@prismicio/client 6.0.0-alpha.7 → 6.0.0-beta.1

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