@prismicio/client 7.21.0-pr.415.5ae3e57 → 7.21.0-pr.416.a60d634

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