@fastly/compute-js-static-publish 8.0.2 → 8.0.3-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 (48) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/DOCUMENTATION.md +28 -23
  3. package/MIGRATING.md +1 -1
  4. package/README.md +3 -3
  5. package/README.short.md +3 -3
  6. package/build/cli/cli/commands/manage/clean.d.ts.map +1 -1
  7. package/build/cli/cli/commands/manage/clean.js +27 -0
  8. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  9. package/build/cli/cli/commands/manage/publish-content.js +38 -1
  10. package/build/cli/cli/storage/kv-store-local-provider.d.ts +2 -2
  11. package/build/cli/cli/storage/kv-store-local-provider.d.ts.map +1 -1
  12. package/build/cli/cli/storage/kv-store-local-provider.js +2 -14
  13. package/build/cli/cli/storage/kv-store-provider.d.ts +2 -2
  14. package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
  15. package/build/cli/cli/storage/kv-store-provider.js +2 -1
  16. package/build/cli/cli/storage/s3-storage-provider.d.ts +2 -2
  17. package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
  18. package/build/cli/cli/storage/s3-storage-provider.js +2 -1
  19. package/build/cli/cli/storage/storage-provider.d.ts +3 -1
  20. package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
  21. package/build/cli/cli/storage/storage-provider.js +16 -0
  22. package/build/cli/cli/util/kv-store.d.ts +1 -1
  23. package/build/cli/cli/util/kv-store.d.ts.map +1 -1
  24. package/build/cli/models/index-parts/index.d.ts +20 -0
  25. package/build/cli/models/index-parts/index.d.ts.map +1 -0
  26. package/build/cli/models/index-parts/index.js +76 -0
  27. package/build/cli/models/server/index.d.ts +2 -0
  28. package/build/cli/models/server/index.d.ts.map +1 -1
  29. package/build/cli/models/server/index.js +7 -1
  30. package/build/server/models/index-parts/index.d.ts +20 -0
  31. package/build/server/models/index-parts/index.d.ts.map +1 -0
  32. package/build/server/models/index-parts/index.js +76 -0
  33. package/build/server/models/server/index.d.ts +2 -0
  34. package/build/server/models/server/index.d.ts.map +1 -1
  35. package/build/server/models/server/index.js +7 -1
  36. package/build/server/server/index.d.ts +1 -1
  37. package/build/server/server/index.d.ts.map +1 -1
  38. package/build/server/server/publisher-server/index.d.ts +5 -0
  39. package/build/server/server/publisher-server/index.d.ts.map +1 -1
  40. package/build/server/server/publisher-server/index.js +95 -21
  41. package/build/server/server/storage/kv-store-provider.d.ts.map +1 -1
  42. package/build/server/server/storage/kv-store-provider.js +1 -0
  43. package/build/server/server/storage/s3-storage-provider.d.ts +2 -2
  44. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  45. package/build/server/server/storage/s3-storage-provider.js +5 -2
  46. package/build/server/server/storage/storage-provider.d.ts +12 -1
  47. package/build/server/server/storage/storage-provider.d.ts.map +1 -1
  48. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,19 @@ This file does not list v7 releases after 7.0.8, or v6 releases after 6.3.0. For
9
9
 
10
10
  ## [unreleased]
11
11
 
12
+ ### Added
13
+
14
+ - `publish-content` also stores an index with 2,000 entries or more in parts, about 400 entries in each part, with the keys `<publishId>_parts_<hash>_<count>_<n>`. `PublisherServer` then reads only the part that has the path of a request. On a response-cache miss, this removes most of the time to read and parse a large index: for an index of 25,000 entries, about 70 ms became about 10 ms in a test. The full index is still stored, so an older `PublisherServer` serves the same content, and an older CLI can still `promote`, `clean`, and `update-expiration`. `clean` deletes the index parts that no index uses. `Server-Timing` has the new entry `index-part`.
15
+ - `StorageProvider.getEntry()` takes an optional third parameter, `options` (type `GetEntryOptions`). Its `ttl` sets how long, in seconds, a provider that caches what it reads keeps the entry.
16
+
17
+ ### Changed
18
+
19
+ - S3 mode: the server keeps the files that it reads from storage in the Fastly cache for 1 year. It was 1 hour. With a response cache `maxAge` of 1 hour or more, a response-cache miss then usually also read the file from storage. The key of a file has the hash of its content, so a cached copy does not get out of date. The cached files have the new surrogate key `<publishId>-files`. A publish does not purge it. The settings and the index are still kept for 1 hour.
20
+
21
+ ### Fixed
22
+
23
+ - `collections promote` and `collections update-expiration` (KV Store): the command sometimes stopped with `400 Bad request: must include valid content-length header` when it wrote the index of the collection. The command sent the index as a stream, with no `Content-Length`. Now it reads the index into memory and sends it with a `Content-Length`. In S3 mode, the commands now also send the index and the settings with a known length.
24
+
12
25
  ## [8.0.2] - 2026-11-16
13
26
 
14
27
  ### Changed
package/DOCUMENTATION.md CHANGED
@@ -56,7 +56,7 @@ Serve static websites and web apps at the edge &mdash; no backends and no CDN in
56
56
  Create a directory for your project, place your static files in `./public`, then type:
57
57
 
58
58
  ```sh
59
- npx @fastly/compute-js-static-publish@latest \
59
+ npx @fastly/compute-js-static-publish@rc \
60
60
  --root-dir=./public \
61
61
  --kv-store-name=site-content
62
62
  ```
@@ -117,7 +117,7 @@ FASTLY_API_TOKEN=$(npx fastly auth token) npm run fastly:publish
117
117
  Create a directory for your project, place your static files in `./public`, then type:
118
118
 
119
119
  ```sh
120
- npx @fastly/compute-js-static-publish@latest \
120
+ npx @fastly/compute-js-static-publish@rc \
121
121
  --root-dir=./public \
122
122
  --storage-mode=s3 \
123
123
  --s3-region=<s3 region> \
@@ -128,7 +128,7 @@ npx @fastly/compute-js-static-publish@latest \
128
128
  > If the storage requires a custom endpoint, such as is the case with Fastly Object Storage, specify it using `--s3-endpoint=<endpoint>`. For example:
129
129
  >
130
130
  > ```sh
131
- > npx @fastly/compute-js-static-publish@latest \
131
+ > npx @fastly/compute-js-static-publish@rc \
132
132
  > --root-dir=./public \
133
133
  > --storage-mode=s3 \
134
134
  > --s3-region=us-east-1 \
@@ -365,10 +365,12 @@ Collections are a powerful feature that allow you to publish and manage multiple
365
365
  - Server configuration (e.g., fallback file, static directories, etc.)
366
366
  - An index file that maps paths to those hashes
367
367
 
368
+ For an index with 2,000 entries or more, `publish-content` also stores the index in parts, about 400 entries in each part. Then `PublisherServer` reads only the part that has the path of a request, not the whole index. The full index is still stored, so an older version of `PublisherServer` serves the same content.
369
+
368
370
  Collections are published using a `--collection-name`, and can be reused, updated, or deleted independently. For example, you can create a staging version of your site using:
369
371
 
370
372
  ```sh
371
- npx @fastly/compute-js-static-publish publish-content \
373
+ npx @fastly/compute-js-static-publish@rc publish-content \
372
374
  --collection-name=staging \
373
375
  --expires-in=7d \
374
376
  --config=./publish-content.config.js
@@ -464,7 +466,7 @@ collectionSelector.fromConfigStore('my-config-store', 'collection-key');
464
466
  If you're happy with a preview or staging collection and want to make it live, use the `collections promote` command:
465
467
 
466
468
  ```sh
467
- npx @fastly/compute-js-static-publish collections promote \
469
+ npx @fastly/compute-js-static-publish@rc collections promote \
468
470
  --collection-name=staging
469
471
  --to=live
470
472
  ```
@@ -474,7 +476,7 @@ This copies all content and server settings from the `staging` collection to `li
474
476
  You can also specify a new expiration:
475
477
 
476
478
  ```sh
477
- npx @fastly/compute-js-static-publish collections promote \
479
+ npx @fastly/compute-js-static-publish@rc collections promote \
478
480
  --collection-name=preview-42 \
479
481
  --to=staging \
480
482
  --expires-in=7d
@@ -644,13 +646,14 @@ npm run fastly:clean
644
646
 
645
647
  These scripts run against the local and Fastly KV Stores respectively, and run the following command:
646
648
  ```
647
- npx @fastly/compute-js-static-publish clean --delete-expired-collections
649
+ npx @fastly/compute-js-static-publish@rc clean --delete-expired-collections
648
650
  ```
649
651
 
650
652
  This removes:
651
653
 
652
654
  - Expired collection index files (only if `--delete-expired-collections` is passed)
653
655
  - Unused content blobs (no longer referenced)
656
+ - Index parts that no index uses
654
657
  - Orphaned server config files
655
658
 
656
659
  ### 🔍 Dry Run Mode
@@ -658,7 +661,7 @@ This removes:
658
661
  Preview what will be deleted without making changes:
659
662
 
660
663
  ```sh
661
- npx @fastly/compute-js-static-publish clean --dry-run
664
+ npx @fastly/compute-js-static-publish@rc clean --dry-run
662
665
  ```
663
666
 
664
667
  > ⚠️ Cleanup never deletes the default collection and never deletes content that’s still in use.
@@ -730,6 +733,7 @@ Server-Timing: settings;dur=12.3, index;dur=40.1, index-body;dur=31.0, index-par
730
733
  |------|-------------|
731
734
  | `settings` | Reading and parsing the collection's settings |
732
735
  | `index` | Reading the collection's index, until the response headers arrive |
736
+ | `index-part` | Reading and parsing one part of the index, if the index has parts. Can appear more than one time, for example when `autoExt` tries more than one path. |
733
737
  | `index-body` | Reading the body of the index |
734
738
  | `index-parse` | Parsing the index |
735
739
  | `asset` | Reading the file, until the response headers arrive. Can appear more than one time, one time for each variant that is tried. |
@@ -751,7 +755,7 @@ Any client can send the request header. Choose a name that is not easy to guess
751
755
 
752
756
  ### 🗄️ Caching Responses with the Core Cache
753
757
 
754
- To serve a file, `PublisherServer` reads the collection's settings, the collection's index, and the file. Fastly can cache these reads, but `PublisherServer` must still parse the index for each request, and the index of a large site is large. To skip this work, `PublisherServer` can cache whole responses with the Fastly [Core Cache](https://www.fastly.com/documentation/guides/concepts/cache/) API:
758
+ To serve a file, `PublisherServer` reads the collection's settings, the collection's index, and the file. Fastly can cache these reads, but `PublisherServer` must still parse the index (or one part of it) for each request. To skip this work, `PublisherServer` can cache whole responses with the Fastly [Core Cache](https://www.fastly.com/documentation/guides/concepts/cache/) API:
755
759
 
756
760
  ```js
757
761
  publisherServer.setResponseCache({ maxAge: 3600 });
@@ -770,6 +774,7 @@ publisherServer.setResponseCache({ maxAge: 3600, maxBodySize: 4 * 1024 * 1024 })
770
774
  - If several requests miss the same response at the same time, one request produces it, and the others wait for it.
771
775
  - Only `200` and `404` responses are cached. Conditional requests (`304`) and `HEAD` requests are answered from the cached response.
772
776
  - Each cached response has the surrogate key `<publishId>-<collectionName>`. After you publish, `publish-content` purges this key (see [`--fastly-service-id`](#publish-content)), so the next request gets the new content. `collections promote` and `collections delete` purge the key of the collection that they change.
777
+ - In S3 mode, the server also keeps the settings, the index, and the files that it reads from storage in the Fastly cache. The settings and the index are kept for 1 hour, with the surrogate key of the collection. The files and the index parts are kept for 1 year, with the surrogate key `<publishId>-files`, because their keys have the hash of their content. Thus after a publish, a file that did not change is read from the cache, not from storage. A publish does not purge `<publishId>-files`. To remove the cached copies of all files, purge it yourself.
773
778
 
774
779
  `serveRequest()` uses the response cache automatically. If you call `getMatchingAsset()` and `serveAsset()` directly, wrap them in `serveCached()`. When a response is not cached yet, `serveCached()` calls your function to produce it, with a `GET` request that has no conditional headers:
775
780
 
@@ -832,7 +837,7 @@ You can stream `assetVariant.storageEntry.body` directly to a `Response`, or rea
832
837
  ### Available Commands
833
838
 
834
839
  #### Outside a Compute App Directory
835
- - `npx @fastly/compute-js-static-publish@latest [options]` - Scaffold a new Compute app
840
+ - `npx @fastly/compute-js-static-publish@rc [options]` - Scaffold a new Compute app
836
841
 
837
842
  #### Inside a Compute App Directory
838
843
  - `publish-content` - Publish static files to storage (KV Store or S3-compatible storage) under a named collection
@@ -850,12 +855,12 @@ Run outside an existing Compute app directory:
850
855
 
851
856
  ```sh
852
857
  # Using KV store storage
853
- npx @fastly/compute-js-static-publish@latest \
858
+ npx @fastly/compute-js-static-publish@rc \
854
859
  --root-dir=./public \
855
860
  --kv-store-name=<site-content>
856
861
 
857
862
  # Using S3 storage (BETA)
858
- npx @fastly/compute-js-static-publish@latest \
863
+ npx @fastly/compute-js-static-publish@rc \
859
864
  --root-dir=./public \
860
865
  --storage-mode=s3 \
861
866
  --s3-region=<s3 region> \
@@ -866,7 +871,7 @@ npx @fastly/compute-js-static-publish@latest \
866
871
  #### Full options list
867
872
 
868
873
  ```sh
869
- npx @fastly/compute-js-static-publish@latest \
874
+ npx @fastly/compute-js-static-publish@rc \
870
875
  --root-dir=./public \
871
876
  { [--storage-mode=kv-store] --kv-store-name=<site-content> | \
872
877
  --storage-mode=s3 --s3-region=<s3 region> --s3-bucket=<bucket name> [--s3-endpoint=<endpoint>] } \
@@ -921,7 +926,7 @@ Once you're in the scaffolded Compute app directory (with `static-publish.rc.js`
921
926
  #### `publish-content`
922
927
 
923
928
  ```sh
924
- npx @fastly/compute-js-static-publish publish-content \
929
+ npx @fastly/compute-js-static-publish@rc publish-content \
925
930
  [--root-dir=./public] \
926
931
  [--collection-name=preview-42] \
927
932
  [--config=./publish-content.config.js] \
@@ -949,7 +954,7 @@ After this process is complete, the PublisherServer object in the Compute applic
949
954
  - `--root-dir`: Source directory to read files from (overrides value in `publish-content.config.js`)
950
955
  - `--overwrite-existing`: Always upload all files, even if they are already in storage. `--kv-overwrite` is an alias.
951
956
  - `--brotli-quality`: Brotli quality for the `br` variants, an integer from 0 to 11. Overrides `brotliQuality` in `publish-content.config.js`. This is useful in CI, where the config file is generated at each run.
952
- - `--fastly-service-id`: The Fastly Service ID to purge after publishing. The command purges the surrogate key `<publishId>-<collectionName>`, so that the service stops serving cached copies of the collection's settings, index, files, and responses (see [response cache](#️-caching-responses-with-the-core-cache)). If not set, the tool will check:
957
+ - `--fastly-service-id`: The Fastly Service ID to purge after publishing. The command purges the surrogate key `<publishId>-<collectionName>`, so that the service stops serving cached copies of the collection's settings, index, and responses (see [response cache](#️-caching-responses-with-the-core-cache)). If not set, the tool will check:
953
958
  - **`FASTLY_SERVICE_ID` environment variable**
954
959
  - `service_id` in `fastly.toml`
955
960
 
@@ -979,13 +984,13 @@ After this process is complete, the PublisherServer object in the Compute applic
979
984
  #### `clean`
980
985
 
981
986
  ```sh
982
- npx @fastly/compute-js-static-publish clean \
987
+ npx @fastly/compute-js-static-publish@rc clean \
983
988
  [--delete-expired-collections] \
984
989
  [--dry-run]
985
990
  ```
986
991
 
987
992
  Cleans up expired or unreferenced items in storage (KV Store or S3-compatible storage).
988
- This can include expired collection indexes and orphaned content assets.
993
+ This can include expired collection indexes, orphaned content assets, and index parts that no index uses.
989
994
 
990
995
  ##### Options:
991
996
 
@@ -1005,7 +1010,7 @@ This can include expired collection indexes and orphaned content assets.
1005
1010
  #### `collections list`
1006
1011
 
1007
1012
  ```sh
1008
- npx @fastly/compute-js-static-publish collections list
1013
+ npx @fastly/compute-js-static-publish@rc collections list
1009
1014
  ```
1010
1015
  Lists all collections currently published in storage.
1011
1016
 
@@ -1024,7 +1029,7 @@ Lists all collections currently published in storage.
1024
1029
  #### `collections promote`
1025
1030
 
1026
1031
  ```sh
1027
- npx @fastly/compute-js-static-publish collections promote \
1032
+ npx @fastly/compute-js-static-publish@rc collections promote \
1028
1033
  --collection-name=preview-42 \
1029
1034
  --to=live \
1030
1035
  [--expires-in=7d | --expires-at=2025-06-01T00:00Z | --expires-never]
@@ -1064,7 +1069,7 @@ If a Service ID is found, the command then purges the surrogate key `<publishId>
1064
1069
  #### `collections update-expiration`
1065
1070
 
1066
1071
  ```sh
1067
- npx @fastly/compute-js-static-publish collections update-expiration \
1072
+ npx @fastly/compute-js-static-publish@rc collections update-expiration \
1068
1073
  --collection-name=preview-42 \
1069
1074
  --expires-in=3d | --expires-at=2025-06-01T00:00Z | --expires-never
1070
1075
  ```
@@ -1094,13 +1099,13 @@ Sets or updates the expiration time of an existing collection.
1094
1099
  #### `collections delete`
1095
1100
 
1096
1101
  ```sh
1097
- npx @fastly/compute-js-static-publish collections delete \
1102
+ npx @fastly/compute-js-static-publish@rc collections delete \
1098
1103
  --collection-name=preview-42
1099
1104
  ```
1100
1105
 
1101
1106
  Deletes a collection index from storage. The content files will remain as they may still be referenced by other collection indexes.
1102
1107
 
1103
- Use the `npx @fastly/compute-js-static-publish clean` command afterward to remove content files that are no longer referenced by any collection.
1108
+ Use the `npx @fastly/compute-js-static-publish@rc clean` command afterward to remove content files that are no longer referenced by any collection.
1104
1109
 
1105
1110
  If a Service ID is found, the command then purges the surrogate key `<publishId>-<collectionName>`, so that the service stops serving cached responses of the deleted collection. This uses the same options as [`publish-content`](#publish-content).
1106
1111
 
@@ -1218,7 +1223,7 @@ async function handleRequest(event) {
1218
1223
 
1219
1224
  ## 📚 Next Steps
1220
1225
 
1221
- - View CLI command help: `npx @fastly/compute-js-static-publish --help`
1226
+ - View CLI command help: `npx @fastly/compute-js-static-publish@rc --help`
1222
1227
  - Use in CI to automate branch previews
1223
1228
  - Visit [https://developer.fastly.com](https://developer.fastly.com) for Compute platform docs
1224
1229
 
package/MIGRATING.md CHANGED
@@ -20,7 +20,7 @@ To upgrade an app that uses the KV Store:
20
20
  1. In the `compute-js/` directory of your app, install v8:
21
21
 
22
22
  ```sh
23
- npm install @fastly/compute-js-static-publish@latest
23
+ npm install @fastly/compute-js-static-publish@rc
24
24
  ```
25
25
 
26
26
  2. Make sure that the CLI can get a Fastly API token. Set the `FASTLY_API_TOKEN` environment variable, or use
package/README.md CHANGED
@@ -18,18 +18,18 @@ This CLI tool helps you:
18
18
  Create a directory for your project, place your static files in `./public`, then type:
19
19
 
20
20
  ```sh
21
- npx @fastly/compute-js-static-publish@latest --root-dir=./public --kv-store-name=site-content
21
+ npx @fastly/compute-js-static-publish@rc --root-dir=./public --kv-store-name=site-content
22
22
  ```
23
23
 
24
24
  **New in v8:** S3-compatible storage (such as Fastly Object Storage) is also supported (Beta). To use this mode, type:
25
25
 
26
26
  ```sh
27
- npx @fastly/compute-js-static-publish@latest --root-dir=./public --storage-mode=s3 --s3-region=<region> --s3-bucket=<bucket-name>
27
+ npx @fastly/compute-js-static-publish@rc --root-dir=./public --storage-mode=s3 --s3-region=<region> --s3-bucket=<bucket-name>
28
28
  ```
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/main/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/rc/8.0.3/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
33
33
 
34
34
  ### 🔧 Local Preview
35
35
 
package/README.short.md CHANGED
@@ -18,18 +18,18 @@ This CLI tool helps you:
18
18
  Create a directory for your project, place your static files in `./public`, then type:
19
19
 
20
20
  ```sh
21
- npx @fastly/compute-js-static-publish@latest --root-dir=./public --kv-store-name=site-content
21
+ npx @fastly/compute-js-static-publish@rc --root-dir=./public --kv-store-name=site-content
22
22
  ```
23
23
 
24
24
  **New in v8:** S3-compatible storage (such as Fastly Object Storage) is also supported (Beta). To use this mode, type:
25
25
 
26
26
  ```sh
27
- npx @fastly/compute-js-static-publish@latest --root-dir=./public --storage-mode=s3 --s3-region=<region> --s3-bucket=<bucket-name>
27
+ npx @fastly/compute-js-static-publish@rc --root-dir=./public --storage-mode=s3 --s3-region=<region> --s3-bucket=<bucket-name>
28
28
  ```
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/main/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/rc/8.0.3/README.md#-using-s3-compatible-storage-beta) section in the full documentation.
33
33
 
34
34
  ### 🔧 Local Preview
35
35
 
@@ -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":"AAqDA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAqPhD"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import path from 'node:path';
6
6
  import { decodeIndexMetadata } from '../../../models/server/index.js';
7
+ import { getIndexPartsPrefix, getIndexPartsSetPrefix, parseIndexPartKey } from '../../../models/index-parts/index.js';
7
8
  import { isExpired } from '../../../models/time/index.js';
8
9
  import { parseCommandLine } from '../../util/args.js';
9
10
  import { LoadConfigError, loadStaticPublisherRcFile } from '../../util/config.js';
@@ -121,6 +122,8 @@ export async function action(actionArgs) {
121
122
  const liveCollections = new Set();
122
123
  // All asset keys (hashes) that we are keeping
123
124
  const assetsIdsInUse = new Set();
125
+ // The key prefixes of the index parts that we are keeping
126
+ const indexPartsInUse = new Set();
124
127
  console.log('Processing collections:');
125
128
  await storageProvider.doConcurrentParallel(foundCollections.map(collection => ({
126
129
  key: indexesPrefix + collection,
@@ -156,6 +159,9 @@ export async function action(actionArgs) {
156
159
  return;
157
160
  }
158
161
  liveCollections.add(collection);
162
+ if (indexMetadata.indexParts != null) {
163
+ indexPartsInUse.add(getIndexPartsSetPrefix(publishId, indexMetadata.indexParts));
164
+ }
159
165
  const kvAssetsIndex = (await new Response(indexEntryInfo.data).json());
160
166
  for (const [_assetKey, assetEntry] of Object.entries(kvAssetsIndex)) {
161
167
  if (assetEntry.key.startsWith('sha256:')) {
@@ -210,6 +216,27 @@ export async function action(actionArgs) {
210
216
  }
211
217
  }
212
218
  console.log('');
219
+ // ### Find the index parts that no live index uses
220
+ console.log('Enumerating index parts:');
221
+ const indexPartKeys = await storageProvider.getStorageKeys(getIndexPartsPrefix(publishId));
222
+ if (indexPartKeys == null) {
223
+ throw new Error(`Can't query index parts in storage`);
224
+ }
225
+ for (const indexPartKey of indexPartKeys) {
226
+ const parsed = parseIndexPartKey(publishId, indexPartKey);
227
+ if (parsed == null) {
228
+ // If we don't know the format, we ignore it
229
+ continue;
230
+ }
231
+ if (indexPartsInUse.has(getIndexPartsSetPrefix(publishId, parsed))) {
232
+ console.log(` ${indexPartKey}: in use`);
233
+ }
234
+ else {
235
+ assetKeysToDelete.add(indexPartKey);
236
+ console.log(` ${indexPartKey}: not in use - ✅ marking for deletion`);
237
+ }
238
+ }
239
+ console.log('');
213
240
  // ### Delete items that have been flagged
214
241
  const items = [...assetKeysToDelete].map(key => ({ key }));
215
242
  await storageProvider.doConcurrentParallel(items, async (_, key) => {
@@ -1 +1 @@
1
- {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AA+HA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmjBhD"}
1
+ {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AAuIA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA4lBhD"}
@@ -2,8 +2,10 @@
2
2
  * Copyright Fastly, Inc.
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
+ import * as crypto from 'node:crypto';
5
6
  import * as fs from 'node:fs';
6
7
  import * as path from 'node:path';
8
+ import { chooseIndexPartCount, getIndexPartKey, getIndexPartsSetPrefix, splitAssetEntryMap, } from '../../../models/index-parts/index.js';
7
9
  import { encodeIndexMetadata } from '../../../models/server/index.js';
8
10
  import { calcExpirationTime } from '../../../models/time/index.js';
9
11
  import { parseCommandLine } from '../../util/args.js';
@@ -477,16 +479,51 @@ export async function action(actionArgs) {
477
479
  console.log(` | ${batch.storageProviderBatchEntries.length} variant(s) to upload.`);
478
480
  }
479
481
  await storageProvider.applyBatch(batch, { existingKeys, verbose });
482
+ const indexText = JSON.stringify(assetsIndex);
483
+ // #### INDEX PARTS
484
+ // These are saved before the index, so that the index never points to parts
485
+ // that are not in storage yet.
486
+ let indexParts;
487
+ const indexPartCount = chooseIndexPartCount(Object.keys(assetsIndex).length);
488
+ if (indexPartCount > 0) {
489
+ indexParts = {
490
+ count: indexPartCount,
491
+ hash: crypto.createHash('sha256').update(indexText).digest('hex'),
492
+ };
493
+ console.log(`🧩 Saving index parts...`);
494
+ const parts = splitAssetEntryMap(assetsIndex, indexPartCount);
495
+ const partItems = parts.map((part, partNumber) => ({
496
+ key: getIndexPartKey(publishId, indexParts, partNumber),
497
+ partNumber,
498
+ part,
499
+ }));
500
+ // Parts of the same index are already in storage if this content was
501
+ // published before.
502
+ let existingPartKeys = null;
503
+ if (!overwriteExisting && !localMode) {
504
+ const keys = await storageProvider.getStorageKeys(getIndexPartsSetPrefix(publishId, indexParts));
505
+ existingPartKeys = keys != null ? new Set(keys) : null;
506
+ }
507
+ const partItemsToWrite = partItems.filter(item => !existingPartKeys?.has(item.key));
508
+ await storageProvider.doConcurrentParallel(partItemsToWrite, async ({ partNumber, part }, key) => {
509
+ const partFilePath = path.resolve(storageContentDir, `index_parts_${indexParts.hash}_${indexPartCount}_${partNumber}.json`);
510
+ await storageProvider.submitStorageEntry(key, partFilePath, JSON.stringify(part));
511
+ }, undefined,
512
+ // The index must not point to parts that could not be saved.
513
+ true);
514
+ console.log(`✅ ${indexPartCount} index parts: ${partItemsToWrite.length} saved, ${indexPartCount - partItemsToWrite.length} already in storage.`);
515
+ }
480
516
  // #### INDEX FILE
481
517
  console.log(`🗂️ Saving Index...`);
482
518
  const indexFileKey = `${publishId}_index_${collectionName}`;
483
519
  const indexMetadata = {
484
520
  publishedTime: Math.floor(Date.now() / 1000),
485
521
  expirationTime: expirationTime ?? undefined,
522
+ indexParts,
486
523
  };
487
524
  const indexFileName = `index_${collectionName}.json`;
488
525
  const indexFilePath = path.resolve(storageContentDir, indexFileName);
489
- await storageProvider.submitStorageEntry(indexFileKey, indexFilePath, JSON.stringify(assetsIndex), encodeIndexMetadata(indexMetadata));
526
+ await storageProvider.submitStorageEntry(indexFileKey, indexFilePath, indexText, encodeIndexMetadata(indexMetadata));
490
527
  console.log(`✅ Index has been saved.`);
491
528
  // #### SERVER SETTINGS
492
529
  // These are saved to storage
@@ -1,4 +1,4 @@
1
- import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type ApplyBatchOptions } from './storage-provider.js';
1
+ import { type StorageEntry, type StorageEntryData, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type ApplyBatchOptions } from './storage-provider.js';
2
2
  export declare const buildStoreProvider: StorageProviderBuilder;
3
3
  export declare class KvStoreLocalProvider implements StorageProvider {
4
4
  constructor(storeFile: string, computeAppDir: string);
@@ -7,7 +7,7 @@ export declare class KvStoreLocalProvider implements StorageProvider {
7
7
  getStorageKeys(prefix?: string): Promise<string[] | null>;
8
8
  getStorageEntry(key: string): Promise<StorageEntry | null>;
9
9
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
10
- submitStorageEntry(key: string, filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
10
+ submitStorageEntry(key: string, filePath: string, data: StorageEntryData, metadata?: Record<string, string>): Promise<void>;
11
11
  deleteStorageEntry(key: string): Promise<void>;
12
12
  applyBatch(batch: StorageProviderBatch, _options?: ApplyBatchOptions): Promise<void>;
13
13
  doConcurrentParallel<TObject extends {
@@ -1 +1 @@
1
- {"version":3,"file":"kv-store-local-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/kv-store-local-provider.ts"],"names":[],"mappings":"AA2BA,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,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,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;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,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,gBAAgB,EACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC;IAYV,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9C,UAAU,CAAC,KAAK,EAAE,oBAAoB,EAAE,QAAQ,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxF,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,CAAC,EAAE,MAAM,EACtB,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,IAAI,CAAC;IAYhB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIxC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAG5C"}
@@ -9,6 +9,7 @@ import { getKvStoreConfigFromRc, } from '../../models/config/kv-store-config.js'
9
9
  import { applyKVStoreEntriesChunks, chunkSizes, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
10
10
  import { getLocalKvStoreEntry, getLocalKVStoreKeys, localKvStoreDeleteEntry, localKvStoreSubmitEntry, writeKVStoreEntriesForLocal, } from '../util/kv-store-local-server.js';
11
11
  import { concurrentParallel } from '../util/retryable.js';
12
+ import { storageEntryDataToBytes, } from './storage-provider.js';
12
13
  import { kvStoreEntryToStorageEntry, } from './kv-store-provider.js';
13
14
  export const buildStoreProvider = (config, context) => {
14
15
  if (isKvStoreConfigRc(config) && context.localMode) {
@@ -45,20 +46,7 @@ export class KvStoreLocalProvider {
45
46
  return kvStoreEntryToStorageEntry(kvStoreEntry);
46
47
  }
47
48
  async submitStorageEntry(key, filePath, data, metadata) {
48
- let fileData;
49
- if (data == null) {
50
- fileData = new Uint8Array(0);
51
- }
52
- else if (data instanceof ReadableStream) {
53
- fileData = Buffer.from(await new Response(data).arrayBuffer());
54
- }
55
- else if (typeof data === 'string') {
56
- fileData = new TextEncoder().encode(data);
57
- }
58
- else {
59
- fileData = data;
60
- }
61
- fs.writeFileSync(filePath, fileData);
49
+ fs.writeFileSync(filePath, await storageEntryDataToBytes(data));
62
50
  await localKvStoreSubmitEntry(this.storeFile, key, path.relative(this.computeAppDir, filePath), metadata != null ? JSON.stringify(metadata) : undefined);
63
51
  }
64
52
  async deleteStorageEntry(key) {
@@ -1,6 +1,6 @@
1
1
  import { type FastlyApiContext } from '../util/api-token.js';
2
2
  import { type KvStoreEntryInfo } from '../util/kv-store.js';
3
- import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type StorageProviderBatchEntry, type ApplyBatchOptions } from './storage-provider.js';
3
+ import { type StorageEntry, type StorageEntryData, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type StorageProviderBatchEntry, type ApplyBatchOptions } from './storage-provider.js';
4
4
  export declare const buildStoreProvider: StorageProviderBuilder;
5
5
  export declare class KvStoreProvider implements StorageProvider {
6
6
  constructor(storeName: string, fastlyApiToken: string);
@@ -9,7 +9,7 @@ export declare class KvStoreProvider implements StorageProvider {
9
9
  getStorageKeys(prefix?: string): Promise<string[] | null>;
10
10
  getStorageEntry(key: string): Promise<StorageEntry | null>;
11
11
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
12
- submitStorageEntry(key: string, _filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
12
+ submitStorageEntry(key: string, _filePath: string, data: StorageEntryData, metadata?: Record<string, string>): Promise<void>;
13
13
  deleteStorageEntry(key: string): Promise<void>;
14
14
  applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
15
15
  uploadEntries(entries: StorageProviderBatchEntry[], verbose?: boolean): Promise<void>;
@@ -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;AAK9B,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,qBAAqB,CAAC;AAa7B,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,MAA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,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;IAIxC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAI5C;AAED,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,gBAAgB,gBA6B/B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,iCAiCpD"}
@@ -11,6 +11,7 @@ import { ProgressLog } from '../util/progress.js';
11
11
  import { getKvStoreEntry, getKVStoreKeys, kvStoreDeleteEntry, kvStoreSubmitEntry, kvStoreSubmitBatch, } from '../util/kv-store.js';
12
12
  import { applyKVStoreEntriesChunks, chunkSizes, packNdjsonBatches, ndjsonLineForBatchEntry, entriesToUpload, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
13
13
  import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
14
+ import { storageEntryDataToBytes, } from './storage-provider.js';
14
15
  export const buildStoreProvider = (config, context) => {
15
16
  if (isKvStoreConfigRc(config) && !context.localMode) {
16
17
  console.log(` Working on the Fastly KV Store...`);
@@ -50,7 +51,7 @@ export class KvStoreProvider {
50
51
  return kvStoreEntryToStorageEntry(kvStoreEntry);
51
52
  }
52
53
  async submitStorageEntry(key, _filePath, data, metadata) {
53
- await kvStoreSubmitEntry(this.fastlyApiContext, this.kvStoreName, key, data ?? new Uint8Array(0), metadata != null ? JSON.stringify(metadata) : undefined);
54
+ await kvStoreSubmitEntry(this.fastlyApiContext, this.kvStoreName, key, await storageEntryDataToBytes(data), metadata != null ? JSON.stringify(metadata) : undefined);
54
55
  }
55
56
  async deleteStorageEntry(key) {
56
57
  await kvStoreDeleteEntry(this.fastlyApiContext, this.kvStoreName, key);
@@ -1,6 +1,6 @@
1
1
  import { S3Client } from '@aws-sdk/client-s3';
2
2
  import { type Command, type HttpHandlerOptions } from '@aws-sdk/types';
3
- import { type StorageEntry, type StorageProvider, type StorageProviderBuilder, type StorageProviderBatch, type ApplyBatchOptions } from './storage-provider.js';
3
+ import { type StorageEntry, type StorageEntryData, 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
5
  export declare const DEFAULT_S3_UPLOAD_CONCURRENCY = 64;
6
6
  export declare const S3_LOCAL_MODE_ERROR = "--local is available only in KV Store mode. In S3 mode, the commands always use the bucket in static-publish.rc.js.";
@@ -19,7 +19,7 @@ export declare class S3StorageProvider implements StorageProvider {
19
19
  getStorageKeys(prefix?: string): Promise<string[] | null>;
20
20
  getStorageEntry(key: string): Promise<StorageEntry | null>;
21
21
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
22
- submitStorageEntry(key: string, _filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
22
+ submitStorageEntry(key: string, _filePath: string, data: StorageEntryData, metadata?: Record<string, string>): Promise<void>;
23
23
  deleteStorageEntry(key: string): Promise<void>;
24
24
  applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
25
25
  doConcurrentParallel<TObject extends {
@@ -1 +1 @@
1
- {"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAQA,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;AAc/B,KAAK,a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AAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAyB9D,kBAAkB,CACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,gBAAgB,EACtB,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;IA+BvF,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;IAIzC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;CAI5C"}
@@ -8,6 +8,7 @@ import https from 'node:https';
8
8
  import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, PutObjectCommand, S3Client, S3ServiceException, paginateListObjectsV2, } from '@aws-sdk/client-s3';
9
9
  import { isS3StorageConfigRc, } from '../../models/config/static-publish-rc.js';
10
10
  import { getS3StorageConfigFromRc, } from '../../models/config/s3-storage-config.js';
11
+ import { storageEntryDataToBytes, } from './storage-provider.js';
11
12
  import { entriesToUpload } from '../util/kv-store-items.js';
12
13
  import { loadS3Credentials, } from '../util/s3-credentials.js';
13
14
  import { concurrentParallel, makeRetryable, } from '../util/retryable.js';
@@ -164,7 +165,7 @@ export class S3StorageProvider {
164
165
  const input = {
165
166
  Bucket: this.s3Bucket, // required
166
167
  Key: key, // required
167
- Body: data ?? undefined,
168
+ Body: await storageEntryDataToBytes(data),
168
169
  Metadata: metadata,
169
170
  };
170
171
  const command = new PutObjectCommand(input);
@@ -5,11 +5,13 @@ export interface StorageEntry {
5
5
  providerMetadata?: Record<string, string>;
6
6
  size?: number;
7
7
  }
8
+ export type StorageEntryData = ReadableStream<Uint8Array> | Uint8Array | string | null | undefined;
9
+ export declare function storageEntryDataToBytes(data: StorageEntryData): Promise<Uint8Array>;
8
10
  export interface StorageProvider {
9
11
  getStorageKeys(prefix?: string): Promise<string[] | null>;
10
12
  getStorageEntryInfo(key: string): Promise<StorageEntry | null>;
11
13
  getStorageEntry(key: string): Promise<StorageEntry | null>;
12
- submitStorageEntry(key: string, filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
14
+ submitStorageEntry(key: string, filePath: string, data: StorageEntryData, metadata?: Record<string, string>): Promise<void>;
13
15
  deleteStorageEntry(key: string): Promise<void>;
14
16
  applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
15
17
  doConcurrentParallel<TObject extends {
@@ -1 +1 @@
1
- {"version":3,"file":"storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/cli/storage/storage-provider.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO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