diff --git a/.changeset/move-same-bucket-only.md b/.changeset/move-same-bucket-only.md new file mode 100644 index 0000000..6a6dfde --- /dev/null +++ b/.changeset/move-same-bucket-only.md @@ -0,0 +1,5 @@ +--- +'@tigrisdata/storage': patch +--- + +`move` no longer accepts `srcBucket` / `destBucket` options — cross-bucket moves are not supported by the server. Use `copy` followed by `remove` to move objects between buckets. diff --git a/packages/storage/src/lib/object/move.ts b/packages/storage/src/lib/object/move.ts index 47a0003..69029a5 100644 --- a/packages/storage/src/lib/object/move.ts +++ b/packages/storage/src/lib/object/move.ts @@ -1,13 +1,21 @@ -import type { TigrisStorageResponse } from '../types'; -import { type CopyOptions, type CopyResponse, copyOrMove } from './copy'; +import type { TigrisStorageConfig, TigrisStorageResponse } from '../types'; +import { type CopyResponse, copyOrMove } from './copy'; + +export type MoveOptions = { + config?: TigrisStorageConfig; +}; -export type MoveOptions = CopyOptions; export type MoveResponse = CopyResponse; +/** + * Move (rename) an object within a bucket. Cross-bucket moves are not + * supported by the server; use `copy` followed by `remove` if you need + * to move between buckets. + */ export async function move( src: string, dest: string, options?: MoveOptions ): Promise> { - return copyOrMove(src, dest, true, options); + return copyOrMove(src, dest, true, { config: options?.config }); }