@prismicio/client 6.7.2 → 6.8.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
@@ -1,88 +1,88 @@
1
- import { getRepositoryEndpoint } from "./getRepositoryEndpoint";
2
- export { getRepositoryEndpoint };
3
- /**
4
- * @deprecated Renamed to `getRepositoryEndpoint`.
5
- */
6
- export declare const getEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
7
- export { getRepositoryName } from "./getRepositoryName";
8
- export { getGraphQLEndpoint } from "./getGraphQLEndpoint";
9
- export { isRepositoryName } from "./isRepositoryName";
10
- export { isRepositoryEndpoint } from "./isRepositoryEndpoint";
11
- export { buildQueryURL } from "./buildQueryURL";
12
- export { createClient, Client } from "./client";
13
- import { predicate } from "./predicate";
14
- export { predicate };
15
- /**
16
- * @deprecated Renamed to `predicate` (without an "s").
17
- */
18
- export declare const predicates: {
19
- at: (path: string, value: string | number | boolean | string[] | Date) => string;
20
- not: (path: string, value: string | number | boolean | string[] | Date) => string;
21
- any: (path: string, values: (string | number | boolean | Date)[]) => string;
22
- in: (path: string, values: string[]) => string;
23
- fulltext: (path: string, searchTerms: string) => string;
24
- has: (path: string) => string;
25
- missing: (path: string) => string;
26
- similar: (id: string, value: number) => string;
27
- geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
28
- numberLessThan: (path: string, value: number) => string;
29
- numberGreaterThan: (path: string, value: number) => string;
30
- numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
31
- dateAfter: (path: string, date: string | number | Date) => string;
32
- dateBefore: (path: string, date: string | number | Date) => string;
33
- dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
34
- dateDayOfMonth: (path: string, day: number) => string;
35
- dateDayOfMonthAfter: (path: string, day: number) => string;
36
- dateDayOfMonthBefore: (path: string, day: number) => string;
37
- dateDayOfWeek: (path: string, day: string | number) => string;
38
- dateDayOfWeekAfter: (path: string, day: string | number) => string;
39
- dateDayOfWeekBefore: (path: string, day: string | number) => string;
40
- dateMonth: (path: string, month: string | number) => string;
41
- dateMonthAfter: (path: string, month: string | number) => string;
42
- dateMonthBefore: (path: string, month: string | number) => string;
43
- dateYear: (path: string, year: number) => string;
44
- dateHour: (path: string, hour: number) => string;
45
- dateHourAfter: (path: string, hour: number) => string;
46
- dateHourBefore: (path: string, hour: number) => string;
47
- };
48
- /**
49
- * @deprecated Renamed to `predicate` (lowercase and without an "s").
50
- */
51
- export declare const Predicates: {
52
- at: (path: string, value: string | number | boolean | string[] | Date) => string;
53
- not: (path: string, value: string | number | boolean | string[] | Date) => string;
54
- any: (path: string, values: (string | number | boolean | Date)[]) => string;
55
- in: (path: string, values: string[]) => string;
56
- fulltext: (path: string, searchTerms: string) => string;
57
- has: (path: string) => string;
58
- missing: (path: string) => string;
59
- similar: (id: string, value: number) => string;
60
- geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
61
- numberLessThan: (path: string, value: number) => string;
62
- numberGreaterThan: (path: string, value: number) => string;
63
- numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
64
- dateAfter: (path: string, date: string | number | Date) => string;
65
- dateBefore: (path: string, date: string | number | Date) => string;
66
- dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
67
- dateDayOfMonth: (path: string, day: number) => string;
68
- dateDayOfMonthAfter: (path: string, day: number) => string;
69
- dateDayOfMonthBefore: (path: string, day: number) => string;
70
- dateDayOfWeek: (path: string, day: string | number) => string;
71
- dateDayOfWeekAfter: (path: string, day: string | number) => string;
72
- dateDayOfWeekBefore: (path: string, day: string | number) => string;
73
- dateMonth: (path: string, month: string | number) => string;
74
- dateMonthAfter: (path: string, month: string | number) => string;
75
- dateMonthBefore: (path: string, month: string | number) => string;
76
- dateYear: (path: string, year: number) => string;
77
- dateHour: (path: string, hour: number) => string;
78
- dateHourAfter: (path: string, hour: number) => string;
79
- dateHourBefore: (path: string, hour: number) => string;
80
- };
81
- export { PrismicError } from "./PrismicError";
82
- export { ForbiddenError } from "./ForbiddenError";
83
- export { ParsingError } from "./ParsingError";
84
- export { NotFoundError } from "./NotFoundError";
85
- export * as cookie from "./cookie";
86
- export type { CreateClient, ClientConfig } from "./client";
87
- export type { QueryParams, BuildQueryURLArgs } from "./buildQueryURL";
88
- export type { AbortSignalLike, FetchLike, HttpRequestLike, Ordering, RequestInitLike, ResponseLike, Route, } from "./types";
1
+ import { getRepositoryEndpoint } from "./getRepositoryEndpoint";
2
+ export { getRepositoryEndpoint };
3
+ /**
4
+ * @deprecated Renamed to `getRepositoryEndpoint`.
5
+ */
6
+ export declare const getEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
7
+ export { getRepositoryName } from "./getRepositoryName";
8
+ export { getGraphQLEndpoint } from "./getGraphQLEndpoint";
9
+ export { isRepositoryName } from "./isRepositoryName";
10
+ export { isRepositoryEndpoint } from "./isRepositoryEndpoint";
11
+ export { buildQueryURL } from "./buildQueryURL";
12
+ export { createClient, Client } from "./client";
13
+ import { predicate } from "./predicate";
14
+ export { predicate };
15
+ /**
16
+ * @deprecated Renamed to `predicate` (without an "s").
17
+ */
18
+ export declare const predicates: {
19
+ at: (path: string, value: string | number | boolean | string[] | Date) => string;
20
+ not: (path: string, value: string | number | boolean | string[] | Date) => string;
21
+ any: (path: string, values: (string | number | boolean | Date)[]) => string;
22
+ in: (path: string, values: string[]) => string;
23
+ fulltext: (path: string, searchTerms: string) => string;
24
+ has: (path: string) => string;
25
+ missing: (path: string) => string;
26
+ similar: (id: string, value: number) => string;
27
+ geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
28
+ numberLessThan: (path: string, value: number) => string;
29
+ numberGreaterThan: (path: string, value: number) => string;
30
+ numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
31
+ dateAfter: (path: string, date: string | number | Date) => string;
32
+ dateBefore: (path: string, date: string | number | Date) => string;
33
+ dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
34
+ dateDayOfMonth: (path: string, day: number) => string;
35
+ dateDayOfMonthAfter: (path: string, day: number) => string;
36
+ dateDayOfMonthBefore: (path: string, day: number) => string;
37
+ dateDayOfWeek: (path: string, day: string | number) => string;
38
+ dateDayOfWeekAfter: (path: string, day: string | number) => string;
39
+ dateDayOfWeekBefore: (path: string, day: string | number) => string;
40
+ dateMonth: (path: string, month: string | number) => string;
41
+ dateMonthAfter: (path: string, month: string | number) => string;
42
+ dateMonthBefore: (path: string, month: string | number) => string;
43
+ dateYear: (path: string, year: number) => string;
44
+ dateHour: (path: string, hour: number) => string;
45
+ dateHourAfter: (path: string, hour: number) => string;
46
+ dateHourBefore: (path: string, hour: number) => string;
47
+ };
48
+ /**
49
+ * @deprecated Renamed to `predicate` (lowercase and without an "s").
50
+ */
51
+ export declare const Predicates: {
52
+ at: (path: string, value: string | number | boolean | string[] | Date) => string;
53
+ not: (path: string, value: string | number | boolean | string[] | Date) => string;
54
+ any: (path: string, values: (string | number | boolean | Date)[]) => string;
55
+ in: (path: string, values: string[]) => string;
56
+ fulltext: (path: string, searchTerms: string) => string;
57
+ has: (path: string) => string;
58
+ missing: (path: string) => string;
59
+ similar: (id: string, value: number) => string;
60
+ geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
61
+ numberLessThan: (path: string, value: number) => string;
62
+ numberGreaterThan: (path: string, value: number) => string;
63
+ numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
64
+ dateAfter: (path: string, date: string | number | Date) => string;
65
+ dateBefore: (path: string, date: string | number | Date) => string;
66
+ dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
67
+ dateDayOfMonth: (path: string, day: number) => string;
68
+ dateDayOfMonthAfter: (path: string, day: number) => string;
69
+ dateDayOfMonthBefore: (path: string, day: number) => string;
70
+ dateDayOfWeek: (path: string, day: string | number) => string;
71
+ dateDayOfWeekAfter: (path: string, day: string | number) => string;
72
+ dateDayOfWeekBefore: (path: string, day: string | number) => string;
73
+ dateMonth: (path: string, month: string | number) => string;
74
+ dateMonthAfter: (path: string, month: string | number) => string;
75
+ dateMonthBefore: (path: string, month: string | number) => string;
76
+ dateYear: (path: string, year: number) => string;
77
+ dateHour: (path: string, hour: number) => string;
78
+ dateHourAfter: (path: string, hour: number) => string;
79
+ dateHourBefore: (path: string, hour: number) => string;
80
+ };
81
+ export { PrismicError } from "./PrismicError";
82
+ export { ForbiddenError } from "./ForbiddenError";
83
+ export { ParsingError } from "./ParsingError";
84
+ export { NotFoundError } from "./NotFoundError";
85
+ export * as cookie from "./cookie";
86
+ export type { CreateClient, ClientConfig } from "./client";
87
+ export type { QueryParams, BuildQueryURLArgs } from "./buildQueryURL";
88
+ export type { AbortSignalLike, FetchLike, HttpRequestLike, Ordering, RequestInitLike, ResponseLike, Route, } from "./types";
@@ -1,10 +1,10 @@
1
- /**
2
- * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid
3
- * URL is a valid endpoint to support network proxies.
4
- *
5
- * @param input - Input to test.
6
- *
7
- * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`
8
- * otherwise.
9
- */
10
- export declare const isRepositoryEndpoint: (input: string) => boolean;
1
+ /**
2
+ * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid
3
+ * URL is a valid endpoint to support network proxies.
4
+ *
5
+ * @param input - Input to test.
6
+ *
7
+ * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`
8
+ * otherwise.
9
+ */
10
+ export declare const isRepositoryEndpoint: (input: string) => boolean;
@@ -1,9 +1,9 @@
1
- /**
2
- * Determines if an input is a valid Prismic repository name.
3
- *
4
- * @param input - Input to test.
5
- *
6
- * @returns `true` if `input` is a valid Prismic repository name, `false`
7
- * otherwise.
8
- */
9
- export declare const isRepositoryName: (input: string) => boolean;
1
+ /**
2
+ * Determines if an input is a valid Prismic repository name.
3
+ *
4
+ * @param input - Input to test.
5
+ *
6
+ * @returns `true` if `input` is a valid Prismic repository name, `false`
7
+ * otherwise.
8
+ */
9
+ export declare const isRepositoryName: (input: string) => boolean;
@@ -1,18 +1,18 @@
1
- interface WithPredicates {
2
- predicates?: string | string[];
3
- }
4
- /**
5
- * Adds one or more predicates to an object with a `predicates` property.
6
- * Appended predicates are added to the end of the existing list.
7
- *
8
- * @typeParam T - Object to which predicates will be append.
9
- * @param objWithPredicates - Object to append predicates on the `predicates`
10
- * property.
11
- * @param predicates - One or more predicates to append.
12
- *
13
- * @returns The object with the appended predicates.
14
- */
15
- export declare const appendPredicates: <T extends WithPredicates>(objWithPredicates: T | undefined, predicates: string | string[]) => T & {
16
- predicates: string[];
17
- };
18
- export {};
1
+ interface WithPredicates {
2
+ predicates?: string | string[];
3
+ }
4
+ /**
5
+ * Adds one or more predicates to an object with a `predicates` property.
6
+ * Appended predicates are added to the end of the existing list.
7
+ *
8
+ * @typeParam T - Object to which predicates will be append.
9
+ * @param objWithPredicates - Object to append predicates on the `predicates`
10
+ * property.
11
+ * @param predicates - One or more predicates to append.
12
+ *
13
+ * @returns The object with the appended predicates.
14
+ */
15
+ export declare const appendPredicates: <T extends WithPredicates>(objWithPredicates: T | undefined, predicates: string | string[]) => T & {
16
+ predicates: string[];
17
+ };
18
+ export {};
@@ -1,11 +1,11 @@
1
- /**
2
- * Ensures that a value is an array. If it is already an array, it is returned
3
- * as is. If it is not an array, it is converted to an array with itself as its
4
- * only element.
5
- *
6
- * @typeParam A - Element of the array.
7
- * @param a - Value to ensure is an array.
8
- *
9
- * @returns `a` as an array.
10
- */
11
- export declare const castArray: <A>(a: A | A[]) => A[];
1
+ /**
2
+ * Ensures that a value is an array. If it is already an array, it is returned
3
+ * as is. If it is not an array, it is converted to an array with itself as its
4
+ * only element.
5
+ *
6
+ * @typeParam A - Element of the array.
7
+ * @param a - Value to ensure is an array.
8
+ *
9
+ * @returns `a` as an array.
10
+ */
11
+ export declare const castArray: <A>(a: A | A[]) => A[];
@@ -1,10 +1,10 @@
1
- /**
2
- * Ensures that a value is a thunk. If it is already a thunk, it is returned as
3
- * is. If it is not a thunk, it is converted to a thunk.
4
- *
5
- * @typeParam A - Value returned by the thunk.
6
- * @param a - Value to ensure is a thunk.
7
- *
8
- * @returns `a` as a a thunk.
9
- */
10
- export declare const castThunk: <A>(a: A | (() => A)) => () => A;
1
+ /**
2
+ * Ensures that a value is a thunk. If it is already a thunk, it is returned as
3
+ * is. If it is not a thunk, it is converted to a thunk.
4
+ *
5
+ * @typeParam A - Value returned by the thunk.
6
+ * @param a - Value to ensure is a thunk.
7
+ *
8
+ * @returns `a` as a a thunk.
9
+ */
10
+ export declare const castThunk: <A>(a: A | (() => A)) => () => A;
@@ -1,10 +1,10 @@
1
- import * as prismicT from "@prismicio/types";
2
- /**
3
- * Returns the master ref from a list of given refs.
4
- *
5
- * @param refs - A list of refs to search.
6
- *
7
- * @returns The master ref from the list.
8
- * @throws If a matching ref cannot be found.
9
- */
10
- export declare const findMasterRef: (refs: prismicT.Ref[]) => prismicT.Ref;
1
+ import * as prismicT from "@prismicio/types";
2
+ /**
3
+ * Returns the master ref from a list of given refs.
4
+ *
5
+ * @param refs - A list of refs to search.
6
+ *
7
+ * @returns The master ref from the list.
8
+ * @throws If a matching ref cannot be found.
9
+ */
10
+ export declare const findMasterRef: (refs: prismicT.Ref[]) => prismicT.Ref;
@@ -1,13 +1,13 @@
1
- import * as prismicT from "@prismicio/types";
2
- /**
3
- * Returns the first ref from a list that passes a predicate (a function that
4
- * returns true).
5
- *
6
- * @param refs - A list of refs to search.
7
- * @param predicate - A function that determines if a ref from the list matches
8
- * the criteria.
9
- *
10
- * @returns The first matching ref.
11
- * @throws If a matching ref cannot be found.
12
- */
13
- export declare const findRef: (refs: prismicT.Ref[], predicate: (ref: prismicT.Ref) => boolean) => prismicT.Ref;
1
+ import * as prismicT from "@prismicio/types";
2
+ /**
3
+ * Returns the first ref from a list that passes a predicate (a function that
4
+ * returns true).
5
+ *
6
+ * @param refs - A list of refs to search.
7
+ * @param predicate - A function that determines if a ref from the list matches
8
+ * the criteria.
9
+ *
10
+ * @returns The first matching ref.
11
+ * @throws If a matching ref cannot be found.
12
+ */
13
+ export declare const findRef: (refs: prismicT.Ref[], predicate: (ref: prismicT.Ref) => boolean) => prismicT.Ref;
@@ -1,11 +1,11 @@
1
- import * as prismicT from "@prismicio/types";
2
- /**
3
- * Returns the ref from a list of given refs with a matching ID.
4
- *
5
- * @param refs - A list of refs to search.
6
- * @param id - The ID of the ref to find.
7
- *
8
- * @returns The ref with a matching ID from the list.
9
- * @throws If a matching ref cannot be found.
10
- */
11
- export declare const findRefByID: (refs: prismicT.Ref[], id: string) => prismicT.Ref;
1
+ import * as prismicT from "@prismicio/types";
2
+ /**
3
+ * Returns the ref from a list of given refs with a matching ID.
4
+ *
5
+ * @param refs - A list of refs to search.
6
+ * @param id - The ID of the ref to find.
7
+ *
8
+ * @returns The ref with a matching ID from the list.
9
+ * @throws If a matching ref cannot be found.
10
+ */
11
+ export declare const findRefByID: (refs: prismicT.Ref[], id: string) => prismicT.Ref;
@@ -1,11 +1,11 @@
1
- import * as prismicT from "@prismicio/types";
2
- /**
3
- * Returns the ref from a list of given refs with a matching label.
4
- *
5
- * @param refs - A list of refs to search.
6
- * @param id - The label of the ref to find.
7
- *
8
- * @returns The ref with a matching label from the list.
9
- * @throws If a matching ref cannot be found.
10
- */
11
- export declare const findRefByLabel: (refs: prismicT.Ref[], label: string) => prismicT.Ref;
1
+ import * as prismicT from "@prismicio/types";
2
+ /**
3
+ * Returns the ref from a list of given refs with a matching label.
4
+ *
5
+ * @param refs - A list of refs to search.
6
+ * @param id - The label of the ref to find.
7
+ *
8
+ * @returns The ref with a matching label from the list.
9
+ * @throws If a matching ref cannot be found.
10
+ */
11
+ export declare const findRefByLabel: (refs: prismicT.Ref[], label: string) => prismicT.Ref;
@@ -1,9 +1,9 @@
1
- /**
2
- * Returns the value of a cookie from a given cookie store.
3
- *
4
- * @param cookieJar - The stringified cookie store from which to read the
5
- * cookie.
6
- *
7
- * @returns The value of the cookie, if it exists.
8
- */
9
- export declare const getPreviewCookie: (cookieJar: string) => string | undefined;
1
+ /**
2
+ * Returns the value of a cookie from a given cookie store.
3
+ *
4
+ * @param cookieJar - The stringified cookie store from which to read the
5
+ * cookie.
6
+ *
7
+ * @returns The value of the cookie, if it exists.
8
+ */
9
+ export declare const getPreviewCookie: (cookieJar: string) => string | undefined;
@@ -1,8 +1,8 @@
1
- /**
2
- * Minifies a GraphQL query by removing whitespace where possible.
3
- *
4
- * @param query - GraphQL query to minify.
5
- *
6
- * @returns A minified version of `query`.
7
- */
8
- export declare const minifyGraphQLQuery: (query: string) => string;
1
+ /**
2
+ * Minifies a GraphQL query by removing whitespace where possible.
3
+ *
4
+ * @param query - GraphQL query to minify.
5
+ *
6
+ * @returns A minified version of `query`.
7
+ */
8
+ export declare const minifyGraphQLQuery: (query: string) => string;
@@ -1,11 +1,11 @@
1
- /**
2
- * Throws an error if a given value is nullish.
3
- *
4
- * @typeParam Nullable - Value to check.
5
- * @param a -Nullable value to check.
6
- * @param error - Error to throw if `a` is nullish.
7
- *
8
- * @returns `a`, whose type is narrowed to be non-nullable.
9
- * @throws Throws the given error if `a` is nullish.
10
- */
11
- export declare const orElseThrow: <T>(a: T | null | undefined, error: Error) => T;
1
+ /**
2
+ * Throws an error if a given value is nullish.
3
+ *
4
+ * @typeParam Nullable - Value to check.
5
+ * @param a -Nullable value to check.
6
+ * @param error - Error to throw if `a` is nullish.
7
+ *
8
+ * @returns `a`, whose type is narrowed to be non-nullable.
9
+ * @throws Throws the given error if `a` is nullish.
10
+ */
11
+ export declare const orElseThrow: <T>(a: T | null | undefined, error: Error) => T;