@decocms/blocks 8.1.0-next.3 → 8.1.0-next.5

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 (154) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/protocol/client.d.ts +1 -1
  6. package/dist/protocol/conformance/cases/reads.d.ts.map +1 -1
  7. package/dist/protocol/conformance/cases/reads.js +22 -6
  8. package/dist/protocol/conformance/cases/reads.js.map +1 -1
  9. package/dist/protocol/conformance/cases/writes.d.ts.map +1 -1
  10. package/dist/protocol/conformance/cases/writes.js +1 -0
  11. package/dist/protocol/conformance/cases/writes.js.map +1 -1
  12. package/dist/protocol/conformance/contentHashFixtures.d.ts +0 -29
  13. package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -1
  14. package/dist/protocol/conformance/contentHashFixtures.js +0 -30
  15. package/dist/protocol/conformance/contentHashFixtures.js.map +1 -1
  16. package/dist/protocol/conformance/context.d.ts +3 -3
  17. package/dist/protocol/conformance/context.d.ts.map +1 -1
  18. package/dist/protocol/conformance/index.d.ts +1 -1
  19. package/dist/protocol/conformance/index.d.ts.map +1 -1
  20. package/dist/protocol/conformance/index.js +2 -2
  21. package/dist/protocol/conformance/index.js.map +1 -1
  22. package/dist/protocol/index.d.ts +3 -5
  23. package/dist/protocol/index.d.ts.map +1 -1
  24. package/dist/protocol/index.js +3 -5
  25. package/dist/protocol/index.js.map +1 -1
  26. package/dist/protocol/secrets.d.ts.map +1 -1
  27. package/dist/protocol/secrets.js +9 -2
  28. package/dist/protocol/secrets.js.map +1 -1
  29. package/dist/protocol/server/assets.d.ts +1 -1
  30. package/dist/protocol/server/assets.js +1 -1
  31. package/dist/protocol/server/methods/read.d.ts.map +1 -1
  32. package/dist/protocol/server/methods/read.js +5 -2
  33. package/dist/protocol/server/methods/read.js.map +1 -1
  34. package/dist/protocol/types.d.ts +23 -0
  35. package/dist/protocol/types.d.ts.map +1 -1
  36. package/dist/protocol/types.js +10 -0
  37. package/dist/protocol/types.js.map +1 -1
  38. package/dist/v8/boundedJson.d.ts +11 -0
  39. package/dist/v8/boundedJson.d.ts.map +1 -0
  40. package/dist/v8/boundedJson.js +44 -0
  41. package/dist/v8/boundedJson.js.map +1 -0
  42. package/dist/v8/builtins/data.d.ts +21 -5
  43. package/dist/v8/builtins/data.d.ts.map +1 -1
  44. package/dist/v8/builtins/data.js +47 -6
  45. package/dist/v8/builtins/data.js.map +1 -1
  46. package/dist/v8/builtins/index.d.ts.map +1 -1
  47. package/dist/v8/builtins/index.js +2 -3
  48. package/dist/v8/builtins/index.js.map +1 -1
  49. package/dist/v8/canonical.d.ts +0 -28
  50. package/dist/v8/canonical.d.ts.map +1 -1
  51. package/dist/v8/canonical.js +0 -19
  52. package/dist/v8/canonical.js.map +1 -1
  53. package/dist/v8/cli/check/index.d.ts +5 -0
  54. package/dist/v8/cli/check/index.d.ts.map +1 -1
  55. package/dist/v8/cli/check/index.js +34 -2
  56. package/dist/v8/cli/check/index.js.map +1 -1
  57. package/dist/v8/cli/index.d.ts +2 -1
  58. package/dist/v8/cli/index.d.ts.map +1 -1
  59. package/dist/v8/cli/index.js +2 -1
  60. package/dist/v8/cli/index.js.map +1 -1
  61. package/dist/v8/cli/run.d.ts.map +1 -1
  62. package/dist/v8/cli/run.js +3 -10
  63. package/dist/v8/cli/run.js.map +1 -1
  64. package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -1
  65. package/dist/v8/cli/schema/builtinSchemas.js +48 -28
  66. package/dist/v8/cli/schema/builtinSchemas.js.map +1 -1
  67. package/dist/v8/cli/schema/generate.d.ts +3 -1
  68. package/dist/v8/cli/schema/generate.d.ts.map +1 -1
  69. package/dist/v8/cli/schema/generate.js +2 -1
  70. package/dist/v8/cli/schema/generate.js.map +1 -1
  71. package/dist/v8/cli/schema/tsProgram.d.ts +10 -0
  72. package/dist/v8/cli/schema/tsProgram.d.ts.map +1 -1
  73. package/dist/v8/cli/schema/tsProgram.js +31 -0
  74. package/dist/v8/cli/schema/tsProgram.js.map +1 -1
  75. package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -1
  76. package/dist/v8/cli/schema/typeToSchema.js +15 -1
  77. package/dist/v8/cli/schema/typeToSchema.js.map +1 -1
  78. package/dist/v8/cli/serve/server.d.ts +1 -5
  79. package/dist/v8/cli/serve/server.d.ts.map +1 -1
  80. package/dist/v8/cli/serve/server.js +76 -62
  81. package/dist/v8/cli/serve/server.js.map +1 -1
  82. package/dist/v8/cms.d.ts +5 -2
  83. package/dist/v8/cms.d.ts.map +1 -1
  84. package/dist/v8/cms.js +187 -25
  85. package/dist/v8/cms.js.map +1 -1
  86. package/dist/v8/content.d.ts +22 -6
  87. package/dist/v8/content.d.ts.map +1 -1
  88. package/dist/v8/content.js +78 -40
  89. package/dist/v8/content.js.map +1 -1
  90. package/dist/v8/draft.d.ts +9 -12
  91. package/dist/v8/draft.d.ts.map +1 -1
  92. package/dist/v8/draft.js +30 -4
  93. package/dist/v8/draft.js.map +1 -1
  94. package/dist/v8/draftChanges.d.ts +26 -0
  95. package/dist/v8/draftChanges.d.ts.map +1 -0
  96. package/dist/v8/draftChanges.js +102 -0
  97. package/dist/v8/draftChanges.js.map +1 -0
  98. package/dist/v8/hosts.d.ts +55 -0
  99. package/dist/v8/hosts.d.ts.map +1 -0
  100. package/dist/v8/hosts.js +197 -0
  101. package/dist/v8/hosts.js.map +1 -0
  102. package/dist/v8/index.d.ts +4 -3
  103. package/dist/v8/index.d.ts.map +1 -1
  104. package/dist/v8/index.js +3 -2
  105. package/dist/v8/index.js.map +1 -1
  106. package/dist/v8/remoteLoader.d.ts +1 -1
  107. package/dist/v8/remoteLoader.d.ts.map +1 -1
  108. package/dist/v8/remoteLoader.js +32 -257
  109. package/dist/v8/remoteLoader.js.map +1 -1
  110. package/dist/v8/settings.d.ts +34 -0
  111. package/dist/v8/settings.d.ts.map +1 -0
  112. package/dist/v8/settings.js +143 -0
  113. package/dist/v8/settings.js.map +1 -0
  114. package/dist/v8/telemetry.d.ts +13 -3
  115. package/dist/v8/telemetry.d.ts.map +1 -1
  116. package/dist/v8/telemetry.js +31 -32
  117. package/dist/v8/telemetry.js.map +1 -1
  118. package/dist/v8/types.d.ts +74 -9
  119. package/dist/v8/types.d.ts.map +1 -1
  120. package/package.json +1 -1
  121. package/src/index.ts +3 -3
  122. package/src/protocol/client.ts +1 -1
  123. package/src/protocol/conformance/cases/reads.ts +24 -6
  124. package/src/protocol/conformance/cases/writes.ts +1 -0
  125. package/src/protocol/conformance/contentHashFixtures.ts +0 -57
  126. package/src/protocol/conformance/context.ts +3 -3
  127. package/src/protocol/conformance/index.ts +2 -7
  128. package/src/protocol/index.ts +2 -8
  129. package/src/protocol/secrets.ts +10 -2
  130. package/src/protocol/server/assets.ts +1 -1
  131. package/src/protocol/server/methods/read.ts +5 -2
  132. package/src/protocol/types.ts +21 -1
  133. package/src/v8/boundedJson.ts +47 -0
  134. package/src/v8/builtins/data.ts +56 -7
  135. package/src/v8/builtins/index.ts +2 -3
  136. package/src/v8/canonical.ts +0 -36
  137. package/src/v8/cli/check/index.ts +48 -2
  138. package/src/v8/cli/index.ts +2 -1
  139. package/src/v8/cli/run.ts +4 -9
  140. package/src/v8/cli/schema/builtinSchemas.ts +49 -28
  141. package/src/v8/cli/schema/generate.ts +4 -1
  142. package/src/v8/cli/schema/tsProgram.ts +27 -0
  143. package/src/v8/cli/schema/typeToSchema.ts +18 -1
  144. package/src/v8/cli/serve/server.ts +78 -77
  145. package/src/v8/cms.ts +234 -30
  146. package/src/v8/content.ts +87 -43
  147. package/src/v8/draft.ts +31 -9
  148. package/src/v8/draftChanges.ts +117 -0
  149. package/src/v8/hosts.ts +184 -0
  150. package/src/v8/index.ts +6 -8
  151. package/src/v8/remoteLoader.ts +39 -290
  152. package/src/v8/settings.ts +178 -0
  153. package/src/v8/telemetry.ts +43 -40
  154. package/src/v8/types.ts +68 -9
@@ -5,8 +5,10 @@
5
5
  * - **Where** comes from code: `createCMS({ telemetry })`, or the standard
6
6
  * `OTEL_EXPORTER_OTLP_ENDPOINT`/`OTEL_EXPORTER_OTLP_HEADERS` when it's left
7
7
  * out. `false` sends nothing.
8
- * - **How much** comes from content: the `Telemetry` saved block of the
9
- * release being served, capped by `telemetry.limits`.
8
+ * - **How much** comes from content: the `telemetry` section of the CMS
9
+ * settings (`cms.settings()`, the release's `CMS` block), capped by
10
+ * `telemetry.limits`. The CMS reads it outside any request, when the
11
+ * release changes and then at most once a minute.
10
12
  * - Metrics are aggregated in memory (delta histograms); error logs and traces
11
13
  * are sampled. Batches leave in the background (after the response on
12
14
  * Workers, on an unref'd timer elsewhere); a send that fails is retried
@@ -15,10 +17,10 @@
15
17
  * cookies or authorization values, and no value a secret block decrypted.
16
18
  */
17
19
  import { hasBackgroundHook, later, runInBackground } from "./background.ts";
20
+ import { rate, TELEMETRY_DEFAULTS } from "./builtins/data.ts";
18
21
  import { isResolutionError } from "./errors.ts";
19
22
  import { readEnv } from "./identity.ts";
20
- import { isPlainObject } from "./json.ts";
21
- import type { CMSError, Snapshot, TelemetryConfig } from "./types.ts";
23
+ import type { CMSError, Snapshot, Telemetry, TelemetryConfig } from "./types.ts";
22
24
 
23
25
  /** The hosted Deco CMS collector, for `telemetry: { site, token }`. */
24
26
  const HOSTED_TELEMETRY_ENDPOINT = "https://otel.decocms.com";
@@ -31,9 +33,20 @@ const MAX_SECRETS = 1_000;
31
33
  const RETRY_STATUSES = new Set([429, 502, 503, 504]);
32
34
  /** OpenTelemetry's recommended `http.*.request.duration` buckets, in seconds. */
33
35
  const BOUNDS = [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10];
34
- const DEFAULTS = { enabled: true, metrics: true, errorSampleRate: 0.05, traceSampleRate: 0 };
35
36
  const DEFAULT_LIMITS = { errorSampleRate: 0.1, traceSampleRate: 0 };
36
37
 
38
+ /** The caps on content's sample rates: `telemetry.limits`, defaults 0.1 and 0. */
39
+ export function telemetryLimits(config: false | TelemetryConfig | undefined): {
40
+ errorSampleRate: number;
41
+ traceSampleRate: number;
42
+ } {
43
+ const limits = config ? config.limits : undefined;
44
+ return {
45
+ errorSampleRate: rate(limits?.errorSampleRate, DEFAULT_LIMITS.errorSampleRate),
46
+ traceSampleRate: rate(limits?.traceSampleRate, DEFAULT_LIMITS.traceSampleRate),
47
+ };
48
+ }
49
+
37
50
  type Attributes = Record<string, string | number | boolean | undefined>;
38
51
 
39
52
  interface Destination {
@@ -92,10 +105,7 @@ export function resolveDestination(
92
105
  const headers = parseKeyValues(readEnv("OTEL_EXPORTER_OTLP_HEADERS"));
93
106
  return { endpoint, headers, site, limits: DEFAULT_LIMITS };
94
107
  }
95
- const limits = {
96
- errorSampleRate: rate(config.limits?.errorSampleRate, DEFAULT_LIMITS.errorSampleRate),
97
- traceSampleRate: rate(config.limits?.traceSampleRate, DEFAULT_LIMITS.traceSampleRate),
98
- };
108
+ const limits = telemetryLimits(config);
99
109
  if ("endpoint" in config) {
100
110
  if (typeof config.endpoint !== "string" || !config.endpoint) return null;
101
111
  return { endpoint: config.endpoint, headers: { ...config.headers }, site, limits };
@@ -111,8 +121,7 @@ export function resolveDestination(
111
121
 
112
122
  export class TelemetryPipeline {
113
123
  readonly #destination: Destination;
114
- #settings = { ...DEFAULTS };
115
- #settingsRevision: string | undefined;
124
+ #settings: Required<Telemetry> = { ...TELEMETRY_DEFAULTS };
116
125
  #release: string | undefined;
117
126
  #histograms = new Map<string, Histogram>();
118
127
  #logs: LogRecord[] = [];
@@ -124,7 +133,7 @@ export class TelemetryPipeline {
124
133
 
125
134
  constructor(destination: Destination) {
126
135
  this.#destination = destination;
127
- this.#apply(undefined);
136
+ this.apply(TELEMETRY_DEFAULTS);
128
137
  }
129
138
 
130
139
  /** Never send `value`: it's replaced with `[redacted]` in every log, span and label. */
@@ -132,13 +141,29 @@ export class TelemetryPipeline {
132
141
  if (value.length > 0 && this.#secrets.size < MAX_SECRETS) this.#secrets.add(value);
133
142
  }
134
143
 
135
- /** The release being served: its revision labels batches and its `Telemetry` block sets the rates. */
144
+ /** The release being served: its revision labels batches. */
136
145
  useRelease(snapshot: Snapshot): void {
137
146
  this.#release = snapshot.revision;
138
- if (this.#settingsRevision === snapshot.revision) return;
139
- this.#settingsRevision = snapshot.revision;
140
- const entry = snapshot.blocks.Telemetry;
141
- this.#apply(isPlainObject(entry) && entry.__resolveType === "telemetry" ? entry : undefined);
147
+ }
148
+
149
+ /**
150
+ * The `telemetry` section to follow (from `cms.settings()`). Rates are
151
+ * capped by the destination's limits here too, whatever the caller passed.
152
+ */
153
+ apply(section: Telemetry): void {
154
+ const { limits } = this.#destination;
155
+ this.#settings = {
156
+ enabled: typeof section.enabled === "boolean" ? section.enabled : TELEMETRY_DEFAULTS.enabled,
157
+ metrics: typeof section.metrics === "boolean" ? section.metrics : TELEMETRY_DEFAULTS.metrics,
158
+ errorSampleRate: Math.min(
159
+ rate(section.errorSampleRate, TELEMETRY_DEFAULTS.errorSampleRate),
160
+ limits.errorSampleRate,
161
+ ),
162
+ traceSampleRate: Math.min(
163
+ rate(section.traceSampleRate, TELEMETRY_DEFAULTS.traceSampleRate),
164
+ limits.traceSampleRate,
165
+ ),
166
+ };
142
167
  }
143
168
 
144
169
  histogram(name: string, attributes: Attributes, seconds: number): void {
@@ -188,7 +213,7 @@ export class TelemetryPipeline {
188
213
  /**
189
214
  * The hooks one client reports through. The trace decision is made once per
190
215
  * client, on its first block, after its release is loaded, so the first
191
- * client of a release already uses that release's `Telemetry` block.
216
+ * client of a release already uses that release's `telemetry` section.
192
217
  */
193
218
  forClient(): ClientTelemetry {
194
219
  let decided = false;
@@ -340,22 +365,6 @@ export class TelemetryPipeline {
340
365
  return scrubText(out);
341
366
  }
342
367
 
343
- #apply(block: Record<string, unknown> | undefined): void {
344
- const { limits } = this.#destination;
345
- this.#settings = {
346
- enabled: typeof block?.enabled === "boolean" ? block.enabled : DEFAULTS.enabled,
347
- metrics: typeof block?.metrics === "boolean" ? block.metrics : DEFAULTS.metrics,
348
- errorSampleRate: Math.min(
349
- rate(block?.errorSampleRate, DEFAULTS.errorSampleRate),
350
- limits.errorSampleRate,
351
- ),
352
- traceSampleRate: Math.min(
353
- rate(block?.traceSampleRate, DEFAULTS.traceSampleRate),
354
- limits.traceSampleRate,
355
- ),
356
- };
357
- }
358
-
359
368
  #schedule(): void {
360
369
  if (this.#scheduled) return;
361
370
  this.#scheduled = true;
@@ -483,12 +492,6 @@ function randomHex(bytes: number): string {
483
492
  return Array.from(values, (b) => b.toString(16).padStart(2, "0")).join("");
484
493
  }
485
494
 
486
- function rate(value: unknown, fallback: number): number {
487
- return typeof value === "number" && Number.isFinite(value)
488
- ? Math.min(1, Math.max(0, value))
489
- : fallback;
490
- }
491
-
492
495
  /** `k1=v1,k2=v2` with URL-encoded values, the format of the OTEL_* environment variables. */
493
496
  function parseKeyValues(raw: string | undefined): Record<string, string> {
494
497
  const out: Record<string, string> = {};
package/src/v8/types.ts CHANGED
@@ -37,19 +37,22 @@ export type Snapshot = {
37
37
  */
38
38
  export type ContentModule = Snapshot & { root?: string };
39
39
 
40
- /** A source of content. `load()` is the release; `load(pointer)` is a draft. */
40
+ /**
41
+ * A source of content: `load()` returns it. Drafts aren't a loader's job:
42
+ * `forDraft` layers a draft's changes over what `load()` returned.
43
+ */
41
44
  export interface Loader {
42
- load(pointer?: string | null): Promise<Snapshot>;
45
+ load(): Promise<Snapshot>;
43
46
  update?(): Promise<{ updated: boolean }>;
44
47
  }
45
48
 
46
49
  /** The parts of a draft pointer, `<host[:port]><path[?query]>@<version>`. */
47
50
  export interface DraftPointer {
48
- /** `host[:port]` of the content source that holds the draft. */
51
+ /** `host[:port]` of the Studio API that serves the draft's changes. */
49
52
  host: string;
50
53
  /** Starts with `/`; opaque to the app. Never carries the `__variant` parameters. */
51
54
  path: string;
52
- /** Opaque and immutable: the branch head or ETag. */
55
+ /** Opaque: the commit of the editor's last save. `"local"` names no draft (`deco serve`). */
53
56
  version: string;
54
57
  /** The variants this preview forces (the query's `__variant` parameters); absent when none. */
55
58
  variants?: ForcedVariant[];
@@ -130,7 +133,28 @@ export interface Variant<T> {
130
133
  value: Lazy<T>;
131
134
  }
132
135
 
133
- /** The `Telemetry` saved block's type (built-in `telemetry`). */
136
+ /**
137
+ * The built-in `cms-settings` block's props: the type of the well-known saved
138
+ * block `CMS`. Every field is optional, and any field can have variants. Read
139
+ * it through `cms.settings()`, which fills in the defaults and applies code's
140
+ * caps (see /next/built-in-blocks#cms-settings).
141
+ */
142
+ export interface CMSSettings {
143
+ /** Host patterns previews are allowed on, within `createCMS`'s `preview.hosts`. */
144
+ preview?: { hosts?: string[] };
145
+ telemetry?: Telemetry;
146
+ analytics?: Analytics;
147
+ }
148
+
149
+ /** What `cms.settings()` returns: every section, defaults filled in, caps applied. */
150
+ export interface EffectiveSettings {
151
+ /** `["*"]` means every host; an empty list, none. */
152
+ preview: { hosts: string[] };
153
+ telemetry: Required<Telemetry>;
154
+ analytics: Required<Analytics>;
155
+ }
156
+
157
+ /** The `telemetry` section of the CMS settings. */
134
158
  export interface Telemetry {
135
159
  /** Default `true`; `false` switches telemetry off. */
136
160
  enabled?: boolean;
@@ -142,7 +166,7 @@ export interface Telemetry {
142
166
  traceSampleRate?: number;
143
167
  }
144
168
 
145
- /** The built-in `analytics` block's props. Separate from telemetry. */
169
+ /** The `analytics` section of the CMS settings, and `AnalyticsScript`'s props. */
146
170
  export interface Analytics {
147
171
  /** An endpoint that accepts the One Dollar Stats format; default: the hosted Deco CMS collector. */
148
172
  collector?: string;
@@ -150,6 +174,9 @@ export interface Analytics {
150
174
  enabled?: boolean;
151
175
  }
152
176
 
177
+ /** Anything with a `url` and `headers`: a fetch `Request`, a `NextRequest`, a framework wrapper. */
178
+ export type RequestLike = Request | { url: string; headers: { get(name: string): string | null } };
179
+
153
180
  // ---------------------------------------------------------------------------
154
181
  // Results and errors
155
182
  // ---------------------------------------------------------------------------
@@ -201,11 +228,23 @@ export interface CMSConfig {
201
228
  interval?: number;
202
229
  /** Where telemetry goes; see /next/telemetry. */
203
230
  telemetry?: false | TelemetryConfig;
231
+ preview?: {
232
+ /**
233
+ * The most content may allow previews on, in the host pattern format
234
+ * (/next/api-reference#host-patterns). Without it, content may allow any host.
235
+ */
236
+ hosts?: string[];
237
+ /**
238
+ * The hosts a draft pointer may name, in the host pattern format; code
239
+ * only, never content. Default `["studio.decocms.com"]`.
240
+ */
241
+ sources?: string[];
242
+ };
204
243
  /** The private key that decrypts `secret` blocks. */
205
244
  secrets?: { key?: string };
206
- /** Your site's ID, for hosted releases and drafts. */
245
+ /** Your site's ID, for hosted releases. Drafts don't need it. */
207
246
  site?: string;
208
- /** Your site token (secret), for hosted releases and drafts. */
247
+ /** Your site token (secret), for hosted releases. Drafts don't need it. */
209
248
  token?: string;
210
249
  }
211
250
 
@@ -244,10 +283,30 @@ export interface Client {
244
283
  export interface CMS {
245
284
  /** A client reading the current release. */
246
285
  forRelease(): Client;
247
- /** A client reading the draft a pointer names. */
286
+ /**
287
+ * A client reading the draft a pointer names: its changes, fetched from a
288
+ * host in `preview.sources`, over this server's production content.
289
+ */
248
290
  forDraft(pointer: string): Client;
249
291
  /** A client pinned to a revision this CMS has served; an unknown revision behaves like the release. */
250
292
  forRevision(revision: string): Client;
251
293
  /** Ask the content source for newer content now; never throws. */
252
294
  update(): Promise<{ updated: boolean }>;
295
+ /**
296
+ * The release's CMS settings (the saved block `CMS`), defaults filled in and
297
+ * code's caps applied. Reads the release already in memory, never a draft;
298
+ * never fetches, never rejects.
299
+ */
300
+ settings(): Promise<EffectiveSettings>;
301
+ /**
302
+ * The request's draft pointer: `?__draft=` first, then the `deco-draft`
303
+ * cookie. `null` when neither is present, for `?__draft=off`, and on a host
304
+ * outside `settings().preview.hosts`, where the request gets the release.
305
+ */
306
+ draftPointer(request: RequestLike): Promise<string | null>;
307
+ /**
308
+ * The `Set-Cookie` value that starts a preview (a valid `?__draft=` on an
309
+ * allowed host) or ends one (`?__draft=off`, on any host); `null` otherwise.
310
+ */
311
+ draftCookie(request: RequestLike): Promise<string | null>;
253
312
  }