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