@prismicio/client 6.0.0-beta.0 → 6.0.0-beta.1

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/index.ts CHANGED
@@ -4,7 +4,7 @@ export * from "./buildQueryURL";
4
4
  export { createClient, Client } from "./client";
5
5
 
6
6
  // Predicates API.
7
- export * as predicate from "./predicate";
7
+ export { predicate } from "./predicate";
8
8
 
9
9
  // Custom errors used by Client.
10
10
  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 A function that accepts an object with a `predicates` property. The
13
- * `predicates` list will be appended to that object.
15
+ * @returns The object with the appended predicates.
14
16
  */
15
- export const appendPredicates =
16
- <T extends WithPredicates>(...predicates: string[]) =>
17
- /**
18
- * Adds one or more predicates to an object with a `predicates` property.
19
- * Appended predicates are added to the end of the existing list.
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: [objWithPredicates.predicates || [], ...predicates].flat(),
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
- * The `at` predicate checks that the path matches the described value exactly.
101
- * It takes a single value for a field or an array (only for tags).
102
- *
103
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#at}
104
- */
105
- export const at = pathWithArgsPredicate<DefaultPredicateArgs>("at");
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
- * The `any` predicate takes an array of values. It works exactly the same way
117
- * as the `at` operator, but checks whether the fragment matches any of the
118
- * values in the array.
119
- *
120
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#any}
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
- * The `in` predicate is used specifically to retrieve an array of documents by
126
- * their IDs or UIDs. This predicate is much more efficient at this than the any
127
- * predicate.
128
- *
129
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#in}
130
- */
131
- const _in = pathWithArgsPredicate<DefaultPredicateArgs>("in");
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
- // Named `_in` since `in` is a keyword.
134
- export { _in as in };
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
- * The `fulltext` predicate provides two capabilities:
138
- *
139
- * 1. Checking if a certain string is anywhere inside a document (this is what you
140
- * should use to make your project's search engine feature)
141
- * 2. Checking if the string is contained inside a specific custom type’s Rich Text
142
- * or Key Text fragment.
143
- *
144
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#fulltext}
145
- */
146
- export const fulltext = pathWithArgsPredicate<DefaultPredicateArgs>("fulltext");
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
- * The `has` predicate checks whether a fragment has a value. It will return all
150
- * the documents of the specified type that contain a value for the specified field.
151
- *
152
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#has}
153
- */
154
- export const has = pathPredicate("has");
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
- * The `missing` predicate checks if a fragment doesn't have a value. It will
158
- * return all the documents of the specified type that do not contain a value
159
- * for the specified field.
160
- *
161
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#missing}
162
- */
163
- export const missing = pathPredicate("missing");
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
- * The `similar` predicate takes the ID of a document, and returns a list of
167
- * documents with similar content. This allows you to build an automated content
168
- * discovery feature (for example, a "Related posts" section).
169
- *
170
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#similar}
171
- */
172
- export const similar = argsPredicate<[id: string, value: number]>("similar");
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
- * The `geopoint.near` predicate checks that the value in the path is within the
176
- * radius of the given coordinates.
177
- *
178
- * This predicate will only work for a GeoPoint field.
179
- *
180
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#near}
181
- */
182
- export const geopointNear =
183
- pathWithArgsPredicate<[latitude: number, longitude: number, radius: number]>(
184
- "geopoint.near",
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
- * The `number.lt` predicate checks that the value in the number field is less
189
- * than the value passed into the predicate.
190
- *
191
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#lt-less-than}
192
- */
193
- export const numberLessThan =
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
- * The `number.gt` predicate checks that the value in the number field is
198
- * greater than the value passed into the predicate.
199
- *
200
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#gt-greater-than}
201
- */
202
- export const numberGreaterThan =
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
- * The `number.inRange` predicate checks that the value in the path is within
207
- * the two values passed into the predicate.
208
- *
209
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api#inrange}
210
- */
211
- export const numberInRange =
212
- pathWithArgsPredicate<[lowerLimit: number, upperLimit: number]>(
213
- "number.inRange",
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
- * The `date.after` predicate checks that the value in the path is after the
218
- * date value passed into the predicate.
219
- *
220
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#after}
221
- */
222
- export const dateAfter =
223
- pathWithArgsPredicate<[date: string | number | Date]>("date.after");
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
- * The `date.before` predicate checks that the value in the path is before the
227
- * date value passed into the predicate.
228
- *
229
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#before}
230
- */
231
- export const dateBefore =
232
- pathWithArgsPredicate<[date: string | number | Date]>("date.before");
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
- * The `date.between` predicate checks that the value in the path is within the
236
- * date values passed into the predicate.
237
- *
238
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#between}
239
- */
240
- export const dateBetween =
241
- pathWithArgsPredicate<
242
- [startDate: string | number | Date, endDate: string | number | Date]
243
- >("date.between");
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
- * The `date.day-of-month` predicate checks that the value in the path is equal
247
- * to the day of the month passed into the predicate.
248
- *
249
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonth}
250
- */
251
- export const dateDayOfMonth =
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
- * The `date.day-of-month-after` predicate checks that the value in the path is
256
- * after the day of the month passed into the predicate.
257
- *
258
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthafter}
259
- */
260
- export const dateDayOfMonthAfter = pathWithArgsPredicate<[day: number]>(
261
- "date.day-of-month-after",
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
- * The `date.day-of-month-before` predicate checks that the value in the path is
266
- * before the day of the month passed into the predicate.
267
- *
268
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofmonthbefore}
269
- */
270
- export const dateDayOfMonthBefore = pathWithArgsPredicate<[day: number]>(
271
- "date.day-of-month-before",
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
- * The `date.day-of-week` predicate checks that the value in the path is equal
276
- * to the day of the week passed into the predicate.
277
- *
278
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweek}
279
- */
280
- export const dateDayOfWeek =
281
- pathWithArgsPredicate<[day: string | number]>("date.day-of-week");
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
- * The `date.day-of-week-after` predicate checks that the value in the path is
285
- * after the day of the week passed into the predicate.
286
- *
287
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekafter}
288
- */
289
- export const dateDayOfWeekAfter = pathWithArgsPredicate<[day: string | number]>(
290
- "date.day-of-week-after",
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
- * The date.day-of-week-before predicate checks that the value in the path is
295
- * before the day of the week passed into the predicate.
296
- *
297
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#dayofweekbefore}
298
- */
299
- export const dateDayOfWeekBefore = pathWithArgsPredicate<
300
- [day: string | number]
301
- >("date.day-of-week-before");
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
- * The `date.month` predicate checks that the value in the path occurs in the
305
- * month value passed into the predicate.
306
- *
307
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#month}
308
- */
309
- export const dateMonth =
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
- * The `date.month-after` predicate checks that the value in the path occurs in
314
- * any month after the value passed into the predicate.
315
- *
316
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthafter}
317
- */
318
- export const dateMonthAfter =
319
- pathWithArgsPredicate<[month: string | number]>("date.month-after");
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
- * The `date.month-before` predicate checks that the value in the path occurs in
323
- * any month before the value passed into the predicate.
324
- *
325
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#monthbefore}
326
- */
327
- export const dateMonthBefore =
328
- pathWithArgsPredicate<[month: string | number]>("date.month-before");
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
- * The `date.year` predicate checks that the value in the path occurs in the
332
- * year value passed into the predicate.
333
- *
334
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#year}
335
- */
336
- export const dateYear = pathWithArgsPredicate<[year: number]>("date.year");
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
- * The `date.hour` predicate checks that the value in the path occurs within the
340
- * hour value passed into the predicate.
341
- *
342
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hour}
343
- */
344
- export const dateHour = pathWithArgsPredicate<[hour: number]>("date.hour");
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
- * The `date.hour-after` predicate checks that the value in the path occurs
348
- * after the hour value passed into the predicate.
349
- *
350
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourafter}
351
- */
352
- export const dateHourAfter =
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
- * The `date.hour-before` predicate checks that the value in the path occurs
357
- * before the hour value passed into the predicate.
358
- *
359
- * {@link https://prismic.io/docs/technologies/date-and-time-based-predicate-reference-rest-api#hourbefore}
360
- */
361
- export const dateHourBefore =
362
- pathWithArgsPredicate<[hour: number]>("date.hour-before");
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
+ };