@decocms/tanstack 8.5.1 → 8.6.0

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 (76) hide show
  1. package/README.md +35 -8
  2. package/dist/assignments.d.ts +31 -0
  3. package/dist/assignments.d.ts.map +1 -0
  4. package/dist/assignments.js +61 -0
  5. package/dist/assignments.js.map +1 -0
  6. package/dist/draft.d.ts +9 -6
  7. package/dist/draft.d.ts.map +1 -1
  8. package/dist/draft.js +10 -7
  9. package/dist/draft.js.map +1 -1
  10. package/dist/index.d.ts +3 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/scope/server.d.ts +1 -1
  15. package/dist/scope/server.d.ts.map +1 -1
  16. package/dist/server/index.d.ts +35 -8
  17. package/dist/server/index.d.ts.map +1 -1
  18. package/dist/server/index.js +41 -9
  19. package/dist/server/index.js.map +1 -1
  20. package/dist/shared.d.ts +5 -5
  21. package/dist/shared.js +5 -5
  22. package/dist/start/index.d.ts +3 -3
  23. package/dist/start/index.js +3 -3
  24. package/dist/visitor.d.ts +14 -0
  25. package/dist/visitor.d.ts.map +1 -0
  26. package/dist/visitor.js +14 -0
  27. package/dist/visitor.js.map +1 -0
  28. package/dist/worker/assignments.d.ts +44 -0
  29. package/dist/worker/assignments.d.ts.map +1 -0
  30. package/dist/worker/assignments.js +114 -0
  31. package/dist/worker/assignments.js.map +1 -0
  32. package/dist/worker/cache.d.ts +33 -0
  33. package/dist/worker/cache.d.ts.map +1 -0
  34. package/dist/worker/cache.js +41 -0
  35. package/dist/worker/cache.js.map +1 -0
  36. package/dist/worker/cookies.d.ts +1 -5
  37. package/dist/worker/cookies.d.ts.map +1 -1
  38. package/dist/worker/cookies.js +1 -26
  39. package/dist/worker/cookies.js.map +1 -1
  40. package/dist/worker/drafts.d.ts +27 -48
  41. package/dist/worker/drafts.d.ts.map +1 -1
  42. package/dist/worker/drafts.js +33 -88
  43. package/dist/worker/drafts.js.map +1 -1
  44. package/dist/worker/index.d.ts +77 -51
  45. package/dist/worker/index.d.ts.map +1 -1
  46. package/dist/worker/index.js +141 -360
  47. package/dist/worker/index.js.map +1 -1
  48. package/dist/worker/segment.d.ts +7 -6
  49. package/dist/worker/segment.d.ts.map +1 -1
  50. package/dist/worker/segment.js +6 -5
  51. package/dist/worker/segment.js.map +1 -1
  52. package/dist/worker/serverFn.d.ts +12 -0
  53. package/dist/worker/serverFn.d.ts.map +1 -0
  54. package/dist/worker/serverFn.js +44 -0
  55. package/dist/worker/serverFn.js.map +1 -0
  56. package/package.json +3 -3
  57. package/src/assignments.ts +77 -0
  58. package/src/draft.ts +10 -7
  59. package/src/index.ts +3 -1
  60. package/src/scope/server.ts +1 -1
  61. package/src/server/index.ts +51 -12
  62. package/src/shared.ts +5 -5
  63. package/src/start/index.ts +3 -3
  64. package/src/visitor.ts +14 -0
  65. package/src/worker/assignments.ts +146 -0
  66. package/src/worker/cache.ts +57 -0
  67. package/src/worker/cookies.ts +1 -27
  68. package/src/worker/drafts.ts +38 -98
  69. package/src/worker/index.ts +213 -425
  70. package/src/worker/segment.ts +7 -7
  71. package/src/worker/serverFn.ts +36 -0
  72. package/dist/worker/cacheProfiles.d.ts +0 -43
  73. package/dist/worker/cacheProfiles.d.ts.map +0 -1
  74. package/dist/worker/cacheProfiles.js +0 -162
  75. package/dist/worker/cacheProfiles.js.map +0 -1
  76. package/src/worker/cacheProfiles.ts +0 -180
@@ -0,0 +1,44 @@
1
+ /**
2
+ * A request's assignments (what its content gives it), decided once by the
3
+ * worker: the version it reads (a Studio link's draft or release SHA), each
4
+ * test of the saved `experiments` block on or off for its visitor and each
5
+ * campaign of the saved `campaigns` block running or not at its date, with a
6
+ * preview's switched tests and campaigns on top. The worker hands them to the
7
+ * page (`x-deco-assignments`) and to the site's `pageCache`
8
+ * (`page.assignments`), whose key carries them (`assignmentsKey`). Two
9
+ * requests with the same assignments render the same content, so they share
10
+ * a cache entry; the visitor id itself is never in the key, or every visitor
11
+ * would miss.
12
+ *
13
+ * Blocks decides (`cms.client({ visitor, version, … })`); this only reads
14
+ * the answers. A site without either block has no assignments and keys as
15
+ * before.
16
+ */
17
+ import type { ClientOptions, CMS } from "@decocms/blocks";
18
+ import type { DecidedAssignments } from "../assignments.ts";
19
+ export interface RequestAssignments extends DecidedAssignments {
20
+ /** The version read, `null` for the current release. */
21
+ version: string | null;
22
+ }
23
+ /**
24
+ * The assignments of one request: `cms.client(options)` (the version, the
25
+ * visitor, the date and a preview's switched tests and campaigns, as
26
+ * `cms.readVersion` reads them) resolving `experiments` and `campaigns`.
27
+ * Missing blocks (or content that doesn't load) give none, never an error.
28
+ */
29
+ export declare function readAssignments(cms: Pick<CMS, "client">, options: ClientOptions): Promise<RequestAssignments>;
30
+ /**
31
+ * Every assignments key a live request can carry now, for a site's purge: each
32
+ * subset of the tests in the saved `experiments` block on (the empty one
33
+ * included), with the campaigns running now and with none. Previews are
34
+ * never cached, so no version. A site without either block has one: `""`.
35
+ */
36
+ export declare function liveAssignmentKeys(cms: Pick<CMS, "client">): Promise<string[]>;
37
+ /**
38
+ * The assignments as one stable string for a cache key:
39
+ * `v=<version>|x=<tests on>|c=<campaigns running>`, names sorted and
40
+ * URL-encoded, empty parts left out; `""` for none. The names that are off
41
+ * aren't in it: within one content revision they are the rest.
42
+ */
43
+ export declare function assignmentsKey(assignments: RequestAssignments): string;
44
+ //# sourceMappingURL=assignments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignments.d.ts","sourceRoot":"","sources":["../../src/worker/assignments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,wDAAwD;IACxD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AA0CD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EACxB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAa7B;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA0BpF;AASD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAStE"}
@@ -0,0 +1,114 @@
1
+ const EXPERIMENTS = { block: "experiments", type: "split-traffic" };
2
+ const CAMPAIGNS = { block: "campaigns", type: "calendar" };
3
+ /** Plain code-unit order, the same on every server and locale. */
4
+ const byCodeUnit = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
5
+ const record = () => Object.create(null);
6
+ function isRecord(value) {
7
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8
+ }
9
+ /**
10
+ * Whether the content saves a block of `type`: listing never fails on a
11
+ * missing block, so a site without tests or campaigns reports no error.
12
+ */
13
+ async function saves(client, type) {
14
+ const [list] = await client.list(type);
15
+ return (list?.length ?? 0) > 0;
16
+ }
17
+ /** The saved `block` resolved, each name `true` or `false`; none when it is missing. */
18
+ async function decided(client, spec) {
19
+ const out = record();
20
+ try {
21
+ if (!(await saves(client, spec.type)))
22
+ return out;
23
+ const [value] = await client.resolve(spec.block);
24
+ if (!isRecord(value))
25
+ return out;
26
+ for (const name of Object.keys(value).sort(byCodeUnit))
27
+ out[name] = value[name] === true;
28
+ }
29
+ catch {
30
+ // Content that doesn't load gives no assignments.
31
+ }
32
+ return out;
33
+ }
34
+ /**
35
+ * The assignments of one request: `cms.client(options)` (the version, the
36
+ * visitor, the date and a preview's switched tests and campaigns, as
37
+ * `cms.readVersion` reads them) resolving `experiments` and `campaigns`.
38
+ * Missing blocks (or content that doesn't load) give none, never an error.
39
+ */
40
+ export async function readAssignments(cms, options) {
41
+ const version = typeof options.version === "string" ? options.version : null;
42
+ let client;
43
+ try {
44
+ client = cms.client(options);
45
+ }
46
+ catch {
47
+ return { version, experiments: record(), campaigns: record() };
48
+ }
49
+ const [experiments, campaigns] = await Promise.all([
50
+ decided(client, EXPERIMENTS),
51
+ decided(client, CAMPAIGNS),
52
+ ]);
53
+ return { version, experiments, campaigns };
54
+ }
55
+ /**
56
+ * Every assignments key a live request can carry now, for a site's purge: each
57
+ * subset of the tests in the saved `experiments` block on (the empty one
58
+ * included), with the campaigns running now and with none. Previews are
59
+ * never cached, so no version. A site without either block has one: `""`.
60
+ */
61
+ export async function liveAssignmentKeys(cms) {
62
+ let client;
63
+ try {
64
+ client = cms.client();
65
+ }
66
+ catch {
67
+ return [""];
68
+ }
69
+ const [saved, campaigns] = await Promise.all([
70
+ decided(client, EXPERIMENTS),
71
+ decided(client, CAMPAIGNS),
72
+ ]);
73
+ const tests = Object.keys(saved);
74
+ const running = Object.keys(campaigns).some((name) => campaigns[name] === true);
75
+ const campaignSets = running ? [campaigns, record()] : [record()];
76
+ const keys = [];
77
+ // Subsets by bitmask, tests in sorted order: 2^tests of them.
78
+ for (let mask = 0; mask < 2 ** tests.length; mask++) {
79
+ const experiments = record();
80
+ tests.forEach((name, i) => {
81
+ experiments[name] = Math.floor(mask / 2 ** i) % 2 === 1;
82
+ });
83
+ for (const set of campaignSets) {
84
+ keys.push(assignmentsKey({ version: null, experiments, campaigns: set }));
85
+ }
86
+ }
87
+ return keys;
88
+ }
89
+ /** The names that are on, sorted. */
90
+ function onNames(assignments) {
91
+ return Object.keys(assignments)
92
+ .filter((name) => assignments[name] === true)
93
+ .sort(byCodeUnit);
94
+ }
95
+ /**
96
+ * The assignments as one stable string for a cache key:
97
+ * `v=<version>|x=<tests on>|c=<campaigns running>`, names sorted and
98
+ * URL-encoded, empty parts left out; `""` for none. The names that are off
99
+ * aren't in it: within one content revision they are the rest.
100
+ */
101
+ export function assignmentsKey(assignments) {
102
+ const list = (names) => names.map(encodeURIComponent).join(",");
103
+ const parts = [];
104
+ if (assignments.version)
105
+ parts.push(`v=${encodeURIComponent(assignments.version)}`);
106
+ const tests = onNames(assignments.experiments);
107
+ const campaigns = onNames(assignments.campaigns);
108
+ if (tests.length)
109
+ parts.push(`x=${list(tests)}`);
110
+ if (campaigns.length)
111
+ parts.push(`c=${list(campaigns)}`);
112
+ return parts.join("|");
113
+ }
114
+ //# sourceMappingURL=assignments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignments.js","sourceRoot":"","sources":["../../src/worker/assignments.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAW,CAAC;AAC7E,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAW,CAAC;AAIpE,kEAAkE;AAClE,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAElF,MAAM,MAAM,GAAG,GAAgB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAgB,CAAC;AAErE,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,KAAK,CAAC,MAAc,EAAE,IAAY;IAC/C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;I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AAI,SAAS,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * What a site needs to build its own page cache in front of the worker (the
3
+ * README's worker-entry recipe): whether a request may be cached at all, the
4
+ * version every key carries, and the version (draft or old release) a request
5
+ * renders. The worker caches nothing itself.
6
+ */
7
+ import type { CMS } from "@decocms/blocks";
8
+ /**
9
+ * Whether a request may be served from or stored in a shared cache at all:
10
+ * a GET of the current release (`version` `null`: never a preview, a draft
11
+ * or an old release), outside local development, without `Authorization`,
12
+ * and not one of TanStack Start's own `/_build` files. The worker calls a
13
+ * site's `pageCache` only for these.
14
+ */
15
+ export declare function isCacheable(request: Pick<Request, "method" | "url" | "headers">, inputs: {
16
+ version: string | null;
17
+ dev?: boolean;
18
+ }): boolean;
19
+ /**
20
+ * `<build>.<content revision>`, for every cache key: a new build or a
21
+ * published release gets new entries at once. The build alone when the
22
+ * revision can't be read.
23
+ */
24
+ export declare function cacheVersion(cms: Pick<CMS, "forRelease">, buildHash: string): Promise<string>;
25
+ /**
26
+ * The version a request renders as the worker decided it (a Studio link's
27
+ * draft pointer or release SHA, after the host allowlist), from the
28
+ * `x-deco-version` header it sets; `null` for the current release. For the
29
+ * request a `routes` handler or `pageCache` gets: the worker removes any copy
30
+ * that arrives from outside.
31
+ */
32
+ export declare function requestVersion(request: Pick<Request, "headers">): string | null;
33
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/worker/cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG3C;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC,EACpD,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAChD,OAAO,CAQT;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAC5B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,CAE/E"}
@@ -0,0 +1,41 @@
1
+ import { VERSION_HEADER } from "../draft.js";
2
+ /**
3
+ * Whether a request may be served from or stored in a shared cache at all:
4
+ * a GET of the current release (`version` `null`: never a preview, a draft
5
+ * or an old release), outside local development, without `Authorization`,
6
+ * and not one of TanStack Start's own `/_build` files. The worker calls a
7
+ * site's `pageCache` only for these.
8
+ */
9
+ export function isCacheable(request, inputs) {
10
+ return (request.method === "GET" &&
11
+ inputs.version === null &&
12
+ inputs.dev !== true &&
13
+ !request.headers.has("authorization") &&
14
+ !new URL(request.url).pathname.startsWith("/_build"));
15
+ }
16
+ /**
17
+ * `<build>.<content revision>`, for every cache key: a new build or a
18
+ * published release gets new entries at once. The build alone when the
19
+ * revision can't be read.
20
+ */
21
+ export async function cacheVersion(cms, buildHash) {
22
+ let revision = "";
23
+ try {
24
+ revision = await cms.forRelease().revision();
25
+ }
26
+ catch {
27
+ // The content didn't load: key on the build only.
28
+ }
29
+ return [buildHash, revision].filter(Boolean).join(".");
30
+ }
31
+ /**
32
+ * The version a request renders as the worker decided it (a Studio link's
33
+ * draft pointer or release SHA, after the host allowlist), from the
34
+ * `x-deco-version` header it sets; `null` for the current release. For the
35
+ * request a `routes` handler or `pageCache` gets: the worker removes any copy
36
+ * that arrives from outside.
37
+ */
38
+ export function requestVersion(request) {
39
+ return request.headers.get(VERSION_HEADER) || null;
40
+ }
41
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/worker/cache.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,OAAoD,EACpD,MAAiD;IAEjD,OAAO,CACL,OAAO,CAAC,MAAM,KAAK,KAAK;QACxB,MAAM,CAAC,OAAO,KAAK,IAAI;QACvB,MAAM,CAAC,GAAG,KAAK,IAAI;QACnB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QACrC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CACrD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAA4B,EAC5B,SAAiB;IAEjB,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,kDAAkD;IACpD,CAAC;IACD,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAiC;IAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC;AACrD,CAAC"}
@@ -1,8 +1,4 @@
1
- /** Set-Cookie handling: which cookies a cached response may carry, and one header per cookie. */
2
- /** Whether every cookie the response sets is one a shared (cached) response may set. */
3
- export declare function hasOnlySafeCookies(response: Response, safe: ReadonlySet<string>): boolean;
4
- /** A copy for the cache without the safe cookies; the visitor still gets them. */
5
- export declare function withoutSafeCookies(response: Response, safe: ReadonlySet<string>): Response;
1
+ /** Set-Cookie handling: one header per cookie. */
6
2
  /**
7
3
  * A Set-Cookie's identity: name + Domain + Path, the way the browser keys its
8
4
  * cookie jar (RFC 6265 §5.3), so two headers that differ in scope address two
@@ -1 +1 @@
1
- {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/worker/cookies.ts"],"names":[],"mappings":"AAAA,iGAAiG;AAOjG,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAKzF;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,QAAQ,CAU1F;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAc3D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAQzD"}
1
+ {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/worker/cookies.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAc3D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAQzD"}
@@ -1,29 +1,4 @@
1
- /** Set-Cookie handling: which cookies a cached response may carry, and one header per cookie. */
2
- function cookieName(setCookie) {
3
- const eq = setCookie.indexOf("=");
4
- return eq > 0 ? setCookie.slice(0, eq).trim() : "";
5
- }
6
- /** Whether every cookie the response sets is one a shared (cached) response may set. */
7
- export function hasOnlySafeCookies(response, safe) {
8
- return response.headers.getSetCookie().every((c) => {
9
- const name = cookieName(c);
10
- return name === "" || safe.has(name);
11
- });
12
- }
13
- /** A copy for the cache without the safe cookies; the visitor still gets them. */
14
- export function withoutSafeCookies(response, safe) {
15
- const copy = response.clone();
16
- const cookies = response.headers.getSetCookie();
17
- if (cookies.length === 0)
18
- return copy;
19
- copy.headers.delete("set-cookie");
20
- for (const c of cookies) {
21
- const name = cookieName(c);
22
- if (name && !safe.has(name))
23
- copy.headers.append("set-cookie", c);
24
- }
25
- return copy;
26
- }
1
+ /** Set-Cookie handling: one header per cookie. */
27
2
  /**
28
3
  * A Set-Cookie's identity: name + Domain + Path, the way the browser keys its
29
4
  * cookie jar (RFC 6265 §5.3), so two headers that differ in scope address two
@@ -1 +1 @@
1
- {"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../src/worker/cookies.ts"],"names":[],"mappings":"AAAA,iGAAiG;AAEjG,SAAS,UAAU,CAAC,SAAiB;IACnC,MAAM,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,kBAAkB,CAAC,QAAkB,EAAE,IAAyB;IAC9E,OAAO,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACjD,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,kBAAkB,CAAC,QAAkB,EAAE,IAAyB;IAC9E,MA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O,GAAG,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO;IAChC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,OAAO;QAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM;QAAE,OAAO;IACzC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC"}
@@ -1,59 +1,38 @@
1
1
  /**
2
- * Which hosts may render drafts: v7's allowlist (`@decocms/blocks` 7.x
3
- * `cms/draftSource.ts`: `readAllowedHosts`, `isDraftHostAllowed`,
4
- * `isDraftPreviewEnabled`), ported as is. v7 read its override from the
5
- * `DECO_ALLOWED_PREVIEW_HOSTS` variable; here it is the `previewHosts` option.
6
- *
7
- * - The site's own preview hosts: the ones it declares, in the `CMS` block or
8
- * as `createCMS({ preview: { hosts } })` (matched as `cms.draftPointer`
9
- * matches them). A site that declares none has none, as in v7: blocks'
10
- * own default (every host) doesn't count as a declaration.
11
- * - The hosts Deco runs the site on, named after the site and always added:
12
- * `<site>.deco.site` and `<site>.deco-cx.workers.dev`, exact.
13
- * - `previewHosts: [...]` replaces the site's own list (the inferred hosts are
14
- * still added); `previewHosts: "none"` turns previews off on every host.
15
- *
16
- * Hosts compare exactly, lowercased, port included (`localhost:5173`).
2
+ * Which hosts may render drafts: the ones the CMS allows (`cms.readVersion`):
3
+ * the addresses Studio writes into the current release's metadata, plus
4
+ * `createCMS`'s `preview.hosts`; every host while the site has published no
5
+ * list, or with no `site` and no `preview.hosts`. The site declares nothing
6
+ * here (PO 2026-10-22).
17
7
  *
18
8
  * The draft itself is the capability: a host check only bounds where a draft
19
9
  * link works. A request the check refuses gets the release, never an error.
10
+ *
11
+ * What a link carries is a version, as `cms.readVersion` reads it: a draft
12
+ * pointer, or a published release's commit SHA (Studio's "Preview this
13
+ * version"), with the preview's moment and switched tests and campaigns
14
+ * (`__at`, `__test`, `__campaign`; `parseVersion` from `@decocms/blocks`).
15
+ * Both pass the same host check: a visitor on the live site never picks a
16
+ * version.
20
17
  */
21
- import { type CMS } from "@decocms/blocks";
22
- export interface PreviewPolicy {
23
- /** The site's name: `<site>.deco.site` and `<site>.deco-cx.workers.dev` may preview. */
24
- site?: string;
25
- /** Replaces the `CMS` block's preview hosts; `"none"` turns previews off everywhere. */
26
- previewHosts?: readonly string[] | "none";
27
- }
28
- /** The hosts Deco runs `site` on, which may always preview (unless previews are off). */
29
- export declare function inferredPreviewHosts(site: string | undefined): string[];
30
- /**
31
- * Whether `host` may preview without asking the CMS: `true` (an override or
32
- * inferred host), `false` (previews off, or the override leaves it out), or
33
- * `"cms"` when only the site's declared preview hosts can say (none declared:
34
- * `false`, see {@link declaresPreviewHosts}).
35
- */
36
- export declare function previewHostDecision(host: string, policy: PreviewPolicy): boolean | "cms";
37
- /**
38
- * Whether the site declares its own preview hosts: in the `CMS` block, or as
39
- * `createCMS`'s `preview.hosts`. When it declares none, `cms.settings()`
40
- * reports blocks' default, every host (`["*"]`), which v7 never had: there,
41
- * a site without a list previewed only on its Deco hosts. The saved `CMS`
42
- * block tells an explicit `["*"]` from that default.
43
- */
44
- export declare function declaresPreviewHosts(cms: Pick<CMS, "settings" | "forRelease">): Promise<boolean>;
18
+ import { type CMS, type RequestVersion } from "@decocms/blocks";
45
19
  /**
46
- * The pointer a request carries, as `@decocms/blocks` reads it: `?__draft=`
47
- * first, then the draft cookie; `null` for `?__draft=off` and for a value
48
- * that doesn't parse.
20
+ * What a request's Studio link asks for, as `@decocms/blocks` reads it:
21
+ * `?__draft=` first, then the draft cookie; `null` for `?__draft=off` and
22
+ * for a value that doesn't parse.
49
23
  */
50
- export declare function readDraftPointer(request: Request): string | null;
24
+ export declare function readDraftVersion(request: Request): RequestVersion | null;
51
25
  export interface DraftDecision {
52
- /** The draft this request renders, after the host check; `null` for the release. */
53
- pointer: string | null;
54
- /** The `Set-Cookie` the response carries: storing a draft link's pointer, or ending a preview. */
26
+ /**
27
+ * What this request's Studio link asks for, after the host check: the
28
+ * version (a draft pointer, or a release's commit SHA) and the preview's
29
+ * moment and switched tests and campaigns, in the shape of
30
+ * `cms.client()`'s options; `null` for the current release.
31
+ */
32
+ version: RequestVersion | null;
33
+ /** The `Set-Cookie` the response carries: storing a link's version, or ending a preview. */
55
34
  setCookie: string | null;
56
35
  }
57
- /** The draft a request renders, and the cookie its response sets, under `policy`. */
58
- export declare function decideDraft(cms: Pick<CMS, "draftPointer" | "settings" | "forRelease">, request: Request, policy: PreviewPolicy): Promise<DraftDecision>;
36
+ /** The version a request renders, and the cookie its response sets. */
37
+ export declare function decideDraft(cms: Pick<CMS, "readVersion">, request: Request): Promise<DraftDecision>;
59
38
  //# sourceMappingURL=drafts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drafts.d.ts","sourceRoot":"","sources":["../../src/worker/drafts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,GAAG,EAAqB,MAAM,iBAAiB,CAAC;AAG9D,MAAM,WAAW,aAAa;IAC5B,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;CAC3C;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,M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+1,22 @@
1
1
  /**
2
- * Which hosts may render drafts: v7's allowlist (`@decocms/blocks` 7.x
3
- * `cms/draftSource.ts`: `readAllowedHosts`, `isDraftHostAllowed`,
4
- * `isDraftPreviewEnabled`), ported as is. v7 read its override from the
5
- * `DECO_ALLOWED_PREVIEW_HOSTS` variable; here it is the `previewHosts` option.
6
- *
7
- * - The site's own preview hosts: the ones it declares, in the `CMS` block or
8
- * as `createCMS({ preview: { hosts } })` (matched as `cms.draftPointer`
9
- * matches them). A site that declares none has none, as in v7: blocks'
10
- * own default (every host) doesn't count as a declaration.
11
- * - The hosts Deco runs the site on, named after the site and always added:
12
- * `<site>.deco.site` and `<site>.deco-cx.workers.dev`, exact.
13
- * - `previewHosts: [...]` replaces the site's own list (the inferred hosts are
14
- * still added); `previewHosts: "none"` turns previews off on every host.
15
- *
16
- * Hosts compare exactly, lowercased, port included (`localhost:5173`).
2
+ * Which hosts may render drafts: the ones the CMS allows (`cms.readVersion`):
3
+ * the addresses Studio writes into the current release's metadata, plus
4
+ * `createCMS`'s `preview.hosts`; every host while the site has published no
5
+ * list, or with no `site` and no `preview.hosts`. The site declares nothing
6
+ * here (PO 2026-10-22).
17
7
  *
18
8
  * The draft itself is the capability: a host check only bounds where a draft
19
9
  * link works. A request the check refuses gets the release, never an error.
10
+ *
11
+ * What a link carries is a version, as `cms.readVersion` reads it: a draft
12
+ * pointer, or a published release's commit SHA (Studio's "Preview this
13
+ * version"), with the preview's moment and switched tests and campaigns
14
+ * (`__at`, `__test`, `__campaign`; `parseVersion` from `@decocms/blocks`).
15
+ * Both pass the same host check: a visitor on the live site never picks a
16
+ * version.
20
17
  */
21
- import { parseDraftPointer } from "@decocms/blocks";
18
+ import { parseVersion } from "@decocms/blocks";
22
19
  import { DRAFT_COOKIE, DRAFT_PARAM } from "../draft.js";
23
- /** The hosts Deco runs `site` on, which may always preview (unless previews are off). */
24
- export function inferredPreviewHosts(site) {
25
- const s = (site ?? "").trim().toLowerCase();
26
- return s ? [`${s}.deco.site`, `${s}.deco-cx.workers.dev`] : [];
27
- }
28
- /**
29
- * Whether `host` may preview without asking the CMS: `true` (an override or
30
- * inferred host), `false` (previews off, or the override leaves it out), or
31
- * `"cms"` when only the site's declared preview hosts can say (none declared:
32
- * `false`, see {@link declaresPreviewHosts}).
33
- */
34
- export function previewHostDecision(host, policy) {
35
- const override = policy.previewHosts === "none"
36
- ? ["none"]
37
- : (policy.previewHosts ?? []).map((h) => h.trim().toLowerCase()).filter(Boolean);
38
- if (override.includes("none"))
39
- return false;
40
- const h = host.trim().toLowerCase();
41
- if (h === "")
42
- return false;
43
- if (inferredPreviewHosts(policy.site).includes(h))
44
- return true;
45
- if (policy.previewHosts !== undefined)
46
- return override.includes(h);
47
- return "cms";
48
- }
49
- /**
50
- * Whether the site declares its own preview hosts: in the `CMS` block, or as
51
- * `createCMS`'s `preview.hosts`. When it declares none, `cms.settings()`
52
- * reports blocks' default, every host (`["*"]`), which v7 never had: there,
53
- * a site without a list previewed only on its Deco hosts. The saved `CMS`
54
- * block tells an explicit `["*"]` from that default.
55
- */
56
- export async function declaresPreviewHosts(cms) {
57
- const { hosts } = (await cms.settings()).preview;
58
- if (hosts.length !== 1 || hosts[0] !== "*")
59
- return true;
60
- try {
61
- const [block] = await cms.forRelease().resolve("CMS", { run: false });
62
- const preview = isRecord(block) ? block.preview : undefined;
63
- return isRecord(preview) && ("hosts" in preview || "__resolveType" in preview);
64
- }
65
- catch {
66
- return false;
67
- }
68
- }
69
- function isRecord(value) {
70
- return typeof value === "object" && value !== null && !Array.isArray(value);
71
- }
72
20
  const DRAFT_OFF = "off";
73
21
  function draftParam(url) {
74
22
  return url.searchParams.get(DRAFT_PARAM);
@@ -90,18 +38,18 @@ function readCookie(header, name) {
90
38
  return null;
91
39
  }
92
40
  /**
93
- * The pointer a request carries, as `@decocms/blocks` reads it: `?__draft=`
94
- * first, then the draft cookie; `null` for `?__draft=off` and for a value
95
- * that doesn't parse.
41
+ * What a request's Studio link asks for, as `@decocms/blocks` reads it:
42
+ * `?__draft=` first, then the draft cookie; `null` for `?__draft=off` and
43
+ * for a value that doesn't parse.
96
44
  */
97
- export function readDraftPointer(request) {
45
+ export function readDraftVersion(request) {
98
46
  const param = draftParam(new URL(request.url));
99
47
  if (param === DRAFT_OFF)
100
48
  return null;
101
- if (param && parseDraftPointer(param) !== null)
102
- return param;
103
- const cookie = readCookie(request.headers.get("cookie"), DRAFT_COOKIE);
104
- return cookie && parseDraftPointer(cookie) !== null ? cookie : null;
49
+ const fromLink = param ? parseVersion(param) : null;
50
+ if (fromLink !== null)
51
+ return fromLink;
52
+ return parseVersion(readCookie(request.headers.get("cookie"), DRAFT_COOKIE));
105
53
  }
106
54
  function serializeCookie(value, extra) {
107
55
  // The same cookie `cms.draftCookie` writes (a test holds the two together).
@@ -115,26 +63,23 @@ function serializeCookie(value, extra) {
115
63
  "Partitioned",
116
64
  ].join("; ");
117
65
  }
118
- /** The draft a request renders, and the cookie its response sets, under `policy`. */
119
- export async function decideDraft(cms, request, policy) {
66
+ /** The version a request renders, and the cookie its response sets. */
67
+ export async function decideDraft(cms, request) {
120
68
  const url = new URL(request.url);
121
69
  const param = draftParam(url);
122
70
  // Ending a preview is allowed on any host, so a cookie set earlier always goes.
123
71
  if (param === DRAFT_OFF)
124
- return { pointer: null, setCookie: serializeCookie("", ["Max-Age=0"]) };
125
- const pointer = readDraftPointer(request);
126
- if (pointer === null)
127
- return { pointer: null, setCookie: null };
128
- const decision = previewHostDecision(url.host, policy);
129
- const allowed = decision === "cms"
130
- ? (await declaresPreviewHosts(cms)) && (await cms.draftPointer(request)) !== null
131
- : decision;
132
- if (!allowed)
133
- return { pointer: null, setCookie: null };
134
- const fromLink = param !== null && param === pointer;
72
+ return { version: null, setCookie: serializeCookie("", ["Max-Age=0"]) };
73
+ const version = readDraftVersion(request);
74
+ if (version === null)
75
+ return { version: null, setCookie: null };
76
+ if ((await cms.readVersion(request)) === null)
77
+ return { version: null, setCookie: null };
78
+ // The link's own value goes in the cookie, its preview parameters with it.
79
+ const fromLink = param !== null && parseVersion(param) !== null;
135
80
  return {
136
- pointer,
137
- setCookie: fromLink ? serializeCookie(encodeURIComponent(pointer), []) : null,
81
+ version,
82
+ setCookie: fromLink ? serializeCookie(encodeURIComponent(param), []) : null,
138
83
  };
139
84
  }
140
85
  //# sourceMappingURL=drafts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drafts.js","sourceRoot":"","sources":["../../src/worker/drafts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAY,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AASxD,yFAAyF;AACzF,MAAM,UAAU,oBAAoB,CAAC,IAAwB;IAC3D,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,MAAqB;IACrE,MAAM,QAAQ,GACZ,MAAM,CAAC,YAAY,KAAK,MAAM;QAC5B,CAAC,CAAC,CAAC,MAAM,CAAC;QACV,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrF,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CA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