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

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 (40) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +86 -3
  3. package/dist/files-sdk/files-sdk.driver.d.ts +18 -18
  4. package/dist/files-sdk/files-sdk.driver.d.ts.map +1 -1
  5. package/dist/files-sdk/fs/index.d.ts +21 -0
  6. package/dist/files-sdk/fs/index.d.ts.map +1 -0
  7. package/dist/files-sdk/fs/index.js +20 -0
  8. package/dist/files-sdk/fs/index.js.map +1 -0
  9. package/dist/files-sdk/provider/index.d.ts +54 -0
  10. package/dist/files-sdk/provider/index.d.ts.map +1 -0
  11. package/dist/files-sdk/provider/index.js +80 -0
  12. package/dist/files-sdk/provider/index.js.map +1 -0
  13. package/dist/files-sdk/s3/index.d.ts +13 -2
  14. package/dist/files-sdk/s3/index.d.ts.map +1 -1
  15. package/dist/files-sdk/s3/index.js +19 -8
  16. package/dist/files-sdk/s3/index.js.map +1 -1
  17. package/dist/gateway/storage-gateway-fastify-parser.d.ts.map +1 -1
  18. package/dist/gateway/storage-gateway-fastify-parser.js.map +1 -1
  19. package/dist/gateway/storage-gateway.controller.d.ts.map +1 -1
  20. package/dist/gateway/storage-gateway.controller.js.map +1 -1
  21. package/dist/gateway/storage-gateway.guard.d.ts.map +1 -1
  22. package/dist/gateway/storage-gateway.guard.js.map +1 -1
  23. package/dist/gateway/storage-gateway.module.d.ts.map +1 -1
  24. package/dist/gateway/storage-gateway.module.js.map +1 -1
  25. package/dist/gateway/storage-gateway.types.d.ts +10 -10
  26. package/dist/gateway/storage-gateway.types.d.ts.map +1 -1
  27. package/dist/inject-storage.decorator.js.map +1 -1
  28. package/dist/storage-upload-control.d.ts.map +1 -1
  29. package/dist/storage.client.d.ts.map +1 -1
  30. package/dist/storage.client.js.map +1 -1
  31. package/dist/storage.error.d.ts +10 -10
  32. package/dist/storage.error.d.ts.map +1 -1
  33. package/dist/storage.error.js.map +1 -1
  34. package/dist/storage.module.d.ts.map +1 -1
  35. package/dist/storage.module.js.map +1 -1
  36. package/dist/storage.service.d.ts.map +1 -1
  37. package/dist/storage.service.js.map +1 -1
  38. package/dist/storage.tokens.js.map +1 -1
  39. package/dist/testing/index.js.map +1 -1
  40. package/package.json +18 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @nestm/storage
2
2
 
3
+ ## 0.1.0-alpha.4
4
+
5
+ ### Minor Changes
6
+
7
+ - 79ad3af: Add runtime provider selection and a package-owned filesystem driver.
8
+
9
+ `@nestm/storage/files-sdk/provider` builds a driver from a provider slug carried
10
+ as data — `createProviderStorageDriver({ provider: 's3' | 'gcs' | 'azure' | 'r2'
11
+ | 'fs' | … })` — importing that provider's adapter, and only that one, on
12
+ demand. A deployment now selects its store with an environment variable and
13
+ installs a single native SDK instead of the application hard-coding a driver per
14
+ backend. The same entry point exposes the provider catalog (`listStorageProviders`,
15
+ `getStorageProvider`, `listStorageProviderEnvVars`,
16
+ `listStorageProviderSecretEnvVars`, `isStorageProvider`) as pure data, so config
17
+ validation and health checks can read a provider's env contract without loading
18
+ an adapter. An unknown slug fails closed with `INVALID_ARGUMENT` before anything
19
+ is imported.
20
+
21
+ `@nestm/storage/files-sdk/fs` adds `createFsStorageDriver` for local filesystem
22
+ storage, mirroring the S3 factory. Its adapter reaches only `node:fs`, so it adds
23
+ no native SDK to an install.
24
+
25
+ `@nestm/storage/files-sdk/s3` additionally exports `withS3Capabilities`, which
26
+ applies S3's conditional-copy promotion and signed-policy declarations to an
27
+ adapter built by `s3(...)`. The provider factory uses it so the `s3` slug keeps
28
+ those capabilities without re-deriving `S3AdapterOptions` from flat config.
29
+ `EnhancedS3Adapter` is now `S3StorageAdapter`; the type was not previously
30
+ exported.
31
+
3
32
  ## 0.1.0-alpha.3
4
33
 
5
34
  ### Minor Changes
package/README.md CHANGED
@@ -33,7 +33,7 @@ pinned engine explicitly only when the application imports another adapter
33
33
  such as `files-sdk/gcs`:
34
34
 
35
35
  ```sh
36
- pnpm add files-sdk@2.2.2
36
+ pnpm add files-sdk@2.2.3
37
37
  ```
38
38
 
39
39
  Install only the native SDKs required by the chosen provider. For example:
@@ -225,6 +225,71 @@ modules retain their own DI scope rather than mutating an application-wide
225
225
  registry. Names are case-sensitive and cannot contain leading or trailing
226
226
  whitespace.
227
227
 
228
+ ### Select the provider at runtime
229
+
230
+ An application that ships to more than one environment usually cannot name its
231
+ provider at build time. `createProviderStorageDriver` takes the slug as data and
232
+ imports that provider's adapter — and only that one — on demand, so a deployment
233
+ picks its store with an environment variable and installs one native SDK:
234
+
235
+ ```ts
236
+ import { createProviderStorageDriver } from '@nestm/storage/files-sdk/provider';
237
+
238
+ StorageModule.forRootAsync({
239
+ imports: [ConfigModule],
240
+ stores: [
241
+ {
242
+ name: 'media',
243
+ inject: [ConfigService],
244
+ useFactory: (config: ConfigService) =>
245
+ createProviderStorageDriver({
246
+ provider: config.getOrThrow('STORAGE_PROVIDER'),
247
+ prefix: config.get('STORAGE_PREFIX'),
248
+ config: {
249
+ bucket: config.get('STORAGE_BUCKET'),
250
+ region: config.get('STORAGE_REGION'),
251
+ root: config.get('STORAGE_ROOT'),
252
+ },
253
+ }),
254
+ },
255
+ ],
256
+ });
257
+ ```
258
+
259
+ `config` is one flat bag of provider settings — `bucket` and `region` for an
260
+ object store, `root` for the filesystem, `accountName` and `container` for
261
+ Azure. Each provider reads what it needs and ignores the rest, so the same shape
262
+ survives a provider change. Credentials may be omitted wherever the provider's
263
+ SDK resolves its own chain (an IAM role, Application Default Credentials, a
264
+ shared profile).
265
+
266
+ An unknown slug fails closed with `INVALID_ARGUMENT` before anything is
267
+ imported. Validate untrusted input up front with `isStorageProvider`, and drive
268
+ config validation from the catalog rather than a hand-kept list:
269
+
270
+ ```ts
271
+ import {
272
+ getStorageProvider,
273
+ isStorageProvider,
274
+ listStorageProviders,
275
+ listStorageProviderSecretEnvVars,
276
+ } from '@nestm/storage/files-sdk/provider';
277
+
278
+ listStorageProviders().map((provider) => provider.slug); // 'akamai', 'alibaba', …
279
+ getStorageProvider('gcs')?.peerDeps; // ['@google-cloud/storage', …]
280
+ listStorageProviderSecretEnvVars('s3').map((variable) => variable.key);
281
+ ```
282
+
283
+ The catalog is pure data and pulls in no adapter, so it is safe in config UIs,
284
+ health checks, and startup validation.
285
+
286
+ The `s3` slug additionally carries the conditional-promotion and signed-policy
287
+ capabilities described under
288
+ [Race-free staged-object promotion](#race-free-staged-object-promotion); every
289
+ other provider exposes exactly what its adapter declares. When the provider _is_
290
+ known at build time, import `@nestm/storage/files-sdk/s3` or
291
+ `@nestm/storage/files-sdk/fs` directly and skip the indirection.
292
+
228
293
  ## Storage API
229
294
 
230
295
  `StorageClient` exposes:
@@ -510,8 +575,26 @@ StorageModule.forRoot({
510
575
  });
511
576
  ```
512
577
 
513
- For local filesystem storage, import `fs` from `files-sdk/fs` and pass it to
514
- `createFilesSdkDriver` exactly like a cloud adapter.
578
+ For local filesystem storage, use the package-owned factory. The adapter reaches
579
+ only `node:fs`, so it needs no native SDK:
580
+
581
+ ```ts
582
+ import { createFsStorageDriver } from '@nestm/storage/files-sdk/fs';
583
+
584
+ StorageModule.forRoot({
585
+ stores: [
586
+ {
587
+ name: 'artifacts',
588
+ driver: createFsStorageDriver({ adapter: { root: './var/artifacts' } }),
589
+ },
590
+ ],
591
+ });
592
+ ```
593
+
594
+ Bodies are written verbatim at `<root>/<key>`. A `<key>.meta.json` sidecar beside
595
+ each one carries the content type, ETag, and custom metadata a filesystem has
596
+ nowhere else to put; sidecars never surface as keys, and uploading a key ending
597
+ in `.meta.json` fails closed rather than colliding with one.
515
598
 
516
599
  ## License
517
600
 
@@ -23,30 +23,30 @@ export declare class FilesSdkStorageDriver<AdapterType extends Adapter = Adapter
23
23
  constructor(options: FilesSdkDriverOptions<AdapterType>);
24
24
  get name(): string;
25
25
  get capabilities(): {
26
- nativeUploadProgress: boolean;
27
- signedUploadPolicy?: {
28
- contentType: boolean;
29
- sizeRange: boolean;
30
- };
31
- signedUpload: "runtime";
32
- signedDownloadPolicy?: {
33
- expiresIn: boolean;
34
- };
35
- signedDownload: {
36
- supported: boolean;
37
- maxExpiresIn?: number;
38
- };
39
- conditionalCopy?: {
40
- supported: boolean;
41
- etag: boolean;
42
- version: boolean;
43
- };
44
26
  cacheControl: boolean;
45
27
  delimiter: boolean;
46
28
  metadata: boolean;
47
29
  rangeRead: boolean;
48
30
  resumableUpload: boolean;
49
31
  serverSideCopy: boolean;
32
+ conditionalCopy?: {
33
+ supported: boolean;
34
+ etag: boolean;
35
+ version: boolean;
36
+ };
37
+ signedDownload: {
38
+ supported: boolean;
39
+ maxExpiresIn?: number;
40
+ };
41
+ signedDownloadPolicy?: {
42
+ expiresIn: boolean;
43
+ };
44
+ signedUpload: 'runtime';
45
+ signedUploadPolicy?: {
46
+ contentType: boolean;
47
+ sizeRange: boolean;
48
+ };
49
+ nativeUploadProgress: boolean;
50
50
  };
51
51
  upload(key: string, body: StorageBody, options?: StorageUploadOptions): Promise<StorageUploadResult>;
52
52
  download(key: string, options?: StorageDownloadOptions): Promise<StorageObject>;
@@ -1 +1 @@
1
- {"version":3,"file":"files-sdk.driver.d.ts","sourceRoot":"","sources":["../../src/files-sdk/files-sdk.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,OAAO,EAGZ,KAAK,YAAY,EAUlB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,gCAAgC,EAChC,uBAAuB,EAEvB,oBAAoB,EACpB,mCAAmC,EACnC,qCAAqC,EACrC,4BAA4B,EAC5B,mBAAmB,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,CAAC,WAAW,SAAS,OAAO,EAC9D,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAC1C,qBAAqB,CAAC,WAAW,CAAC,CAEpC"}
@@ -0,0 +1,21 @@
1
+ import { type FsAdapter, type FsAdapterOptions } from 'files-sdk/fs';
2
+ import { type FilesSdkDriverOptions, type FilesSdkStorageDriver } from '../files-sdk.driver.js';
3
+ export interface FsStorageDriverOptions extends Omit<FilesSdkDriverOptions<FsAdapter>, 'adapter'> {
4
+ adapter: FsAdapterOptions;
5
+ }
6
+ /**
7
+ * Creates the files-sdk filesystem driver from the storage package's own
8
+ * dependency context. The adapter reaches only `node:fs`, so this entry point
9
+ * adds no native SDK to the install — unlike every object-store provider, it is
10
+ * always available.
11
+ *
12
+ * The adapter keeps a `<key>.meta.json` sidecar beside each body to carry the
13
+ * content type, ETag, and custom metadata that a filesystem has nowhere else to
14
+ * put. Sidecars never surface as keys: `list` and `search` skip them, and
15
+ * uploading a key that ends in `.meta.json` fails closed rather than colliding
16
+ * with one.
17
+ */
18
+ export declare function createFsStorageDriver(options: FsStorageDriverOptions): FilesSdkStorageDriver<FsAdapter>;
19
+ export { fs, mapFsError } from 'files-sdk/fs';
20
+ export type { FsAdapter, FsAdapterOptions } from 'files-sdk/fs';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/files-sdk/fs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,qBAAqB,CAAC,SAAS,CAAC,EAChC,SAAS,CACV;IACC,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CAAC,SAAS,CAAC,CAGlC;AAED,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { fs } from 'files-sdk/fs';
2
+ import { createFilesSdkDriver, } from '../files-sdk.driver.js';
3
+ /**
4
+ * Creates the files-sdk filesystem driver from the storage package's own
5
+ * dependency context. The adapter reaches only `node:fs`, so this entry point
6
+ * adds no native SDK to the install — unlike every object-store provider, it is
7
+ * always available.
8
+ *
9
+ * The adapter keeps a `<key>.meta.json` sidecar beside each body to carry the
10
+ * content type, ETag, and custom metadata that a filesystem has nowhere else to
11
+ * put. Sidecars never surface as keys: `list` and `search` skip them, and
12
+ * uploading a key that ends in `.meta.json` fails closed rather than colliding
13
+ * with one.
14
+ */
15
+ export function createFsStorageDriver(options) {
16
+ const { adapter: adapterOptions, ...filesOptions } = options;
17
+ return createFilesSdkDriver({ ...filesOptions, adapter: fs(adapterOptions) });
18
+ }
19
+ export { fs, mapFsError } from 'files-sdk/fs';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/files-sdk/fs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAyC,MAAM,cAAc,CAAC;AAEzE,OAAO,EACL,oBAAoB,GAGrB,MAAM,wBAAwB,CAAC;AAShC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAA+B;IAE/B,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC;IAC7D,OAAO,oBAAoB,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { fs, type FsAdapter, type FsAdapterOptions } from 'files-sdk/fs';\n\nimport {\n createFilesSdkDriver,\n type FilesSdkDriverOptions,\n type FilesSdkStorageDriver,\n} from '../files-sdk.driver.js';\n\nexport interface FsStorageDriverOptions extends Omit<\n FilesSdkDriverOptions<FsAdapter>,\n 'adapter'\n> {\n adapter: FsAdapterOptions;\n}\n\n/**\n * Creates the files-sdk filesystem driver from the storage package's own\n * dependency context. The adapter reaches only `node:fs`, so this entry point\n * adds no native SDK to the install — unlike every object-store provider, it is\n * always available.\n *\n * The adapter keeps a `<key>.meta.json` sidecar beside each body to carry the\n * content type, ETag, and custom metadata that a filesystem has nowhere else to\n * put. Sidecars never surface as keys: `list` and `search` skip them, and\n * uploading a key that ends in `.meta.json` fails closed rather than colliding\n * with one.\n */\nexport function createFsStorageDriver(\n options: FsStorageDriverOptions,\n): FilesSdkStorageDriver<FsAdapter> {\n const { adapter: adapterOptions, ...filesOptions } = options;\n return createFilesSdkDriver({ ...filesOptions, adapter: fs(adapterOptions) });\n}\n\nexport { fs, mapFsError } from 'files-sdk/fs';\nexport type { FsAdapter, FsAdapterOptions } from 'files-sdk/fs';\n"]}
@@ -0,0 +1,54 @@
1
+ import type { Adapter } from 'files-sdk';
2
+ import { type LoadFilesOptions } from 'files-sdk/loader';
3
+ import { type EnvVar, type Provider, type ProviderSlug } from 'files-sdk/providers';
4
+ import { type FilesSdkDriverOptions, type FilesSdkStorageDriver } from '../files-sdk.driver.js';
5
+ /** Slug of a storage provider this package can build a driver for. */
6
+ export type StorageProviderName = ProviderSlug;
7
+ /**
8
+ * Flat, provider-specific settings — `bucket` and `region` for an object store,
9
+ * `root` for the filesystem, `accountName` and `container` for Azure, and so
10
+ * on. Every provider reads what it needs and ignores the rest, so one config
11
+ * shape serves a deployment that switches providers by name.
12
+ *
13
+ * Credentials may be omitted for any provider whose SDK resolves its own chain
14
+ * (an IAM role, Application Default Credentials, a shared profile).
15
+ */
16
+ export type StorageProviderConfig = Omit<LoadFilesOptions, 'provider'>;
17
+ export interface ProviderStorageDriverOptions extends Omit<FilesSdkDriverOptions<Adapter>, 'adapter'> {
18
+ /** Which provider to build. Validate untrusted input with {@link isStorageProvider}. */
19
+ provider: StorageProviderName;
20
+ config?: StorageProviderConfig;
21
+ }
22
+ /**
23
+ * Builds a {@link FilesSdkStorageDriver} for a provider named at runtime,
24
+ * importing that provider's adapter — and only that one — on demand. A
25
+ * deployment selects its store with a string (`'s3'`, `'gcs'`, `'azure'`,
26
+ * `'r2'`, `'fs'`, …) and installs one native SDK, instead of the application
27
+ * hard-coding a driver per backend.
28
+ *
29
+ * The `s3` slug additionally gets the conditional-promotion and signed-policy
30
+ * capabilities {@link createS3StorageDriver} attaches; every other provider
31
+ * exposes exactly what its adapter declares. Import
32
+ * `@nestm/storage/files-sdk/s3` directly when the provider is known at build
33
+ * time and the extra indirection buys nothing.
34
+ *
35
+ * @throws StorageError `INVALID_ARGUMENT` for an unknown slug, and whatever the
36
+ * adapter reports (mapped) when required config or credentials are missing.
37
+ */
38
+ export declare function createProviderStorageDriver(options: ProviderStorageDriverOptions): Promise<FilesSdkStorageDriver>;
39
+ /** Narrows an untrusted string — an env var, a config file — to a known slug. */
40
+ export declare function isStorageProvider(value: string): value is StorageProviderName;
41
+ /** Every provider that can be named, sorted by slug. */
42
+ export declare function listStorageProviders(): readonly Provider[];
43
+ /** One provider's display name, description, native SDKs, and env contract. */
44
+ export declare function getStorageProvider(slug: string): Provider | undefined;
45
+ /**
46
+ * Every environment variable a provider reads, flattened across required, all
47
+ * credential modes, and optional. Useful for validating a deployment's config
48
+ * before the first upload rather than at it.
49
+ */
50
+ export declare function listStorageProviderEnvVars(slug: string): EnvVar[];
51
+ /** The subset of {@link listStorageProviderEnvVars} that carries secrets. */
52
+ export declare function listStorageProviderSecretEnvVars(slug: string): EnvVar[];
53
+ export type { EnvVar as StorageProviderEnvVar, Provider as StorageProviderInfo, } from 'files-sdk/providers';
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/files-sdk/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEvE,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CACxD,qBAAqB,CAAC,OAAO,CAAC,EAC9B,SAAS,CACV;IACC,wFAAwF;IACxF,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,qBAAqB,CAAC,CAWhC;AAoCD,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,mBAAmB,CAE7E;AAED,wDAAwD;AACxD,wBAAgB,oBAAoB,IAAI,SAAS,QAAQ,EAAE,CAE1D;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAErE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjE;AAED,6EAA6E;AAC7E,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvE;AAED,YAAY,EACV,MAAM,IAAI,qBAAqB,EAC/B,QAAQ,IAAI,mBAAmB,GAChC,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { loadFiles } from 'files-sdk/loader';
2
+ import { PROVIDER_NAMES, getProvider, getSecretEnvVars, listEnvVars, } from 'files-sdk/providers';
3
+ import { StorageError, StorageErrorCode } from '../../storage.error.js';
4
+ import { createFilesSdkDriver, mapFilesSdkError, } from '../files-sdk.driver.js';
5
+ /**
6
+ * Builds a {@link FilesSdkStorageDriver} for a provider named at runtime,
7
+ * importing that provider's adapter — and only that one — on demand. A
8
+ * deployment selects its store with a string (`'s3'`, `'gcs'`, `'azure'`,
9
+ * `'r2'`, `'fs'`, …) and installs one native SDK, instead of the application
10
+ * hard-coding a driver per backend.
11
+ *
12
+ * The `s3` slug additionally gets the conditional-promotion and signed-policy
13
+ * capabilities {@link createS3StorageDriver} attaches; every other provider
14
+ * exposes exactly what its adapter declares. Import
15
+ * `@nestm/storage/files-sdk/s3` directly when the provider is known at build
16
+ * time and the extra indirection buys nothing.
17
+ *
18
+ * @throws StorageError `INVALID_ARGUMENT` for an unknown slug, and whatever the
19
+ * adapter reports (mapped) when required config or credentials are missing.
20
+ */
21
+ export async function createProviderStorageDriver(options) {
22
+ const { provider, config, ...filesOptions } = options;
23
+ if (!isStorageProvider(provider)) {
24
+ throw unknownProvider(provider);
25
+ }
26
+ // `loadFiles` owns the slug → adapter mapping and keeps the import lazy; the
27
+ // client it returns is discarded so the caller's own driver options (prefix,
28
+ // hooks, plugins, readonly, retries) apply to the instance the bridge builds.
29
+ const adapter = await resolveAdapter(provider, config);
30
+ return createFilesSdkDriver({ ...filesOptions, adapter });
31
+ }
32
+ async function resolveAdapter(provider, config) {
33
+ let resolved;
34
+ try {
35
+ resolved = await loadFiles({ ...config, provider });
36
+ }
37
+ catch (error) {
38
+ throw mapFilesSdkError(error);
39
+ }
40
+ const { adapter } = resolved.files;
41
+ if (provider !== 's3') {
42
+ return adapter;
43
+ }
44
+ // Built by `s3(...)`, so its `raw` is an S3Client and the promotion path
45
+ // holds. The S3-compatible wrappers keep only what they declare themselves.
46
+ const { withS3Capabilities } = await import('../s3/index.js');
47
+ return withS3Capabilities(adapter, {
48
+ ...(config?.publicBaseUrl !== undefined && {
49
+ publicBaseUrl: config.publicBaseUrl,
50
+ }),
51
+ });
52
+ }
53
+ function unknownProvider(provider) {
54
+ return new StorageError(`Unknown storage provider: ${JSON.stringify(provider)}. Known providers: ${PROVIDER_NAMES.join(', ')}.`, { code: StorageErrorCode.INVALID_ARGUMENT, permanent: true });
55
+ }
56
+ /** Narrows an untrusted string — an env var, a config file — to a known slug. */
57
+ export function isStorageProvider(value) {
58
+ return getProvider(value) !== undefined;
59
+ }
60
+ /** Every provider that can be named, sorted by slug. */
61
+ export function listStorageProviders() {
62
+ return PROVIDER_NAMES.flatMap((slug) => getProvider(slug) ?? []);
63
+ }
64
+ /** One provider's display name, description, native SDKs, and env contract. */
65
+ export function getStorageProvider(slug) {
66
+ return getProvider(slug);
67
+ }
68
+ /**
69
+ * Every environment variable a provider reads, flattened across required, all
70
+ * credential modes, and optional. Useful for validating a deployment's config
71
+ * before the first upload rather than at it.
72
+ */
73
+ export function listStorageProviderEnvVars(slug) {
74
+ return listEnvVars(slug);
75
+ }
76
+ /** The subset of {@link listStorageProviderEnvVars} that carries secrets. */
77
+ export function listStorageProviderSecretEnvVars(slug) {
78
+ return getSecretEnvVars(slug);
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/files-sdk/provider/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAyB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,WAAW,G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AE,aAAa,KAAK,SAAS,IAAI;YACzC,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAC;KACH,CACF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,OAAO,IAAI,YAAY,CACrB,6BAA6B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EACvG,EAAE,IAAI,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,SAAS,EAAE,IAAI,EAAE,CAC7D,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,WAAW,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AAC1C,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,oBAAoB;IAClC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAY;IACrD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,gCAAgC,CAAC,IAAY;IAC3D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import type { Adapter } from 'files-sdk';\nimport { loadFiles, type LoadFilesOptions } from 'files-sdk/loader';\nimport {\n PROVIDER_NAMES,\n getProvider,\n getSecretEnvVars,\n listEnvVars,\n type EnvVar,\n type Provider,\n type ProviderSlug,\n} from 'files-sdk/providers';\n\nimport { StorageError, StorageErrorCode } from '../../storage.error.js';\nimport {\n createFilesSdkDriver,\n mapFilesSdkError,\n type FilesSdkDriverOptions,\n type FilesSdkStorageDriver,\n} from '../files-sdk.driver.js';\n\n/** Slug of a storage provider this package can build a driver for. */\nexport type StorageProviderName = ProviderSlug;\n\n/**\n * Flat, provider-specific settings — `bucket` and `region` for an object store,\n * `root` for the filesystem, `accountName` and `container` for Azure, and so\n * on. Every provider reads what it needs and ignores the rest, so one config\n * shape serves a deployment that switches providers by name.\n *\n * Credentials may be omitted for any provider whose SDK resolves its own chain\n * (an IAM role, Application Default Credentials, a shared profile).\n */\nexport type StorageProviderConfig = Omit<LoadFilesOptions, 'provider'>;\n\nexport interface ProviderStorageDriverOptions extends Omit<\n FilesSdkDriverOptions<Adapter>,\n 'adapter'\n> {\n /** Which provider to build. Validate untrusted input with {@link isStorageProvider}. */\n provider: StorageProviderName;\n config?: StorageProviderConfig;\n}\n\n/**\n * Builds a {@link FilesSdkStorageDriver} for a provider named at runtime,\n * importing that provider's adapter — and only that one — on demand. A\n * deployment selects its store with a string (`'s3'`, `'gcs'`, `'azure'`,\n * `'r2'`, `'fs'`, …) and installs one native SDK, instead of the application\n * hard-coding a driver per backend.\n *\n * The `s3` slug additionally gets the conditional-promotion and signed-policy\n * capabilities {@link createS3StorageDriver} attaches; every other provider\n * exposes exactly what its adapter declares. Import\n * `@nestm/storage/files-sdk/s3` directly when the provider is known at build\n * time and the extra indirection buys nothing.\n *\n * @throws StorageError `INVALID_ARGUMENT` for an unknown slug, and whatever the\n * adapter reports (mapped) when required config or credentials are missing.\n */\nexport async function createProviderStorageDriver(\n options: ProviderStorageDriverOptions,\n): Promise<FilesSdkStorageDriver> {\n const { provider, config, ...filesOptions } = options;\n if (!isStorageProvider(provider)) {\n throw unknownProvider(provider);\n }\n\n // `loadFiles` owns the slug → adapter mapping and keeps the import lazy; the\n // client it returns is discarded so the caller's own driver options (prefix,\n // hooks, plugins, readonly, retries) apply to the instance the bridge builds.\n const adapter = await resolveAdapter(provider, config);\n return createFilesSdkDriver({ ...filesOptions, adapter });\n}\n\nasync function resolveAdapter(\n provider: StorageProviderName,\n config: StorageProviderConfig | undefined,\n): Promise<Adapter> {\n let resolved;\n try {\n resolved = await loadFiles({ ...config, provider });\n } catch (error) {\n throw mapFilesSdkError(error);\n }\n const { adapter } = resolved.files;\n if (provider !== 's3') {\n return adapter;\n }\n // Built by `s3(...)`, so its `raw` is an S3Client and the promotion path\n // holds. The S3-compatible wrappers keep only what they declare themselves.\n const { withS3Capabilities } = await import('../s3/index.js');\n return withS3Capabilities(\n adapter as Parameters<typeof withS3Capabilities>[0],\n {\n ...(config?.publicBaseUrl !== undefined && {\n publicBaseUrl: config.publicBaseUrl,\n }),\n },\n );\n}\n\nfunction unknownProvider(provider: string): StorageError {\n return new StorageError(\n `Unknown storage provider: ${JSON.stringify(provider)}. Known providers: ${PROVIDER_NAMES.join(', ')}.`,\n { code: StorageErrorCode.INVALID_ARGUMENT, permanent: true },\n );\n}\n\n/** Narrows an untrusted string — an env var, a config file — to a known slug. */\nexport function isStorageProvider(value: string): value is StorageProviderName {\n return getProvider(value) !== undefined;\n}\n\n/** Every provider that can be named, sorted by slug. */\nexport function listStorageProviders(): readonly Provider[] {\n return PROVIDER_NAMES.flatMap((slug) => getProvider(slug) ?? []);\n}\n\n/** One provider's display name, description, native SDKs, and env contract. */\nexport function getStorageProvider(slug: string): Provider | undefined {\n return getProvider(slug);\n}\n\n/**\n * Every environment variable a provider reads, flattened across required, all\n * credential modes, and optional. Useful for validating a deployment's config\n * before the first upload rather than at it.\n */\nexport function listStorageProviderEnvVars(slug: string): EnvVar[] {\n return listEnvVars(slug);\n}\n\n/** The subset of {@link listStorageProviderEnvVars} that carries secrets. */\nexport function listStorageProviderSecretEnvVars(slug: string): EnvVar[] {\n return getSecretEnvVars(slug);\n}\n\nexport type {\n EnvVar as StorageProviderEnvVar,\n Provider as StorageProviderInfo,\n} from 'files-sdk/providers';\n"]}
@@ -3,12 +3,23 @@ import { type FilesSdkConditionalCopyAdapter, type FilesSdkDriverOptions, type F
3
3
  export interface S3StorageDriverOptions extends Omit<FilesSdkDriverOptions<S3Adapter>, 'adapter'> {
4
4
  adapter: S3AdapterOptions;
5
5
  }
6
- type EnhancedS3Adapter = S3Adapter & FilesSdkConditionalCopyAdapter & FilesSdkSignedDownloadPolicyAdapter & FilesSdkSignedUploadPolicyAdapter;
6
+ export type S3StorageAdapter = S3Adapter & FilesSdkConditionalCopyAdapter & FilesSdkSignedDownloadPolicyAdapter & FilesSdkSignedUploadPolicyAdapter;
7
+ /**
8
+ * Adds the S3-only capabilities to an adapter already built by `s3(...)`: an
9
+ * ETag/version-conditional server-side promotion, and the signed upload and
10
+ * download policies the bridge advertises through `capabilities`.
11
+ *
12
+ * Exported so the provider factory can apply them to the adapter `loadFiles`
13
+ * resolved for the `s3` slug instead of re-deriving {@link S3AdapterOptions}
14
+ * from flat provider config. It expects an adapter whose `raw` is an `S3Client`
15
+ * — pass one built by `s3(...)`, not an S3-compatible wrapper.
16
+ */
17
+ export declare function withS3Capabilities(base: S3Adapter, options?: Pick<S3AdapterOptions, 'publicBaseUrl'>): S3StorageAdapter;
7
18
  /**
8
19
  * Creates the files-sdk S3 driver from the storage package's own dependency
9
20
  * context and adds an ETag/version-conditional server-side promotion.
10
21
  */
11
- export declare function createS3StorageDriver(options: S3StorageDriverOptions): FilesSdkStorageDriver<EnhancedS3Adapter>;
22
+ export declare function createS3StorageDriver(options: S3StorageDriverOptions): FilesSdkStorageDriver<S3StorageAdapter>;
12
23
  export { mapS3Error, s3 } from 'files-sdk/s3';
13
24
  export type { S3Adapter, S3AdapterOptions, S3Sdk } from 'files-sdk/s3';
14
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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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,CACnC,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CAAC,gBAAgB,CAAC,CAMzC;AAED,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC"}
@@ -43,13 +43,17 @@ async function waitForRetry(milliseconds, signal) {
43
43
  });
44
44
  }
45
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.
46
+ * Adds the S3-only capabilities to an adapter already built by `s3(...)`: an
47
+ * ETag/version-conditional server-side promotion, and the signed upload and
48
+ * download policies the bridge advertises through `capabilities`.
49
+ *
50
+ * Exported so the provider factory can apply them to the adapter `loadFiles`
51
+ * resolved for the `s3` slug instead of re-deriving {@link S3AdapterOptions}
52
+ * from flat provider config. It expects an adapter whose `raw` is an `S3Client`
53
+ * — pass one built by `s3(...)`, not an S3-compatible wrapper.
48
54
  */
49
- export function createS3StorageDriver(options) {
50
- const { adapter: adapterOptions, ...filesOptions } = options;
51
- const base = s3(adapterOptions);
52
- const adapter = Object.assign(base, {
55
+ export function withS3Capabilities(base, options = {}) {
56
+ return Object.assign(base, {
53
57
  conditionalCopy: Object.freeze({
54
58
  etag: true,
55
59
  supported: true,
@@ -60,7 +64,7 @@ export function createS3StorageDriver(options) {
60
64
  sizeRange: true,
61
65
  }),
62
66
  signedDownloadPolicy: Object.freeze({
63
- expiresIn: adapterOptions.publicBaseUrl === undefined,
67
+ expiresIn: options.publicBaseUrl === undefined,
64
68
  }),
65
69
  async promote(sourceKey, destinationKey, promotion) {
66
70
  const retries = maxRetries(promotion);
@@ -99,9 +103,16 @@ export function createS3StorageDriver(options) {
99
103
  }
100
104
  },
101
105
  });
106
+ }
107
+ /**
108
+ * Creates the files-sdk S3 driver from the storage package's own dependency
109
+ * context and adds an ETag/version-conditional server-side promotion.
110
+ */
111
+ export function createS3StorageDriver(options) {
112
+ const { adapter: adapterOptions, ...filesOptions } = options;
102
113
  return createFilesSdkDriver({
103
114
  ...filesOptions,
104
- adapter,
115
+ adapter: withS3Capabilities(s3(adapterOptions), adapterOptions),
105
116
  });
106
117
  }
107
118
  export { mapS3Error, s3 } from 'files-sdk/s3';
@@ -1 +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,CAAC,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1E,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,GAAG,MAAM,cAAc,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;AAC3D,CAAC;AAED,SAAS,eAAe,CACtB,OAAgC;IAEhC,MAAM,aAAa,GACjB,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC;QACnD,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,OAAO,aAAa,KAAK,SAAS;QAChC,CAAC,CAAC,OAAO,CAAC,MAAM;QAChB,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,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AAK,CAAC,CAAC;oBACjC,IACE,OAAO,IAAI,OAAO;wBAClB,MAAM,CAAC,IAAI,KAAK,UAAU;wBAC1B,MAAM,CAAC,OAAO;wBACd,MAAM,CAAC,SAAS;wBAChB,MAAM,EAAE,OAAO,KAAK,IAAI,EACxB,CAAC;wBACD,MAAM,MAAM,CAAC;oBACf,CAAC;oBACD,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAC9C,MAAM,KAAK,GACT,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ;wBACrC,SAAS,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS;wBACrC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;4BACxB,OAAO,EAAE,OAAO,GAAG,CAAC;4BACpB,KAAK,EAAE,YAAY;yBACpB,CAAC;wBACJ,CAAC,CAAC,IAAI,CAAC,GAAG,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
+ {"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,GAC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AI,CAAC,GAAG,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;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAA+B;IAE/B,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC;IAC7D,OAAO,oBAAoB,CAAC;QAC1B,GAAG,YAAY;QACf,OAAO,EAAE,kBAAkB,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;KAChE,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\nexport type S3StorageAdapter = 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 * Adds the S3-only capabilities to an adapter already built by `s3(...)`: an\n * ETag/version-conditional server-side promotion, and the signed upload and\n * download policies the bridge advertises through `capabilities`.\n *\n * Exported so the provider factory can apply them to the adapter `loadFiles`\n * resolved for the `s3` slug instead of re-deriving {@link S3AdapterOptions}\n * from flat provider config. It expects an adapter whose `raw` is an `S3Client`\n * pass one built by `s3(...)`, not an S3-compatible wrapper.\n */\nexport function withS3Capabilities(\n base: S3Adapter,\n options: Pick<S3AdapterOptions, 'publicBaseUrl'> = {},\n): S3StorageAdapter {\n return 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: options.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\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<S3StorageAdapter> {\n const { adapter: adapterOptions, ...filesOptions } = options;\n return createFilesSdkDriver({\n ...filesOptions,\n adapter: withS3Capabilities(s3(adapterOptions), adapterOptions),\n });\n}\n\nexport { mapS3Error, s3 } from 'files-sdk/s3';\nexport type { S3Adapter, S3AdapterOptions, S3Sdk } from 'files-sdk/s3';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"storage-gateway-fastify-parser.d.ts","sourceRoot":"","sources":["../../src/gateway/storage-gateway-fastify-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,eAAO,MAAM,6BAA6B,8BAA8B,CAAC;AAqBzE,qBACa,2BAA4B,YAAW,YAAY;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,eAAe;IAEzD,YAAY,IAAI,IAAI;CAyBrB"}
1
+ {"version":3,"file":"storage-gateway-fastify-parser.d.ts","sourceRoot":"","sources":["../../src/gateway/storage-gateway-fastify-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,eAAO,MAAM,6BAA6B,8BAA8B,CAAC;AAqBzE,qBACa,2BAA4B,YAAW,YAAY;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAxC,YAA6B,WAAW,EAAE,eAAe,EAAI;IAE7D,YAAY,IAAI,IAAI,CAwBnB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage-gateway-fastify-parser.js","sourceRoot":"","sources":["../../src/gateway/storage-gateway-fastify-parser.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,UAAU,EACV,6BAA6B,GAE9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,MAAM,CAAC,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAEzE,SAAS,oBAAoB;IAC3B,OAAO,IAAI,6BAA6B,CACtC,kDAAkD,CACnD,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAc;IAEd,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,SAAS,GAAG,KAAuC,CAAC;IAC1D,OAAO,CACL,OAAO,SAAS,CAAC,oBAAoB,KAAK,UAAU;QACpD,OAAO,SAAS,CAAC,oBAAoB,KAAK,UAAU,CACrD,CAAC;AACJ,CAAC;AAGM,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACT;IAA7B,YAA6B,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;IAAG,CAAC;IAE7D,YAAY;QACV,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAC5D,IACE,CAAC,uBAAuB,CAAC,QAAQ,CAAC;YAClC,QAAQ,CAAC,oBAAoB,CAAC,0BAA0B,CAAC,EACzD,CAAC;YACD,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,oBAAoB,CAC3B,0BAA0B,EAC1B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YACzB,MAAM,aAAa,GAAG,OAA+B,CAAC;YACtD,IACE,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,CAClC,6BAA6B,CAC9B,KAAK,IAAI,EACV,CAAC;gBACD,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;gBAC7B,OAAO;YACT,CAAC;YACD,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5BY,2BAA2B;IADvC,UAAU,EAAE;qCAE+B,eAAe;GAD9C,2BAA2B,CA4BvC","sourcesContent":["import {\n Injectable,\n UnsupportedMediaTypeException,\n type OnModuleInit,\n} from '@nestjs/common';\nimport { HttpAdapterHost } from '@nestjs/core';\nimport type { Readable } from 'node:stream';\n\ninterface FastifyParserInstance {\n hasContentTypeParser(contentType: string): boolean;\n addContentTypeParser(\n contentType: string,\n parser: (\n request: unknown,\n payload: Readable,\n done: (error: Error | null, body?: unknown) => void,\n ) => void,\n ): void;\n}\n\ninterface FastifyParserRequest {\n routeOptions?: {\n config?: Record<string, unknown>;\n };\n}\n\nexport const FASTIFY_STORAGE_UPLOAD_CONFIG = 'nestmStorageGatewayUpload';\n\nfunction unsupportedMediaType(): Error {\n return new UnsupportedMediaTypeException(\n 'Unsupported Media Type: application/octet-stream',\n );\n}\n\nfunction isFastifyParserInstance(\n value: unknown,\n): value is FastifyParserInstance {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const candidate = value as Partial<FastifyParserInstance>;\n return (\n typeof candidate.addContentTypeParser === 'function' &&\n typeof candidate.hasContentTypeParser === 'function'\n );\n}\n\n@Injectable()\nexport class StorageGatewayFastifyParser implements OnModuleInit {\n constructor(private readonly adapterHost: HttpAdapterHost) {}\n\n onModuleInit(): void {\n const instance = this.adapterHost.httpAdapter.getInstance();\n if (\n !isFastifyParserInstance(instance) ||\n instance.hasContentTypeParser('application/octet-stream')\n ) {\n return;\n }\n\n instance.addContentTypeParser(\n 'application/octet-stream',\n (request, payload, done) => {\n const parserRequest = request as FastifyParserRequest;\n if (\n parserRequest.routeOptions?.config?.[\n FASTIFY_STORAGE_UPLOAD_CONFIG\n ] !== true\n ) {\n done(unsupportedMediaType());\n return;\n }\n done(null, payload);\n },\n );\n }\n}\n"]}
1
+ {"version":3,"file":"storage-gateway-fastify-parser.js","sourceRoot":"","sources":["../../src/gateway/storage-gateway-fastify-parser.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,UAAU,EACV,6BAA6B,GAE9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,MAAM,CAAC,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAEzE,SAAS,oBAAoB;IAC3B,OAAO,IAAI,6BAA6B,CACtC,kDAAkD,CACnD,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAc;IAEd,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,SAAS,GAAG,KAAuC,CAAC;IAC1D,OAAO,CACL,OAAO,SAAS,CAAC,oBAAoB,KAAK,UAAU;QACpD,OAAO,SAAS,CAAC,oBAAoB,KAAK,UAAU,CACrD,CAAC;AACJ,CAAC;AAGM,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACT,WAAW;IAAxC,YAA6B,WAA4B;2BAA5B,WAAW;IAAoB,CAAC;IAE7D,YAAY;QACV,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;QAC5D,IACE,CAAC,uBAAuB,CAAC,QAAQ,CAAC;YAClC,QAAQ,CAAC,oBAAoB,CAAC,0BAA0B,CAAC,EACzD,CAAC;YACD,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,oBAAoB,CAC3B,0BAA0B,EAC1B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YACzB,MAAM,aAAa,GAAG,OAA+B,CAAC;YACtD,IACE,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,CAClC,6BAA6B,CAC9B,KAAK,IAAI,EACV,CAAC;gBACD,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;gBAC7B,OAAO;YACT,CAAC;YACD,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5BY,2BAA2B;IADvC,UAAU,EAAE;qCAE+B,eAAe;GAD9C,2BAA2B,CA4BvC","sourcesContent":["import {\n Injectable,\n UnsupportedMediaTypeException,\n type OnModuleInit,\n} from '@nestjs/common';\nimport { HttpAdapterHost } from '@nestjs/core';\nimport type { Readable } from 'node:stream';\n\ninterface FastifyParserInstance {\n hasContentTypeParser(contentType: string): boolean;\n addContentTypeParser(\n contentType: string,\n parser: (\n request: unknown,\n payload: Readable,\n done: (error: Error | null, body?: unknown) => void,\n ) => void,\n ): void;\n}\n\ninterface FastifyParserRequest {\n routeOptions?: {\n config?: Record<string, unknown>;\n };\n}\n\nexport const FASTIFY_STORAGE_UPLOAD_CONFIG = 'nestmStorageGatewayUpload';\n\nfunction unsupportedMediaType(): Error {\n return new UnsupportedMediaTypeException(\n 'Unsupported Media Type: application/octet-stream',\n );\n}\n\nfunction isFastifyParserInstance(\n value: unknown,\n): value is FastifyParserInstance {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const candidate = value as Partial<FastifyParserInstance>;\n return (\n typeof candidate.addContentTypeParser === 'function' &&\n typeof candidate.hasContentTypeParser === 'function'\n );\n}\n\n@Injectable()\nexport class StorageGatewayFastifyParser implements OnModuleInit {\n constructor(private readonly adapterHost: HttpAdapterHost) {}\n\n onModuleInit(): void {\n const instance = this.adapterHost.httpAdapter.getInstance();\n if (\n !isFastifyParserInstance(instance) ||\n instance.hasContentTypeParser('application/octet-stream')\n ) {\n return;\n }\n\n instance.addContentTypeParser(\n 'application/octet-stream',\n (request, payload, done) => {\n const parserRequest = request as FastifyParserRequest;\n if (\n parserRequest.routeOptions?.config?.[\n FASTIFY_STORAGE_UPLOAD_CONFIG\n ] !== true\n ) {\n done(unsupportedMediaType());\n return;\n }\n done(null, payload);\n },\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"storage-gateway.controller.d.ts","sourceRoot":"","sources":["../../src/gateway/storage-gateway.controller.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAcvD,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAG7B,MAAM,4BAA4B,CAAC;AAEpC,UAAU,gBAAgB,CAAC,MAAM;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAoWD,qBAEa,wBAAwB;;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAJT,OAAO,EAAE,cAAc,EAEvB,OAAO,EAAE,6BAA6B,EAEtC,SAAS,EAAE,uBAAuB;IAI/C,QAAQ,CACE,GAAG,EAAE,MAAM,GAAG,SAAS,EACrB,KAAK,EAAE,MAAM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