@fastly/compute-js-static-publish 7.0.0-beta.1 → 7.0.0-beta.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.
Files changed (68) hide show
  1. package/build/cli/commands/manage/clean.d.ts +2 -0
  2. package/build/cli/commands/manage/clean.d.ts.map +1 -0
  3. package/build/cli/commands/manage/clean.js +201 -0
  4. package/build/cli/commands/manage/collections/delete.d.ts +2 -0
  5. package/build/cli/commands/manage/collections/delete.d.ts.map +1 -0
  6. package/build/cli/commands/{collections → manage/collections}/delete.js +56 -25
  7. package/build/cli/commands/manage/collections/index.d.ts.map +1 -0
  8. package/build/cli/commands/{collections → manage/collections}/index.js +27 -22
  9. package/build/cli/commands/manage/collections/list.d.ts +2 -0
  10. package/build/cli/commands/manage/collections/list.d.ts.map +1 -0
  11. package/build/cli/commands/manage/collections/list.js +133 -0
  12. package/build/cli/commands/manage/collections/promote.d.ts +2 -0
  13. package/build/cli/commands/manage/collections/promote.d.ts.map +1 -0
  14. package/build/cli/commands/manage/collections/promote.js +153 -0
  15. package/build/cli/commands/manage/collections/update-expiration.d.ts +2 -0
  16. package/build/cli/commands/manage/collections/update-expiration.d.ts.map +1 -0
  17. package/build/cli/commands/manage/collections/update-expiration.js +129 -0
  18. package/build/cli/commands/manage/index.d.ts.map +1 -0
  19. package/build/cli/commands/{index.js → manage/index.js} +26 -29
  20. package/build/cli/commands/manage/publish-content.d.ts +2 -0
  21. package/build/cli/commands/manage/publish-content.d.ts.map +1 -0
  22. package/build/cli/commands/{publish-content.js → manage/publish-content.js} +142 -56
  23. package/build/cli/commands/{init-app.d.ts → scaffold/index.d.ts} +2 -2
  24. package/build/cli/commands/scaffold/index.d.ts.map +1 -0
  25. package/build/cli/commands/{init-app.js → scaffold/index.js} +70 -22
  26. package/build/cli/fastly-api/api-token.d.ts.map +1 -1
  27. package/build/cli/fastly-api/api-token.js +7 -1
  28. package/build/cli/fastly-api/kv-store.d.ts +2 -2
  29. package/build/cli/fastly-api/kv-store.d.ts.map +1 -1
  30. package/build/cli/fastly-api/kv-store.js +2 -2
  31. package/build/cli/index.js +11 -3
  32. package/build/cli/util/args.d.ts +16 -2
  33. package/build/cli/util/args.d.ts.map +1 -1
  34. package/build/cli/util/args.js +32 -6
  35. package/build/cli/util/fastly-toml.d.ts +2 -0
  36. package/build/cli/util/fastly-toml.d.ts.map +1 -0
  37. package/build/cli/util/fastly-toml.js +15 -0
  38. package/build/cli/util/kv-store-items.d.ts +3 -2
  39. package/build/cli/util/kv-store-items.d.ts.map +1 -1
  40. package/build/cli/util/kv-store-items.js +6 -12
  41. package/build/cli/util/node.d.ts +2 -0
  42. package/build/cli/util/node.d.ts.map +1 -0
  43. package/build/cli/util/node.js +10 -0
  44. package/build/models/server/index.d.ts +5 -0
  45. package/build/models/server/index.d.ts.map +1 -0
  46. package/build/models/server/index.js +1 -0
  47. package/build/models/time/index.d.ts +7 -0
  48. package/build/models/time/index.d.ts.map +1 -0
  49. package/build/models/time/index.js +51 -0
  50. package/build/server/publisher-server/index.d.ts +2 -0
  51. package/build/server/publisher-server/index.d.ts.map +1 -1
  52. package/build/server/publisher-server/index.js +34 -3
  53. package/package.json +3 -2
  54. package/build/cli/commands/clean.d.ts +0 -2
  55. package/build/cli/commands/clean.d.ts.map +0 -1
  56. package/build/cli/commands/clean.js +0 -121
  57. package/build/cli/commands/collections/delete.d.ts +0 -2
  58. package/build/cli/commands/collections/delete.d.ts.map +0 -1
  59. package/build/cli/commands/collections/index.d.ts.map +0 -1
  60. package/build/cli/commands/collections/list.d.ts +0 -2
  61. package/build/cli/commands/collections/list.d.ts.map +0 -1
  62. package/build/cli/commands/collections/list.js +0 -62
  63. package/build/cli/commands/index.d.ts.map +0 -1
  64. package/build/cli/commands/init-app.d.ts.map +0 -1
  65. package/build/cli/commands/publish-content.d.ts +0 -2
  66. package/build/cli/commands/publish-content.d.ts.map +0 -1
  67. /package/build/cli/commands/{collections → manage/collections}/index.d.ts +0 -0
  68. /package/build/cli/commands/{index.d.ts → manage/index.d.ts} +0 -0
@@ -1,16 +1,30 @@
1
+ import { type CommandLineOptions, type OptionDefinition } from 'command-line-args';
1
2
  export type ModeAction = (argv: string[]) => void | Promise<void>;
2
3
  export type ActionModule = {
3
4
  action: ModeAction;
4
5
  };
6
+ export type ActionTable<T extends string> = Record<T, ActionModule>;
5
7
  export declare function isHelpArgs(argv: string[]): boolean;
6
8
  export declare function findMainCommandNameAndArgs(argv: string[]): [string | null, string[]];
7
9
  export type CommandAndArgs<T> = {
8
10
  needHelp: false;
9
11
  command: T;
10
12
  argv: string[];
11
- } | {
13
+ };
14
+ export type CommandAndArgsHelp = {
12
15
  needHelp: true;
13
16
  command: string | null;
14
17
  };
15
- export declare function getCommandAndArgs<T extends string>(argv: string[], modes: T[]): CommandAndArgs<T>;
18
+ export type CommandAndArgsResult<T> = CommandAndArgs<T> | CommandAndArgsHelp;
19
+ export declare function getCommandAndArgs<T extends string>(argv: string[], actions: ActionTable<T>): CommandAndArgsResult<T>;
20
+ export type CommandLineParsed = {
21
+ needHelp: false;
22
+ commandLineOptions: CommandLineOptions;
23
+ };
24
+ export type CommandLineHelp = {
25
+ needHelp: true;
26
+ error: Error | null;
27
+ };
28
+ export type CommandLineResult = CommandLineParsed | CommandLineHelp;
29
+ export declare function parseCommandLine(argv: string[], optionDefinitions: OptionDefinition[]): CommandLineResult;
16
30
  //# sourceMappingURL=args.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../src/cli/util/args.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAElD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,WAQxC;AAED,wBAAgB,0BAA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,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,IAAI,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAA;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC;AAE7E,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GACtB,oBAAoB,CAAC,CAAC,CAAC,CAiCzB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC;IAChB,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEpE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EAAE,EACd,iBAAiB,EAAE,gBAAgB,EAAE,GACpC,iBAAiB,CA0BnB"}
@@ -3,11 +3,11 @@
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
5
  import commandLineArgs from 'command-line-args';
6
+ const helpOptionsDefs = [
7
+ { name: 'help', alias: 'h', type: Boolean },
8
+ ];
6
9
  export function isHelpArgs(argv) {
7
- const helpDefinitions = [
8
- { name: 'help', type: Boolean, },
9
- ];
10
- const helpOptions = commandLineArgs(helpDefinitions, { argv, stopAtFirstUnknown: true });
10
+ const helpOptions = commandLineArgs(helpOptionsDefs, { argv, stopAtFirstUnknown: true });
11
11
  return !!helpOptions['help'];
12
12
  }
13
13
  export function findMainCommandNameAndArgs(argv) {
@@ -22,7 +22,7 @@ export function findMainCommandNameAndArgs(argv) {
22
22
  }
23
23
  return [command, commandArgs];
24
24
  }
25
- export function getCommandAndArgs(argv, modes) {
25
+ export function getCommandAndArgs(argv, actions) {
26
26
  if (isHelpArgs(argv)) {
27
27
  return {
28
28
  needHelp: true,
@@ -32,7 +32,7 @@ export function getCommandAndArgs(argv, modes) {
32
32
  const result = findMainCommandNameAndArgs(argv);
33
33
  const [command, actionArgv] = result;
34
34
  if (command != null) {
35
- for (const modeName of modes) {
35
+ for (const modeName of Object.keys(actions)) {
36
36
  if (command === modeName) {
37
37
  return {
38
38
  needHelp: false,
@@ -53,3 +53,29 @@ export function getCommandAndArgs(argv, modes) {
53
53
  command,
54
54
  };
55
55
  }
56
+ export function parseCommandLine(argv, optionDefinitions) {
57
+ let commandLineOptions;
58
+ try {
59
+ commandLineOptions = commandLineArgs([
60
+ ...helpOptionsDefs,
61
+ ...optionDefinitions,
62
+ ], { argv });
63
+ }
64
+ catch (err) {
65
+ const error = err instanceof Error ? err : new Error(String(err));
66
+ return {
67
+ needHelp: true,
68
+ error,
69
+ };
70
+ }
71
+ if (!!commandLineOptions['help']) {
72
+ return {
73
+ needHelp: true,
74
+ error: null,
75
+ };
76
+ }
77
+ return {
78
+ needHelp: false,
79
+ commandLineOptions,
80
+ };
81
+ }
@@ -0,0 +1,2 @@
1
+ export declare function readServiceId(filePath: string): string | undefined;
2
+ //# sourceMappingURL=fastly-toml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastly-toml.d.ts","sourceRoot":"","sources":["../../../src/cli/util/fastly-toml.ts"],"names":[],"mappings":"AAQA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,sBAQ7C"}
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ import fs from 'fs';
6
+ import toml from 'toml';
7
+ export function readServiceId(filePath) {
8
+ const text = fs.readFileSync(filePath, 'utf8');
9
+ const parsed = toml.parse(text);
10
+ const serviceId = parsed.service_id;
11
+ if (typeof serviceId === 'string') {
12
+ return serviceId;
13
+ }
14
+ return undefined;
15
+ }
@@ -1,4 +1,6 @@
1
- import { type FastlyApiContext } from '../fastly-api/api-token.js';
1
+ export declare function doKvStoreItemsOperation<TObject extends {
2
+ key: string;
3
+ }>(objects: TObject[], fn: (obj: TObject, key: string, index: number) => Promise<void>, maxConcurrent?: number): Promise<void>;
2
4
  export type KVStoreItemDesc = {
3
5
  write: boolean;
4
6
  size: number;
@@ -6,7 +8,6 @@ export type KVStoreItemDesc = {
6
8
  filePath: string;
7
9
  metadataJson?: Record<string, any>;
8
10
  };
9
- export declare function uploadFilesToKVStore(fastlyApiContext: FastlyApiContext, kvStoreName: string, kvStoreItemDescriptions: KVStoreItemDesc[]): Promise<void>;
10
11
  export declare function shouldRecreateChunks(chunksDir: string, numChunks: number, item: KVStoreItemDesc, chunkSize: number): boolean;
11
12
  export declare function applyKVStoreEntriesChunks(kvStoreItemDescriptions: KVStoreItemDesc[], chunkSize: number): Promise<void>;
12
13
  //# sourceMappingURL=kv-store-items.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kv-store-items.d.ts","sourceRoot":"","sources":["../../../src/cli/util/kv-store-items.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,4BAA4B,CAAC;AAG/E,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,iBAgD7I;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,WAkClH;AAED,wBAAsB,yBAAyB,CAAC,uBAAuB,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,MAAM,iBAoG5G"}
1
+ {"version":3,"file":"kv-store-items.d.ts","sourceRoot":"","sources":["../../../src/cli/util/kv-store-items.ts"],"names":[],"mappings":"AAUA,wBAAsB,uBAAuB,CAAC,OAAO,SAAS;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EAC3E,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,iBA6C3B;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,WAkClH;AAED,wBAAsB,yBAAyB,CAAC,uBAAuB,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,MAAM,iBAoG5G"}
@@ -3,26 +3,20 @@
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
5
  import fs from 'node:fs';
6
- import { directoryExists, getFileSize, rootRelative } from './files.js';
6
+ import { directoryExists, getFileSize } from './files.js';
7
7
  import { attemptWithRetries } from './retryable.js';
8
8
  import { FetchError } from '../fastly-api/api-token.js';
9
- import { kvStoreSubmitFile } from '../fastly-api/kv-store.js';
10
- export async function uploadFilesToKVStore(fastlyApiContext, kvStoreName, kvStoreItemDescriptions) {
11
- const maxConcurrent = 12;
9
+ export async function doKvStoreItemsOperation(objects, fn, maxConcurrent = 12) {
12
10
  let index = 0; // Shared among workers
13
11
  async function worker() {
14
- while (index < kvStoreItemDescriptions.length) {
12
+ while (index < objects.length) {
15
13
  const currentIndex = index;
16
14
  index = index + 1;
17
- const { write, key, filePath, metadataJson } = kvStoreItemDescriptions[currentIndex];
18
- if (!write) {
19
- continue;
20
- }
15
+ const object = objects[currentIndex];
16
+ const { key } = object;
21
17
  try {
22
18
  await attemptWithRetries(async () => {
23
- const fileBytes = fs.readFileSync(filePath);
24
- await kvStoreSubmitFile(fastlyApiContext, kvStoreName, key, fileBytes, metadataJson != null ? JSON.stringify(metadataJson) : undefined);
25
- console.log(` 🌐 Submitted asset "${rootRelative(filePath)}" to KV Store with key "${key}".`);
19
+ await fn(object, key, currentIndex);
26
20
  }, {
27
21
  onAttempt(attempt) {
28
22
  if (attempt > 0) {
@@ -0,0 +1,2 @@
1
+ export declare function isNodeError(err: unknown): err is NodeJS.ErrnoException;
2
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/cli/util/node.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,cAAc,CAKtE"}
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ export function isNodeError(err) {
6
+ if (err == null || typeof err !== 'object' || !('code' in err)) {
7
+ return false;
8
+ }
9
+ return true;
10
+ }
@@ -0,0 +1,5 @@
1
+ export type IndexMetadata = {
2
+ publishedTime?: number;
3
+ expirationTime?: number;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/server/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type CalcExpirationTimeArg = {
2
+ expiresIn?: string;
3
+ expiresAt?: string;
4
+ };
5
+ export declare function calcExpirationTime({ expiresIn, expiresAt }: CalcExpirationTimeArg): number | undefined;
6
+ export declare function isExpired(unixTime: number): boolean;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/time/index.ts"],"names":[],"mappings":"AAkCA,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,qBAAqB,sBAsBjF;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,WAEzC"}
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ const DURATION_MS = {
6
+ w: 604800000,
7
+ d: 86400000,
8
+ h: 3600000,
9
+ m: 60000,
10
+ s: 1000,
11
+ ms: 1,
12
+ };
13
+ // Parses something like "1d2h30m" or "5m15s" or "150ms"
14
+ function parseDuration(durationStr) {
15
+ const regex = /(\d+(?:\.\d+)?)(ms|[dhms])/g;
16
+ let totalMs = 0;
17
+ let matchedLength = 0;
18
+ for (const match of durationStr.matchAll(regex)) {
19
+ const [res, valueStr, unit] = match;
20
+ const value = parseFloat(valueStr);
21
+ totalMs += value * DURATION_MS[unit];
22
+ matchedLength += res.length;
23
+ }
24
+ if (matchedLength !== durationStr.length) {
25
+ throw new Error(`Invalid duration format: '${durationStr}'`);
26
+ }
27
+ return totalMs;
28
+ }
29
+ export function calcExpirationTime({ expiresIn, expiresAt }) {
30
+ if (expiresIn && expiresAt) {
31
+ throw new Error('Only one of expiresIn or expiresAt may be provided');
32
+ }
33
+ if (expiresIn) {
34
+ const deltaMs = parseDuration(expiresIn);
35
+ console.log(` ⏳ Expiration duration '${expiresIn}' = ${deltaMs} ms`);
36
+ return Math.floor((Date.now() + deltaMs) / 1000); // return UNIX timestamp
37
+ }
38
+ if (expiresAt) {
39
+ const time = Date.parse(expiresAt);
40
+ if (isNaN(time)) {
41
+ throw new Error(`Invalid expiresAt value: '${expiresAt}'`);
42
+ }
43
+ console.log(` ⏰️ Expiration timestamp '${expiresAt}' = '${new Date(time)}'`);
44
+ console.log(` → ${new Date(time).toISOString()}`);
45
+ return Math.floor(time / 1000);
46
+ }
47
+ return undefined;
48
+ }
49
+ export function isExpired(unixTime) {
50
+ return unixTime < Math.floor(Date.now() / 1000);
51
+ }
@@ -20,6 +20,8 @@ export declare class PublisherServer {
20
20
  defaultCollectionName: string;
21
21
  activeCollectionName: string;
22
22
  collectionNameHeader: string | null;
23
+ settingsCached: PublisherServerConfigNormalized | null | undefined;
24
+ kvAssetsIndex: KVAssetEntryMap | null | undefined;
23
25
  setActiveCollectionName(collectionName: string): void;
24
26
  setCollectionNameHeader(collectionHeader: string | null): void;
25
27
  getServerConfig(): Promise<PublisherServerConfigNormalized | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/publisher-server/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,KAAK,+BAA+B,EACrC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB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8
  import { getKVStoreEntry } from '../util/kv-store.js';
9
9
  import { checkIfModifiedSince, getIfModifiedSinceHeader } from './serve-preconditions/if-modified-since.js';
10
10
  import { checkIfNoneMatch, getIfNoneMatchHeader } from './serve-preconditions/if-none-match.js';
11
+ import { isExpired } from "../../models/time/index.js";
11
12
  export function buildHeadersSubset(responseHeaders, keys) {
12
13
  const resultHeaders = new Headers();
13
14
  for (const value of keys) {
@@ -48,21 +49,29 @@ export class PublisherServer {
48
49
  }
49
50
  setActiveCollectionName(collectionName) {
50
51
  this.activeCollectionName = collectionName;
52
+ this.settingsCached = undefined;
53
+ this.kvAssetsIndex = undefined;
51
54
  }
52
55
  setCollectionNameHeader(collectionHeader) {
53
56
  this.collectionNameHeader = collectionHeader;
54
57
  }
55
58
  // Server config is obtained from the KV Store, and cached for the duration of this object.
56
59
  async getServerConfig() {
60
+ if (this.settingsCached !== undefined) {
61
+ return this.settingsCached;
62
+ }
57
63
  const settingsFileKey = `${this.publishId}_settings_${this.activeCollectionName}`;
58
64
  const kvStore = new KVStore(this.kvStoreName);
59
65
  const settingsFile = await getKVStoreEntry(kvStore, settingsFileKey);
60
66
  if (settingsFile == null) {
61
67
  console.error(`Settings File not found at ${settingsFileKey}.`);
62
68
  console.error(`You may need to publish your application.`);
63
- return null;
69
+ this.settingsCached = null;
70
+ }
71
+ else {
72
+ this.settingsCached = (await settingsFile.json());
64
73
  }
65
- return (await settingsFile.json());
74
+ return this.settingsCached;
66
75
  }
67
76
  async getStaticItems() {
68
77
  const serverConfig = await this.getServerConfig();
@@ -84,15 +93,37 @@ export class PublisherServer {
84
93
  .filter(x => Boolean(x));
85
94
  }
86
95
  async getKvAssetsIndex() {
96
+ if (this.kvAssetsIndex !== undefined) {
97
+ return this.kvAssetsIndex;
98
+ }
87
99
  const indexFileKey = `${this.publishId}_index_${this.activeCollectionName}`;
88
100
  const kvStore = new KVStore(this.kvStoreName);
89
101
  const indexFile = await getKVStoreEntry(kvStore, indexFileKey);
90
102
  if (indexFile == null) {
91
103
  console.error(`Index File not found at ${indexFileKey}.`);
92
104
  console.error(`You may need to publish your application.`);
105
+ this.kvAssetsIndex = null;
106
+ return null;
107
+ }
108
+ let collectionIsExpired = false;
109
+ if (this.activeCollectionName !== this.defaultCollectionName) {
110
+ const metadataText = indexFile.metadataText();
111
+ if (metadataText != null) {
112
+ try {
113
+ const metadata = JSON.parse(metadataText);
114
+ collectionIsExpired = metadata.expirationTime != null && isExpired(metadata.expirationTime);
115
+ }
116
+ catch {
117
+ }
118
+ }
119
+ }
120
+ if (collectionIsExpired) {
121
+ console.error(`Requested collection expired at ${indexFileKey}.`);
122
+ this.kvAssetsIndex = null;
93
123
  return null;
94
124
  }
95
- return (await indexFile.json());
125
+ this.kvAssetsIndex = (await indexFile.json());
126
+ return this.kvAssetsIndex;
96
127
  }
97
128
  async getMatchingAsset(assetKey, applyAuto = false) {
98
129
  const serverConfig = await this.getServerConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "7.0.0-beta.1",
4
+ "version": "7.0.0-beta.2",
5
5
  "description": "Static Publisher for Fastly Compute JavaScript",
6
6
  "main": "build/index.js",
7
7
  "exports": {
@@ -40,7 +40,8 @@
40
40
  "dependencies": {
41
41
  "@fastly/cli": "^11.2.0",
42
42
  "command-line-args": "^5.2.1",
43
- "glob-to-regexp": "^0.4.1"
43
+ "glob-to-regexp": "^0.4.1",
44
+ "toml": "^3.0.0"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "@fastly/js-compute": "^3.33.2"
@@ -1,2 +0,0 @@
1
- export declare function action(argv: string[]): Promise<void>;
2
- //# sourceMappingURL=clean.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/clean.ts"],"names":[],"mappings":"AAYA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,iBAoJ1C"}
@@ -1,121 +0,0 @@
1
- /*
2
- * Copyright Fastly, Inc.
3
- * Licensed under the MIT license. See LICENSE file for details.
4
- */
5
- import commandLineArgs from 'command-line-args';
6
- import { LoadConfigError, loadStaticPublisherRcFile } from '../util/config.js';
7
- import { getKvStoreEntry, getKVStoreKeys, kvStoreDeleteFile } from '../fastly-api/kv-store.js';
8
- import { loadApiToken } from '../fastly-api/api-token.js';
9
- export async function action(argv) {
10
- const optionDefinitions = [
11
- { name: 'verbose', type: Boolean },
12
- { name: 'fastly-api-token', type: String, },
13
- ];
14
- const commandLineValues = commandLineArgs(optionDefinitions, { argv });
15
- const { verbose, ['fastly-api-token']: fastlyApiToken, } = commandLineValues;
16
- const apiTokenResult = loadApiToken({ commandLine: fastlyApiToken });
17
- if (apiTokenResult == null) {
18
- console.error("❌ Fastly API Token not provided.");
19
- console.error("Set the FASTLY_API_TOKEN environment variable to an API token that has write access to the KV Store.");
20
- process.exitCode = 1;
21
- return;
22
- }
23
- const fastlyApiContext = { apiToken: apiTokenResult.apiToken };
24
- console.log(`✔️ Fastly API Token: ${fastlyApiContext.apiToken.slice(0, 4)}${'*'.repeat(fastlyApiContext.apiToken.length - 4)} from '${apiTokenResult.source}'`);
25
- // #### load config
26
- let staticPublisherRc;
27
- try {
28
- staticPublisherRc = await loadStaticPublisherRcFile();
29
- }
30
- catch (err) {
31
- console.error("❌ Can't load static-publish.rc.js");
32
- console.error("Run this from a compute-js-static-publish compute-js directory.");
33
- if (err instanceof LoadConfigError) {
34
- for (const error of err.errors) {
35
- console.error(error);
36
- }
37
- }
38
- process.exitCode = 1;
39
- return;
40
- }
41
- const publishId = staticPublisherRc.publishId;
42
- console.log(`✔️ Publish ID: ${publishId}`);
43
- const kvStoreName = staticPublisherRc.kvStoreName;
44
- console.log(`✔️ Using KV Store: ${kvStoreName}`);
45
- const defaultCollectionName = staticPublisherRc.defaultCollectionName;
46
- console.log(`✔️ Default Collection Name: ${defaultCollectionName}`);
47
- // ### KVStore Keys to delete
48
- const kvKeysToDelete = new Set();
49
- // ### List all indexes ###
50
- const indexesPrefix = publishId + '_index_';
51
- const indexKeys = await getKVStoreKeys(fastlyApiContext, kvStoreName, indexesPrefix);
52
- if (indexKeys == null) {
53
- throw new Error(`Can't query indexes in KV Store`);
54
- }
55
- // ### Found collections ###
56
- const foundCollections = indexKeys.map(x => x.slice(indexesPrefix.length));
57
- console.log('Found collections');
58
- for (const collection of foundCollections) {
59
- console.log(collection);
60
- }
61
- // TODO ### Determine which ones are not expired, based on an expiration meta
62
- const liveCollections = foundCollections;
63
- // ### List all settings ###
64
- const settingsPrefix = publishId + '_index_';
65
- const settingsKeys = await getKVStoreKeys(fastlyApiContext, kvStoreName, settingsPrefix);
66
- if (settingsKeys == null) {
67
- throw new Error(`Can't query settings in KV Store`);
68
- }
69
- // If a settings object is found that doesn't match a live collection name then
70
- // mark it for deletion
71
- const foundSettingsCollections = settingsKeys.map(key => ({ key, name: key.slice(settingsPrefix.length) }));
72
- for (const foundSettings of foundSettingsCollections) {
73
- if (!foundCollections.includes(foundSettings.name)) {
74
- kvKeysToDelete.add(foundSettings.key);
75
- }
76
- }
77
- // ### Go through the index files and make a list of all keys (hashes) that we are keeping
78
- const assetsIdsInUse = new Set();
79
- for (const collection of liveCollections) {
80
- // TODO deal with when the index file is > 20MB
81
- const kvAssetsIndexResponse = await getKvStoreEntry(fastlyApiContext, kvStoreName, indexesPrefix + collection);
82
- if (!kvAssetsIndexResponse) {
83
- throw new Error(`Can't load KV Store entry ${indexesPrefix + collection}`);
84
- }
85
- const kvAssetsIndex = (await kvAssetsIndexResponse.response.json());
86
- for (const [_assetKey, assetEntry] of Object.entries(kvAssetsIndex)) {
87
- if (assetEntry.key.startsWith('sha256:')) {
88
- assetsIdsInUse.add(`sha256_${assetEntry.key.slice('sha256:'.length)}`);
89
- }
90
- }
91
- }
92
- // ### Obtain the assets in the KV Store and find the ones that are not in use
93
- const assetPrefix = publishId + '_files_';
94
- const assetKeys = await getKVStoreKeys(fastlyApiContext, kvStoreName, assetPrefix);
95
- if (assetKeys == null) {
96
- throw new Error(`Can't query assets in KV Store`);
97
- }
98
- for (const assetKey of assetKeys) {
99
- let assetId = assetKey.slice(assetPrefix.length);
100
- if (assetId.startsWith('sha256_')) {
101
- assetId = assetId.slice(0, 'sha256_'.length + 64);
102
- }
103
- else {
104
- // If we don't know what the prefix is, we ignore it
105
- continue;
106
- }
107
- if (assetsIdsInUse.has(assetId)) {
108
- console.log('Asset ID ' + assetId + ' in use');
109
- }
110
- else {
111
- kvKeysToDelete.add(assetKey);
112
- console.log('Asset ID ' + assetId + ' not in use');
113
- }
114
- }
115
- // ### Delete items that have been flagged
116
- for (const key of kvKeysToDelete) {
117
- console.log("Deleting item: " + key);
118
- await kvStoreDeleteFile(fastlyApiContext, kvStoreName, key);
119
- }
120
- console.log("✅ Completed.");
121
- }
@@ -1,2 +0,0 @@
1
- export declare function action(argv: string[]): Promise<void>;
2
- //# sourceMappingURL=delete.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/collections/delete.ts"],"names":[],"mappings":"AAWA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,iBAmG1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/collections/index.ts"],"names":[],"mappings":"AASA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA2BhD"}
@@ -1,2 +0,0 @@
1
- export declare function action(argv: string[]): Promise<void>;
2
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/collections/list.ts"],"names":[],"mappings":"AAWA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,iBAoE1C"}
@@ -1,62 +0,0 @@
1
- /*
2
- * Copyright Fastly, Inc.
3
- * Licensed under the MIT license. See LICENSE file for details.
4
- */
5
- import commandLineArgs from 'command-line-args';
6
- import { LoadConfigError, loadStaticPublisherRcFile } from '../../util/config.js';
7
- import { getKVStoreKeys } from '../../fastly-api/kv-store.js';
8
- import { loadApiToken } from '../../fastly-api/api-token.js';
9
- export async function action(argv) {
10
- const optionDefinitions = [
11
- { name: 'verbose', type: Boolean },
12
- { name: 'fastly-api-token', type: String, },
13
- ];
14
- const commandLineValues = commandLineArgs(optionDefinitions, { argv });
15
- const { verbose, ['fastly-api-token']: fastlyApiToken, } = commandLineValues;
16
- const apiTokenResult = loadApiToken({ commandLine: fastlyApiToken });
17
- if (apiTokenResult == null) {
18
- console.error("❌ Fastly API Token not provided.");
19
- console.error("Set the FASTLY_API_TOKEN environment variable to an API token that has write access to the KV Store.");
20
- process.exitCode = 1;
21
- return;
22
- }
23
- const fastlyApiContext = { apiToken: apiTokenResult.apiToken };
24
- console.log(`✔️ Fastly API Token: ${fastlyApiContext.apiToken.slice(0, 4)}${'*'.repeat(fastlyApiContext.apiToken.length - 4)} from '${apiTokenResult.source}'`);
25
- // #### load config
26
- let staticPublisherRc;
27
- try {
28
- staticPublisherRc = await loadStaticPublisherRcFile();
29
- }
30
- catch (err) {
31
- console.error("❌ Can't load static-publish.rc.js");
32
- console.error("Run this from a compute-js-static-publish compute-js directory.");
33
- if (err instanceof LoadConfigError) {
34
- for (const error of err.errors) {
35
- console.error(error);
36
- }
37
- }
38
- process.exitCode = 1;
39
- return;
40
- }
41
- const publishId = staticPublisherRc.publishId;
42
- console.log(`✔️ Publish ID: ${publishId}`);
43
- const kvStoreName = staticPublisherRc.kvStoreName;
44
- console.log(`✔️ Using KV Store: ${kvStoreName}`);
45
- const defaultCollectionName = staticPublisherRc.defaultCollectionName;
46
- console.log(`✔️ Default Collection Name: ${defaultCollectionName}`);
47
- // ### List all indexes ###
48
- const indexesPrefix = publishId + '_index_';
49
- const indexKeys = await getKVStoreKeys(fastlyApiContext, kvStoreName, indexesPrefix);
50
- if (indexKeys == null) {
51
- throw new Error(`Can't query indexes in KV Store`);
52
- }
53
- // ### Found collections ###
54
- const foundCollections = indexKeys.map(key => ({ key, name: key.slice(indexesPrefix.length), }));
55
- if (foundCollections.length === 0) {
56
- console.log('No collections found.');
57
- }
58
- else {
59
- console.log(`Found collections: ${foundCollections.map(x => `'${x.name}'`).join(', ')}`);
60
- }
61
- console.log("✅ Completed.");
62
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAYA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAkChD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-app.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init-app.ts"],"names":[],"mappings":"AAkBA,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;CACjC,CAAC;AA0QF,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,iBA6d1C"}
@@ -1,2 +0,0 @@
1
- export declare function action(argv: string[]): Promise<void>;
2
- //# sourceMappingURL=publish-content.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/publish-content.ts"],"names":[],"mappings":"AAiCA,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,iBAuiB1C"}