@prismicio/client 6.4.1 → 6.4.2

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