@fastly/compute-js-static-publish 8.0.0-beta.9 → 8.0.0-rc.1

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 (75) hide show
  1. package/README.md +2 -2
  2. package/README.short.md +2 -2
  3. package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
  4. package/build/cli/cli/commands/manage/clean.js +2 -3
  5. package/build/cli/cli/commands/manage/collections/delete.d.ts.map +1 -1
  6. package/build/cli/cli/commands/manage/collections/delete.js +2 -3
  7. package/build/cli/cli/commands/manage/collections/index.d.ts.map +1 -1
  8. package/build/cli/cli/commands/manage/collections/index.js +2 -3
  9. package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
  10. package/build/cli/cli/commands/manage/collections/list.js +2 -3
  11. package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
  12. package/build/cli/cli/commands/manage/collections/promote.js +2 -3
  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 +2 -3
  15. package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
  16. package/build/cli/cli/commands/manage/index.js +2 -3
  17. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  18. package/build/cli/cli/commands/manage/publish-content.js +86 -8
  19. package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
  20. package/build/cli/cli/commands/scaffold/index.js +3 -2
  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 +0 -1
  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 +0 -2
  33. package/build/cli/cli/storage/kv-store-provider.d.ts +0 -1
  34. package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
  35. package/build/cli/cli/storage/kv-store-provider.js +0 -2
  36. package/build/cli/cli/storage/s3-storage-provider.d.ts +3 -4
  37. package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
  38. package/build/cli/cli/storage/s3-storage-provider.js +20 -45
  39. package/build/cli/cli/storage/storage-provider.d.ts +2 -1
  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.js +1 -1
  47. package/build/cli/cli/util/purge.d.ts +17 -1
  48. package/build/cli/cli/util/purge.d.ts.map +1 -1
  49. package/build/cli/cli/util/purge.js +63 -3
  50. package/build/cli/cli/util/service-id.d.ts +10 -0
  51. package/build/cli/cli/util/service-id.d.ts.map +1 -0
  52. package/build/cli/cli/util/service-id.js +27 -0
  53. package/build/cli/cli/util/variants.d.ts +2 -1
  54. package/build/cli/cli/util/variants.d.ts.map +1 -1
  55. package/build/cli/cli/util/variants.js +2 -2
  56. package/build/cli/models/config/publish-content-config.d.ts +2 -0
  57. package/build/cli/models/config/publish-content-config.d.ts.map +1 -1
  58. package/build/server/models/config/publish-content-config.d.ts +2 -0
  59. package/build/server/models/config/publish-content-config.d.ts.map +1 -1
  60. package/build/server/server/publisher-server/index.d.ts +15 -1
  61. package/build/server/server/publisher-server/index.d.ts.map +1 -1
  62. package/build/server/server/publisher-server/index.js +189 -56
  63. package/build/server/server/publisher-server/response-cache.d.ts +19 -0
  64. package/build/server/server/publisher-server/response-cache.d.ts.map +1 -0
  65. package/build/server/server/publisher-server/response-cache.js +106 -0
  66. package/build/server/server/storage/s3-storage-provider.d.ts +2 -5
  67. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  68. package/build/server/server/storage/s3-storage-provider.js +95 -38
  69. package/build/server/server/storage/storage-provider.d.ts +1 -1
  70. package/build/server/server/storage/storage-provider.d.ts.map +1 -1
  71. package/build/server/server/storage/storage-provider.js +2 -1
  72. package/build/server/server/util/server-timing.d.ts +7 -0
  73. package/build/server/server/util/server-timing.d.ts.map +1 -0
  74. package/build/server/server/util/server-timing.js +34 -0
  75. package/package.json +10 -8
package/README.md CHANGED
@@ -29,7 +29,7 @@ npx @fastly/compute-js-static-publish@latest --root-dir=./public --storage-mode=
29
29
 
30
30
  If the storage needs a custom endpoint, as Fastly Object Storage does, add `--s3-endpoint=<endpoint>` (for example, `--s3-endpoint=https://us-east-1.object.fastlystorage.app`).
31
31
 
32
- For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/v8/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
32
+ For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/main/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
33
33
 
34
34
  ### 🔧 Local Preview
35
35
 
@@ -73,7 +73,7 @@ If the app uses S3-compatible storage, your files are already in the bucket afte
73
73
  ## Documentation
74
74
 
75
75
  📘 Full documentation available on GitHub:
76
- [https://github.com/fastly/compute-js-static-publish/tree/v8](https://github.com/fastly/compute-js-static-publish/tree/v8)
76
+ [https://github.com/fastly/compute-js-static-publish/tree/main](https://github.com/fastly/compute-js-static-publish/tree/main)
77
77
 
78
78
  ### Security issues
79
79
 
package/README.short.md CHANGED
@@ -29,7 +29,7 @@ npx @fastly/compute-js-static-publish@latest --root-dir=./public --storage-mode=
29
29
 
30
30
  If the storage needs a custom endpoint, as Fastly Object Storage does, add `--s3-endpoint=<endpoint>` (for example, `--s3-endpoint=https://us-east-1.object.fastlystorage.app`).
31
31
 
32
- For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/v8/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
32
+ For more details, see the [S3-compatible storage](https://github.com/fastly/compute-js-static-publish/blob/main/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
33
33
 
34
34
  ### 🔧 Local Preview
35
35
 
@@ -73,7 +73,7 @@ If the app uses S3-compatible storage, your files are already in the bucket afte
73
73
  ## Documentation
74
74
 
75
75
  📘 Full documentation available on GitHub:
76
- [https://github.com/fastly/compute-js-static-publish/tree/v8](https://github.com/fastly/compute-js-static-publish/tree/v8)
76
+ [https://github.com/fastly/compute-js-static-publish/tree/main](https://github.com/fastly/compute-js-static-publish/tree/main)
77
77
 
78
78
  ### Security issues
79
79
 
@@ -1 +1 @@
1
- {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/clean.ts"],"names":[],"mappings":"AAoDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0NhD"}
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/clean.ts"],"names":[],"mappings":"AAmDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0NhD"}
@@ -29,9 +29,8 @@ KV Store Options:
29
29
  with the local development environment.
30
30
 
31
31
  --fastly-api-token=<token> Fastly API token for KV Store access.
32
- If not set, the tool will check:
33
- 1. FASTLY_API_TOKEN environment variable
34
- 2. The default profile in the Fastly CLI
32
+ If not set, the tool uses the FASTLY_API_TOKEN
33
+ environment variable.
35
34
 
36
35
  S3 Storage Options (BETA):
37
36
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/delete.ts"],"names":[],"mappings":"AAkDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuIhD"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/delete.ts"],"names":[],"mappings":"AAiDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuIhD"}
@@ -28,9 +28,8 @@ KV Store Options:
28
28
  with the local development environment.
29
29
 
30
30
  --fastly-api-token=<token> Fastly API token for KV Store access.
31
- If not set, the tool will check:
32
- 1. FASTLY_API_TOKEN environment variable
33
- 2. The default profile in the Fastly CLI
31
+ If not set, the tool uses the FASTLY_API_TOKEN
32
+ environment variable.
34
33
 
35
34
  S3 Storage Options (BETA):
36
35
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/index.ts"],"names":[],"mappings":"AAoDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0BhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/index.ts"],"names":[],"mappings":"AAmDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0BhD"}
@@ -29,9 +29,8 @@ KV Store Options:
29
29
  with the local development environment.
30
30
 
31
31
  --fastly-api-token=<token> Fastly API token for KV Store access.
32
- If not set, the tool will check:
33
- 1. FASTLY_API_TOKEN environment variable
34
- 2. The default profile in the Fastly CLI
32
+ If not set, the tool uses the FASTLY_API_TOKEN
33
+ environment variable.
35
34
 
36
35
  S3 Storage Options (BETA):
37
36
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/list.ts"],"names":[],"mappings":"AA6CA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmIhD"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/list.ts"],"names":[],"mappings":"AA4CA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmIhD"}
@@ -23,9 +23,8 @@ KV Store Options:
23
23
  with the local development environment.
24
24
 
25
25
  --fastly-api-token=<token> Fastly API token for KV Store access.
26
- If not set, the tool will check:
27
- 1. FASTLY_API_TOKEN environment variable
28
- 2. The default profile in the Fastly CLI
26
+ If not set, the tool uses the FASTLY_API_TOKEN
27
+ environment variable.
29
28
 
30
29
  S3 Storage Options (BETA):
31
30
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"AAmEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuLhD"}
1
+ {"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"AAkEA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuLhD"}
@@ -45,9 +45,8 @@ KV Store Options:
45
45
  with the local development environment.
46
46
 
47
47
  --fastly-api-token=<token> Fastly API token for KV Store access.
48
- If not set, the tool will check:
49
- 1. FASTLY_API_TOKEN environment variable
50
- 2. The default profile in the Fastly CLI
48
+ If not set, the tool uses the FASTLY_API_TOKEN
49
+ environment variable.
51
50
 
52
51
  S3 Storage Options (BETA):
53
52
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"update-expiration.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/update-expiration.ts"],"names":[],"mappings":"AA+DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0JhD"}
1
+ {"version":3,"file":"update-expiration.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/update-expiration.ts"],"names":[],"mappings":"AA8DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0JhD"}
@@ -41,9 +41,8 @@ KV Store Options:
41
41
  with the local development environment.
42
42
 
43
43
  --fastly-api-token=<token> Fastly API token for KV Store access.
44
- If not set, the tool will check:
45
- 1. FASTLY_API_TOKEN environment variable
46
- 2. The default profile in the Fastly CLI
44
+ If not set, the tool uses the FASTLY_API_TOKEN
45
+ environment variable.
47
46
 
48
47
  S3 Storage Options (BETA):
49
48
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/index.ts"],"names":[],"mappings":"AA2DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAyBhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/index.ts"],"names":[],"mappings":"AA0DA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAyBhD"}
@@ -31,9 +31,8 @@ KV Store Options:
31
31
  with the local development environment.
32
32
 
33
33
  --fastly-api-token=<token> Fastly API token for KV Store access.
34
- If not set, the tool will check:
35
- 1. FASTLY_API_TOKEN environment variable
36
- 2. The default profile in the Fastly CLI
34
+ If not set, the tool uses the FASTLY_API_TOKEN
35
+ environment variable.
37
36
 
38
37
  S3 Storage Options (BETA):
39
38
  --s3-access-key-id=<id> Access Key ID and Secret Access Key used to
@@ -1 +1 @@
1
- {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAuGA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA8fhD"}
1
+ {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAyHA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAikBhD"}
@@ -13,7 +13,8 @@ import { applyDefaults } from '../../util/data.js';
13
13
  import { calculateFileSizeAndHash, enumerateFiles, rootRelative } from '../../util/files.js';
14
14
  import { ensureVariantFileExists } from '../../util/variants.js';
15
15
  import { concurrentMap } from '../../util/retryable.js';
16
- import { loadStorageProviderFromStaticPublishRc, StorageProviderBatch, } from '../../storage/storage-provider.js';
16
+ import { loadPurgeTarget, purgeSurrogateKey } from '../../util/purge.js';
17
+ import { getStorageKeysByHexPrefix, loadStorageProviderFromStaticPublishRc, StorageProviderBatch, } from '../../storage/storage-provider.js';
17
18
  // Storage key format:
18
19
  // <publishId>_index_<preview_id>.json
19
20
  // <publishId>_settings_<preview_id>.json
@@ -44,12 +45,25 @@ Optional:
44
45
  Default: rootDir from publish-content.config.js
45
46
 
46
47
  --fastly-api-token=<token> Fastly API token for KV Store or cache access.
48
+ If not set, the tool uses the FASTLY_API_TOKEN
49
+ environment variable.
50
+
51
+ --fastly-service-id=<id> Fastly Service ID to purge after publishing (not with --local).
47
52
  If not set, the tool will check:
48
- 1. FASTLY_API_TOKEN environment variable
49
- 2. The default profile in the Fastly CLI
53
+ 1. FASTLY_SERVICE_ID environment variable
54
+ 2. service_id in fastly.toml
55
+ If none is found, the purge is skipped.
56
+
57
+ --purge-environment=<env> Environment to purge: production, staging, or a
58
+ comma-separated list of both. Can be repeated.
59
+ Default: production
50
60
 
51
61
  --overwrite-existing Always overwrite existing entries in storage, even if unchanged.
52
62
 
63
+ --brotli-quality=<0-11> Brotli quality for the 'br' variants. Overrides
64
+ brotliQuality in the config file.
65
+ Default: brotliQuality from publish-content.config.js, or 11
66
+
53
67
  Expiration:
54
68
  --expires-in=<duration> Expiration duration from now.
55
69
  Examples: 3d, 12h, 15m, 1w
@@ -75,6 +89,9 @@ S3 Storage Options (BETA):
75
89
  If not set, the tool will check the S3_ACCESS_KEY_ID
76
90
  and S3_SECRET_ACCESS_KEY environment variables.
77
91
 
92
+ --s3-upload-concurrency=<1-256> Number of objects to upload at the same time.
93
+ Default: 64
94
+
78
95
  Global Options:
79
96
  -h, --help Show this help message and exit.
80
97
 
@@ -92,14 +109,18 @@ export async function action(actionArgs) {
92
109
  { name: 'collection-name', type: String, },
93
110
  { name: 'root-dir', type: String, },
94
111
  { name: 'overwrite-existing', type: Boolean },
112
+ { name: 'brotli-quality', type: String },
95
113
  { name: 'expires-in', type: String },
96
114
  { name: 'expires-at', type: String },
97
115
  { name: 'expires-never', type: Boolean },
98
116
  { name: 'local', type: Boolean },
99
117
  { name: 'fastly-api-token', type: String, },
118
+ { name: 'fastly-service-id', type: String, },
119
+ { name: 'purge-environment', type: String, multiple: true, },
100
120
  { name: 'kv-overwrite', type: Boolean },
101
121
  { name: 's3-access-key-id', type: String, },
102
122
  { name: 's3-secret-access-key', type: String, },
123
+ { name: 's3-upload-concurrency', type: String, },
103
124
  ];
104
125
  const parsed = parseCommandLine(actionArgs, optionDefinitions);
105
126
  if (parsed.needHelp) {
@@ -111,7 +132,17 @@ export async function action(actionArgs) {
111
132
  help();
112
133
  return;
113
134
  }
114
- const { verbose, config: configFilePathValue, ['collection-name']: collectionNameValue, ['root-dir']: rootDir, ['overwrite-existing']: _overwriteExisting, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['kv-overwrite']: _kvOverwrite, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
135
+ const { verbose, config: configFilePathValue, ['collection-name']: collectionNameValue, ['root-dir']: rootDir, ['overwrite-existing']: _overwriteExisting, ['brotli-quality']: brotliQualityValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['fastly-service-id']: fastlyServiceId, ['purge-environment']: purgeEnvironmentValues, ['kv-overwrite']: _kvOverwrite, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, ['s3-upload-concurrency']: s3UploadConcurrencyValue, } = parsed.commandLineOptions;
136
+ let s3UploadConcurrency;
137
+ if (s3UploadConcurrencyValue !== undefined) {
138
+ if (typeof s3UploadConcurrencyValue !== 'string' || !/^\d+$/.test(s3UploadConcurrencyValue) ||
139
+ Number(s3UploadConcurrencyValue) < 1 || Number(s3UploadConcurrencyValue) > 256) {
140
+ console.error(`❌ --s3-upload-concurrency must be an integer from 1 to 256.`);
141
+ process.exitCode = 1;
142
+ return;
143
+ }
144
+ s3UploadConcurrency = Number(s3UploadConcurrencyValue);
145
+ }
115
146
  const overwriteExisting = _overwriteExisting ?? _kvOverwrite;
116
147
  // compute-js-static-publisher cli is always run from the Compute application directory
117
148
  // in other words, the directory that contains `fastly.toml`.
@@ -148,6 +179,17 @@ export async function action(actionArgs) {
148
179
  process.exitCode = 1;
149
180
  return;
150
181
  }
182
+ // --brotli-quality overrides brotliQuality in the config file.
183
+ let brotliQualitySource = 'config';
184
+ if (brotliQualityValue !== undefined) {
185
+ if (typeof brotliQualityValue !== 'string' || !/^\d+$/.test(brotliQualityValue) || Number(brotliQualityValue) > 11) {
186
+ console.error(`❌ --brotli-quality must be an integer from 0 to 11.`);
187
+ process.exitCode = 1;
188
+ return;
189
+ }
190
+ publishContentConfig.brotliQuality = Number(brotliQualityValue);
191
+ brotliQualitySource = '--brotli-quality';
192
+ }
151
193
  const publicDirRoot = path.resolve(rootDir != null ? rootDir : publishContentConfig.rootDir);
152
194
  if ((computeAppDir + '/').startsWith(publicDirRoot + '/')) {
153
195
  if (verbose) {
@@ -167,6 +209,9 @@ export async function action(actionArgs) {
167
209
  return;
168
210
  }
169
211
  console.log(`✔️ Public directory '${rootRelative(publicDirRoot)}'.`);
212
+ if (publishContentConfig.brotliQuality != null) {
213
+ console.log(`✔️ Brotli quality: ${publishContentConfig.brotliQuality} (from ${brotliQualitySource})`);
214
+ }
170
215
  const publishId = staticPublisherRc.publishId;
171
216
  console.log(` | Publish ID: ${publishId}`);
172
217
  const defaultCollectionName = staticPublisherRc.defaultCollectionName;
@@ -182,6 +227,7 @@ export async function action(actionArgs) {
182
227
  fastlyApiToken,
183
228
  s3AccessKeyId,
184
229
  s3SecretAccessKey,
230
+ s3UploadConcurrency,
185
231
  });
186
232
  }
187
233
  catch (err) {
@@ -190,6 +236,22 @@ export async function action(actionArgs) {
190
236
  process.exitCode = 1;
191
237
  return;
192
238
  }
239
+ // Purge target: checked now, so that a missing API token fails before anything is uploaded.
240
+ let purgeTarget;
241
+ try {
242
+ purgeTarget = loadPurgeTarget({
243
+ localMode: localMode ?? false,
244
+ computeAppDir,
245
+ fastlyServiceId,
246
+ fastlyApiToken,
247
+ purgeEnvironments: purgeEnvironmentValues,
248
+ });
249
+ }
250
+ catch (err) {
251
+ console.error(String(err));
252
+ process.exitCode = 1;
253
+ return;
254
+ }
193
255
  // Load content types
194
256
  const contentTypes = mergeContentTypes(publishContentConfig.contentTypes);
195
257
  // #### Collect all file paths
@@ -249,11 +311,14 @@ export async function action(actionArgs) {
249
311
  // The key of a file is the hash of its content. If the key exists, storage
250
312
  // already has the same content. Thus we do not compress, hash, or upload it again.
251
313
  // In local mode, a key can refer to a working file that was deleted, so we do not list.
314
+ // All the keys that the scan looks for start with `<publishId>_files_sha256_` and a hex
315
+ // hash, so we list them in 16 parts at the same time.
252
316
  let existingKeys;
253
317
  if (!overwriteExisting && !localMode) {
254
318
  console.log(`🔎 Listing files that are already in storage...`);
255
- existingKeys = new Set(await storageProvider.getStorageKeys(`${publishId}_files_`) ?? []);
256
- console.log(`✅ Found ${existingKeys.size} key(s).`);
319
+ const listStart = Date.now();
320
+ existingKeys = new Set(await getStorageKeysByHexPrefix(storageProvider, `${publishId}_files_sha256_`) ?? []);
321
+ console.log(`✅ Found ${existingKeys.size} key(s) in ${((Date.now() - listStart) / 1000).toFixed(1)} s.`);
257
322
  }
258
323
  let existingVariantCount = 0;
259
324
  function isVariantInStorage(variantKey, numChunks) {
@@ -345,7 +410,7 @@ export async function action(actionArgs) {
345
410
  variantKeeps.set(variant, keep);
346
411
  }
347
412
  else {
348
- await ensureVariantFileExists(variantFilePath, variant, file, verbose);
413
+ await ensureVariantFileExists(variantFilePath, variant, file, verbose, { brotliQuality: publishContentConfig.brotliQuality });
349
414
  let contentEncoding, hash, size;
350
415
  if (variant === 'original') {
351
416
  contentEncoding = undefined;
@@ -488,6 +553,19 @@ export async function action(actionArgs) {
488
553
  const settingsFilePath = path.resolve(storageContentDir, settingsFileName);
489
554
  await storageProvider.submitStorageEntry(settingsFileKey, settingsFilePath, JSON.stringify(serverSettings));
490
555
  console.log(`✅ Settings have been saved.`);
491
- await storageProvider.purgeSurrogateKey(`${publishId}-${collectionName}`);
556
+ if (purgeTarget != null) {
557
+ const surrogateKey = `${publishId}-${collectionName}`;
558
+ for (const environment of purgeTarget.environments) {
559
+ console.log(`Purging surrogate key [${surrogateKey}] on service [${purgeTarget.serviceId}] (${environment})...`);
560
+ const purged = await purgeSurrogateKey(purgeTarget.fastlyApiContext, purgeTarget.serviceId, surrogateKey, true, environment);
561
+ if (purged) {
562
+ console.log('Purged');
563
+ }
564
+ else {
565
+ // The content is published. Only the cached copies may be stale until they expire.
566
+ console.warn(`⚠️ Warning: Failed purging (${environment}). Cached copies may be served until they expire.`);
567
+ }
568
+ }
569
+ }
492
570
  console.log(`🎉 Completed.`);
493
571
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/index.ts"],"names":[],"mappings":"AAuEA,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,yBAAyB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,GAAG,EAAE,M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AAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AA0TF,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAyqBhD"}
@@ -682,7 +682,7 @@ export async function action(actionArgs) {
682
682
  '@fastly/compute-js-static-publish': computeJsStaticPublisherVersion,
683
683
  },
684
684
  dependencies: {
685
- '@fastly/js-compute': '^3.26.0',
685
+ '@fastly/js-compute': '^4.0.0',
686
686
  },
687
687
  engines: {
688
688
  node: '>=20.11.0',
@@ -849,7 +849,8 @@ const config = {
849
849
  // excludeDotFiles: true,
850
850
  // includeWellKnown: true,
851
851
  // assetInclusionTest: (assetKey) => true,
852
- // contentCompression: [ 'br', 'gzip' ],
852
+ // contentCompression: [ 'br', 'gzip' ],
853
+ // brotliQuality: 11,
853
854
  // contentTypes: [
854
855
  // { test: /.custom$/, contentType: 'application/x-custom', text: false },
855
856
  // ],
@@ -1,3 +1,4 @@
1
+ import type { CompressOptions } from './index.js';
1
2
  export declare const key = "br";
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=brotli.d.ts.map
@@ -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);
@@ -14,6 +14,5 @@ export declare class KvStoreLocalProvider implements StorageProvider {
14
14
  key: string;
15
15
  }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
16
16
  calculateNumChunks(size: number): number;
17
- purgeSurrogateKey(_surrogateKey: string): Promise<void>;
18
17
  }
19
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":"AA0BA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,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,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IAQzD,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAc1D,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAe9D,kBAAkB,C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- }
83
81
  }
@@ -17,7 +17,6 @@ export declare class KvStoreProvider implements StorageProvider {
17
17
  key: string;
18
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
- purgeSurrogateKey(_surrogateKey: string): Promise<void>;
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":"AAaA,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,kBAAkB,EAAE,sBAsBhC,CAAC;AAEF,qBAAa,eAAgB,YAAW,eAAe;gBAEnD,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM;IAMxB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IAEd,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;IAUzD,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAe1D,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAiB9D,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MA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AE,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"}
@@ -107,8 +107,6 @@ export class KvStoreProvider {
107
107
  calculateNumChunks(size) {
108
108
  return Math.ceil(size / KV_STORE_CHUNK_SIZE);
109
109
  }
110
- async purgeSurrogateKey(_surrogateKey) {
111
- }
112
110
  }
113
111
  export function kvStoreEntryToStorageEntry(kvStoreEntry) {
114
112
  const storageEntry = {};
@@ -2,16 +2,16 @@ import { S3Client } from '@aws-sdk/client-s3';
2
2
  import { type Command, type HttpHandlerOptions } from '@aws-sdk/types';
3
3
  import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type ApplyBatchOptions } from './storage-provider.js';
4
4
  type CommandOutput<C> = C extends Command<any, any, any, infer O, any> ? O : never;
5
+ export declare const DEFAULT_S3_UPLOAD_CONCURRENCY = 64;
5
6
  export declare const buildStoreProvider: StorageProviderBuilder;
6
7
  export declare class S3StorageProvider implements StorageProvider {
7
- constructor(fastlyServiceId: string | undefined, fastlyApiToken: string | undefined, s3Region: string, accessKeyId: string, secretAccessKey: string, s3Bucket: string, s3Endpoint?: string);
8
- private readonly fastlyServiceId?;
9
- private readonly fastlyApiContext?;
8
+ constructor(s3Region: string, accessKeyId: string, secretAccessKey: string, s3Bucket: string, s3Endpoint?: string, uploadConcurrency?: number);
10
9
  private readonly s3Region;
11
10
  private readonly accessKeyId;
12
11
  private readonly secretAccessKey;
13
12
  private readonly s3Bucket;
14
13
  private readonly s3Endpoint?;
14
+ private readonly uploadConcurrency;
15
15
  private s3Client?;
16
16
  getS3Client(): S3Client;
17
17
  sendS3ClientCommand<C extends Command<any, any, any, any, any>>(command: C, options?: HttpHandlerOptions): Promise<CommandOutput<C>>;
@@ -25,7 +25,6 @@ export declare class S3StorageProvider implements StorageProvider {
25
25
  key: string;
26
26
  }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number, throwOnError?: boolean): Promise<void>;
27
27
  calculateNumChunks(_size: number): number;
28
- purgeSurrogateKey(surrogateKey: string): Promise<void>;
29
28
  }
30
29
  export {};
31
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":[],"mappings":"AAOA,OAAO,EAUL,QAAQ,EAIT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AASxB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAuB/B,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnF,eAAO,MAAM,kBAAkB,EAAE,sBAuDhC,CAAC;AAGF,qBAAa,iBAAkB,YAAW,eAAe;gBAErD,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM;IAWrB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAS;IAC1C,OAAO,CAAC,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