@prismicio/client 6.0.0-alpha.9 → 6.0.0-beta.3
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/README.md +38 -34
- package/dist/index.cjs +226 -300
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +364 -433
- package/dist/index.mjs +220 -292
- package/dist/index.mjs.map +1 -0
- package/package.json +26 -25
- package/src/ForbiddenError.ts +8 -41
- package/src/ParsingError.ts +4 -34
- package/src/PrismicError.ts +11 -12
- package/src/buildQueryURL.ts +1 -6
- package/src/client.ts +391 -413
- package/src/index.ts +1 -7
- package/src/lib/appendPredicates.ts +15 -15
- package/src/lib/findMasterRef.ts +15 -0
- package/src/lib/findRef.ts +27 -0
- package/src/lib/findRefByID.ts +16 -0
- package/src/lib/findRefByLabel.ts +19 -0
- package/src/predicate.ts +231 -237
- package/src/types.ts +0 -63
package/dist/index.d.ts
CHANGED
|
@@ -11,57 +11,6 @@ import * as prismicH from '@prismicio/helpers';
|
|
|
11
11
|
*/
|
|
12
12
|
declare const getEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
|
|
13
13
|
|
|
14
|
-
interface Ref {
|
|
15
|
-
ref: string;
|
|
16
|
-
label: string;
|
|
17
|
-
isMasterRef: boolean;
|
|
18
|
-
scheduledAt?: string;
|
|
19
|
-
id: string;
|
|
20
|
-
}
|
|
21
|
-
interface Language {
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
}
|
|
25
|
-
interface Repository {
|
|
26
|
-
refs: Ref[];
|
|
27
|
-
integrationFieldsRef: string | null;
|
|
28
|
-
bookmarks: Record<string, string>;
|
|
29
|
-
languages: Language[];
|
|
30
|
-
types: Record<string, string>;
|
|
31
|
-
tags: string[];
|
|
32
|
-
forms: Record<string, Form>;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Experiments are no longer part of Prismic.
|
|
35
|
-
*/
|
|
36
|
-
experiments: unknown;
|
|
37
|
-
oauth_initiate: string;
|
|
38
|
-
oauth_token: string;
|
|
39
|
-
version: string;
|
|
40
|
-
license: string;
|
|
41
|
-
}
|
|
42
|
-
interface Query<TDocument extends prismicT.PrismicDocument = prismicT.PrismicDocument> {
|
|
43
|
-
page: number;
|
|
44
|
-
results_per_page: number;
|
|
45
|
-
results_size: number;
|
|
46
|
-
total_results_size: number;
|
|
47
|
-
total_pages: number;
|
|
48
|
-
next_page: string | null;
|
|
49
|
-
prev_page: string | null;
|
|
50
|
-
results: TDocument[];
|
|
51
|
-
}
|
|
52
|
-
interface Form {
|
|
53
|
-
method: "GET";
|
|
54
|
-
enctype: string;
|
|
55
|
-
action: string;
|
|
56
|
-
name?: string;
|
|
57
|
-
rel?: string;
|
|
58
|
-
fields: Record<string, FormField>;
|
|
59
|
-
}
|
|
60
|
-
interface FormField {
|
|
61
|
-
type: "String" | "Integer";
|
|
62
|
-
multiple: boolean;
|
|
63
|
-
default?: string;
|
|
64
|
-
}
|
|
65
14
|
/**
|
|
66
15
|
* A universal API to make network requests. A subset of the `fetch()` API.
|
|
67
16
|
*/
|
|
@@ -257,15 +206,17 @@ declare type ClientConfig = {
|
|
|
257
206
|
*/
|
|
258
207
|
ref?: RefStringOrThunk;
|
|
259
208
|
/**
|
|
260
|
-
* A
|
|
261
|
-
*
|
|
209
|
+
* A list of Route Resolver objects that define how a document's `url` field
|
|
210
|
+
* is resolved.
|
|
211
|
+
*
|
|
212
|
+
* {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
|
|
262
213
|
*/
|
|
263
|
-
|
|
214
|
+
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
264
215
|
/**
|
|
265
216
|
* Default parameters that will be sent with each query. These parameters can
|
|
266
217
|
* be overridden on each query if needed.
|
|
267
218
|
*/
|
|
268
|
-
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "accessToken">;
|
|
219
|
+
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
|
|
269
220
|
/**
|
|
270
221
|
* The function used to make network requests to the Prismic REST API. In
|
|
271
222
|
* environments where a global `fetch` function does not exist, such as
|
|
@@ -304,7 +255,7 @@ declare type ResolvePreviewArgs = {
|
|
|
304
255
|
/**
|
|
305
256
|
* The previewed document that will be used to determine the destination URL.
|
|
306
257
|
*/
|
|
307
|
-
|
|
258
|
+
documentID?: string;
|
|
308
259
|
};
|
|
309
260
|
/**
|
|
310
261
|
* Creates a Prismic client that can be used to query a repository.
|
|
@@ -338,11 +289,12 @@ declare class Client {
|
|
|
338
289
|
*/
|
|
339
290
|
accessToken?: string;
|
|
340
291
|
/**
|
|
341
|
-
*
|
|
292
|
+
* A list of Route Resolver objects that define how a document's `url` field
|
|
293
|
+
* is resolved.
|
|
342
294
|
*
|
|
343
|
-
* {@link https://prismic.io/docs/core-concepts/
|
|
295
|
+
* {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
|
|
344
296
|
*/
|
|
345
|
-
|
|
297
|
+
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
346
298
|
/**
|
|
347
299
|
* The function used to make network requests to the Prismic REST API. In
|
|
348
300
|
* environments where a global `fetch` function does not exist, such as
|
|
@@ -353,15 +305,19 @@ declare class Client {
|
|
|
353
305
|
* Default parameters that will be sent with each query. These parameters can
|
|
354
306
|
* be overridden on each query if needed.
|
|
355
307
|
*/
|
|
356
|
-
defaultParams?: Omit<BuildQueryURLArgs, "ref">;
|
|
308
|
+
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
|
|
357
309
|
/**
|
|
358
310
|
* The client's ref mode state. This determines which ref is used during queries.
|
|
359
311
|
*/
|
|
360
|
-
private
|
|
312
|
+
private refState;
|
|
313
|
+
/**
|
|
314
|
+
* Cached repository value.
|
|
315
|
+
*/
|
|
316
|
+
private cachedRepository;
|
|
361
317
|
/**
|
|
362
|
-
*
|
|
318
|
+
* Timestamp at which the cached repository data is considered stale.
|
|
363
319
|
*/
|
|
364
|
-
private
|
|
320
|
+
private cachedRepositoryExpiration;
|
|
365
321
|
/**
|
|
366
322
|
* Creates a Prismic client that can be used to query a repository.
|
|
367
323
|
*
|
|
@@ -431,7 +387,9 @@ declare class Client {
|
|
|
431
387
|
* @example
|
|
432
388
|
*
|
|
433
389
|
* ```ts
|
|
434
|
-
* const response = await client.
|
|
390
|
+
* const response = await client.query(
|
|
391
|
+
* prismic.predicate.at("document.type", "page"),
|
|
392
|
+
* );
|
|
435
393
|
* ```
|
|
436
394
|
*
|
|
437
395
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
@@ -439,7 +397,7 @@ declare class Client {
|
|
|
439
397
|
*
|
|
440
398
|
* @returns A paginated response containing the result of the query.
|
|
441
399
|
*/
|
|
442
|
-
query
|
|
400
|
+
query<TDocument extends prismicT.PrismicDocument>(predicates: NonNullable<BuildQueryURLArgs["predicates"]>, params?: Partial<Omit<BuildQueryURLArgs, "predicates">>): Promise<prismicT.Query<TDocument>>;
|
|
443
401
|
/**
|
|
444
402
|
* Queries content from the Prismic repository.
|
|
445
403
|
*
|
|
@@ -454,7 +412,7 @@ declare class Client {
|
|
|
454
412
|
*
|
|
455
413
|
* @returns A paginated response containing the result of the query.
|
|
456
414
|
*/
|
|
457
|
-
get<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<Query<TDocument>>;
|
|
415
|
+
get<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
458
416
|
/**
|
|
459
417
|
* Queries content from the Prismic repository and returns only the first
|
|
460
418
|
* result, if any.
|
|
@@ -471,6 +429,10 @@ declare class Client {
|
|
|
471
429
|
*/
|
|
472
430
|
getFirst<TDocument extends prismicT.PrismicDocument>(params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
|
|
473
431
|
/**
|
|
432
|
+
* **IMPORTANT**: Avoid using `dangerouslyGetAll` as it may be slower and
|
|
433
|
+
* require more resources than other methods. Prefer using other methods that
|
|
434
|
+
* filter by predicates such as `getAllByType`.
|
|
435
|
+
*
|
|
474
436
|
* Queries content from the Prismic repository and returns all matching
|
|
475
437
|
* content. If no predicates are provided, all documents will be fetched.
|
|
476
438
|
*
|
|
@@ -479,14 +441,15 @@ declare class Client {
|
|
|
479
441
|
* @example
|
|
480
442
|
*
|
|
481
443
|
* ```ts
|
|
482
|
-
* const response = await client.
|
|
444
|
+
* const response = await client.dangerouslyGetAll();
|
|
483
445
|
* ```
|
|
484
446
|
*
|
|
485
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
486
|
-
*
|
|
487
|
-
*
|
|
447
|
+
* @typeParam TDocument - Type of Prismic documents returned.
|
|
448
|
+
* @param params - Parameters to filter, sort, and paginate results.
|
|
449
|
+
*
|
|
450
|
+
* @returns A list of documents matching the query.
|
|
488
451
|
*/
|
|
489
|
-
|
|
452
|
+
dangerouslyGetAll<TDocument extends prismicT.PrismicDocument>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams): Promise<TDocument[]>;
|
|
490
453
|
/**
|
|
491
454
|
* Queries a document from the Prismic repository with a specific ID.
|
|
492
455
|
*
|
|
@@ -531,7 +494,7 @@ declare class Client {
|
|
|
531
494
|
* @returns A paginated response containing documents with IDs matching the
|
|
532
495
|
* `ids` parameter.
|
|
533
496
|
*/
|
|
534
|
-
getByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<Query<TDocument>>;
|
|
497
|
+
getByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
535
498
|
/**
|
|
536
499
|
* Queries all documents from the Prismic repository with specific IDs.
|
|
537
500
|
*
|
|
@@ -554,8 +517,7 @@ declare class Client {
|
|
|
554
517
|
* @param ids - A list of document IDs.
|
|
555
518
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
556
519
|
*
|
|
557
|
-
* @returns A list of documents with IDs matching the `ids` parameter
|
|
558
|
-
* matching document exists.
|
|
520
|
+
* @returns A list of documents with IDs matching the `ids` parameter.
|
|
559
521
|
*/
|
|
560
522
|
getAllByIDs<TDocument extends prismicT.PrismicDocument>(ids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
|
|
561
523
|
/**
|
|
@@ -580,6 +542,57 @@ declare class Client {
|
|
|
580
542
|
* matching document exists.
|
|
581
543
|
*/
|
|
582
544
|
getByUID<TDocument extends prismicT.PrismicDocument>(documentType: string, uid: string, params?: Partial<BuildQueryURLArgs>): Promise<TDocument>;
|
|
545
|
+
/**
|
|
546
|
+
* Queries document from the Prismic repository with specific UIDs and Custom Type.
|
|
547
|
+
*
|
|
548
|
+
* @remarks
|
|
549
|
+
* A document's UID is different from its ID. An ID is automatically generated
|
|
550
|
+
* for all documents and is made available on its `id` property. A UID is
|
|
551
|
+
* provided in the Prismic editor and is unique among all documents of its Custom Type.
|
|
552
|
+
* @example
|
|
553
|
+
*
|
|
554
|
+
* ```ts
|
|
555
|
+
* const document = await client.getByUIDs("blog_post", [
|
|
556
|
+
* "my-first-post",
|
|
557
|
+
* "my-second-post",
|
|
558
|
+
* ]);
|
|
559
|
+
* ```
|
|
560
|
+
*
|
|
561
|
+
* @typeParam TDocument - Type of the Prismic document returned.
|
|
562
|
+
* @param documentType - The API ID of the document's Custom Type.
|
|
563
|
+
* @param uids - A list of document UIDs.
|
|
564
|
+
* @param params - Parameters to filter, sort, and paginate the results.
|
|
565
|
+
*
|
|
566
|
+
* @returns A paginated response containing documents with UIDs matching the
|
|
567
|
+
* `uids` parameter.
|
|
568
|
+
*/
|
|
569
|
+
getByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
570
|
+
/**
|
|
571
|
+
* Queries all documents from the Prismic repository with specific UIDs and Custom Type.
|
|
572
|
+
*
|
|
573
|
+
* This method may make multiple network requests to query all matching content.
|
|
574
|
+
*
|
|
575
|
+
* @remarks
|
|
576
|
+
* A document's UID is different from its ID. An ID is automatically generated
|
|
577
|
+
* for all documents and is made available on its `id` property. A UID is
|
|
578
|
+
* provided in the Prismic editor and is unique among all documents of its Custom Type.
|
|
579
|
+
* @example
|
|
580
|
+
*
|
|
581
|
+
* ```ts
|
|
582
|
+
* const response = await client.getAllByUIDs([
|
|
583
|
+
* "my-first-post",
|
|
584
|
+
* "my-second-post",
|
|
585
|
+
* ]);
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* @typeParam TDocument - Type of Prismic documents returned.
|
|
589
|
+
* @param documentType - The API ID of the document's Custom Type.
|
|
590
|
+
* @param uids - A list of document UIDs.
|
|
591
|
+
* @param params - Parameters to filter, sort, and paginate the results.
|
|
592
|
+
*
|
|
593
|
+
* @returns A list of documents with UIDs matching the `uids` parameter.
|
|
594
|
+
*/
|
|
595
|
+
getAllByUIDs<TDocument extends prismicT.PrismicDocument>(documentType: string, uids: string[], params?: Partial<BuildQueryURLArgs>): Promise<TDocument[]>;
|
|
583
596
|
/**
|
|
584
597
|
* Queries a singleton document from the Prismic repository for a specific Custom Type.
|
|
585
598
|
*
|
|
@@ -619,7 +632,7 @@ declare class Client {
|
|
|
619
632
|
*
|
|
620
633
|
* @returns A paginated response containing documents of the Custom Type.
|
|
621
634
|
*/
|
|
622
|
-
getByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<Query<TDocument>>;
|
|
635
|
+
getByType<TDocument extends prismicT.PrismicDocument>(documentType: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
623
636
|
/**
|
|
624
637
|
* Queries all documents from the Prismic repository for a specific Custom Type.
|
|
625
638
|
*
|
|
@@ -655,7 +668,7 @@ declare class Client {
|
|
|
655
668
|
*
|
|
656
669
|
* @returns A paginated response containing documents with the tag.
|
|
657
670
|
*/
|
|
658
|
-
getByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<BuildQueryURLArgs>): Promise<Query<TDocument>>;
|
|
671
|
+
getByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
659
672
|
/**
|
|
660
673
|
* Queries all documents from the Prismic repository with a specific tag.
|
|
661
674
|
*
|
|
@@ -675,46 +688,84 @@ declare class Client {
|
|
|
675
688
|
*/
|
|
676
689
|
getAllByTag<TDocument extends prismicT.PrismicDocument>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
|
|
677
690
|
/**
|
|
678
|
-
* Queries documents from the Prismic repository with
|
|
691
|
+
* Queries documents from the Prismic repository with specific tags. A
|
|
692
|
+
* document must be tagged with all of the queried tags to be included.
|
|
679
693
|
*
|
|
680
694
|
* @example
|
|
681
695
|
*
|
|
682
696
|
* ```ts
|
|
683
|
-
* const response = await client.
|
|
697
|
+
* const response = await client.getByEveryTag(["food", "fruit"]);
|
|
684
698
|
* ```
|
|
685
699
|
*
|
|
686
700
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
687
701
|
* @param tags - A list of tags that must be included on a document.
|
|
688
702
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
689
703
|
*
|
|
690
|
-
* @returns A paginated response containing documents with the
|
|
704
|
+
* @returns A paginated response containing documents with the tags.
|
|
691
705
|
*/
|
|
692
|
-
|
|
706
|
+
getByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
693
707
|
/**
|
|
694
|
-
* Queries
|
|
708
|
+
* Queries documents from the Prismic repository with specific tags. A
|
|
709
|
+
* document must be tagged with all of the queried tags to be included.
|
|
695
710
|
*
|
|
696
711
|
* This method may make multiple network requests to query all matching content.
|
|
697
712
|
*
|
|
698
713
|
* @example
|
|
699
714
|
*
|
|
700
715
|
* ```ts
|
|
701
|
-
* const response = await client.
|
|
716
|
+
* const response = await client.getAllByEveryTag(["food", "fruit"]);
|
|
702
717
|
* ```
|
|
703
718
|
*
|
|
704
719
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
705
720
|
* @param tags - A list of tags that must be included on a document.
|
|
706
721
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
707
722
|
*
|
|
708
|
-
* @returns A list of all documents with the
|
|
723
|
+
* @returns A list of all documents with the tags.
|
|
724
|
+
*/
|
|
725
|
+
getAllByEveryTag<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
|
|
726
|
+
/**
|
|
727
|
+
* Queries documents from the Prismic repository with specific tags. A
|
|
728
|
+
* document must be tagged with at least one of the queried tags to be included.
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
*
|
|
732
|
+
* ```ts
|
|
733
|
+
* const response = await client.getByEveryTag(["food", "fruit"]);
|
|
734
|
+
* ```
|
|
735
|
+
*
|
|
736
|
+
* @typeParam TDocument - Type of Prismic documents returned.
|
|
737
|
+
* @param tags - A list of tags that must be included on a document.
|
|
738
|
+
* @param params - Parameters to filter, sort, and paginate the results.
|
|
739
|
+
*
|
|
740
|
+
* @returns A paginated response containing documents with at least one of the tags.
|
|
709
741
|
*/
|
|
710
|
-
|
|
742
|
+
getBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<BuildQueryURLArgs>): Promise<prismicT.Query<TDocument>>;
|
|
743
|
+
/**
|
|
744
|
+
* Queries documents from the Prismic repository with specific tags. A
|
|
745
|
+
* document must be tagged with at least one of the queried tags to be included.
|
|
746
|
+
*
|
|
747
|
+
* This method may make multiple network requests to query all matching content.
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
*
|
|
751
|
+
* ```ts
|
|
752
|
+
* const response = await client.getAllByEveryTag(["food", "fruit"]);
|
|
753
|
+
* ```
|
|
754
|
+
*
|
|
755
|
+
* @typeParam TDocument - Type of Prismic documents returned.
|
|
756
|
+
* @param tags - A list of tags that must be included on a document.
|
|
757
|
+
* @param params - Parameters to filter, sort, and paginate the results.
|
|
758
|
+
*
|
|
759
|
+
* @returns A list of all documents with at least one of the tags.
|
|
760
|
+
*/
|
|
761
|
+
getAllBySomeTags<TDocument extends prismicT.PrismicDocument>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">>): Promise<TDocument[]>;
|
|
711
762
|
/**
|
|
712
763
|
* Returns metadata about the Prismic repository, such as its refs, releases,
|
|
713
764
|
* and custom types.
|
|
714
765
|
*
|
|
715
766
|
* @returns Repository metadata.
|
|
716
767
|
*/
|
|
717
|
-
getRepository(): Promise<Repository>;
|
|
768
|
+
getRepository(): Promise<prismicT.Repository>;
|
|
718
769
|
/**
|
|
719
770
|
* Returns a list of all refs for the Prismic repository.
|
|
720
771
|
*
|
|
@@ -724,7 +775,7 @@ declare class Client {
|
|
|
724
775
|
*
|
|
725
776
|
* @returns A list of all refs for the Prismic repository.
|
|
726
777
|
*/
|
|
727
|
-
getRefs(): Promise<Ref[]>;
|
|
778
|
+
getRefs(): Promise<prismicT.Ref[]>;
|
|
728
779
|
/**
|
|
729
780
|
* Returns a ref for the Prismic repository with a matching ID.
|
|
730
781
|
*
|
|
@@ -732,7 +783,7 @@ declare class Client {
|
|
|
732
783
|
*
|
|
733
784
|
* @returns The ref with a matching ID, if it exists.
|
|
734
785
|
*/
|
|
735
|
-
|
|
786
|
+
getRefByID(id: string): Promise<prismicT.Ref>;
|
|
736
787
|
/**
|
|
737
788
|
* Returns a ref for the Prismic repository with a matching label.
|
|
738
789
|
*
|
|
@@ -740,21 +791,21 @@ declare class Client {
|
|
|
740
791
|
*
|
|
741
792
|
* @returns The ref with a matching label, if it exists.
|
|
742
793
|
*/
|
|
743
|
-
getRefByLabel(label: string): Promise<Ref>;
|
|
794
|
+
getRefByLabel(label: string): Promise<prismicT.Ref>;
|
|
744
795
|
/**
|
|
745
796
|
* Returns the master ref for the Prismic repository. The master ref points to
|
|
746
797
|
* the repository's latest published content.
|
|
747
798
|
*
|
|
748
799
|
* @returns The repository's master ref.
|
|
749
800
|
*/
|
|
750
|
-
getMasterRef(): Promise<Ref>;
|
|
801
|
+
getMasterRef(): Promise<prismicT.Ref>;
|
|
751
802
|
/**
|
|
752
803
|
* Returns a list of all Releases for the Prismic repository. Releases are
|
|
753
804
|
* used to group content changes before publishing.
|
|
754
805
|
*
|
|
755
806
|
* @returns A list of all Releases for the Prismic repository.
|
|
756
807
|
*/
|
|
757
|
-
getReleases(): Promise<Ref[]>;
|
|
808
|
+
getReleases(): Promise<prismicT.Ref[]>;
|
|
758
809
|
/**
|
|
759
810
|
* Returns a Release for the Prismic repository with a matching ID.
|
|
760
811
|
*
|
|
@@ -762,7 +813,7 @@ declare class Client {
|
|
|
762
813
|
*
|
|
763
814
|
* @returns The Release with a matching ID, if it exists.
|
|
764
815
|
*/
|
|
765
|
-
getReleaseByID(id: string): Promise<Ref>;
|
|
816
|
+
getReleaseByID(id: string): Promise<prismicT.Ref>;
|
|
766
817
|
/**
|
|
767
818
|
* Returns a Release for the Prismic repository with a matching label.
|
|
768
819
|
*
|
|
@@ -770,7 +821,7 @@ declare class Client {
|
|
|
770
821
|
*
|
|
771
822
|
* @returns The ref with a matching label, if it exists.
|
|
772
823
|
*/
|
|
773
|
-
getReleaseByLabel(label: string): Promise<Ref>;
|
|
824
|
+
getReleaseByLabel(label: string): Promise<prismicT.Ref>;
|
|
774
825
|
/**
|
|
775
826
|
* Returns a list of all tags used in the Prismic repository.
|
|
776
827
|
*
|
|
@@ -833,7 +884,7 @@ declare class Client {
|
|
|
833
884
|
*
|
|
834
885
|
* @param id - The ID of the Release.
|
|
835
886
|
*/
|
|
836
|
-
queryContentFromReleaseByID(
|
|
887
|
+
queryContentFromReleaseByID(releaseID: string): void;
|
|
837
888
|
/**
|
|
838
889
|
* Configures the client to query content from a specific Release identified
|
|
839
890
|
* by its label for all future queries.
|
|
@@ -883,31 +934,6 @@ declare class Client {
|
|
|
883
934
|
* @throws If a matching form cannot be found.
|
|
884
935
|
*/
|
|
885
936
|
private getCachedRepositoryForm;
|
|
886
|
-
/**
|
|
887
|
-
* Returns the preview ref for the client, if one exists.
|
|
888
|
-
*
|
|
889
|
-
* If this method is used in the browser, the browser's cookies will be read.
|
|
890
|
-
* If this method is used on the server, the cookies from the saved HTTP
|
|
891
|
-
* Request will be read, if an HTTP Request was given.
|
|
892
|
-
*
|
|
893
|
-
* @returns The preview ref as a string, if one exists.
|
|
894
|
-
*/
|
|
895
|
-
private getPreviewRefString;
|
|
896
|
-
/**
|
|
897
|
-
* Returns the Integration Fields ref for the client, if one exists. This ref
|
|
898
|
-
* is used to fetch the latest content from a Integration Field's API.
|
|
899
|
-
*
|
|
900
|
-
* @returns The repository's Integration Fields ref.
|
|
901
|
-
*/
|
|
902
|
-
private getIntegrationFieldsRef;
|
|
903
|
-
/**
|
|
904
|
-
* Returns the Integration Fields ref neeed to query based on the client's
|
|
905
|
-
* configuration. This method may make a network request to fetch a ref or
|
|
906
|
-
* resolve the user's Integration Field ref thunk.
|
|
907
|
-
*
|
|
908
|
-
* @returns The repository's Integration Fields ref, if one is available.
|
|
909
|
-
*/
|
|
910
|
-
private getResolvedIntegrationFieldsRef;
|
|
911
937
|
/**
|
|
912
938
|
* Returns the ref needed to query based on the client's current state. This
|
|
913
939
|
* method may make a network request to fetch a ref or resolve the user's ref thunk.
|
|
@@ -930,16 +956,6 @@ declare class Client {
|
|
|
930
956
|
* @returns The ref to use during a query.
|
|
931
957
|
*/
|
|
932
958
|
private getResolvedRefString;
|
|
933
|
-
/**
|
|
934
|
-
* Returns the network request options required by the Prismic repository.
|
|
935
|
-
*
|
|
936
|
-
* It currently only includes an Authorization header if an access token is provided.
|
|
937
|
-
*
|
|
938
|
-
* @param params - Parameters for the query, including an access token.
|
|
939
|
-
*
|
|
940
|
-
* @returns Request options that can be used to make a network request to
|
|
941
|
-
* query the repository.
|
|
942
|
-
*/
|
|
943
959
|
/**
|
|
944
960
|
* Performs a network request using the configured `fetch` function. It
|
|
945
961
|
* assumes all successful responses will have a JSON content type. It also
|
|
@@ -954,326 +970,241 @@ declare class Client {
|
|
|
954
970
|
private fetch;
|
|
955
971
|
}
|
|
956
972
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
/**
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
declare const predicate_at: typeof at;
|
|
1166
|
-
declare const predicate_not: typeof not;
|
|
1167
|
-
declare const predicate_any: typeof any;
|
|
1168
|
-
declare const predicate_fulltext: typeof fulltext;
|
|
1169
|
-
declare const predicate_has: typeof has;
|
|
1170
|
-
declare const predicate_missing: typeof missing;
|
|
1171
|
-
declare const predicate_similar: typeof similar;
|
|
1172
|
-
declare const predicate_geopointNear: typeof geopointNear;
|
|
1173
|
-
declare const predicate_numberLessThan: typeof numberLessThan;
|
|
1174
|
-
declare const predicate_numberGreaterThan: typeof numberGreaterThan;
|
|
1175
|
-
declare const predicate_numberInRange: typeof numberInRange;
|
|
1176
|
-
declare const predicate_dateAfter: typeof dateAfter;
|
|
1177
|
-
declare const predicate_dateBefore: typeof dateBefore;
|
|
1178
|
-
declare const predicate_dateBetween: typeof dateBetween;
|
|
1179
|
-
declare const predicate_dateDayOfMonth: typeof dateDayOfMonth;
|
|
1180
|
-
declare const predicate_dateDayOfMonthAfter: typeof dateDayOfMonthAfter;
|
|
1181
|
-
declare const predicate_dateDayOfMonthBefore: typeof dateDayOfMonthBefore;
|
|
1182
|
-
declare const predicate_dateDayOfWeek: typeof dateDayOfWeek;
|
|
1183
|
-
declare const predicate_dateDayOfWeekAfter: typeof dateDayOfWeekAfter;
|
|
1184
|
-
declare const predicate_dateDayOfWeekBefore: typeof dateDayOfWeekBefore;
|
|
1185
|
-
declare const predicate_dateMonth: typeof dateMonth;
|
|
1186
|
-
declare const predicate_dateMonthAfter: typeof dateMonthAfter;
|
|
1187
|
-
declare const predicate_dateMonthBefore: typeof dateMonthBefore;
|
|
1188
|
-
declare const predicate_dateYear: typeof dateYear;
|
|
1189
|
-
declare const predicate_dateHour: typeof dateHour;
|
|
1190
|
-
declare const predicate_dateHourAfter: typeof dateHourAfter;
|
|
1191
|
-
declare const predicate_dateHourBefore: typeof dateHourBefore;
|
|
1192
|
-
declare namespace predicate {
|
|
1193
|
-
export {
|
|
1194
|
-
_in as in,
|
|
1195
|
-
predicate_at as at,
|
|
1196
|
-
predicate_not as not,
|
|
1197
|
-
predicate_any as any,
|
|
1198
|
-
predicate_fulltext as fulltext,
|
|
1199
|
-
predicate_has as has,
|
|
1200
|
-
predicate_missing as missing,
|
|
1201
|
-
predicate_similar as similar,
|
|
1202
|
-
predicate_geopointNear as geopointNear,
|
|
1203
|
-
predicate_numberLessThan as numberLessThan,
|
|
1204
|
-
predicate_numberGreaterThan as numberGreaterThan,
|
|
1205
|
-
predicate_numberInRange as numberInRange,
|
|
1206
|
-
predicate_dateAfter as dateAfter,
|
|
1207
|
-
predicate_dateBefore as dateBefore,
|
|
1208
|
-
predicate_dateBetween as dateBetween,
|
|
1209
|
-
predicate_dateDayOfMonth as dateDayOfMonth,
|
|
1210
|
-
predicate_dateDayOfMonthAfter as dateDayOfMonthAfter,
|
|
1211
|
-
predicate_dateDayOfMonthBefore as dateDayOfMonthBefore,
|
|
1212
|
-
predicate_dateDayOfWeek as dateDayOfWeek,
|
|
1213
|
-
predicate_dateDayOfWeekAfter as dateDayOfWeekAfter,
|
|
1214
|
-
predicate_dateDayOfWeekBefore as dateDayOfWeekBefore,
|
|
1215
|
-
predicate_dateMonth as dateMonth,
|
|
1216
|
-
predicate_dateMonthAfter as dateMonthAfter,
|
|
1217
|
-
predicate_dateMonthBefore as dateMonthBefore,
|
|
1218
|
-
predicate_dateYear as dateYear,
|
|
1219
|
-
predicate_dateHour as dateHour,
|
|
1220
|
-
predicate_dateHourAfter as dateHourAfter,
|
|
1221
|
-
predicate_dateHourBefore as dateHourBefore,
|
|
1222
|
-
};
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
declare type PrismicErrorArgs = {
|
|
1226
|
-
url: string;
|
|
1227
|
-
response?: Record<string, unknown>;
|
|
973
|
+
declare const predicate: {
|
|
974
|
+
/**
|
|
975
|
+
* The `at` predicate checks that the path matches the described value
|
|
976
|
+
* exactly. It takes a single value for a field or an array (only for tags).
|
|
977
|
+
*
|
|
978
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#at}
|
|
979
|
+
*/
|
|
980
|
+
at: (path: string, value: string | number | (string | number)[]) => string;
|
|
981
|
+
/**
|
|
982
|
+
* The `not` predicate checks that the path doesn't match the provided value
|
|
983
|
+
* exactly. It takes a single value as the argument.
|
|
984
|
+
*
|
|
985
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
|
|
986
|
+
*/
|
|
987
|
+
not: (path: string, value: string | number | (string | number)[]) => string;
|
|
988
|
+
/**
|
|
989
|
+
* The `any` predicate takes an array of values. It works exactly the same way
|
|
990
|
+
* as the `at` operator, but checks whether the fragment matches any of the
|
|
991
|
+
* values in the array.
|
|
992
|
+
*
|
|
993
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#any}
|
|
994
|
+
*/
|
|
995
|
+
any: (path: string, value: string | number | (string | number)[]) => string;
|
|
996
|
+
/**
|
|
997
|
+
* The `in` predicate is used specifically to retrieve an array of documents
|
|
998
|
+
* by their IDs or UIDs. This predicate is much more efficient at this than
|
|
999
|
+
* the any predicate.
|
|
1000
|
+
*
|
|
1001
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#in}
|
|
1002
|
+
*/
|
|
1003
|
+
in: (path: string, value: string | number | (string | number)[]) => string;
|
|
1004
|
+
/**
|
|
1005
|
+
* The `fulltext` predicate provides two capabilities:
|
|
1006
|
+
*
|
|
1007
|
+
* 1. Checking if a certain string is anywhere inside a document (this is what
|
|
1008
|
+
* you should use to make your project's search engine feature)
|
|
1009
|
+
* 2. Checking if the string is contained inside a specific custom type’s Rich
|
|
1010
|
+
* Text or Key Text fragment.
|
|
1011
|
+
*
|
|
1012
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#fulltext}
|
|
1013
|
+
*/
|
|
1014
|
+
fulltext: (path: string, value: string | number | (string | number)[]) => string;
|
|
1015
|
+
/**
|
|
1016
|
+
* The `has` predicate checks whether a fragment has a value. It will return
|
|
1017
|
+
* all the documents of the specified type that contain a value for the
|
|
1018
|
+
* specified field.
|
|
1019
|
+
*
|
|
1020
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#has}
|
|
1021
|
+
*/
|
|
1022
|
+
has: (path: string) => string;
|
|
1023
|
+
/**
|
|
1024
|
+
* The `missing` predicate checks if a fragment doesn't have a value. It will
|
|
1025
|
+
* return all the documents of the specified type that do not contain a value
|
|
1026
|
+
* for the specified field.
|
|
1027
|
+
*
|
|
1028
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#missing}
|
|
1029
|
+
*/
|
|
1030
|
+
missing: (path: string) => string;
|
|
1031
|
+
/**
|
|
1032
|
+
* The `similar` predicate takes the ID of a document, and returns a list of
|
|
1033
|
+
* documents with similar content. This allows you to build an automated
|
|
1034
|
+
* content discovery feature (for example, a "Related posts" section).
|
|
1035
|
+
*
|
|
1036
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#similar}
|
|
1037
|
+
*/
|
|
1038
|
+
similar: (id: string, value: number) => string;
|
|
1039
|
+
/**
|
|
1040
|
+
* The `geopoint.near` predicate checks that the value in the path is within
|
|
1041
|
+
* the radius of the given coordinates.
|
|
1042
|
+
*
|
|
1043
|
+
* This predicate will only work for a GeoPoint field.
|
|
1044
|
+
*
|
|
1045
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#near}
|
|
1046
|
+
*/
|
|
1047
|
+
geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
|
|
1048
|
+
/**
|
|
1049
|
+
* The `number.lt` predicate checks that the value in the number field is less
|
|
1050
|
+
* than the value passed into the predicate.
|
|
1051
|
+
*
|
|
1052
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#lt-less-than}
|
|
1053
|
+
*/
|
|
1054
|
+
numberLessThan: (path: string, value: number) => string;
|
|
1055
|
+
/**
|
|
1056
|
+
* The `number.gt` predicate checks that the value in the number field is
|
|
1057
|
+
* greater than the value passed into the predicate.
|
|
1058
|
+
*
|
|
1059
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#gt-greater-than}
|
|
1060
|
+
*/
|
|
1061
|
+
numberGreaterThan: (path: string, value: number) => string;
|
|
1062
|
+
/**
|
|
1063
|
+
* The `number.inRange` predicate checks that the value in the path is within
|
|
1064
|
+
* the two values passed into the predicate.
|
|
1065
|
+
*
|
|
1066
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#inrange}
|
|
1067
|
+
*/
|
|
1068
|
+
numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
|
|
1069
|
+
/**
|
|
1070
|
+
* The `date.after` predicate checks that the value in the path is after the
|
|
1071
|
+
* date value passed into the predicate.
|
|
1072
|
+
*
|
|
1073
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#after}
|
|
1074
|
+
*/
|
|
1075
|
+
dateAfter: (path: string, date: string | number | Date) => string;
|
|
1076
|
+
/**
|
|
1077
|
+
* The `date.before` predicate checks that the value in the path is before the
|
|
1078
|
+
* date value passed into the predicate.
|
|
1079
|
+
*
|
|
1080
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#before}
|
|
1081
|
+
*/
|
|
1082
|
+
dateBefore: (path: string, date: string | number | Date) => string;
|
|
1083
|
+
/**
|
|
1084
|
+
* The `date.between` predicate checks that the value in the path is within
|
|
1085
|
+
* the date values passed into the predicate.
|
|
1086
|
+
*
|
|
1087
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#between}
|
|
1088
|
+
*/
|
|
1089
|
+
dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
|
|
1090
|
+
/**
|
|
1091
|
+
* The `date.day-of-month` predicate checks that the value in the path is
|
|
1092
|
+
* equal to the day of the month passed into the predicate.
|
|
1093
|
+
*
|
|
1094
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonth}
|
|
1095
|
+
*/
|
|
1096
|
+
dateDayOfMonth: (path: string, day: number) => string;
|
|
1097
|
+
/**
|
|
1098
|
+
* The `date.day-of-month-after` predicate checks that the value in the path
|
|
1099
|
+
* is after the day of the month passed into the predicate.
|
|
1100
|
+
*
|
|
1101
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthafter}
|
|
1102
|
+
*/
|
|
1103
|
+
dateDayOfMonthAfter: (path: string, day: number) => string;
|
|
1104
|
+
/**
|
|
1105
|
+
* The `date.day-of-month-before` predicate checks that the value in the path
|
|
1106
|
+
* is before the day of the month passed into the predicate.
|
|
1107
|
+
*
|
|
1108
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthbefore}
|
|
1109
|
+
*/
|
|
1110
|
+
dateDayOfMonthBefore: (path: string, day: number) => string;
|
|
1111
|
+
/**
|
|
1112
|
+
* The `date.day-of-week` predicate checks that the value in the path is equal
|
|
1113
|
+
* to the day of the week passed into the predicate.
|
|
1114
|
+
*
|
|
1115
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweek}
|
|
1116
|
+
*/
|
|
1117
|
+
dateDayOfWeek: (path: string, day: string | number) => string;
|
|
1118
|
+
/**
|
|
1119
|
+
* The `date.day-of-week-after` predicate checks that the value in the path is
|
|
1120
|
+
* after the day of the week passed into the predicate.
|
|
1121
|
+
*
|
|
1122
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekafter}
|
|
1123
|
+
*/
|
|
1124
|
+
dateDayOfWeekAfter: (path: string, day: string | number) => string;
|
|
1125
|
+
/**
|
|
1126
|
+
* The date.day-of-week-before predicate checks that the value in the path is
|
|
1127
|
+
* before the day of the week passed into the predicate.
|
|
1128
|
+
*
|
|
1129
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekbefore}
|
|
1130
|
+
*/
|
|
1131
|
+
dateDayOfWeekBefore: (path: string, day: string | number) => string;
|
|
1132
|
+
/**
|
|
1133
|
+
* The `date.month` predicate checks that the value in the path occurs in the
|
|
1134
|
+
* month value passed into the predicate.
|
|
1135
|
+
*
|
|
1136
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#month}
|
|
1137
|
+
*/
|
|
1138
|
+
dateMonth: (path: string, month: string | number) => string;
|
|
1139
|
+
/**
|
|
1140
|
+
* The `date.month-after` predicate checks that the value in the path occurs
|
|
1141
|
+
* in any month after the value passed into the predicate.
|
|
1142
|
+
*
|
|
1143
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthafter}
|
|
1144
|
+
*/
|
|
1145
|
+
dateMonthAfter: (path: string, month: string | number) => string;
|
|
1146
|
+
/**
|
|
1147
|
+
* The `date.month-before` predicate checks that the value in the path occurs
|
|
1148
|
+
* in any month before the value passed into the predicate.
|
|
1149
|
+
*
|
|
1150
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthbefore}
|
|
1151
|
+
*/
|
|
1152
|
+
dateMonthBefore: (path: string, month: string | number) => string;
|
|
1153
|
+
/**
|
|
1154
|
+
* The `date.year` predicate checks that the value in the path occurs in the
|
|
1155
|
+
* year value passed into the predicate.
|
|
1156
|
+
*
|
|
1157
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#year}
|
|
1158
|
+
*/
|
|
1159
|
+
dateYear: (path: string, year: number) => string;
|
|
1160
|
+
/**
|
|
1161
|
+
* The `date.hour` predicate checks that the value in the path occurs within
|
|
1162
|
+
* the hour value passed into the predicate.
|
|
1163
|
+
*
|
|
1164
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hour}
|
|
1165
|
+
*/
|
|
1166
|
+
dateHour: (path: string, hour: number) => string;
|
|
1167
|
+
/**
|
|
1168
|
+
* The `date.hour-after` predicate checks that the value in the path occurs
|
|
1169
|
+
* after the hour value passed into the predicate.
|
|
1170
|
+
*
|
|
1171
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourafter}
|
|
1172
|
+
*/
|
|
1173
|
+
dateHourAfter: (path: string, hour: number) => string;
|
|
1174
|
+
/**
|
|
1175
|
+
* The `date.hour-before` predicate checks that the value in the path occurs
|
|
1176
|
+
* before the hour value passed into the predicate.
|
|
1177
|
+
*
|
|
1178
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourbefore}
|
|
1179
|
+
*/
|
|
1180
|
+
dateHourBefore: (path: string, hour: number) => string;
|
|
1228
1181
|
};
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1182
|
+
|
|
1183
|
+
declare class PrismicError<Response> extends Error {
|
|
1184
|
+
url?: string;
|
|
1185
|
+
response: Response;
|
|
1186
|
+
constructor(message: string | undefined, url: string | undefined, response: Response);
|
|
1233
1187
|
}
|
|
1234
1188
|
|
|
1235
|
-
|
|
1189
|
+
declare type ForbiddenErrorRepositoryAPIResponse = {
|
|
1236
1190
|
type: string;
|
|
1237
1191
|
message: string;
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1241
|
-
interface ForbiddenErrorQueryAPIResponse {
|
|
1192
|
+
};
|
|
1193
|
+
declare type ForbiddenErrorQueryAPIResponse = {
|
|
1242
1194
|
error: string;
|
|
1243
|
-
oauth_initiate: string;
|
|
1244
|
-
oauth_token: string;
|
|
1245
|
-
}
|
|
1246
|
-
declare type ForbiddenErrorAPIResponse = ForbiddenErrorRepositoryAPIResponse | ForbiddenErrorQueryAPIResponse;
|
|
1247
|
-
declare type ForbiddenErrorArgs = {
|
|
1248
|
-
url: string;
|
|
1249
|
-
response: ForbiddenErrorAPIResponse;
|
|
1250
1195
|
};
|
|
1251
|
-
declare class ForbiddenError extends
|
|
1252
|
-
url: string;
|
|
1253
|
-
oauth_initiate: string;
|
|
1254
|
-
oauth_token: string;
|
|
1255
|
-
constructor(message: string, args: ForbiddenErrorArgs);
|
|
1196
|
+
declare class ForbiddenError extends PrismicError<ForbiddenErrorRepositoryAPIResponse | ForbiddenErrorQueryAPIResponse> {
|
|
1256
1197
|
}
|
|
1257
1198
|
|
|
1258
|
-
|
|
1199
|
+
declare type ParsingErrorAPIResponse = {
|
|
1259
1200
|
type: "parsing-error";
|
|
1260
1201
|
message: string;
|
|
1261
1202
|
line: number;
|
|
1262
1203
|
column: number;
|
|
1263
1204
|
id: number;
|
|
1264
1205
|
location: string;
|
|
1265
|
-
}
|
|
1266
|
-
declare type ParsingErrorArgs = {
|
|
1267
|
-
url: string;
|
|
1268
|
-
response: ParsingErrorAPIResponse;
|
|
1269
1206
|
};
|
|
1270
|
-
declare class ParsingError extends
|
|
1271
|
-
url: string;
|
|
1272
|
-
line: number;
|
|
1273
|
-
column: number;
|
|
1274
|
-
id: number;
|
|
1275
|
-
location: string;
|
|
1276
|
-
constructor(message: string, args: ParsingErrorArgs);
|
|
1207
|
+
declare class ParsingError extends PrismicError<ParsingErrorAPIResponse> {
|
|
1277
1208
|
}
|
|
1278
1209
|
|
|
1279
1210
|
/**
|
|
@@ -1288,4 +1219,4 @@ declare namespace cookie {
|
|
|
1288
1219
|
};
|
|
1289
1220
|
}
|
|
1290
1221
|
|
|
1291
|
-
export { BuildQueryURLArgs, Client, ClientConfig, FetchLike, ForbiddenError,
|
|
1222
|
+
export { BuildQueryURLArgs, Client, ClientConfig, FetchLike, ForbiddenError, HttpRequestLike, Ordering, ParsingError, PrismicError, QueryParams, RequestInitLike, ResponseLike, Route, buildQueryURL, cookie, createClient, getEndpoint, predicate };
|