@fastly/compute-js-static-publish 8.1.0-beta.2 → 8.1.0-beta.4

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 (90) hide show
  1. package/CHANGELOG.md +601 -0
  2. package/DOCUMENTATION.md +28 -19
  3. package/README.md +18 -5
  4. package/README.short.md +18 -5
  5. package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
  6. package/build/cli/cli/commands/manage/collections/list.js +8 -10
  7. package/build/cli/cli/commands/manage/deploy.d.ts.map +1 -1
  8. package/build/cli/cli/commands/manage/deploy.js +68 -12
  9. package/build/cli/cli/commands/manage/eject.d.ts.map +1 -1
  10. package/build/cli/cli/commands/manage/eject.js +22 -5
  11. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  12. package/build/cli/cli/commands/manage/publish-content.js +9 -4
  13. package/build/cli/cli/commands/manage/status.d.ts.map +1 -1
  14. package/build/cli/cli/commands/manage/status.js +6 -0
  15. package/build/cli/cli/commands/manage/template/init.js +6 -6
  16. package/build/cli/cli/commands/run-dev-watch.d.ts +1 -0
  17. package/build/cli/cli/commands/run-dev-watch.d.ts.map +1 -1
  18. package/build/cli/cli/commands/run-dev-watch.js +45 -9
  19. package/build/cli/cli/commands/scaffold/generate-app.d.ts +10 -3
  20. package/build/cli/cli/commands/scaffold/generate-app.d.ts.map +1 -1
  21. package/build/cli/cli/commands/scaffold/generate-app.js +17 -1
  22. package/build/cli/cli/commands/scaffold/index.d.ts +3 -3
  23. package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
  24. package/build/cli/cli/commands/scaffold/index.js +27 -24
  25. package/build/cli/cli/managed/app.d.ts +1 -1
  26. package/build/cli/cli/managed/app.d.ts.map +1 -1
  27. package/build/cli/cli/managed/app.js +5 -3
  28. package/build/cli/cli/managed/lockfile.js +1 -1
  29. package/build/cli/cli/managed/project-file.d.ts.map +1 -1
  30. package/build/cli/cli/managed/project-file.js +13 -4
  31. package/build/cli/cli/managed/template-init.d.ts.map +1 -1
  32. package/build/cli/cli/managed/template-init.js +3 -1
  33. package/build/cli/cli/util/collection-selection-flags.d.ts +1 -1
  34. package/build/cli/cli/util/collection-selection-flags.d.ts.map +1 -1
  35. package/build/cli/cli/util/collection-selection-flags.js +31 -5
  36. package/build/cli/cli/util/config.d.ts.map +1 -1
  37. package/build/cli/cli/util/config.js +9 -0
  38. package/build/cli/cli/util/fastly-options.d.ts +2 -0
  39. package/build/cli/cli/util/fastly-options.d.ts.map +1 -0
  40. package/build/cli/cli/util/fastly-options.js +52 -0
  41. package/build/cli/cli/util/global-options.js +1 -1
  42. package/build/cli/cli/util/package.d.ts +2 -1
  43. package/build/cli/cli/util/package.d.ts.map +1 -1
  44. package/build/cli/cli/util/package.js +47 -9
  45. package/build/cli/cli/util/s3.d.ts +10 -4
  46. package/build/cli/cli/util/s3.d.ts.map +1 -1
  47. package/build/cli/cli/util/s3.js +13 -35
  48. package/build/cli/models/config/collection-selection.d.ts +2 -0
  49. package/build/cli/models/config/collection-selection.d.ts.map +1 -1
  50. package/build/cli/models/config/collection-selection.js +48 -8
  51. package/build/cli/models/config/publish-content-config.d.ts +1 -0
  52. package/build/cli/models/config/publish-content-config.d.ts.map +1 -1
  53. package/build/cli/models/config/s3-storage-config.d.ts +1 -0
  54. package/build/cli/models/config/s3-storage-config.d.ts.map +1 -1
  55. package/build/cli/models/config/s3-storage-config.js +1 -0
  56. package/build/cli/models/config/static-publish-rc.d.ts +1 -0
  57. package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
  58. package/build/cli/models/config/static-publish-rc.js +3 -1
  59. package/build/cli/models/server/index.d.ts +2 -0
  60. package/build/cli/models/server/index.d.ts.map +1 -1
  61. package/build/cli/models/server/index.js +13 -1
  62. package/build/server/hono/extensions.d.ts.map +1 -1
  63. package/build/server/hono/extensions.js +12 -7
  64. package/build/server/models/config/collection-selection.d.ts +2 -0
  65. package/build/server/models/config/collection-selection.d.ts.map +1 -1
  66. package/build/server/models/config/collection-selection.js +48 -8
  67. package/build/server/models/config/publish-content-config.d.ts +1 -0
  68. package/build/server/models/config/publish-content-config.d.ts.map +1 -1
  69. package/build/server/models/config/s3-storage-config.d.ts +1 -0
  70. package/build/server/models/config/s3-storage-config.d.ts.map +1 -1
  71. package/build/server/models/config/s3-storage-config.js +1 -0
  72. package/build/server/models/config/static-publish-rc.d.ts +1 -0
  73. package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
  74. package/build/server/models/config/static-publish-rc.js +3 -1
  75. package/build/server/models/server/index.d.ts +2 -0
  76. package/build/server/models/server/index.d.ts.map +1 -1
  77. package/build/server/models/server/index.js +13 -1
  78. package/build/server/server/collection-selection/index.d.ts.map +1 -1
  79. package/build/server/server/collection-selection/index.js +16 -6
  80. package/build/server/server/storage/s3-storage-provider.d.ts +2 -1
  81. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  82. package/build/server/server/storage/s3-storage-provider.js +15 -7
  83. package/package.json +2 -1
  84. package/resources/app/fastly.toml.njk +8 -8
  85. package/resources/app/publish-content.config.js.njk +1 -0
  86. package/resources/app/static-publish.project.js.njk +6 -0
  87. package/resources/app/static-publish.rc.js.njk +6 -0
  88. package/resources/template-init/hono/gitignore +1 -0
  89. package/resources/templates/hono/src/index.ts +0 -1
  90. package/resources/templates/plain/src/index.js +12 -2
@@ -1 +1 @@
1
- {"version":3,"file":"collection-selection.d.ts","sourceRoot":"","sources":["../../../../src/models/config/collection-selection.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEF,MAA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S,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAQ7G;AAGD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAsIrE;AAOD,wBAAgB,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CA6C9G;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG;IAAE,IAAI,EAAE,6BAA6B,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAqBxI"}
@@ -67,6 +67,20 @@ export function validateCollectionSelection(config) {
67
67
  return ['collectionSelection must be an object.'];
68
68
  }
69
69
  const { sources, allow, onMissing, noindex } = config;
70
+ const allowIsValid = allow === undefined ||
71
+ (Array.isArray(allow) && allow.every(x => typeof x === 'string' && ALLOW_PATTERN.test(x)));
72
+ // The value of a host or path source: a collection name that allow (if set) matches.
73
+ const checkValue = (name, value, patternField, pattern) => {
74
+ if (typeof value !== 'string' || !isValidCollectionName(value)) {
75
+ errors.push(`${name}.value must be a valid collection name. ${COLLECTION_NAME_RULE}`);
76
+ }
77
+ else if (allowIsValid && !isCollectionNameAllowed(value, allow)) {
78
+ errors.push(`${name}.value '${value}' is not in collectionSelection.allow.`);
79
+ }
80
+ if (typeof pattern === 'string' && pattern.includes(COLLECTION_PLACEHOLDER)) {
81
+ errors.push(`${name}: use ${COLLECTION_PLACEHOLDER} in ${patternField}, or value, not both.`);
82
+ }
83
+ };
70
84
  if (!Array.isArray(sources)) {
71
85
  errors.push('collectionSelection.sources must be an array.');
72
86
  }
@@ -86,9 +100,17 @@ export function validateCollectionSelection(config) {
86
100
  }
87
101
  switch (s.type) {
88
102
  case 'host': {
103
+ if (s.value !== undefined) {
104
+ checkValue(name, s.value, 'pattern', s.pattern);
105
+ if (typeof s.pattern !== 'string' ||
106
+ (!s.pattern.includes(COLLECTION_PLACEHOLDER) && !/^[a-z0-9-]+(\.[a-z0-9-]+)*$/i.test(s.pattern))) {
107
+ errors.push(`${name}.pattern must be a hostname: use only a-z, 0-9, '-', and '.'.`);
108
+ }
109
+ break;
110
+ }
89
111
  const parts = typeof s.pattern === 'string' ? splitPattern(s.pattern) : null;
90
112
  if (parts == null) {
91
- errors.push(`${name}.pattern must be a string with exactly one ${COLLECTION_PLACEHOLDER}.`);
113
+ errors.push(`${name}.pattern must be a string with exactly one ${COLLECTION_PLACEHOLDER}, or a hostname with value.`);
92
114
  }
93
115
  else if (!/^[a-z0-9.-]*$/i.test(parts.before + parts.after)) {
94
116
  errors.push(`${name}.pattern must be a hostname: use only a-z, 0-9, '-', and '.' around ${COLLECTION_PLACEHOLDER}.`);
@@ -99,14 +121,19 @@ export function validateCollectionSelection(config) {
99
121
  break;
100
122
  }
101
123
  case 'path': {
102
- const parts = typeof s.prefix === 'string' ? splitPattern(s.prefix) : null;
124
+ if (s.value !== undefined) {
125
+ checkValue(name, s.value, 'prefix', s.prefix);
126
+ }
127
+ const parts = typeof s.prefix !== 'string' ? null :
128
+ s.value !== undefined ? { before: s.prefix, after: '' } :
129
+ splitPattern(s.prefix);
103
130
  if (parts == null) {
104
- errors.push(`${name}.prefix must be a string with exactly one ${COLLECTION_PLACEHOLDER}.`);
131
+ errors.push(`${name}.prefix must be a string with exactly one ${COLLECTION_PLACEHOLDER}, or a prefix with value.`);
105
132
  }
106
133
  else if (!parts.before.startsWith('/')) {
107
134
  errors.push(`${name}.prefix must start with '/'.`);
108
135
  }
109
- else if (parts.after.endsWith('/')) {
136
+ else if ((s.value !== undefined ? parts.before : parts.after).endsWith('/')) {
110
137
  errors.push(`${name}.prefix must not end with '/'.`);
111
138
  }
112
139
  else if (/[?#]/.test(parts.before + parts.after)) {
@@ -139,6 +166,9 @@ export function validateCollectionSelection(config) {
139
166
  }
140
167
  break;
141
168
  }
169
+ if (s.value !== undefined && s.type !== 'host' && s.type !== 'path') {
170
+ errors.push(`${name}.value is only for the 'host' and 'path' sources.`);
171
+ }
142
172
  if (s.sticky !== undefined) {
143
173
  if (s.type !== 'path' && s.type !== 'query') {
144
174
  errors.push(`${name}.sticky is only for the 'path' and 'query' sources.`);
@@ -158,10 +188,8 @@ export function validateCollectionSelection(config) {
158
188
  errors.push(`sticky: 'cookie' needs a 'cookie' source in collectionSelection.sources, for the settings of the cookie.`);
159
189
  }
160
190
  }
161
- if (allow !== undefined) {
162
- if (!Array.isArray(allow) || !allow.every(x => typeof x === 'string' && ALLOW_PATTERN.test(x))) {
163
- errors.push(`collectionSelection.allow must be an array of patterns. Use a-z, 0-9, '-', and '*'.`);
164
- }
191
+ if (!allowIsValid) {
192
+ errors.push(`collectionSelection.allow must be an array of patterns. Use a-z, 0-9, '-', and '*'.`);
165
193
  }
166
194
  if (onMissing !== undefined && onMissing !== 'not-found' && onMissing !== 'default') {
167
195
  errors.push(`collectionSelection.onMissing must be 'not-found' or 'default'.`);
@@ -187,6 +215,12 @@ export function previewUrl(collectionName, baseUrl, config) {
187
215
  for (const source of config.sources) {
188
216
  switch (source.type) {
189
217
  case 'host': {
218
+ if (source.value != null) {
219
+ if (source.value === collectionName) {
220
+ return `${base.protocol}//${source.pattern.toLowerCase()}/`;
221
+ }
222
+ continue;
223
+ }
190
224
  const maxLength = maxCollectionNameLengthForHost(source.pattern);
191
225
  if (collectionName.length > maxLength) {
192
226
  throw new Error(`'${collectionName}' is too long for the host pattern '${source.pattern}': a host label has at most ${MAX_LABEL_LENGTH} characters, so the name can have at most ${maxLength}.`);
@@ -194,6 +228,12 @@ export function previewUrl(collectionName, baseUrl, config) {
194
228
  return `${base.protocol}//${source.pattern.replace(COLLECTION_PLACEHOLDER, collectionName).toLowerCase()}/`;
195
229
  }
196
230
  case 'path':
231
+ if (source.value != null) {
232
+ if (source.value === collectionName) {
233
+ return `${base.origin}${source.prefix}/`;
234
+ }
235
+ continue;
236
+ }
197
237
  return `${base.origin}${source.prefix.replace(COLLECTION_PLACEHOLDER, collectionName)}/`;
198
238
  case 'query': {
199
239
  const url = new URL('/', base);
@@ -39,6 +39,7 @@ export type PublishContentConfigNormalized = {
39
39
  includeWellKnown: boolean;
40
40
  assetInclusionTest: AssetInclusionTest | null;
41
41
  hiddenItems: string[];
42
+ hiddenItemsAsWritten: string[];
42
43
  contentCompression: ContentCompressionTypes[];
43
44
  brotliQuality: number | undefined;
44
45
  contentTypes: ContentTypeDef[];
@@ -1 +1 @@
1
- {"version":3,"file":"publish-content-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/publish-content-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAGxD,MAAM,MAAM,cAAc,GAAG;IAE3B,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IAG/B,WAAW,EAAE,MAAM,CAAC;IAIpB,IAAI,CAAC,EAAE,OAAO,CAAC;IAIf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AAID,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,wBAAwB,CAAC;AAEtG,MAAM,MAAM,oBAAo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,CAAC;IAIvC,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAGhC,MAAM,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9C,WAAW,EAAE,MAAM,EAAE,CAAC;IAGtB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,kBAAkB,EAAE,uBAAuB,EAAE,CAAC;IAC9C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,MAAM,EAAE,+BAA+B,GAAG,IAAI,CAAC;CAChD,CAAC"}
@@ -4,6 +4,7 @@ export type S3StorageConfig = {
4
4
  bucket: string;
5
5
  endpoint?: string;
6
6
  fastlyBackendName?: string;
7
+ secretStoreLinkName?: string;
7
8
  };
8
9
  export declare function getS3StorageConfigFromRc(rc: StaticPublishS3Storage): S3StorageConfig;
9
10
  //# sourceMappingURL=s3-storage-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"s3-storage-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/s3-storage-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,sBAAsB,GAAG,eAAe,CAOpF"}
1
+ {"version":3,"file":"s3-storage-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/s3-storage-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,sBAAsB,GAAG,eAAe,CAQpF"}
@@ -8,5 +8,6 @@ export function getS3StorageConfigFromRc(rc) {
8
8
  bucket: rc.s3.bucket,
9
9
  endpoint: rc.s3.endpoint,
10
10
  fastlyBackendName: rc.s3.fastlyBackendName,
11
+ secretStoreLinkName: rc.s3.secretStoreLinkName,
11
12
  };
12
13
  }
@@ -47,6 +47,7 @@ export type StaticPublishPartialS3Storage = {
47
47
  bucket: string;
48
48
  endpoint?: string;
49
49
  fastlyBackendName?: string;
50
+ secretStoreLinkName?: string;
50
51
  };
51
52
  };
52
53
  export type StaticPublishS3Storage = StaticPublishPartialS3Storage & StaticPublishRcBase;
@@ -1 +1 @@
1
- {"version":3,"file":"static-publish-rc.d.ts","sourceRoot":"","sources":["../../../../src/models/config/static-publish-rc.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG;IAGhC,SAAS,EAAE,MAAM,CAAC;IAGlB,qBAAqB,EAAE,MAAM,CAAC;IAK9B,yBAAyB,EAAE,MAAM,CAAC;IAGlC,aAAa,CAAC,EAAE,aAAa,CAAC;IAK9B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAG1C,KAAK,CAAC,EAAE,kBAAkB,CAA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,GACnC,2BAA2B,GAC3B,6BAA6B,CAChC;AAED,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,sBAAsB,CACzB;AAQD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAuB5E"}
@@ -32,7 +32,9 @@ export function isS3StorageConfigRc(rc) {
32
32
  rc.s3.endpoint === undefined ||
33
33
  typeof rc.s3.endpoint === 'string') && (!('fastlyBackendName' in rc.s3) ||
34
34
  rc.s3.fastlyBackendName === undefined ||
35
- typeof rc.s3.fastlyBackendName === 'string')) {
35
+ typeof rc.s3.fastlyBackendName === 'string') && (!('secretStoreLinkName' in rc.s3) ||
36
+ rc.s3.secretStoreLinkName === undefined ||
37
+ (typeof rc.s3.secretStoreLinkName === 'string' && rc.s3.secretStoreLinkName !== ''))) {
36
38
  return true;
37
39
  }
38
40
  }
@@ -2,6 +2,8 @@ export type IndexMetadata = {
2
2
  publishedTime?: number;
3
3
  expirationTime?: number;
4
4
  requires?: string[];
5
+ fileCount?: number;
6
+ hiddenFileCount?: number;
5
7
  otherFields?: Record<string, string>;
6
8
  };
7
9
  export declare const SUPPORTED_INDEX_FEATURES: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/server/index.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAGrD,CAAC;AAIF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqBxF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CA2BjG;AAGD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,GAAE,SAAS,MAAM,EAA6B,GAC9D,MAAM,EAAE,CAEV"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/server/index.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAGrD,CAAC;AAIF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4BxF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAkCjG;AAGD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,GAAE,SAAS,MAAM,EAA6B,GAC9D,MAAM,EAAE,CAEV"}
@@ -12,7 +12,7 @@ export const SUPPORTED_INDEX_FEATURES = [
12
12
  // Hidden files: index keys that start with 'hidden:'.
13
13
  HIDDEN_INDEX_FEATURE,
14
14
  ];
15
- const KNOWN_FIELDS = ['publishedTime', 'expirationTime', 'requires'];
15
+ const KNOWN_FIELDS = ['publishedTime', 'expirationTime', 'requires', 'fileCount', 'hiddenFileCount'];
16
16
  export function encodeIndexMetadata(indexMetadata) {
17
17
  const result = { ...indexMetadata.otherFields };
18
18
  if (indexMetadata.publishedTime != null && !isNaN(indexMetadata.publishedTime)) {
@@ -29,6 +29,12 @@ export function encodeIndexMetadata(indexMetadata) {
29
29
  }
30
30
  result['requires'] = indexMetadata.requires.join(',');
31
31
  }
32
+ for (const field of ['fileCount', 'hiddenFileCount']) {
33
+ const value = indexMetadata[field];
34
+ if (value != null && Number.isInteger(value) && value >= 0) {
35
+ result[field] = String(value);
36
+ }
37
+ }
32
38
  return result;
33
39
  }
34
40
  export function decodeIndexMetadata(obj) {
@@ -50,10 +56,16 @@ export function decodeIndexMetadata(obj) {
50
56
  otherFields[key] = String(value);
51
57
  }
52
58
  }
59
+ const count = (field) => {
60
+ const value = getMetadataFieldValue(obj, field);
61
+ return value != null && /^\d+$/.test(String(value)) ? Number(value) : undefined;
62
+ };
53
63
  return {
54
64
  publishedTime: !isNaN(publishedTime) ? publishedTime : undefined,
55
65
  expirationTime: !isNaN(expirationTime) ? expirationTime : undefined,
56
66
  requires: requires.length > 0 ? requires : undefined,
67
+ fileCount: count('fileCount'),
68
+ hiddenFileCount: count('hiddenFileCount'),
57
69
  otherFields,
58
70
  };
59
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/collection-selection/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,6BAA6B,EAKnC,MAAM,6CAA6C,CAAC;AAGrD,MAAM,MAAM,uBAAuB,GAAG;IAEpC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,SAAS,CAAC,EAAE,6BAA6B,CAAC;CAC3C,CAAC;AA6FF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAmCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAGhG;AAKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,uBAAuB,CAoE3H"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/collection-selection/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,6BAA6B,EAKnC,MAAM,6CAA6C,CAAC;AAGrD,MAAM,MAAM,uBAAuB,GAAG;IAEpC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,SAAS,CAAC,EAAE,6BAA6B,CAAC;CAC3C,CAAC;AAuGF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAmCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAGhG;AAKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,uBAAuB,CAoE3H"}
@@ -33,6 +33,11 @@ function compile(config) {
33
33
  const matchers = config.sources.map((source) => {
34
34
  switch (source.type) {
35
35
  case 'host': {
36
+ if (source.value != null) {
37
+ const hostname = source.pattern.toLowerCase();
38
+ const value = source.value;
39
+ return (url) => url.hostname.toLowerCase() === hostname && allowed(value) ? { collectionName: value } : null;
40
+ }
36
41
  const parts = splitPattern(source.pattern);
37
42
  const re = new RegExp(`^${escapeRegExp(parts.before.toLowerCase())}${NAME_GROUP}${escapeRegExp(parts.after.toLowerCase())}$`);
38
43
  return (url) => {
@@ -41,11 +46,16 @@ function compile(config) {
41
46
  };
42
47
  }
43
48
  case 'path': {
44
- const parts = splitPattern(source.prefix);
45
- const re = new RegExp(`^${escapeRegExp(parts.before)}${NAME_GROUP}${escapeRegExp(parts.after)}(/.*)?$`);
49
+ // With value, the whole prefix is fixed text.
50
+ const value = source.value;
51
+ const parts = value != null ? null : splitPattern(source.prefix);
52
+ const re = parts != null ?
53
+ new RegExp(`^${escapeRegExp(parts.before)}${NAME_GROUP}${escapeRegExp(parts.after)}(/.*)?$`) :
54
+ new RegExp(`^${escapeRegExp(source.prefix)}()(/.*)?$`);
46
55
  return (url) => {
47
56
  const match = re.exec(url.pathname);
48
- if (match == null || !allowed(match[1])) {
57
+ const name = value ?? match?.[1];
58
+ if (match == null || !allowed(name)) {
49
59
  return null;
50
60
  }
51
61
  let pathname;
@@ -55,7 +65,7 @@ function compile(config) {
55
65
  catch {
56
66
  return null;
57
67
  }
58
- return { collectionName: match[1], pathname };
68
+ return { collectionName: name, pathname };
59
69
  };
60
70
  }
61
71
  case 'query':
@@ -174,8 +184,8 @@ export function resolveCollection(request, config) {
174
184
  let location;
175
185
  if (source.type === 'path') {
176
186
  // The path without the prefix, not decoded.
177
- const parts = splitPattern(source.prefix);
178
- const prefix = parts.before + match.collectionName + parts.after;
187
+ const parts = source.value != null ? null : splitPattern(source.prefix);
188
+ const prefix = parts != null ? parts.before + match.collectionName + parts.after : source.prefix;
179
189
  location = (url.pathname.slice(prefix.length) || '/') + url.search;
180
190
  }
181
191
  else {
@@ -8,7 +8,8 @@ export declare const buildStoreProvider: StorageProviderBuilder;
8
8
  /**
9
9
  * Sets the resource link name of the Secret Store that has the S3 credentials.
10
10
  * This is the name of the link between the service and the Secret Store, not
11
- * the name of the Secret Store. The default is 'S3_CREDENTIALS'.
11
+ * the name of the Secret Store. It is used in place of s3.secretStoreLinkName of
12
+ * static-publish.rc.js. The default is 'S3_CREDENTIALS'.
12
13
  */
13
14
  export declare function setSecretStoreForS3Credentials(resourceLinkName: string): void;
14
15
  export declare function setSecretStoreKeyForS3AccessKeyId(secretStoreKey: string): void;
@@ -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C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAS;IAI9C,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAO1B;IAKK,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmD1E;IAEK,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAiCzE;CACF"}
@@ -14,21 +14,28 @@ export const buildStoreProvider = (config) => {
14
14
  return null;
15
15
  }
16
16
  const s3StorageConfig = getS3StorageConfigFromRc(config);
17
+ _secretStoreLinkNameFromRc = s3StorageConfig.secretStoreLinkName;
17
18
  return new S3StorageProvider(s3StorageConfig.region, s3StorageConfig.bucket, {
18
19
  s3Endpoint: s3StorageConfig.endpoint,
19
20
  s3FastlyBackendName: s3StorageConfig.fastlyBackendName,
20
21
  });
21
22
  };
22
- let _secretStoreLinkNameForS3Credentials = 'S3_CREDENTIALS';
23
+ // The resource link name of the Secret Store with the S3 credentials:
24
+ // setSecretStoreForS3Credentials(), else s3.secretStoreLinkName of
25
+ // static-publish.rc.js, else 'S3_CREDENTIALS'.
26
+ let _secretStoreLinkNameFromCode = undefined;
27
+ let _secretStoreLinkNameFromRc = undefined;
28
+ const secretStoreLinkNameForS3Credentials = () => _secretStoreLinkNameFromCode ?? _secretStoreLinkNameFromRc ?? 'S3_CREDENTIALS';
23
29
  let _secretStoreKeyForS3AccessKeyId = 'S3_ACCESS_KEY_ID';
24
30
  let _secretStoreKeyForS3SecretAccessKey = 'S3_SECRET_ACCESS_KEY';
25
31
  /**
26
32
  * Sets the resource link name of the Secret Store that has the S3 credentials.
27
33
  * This is the name of the link between the service and the Secret Store, not
28
- * the name of the Secret Store. The default is 'S3_CREDENTIALS'.
34
+ * the name of the Secret Store. It is used in place of s3.secretStoreLinkName of
35
+ * static-publish.rc.js. The default is 'S3_CREDENTIALS'.
29
36
  */
30
37
  export function setSecretStoreForS3Credentials(resourceLinkName) {
31
- _secretStoreLinkNameForS3Credentials = resourceLinkName;
38
+ _secretStoreLinkNameFromCode = resourceLinkName;
32
39
  }
33
40
  export function setSecretStoreKeyForS3AccessKeyId(secretStoreKey) {
34
41
  _secretStoreKeyForS3AccessKeyId = secretStoreKey;
@@ -41,21 +48,22 @@ export async function buildS3CredentialsFromSecretStore() {
41
48
  if (_s3CredentialsFromSecretStore != null) {
42
49
  return _s3CredentialsFromSecretStore;
43
50
  }
51
+ const linkName = secretStoreLinkNameForS3Credentials();
44
52
  let secretStore;
45
53
  try {
46
- secretStore = new SecretStore(_secretStoreLinkNameForS3Credentials);
54
+ secretStore = new SecretStore(linkName);
47
55
  }
48
56
  catch {
49
- throw new Error(`Could not open the secret store for S3 credentials with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
57
+ throw new Error(`Could not open the secret store for S3 credentials with the resource link name '${linkName}'`);
50
58
  }
51
59
  const accessKeyIdEntry = await secretStore.get(_secretStoreKeyForS3AccessKeyId);
52
60
  if (accessKeyIdEntry == null) {
53
- throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in the secret store with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
61
+ throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in the secret store with the resource link name '${linkName}'`);
54
62
  }
55
63
  const accessKeyId = accessKeyIdEntry.plaintext();
56
64
  const secretAccessKeyEntry = await secretStore.get(_secretStoreKeyForS3SecretAccessKey);
57
65
  if (secretAccessKeyEntry == null) {
58
- throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in the secret store with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
66
+ throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in the secret store with the resource link name '${linkName}'`);
59
67
  }
60
68
  const secretAccessKey = secretAccessKeyEntry.plaintext();
61
69
  _s3CredentialsFromSecretStore = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "8.1.0-beta.2",
4
+ "version": "8.1.0-beta.4",
5
5
  "description": "Static Publisher for Fastly Compute JavaScript",
6
6
  "main": "build/server/server/index.js",
7
7
  "exports": {
@@ -87,6 +87,7 @@
87
87
  "package.json",
88
88
  "README.md",
89
89
  "DOCUMENTATION.md",
90
+ "CHANGELOG.md",
90
91
  "SECURITY.md"
91
92
  ]
92
93
  }
@@ -27,32 +27,32 @@ build = "npm run build"
27
27
  [local_server]
28
28
 
29
29
  [local_server.secret_stores]
30
- [[local_server.secret_stores.S3_CREDENTIALS]]
30
+ [[local_server.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}]]
31
31
  key = "S3_ACCESS_KEY_ID"
32
32
  env = "S3_ACCESS_KEY_ID"
33
- [[local_server.secret_stores.S3_CREDENTIALS]]
33
+ [[local_server.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}]]
34
34
  key = "S3_SECRET_ACCESS_KEY"
35
35
  env = "S3_SECRET_ACCESS_KEY"
36
36
 
37
37
  [local_server.backends]
38
- [local_server.backends.s3_storage]
38
+ [local_server.backends.{{ s3BackendName | tomlKey }}]
39
39
  url = {{ s3EndpointUrl | toml }}
40
40
  override_host = {{ s3EndpointHostname | toml }}
41
41
 
42
42
  [setup]
43
43
 
44
44
  [setup.backends]
45
- [setup.backends.s3_storage]
45
+ [setup.backends.{{ s3BackendName | tomlKey }}]
46
46
  address = {{ s3EndpointHostname | toml }}
47
47
  description = "S3 API endpoint"
48
48
  port = 443
49
49
  [setup.secret_stores]
50
- [setup.secret_stores.S3_CREDENTIALS]
50
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}]
51
51
  description = "Credentials for S3 storage"
52
- [setup.secret_stores.S3_CREDENTIALS.entries]
53
- [setup.secret_stores.S3_CREDENTIALS.entries.S3_ACCESS_KEY_ID]
52
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}.entries]
53
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}.entries.S3_ACCESS_KEY_ID]
54
54
  description = "Access Key ID"
55
- [setup.secret_stores.S3_CREDENTIALS.entries.S3_SECRET_ACCESS_KEY]
55
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}.entries.S3_SECRET_ACCESS_KEY]
56
56
  description = "Secret Access Key"
57
57
  {% endif %}
58
58
 
@@ -12,6 +12,7 @@ const config = {
12
12
  // excludeDotFiles: true,
13
13
  // includeWellKnown: true,
14
14
  // assetInclusionTest: (assetKey) => true,
15
+ // hiddenItems: [],
15
16
  // contentCompression: [ 'br', 'gzip' ],
16
17
  // brotliQuality: 11,
17
18
  // contentTypes: [
@@ -21,6 +21,12 @@ const project = {
21
21
  bucket: {{ storage.bucket | js }},
22
22
  {% if not storage.endpointGenerated %}
23
23
  endpoint: {{ s3EndpointUrl | js }},
24
+ {% endif %}
25
+ {% if storage.fastlyBackendName %}
26
+ fastlyBackendName: {{ storage.fastlyBackendName | js }},
27
+ {% endif %}
28
+ {% if storage.secretStoreLinkName %}
29
+ secretStoreLinkName: {{ storage.secretStoreLinkName | js }},
24
30
  {% endif %}
25
31
  },
26
32
  {% endif %}
@@ -16,6 +16,12 @@ const rc = {
16
16
  bucket: {{ storage.bucket | js }},
17
17
  {% if not storage.endpointGenerated %}
18
18
  endpoint: {{ s3EndpointUrl | js }},
19
+ {% endif %}
20
+ {% if storage.fastlyBackendName %}
21
+ fastlyBackendName: {{ storage.fastlyBackendName | js }},
22
+ {% endif %}
23
+ {% if storage.secretStoreLinkName %}
24
+ secretStoreLinkName: {{ storage.secretStoreLinkName | js }},
19
25
  {% endif %}
20
26
  },
21
27
  {% endif %}
@@ -0,0 +1 @@
1
+ /node_modules
@@ -1,4 +1,3 @@
1
- /// <reference types="@fastly/js-compute" />
2
1
  import { Hono } from 'hono';
3
2
  import { type BindingsDefs, buildFire, logFastlyServiceVersion } from '@fastly/hono-fastly-compute';
4
3
  import {
@@ -19,16 +19,26 @@ async function handleRequest(event) {
19
19
  return selection.response;
20
20
  }
21
21
 
22
+ // Code that must run before the published files goes here.
23
+
24
+ // Serve the published file for the request. With fallback: false, a path
25
+ // that has no file does not get the SPA file or the 404 page here.
22
26
  const response = await publisherServer.serveRequest(request, {
23
27
  collectionName: selection.collectionName,
24
28
  pathname: selection.pathname,
29
+ fallback: false,
25
30
  });
26
31
  if (response != null) {
27
32
  return response;
28
33
  }
29
34
 
30
35
  // Do custom things here!
31
- // Handle API requests, serve non-static responses, etc.
36
+ // Handle API requests, serve non-static responses, etc. This code runs only
37
+ // for the requests that no published file matches.
32
38
 
33
- return new Response('Not found', { status: 404 });
39
+ // When nothing else matches, serve the SPA file or the 404 page.
40
+ const fallback = await publisherServer.serveFallback(request, {
41
+ collectionName: selection.collectionName,
42
+ });
43
+ return fallback ?? new Response('Not found', { status: 404 });
34
44
  }