@prismicio/client 6.0.0-beta.0 → 6.0.0-beta.4
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.cjs +212 -289
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +354 -369
- package/dist/index.js +488 -0
- package/dist/index.js.map +1 -0
- package/package.json +16 -15
- 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 +280 -401
- package/src/index.ts +12 -1
- 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/dist/index.mjs +0 -567
- package/dist/index.mjs.map +0 -1
package/src/index.ts
CHANGED
|
@@ -4,7 +4,18 @@ export * from "./buildQueryURL";
|
|
|
4
4
|
export { createClient, Client } from "./client";
|
|
5
5
|
|
|
6
6
|
// Predicates API.
|
|
7
|
-
|
|
7
|
+
import { predicate } from "./predicate";
|
|
8
|
+
export { predicate };
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Renamed to `predicate` (without an "s").
|
|
11
|
+
*/
|
|
12
|
+
// TODO: Remove in v3.
|
|
13
|
+
export const predicates = predicate;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Renamed to `predicate` (lowercase and without an "s").
|
|
16
|
+
*/
|
|
17
|
+
// TODO: Remove in v3.
|
|
18
|
+
export const Predicates = predicate;
|
|
8
19
|
|
|
9
20
|
// Custom errors used by Client.
|
|
10
21
|
export { PrismicError } from "./PrismicError";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { castArray } from "./castArray";
|
|
2
|
+
|
|
1
3
|
interface WithPredicates {
|
|
2
4
|
predicates?: string | string[];
|
|
3
5
|
}
|
|
@@ -7,22 +9,20 @@ interface WithPredicates {
|
|
|
7
9
|
* Appended predicates are added to the end of the existing list.
|
|
8
10
|
*
|
|
9
11
|
* @typeParam T - Object to which predicates will be append.
|
|
12
|
+
* @param objWithPredicates - Object to append predicates on the `predicates` property.
|
|
10
13
|
* @param predicates - One or more predicates to append.
|
|
11
14
|
*
|
|
12
|
-
* @returns
|
|
13
|
-
* `predicates` list will be appended to that object.
|
|
15
|
+
* @returns The object with the appended predicates.
|
|
14
16
|
*/
|
|
15
|
-
export const appendPredicates =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @param objWithPredicates - Object to append predicates on the `predicates` property.
|
|
22
|
-
*
|
|
23
|
-
* @returns The object with the appended predicates.
|
|
24
|
-
*/
|
|
25
|
-
(objWithPredicates: T = {} as T): T => ({
|
|
17
|
+
export const appendPredicates = <T extends WithPredicates>(
|
|
18
|
+
objWithPredicates: T = {} as T,
|
|
19
|
+
predicates: string | string[],
|
|
20
|
+
) => {
|
|
21
|
+
return {
|
|
26
22
|
...objWithPredicates,
|
|
27
|
-
predicates: [
|
|
28
|
-
|
|
23
|
+
predicates: [
|
|
24
|
+
...(objWithPredicates.predicates || []),
|
|
25
|
+
...castArray(predicates),
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as prismicT from "@prismicio/types";
|
|
2
|
+
|
|
3
|
+
import { findRef } from "./findRef";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the master ref from a list of given refs.
|
|
7
|
+
*
|
|
8
|
+
* @param refs - A list of refs to search.
|
|
9
|
+
*
|
|
10
|
+
* @returns The master ref from the list.
|
|
11
|
+
* @throws If a matching ref cannot be found.
|
|
12
|
+
*/
|
|
13
|
+
export const findMasterRef = (refs: prismicT.Ref[]): prismicT.Ref => {
|
|
14
|
+
return findRef(refs, (ref) => ref.isMasterRef);
|
|
15
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as prismicT from "@prismicio/types";
|
|
2
|
+
|
|
3
|
+
import { PrismicError } from "../PrismicError";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the first ref from a list that passes a predicate (a function that
|
|
7
|
+
* returns true).
|
|
8
|
+
*
|
|
9
|
+
* @param refs - A list of refs to search.
|
|
10
|
+
* @param predicate - A function that determines if a ref from the list matches
|
|
11
|
+
* the criteria.
|
|
12
|
+
*
|
|
13
|
+
* @returns The first matching ref.
|
|
14
|
+
* @throws If a matching ref cannot be found.
|
|
15
|
+
*/
|
|
16
|
+
export const findRef = (
|
|
17
|
+
refs: prismicT.Ref[],
|
|
18
|
+
predicate: (ref: prismicT.Ref) => boolean,
|
|
19
|
+
): prismicT.Ref => {
|
|
20
|
+
const ref = refs.find((ref) => predicate(ref));
|
|
21
|
+
|
|
22
|
+
if (!ref) {
|
|
23
|
+
throw new PrismicError("Ref could not be found.", undefined, undefined);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return ref;
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as prismicT from "@prismicio/types";
|
|
2
|
+
|
|
3
|
+
import { findRef } from "./findRef";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the ref from a list of given refs with a matching ID.
|
|
7
|
+
*
|
|
8
|
+
* @param refs - A list of refs to search.
|
|
9
|
+
* @param id - The ID of the ref to find.
|
|
10
|
+
*
|
|
11
|
+
* @returns The ref with a matching ID from the list.
|
|
12
|
+
* @throws If a matching ref cannot be found.
|
|
13
|
+
*/
|
|
14
|
+
export const findRefByID = (refs: prismicT.Ref[], id: string): prismicT.Ref => {
|
|
15
|
+
return findRef(refs, (ref) => ref.id === id);
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as prismicT from "@prismicio/types";
|
|
2
|
+
|
|
3
|
+
import { findRef } from "./findRef";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the ref from a list of given refs with a matching label.
|
|
7
|
+
*
|
|
8
|
+
* @param refs - A list of refs to search.
|
|
9
|
+
* @param id - The label of the ref to find.
|
|
10
|
+
*
|
|
11
|
+
* @returns The ref with a matching label from the list.
|
|
12
|
+
* @throws If a matching ref cannot be found.
|
|
13
|
+
*/
|
|
14
|
+
export const findRefByLabel = (
|
|
15
|
+
refs: prismicT.Ref[],
|
|
16
|
+
label: string,
|
|
17
|
+
): prismicT.Ref => {
|
|
18
|
+
return findRef(refs, (ref) => ref.label === label);
|
|
19
|
+
};
|
package/src/predicate.ts
CHANGED
|
@@ -96,267 +96,261 @@ const argsPredicate = <Args extends unknown[]>(name: string) => {
|
|
|
96
96
|
*/
|
|
97
97
|
type DefaultPredicateArgs = [value: string | number | (string | number)[]];
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The `not` predicate checks that the path doesn't match the provided value
|
|
109
|
-
* exactly. It takes a single value as the argument.
|
|
110
|
-
*
|
|
111
|
-
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
|
|
112
|
-
*/
|
|
113
|
-
export const not = pathWithArgsPredicate<DefaultPredicateArgs>("not");
|
|
99
|
+
export const predicate = {
|
|
100
|
+
/**
|
|
101
|
+
* The `at` predicate checks that the path matches the described value
|
|
102
|
+
* exactly. It takes a single value for a field or an array (only for tags).
|
|
103
|
+
*
|
|
104
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#at}
|
|
105
|
+
*/
|
|
106
|
+
at: pathWithArgsPredicate<DefaultPredicateArgs>("at"),
|
|
114
107
|
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
export const any = pathWithArgsPredicate<DefaultPredicateArgs>("any");
|
|
108
|
+
/**
|
|
109
|
+
* The `not` predicate checks that the path doesn't match the provided value
|
|
110
|
+
* exactly. It takes a single value as the argument.
|
|
111
|
+
*
|
|
112
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#not}
|
|
113
|
+
*/
|
|
114
|
+
not: pathWithArgsPredicate<DefaultPredicateArgs>("not"),
|
|
123
115
|
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
116
|
+
/**
|
|
117
|
+
* The `any` predicate takes an array of values. It works exactly the same way
|
|
118
|
+
* as the `at` operator, but checks whether the fragment matches any of the
|
|
119
|
+
* values in the array.
|
|
120
|
+
*
|
|
121
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#any}
|
|
122
|
+
*/
|
|
123
|
+
any: pathWithArgsPredicate<DefaultPredicateArgs>("any"),
|
|
132
124
|
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
/**
|
|
126
|
+
* The `in` predicate is used specifically to retrieve an array of documents
|
|
127
|
+
* by their IDs or UIDs. This predicate is much more efficient at this than
|
|
128
|
+
* the any predicate.
|
|
129
|
+
*
|
|
130
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#in}
|
|
131
|
+
*/
|
|
132
|
+
in: pathWithArgsPredicate<DefaultPredicateArgs>("in"),
|
|
135
133
|
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
134
|
+
/**
|
|
135
|
+
* The `fulltext` predicate provides two capabilities:
|
|
136
|
+
*
|
|
137
|
+
* 1. Checking if a certain string is anywhere inside a document (this is what
|
|
138
|
+
* you should use to make your project's search engine feature)
|
|
139
|
+
* 2. Checking if the string is contained inside a specific custom type’s Rich
|
|
140
|
+
* Text or Key Text fragment.
|
|
141
|
+
*
|
|
142
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#fulltext}
|
|
143
|
+
*/
|
|
144
|
+
fulltext: pathWithArgsPredicate<DefaultPredicateArgs>("fulltext"),
|
|
147
145
|
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
/**
|
|
147
|
+
* The `has` predicate checks whether a fragment has a value. It will return
|
|
148
|
+
* all the documents of the specified type that contain a value for the
|
|
149
|
+
* specified field.
|
|
150
|
+
*
|
|
151
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#has}
|
|
152
|
+
*/
|
|
153
|
+
has: pathPredicate("has"),
|
|
155
154
|
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
155
|
+
/**
|
|
156
|
+
* The `missing` predicate checks if a fragment doesn't have a value. It will
|
|
157
|
+
* return all the documents of the specified type that do not contain a value
|
|
158
|
+
* for the specified field.
|
|
159
|
+
*
|
|
160
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#missing}
|
|
161
|
+
*/
|
|
162
|
+
missing: pathPredicate("missing"),
|
|
164
163
|
|
|
165
|
-
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
164
|
+
/**
|
|
165
|
+
* The `similar` predicate takes the ID of a document, and returns a list of
|
|
166
|
+
* documents with similar content. This allows you to build an automated
|
|
167
|
+
* content discovery feature (for example, a "Related posts" section).
|
|
168
|
+
*
|
|
169
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#similar}
|
|
170
|
+
*/
|
|
171
|
+
similar: argsPredicate<[id: string, value: number]>("similar"),
|
|
173
172
|
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
/**
|
|
174
|
+
* The `geopoint.near` predicate checks that the value in the path is within
|
|
175
|
+
* the radius of the given coordinates.
|
|
176
|
+
*
|
|
177
|
+
* This predicate will only work for a GeoPoint field.
|
|
178
|
+
*
|
|
179
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#near}
|
|
180
|
+
*/
|
|
181
|
+
geopointNear:
|
|
182
|
+
pathWithArgsPredicate<
|
|
183
|
+
[latitude: number, longitude: number, radius: number]
|
|
184
|
+
>("geopoint.near"),
|
|
186
185
|
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
pathWithArgsPredicate<[value: number]>("number.lt");
|
|
186
|
+
/**
|
|
187
|
+
* The `number.lt` predicate checks that the value in the number field is less
|
|
188
|
+
* than the value passed into the predicate.
|
|
189
|
+
*
|
|
190
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#lt-less-than}
|
|
191
|
+
*/
|
|
192
|
+
numberLessThan: pathWithArgsPredicate<[value: number]>("number.lt"),
|
|
195
193
|
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
pathWithArgsPredicate<[value: number]>("number.gt");
|
|
194
|
+
/**
|
|
195
|
+
* The `number.gt` predicate checks that the value in the number field is
|
|
196
|
+
* greater than the value passed into the predicate.
|
|
197
|
+
*
|
|
198
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#gt-greater-than}
|
|
199
|
+
*/
|
|
200
|
+
numberGreaterThan: pathWithArgsPredicate<[value: number]>("number.gt"),
|
|
204
201
|
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
202
|
+
/**
|
|
203
|
+
* The `number.inRange` predicate checks that the value in the path is within
|
|
204
|
+
* the two values passed into the predicate.
|
|
205
|
+
*
|
|
206
|
+
* {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#inrange}
|
|
207
|
+
*/
|
|
208
|
+
numberInRange:
|
|
209
|
+
pathWithArgsPredicate<[lowerLimit: number, upperLimit: number]>(
|
|
210
|
+
"number.inRange",
|
|
211
|
+
),
|
|
215
212
|
|
|
216
|
-
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
213
|
+
/**
|
|
214
|
+
* The `date.after` predicate checks that the value in the path is after the
|
|
215
|
+
* date value passed into the predicate.
|
|
216
|
+
*
|
|
217
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#after}
|
|
218
|
+
*/
|
|
219
|
+
dateAfter:
|
|
220
|
+
pathWithArgsPredicate<[date: string | number | Date]>("date.after"),
|
|
224
221
|
|
|
225
|
-
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
222
|
+
/**
|
|
223
|
+
* The `date.before` predicate checks that the value in the path is before the
|
|
224
|
+
* date value passed into the predicate.
|
|
225
|
+
*
|
|
226
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#before}
|
|
227
|
+
*/
|
|
228
|
+
dateBefore:
|
|
229
|
+
pathWithArgsPredicate<[date: string | number | Date]>("date.before"),
|
|
233
230
|
|
|
234
|
-
/**
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
231
|
+
/**
|
|
232
|
+
* The `date.between` predicate checks that the value in the path is within
|
|
233
|
+
* the date values passed into the predicate.
|
|
234
|
+
*
|
|
235
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#between}
|
|
236
|
+
*/
|
|
237
|
+
dateBetween:
|
|
238
|
+
pathWithArgsPredicate<
|
|
239
|
+
[startDate: string | number | Date, endDate: string | number | Date]
|
|
240
|
+
>("date.between"),
|
|
244
241
|
|
|
245
|
-
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
pathWithArgsPredicate<[day: number]>("date.day-of-month");
|
|
242
|
+
/**
|
|
243
|
+
* The `date.day-of-month` predicate checks that the value in the path is
|
|
244
|
+
* equal to the day of the month passed into the predicate.
|
|
245
|
+
*
|
|
246
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonth}
|
|
247
|
+
*/
|
|
248
|
+
dateDayOfMonth: pathWithArgsPredicate<[day: number]>("date.day-of-month"),
|
|
253
249
|
|
|
254
|
-
/**
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
)
|
|
250
|
+
/**
|
|
251
|
+
* The `date.day-of-month-after` predicate checks that the value in the path
|
|
252
|
+
* is after the day of the month passed into the predicate.
|
|
253
|
+
*
|
|
254
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthafter}
|
|
255
|
+
*/
|
|
256
|
+
dateDayOfMonthAfter: pathWithArgsPredicate<[day: number]>(
|
|
257
|
+
"date.day-of-month-after",
|
|
258
|
+
),
|
|
263
259
|
|
|
264
|
-
/**
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
)
|
|
260
|
+
/**
|
|
261
|
+
* The `date.day-of-month-before` predicate checks that the value in the path
|
|
262
|
+
* is before the day of the month passed into the predicate.
|
|
263
|
+
*
|
|
264
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthbefore}
|
|
265
|
+
*/
|
|
266
|
+
dateDayOfMonthBefore: pathWithArgsPredicate<[day: number]>(
|
|
267
|
+
"date.day-of-month-before",
|
|
268
|
+
),
|
|
273
269
|
|
|
274
|
-
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
270
|
+
/**
|
|
271
|
+
* The `date.day-of-week` predicate checks that the value in the path is equal
|
|
272
|
+
* to the day of the week passed into the predicate.
|
|
273
|
+
*
|
|
274
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweek}
|
|
275
|
+
*/
|
|
276
|
+
dateDayOfWeek:
|
|
277
|
+
pathWithArgsPredicate<[day: string | number]>("date.day-of-week"),
|
|
282
278
|
|
|
283
|
-
/**
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
)
|
|
279
|
+
/**
|
|
280
|
+
* The `date.day-of-week-after` predicate checks that the value in the path is
|
|
281
|
+
* after the day of the week passed into the predicate.
|
|
282
|
+
*
|
|
283
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekafter}
|
|
284
|
+
*/
|
|
285
|
+
dateDayOfWeekAfter: pathWithArgsPredicate<[day: string | number]>(
|
|
286
|
+
"date.day-of-week-after",
|
|
287
|
+
),
|
|
292
288
|
|
|
293
|
-
/**
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
289
|
+
/**
|
|
290
|
+
* The date.day-of-week-before predicate checks that the value in the path is
|
|
291
|
+
* before the day of the week passed into the predicate.
|
|
292
|
+
*
|
|
293
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekbefore}
|
|
294
|
+
*/
|
|
295
|
+
dateDayOfWeekBefore: pathWithArgsPredicate<[day: string | number]>(
|
|
296
|
+
"date.day-of-week-before",
|
|
297
|
+
),
|
|
302
298
|
|
|
303
|
-
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
pathWithArgsPredicate<[month: string | number]>("date.month");
|
|
299
|
+
/**
|
|
300
|
+
* The `date.month` predicate checks that the value in the path occurs in the
|
|
301
|
+
* month value passed into the predicate.
|
|
302
|
+
*
|
|
303
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#month}
|
|
304
|
+
*/
|
|
305
|
+
dateMonth: pathWithArgsPredicate<[month: string | number]>("date.month"),
|
|
311
306
|
|
|
312
|
-
/**
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
307
|
+
/**
|
|
308
|
+
* The `date.month-after` predicate checks that the value in the path occurs
|
|
309
|
+
* in any month after the value passed into the predicate.
|
|
310
|
+
*
|
|
311
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthafter}
|
|
312
|
+
*/
|
|
313
|
+
dateMonthAfter:
|
|
314
|
+
pathWithArgsPredicate<[month: string | number]>("date.month-after"),
|
|
320
315
|
|
|
321
|
-
/**
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
316
|
+
/**
|
|
317
|
+
* The `date.month-before` predicate checks that the value in the path occurs
|
|
318
|
+
* in any month before the value passed into the predicate.
|
|
319
|
+
*
|
|
320
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthbefore}
|
|
321
|
+
*/
|
|
322
|
+
dateMonthBefore:
|
|
323
|
+
pathWithArgsPredicate<[month: string | number]>("date.month-before"),
|
|
329
324
|
|
|
330
|
-
/**
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
325
|
+
/**
|
|
326
|
+
* The `date.year` predicate checks that the value in the path occurs in the
|
|
327
|
+
* year value passed into the predicate.
|
|
328
|
+
*
|
|
329
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#year}
|
|
330
|
+
*/
|
|
331
|
+
dateYear: pathWithArgsPredicate<[year: number]>("date.year"),
|
|
337
332
|
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
333
|
+
/**
|
|
334
|
+
* The `date.hour` predicate checks that the value in the path occurs within
|
|
335
|
+
* the hour value passed into the predicate.
|
|
336
|
+
*
|
|
337
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hour}
|
|
338
|
+
*/
|
|
339
|
+
dateHour: pathWithArgsPredicate<[hour: number]>("date.hour"),
|
|
345
340
|
|
|
346
|
-
/**
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
pathWithArgsPredicate<[hour: number]>("date.hour-after");
|
|
341
|
+
/**
|
|
342
|
+
* The `date.hour-after` predicate checks that the value in the path occurs
|
|
343
|
+
* after the hour value passed into the predicate.
|
|
344
|
+
*
|
|
345
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourafter}
|
|
346
|
+
*/
|
|
347
|
+
dateHourAfter: pathWithArgsPredicate<[hour: number]>("date.hour-after"),
|
|
354
348
|
|
|
355
|
-
/**
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
349
|
+
/**
|
|
350
|
+
* The `date.hour-before` predicate checks that the value in the path occurs
|
|
351
|
+
* before the hour value passed into the predicate.
|
|
352
|
+
*
|
|
353
|
+
* {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourbefore}
|
|
354
|
+
*/
|
|
355
|
+
dateHourBefore: pathWithArgsPredicate<[hour: number]>("date.hour-before"),
|
|
356
|
+
};
|