@fastly/compute-js-static-publish 8.0.0-beta.2 → 8.0.0-beta.20

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 (113) hide show
  1. package/README.md +19 -5
  2. package/README.short.md +19 -5
  3. package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
  4. package/build/cli/cli/commands/manage/clean.js +17 -24
  5. package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
  6. package/build/cli/cli/commands/manage/collections/delete.js +13 -23
  7. package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
  8. package/build/cli/cli/commands/manage/collections/index.js +7 -15
  9. package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
  10. package/build/cli/cli/commands/manage/collections/list.js +12 -22
  11. package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
  12. package/build/cli/cli/commands/manage/collections/promote.js +12 -22
  13. package/build/cli/cli/commands/manage/collections/update-expiration.d.ts.map +1 -1
  14. package/build/cli/cli/commands/manage/collections/update-expiration.js +12 -22
  15. package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
  16. package/build/cli/cli/commands/manage/index.js +7 -15
  17. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  18. package/build/cli/cli/commands/manage/publish-content.js +201 -92
  19. package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
  20. package/build/cli/cli/commands/scaffold/index.js +54 -32
  21. package/build/cli/cli/compression/brotli.d.ts +2 -1
  22. package/build/cli/cli/compression/brotli.d.ts.map +1 -1
  23. package/build/cli/cli/compression/brotli.js +15 -4
  24. package/build/cli/cli/compression/gzip.d.ts +2 -1
  25. package/build/cli/cli/compression/gzip.d.ts.map +1 -1
  26. package/build/cli/cli/compression/gzip.js +8 -4
  27. package/build/cli/cli/compression/index.d.ts +4 -1
  28. package/build/cli/cli/compression/index.d.ts.map +1 -1
  29. package/build/cli/cli/index.js +8 -0
  30. package/build/cli/cli/storage/kv-store-local-provider.d.ts +3 -5
  31. package/build/cli/cli/storage/kv-store-local-provider.d.ts.map +1 -1
  32. package/build/cli/cli/storage/kv-store-local-provider.js +3 -8
  33. package/build/cli/cli/storage/kv-store-provider.d.ts +4 -5
  34. package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
  35. package/build/cli/cli/storage/kv-store-provider.js +38 -66
  36. package/build/cli/cli/storage/s3-storage-provider.d.ts +6 -6
  37. package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
  38. package/build/cli/cli/storage/s3-storage-provider.js +54 -51
  39. package/build/cli/cli/storage/storage-provider.d.ts +9 -8
  40. package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
  41. package/build/cli/cli/storage/storage-provider.js +13 -0
  42. package/build/cli/cli/util/api-token.d.ts.map +1 -1
  43. package/build/cli/cli/util/api-token.js +0 -28
  44. package/build/cli/cli/util/config.d.ts.map +1 -1
  45. package/build/cli/cli/util/config.js +8 -1
  46. package/build/cli/cli/util/content-types.d.ts.map +1 -1
  47. package/build/cli/cli/util/content-types.js +5 -2
  48. package/build/cli/cli/util/kv-store-items.d.ts +12 -0
  49. package/build/cli/cli/util/kv-store-items.d.ts.map +1 -1
  50. package/build/cli/cli/util/kv-store-items.js +49 -0
  51. package/build/cli/cli/util/kv-store.d.ts +6 -0
  52. package/build/cli/cli/util/kv-store.d.ts.map +1 -1
  53. package/build/cli/cli/util/kv-store.js +39 -2
  54. package/build/cli/cli/util/purge.d.ts +19 -0
  55. package/build/cli/cli/util/purge.d.ts.map +1 -0
  56. package/build/cli/cli/util/purge.js +83 -0
  57. package/build/cli/cli/util/retryable.d.ts +2 -1
  58. package/build/cli/cli/util/retryable.d.ts.map +1 -1
  59. package/build/cli/cli/util/retryable.js +34 -1
  60. package/build/cli/cli/util/s3-credentials.d.ts +11 -0
  61. package/build/cli/cli/util/s3-credentials.d.ts.map +1 -0
  62. package/build/cli/cli/util/s3-credentials.js +38 -0
  63. package/build/cli/cli/util/s3.d.ts +1 -1
  64. package/build/cli/cli/util/s3.d.ts.map +1 -1
  65. package/build/cli/cli/util/s3.js +1 -1
  66. package/build/cli/cli/util/service-id.d.ts +10 -0
  67. package/build/cli/cli/util/service-id.d.ts.map +1 -0
  68. package/build/cli/cli/util/service-id.js +26 -0
  69. package/build/cli/cli/util/variants.d.ts +2 -1
  70. package/build/cli/cli/util/variants.d.ts.map +1 -1
  71. package/build/cli/cli/util/variants.js +8 -4
  72. package/build/cli/models/assets/index.js +1 -1
  73. package/build/cli/models/config/publish-content-config.d.ts +2 -0
  74. package/build/cli/models/config/publish-content-config.d.ts.map +1 -1
  75. package/build/cli/models/config/s3-storage-config.d.ts +1 -0
  76. package/build/cli/models/config/s3-storage-config.d.ts.map +1 -1
  77. package/build/cli/models/config/s3-storage-config.js +1 -0
  78. package/build/cli/models/config/static-publish-rc.d.ts +1 -0
  79. package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
  80. package/build/cli/models/config/static-publish-rc.js +3 -1
  81. package/build/cli/models/metadata/index.js +1 -1
  82. package/build/server/models/assets/index.js +1 -1
  83. package/build/server/models/config/publish-content-config.d.ts +2 -0
  84. package/build/server/models/config/publish-content-config.d.ts.map +1 -1
  85. package/build/server/models/config/s3-storage-config.d.ts +1 -0
  86. package/build/server/models/config/s3-storage-config.d.ts.map +1 -1
  87. package/build/server/models/config/s3-storage-config.js +1 -0
  88. package/build/server/models/config/static-publish-rc.d.ts +1 -0
  89. package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
  90. package/build/server/models/config/static-publish-rc.js +3 -1
  91. package/build/server/models/metadata/index.js +1 -1
  92. package/build/server/server/index.d.ts +1 -1
  93. package/build/server/server/index.d.ts.map +1 -1
  94. package/build/server/server/index.js +1 -1
  95. package/build/server/server/publisher-server/index.d.ts +14 -0
  96. package/build/server/server/publisher-server/index.d.ts.map +1 -1
  97. package/build/server/server/publisher-server/index.js +178 -54
  98. package/build/server/server/publisher-server/response-cache.d.ts +19 -0
  99. package/build/server/server/publisher-server/response-cache.d.ts.map +1 -0
  100. package/build/server/server/publisher-server/response-cache.js +106 -0
  101. package/build/server/server/storage/s3-storage-provider.d.ts +16 -15
  102. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  103. package/build/server/server/storage/s3-storage-provider.js +131 -60
  104. package/build/server/server/storage/storage-provider.d.ts +2 -2
  105. package/build/server/server/storage/storage-provider.d.ts.map +1 -1
  106. package/build/server/server/storage/storage-provider.js +2 -1
  107. package/build/server/server/util/server-timing.d.ts +7 -0
  108. package/build/server/server/util/server-timing.d.ts.map +1 -0
  109. package/build/server/server/util/server-timing.js +34 -0
  110. package/package.json +9 -8
  111. package/build/cli/cli/util/aws-credentials.d.ts +0 -12
  112. package/build/cli/cli/util/aws-credentials.d.ts.map +0 -1
  113. package/build/cli/cli/util/aws-credentials.js +0 -67
@@ -1 +1 @@
1
- {"version":3,"file":"brotli.d.ts","sourceRoot":"","sources":["../../../../src/cli/compression/brotli.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,GAAG,OAAO,CAAC;AAExB,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
1
+ {"version":3,"file":"brotli.d.ts","sourceRoot":"","sources":["../../../../src/cli/compression/brotli.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,GAAG,OAAO,CAAC;AAMxB,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAexG"}
@@ -4,9 +4,20 @@
4
4
  */
5
5
  import fs from 'node:fs';
6
6
  import zlib from 'node:zlib';
7
+ import { promisify } from 'node:util';
7
8
  export const key = 'br';
8
- export async function compressTo(src, dest) {
9
- const buffer = fs.readFileSync(src);
10
- const resultBuffer = zlib.brotliCompressSync(buffer);
11
- fs.writeFileSync(dest, resultBuffer);
9
+ // The async version runs on the libuv thread pool, so that more than one
10
+ // file can be compressed at the same time.
11
+ const brotliCompress = promisify(zlib.brotliCompress);
12
+ export async function compressTo(src, dest, options = {}) {
13
+ const buffer = await fs.promises.readFile(src);
14
+ // If no quality is specified, use the zlib default (11, the maximum).
15
+ const zlibOptions = {};
16
+ if (options.brotliQuality != null) {
17
+ zlibOptions.params = {
18
+ [zlib.constants.BROTLI_PARAM_QUALITY]: options.brotliQuality,
19
+ };
20
+ }
21
+ const resultBuffer = await brotliCompress(buffer, zlibOptions);
22
+ await fs.promises.writeFile(dest, resultBuffer);
12
23
  }
@@ -1,3 +1,4 @@
1
+ import type { CompressOptions } from './index.js';
1
2
  export declare const key = "gzip";
2
- export declare function compressTo(src: string, dest: string): Promise<void>;
3
+ export declare function compressTo(src: string, dest: string, _options?: CompressOptions): Promise<void>;
3
4
  //# sourceMappingURL=gzip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../../../src/cli/compression/gzip.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,GAAG,SAAS,CAAC;AAE1B,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
1
+ {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../../../src/cli/compression/gzip.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,GAAG,SAAS,CAAC;AAM1B,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzG"}
@@ -4,9 +4,13 @@
4
4
  */
5
5
  import fs from 'node:fs';
6
6
  import zlib from 'node:zlib';
7
+ import { promisify } from 'node:util';
7
8
  export const key = 'gzip';
8
- export async function compressTo(src, dest) {
9
- const buffer = fs.readFileSync(src);
10
- const resultBuffer = zlib.gzipSync(buffer);
11
- fs.writeFileSync(dest, resultBuffer);
9
+ // The async version runs on the libuv thread pool, so that more than one
10
+ // file can be compressed at the same time.
11
+ const gzip = promisify(zlib.gzip);
12
+ export async function compressTo(src, dest, _options = {}) {
13
+ const buffer = await fs.promises.readFile(src);
14
+ const resultBuffer = await gzip(buffer);
15
+ await fs.promises.writeFile(dest, resultBuffer);
12
16
  }
@@ -1,5 +1,8 @@
1
1
  import { type ContentCompressionTypes } from '../../models/compression/index.js';
2
- export type CompressAlg = (src: string, dest: string) => Promise<void>;
2
+ export type CompressOptions = {
3
+ brotliQuality?: number;
4
+ };
5
+ export type CompressAlg = (src: string, dest: string, options?: CompressOptions) => Promise<void>;
3
6
  declare const algs: Record<ContentCompressionTypes, CompressAlg>;
4
7
  export { algs };
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/compression/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvE,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,CAGtD,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/compression/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,MAAM,MAAM,eAAe,GAAG;IAE5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElG,QAAA,MAAM,IAAI,EAAE,MAAM,CAAC,uBAAuB,EAAE,WAAW,CAGtD,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -4,6 +4,7 @@
4
4
  * Licensed under the MIT license. See LICENSE file for details.
5
5
  */
6
6
  import fs from 'node:fs';
7
+ import { availableParallelism } from 'node:os';
7
8
  import * as scaffoldCommand from './commands/scaffold/index.js';
8
9
  import * as manageCommands from './commands/manage/index.js';
9
10
  // Register storage builder providers
@@ -14,6 +15,13 @@ import * as s3StorageProvider from './storage/s3-storage-provider.js';
14
15
  registerStorageProviderBuilder(kvStoreProvider.buildStoreProvider);
15
16
  registerStorageProviderBuilder(kvStoreLocalProvider.buildStoreProvider);
16
17
  registerStorageProviderBuilder(s3StorageProvider.buildStoreProvider);
18
+ // Compression runs on the libuv thread pool, which has 4 threads by default.
19
+ // Use more threads on machines with more cores. libuv reads this value when it
20
+ // first uses the pool, so set it before any async work. A value that the user
21
+ // sets is kept.
22
+ if (process.env.UV_THREADPOOL_SIZE == null) {
23
+ process.env.UV_THREADPOOL_SIZE = String(Math.max(4, Math.min(availableParallelism(), 16)));
24
+ }
17
25
  if (!fs.existsSync('./static-publish.rc.js')) {
18
26
  console.log("🧑‍💻Fastly Compute JavaScript Static Publisher (Scaffolding mode)");
19
27
  await scaffoldCommand.action(process.argv);
@@ -1,5 +1,4 @@
1
- import { type AssetVariantMetadata } from '../../models/assets/index.js';
2
- import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch } from './storage-provider.js';
1
+ import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type ApplyBatchOptions } from './storage-provider.js';
3
2
  export declare const buildStoreProvider: StorageProviderBuilder;
4
3
  export declare class KvStoreLocalProvider implements StorageProvider {
5
4
  constructor(storeFile: string, computeAppDir: string);
@@ -10,11 +9,10 @@ export declare class KvStoreLocalProvider implements StorageProvider {
10
9
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
11
10
  submitStorageEntry(key: string, filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
12
11
  deleteStorageEntry(key: string): Promise<void>;
13
- applyBatch(batch: StorageProviderBatch): Promise<void>;
12
+ applyBatch(batch: StorageProviderBatch, _options?: ApplyBatchOptions): Promise<void>;
14
13
  doConcurrentParallel<TObject extends {
15
14
  key: string;
16
- }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number): Promise<void>;
15
+ }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
17
16
  calculateNumChunks(size: number): number;
18
- getExistingAssetVariant(_variantKey: string): Promise<AssetVariantMetadata | null>;
19
17
  }
20
18
  //# sourceMappingURL=kv-store-local-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kv-store-local-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-local-provider.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AAoBtC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAK/B,eAAO,MAAM,kBAAkB,EAAE,sBAkBhC,CAAC;AAEF,qBAAa,oBAAqB,YAAW,eAAe;gBAExD,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM;IAMvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAEzB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,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,EAAE,MAAM,GAAG,MAAM;CAGzC"}
@@ -64,7 +64,7 @@ export class KvStoreLocalProvider {
64
64
  async deleteStorageEntry(key) {
65
65
  await localKvStoreDeleteEntry(this.storeFile, key);
66
66
  }
67
- async applyBatch(batch) {
67
+ async applyBatch(batch, _options = {}) {
68
68
  console.log(`🍪 Chunking large files...`);
69
69
  await applyKVStoreEntriesChunks(batch.storageProviderBatchEntries, KV_STORE_CHUNK_SIZE);
70
70
  console.log(`✅ Large files have been chunked.`);
@@ -72,15 +72,10 @@ export class KvStoreLocalProvider {
72
72
  writeKVStoreEntriesForLocal(this.storeFile, this.computeAppDir, batch.storageProviderBatchEntries);
73
73
  console.log(`✅ Wrote KV Store entries for local server.`);
74
74
  }
75
- async doConcurrentParallel(objects, fn, maxConcurrent) {
76
- await concurrentParallel(objects, fn, () => null, maxConcurrent);
75
+ async doConcurrentParallel(objects, fn, maxConcurrent, throwOnError = false) {
76
+ await concurrentParallel(objects, fn, () => null, maxConcurrent, throwOnError);
77
77
  }
78
78
  calculateNumChunks(size) {
79
79
  return Math.ceil(size / KV_STORE_CHUNK_SIZE);
80
80
  }
81
- async getExistingAssetVariant(_variantKey) {
82
- // The purpose of this function is to use a HEAD request against storage
83
- // to save time by checking for an existing item. This is not applicable for local.
84
- return null;
85
- }
86
81
  }
@@ -1,7 +1,6 @@
1
- import { type AssetVariantMetadata } from '../../models/assets/index.js';
2
1
  import { type FastlyApiContext } from '../util/api-token.js';
3
2
  import { type KvStoreEntryInfo } from '../util/kv-store.js';
4
- import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch } from './storage-provider.js';
3
+ import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type StorageProviderBatchEntry, type ApplyBatchOptions } from './storage-provider.js';
5
4
  export declare const buildStoreProvider: StorageProviderBuilder;
6
5
  export declare class KvStoreProvider implements StorageProvider {
7
6
  constructor(storeName: string, fastlyApiToken: string);
@@ -12,12 +11,12 @@ export declare class KvStoreProvider implements StorageProvider {
12
11
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
13
12
  submitStorageEntry(key: string, _filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
14
13
  deleteStorageEntry(key: string): Promise<void>;
15
- applyBatch(batch: StorageProviderBatch): Promise<void>;
14
+ applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
15
+ uploadEntries(entries: StorageProviderBatchEntry[]): Promise<void>;
16
16
  doConcurrentParallel<TObject extends {
17
17
  key: string;
18
- }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number): Promise<void>;
18
+ }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
19
19
  calculateNumChunks(size: number): number;
20
- getExistingAssetVariant(variantKey: string): Promise<AssetVariantMetadata | null>;
21
20
  }
22
21
  export declare function kvStoreEntryToStorageEntry(kvStoreEntry: KvStoreEntryInfo): StorageEntry;
23
22
  export declare function parseKvStoreMetadata(metadata: string): Record<string, string> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"kv-store-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-provider.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,kBAAkB,EAAE,sBAsBhC,CAAC;AAEF,qBAAa,eAAgB,YAAW,eAAe;gBAEnD,SAAS,EAAE,MAAM,EACjB,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AAO,CAAC,IAAI,CAAC;IAsBvF,aAAa,CAAC,OAAO,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0ClE,oBAAoB,CAAC,OAAO,SAAS;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EACxD,OAAO,EAAE,OAAO,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,aAAa,GAAE,MAAW,EAC1B,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC;IAqBhB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAIzC;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,gBAAgB,gBAuB/B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,iCAiCpD"}
@@ -3,14 +3,13 @@
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
5
  import fs from 'node:fs';
6
- import { decodeAssetVariantMetadata, } from '../../models/assets/index.js';
7
6
  import { isKvStoreConfigRc, } from '../../models/config/static-publish-rc.js';
8
7
  import { getKvStoreConfigFromRc, } from '../../models/config/kv-store-config.js';
9
8
  import { FetchError, loadApiToken, } from '../util/api-token.js';
10
9
  import { rootRelative, } from '../util/files.js';
11
- import { getKvStoreEntry, getKVStoreKeys, kvStoreDeleteEntry, kvStoreSubmitEntry, getKvStoreEntryInfo, } from '../util/kv-store.js';
12
- import { applyKVStoreEntriesChunks, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
13
- import { concurrentParallel, } from '../util/retryable.js';
10
+ import { getKvStoreEntry, getKVStoreKeys, kvStoreDeleteEntry, kvStoreSubmitEntry, kvStoreSubmitBatch, } from '../util/kv-store.js';
11
+ import { applyKVStoreEntriesChunks, packNdjsonBatches, ndjsonLineForBatchEntry, entriesToUpload, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
12
+ import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
14
13
  export const buildStoreProvider = (config, context) => {
15
14
  if (isKvStoreConfigRc(config) && !context.localMode) {
16
15
  console.log(` Working on the Fastly KV Store...`);
@@ -55,20 +54,43 @@ export class KvStoreProvider {
55
54
  async deleteStorageEntry(key) {
56
55
  await kvStoreDeleteEntry(this.fastlyApiContext, this.kvStoreName, key);
57
56
  }
58
- async applyBatch(batch) {
57
+ async applyBatch(batch, options = {}) {
58
+ const { existingKeys } = options;
59
59
  console.log(`🍪 Chunking large files...`);
60
60
  await applyKVStoreEntriesChunks(batch.storageProviderBatchEntries, KV_STORE_CHUNK_SIZE);
61
61
  console.log(`✅ Large files have been chunked.`);
62
- console.log(`📤 Uploading entries to KV Store.`);
63
- // fastlyApiContext is non-null if useKvStore is true
64
- await this.doConcurrentParallel(batch.storageProviderBatchEntries.filter(x => x.write), async ({ filePath, metadataJson }, key) => {
62
+ let toWrite = batch.storageProviderBatchEntries;
63
+ if (existingKeys != null) {
64
+ toWrite = entriesToUpload(toWrite, existingKeys);
65
+ console.log(` | ${batch.storageProviderBatchEntries.length - toWrite.length} chunk(s) already present in the KV Store.`);
66
+ }
67
+ console.log(`📤 Uploading ${toWrite.length} entries to KV Store.`);
68
+ await this.uploadEntries(toWrite);
69
+ console.log(`✅ Uploaded entries to KV Store.`);
70
+ }
71
+ async uploadEntries(entries) {
72
+ const { batches, oversized } = packNdjsonBatches(entries);
73
+ await this.doConcurrentParallel(oversized, async ({ filePath, metadataJson }, key) => {
65
74
  const fileBytes = fs.readFileSync(filePath);
66
75
  await kvStoreSubmitEntry(this.fastlyApiContext, this.kvStoreName, key, fileBytes, metadataJson != null ? JSON.stringify(metadataJson) : undefined);
67
- console.log(` 🌐 Submitted asset "${rootRelative(filePath)}" to KV Store with key "${key}".`);
68
- });
69
- console.log(`✅ Uploaded entries to KV Store.`);
76
+ console.log(` 🌐 Submitted large asset "${rootRelative(filePath)}" to KV Store with key "${key}".`);
77
+ }, 12, true);
78
+ await this.doConcurrentParallel(batches, async (batch, key) => {
79
+ const lines = batch.entries.map(ndjsonLineForBatchEntry);
80
+ const failures = await kvStoreSubmitBatch(this.fastlyApiContext, this.kvStoreName, lines);
81
+ if (failures.length > 0) {
82
+ // Keep only the entries that failed. The retry submits only these entries.
83
+ const failedKeys = new Set(failures.map(f => f.key));
84
+ const submittedCount = batch.entries.length;
85
+ batch.entries = batch.entries.filter(entry => failedKeys.has(entry.key));
86
+ const shown = failures.slice(0, 5).map(f => `${f.key} (${f.code ?? 'unknown'}: ${f.reason ?? 'unknown'})`).join(', ');
87
+ const more = failures.length > 5 ? `, and ${failures.length - 5} more` : '';
88
+ throw makeRetryable(new Error(`${failures.length} of ${submittedCount} entries failed: ${shown}${more}`));
89
+ }
90
+ console.log(` 🌐 Submitted ${batch.entries.length} entries to KV Store ("${key}").`);
91
+ }, 12, true);
70
92
  }
71
- async doConcurrentParallel(objects, fn, maxConcurrent = 12) {
93
+ async doConcurrentParallel(objects, fn, maxConcurrent = 12, throwOnError = false) {
72
94
  await concurrentParallel(objects, fn, (err) => {
73
95
  if (err instanceof FetchError) {
74
96
  return `HTTP ${err.status}`;
@@ -76,65 +98,15 @@ export class KvStoreProvider {
76
98
  else if (err instanceof TypeError) {
77
99
  return 'transport';
78
100
  }
101
+ else if (err instanceof Error) {
102
+ return err.message;
103
+ }
79
104
  return null;
80
- }, maxConcurrent);
105
+ }, maxConcurrent, throwOnError);
81
106
  }
82
107
  calculateNumChunks(size) {
83
108
  return Math.ceil(size / KV_STORE_CHUNK_SIZE);
84
109
  }
85
- async getExistingAssetVariant(variantKey) {
86
- let kvStoreItemMetadata = null;
87
- const items = [{
88
- key: variantKey,
89
- }];
90
- await this.doConcurrentParallel(items, async (_, variantKey) => {
91
- // fastlyApiContext is non-null if useKvStore is true
92
- const kvStoreEntryInfo = await getKvStoreEntryInfo(this.fastlyApiContext, this.kvStoreName, variantKey);
93
- if (!kvStoreEntryInfo) {
94
- return;
95
- }
96
- let itemMetadata;
97
- if (kvStoreEntryInfo.metadata != null) {
98
- try {
99
- itemMetadata = JSON.parse(kvStoreEntryInfo.metadata);
100
- }
101
- catch {
102
- // if the metadata does not parse successfully as JSON,
103
- // treat it as though it didn't exist.
104
- }
105
- itemMetadata = decodeAssetVariantMetadata(itemMetadata);
106
- }
107
- if (itemMetadata != null) {
108
- let exists = false;
109
- if (itemMetadata.size <= KV_STORE_CHUNK_SIZE) {
110
- // For an item equal to or smaller than the chunk size, if it exists
111
- // and its metadata asserts no chunk count, then we assume it exists.
112
- if (itemMetadata.numChunks === undefined) {
113
- exists = true;
114
- }
115
- }
116
- else {
117
- // For chunked objects, if the first chunk exists, and its metadata asserts
118
- // the same number of chunks based on size, then we assume it exists (for now).
119
- // In the future we might actually check for the existence and sizes of
120
- // every chunk in the KV Store.
121
- const expectedNumChunks = Math.ceil(itemMetadata.size / KV_STORE_CHUNK_SIZE);
122
- if (itemMetadata.numChunks === expectedNumChunks) {
123
- exists = true;
124
- }
125
- }
126
- if (exists) {
127
- kvStoreItemMetadata = {
128
- contentEncoding: itemMetadata.contentEncoding,
129
- size: itemMetadata.size,
130
- hash: itemMetadata.hash,
131
- numChunks: itemMetadata.numChunks,
132
- };
133
- }
134
- }
135
- });
136
- return kvStoreItemMetadata;
137
- }
138
110
  }
139
111
  export function kvStoreEntryToStorageEntry(kvStoreEntry) {
140
112
  const storageEntry = {};
@@ -1,16 +1,17 @@
1
1
  import { S3Client } from '@aws-sdk/client-s3';
2
2
  import { type Command, type HttpHandlerOptions } from '@aws-sdk/types';
3
- import { type AssetVariantMetadata } from '../../models/assets/index.js';
4
- import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch } from './storage-provider.js';
3
+ import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type ApplyBatchOptions } from './storage-provider.js';
5
4
  type CommandOutput<C> = C extends Command<any, any, any, infer O, any> ? O : never;
5
+ export declare const DEFAULT_S3_UPLOAD_CONCURRENCY = 64;
6
6
  export declare const buildStoreProvider: StorageProviderBuilder;
7
7
  export declare class S3StorageProvider implements StorageProvider {
8
- constructor(s3Region: string, accessKeyId: string, secretAccessKey: string, s3Bucket: string, s3Endpoint?: string);
8
+ constructor(s3Region: string, accessKeyId: string, secretAccessKey: string, s3Bucket: string, s3Endpoint?: string, uploadConcurrency?: number);
9
9
  private readonly s3Region;
10
10
  private readonly accessKeyId;
11
11
  private readonly secretAccessKey;
12
12
  private readonly s3Bucket;
13
13
  private readonly s3Endpoint?;
14
+ private readonly uploadConcurrency;
14
15
  private s3Client?;
15
16
  getS3Client(): S3Client;
16
17
  sendS3ClientCommand<C extends Command<any, any, any, any, any>>(command: C, options?: HttpHandlerOptions): Promise<CommandOutput<C>>;
@@ -19,12 +20,11 @@ export declare class S3StorageProvider implements StorageProvider {
19
20
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
20
21
  submitStorageEntry(key: string, _filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
21
22
  deleteStorageEntry(key: string): Promise<void>;
22
- applyBatch(batch: StorageProviderBatch): Promise<void>;
23
+ applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
23
24
  doConcurrentParallel<TObject extends {
24
25
  key: string;
25
- }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number): Promise<void>;
26
+ }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
26
27
  calculateNumChunks(_size: number): number;
27
- getExistingAssetVariant(variantKey: string): Promise<AssetVariantMetadata | null>;
28
28
  }
29
29
  export {};
30
30
  //# sourceMappingURL=s3-storage-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mapp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CAAC,YAAY,GAAG,IAAI,CAAC;IA6B1D,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAwB9D,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EACzE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IAaV,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9C,UAAU,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BvF,oBAAoB,CAAC,OAAO,SAAS;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EACxD,OAAO,EAAE,OAAO,EAAE,EAClB,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/D,aAAa,GAAE,MAAW,EAC1B,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC;IAmBhB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAI1C"}
@@ -3,38 +3,44 @@
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
5
  import fs from 'node:fs';
6
- import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client, S3ServiceException, } from '@aws-sdk/client-s3';
7
- import { decodeAssetVariantMetadata, } from '../../models/assets/index.js';
6
+ import http from 'node:http';
7
+ import https from 'node:https';
8
+ import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, PutObjectCommand, S3Client, S3ServiceException, paginateListObjectsV2, } from '@aws-sdk/client-s3';
8
9
  import { isS3StorageConfigRc, } from '../../models/config/static-publish-rc.js';
9
10
  import { getS3StorageConfigFromRc, } from '../../models/config/s3-storage-config.js';
10
- import { loadAwsCredentials, } from '../util/aws-credentials.js';
11
+ import { entriesToUpload } from '../util/kv-store-items.js';
12
+ import { loadS3Credentials, } from '../util/s3-credentials.js';
11
13
  import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
12
14
  import { rootRelative, } from '../util/files.js';
15
+ // The number of objects to upload at the same time. S3 accepts many parallel
16
+ // requests, and each request mostly waits for the network. In a test with small
17
+ // objects, 64 was approximately 4 times faster than 12.
18
+ export const DEFAULT_S3_UPLOAD_CONCURRENCY = 64;
13
19
  export const buildStoreProvider = async (config, context) => {
14
20
  if (isS3StorageConfigRc(config)) {
15
- console.log(` Working on S3 (or compatible) storage...`);
21
+ console.log(` Working on S3 (or compatible) storage (BETA)...`);
16
22
  }
17
23
  else {
18
24
  return null;
19
25
  }
20
26
  const { region, bucket, endpoint, } = getS3StorageConfigFromRc(config);
21
- console.log(` | Using S3 storage`);
27
+ console.log(` | Using S3 storage (BETA)`);
22
28
  console.log(` Region : ${region}`);
23
29
  console.log(` Bucket : ${bucket}`);
24
30
  console.log(` Endpoint: ${endpoint ?? 'default'}`);
25
- const awsCredentialsResult = await loadAwsCredentials({
26
- awsProfile: context.awsProfile,
27
- awsAccessKeyId: context.awsAccessKeyId,
28
- awsSecretAccessKey: context.awsSecretAccessKey,
31
+ const s3CredentialsResult = await loadS3Credentials({
32
+ s3AccessKeyId: context.s3AccessKeyId,
33
+ s3SecretAccessKey: context.s3SecretAccessKey,
29
34
  });
30
- if (awsCredentialsResult == null) {
31
- throw new Error("❌ S3 Credentials not provided.\nProvide an AWS access key ID and secret access key that has write access to the S3 Storage.\nRefer to the README file and --help for additional information.");
35
+ if (s3CredentialsResult == null) {
36
+ throw new Error("❌ S3 Credentials not provided.\nProvide an access key ID and secret access key that have write access to the S3 or compatible storage.\nRefer to the README file and --help for additional information.");
32
37
  }
33
- console.log(`✔️ S3 Credentials: ${awsCredentialsResult.awsAccessKeyId.slice(0, 4)}${'*'.repeat(awsCredentialsResult.awsAccessKeyId.length - 4)} from '${awsCredentialsResult.source}'`);
34
- return new S3StorageProvider(region, awsCredentialsResult.awsAccessKeyId, awsCredentialsResult.awsSecretAccessKey, bucket, endpoint);
38
+ console.log(`✔️ S3 Credentials: ${s3CredentialsResult.s3AccessKeyId.slice(0, 4)}${'*'.repeat(s3CredentialsResult.s3AccessKeyId.length - 4)} from '${s3CredentialsResult.source}'`);
39
+ return new S3StorageProvider(region, s3CredentialsResult.s3AccessKeyId, s3CredentialsResult.s3SecretAccessKey, bucket, endpoint, context.s3UploadConcurrency ?? DEFAULT_S3_UPLOAD_CONCURRENCY);
35
40
  };
36
41
  export class S3StorageProvider {
37
- constructor(s3Region, accessKeyId, secretAccessKey, s3Bucket, s3Endpoint) {
42
+ constructor(s3Region, accessKeyId, secretAccessKey, s3Bucket, s3Endpoint, uploadConcurrency = DEFAULT_S3_UPLOAD_CONCURRENCY) {
43
+ this.uploadConcurrency = uploadConcurrency;
38
44
  this.s3Region = s3Region;
39
45
  this.accessKeyId = accessKeyId;
40
46
  this.secretAccessKey = secretAccessKey;
@@ -45,7 +51,14 @@ export class S3StorageProvider {
45
51
  if (this.s3Client != null) {
46
52
  return this.s3Client;
47
53
  }
54
+ // The SDK default is 50 sockets. Use at least one socket for each
55
+ // concurrent upload, so that uploads do not wait for a socket.
56
+ const maxSockets = Math.max(50, this.uploadConcurrency);
48
57
  this.s3Client = new S3Client({
58
+ requestHandler: {
59
+ httpAgent: new http.Agent({ keepAlive: true, maxSockets }),
60
+ httpsAgent: new https.Agent({ keepAlive: true, maxSockets }),
61
+ },
49
62
  region: this.s3Region,
50
63
  endpoint: this.s3Endpoint,
51
64
  forcePathStyle: this.s3Endpoint != null,
@@ -69,20 +82,27 @@ export class S3StorageProvider {
69
82
  }
70
83
  }
71
84
  async getStorageKeys(prefix) {
85
+ const paginationConfig = {
86
+ client: this.getS3Client(),
87
+ };
72
88
  const input = {
73
89
  Bucket: this.s3Bucket,
74
- MaxKeys: 4096,
75
90
  Prefix: prefix,
76
- ContinuationToken: undefined, // pagination
77
91
  };
78
- const command = new ListObjectsV2Command(input);
79
- const response = await this.sendS3ClientCommand(command);
80
- if (response.Contents == null) {
81
- return null;
92
+ const paginator = paginateListObjectsV2(paginationConfig, input);
93
+ const objectKeys = [];
94
+ for await (const { Contents } of paginator) {
95
+ if (Contents == null) {
96
+ continue;
97
+ }
98
+ for (const obj of Contents) {
99
+ if (obj.Key != null) {
100
+ objectKeys.push(obj.Key);
101
+ }
102
+ }
82
103
  }
83
- return response.Contents
84
- .map(c => c.Key)
85
- .filter(c => c != null);
104
+ // An empty list is a valid result. The callers use null only for an error.
105
+ return objectKeys;
86
106
  }
87
107
  async getStorageEntry(key) {
88
108
  const input = {
@@ -152,18 +172,22 @@ export class S3StorageProvider {
152
172
  const command = new DeleteObjectCommand(input);
153
173
  await this.sendS3ClientCommand(command);
154
174
  }
155
- async applyBatch(batch) {
156
- console.log(`📤 Uploading entries to S3 storage.`);
157
- // fastlyApiContext is non-null if useKvStore is true
158
- await this.doConcurrentParallel(batch.storageProviderBatchEntries.filter(x => x.write), async ({ filePath, metadataJson }, key) => {
175
+ async applyBatch(batch, options = {}) {
176
+ const { existingKeys } = options;
177
+ let toWrite = batch.storageProviderBatchEntries;
178
+ if (existingKeys != null) {
179
+ toWrite = entriesToUpload(toWrite, existingKeys);
180
+ }
181
+ console.log(`📤 Uploading ${toWrite.length} entries to S3 storage (${this.uploadConcurrency} at a time).`);
182
+ await this.doConcurrentParallel(toWrite, async ({ filePath, metadataJson }, key) => {
159
183
  // const fileStream = fs.createReadStream(filePath);
160
184
  const fileData = fs.readFileSync(filePath);
161
185
  await this.submitStorageEntry(key, filePath, fileData, metadataJson);
162
186
  console.log(` 🌐 Submitted asset "${rootRelative(filePath)}" to S3 storage with key "${key}".`);
163
- });
187
+ }, this.uploadConcurrency, true);
164
188
  console.log(`✅ Uploaded entries to S3 storage.`);
165
189
  }
166
- async doConcurrentParallel(objects, fn, maxConcurrent = 12) {
190
+ async doConcurrentParallel(objects, fn, maxConcurrent = 12, throwOnError = false) {
167
191
  await concurrentParallel(objects, fn, (err) => {
168
192
  if (err instanceof S3ServiceException) {
169
193
  return `S3 error [${err.name}] - ${err.message}`;
@@ -172,30 +196,9 @@ export class S3StorageProvider {
172
196
  return 'transport';
173
197
  }
174
198
  return null;
175
- }, maxConcurrent);
199
+ }, maxConcurrent, throwOnError);
176
200
  }
177
201
  calculateNumChunks(_size) {
178
202
  return 1;
179
203
  }
180
- async getExistingAssetVariant(variantKey) {
181
- let assetVariantMetadata = null;
182
- await this.doConcurrentParallel([{ key: variantKey }], async (_, variantKey) => {
183
- const entryInfo = await this.getStorageEntryInfo(variantKey);
184
- if (entryInfo == null) {
185
- return;
186
- }
187
- const metadata = decodeAssetVariantMetadata(entryInfo.metadata);
188
- if (metadata != null) {
189
- if (metadata.numChunks !== undefined) {
190
- return;
191
- }
192
- assetVariantMetadata = {
193
- contentEncoding: metadata.contentEncoding,
194
- size: metadata.size,
195
- hash: metadata.hash,
196
- };
197
- }
198
- });
199
- return assetVariantMetadata;
200
- }
201
204
  }
@@ -1,4 +1,3 @@
1
- import { type AssetVariantMetadata } from '../../models/assets/index.js';
2
1
  import { type StaticPublishRc } from '../../models/config/static-publish-rc.js';
3
2
  export interface StorageEntry {
4
3
  data?: ReadableStream<Uint8Array>;
@@ -11,20 +10,21 @@ export interface StorageProvider {
11
10
  getStorageEntry(key: string): Promise<StorageEntry | null>;
12
11
  submitStorageEntry(key: string, filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
13
12
  deleteStorageEntry(key: string): Promise<void>;
14
- applyBatch(batch: StorageProviderBatch): Promise<void>;
13
+ applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
15
14
  doConcurrentParallel<TObject extends {
16
15
  key: string;
17
- }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number): Promise<void>;
16
+ }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
18
17
  calculateNumChunks(size: number): number;
19
- getExistingAssetVariant(variantKey: string): Promise<AssetVariantMetadata | null>;
20
18
  }
21
19
  export type StorageProviderBatchEntry = {
22
- write: boolean;
23
20
  size: number;
24
21
  key: string;
25
22
  filePath: string;
26
23
  metadataJson?: Record<string, string>;
27
24
  };
25
+ export type ApplyBatchOptions = {
26
+ existingKeys?: Set<string>;
27
+ };
28
28
  export declare class StorageProviderBatch {
29
29
  constructor();
30
30
  storageProviderBatchEntries: StorageProviderBatchEntry[];
@@ -34,11 +34,12 @@ export type StorageProviderBuilderContext = {
34
34
  computeAppDir: string;
35
35
  localMode?: boolean;
36
36
  fastlyApiToken?: string;
37
- awsProfile?: string;
38
- awsAccessKeyId?: string;
39
- awsSecretAccessKey?: string;
37
+ s3AccessKeyId?: string;
38
+ s3SecretAccessKey?: string;
39
+ s3UploadConcurrency?: number;
40
40
  };
41
41
  export type StorageProviderBuilder = (config: StaticPublishRc, context: StorageProviderBuilderContext) => (Promise<StorageProvider | null> | StorageProvider | null);
42
+ export declare function getStorageKeysByHexPrefix(storageProvider: StorageProvider, prefix: string): Promise<string[] | null>;
42
43
  export declare function registerStorageProviderBuilder(builder: StorageProviderBuilder): void;
43
44
  export declare function loadStorageProviderFromStaticPublishRc(config: StaticPublishRc, context: StorageProviderBuilderContext): Promise<StorageProvider>;
44
45
  //# sourceMappingURL=storage-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/storage-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,eAAe,EAC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