@fastly/compute-js-static-publish 8.0.0 → 8.0.2
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.
- package/CHANGELOG.md +544 -0
- package/DOCUMENTATION.md +1243 -0
- package/MIGRATING.md +128 -0
- package/README.md +9 -2
- package/README.short.md +9 -2
- package/build/cli/cli/commands/manage/collections/promote.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/collections/promote.js +43 -4
- package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
- package/build/cli/cli/commands/manage/publish-content.js +13 -16
- package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
- package/build/cli/cli/commands/scaffold/index.js +51 -31
- package/build/cli/cli/storage/kv-store-local-provider.d.ts +1 -0
- package/build/cli/cli/storage/kv-store-local-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/kv-store-local-provider.js +4 -1
- package/build/cli/cli/storage/kv-store-provider.d.ts +2 -1
- package/build/cli/cli/storage/kv-store-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/kv-store-provider.js +17 -6
- package/build/cli/cli/storage/s3-storage-provider.d.ts +1 -0
- package/build/cli/cli/storage/s3-storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/s3-storage-provider.js +8 -2
- package/build/cli/cli/storage/storage-provider.d.ts +4 -0
- package/build/cli/cli/storage/storage-provider.d.ts.map +1 -1
- package/build/cli/cli/storage/storage-provider.js +32 -0
- package/build/cli/cli/util/api-token.d.ts +2 -1
- package/build/cli/cli/util/api-token.d.ts.map +1 -1
- package/build/cli/cli/util/api-token.js +38 -3
- package/build/cli/cli/util/kv-store-items.d.ts +1 -0
- package/build/cli/cli/util/kv-store-items.d.ts.map +1 -1
- package/build/cli/cli/util/kv-store-items.js +16 -40
- package/build/cli/cli/util/progress.d.ts +11 -0
- package/build/cli/cli/util/progress.d.ts.map +1 -0
- package/build/cli/cli/util/progress.js +32 -0
- package/build/cli/cli/util/purge.d.ts +9 -1
- package/build/cli/cli/util/purge.d.ts.map +1 -1
- package/build/cli/cli/util/purge.js +16 -8
- package/build/cli/cli/util/s3.d.ts +10 -4
- package/build/cli/cli/util/s3.d.ts.map +1 -1
- package/build/cli/cli/util/s3.js +13 -35
- package/build/server/server/publisher-server/accept-html.d.ts +2 -0
- package/build/server/server/publisher-server/accept-html.d.ts.map +1 -0
- package/build/server/server/publisher-server/accept-html.js +50 -0
- package/build/server/server/publisher-server/index.d.ts +1 -0
- package/build/server/server/publisher-server/index.d.ts.map +1 -1
- package/build/server/server/publisher-server/index.js +31 -13
- package/build/server/server/publisher-server/response-cache.d.ts +3 -0
- package/build/server/server/publisher-server/response-cache.d.ts.map +1 -1
- package/build/server/server/publisher-server/response-cache.js +24 -1
- package/package.json +6 -3
package/MIGRATING.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
New major versions of `@fastly/compute-js-static-publish` can involve changes to the files that
|
|
4
|
+
are generated during scaffolding. For this reason, it is recommended that you re-scaffold your application.
|
|
5
|
+
|
|
6
|
+
This is straightforward if you're using `compute-js-static-publisher` out-of-the-box. Otherwise, read on.
|
|
7
|
+
|
|
8
|
+
> [!NOTE]
|
|
9
|
+
> This document is under construction.
|
|
10
|
+
>
|
|
11
|
+
|
|
12
|
+
## Upgrade from v7 to v8
|
|
13
|
+
|
|
14
|
+
v8 can use the files that v7 published. The storage key layout did not change. v8 also accepts the v7 format of
|
|
15
|
+
`static-publish.rc.js` (`kvStoreName` at the top level). Thus, an app that uses the KV Store does not need a new
|
|
16
|
+
scaffold.
|
|
17
|
+
|
|
18
|
+
To upgrade an app that uses the KV Store:
|
|
19
|
+
|
|
20
|
+
1. In the `compute-js/` directory of your app, install v8:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install @fastly/compute-js-static-publish@latest
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. Make sure that the CLI can get a Fastly API token. Set the `FASTLY_API_TOKEN` environment variable, or use
|
|
27
|
+
`--fastly-api-token`. v8 no longer uses the token logged in by the Fastly CLI.
|
|
28
|
+
|
|
29
|
+
3. Build and deploy your app again. The Wasm binary contains a copy of `static-publish.rc.js`, and the server code
|
|
30
|
+
changed.
|
|
31
|
+
|
|
32
|
+
4. Publish your content again with `npm run publish-content`. This step is optional. v8 serves the content that v7
|
|
33
|
+
published.
|
|
34
|
+
|
|
35
|
+
### Changes to examine
|
|
36
|
+
|
|
37
|
+
- **The CLI purges after it publishes.** In v8, `publish-content` purges the surrogate key `<publishId>-<collection>`
|
|
38
|
+
in KV Store mode too. It finds the Service ID from `--fastly-service-id`, then the `FASTLY_SERVICE_ID`
|
|
39
|
+
environment variable, then `service_id` in `fastly.toml`. If it finds a Service ID, the API token must have permission to purge
|
|
40
|
+
that service. If you do not want a purge, make sure that the CLI does not find a Service ID. If the purge fails,
|
|
41
|
+
the CLI shows a warning, and the publish is complete. `collections delete` purges the same way after it deletes a
|
|
42
|
+
collection.
|
|
43
|
+
- **`kvStoreAssetInclusionTest` has a new name.** In `publish-content.config.js`, use `assetInclusionTest`. The old
|
|
44
|
+
name continues to work, but it is deprecated.
|
|
45
|
+
- **Imports of files in `build/` are not supported.** Import the named exports of
|
|
46
|
+
`@fastly/compute-js-static-publish`.
|
|
47
|
+
- **`--public-dir` and `server.publicDirPrefix` are deprecated.** `publish-content` shows a warning if
|
|
48
|
+
`publicDirPrefix` is not empty. See [Stop using `publicDirPrefix`](#stop-using-publicdirprefix-deprecated).
|
|
49
|
+
- **The `@fastly/cli` dependency is removed** from this package. A scaffolded app continues to have `@fastly/cli` as
|
|
50
|
+
its own dependency.
|
|
51
|
+
|
|
52
|
+
### Stop using `publicDirPrefix` (deprecated)
|
|
53
|
+
|
|
54
|
+
`--public-dir` and `server.publicDirPrefix` are deprecated. A future version will remove them. If `publish-content`
|
|
55
|
+
shows a warning about `server.publicDirPrefix`, do the steps in this section. If it does not show the warning, you do
|
|
56
|
+
not use this feature, and you do not have to do anything.
|
|
57
|
+
|
|
58
|
+
`publicDirPrefix` lets you publish files that requests cannot get. For example, with this layout, `rootDir` is
|
|
59
|
+
`'../site'` and `publicDirPrefix` is `'/public'`:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
site/
|
|
63
|
+
404.html published as /404.html, but /404.html is not a URL
|
|
64
|
+
templates/
|
|
65
|
+
email.html published as /templates/email.html, but it is not a URL
|
|
66
|
+
public/
|
|
67
|
+
index.html published as /public/index.html, served at /index.html
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
To stop using `publicDirPrefix`:
|
|
71
|
+
|
|
72
|
+
1. Find the files that are under `rootDir` but not under the public directory (`site/public/` in the example). For
|
|
73
|
+
each file, do one of these steps:
|
|
74
|
+
- If your app does not use the file, do nothing. After step 2, the CLI does not publish it.
|
|
75
|
+
- If the file is your `spaFile` or your `notFoundPageFile`, move it into the public directory. Then requests can
|
|
76
|
+
also get it at its own URL, for example `/404.html`.
|
|
77
|
+
- If your code reads the file with `getMatchingAsset()`, move it into the public directory. Then requests can also
|
|
78
|
+
get it at its own URL. To prevent this, return a response in `src/index.js` before you call `serveRequest()`:
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
const url = new URL(request.url);
|
|
82
|
+
if (url.pathname.startsWith('/templates/')) {
|
|
83
|
+
return new Response('Not found', { status: 404 });
|
|
84
|
+
}
|
|
85
|
+
const response = await publisherServer.serveRequest(request);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. In `publish-content.config.js`:
|
|
89
|
+
- Set `rootDir` to the public directory, for example `'../site/public'`.
|
|
90
|
+
- Remove `publicDirPrefix` from the `server` section.
|
|
91
|
+
- In `spaFile` and `notFoundPageFile`, remove the prefix, for example change `'/public/404.html'` to
|
|
92
|
+
`'/404.html'`. These values are asset keys, and asset keys are relative to `rootDir`.
|
|
93
|
+
- Do not change `staticItems`. These values are already relative to the public directory.
|
|
94
|
+
|
|
95
|
+
3. If your code calls `getMatchingAsset()` with a key that starts with the prefix, remove the prefix from the key, for
|
|
96
|
+
example change `'/public/index.html'` to `'/index.html'`. Then build and deploy your app. Between the deploy and
|
|
97
|
+
step 4, your code does not find these files.
|
|
98
|
+
|
|
99
|
+
4. Publish each collection that you serve again. Each collection keeps its old settings and its old index until you
|
|
100
|
+
publish it again. The keys of the files are the hashes of the content, so the CLI does not upload the same files
|
|
101
|
+
again.
|
|
102
|
+
|
|
103
|
+
### Move from the KV Store to S3-compatible storage (BETA)
|
|
104
|
+
|
|
105
|
+
You do not have to move to S3-compatible storage. The KV Store continues to be the default storage mode.
|
|
106
|
+
|
|
107
|
+
There is no tool that moves your content from the KV Store to a bucket. The CLI publishes from your source files.
|
|
108
|
+
Thus, to move, you publish your content again into the bucket:
|
|
109
|
+
|
|
110
|
+
1. Scaffold a new app with `--storage-mode=s3`, `--s3-region`, `--s3-bucket`, and, if necessary, `--s3-endpoint`.
|
|
111
|
+
Scaffold it into a different directory, so that you can compare the new files with your current app.
|
|
112
|
+
|
|
113
|
+
2. Copy your changes from your current app into the new app, for example the changes to `src/index.js` and to
|
|
114
|
+
`publish-content.config.js`. Keep the same `publishId` and `defaultCollectionName`.
|
|
115
|
+
|
|
116
|
+
3. Set up the S3 credentials for publishing and for the server. See "Using S3 Compatible Storage (Beta)" in
|
|
117
|
+
`README.md`.
|
|
118
|
+
|
|
119
|
+
4. Publish each collection that you need again, from its source files. The collections that are in the KV Store
|
|
120
|
+
are not copied.
|
|
121
|
+
|
|
122
|
+
5. Build and deploy the new app. Then examine your site.
|
|
123
|
+
|
|
124
|
+
6. When you do not need the KV Store content, delete it. Before you do this, make sure that no service version
|
|
125
|
+
that is active or staged uses that KV Store.
|
|
126
|
+
|
|
127
|
+
> [!NOTE]
|
|
128
|
+
> S3-compatible storage is in beta. The configuration and these steps can change before this feature is stable.
|
package/README.md
CHANGED
|
@@ -54,6 +54,12 @@ npm run fastly:deploy # deploy the app
|
|
|
54
54
|
npm run fastly:publish # upload your static files
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
`fastly:publish` needs a Fastly API token that can write to the KV Store. Set the `FASTLY_API_TOKEN` environment variable, or add `-- --fastly-api-token=<token>`. The command does not read the token of your Fastly CLI profile. If you are logged in with the Fastly CLI, you can give it that token:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
FASTLY_API_TOKEN=$(npx fastly auth token) npm run fastly:publish
|
|
61
|
+
```
|
|
62
|
+
|
|
57
63
|
In the future, unless you have further changes to make to your app itself, you can
|
|
58
64
|
upload further updates to your static files:
|
|
59
65
|
```sh
|
|
@@ -61,7 +67,7 @@ cd compute-js
|
|
|
61
67
|
npm run fastly:publish # upload your static files
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
If the app uses S3-compatible storage, your files are already in the bucket after `npm run s3:publish`. Run `npm run fastly:deploy` to deploy the app, and use `npm run s3:publish` to upload updates.
|
|
70
|
+
If the app uses S3-compatible storage, your files are already in the bucket after `npm run s3:publish`. Run `npm run fastly:deploy` to deploy the app, and use `npm run s3:publish` to upload updates. After the deploy, `fastly.toml` has the service ID, so `s3:publish` also purges the service's cache. For this purge, set `FASTLY_API_TOKEN` too. Without it, `s3:publish` stops with an error before it uploads files.
|
|
65
71
|
|
|
66
72
|
## Features
|
|
67
73
|
|
|
@@ -72,7 +78,8 @@ If the app uses S3-compatible storage, your files are already in the bucket afte
|
|
|
72
78
|
|
|
73
79
|
## Documentation
|
|
74
80
|
|
|
75
|
-
📘
|
|
81
|
+
📘 This package includes the full documentation in [DOCUMENTATION.md](DOCUMENTATION.md), with the CLI reference for this version.
|
|
82
|
+
It is also available on GitHub:
|
|
76
83
|
[https://github.com/fastly/compute-js-static-publish/tree/main](https://github.com/fastly/compute-js-static-publish/tree/main)
|
|
77
84
|
|
|
78
85
|
### Security issues
|
package/README.short.md
CHANGED
|
@@ -54,6 +54,12 @@ npm run fastly:deploy # deploy the app
|
|
|
54
54
|
npm run fastly:publish # upload your static files
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
`fastly:publish` needs a Fastly API token that can write to the KV Store. Set the `FASTLY_API_TOKEN` environment variable, or add `-- --fastly-api-token=<token>`. The command does not read the token of your Fastly CLI profile. If you are logged in with the Fastly CLI, you can give it that token:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
FASTLY_API_TOKEN=$(npx fastly auth token) npm run fastly:publish
|
|
61
|
+
```
|
|
62
|
+
|
|
57
63
|
In the future, unless you have further changes to make to your app itself, you can
|
|
58
64
|
upload further updates to your static files:
|
|
59
65
|
```sh
|
|
@@ -61,7 +67,7 @@ cd compute-js
|
|
|
61
67
|
npm run fastly:publish # upload your static files
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
If the app uses S3-compatible storage, your files are already in the bucket after `npm run s3:publish`. Run `npm run fastly:deploy` to deploy the app, and use `npm run s3:publish` to upload updates.
|
|
70
|
+
If the app uses S3-compatible storage, your files are already in the bucket after `npm run s3:publish`. Run `npm run fastly:deploy` to deploy the app, and use `npm run s3:publish` to upload updates. After the deploy, `fastly.toml` has the service ID, so `s3:publish` also purges the service's cache. For this purge, set `FASTLY_API_TOKEN` too. Without it, `s3:publish` stops with an error before it uploads files.
|
|
65
71
|
|
|
66
72
|
## Features
|
|
67
73
|
|
|
@@ -72,7 +78,8 @@ If the app uses S3-compatible storage, your files are already in the bucket afte
|
|
|
72
78
|
|
|
73
79
|
## Documentation
|
|
74
80
|
|
|
75
|
-
📘
|
|
81
|
+
📘 This package includes the full documentation in [DOCUMENTATION.md](DOCUMENTATION.md), with the CLI reference for this version.
|
|
82
|
+
It is also available on GitHub:
|
|
76
83
|
[https://github.com/fastly/compute-js-static-publish/tree/main](https://github.com/fastly/compute-js-static-publish/tree/main)
|
|
77
84
|
|
|
78
85
|
### Security issues
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/manage/collections/promote.ts"],"names":[],"mappings":"AAkFA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAmNhD"}
|
|
@@ -9,6 +9,7 @@ import { calcExpirationTime } from '../../../../models/time/index.js';
|
|
|
9
9
|
import { LoadConfigError, loadStaticPublisherRcFile } from '../../../util/config.js';
|
|
10
10
|
import { parseCommandLine } from '../../../util/args.js';
|
|
11
11
|
import { loadStorageProviderFromStaticPublishRc } from '../../../storage/storage-provider.js';
|
|
12
|
+
import { loadPurgeTarget, purgeCollection } from '../../../util/purge.js';
|
|
12
13
|
function help() {
|
|
13
14
|
console.log(`\
|
|
14
15
|
|
|
@@ -21,6 +22,9 @@ Usage:
|
|
|
21
22
|
Description:
|
|
22
23
|
Copies an existing collection (content + config) to a new collection name.
|
|
23
24
|
|
|
25
|
+
If a Service ID is found, the tool then purges the cached responses of the target
|
|
26
|
+
collection from that service.
|
|
27
|
+
|
|
24
28
|
Required:
|
|
25
29
|
--collection-name=<name> The name of the collection to promote
|
|
26
30
|
--to=<name> The name of the new (target) collection to create or overwrite
|
|
@@ -45,10 +49,21 @@ KV Store Options:
|
|
|
45
49
|
with the local development environment.
|
|
46
50
|
KV Store mode only. In S3 mode, --local is an error.
|
|
47
51
|
|
|
48
|
-
--fastly-api-token=<token> Fastly API token for KV Store access.
|
|
52
|
+
--fastly-api-token=<token> Fastly API token for KV Store or cache access.
|
|
49
53
|
If not set, the tool uses the FASTLY_API_TOKEN
|
|
50
54
|
environment variable.
|
|
51
55
|
|
|
56
|
+
Purge Options:
|
|
57
|
+
--fastly-service-id=<id> Fastly Service ID to purge after promoting (not with --local).
|
|
58
|
+
If not set, the tool will check:
|
|
59
|
+
1. FASTLY_SERVICE_ID environment variable
|
|
60
|
+
2. service_id in fastly.toml
|
|
61
|
+
If none is found, the purge is skipped.
|
|
62
|
+
|
|
63
|
+
--purge-environment=<env> Environment to purge: production, staging, or a
|
|
64
|
+
comma-separated list of both. Can be repeated.
|
|
65
|
+
Default: production
|
|
66
|
+
|
|
52
67
|
S3 Storage Options (BETA):
|
|
53
68
|
--s3-access-key-id=<id> Access Key ID and Secret Access Key used to
|
|
54
69
|
--s3-secret-access-key=<key> interface with S3 or compatible storage.
|
|
@@ -69,6 +84,8 @@ export async function action(actionArgs) {
|
|
|
69
84
|
{ name: 'expires-never', type: Boolean },
|
|
70
85
|
{ name: 'local', type: Boolean },
|
|
71
86
|
{ name: 'fastly-api-token', type: String, },
|
|
87
|
+
{ name: 'fastly-service-id', type: String, },
|
|
88
|
+
{ name: 'purge-environment', type: String, multiple: true, },
|
|
72
89
|
{ name: 's3-access-key-id', type: String, },
|
|
73
90
|
{ name: 's3-secret-access-key', type: String, },
|
|
74
91
|
];
|
|
@@ -82,7 +99,7 @@ export async function action(actionArgs) {
|
|
|
82
99
|
help();
|
|
83
100
|
return;
|
|
84
101
|
}
|
|
85
|
-
const { verbose, ['collection-name']: collectionNameValue, to: toCollectionNameValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
102
|
+
const { verbose, ['collection-name']: collectionNameValue, to: toCollectionNameValue, ['expires-in']: expiresIn, ['expires-at']: expiresAt, ['expires-never']: expiresNever, local: localMode, ['fastly-api-token']: fastlyApiToken, ['fastly-service-id']: fastlyServiceId, ['purge-environment']: purgeEnvironmentValues, ['s3-access-key-id']: s3AccessKeyId, ['s3-secret-access-key']: s3SecretAccessKey, } = parsed.commandLineOptions;
|
|
86
103
|
// compute-js-static-publisher cli is always run from the Compute application directory
|
|
87
104
|
// in other words, the directory that contains `fastly.toml`.
|
|
88
105
|
const computeAppDir = path.resolve();
|
|
@@ -148,6 +165,22 @@ export async function action(actionArgs) {
|
|
|
148
165
|
}
|
|
149
166
|
const sourceCollectionName = collectionNameValue;
|
|
150
167
|
console.log(`✔️ Collection to copy: ${sourceCollectionName}`);
|
|
168
|
+
// Purge target: checked now, so that a missing API token fails before anything is written.
|
|
169
|
+
let purgeTarget;
|
|
170
|
+
try {
|
|
171
|
+
purgeTarget = loadPurgeTarget({
|
|
172
|
+
localMode: localMode ?? false,
|
|
173
|
+
computeAppDir,
|
|
174
|
+
fastlyServiceId,
|
|
175
|
+
fastlyApiToken,
|
|
176
|
+
purgeEnvironments: purgeEnvironmentValues,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
console.error(String(err));
|
|
181
|
+
process.exitCode = 1;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
151
184
|
const targetCollectionName = toCollectionNameValue;
|
|
152
185
|
console.log(`✔️ Collection to promote to: ${targetCollectionName}`);
|
|
153
186
|
if (expirationTime === undefined) {
|
|
@@ -191,11 +224,17 @@ export async function action(actionArgs) {
|
|
|
191
224
|
console.log(`Uploading to storage: '${targetCollectionName}'`);
|
|
192
225
|
const storageContentDir = `${staticPublisherWorkingDir}/storage-content`;
|
|
193
226
|
fs.mkdirSync(storageContentDir, { recursive: true });
|
|
194
|
-
|
|
227
|
+
// The files have the name of the target collection, as in publish-content. In
|
|
228
|
+
// --local mode, kvstore.json refers to them, so the target must not share a
|
|
229
|
+
// file with the source.
|
|
230
|
+
const indexFileName = `index_${targetCollectionName}.json`;
|
|
195
231
|
const indexFilePath = path.resolve(storageContentDir, indexFileName);
|
|
196
232
|
await storageProvider.submitStorageEntry(targetCollectionIndexKey, indexFilePath, indexEntryInfo.data, encodeIndexMetadata(indexMetadata));
|
|
197
|
-
const settingsFileName = `settings_${
|
|
233
|
+
const settingsFileName = `settings_${targetCollectionName}.json`;
|
|
198
234
|
const settingsFilePath = path.resolve(storageContentDir, settingsFileName);
|
|
199
235
|
await storageProvider.submitStorageEntry(targetCollectionSettingsKey, settingsFilePath, settingsEntryInfo.data);
|
|
236
|
+
if (purgeTarget != null) {
|
|
237
|
+
await purgeCollection(purgeTarget, publishId, targetCollectionName);
|
|
238
|
+
}
|
|
200
239
|
console.log("✅ Completed.");
|
|
201
240
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -13,8 +13,9 @@ import { applyDefaults } from '../../util/data.js';
|
|
|
13
13
|
import { calculateFileSizeAndHash, enumerateFiles, rootRelative } from '../../util/files.js';
|
|
14
14
|
import { ensureVariantFileExists, OncePerKey } from '../../util/variants.js';
|
|
15
15
|
import { concurrentMap } from '../../util/retryable.js';
|
|
16
|
+
import { ProgressLog } from '../../util/progress.js';
|
|
16
17
|
import { loadPurgeTarget, purgeCollection } from '../../util/purge.js';
|
|
17
|
-
import { getStorageKeysByHexPrefix, loadStorageProviderFromStaticPublishRc, StorageProviderBatch, } from '../../storage/storage-provider.js';
|
|
18
|
+
import { getStorageKeysByHexPrefix, isVariantInStorage, loadStorageProviderFromStaticPublishRc, StorageProviderBatch, } from '../../storage/storage-provider.js';
|
|
18
19
|
// Storage key format:
|
|
19
20
|
// <publishId>_index_<preview_id>.json
|
|
20
21
|
// <publishId>_settings_<preview_id>.json
|
|
@@ -94,6 +95,9 @@ S3 Storage Options (BETA):
|
|
|
94
95
|
Default: 64
|
|
95
96
|
|
|
96
97
|
Global Options:
|
|
98
|
+
--verbose Verbose mode. Logs each file and each upload.
|
|
99
|
+
Without this, the log shows the progress after
|
|
100
|
+
each 1000 files or uploads.
|
|
97
101
|
-h, --help Show this help message and exit.
|
|
98
102
|
|
|
99
103
|
Examples:
|
|
@@ -105,7 +109,7 @@ Examples:
|
|
|
105
109
|
}
|
|
106
110
|
export async function action(actionArgs) {
|
|
107
111
|
const optionDefinitions = [
|
|
108
|
-
{ name: 'verbose', type: Boolean },
|
|
112
|
+
{ name: 'verbose', type: Boolean, defaultValue: false },
|
|
109
113
|
{ name: 'config', type: String },
|
|
110
114
|
{ name: 'collection-name', type: String, },
|
|
111
115
|
{ name: 'root-dir', type: String, },
|
|
@@ -315,6 +319,8 @@ export async function action(actionArgs) {
|
|
|
315
319
|
// #### Keys that are already in storage
|
|
316
320
|
// The key of a file is the hash of its content. If the key exists, storage
|
|
317
321
|
// already has the same content. Thus we do not compress, hash, or upload it again.
|
|
322
|
+
// For a file in more than one chunk, isVariantInStorage() also compares the
|
|
323
|
+
// stored size of each chunk.
|
|
318
324
|
// In local mode, a key can refer to a working file that was deleted, so we do not list.
|
|
319
325
|
// All the keys that the scan looks for start with `<publishId>_files_sha256_` and a hex
|
|
320
326
|
// hash, so we list them in 16 parts at the same time.
|
|
@@ -326,18 +332,8 @@ export async function action(actionArgs) {
|
|
|
326
332
|
console.log(`✅ Found ${existingKeys.size} key(s) in ${((Date.now() - listStart) / 1000).toFixed(1)} s.`);
|
|
327
333
|
}
|
|
328
334
|
let existingVariantCount = 0;
|
|
329
|
-
function isVariantInStorage(variantKey, numChunks) {
|
|
330
|
-
if (existingKeys == null || !existingKeys.has(variantKey)) {
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
for (let chunkIndex = 1; chunkIndex < numChunks; chunkIndex++) {
|
|
334
|
-
if (!existingKeys.has(`${variantKey}_${chunkIndex}`)) {
|
|
335
|
-
return false;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return true;
|
|
339
|
-
}
|
|
340
335
|
// #### Iterate files
|
|
336
|
+
const scanProgress = new ProgressLog('Files scanned', verbose);
|
|
341
337
|
const fileResults = await concurrentMap(files, async (file) => {
|
|
342
338
|
// #### asset key
|
|
343
339
|
const assetKey = file.slice(publicDirRoot.length)
|
|
@@ -371,7 +367,7 @@ export async function action(actionArgs) {
|
|
|
371
367
|
}
|
|
372
368
|
// #### Base file size, hash, last modified time
|
|
373
369
|
const { size: baseSize, hash: baseHash } = await calculateFileSizeAndHash(file);
|
|
374
|
-
|
|
370
|
+
scanProgress.add(1, () => `📄 File '${rootRelative(file)}' - ${baseSize} bytes, sha256: ${baseHash}`);
|
|
375
371
|
const stats = fs.statSync(file);
|
|
376
372
|
const lastModifiedTime = Math.floor((stats.mtime).getTime() / 1000);
|
|
377
373
|
// We know the number of chunks of the original before we read it. For a
|
|
@@ -387,7 +383,8 @@ export async function action(actionArgs) {
|
|
|
387
383
|
// Returns true if the index keeps the variant.
|
|
388
384
|
async function prepareVariant(variant, variantKey, variantFilePath) {
|
|
389
385
|
if ((variant === 'original' || baseNumChunks === 1) &&
|
|
390
|
-
|
|
386
|
+
existingKeys != null &&
|
|
387
|
+
await isVariantInStorage(storageProvider, existingKeys, variantKey, baseSize, variant === 'original' ? baseNumChunks : 1)) {
|
|
391
388
|
if (verbose) {
|
|
392
389
|
console.log(` ・ Asset found in storage with key "${variantKey}".`);
|
|
393
390
|
}
|
|
@@ -479,7 +476,7 @@ export async function action(actionArgs) {
|
|
|
479
476
|
else {
|
|
480
477
|
console.log(` | ${batch.storageProviderBatchEntries.length} variant(s) to upload.`);
|
|
481
478
|
}
|
|
482
|
-
await storageProvider.applyBatch(batch, { existingKeys });
|
|
479
|
+
await storageProvider.applyBatch(batch, { existingKeys, verbose });
|
|
483
480
|
// #### INDEX FILE
|
|
484
481
|
console.log(`🗂️ Saving Index...`);
|
|
485
482
|
const indexFileKey = `${publishId}_index_${collectionName}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/scaffold/index.ts"],"names":[],"mappings":"AAwEA,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,MAAM,GAAG,SAAS,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,WAAW,EAAE,MAAM,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,iBAktBhD"}
|
|
@@ -52,8 +52,9 @@ Compute Service Metadata:
|
|
|
52
52
|
Server Config:
|
|
53
53
|
--public-dir <path> Deprecated. Base dir for content (default: root-dir)
|
|
54
54
|
--static-dir <path>,<path...> Directory served with long TTL (can repeat)
|
|
55
|
-
--spa <file> SPA fallback file (e.g., /index.html)
|
|
56
|
-
--not-found-page <file> 404 fallback file (e.g., /404.html)
|
|
55
|
+
--spa <file> SPA fallback file, under --root-dir (e.g., ./public/index.html)
|
|
56
|
+
--not-found-page <file> 404 fallback file, under --root-dir (e.g., ./public/404.html)
|
|
57
|
+
(default: 404.html in --root-dir, if the file exists)
|
|
57
58
|
--auto-index <name>,<name...> Index filename (e.g., index.html,index.htm)
|
|
58
59
|
--auto-ext <ext>,<ext...> Automatic extensions (e.g., .html,.htm)
|
|
59
60
|
|
|
@@ -69,7 +70,7 @@ const defaultOptions = {
|
|
|
69
70
|
staticDirs: [],
|
|
70
71
|
staticPublisherWorkingDir: undefined,
|
|
71
72
|
spa: undefined,
|
|
72
|
-
notFoundPage:
|
|
73
|
+
notFoundPage: undefined,
|
|
73
74
|
autoIndex: ['index.html', 'index.htm'],
|
|
74
75
|
autoExt: ['.html', '.htm'],
|
|
75
76
|
author: 'you@example.com',
|
|
@@ -502,14 +503,17 @@ export async function action(actionArgs) {
|
|
|
502
503
|
spaFilename = processPublicDirToken(SPA, publicDir);
|
|
503
504
|
// At any rate it must exist under the root directory
|
|
504
505
|
if (!spaFilename.startsWith(rootDir)) {
|
|
505
|
-
console.
|
|
506
|
-
console.
|
|
507
|
-
|
|
506
|
+
console.error(`❌ Specified SPA file '${SPA}' is not under the asset root directory.`);
|
|
507
|
+
console.error(` * ${rootRelative(spaFilename)} must be under ${rootRelative(rootDir)}`);
|
|
508
|
+
console.error(` Give the path from the current directory, for example ${rootRelative(rootDir)}/index.html.`);
|
|
509
|
+
process.exitCode = 1;
|
|
510
|
+
return;
|
|
508
511
|
}
|
|
509
|
-
|
|
510
|
-
console.
|
|
511
|
-
console.
|
|
512
|
-
|
|
512
|
+
if (!fs.existsSync(spaFilename)) {
|
|
513
|
+
console.error(`❌ Specified SPA file '${SPA}' does not exist.`);
|
|
514
|
+
console.error(` * ${rootRelative(spaFilename)} does not exist.`);
|
|
515
|
+
process.exitCode = 1;
|
|
516
|
+
return;
|
|
513
517
|
}
|
|
514
518
|
}
|
|
515
519
|
const NOT_FOUND_PAGE = options.notFoundPage;
|
|
@@ -519,14 +523,24 @@ export async function action(actionArgs) {
|
|
|
519
523
|
notFoundPageFilename = processPublicDirToken(NOT_FOUND_PAGE, publicDir);
|
|
520
524
|
// At any rate it must exist under the root directory
|
|
521
525
|
if (!notFoundPageFilename.startsWith(rootDir)) {
|
|
522
|
-
console.
|
|
523
|
-
console.
|
|
524
|
-
|
|
526
|
+
console.error(`❌ Specified Not Found file '${NOT_FOUND_PAGE}' is not under the asset root directory.`);
|
|
527
|
+
console.error(` * ${rootRelative(notFoundPageFilename)} must be under ${rootRelative(rootDir)}`);
|
|
528
|
+
console.error(` Give the path from the current directory, for example ${rootRelative(rootDir)}/404.html.`);
|
|
529
|
+
process.exitCode = 1;
|
|
530
|
+
return;
|
|
525
531
|
}
|
|
526
|
-
|
|
527
|
-
console.
|
|
528
|
-
console.
|
|
529
|
-
|
|
532
|
+
if (!fs.existsSync(notFoundPageFilename)) {
|
|
533
|
+
console.error(`❌ Specified Not Found file '${NOT_FOUND_PAGE}' does not exist.`);
|
|
534
|
+
console.error(` * ${rootRelative(notFoundPageFilename)} does not exist.`);
|
|
535
|
+
process.exitCode = 1;
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
// Without --not-found-page, use 404.html in the public directory if it exists.
|
|
541
|
+
const defaultNotFoundPageFilename = processPublicDirToken('[public-dir]/404.html', publicDir);
|
|
542
|
+
if (fs.existsSync(defaultNotFoundPageFilename)) {
|
|
543
|
+
notFoundPageFilename = defaultNotFoundPageFilename;
|
|
530
544
|
}
|
|
531
545
|
}
|
|
532
546
|
const autoIndex = options.autoIndex;
|
|
@@ -576,19 +590,16 @@ export async function action(actionArgs) {
|
|
|
576
590
|
}
|
|
577
591
|
let s3Endpoint = options.s3Endpoint;
|
|
578
592
|
if (s3Endpoint == null || s3Endpoint === '') {
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (s3Endpoint) {
|
|
585
|
-
console.log('✅ S3 endpoint resolved:', s3Endpoint);
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
588
|
-
console.error(`❌ Unable to resolve S3 endpoint from region '${s3Region}' and bucket '${s3Bucket}.`);
|
|
593
|
+
// Without an endpoint, the bucket is on AWS. The app needs its host name
|
|
594
|
+
// for the backend in the Compute service.
|
|
595
|
+
const hostname = findHostnameForAwsS3RegionAndBucket(s3Region, s3Bucket);
|
|
596
|
+
if (hostname == null) {
|
|
597
|
+
console.error(`❌ The bucket name '${s3Bucket}' has a dot, so it cannot be a host name of AWS S3 under HTTPS. Set --s3-endpoint, for example --s3-endpoint=https://s3.${s3Region}.amazonaws.com. Then the bucket is in the path of the URL.`);
|
|
589
598
|
process.exitCode = 1;
|
|
590
599
|
return;
|
|
591
600
|
}
|
|
601
|
+
s3Endpoint = hostname;
|
|
602
|
+
console.log('✅ S3 endpoint resolved:', s3Endpoint);
|
|
592
603
|
s3EndpointUrl = new URL(`https://${s3Endpoint}/`);
|
|
593
604
|
s3EndpointGenerated = true;
|
|
594
605
|
}
|
|
@@ -889,14 +900,16 @@ async function handleRequest(event) {
|
|
|
889
900
|
|
|
890
901
|
const request = event.request;
|
|
891
902
|
|
|
903
|
+
// Do custom things here!
|
|
904
|
+
// Handle API requests, serve non-static responses, etc.
|
|
905
|
+
// serveRequest() serves the 404 page or the SPA file for each path that
|
|
906
|
+
// has no file, so code after it does not run for those requests.
|
|
907
|
+
|
|
892
908
|
const response = await publisherServer.serveRequest(request);
|
|
893
909
|
if (response != null) {
|
|
894
910
|
return response;
|
|
895
911
|
}
|
|
896
912
|
|
|
897
|
-
// Do custom things here!
|
|
898
|
-
// Handle API requests, serve non-static responses, etc.
|
|
899
|
-
|
|
900
913
|
return new Response('Not found', { status: 404 });
|
|
901
914
|
}
|
|
902
915
|
`;
|
|
@@ -923,7 +936,11 @@ To build and deploy to your Compute service:
|
|
|
923
936
|
|
|
924
937
|
cd ${COMPUTE_JS_DIR}
|
|
925
938
|
npm run fastly:deploy
|
|
926
|
-
npm run fastly:publish
|
|
939
|
+
FASTLY_API_TOKEN=xxxx npm run fastly:publish
|
|
940
|
+
|
|
941
|
+
fastly:publish reads the API token only from FASTLY_API_TOKEN or --fastly-api-token,
|
|
942
|
+
not from your Fastly CLI profile. To use the token of the Fastly CLI, type:
|
|
943
|
+
FASTLY_API_TOKEN=$(npx fastly auth token) npm run fastly:publish
|
|
927
944
|
|
|
928
945
|
`);
|
|
929
946
|
}
|
|
@@ -971,6 +988,9 @@ To build and deploy to your Compute service:
|
|
|
971
988
|
a different name, the Fastly CLI uses it for the resource link too. Then call
|
|
972
989
|
setSecretStoreForS3Credentials() with that name in src/index.js, and deploy again.
|
|
973
990
|
|
|
991
|
+
After the deploy, fastly.toml has the service ID, so s3:publish also purges the
|
|
992
|
+
service's cache. For this purge, s3:publish needs FASTLY_API_TOKEN too.
|
|
993
|
+
|
|
974
994
|
`);
|
|
975
995
|
}
|
|
976
996
|
}
|
|
@@ -14,5 +14,6 @@ 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
|
+
calculateChunkSizes(size: number): number[];
|
|
17
18
|
}
|
|
18
19
|
//# 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":"
|
|
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,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;IAsBV,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"}
|
|
@@ -6,7 +6,7 @@ import fs from 'node:fs';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { isKvStoreConfigRc, } from '../../models/config/static-publish-rc.js';
|
|
8
8
|
import { getKvStoreConfigFromRc, } from '../../models/config/kv-store-config.js';
|
|
9
|
-
import { applyKVStoreEntriesChunks, KV_STORE_CHUNK_SIZE, } from '../util/kv-store-items.js';
|
|
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
12
|
import { kvStoreEntryToStorageEntry, } from './kv-store-provider.js';
|
|
@@ -78,4 +78,7 @@ export class KvStoreLocalProvider {
|
|
|
78
78
|
calculateNumChunks(size) {
|
|
79
79
|
return Math.ceil(size / KV_STORE_CHUNK_SIZE);
|
|
80
80
|
}
|
|
81
|
+
calculateChunkSizes(size) {
|
|
82
|
+
return chunkSizes(size, KV_STORE_CHUNK_SIZE);
|
|
83
|
+
}
|
|
81
84
|
}
|
|
@@ -12,11 +12,12 @@ export declare class KvStoreProvider implements StorageProvider {
|
|
|
12
12
|
submitStorageEntry(key: string, _filePath: string, data: ReadableStream<Uint8Array> | Uint8Array | string | null | undefined, metadata?: Record<string, string>): Promise<void>;
|
|
13
13
|
deleteStorageEntry(key: string): Promise<void>;
|
|
14
14
|
applyBatch(batch: StorageProviderBatch, options?: ApplyBatchOptions): Promise<void>;
|
|
15
|
-
uploadEntries(entries: StorageProviderBatchEntry[]): Promise<void>;
|
|
15
|
+
uploadEntries(entries: StorageProviderBatchEntry[], verbose?: boolean): Promise<void>;
|
|
16
16
|
doConcurrentParallel<TObject extends {
|
|
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
|
+
calculateChunkSizes(size: number): number[];
|
|
20
21
|
}
|
|
21
22
|
export declare function kvStoreEntryToStorageEntry(kvStoreEntry: KvStoreEntryInfo): StorageEntry;
|
|
22
23
|
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;
|
|
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,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;IAYV,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9C,UAAU,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBvF,aAAa,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C5F,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;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"}
|