@fastly/compute-js-static-publish 8.0.0-beta.21 → 8.0.0-beta.23
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.
|
@@ -27,7 +27,7 @@ export declare class PublisherServer {
|
|
|
27
27
|
responseCache: ResponseCacheOptions | null;
|
|
28
28
|
settingsCached: PublisherServerConfigNormalized | null | undefined;
|
|
29
29
|
assetEntryMapCache: AssetEntryMap | null | undefined;
|
|
30
|
-
setActiveCollectionName(collectionName: string): void;
|
|
30
|
+
setActiveCollectionName(collectionName: string | null): void;
|
|
31
31
|
setCollectionNameHeader(collectionHeader: string | null): void;
|
|
32
32
|
setServerTimingRequestHeader(requestHeader: string | null): void;
|
|
33
33
|
setResponseCache(options: ResponseCacheOptions | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/publisher-server/index.ts"],"names":[],"mappings":"AAUA,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,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAE1B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EAErB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAEL,KAAK,oBAAoB,EAO1B,MAAM,qBAAqB,CAAC;AAE7B,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,oBAAoB,CAAC;AAEzB,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAA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BAAoB,GAAG,IAAI;IASrD,YAAY,CAAC,OAAO,EAAE,OAAO;IAO7B,OAAO,CAAC,KAAK;IAMP,eAAe;IAiBf,cAAc;IAoBd,gBAAgB;IA2ChB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IA2D1F,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC;IASjF,iBAAiB,CAAC,QAAQ,EAAE,MAAM;IAcxC,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI;IAMnG,OAAO,CAAC,kCAAkC;IA6D7B,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YA8BzG,wCAAwC;IAyChD,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;IA4DpF,WAAW,CACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GACtD,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAiFb,eAAe;IAoB7B,OAAO,CAAC,iBAAiB;IAwBnB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAsBhD,uBAAuB;CAwDtC"}
|
|
@@ -53,8 +53,11 @@ export class PublisherServer {
|
|
|
53
53
|
const storeProvider = loadStorageProviderFromStaticPublishRc(config);
|
|
54
54
|
return new PublisherServer(config.publishId, storeProvider, config.defaultCollectionName);
|
|
55
55
|
}
|
|
56
|
+
// null selects the default collection. A sandbox can be reused for more than
|
|
57
|
+
// one request, so call this for each request, also when no collection is
|
|
58
|
+
// selected. Otherwise, the collection of the previous request stays active.
|
|
56
59
|
setActiveCollectionName(collectionName) {
|
|
57
|
-
this.activeCollectionName = collectionName;
|
|
60
|
+
this.activeCollectionName = collectionName ?? this.defaultCollectionName;
|
|
58
61
|
this.settingsCached = undefined;
|
|
59
62
|
this.assetEntryMapCache = undefined;
|
|
60
63
|
}
|
|
@@ -76,14 +79,20 @@ export class PublisherServer {
|
|
|
76
79
|
}
|
|
77
80
|
// Start handling a new request. serveRequest() calls this. If you call
|
|
78
81
|
// getMatchingAsset() and serveAsset() directly, call this first.
|
|
82
|
+
// A sandbox can be reused for more than one request, so this also clears the
|
|
83
|
+
// settings and the index that a previous request read. Without this, a reused
|
|
84
|
+
// sandbox serves an old index after a publish, and serves an expired collection.
|
|
79
85
|
beginRequest(request) {
|
|
86
|
+
this.settingsCached = undefined;
|
|
87
|
+
this.assetEntryMapCache = undefined;
|
|
80
88
|
const header = this.serverTimingRequestHeader;
|
|
81
89
|
this.serverTiming = header != null && request.headers.has(header) ? new ServerTiming() : null;
|
|
82
90
|
}
|
|
83
91
|
timed(name, fn) {
|
|
84
92
|
return this.serverTiming != null ? this.serverTiming.measure(name, fn) : fn();
|
|
85
93
|
}
|
|
86
|
-
// Server config is obtained from storage, and cached
|
|
94
|
+
// Server config is obtained from storage, and cached until the next beginRequest()
|
|
95
|
+
// or setActiveCollectionName().
|
|
87
96
|
async getServerConfig() {
|
|
88
97
|
if (this.settingsCached !== undefined) {
|
|
89
98
|
return this.settingsCached;
|
package/package.json
CHANGED