@nestm/storage 0.1.0-alpha.2 → 0.1.0-alpha.3

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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +111 -13
  3. package/SECURITY.md +23 -0
  4. package/dist/files-sdk/files-sdk.driver.d.ts +36 -7
  5. package/dist/files-sdk/files-sdk.driver.d.ts.map +1 -1
  6. package/dist/files-sdk/files-sdk.driver.js +141 -20
  7. package/dist/files-sdk/files-sdk.driver.js.map +1 -1
  8. package/dist/files-sdk/index.d.ts +1 -1
  9. package/dist/files-sdk/index.d.ts.map +1 -1
  10. package/dist/files-sdk/index.js.map +1 -1
  11. package/dist/files-sdk/s3/index.d.ts +14 -0
  12. package/dist/files-sdk/s3/index.d.ts.map +1 -0
  13. package/dist/files-sdk/s3/index.js +108 -0
  14. package/dist/files-sdk/s3/index.js.map +1 -0
  15. package/dist/gateway/index.d.ts +1 -1
  16. package/dist/gateway/index.d.ts.map +1 -1
  17. package/dist/gateway/index.js.map +1 -1
  18. package/dist/gateway/storage-gateway.controller.d.ts +12 -11
  19. package/dist/gateway/storage-gateway.controller.d.ts.map +1 -1
  20. package/dist/gateway/storage-gateway.controller.js +209 -65
  21. package/dist/gateway/storage-gateway.controller.js.map +1 -1
  22. package/dist/gateway/storage-gateway.module.d.ts.map +1 -1
  23. package/dist/gateway/storage-gateway.module.js +60 -1
  24. package/dist/gateway/storage-gateway.module.js.map +1 -1
  25. package/dist/gateway/storage-gateway.tokens.d.ts +1 -0
  26. package/dist/gateway/storage-gateway.tokens.d.ts.map +1 -1
  27. package/dist/gateway/storage-gateway.tokens.js +1 -0
  28. package/dist/gateway/storage-gateway.tokens.js.map +1 -1
  29. package/dist/gateway/storage-gateway.types.d.ts +43 -0
  30. package/dist/gateway/storage-gateway.types.d.ts.map +1 -1
  31. package/dist/gateway/storage-gateway.types.js.map +1 -1
  32. package/dist/storage.client.d.ts +8 -1
  33. package/dist/storage.client.d.ts.map +1 -1
  34. package/dist/storage.client.js +40 -0
  35. package/dist/storage.client.js.map +1 -1
  36. package/dist/storage.driver.d.ts +6 -1
  37. package/dist/storage.driver.d.ts.map +1 -1
  38. package/dist/storage.driver.js.map +1 -1
  39. package/dist/storage.error.d.ts +3 -0
  40. package/dist/storage.error.d.ts.map +1 -1
  41. package/dist/storage.error.js +33 -1
  42. package/dist/storage.error.js.map +1 -1
  43. package/dist/storage.types.d.ts +39 -1
  44. package/dist/storage.types.d.ts.map +1 -1
  45. package/dist/storage.types.js.map +1 -1
  46. package/package.json +25 -1
@@ -1 +1 @@
1
- {"version":3,"file":"files-sdk.driver.js","sourceRoot":"","sources":["../../src/files-sdk/files-sdk.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EACL,KAAK,EACL,UAAU,GAcX,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkBrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,YAAY,CACrB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD;YACE,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,gBAAgB,CAAC,QAAQ;SAChC,CACF,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,YAAY,YAAY,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,IAAsB,CAAC;IAC3B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n\nimport {\n Files,\n FilesError,\n type Adapter,\n type Body,\n type DownloadOptions,\n type FilesOptions,\n type ListOptions,\n type OperationOptions,\n type RetryOptions,\n type SearchOptions,\n type SignUploadOptions,\n type StoredFile,\n type UploadOptions,\n type UploadResult,\n type UrlOptions,\n} from 'files-sdk';\n\nimport { StorageError, StorageErrorCode } from '../storage.error.js';\nimport type { StorageDriver } from '../storage.driver.js';\nimport type {\n StorageBody,\n StorageDownloadOptions,\n StorageListOptions,\n StorageListResult,\n StorageObject,\n StorageObjectMetadata,\n StorageOperationOptions,\n StorageRetryOptions,\n StorageSearchOptions,\n StorageSignedDownloadOptions,\n StorageSignedUpload,\n StorageSignedUploadOptions,\n StorageUploadOptions,\n StorageUploadResult,\n} from '../storage.types.js';\nimport { getFilesSdkUploadControl } from '../storage-upload-control.js';\n\nexport type FilesSdkDriverOptions<AdapterType extends Adapter> =\n FilesOptions<AdapterType>;\n\nfunction mapFilesError(error: unknown): StorageError {\n if (error instanceof StorageError) {\n return error;\n }\n if (!(error instanceof FilesError)) {\n return new StorageError(\n error instanceof Error ? error.message : String(error),\n {\n cause: error,\n code: StorageErrorCode.PROVIDER,\n },\n );\n }\n\n if (error.cause instanceof StorageError) {\n return error.cause;\n }\n\n let code: StorageErrorCode;\n if (error.timedOut) {\n code = StorageErrorCode.TIMEOUT;\n } else if (error.aborted) {\n code = StorageErrorCode.ABORTED;\n } else {\n switch (error.code) {\n case 'NotFound':\n code = StorageErrorCode.NOT_FOUND;\n break;\n case 'Unauthorized':\n code = StorageErrorCode.UNAUTHORIZED;\n break;\n case 'Conflict':\n code = StorageErrorCode.CONFLICT;\n break;\n case 'ReadOnly':\n code = StorageErrorCode.READ_ONLY;\n break;\n case 'Provider':\n code = /(?:not supported|does not support|unsupported)/iu.test(\n error.message,\n )\n ? StorageErrorCode.NOT_SUPPORTED\n : StorageErrorCode.PROVIDER;\n break;\n }\n }\n\n return new StorageError(error.message, {\n aborted: error.aborted,\n cause: error.cause ?? error,\n code,\n permanent: error.permanent,\n timedOut: error.timedOut,\n });\n}\n\nfunction mapRetryOptions(\n retries: StorageRetryOptions | undefined,\n): RetryOptions | undefined {\n if (retries === undefined || typeof retries === 'number') {\n return retries;\n }\n\n return {\n max: retries.max,\n ...(retries.backoff !== undefined && {\n backoff: ({ attempt, error }) =>\n retries.backoff?.({\n attempt,\n error: mapFilesError(error),\n }) ?? 0,\n }),\n };\n}\n\nfunction operationOptions(\n options?: StorageOperationOptions,\n): OperationOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n\n const retries = mapRetryOptions(options.retries);\n return {\n ...(retries !== undefined && { retries }),\n ...(options.signal !== undefined && { signal: options.signal }),\n ...(options.timeout !== undefined && { timeout: options.timeout }),\n };\n}\n\nasync function* normalizeNodeChunks(\n source: Readable,\n): AsyncGenerator<Uint8Array> {\n for await (const chunk of source) {\n if (typeof chunk === 'string') {\n yield new TextEncoder().encode(chunk);\n continue;\n }\n if (chunk instanceof Uint8Array) {\n yield chunk;\n continue;\n }\n throw new StorageError(\n 'Node upload streams must yield strings or Uint8Array chunks.',\n {\n code: StorageErrorCode.INVALID_ARGUMENT,\n permanent: true,\n },\n );\n }\n}\n\nfunction mapBody(body: StorageBody): Body {\n if (body instanceof Readable) {\n return Readable.toWeb(\n Readable.from(normalizeNodeChunks(body)),\n ) as ReadableStream<Uint8Array>;\n }\n return body;\n}\n\nfunction normalizeDownloadStream(\n source: ReadableStream<Uint8Array>,\n): ReadableStream<Uint8Array> {\n let reader: ReadableStreamDefaultReader<Uint8Array> | undefined =\n source.getReader();\n\n const release = (): void => {\n reader?.releaseLock();\n reader = undefined;\n };\n\n return new ReadableStream<Uint8Array>({\n async cancel(reason) {\n const activeReader = reader;\n if (activeReader === undefined) {\n return;\n }\n try {\n await activeReader.cancel(reason);\n } catch (error) {\n throw mapFilesError(error);\n } finally {\n release();\n }\n },\n async pull(controller) {\n const activeReader = reader;\n if (activeReader === undefined) {\n controller.close();\n return;\n }\n try {\n const result = await activeReader.read();\n if (result.done) {\n release();\n controller.close();\n return;\n }\n controller.enqueue(result.value);\n } catch (error) {\n release();\n controller.error(mapFilesError(error));\n }\n },\n });\n}\n\nfunction uploadOptions(\n options?: StorageUploadOptions,\n): UploadOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.cacheControl !== undefined && {\n cacheControl: options.cacheControl,\n }),\n ...(options.contentType !== undefined && {\n contentType: options.contentType,\n }),\n ...(options.control !== undefined && {\n control: getFilesSdkUploadControl(options.control),\n }),\n ...(options.metadata !== undefined && { metadata: options.metadata }),\n ...(options.multipart !== undefined && {\n multipart: options.multipart,\n }),\n ...(options.onProgress !== undefined && {\n onProgress: options.onProgress,\n }),\n };\n}\n\nfunction downloadOptions(options?: StorageDownloadOptions): DownloadOptions {\n return {\n ...operationOptions(options),\n as: 'stream',\n ...(options?.range !== undefined && { range: options.range }),\n };\n}\n\nfunction listOptions(options?: StorageListOptions): ListOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.cursor !== undefined && { cursor: options.cursor }),\n ...(options.delimiter !== undefined && { delimiter: options.delimiter }),\n ...(options.limit !== undefined && { limit: options.limit }),\n ...(options.prefix !== undefined && { prefix: options.prefix }),\n };\n}\n\nfunction searchOptions(\n options?: StorageSearchOptions,\n): SearchOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.caseInsensitive !== undefined && {\n caseInsensitive: options.caseInsensitive,\n }),\n ...(options.limit !== undefined && { limit: options.limit }),\n ...(options.match !== undefined && { match: options.match }),\n ...(options.maxResults !== undefined && {\n maxResults: options.maxResults,\n }),\n ...(options.prefix !== undefined && { prefix: options.prefix }),\n };\n}\n\nfunction signedDownloadOptions(\n options?: StorageSignedDownloadOptions,\n): UrlOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.expiresIn !== undefined && {\n expiresIn: options.expiresIn,\n }),\n ...(options.responseContentDisposition !== undefined && {\n responseContentDisposition: options.responseContentDisposition,\n }),\n };\n}\n\nfunction signedUploadOptions(\n options: StorageSignedUploadOptions,\n): SignUploadOptions {\n return {\n ...operationOptions(options),\n expiresIn: options.expiresIn,\n ...(options.contentType !== undefined && {\n contentType: options.contentType,\n }),\n ...(options.maxSize !== undefined && { maxSize: options.maxSize }),\n ...(options.minSize !== undefined && { minSize: options.minSize }),\n };\n}\n\nfunction metadataOf(file: StoredFile): StorageObjectMetadata {\n return {\n contentType: file.type,\n ...(file.etag !== undefined && { etag: file.etag }),\n key: file.key,\n ...(file.lastModified !== undefined && {\n lastModified: new Date(file.lastModified),\n }),\n ...(file.metadata !== undefined && {\n metadata: { ...file.metadata },\n }),\n name: file.name,\n size: file.size,\n };\n}\n\nfunction uploadResultOf(result: UploadResult): StorageUploadResult {\n return {\n contentType: result.contentType,\n ...(result.etag !== undefined && { etag: result.etag }),\n key: result.key,\n ...(result.lastModified !== undefined && {\n lastModified: new Date(result.lastModified),\n }),\n size: result.size,\n };\n}\n\nexport class FilesSdkStorageDriver<\n AdapterType extends Adapter = Adapter,\n> implements StorageDriver {\n readonly #files: Files<AdapterType>;\n readonly #name: string;\n\n constructor(options: FilesSdkDriverOptions<AdapterType>) {\n this.#files = new Files(options);\n this.#name = options.adapter.name;\n }\n\n get name(): string {\n return this.#name;\n }\n\n get capabilities() {\n const capabilities = this.#files.capabilities;\n return {\n cacheControl: capabilities.cacheControl,\n delimiter: capabilities.delimiter,\n metadata: capabilities.metadata,\n rangeRead: capabilities.rangeRead,\n resumableUpload: capabilities.multipart,\n serverSideCopy: capabilities.serverSideCopy,\n signedDownload: { ...capabilities.signedUrl },\n signedUpload: 'runtime' as const,\n nativeUploadProgress: capabilities.uploadProgress,\n };\n }\n\n async upload(\n key: string,\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult> {\n return this.#call(async () =>\n uploadResultOf(\n await this.#files.upload(key, mapBody(body), uploadOptions(options)),\n ),\n );\n }\n\n async download(\n key: string,\n options?: StorageDownloadOptions,\n ): Promise<StorageObject> {\n return this.#call(async () => {\n const file = await this.#files.download(key, downloadOptions(options));\n return {\n ...metadataOf(file),\n body: normalizeDownloadStream(file.stream()),\n };\n });\n }\n\n async head(\n key: string,\n options?: StorageOperationOptions,\n ): Promise<StorageObjectMetadata> {\n return this.#call(async () =>\n metadataOf(await this.#files.head(key, operationOptions(options))),\n );\n }\n\n exists(key: string, options?: StorageOperationOptions): Promise<boolean> {\n return this.#call(() => this.#files.exists(key, operationOptions(options)));\n }\n\n delete(key: string, options?: StorageOperationOptions): Promise<void> {\n return this.#call(async () => {\n await this.#files.delete(key, operationOptions(options));\n });\n }\n\n copy(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n return this.#call(() =>\n this.#files.copy(sourceKey, destinationKey, operationOptions(options)),\n );\n }\n\n move(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n return this.#call(() =>\n this.#files.move(sourceKey, destinationKey, operationOptions(options)),\n );\n }\n\n async list(options?: StorageListOptions): Promise<StorageListResult> {\n return this.#call(async () => {\n const result = await this.#files.list(listOptions(options));\n return {\n items: result.items.map(metadataOf),\n ...(result.cursor !== undefined && { cursor: result.cursor }),\n ...(result.prefixes !== undefined && {\n prefixes: [...result.prefixes],\n }),\n };\n });\n }\n\n search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncIterable<StorageObjectMetadata> {\n return this.#search(pattern, options);\n }\n\n async *#search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncGenerator<StorageObjectMetadata, void> {\n try {\n for await (const file of this.#files.search(\n pattern,\n searchOptions(options),\n )) {\n yield metadataOf(file);\n }\n } catch (error) {\n throw mapFilesError(error);\n }\n }\n\n signDownload(\n key: string,\n options?: StorageSignedDownloadOptions,\n ): Promise<string> {\n return this.#call(() =>\n this.#files.url(key, signedDownloadOptions(options)),\n );\n }\n\n signUpload(\n key: string,\n options: StorageSignedUploadOptions,\n ): Promise<StorageSignedUpload> {\n return this.#call(() =>\n this.#files.signedUploadUrl(key, signedUploadOptions(options)),\n );\n }\n\n async #call<Result>(operation: () => Promise<Result>): Promise<Result> {\n try {\n return await operation();\n } catch (error) {\n throw mapFilesError(error);\n }\n }\n}\n\nexport function createFilesSdkDriver<AdapterType extends Adapter>(\n options: FilesSdkDriverOptions<AdapterType>,\n): FilesSdkStorageDriver<AdapterType> {\n return new FilesSdkStorageDriver(options);\n}\n"]}
1
+ {"version":3,"file":"files-sdk.driver.js","sourceRoot":"","sources":["../../src/files-sdk/files-sdk.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EACL,KAAK,EACL,UAAU,GAcX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAsB7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AA0BxE,SAAS,wBAAwB,CAC/B,OAAgB;IAEhB,IACE,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,KAAK,IAAI;QAChB,CAAC,CAAC,iBAAiB,IAAI,OAAO,CAAC;QAC/B,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,EACvB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,SAAS,GAAG,OACuB,CAAC;IAC1C,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC;IAC7C,IACE,UAAU,KAAK,SAAS;QACxB,OAAO,UAAU,CAAC,SAAS,KAAK,SAAS;QACzC,OAAO,UAAU,CAAC,IAAI,KAAK,SAAS;QACpC,OAAO,UAAU,CAAC,OAAO,KAAK,SAAS;QACvC,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,EACvC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,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CAAC,CACrD,CAAC;IACJ,CAAC;IAED,UAAU,CACR,GAAW,EACX,OAAmC;QAEnC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CACrB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAC/D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CAAS,SAAgC;QAClD,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,oBAAoB,CAClC,OAA2C;IAE3C,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { Readable } from 'node:stream';\n\nimport {\n Files,\n FilesError,\n type Adapter,\n type Body,\n type DownloadOptions,\n type FilesOptions,\n type ListOptions,\n type OperationOptions,\n type RetryOptions,\n type SearchOptions,\n type SignUploadOptions,\n type StoredFile,\n type UploadOptions,\n type UploadResult,\n type UrlOptions,\n} from 'files-sdk';\n\nimport {\n StorageError,\n StorageErrorCode,\n isStorageError,\n} from '../storage.error.js';\nimport type { StorageDriver } from '../storage.driver.js';\nimport type {\n StorageBody,\n StorageDownloadOptions,\n StorageListOptions,\n StorageListResult,\n StorageObject,\n StorageObjectMetadata,\n StorageOperationOptions,\n StorageConditionalCopyCapability,\n StoragePromotionOptions,\n StorageRetryOptions,\n StorageSearchOptions,\n StorageSignedUploadPolicyCapability,\n StorageSignedDownloadPolicyCapability,\n StorageSignedDownloadOptions,\n StorageSignedUpload,\n StorageSignedUploadOptions,\n StorageUploadOptions,\n StorageUploadResult,\n} from '../storage.types.js';\nimport { getFilesSdkUploadControl } from '../storage-upload-control.js';\n\nexport type FilesSdkDriverOptions<AdapterType extends Adapter> =\n FilesOptions<AdapterType>;\n\n/**\n * Optional adapter extension for providers that can conditionally copy an\n * immutable source identity. Plain files-sdk adapters remain fully supported.\n */\nexport interface FilesSdkConditionalCopyAdapter {\n readonly conditionalCopy: StorageConditionalCopyCapability;\n promote(\n sourceKey: string,\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void>;\n}\n\nexport interface FilesSdkSignedUploadPolicyAdapter {\n readonly signedUploadPolicy: StorageSignedUploadPolicyCapability;\n}\n\nexport interface FilesSdkSignedDownloadPolicyAdapter {\n readonly signedDownloadPolicy: StorageSignedDownloadPolicyCapability;\n}\n\nfunction conditionalCopyAdapterOf(\n adapter: Adapter,\n): FilesSdkConditionalCopyAdapter | undefined {\n if (\n typeof adapter !== 'object' ||\n adapter === null ||\n !('conditionalCopy' in adapter) ||\n !('promote' in adapter)\n ) {\n return undefined;\n }\n const candidate = adapter as Adapter &\n Partial<FilesSdkConditionalCopyAdapter>;\n const capability = candidate.conditionalCopy;\n if (\n capability === undefined ||\n typeof capability.supported !== 'boolean' ||\n typeof capability.etag !== 'boolean' ||\n typeof capability.version !== 'boolean' ||\n typeof candidate.promote !== 'function'\n ) {\n return undefined;\n }\n return candidate as Adapter & FilesSdkConditionalCopyAdapter;\n}\n\nfunction signedUploadPolicyAdapterOf(\n adapter: Adapter,\n): FilesSdkSignedUploadPolicyAdapter | undefined {\n if (\n typeof adapter !== 'object' ||\n adapter === null ||\n !('signedUploadPolicy' in adapter)\n ) {\n return undefined;\n }\n const candidate = adapter as Adapter &\n Partial<FilesSdkSignedUploadPolicyAdapter>;\n const capability = candidate.signedUploadPolicy;\n if (\n capability === undefined ||\n typeof capability.contentType !== 'boolean' ||\n typeof capability.sizeRange !== 'boolean'\n ) {\n return undefined;\n }\n return candidate as Adapter & FilesSdkSignedUploadPolicyAdapter;\n}\n\nfunction signedDownloadPolicyAdapterOf(\n adapter: Adapter,\n): FilesSdkSignedDownloadPolicyAdapter | undefined {\n if (\n typeof adapter !== 'object' ||\n adapter === null ||\n !('signedDownloadPolicy' in adapter)\n ) {\n return undefined;\n }\n const candidate = adapter as Adapter &\n Partial<FilesSdkSignedDownloadPolicyAdapter>;\n const capability = candidate.signedDownloadPolicy;\n if (capability === undefined || typeof capability.expiresIn !== 'boolean') {\n return undefined;\n }\n return candidate as Adapter & FilesSdkSignedDownloadPolicyAdapter;\n}\n\ninterface FilesErrorLike {\n readonly name: string;\n readonly message: string;\n readonly code: FilesError['code'];\n readonly aborted: boolean;\n readonly timedOut: boolean;\n readonly permanent: boolean;\n readonly cause?: unknown;\n}\n\nfunction isFilesErrorCode(value: unknown): value is FilesError['code'] {\n return (\n value === 'NotFound' ||\n value === 'Unauthorized' ||\n value === 'Conflict' ||\n value === 'ReadOnly' ||\n value === 'Provider'\n );\n}\n\nfunction isFilesErrorLike(error: unknown): error is FilesErrorLike {\n if (error instanceof FilesError) {\n return true;\n }\n if (!(error instanceof Error)) {\n return false;\n }\n\n try {\n return (\n error.name === 'FilesError' &&\n typeof error.message === 'string' &&\n 'code' in error &&\n isFilesErrorCode(error.code) &&\n 'aborted' in error &&\n typeof error.aborted === 'boolean' &&\n 'timedOut' in error &&\n typeof error.timedOut === 'boolean' &&\n 'permanent' in error &&\n typeof error.permanent === 'boolean'\n );\n } catch {\n return false;\n }\n}\n\nfunction unwrapFilesError(error: FilesErrorLike): FilesErrorLike {\n const seen = new Set<FilesErrorLike>();\n let current = error;\n\n while (\n current.code === 'Provider' &&\n !current.aborted &&\n !current.timedOut &&\n !current.permanent &&\n isFilesErrorLike(current.cause) &&\n current.message === current.cause.message &&\n !seen.has(current.cause)\n ) {\n seen.add(current);\n current = current.cause;\n }\n\n return current;\n}\n\nexport function mapFilesSdkError(error: unknown): StorageError {\n if (isStorageError(error)) {\n return error;\n }\n if (!isFilesErrorLike(error)) {\n return new StorageError(\n error instanceof Error ? error.message : String(error),\n {\n cause: error,\n code: StorageErrorCode.PROVIDER,\n },\n );\n }\n\n const filesError = unwrapFilesError(error);\n\n if (isStorageError(filesError.cause)) {\n return filesError.cause;\n }\n\n let code: StorageErrorCode;\n if (filesError.timedOut) {\n code = StorageErrorCode.TIMEOUT;\n } else if (filesError.aborted) {\n code = StorageErrorCode.ABORTED;\n } else {\n switch (filesError.code) {\n case 'NotFound':\n code = StorageErrorCode.NOT_FOUND;\n break;\n case 'Unauthorized':\n code = StorageErrorCode.UNAUTHORIZED;\n break;\n case 'Conflict':\n code = StorageErrorCode.CONFLICT;\n break;\n case 'ReadOnly':\n code = StorageErrorCode.READ_ONLY;\n break;\n case 'Provider':\n code = /(?:not supported|does not support|unsupported)/iu.test(\n filesError.message,\n )\n ? StorageErrorCode.NOT_SUPPORTED\n : StorageErrorCode.PROVIDER;\n break;\n }\n }\n\n return new StorageError(filesError.message, {\n aborted: filesError.aborted,\n cause: filesError.cause ?? error,\n code,\n permanent: filesError.permanent,\n timedOut: filesError.timedOut,\n });\n}\n\nfunction mapRetryOptions(\n retries: StorageRetryOptions | undefined,\n): RetryOptions | undefined {\n if (retries === undefined || typeof retries === 'number') {\n return retries;\n }\n\n return {\n max: retries.max,\n ...(retries.backoff !== undefined && {\n backoff: ({ attempt, error }) =>\n retries.backoff?.({\n attempt,\n error: mapFilesSdkError(error),\n }) ?? 0,\n }),\n };\n}\n\nfunction operationOptions(\n options?: StorageOperationOptions,\n): OperationOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n\n const retries = mapRetryOptions(options.retries);\n return {\n ...(retries !== undefined && { retries }),\n ...(options.signal !== undefined && { signal: options.signal }),\n ...(options.timeout !== undefined && { timeout: options.timeout }),\n };\n}\n\nasync function* normalizeNodeChunks(\n source: Readable,\n): AsyncGenerator<Uint8Array> {\n for await (const chunk of source) {\n if (typeof chunk === 'string') {\n yield new TextEncoder().encode(chunk);\n continue;\n }\n if (chunk instanceof Uint8Array) {\n yield chunk;\n continue;\n }\n throw new StorageError(\n 'Node upload streams must yield strings or Uint8Array chunks.',\n {\n code: StorageErrorCode.INVALID_ARGUMENT,\n permanent: true,\n },\n );\n }\n}\n\nfunction mapBody(body: StorageBody): Body {\n if (body instanceof Readable) {\n return Readable.toWeb(\n Readable.from(normalizeNodeChunks(body)),\n ) as ReadableStream<Uint8Array>;\n }\n return body;\n}\n\nfunction normalizeDownloadStream(\n source: ReadableStream<Uint8Array>,\n): ReadableStream<Uint8Array> {\n let reader: ReadableStreamDefaultReader<Uint8Array> | undefined =\n source.getReader();\n\n const release = (): void => {\n reader?.releaseLock();\n reader = undefined;\n };\n\n return new ReadableStream<Uint8Array>({\n async cancel(reason) {\n const activeReader = reader;\n if (activeReader === undefined) {\n return;\n }\n try {\n await activeReader.cancel(reason);\n } catch (error) {\n throw mapFilesSdkError(error);\n } finally {\n release();\n }\n },\n async pull(controller) {\n const activeReader = reader;\n if (activeReader === undefined) {\n controller.close();\n return;\n }\n try {\n const result = await activeReader.read();\n if (result.done) {\n release();\n controller.close();\n return;\n }\n controller.enqueue(result.value);\n } catch (error) {\n release();\n controller.error(mapFilesSdkError(error));\n }\n },\n });\n}\n\nfunction uploadOptions(\n options?: StorageUploadOptions,\n): UploadOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.cacheControl !== undefined && {\n cacheControl: options.cacheControl,\n }),\n ...(options.contentType !== undefined && {\n contentType: options.contentType,\n }),\n ...(options.control !== undefined && {\n control: getFilesSdkUploadControl(options.control),\n }),\n ...(options.metadata !== undefined && { metadata: options.metadata }),\n ...(options.multipart !== undefined && {\n multipart: options.multipart,\n }),\n ...(options.onProgress !== undefined && {\n onProgress: options.onProgress,\n }),\n };\n}\n\nfunction downloadOptions(options?: StorageDownloadOptions): DownloadOptions {\n return {\n ...operationOptions(options),\n as: 'stream',\n ...(options?.range !== undefined && { range: options.range }),\n };\n}\n\nfunction listOptions(options?: StorageListOptions): ListOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.cursor !== undefined && { cursor: options.cursor }),\n ...(options.delimiter !== undefined && { delimiter: options.delimiter }),\n ...(options.limit !== undefined && { limit: options.limit }),\n ...(options.prefix !== undefined && { prefix: options.prefix }),\n };\n}\n\nfunction searchOptions(\n options?: StorageSearchOptions,\n): SearchOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.caseInsensitive !== undefined && {\n caseInsensitive: options.caseInsensitive,\n }),\n ...(options.limit !== undefined && { limit: options.limit }),\n ...(options.match !== undefined && { match: options.match }),\n ...(options.maxResults !== undefined && {\n maxResults: options.maxResults,\n }),\n ...(options.prefix !== undefined && { prefix: options.prefix }),\n };\n}\n\nfunction signedDownloadOptions(\n options?: StorageSignedDownloadOptions,\n): UrlOptions | undefined {\n if (options === undefined) {\n return undefined;\n }\n return {\n ...operationOptions(options),\n ...(options.expiresIn !== undefined && {\n expiresIn: options.expiresIn,\n }),\n ...(options.responseContentDisposition !== undefined && {\n responseContentDisposition: options.responseContentDisposition,\n }),\n };\n}\n\nfunction signedUploadOptions(\n options: StorageSignedUploadOptions,\n): SignUploadOptions {\n return {\n ...operationOptions(options),\n expiresIn: options.expiresIn,\n ...(options.contentType !== undefined && {\n contentType: options.contentType,\n }),\n ...(options.maxSize !== undefined && { maxSize: options.maxSize }),\n ...(options.minSize !== undefined && { minSize: options.minSize }),\n };\n}\n\nfunction metadataOf(file: StoredFile): StorageObjectMetadata {\n return {\n contentType: file.type,\n ...(file.etag !== undefined && { etag: file.etag }),\n key: file.key,\n ...(file.lastModified !== undefined && {\n lastModified: new Date(file.lastModified),\n }),\n ...(file.metadata !== undefined && {\n metadata: { ...file.metadata },\n }),\n name: file.name,\n size: file.size,\n };\n}\n\nfunction uploadResultOf(result: UploadResult): StorageUploadResult {\n return {\n contentType: result.contentType,\n ...(result.etag !== undefined && { etag: result.etag }),\n key: result.key,\n ...(result.lastModified !== undefined && {\n lastModified: new Date(result.lastModified),\n }),\n size: result.size,\n };\n}\n\nexport class FilesSdkStorageDriver<\n AdapterType extends Adapter = Adapter,\n> implements StorageDriver {\n readonly #files: Files<AdapterType>;\n readonly #name: string;\n readonly #conditionalCopy: FilesSdkConditionalCopyAdapter | undefined;\n readonly #signedUploadPolicy: FilesSdkSignedUploadPolicyAdapter | undefined;\n readonly #signedDownloadPolicy:\n FilesSdkSignedDownloadPolicyAdapter | undefined;\n\n constructor(options: FilesSdkDriverOptions<AdapterType>) {\n this.#files = new Files(options);\n this.#name = options.adapter.name;\n this.#conditionalCopy = conditionalCopyAdapterOf(options.adapter);\n this.#signedUploadPolicy = signedUploadPolicyAdapterOf(options.adapter);\n this.#signedDownloadPolicy = signedDownloadPolicyAdapterOf(options.adapter);\n }\n\n get name(): string {\n return this.#name;\n }\n\n get capabilities() {\n const capabilities = this.#files.capabilities;\n return {\n cacheControl: capabilities.cacheControl,\n delimiter: capabilities.delimiter,\n metadata: capabilities.metadata,\n rangeRead: capabilities.rangeRead,\n resumableUpload: capabilities.multipart,\n serverSideCopy: capabilities.serverSideCopy,\n ...(this.#conditionalCopy !== undefined && {\n conditionalCopy: { ...this.#conditionalCopy.conditionalCopy },\n }),\n signedDownload: { ...capabilities.signedUrl },\n ...(this.#signedDownloadPolicy !== undefined && {\n signedDownloadPolicy: {\n ...this.#signedDownloadPolicy.signedDownloadPolicy,\n },\n }),\n signedUpload: 'runtime' as const,\n ...(this.#signedUploadPolicy !== undefined && {\n signedUploadPolicy: { ...this.#signedUploadPolicy.signedUploadPolicy },\n }),\n nativeUploadProgress: capabilities.uploadProgress,\n };\n }\n\n async upload(\n key: string,\n body: StorageBody,\n options?: StorageUploadOptions,\n ): Promise<StorageUploadResult> {\n return this.#call(async () =>\n uploadResultOf(\n await this.#files.upload(key, mapBody(body), uploadOptions(options)),\n ),\n );\n }\n\n async download(\n key: string,\n options?: StorageDownloadOptions,\n ): Promise<StorageObject> {\n return this.#call(async () => {\n const file = await this.#files.download(key, downloadOptions(options));\n return {\n ...metadataOf(file),\n body: normalizeDownloadStream(file.stream()),\n };\n });\n }\n\n async head(\n key: string,\n options?: StorageOperationOptions,\n ): Promise<StorageObjectMetadata> {\n return this.#call(async () =>\n metadataOf(await this.#files.head(key, operationOptions(options))),\n );\n }\n\n exists(key: string, options?: StorageOperationOptions): Promise<boolean> {\n return this.#call(() => this.#files.exists(key, operationOptions(options)));\n }\n\n delete(key: string, options?: StorageOperationOptions): Promise<void> {\n return this.#call(async () => {\n await this.#files.delete(key, operationOptions(options));\n });\n }\n\n copy(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n return this.#call(() =>\n this.#files.copy(sourceKey, destinationKey, operationOptions(options)),\n );\n }\n\n move(\n sourceKey: string,\n destinationKey: string,\n options?: StorageOperationOptions,\n ): Promise<void> {\n return this.#call(() =>\n this.#files.move(sourceKey, destinationKey, operationOptions(options)),\n );\n }\n\n promote(\n sourceKey: string,\n destinationKey: string,\n options: StoragePromotionOptions,\n ): Promise<void> {\n const adapter = this.#conditionalCopy;\n if (adapter === undefined || !adapter.conditionalCopy.supported) {\n return Promise.reject(\n new StorageError(\n `Storage adapter \"${this.#name}\" does not support conditional promotion.`,\n {\n code: StorageErrorCode.NOT_SUPPORTED,\n key: sourceKey,\n operation: 'promote',\n permanent: true,\n },\n ),\n );\n }\n return this.#call(() =>\n adapter.promote(sourceKey, destinationKey, options),\n );\n }\n\n async list(options?: StorageListOptions): Promise<StorageListResult> {\n return this.#call(async () => {\n const result = await this.#files.list(listOptions(options));\n return {\n items: result.items.map(metadataOf),\n ...(result.cursor !== undefined && { cursor: result.cursor }),\n ...(result.prefixes !== undefined && {\n prefixes: [...result.prefixes],\n }),\n };\n });\n }\n\n search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncIterable<StorageObjectMetadata> {\n return this.#search(pattern, options);\n }\n\n async *#search(\n pattern: string | RegExp,\n options?: StorageSearchOptions,\n ): AsyncGenerator<StorageObjectMetadata, void> {\n try {\n for await (const file of this.#files.search(\n pattern,\n searchOptions(options),\n )) {\n yield metadataOf(file);\n }\n } catch (error) {\n throw mapFilesSdkError(error);\n }\n }\n\n signDownload(\n key: string,\n options?: StorageSignedDownloadOptions,\n ): Promise<string> {\n return this.#call(() =>\n this.#files.url(key, signedDownloadOptions(options)),\n );\n }\n\n signUpload(\n key: string,\n options: StorageSignedUploadOptions,\n ): Promise<StorageSignedUpload> {\n return this.#call(() =>\n this.#files.signedUploadUrl(key, signedUploadOptions(options)),\n );\n }\n\n async #call<Result>(operation: () => Promise<Result>): Promise<Result> {\n try {\n return await operation();\n } catch (error) {\n throw mapFilesSdkError(error);\n }\n }\n}\n\nexport function createFilesSdkDriver<AdapterType extends Adapter>(\n options: FilesSdkDriverOptions<AdapterType>,\n): FilesSdkStorageDriver<AdapterType> {\n return new FilesSdkStorageDriver(options);\n}\n"]}
@@ -1,3 +1,3 @@
1
- export { FilesSdkStorageDriver, createFilesSdkDriver, type FilesSdkDriverOptions, } from './files-sdk.driver.js';
1
+ export { FilesSdkStorageDriver, createFilesSdkDriver, type FilesSdkConditionalCopyAdapter, type FilesSdkSignedUploadPolicyAdapter, type FilesSdkSignedDownloadPolicyAdapter, type FilesSdkDriverOptions, } from './files-sdk.driver.js';
2
2
  export type { Adapter as FilesSdkAdapter, FilesHooks as FilesSdkHooks, FilesPlugin as FilesSdkPlugin, } from 'files-sdk';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/files-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,OAAO,IAAI,eAAe,EAC1B,UAAU,IAAI,aAAa,EAC3B,WAAW,IAAI,cAAc,GAC9B,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/files-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,OAAO,IAAI,eAAe,EAC1B,UAAU,IAAI,aAAa,EAC3B,WAAW,IAAI,cAAc,GAC9B,MAAM,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/files-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAErB,MAAM,uBAAuB,CAAC","sourcesContent":["export {\n FilesSdkStorageDriver,\n createFilesSdkDriver,\n type FilesSdkDriverOptions,\n} from './files-sdk.driver.js';\n\nexport type {\n Adapter as FilesSdkAdapter,\n FilesHooks as FilesSdkHooks,\n FilesPlugin as FilesSdkPlugin,\n} from 'files-sdk';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/files-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAKrB,MAAM,uBAAuB,CAAC","sourcesContent":["export {\n FilesSdkStorageDriver,\n createFilesSdkDriver,\n type FilesSdkConditionalCopyAdapter,\n type FilesSdkSignedUploadPolicyAdapter,\n type FilesSdkSignedDownloadPolicyAdapter,\n type FilesSdkDriverOptions,\n} from './files-sdk.driver.js';\n\nexport type {\n Adapter as FilesSdkAdapter,\n FilesHooks as FilesSdkHooks,\n FilesPlugin as FilesSdkPlugin,\n} from 'files-sdk';\n"]}
@@ -0,0 +1,14 @@
1
+ import { type S3Adapter, type S3AdapterOptions } from 'files-sdk/s3';
2
+ import { type FilesSdkConditionalCopyAdapter, type FilesSdkDriverOptions, type FilesSdkSignedUploadPolicyAdapter, type FilesSdkSignedDownloadPolicyAdapter, type FilesSdkStorageDriver } from '../files-sdk.driver.js';
3
+ export interface S3StorageDriverOptions extends Omit<FilesSdkDriverOptions<S3Adapter>, 'adapter'> {
4
+ adapter: S3AdapterOptions;
5
+ }
6
+ type EnhancedS3Adapter = S3Adapter & FilesSdkConditionalCopyAdapter & FilesSdkSignedDownloadPolicyAdapter & FilesSdkSignedUploadPolicyAdapter;
7
+ /**
8
+ * Creates the files-sdk S3 driver from the storage package's own dependency
9
+ * context and adds an ETag/version-conditional server-side promotion.
10
+ */
11
+ export declare function createS3StorageDriver(options: S3StorageDriverOptions): FilesSdkStorageDriver<EnhancedS3Adapter>;
12
+ export { mapS3Error, s3 } from 'files-sdk/s3';
13
+ export type { S3Adapter, S3AdapterOptions, S3Sdk } from 'files-sdk/s3';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/files-sdk/s3/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,qBAAqB,EAE3B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,qBAAqB,CAAC,SAAS,CAAC,EAChC,SAAS,CACV;IACC,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,KAAK,iBAAiB,GAAG,SAAS,GAChC,8BAA8B,GAC9B,mCAAmC,GACnC,iCAAiC,CAAC;AA6DpC;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CAAC,iBAAiB,CAAC,CAyE1C;AAED,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { CopyObjectCommand } from '@aws-sdk/client-s3';
2
+ import { mapS3Error, s3, } from 'files-sdk/s3';
3
+ import { createFilesSdkDriver, mapFilesSdkError, } from '../files-sdk.driver.js';
4
+ function copySource(bucket, key, version) {
5
+ const source = `${encodeURIComponent(bucket)}/${encodeURIComponent(key)}`;
6
+ return version === undefined
7
+ ? source
8
+ : `${source}?versionId=${encodeURIComponent(version)}`;
9
+ }
10
+ function operationSignal(options) {
11
+ const timeoutSignal = options.timeout === undefined || options.timeout <= 0
12
+ ? undefined
13
+ : AbortSignal.timeout(options.timeout);
14
+ if (options.signal === undefined) {
15
+ return timeoutSignal;
16
+ }
17
+ return timeoutSignal === undefined
18
+ ? options.signal
19
+ : AbortSignal.any([options.signal, timeoutSignal]);
20
+ }
21
+ function maxRetries(options) {
22
+ const configured = typeof options.retries === 'number'
23
+ ? options.retries
24
+ : options.retries?.max;
25
+ return Math.max(0, Math.floor(configured ?? 0));
26
+ }
27
+ async function waitForRetry(milliseconds, signal) {
28
+ if (signal?.aborted === true) {
29
+ throw signal.reason;
30
+ }
31
+ await new Promise((resolve, reject) => {
32
+ const cleanup = () => signal?.removeEventListener('abort', abort);
33
+ const timer = setTimeout(() => {
34
+ cleanup();
35
+ resolve();
36
+ }, Math.max(0, milliseconds));
37
+ const abort = () => {
38
+ clearTimeout(timer);
39
+ cleanup();
40
+ reject(signal?.reason);
41
+ };
42
+ signal?.addEventListener('abort', abort, { once: true });
43
+ });
44
+ }
45
+ /**
46
+ * Creates the files-sdk S3 driver from the storage package's own dependency
47
+ * context and adds an ETag/version-conditional server-side promotion.
48
+ */
49
+ export function createS3StorageDriver(options) {
50
+ const { adapter: adapterOptions, ...filesOptions } = options;
51
+ const base = s3(adapterOptions);
52
+ const adapter = Object.assign(base, {
53
+ conditionalCopy: Object.freeze({
54
+ etag: true,
55
+ supported: true,
56
+ version: true,
57
+ }),
58
+ signedUploadPolicy: Object.freeze({
59
+ contentType: true,
60
+ sizeRange: true,
61
+ }),
62
+ signedDownloadPolicy: Object.freeze({
63
+ expiresIn: adapterOptions.publicBaseUrl === undefined,
64
+ }),
65
+ async promote(sourceKey, destinationKey, promotion) {
66
+ const retries = maxRetries(promotion);
67
+ for (let attempt = 0;; attempt += 1) {
68
+ const signal = operationSignal(promotion);
69
+ try {
70
+ await base.raw.send(new CopyObjectCommand({
71
+ Bucket: base.bucket,
72
+ CopySource: copySource(base.bucket, sourceKey, promotion.sourceVersion),
73
+ ...(promotion.sourceEtag !== undefined && {
74
+ CopySourceIfMatch: promotion.sourceEtag,
75
+ }),
76
+ Key: destinationKey,
77
+ }), signal === undefined ? undefined : { abortSignal: signal });
78
+ return;
79
+ }
80
+ catch (error) {
81
+ const mapped = mapS3Error(error);
82
+ if (attempt >= retries ||
83
+ mapped.code !== 'Provider' ||
84
+ mapped.aborted ||
85
+ mapped.permanent ||
86
+ signal?.aborted === true) {
87
+ throw mapped;
88
+ }
89
+ const storageError = mapFilesSdkError(mapped);
90
+ const delay = typeof promotion.retries === 'object' &&
91
+ promotion.retries.backoff !== undefined
92
+ ? promotion.retries.backoff({
93
+ attempt: attempt + 1,
94
+ error: storageError,
95
+ })
96
+ : Math.min(1000, 100 * 2 ** attempt);
97
+ await waitForRetry(delay, promotion.signal);
98
+ }
99
+ }
100
+ },
101
+ });
102
+ return createFilesSdkDriver({
103
+ ...filesOptions,
104
+ adapter,
105
+ });
106
+ }
107
+ export { mapS3Error, s3 } from 'files-sdk/s3';
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/files-sdk/s3/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,UAAU,EACV,EAAE,GAGH,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,oBAAoB,EAMpB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAchC,SAAS,UAAU,CACjB,MAAc,EACd,GAAW,EACX,OAA2B;IAE3B,MAAM,MAAM,GAAG,GAAG,kBAAkB,CAAC,MAAM,CA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G,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC;oBACzC,MAAM,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;KAGgC,CAAC,CAAC;IAErC,OAAO,oBAAoB,CAAC;QAC1B,GAAG,YAAY;QACf,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { CopyObjectCommand } from '@aws-sdk/client-s3';\nimport {\n mapS3Error,\n s3,\n type S3Adapter,\n type S3AdapterOptions,\n} from 'files-sdk/s3';\n\nimport type { StoragePromotionOptions } from '../../storage.types.js';\nimport {\n createFilesSdkDriver,\n type FilesSdkConditionalCopyAdapter,\n type FilesSdkDriverOptions,\n type FilesSdkSignedUploadPolicyAdapter,\n type FilesSdkSignedDownloadPolicyAdapter,\n type FilesSdkStorageDriver,\n mapFilesSdkError,\n} from '../files-sdk.driver.js';\n\nexport interface S3StorageDriverOptions extends Omit<\n FilesSdkDriverOptions<S3Adapter>,\n 'adapter'\n> {\n adapter: S3AdapterOptions;\n}\n\ntype EnhancedS3Adapter = S3Adapter &\n FilesSdkConditionalCopyAdapter &\n FilesSdkSignedDownloadPolicyAdapter &\n FilesSdkSignedUploadPolicyAdapter;\n\nfunction copySource(\n bucket: string,\n key: string,\n version: string | undefined,\n): string {\n const source = `${encodeURIComponent(bucket)}/${encodeURIComponent(key)}`;\n return version === undefined\n ? source\n : `${source}?versionId=${encodeURIComponent(version)}`;\n}\n\nfunction operationSignal(\n options: StoragePromotionOptions,\n): AbortSignal | undefined {\n const timeoutSignal =\n options.timeout === undefined || options.timeout <= 0\n ? undefined\n : AbortSignal.timeout(options.timeout);\n if (options.signal === undefined) {\n return timeoutSignal;\n }\n return timeoutSignal === undefined\n ? options.signal\n : AbortSignal.any([options.signal, timeoutSignal]);\n}\n\nfunction maxRetries(options: StoragePromotionOptions): number {\n const configured =\n typeof options.retries === 'number'\n ? options.retries\n : options.retries?.max;\n return Math.max(0, Math.floor(configured ?? 0));\n}\n\nasync function waitForRetry(\n milliseconds: number,\n signal: AbortSignal | undefined,\n): Promise<void> {\n if (signal?.aborted === true) {\n throw signal.reason;\n }\n await new Promise<void>((resolve, reject) => {\n const cleanup = (): void => signal?.removeEventListener('abort', abort);\n const timer = setTimeout(\n () => {\n cleanup();\n resolve();\n },\n Math.max(0, milliseconds),\n );\n const abort = (): void => {\n clearTimeout(timer);\n cleanup();\n reject(signal?.reason);\n };\n signal?.addEventListener('abort', abort, { once: true });\n });\n}\n\n/**\n * Creates the files-sdk S3 driver from the storage package's own dependency\n * context and adds an ETag/version-conditional server-side promotion.\n */\nexport function createS3StorageDriver(\n options: S3StorageDriverOptions,\n): FilesSdkStorageDriver<EnhancedS3Adapter> {\n const { adapter: adapterOptions, ...filesOptions } = options;\n const base = s3(adapterOptions);\n const adapter: EnhancedS3Adapter = Object.assign(base, {\n conditionalCopy: Object.freeze({\n etag: true,\n supported: true,\n version: true,\n }),\n signedUploadPolicy: Object.freeze({\n contentType: true,\n sizeRange: true,\n }),\n signedDownloadPolicy: Object.freeze({\n expiresIn: adapterOptions.publicBaseUrl === undefined,\n }),\n async promote(\n sourceKey: string,\n destinationKey: string,\n promotion: StoragePromotionOptions,\n ): Promise<void> {\n const retries = maxRetries(promotion);\n for (let attempt = 0; ; attempt += 1) {\n const signal = operationSignal(promotion);\n try {\n await base.raw.send(\n new CopyObjectCommand({\n Bucket: base.bucket,\n CopySource: copySource(\n base.bucket,\n sourceKey,\n promotion.sourceVersion,\n ),\n ...(promotion.sourceEtag !== undefined && {\n CopySourceIfMatch: promotion.sourceEtag,\n }),\n Key: destinationKey,\n }),\n signal === undefined ? undefined : { abortSignal: signal },\n );\n return;\n } catch (error) {\n const mapped = mapS3Error(error);\n if (\n attempt >= retries ||\n mapped.code !== 'Provider' ||\n mapped.aborted ||\n mapped.permanent ||\n signal?.aborted === true\n ) {\n throw mapped;\n }\n const storageError = mapFilesSdkError(mapped);\n const delay =\n typeof promotion.retries === 'object' &&\n promotion.retries.backoff !== undefined\n ? promotion.retries.backoff({\n attempt: attempt + 1,\n error: storageError,\n })\n : Math.min(1000, 100 * 2 ** attempt);\n await waitForRetry(delay, promotion.signal);\n }\n }\n },\n } satisfies FilesSdkConditionalCopyAdapter &\n FilesSdkSignedDownloadPolicyAdapter &\n FilesSdkSignedUploadPolicyAdapter);\n\n return createFilesSdkDriver({\n ...filesOptions,\n adapter,\n });\n}\n\nexport { mapS3Error, s3 } from 'files-sdk/s3';\nexport type { S3Adapter, S3AdapterOptions, S3Sdk } from 'files-sdk/s3';\n"]}
@@ -1,3 +1,3 @@
1
1
  export { StorageGatewayModule } from './storage-gateway.module.js';
2
- export { StorageGatewayOperation, type StorageGatewayMode, type StorageGatewayOperation as StorageGatewayOperationName, type StorageGatewayOptions, } from './storage-gateway.types.js';
2
+ export { StorageGatewayOperation, type ParsedStorageGatewayKey, type StorageGatewayKeyPolicy, type StorageGatewayKeyPolicyContext, type StorageGatewayKeyTarget, type StorageGatewayMode, type StorageGatewayOperation as StorageGatewayOperationName, type StorageGatewayOptions, } from './storage-gateway.types.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,uBAAuB,GAIxB,MAAM,4BAA4B,CAAC","sourcesContent":["export { StorageGatewayModule } from './storage-gateway.module.js';\nexport {\n StorageGatewayOperation,\n type StorageGatewayMode,\n type StorageGatewayOperation as StorageGatewayOperationName,\n type StorageGatewayOptions,\n} from './storage-gateway.types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EACL,uBAAuB,GAQxB,MAAM,4BAA4B,CAAC","sourcesContent":["export { StorageGatewayModule } from './storage-gateway.module.js';\nexport {\n StorageGatewayOperation,\n type ParsedStorageGatewayKey,\n type StorageGatewayKeyPolicy,\n type StorageGatewayKeyPolicyContext,\n type StorageGatewayKeyTarget,\n type StorageGatewayMode,\n type StorageGatewayOperation as StorageGatewayOperationName,\n type StorageGatewayOptions,\n} from './storage-gateway.types.js';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { StorageService } from '../storage.service.js';
2
- import { type ResolvedStorageGatewayOptions } from './storage-gateway.types.js';
2
+ import { type ResolvedStorageGatewayOptions, type StorageGatewayKeyPolicy } from './storage-gateway.types.js';
3
3
  interface ResponseEnvelope<Result> {
4
4
  data: Result;
5
5
  }
@@ -7,23 +7,24 @@ export declare class StorageGatewayController {
7
7
  #private;
8
8
  private readonly storage;
9
9
  private readonly options;
10
- constructor(storage: StorageService, options: ResolvedStorageGatewayOptions);
11
- download(key: string | undefined, proxy: string | undefined, rangeStart: string | undefined, rangeEnd: string | undefined, disposition: string | undefined, response: unknown): Promise<void>;
10
+ private readonly keyPolicy;
11
+ constructor(storage: StorageService, options: ResolvedStorageGatewayOptions, keyPolicy: StorageGatewayKeyPolicy);
12
+ download(key: string | undefined, proxy: string | undefined, rangeStart: string | undefined, rangeEnd: string | undefined, disposition: string | undefined, request: unknown, response: unknown): Promise<void>;
12
13
  upload(key: string | undefined, request: unknown): Promise<ResponseEnvelope<unknown>>;
13
- head(key: string | undefined, response: unknown): Promise<void>;
14
- delete(key: string | undefined): Promise<ResponseEnvelope<{
14
+ head(key: string | undefined, request: unknown, response: unknown): Promise<void>;
15
+ delete(key: string | undefined, request: unknown): Promise<ResponseEnvelope<{
15
16
  deleted: true;
16
17
  }>>;
17
- list(prefix: string | undefined, cursor: string | undefined, limit: string | undefined, delimiter: string | undefined): Promise<ResponseEnvelope<unknown>>;
18
- search(pattern: string | undefined, prefix: string | undefined, limit: string | undefined, maxResults: string | undefined, match: string | undefined, caseInsensitive: string | undefined): Promise<ResponseEnvelope<unknown>>;
19
- signDownload(body: unknown): Promise<ResponseEnvelope<{
18
+ list(prefix: string | undefined, cursor: string | undefined, limit: string | undefined, delimiter: string | undefined, request: unknown): Promise<ResponseEnvelope<unknown>>;
19
+ search(pattern: string | undefined, prefix: string | undefined, limit: string | undefined, maxResults: string | undefined, match: string | undefined, caseInsensitive: string | undefined, request: unknown): Promise<ResponseEnvelope<unknown>>;
20
+ signDownload(body: unknown, request: unknown): Promise<ResponseEnvelope<{
20
21
  url: string;
21
22
  }>>;
22
- signUpload(body: unknown): Promise<ResponseEnvelope<unknown>>;
23
- copy(body: unknown): Promise<ResponseEnvelope<{
23
+ signUpload(body: unknown, request: unknown): Promise<ResponseEnvelope<unknown>>;
24
+ copy(body: unknown, request: unknown): Promise<ResponseEnvelope<{
24
25
  copied: true;
25
26
  }>>;
26
- move(body: unknown): Promise<ResponseEnvelope<{
27
+ move(body: unknown, request: unknown): Promise<ResponseEnvelope<{
27
28
  moved: true;
28
29
  }>>;
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"storage-gateway.controller.d.ts","sourceRoot":"","sources":["../../src/gateway/storage-gateway.controller.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAWvD,OAAO,EAEL,KAAK,6BAA6B,EAEnC,MAAM,4BAA4B,CAAC;AAEpC,UAAU,gBAAgB,CAAC,MAAM;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAgQD,qBAEa,wBAAwB;;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,OAAO,EAAE,cAAc,EAEvB,OAAO,EAAE,6BAA6B;IAInD,QAAQ,CACE,GAAG,EAAE,MAAM,GAAG,SAAS,EACrB,KAAK,EAAE,MAAM,GAAG,SAAS,EACpB,UAAU,EAAE,MAAM,GAAG,SAAS,EAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,EACzB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC9C,QAAQ,EAAE,OAAO,GACvB,OAAO,CAAC,IAAI,CAAC;IA0GV,MAAM,CACI,GAAG,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,OAAO,GACtB,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAuD/B,IAAI,CACM,GAAG,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,OAAO,GACvB,OAAO,CAAC,IAAI,CAAC;IAcV,MAAM,CACI,GAAG,EAAE,MAAM,GAAG,SAAS,GACpC,OAAO,CAAC,gBAAgB,CAAC;QAAE,OAAO,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IASzC,IAAI,CACS,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC3B,KAAK,EAAE,MA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