@prismicio/client 6.0.0-beta.0 → 6.0.0-beta.1

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.
package/dist/index.d.ts CHANGED
@@ -1,1297 +1,1210 @@
1
1
  import * as prismicT from '@prismicio/types';
2
2
  import * as prismicH from '@prismicio/helpers';
3
3
 
4
- /**
5
- * Get a repository's Prismic REST API V2 endpoint.
6
- *
7
- * @typeParam RepositoryName - Name of the Prismic repository.
8
- * @param repositoryName - Name of the repository.
9
- *
10
- * @returns The repository's Prismic REST API V2 endpoint
11
- */
4
+ /**
5
+ * Get a repository's Prismic REST API V2 endpoint.
6
+ *
7
+ * @typeParam RepositoryName - Name of the Prismic repository.
8
+ * @param repositoryName - Name of the repository.
9
+ *
10
+ * @returns The repository's Prismic REST API V2 endpoint
11
+ */
12
12
  declare const getEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
13
13
 
14
- /**
15
- * A universal API to make network requests. A subset of the `fetch()` API.
16
- */
17
- declare type FetchLike = (input: string, init?: RequestInitLike) => Promise<ResponseLike>;
18
- /**
19
- * The minimum required properties from RequestInit.
20
- */
21
- interface RequestInitLike {
22
- headers?: Record<string, string>;
23
- }
24
- /**
25
- * The minimum required properties from Response.
26
- */
27
- interface ResponseLike {
28
- status: number;
29
- json(): Promise<any>;
30
- }
31
- /**
32
- * The minimum required properties to treat as an HTTP Request for automatic
33
- * Prismic preview support.
34
- */
35
- interface HttpRequestLike {
36
- headers?: {
37
- cookie?: string;
38
- };
39
- query?: Record<string, unknown>;
40
- }
41
- /**
42
- * An `orderings` parameter that orders the results by the specified field.
43
- *
44
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}
45
- */
46
- interface Ordering {
47
- field: string;
48
- direction?: "asc" | "desc";
49
- }
50
- /**
51
- * A `routes` parameter that determines how a document's URL field is resolved.
52
- *
53
- * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
54
- */
55
- interface Route {
56
- /**
57
- * The Custom Type of the document.
58
- */
59
- type: string;
60
- /**
61
- * The resolved path of the document with optional placeholders.
62
- */
63
- path: string;
64
- /**
65
- * An object that lists the API IDs of the Content Relationships in the route.
66
- */
67
- resolvers?: Record<string, string>;
14
+ /**
15
+ * A universal API to make network requests. A subset of the `fetch()` API.
16
+ */
17
+ declare type FetchLike = (input: string, init?: RequestInitLike) => Promise<ResponseLike>;
18
+ /**
19
+ * The minimum required properties from RequestInit.
20
+ */
21
+ interface RequestInitLike {
22
+ headers?: Record<string, string>;
23
+ }
24
+ /**
25
+ * The minimum required properties from Response.
26
+ */
27
+ interface ResponseLike {
28
+ status: number;
29
+ json(): Promise<any>;
30
+ }
31
+ /**
32
+ * The minimum required properties to treat as an HTTP Request for automatic
33
+ * Prismic preview support.
34
+ */
35
+ interface HttpRequestLike {
36
+ headers?: {
37
+ cookie?: string;
38
+ };
39
+ query?: Record<string, unknown>;
40
+ }
41
+ /**
42
+ * An `orderings` parameter that orders the results by the specified field.
43
+ *
44
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}
45
+ */
46
+ interface Ordering {
47
+ field: string;
48
+ direction?: "asc" | "desc";
49
+ }
50
+ /**
51
+ * A `routes` parameter that determines how a document's URL field is resolved.
52
+ *
53
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
54
+ */
55
+ interface Route {
56
+ /**
57
+ * The Custom Type of the document.
58
+ */
59
+ type: string;
60
+ /**
61
+ * The resolved path of the document with optional placeholders.
62
+ */
63
+ path: string;
64
+ /**
65
+ * An object that lists the API IDs of the Content Relationships in the route.
66
+ */
67
+ resolvers?: Record<string, string>;
68
68
  }
69
69
 
70
- /**
71
- * Parameters for the Prismic REST API V2.
72
- *
73
- * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}
74
- */
75
- interface QueryParams {
76
- /**
77
- * The secure token for accessing the API (only needed if your repository is
78
- * set to private).
79
- *
80
- * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
81
- */
82
- accessToken?: string;
83
- /**
84
- * The `pageSize` parameter defines the maximum number of documents that the
85
- * API will return for your query.
86
- *
87
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#pagesize}
88
- */
89
- pageSize?: number;
90
- /**
91
- * The `page` parameter defines the pagination for the result of your query.
92
- *
93
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#page}
94
- */
95
- page?: number;
96
- /**
97
- * The `after` parameter can be used along with the orderings option. It will
98
- * remove all the documents except for those after the specified document in the list.
99
- *
100
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#after}
101
- */
102
- after?: string;
103
- /**
104
- * The `fetch` parameter is used to make queries faster by only retrieving the
105
- * specified field(s).
106
- *
107
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetch}
108
- */
109
- fetch?: string | string[];
110
- /**
111
- * The `fetchLinks` parameter allows you to retrieve a specific content field
112
- * from a linked document and add it to the document response object.
113
- *
114
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetchlinks}
115
- */
116
- fetchLinks?: string | string[];
117
- /**
118
- * The `graphQuery` parameter allows you to specify which fields to retrieve
119
- * and what content to retrieve from Linked Documents / Content Relationships.
120
- *
121
- * {@link https://prismic.io/docs/technologies/graphquery-rest-api}
122
- */
123
- graphQuery?: string;
124
- /**
125
- * The `lang` option defines the language code for the results of your query.
126
- *
127
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#lang}
128
- */
129
- lang?: string;
130
- /**
131
- * The `orderings` parameter orders the results by the specified field(s). You
132
- * can specify as many fields as you want.
133
- *
134
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}
135
- */
136
- orderings?: Ordering | string | (Ordering | string)[];
137
- /**
138
- * The `routes` option allows you to define how a document's `url` field is resolved.
139
- *
140
- * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
141
- */
142
- routes?: Route | string | (Route | string)[];
143
- }
144
- /**
145
- * Arguments for `buildQueryURL` to construct a Query URL.
146
- */
147
- declare type BuildQueryURLParams = {
148
- /**
149
- * Ref used to query documents.
150
- *
151
- * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}
152
- */
153
- ref: string;
154
- /**
155
- * Ref used to populate Integration Fields with the latest content.
156
- *
157
- * {@link https://prismic.io/docs/core-concepts/integration-fields}
158
- */
159
- integrationFieldsRef?: string;
160
- /**
161
- * One or more predicates to filter documents for the query.
162
- *
163
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}
164
- */
165
- predicates?: string | string[];
166
- };
167
- declare type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;
168
- /**
169
- * Build a Prismic REST API V2 URL to request documents from a repository. The
170
- * paginated response for this URL includes documents matching the parameters.
171
- *
172
- * A ref is required to make a request. Request the `endpoint` URL to retrieve a
173
- * list of available refs.
174
- *
175
- * Type the JSON response with `Query`.
176
- *
177
- * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}
178
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}
179
- *
180
- * @param endpoint - URL to the repository's REST API V2.
181
- * @param args - Arguments to filter and scope the query.
182
- *
183
- * @returns URL that can be used to request documents from the repository.
184
- */
70
+ /**
71
+ * Parameters for the Prismic REST API V2.
72
+ *
73
+ * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}
74
+ */
75
+ interface QueryParams {
76
+ /**
77
+ * The secure token for accessing the API (only needed if your repository is
78
+ * set to private).
79
+ *
80
+ * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
81
+ */
82
+ accessToken?: string;
83
+ /**
84
+ * The `pageSize` parameter defines the maximum number of documents that the
85
+ * API will return for your query.
86
+ *
87
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#pagesize}
88
+ */
89
+ pageSize?: number;
90
+ /**
91
+ * The `page` parameter defines the pagination for the result of your query.
92
+ *
93
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#page}
94
+ */
95
+ page?: number;
96
+ /**
97
+ * The `after` parameter can be used along with the orderings option. It will
98
+ * remove all the documents except for those after the specified document in the list.
99
+ *
100
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#after}
101
+ */
102
+ after?: string;
103
+ /**
104
+ * The `fetch` parameter is used to make queries faster by only retrieving the
105
+ * specified field(s).
106
+ *
107
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetch}
108
+ */
109
+ fetch?: string | string[];
110
+ /**
111
+ * The `fetchLinks` parameter allows you to retrieve a specific content field
112
+ * from a linked document and add it to the document response object.
113
+ *
114
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetchlinks}
115
+ */
116
+ fetchLinks?: string | string[];
117
+ /**
118
+ * The `graphQuery` parameter allows you to specify which fields to retrieve
119
+ * and what content to retrieve from Linked Documents / Content Relationships.
120
+ *
121
+ * {@link https://prismic.io/docs/technologies/graphquery-rest-api}
122
+ */
123
+ graphQuery?: string;
124
+ /**
125
+ * The `lang` option defines the language code for the results of your query.
126
+ *
127
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#lang}
128
+ */
129
+ lang?: string;
130
+ /**
131
+ * The `orderings` parameter orders the results by the specified field(s). You
132
+ * can specify as many fields as you want.
133
+ *
134
+ * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}
135
+ */
136
+ orderings?: Ordering | string | (Ordering | string)[];
137
+ /**
138
+ * The `routes` option allows you to define how a document's `url` field is resolved.
139
+ *
140
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
141
+ */
142
+ routes?: Route | string | (Route | string)[];
143
+ }
144
+ /**
145
+ * Arguments for `buildQueryURL` to construct a Query URL.
146
+ */
147
+ declare type BuildQueryURLParams = {
148
+ /**
149
+ * Ref used to query documents.
150
+ *
151
+ * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}
152
+ */
153
+ ref: string;
154
+ /**
155
+ * Ref used to populate Integration Fields with the latest content.
156
+ *
157
+ * {@link https://prismic.io/docs/core-concepts/integration-fields}
158
+ */
159
+ integrationFieldsRef?: string;
160
+ /**
161
+ * One or more predicates to filter documents for the query.
162
+ *
163
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}
164
+ */
165
+ predicates?: string | string[];
166
+ };
167
+ declare type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;
168
+ /**
169
+ * Build a Prismic REST API V2 URL to request documents from a repository. The
170
+ * paginated response for this URL includes documents matching the parameters.
171
+ *
172
+ * A ref is required to make a request. Request the `endpoint` URL to retrieve a
173
+ * list of available refs.
174
+ *
175
+ * Type the JSON response with `Query`.
176
+ *
177
+ * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}
178
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}
179
+ *
180
+ * @param endpoint - URL to the repository's REST API V2.
181
+ * @param args - Arguments to filter and scope the query.
182
+ *
183
+ * @returns URL that can be used to request documents from the repository.
184
+ */
185
185
  declare const buildQueryURL: (endpoint: string, args: BuildQueryURLArgs) => string;
186
186
 
187
- /**
188
- * A ref or a function that returns a ref. If a static ref is known, one can be
189
- * given. If the ref must be fetched on-demand, a function can be provided. This
190
- * function can optionally be asynchronous.
191
- */
192
- declare type RefStringOrThunk = string | (() => string | undefined | Promise<string | undefined>);
193
- /**
194
- * Configuration for clients that determine how content is queried.
195
- */
196
- declare type ClientConfig = {
197
- /**
198
- * The secure token for accessing the Prismic repository. This is only
199
- * required if the repository is set to private.
200
- */
201
- accessToken?: string;
202
- /**
203
- * A string representing a version of the Prismic repository's content. This
204
- * may point to the latest version (called the "master ref"), or a preview
205
- * with draft content.
206
- */
207
- ref?: RefStringOrThunk;
208
- /**
209
- * A string representing a version of the Prismic repository's Integration
210
- * Fields content.
211
- */
212
- integrationFieldsRef?: RefStringOrThunk;
213
- /**
214
- * A list of Route Resolver objects that define how a document's `url` field
215
- * is resolved.
216
- *
217
- * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
218
- */
219
- routes?: NonNullable<BuildQueryURLArgs["routes"]>;
220
- /**
221
- * Default parameters that will be sent with each query. These parameters can
222
- * be overridden on each query if needed.
223
- */
224
- defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
225
- /**
226
- * The function used to make network requests to the Prismic REST API. In
227
- * environments where a global `fetch` function does not exist, such as
228
- * Node.js, this function must be provided.
229
- */
230
- fetch?: FetchLike;
231
- };
232
- /**
233
- * Parameters specific to client methods that fetch all documents. These methods
234
- * start with `getAll` (for example, `getAllByType`).
235
- */
236
- declare type GetAllParams = {
237
- /**
238
- * Limit the number of documents queried. If a number is not provided, there
239
- * will be no limit and all matching documents will be returned.
240
- */
241
- limit?: number;
242
- };
243
- /**
244
- * Arguments to determine how the URL for a preview session is resolved.
245
- */
246
- declare type ResolvePreviewArgs = {
247
- /**
248
- * A function that maps a Prismic document to a URL within your app.
249
- */
250
- linkResolver?: prismicH.LinkResolverFunction;
251
- /**
252
- * A fallback URL if the Link Resolver does not return a value.
253
- */
254
- defaultURL: string;
255
- /**
256
- * The preview token (also known as a ref) that will be used to query preview
257
- * content from the Prismic repository.
258
- */
259
- previewToken?: string;
260
- /**
261
- * The previewed document that will be used to determine the destination URL.
262
- */
263
- documentID?: string;
264
- };
265
- /**
266
- * Creates a Prismic client that can be used to query a repository.
267
- *
268
- * @param endpoint - The Prismic REST API V2 endpoint for the repository (use
269
- * `prismic.getEndpoint` for the default endpoint).
270
- * @param options - Configuration that determines how content will be queried
271
- * from the Prismic repository.
272
- *
273
- * @returns A client that can query content from the repository.
274
- */
275
- declare const createClient: (endpoint: string, options?: ClientConfig | undefined) => Client;
276
- /**
277
- * A client that allows querying content from a Prismic repository.
278
- *
279
- * If used in an environment where a global `fetch` function is unavailable,
280
- * such as Node.js, the `fetch` option must be provided as part of the `options`
281
- * parameter.
282
- */
283
- declare class Client {
284
- /**
285
- * The Prismic REST API V2 endpoint for the repository (use
286
- * `prismic.getEndpoint` for the default endpoint).
287
- */
288
- endpoint: string;
289
- /**
290
- * The secure token for accessing the API (only needed if your repository is
291
- * set to private).
292
- *
293
- * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
294
- */
295
- accessToken?: string;
296
- /**
297
- * The client's Integration Fields ref for fetching the latest Integration Fields data.
298
- *
299
- * {@link https://prismic.io/docs/core-concepts/integration-fields}
300
- */
301
- integrationFieldsRef?: RefStringOrThunk;
302
- /**
303
- * A list of Route Resolver objects that define how a document's `url` field
304
- * is resolved.
305
- *
306
- * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
307
- */
308
- routes?: NonNullable<BuildQueryURLArgs["routes"]>;
309
- /**
310
- * The function used to make network requests to the Prismic REST API. In
311
- * environments where a global `fetch` function does not exist, such as
312
- * Node.js, this function must be provided.
313
- */
314
- fetchFn: FetchLike;
315
- /**
316
- * Default parameters that will be sent with each query. These parameters can
317
- * be overridden on each query if needed.
318
- */
319
- defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
320
- /**
321
- * The client's ref mode state. This determines which ref is used during queries.
322
- */
323
- private refMode;
324
- /**
325
- * Internal cache for low-level caching.
326
- */
327
- private internalCache;
328
- /**
329
- * Creates a Prismic client that can be used to query a repository.
330
- *
331
- * If used in an environment where a global `fetch` function is unavailable,
332
- * such as Node.js, the `fetch` option must be provided as part of the
333
- * `options` parameter.
334
- *
335
- * @param endpoint - The Prismic REST API V2 endpoint for the repository (use
336
- * `prismic.getEndpoint` to get the default endpoint).
337
- * @param options - Configuration that determines how content will be queried
338
- * from the Prismic repository.
339
- *
340
- * @returns A client that can query content from the repository.
341
- */
342
- constructor(endpoint: string, options?: ClientConfig);
343
- /**
344
- * Enables the client to automatically query content from a preview session if
345
- * one is active in browser environments. This is enabled by default in the browser.
346
- *
347
- * For server environments, use `enableAutoPreviewsFromReq`.
348
- *
349
- * @example
350
- *
351
- * ```ts
352
- * client.enableAutoPreviews();
353
- * ```
354
- *
355
- * @see enableAutoPreviewsFromReq
356
- */
357
- enableAutoPreviews(): void;
358
- /**
359
- * Enables the client to automatically query content from a preview session if
360
- * one is active in server environments. This is disabled by default on the server.
361
- *
362
- * For browser environments, use `enableAutoPreviews`.
363
- *
364
- * @example
365
- *
366
- * ```ts
367
- * // In an express app
368
- * app.get("/", function (req, res) {
369
- * client.enableAutoPreviewsFromReq(req);
370
- * });
371
- * ```
372
- *
373
- * @param req - An HTTP server request object containing the request's cookies.
374
- */
375
- enableAutoPreviewsFromReq<R extends HttpRequestLike>(req: R): void;
376
- /**
377
- * Disables the client from automatically querying content from a preview
378
- * session if one is active.
379
- *
380
- * Automatic preview content querying is enabled by default unless this method
381
- * is called.
382
- *
383
- * @example
384
- *
385
- * ```ts
386
- * client.disableAutoPreviews();
387
- * ```
388
- */
389
- disableAutoPreviews(): void;
390
- /**
391
- * Queries content from the Prismic repository.
392
- *
393
- * @deprecated Use `get` instead.
394
- * @example
395
- *
396
- * ```ts
397
- * const response = await client.get();
398
- * ```
399
- *
400
- * @typeParam TDocument - Type of Prismic documents returned.
401
- * @param params - Parameters to filter, sort, and paginate results.
402
- *
403
- * @returns A paginated response containing the result of the query.
404
- */
405
- query: <TDocument extends prismicT.PrismicDocument<Record<string, prismicT.AnyRegularField | prismicT.GroupField<Record<string, prismicT.AnyRegularField>> | prismicT.SliceZone<prismicT.Slice<string, Record<string, prismicT.AnyRegularField>, Record<string, prismicT.AnyRegularField>> | prismicT.SharedSlice<string, prismicT.SharedSliceVariation<string, Record<string, prismicT.AnyRegularField>, Record<string, prismicT.AnyRegularField>>>>>, string, string>>(params?: Partial<BuildQueryURLArgs> | undefined) => Promise<prismicT.Query<TDocument>>;
406
- /**
407
- * Queries content from the Prismic repository.
408
- *
409
- * @example
410
- *
411
- * ```ts
412
- * const response = await client.get();
413
- * ```
414
- *
415
- * @typeParam TDocument - Type of Prismic documents returned.
416
- * @param params - Parameters to filter, sort, and paginate results.
417
- *
418
- * @returns A paginated response containing the result of the query.
419
- */
420
- get<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
421
- /**
422
- * Queries content from the Prismic repository and returns only the first
423
- * result, if any.
424
- *
425
- * @example
426
- *
427
- * ```ts
428
- * const document = await client.getFirst();
429
- * ```
430
- *
431
- * @typeParam TDocument - Type of the Prismic document returned.
432
- * @param params - Parameters to filter, sort, and paginate results. @returns
433
- * The first result of the query, if any.
434
- */
435
- getFirst<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
436
- /**
437
- * Queries content from the Prismic repository and returns all matching
438
- * content. If no predicates are provided, all documents will be fetched.
439
- *
440
- * This method may make multiple network requests to query all matching content.
441
- *
442
- * @example
443
- *
444
- * ```ts
445
- * const response = await client.getAll();
446
- * ```
447
- *
448
- * @typeParam TDocument - Type of Prismic documents returned. @param params -
449
- * Parameters to filter, sort, and paginate results. @returns A list of
450
- * documents matching the query.
451
- */
452
- getAll<TDocument extends prismicT.PrismicDocument>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams): Promise<TDocument[]>;
453
- /**
454
- * Queries a document from the Prismic repository with a specific ID.
455
- *
456
- * @remarks
457
- * A document's UID is different from its ID. An ID is automatically generated
458
- * for all documents and is made available on its `id` property. A UID is
459
- * provided in the Prismic editor and is unique among all documents of its Custom Type.
460
- * @example
461
- *
462
- * ```ts
463
- * const document = await client.getByID("WW4bKScAAMAqmluX");
464
- * ```
465
- *
466
- * @typeParam TDocument- Type of the Prismic document returned.
467
- * @param id - ID of the document.
468
- * @param params - Parameters to filter, sort, and paginate the results.
469
- *
470
- * @returns The document with an ID matching the `id` parameter, if a matching
471
- * document exists.
472
- */
473
- getByID<TDocument extends prismicT.PrismicDocument>(id: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
474
- /**
475
- * Queries documents from the Prismic repository with specific IDs.
476
- *
477
- * @remarks
478
- * A document's UID is different from its ID. An ID is automatically generated
479
- * for all documents and is made available on its `id` property. A UID is
480
- * provided in the Prismic editor and is unique among all documents of its Custom Type.
481
- * @example
482
- *
483
- * ```ts
484
- * const response = await client.getByIDs([
485
- * "WW4bKScAAMAqmluX",
486
- * "U1kTRgEAAC8A5ldS",
487
- * ]);
488
- * ```
489
- *
490
- * @typeParam TDocument - Type of Prismic documents returned.
491
- * @param ids - A list of document IDs.
492
- * @param params - Parameters to filter, sort, and paginate the results.
493
- *
494
- * @returns A paginated response containing documents with IDs matching the
495
- * `ids` parameter.
496
- */
497
- getByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
498
- /**
499
- * Queries all documents from the Prismic repository with specific IDs.
500
- *
501
- * This method may make multiple network requests to query all matching content.
502
- *
503
- * @remarks
504
- * A document's UID is different from its ID. An ID is automatically generated
505
- * for all documents and is made available on its `id` property. A UID is
506
- * provided in the Prismic editor and is unique among all documents of its Custom Type.
507
- * @example
508
- *
509
- * ```ts
510
- * const response = await client.getAllByIDs([
511
- * "WW4bKScAAMAqmluX",
512
- * "U1kTRgEAAC8A5ldS",
513
- * ]);
514
- * ```
515
- *
516
- * @typeParam TDocument - Type of Prismic documents returned.
517
- * @param ids - A list of document IDs.
518
- * @param params - Parameters to filter, sort, and paginate the results.
519
- *
520
- * @returns A list of documents with IDs matching the `ids` parameter.
521
- */
522
- getAllByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
523
- /**
524
- * Queries a document from the Prismic repository with a specific UID and Custom Type.
525
- *
526
- * @remarks
527
- * A document's UID is different from its ID. An ID is automatically generated
528
- * for all documents and is made available on its `id` property. A UID is
529
- * provided in the Prismic editor and is unique among all documents of its Custom Type.
530
- * @example
531
- *
532
- * ```ts
533
- * const document = await client.getByUID("blog_post", "my-first-post");
534
- * ```
535
- *
536
- * @typeParam TDocument - Type of the Prismic document returned.
537
- * @param documentType - The API ID of the document's Custom Type.
538
- * @param uid - UID of the document.
539
- * @param params - Parameters to filter, sort, and paginate the results.
540
- *
541
- * @returns The document with a UID matching the `uid` parameter, if a
542
- * matching document exists.
543
- */
544
- getByUID<TDocument extends prismicT.PrismicDocument>(documentType: string, uid: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
545
- /**
546
- * Queries document from the Prismic repository with specific UIDs and Custom Type.
547
- *
548
- * @remarks
549
- * A document's UID is different from its ID. An ID is automatically generated
550
- * for all documents and is made available on its `id` property. A UID is
551
- * provided in the Prismic editor and is unique among all documents of its Custom Type.
552
- * @example
553
- *
554
- * ```ts
555
- * const document = await client.getByUIDs("blog_post", [
556
- * "my-first-post",
557
- * "my-second-post",
558
- * ]);
559
- * ```
560
- *
561
- * @typeParam TDocument - Type of the Prismic document returned.
562
- * @param documentType - The API ID of the document's Custom Type.
563
- * @param uids - A list of document UIDs.
564
- * @param params - Parameters to filter, sort, and paginate the results.
565
- *
566
- * @returns A paginated response containing documents with UIDs matching the
567
- * `uids` parameter.
568
- */
569
- getByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
570
- /**
571
- * Queries all documents from the Prismic repository with specific UIDs and Custom Type.
572
- *
573
- * This method may make multiple network requests to query all matching content.
574
- *
575
- * @remarks
576
- * A document's UID is different from its ID. An ID is automatically generated
577
- * for all documents and is made available on its `id` property. A UID is
578
- * provided in the Prismic editor and is unique among all documents of its Custom Type.
579
- * @example
580
- *
581
- * ```ts
582
- * const response = await client.getAllByUIDs([
583
- * "my-first-post",
584
- * "my-second-post",
585
- * ]);
586
- * ```
587
- *
588
- * @typeParam TDocument - Type of Prismic documents returned.
589
- * @param documentType - The API ID of the document's Custom Type.
590
- * @param uids - A list of document UIDs.
591
- * @param params - Parameters to filter, sort, and paginate the results.
592
- *
593
- * @returns A list of documents with UIDs matching the `uids` parameter.
594
- */
595
- getAllByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
596
- /**
597
- * Queries a singleton document from the Prismic repository for a specific Custom Type.
598
- *
599
- * @remarks
600
- * A singleton document is one that is configured in Prismic to only allow one
601
- * instance. For example, a repository may be configured to contain just one
602
- * Settings document. This is in contrast to a repeatable Custom Type which
603
- * allows multiple instances of itself.
604
- * @example
605
- *
606
- * ```ts
607
- * const document = await client.getSingle("settings");
608
- * ```
609
- *
610
- * @typeParam TDocument - Type of the Prismic document returned.
611
- * @param documentType - The API ID of the singleton Custom Type.
612
- * @param params - Parameters to filter, sort, and paginate the results.
613
- *
614
- * @returns The singleton document for the Custom Type, if a matching document exists.
615
- */
616
- getSingle<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
617
- /**
618
- * Queries documents from the Prismic repository for a specific Custom Type.
619
- *
620
- * Use `getAllByType` instead if you need to query all documents for a
621
- * specific Custom Type.
622
- *
623
- * @example
624
- *
625
- * ```ts
626
- * const response = await client.getByType("blog_post");
627
- * ```
628
- *
629
- * @typeParam TDocument - Type of Prismic documents returned.
630
- * @param documentType - The API ID of the Custom Type.
631
- * @param params - Parameters to filter, sort, and paginate the results.
632
- *
633
- * @returns A paginated response containing documents of the Custom Type.
634
- */
635
- getByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
636
- /**
637
- * Queries all documents from the Prismic repository for a specific Custom Type.
638
- *
639
- * This method may make multiple network requests to query all matching content.
640
- *
641
- * @example
642
- *
643
- * ```ts
644
- * const response = await client.getByType("blog_post");
645
- * ```
646
- *
647
- * @typeParam TDocument - Type of Prismic documents returned.
648
- * @param documentType - The API ID of the Custom Type.
649
- * @param params - Parameters to filter, sort, and paginate the results.
650
- *
651
- * @returns A list of all documents of the Custom Type.
652
- */
653
- getAllByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
654
- /**
655
- * Queries documents from the Prismic repository with a specific tag.
656
- *
657
- * Use `getAllByTag` instead if you need to query all documents with a specific tag.
658
- *
659
- * @example
660
- *
661
- * ```ts
662
- * const response = await client.getByTag("food");
663
- * ```
664
- *
665
- * @typeParam TDocument - Type of Prismic documents returned.
666
- * @param tag - The tag that must be included on a document.
667
- * @param params - Parameters to filter, sort, and paginate the results.
668
- *
669
- * @returns A paginated response containing documents with the tag.
670
- */
671
- getByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
672
- /**
673
- * Queries all documents from the Prismic repository with a specific tag.
674
- *
675
- * This method may make multiple network requests to query all matching content.
676
- *
677
- * @example
678
- *
679
- * ```ts
680
- * const response = await client.getAllByTag("food");
681
- * ```
682
- *
683
- * @typeParam TDocument - Type of Prismic documents returned.
684
- * @param tag - The tag that must be included on a document.
685
- * @param params - Parameters to filter, sort, and paginate the results.
686
- *
687
- * @returns A list of all documents with the tag.
688
- */
689
- getAllByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
690
- /**
691
- * Queries documents from the Prismic repository with a specific tag.
692
- *
693
- * @example
694
- *
695
- * ```ts
696
- * const response = await client.getAllByTag("food");
697
- * ```
698
- *
699
- * @typeParam TDocument - Type of Prismic documents returned.
700
- * @param tags - A list of tags that must be included on a document.
701
- * @param params - Parameters to filter, sort, and paginate the results.
702
- *
703
- * @returns A paginated response containing documents with the tag.
704
- */
705
- getByTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
706
- /**
707
- * Queries all documents from the Prismic repository with a specific tag.
708
- *
709
- * This method may make multiple network requests to query all matching content.
710
- *
711
- * @example
712
- *
713
- * ```ts
714
- * const response = await client.getAllByTag("food");
715
- * ```
716
- *
717
- * @typeParam TDocument - Type of Prismic documents returned.
718
- * @param tags - A list of tags that must be included on a document.
719
- * @param params - Parameters to filter, sort, and paginate the results.
720
- *
721
- * @returns A list of all documents with the tag.
722
- */
723
- getAllByTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
724
- /**
725
- * Returns metadata about the Prismic repository, such as its refs, releases,
726
- * and custom types.
727
- *
728
- * @returns Repository metadata.
729
- */
730
- getRepository(): Promise<prismicT.Repository>;
731
- /**
732
- * Returns a list of all refs for the Prismic repository.
733
- *
734
- * Refs are used to identify which version of the repository's content should
735
- * be queried. All repositories will have at least one ref pointing to the
736
- * latest published content called the "master ref".
737
- *
738
- * @returns A list of all refs for the Prismic repository.
739
- */
740
- getRefs(): Promise<prismicT.Ref[]>;
741
- /**
742
- * Returns a ref for the Prismic repository with a matching ID.
743
- *
744
- * @param id - ID of the ref.
745
- *
746
- * @returns The ref with a matching ID, if it exists.
747
- */
748
- getRefByID(id: string): Promise<prismicT.Ref>;
749
- /**
750
- * Returns a ref for the Prismic repository with a matching label.
751
- *
752
- * @param label - Label of the ref.
753
- *
754
- * @returns The ref with a matching label, if it exists.
755
- */
756
- getRefByLabel(label: string): Promise<prismicT.Ref>;
757
- /**
758
- * Returns the master ref for the Prismic repository. The master ref points to
759
- * the repository's latest published content.
760
- *
761
- * @returns The repository's master ref.
762
- */
763
- getMasterRef(): Promise<prismicT.Ref>;
764
- /**
765
- * Returns a list of all Releases for the Prismic repository. Releases are
766
- * used to group content changes before publishing.
767
- *
768
- * @returns A list of all Releases for the Prismic repository.
769
- */
770
- getReleases(): Promise<prismicT.Ref[]>;
771
- /**
772
- * Returns a Release for the Prismic repository with a matching ID.
773
- *
774
- * @param id - ID of the Release.
775
- *
776
- * @returns The Release with a matching ID, if it exists.
777
- */
778
- getReleaseByID(id: string): Promise<prismicT.Ref>;
779
- /**
780
- * Returns a Release for the Prismic repository with a matching label.
781
- *
782
- * @param label - Label of the ref.
783
- *
784
- * @returns The ref with a matching label, if it exists.
785
- */
786
- getReleaseByLabel(label: string): Promise<prismicT.Ref>;
787
- /**
788
- * Returns a list of all tags used in the Prismic repository.
789
- *
790
- * @returns A list of all tags used in the repository.
791
- */
792
- getTags(): Promise<string[]>;
793
- /**
794
- * Builds a URL used to query content from the Prismic repository.
795
- *
796
- * @param params - Parameters to filter, sort, and paginate the results.
797
- *
798
- * @returns A URL string that can be requested to query content.
799
- */
800
- buildQueryURL(params?: Partial<BuildQueryURLArgs>): Promise<string>;
801
- /**
802
- * Determines the URL for a previewed document during an active preview
803
- * session. The result of this method should be used to redirect the user to
804
- * the document's URL.
805
- *
806
- * @example
807
- *
808
- * ```ts
809
- * const url = client.resolvePreviewURL({
810
- * linkResolver: (document) => `/${document.uid}`
811
- * defaultURL: '/'
812
- * })
813
- * ```
814
- *
815
- * @param args - Arguments to configure the URL resolving.
816
- *
817
- * @returns The URL for the previewed document during an active preview
818
- * session. The user should be redirected to this URL.
819
- */
820
- resolvePreviewURL(args: ResolvePreviewArgs): Promise<string>;
821
- /**
822
- * Configures the client to query the latest published content for all future queries.
823
- *
824
- * If the `ref` parameter is provided during a query, it takes priority for that query.
825
- *
826
- * @example
827
- *
828
- * ```ts
829
- * await client.queryLatestContent();
830
- * const document = await client.getByID("WW4bKScAAMAqmluX");
831
- * ```
832
- */
833
- queryLatestContent(): void;
834
- /**
835
- * Configures the client to query content from a specific Release identified
836
- * by its ID for all future queries.
837
- *
838
- * If the `ref` parameter is provided during a query, it takes priority for that query.
839
- *
840
- * @example
841
- *
842
- * ```ts
843
- * await client.queryContentFromReleaseByID("YLB7OBAAACMA7Cpa");
844
- * const document = await client.getByID("WW4bKScAAMAqmluX");
845
- * ```
846
- *
847
- * @param id - The ID of the Release.
848
- */
849
- queryContentFromReleaseByID(releaseID: string): void;
850
- /**
851
- * Configures the client to query content from a specific Release identified
852
- * by its label for all future queries.
853
- *
854
- * If the `ref` parameter is provided during a query, it takes priority for that query.
855
- *
856
- * @example
857
- *
858
- * ```ts
859
- * await client.queryContentFromReleaseByLabel("My Release");
860
- * const document = await client.getByID("WW4bKScAAMAqmluX");
861
- * ```
862
- *
863
- * @param label - The label of the Release.
864
- */
865
- queryContentFromReleaseByLabel(releaseLabel: string): void;
866
- /**
867
- * Configures the client to query content from a specific ref. The ref can be
868
- * provided as a string or a function.
869
- *
870
- * If a function is provided, the ref is fetched lazily before each query. The
871
- * function may also be asynchronous.
872
- *
873
- * @example
874
- *
875
- * ```ts
876
- * await client.queryContentFromRef("my-ref");
877
- * const document = await client.getByID("WW4bKScAAMAqmluX");
878
- * ```
879
- *
880
- * @param ref - The ref or a function that returns the ref from which to query content.
881
- */
882
- queryContentFromRef(ref: RefStringOrThunk): void;
883
- /**
884
- * Returns a cached version of `getRepository` with a TTL.
885
- *
886
- * @returns Cached repository metadata.
887
- */
888
- private getCachedRepository;
889
- /**
890
- * Returns a cached Prismic repository form. Forms are used to determine API
891
- * endpoints for types of repository data.
892
- *
893
- * @param name - Name of the form.
894
- *
895
- * @returns The repository form.
896
- * @throws If a matching form cannot be found.
897
- */
898
- private getCachedRepositoryForm;
899
- /**
900
- * Returns the preview ref for the client, if one exists.
901
- *
902
- * If this method is used in the browser, the browser's cookies will be read.
903
- * If this method is used on the server, the cookies from the saved HTTP
904
- * Request will be read, if an HTTP Request was given.
905
- *
906
- * @returns The preview ref as a string, if one exists.
907
- */
908
- private getPreviewRefString;
909
- /**
910
- * Returns the Integration Fields ref for the client, if one exists. This ref
911
- * is used to fetch the latest content from a Integration Field's API.
912
- *
913
- * @returns The repository's Integration Fields ref.
914
- */
915
- private getIntegrationFieldsRef;
916
- /**
917
- * Returns the Integration Fields ref neeed to query based on the client's
918
- * configuration. This method may make a network request to fetch a ref or
919
- * resolve the user's Integration Field ref thunk.
920
- *
921
- * @returns The repository's Integration Fields ref, if one is available.
922
- */
923
- private getResolvedIntegrationFieldsRef;
924
- /**
925
- * Returns the ref needed to query based on the client's current state. This
926
- * method may make a network request to fetch a ref or resolve the user's ref thunk.
927
- *
928
- * If auto previews are enabled, the preview ref takes priority if available.
929
- *
930
- * The following strategies are used depending on the client's state:
931
- *
932
- * - If the user called `queryLatestContent`: Use the repository's master ref.
933
- * The ref is cached for 5 seconds. After 5 seconds, a new master ref is fetched.
934
- * - If the user called `queryContentFromReleaseByID`: Use the release's ref.
935
- * The ref is cached for 5 seconds. After 5 seconds, a new ref for the
936
- * release is fetched.
937
- * - If the user called `queryContentFromReleaseByLabel`: Use the release's ref.
938
- * The ref is cached for 5 seconds. After 5 seconds, a new ref for the
939
- * release is fetched.
940
- * - If the user called `queryContentFromRef`: Use the provided ref. Fall back
941
- * to the master ref if the ref is not a string.
942
- *
943
- * @returns The ref to use during a query.
944
- */
945
- private getResolvedRefString;
946
- /**
947
- * Returns the network request options required by the Prismic repository.
948
- *
949
- * It currently only includes an Authorization header if an access token is provided.
950
- *
951
- * @param params - Parameters for the query, including an access token.
952
- *
953
- * @returns Request options that can be used to make a network request to
954
- * query the repository.
955
- */
956
- /**
957
- * Performs a network request using the configured `fetch` function. It
958
- * assumes all successful responses will have a JSON content type. It also
959
- * normalizes unsuccessful network requests.
960
- *
961
- * @typeParam T - The JSON response.
962
- * @param url - URL to the resource to fetch.
963
- * @param params - Prismic REST API parameters for the network request.
964
- *
965
- * @returns The JSON response from the network request.
966
- */
967
- private fetch;
187
+ /**
188
+ * A ref or a function that returns a ref. If a static ref is known, one can be
189
+ * given. If the ref must be fetched on-demand, a function can be provided. This
190
+ * function can optionally be asynchronous.
191
+ */
192
+ declare type RefStringOrThunk = string | (() => string | undefined | Promise<string | undefined>);
193
+ /**
194
+ * Configuration for clients that determine how content is queried.
195
+ */
196
+ declare type ClientConfig = {
197
+ /**
198
+ * The secure token for accessing the Prismic repository. This is only
199
+ * required if the repository is set to private.
200
+ */
201
+ accessToken?: string;
202
+ /**
203
+ * A string representing a version of the Prismic repository's content. This
204
+ * may point to the latest version (called the "master ref"), or a preview
205
+ * with draft content.
206
+ */
207
+ ref?: RefStringOrThunk;
208
+ /**
209
+ * A list of Route Resolver objects that define how a document's `url` field
210
+ * is resolved.
211
+ *
212
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
213
+ */
214
+ routes?: NonNullable<BuildQueryURLArgs["routes"]>;
215
+ /**
216
+ * Default parameters that will be sent with each query. These parameters can
217
+ * be overridden on each query if needed.
218
+ */
219
+ defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
220
+ /**
221
+ * The function used to make network requests to the Prismic REST API. In
222
+ * environments where a global `fetch` function does not exist, such as
223
+ * Node.js, this function must be provided.
224
+ */
225
+ fetch?: FetchLike;
226
+ };
227
+ /**
228
+ * Parameters specific to client methods that fetch all documents. These methods
229
+ * start with `getAll` (for example, `getAllByType`).
230
+ */
231
+ declare type GetAllParams = {
232
+ /**
233
+ * Limit the number of documents queried. If a number is not provided, there
234
+ * will be no limit and all matching documents will be returned.
235
+ */
236
+ limit?: number;
237
+ };
238
+ /**
239
+ * Arguments to determine how the URL for a preview session is resolved.
240
+ */
241
+ declare type ResolvePreviewArgs = {
242
+ /**
243
+ * A function that maps a Prismic document to a URL within your app.
244
+ */
245
+ linkResolver?: prismicH.LinkResolverFunction;
246
+ /**
247
+ * A fallback URL if the Link Resolver does not return a value.
248
+ */
249
+ defaultURL: string;
250
+ /**
251
+ * The preview token (also known as a ref) that will be used to query preview
252
+ * content from the Prismic repository.
253
+ */
254
+ previewToken?: string;
255
+ /**
256
+ * The previewed document that will be used to determine the destination URL.
257
+ */
258
+ documentID?: string;
259
+ };
260
+ /**
261
+ * Creates a Prismic client that can be used to query a repository.
262
+ *
263
+ * @param endpoint - The Prismic REST API V2 endpoint for the repository (use
264
+ * `prismic.getEndpoint` for the default endpoint).
265
+ * @param options - Configuration that determines how content will be queried
266
+ * from the Prismic repository.
267
+ *
268
+ * @returns A client that can query content from the repository.
269
+ */
270
+ declare const createClient: (endpoint: string, options?: ClientConfig | undefined) => Client;
271
+ /**
272
+ * A client that allows querying content from a Prismic repository.
273
+ *
274
+ * If used in an environment where a global `fetch` function is unavailable,
275
+ * such as Node.js, the `fetch` option must be provided as part of the `options`
276
+ * parameter.
277
+ */
278
+ declare class Client {
279
+ /**
280
+ * The Prismic REST API V2 endpoint for the repository (use
281
+ * `prismic.getEndpoint` for the default endpoint).
282
+ */
283
+ endpoint: string;
284
+ /**
285
+ * The secure token for accessing the API (only needed if your repository is
286
+ * set to private).
287
+ *
288
+ * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
289
+ */
290
+ accessToken?: string;
291
+ /**
292
+ * A list of Route Resolver objects that define how a document's `url` field
293
+ * is resolved.
294
+ *
295
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
296
+ */
297
+ routes?: NonNullable<BuildQueryURLArgs["routes"]>;
298
+ /**
299
+ * The function used to make network requests to the Prismic REST API. In
300
+ * environments where a global `fetch` function does not exist, such as
301
+ * Node.js, this function must be provided.
302
+ */
303
+ fetchFn: FetchLike;
304
+ /**
305
+ * Default parameters that will be sent with each query. These parameters can
306
+ * be overridden on each query if needed.
307
+ */
308
+ defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
309
+ /**
310
+ * The client's ref mode state. This determines which ref is used during queries.
311
+ */
312
+ private refState;
313
+ /**
314
+ * Cached repository value.
315
+ */
316
+ private cachedRepository;
317
+ /**
318
+ * Timestamp at which the cached repository data is considered stale.
319
+ */
320
+ private cachedRepositoryExpiration;
321
+ /**
322
+ * Creates a Prismic client that can be used to query a repository.
323
+ *
324
+ * If used in an environment where a global `fetch` function is unavailable,
325
+ * such as Node.js, the `fetch` option must be provided as part of the
326
+ * `options` parameter.
327
+ *
328
+ * @param endpoint - The Prismic REST API V2 endpoint for the repository (use
329
+ * `prismic.getEndpoint` to get the default endpoint).
330
+ * @param options - Configuration that determines how content will be queried
331
+ * from the Prismic repository.
332
+ *
333
+ * @returns A client that can query content from the repository.
334
+ */
335
+ constructor(endpoint: string, options?: ClientConfig);
336
+ /**
337
+ * Enables the client to automatically query content from a preview session if
338
+ * one is active in browser environments. This is enabled by default in the browser.
339
+ *
340
+ * For server environments, use `enableAutoPreviewsFromReq`.
341
+ *
342
+ * @example
343
+ *
344
+ * ```ts
345
+ * client.enableAutoPreviews();
346
+ * ```
347
+ *
348
+ * @see enableAutoPreviewsFromReq
349
+ */
350
+ enableAutoPreviews(): void;
351
+ /**
352
+ * Enables the client to automatically query content from a preview session if
353
+ * one is active in server environments. This is disabled by default on the server.
354
+ *
355
+ * For browser environments, use `enableAutoPreviews`.
356
+ *
357
+ * @example
358
+ *
359
+ * ```ts
360
+ * // In an express app
361
+ * app.get("/", function (req, res) {
362
+ * client.enableAutoPreviewsFromReq(req);
363
+ * });
364
+ * ```
365
+ *
366
+ * @param req - An HTTP server request object containing the request's cookies.
367
+ */
368
+ enableAutoPreviewsFromReq<R extends HttpRequestLike>(req: R): void;
369
+ /**
370
+ * Disables the client from automatically querying content from a preview
371
+ * session if one is active.
372
+ *
373
+ * Automatic preview content querying is enabled by default unless this method
374
+ * is called.
375
+ *
376
+ * @example
377
+ *
378
+ * ```ts
379
+ * client.disableAutoPreviews();
380
+ * ```
381
+ */
382
+ disableAutoPreviews(): void;
383
+ /**
384
+ * Queries content from the Prismic repository.
385
+ *
386
+ * @deprecated Use `get` instead.
387
+ * @example
388
+ *
389
+ * ```ts
390
+ * const response = await client.query(
391
+ * prismic.predicate.at("document.type", "page"),
392
+ * );
393
+ * ```
394
+ *
395
+ * @typeParam TDocument - Type of Prismic documents returned.
396
+ * @param params - Parameters to filter, sort, and paginate results.
397
+ *
398
+ * @returns A paginated response containing the result of the query.
399
+ */
400
+ query<TDocument extends prismicT.PrismicDocument>(predicates: NonNullable<BuildQueryURLArgs["predicates"]>, params?: Partial<Omit<BuildQueryURLArgs, "predicates">>): Promise<prismicT.Query<TDocument>>;
401
+ /**
402
+ * Queries content from the Prismic repository.
403
+ *
404
+ * @example
405
+ *
406
+ * ```ts
407
+ * const response = await client.get();
408
+ * ```
409
+ *
410
+ * @typeParam TDocument - Type of Prismic documents returned.
411
+ * @param params - Parameters to filter, sort, and paginate results.
412
+ *
413
+ * @returns A paginated response containing the result of the query.
414
+ */
415
+ get<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
416
+ /**
417
+ * Queries content from the Prismic repository and returns only the first
418
+ * result, if any.
419
+ *
420
+ * @example
421
+ *
422
+ * ```ts
423
+ * const document = await client.getFirst();
424
+ * ```
425
+ *
426
+ * @typeParam TDocument - Type of the Prismic document returned.
427
+ * @param params - Parameters to filter, sort, and paginate results. @returns
428
+ * The first result of the query, if any.
429
+ */
430
+ getFirst<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
431
+ /**
432
+ * Queries content from the Prismic repository and returns all matching
433
+ * content. If no predicates are provided, all documents will be fetched.
434
+ *
435
+ * This method may make multiple network requests to query all matching content.
436
+ *
437
+ * @example
438
+ *
439
+ * ```ts
440
+ * const response = await client.getAll();
441
+ * ```
442
+ *
443
+ * @typeParam TDocument - Type of Prismic documents returned. @param params -
444
+ * Parameters to filter, sort, and paginate results. @returns A list of
445
+ * documents matching the query.
446
+ */
447
+ getAll<TDocument extends prismicT.PrismicDocument>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams): Promise<TDocument[]>;
448
+ /**
449
+ * Queries a document from the Prismic repository with a specific ID.
450
+ *
451
+ * @remarks
452
+ * A document's UID is different from its ID. An ID is automatically generated
453
+ * for all documents and is made available on its `id` property. A UID is
454
+ * provided in the Prismic editor and is unique among all documents of its Custom Type.
455
+ * @example
456
+ *
457
+ * ```ts
458
+ * const document = await client.getByID("WW4bKScAAMAqmluX");
459
+ * ```
460
+ *
461
+ * @typeParam TDocument- Type of the Prismic document returned.
462
+ * @param id - ID of the document.
463
+ * @param params - Parameters to filter, sort, and paginate the results.
464
+ *
465
+ * @returns The document with an ID matching the `id` parameter, if a matching
466
+ * document exists.
467
+ */
468
+ getByID<TDocument extends prismicT.PrismicDocument>(id: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
469
+ /**
470
+ * Queries documents from the Prismic repository with specific IDs.
471
+ *
472
+ * @remarks
473
+ * A document's UID is different from its ID. An ID is automatically generated
474
+ * for all documents and is made available on its `id` property. A UID is
475
+ * provided in the Prismic editor and is unique among all documents of its Custom Type.
476
+ * @example
477
+ *
478
+ * ```ts
479
+ * const response = await client.getByIDs([
480
+ * "WW4bKScAAMAqmluX",
481
+ * "U1kTRgEAAC8A5ldS",
482
+ * ]);
483
+ * ```
484
+ *
485
+ * @typeParam TDocument - Type of Prismic documents returned.
486
+ * @param ids - A list of document IDs.
487
+ * @param params - Parameters to filter, sort, and paginate the results.
488
+ *
489
+ * @returns A paginated response containing documents with IDs matching the
490
+ * `ids` parameter.
491
+ */
492
+ getByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
493
+ /**
494
+ * Queries all documents from the Prismic repository with specific IDs.
495
+ *
496
+ * This method may make multiple network requests to query all matching content.
497
+ *
498
+ * @remarks
499
+ * A document's UID is different from its ID. An ID is automatically generated
500
+ * for all documents and is made available on its `id` property. A UID is
501
+ * provided in the Prismic editor and is unique among all documents of its Custom Type.
502
+ * @example
503
+ *
504
+ * ```ts
505
+ * const response = await client.getAllByIDs([
506
+ * "WW4bKScAAMAqmluX",
507
+ * "U1kTRgEAAC8A5ldS",
508
+ * ]);
509
+ * ```
510
+ *
511
+ * @typeParam TDocument - Type of Prismic documents returned.
512
+ * @param ids - A list of document IDs.
513
+ * @param params - Parameters to filter, sort, and paginate the results.
514
+ *
515
+ * @returns A list of documents with IDs matching the `ids` parameter.
516
+ */
517
+ getAllByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
518
+ /**
519
+ * Queries a document from the Prismic repository with a specific UID and Custom Type.
520
+ *
521
+ * @remarks
522
+ * A document's UID is different from its ID. An ID is automatically generated
523
+ * for all documents and is made available on its `id` property. A UID is
524
+ * provided in the Prismic editor and is unique among all documents of its Custom Type.
525
+ * @example
526
+ *
527
+ * ```ts
528
+ * const document = await client.getByUID("blog_post", "my-first-post");
529
+ * ```
530
+ *
531
+ * @typeParam TDocument - Type of the Prismic document returned.
532
+ * @param documentType - The API ID of the document's Custom Type.
533
+ * @param uid - UID of the document.
534
+ * @param params - Parameters to filter, sort, and paginate the results.
535
+ *
536
+ * @returns The document with a UID matching the `uid` parameter, if a
537
+ * matching document exists.
538
+ */
539
+ getByUID<TDocument extends prismicT.PrismicDocument>(documentType: string, uid: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
540
+ /**
541
+ * Queries document from the Prismic repository with specific UIDs and Custom Type.
542
+ *
543
+ * @remarks
544
+ * A document's UID is different from its ID. An ID is automatically generated
545
+ * for all documents and is made available on its `id` property. A UID is
546
+ * provided in the Prismic editor and is unique among all documents of its Custom Type.
547
+ * @example
548
+ *
549
+ * ```ts
550
+ * const document = await client.getByUIDs("blog_post", [
551
+ * "my-first-post",
552
+ * "my-second-post",
553
+ * ]);
554
+ * ```
555
+ *
556
+ * @typeParam TDocument - Type of the Prismic document returned.
557
+ * @param documentType - The API ID of the document's Custom Type.
558
+ * @param uids - A list of document UIDs.
559
+ * @param params - Parameters to filter, sort, and paginate the results.
560
+ *
561
+ * @returns A paginated response containing documents with UIDs matching the
562
+ * `uids` parameter.
563
+ */
564
+ getByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
565
+ /**
566
+ * Queries all documents from the Prismic repository with specific UIDs and Custom Type.
567
+ *
568
+ * This method may make multiple network requests to query all matching content.
569
+ *
570
+ * @remarks
571
+ * A document's UID is different from its ID. An ID is automatically generated
572
+ * for all documents and is made available on its `id` property. A UID is
573
+ * provided in the Prismic editor and is unique among all documents of its Custom Type.
574
+ * @example
575
+ *
576
+ * ```ts
577
+ * const response = await client.getAllByUIDs([
578
+ * "my-first-post",
579
+ * "my-second-post",
580
+ * ]);
581
+ * ```
582
+ *
583
+ * @typeParam TDocument - Type of Prismic documents returned.
584
+ * @param documentType - The API ID of the document's Custom Type.
585
+ * @param uids - A list of document UIDs.
586
+ * @param params - Parameters to filter, sort, and paginate the results.
587
+ *
588
+ * @returns A list of documents with UIDs matching the `uids` parameter.
589
+ */
590
+ getAllByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
591
+ /**
592
+ * Queries a singleton document from the Prismic repository for a specific Custom Type.
593
+ *
594
+ * @remarks
595
+ * A singleton document is one that is configured in Prismic to only allow one
596
+ * instance. For example, a repository may be configured to contain just one
597
+ * Settings document. This is in contrast to a repeatable Custom Type which
598
+ * allows multiple instances of itself.
599
+ * @example
600
+ *
601
+ * ```ts
602
+ * const document = await client.getSingle("settings");
603
+ * ```
604
+ *
605
+ * @typeParam TDocument - Type of the Prismic document returned.
606
+ * @param documentType - The API ID of the singleton Custom Type.
607
+ * @param params - Parameters to filter, sort, and paginate the results.
608
+ *
609
+ * @returns The singleton document for the Custom Type, if a matching document exists.
610
+ */
611
+ getSingle<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
612
+ /**
613
+ * Queries documents from the Prismic repository for a specific Custom Type.
614
+ *
615
+ * Use `getAllByType` instead if you need to query all documents for a
616
+ * specific Custom Type.
617
+ *
618
+ * @example
619
+ *
620
+ * ```ts
621
+ * const response = await client.getByType("blog_post");
622
+ * ```
623
+ *
624
+ * @typeParam TDocument - Type of Prismic documents returned.
625
+ * @param documentType - The API ID of the Custom Type.
626
+ * @param params - Parameters to filter, sort, and paginate the results.
627
+ *
628
+ * @returns A paginated response containing documents of the Custom Type.
629
+ */
630
+ getByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
631
+ /**
632
+ * Queries all documents from the Prismic repository for a specific Custom Type.
633
+ *
634
+ * This method may make multiple network requests to query all matching content.
635
+ *
636
+ * @example
637
+ *
638
+ * ```ts
639
+ * const response = await client.getByType("blog_post");
640
+ * ```
641
+ *
642
+ * @typeParam TDocument - Type of Prismic documents returned.
643
+ * @param documentType - The API ID of the Custom Type.
644
+ * @param params - Parameters to filter, sort, and paginate the results.
645
+ *
646
+ * @returns A list of all documents of the Custom Type.
647
+ */
648
+ getAllByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
649
+ /**
650
+ * Queries documents from the Prismic repository with a specific tag.
651
+ *
652
+ * Use `getAllByTag` instead if you need to query all documents with a specific tag.
653
+ *
654
+ * @example
655
+ *
656
+ * ```ts
657
+ * const response = await client.getByTag("food");
658
+ * ```
659
+ *
660
+ * @typeParam TDocument - Type of Prismic documents returned.
661
+ * @param tag - The tag that must be included on a document.
662
+ * @param params - Parameters to filter, sort, and paginate the results.
663
+ *
664
+ * @returns A paginated response containing documents with the tag.
665
+ */
666
+ getByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
667
+ /**
668
+ * Queries all documents from the Prismic repository with a specific tag.
669
+ *
670
+ * This method may make multiple network requests to query all matching content.
671
+ *
672
+ * @example
673
+ *
674
+ * ```ts
675
+ * const response = await client.getAllByTag("food");
676
+ * ```
677
+ *
678
+ * @typeParam TDocument - Type of Prismic documents returned.
679
+ * @param tag - The tag that must be included on a document.
680
+ * @param params - Parameters to filter, sort, and paginate the results.
681
+ *
682
+ * @returns A list of all documents with the tag.
683
+ */
684
+ getAllByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
685
+ /**
686
+ * Queries documents from the Prismic repository with specific tags. A
687
+ * document must be tagged with all of the queried tags to be included.
688
+ *
689
+ * @example
690
+ *
691
+ * ```ts
692
+ * const response = await client.getByEveryTag(["food", "fruit"]);
693
+ * ```
694
+ *
695
+ * @typeParam TDocument - Type of Prismic documents returned.
696
+ * @param tags - A list of tags that must be included on a document.
697
+ * @param params - Parameters to filter, sort, and paginate the results.
698
+ *
699
+ * @returns A paginated response containing documents with the tags.
700
+ */
701
+ getByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
702
+ /**
703
+ * Queries documents from the Prismic repository with specific tags. A
704
+ * document must be tagged with all of the queried tags to be included.
705
+ *
706
+ * This method may make multiple network requests to query all matching content.
707
+ *
708
+ * @example
709
+ *
710
+ * ```ts
711
+ * const response = await client.getAllByEveryTag(["food", "fruit"]);
712
+ * ```
713
+ *
714
+ * @typeParam TDocument - Type of Prismic documents returned.
715
+ * @param tags - A list of tags that must be included on a document.
716
+ * @param params - Parameters to filter, sort, and paginate the results.
717
+ *
718
+ * @returns A list of all documents with the tags.
719
+ */
720
+ getAllByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
721
+ /**
722
+ * Queries documents from the Prismic repository with specific tags. A
723
+ * document must be tagged with at least one of the queried tags to be included.
724
+ *
725
+ * @example
726
+ *
727
+ * ```ts
728
+ * const response = await client.getByEveryTag(["food", "fruit"]);
729
+ * ```
730
+ *
731
+ * @typeParam TDocument - Type of Prismic documents returned.
732
+ * @param tags - A list of tags that must be included on a document.
733
+ * @param params - Parameters to filter, sort, and paginate the results.
734
+ *
735
+ * @returns A paginated response containing documents with at least one of the tags.
736
+ */
737
+ getBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
738
+ /**
739
+ * Queries documents from the Prismic repository with specific tags. A
740
+ * document must be tagged with at least one of the queried tags to be included.
741
+ *
742
+ * This method may make multiple network requests to query all matching content.
743
+ *
744
+ * @example
745
+ *
746
+ * ```ts
747
+ * const response = await client.getAllByEveryTag(["food", "fruit"]);
748
+ * ```
749
+ *
750
+ * @typeParam TDocument - Type of Prismic documents returned.
751
+ * @param tags - A list of tags that must be included on a document.
752
+ * @param params - Parameters to filter, sort, and paginate the results.
753
+ *
754
+ * @returns A list of all documents with at least one of the tags.
755
+ */
756
+ getAllBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
757
+ /**
758
+ * Returns metadata about the Prismic repository, such as its refs, releases,
759
+ * and custom types.
760
+ *
761
+ * @returns Repository metadata.
762
+ */
763
+ getRepository(): Promise<prismicT.Repository>;
764
+ /**
765
+ * Returns a list of all refs for the Prismic repository.
766
+ *
767
+ * Refs are used to identify which version of the repository's content should
768
+ * be queried. All repositories will have at least one ref pointing to the
769
+ * latest published content called the "master ref".
770
+ *
771
+ * @returns A list of all refs for the Prismic repository.
772
+ */
773
+ getRefs(): Promise<prismicT.Ref[]>;
774
+ /**
775
+ * Returns a ref for the Prismic repository with a matching ID.
776
+ *
777
+ * @param id - ID of the ref.
778
+ *
779
+ * @returns The ref with a matching ID, if it exists.
780
+ */
781
+ getRefByID(id: string): Promise<prismicT.Ref>;
782
+ /**
783
+ * Returns a ref for the Prismic repository with a matching label.
784
+ *
785
+ * @param label - Label of the ref.
786
+ *
787
+ * @returns The ref with a matching label, if it exists.
788
+ */
789
+ getRefByLabel(label: string): Promise<prismicT.Ref>;
790
+ /**
791
+ * Returns the master ref for the Prismic repository. The master ref points to
792
+ * the repository's latest published content.
793
+ *
794
+ * @returns The repository's master ref.
795
+ */
796
+ getMasterRef(): Promise<prismicT.Ref>;
797
+ /**
798
+ * Returns a list of all Releases for the Prismic repository. Releases are
799
+ * used to group content changes before publishing.
800
+ *
801
+ * @returns A list of all Releases for the Prismic repository.
802
+ */
803
+ getReleases(): Promise<prismicT.Ref[]>;
804
+ /**
805
+ * Returns a Release for the Prismic repository with a matching ID.
806
+ *
807
+ * @param id - ID of the Release.
808
+ *
809
+ * @returns The Release with a matching ID, if it exists.
810
+ */
811
+ getReleaseByID(id: string): Promise<prismicT.Ref>;
812
+ /**
813
+ * Returns a Release for the Prismic repository with a matching label.
814
+ *
815
+ * @param label - Label of the ref.
816
+ *
817
+ * @returns The ref with a matching label, if it exists.
818
+ */
819
+ getReleaseByLabel(label: string): Promise<prismicT.Ref>;
820
+ /**
821
+ * Returns a list of all tags used in the Prismic repository.
822
+ *
823
+ * @returns A list of all tags used in the repository.
824
+ */
825
+ getTags(): Promise<string[]>;
826
+ /**
827
+ * Builds a URL used to query content from the Prismic repository.
828
+ *
829
+ * @param params - Parameters to filter, sort, and paginate the results.
830
+ *
831
+ * @returns A URL string that can be requested to query content.
832
+ */
833
+ buildQueryURL(params?: Partial<BuildQueryURLArgs>): Promise<string>;
834
+ /**
835
+ * Determines the URL for a previewed document during an active preview
836
+ * session. The result of this method should be used to redirect the user to
837
+ * the document's URL.
838
+ *
839
+ * @example
840
+ *
841
+ * ```ts
842
+ * const url = client.resolvePreviewURL({
843
+ * linkResolver: (document) => `/${document.uid}`
844
+ * defaultURL: '/'
845
+ * })
846
+ * ```
847
+ *
848
+ * @param args - Arguments to configure the URL resolving.
849
+ *
850
+ * @returns The URL for the previewed document during an active preview
851
+ * session. The user should be redirected to this URL.
852
+ */
853
+ resolvePreviewURL(args: ResolvePreviewArgs): Promise<string>;
854
+ /**
855
+ * Configures the client to query the latest published content for all future queries.
856
+ *
857
+ * If the `ref` parameter is provided during a query, it takes priority for that query.
858
+ *
859
+ * @example
860
+ *
861
+ * ```ts
862
+ * await client.queryLatestContent();
863
+ * const document = await client.getByID("WW4bKScAAMAqmluX");
864
+ * ```
865
+ */
866
+ queryLatestContent(): void;
867
+ /**
868
+ * Configures the client to query content from a specific Release identified
869
+ * by its ID for all future queries.
870
+ *
871
+ * If the `ref` parameter is provided during a query, it takes priority for that query.
872
+ *
873
+ * @example
874
+ *
875
+ * ```ts
876
+ * await client.queryContentFromReleaseByID("YLB7OBAAACMA7Cpa");
877
+ * const document = await client.getByID("WW4bKScAAMAqmluX");
878
+ * ```
879
+ *
880
+ * @param id - The ID of the Release.
881
+ */
882
+ queryContentFromReleaseByID(releaseID: string): void;
883
+ /**
884
+ * Configures the client to query content from a specific Release identified
885
+ * by its label for all future queries.
886
+ *
887
+ * If the `ref` parameter is provided during a query, it takes priority for that query.
888
+ *
889
+ * @example
890
+ *
891
+ * ```ts
892
+ * await client.queryContentFromReleaseByLabel("My Release");
893
+ * const document = await client.getByID("WW4bKScAAMAqmluX");
894
+ * ```
895
+ *
896
+ * @param label - The label of the Release.
897
+ */
898
+ queryContentFromReleaseByLabel(releaseLabel: string): void;
899
+ /**
900
+ * Configures the client to query content from a specific ref. The ref can be
901
+ * provided as a string or a function.
902
+ *
903
+ * If a function is provided, the ref is fetched lazily before each query. The
904
+ * function may also be asynchronous.
905
+ *
906
+ * @example
907
+ *
908
+ * ```ts
909
+ * await client.queryContentFromRef("my-ref");
910
+ * const document = await client.getByID("WW4bKScAAMAqmluX");
911
+ * ```
912
+ *
913
+ * @param ref - The ref or a function that returns the ref from which to query content.
914
+ */
915
+ queryContentFromRef(ref: RefStringOrThunk): void;
916
+ /**
917
+ * Returns a cached version of `getRepository` with a TTL.
918
+ *
919
+ * @returns Cached repository metadata.
920
+ */
921
+ private getCachedRepository;
922
+ /**
923
+ * Returns a cached Prismic repository form. Forms are used to determine API
924
+ * endpoints for types of repository data.
925
+ *
926
+ * @param name - Name of the form.
927
+ *
928
+ * @returns The repository form.
929
+ * @throws If a matching form cannot be found.
930
+ */
931
+ private getCachedRepositoryForm;
932
+ /**
933
+ * Returns the ref needed to query based on the client's current state. This
934
+ * method may make a network request to fetch a ref or resolve the user's ref thunk.
935
+ *
936
+ * If auto previews are enabled, the preview ref takes priority if available.
937
+ *
938
+ * The following strategies are used depending on the client's state:
939
+ *
940
+ * - If the user called `queryLatestContent`: Use the repository's master ref.
941
+ * The ref is cached for 5 seconds. After 5 seconds, a new master ref is fetched.
942
+ * - If the user called `queryContentFromReleaseByID`: Use the release's ref.
943
+ * The ref is cached for 5 seconds. After 5 seconds, a new ref for the
944
+ * release is fetched.
945
+ * - If the user called `queryContentFromReleaseByLabel`: Use the release's ref.
946
+ * The ref is cached for 5 seconds. After 5 seconds, a new ref for the
947
+ * release is fetched.
948
+ * - If the user called `queryContentFromRef`: Use the provided ref. Fall back
949
+ * to the master ref if the ref is not a string.
950
+ *
951
+ * @returns The ref to use during a query.
952
+ */
953
+ private getResolvedRefString;
954
+ /**
955
+ * Performs a network request using the configured `fetch` function. It
956
+ * assumes all successful responses will have a JSON content type. It also
957
+ * normalizes unsuccessful network requests.
958
+ *
959
+ * @typeParam T - The JSON response.
960
+ * @param url - URL to the resource to fetch.
961
+ * @param params - Prismic REST API parameters for the network request.
962
+ *
963
+ * @returns The JSON response from the network request.
964
+ */
965
+ private fetch;
968
966
  }
969
967
 
970
- /**
971
- * The `at` predicate checks that the path matches the described value exactly.
972
- * It takes a single value for a field or an array (only for tags).
973
- *
974
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#at}
975
- */
976
- declare const at: (path: string, value: string | number | (string | number)[]) => string;
977
- /**
978
- * The `not` predicate checks that the path doesn't match the provided value
979
- * exactly. It takes a single value as the argument.
980
- *
981
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
982
- */
983
- declare const not: (path: string, value: string | number | (string | number)[]) => string;
984
- /**
985
- * The `any` predicate takes an array of values. It works exactly the same way
986
- * as the `at` operator, but checks whether the fragment matches any of the
987
- * values in the array.
988
- *
989
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#any}
990
- */
991
- declare const any: (path: string, value: string | number | (string | number)[]) => string;
992
- /**
993
- * The `in` predicate is used specifically to retrieve an array of documents by
994
- * their IDs or UIDs. This predicate is much more efficient at this than the any
995
- * predicate.
996
- *
997
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#in}
998
- */
999
- declare const _in: (path: string, value: string | number | (string | number)[]) => string;
1000
-
1001
- /**
1002
- * The `fulltext` predicate provides two capabilities:
1003
- *
1004
- * 1. Checking if a certain string is anywhere inside a document (this is what you
1005
- * should use to make your project's search engine feature)
1006
- * 2. Checking if the string is contained inside a specific custom type’s Rich Text
1007
- * or Key Text fragment.
1008
- *
1009
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#fulltext}
1010
- */
1011
- declare const fulltext: (path: string, value: string | number | (string | number)[]) => string;
1012
- /**
1013
- * The `has` predicate checks whether a fragment has a value. It will return all
1014
- * the documents of the specified type that contain a value for the specified field.
1015
- *
1016
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#has}
1017
- */
1018
- declare const has: (path: string) => string;
1019
- /**
1020
- * The `missing` predicate checks if a fragment doesn't have a value. It will
1021
- * return all the documents of the specified type that do not contain a value
1022
- * for the specified field.
1023
- *
1024
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#missing}
1025
- */
1026
- declare const missing: (path: string) => string;
1027
- /**
1028
- * The `similar` predicate takes the ID of a document, and returns a list of
1029
- * documents with similar content. This allows you to build an automated content
1030
- * discovery feature (for example, a "Related posts" section).
1031
- *
1032
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#similar}
1033
- */
1034
- declare const similar: (id: string, value: number) => string;
1035
- /**
1036
- * The `geopoint.near` predicate checks that the value in the path is within the
1037
- * radius of the given coordinates.
1038
- *
1039
- * This predicate will only work for a GeoPoint field.
1040
- *
1041
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#near}
1042
- */
1043
- declare const geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
1044
- /**
1045
- * The `number.lt` predicate checks that the value in the number field is less
1046
- * than the value passed into the predicate.
1047
- *
1048
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#lt-less-than}
1049
- */
1050
- declare const numberLessThan: (path: string, value: number) => string;
1051
- /**
1052
- * The `number.gt` predicate checks that the value in the number field is
1053
- * greater than the value passed into the predicate.
1054
- *
1055
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#gt-greater-than}
1056
- */
1057
- declare const numberGreaterThan: (path: string, value: number) => string;
1058
- /**
1059
- * The `number.inRange` predicate checks that the value in the path is within
1060
- * the two values passed into the predicate.
1061
- *
1062
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#inrange}
1063
- */
1064
- declare const numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
1065
- /**
1066
- * The `date.after` predicate checks that the value in the path is after the
1067
- * date value passed into the predicate.
1068
- *
1069
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#after}
1070
- */
1071
- declare const dateAfter: (path: string, date: string | number | Date) => string;
1072
- /**
1073
- * The `date.before` predicate checks that the value in the path is before the
1074
- * date value passed into the predicate.
1075
- *
1076
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#before}
1077
- */
1078
- declare const dateBefore: (path: string, date: string | number | Date) => string;
1079
- /**
1080
- * The `date.between` predicate checks that the value in the path is within the
1081
- * date values passed into the predicate.
1082
- *
1083
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#between}
1084
- */
1085
- declare const dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
1086
- /**
1087
- * The `date.day-of-month` predicate checks that the value in the path is equal
1088
- * to the day of the month passed into the predicate.
1089
- *
1090
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonth}
1091
- */
1092
- declare const dateDayOfMonth: (path: string, day: number) => string;
1093
- /**
1094
- * The `date.day-of-month-after` predicate checks that the value in the path is
1095
- * after the day of the month passed into the predicate.
1096
- *
1097
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthafter}
1098
- */
1099
- declare const dateDayOfMonthAfter: (path: string, day: number) => string;
1100
- /**
1101
- * The `date.day-of-month-before` predicate checks that the value in the path is
1102
- * before the day of the month passed into the predicate.
1103
- *
1104
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthbefore}
1105
- */
1106
- declare const dateDayOfMonthBefore: (path: string, day: number) => string;
1107
- /**
1108
- * The `date.day-of-week` predicate checks that the value in the path is equal
1109
- * to the day of the week passed into the predicate.
1110
- *
1111
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweek}
1112
- */
1113
- declare const dateDayOfWeek: (path: string, day: string | number) => string;
1114
- /**
1115
- * The `date.day-of-week-after` predicate checks that the value in the path is
1116
- * after the day of the week passed into the predicate.
1117
- *
1118
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekafter}
1119
- */
1120
- declare const dateDayOfWeekAfter: (path: string, day: string | number) => string;
1121
- /**
1122
- * The date.day-of-week-before predicate checks that the value in the path is
1123
- * before the day of the week passed into the predicate.
1124
- *
1125
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekbefore}
1126
- */
1127
- declare const dateDayOfWeekBefore: (path: string, day: string | number) => string;
1128
- /**
1129
- * The `date.month` predicate checks that the value in the path occurs in the
1130
- * month value passed into the predicate.
1131
- *
1132
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#month}
1133
- */
1134
- declare const dateMonth: (path: string, month: string | number) => string;
1135
- /**
1136
- * The `date.month-after` predicate checks that the value in the path occurs in
1137
- * any month after the value passed into the predicate.
1138
- *
1139
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthafter}
1140
- */
1141
- declare const dateMonthAfter: (path: string, month: string | number) => string;
1142
- /**
1143
- * The `date.month-before` predicate checks that the value in the path occurs in
1144
- * any month before the value passed into the predicate.
1145
- *
1146
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthbefore}
1147
- */
1148
- declare const dateMonthBefore: (path: string, month: string | number) => string;
1149
- /**
1150
- * The `date.year` predicate checks that the value in the path occurs in the
1151
- * year value passed into the predicate.
1152
- *
1153
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#year}
1154
- */
1155
- declare const dateYear: (path: string, year: number) => string;
1156
- /**
1157
- * The `date.hour` predicate checks that the value in the path occurs within the
1158
- * hour value passed into the predicate.
1159
- *
1160
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hour}
1161
- */
1162
- declare const dateHour: (path: string, hour: number) => string;
1163
- /**
1164
- * The `date.hour-after` predicate checks that the value in the path occurs
1165
- * after the hour value passed into the predicate.
1166
- *
1167
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourafter}
1168
- */
1169
- declare const dateHourAfter: (path: string, hour: number) => string;
1170
- /**
1171
- * The `date.hour-before` predicate checks that the value in the path occurs
1172
- * before the hour value passed into the predicate.
1173
- *
1174
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourbefore}
1175
- */
1176
- declare const dateHourBefore: (path: string, hour: number) => string;
1177
-
1178
- declare const predicate_at: typeof at;
1179
- declare const predicate_not: typeof not;
1180
- declare const predicate_any: typeof any;
1181
- declare const predicate_fulltext: typeof fulltext;
1182
- declare const predicate_has: typeof has;
1183
- declare const predicate_missing: typeof missing;
1184
- declare const predicate_similar: typeof similar;
1185
- declare const predicate_geopointNear: typeof geopointNear;
1186
- declare const predicate_numberLessThan: typeof numberLessThan;
1187
- declare const predicate_numberGreaterThan: typeof numberGreaterThan;
1188
- declare const predicate_numberInRange: typeof numberInRange;
1189
- declare const predicate_dateAfter: typeof dateAfter;
1190
- declare const predicate_dateBefore: typeof dateBefore;
1191
- declare const predicate_dateBetween: typeof dateBetween;
1192
- declare const predicate_dateDayOfMonth: typeof dateDayOfMonth;
1193
- declare const predicate_dateDayOfMonthAfter: typeof dateDayOfMonthAfter;
1194
- declare const predicate_dateDayOfMonthBefore: typeof dateDayOfMonthBefore;
1195
- declare const predicate_dateDayOfWeek: typeof dateDayOfWeek;
1196
- declare const predicate_dateDayOfWeekAfter: typeof dateDayOfWeekAfter;
1197
- declare const predicate_dateDayOfWeekBefore: typeof dateDayOfWeekBefore;
1198
- declare const predicate_dateMonth: typeof dateMonth;
1199
- declare const predicate_dateMonthAfter: typeof dateMonthAfter;
1200
- declare const predicate_dateMonthBefore: typeof dateMonthBefore;
1201
- declare const predicate_dateYear: typeof dateYear;
1202
- declare const predicate_dateHour: typeof dateHour;
1203
- declare const predicate_dateHourAfter: typeof dateHourAfter;
1204
- declare const predicate_dateHourBefore: typeof dateHourBefore;
1205
- declare namespace predicate {
1206
- export {
1207
- _in as in,
1208
- predicate_at as at,
1209
- predicate_not as not,
1210
- predicate_any as any,
1211
- predicate_fulltext as fulltext,
1212
- predicate_has as has,
1213
- predicate_missing as missing,
1214
- predicate_similar as similar,
1215
- predicate_geopointNear as geopointNear,
1216
- predicate_numberLessThan as numberLessThan,
1217
- predicate_numberGreaterThan as numberGreaterThan,
1218
- predicate_numberInRange as numberInRange,
1219
- predicate_dateAfter as dateAfter,
1220
- predicate_dateBefore as dateBefore,
1221
- predicate_dateBetween as dateBetween,
1222
- predicate_dateDayOfMonth as dateDayOfMonth,
1223
- predicate_dateDayOfMonthAfter as dateDayOfMonthAfter,
1224
- predicate_dateDayOfMonthBefore as dateDayOfMonthBefore,
1225
- predicate_dateDayOfWeek as dateDayOfWeek,
1226
- predicate_dateDayOfWeekAfter as dateDayOfWeekAfter,
1227
- predicate_dateDayOfWeekBefore as dateDayOfWeekBefore,
1228
- predicate_dateMonth as dateMonth,
1229
- predicate_dateMonthAfter as dateMonthAfter,
1230
- predicate_dateMonthBefore as dateMonthBefore,
1231
- predicate_dateYear as dateYear,
1232
- predicate_dateHour as dateHour,
1233
- predicate_dateHourAfter as dateHourAfter,
1234
- predicate_dateHourBefore as dateHourBefore,
1235
- };
1236
- }
968
+ declare const predicate: {
969
+ /**
970
+ * The `at` predicate checks that the path matches the described value
971
+ * exactly. It takes a single value for a field or an array (only for tags).
972
+ *
973
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#at}
974
+ */
975
+ at: (path: string, value: string | number | (string | number)[]) => string;
976
+ /**
977
+ * The `not` predicate checks that the path doesn't match the provided value
978
+ * exactly. It takes a single value as the argument.
979
+ *
980
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
981
+ */
982
+ not: (path: string, value: string | number | (string | number)[]) => string;
983
+ /**
984
+ * The `any` predicate takes an array of values. It works exactly the same way
985
+ * as the `at` operator, but checks whether the fragment matches any of the
986
+ * values in the array.
987
+ *
988
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#any}
989
+ */
990
+ any: (path: string, value: string | number | (string | number)[]) => string;
991
+ /**
992
+ * The `in` predicate is used specifically to retrieve an array of documents
993
+ * by their IDs or UIDs. This predicate is much more efficient at this than
994
+ * the any predicate.
995
+ *
996
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#in}
997
+ */
998
+ in: (path: string, value: string | number | (string | number)[]) => string;
999
+ /**
1000
+ * The `fulltext` predicate provides two capabilities:
1001
+ *
1002
+ * 1. Checking if a certain string is anywhere inside a document (this is what
1003
+ * you should use to make your project's search engine feature)
1004
+ * 2. Checking if the string is contained inside a specific custom type’s Rich
1005
+ * Text or Key Text fragment.
1006
+ *
1007
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#fulltext}
1008
+ */
1009
+ fulltext: (path: string, value: string | number | (string | number)[]) => string;
1010
+ /**
1011
+ * The `has` predicate checks whether a fragment has a value. It will return
1012
+ * all the documents of the specified type that contain a value for the
1013
+ * specified field.
1014
+ *
1015
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#has}
1016
+ */
1017
+ has: (path: string) => string;
1018
+ /**
1019
+ * The `missing` predicate checks if a fragment doesn't have a value. It will
1020
+ * return all the documents of the specified type that do not contain a value
1021
+ * for the specified field.
1022
+ *
1023
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#missing}
1024
+ */
1025
+ missing: (path: string) => string;
1026
+ /**
1027
+ * The `similar` predicate takes the ID of a document, and returns a list of
1028
+ * documents with similar content. This allows you to build an automated
1029
+ * content discovery feature (for example, a "Related posts" section).
1030
+ *
1031
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#similar}
1032
+ */
1033
+ similar: (id: string, value: number) => string;
1034
+ /**
1035
+ * The `geopoint.near` predicate checks that the value in the path is within
1036
+ * the radius of the given coordinates.
1037
+ *
1038
+ * This predicate will only work for a GeoPoint field.
1039
+ *
1040
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#near}
1041
+ */
1042
+ geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
1043
+ /**
1044
+ * The `number.lt` predicate checks that the value in the number field is less
1045
+ * than the value passed into the predicate.
1046
+ *
1047
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#lt-less-than}
1048
+ */
1049
+ numberLessThan: (path: string, value: number) => string;
1050
+ /**
1051
+ * The `number.gt` predicate checks that the value in the number field is
1052
+ * greater than the value passed into the predicate.
1053
+ *
1054
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#gt-greater-than}
1055
+ */
1056
+ numberGreaterThan: (path: string, value: number) => string;
1057
+ /**
1058
+ * The `number.inRange` predicate checks that the value in the path is within
1059
+ * the two values passed into the predicate.
1060
+ *
1061
+ * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#inrange}
1062
+ */
1063
+ numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
1064
+ /**
1065
+ * The `date.after` predicate checks that the value in the path is after the
1066
+ * date value passed into the predicate.
1067
+ *
1068
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#after}
1069
+ */
1070
+ dateAfter: (path: string, date: string | number | Date) => string;
1071
+ /**
1072
+ * The `date.before` predicate checks that the value in the path is before the
1073
+ * date value passed into the predicate.
1074
+ *
1075
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#before}
1076
+ */
1077
+ dateBefore: (path: string, date: string | number | Date) => string;
1078
+ /**
1079
+ * The `date.between` predicate checks that the value in the path is within
1080
+ * the date values passed into the predicate.
1081
+ *
1082
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#between}
1083
+ */
1084
+ dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
1085
+ /**
1086
+ * The `date.day-of-month` predicate checks that the value in the path is
1087
+ * equal to the day of the month passed into the predicate.
1088
+ *
1089
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonth}
1090
+ */
1091
+ dateDayOfMonth: (path: string, day: number) => string;
1092
+ /**
1093
+ * The `date.day-of-month-after` predicate checks that the value in the path
1094
+ * is after the day of the month passed into the predicate.
1095
+ *
1096
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthafter}
1097
+ */
1098
+ dateDayOfMonthAfter: (path: string, day: number) => string;
1099
+ /**
1100
+ * The `date.day-of-month-before` predicate checks that the value in the path
1101
+ * is before the day of the month passed into the predicate.
1102
+ *
1103
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthbefore}
1104
+ */
1105
+ dateDayOfMonthBefore: (path: string, day: number) => string;
1106
+ /**
1107
+ * The `date.day-of-week` predicate checks that the value in the path is equal
1108
+ * to the day of the week passed into the predicate.
1109
+ *
1110
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweek}
1111
+ */
1112
+ dateDayOfWeek: (path: string, day: string | number) => string;
1113
+ /**
1114
+ * The `date.day-of-week-after` predicate checks that the value in the path is
1115
+ * after the day of the week passed into the predicate.
1116
+ *
1117
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekafter}
1118
+ */
1119
+ dateDayOfWeekAfter: (path: string, day: string | number) => string;
1120
+ /**
1121
+ * The date.day-of-week-before predicate checks that the value in the path is
1122
+ * before the day of the week passed into the predicate.
1123
+ *
1124
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekbefore}
1125
+ */
1126
+ dateDayOfWeekBefore: (path: string, day: string | number) => string;
1127
+ /**
1128
+ * The `date.month` predicate checks that the value in the path occurs in the
1129
+ * month value passed into the predicate.
1130
+ *
1131
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#month}
1132
+ */
1133
+ dateMonth: (path: string, month: string | number) => string;
1134
+ /**
1135
+ * The `date.month-after` predicate checks that the value in the path occurs
1136
+ * in any month after the value passed into the predicate.
1137
+ *
1138
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthafter}
1139
+ */
1140
+ dateMonthAfter: (path: string, month: string | number) => string;
1141
+ /**
1142
+ * The `date.month-before` predicate checks that the value in the path occurs
1143
+ * in any month before the value passed into the predicate.
1144
+ *
1145
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthbefore}
1146
+ */
1147
+ dateMonthBefore: (path: string, month: string | number) => string;
1148
+ /**
1149
+ * The `date.year` predicate checks that the value in the path occurs in the
1150
+ * year value passed into the predicate.
1151
+ *
1152
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#year}
1153
+ */
1154
+ dateYear: (path: string, year: number) => string;
1155
+ /**
1156
+ * The `date.hour` predicate checks that the value in the path occurs within
1157
+ * the hour value passed into the predicate.
1158
+ *
1159
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hour}
1160
+ */
1161
+ dateHour: (path: string, hour: number) => string;
1162
+ /**
1163
+ * The `date.hour-after` predicate checks that the value in the path occurs
1164
+ * after the hour value passed into the predicate.
1165
+ *
1166
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourafter}
1167
+ */
1168
+ dateHourAfter: (path: string, hour: number) => string;
1169
+ /**
1170
+ * The `date.hour-before` predicate checks that the value in the path occurs
1171
+ * before the hour value passed into the predicate.
1172
+ *
1173
+ * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourbefore}
1174
+ */
1175
+ dateHourBefore: (path: string, hour: number) => string;
1176
+ };
1237
1177
 
1238
- declare type PrismicErrorArgs = {
1239
- url: string;
1240
- response?: Record<string, unknown>;
1241
- };
1242
- declare class PrismicError extends Error {
1243
- url: string;
1244
- response?: Record<string, unknown>;
1245
- constructor(message: string | undefined, args: PrismicErrorArgs);
1178
+ declare class PrismicError<Response> extends Error {
1179
+ url?: string;
1180
+ response: Response;
1181
+ constructor(message: string | undefined, url: string | undefined, response: Response);
1246
1182
  }
1247
1183
 
1248
- interface ForbiddenErrorRepositoryAPIResponse {
1249
- type: string;
1250
- message: string;
1251
- oauth_initiate: string;
1252
- oauth_token: string;
1253
- }
1254
- interface ForbiddenErrorQueryAPIResponse {
1255
- error: string;
1256
- oauth_initiate: string;
1257
- oauth_token: string;
1258
- }
1259
- declare type ForbiddenErrorAPIResponse = ForbiddenErrorRepositoryAPIResponse | ForbiddenErrorQueryAPIResponse;
1260
- declare type ForbiddenErrorArgs = {
1261
- url: string;
1262
- response: ForbiddenErrorAPIResponse;
1263
- };
1264
- declare class ForbiddenError extends Error {
1265
- url: string;
1266
- oauth_initiate: string;
1267
- oauth_token: string;
1268
- constructor(message: string, args: ForbiddenErrorArgs);
1184
+ declare type ForbiddenErrorRepositoryAPIResponse = {
1185
+ type: string;
1186
+ message: string;
1187
+ };
1188
+ declare type ForbiddenErrorQueryAPIResponse = {
1189
+ error: string;
1190
+ };
1191
+ declare class ForbiddenError extends PrismicError<ForbiddenErrorRepositoryAPIResponse | ForbiddenErrorQueryAPIResponse> {
1269
1192
  }
1270
1193
 
1271
- interface ParsingErrorAPIResponse {
1272
- type: "parsing-error";
1273
- message: string;
1274
- line: number;
1275
- column: number;
1276
- id: number;
1277
- location: string;
1278
- }
1279
- declare type ParsingErrorArgs = {
1280
- url: string;
1281
- response: ParsingErrorAPIResponse;
1282
- };
1283
- declare class ParsingError extends Error {
1284
- url: string;
1285
- line: number;
1286
- column: number;
1287
- id: number;
1288
- location: string;
1289
- constructor(message: string, args: ParsingErrorArgs);
1194
+ declare type ParsingErrorAPIResponse = {
1195
+ type: "parsing-error";
1196
+ message: string;
1197
+ line: number;
1198
+ column: number;
1199
+ id: number;
1200
+ location: string;
1201
+ };
1202
+ declare class ParsingError extends PrismicError<ParsingErrorAPIResponse> {
1290
1203
  }
1291
1204
 
1292
- /**
1293
- * The well-known name of the cookie used to store a Prismic preview session's ref.
1294
- */
1205
+ /**
1206
+ * The well-known name of the cookie used to store a Prismic preview session's ref.
1207
+ */
1295
1208
  declare const preview = "io.prismic.preview";
1296
1209
 
1297
1210
  declare const cookie_preview: typeof preview;