@prismicio/client 6.0.0 → 6.3.0

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
@@ -2,24 +2,82 @@ import * as prismicT from '@prismicio/types';
2
2
  import * as prismicH from '@prismicio/helpers';
3
3
 
4
4
  /**
5
- * Get a repository's Prismic REST API V2 endpoint.
5
+ * Get a repository's Prismic Rest API V2 endpoint.
6
+ *
7
+ * @typeParam RepositoryName - Name of the Prismic repository.
8
+ * @param repositoryName - Name of the repository.
9
+ *
10
+ * @returns The repository's Prismic Rest API V2 endpoint
11
+ * @throws {@link Error} Thrown if an invalid repository name is provided.
12
+ */
13
+ declare const getRepositoryEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
14
+
15
+ /**
16
+ * Get a Prismic repository's name from its standard Prismic Rest API V2 or
17
+ * GraphQL endpoint.
18
+ *
19
+ * @typeParam RepositoryEndpoint - Prismic Rest API V2 endpoint for the repository.
20
+ * @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.
21
+ *
22
+ * @returns The Prismic repository's name.
23
+ * @throws {@link Error} Thrown if an invalid Prismic Rest API V2 endpoint is provided.
24
+ */
25
+ declare const getRepositoryName: (repositoryEndpoint: string) => string;
26
+
27
+ /**
28
+ * Get a repository's Prismic GraphQL endpoint.
6
29
  *
7
30
  * @typeParam RepositoryName - Name of the Prismic repository.
8
31
  * @param repositoryName - Name of the repository.
9
32
  *
10
33
  * @returns The repository's Prismic REST API V2 endpoint
11
34
  */
12
- declare const getEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
35
+ declare const getGraphQLEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/graphql`;
36
+
37
+ /**
38
+ * Determines if an input is a valid Prismic repository name.
39
+ *
40
+ * @param input - Input to test.
41
+ *
42
+ * @returns `true` if `input` is a valid Prismic repository name, `false` otherwise.
43
+ */
44
+ declare const isRepositoryName: (input: string) => boolean;
45
+
46
+ /**
47
+ * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid
48
+ * URL is a valid endpoint to support network proxies.
49
+ *
50
+ * @param input - Input to test.
51
+ *
52
+ * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false` otherwise.
53
+ */
54
+ declare const isRepositoryEndpoint: (input: string) => boolean;
13
55
 
14
56
  /**
15
57
  * A universal API to make network requests. A subset of the `fetch()` API.
58
+ *
59
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}
16
60
  */
17
61
  declare type FetchLike = (input: string, init?: RequestInitLike) => Promise<ResponseLike>;
62
+ /**
63
+ * An object that allows you to abort a `fetch()` request if needed via an
64
+ * `AbortController` object
65
+ *
66
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}
67
+ */
68
+ declare type AbortSignalLike = {
69
+ aborted: any;
70
+ addEventListener: any;
71
+ removeEventListener: any;
72
+ dispatchEvent: any;
73
+ onabort: any;
74
+ };
18
75
  /**
19
76
  * The minimum required properties from RequestInit.
20
77
  */
21
78
  interface RequestInitLike {
22
79
  headers?: Record<string, string>;
80
+ signal?: AbortSignalLike | null;
23
81
  }
24
82
  /**
25
83
  * The minimum required properties from Response.
@@ -224,6 +282,19 @@ declare type ClientConfig = {
224
282
  */
225
283
  fetch?: FetchLike;
226
284
  };
285
+ /**
286
+ * Parameters for any client method that use `fetch()`. Only a subset of
287
+ * `fetch()` parameters are exposed.
288
+ */
289
+ declare type FetchParams = {
290
+ /**
291
+ * An `AbortSignal` provided by an `AbortController`. This allows the network
292
+ * request to be cancelled if necessary.
293
+ *
294
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}
295
+ */
296
+ signal?: AbortSignalLike;
297
+ };
227
298
  /**
228
299
  * Parameters specific to client methods that fetch all documents. These methods
229
300
  * start with `getAll` (for example, `getAllByType`).
@@ -260,14 +331,24 @@ declare type ResolvePreviewArgs = {
260
331
  /**
261
332
  * Creates a Prismic client that can be used to query a repository.
262
333
  *
263
- * @param endpoint - The Prismic REST API V2 endpoint for the repository (use
264
- * `prismic.getEndpoint` for the default endpoint).
334
+ * @example
335
+ *
336
+ * ```ts
337
+ * // With a repository name.
338
+ * createClient("qwerty");
339
+ *
340
+ * // Or with a full Prismic Rest API V2 endpoint.
341
+ * createClient("https://qwerty.cdn.prismic.io/api/v2");
342
+ * ```
343
+ *
344
+ * @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
345
+ * API V2 endpoint for the repository.
265
346
  * @param options - Configuration that determines how content will be queried
266
347
  * from the Prismic repository.
267
348
  *
268
349
  * @returns A client that can query content from the repository.
269
350
  */
270
- declare const createClient: (endpoint: string, options?: ClientConfig | undefined) => Client;
351
+ declare const createClient: (repositoryNameOrEndpoint: string, options?: ClientConfig | undefined) => Client;
271
352
  /**
272
353
  * A client that allows querying content from a Prismic repository.
273
354
  *
@@ -278,7 +359,7 @@ declare const createClient: (endpoint: string, options?: ClientConfig | undefine
278
359
  declare class Client {
279
360
  /**
280
361
  * The Prismic REST API V2 endpoint for the repository (use
281
- * `prismic.getEndpoint` for the default endpoint).
362
+ * `prismic.getRepositoryEndpoint` for the default endpoint).
282
363
  */
283
364
  endpoint: string;
284
365
  /**
@@ -325,14 +406,14 @@ declare class Client {
325
406
  * such as Node.js, the `fetch` option must be provided as part of the
326
407
  * `options` parameter.
327
408
  *
328
- * @param endpoint - The Prismic REST API V2 endpoint for the repository (use
329
- * `prismic.getEndpoint` to get the default endpoint).
409
+ * @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
410
+ * API V2 endpoint for the repository.
330
411
  * @param options - Configuration that determines how content will be queried
331
412
  * from the Prismic repository.
332
413
  *
333
414
  * @returns A client that can query content from the repository.
334
415
  */
335
- constructor(endpoint: string, options?: ClientConfig);
416
+ constructor(repositoryNameOrEndpoint: string, options?: ClientConfig);
336
417
  /**
337
418
  * Enables the client to automatically query content from a preview session if
338
419
  * one is active in browser environments. This is enabled by default in the browser.
@@ -397,7 +478,7 @@ declare class Client {
397
478
  *
398
479
  * @returns A paginated response containing the result of the query.
399
480
  */
400
- query<TDocument extends prismicT.PrismicDocument>(predicates: NonNullable<BuildQueryURLArgs["predicates"]>, params?: Partial<Omit<BuildQueryURLArgs, "predicates">>): Promise<prismicT.Query<TDocument>>;
481
+ query<TDocument extends prismicT.PrismicDocument>(predicates: NonNullable<BuildQueryURLArgs["predicates"]>, params?: Partial<Omit<BuildQueryURLArgs, "predicates">> & FetchParams): Promise<prismicT.Query<TDocument>>;
401
482
  /**
402
483
  * Queries content from the Prismic repository.
403
484
  *
@@ -412,7 +493,7 @@ declare class Client {
412
493
  *
413
494
  * @returns A paginated response containing the result of the query.
414
495
  */
415
- get<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
496
+ get<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
416
497
  /**
417
498
  * Queries content from the Prismic repository and returns only the first
418
499
  * result, if any.
@@ -427,7 +508,7 @@ declare class Client {
427
508
  * @param params - Parameters to filter, sort, and paginate results. @returns
428
509
  * The first result of the query, if any.
429
510
  */
430
- getFirst<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
511
+ getFirst<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
431
512
  /**
432
513
  * **IMPORTANT**: Avoid using `dangerouslyGetAll` as it may be slower and
433
514
  * require more resources than other methods. Prefer using other methods that
@@ -449,7 +530,7 @@ declare class Client {
449
530
  *
450
531
  * @returns A list of documents matching the query.
451
532
  */
452
- dangerouslyGetAll<TDocument extends prismicT.PrismicDocument>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams): Promise<TDocument[]>;
533
+ dangerouslyGetAll<TDocument extends prismicT.PrismicDocument>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
453
534
  /**
454
535
  * Queries a document from the Prismic repository with a specific ID.
455
536
  *
@@ -470,7 +551,7 @@ declare class Client {
470
551
  * @returns The document with an ID matching the `id` parameter, if a matching
471
552
  * document exists.
472
553
  */
473
- getByID<TDocument extends prismicT.PrismicDocument>(id: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
554
+ getByID<TDocument extends prismicT.PrismicDocument>(id: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
474
555
  /**
475
556
  * Queries documents from the Prismic repository with specific IDs.
476
557
  *
@@ -494,7 +575,7 @@ declare class Client {
494
575
  * @returns A paginated response containing documents with IDs matching the
495
576
  * `ids` parameter.
496
577
  */
497
- getByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
578
+ getByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
498
579
  /**
499
580
  * Queries all documents from the Prismic repository with specific IDs.
500
581
  *
@@ -519,7 +600,7 @@ declare class Client {
519
600
  *
520
601
  * @returns A list of documents with IDs matching the `ids` parameter.
521
602
  */
522
- getAllByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
603
+ getAllByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument[]>;
523
604
  /**
524
605
  * Queries a document from the Prismic repository with a specific UID and Custom Type.
525
606
  *
@@ -541,7 +622,7 @@ declare class Client {
541
622
  * @returns The document with a UID matching the `uid` parameter, if a
542
623
  * matching document exists.
543
624
  */
544
- getByUID<TDocument extends prismicT.PrismicDocument>(documentType: string, uid: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
625
+ getByUID<TDocument extends prismicT.PrismicDocument>(documentType: string, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
545
626
  /**
546
627
  * Queries document from the Prismic repository with specific UIDs and Custom Type.
547
628
  *
@@ -566,7 +647,7 @@ declare class Client {
566
647
  * @returns A paginated response containing documents with UIDs matching the
567
648
  * `uids` parameter.
568
649
  */
569
- getByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
650
+ getByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
570
651
  /**
571
652
  * Queries all documents from the Prismic repository with specific UIDs and Custom Type.
572
653
  *
@@ -592,7 +673,7 @@ declare class Client {
592
673
  *
593
674
  * @returns A list of documents with UIDs matching the `uids` parameter.
594
675
  */
595
- getAllByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
676
+ getAllByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument[]>;
596
677
  /**
597
678
  * Queries a singleton document from the Prismic repository for a specific Custom Type.
598
679
  *
@@ -613,7 +694,7 @@ declare class Client {
613
694
  *
614
695
  * @returns The singleton document for the Custom Type, if a matching document exists.
615
696
  */
616
- getSingle<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
697
+ getSingle<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
617
698
  /**
618
699
  * Queries documents from the Prismic repository for a specific Custom Type.
619
700
  *
@@ -632,7 +713,7 @@ declare class Client {
632
713
  *
633
714
  * @returns A paginated response containing documents of the Custom Type.
634
715
  */
635
- getByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
716
+ getByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
636
717
  /**
637
718
  * Queries all documents from the Prismic repository for a specific Custom Type.
638
719
  *
@@ -650,7 +731,7 @@ declare class Client {
650
731
  *
651
732
  * @returns A list of all documents of the Custom Type.
652
733
  */
653
- getAllByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
734
+ getAllByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams): Promise<TDocument[]>;
654
735
  /**
655
736
  * Queries documents from the Prismic repository with a specific tag.
656
737
  *
@@ -668,7 +749,7 @@ declare class Client {
668
749
  *
669
750
  * @returns A paginated response containing documents with the tag.
670
751
  */
671
- getByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
752
+ getByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
672
753
  /**
673
754
  * Queries all documents from the Prismic repository with a specific tag.
674
755
  *
@@ -686,7 +767,7 @@ declare class Client {
686
767
  *
687
768
  * @returns A list of all documents with the tag.
688
769
  */
689
- getAllByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
770
+ getAllByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams): Promise<TDocument[]>;
690
771
  /**
691
772
  * Queries documents from the Prismic repository with specific tags. A
692
773
  * document must be tagged with all of the queried tags to be included.
@@ -703,7 +784,7 @@ declare class Client {
703
784
  *
704
785
  * @returns A paginated response containing documents with the tags.
705
786
  */
706
- getByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
787
+ getByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
707
788
  /**
708
789
  * Queries documents from the Prismic repository with specific tags. A
709
790
  * document must be tagged with all of the queried tags to be included.
@@ -722,7 +803,7 @@ declare class Client {
722
803
  *
723
804
  * @returns A list of all documents with the tags.
724
805
  */
725
- getAllByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
806
+ getAllByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams): Promise<TDocument[]>;
726
807
  /**
727
808
  * Queries documents from the Prismic repository with specific tags. A
728
809
  * document must be tagged with at least one of the queried tags to be included.
@@ -739,7 +820,7 @@ declare class Client {
739
820
  *
740
821
  * @returns A paginated response containing documents with at least one of the tags.
741
822
  */
742
- getBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
823
+ getBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<prismicT.Query<TDocument>>;
743
824
  /**
744
825
  * Queries documents from the Prismic repository with specific tags. A
745
826
  * document must be tagged with at least one of the queried tags to be included.
@@ -758,14 +839,14 @@ declare class Client {
758
839
  *
759
840
  * @returns A list of all documents with at least one of the tags.
760
841
  */
761
- getAllBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
842
+ getAllBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & FetchParams): Promise<TDocument[]>;
762
843
  /**
763
844
  * Returns metadata about the Prismic repository, such as its refs, releases,
764
845
  * and custom types.
765
846
  *
766
847
  * @returns Repository metadata.
767
848
  */
768
- getRepository(): Promise<prismicT.Repository>;
849
+ getRepository(params?: FetchParams): Promise<prismicT.Repository>;
769
850
  /**
770
851
  * Returns a list of all refs for the Prismic repository.
771
852
  *
@@ -775,7 +856,7 @@ declare class Client {
775
856
  *
776
857
  * @returns A list of all refs for the Prismic repository.
777
858
  */
778
- getRefs(): Promise<prismicT.Ref[]>;
859
+ getRefs(params?: FetchParams): Promise<prismicT.Ref[]>;
779
860
  /**
780
861
  * Returns a ref for the Prismic repository with a matching ID.
781
862
  *
@@ -783,7 +864,7 @@ declare class Client {
783
864
  *
784
865
  * @returns The ref with a matching ID, if it exists.
785
866
  */
786
- getRefByID(id: string): Promise<prismicT.Ref>;
867
+ getRefByID(id: string, params?: FetchParams): Promise<prismicT.Ref>;
787
868
  /**
788
869
  * Returns a ref for the Prismic repository with a matching label.
789
870
  *
@@ -791,21 +872,21 @@ declare class Client {
791
872
  *
792
873
  * @returns The ref with a matching label, if it exists.
793
874
  */
794
- getRefByLabel(label: string): Promise<prismicT.Ref>;
875
+ getRefByLabel(label: string, params?: FetchParams): Promise<prismicT.Ref>;
795
876
  /**
796
877
  * Returns the master ref for the Prismic repository. The master ref points to
797
878
  * the repository's latest published content.
798
879
  *
799
880
  * @returns The repository's master ref.
800
881
  */
801
- getMasterRef(): Promise<prismicT.Ref>;
882
+ getMasterRef(params?: FetchParams): Promise<prismicT.Ref>;
802
883
  /**
803
884
  * Returns a list of all Releases for the Prismic repository. Releases are
804
885
  * used to group content changes before publishing.
805
886
  *
806
887
  * @returns A list of all Releases for the Prismic repository.
807
888
  */
808
- getReleases(): Promise<prismicT.Ref[]>;
889
+ getReleases(params?: FetchParams): Promise<prismicT.Ref[]>;
809
890
  /**
810
891
  * Returns a Release for the Prismic repository with a matching ID.
811
892
  *
@@ -813,7 +894,7 @@ declare class Client {
813
894
  *
814
895
  * @returns The Release with a matching ID, if it exists.
815
896
  */
816
- getReleaseByID(id: string): Promise<prismicT.Ref>;
897
+ getReleaseByID(id: string, params?: FetchParams): Promise<prismicT.Ref>;
817
898
  /**
818
899
  * Returns a Release for the Prismic repository with a matching label.
819
900
  *
@@ -821,13 +902,13 @@ declare class Client {
821
902
  *
822
903
  * @returns The ref with a matching label, if it exists.
823
904
  */
824
- getReleaseByLabel(label: string): Promise<prismicT.Ref>;
905
+ getReleaseByLabel(label: string, params?: FetchParams): Promise<prismicT.Ref>;
825
906
  /**
826
907
  * Returns a list of all tags used in the Prismic repository.
827
908
  *
828
909
  * @returns A list of all tags used in the repository.
829
910
  */
830
- getTags(): Promise<string[]>;
911
+ getTags(params?: FetchParams): Promise<string[]>;
831
912
  /**
832
913
  * Builds a URL used to query content from the Prismic repository.
833
914
  *
@@ -835,7 +916,7 @@ declare class Client {
835
916
  *
836
917
  * @returns A URL string that can be requested to query content.
837
918
  */
838
- buildQueryURL(params?: Partial<BuildQueryURLArgs>): Promise<string>;
919
+ buildQueryURL({ signal, ...params }?: Partial<BuildQueryURLArgs> & FetchParams): Promise<string>;
839
920
  /**
840
921
  * Determines the URL for a previewed document during an active preview
841
922
  * session. The result of this method should be used to redirect the user to
@@ -855,7 +936,7 @@ declare class Client {
855
936
  * @returns The URL for the previewed document during an active preview
856
937
  * session. The user should be redirected to this URL.
857
938
  */
858
- resolvePreviewURL(args: ResolvePreviewArgs): Promise<string>;
939
+ resolvePreviewURL(args: ResolvePreviewArgs & FetchParams): Promise<string>;
859
940
  /**
860
941
  * Configures the client to query the latest published content for all future queries.
861
942
  *
@@ -918,6 +999,34 @@ declare class Client {
918
999
  * @param ref - The ref or a function that returns the ref from which to query content.
919
1000
  */
920
1001
  queryContentFromRef(ref: RefStringOrThunk): void;
1002
+ /**
1003
+ * A `fetch()` function to be used with GraphQL clients configured for
1004
+ * Prismic's GraphQL API. It automatically applies the necessary `prismic-ref`
1005
+ * and Authorization headers. Queries will automatically be minified by
1006
+ * removing whitespace where possible.
1007
+ *
1008
+ * @example
1009
+ *
1010
+ * ```ts
1011
+ * const graphqlClient = new ApolloClient({
1012
+ * link: new HttpLink({
1013
+ * uri: prismic.getGraphQLEndpoint(repositoryName),
1014
+ * // Provide `client.graphqlFetch` as the fetch implementation.
1015
+ * fetch: client.graphqlFetch,
1016
+ * // Using GET is required.
1017
+ * useGETForQueries: true,
1018
+ * }),
1019
+ * cache: new InMemoryCache(),
1020
+ * });
1021
+ * ```
1022
+ *
1023
+ * @param input - The `fetch()` `input` parameter. Only strings are supported.
1024
+ * @param init - The `fetch()` `init` parameter. Only plain objects are supported.
1025
+ *
1026
+ * @returns The `fetch()` Response for the request.
1027
+ * @experimental
1028
+ */
1029
+ graphqlFetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
921
1030
  /**
922
1031
  * Returns a cached version of `getRepository` with a TTL.
923
1032
  *
@@ -1222,6 +1331,11 @@ declare namespace cookie {
1222
1331
  };
1223
1332
  }
1224
1333
 
1334
+ /**
1335
+ * @deprecated Renamed to `getRepositoryEndpoint`.
1336
+ */
1337
+ declare const getEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
1338
+
1225
1339
  /**
1226
1340
  * @deprecated Renamed to `predicate` (without an "s").
1227
1341
  */
@@ -1289,4 +1403,4 @@ declare const Predicates: {
1289
1403
  dateHourBefore: (path: string, hour: number) => string;
1290
1404
  };
1291
1405
 
1292
- export { BuildQueryURLArgs, Client, ClientConfig, FetchLike, ForbiddenError, HttpRequestLike, NotFoundError, Ordering, ParsingError, Predicates, PrismicError, QueryParams, RequestInitLike, ResponseLike, Route, buildQueryURL, cookie, createClient, getEndpoint, predicate, predicates };
1406
+ export { BuildQueryURLArgs, Client, ClientConfig, FetchLike, ForbiddenError, HttpRequestLike, NotFoundError, Ordering, ParsingError, Predicates, PrismicError, QueryParams, RequestInitLike, ResponseLike, Route, buildQueryURL, cookie, createClient, getEndpoint, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, isRepositoryEndpoint, isRepositoryName, predicate, predicates };