@prismicio/client 6.4.3 → 6.6.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/src/client.ts CHANGED
@@ -11,7 +11,12 @@ import { getCookie } from "./lib/getCookie";
11
11
  import { minifyGraphQLQuery } from "./lib/minifyGraphQLQuery";
12
12
 
13
13
  import * as cookie from "./cookie";
14
- import { AbortSignalLike, FetchLike, HttpRequestLike } from "./types";
14
+ import {
15
+ AbortSignalLike,
16
+ FetchLike,
17
+ HttpRequestLike,
18
+ ExtractDocumentType,
19
+ } from "./types";
15
20
  import { ForbiddenError } from "./ForbiddenError";
16
21
  import { NotFoundError } from "./NotFoundError";
17
22
  import { ParsingError } from "./ParsingError";
@@ -236,6 +241,16 @@ const everyTagPredicate = (tags: string | string[]): string =>
236
241
  const someTagsPredicate = (tags: string | string[]): string =>
237
242
  predicate.any("document.tags", castArray(tags));
238
243
 
244
+ /**
245
+ * Type definitions for the `createClient()` function. May be augmented by
246
+ * third-party libraries.
247
+ */
248
+ export interface CreateClient {
249
+ <TDocuments extends prismicT.PrismicDocument>(
250
+ ...args: ConstructorParameters<typeof Client>
251
+ ): Client<TDocuments>;
252
+ }
253
+
239
254
  /**
240
255
  * Creates a Prismic client that can be used to query a repository.
241
256
  *
@@ -249,6 +264,8 @@ const someTagsPredicate = (tags: string | string[]): string =>
249
264
  * createClient("https://qwerty.cdn.prismic.io/api/v2");
250
265
  * ```
251
266
  *
267
+ * @typeParam TDocuments - A map of Prismic document type IDs mapped to their
268
+ * TypeScript type.
252
269
  * @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
253
270
  * API V2 endpoint for the repository.
254
271
  * @param options - Configuration that determines how content will be queried
@@ -256,9 +273,12 @@ const someTagsPredicate = (tags: string | string[]): string =>
256
273
  *
257
274
  * @returns A client that can query content from the repository.
258
275
  */
259
- export const createClient = (
260
- ...args: ConstructorParameters<typeof Client>
261
- ): Client => new Client(...args);
276
+ export const createClient: CreateClient = <
277
+ TDocuments extends prismicT.PrismicDocument,
278
+ >(
279
+ repositoryNameOrEndpoint: string,
280
+ options?: ClientConfig,
281
+ ) => new Client<TDocuments>(repositoryNameOrEndpoint, options);
262
282
 
263
283
  /**
264
284
  * A client that allows querying content from a Prismic repository.
@@ -266,8 +286,13 @@ export const createClient = (
266
286
  * If used in an environment where a global `fetch` function is unavailable,
267
287
  * such as Node.js, the `fetch` option must be provided as part of the `options`
268
288
  * parameter.
289
+ *
290
+ * @typeParam TDocuments - Document types that are registered for the Prismic
291
+ * repository. Query methods will automatically be typed based on this type.
269
292
  */
270
- export class Client {
293
+ export class Client<
294
+ TDocuments extends prismicT.PrismicDocument = prismicT.PrismicDocument,
295
+ > {
271
296
  /**
272
297
  * The Prismic REST API V2 endpoint for the repository (use
273
298
  * `prismic.getRepositoryEndpoint` for the default endpoint).
@@ -458,7 +483,7 @@ export class Client {
458
483
  *
459
484
  * @returns A paginated response containing the result of the query.
460
485
  */
461
- async query<TDocument extends prismicT.PrismicDocument>(
486
+ async query<TDocument extends TDocuments>(
462
487
  predicates: NonNullable<BuildQueryURLArgs["predicates"]>,
463
488
  params?: Partial<Omit<BuildQueryURLArgs, "predicates">> & FetchParams,
464
489
  ): Promise<prismicT.Query<TDocument>> {
@@ -481,7 +506,7 @@ export class Client {
481
506
  *
482
507
  * @returns A paginated response containing the result of the query.
483
508
  */
484
- async get<TDocument extends prismicT.PrismicDocument>(
509
+ async get<TDocument extends TDocuments>(
485
510
  params?: Partial<BuildQueryURLArgs> & FetchParams,
486
511
  ): Promise<prismicT.Query<TDocument>> {
487
512
  const url = await this.buildQueryURL(params);
@@ -503,7 +528,7 @@ export class Client {
503
528
  * @param params - Parameters to filter, sort, and paginate results. @returns
504
529
  * The first result of the query, if any.
505
530
  */
506
- async getFirst<TDocument extends prismicT.PrismicDocument>(
531
+ async getFirst<TDocument extends TDocuments>(
507
532
  params?: Partial<BuildQueryURLArgs> & FetchParams,
508
533
  ): Promise<TDocument> {
509
534
  const url = await this.buildQueryURL(params);
@@ -539,7 +564,7 @@ export class Client {
539
564
  *
540
565
  * @returns A list of documents matching the query.
541
566
  */
542
- async dangerouslyGetAll<TDocument extends prismicT.PrismicDocument>(
567
+ async dangerouslyGetAll<TDocument extends TDocuments>(
543
568
  params: Partial<Omit<BuildQueryURLArgs, "page">> &
544
569
  GetAllParams &
545
570
  FetchParams = {},
@@ -593,7 +618,7 @@ export class Client {
593
618
  * @returns The document with an ID matching the `id` parameter, if a matching
594
619
  * document exists.
595
620
  */
596
- async getByID<TDocument extends prismicT.PrismicDocument>(
621
+ async getByID<TDocument extends TDocuments>(
597
622
  id: string,
598
623
  params?: Partial<BuildQueryURLArgs> & FetchParams,
599
624
  ): Promise<TDocument> {
@@ -625,7 +650,7 @@ export class Client {
625
650
  * @returns A paginated response containing documents with IDs matching the
626
651
  * `ids` parameter.
627
652
  */
628
- async getByIDs<TDocument extends prismicT.PrismicDocument>(
653
+ async getByIDs<TDocument extends TDocuments>(
629
654
  ids: string[],
630
655
  params?: Partial<BuildQueryURLArgs> & FetchParams,
631
656
  ): Promise<prismicT.Query<TDocument>> {
@@ -658,7 +683,7 @@ export class Client {
658
683
  *
659
684
  * @returns A list of documents with IDs matching the `ids` parameter.
660
685
  */
661
- async getAllByIDs<TDocument extends prismicT.PrismicDocument>(
686
+ async getAllByIDs<TDocument extends TDocuments>(
662
687
  ids: string[],
663
688
  params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams,
664
689
  ): Promise<TDocument[]> {
@@ -688,12 +713,15 @@ export class Client {
688
713
  * @returns The document with a UID matching the `uid` parameter, if a
689
714
  * matching document exists.
690
715
  */
691
- async getByUID<TDocument extends prismicT.PrismicDocument>(
692
- documentType: string,
716
+ async getByUID<
717
+ TDocument extends TDocuments,
718
+ TDocumentType extends TDocument["type"] = TDocument["type"],
719
+ >(
720
+ documentType: TDocumentType,
693
721
  uid: string,
694
722
  params?: Partial<BuildQueryURLArgs> & FetchParams,
695
- ): Promise<TDocument> {
696
- return await this.getFirst<TDocument>(
723
+ ): Promise<ExtractDocumentType<TDocuments, TDocumentType>> {
724
+ return await this.getFirst<ExtractDocumentType<TDocuments, TDocumentType>>(
697
725
  appendPredicates(params, [
698
726
  typePredicate(documentType),
699
727
  predicate.at(`my.${documentType}.uid`, uid),
@@ -725,12 +753,15 @@ export class Client {
725
753
  * @returns A paginated response containing documents with UIDs matching the
726
754
  * `uids` parameter.
727
755
  */
728
- async getByUIDs<TDocument extends prismicT.PrismicDocument>(
729
- documentType: string,
756
+ async getByUIDs<
757
+ TDocument extends TDocuments,
758
+ TDocumentType extends TDocument["type"] = TDocument["type"],
759
+ >(
760
+ documentType: TDocumentType,
730
761
  uids: string[],
731
762
  params?: Partial<BuildQueryURLArgs> & FetchParams,
732
- ): Promise<prismicT.Query<TDocument>> {
733
- return await this.get<TDocument>(
763
+ ): Promise<prismicT.Query<ExtractDocumentType<TDocuments, TDocumentType>>> {
764
+ return await this.get<ExtractDocumentType<TDocuments, TDocumentType>>(
734
765
  appendPredicates(params, [
735
766
  typePredicate(documentType),
736
767
  predicate.in(`my.${documentType}.uid`, uids),
@@ -763,12 +794,17 @@ export class Client {
763
794
  *
764
795
  * @returns A list of documents with UIDs matching the `uids` parameter.
765
796
  */
766
- async getAllByUIDs<TDocument extends prismicT.PrismicDocument>(
767
- documentType: string,
797
+ async getAllByUIDs<
798
+ TDocument extends TDocuments,
799
+ TDocumentType extends TDocument["type"] = TDocument["type"],
800
+ >(
801
+ documentType: TDocumentType,
768
802
  uids: string[],
769
803
  params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams,
770
- ): Promise<TDocument[]> {
771
- return await this.dangerouslyGetAll<TDocument>(
804
+ ): Promise<ExtractDocumentType<TDocuments, TDocumentType>[]> {
805
+ return await this.dangerouslyGetAll<
806
+ ExtractDocumentType<TDocuments, TDocumentType>
807
+ >(
772
808
  appendPredicates(params, [
773
809
  typePredicate(documentType),
774
810
  predicate.in(`my.${documentType}.uid`, uids),
@@ -796,11 +832,14 @@ export class Client {
796
832
  *
797
833
  * @returns The singleton document for the Custom Type, if a matching document exists.
798
834
  */
799
- async getSingle<TDocument extends prismicT.PrismicDocument>(
800
- documentType: string,
835
+ async getSingle<
836
+ TDocument extends TDocuments,
837
+ TDocumentType extends TDocument["type"] = TDocument["type"],
838
+ >(
839
+ documentType: TDocumentType,
801
840
  params?: Partial<BuildQueryURLArgs> & FetchParams,
802
- ): Promise<TDocument> {
803
- return await this.getFirst<TDocument>(
841
+ ): Promise<ExtractDocumentType<TDocuments, TDocumentType>> {
842
+ return await this.getFirst<ExtractDocumentType<TDocuments, TDocumentType>>(
804
843
  appendPredicates(params, typePredicate(documentType)),
805
844
  );
806
845
  }
@@ -823,11 +862,14 @@ export class Client {
823
862
  *
824
863
  * @returns A paginated response containing documents of the Custom Type.
825
864
  */
826
- async getByType<TDocument extends prismicT.PrismicDocument>(
827
- documentType: string,
865
+ async getByType<
866
+ TDocument extends TDocuments,
867
+ TDocumentType extends TDocument["type"] = TDocument["type"],
868
+ >(
869
+ documentType: TDocumentType,
828
870
  params?: Partial<BuildQueryURLArgs> & FetchParams,
829
- ): Promise<prismicT.Query<TDocument>> {
830
- return await this.get<TDocument>(
871
+ ): Promise<prismicT.Query<ExtractDocumentType<TDocuments, TDocumentType>>> {
872
+ return await this.get<ExtractDocumentType<TDocuments, TDocumentType>>(
831
873
  appendPredicates(params, typePredicate(documentType)),
832
874
  );
833
875
  }
@@ -849,15 +891,18 @@ export class Client {
849
891
  *
850
892
  * @returns A list of all documents of the Custom Type.
851
893
  */
852
- async getAllByType<TDocument extends prismicT.PrismicDocument>(
853
- documentType: string,
894
+ async getAllByType<
895
+ TDocument extends TDocuments,
896
+ TDocumentType extends TDocument["type"] = TDocument["type"],
897
+ >(
898
+ documentType: TDocumentType,
854
899
  params?: Partial<Omit<BuildQueryURLArgs, "page">> &
855
900
  GetAllParams &
856
901
  FetchParams,
857
- ): Promise<TDocument[]> {
858
- return await this.dangerouslyGetAll<TDocument>(
859
- appendPredicates(params, typePredicate(documentType)),
860
- );
902
+ ): Promise<ExtractDocumentType<TDocuments, TDocumentType>[]> {
903
+ return await this.dangerouslyGetAll<
904
+ ExtractDocumentType<TDocuments, TDocumentType>
905
+ >(appendPredicates(params, typePredicate(documentType)));
861
906
  }
862
907
 
863
908
  /**
@@ -877,7 +922,7 @@ export class Client {
877
922
  *
878
923
  * @returns A paginated response containing documents with the tag.
879
924
  */
880
- async getByTag<TDocument extends prismicT.PrismicDocument>(
925
+ async getByTag<TDocument extends TDocuments>(
881
926
  tag: string,
882
927
  params?: Partial<BuildQueryURLArgs> & FetchParams,
883
928
  ): Promise<prismicT.Query<TDocument>> {
@@ -903,7 +948,7 @@ export class Client {
903
948
  *
904
949
  * @returns A list of all documents with the tag.
905
950
  */
906
- async getAllByTag<TDocument extends prismicT.PrismicDocument>(
951
+ async getAllByTag<TDocument extends TDocuments>(
907
952
  tag: string,
908
953
  params?: Partial<Omit<BuildQueryURLArgs, "page">> &
909
954
  GetAllParams &
@@ -930,7 +975,7 @@ export class Client {
930
975
  *
931
976
  * @returns A paginated response containing documents with the tags.
932
977
  */
933
- async getByEveryTag<TDocument extends prismicT.PrismicDocument>(
978
+ async getByEveryTag<TDocument extends TDocuments>(
934
979
  tags: string[],
935
980
  params?: Partial<BuildQueryURLArgs> & FetchParams,
936
981
  ): Promise<prismicT.Query<TDocument>> {
@@ -957,7 +1002,7 @@ export class Client {
957
1002
  *
958
1003
  * @returns A list of all documents with the tags.
959
1004
  */
960
- async getAllByEveryTag<TDocument extends prismicT.PrismicDocument>(
1005
+ async getAllByEveryTag<TDocument extends TDocuments>(
961
1006
  tags: string[],
962
1007
  params?: Partial<Omit<BuildQueryURLArgs, "page">> &
963
1008
  GetAllParams &
@@ -984,7 +1029,7 @@ export class Client {
984
1029
  *
985
1030
  * @returns A paginated response containing documents with at least one of the tags.
986
1031
  */
987
- async getBySomeTags<TDocument extends prismicT.PrismicDocument>(
1032
+ async getBySomeTags<TDocument extends TDocuments>(
988
1033
  tags: string[],
989
1034
  params?: Partial<BuildQueryURLArgs> & FetchParams,
990
1035
  ): Promise<prismicT.Query<TDocument>> {
@@ -1011,7 +1056,7 @@ export class Client {
1011
1056
  *
1012
1057
  * @returns A list of all documents with at least one of the tags.
1013
1058
  */
1014
- async getAllBySomeTags<TDocument extends prismicT.PrismicDocument>(
1059
+ async getAllBySomeTags<TDocument extends TDocuments>(
1015
1060
  tags: string[],
1016
1061
  params?: Partial<Omit<BuildQueryURLArgs, "page">> &
1017
1062
  GetAllParams &
@@ -1150,7 +1195,13 @@ export class Client {
1150
1195
  try {
1151
1196
  const tagsForm = await this.getCachedRepositoryForm("tags", params);
1152
1197
 
1153
- return await this.fetch<string[]>(tagsForm.action);
1198
+ const url = new URL(tagsForm.action);
1199
+
1200
+ if (this.accessToken) {
1201
+ url.searchParams.set("access_token", this.accessToken);
1202
+ }
1203
+
1204
+ return await this.fetch<string[]>(url.toString(), params);
1154
1205
  } catch {
1155
1206
  const repository = await this.getRepository(params);
1156
1207
 
@@ -1207,19 +1258,30 @@ export class Client {
1207
1258
  async resolvePreviewURL<LinkResolverReturnType>(
1208
1259
  args: ResolvePreviewArgs<LinkResolverReturnType> & FetchParams,
1209
1260
  ): Promise<string> {
1210
- let documentID = args.documentID;
1211
- let previewToken = args.previewToken;
1261
+ let documentID: string | undefined | null = args.documentID;
1262
+ let previewToken: string | undefined | null = args.previewToken;
1212
1263
 
1213
1264
  if (typeof globalThis.location !== "undefined") {
1214
1265
  const searchParams = new URLSearchParams(globalThis.location.search);
1215
1266
 
1216
- documentID = documentID || searchParams.get("documentId") || undefined;
1217
- previewToken = previewToken || searchParams.get("token") || undefined;
1218
- } else if (this.refState.httpRequest?.query) {
1219
- documentID =
1220
- documentID || (this.refState.httpRequest.query.documentId as string);
1221
- previewToken =
1222
- previewToken || (this.refState.httpRequest.query.token as string);
1267
+ documentID = documentID || searchParams.get("documentId");
1268
+ previewToken = previewToken || searchParams.get("token");
1269
+ } else if (this.refState.httpRequest) {
1270
+ if ("query" in this.refState.httpRequest) {
1271
+ documentID =
1272
+ documentID || (this.refState.httpRequest.query?.documentId as string);
1273
+ previewToken =
1274
+ previewToken || (this.refState.httpRequest.query?.token as string);
1275
+ } else if (
1276
+ "url" in this.refState.httpRequest &&
1277
+ this.refState.httpRequest.url
1278
+ ) {
1279
+ const searchParams = new URL(this.refState.httpRequest.url)
1280
+ .searchParams;
1281
+
1282
+ documentID = documentID || searchParams.get("documentId");
1283
+ previewToken = previewToken || searchParams.get("token");
1284
+ }
1223
1285
  }
1224
1286
 
1225
1287
  if (documentID != null && previewToken != null) {
@@ -1492,15 +1554,27 @@ export class Client {
1492
1554
  */
1493
1555
  private async getResolvedRefString(params?: FetchParams): Promise<string> {
1494
1556
  if (this.refState.autoPreviewsEnabled) {
1495
- let previewRef: string | undefined = undefined;
1557
+ let previewRef: string | undefined;
1558
+
1559
+ let cookieJar: string | null | undefined;
1496
1560
 
1497
1561
  if (globalThis.document?.cookie) {
1498
- previewRef = getCookie(cookie.preview, globalThis.document.cookie);
1499
- } else if (this.refState.httpRequest?.headers?.cookie) {
1500
- previewRef = getCookie(
1501
- cookie.preview,
1502
- this.refState.httpRequest.headers.cookie,
1503
- );
1562
+ cookieJar = globalThis.document.cookie;
1563
+ } else if (this.refState.httpRequest?.headers) {
1564
+ if (
1565
+ "get" in this.refState.httpRequest.headers &&
1566
+ typeof this.refState.httpRequest.headers.get === "function"
1567
+ ) {
1568
+ // Web API Headers
1569
+ cookieJar = this.refState.httpRequest.headers.get("cookie");
1570
+ } else if ("cookie" in this.refState.httpRequest.headers) {
1571
+ // Express-style headers
1572
+ cookieJar = this.refState.httpRequest.headers.cookie;
1573
+ }
1574
+ }
1575
+
1576
+ if (cookieJar) {
1577
+ previewRef = getCookie(cookie.preview, cookieJar);
1504
1578
  }
1505
1579
 
1506
1580
  if (previewRef) {
package/src/index.ts CHANGED
@@ -37,7 +37,7 @@ export { NotFoundError } from "./NotFoundError";
37
37
  export * as cookie from "./cookie";
38
38
 
39
39
  // General types used throughout the project. These are made public to allow users to better type their projects.
40
- export type { ClientConfig } from "./client";
40
+ export type { CreateClient, ClientConfig } from "./client";
41
41
  export type { QueryParams, BuildQueryURLArgs } from "./buildQueryURL";
42
42
  export type {
43
43
  FetchLike,
@@ -47,12 +47,12 @@ const getAll = (cookieStore: string): { [name: string]: string } =>
47
47
  /**
48
48
  * Returns the value of a cookie from a given cookie store.
49
49
  *
50
- * @param Name - Of the cookie.
51
- * @param cookieStore - The stringified cookie store from which to read the cookie.
50
+ * @param name - Of the cookie.
51
+ * @param cookieJar - The stringified cookie store from which to read the cookie.
52
52
  *
53
53
  * @returns The value of the cookie, if it exists.
54
54
  */
55
55
  export const getCookie = (
56
56
  name: string,
57
- cookieStore: string,
58
- ): string | undefined => getAll(cookieStore)[name];
57
+ cookieJar: string,
58
+ ): string | undefined => getAll(cookieJar)[name];
package/src/predicate.ts CHANGED
@@ -104,11 +104,13 @@ export const predicate = {
104
104
 
105
105
  /**
106
106
  * The `not` predicate checks that the path doesn't match the provided value
107
- * exactly. It takes a single value as the argument.
107
+ * exactly. It takes a single value for a field or an array (only for tags).
108
108
  *
109
109
  * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
110
110
  */
111
- not: pathWithArgsPredicate<[value: string | number | boolean | Date]>("not"),
111
+ not: pathWithArgsPredicate<
112
+ [value: string | number | boolean | Date | string[]]
113
+ >("not"),
112
114
 
113
115
  /**
114
116
  * The `any` predicate takes an array of values. It works exactly the same way
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as prismicT from "@prismicio/types";
2
+
1
3
  /**
2
4
  * Create a union of the given object's values, and optionally specify which
3
5
  * keys to get the values from.
@@ -12,6 +14,40 @@ export type ValueOf<
12
14
  ValueType extends keyof ObjectType = keyof ObjectType,
13
15
  > = ObjectType[ValueType];
14
16
 
17
+ /**
18
+ * Functions like TypeScript's native `Extract` utility type with added support
19
+ * to fall back to a value if the resulting union is `never`.
20
+ *
21
+ * @example
22
+ *
23
+ * ```ts
24
+ * ExtractOrFallback<"a" | "b", "a"> // => "a"
25
+ * ExtractOrFallback<"a" | "b", "c"> // => "a" | "b"
26
+ * ExtractOrFallback<"a" | "b", "c", "foo"> // => "foo"
27
+ * ```
28
+ *
29
+ * @typeParam T - The union from which values will be extracted.
30
+ * @typeParam U - The extraction condition.
31
+ * @typeParam Fallback - The value to return if the resulting union is `never`.
32
+ * Defaults to `T`.
33
+ */
34
+ type ExtractOrFallback<T, U, Fallback = T> = Extract<T, U> extends never
35
+ ? Fallback
36
+ : Extract<T, U>;
37
+
38
+ /**
39
+ * Extracts one or more Prismic document types that match a given Prismic
40
+ * document type. If no matches are found, no extraction is performed and the
41
+ * union of all provided Prismic document types are returned.
42
+ *
43
+ * @typeParam TDocuments - Prismic document types from which to extract.
44
+ * @typeParam TDocumentType - Type(s) to match `TDocuments` against.
45
+ */
46
+ export type ExtractDocumentType<
47
+ TDocuments extends prismicT.PrismicDocument,
48
+ TDocumentType extends TDocuments["type"],
49
+ > = ExtractOrFallback<TDocuments, { type: TDocumentType }>;
50
+
15
51
  /**
16
52
  * A universal API to make network requests. A subset of the `fetch()` API.
17
53
  *
@@ -43,6 +79,10 @@ export type AbortSignalLike = {
43
79
  dispatchEvent: any;
44
80
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
81
  onabort: any;
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
+ reason: any;
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ throwIfAborted: any;
46
86
  };
47
87
 
48
88
  /**
@@ -68,12 +108,28 @@ export interface ResponseLike {
68
108
  * The minimum required properties to treat as an HTTP Request for automatic
69
109
  * Prismic preview support.
70
110
  */
71
- export interface HttpRequestLike {
72
- headers?: {
73
- cookie?: string;
74
- };
75
- query?: Record<string, unknown>;
76
- }
111
+ export type HttpRequestLike =
112
+ | /**
113
+ * Web API Request
114
+ *
115
+ * @see http://developer.mozilla.org/en-US/docs/Web/API/Request
116
+ */
117
+ {
118
+ headers?: {
119
+ get(name: string): string | null;
120
+ };
121
+ url?: string;
122
+ }
123
+
124
+ /**
125
+ * Express-style Request
126
+ */
127
+ | {
128
+ headers?: {
129
+ cookie?: string;
130
+ };
131
+ query?: Record<string, unknown>;
132
+ };
77
133
 
78
134
  /**
79
135
  * An `orderings` parameter that orders the results by the specified field.