@nestm/storage 0.1.0-alpha.6 → 0.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +398 -19
  3. package/SECURITY.md +69 -0
  4. package/dist/ai-sdk/ai-sdk-workspace-tools.d.ts +74 -0
  5. package/dist/ai-sdk/ai-sdk-workspace-tools.d.ts.map +1 -0
  6. package/dist/ai-sdk/ai-sdk-workspace-tools.js +414 -0
  7. package/dist/ai-sdk/ai-sdk-workspace-tools.js.map +1 -0
  8. package/dist/ai-sdk/index.d.ts +2 -0
  9. package/dist/ai-sdk/index.d.ts.map +1 -0
  10. package/dist/ai-sdk/index.js +2 -0
  11. package/dist/ai-sdk/index.js.map +1 -0
  12. package/dist/files-sdk/files-sdk.driver.d.ts +64 -6
  13. package/dist/files-sdk/files-sdk.driver.d.ts.map +1 -1
  14. package/dist/files-sdk/files-sdk.driver.js +918 -38
  15. package/dist/files-sdk/files-sdk.driver.js.map +1 -1
  16. package/dist/files-sdk/fs/index.d.ts +21 -2
  17. package/dist/files-sdk/fs/index.d.ts.map +1 -1
  18. package/dist/files-sdk/fs/index.js +833 -1
  19. package/dist/files-sdk/fs/index.js.map +1 -1
  20. package/dist/files-sdk/index.d.ts +1 -1
  21. package/dist/files-sdk/index.d.ts.map +1 -1
  22. package/dist/files-sdk/index.js.map +1 -1
  23. package/dist/files-sdk/provider/index.d.ts +9 -5
  24. package/dist/files-sdk/provider/index.d.ts.map +1 -1
  25. package/dist/files-sdk/provider/index.js +60 -15
  26. package/dist/files-sdk/provider/index.js.map +1 -1
  27. package/dist/files-sdk/s3/construction-metadata.d.ts +7 -0
  28. package/dist/files-sdk/s3/construction-metadata.d.ts.map +1 -0
  29. package/dist/files-sdk/s3/construction-metadata.js +13 -0
  30. package/dist/files-sdk/s3/construction-metadata.js.map +1 -0
  31. package/dist/files-sdk/s3/index.d.ts +43 -14
  32. package/dist/files-sdk/s3/index.d.ts.map +1 -1
  33. package/dist/files-sdk/s3/index.js +1046 -57
  34. package/dist/files-sdk/s3/index.js.map +1 -1
  35. package/dist/gateway/storage-gateway.controller.d.ts.map +1 -1
  36. package/dist/gateway/storage-gateway.controller.js +25 -5
  37. package/dist/gateway/storage-gateway.controller.js.map +1 -1
  38. package/dist/storage-etag.d.ts +13 -0
  39. package/dist/storage-etag.d.ts.map +1 -0
  40. package/dist/storage-etag.js +31 -0
  41. package/dist/storage-etag.js.map +1 -0
  42. package/dist/storage.client.d.ts +7 -1
  43. package/dist/storage.client.d.ts.map +1 -1
  44. package/dist/storage.client.js +124 -10
  45. package/dist/storage.client.js.map +1 -1
  46. package/dist/storage.driver.d.ts +23 -1
  47. package/dist/storage.driver.d.ts.map +1 -1
  48. package/dist/storage.driver.js.map +1 -1
  49. package/dist/storage.service.d.ts.map +1 -1
  50. package/dist/storage.service.js +28 -3
  51. package/dist/storage.service.js.map +1 -1
  52. package/dist/storage.types.d.ts +113 -6
  53. package/dist/storage.types.d.ts.map +1 -1
  54. package/dist/storage.types.js.map +1 -1
  55. package/dist/testing/index.d.ts +1 -0
  56. package/dist/testing/index.d.ts.map +1 -1
  57. package/dist/testing/index.js +1 -0
  58. package/dist/testing/index.js.map +1 -1
  59. package/dist/testing/provider-conformance.d.ts +65 -0
  60. package/dist/testing/provider-conformance.d.ts.map +1 -0
  61. package/dist/testing/provider-conformance.js +853 -0
  62. package/dist/testing/provider-conformance.js.map +1 -0
  63. package/dist/workspace/index.d.ts +5 -0
  64. package/dist/workspace/index.d.ts.map +1 -0
  65. package/dist/workspace/index.js +5 -0
  66. package/dist/workspace/index.js.map +1 -0
  67. package/dist/workspace/storage-workspace.cursor.d.ts +71 -0
  68. package/dist/workspace/storage-workspace.cursor.d.ts.map +1 -0
  69. package/dist/workspace/storage-workspace.cursor.js +408 -0
  70. package/dist/workspace/storage-workspace.cursor.js.map +1 -0
  71. package/dist/workspace/storage-workspace.d.ts +6 -0
  72. package/dist/workspace/storage-workspace.d.ts.map +1 -0
  73. package/dist/workspace/storage-workspace.error.d.ts +28 -0
  74. package/dist/workspace/storage-workspace.error.d.ts.map +1 -0
  75. package/dist/workspace/storage-workspace.error.js +67 -0
  76. package/dist/workspace/storage-workspace.error.js.map +1 -0
  77. package/dist/workspace/storage-workspace.js +755 -0
  78. package/dist/workspace/storage-workspace.js.map +1 -0
  79. package/dist/workspace/storage-workspace.path.d.ts +9 -0
  80. package/dist/workspace/storage-workspace.path.d.ts.map +1 -0
  81. package/dist/workspace/storage-workspace.path.js +68 -0
  82. package/dist/workspace/storage-workspace.path.js.map +1 -0
  83. package/dist/workspace/storage-workspace.types.d.ts +105 -0
  84. package/dist/workspace/storage-workspace.types.d.ts.map +1 -0
  85. package/dist/workspace/storage-workspace.types.js +21 -0
  86. package/dist/workspace/storage-workspace.types.js.map +1 -0
  87. package/package.json +24 -5
@@ -0,0 +1,13 @@
1
+ /** Maximum UTF-8 byte length of a normalized storage ETag. */
2
+ export declare const MAX_STORAGE_ETAG_BYTES = 1024;
3
+ /** Returns whether a value is the package's canonical bare ETag form. */
4
+ export declare function isCanonicalStorageEtag(value: unknown): value is string;
5
+ /**
6
+ * Normalizes one provider-returned strong entity tag to the canonical bare
7
+ * form. Providers may return either the HTTP-quoted representation or an
8
+ * already-normalized value; lists, weak tags, and malformed values fail.
9
+ */
10
+ export declare function normalizeProviderStorageEtag(value: unknown): string | undefined;
11
+ /** Serializes one canonical bare ETag as exactly one HTTP entity tag. */
12
+ export declare function storageEtagHeader(value: unknown): string | undefined;
13
+ //# sourceMappingURL=storage-etag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-etag.d.ts","sourceRoot":"","sources":["../src/storage-etag.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAQ3C,yEAAyE;AACzE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,SAAS,CASpB;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEpE"}
@@ -0,0 +1,31 @@
1
+ /** Maximum UTF-8 byte length of a normalized storage ETag. */
2
+ export const MAX_STORAGE_ETAG_BYTES = 1024;
3
+ // Deliberately narrower than RFC 9110's etagc grammar. Commas and backslashes
4
+ // are excluded so a normalized value cannot be confused with an entity-tag
5
+ // list or be interpreted differently by legacy HTTP implementations.
6
+ const canonicalStorageEtag = /^(?!\*$)(?![Ww]\/)[\x21\x23-\x2B\x2D-\x5B\x5D-\x7E]+$/u;
7
+ /** Returns whether a value is the package's canonical bare ETag form. */
8
+ export function isCanonicalStorageEtag(value) {
9
+ return (typeof value === 'string' &&
10
+ value.length <= MAX_STORAGE_ETAG_BYTES &&
11
+ canonicalStorageEtag.test(value));
12
+ }
13
+ /**
14
+ * Normalizes one provider-returned strong entity tag to the canonical bare
15
+ * form. Providers may return either the HTTP-quoted representation or an
16
+ * already-normalized value; lists, weak tags, and malformed values fail.
17
+ */
18
+ export function normalizeProviderStorageEtag(value) {
19
+ if (typeof value !== 'string') {
20
+ return undefined;
21
+ }
22
+ const opaque = value.startsWith('"') && value.endsWith('"') && value.length >= 3
23
+ ? value.slice(1, -1)
24
+ : value;
25
+ return isCanonicalStorageEtag(opaque) ? opaque : undefined;
26
+ }
27
+ /** Serializes one canonical bare ETag as exactly one HTTP entity tag. */
28
+ export function storageEtagHeader(value) {
29
+ return isCanonicalStorageEtag(value) ? `"${value}"` : undefined;
30
+ }
31
+ //# sourceMappingURL=storage-etag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-etag.js","sourceRoot":"","sources":["../src/storage-etag.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,8EAA8E;AAC9E,2EAA2E;AAC3E,qEAAqE;AACrE,MAAM,oBAAoB,GACxB,wDAAwD,CAAC;AAE3D,yEAAyE;AACzE,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,MAAM,IAAI,sBAAsB;QACtC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CACjC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAc;IAEd,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GACV,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAC/D,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC;IACZ,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC","sourcesContent":["/** Maximum UTF-8 byte length of a normalized storage ETag. */\nexport const MAX_STORAGE_ETAG_BYTES = 1024;\n\n// Deliberately narrower than RFC 9110's etagc grammar. Commas and backslashes\n// are excluded so a normalized value cannot be confused with an entity-tag\n// list or be interpreted differently by legacy HTTP implementations.\nconst canonicalStorageEtag =\n /^(?!\\*$)(?![Ww]\\/)[\\x21\\x23-\\x2B\\x2D-\\x5B\\x5D-\\x7E]+$/u;\n\n/** Returns whether a value is the package's canonical bare ETag form. */\nexport function isCanonicalStorageEtag(value: unknown): value is string {\n return (\n typeof value === 'string' &&\n value.length <= MAX_STORAGE_ETAG_BYTES &&\n canonicalStorageEtag.test(value)\n );\n}\n\n/**\n * Normalizes one provider-returned strong entity tag to the canonical bare\n * form. Providers may return either the HTTP-quoted representation or an\n * already-normalized value; lists, weak tags, and malformed values fail.\n */\nexport function normalizeProviderStorageEtag(\n value: unknown,\n): string | undefined {\n if (typeof value !== 'string') {\n return undefined;\n }\n const opaque =\n value.startsWith('\"') && value.endsWith('\"') && value.length >= 3\n ? value.slice(1, -1)\n : value;\n return isCanonicalStorageEtag(opaque) ? opaque : undefined;\n}\n\n/** Serializes one canonical bare ETag as exactly one HTTP entity tag. */\nexport function storageEtagHeader(value: unknown): string | undefined {\n return isCanonicalStorageEtag(value) ? `\"${value}\"` : undefined;\n}\n"]}
@@ -1,17 +1,20 @@
1
1
  import type { StorageDriver } from './storage.driver.js';
2
- import type { StorageBody, StorageBufferedDownloadOptions, StorageBulkOptions, StorageCapabilities, StorageDeleteManyResult, StorageDownloadManyResult, StorageDownloadOptions, StorageExistsManyResult, StorageHeadManyResult, StorageListOptions, StorageListResult, StorageObject, StorageObjectMetadata, StorageOperationOptions, StoragePlugin, StoragePromotionOptions, StorageSearchOptions, StorageSignedDownloadOptions, StorageSignedUpload, StorageSignedUploadOptions, StorageUploadManyItem, StorageUploadManyOptions, StorageUploadManyResult, StorageUploadOptions, StorageUploadResult } from './storage.types.js';
2
+ import type { StorageBody, StorageBufferedDownloadOptions, StorageBulkOptions, StorageCapabilities, StorageConditionalDeleteOptions, StorageConditionalReadOptions, StorageConditionalUploadOptions, StorageDeleteManyResult, StorageDownloadManyResult, StorageDownloadOptions, StorageExistsManyResult, StorageHeadManyResult, StorageListOptions, StorageListResult, StorageObject, StorageObjectMetadata, StorageOperationOptions, StoragePlugin, StoragePromotionOptions, StorageSearchOptions, StorageSignedDownloadOptions, StorageSignedUpload, StorageSignedUploadOptions, StorageUploadManyItem, StorageUploadManyOptions, StorageUploadManyResult, StorageUploadOptions, StorageUploadResult } from './storage.types.js';
3
3
  export declare const DEFAULT_BUFFER_LIMIT: number;
4
4
  type BulkOperationOptions = StorageBulkOptions & StorageOperationOptions;
5
5
  type DownloadManyOptions = StorageBulkOptions & StorageDownloadOptions;
6
6
  export interface StorageFileHandle {
7
7
  readonly key: string;
8
8
  upload(body: StorageBody, options?: StorageUploadOptions): Promise<StorageUploadResult>;
9
+ uploadConditional(body: StorageBody, options: StorageConditionalUploadOptions): Promise<StorageUploadResult>;
9
10
  download(options?: StorageDownloadOptions): Promise<StorageObject>;
11
+ downloadConditional(options: StorageConditionalReadOptions): Promise<StorageObject>;
10
12
  bytes(options?: StorageBufferedDownloadOptions): Promise<Uint8Array>;
11
13
  text(options?: StorageBufferedDownloadOptions): Promise<string>;
12
14
  head(options?: StorageOperationOptions): Promise<StorageObjectMetadata>;
13
15
  exists(options?: StorageOperationOptions): Promise<boolean>;
14
16
  delete(options?: StorageOperationOptions): Promise<void>;
17
+ deleteConditional(options: StorageConditionalDeleteOptions): Promise<void>;
15
18
  signDownload(options?: StorageSignedDownloadOptions): Promise<string>;
16
19
  signUpload(options: StorageSignedUploadOptions): Promise<StorageSignedUpload>;
17
20
  copyTo(destinationKey: string, options?: StorageOperationOptions): Promise<void>;
@@ -27,13 +30,16 @@ export declare class StorageClient {
27
30
  get capabilities(): Readonly<StorageCapabilities>;
28
31
  file(key: string): StorageFileHandle;
29
32
  upload(key: string, body: StorageBody, options?: StorageUploadOptions): Promise<StorageUploadResult>;
33
+ uploadConditional(key: string, body: StorageBody, options: StorageConditionalUploadOptions): Promise<StorageUploadResult>;
30
34
  downloadStream(key: string, options?: StorageDownloadOptions): Promise<StorageObject>;
35
+ downloadConditional(key: string, options: StorageConditionalReadOptions): Promise<StorageObject>;
31
36
  downloadBytes(key: string, options?: StorageBufferedDownloadOptions): Promise<Uint8Array>;
32
37
  downloadText(key: string, options?: StorageBufferedDownloadOptions): Promise<string>;
33
38
  downloadJson<Result = unknown>(key: string, options?: StorageBufferedDownloadOptions): Promise<Result>;
34
39
  head(key: string, options?: StorageOperationOptions): Promise<StorageObjectMetadata>;
35
40
  exists(key: string, options?: StorageOperationOptions): Promise<boolean>;
36
41
  delete(key: string, options?: StorageOperationOptions): Promise<void>;
42
+ deleteConditional(key: string, options: StorageConditionalDeleteOptions): Promise<void>;
37
43
  copy(sourceKey: string, destinationKey: string, options?: StorageOperationOptions): Promise<void>;
38
44
  move(sourceKey: string, destinationKey: string, options?: StorageOperationOptions): Promise<void>;
39
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"storage.client.d.ts","sourceRoot":"","sources":["../src/storage.client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,8BAA8B,EAC9B,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EAErB,uBAAuB,EACvB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,4BAA4B,EAC5B,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAErD,KAAK,oBAAoB,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AACzE,KAAK,mBAAmB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAqKvE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,MAAM,CACJ,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,oBAAoB,GA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vB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAWhC;IAEK,UAAU,CACd,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAiBlC;IAEK,UAAU,CACd,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAclC;IAEK,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM3C;CA+BF"}
@@ -1,4 +1,5 @@
1
1
  import { settleMany } from './internal/settle-many.js';
2
+ import { isCanonicalStorageEtag } from './storage-etag.js';
2
3
  import { StorageError, StorageErrorCode, normalizeStorageError, } from './storage.error.js';
3
4
  export const DEFAULT_BUFFER_LIMIT = 10 * 1024 * 1024;
4
5
  function assertKey(key, label = 'key') {
@@ -146,7 +147,9 @@ export class StorageClient {
146
147
  return {
147
148
  copyTo: (destinationKey, options) => this.copy(key, destinationKey, options),
148
149
  delete: (options) => this.delete(key, options),
150
+ deleteConditional: (options) => this.deleteConditional(key, options),
149
151
  download: (options) => this.downloadStream(key, options),
152
+ downloadConditional: (options) => this.downloadConditional(key, options),
150
153
  exists: (options) => this.exists(key, options),
151
154
  head: (options) => this.head(key, options),
152
155
  key,
@@ -157,17 +160,88 @@ export class StorageClient {
157
160
  bytes: (options) => this.downloadBytes(key, options),
158
161
  text: (options) => this.downloadText(key, options),
159
162
  upload: (body, options) => this.upload(key, body, options),
163
+ uploadConditional: (body, options) => this.uploadConditional(key, body, options),
160
164
  };
161
165
  }
162
166
  upload(key, body, options) {
163
167
  assertKey(key);
164
168
  return this.#execute({ key, operation: 'upload', store: this.name }, () => this.#driver.upload(key, body, options));
165
169
  }
170
+ uploadConditional(key, body, options) {
171
+ assertKey(key);
172
+ const condition = options.condition;
173
+ if (condition === undefined ||
174
+ (condition.type !== 'create' && condition.type !== 'replace')) {
175
+ invalidArgument('condition.type must be "create" or "replace".');
176
+ }
177
+ if (condition.type === 'replace' &&
178
+ !isCanonicalStorageEtag(condition.etag)) {
179
+ invalidArgument('condition.etag must be a canonical storage ETag.');
180
+ }
181
+ const capability = condition.type === 'create'
182
+ ? this.#driver.capabilities.conditionalCreate
183
+ : this.#driver.capabilities.conditionalReplace;
184
+ const uploadConditional = this.#driver.uploadConditional;
185
+ const multipartRequested = options.multipart !== undefined && options.multipart !== false;
186
+ const multipartCapability = this.#driver.capabilities.conditionalMultipartCompletion;
187
+ const multipartSupported = !multipartRequested ||
188
+ (condition.type === 'create'
189
+ ? multipartCapability?.create === true
190
+ : multipartCapability?.replace === true);
191
+ if (capability === undefined ||
192
+ !multipartSupported ||
193
+ uploadConditional === undefined) {
194
+ throw new StorageError(`Store "${this.name}" does not support the requested conditional upload.`, {
195
+ code: StorageErrorCode.NOT_SUPPORTED,
196
+ key,
197
+ operation: 'upload',
198
+ permanent: true,
199
+ store: this.name,
200
+ });
201
+ }
202
+ return this.#execute({ key, operation: 'upload', store: this.name }, () => uploadConditional.call(this.#driver, key, body, options));
203
+ }
166
204
  downloadStream(key, options) {
167
205
  assertKey(key);
168
206
  assertDownloadOptions(options);
169
207
  return this.#execute({ key, operation: 'download', store: this.name }, () => this.#driver.download(key, options));
170
208
  }
209
+ downloadConditional(key, options) {
210
+ assertKey(key);
211
+ assertDownloadOptions(options);
212
+ if (options === undefined ||
213
+ options.condition === undefined ||
214
+ typeof options.condition !== 'object' ||
215
+ options.condition === null) {
216
+ invalidArgument('conditional read requires a condition object.');
217
+ }
218
+ const { etag, version } = options.condition;
219
+ if (etag !== undefined && !isCanonicalStorageEtag(etag)) {
220
+ invalidArgument('condition.etag must be a canonical storage ETag.');
221
+ }
222
+ if (version !== undefined &&
223
+ (typeof version !== 'string' || version.length === 0)) {
224
+ invalidArgument('condition.version must be a non-empty string.');
225
+ }
226
+ if (etag === undefined && version === undefined) {
227
+ invalidArgument('conditional read requires an etag, version, or both.');
228
+ }
229
+ const capability = this.#driver.capabilities.conditionalRead;
230
+ const downloadConditional = this.#driver.downloadConditional;
231
+ if (downloadConditional === undefined ||
232
+ capability === undefined ||
233
+ (etag !== undefined && !capability.etag) ||
234
+ (version !== undefined && !capability.version)) {
235
+ throw new StorageError(`Store "${this.name}" does not support the requested conditional read.`, {
236
+ code: StorageErrorCode.NOT_SUPPORTED,
237
+ key,
238
+ operation: 'download',
239
+ permanent: true,
240
+ store: this.name,
241
+ });
242
+ }
243
+ return this.#execute({ key, operation: 'download', store: this.name }, () => downloadConditional.call(this.#driver, key, options));
244
+ }
171
245
  async downloadBytes(key, options) {
172
246
  const { maxBytes = DEFAULT_BUFFER_LIMIT, ...download } = options ?? {};
173
247
  const object = await this.downloadStream(key, download);
@@ -204,6 +278,25 @@ export class StorageClient {
204
278
  assertKey(key);
205
279
  return this.#execute({ key, operation: 'delete', store: this.name }, () => this.#driver.delete(key, options));
206
280
  }
281
+ deleteConditional(key, options) {
282
+ assertKey(key);
283
+ if (options.condition === undefined ||
284
+ !isCanonicalStorageEtag(options.condition.etag)) {
285
+ invalidArgument('condition.etag must be a canonical storage ETag.');
286
+ }
287
+ const capability = this.#driver.capabilities.conditionalDelete;
288
+ const deleteConditional = this.#driver.deleteConditional;
289
+ if (capability?.etag !== true || deleteConditional === undefined) {
290
+ throw new StorageError(`Store "${this.name}" does not support conditional delete.`, {
291
+ code: StorageErrorCode.NOT_SUPPORTED,
292
+ key,
293
+ operation: 'delete',
294
+ permanent: true,
295
+ store: this.name,
296
+ });
297
+ }
298
+ return this.#execute({ key, operation: 'delete', store: this.name }, () => deleteConditional.call(this.#driver, key, options));
299
+ }
207
300
  copy(sourceKey, destinationKey, options) {
208
301
  assertKey(sourceKey, 'source key');
209
302
  assertKey(destinationKey, 'destination key');
@@ -233,21 +326,42 @@ export class StorageClient {
233
326
  assertKey(destinationKey, 'destination key');
234
327
  const sourceEtag = options.sourceEtag;
235
328
  const sourceVersion = options.sourceVersion;
236
- if (sourceEtag !== undefined && sourceEtag.length === 0) {
237
- invalidArgument('sourceEtag must be a non-empty string.');
329
+ if (sourceEtag !== undefined && !isCanonicalStorageEtag(sourceEtag)) {
330
+ invalidArgument('sourceEtag must be a canonical storage ETag.');
238
331
  }
239
- if (sourceVersion !== undefined && sourceVersion.length === 0) {
332
+ if (sourceVersion !== undefined &&
333
+ (typeof sourceVersion !== 'string' || sourceVersion.length === 0)) {
240
334
  invalidArgument('sourceVersion must be a non-empty string.');
241
335
  }
242
- if (sourceEtag === undefined && sourceVersion === undefined) {
243
- invalidArgument('promote requires sourceEtag, sourceVersion, or both.');
336
+ const destination = options.destination;
337
+ if (destination !== undefined &&
338
+ (typeof destination !== 'object' ||
339
+ destination === null ||
340
+ (destination.type !== 'create' && destination.type !== 'replace'))) {
341
+ invalidArgument('destination.type must be "create" or "replace".');
342
+ }
343
+ if (sourceEtag === undefined &&
344
+ sourceVersion === undefined &&
345
+ destination === undefined) {
346
+ invalidArgument('promote requires a source or destination precondition.');
347
+ }
348
+ if (destination?.type === 'replace' &&
349
+ !isCanonicalStorageEtag(destination.etag)) {
350
+ invalidArgument('destination.etag must be a canonical storage ETag.');
244
351
  }
245
- const capability = this.#driver.capabilities.conditionalCopy;
352
+ const sourceCapability = this.#driver.capabilities.conditionalCopySource;
353
+ const destinationCapability = this.#driver.capabilities.conditionalCopyDestination;
246
354
  const promote = this.#driver.promote;
247
- if (capability?.supported !== true ||
248
- promote === undefined ||
249
- (sourceEtag !== undefined && !capability.etag) ||
250
- (sourceVersion !== undefined && !capability.version)) {
355
+ if (promote === undefined ||
356
+ (sourceEtag !== undefined && sourceCapability?.etag !== true) ||
357
+ (sourceVersion !== undefined && sourceCapability?.version !== true) ||
358
+ (destination?.type === 'create' &&
359
+ destinationCapability?.create !== true) ||
360
+ (destination?.type === 'replace' &&
361
+ destinationCapability?.replace !== true) ||
362
+ (destination !== undefined &&
363
+ (sourceEtag !== undefined || sourceVersion !== undefined) &&
364
+ destinationCapability?.atomicWithSource !== true)) {
251
365
  throw new StorageError(`Store "${this.name}" does not support the requested conditional promotion.`, {
252
366
  code: StorageErrorCode.NOT_SUPPORTED,
253
367
  key: sourceKey,
@@ -1 +1 @@
1
- {"version":3,"file":"storage.client.js","sourceRoot":"","sources":["../src/storage.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AA+B5B,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAKrD,SAAS,SAAS,CAAC,GAAW,EAAE,KAAK,GAAG,KAAK;IAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,YAAY,CAAC,GAAG,KAAK,8BAA8B,EAAE;YAC7D,IAAI,EAAE,gBAAgB,CAAC,gBAAgB;YACvC,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE;QAC9B,IAAI,EAAE,gBAAgB,CAAC,gBAAgB;QACvC,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,yBAAyB,CAChC,KAAyB,EACzB,KAAa;IAEb,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC;QACxE,eAAe,CAAC,GAAG,KAAK,mCAAmC,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAgC;IAC7D,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;IAC7B,IAAI,KAAK,KAAK,SAAS,E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AAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC;CACF","sourcesContent":["import { settleMany } from './internal/settle-many.js';\nimport {\n StorageError,\n StorageErrorCode,\n normalizeStorageError,\n} from './storage.error.js';\nimport type { StorageDriver } from './storage.driver.js';\nimport type {\n StorageBody,\n StorageBufferedDownloadOptions,\n StorageBulkOptions,\n StorageCapabilities,\n StorageDeleteManyResult,\n StorageDownloadManyResult,\n StorageDownloadOptions,\n StorageExistsManyResult,\n StorageHeadManyResult,\n StorageListOptions,\n StorageListResult,\n StorageObject,\n StorageObjectMetadata,\n StorageOperationContext,\n StorageOperationOptions,\n StoragePlugin,\n StoragePromotionOptions,\n StorageSearchOptions,\n StorageSignedDownloadOptions,\n StorageSignedUpload,\n StorageSignedUploadOptions,\n StorageUploadManyItem,\n StorageUploadManyOptions,\n StorageUploadManyResult,\n StorageUploadOptions,\n StorageUploadResult,\n} from './storage.types.js';\n\nexport const DEFAULT_BUFFER_LIMIT = 10 * 1024 * 1024;\n\ntype BulkOperationOptions = StorageBulkOptions & StorageOperationOptions;\ntype DownloadManyOptions = StorageBulkOptions & StorageDownloadOptions;\n\nfunction assertKey(key: string, label = 'key'): void {\n if (typeof key !== 'string' || key.length === 0) {\n throw new StorageError(`${label} must be a non-empty string.`, {\n code: StorageErrorCode.INVALID_ARGUMENT,\n permanent: true,\n });\n }\n}\n\nfunction invalidArgument(message: string): never {\n throw new StorageError(message, {\n code: StorageErrorCode.INVALID_ARGUMENT,\n permanent: true,\n });\n}\n\nfunction assertPositiveSafeInteger(\n value: number | undefined,\n label: string,\n): void {\n if (value !== undefined && (!Number.isSafeInteger(value) || value <= 0)) {\n invalidArgument(`${label} must be a positive safe integer.`);\n }\n}\n\nfunction assertDownloadOptions(options?: StorageDownloadOptions): void {\n const range = options?.range;\n if (range === undefined) {\n return;\n }\n if (!Number.isSafeInteger(range.start) || range.start < 0) {\n invalidArgument('range.start must be a non-negative safe integer.');\n }\n if (\n range.end !== undefined &&\n (!Number.isSafeInteger(range.end) || range.end < range.start)\n ) {\n invalidArgument(\n 'range.end must be a safe integer greater than or equal to range.start.',\n );\n }\n}\n\nfunction assertListOptions(options?: StorageListOptions): void {\n if (options?.delimiter !== undefined && options.delimiter.length === 0) {\n invalidArgument('delimiter must be a non-empty string.');\n }\n assertPositiveSafeInteger(options?.limit, 'limit');\n}\n\nfunction assertSearchOptions(options?: StorageSearchOptions): void {\n assertPositiveSafeInteger(options?.limit, 'limit');\n assertPositiveSafeInteger(options?.maxResults, 'maxResults');\n}\n\nfunction assertSignedUploadOptions(options: StorageSignedUploadOptions): void {\n assertPositiveSafeInteger(options.expiresIn, 'expiresIn');\n assertPositiveSafeInteger(options.maxSize, 'maxSize');\n if (\n options.minSize !== undefined &&\n (!Number.isSafeInteger(options.minSize) || options.minSize < 0)\n ) {\n invalidArgument('minSize must be a non-negative safe integer.');\n }\n if (\n options.minSize !== undefined &&\n options.maxSize !== undefined &&\n options.minSize > options.maxSize\n ) {\n invalidArgument('minSize cannot be greater than maxSize.');\n }\n}\n\nfunction operationOptions(\n options?: BulkOperationOptions,\n): StorageOperationOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...(options.retries !== undefined && { retries: options.retries }),\n ...(options.signal !== undefined && { signal: options.signal }),\n ...(options.timeout !== undefined && { timeout: options.timeout }),\n };\n}\n\nfunction downloadOptions(\n options?: DownloadManyOptions,\n): StorageDownloadOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.range !== undefined && { range: options.range }),\n };\n}\n\nasync function collectBody(\n object: StorageObject,\n maxBytes: number,\n): Promise<Uint8Array> {\n if (maxBytes !== Infinity && (!Number.isFinite(maxBytes) || maxBytes < 0)) {\n await object.body.cancel().catch(() => undefined);\n throw new StorageError(\n 'maxBytes must be a non-negative finite number or Infinity.',\n {\n code: StorageErrorCode.INVALID_ARGUMENT,\n key: object.key,\n permanent: true,\n },\n );\n }\n\n if (maxBytes !== Infinity && object.size > maxBytes) {\n await object.body.cancel().catch(() => undefined);\n throw new StorageError(\n `Object \"${object.key}\" is ${object.size} bytes, exceeding the ${maxBytes}-byte buffer limit.`,\n {\n code: StorageErrorCode.LIMIT_EXCEEDED,\n key: object.key,\n permanent: true,\n },\n );\n }\n\n const chunks: Uint8Array[] = [];\n let total = 0;\n const reader = object.body.getReader();\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n total += value.byteLength;\n if (maxBytes !== Infinity && total > maxBytes) {\n await reader.cancel().catch(() => undefined);\n throw new StorageError(\n `Object \"${object.key}\" exceeded the ${maxBytes}-byte buffer limit while downloading.`,\n {\n code: StorageErrorCode.LIMIT_EXCEEDED,\n key: object.key,\n permanent: true,\n },\n );\n }\n chunks.push(value);\n }\n } finally {\n reader.releaseLock();\n }\n\n const bytes = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return bytes;\n}\n\nexport interface StorageFileHandle {\n readonly key: string;\n upload(\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult>;\n download(options?: StorageDownloadOptions): Promise<StorageObject>;\n bytes(options?: StorageBufferedDownloadOptions): Promise<Uint8Array>;\n text(options?: StorageBufferedDownloadOptions): Promise<string>;\n head(options?: StorageOperationOptions): Promise<StorageObjectMetadata>;\n exists(options?: StorageOperationOptions): Promise<boolean>;\n delete(options?: StorageOperationOptions): Promise<void>;\n signDownload(options?: StorageSignedDownloadOptions): Promise<string>;\n signUpload(options: StorageSignedUploadOptions): Promise<StorageSignedUpload>;\n copyTo(\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n moveTo(\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n /** Conditionally copies this staged object and deliberately retains it. */\n promoteTo(\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void>;\n}\n\nexport class StorageClient {\n readonly #driver: StorageDriver;\n readonly #plugins: readonly StoragePlugin[];\n #closed = false;\n\n constructor(\n readonly name: string,\n driver: StorageDriver,\n plugins: readonly StoragePlugin[] = [],\n ) {\n assertKey(name, 'store name');\n this.#driver = driver;\n this.#plugins = [...plugins];\n }\n\n get driverName(): string {\n return this.#driver.name;\n }\n\n get capabilities(): Readonly<StorageCapabilities> {\n return this.#driver.capabilities;\n }\n\n file(key: string): StorageFileHandle {\n assertKey(key);\n return {\n copyTo: (destinationKey, options) =>\n this.copy(key, destinationKey, options),\n delete: (options) => this.delete(key, options),\n download: (options) => this.downloadStream(key, options),\n exists: (options) => this.exists(key, options),\n head: (options) => this.head(key, options),\n key,\n moveTo: (destinationKey, options) =>\n this.move(key, destinationKey, options),\n promoteTo: (destinationKey, options) =>\n this.promote(key, destinationKey, options),\n signDownload: (options) => this.signDownload(key, options),\n signUpload: (options) => this.signUpload(key, options),\n bytes: (options) => this.downloadBytes(key, options),\n text: (options) => this.downloadText(key, options),\n upload: (body, options) => this.upload(key, body, options),\n };\n }\n\n upload(\n key: string,\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult> {\n assertKey(key);\n return this.#execute({ key, operation: 'upload', store: this.name }, () =>\n this.#driver.upload(key, body, options),\n );\n }\n\n downloadStream(\n key: string,\n options?: StorageDownloadOptions,\n ): Promise<StorageObject> {\n assertKey(key);\n assertDownloadOptions(options);\n return this.#execute({ key, operation: 'download', store: this.name }, () =>\n this.#driver.download(key, options),\n );\n }\n\n async downloadBytes(\n key: string,\n options?: StorageBufferedDownloadOptions,\n ): Promise<Uint8Array> {\n const { maxBytes = DEFAULT_BUFFER_LIMIT, ...download } = options ?? {};\n const object = await this.downloadStream(key, download);\n return collectBody(object, maxBytes);\n }\n\n async downloadText(\n key: string,\n options?: StorageBufferedDownloadOptions,\n ): Promise<string> {\n return new TextDecoder().decode(await this.downloadBytes(key, options));\n }\n\n async downloadJson<Result = unknown>(\n key: string,\n options?: StorageBufferedDownloadOptions,\n ): Promise<Result> {\n const text = await this.downloadText(key, options);\n try {\n return JSON.parse(text) as Result;\n } catch (error) {\n throw new StorageError(`Object \"${key}\" does not contain valid JSON.`, {\n cause: error,\n code: StorageErrorCode.INVALID_ARGUMENT,\n key,\n operation: 'download',\n permanent: true,\n store: this.name,\n });\n }\n }\n\n head(\n key: string,\n options?: StorageOperationOptions,\n ): Promise<StorageObjectMetadata> {\n assertKey(key);\n return this.#execute({ key, operation: 'head', store: this.name }, () =>\n this.#driver.head(key, options),\n );\n }\n\n exists(key: string, options?: StorageOperationOptions): Promise<boolean> {\n assertKey(key);\n return this.#execute({ key, operation: 'exists', store: this.name }, () =>\n this.#driver.exists(key, options),\n );\n }\n\n delete(key: string, options?: StorageOperationOptions): Promise<void> {\n assertKey(key);\n return this.#execute({ key, operation: 'delete', store: this.name }, () =>\n this.#driver.delete(key, options),\n );\n }\n\n copy(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n assertKey(sourceKey, 'source key');\n assertKey(destinationKey, 'destination key');\n return this.#execute(\n {\n from: sourceKey,\n operation: 'copy',\n store: this.name,\n to: destinationKey,\n },\n () => this.#driver.copy(sourceKey, destinationKey, options),\n );\n }\n\n move(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n assertKey(sourceKey, 'source key');\n assertKey(destinationKey, 'destination key');\n return this.#execute(\n {\n from: sourceKey,\n operation: 'move',\n store: this.name,\n to: destinationKey,\n },\n () => this.#driver.move(sourceKey, destinationKey, options),\n );\n }\n\n /**\n * Conditionally copies a staged object to a final key. This operation does\n * not delete the source; delete it after the application commit succeeds.\n */\n promote(\n sourceKey: string,\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void> {\n assertKey(sourceKey, 'source key');\n assertKey(destinationKey, 'destination key');\n const sourceEtag = options.sourceEtag;\n const sourceVersion = options.sourceVersion;\n if (sourceEtag !== undefined && sourceEtag.length === 0) {\n invalidArgument('sourceEtag must be a non-empty string.');\n }\n if (sourceVersion !== undefined && sourceVersion.length === 0) {\n invalidArgument('sourceVersion must be a non-empty string.');\n }\n if (sourceEtag === undefined && sourceVersion === undefined) {\n invalidArgument('promote requires sourceEtag, sourceVersion, or both.');\n }\n\n const capability = this.#driver.capabilities.conditionalCopy;\n const promote = this.#driver.promote;\n if (\n capability?.supported !== true ||\n promote === undefined ||\n (sourceEtag !== undefined && !capability.etag) ||\n (sourceVersion !== undefined && !capability.version)\n ) {\n throw new StorageError(\n `Store \"${this.name}\" does not support the requested conditional promotion.`,\n {\n code: StorageErrorCode.NOT_SUPPORTED,\n key: sourceKey,\n operation: 'promote',\n permanent: true,\n store: this.name,\n },\n );\n }\n\n return this.#execute(\n {\n from: sourceKey,\n operation: 'promote',\n store: this.name,\n to: destinationKey,\n },\n () => promote.call(this.#driver, sourceKey, destinationKey, options),\n );\n }\n\n list(options?: StorageListOptions): Promise<StorageListResult> {\n assertListOptions(options);\n return this.#execute({ operation: 'list', store: this.name }, () =>\n this.#driver.list(options),\n );\n }\n\n async *listAll(\n options?: StorageListOptions,\n ): AsyncGenerator<StorageObjectMetadata, void> {\n const { delimiter: _delimiter, ...walkOptions } = options ?? {};\n void _delimiter;\n let cursor = walkOptions.cursor;\n const seen = new Set<string>();\n\n do {\n const page = await this.list({\n ...walkOptions,\n ...(cursor !== undefined && { cursor }),\n });\n yield* page.items;\n cursor = page.cursor;\n if (cursor !== undefined) {\n if (seen.has(cursor)) {\n throw new StorageError(\n `Store \"${this.name}\" returned a repeated pagination cursor.`,\n {\n code: StorageErrorCode.PROVIDER,\n operation: 'list',\n permanent: true,\n store: this.name,\n },\n );\n }\n seen.add(cursor);\n }\n } while (cursor !== undefined);\n }\n\n search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncIterable<StorageObjectMetadata> {\n assertSearchOptions(options);\n return this.#search(pattern, options);\n }\n\n async *#search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncGenerator<StorageObjectMetadata, void> {\n const context: StorageOperationContext = {\n operation: 'search',\n store: this.name,\n };\n try {\n for (const plugin of this.#plugins) {\n await plugin.beforeOperation?.(context);\n }\n for await (const object of this.#driver.search(pattern, options)) {\n yield object;\n }\n for (const plugin of this.#plugins) {\n await plugin.afterOperation?.(context, undefined);\n }\n } catch (error) {\n const normalized = normalizeStorageError(error, {\n operation: 'search',\n store: this.name,\n });\n for (const plugin of this.#plugins) {\n try {\n await plugin.onError?.(context, normalized);\n } catch {\n // Preserve the original storage error.\n }\n }\n throw normalized;\n }\n }\n\n signDownload(\n key: string,\n options?: StorageSignedDownloadOptions,\n ): Promise<string> {\n assertKey(key);\n return this.#execute(\n { key, operation: 'signDownload', store: this.name },\n () => this.#driver.signDownload(key, options),\n );\n }\n\n signUpload(\n key: string,\n options: StorageSignedUploadOptions,\n ): Promise<StorageSignedUpload> {\n assertKey(key);\n assertSignedUploadOptions(options);\n return this.#execute(\n { key, operation: 'signUpload', store: this.name },\n () => this.#driver.signUpload(key, options),\n );\n }\n\n async uploadMany(\n items: readonly StorageUploadManyItem[],\n options?: StorageUploadManyOptions,\n ): Promise<StorageUploadManyResult> {\n const settled = await settleMany(\n items,\n (item) => item.key,\n (item) =>\n this.upload(item.key, item.body, {\n ...operationOptions(options),\n ...(item.cacheControl !== undefined && {\n cacheControl: item.cacheControl,\n }),\n ...(item.contentType !== undefined && {\n contentType: item.contentType,\n }),\n ...(item.metadata !== undefined && { metadata: item.metadata }),\n ...(item.multipart !== undefined && {\n multipart: item.multipart,\n }),\n ...(options?.onProgress !== undefined && {\n onProgress: (progress) =>\n options.onProgress?.({ ...progress, key: item.key }),\n }),\n }),\n options,\n );\n\n return {\n uploaded: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async downloadMany(\n keys: readonly string[],\n options?: DownloadManyOptions,\n ): Promise<StorageDownloadManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n (key) => this.downloadStream(key, downloadOptions(options)),\n options,\n );\n return {\n downloaded: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async headMany(\n keys: readonly string[],\n options?: BulkOperationOptions,\n ): Promise<StorageHeadManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n (key) => this.head(key, operationOptions(options)),\n options,\n );\n return {\n objects: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async existsMany(\n keys: readonly string[],\n options?: BulkOperationOptions,\n ): Promise<StorageExistsManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n async (key) => ({ exists: await this.exists(key, options), key }),\n options,\n );\n const existing: string[] = [];\n const missing: string[] = [];\n for (const result of settled.results) {\n (result.exists ? existing : missing).push(result.key);\n }\n return {\n existing,\n missing,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async deleteMany(\n keys: readonly string[],\n options?: BulkOperationOptions,\n ): Promise<StorageDeleteManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n async (key) => {\n await this.delete(key, operationOptions(options));\n return key;\n },\n options,\n );\n return {\n deleted: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async onApplicationShutdown(): Promise<void> {\n if (this.#closed) {\n return;\n }\n this.#closed = true;\n await this.#driver.close?.();\n }\n\n async #execute<Result>(\n context: StorageOperationContext,\n operation: () => Promise<Result>,\n ): Promise<Result> {\n try {\n for (const plugin of this.#plugins) {\n await plugin.beforeOperation?.(context);\n }\n const result = await operation();\n for (const plugin of this.#plugins) {\n await plugin.afterOperation?.(context, result);\n }\n return result;\n } catch (error) {\n const normalized = normalizeStorageError(error, {\n ...(context.key !== undefined && { key: context.key }),\n operation: context.operation,\n store: this.name,\n });\n for (const plugin of this.#plugins) {\n try {\n await plugin.onError?.(context, normalized);\n } catch {\n // Preserve the original storage error.\n }\n }\n throw normalized;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"storage.client.js","sourceRoot":"","sources":["../src/storage.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAA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AAC,GAAG,EAAE,CAAC;gBACtD,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,KAAK,EAAE,IAAI,CAAC,IAAI;aACjB,CAAC,CAAC;YACH,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnC,IAAI,CAAC;oBACH,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;gBAC9C,CAAC;gBAAC,MAAM,CAAC;oBACP,uCAAuC;gBACzC,CAAC;YACH,CAAC;YACD,MAAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC;CACF","sourcesContent":["import { settleMany } from './internal/settle-many.js';\nimport { isCanonicalStorageEtag } from './storage-etag.js';\nimport {\n StorageError,\n StorageErrorCode,\n normalizeStorageError,\n} from './storage.error.js';\nimport type { StorageDriver } from './storage.driver.js';\nimport type {\n StorageBody,\n StorageBufferedDownloadOptions,\n StorageBulkOptions,\n StorageCapabilities,\n StorageConditionalDeleteOptions,\n StorageConditionalReadOptions,\n StorageConditionalUploadOptions,\n StorageDeleteManyResult,\n StorageDownloadManyResult,\n StorageDownloadOptions,\n StorageExistsManyResult,\n StorageHeadManyResult,\n StorageListOptions,\n StorageListResult,\n StorageObject,\n StorageObjectMetadata,\n StorageOperationContext,\n StorageOperationOptions,\n StoragePlugin,\n StoragePromotionOptions,\n StorageSearchOptions,\n StorageSignedDownloadOptions,\n StorageSignedUpload,\n StorageSignedUploadOptions,\n StorageUploadManyItem,\n StorageUploadManyOptions,\n StorageUploadManyResult,\n StorageUploadOptions,\n StorageUploadResult,\n} from './storage.types.js';\n\nexport const DEFAULT_BUFFER_LIMIT = 10 * 1024 * 1024;\n\ntype BulkOperationOptions = StorageBulkOptions & StorageOperationOptions;\ntype DownloadManyOptions = StorageBulkOptions & StorageDownloadOptions;\n\nfunction assertKey(key: string, label = 'key'): void {\n if (typeof key !== 'string' || key.length === 0) {\n throw new StorageError(`${label} must be a non-empty string.`, {\n code: StorageErrorCode.INVALID_ARGUMENT,\n permanent: true,\n });\n }\n}\n\nfunction invalidArgument(message: string): never {\n throw new StorageError(message, {\n code: StorageErrorCode.INVALID_ARGUMENT,\n permanent: true,\n });\n}\n\nfunction assertPositiveSafeInteger(\n value: number | undefined,\n label: string,\n): void {\n if (value !== undefined && (!Number.isSafeInteger(value) || value <= 0)) {\n invalidArgument(`${label} must be a positive safe integer.`);\n }\n}\n\nfunction assertDownloadOptions(options?: StorageDownloadOptions): void {\n const range = options?.range;\n if (range === undefined) {\n return;\n }\n if (!Number.isSafeInteger(range.start) || range.start < 0) {\n invalidArgument('range.start must be a non-negative safe integer.');\n }\n if (\n range.end !== undefined &&\n (!Number.isSafeInteger(range.end) || range.end < range.start)\n ) {\n invalidArgument(\n 'range.end must be a safe integer greater than or equal to range.start.',\n );\n }\n}\n\nfunction assertListOptions(options?: StorageListOptions): void {\n if (options?.delimiter !== undefined && options.delimiter.length === 0) {\n invalidArgument('delimiter must be a non-empty string.');\n }\n assertPositiveSafeInteger(options?.limit, 'limit');\n}\n\nfunction assertSearchOptions(options?: StorageSearchOptions): void {\n assertPositiveSafeInteger(options?.limit, 'limit');\n assertPositiveSafeInteger(options?.maxResults, 'maxResults');\n}\n\nfunction assertSignedUploadOptions(options: StorageSignedUploadOptions): void {\n assertPositiveSafeInteger(options.expiresIn, 'expiresIn');\n assertPositiveSafeInteger(options.maxSize, 'maxSize');\n if (\n options.minSize !== undefined &&\n (!Number.isSafeInteger(options.minSize) || options.minSize < 0)\n ) {\n invalidArgument('minSize must be a non-negative safe integer.');\n }\n if (\n options.minSize !== undefined &&\n options.maxSize !== undefined &&\n options.minSize > options.maxSize\n ) {\n invalidArgument('minSize cannot be greater than maxSize.');\n }\n}\n\nfunction operationOptions(\n options?: BulkOperationOptions,\n): StorageOperationOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...(options.retries !== undefined && { retries: options.retries }),\n ...(options.signal !== undefined && { signal: options.signal }),\n ...(options.timeout !== undefined && { timeout: options.timeout }),\n };\n}\n\nfunction downloadOptions(\n options?: DownloadManyOptions,\n): StorageDownloadOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.range !== undefined && { range: options.range }),\n };\n}\n\nasync function collectBody(\n object: StorageObject,\n maxBytes: number,\n): Promise<Uint8Array> {\n if (maxBytes !== Infinity && (!Number.isFinite(maxBytes) || maxBytes < 0)) {\n await object.body.cancel().catch(() => undefined);\n throw new StorageError(\n 'maxBytes must be a non-negative finite number or Infinity.',\n {\n code: StorageErrorCode.INVALID_ARGUMENT,\n key: object.key,\n permanent: true,\n },\n );\n }\n\n if (maxBytes !== Infinity && object.size > maxBytes) {\n await object.body.cancel().catch(() => undefined);\n throw new StorageError(\n `Object \"${object.key}\" is ${object.size} bytes, exceeding the ${maxBytes}-byte buffer limit.`,\n {\n code: StorageErrorCode.LIMIT_EXCEEDED,\n key: object.key,\n permanent: true,\n },\n );\n }\n\n const chunks: Uint8Array[] = [];\n let total = 0;\n const reader = object.body.getReader();\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n total += value.byteLength;\n if (maxBytes !== Infinity && total > maxBytes) {\n await reader.cancel().catch(() => undefined);\n throw new StorageError(\n `Object \"${object.key}\" exceeded the ${maxBytes}-byte buffer limit while downloading.`,\n {\n code: StorageErrorCode.LIMIT_EXCEEDED,\n key: object.key,\n permanent: true,\n },\n );\n }\n chunks.push(value);\n }\n } finally {\n reader.releaseLock();\n }\n\n const bytes = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return bytes;\n}\n\nexport interface StorageFileHandle {\n readonly key: string;\n upload(\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult>;\n uploadConditional(\n body: StorageBody,\n options: StorageConditionalUploadOptions,\n ): Promise<StorageUploadResult>;\n download(options?: StorageDownloadOptions): Promise<StorageObject>;\n downloadConditional(\n options: StorageConditionalReadOptions,\n ): Promise<StorageObject>;\n bytes(options?: StorageBufferedDownloadOptions): Promise<Uint8Array>;\n text(options?: StorageBufferedDownloadOptions): Promise<string>;\n head(options?: StorageOperationOptions): Promise<StorageObjectMetadata>;\n exists(options?: StorageOperationOptions): Promise<boolean>;\n delete(options?: StorageOperationOptions): Promise<void>;\n deleteConditional(options: StorageConditionalDeleteOptions): Promise<void>;\n signDownload(options?: StorageSignedDownloadOptions): Promise<string>;\n signUpload(options: StorageSignedUploadOptions): Promise<StorageSignedUpload>;\n copyTo(\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n moveTo(\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n /** Conditionally copies this staged object and deliberately retains it. */\n promoteTo(\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void>;\n}\n\nexport class StorageClient {\n readonly #driver: StorageDriver;\n readonly #plugins: readonly StoragePlugin[];\n #closed = false;\n\n constructor(\n readonly name: string,\n driver: StorageDriver,\n plugins: readonly StoragePlugin[] = [],\n ) {\n assertKey(name, 'store name');\n this.#driver = driver;\n this.#plugins = [...plugins];\n }\n\n get driverName(): string {\n return this.#driver.name;\n }\n\n get capabilities(): Readonly<StorageCapabilities> {\n return this.#driver.capabilities;\n }\n\n file(key: string): StorageFileHandle {\n assertKey(key);\n return {\n copyTo: (destinationKey, options) =>\n this.copy(key, destinationKey, options),\n delete: (options) => this.delete(key, options),\n deleteConditional: (options) => this.deleteConditional(key, options),\n download: (options) => this.downloadStream(key, options),\n downloadConditional: (options) => this.downloadConditional(key, options),\n exists: (options) => this.exists(key, options),\n head: (options) => this.head(key, options),\n key,\n moveTo: (destinationKey, options) =>\n this.move(key, destinationKey, options),\n promoteTo: (destinationKey, options) =>\n this.promote(key, destinationKey, options),\n signDownload: (options) => this.signDownload(key, options),\n signUpload: (options) => this.signUpload(key, options),\n bytes: (options) => this.downloadBytes(key, options),\n text: (options) => this.downloadText(key, options),\n upload: (body, options) => this.upload(key, body, options),\n uploadConditional: (body, options) =>\n this.uploadConditional(key, body, options),\n };\n }\n\n upload(\n key: string,\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult> {\n assertKey(key);\n return this.#execute({ key, operation: 'upload', store: this.name }, () =>\n this.#driver.upload(key, body, options),\n );\n }\n\n uploadConditional(\n key: string,\n body: StorageBody,\n options: StorageConditionalUploadOptions,\n ): Promise<StorageUploadResult> {\n assertKey(key);\n const condition = options.condition;\n if (\n condition === undefined ||\n (condition.type !== 'create' && condition.type !== 'replace')\n ) {\n invalidArgument('condition.type must be \"create\" or \"replace\".');\n }\n if (\n condition.type === 'replace' &&\n !isCanonicalStorageEtag(condition.etag)\n ) {\n invalidArgument('condition.etag must be a canonical storage ETag.');\n }\n\n const capability =\n condition.type === 'create'\n ? this.#driver.capabilities.conditionalCreate\n : this.#driver.capabilities.conditionalReplace;\n const uploadConditional = this.#driver.uploadConditional;\n const multipartRequested =\n options.multipart !== undefined && options.multipart !== false;\n const multipartCapability =\n this.#driver.capabilities.conditionalMultipartCompletion;\n const multipartSupported =\n !multipartRequested ||\n (condition.type === 'create'\n ? multipartCapability?.create === true\n : multipartCapability?.replace === true);\n if (\n capability === undefined ||\n !multipartSupported ||\n uploadConditional === undefined\n ) {\n throw new StorageError(\n `Store \"${this.name}\" does not support the requested conditional upload.`,\n {\n code: StorageErrorCode.NOT_SUPPORTED,\n key,\n operation: 'upload',\n permanent: true,\n store: this.name,\n },\n );\n }\n\n return this.#execute({ key, operation: 'upload', store: this.name }, () =>\n uploadConditional.call(this.#driver, key, body, options),\n );\n }\n\n downloadStream(\n key: string,\n options?: StorageDownloadOptions,\n ): Promise<StorageObject> {\n assertKey(key);\n assertDownloadOptions(options);\n return this.#execute({ key, operation: 'download', store: this.name }, () =>\n this.#driver.download(key, options),\n );\n }\n\n downloadConditional(\n key: string,\n options: StorageConditionalReadOptions,\n ): Promise<StorageObject> {\n assertKey(key);\n assertDownloadOptions(options);\n if (\n options === undefined ||\n options.condition === undefined ||\n typeof options.condition !== 'object' ||\n options.condition === null\n ) {\n invalidArgument('conditional read requires a condition object.');\n }\n const { etag, version } = options.condition;\n if (etag !== undefined && !isCanonicalStorageEtag(etag)) {\n invalidArgument('condition.etag must be a canonical storage ETag.');\n }\n if (\n version !== undefined &&\n (typeof version !== 'string' || version.length === 0)\n ) {\n invalidArgument('condition.version must be a non-empty string.');\n }\n if (etag === undefined && version === undefined) {\n invalidArgument('conditional read requires an etag, version, or both.');\n }\n\n const capability = this.#driver.capabilities.conditionalRead;\n const downloadConditional = this.#driver.downloadConditional;\n if (\n downloadConditional === undefined ||\n capability === undefined ||\n (etag !== undefined && !capability.etag) ||\n (version !== undefined && !capability.version)\n ) {\n throw new StorageError(\n `Store \"${this.name}\" does not support the requested conditional read.`,\n {\n code: StorageErrorCode.NOT_SUPPORTED,\n key,\n operation: 'download',\n permanent: true,\n store: this.name,\n },\n );\n }\n\n return this.#execute({ key, operation: 'download', store: this.name }, () =>\n downloadConditional.call(this.#driver, key, options),\n );\n }\n\n async downloadBytes(\n key: string,\n options?: StorageBufferedDownloadOptions,\n ): Promise<Uint8Array> {\n const { maxBytes = DEFAULT_BUFFER_LIMIT, ...download } = options ?? {};\n const object = await this.downloadStream(key, download);\n return collectBody(object, maxBytes);\n }\n\n async downloadText(\n key: string,\n options?: StorageBufferedDownloadOptions,\n ): Promise<string> {\n return new TextDecoder().decode(await this.downloadBytes(key, options));\n }\n\n async downloadJson<Result = unknown>(\n key: string,\n options?: StorageBufferedDownloadOptions,\n ): Promise<Result> {\n const text = await this.downloadText(key, options);\n try {\n return JSON.parse(text) as Result;\n } catch (error) {\n throw new StorageError(`Object \"${key}\" does not contain valid JSON.`, {\n cause: error,\n code: StorageErrorCode.INVALID_ARGUMENT,\n key,\n operation: 'download',\n permanent: true,\n store: this.name,\n });\n }\n }\n\n head(\n key: string,\n options?: StorageOperationOptions,\n ): Promise<StorageObjectMetadata> {\n assertKey(key);\n return this.#execute({ key, operation: 'head', store: this.name }, () =>\n this.#driver.head(key, options),\n );\n }\n\n exists(key: string, options?: StorageOperationOptions): Promise<boolean> {\n assertKey(key);\n return this.#execute({ key, operation: 'exists', store: this.name }, () =>\n this.#driver.exists(key, options),\n );\n }\n\n delete(key: string, options?: StorageOperationOptions): Promise<void> {\n assertKey(key);\n return this.#execute({ key, operation: 'delete', store: this.name }, () =>\n this.#driver.delete(key, options),\n );\n }\n\n deleteConditional(\n key: string,\n options: StorageConditionalDeleteOptions,\n ): Promise<void> {\n assertKey(key);\n if (\n options.condition === undefined ||\n !isCanonicalStorageEtag(options.condition.etag)\n ) {\n invalidArgument('condition.etag must be a canonical storage ETag.');\n }\n\n const capability = this.#driver.capabilities.conditionalDelete;\n const deleteConditional = this.#driver.deleteConditional;\n if (capability?.etag !== true || deleteConditional === undefined) {\n throw new StorageError(\n `Store \"${this.name}\" does not support conditional delete.`,\n {\n code: StorageErrorCode.NOT_SUPPORTED,\n key,\n operation: 'delete',\n permanent: true,\n store: this.name,\n },\n );\n }\n\n return this.#execute({ key, operation: 'delete', store: this.name }, () =>\n deleteConditional.call(this.#driver, key, options),\n );\n }\n\n copy(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n assertKey(sourceKey, 'source key');\n assertKey(destinationKey, 'destination key');\n return this.#execute(\n {\n from: sourceKey,\n operation: 'copy',\n store: this.name,\n to: destinationKey,\n },\n () => this.#driver.copy(sourceKey, destinationKey, options),\n );\n }\n\n move(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n assertKey(sourceKey, 'source key');\n assertKey(destinationKey, 'destination key');\n return this.#execute(\n {\n from: sourceKey,\n operation: 'move',\n store: this.name,\n to: destinationKey,\n },\n () => this.#driver.move(sourceKey, destinationKey, options),\n );\n }\n\n /**\n * Conditionally copies a staged object to a final key. This operation does\n * not delete the source; delete it after the application commit succeeds.\n */\n promote(\n sourceKey: string,\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void> {\n assertKey(sourceKey, 'source key');\n assertKey(destinationKey, 'destination key');\n const sourceEtag = options.sourceEtag;\n const sourceVersion = options.sourceVersion;\n if (sourceEtag !== undefined && !isCanonicalStorageEtag(sourceEtag)) {\n invalidArgument('sourceEtag must be a canonical storage ETag.');\n }\n if (\n sourceVersion !== undefined &&\n (typeof sourceVersion !== 'string' || sourceVersion.length === 0)\n ) {\n invalidArgument('sourceVersion must be a non-empty string.');\n }\n const destination = options.destination;\n if (\n destination !== undefined &&\n (typeof destination !== 'object' ||\n destination === null ||\n (destination.type !== 'create' && destination.type !== 'replace'))\n ) {\n invalidArgument('destination.type must be \"create\" or \"replace\".');\n }\n if (\n sourceEtag === undefined &&\n sourceVersion === undefined &&\n destination === undefined\n ) {\n invalidArgument('promote requires a source or destination precondition.');\n }\n if (\n destination?.type === 'replace' &&\n !isCanonicalStorageEtag(destination.etag)\n ) {\n invalidArgument('destination.etag must be a canonical storage ETag.');\n }\n\n const sourceCapability = this.#driver.capabilities.conditionalCopySource;\n const destinationCapability =\n this.#driver.capabilities.conditionalCopyDestination;\n const promote = this.#driver.promote;\n if (\n promote === undefined ||\n (sourceEtag !== undefined && sourceCapability?.etag !== true) ||\n (sourceVersion !== undefined && sourceCapability?.version !== true) ||\n (destination?.type === 'create' &&\n destinationCapability?.create !== true) ||\n (destination?.type === 'replace' &&\n destinationCapability?.replace !== true) ||\n (destination !== undefined &&\n (sourceEtag !== undefined || sourceVersion !== undefined) &&\n destinationCapability?.atomicWithSource !== true)\n ) {\n throw new StorageError(\n `Store \"${this.name}\" does not support the requested conditional promotion.`,\n {\n code: StorageErrorCode.NOT_SUPPORTED,\n key: sourceKey,\n operation: 'promote',\n permanent: true,\n store: this.name,\n },\n );\n }\n\n return this.#execute(\n {\n from: sourceKey,\n operation: 'promote',\n store: this.name,\n to: destinationKey,\n },\n () => promote.call(this.#driver, sourceKey, destinationKey, options),\n );\n }\n\n list(options?: StorageListOptions): Promise<StorageListResult> {\n assertListOptions(options);\n return this.#execute({ operation: 'list', store: this.name }, () =>\n this.#driver.list(options),\n );\n }\n\n async *listAll(\n options?: StorageListOptions,\n ): AsyncGenerator<StorageObjectMetadata, void> {\n const { delimiter: _delimiter, ...walkOptions } = options ?? {};\n void _delimiter;\n let cursor = walkOptions.cursor;\n const seen = new Set<string>();\n\n do {\n const page = await this.list({\n ...walkOptions,\n ...(cursor !== undefined && { cursor }),\n });\n yield* page.items;\n cursor = page.cursor;\n if (cursor !== undefined) {\n if (seen.has(cursor)) {\n throw new StorageError(\n `Store \"${this.name}\" returned a repeated pagination cursor.`,\n {\n code: StorageErrorCode.PROVIDER,\n operation: 'list',\n permanent: true,\n store: this.name,\n },\n );\n }\n seen.add(cursor);\n }\n } while (cursor !== undefined);\n }\n\n search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncIterable<StorageObjectMetadata> {\n assertSearchOptions(options);\n return this.#search(pattern, options);\n }\n\n async *#search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncGenerator<StorageObjectMetadata, void> {\n const context: StorageOperationContext = {\n operation: 'search',\n store: this.name,\n };\n try {\n for (const plugin of this.#plugins) {\n await plugin.beforeOperation?.(context);\n }\n for await (const object of this.#driver.search(pattern, options)) {\n yield object;\n }\n for (const plugin of this.#plugins) {\n await plugin.afterOperation?.(context, undefined);\n }\n } catch (error) {\n const normalized = normalizeStorageError(error, {\n operation: 'search',\n store: this.name,\n });\n for (const plugin of this.#plugins) {\n try {\n await plugin.onError?.(context, normalized);\n } catch {\n // Preserve the original storage error.\n }\n }\n throw normalized;\n }\n }\n\n signDownload(\n key: string,\n options?: StorageSignedDownloadOptions,\n ): Promise<string> {\n assertKey(key);\n return this.#execute(\n { key, operation: 'signDownload', store: this.name },\n () => this.#driver.signDownload(key, options),\n );\n }\n\n signUpload(\n key: string,\n options: StorageSignedUploadOptions,\n ): Promise<StorageSignedUpload> {\n assertKey(key);\n assertSignedUploadOptions(options);\n return this.#execute(\n { key, operation: 'signUpload', store: this.name },\n () => this.#driver.signUpload(key, options),\n );\n }\n\n async uploadMany(\n items: readonly StorageUploadManyItem[],\n options?: StorageUploadManyOptions,\n ): Promise<StorageUploadManyResult> {\n const settled = await settleMany(\n items,\n (item) => item.key,\n (item) =>\n this.upload(item.key, item.body, {\n ...operationOptions(options),\n ...(item.cacheControl !== undefined && {\n cacheControl: item.cacheControl,\n }),\n ...(item.contentType !== undefined && {\n contentType: item.contentType,\n }),\n ...(item.metadata !== undefined && { metadata: item.metadata }),\n ...(item.multipart !== undefined && {\n multipart: item.multipart,\n }),\n ...(options?.onProgress !== undefined && {\n onProgress: (progress) =>\n options.onProgress?.({ ...progress, key: item.key }),\n }),\n }),\n options,\n );\n\n return {\n uploaded: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async downloadMany(\n keys: readonly string[],\n options?: DownloadManyOptions,\n ): Promise<StorageDownloadManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n (key) => this.downloadStream(key, downloadOptions(options)),\n options,\n );\n return {\n downloaded: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async headMany(\n keys: readonly string[],\n options?: BulkOperationOptions,\n ): Promise<StorageHeadManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n (key) => this.head(key, operationOptions(options)),\n options,\n );\n return {\n objects: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async existsMany(\n keys: readonly string[],\n options?: BulkOperationOptions,\n ): Promise<StorageExistsManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n async (key) => ({ exists: await this.exists(key, options), key }),\n options,\n );\n const existing: string[] = [];\n const missing: string[] = [];\n for (const result of settled.results) {\n (result.exists ? existing : missing).push(result.key);\n }\n return {\n existing,\n missing,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async deleteMany(\n keys: readonly string[],\n options?: BulkOperationOptions,\n ): Promise<StorageDeleteManyResult> {\n const settled = await settleMany(\n keys,\n (key) => key,\n async (key) => {\n await this.delete(key, operationOptions(options));\n return key;\n },\n options,\n );\n return {\n deleted: settled.results,\n ...(settled.errors.length > 0 && { errors: settled.errors }),\n };\n }\n\n async onApplicationShutdown(): Promise<void> {\n if (this.#closed) {\n return;\n }\n this.#closed = true;\n await this.#driver.close?.();\n }\n\n async #execute<Result>(\n context: StorageOperationContext,\n operation: () => Promise<Result>,\n ): Promise<Result> {\n try {\n for (const plugin of this.#plugins) {\n await plugin.beforeOperation?.(context);\n }\n const result = await operation();\n for (const plugin of this.#plugins) {\n await plugin.afterOperation?.(context, result);\n }\n return result;\n } catch (error) {\n const normalized = normalizeStorageError(error, {\n ...(context.key !== undefined && { key: context.key }),\n operation: context.operation,\n store: this.name,\n });\n for (const plugin of this.#plugins) {\n try {\n await plugin.onError?.(context, normalized);\n } catch {\n // Preserve the original storage error.\n }\n }\n throw normalized;\n }\n }\n}\n"]}
@@ -1,12 +1,15 @@
1
- import type { StorageBody, StorageCapabilities, StorageDownloadOptions, StorageListOptions, StorageListResult, StorageObject, StorageObjectMetadata, StorageOperationOptions, StoragePromotionOptions, StorageSearchOptions, StorageSignedDownloadOptions, StorageSignedUpload, StorageSignedUploadOptions, StorageUploadOptions, StorageUploadResult } from './storage.types.js';
1
+ import type { StorageBody, StorageCapabilities, StorageConditionalDeleteOptions, StorageConditionalReadOptions, StorageConditionalUploadOptions, StorageDownloadOptions, StorageListOptions, StorageListResult, StorageObject, StorageObjectMetadata, StorageOperationOptions, StoragePromotionOptions, StorageSearchOptions, StorageSignedDownloadOptions, StorageSignedUpload, StorageSignedUploadOptions, StorageUploadOptions, StorageUploadResult } from './storage.types.js';
2
2
  export interface StorageDriver {
3
3
  readonly name: string;
4
4
  readonly capabilities: StorageCapabilities;
5
5
  upload(key: string, body: StorageBody, options?: StorageUploadOptions): Promise<StorageUploadResult>;
6
+ uploadConditional?(key: string, body: StorageBody, options: StorageConditionalUploadOptions): Promise<StorageUploadResult>;
6
7
  download(key: string, options?: StorageDownloadOptions): Promise<StorageObject>;
8
+ downloadConditional?(key: string, options: StorageConditionalReadOptions): Promise<StorageObject>;
7
9
  head(key: string, options?: StorageOperationOptions): Promise<StorageObjectMetadata>;
8
10
  exists(key: string, options?: StorageOperationOptions): Promise<boolean>;
9
11
  delete(key: string, options?: StorageOperationOptions): Promise<void>;
12
+ deleteConditional?(key: string, options: StorageConditionalDeleteOptions): Promise<void>;
10
13
  copy(sourceKey: string, destinationKey: string, options?: StorageOperationOptions): Promise<void>;
11
14
  move(sourceKey: string, destinationKey: string, options?: StorageOperationOptions): Promise<void>;
12
15
  /**
@@ -14,6 +17,25 @@ export interface StorageDriver {
14
17
  * in place so applications can delete it only after their metadata commit.
15
18
  */
16
19
  promote?(sourceKey: string, destinationKey: string, options: StoragePromotionOptions): Promise<void>;
20
+ /**
21
+ * Lists one page and, when more entries remain, returns an opaque cursor for
22
+ * the next logical position. Cursors are bound to the request's `prefix` and
23
+ * `delimiter`; callers may choose a different supported `limit` when they
24
+ * resume.
25
+ *
26
+ * A cursor is non-consuming. Reusing it, including after following any
27
+ * descendant cursor, must resume from the same logical position while the
28
+ * provider namespace is unchanged. It must also work with an independently
29
+ * constructed compatible driver and client that address the same store with
30
+ * the same backend configuration while the provider token remains valid and
31
+ * available. Drivers must not make cursor state local to one process, client,
32
+ * or session.
33
+ *
34
+ * This contract does not provide snapshot isolation: concurrent namespace
35
+ * mutations may change subsequent pages. It does not guarantee provider
36
+ * token lifetime or backend availability, and provider invalidation remains
37
+ * an ordinary list-operation failure.
38
+ */
17
39
  list(options?: StorageListOptions): Promise<StorageListResult>;
18
40
  search(pattern: string | RegExp, options?: StorageSearchOptions): AsyncIterable<StorageObjectMetadata>;
19
41
  signDownload(key: string, options?: StorageSignedDownloadOptions): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"storage.driver.d.ts","sourceRoot":"","sources":["../src/storage.driver.ts"],"names":[],"mappings":"AA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AC;IAC/D,MAAM,CACJ,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAAC,qBAAqB,CAAC,CAAC;IACxC,YAAY,CACV,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,UAAU,CACR,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage.driver.js","sourceRoot":"","sources":["../src/storage.driver.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n StorageBody,\n StorageCapabilities,\n StorageDownloadOptions,\n StorageListOptions,\n StorageListResult,\n StorageObject,\n StorageObjectMetadata,\n StorageOperationOptions,\n StoragePromotionOptions,\n StorageSearchOptions,\n StorageSignedDownloadOptions,\n StorageSignedUpload,\n StorageSignedUploadOptions,\n StorageUploadOptions,\n StorageUploadResult,\n} from './storage.types.js';\n\nexport interface StorageDriver {\n readonly name: string;\n readonly capabilities: StorageCapabilities;\n\n upload(\n key: string,\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult>;\n download(\n key: string,\n options?: StorageDownloadOptions,\n ): Promise<StorageObject>;\n head(\n key: string,\n options?: StorageOperationOptions,\n ): Promise<StorageObjectMetadata>;\n exists(key: string, options?: StorageOperationOptions): Promise<boolean>;\n delete(key: string, options?: StorageOperationOptions): Promise<void>;\n copy(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n move(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n /**\n * Conditionally copies a staged object to its final key. The source remains\n * in place so applications can delete it only after their metadata commit.\n */\n promote?(\n sourceKey: string,\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void>;\n list(options?: StorageListOptions): Promise<StorageListResult>;\n search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncIterable<StorageObjectMetadata>;\n signDownload(\n key: string,\n options?: StorageSignedDownloadOptions,\n ): Promise<string>;\n signUpload(\n key: string,\n options: StorageSignedUploadOptions,\n ): Promise<StorageSignedUpload>;\n close?(): void | Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"storage.driver.js","sourceRoot":"","sources":["../src/storage.driver.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n StorageBody,\n StorageCapabilities,\n StorageConditionalDeleteOptions,\n StorageConditionalReadOptions,\n StorageConditionalUploadOptions,\n StorageDownloadOptions,\n StorageListOptions,\n StorageListResult,\n StorageObject,\n StorageObjectMetadata,\n StorageOperationOptions,\n StoragePromotionOptions,\n StorageSearchOptions,\n StorageSignedDownloadOptions,\n StorageSignedUpload,\n StorageSignedUploadOptions,\n StorageUploadOptions,\n StorageUploadResult,\n} from './storage.types.js';\n\nexport interface StorageDriver {\n readonly name: string;\n readonly capabilities: StorageCapabilities;\n\n upload(\n key: string,\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult>;\n uploadConditional?(\n key: string,\n body: StorageBody,\n options: StorageConditionalUploadOptions,\n ): Promise<StorageUploadResult>;\n download(\n key: string,\n options?: StorageDownloadOptions,\n ): Promise<StorageObject>;\n downloadConditional?(\n key: string,\n options: StorageConditionalReadOptions,\n ): Promise<StorageObject>;\n head(\n key: string,\n options?: StorageOperationOptions,\n ): Promise<StorageObjectMetadata>;\n exists(key: string, options?: StorageOperationOptions): Promise<boolean>;\n delete(key: string, options?: StorageOperationOptions): Promise<void>;\n deleteConditional?(\n key: string,\n options: StorageConditionalDeleteOptions,\n ): Promise<void>;\n copy(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n move(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void>;\n /**\n * Conditionally copies a staged object to its final key. The source remains\n * in place so applications can delete it only after their metadata commit.\n */\n promote?(\n sourceKey: string,\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void>;\n /**\n * Lists one page and, when more entries remain, returns an opaque cursor for\n * the next logical position. Cursors are bound to the request's `prefix` and\n * `delimiter`; callers may choose a different supported `limit` when they\n * resume.\n *\n * A cursor is non-consuming. Reusing it, including after following any\n * descendant cursor, must resume from the same logical position while the\n * provider namespace is unchanged. It must also work with an independently\n * constructed compatible driver and client that address the same store with\n * the same backend configuration while the provider token remains valid and\n * available. Drivers must not make cursor state local to one process, client,\n * or session.\n *\n * This contract does not provide snapshot isolation: concurrent namespace\n * mutations may change subsequent pages. It does not guarantee provider\n * token lifetime or backend availability, and provider invalidation remains\n * an ordinary list-operation failure.\n */\n list(options?: StorageListOptions): Promise<StorageListResult>;\n search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncIterable<StorageObjectMetadata>;\n signDownload(\n key: string,\n options?: StorageSignedDownloadOptions,\n ): Promise<string>;\n signUpload(\n key: string,\n options: StorageSignedUploadOptions,\n ): Promise<StorageSignedUpload>;\n close?(): void | Promise<void>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"storage.service.d.ts","sourceRoot":"","sources":["../src/storage.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAIV,kBAAkB,EAElB,iBAAiB,EACjB,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAuD5B,qBAAa,cAAc;;IAKvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAF9B,YACE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,EAG5C;IAED,IAAI,KAAK,IAAI,SAAS,MAAM,EAAE,CAE7B;IAED,GAAG,CAAC,IA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