@prismicio/client 7.21.0-pr.419.4409b0e → 7.21.0-pr.419.de81fe5

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/Client.cjs CHANGED
@@ -214,11 +214,7 @@ var Client = class {
214
214
  this.graphQLFetch = this.graphQLFetch.bind(this);
215
215
  }
216
216
  /**
217
- * Enables the client to automatically query content from a preview session if
218
- * one is active in browser environments. This is enabled by default in the
219
- * browser.
220
- *
221
- * For server environments, use `enableAutoPreviewsFromReq`.
217
+ * Enables the client to automatically query content from a preview session.
222
218
  *
223
219
  * @example
224
220
  *
@@ -226,29 +222,22 @@ var Client = class {
226
222
  * client.enableAutoPreviews()
227
223
  * ```
228
224
  *
229
- * @see enableAutoPreviewsFromReq
225
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviews}
230
226
  */
231
227
  enableAutoPreviews() {
232
228
  this.refState.autoPreviewsEnabled = true;
233
229
  }
234
230
  /**
235
- * Enables the client to automatically query content from a preview session if
236
- * one is active in server environments. This is disabled by default on the
237
- * server.
238
- *
239
- * For browser environments, use `enableAutoPreviews`.
231
+ * Enables the client to automatically query content from a preview session
232
+ * using an HTTP request object.
240
233
  *
241
234
  * @example
242
235
  *
243
236
  * ```ts
244
- * // In an express app
245
- * app.get("/", function (req, res) {
246
- * client.enableAutoPreviewsFromReq(req)
247
- * })
237
+ * client.enableAutoPreviewsFromReq(req)
248
238
  * ```
249
239
  *
250
- * @param req - An HTTP server request object containing the request's
251
- * cookies.
240
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviewsfromreq}
252
241
  */
253
242
  enableAutoPreviewsFromReq(req) {
254
243
  this.refState.httpRequest = req;
@@ -256,53 +245,43 @@ var Client = class {
256
245
  }
257
246
  /**
258
247
  * Disables the client from automatically querying content from a preview
259
- * session if one is active.
260
- *
261
- * Automatic preview content querying is enabled by default unless this method
262
- * is called.
248
+ * session.
263
249
  *
264
250
  * @example
265
251
  *
266
252
  * ```ts
267
253
  * client.disableAutoPreviews()
268
254
  * ```
255
+ *
256
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#disableautopreviews}
269
257
  */
270
258
  disableAutoPreviews() {
271
259
  this.refState.autoPreviewsEnabled = false;
272
260
  }
273
261
  /**
274
- * Queries content from the Prismic repository.
262
+ * Fetches pages based on the `params` argument. Results are paginated.
275
263
  *
276
264
  * @example
277
265
  *
278
266
  * ```ts
279
- * const response = await client.get()
267
+ * const response = await client.get({ pageSize: 10 })
280
268
  * ```
281
269
  *
282
- * @typeParam TDocument - Type of Prismic documents returned.
283
- *
284
- * @param params - Parameters to filter, sort, and paginate results.
285
- *
286
- * @returns A paginated response containing the result of the query.
270
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#get}
287
271
  */
288
272
  async get(params) {
289
273
  return await (await this.#internalGet(params)).json();
290
274
  }
291
275
  /**
292
- * Queries content from the Prismic repository and returns only the first
293
- * result, if any.
276
+ * Fetches the first page returned based on the `params` argument.
294
277
  *
295
278
  * @example
296
279
  *
297
280
  * ```ts
298
- * const document = await client.getFirst()
281
+ * const page = await client.getFirst()
299
282
  * ```
300
283
  *
301
- * @typeParam TDocument - Type of the Prismic document returned.
302
- *
303
- * @param params - Parameters to filter, sort, and paginate results.
304
- *
305
- * @returns The first result of the query, if any.
284
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getfirst}
306
285
  */
307
286
  async getFirst(params) {
308
287
  const actualParams = (params === null || params === void 0 ? void 0 : params.page) || (params === null || params === void 0 ? void 0 : params.pageSize) ? params : {
@@ -315,27 +294,16 @@ var Client = class {
315
294
  throw new require_NotFoundError.NotFoundError("No documents were returned", response.url, void 0);
316
295
  }
317
296
  /**
318
- * **IMPORTANT**: Avoid using `dangerouslyGetAll` as it may be slower and
319
- * require more resources than other methods. Prefer using other methods that
320
- * filter by filters such as `getAllByType`.
321
- *
322
- * Queries content from the Prismic repository and returns all matching
323
- * content. If no filters are provided, all documents will be fetched.
324
- *
325
- * This method may make multiple network requests to query all matching
326
- * content.
297
+ * Fetches all pages based on the `params` argument. This method may make
298
+ * multiple network requests to fetch all matching pages.
327
299
  *
328
300
  * @example
329
301
  *
330
302
  * ```ts
331
- * const response = await client.dangerouslyGetAll()
303
+ * const pages = await client.dangerouslyGetAll()
332
304
  * ```
333
305
  *
334
- * @typeParam TDocument - Type of Prismic documents returned.
335
- *
336
- * @param params - Parameters to filter, sort, and paginate results.
337
- *
338
- * @returns A list of documents matching the query.
306
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#dangerouslygetall}
339
307
  */
340
308
  async dangerouslyGetAll(params = {}) {
341
309
  var _this$defaultParams;
@@ -358,39 +326,21 @@ var Client = class {
358
326
  return documents.slice(0, limit);
359
327
  }
360
328
  /**
361
- * Queries a document from the Prismic repository with a specific ID.
362
- *
363
- * @remarks
364
- * A document's UID is different from its ID. An ID is automatically generated
365
- * for all documents and is made available on its `id` property. A UID is
366
- * provided in the Prismic editor and is unique among all documents of its
367
- * custom type.
329
+ * Fetches a page with a specific ID.
368
330
  *
369
331
  * @example
370
332
  *
371
333
  * ```ts
372
- * const document = await client.getByID("WW4bKScAAMAqmluX")
334
+ * const page = await client.getByID("WW4bKScAAMAqmluX")
373
335
  * ```
374
336
  *
375
- * @typeParam TDocument- Type of the Prismic document returned.
376
- *
377
- * @param id - ID of the document.
378
- * @param params - Parameters to filter, sort, and paginate the results.
379
- *
380
- * @returns The document with an ID matching the `id` parameter, if a matching
381
- * document exists.
337
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyid}
382
338
  */
383
339
  async getByID(id, params) {
384
340
  return await this.getFirst(require_appendFilters.appendFilters(params, require_filter.filter.at("document.id", id)));
385
341
  }
386
342
  /**
387
- * Queries documents from the Prismic repository with specific IDs.
388
- *
389
- * @remarks
390
- * A document's UID is different from its ID. An ID is automatically generated
391
- * for all documents and is made available on its `id` property. A UID is
392
- * provided in the Prismic editor and is unique among all documents of its
393
- * custom type.
343
+ * Fetches pages with specific IDs. Results are paginated.
394
344
  *
395
345
  * @example
396
346
  *
@@ -401,172 +351,95 @@ var Client = class {
401
351
  * ])
402
352
  * ```
403
353
  *
404
- * @typeParam TDocument - Type of Prismic documents returned.
405
- *
406
- * @param ids - A list of document IDs.
407
- * @param params - Parameters to filter, sort, and paginate the results.
408
- *
409
- * @returns A paginated response containing documents with IDs matching the
410
- * `ids` parameter.
354
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyids}
411
355
  */
412
356
  async getByIDs(ids, params) {
413
357
  return await this.get(require_appendFilters.appendFilters(params, require_filter.filter.in("document.id", ids)));
414
358
  }
415
359
  /**
416
- * Queries all documents from the Prismic repository with specific IDs.
417
- *
418
- * This method may make multiple network requests to query all matching
419
- * content.
420
- *
421
- * @remarks
422
- * A document's UID is different from its ID. An ID is automatically generated
423
- * for all documents and is made available on its `id` property. A UID is
424
- * provided in the Prismic editor and is unique among all documents of its
425
- * custom type.
360
+ * Fetches pages with specific IDs. This method may make multiple network
361
+ * requests to fetch all matching pages.
426
362
  *
427
363
  * @example
428
364
  *
429
365
  * ```ts
430
- * const response = await client.getAllByIDs([
366
+ * const pages = await client.getAllByIDs([
431
367
  * "WW4bKScAAMAqmluX",
432
368
  * "U1kTRgEAAC8A5ldS",
433
369
  * ])
434
370
  * ```
435
371
  *
436
- * @typeParam TDocument - Type of Prismic documents returned.
437
- *
438
- * @param ids - A list of document IDs.
439
- * @param params - Parameters to filter, sort, and paginate the results.
440
- *
441
- * @returns A list of documents with IDs matching the `ids` parameter.
372
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyids}
442
373
  */
443
374
  async getAllByIDs(ids, params) {
444
375
  return await this.dangerouslyGetAll(require_appendFilters.appendFilters(params, require_filter.filter.in("document.id", ids)));
445
376
  }
446
377
  /**
447
- * Queries a document from the Prismic repository with a specific UID and
448
- * custom type.
449
- *
450
- * @remarks
451
- * A document's UID is different from its ID. An ID is automatically generated
452
- * for all documents and is made available on its `id` property. A UID is
453
- * provided in the Prismic editor and is unique among all documents of its
454
- * custom type.
378
+ * Fetches a page with a specific UID and type.
455
379
  *
456
380
  * @example
457
381
  *
458
382
  * ```ts
459
- * const document = await client.getByUID("blog_post", "my-first-post")
383
+ * const page = await client.getByUID("blog_post", "my-first-post")
460
384
  * ```
461
385
  *
462
- * @typeParam TDocument - Type of the Prismic document returned.
463
- *
464
- * @param documentType - The API ID of the document's custom type.
465
- * @param uid - UID of the document.
466
- * @param params - Parameters to filter, sort, and paginate the results.
467
- *
468
- * @returns The document with a UID matching the `uid` parameter, if a
469
- * matching document exists.
386
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuid}
470
387
  */
471
388
  async getByUID(documentType, uid, params) {
472
389
  return await this.getFirst(require_appendFilters.appendFilters(params, [require_typeFilter.typeFilter(documentType), require_filter.filter.at(`my.${documentType}.uid`, uid)]));
473
390
  }
474
391
  /**
475
- * Queries document from the Prismic repository with specific UIDs and Custom
476
- * Type.
477
- *
478
- * @remarks
479
- * A document's UID is different from its ID. An ID is automatically generated
480
- * for all documents and is made available on its `id` property. A UID is
481
- * provided in the Prismic editor and is unique among all documents of its
482
- * custom type.
392
+ * Fetches pages with specific UIDs and a specific type. Results are
393
+ * paginated.
483
394
  *
484
395
  * @example
485
396
  *
486
397
  * ```ts
487
- * const document = await client.getByUIDs("blog_post", [
398
+ * const response = await client.getByUIDs("blog_post", [
488
399
  * "my-first-post",
489
400
  * "my-second-post",
490
401
  * ])
491
402
  * ```
492
403
  *
493
- * @typeParam TDocument - Type of the Prismic document returned.
494
- *
495
- * @param documentType - The API ID of the document's custom type.
496
- * @param uids - A list of document UIDs.
497
- * @param params - Parameters to filter, sort, and paginate the results.
498
- *
499
- * @returns A paginated response containing documents with UIDs matching the
500
- * `uids` parameter.
404
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuids}
501
405
  */
502
406
  async getByUIDs(documentType, uids, params) {
503
407
  return await this.get(require_appendFilters.appendFilters(params, [require_typeFilter.typeFilter(documentType), require_filter.filter.in(`my.${documentType}.uid`, uids)]));
504
408
  }
505
409
  /**
506
- * Queries all documents from the Prismic repository with specific UIDs and
507
- * custom type.
508
- *
509
- * This method may make multiple network requests to query all matching
510
- * content.
511
- *
512
- * @remarks
513
- * A document's UID is different from its ID. An ID is automatically generated
514
- * for all documents and is made available on its `id` property. A UID is
515
- * provided in the Prismic editor and is unique among all documents of its
516
- * custom type.
410
+ * Fetches pages with specific UIDs and a specific type. This method may make
411
+ * multiple network requests to fetch all matching pages.
517
412
  *
518
413
  * @example
519
414
  *
520
415
  * ```ts
521
- * const response = await client.getAllByUIDs([
416
+ * const pages = await client.getAllByUIDs("blog_post", [
522
417
  * "my-first-post",
523
418
  * "my-second-post",
524
419
  * ])
525
420
  * ```
526
421
  *
527
- * @typeParam TDocument - Type of Prismic documents returned.
528
- *
529
- * @param documentType - The API ID of the document's custom type.
530
- * @param uids - A list of document UIDs.
531
- * @param params - Parameters to filter, sort, and paginate the results.
532
- *
533
- * @returns A list of documents with UIDs matching the `uids` parameter.
422
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyuids}
534
423
  */
535
424
  async getAllByUIDs(documentType, uids, params) {
536
425
  return await this.dangerouslyGetAll(require_appendFilters.appendFilters(params, [require_typeFilter.typeFilter(documentType), require_filter.filter.in(`my.${documentType}.uid`, uids)]));
537
426
  }
538
427
  /**
539
- * Queries a singleton document from the Prismic repository for a specific
540
- * custom type.
541
- *
542
- * @remarks
543
- * A singleton document is one that is configured in Prismic to only allow one
544
- * instance. For example, a repository may be configured to contain just one
545
- * Settings document. This is in contrast to a repeatable custom type which
546
- * allows multiple instances of itself.
428
+ * Fetches a specific single type page.
547
429
  *
548
430
  * @example
549
431
  *
550
432
  * ```ts
551
- * const document = await client.getSingle("settings")
433
+ * const page = await client.getSingle("settings")
552
434
  * ```
553
435
  *
554
- * @typeParam TDocument - Type of the Prismic document returned.
555
- *
556
- * @param documentType - The API ID of the singleton custom type.
557
- * @param params - Parameters to filter, sort, and paginate the results.
558
- *
559
- * @returns The singleton document for the custom type, if a matching document
560
- * exists.
436
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getsingle}
561
437
  */
562
438
  async getSingle(documentType, params) {
563
439
  return await this.getFirst(require_appendFilters.appendFilters(params, require_typeFilter.typeFilter(documentType)));
564
440
  }
565
441
  /**
566
- * Queries documents from the Prismic repository for a specific custom type.
567
- *
568
- * Use `getAllByType` instead if you need to query all documents for a
569
- * specific custom type.
442
+ * Fetches pages with a specific type. Results are paginated.
570
443
  *
571
444
  * @example
572
445
  *
@@ -574,177 +447,124 @@ var Client = class {
574
447
  * const response = await client.getByType("blog_post")
575
448
  * ```
576
449
  *
577
- * @typeParam TDocument - Type of Prismic documents returned.
578
- *
579
- * @param documentType - The API ID of the custom type.
580
- * @param params - Parameters to filter, sort, and paginate the results.
581
- *
582
- * @returns A paginated response containing documents of the custom type.
450
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytype}
583
451
  */
584
452
  async getByType(documentType, params) {
585
453
  return await this.get(require_appendFilters.appendFilters(params, require_typeFilter.typeFilter(documentType)));
586
454
  }
587
455
  /**
588
- * Queries all documents from the Prismic repository for a specific Custom
589
- * Type.
590
- *
591
- * This method may make multiple network requests to query all matching
592
- * content.
456
+ * Fetches pages with a specific type. This method may make multiple network
457
+ * requests to fetch all matching documents.
593
458
  *
594
459
  * @example
595
460
  *
596
461
  * ```ts
597
- * const response = await client.getByType("blog_post")
462
+ * const pages = await client.getAllByType("blog_post")
598
463
  * ```
599
464
  *
600
- * @typeParam TDocument - Type of Prismic documents returned.
601
- *
602
- * @param documentType - The API ID of the custom type.
603
- * @param params - Parameters to filter, sort, and paginate the results.
604
- *
605
- * @returns A list of all documents of the custom type.
465
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytype}
606
466
  */
607
467
  async getAllByType(documentType, params) {
608
468
  return await this.dangerouslyGetAll(require_appendFilters.appendFilters(params, require_typeFilter.typeFilter(documentType)));
609
469
  }
610
470
  /**
611
- * Queries documents from the Prismic repository with a specific tag.
612
- *
613
- * Use `getAllByTag` instead if you need to query all documents with a
614
- * specific tag.
471
+ * Fetches pages with a specific tag. Results are paginated.
615
472
  *
616
473
  * @example
617
474
  *
618
475
  * ```ts
619
- * const response = await client.getByTag("food")
476
+ * const response = await client.getByTag("featured")
620
477
  * ```
621
478
  *
622
- * @typeParam TDocument - Type of Prismic documents returned.
623
- *
624
- * @param tag - The tag that must be included on a document.
625
- * @param params - Parameters to filter, sort, and paginate the results.
626
- *
627
- * @returns A paginated response containing documents with the tag.
479
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytag}
628
480
  */
629
481
  async getByTag(tag, params) {
630
482
  return await this.get(require_appendFilters.appendFilters(params, require_someTagsFilter.someTagsFilter(tag)));
631
483
  }
632
484
  /**
633
- * Queries all documents from the Prismic repository with a specific tag.
634
- *
635
- * This method may make multiple network requests to query all matching
636
- * content.
485
+ * Fetches pages with a specific tag. This method may make multiple network
486
+ * requests to fetch all matching documents.
637
487
  *
638
488
  * @example
639
489
  *
640
490
  * ```ts
641
- * const response = await client.getAllByTag("food")
491
+ * const pages = await client.getAllByTag("featured")
642
492
  * ```
643
493
  *
644
- * @typeParam TDocument - Type of Prismic documents returned.
645
- *
646
- * @param tag - The tag that must be included on a document.
647
- * @param params - Parameters to filter, sort, and paginate the results.
648
- *
649
- * @returns A list of all documents with the tag.
494
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytag}
650
495
  */
651
496
  async getAllByTag(tag, params) {
652
497
  return await this.dangerouslyGetAll(require_appendFilters.appendFilters(params, require_someTagsFilter.someTagsFilter(tag)));
653
498
  }
654
499
  /**
655
- * Queries documents from the Prismic repository with specific tags. A
656
- * document must be tagged with all of the queried tags to be included.
500
+ * Fetches pages with every tag from a list of tags. Results are paginated.
657
501
  *
658
502
  * @example
659
503
  *
660
504
  * ```ts
661
- * const response = await client.getByEveryTag(["food", "fruit"])
505
+ * const response = await client.getByEveryTag(["featured", "homepage"])
662
506
  * ```
663
507
  *
664
- * @typeParam TDocument - Type of Prismic documents returned.
665
- *
666
- * @param tags - A list of tags that must be included on a document.
667
- * @param params - Parameters to filter, sort, and paginate the results.
668
- *
669
- * @returns A paginated response containing documents with the tags.
508
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyeverytag}
670
509
  */
671
510
  async getByEveryTag(tags, params) {
672
511
  return await this.get(require_appendFilters.appendFilters(params, require_everyTagFilter.everyTagFilter(tags)));
673
512
  }
674
513
  /**
675
- * Queries documents from the Prismic repository with specific tags. A
676
- * document must be tagged with all of the queried tags to be included.
677
- *
678
- * This method may make multiple network requests to query all matching
679
- * content.
514
+ * Fetches pages with every tag from a list of tags. This method may make
515
+ * multiple network requests to fetch all matching pages.
680
516
  *
681
517
  * @example
682
518
  *
683
519
  * ```ts
684
- * const response = await client.getAllByEveryTag(["food", "fruit"])
520
+ * const pages = await client.getAllByEveryTag(["featured", "homepage"])
685
521
  * ```
686
522
  *
687
- * @typeParam TDocument - Type of Prismic documents returned.
688
- *
689
- * @param tags - A list of tags that must be included on a document.
690
- * @param params - Parameters to filter, sort, and paginate the results.
691
- *
692
- * @returns A list of all documents with the tags.
523
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyeverytag}
693
524
  */
694
525
  async getAllByEveryTag(tags, params) {
695
526
  return await this.dangerouslyGetAll(require_appendFilters.appendFilters(params, require_everyTagFilter.everyTagFilter(tags)));
696
527
  }
697
528
  /**
698
- * Queries documents from the Prismic repository with specific tags. A
699
- * document must be tagged with at least one of the queried tags to be
700
- * included.
529
+ * Fetches pages with at least one tag from a list of tags. Results are
530
+ * paginated.
701
531
  *
702
532
  * @example
703
533
  *
704
534
  * ```ts
705
- * const response = await client.getByEveryTag(["food", "fruit"])
535
+ * const response = await client.getBySomeTags(["featured", "homepage"])
706
536
  * ```
707
537
  *
708
- * @typeParam TDocument - Type of Prismic documents returned.
709
- *
710
- * @param tags - A list of tags that must be included on a document.
711
- * @param params - Parameters to filter, sort, and paginate the results.
712
- *
713
- * @returns A paginated response containing documents with at least one of the
714
- * tags.
538
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbysometags}
715
539
  */
716
540
  async getBySomeTags(tags, params) {
717
541
  return await this.get(require_appendFilters.appendFilters(params, require_someTagsFilter.someTagsFilter(tags)));
718
542
  }
719
543
  /**
720
- * Queries documents from the Prismic repository with specific tags. A
721
- * document must be tagged with at least one of the queried tags to be
722
- * included.
723
- *
724
- * This method may make multiple network requests to query all matching
725
- * content.
544
+ * Fetches pages with at least one tag from a list of tags. This method may
545
+ * make multiple network requests to fetch all matching documents.
726
546
  *
727
547
  * @example
728
548
  *
729
549
  * ```ts
730
- * const response = await client.getAllBySomeTags(["food", "fruit"])
550
+ * const pages = await client.getAllBySomeTags(["featured", "homepage"])
731
551
  * ```
732
552
  *
733
- * @typeParam TDocument - Type of Prismic documents returned.
734
- *
735
- * @param tags - A list of tags that must be included on a document.
736
- * @param params - Parameters to filter, sort, and paginate the results.
737
- *
738
- * @returns A list of all documents with at least one of the tags.
553
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbysometags}
739
554
  */
740
555
  async getAllBySomeTags(tags, params) {
741
556
  return await this.dangerouslyGetAll(require_appendFilters.appendFilters(params, require_someTagsFilter.someTagsFilter(tags)));
742
557
  }
743
558
  /**
744
- * Returns metadata about the Prismic repository, such as its refs, releases,
745
- * and custom types.
559
+ * Fetches metadata about the client's Prismic repository.
746
560
  *
747
- * @returns Repository metadata.
561
+ * @example
562
+ *
563
+ * ```ts
564
+ * const repository = await client.getRepository()
565
+ * ```
566
+ *
567
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrepository}
748
568
  */
749
569
  async getRepository(params) {
750
570
  if (this.#cachedRepository && this.#cachedRepositoryExpiration > Date.now()) return this.#cachedRepository;
@@ -761,79 +581,115 @@ var Client = class {
761
581
  return await this.#throwContentAPIError(response, url.toString());
762
582
  }
763
583
  /**
764
- * Returns a list of all refs for the Prismic repository.
584
+ * Fetches the repository's active refs.
765
585
  *
766
- * Refs are used to identify which version of the repository's content should
767
- * be queried. All repositories will have at least one ref pointing to the
768
- * latest published content called the "master ref".
586
+ * @example
769
587
  *
770
- * @returns A list of all refs for the Prismic repository.
588
+ * ```ts
589
+ * const refs = await client.getRefs()
590
+ * ```
591
+ *
592
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefs}
771
593
  */
772
594
  async getRefs(params) {
773
595
  return (await this.getRepository(params)).refs;
774
596
  }
775
597
  /**
776
- * Returns a ref for the Prismic repository with a matching ID.
598
+ * Fetches a ref by its ID.
777
599
  *
778
- * @param id - ID of the ref.
600
+ * @example
779
601
  *
780
- * @returns The ref with a matching ID, if it exists.
602
+ * ```ts
603
+ * const ref = await client.getRefByID("YhE3YhEAACIA4321")
604
+ * ```
605
+ *
606
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbyid}
781
607
  */
782
608
  async getRefByID(id, params) {
783
609
  return require_findRefByID.findRefByID(await this.getRefs(params), id);
784
610
  }
785
611
  /**
786
- * Returns a ref for the Prismic repository with a matching label.
612
+ * Fetches a ref by its label. A release ref's label is its name shown in the
613
+ * Page Builder.
787
614
  *
788
- * @param label - Label of the ref.
615
+ * @example
789
616
  *
790
- * @returns The ref with a matching label, if it exists.
617
+ * ```ts
618
+ * const ref = await client.getRefByLabel("My Release")
619
+ * ```
620
+ *
621
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbylabel}
791
622
  */
792
623
  async getRefByLabel(label, params) {
793
624
  return require_findRefByLabel.findRefByLabel(await this.getRefs(params), label);
794
625
  }
795
626
  /**
796
- * Returns the master ref for the Prismic repository. The master ref points to
797
- * the repository's latest published content.
627
+ * Fetches the repository's master ref.
628
+ *
629
+ * @example
630
+ *
631
+ * ```ts
632
+ * const masterRef = await client.getMasterRef()
633
+ * ```
798
634
  *
799
- * @returns The repository's master ref.
635
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getmasterref}
800
636
  */
801
637
  async getMasterRef(params) {
802
638
  return require_findMasterRef.findMasterRef(await this.getRefs(params));
803
639
  }
804
640
  /**
805
- * Returns a list of all Releases for the Prismic repository. Releases are
806
- * used to group content changes before publishing.
641
+ * Fetches the repository's active releases.
807
642
  *
808
- * @returns A list of all Releases for the Prismic repository.
643
+ * @example
644
+ *
645
+ * ```ts
646
+ * const releases = await client.getReleases()
647
+ * ```
648
+ *
649
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleases}
809
650
  */
810
651
  async getReleases(params) {
811
652
  return (await this.getRefs(params)).filter((ref) => !ref.isMasterRef);
812
653
  }
813
654
  /**
814
- * Returns a Release for the Prismic repository with a matching ID.
655
+ * Fetches a release with a specific ID.
656
+ *
657
+ * @example
815
658
  *
816
- * @param id - ID of the Release.
659
+ * ```ts
660
+ * const release = await client.getReleaseByID("YhE3YhEAACIA4321")
661
+ * ```
817
662
  *
818
- * @returns The Release with a matching ID, if it exists.
663
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebyid}
819
664
  */
820
665
  async getReleaseByID(id, params) {
821
666
  return require_findRefByID.findRefByID(await this.getReleases(params), id);
822
667
  }
823
668
  /**
824
- * Returns a Release for the Prismic repository with a matching label.
669
+ * Fetches a release by its label. A release ref's label is its name shown in
670
+ * the Page Builder.
671
+ *
672
+ * @example
825
673
  *
826
- * @param label - Label of the ref.
674
+ * ```ts
675
+ * const release = await client.getReleaseByLabel("My Release")
676
+ * ```
827
677
  *
828
- * @returns The ref with a matching label, if it exists.
678
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebylabel}
829
679
  */
830
680
  async getReleaseByLabel(label, params) {
831
681
  return require_findRefByLabel.findRefByLabel(await this.getReleases(params), label);
832
682
  }
833
683
  /**
834
- * Returns a list of all tags used in the Prismic repository.
684
+ * Fetches the repository's page tags.
685
+ *
686
+ * @example
835
687
  *
836
- * @returns A list of all tags used in the repository.
688
+ * ```ts
689
+ * const tags = await client.getTags()
690
+ * ```
691
+ *
692
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#gettags}
837
693
  */
838
694
  async getTags(params) {
839
695
  const repository = await this.getRepository(params);
@@ -847,11 +703,17 @@ var Client = class {
847
703
  return repository.tags;
848
704
  }
849
705
  /**
850
- * Builds a URL used to query content from the Prismic repository.
706
+ * Builds a Content API query URL with a set of parameters.
851
707
  *
852
- * @param params - Parameters to filter, sort, and paginate the results.
708
+ * @example
853
709
  *
854
- * @returns A URL string that can be requested to query content.
710
+ * ```ts
711
+ * const url = await client.buildQueryURL({
712
+ * filters: [filter.at("document.type", "blog_post")],
713
+ * })
714
+ * ```
715
+ *
716
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#buildqueryurl}
855
717
  */
856
718
  async buildQueryURL({ signal, fetchOptions,...params } = {}) {
857
719
  const ref = params.ref || await this.getResolvedRefString({
@@ -875,23 +737,18 @@ var Client = class {
875
737
  });
876
738
  }
877
739
  /**
878
- * Determines the URL for a previewed document during an active preview
879
- * session. The result of this method should be used to redirect the user to
880
- * the document's URL.
740
+ * Fetches a previewed page's URL using a preview token and page ID.
881
741
  *
882
742
  * @example
883
743
  *
884
744
  * ```ts
885
- * const url = client.resolvePreviewURL({
886
- * linkResolver: (document) => `/${document.uid}`
887
- * defaultURL: '/'
888
- * })
745
+ * const url = await client.resolvePreviewURL({
746
+ * linkResolver,
747
+ * defaultURL: "/",
748
+ * })
889
749
  * ```
890
750
  *
891
- * @param args - Arguments to configure the URL resolving.
892
- *
893
- * @returns The URL for the previewed document during an active preview
894
- * session. The user should be redirected to this URL.
751
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#resolvepreviewurl}
895
752
  */
896
753
  async resolvePreviewURL(args) {
897
754
  let documentID = args.documentID;
@@ -923,37 +780,30 @@ var Client = class {
923
780
  return args.defaultURL;
924
781
  }
925
782
  /**
926
- * Configures the client to query the latest published content for all future
927
- * queries.
928
- *
929
- * If the `ref` parameter is provided during a query, it takes priority for
930
- * that query.
783
+ * Configures the client to query the latest published content. This is the
784
+ * client's default mode.
931
785
  *
932
786
  * @example
933
787
  *
934
788
  * ```ts
935
- * await client.queryLatestContent()
936
- * const document = await client.getByID("WW4bKScAAMAqmluX")
789
+ * client.queryLatestContent()
937
790
  * ```
791
+ *
792
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querylatestcontent}
938
793
  */
939
794
  queryLatestContent() {
940
795
  this.refState.mode = RefStateMode.Master;
941
796
  }
942
797
  /**
943
- * Configures the client to query content from a specific Release identified
944
- * by its ID for all future queries.
945
- *
946
- * If the `ref` parameter is provided during a query, it takes priority for
947
- * that query.
798
+ * Configures the client to query content from a release with a specific ID.
948
799
  *
949
800
  * @example
950
801
  *
951
802
  * ```ts
952
- * await client.queryContentFromReleaseByID("YLB7OBAAACMA7Cpa")
953
- * const document = await client.getByID("WW4bKScAAMAqmluX")
803
+ * client.queryContentFromReleaseByID("YhE3YhEAACIA4321")
954
804
  * ```
955
805
  *
956
- * @param releaseID - The ID of the Release.
806
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebyid}
957
807
  */
958
808
  queryContentFromReleaseByID(releaseID) {
959
809
  this.refState = {
@@ -963,20 +813,16 @@ var Client = class {
963
813
  };
964
814
  }
965
815
  /**
966
- * Configures the client to query content from a specific Release identified
967
- * by its label for all future queries.
968
- *
969
- * If the `ref` parameter is provided during a query, it takes priority for
970
- * that query.
816
+ * Configures the client to query content from a release with a specific
817
+ * label.
971
818
  *
972
819
  * @example
973
820
  *
974
821
  * ```ts
975
- * await client.queryContentFromReleaseByLabel("My Release")
976
- * const document = await client.getByID("WW4bKScAAMAqmluX")
822
+ * client.queryContentFromReleaseByLabel("My Release")
977
823
  * ```
978
824
  *
979
- * @param releaseLabel - The label of the Release.
825
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebylabel}
980
826
  */
981
827
  queryContentFromReleaseByLabel(releaseLabel) {
982
828
  this.refState = {
@@ -986,21 +832,15 @@ var Client = class {
986
832
  };
987
833
  }
988
834
  /**
989
- * Configures the client to query content from a specific ref. The ref can be
990
- * provided as a string or a function.
991
- *
992
- * If a function is provided, the ref is fetched lazily before each query. The
993
- * function may also be asynchronous.
835
+ * Configures the client to query content from a specific ref.
994
836
  *
995
837
  * @example
996
838
  *
997
839
  * ```ts
998
- * await client.queryContentFromRef("my-ref")
999
- * const document = await client.getByID("WW4bKScAAMAqmluX")
840
+ * client.queryContentFromRef("my-ref")
1000
841
  * ```
1001
842
  *
1002
- * @param ref - The ref or a function that returns the ref from which to query
1003
- * content.
843
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromref}
1004
844
  */
1005
845
  queryContentFromRef(ref) {
1006
846
  this.refState = {
@@ -1010,17 +850,18 @@ var Client = class {
1010
850
  };
1011
851
  }
1012
852
  /**
1013
- * A `fetch()` function to be used with GraphQL clients configured for
1014
- * Prismic's GraphQL API. It automatically applies the necessary `prismic-ref`
1015
- * and Authorization headers. Queries will automatically be minified by
1016
- * removing whitespace where possible.
853
+ * A preconfigured `fetch()` function for Prismic's GraphQL API that can be
854
+ * provided to GraphQL clients.
1017
855
  *
1018
856
  * @example
1019
857
  *
1020
858
  * ```ts
859
+ * import { createClient, getGraphQLEndpoint } from "@prismicio/client"
860
+ *
861
+ * const client = createClient("example-prismic-repo")
1021
862
  * const graphQLClient = new ApolloClient({
1022
863
  * link: new HttpLink({
1023
- * uri: prismic.getGraphQLEndpoint(repositoryName),
864
+ * uri: getGraphQLEndpoint(client.repositoryName),
1024
865
  * // Provide `client.graphQLFetch` as the fetch implementation.
1025
866
  * fetch: client.graphQLFetch,
1026
867
  * // Using GET is required.
@@ -1030,13 +871,7 @@ var Client = class {
1030
871
  * })
1031
872
  * ```
1032
873
  *
1033
- * @param input - The `fetch()` `input` parameter. Only strings are supported.
1034
- * @param init - The `fetch()` `init` parameter. Only plain objects are
1035
- * supported.
1036
- *
1037
- * @returns The `fetch()` Response for the request.
1038
- *
1039
- * @experimental
874
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#graphqlfetch}
1040
875
  */
1041
876
  async graphQLFetch(input, init) {
1042
877
  const repository = await this.getRepository();
@@ -1159,11 +994,8 @@ var Client = class {
1159
994
  * @returns The response from the fetch request.
1160
995
  */
1161
996
  async #request(url, params) {
1162
- return await require_request.request(url, this._buildRequestInit(params), this.fetchFn);
1163
- }
1164
- _buildRequestInit(params) {
1165
997
  var _this$fetchOptions, _params$fetchOptions, _params$fetchOptions2, _this$fetchOptions2;
1166
- return {
998
+ return await require_request.request(url, {
1167
999
  ...this.fetchOptions,
1168
1000
  ...params === null || params === void 0 ? void 0 : params.fetchOptions,
1169
1001
  headers: {
@@ -1171,7 +1003,7 @@ var Client = class {
1171
1003
  ...params === null || params === void 0 || (_params$fetchOptions = params.fetchOptions) === null || _params$fetchOptions === void 0 ? void 0 : _params$fetchOptions.headers
1172
1004
  },
1173
1005
  signal: (params === null || params === void 0 || (_params$fetchOptions2 = params.fetchOptions) === null || _params$fetchOptions2 === void 0 ? void 0 : _params$fetchOptions2.signal) || (params === null || params === void 0 ? void 0 : params.signal) || ((_this$fetchOptions2 = this.fetchOptions) === null || _this$fetchOptions2 === void 0 ? void 0 : _this$fetchOptions2.signal)
1174
- };
1006
+ }, this.fetchFn);
1175
1007
  }
1176
1008
  };
1177
1009