@prismicio/client 7.0.0-alpha.5 → 7.0.1-alpha.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/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +15 -14
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/createClient.cjs +63 -30
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +95 -48
- package/dist/createClient.js +63 -30
- package/dist/createClient.js.map +1 -1
- package/dist/filter.cjs +39 -39
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.ts +39 -39
- package/dist/filter.js +39 -39
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +1 -0
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +2 -0
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.ts +1 -0
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.ts +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.ts +3 -2
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +34 -28
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +5 -5
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +3 -3
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +6 -6
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +32 -23
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +12 -7
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +18 -14
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.ts +2 -0
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +3 -1
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.ts +24 -20
- package/dist/helpers/isFilled.js +3 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/appendFilters.cjs.map +1 -1
- package/dist/lib/appendFilters.d.ts +4 -4
- package/dist/lib/appendFilters.js.map +1 -1
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.d.ts +1 -0
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.d.ts +2 -1
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/lib/everyTagFilter.cjs.map +1 -1
- package/dist/lib/everyTagFilter.d.ts +2 -2
- package/dist/lib/everyTagFilter.js.map +1 -1
- package/dist/lib/findMasterRef.cjs.map +1 -1
- package/dist/lib/findMasterRef.d.ts +1 -0
- package/dist/lib/findMasterRef.js.map +1 -1
- package/dist/lib/findRef.cjs.map +1 -1
- package/dist/lib/findRef.d.ts +3 -2
- package/dist/lib/findRef.js.map +1 -1
- package/dist/lib/findRefByID.cjs.map +1 -1
- package/dist/lib/findRefByID.d.ts +1 -0
- package/dist/lib/findRefByID.js.map +1 -1
- package/dist/lib/findRefByLabel.cjs.map +1 -1
- package/dist/lib/findRefByLabel.d.ts +1 -0
- package/dist/lib/findRefByLabel.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/api/query.d.ts +1 -0
- package/dist/types/api/release.d.ts +1 -0
- package/dist/types/api/repository.d.ts +2 -2
- package/dist/types/api/tags.d.ts +1 -0
- package/dist/types/model/boolean.d.ts +1 -1
- package/dist/types/model/color.d.ts +1 -1
- package/dist/types/model/contentRelationship.d.ts +2 -3
- package/dist/types/model/customType.d.ts +11 -11
- package/dist/types/model/date.d.ts +1 -1
- package/dist/types/model/embed.d.ts +1 -1
- package/dist/types/model/geoPoint.d.ts +1 -1
- package/dist/types/model/group.d.ts +1 -1
- package/dist/types/model/image.d.ts +3 -3
- package/dist/types/model/{integrationFields.d.ts → integration.d.ts} +3 -3
- package/dist/types/model/keyText.d.ts +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.ts +4 -6
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +2 -3
- package/dist/types/model/number.d.ts +1 -1
- package/dist/types/model/richText.d.ts +3 -3
- package/dist/types/model/select.d.ts +1 -1
- package/dist/types/model/sharedSlice.d.ts +2 -2
- package/dist/types/model/sharedSliceVariation.d.ts +1 -1
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.ts +1 -1
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.ts +2 -2
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/timestamp.d.ts +1 -1
- package/dist/types/model/title.d.ts +1 -1
- package/dist/types/model/types.cjs +5 -1
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.ts +10 -6
- package/dist/types/model/types.js +5 -1
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.ts +1 -1
- package/dist/types/value/boolean.d.ts +1 -1
- package/dist/types/value/color.d.ts +2 -1
- package/dist/types/value/contentRelationship.d.ts +1 -1
- package/dist/types/value/date.d.ts +2 -1
- package/dist/types/value/document.d.ts +4 -4
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.ts +2 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.ts +2 -1
- package/dist/types/value/group.d.ts +1 -1
- package/dist/types/value/image.d.ts +5 -3
- package/dist/types/value/{integrationFields.d.ts → integration.d.ts} +3 -2
- package/dist/types/value/keyText.d.ts +2 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.ts +2 -2
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +2 -2
- package/dist/types/value/number.d.ts +2 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.ts +26 -26
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.ts +2 -1
- package/dist/types/value/sharedSlice.d.ts +1 -1
- package/dist/types/value/sharedSliceVariation.d.ts +3 -0
- package/dist/types/value/slice.d.ts +1 -1
- package/dist/types/value/timestamp.d.ts +1 -1
- package/dist/types/value/title.d.ts +1 -1
- package/dist/types/value/types.d.ts +3 -2
- package/dist/types/webhook/apiUpdate.d.ts +1 -1
- package/package.json +4 -4
- package/src/buildQueryURL.ts +15 -14
- package/src/createClient.ts +112 -55
- package/src/filter.ts +43 -43
- package/src/getGraphQLEndpoint.ts +1 -0
- package/src/getRepositoryEndpoint.ts +2 -0
- package/src/getRepositoryName.ts +1 -0
- package/src/getToolbarSrc.ts +1 -1
- package/src/helpers/asDate.ts +3 -2
- package/src/helpers/asHTML.ts +36 -30
- package/src/helpers/asImagePixelDensitySrcSet.ts +5 -5
- package/src/helpers/asImageSrc.ts +3 -3
- package/src/helpers/asImageWidthSrcSet.ts +6 -6
- package/src/helpers/asLink.ts +36 -27
- package/src/helpers/asLinkAttrs.ts +12 -7
- package/src/helpers/asText.ts +18 -14
- package/src/helpers/documentToLinkField.ts +3 -1
- package/src/helpers/isFilled.ts +27 -22
- package/src/index.ts +20 -3
- package/src/lib/appendFilters.ts +4 -4
- package/src/lib/castArray.ts +1 -0
- package/src/lib/castThunk.ts +9 -2
- package/src/lib/everyTagFilter.ts +2 -2
- package/src/lib/findMasterRef.ts +1 -0
- package/src/lib/findRef.ts +3 -2
- package/src/lib/findRefByID.ts +1 -0
- package/src/lib/findRefByLabel.ts +1 -0
- package/src/types/api/query.ts +1 -0
- package/src/types/api/release.ts +1 -0
- package/src/types/api/repository.ts +2 -2
- package/src/types/api/tags.ts +1 -0
- package/src/types/model/boolean.ts +1 -1
- package/src/types/model/color.ts +1 -1
- package/src/types/model/contentRelationship.ts +2 -3
- package/src/types/model/customType.ts +11 -11
- package/src/types/model/date.ts +1 -1
- package/src/types/model/embed.ts +1 -1
- package/src/types/model/geoPoint.ts +1 -1
- package/src/types/model/group.ts +1 -1
- package/src/types/model/image.ts +3 -3
- package/src/types/model/{integrationFields.ts → integration.ts} +3 -3
- package/src/types/model/keyText.ts +1 -1
- package/src/types/model/link.ts +4 -6
- package/src/types/model/linkToMedia.ts +2 -3
- package/src/types/model/number.ts +1 -1
- package/src/types/model/richText.ts +3 -3
- package/src/types/model/select.ts +1 -1
- package/src/types/model/sharedSlice.ts +2 -2
- package/src/types/model/sharedSliceVariation.ts +1 -1
- package/src/types/model/slice.ts +1 -1
- package/src/types/model/sliceZone.ts +2 -2
- package/src/types/model/timestamp.ts +1 -1
- package/src/types/model/title.ts +1 -1
- package/src/types/model/types.ts +10 -6
- package/src/types/model/uid.ts +1 -1
- package/src/types/value/boolean.ts +1 -1
- package/src/types/value/color.ts +2 -1
- package/src/types/value/contentRelationship.ts +1 -1
- package/src/types/value/date.ts +2 -1
- package/src/types/value/document.ts +4 -4
- package/src/types/value/embed.ts +2 -1
- package/src/types/value/geoPoint.ts +2 -1
- package/src/types/value/group.ts +1 -1
- package/src/types/value/image.ts +6 -4
- package/src/types/value/{integrationFields.ts → integration.ts} +3 -2
- package/src/types/value/keyText.ts +2 -1
- package/src/types/value/link.ts +2 -2
- package/src/types/value/linkToMedia.ts +2 -2
- package/src/types/value/number.ts +2 -1
- package/src/types/value/richText.ts +26 -26
- package/src/types/value/select.ts +2 -1
- package/src/types/value/sharedSlice.ts +1 -1
- package/src/types/value/sharedSliceVariation.ts +3 -0
- package/src/types/value/slice.ts +1 -1
- package/src/types/value/timestamp.ts +1 -1
- package/src/types/value/title.ts +1 -1
- package/src/types/value/types.ts +3 -2
- package/src/types/webhook/apiUpdate.ts +1 -1
package/src/filter.ts
CHANGED
|
@@ -30,10 +30,10 @@ const formatValue = (
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Creates a filter builder function for filters with a path and
|
|
34
|
-
* arguments.
|
|
33
|
+
* Creates a filter builder function for filters with a path and arguments.
|
|
35
34
|
*
|
|
36
35
|
* @typeParam Args - Arguments for the filter.
|
|
36
|
+
*
|
|
37
37
|
* @param name - Name of the filter used in the resulting string.
|
|
38
38
|
*
|
|
39
39
|
* @returns Filter builder function for the given name.
|
|
@@ -73,8 +73,8 @@ const pathFilter = (name: string) => {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* Creates a filter builder function for filters with only arguments and
|
|
77
|
-
*
|
|
76
|
+
* Creates a filter builder function for filters with only arguments and no
|
|
77
|
+
* path.
|
|
78
78
|
*
|
|
79
79
|
* @param name - Name of the filter used in the resulting string.
|
|
80
80
|
*
|
|
@@ -95,8 +95,8 @@ const argsFilter = <Args extends unknown[]>(name: string) => {
|
|
|
95
95
|
|
|
96
96
|
export const filter = {
|
|
97
97
|
/**
|
|
98
|
-
* The `at` filter checks that the path matches the described value
|
|
99
|
-
*
|
|
98
|
+
* The `at` filter checks that the path matches the described value exactly.
|
|
99
|
+
* It takes a single value for a field or an array (only for tags).
|
|
100
100
|
*
|
|
101
101
|
* {@link https://prismic.io/docs/rest-api-technical-reference#at}
|
|
102
102
|
*/
|
|
@@ -115,8 +115,8 @@ export const filter = {
|
|
|
115
115
|
),
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* The `any` filter takes an array of values. It works exactly the same way
|
|
119
|
-
*
|
|
118
|
+
* The `any` filter takes an array of values. It works exactly the same way as
|
|
119
|
+
* the `at` operator, but checks whether the fragment matches any of the
|
|
120
120
|
* values in the array.
|
|
121
121
|
*
|
|
122
122
|
* {@link https://prismic.io/docs/rest-api-technical-reference#any}
|
|
@@ -126,9 +126,9 @@ export const filter = {
|
|
|
126
126
|
),
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* The `in` filter is used specifically to retrieve an array of documents
|
|
130
|
-
*
|
|
131
|
-
*
|
|
129
|
+
* The `in` filter is used specifically to retrieve an array of documents by
|
|
130
|
+
* their IDs or UIDs. This filter is much more efficient at this than the any
|
|
131
|
+
* filter.
|
|
132
132
|
*
|
|
133
133
|
* {@link https://prismic.io/docs/rest-api-technical-reference#in}
|
|
134
134
|
*/
|
|
@@ -147,9 +147,9 @@ export const filter = {
|
|
|
147
147
|
fulltext: pathWithArgsFilter<[searchTerms: string]>("fulltext"),
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* The `has` filter checks whether a fragment has a value. It will return
|
|
151
|
-
*
|
|
152
|
-
*
|
|
150
|
+
* The `has` filter checks whether a fragment has a value. It will return all
|
|
151
|
+
* the documents of the specified type that contain a value for the specified
|
|
152
|
+
* field.
|
|
153
153
|
*
|
|
154
154
|
* {@link https://prismic.io/docs/rest-api-technical-reference#has}
|
|
155
155
|
*/
|
|
@@ -174,10 +174,10 @@ export const filter = {
|
|
|
174
174
|
similar: argsFilter<[id: string, value: number]>("similar"),
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
* The `geopoint.near` filter checks that the value in the path is within
|
|
178
|
-
*
|
|
177
|
+
* The `geopoint.near` filter checks that the value in the path is within the
|
|
178
|
+
* radius of the given coordinates.
|
|
179
179
|
*
|
|
180
|
-
* This filter will only work for a
|
|
180
|
+
* This filter will only work for a geopoint field.
|
|
181
181
|
*
|
|
182
182
|
* {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}
|
|
183
183
|
*/
|
|
@@ -195,16 +195,16 @@ export const filter = {
|
|
|
195
195
|
numberLessThan: pathWithArgsFilter<[value: number]>("number.lt"),
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* The `number.gt` filter checks that the value in the number field is
|
|
199
|
-
*
|
|
198
|
+
* The `number.gt` filter checks that the value in the number field is greater
|
|
199
|
+
* than the value passed into the filter.
|
|
200
200
|
*
|
|
201
201
|
* {@link https://prismic.io/docs/rest-api-technical-reference#numbergreaterthan}
|
|
202
202
|
*/
|
|
203
203
|
numberGreaterThan: pathWithArgsFilter<[value: number]>("number.gt"),
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
|
-
* The `number.inRange` filter checks that the value in the path is within
|
|
207
|
-
*
|
|
206
|
+
* The `number.inRange` filter checks that the value in the path is within the
|
|
207
|
+
* two values passed into the filter.
|
|
208
208
|
*
|
|
209
209
|
* {@link https://prismic.io/docs/rest-api-technical-reference#numberinrange}
|
|
210
210
|
*/
|
|
@@ -214,8 +214,8 @@ export const filter = {
|
|
|
214
214
|
),
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* The `date.after` filter checks that the value in the path is after the
|
|
218
|
-
*
|
|
217
|
+
* The `date.after` filter checks that the value in the path is after the date
|
|
218
|
+
* value passed into the filter.
|
|
219
219
|
*
|
|
220
220
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
221
221
|
*/
|
|
@@ -230,8 +230,8 @@ export const filter = {
|
|
|
230
230
|
dateBefore: pathWithArgsFilter<[date: string | number | Date]>("date.before"),
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* The `date.between` filter checks that the value in the path is within
|
|
234
|
-
*
|
|
233
|
+
* The `date.between` filter checks that the value in the path is within the
|
|
234
|
+
* date values passed into the filter.
|
|
235
235
|
*
|
|
236
236
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
237
237
|
*/
|
|
@@ -241,16 +241,16 @@ export const filter = {
|
|
|
241
241
|
>("date.between"),
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
|
-
* The `date.day-of-month` filter checks that the value in the path is
|
|
245
|
-
*
|
|
244
|
+
* The `date.day-of-month` filter checks that the value in the path is equal
|
|
245
|
+
* to the day of the month passed into the filter.
|
|
246
246
|
*
|
|
247
247
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
248
248
|
*/
|
|
249
249
|
dateDayOfMonth: pathWithArgsFilter<[day: number]>("date.day-of-month"),
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
|
-
* The `date.day-of-month-after` filter checks that the value in the path
|
|
253
|
-
*
|
|
252
|
+
* The `date.day-of-month-after` filter checks that the value in the path is
|
|
253
|
+
* after the day of the month passed into the filter.
|
|
254
254
|
*
|
|
255
255
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
256
256
|
*/
|
|
@@ -259,8 +259,8 @@ export const filter = {
|
|
|
259
259
|
),
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
* The `date.day-of-month-before` filter checks that the value in the path
|
|
263
|
-
*
|
|
262
|
+
* The `date.day-of-month-before` filter checks that the value in the path is
|
|
263
|
+
* before the day of the month passed into the filter.
|
|
264
264
|
*
|
|
265
265
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
266
266
|
*/
|
|
@@ -269,8 +269,8 @@ export const filter = {
|
|
|
269
269
|
),
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* The `date.day-of-week` filter checks that the value in the path is equal
|
|
273
|
-
*
|
|
272
|
+
* The `date.day-of-week` filter checks that the value in the path is equal to
|
|
273
|
+
* the day of the week passed into the filter.
|
|
274
274
|
*
|
|
275
275
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
276
276
|
*/
|
|
@@ -305,8 +305,8 @@ export const filter = {
|
|
|
305
305
|
dateMonth: pathWithArgsFilter<[month: string | number]>("date.month"),
|
|
306
306
|
|
|
307
307
|
/**
|
|
308
|
-
* The `date.month-after` filter checks that the value in the path occurs
|
|
309
|
-
*
|
|
308
|
+
* The `date.month-after` filter checks that the value in the path occurs in
|
|
309
|
+
* any month after the value passed into the filter.
|
|
310
310
|
*
|
|
311
311
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
312
312
|
*/
|
|
@@ -314,8 +314,8 @@ export const filter = {
|
|
|
314
314
|
pathWithArgsFilter<[month: string | number]>("date.month-after"),
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
|
-
* The `date.month-before` filter checks that the value in the path occurs
|
|
318
|
-
*
|
|
317
|
+
* The `date.month-before` filter checks that the value in the path occurs in
|
|
318
|
+
* any month before the value passed into the filter.
|
|
319
319
|
*
|
|
320
320
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
321
321
|
*/
|
|
@@ -323,24 +323,24 @@ export const filter = {
|
|
|
323
323
|
pathWithArgsFilter<[month: string | number]>("date.month-before"),
|
|
324
324
|
|
|
325
325
|
/**
|
|
326
|
-
* The `date.year` filter checks that the value in the path occurs in the
|
|
327
|
-
*
|
|
326
|
+
* The `date.year` filter checks that the value in the path occurs in the year
|
|
327
|
+
* value passed into the filter.
|
|
328
328
|
*
|
|
329
329
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
330
330
|
*/
|
|
331
331
|
dateYear: pathWithArgsFilter<[year: number]>("date.year"),
|
|
332
332
|
|
|
333
333
|
/**
|
|
334
|
-
* The `date.hour` filter checks that the value in the path occurs within
|
|
335
|
-
*
|
|
334
|
+
* The `date.hour` filter checks that the value in the path occurs within the
|
|
335
|
+
* hour value passed into the filter.
|
|
336
336
|
*
|
|
337
337
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
338
338
|
*/
|
|
339
339
|
dateHour: pathWithArgsFilter<[hour: number]>("date.hour"),
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
|
-
* The `date.hour-after` filter checks that the value in the path occurs
|
|
343
|
-
*
|
|
342
|
+
* The `date.hour-after` filter checks that the value in the path occurs after
|
|
343
|
+
* the hour value passed into the filter.
|
|
344
344
|
*
|
|
345
345
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
346
346
|
*/
|
|
@@ -6,6 +6,7 @@ import { isRepositoryName } from "./isRepositoryName";
|
|
|
6
6
|
* Get a repository's Prismic GraphQL endpoint.
|
|
7
7
|
*
|
|
8
8
|
* @typeParam RepositoryName - Name of the Prismic repository.
|
|
9
|
+
*
|
|
9
10
|
* @param repositoryName - Name of the repository.
|
|
10
11
|
*
|
|
11
12
|
* @returns The repository's Prismic REST API V2 endpoint
|
|
@@ -6,9 +6,11 @@ import { isRepositoryName } from "./isRepositoryName";
|
|
|
6
6
|
* Get a repository's Prismic Rest API V2 endpoint.
|
|
7
7
|
*
|
|
8
8
|
* @typeParam RepositoryName - Name of the Prismic repository.
|
|
9
|
+
*
|
|
9
10
|
* @param repositoryName - Name of the repository.
|
|
10
11
|
*
|
|
11
12
|
* @returns The repository's Prismic Rest API V2 endpoint
|
|
13
|
+
*
|
|
12
14
|
* @throws {@link Error} Thrown if an invalid repository name is provided.
|
|
13
15
|
*/
|
|
14
16
|
export const getRepositoryEndpoint = <RepositoryName extends string>(
|
package/src/getRepositoryName.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { PrismicError } from "./errors/PrismicError";
|
|
|
9
9
|
* @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.
|
|
10
10
|
*
|
|
11
11
|
* @returns The Prismic repository's name.
|
|
12
|
+
*
|
|
12
13
|
* @throws {@link Error} Thrown if an invalid Prismic Rest API V2 endpoint is
|
|
13
14
|
* provided.
|
|
14
15
|
*/
|
package/src/getToolbarSrc.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { isRepositoryName } from "./isRepositoryName";
|
|
|
12
12
|
* // In Next.js apps, use `next/script` in your `app/layout.tsx` file.
|
|
13
13
|
*
|
|
14
14
|
* import Script from "next/script";
|
|
15
|
-
* import * as prismic from
|
|
15
|
+
* import * as prismic from "@prismicio/client";
|
|
16
16
|
*
|
|
17
17
|
* export default function RootLayout({
|
|
18
18
|
* children,
|
package/src/helpers/asDate.ts
CHANGED
|
@@ -9,11 +9,12 @@ type AsDateReturnType<
|
|
|
9
9
|
> = Field extends DateField<"filled"> | TimestampField<"filled"> ? Date : null;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Transforms a
|
|
12
|
+
* Transforms a date or timestamp field into a JavaScript Date object
|
|
13
13
|
*
|
|
14
|
-
* @param dateOrTimestampField - A
|
|
14
|
+
* @param dateOrTimestampField - A date or timestamp field from Prismic
|
|
15
15
|
*
|
|
16
16
|
* @returns A Date object, null if provided date is falsy
|
|
17
|
+
*
|
|
17
18
|
* @see Templating date field from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#date-and-timestamp}
|
|
18
19
|
*/
|
|
19
20
|
export const asDate = <
|
package/src/helpers/asHTML.ts
CHANGED
|
@@ -22,13 +22,13 @@ import type { RichTextField } from "../types/value/richText";
|
|
|
22
22
|
import { LinkResolverFunction } from "./asLink";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Serializes a node from a
|
|
25
|
+
* Serializes a node from a rich text or title field with a function to HTML.
|
|
26
26
|
*
|
|
27
27
|
* Unlike a typical `@prismicio/richtext` function serializer, this serializer
|
|
28
28
|
* converts the `children` argument to a single string rather than an array of
|
|
29
29
|
* strings.
|
|
30
30
|
*
|
|
31
|
-
* @see Templating
|
|
31
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
32
32
|
*/
|
|
33
33
|
export type HTMLRichTextFunctionSerializer = (
|
|
34
34
|
type: Parameters<RichTextFunctionSerializer<string>>[0],
|
|
@@ -39,13 +39,13 @@ export type HTMLRichTextFunctionSerializer = (
|
|
|
39
39
|
) => string | null | undefined;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Serializes a node from a
|
|
42
|
+
* Serializes a node from a rich text or title field with a map to HTML
|
|
43
43
|
*
|
|
44
44
|
* Unlike a typical `@prismicio/richtext` map serializer, this serializer
|
|
45
45
|
* converts the `children` property to a single string rather than an array of
|
|
46
46
|
* strings.
|
|
47
47
|
*
|
|
48
|
-
* @see Templating
|
|
48
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
49
49
|
*/
|
|
50
50
|
export type HTMLRichTextMapSerializer = {
|
|
51
51
|
[P in keyof RichTextMapSerializer<string>]: (payload: {
|
|
@@ -63,7 +63,7 @@ export type HTMLRichTextMapSerializer = {
|
|
|
63
63
|
* A {@link RichTextMapSerializerFunction} type specifically for
|
|
64
64
|
* {@link HTMLRichTextMapSerializer}.
|
|
65
65
|
*
|
|
66
|
-
* @typeParam BlockName - The serializer's
|
|
66
|
+
* @typeParam BlockName - The serializer's rich text block type.
|
|
67
67
|
*/
|
|
68
68
|
type HTMLRichTextMapSerializerFunction<
|
|
69
69
|
BlockType extends keyof RichTextMapSerializer<string>,
|
|
@@ -106,18 +106,19 @@ type ExtractTextTypeGeneric<T> = T extends RichTextMapSerializerFunction<
|
|
|
106
106
|
: never;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* Serializes a node from a
|
|
109
|
+
* Serializes a node from a rich text or title field with a map or a function to
|
|
110
|
+
* HTML
|
|
110
111
|
*
|
|
111
112
|
* @see {@link HTMLRichTextMapSerializer} and {@link HTMLRichTextFunctionSerializer}
|
|
112
|
-
* @see Templating
|
|
113
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
113
114
|
*/
|
|
114
115
|
export type HTMLRichTextSerializer =
|
|
115
116
|
| HTMLRichTextMapSerializer
|
|
116
117
|
| HTMLRichTextFunctionSerializer;
|
|
117
118
|
|
|
118
119
|
/**
|
|
119
|
-
* Creates a default HTML
|
|
120
|
-
* sensible and safe defaults for every node type
|
|
120
|
+
* Creates a default HTML rich text serializer with a given link resolver
|
|
121
|
+
* providing sensible and safe defaults for every node type
|
|
121
122
|
*
|
|
122
123
|
* @internal
|
|
123
124
|
*/
|
|
@@ -205,13 +206,14 @@ const wrapMapSerializerWithStringChildren = (
|
|
|
205
206
|
*/
|
|
206
207
|
type AsHTMLConfig = {
|
|
207
208
|
/**
|
|
208
|
-
* An optional link resolver function to resolve links.
|
|
209
|
-
*
|
|
209
|
+
* An optional link resolver function to resolve links. Without it you're
|
|
210
|
+
* expected to use the `routes` options from the API.
|
|
210
211
|
*/
|
|
211
212
|
linkResolver?: LinkResolverFunction | null;
|
|
212
213
|
|
|
213
214
|
/**
|
|
214
|
-
* An optional
|
|
215
|
+
* An optional rich text serializer, unhandled cases will fallback to the
|
|
216
|
+
* default serializer
|
|
215
217
|
*/
|
|
216
218
|
serializer?: HTMLRichTextSerializer | null;
|
|
217
219
|
};
|
|
@@ -234,13 +236,23 @@ type AsHTMLReturnType<Field extends RichTextField | null | undefined> =
|
|
|
234
236
|
// TODO: Remove overload when we remove support for deprecated tuple-style configuration.
|
|
235
237
|
export const asHTML: {
|
|
236
238
|
/**
|
|
237
|
-
* Serializes a
|
|
239
|
+
* Serializes a rich text or title field to an HTML string.
|
|
238
240
|
*
|
|
239
|
-
* @
|
|
241
|
+
* @example
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* asHTML(field);
|
|
245
|
+
* asHTML(field, { linkResolver });
|
|
246
|
+
* asHTML(field, { serializer });
|
|
247
|
+
* asHTML(field, { linkResolver, serializer });
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @param richTextField - A rich text or title field from Prismic
|
|
240
251
|
* @param config - Configuration that determines the output of `asHTML()`
|
|
241
252
|
*
|
|
242
|
-
* @returns HTML equivalent of the provided
|
|
243
|
-
*
|
|
253
|
+
* @returns HTML equivalent of the provided rich text or title field
|
|
254
|
+
*
|
|
255
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
244
256
|
*/
|
|
245
257
|
<Field extends RichTextField | null | undefined>(
|
|
246
258
|
richTextField: Field,
|
|
@@ -248,25 +260,19 @@ export const asHTML: {
|
|
|
248
260
|
): AsHTMLReturnType<Field>;
|
|
249
261
|
|
|
250
262
|
/**
|
|
251
|
-
* Serializes a
|
|
263
|
+
* Serializes a rich text or title field to an HTML string.
|
|
252
264
|
*
|
|
253
|
-
* @
|
|
265
|
+
* @deprecated Use object-style configuration instead.
|
|
266
|
+
*
|
|
267
|
+
* @param richTextField - A rich text or title field from Prismic
|
|
254
268
|
* @param linkResolver - An optional link resolver function to resolve links,
|
|
255
269
|
* without it you're expected to use the `routes` options from the API
|
|
256
|
-
* @param serializer - An optional
|
|
257
|
-
* to the default serializer
|
|
258
|
-
*
|
|
259
|
-
* @returns HTML equivalent of the provided Rich Text or Title field
|
|
260
|
-
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
270
|
+
* @param serializer - An optional rich text serializer, unhandled cases will
|
|
271
|
+
* fallback to the default serializer
|
|
261
272
|
*
|
|
262
|
-
* @
|
|
273
|
+
* @returns HTML equivalent of the provided rich text or title field
|
|
263
274
|
*
|
|
264
|
-
*
|
|
265
|
-
* asHTML(field);
|
|
266
|
-
* asHTML(field, { linkResolver });
|
|
267
|
-
* asHTML(field, { serializer });
|
|
268
|
-
* asHTML(field, { linkResolver, serializer });
|
|
269
|
-
* ```
|
|
275
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
270
276
|
*/
|
|
271
277
|
<Field extends RichTextField | null | undefined>(
|
|
272
278
|
richTextField: Field,
|
|
@@ -30,12 +30,12 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
30
30
|
> = Field extends ImageFieldImage<"filled">
|
|
31
31
|
? {
|
|
32
32
|
/**
|
|
33
|
-
* The
|
|
33
|
+
* The image field's image URL with Imgix URL parameters (if given).
|
|
34
34
|
*/
|
|
35
35
|
src: string;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* A pixel-densitye-based `srcset` attribute value for the
|
|
38
|
+
* A pixel-densitye-based `srcset` attribute value for the image field's
|
|
39
39
|
* image with Imgix URL parameters (if given).
|
|
40
40
|
*/
|
|
41
41
|
srcset: string;
|
|
@@ -43,7 +43,7 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
43
43
|
: null;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Creates a pixel-density-based `srcset` from an
|
|
46
|
+
* Creates a pixel-density-based `srcset` from an image field with optional
|
|
47
47
|
* image transformations (via Imgix URL parameters).
|
|
48
48
|
*
|
|
49
49
|
* If a `pixelDensities` parameter is not given, the following pixel densities
|
|
@@ -68,8 +68,8 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
68
68
|
* @param config - An object of Imgix URL API parameters. The `pixelDensities`
|
|
69
69
|
* parameter defines the resulting `srcset` widths.
|
|
70
70
|
*
|
|
71
|
-
* @returns A `srcset` attribute value for the
|
|
72
|
-
* parameters (if given). If the
|
|
71
|
+
* @returns A `srcset` attribute value for the image field with Imgix URL
|
|
72
|
+
* parameters (if given). If the image field is empty, `null` is returned.
|
|
73
73
|
* @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
|
|
74
74
|
*/
|
|
75
75
|
export const asImagePixelDensitySrcSet = <
|
|
@@ -11,7 +11,7 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
|
|
|
11
11
|
Field extends ImageFieldImage<"filled"> ? string : null;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Returns the URL of an
|
|
14
|
+
* Returns the URL of an image field with optional image transformations (via
|
|
15
15
|
* Imgix URL parameters).
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
@@ -25,8 +25,8 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
|
|
|
25
25
|
* an image URL.
|
|
26
26
|
* @param config - An object of Imgix URL API parameters to transform the image.
|
|
27
27
|
*
|
|
28
|
-
* @returns The
|
|
29
|
-
* If the
|
|
28
|
+
* @returns The image field's image URL with transformations applied (if given).
|
|
29
|
+
* If the image field is empty, `null` is returned.
|
|
30
30
|
* @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
|
|
31
31
|
*/
|
|
32
32
|
export const asImageSrc = <Field extends ImageFieldImage | null | undefined>(
|
|
@@ -21,12 +21,12 @@ type AsImageWidthSrcSetReturnType<
|
|
|
21
21
|
> = Field extends ImageFieldImage<"filled">
|
|
22
22
|
? {
|
|
23
23
|
/**
|
|
24
|
-
* The
|
|
24
|
+
* The image field's image URL with Imgix URL parameters (if given).
|
|
25
25
|
*/
|
|
26
26
|
src: string;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* A width-based `srcset` attribute value for the
|
|
29
|
+
* A width-based `srcset` attribute value for the image field's image with
|
|
30
30
|
* Imgix URL parameters (if given).
|
|
31
31
|
*/
|
|
32
32
|
srcset: string;
|
|
@@ -41,13 +41,13 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Creates a width-based `srcset` from an
|
|
44
|
+
* Creates a width-based `srcset` from an image field with optional image
|
|
45
45
|
* transformations (via Imgix URL parameters).
|
|
46
46
|
*
|
|
47
47
|
* If a `widths` parameter is not given, the following widths will be used by
|
|
48
48
|
* default: 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
|
|
49
49
|
*
|
|
50
|
-
* If the
|
|
50
|
+
* If the image field contains responsive views, each responsive view can be
|
|
51
51
|
* used as a width in the resulting `srcset` by passing `"thumbnails"` as the
|
|
52
52
|
* `widths` parameter.
|
|
53
53
|
*
|
|
@@ -72,8 +72,8 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
72
72
|
* defines the resulting `srcset` widths. Pass `"thumbnails"` to automatically
|
|
73
73
|
* use the field's responsive views.
|
|
74
74
|
*
|
|
75
|
-
* @returns A `srcset` attribute value for the
|
|
76
|
-
* parameters (if given). If the
|
|
75
|
+
* @returns A `srcset` attribute value for the image field with Imgix URL
|
|
76
|
+
* parameters (if given). If the image field is empty, `null` is returned.
|
|
77
77
|
* @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
|
|
78
78
|
*/
|
|
79
79
|
export const asImageWidthSrcSet = <
|
package/src/helpers/asLink.ts
CHANGED
|
@@ -6,13 +6,14 @@ import type { FilledLinkToMediaField } from "../types/value/linkToMedia";
|
|
|
6
6
|
import { documentToLinkField } from "./documentToLinkField";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Resolves a
|
|
9
|
+
* Resolves a link to a Prismic document to a URL
|
|
10
10
|
*
|
|
11
11
|
* @typeParam ReturnType - Return type of your link resolver function, useful if
|
|
12
12
|
* you prefer to return a complex object
|
|
13
|
-
* @param linkToDocumentField - A document
|
|
13
|
+
* @param linkToDocumentField - A document link field to resolve
|
|
14
14
|
*
|
|
15
15
|
* @returns Resolved URL
|
|
16
|
+
*
|
|
16
17
|
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
17
18
|
*/
|
|
18
19
|
export type LinkResolverFunction<ReturnType = string | null | undefined> = (
|
|
@@ -25,8 +26,8 @@ export type LinkResolverFunction<ReturnType = string | null | undefined> = (
|
|
|
25
26
|
type AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> =
|
|
26
27
|
{
|
|
27
28
|
/**
|
|
28
|
-
* An optional
|
|
29
|
-
*
|
|
29
|
+
* An optional link resolver function. Without it, you are expected to use
|
|
30
|
+
* the `routes` options from the API.
|
|
30
31
|
*/
|
|
31
32
|
linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;
|
|
32
33
|
};
|
|
@@ -62,16 +63,26 @@ export type AsLinkReturnType<
|
|
|
62
63
|
// TODO: Remove overload when we remove support for deprecated tuple-style configuration.
|
|
63
64
|
export const asLink: {
|
|
64
65
|
/**
|
|
65
|
-
* Resolves any type of
|
|
66
|
+
* Resolves any type of link field or Prismic document to a URL.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
66
69
|
*
|
|
67
|
-
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* asLink(field);
|
|
72
|
+
* asLink(field, { linkResolver });
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
68
76
|
* type
|
|
69
77
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
|
70
|
-
*
|
|
78
|
+
*
|
|
79
|
+
* @param linkFieldOrDocument - Any kind of link field or a document to
|
|
80
|
+
* resolve
|
|
71
81
|
* @param config - Configuration that determines the output of `asLink()`
|
|
72
82
|
*
|
|
73
|
-
* @returns Resolved URL or, if the provided
|
|
74
|
-
*
|
|
83
|
+
* @returns Resolved URL or, if the provided link field or document is empty,
|
|
84
|
+
* `null`
|
|
85
|
+
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
75
86
|
* @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
|
|
76
87
|
*/
|
|
77
88
|
<
|
|
@@ -87,25 +98,23 @@ export const asLink: {
|
|
|
87
98
|
): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
88
99
|
|
|
89
100
|
/**
|
|
90
|
-
* Resolves any type of
|
|
101
|
+
* Resolves any type of link field or Prismic document to a URL.
|
|
102
|
+
*
|
|
103
|
+
* @deprecated Use object-style configuration instead.
|
|
91
104
|
*
|
|
92
|
-
* @typeParam LinkResolverFunctionReturnType -
|
|
105
|
+
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
93
106
|
* type
|
|
94
107
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
|
95
|
-
* @param linkFieldOrDocument - Any kind of Link field or a document to resolve
|
|
96
|
-
* @param linkResolver - An optional Link Resolver function. Without it, you are
|
|
97
|
-
* expected to use the `routes` options from the API
|
|
98
108
|
*
|
|
99
|
-
* @
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
109
|
+
* @param linkFieldOrDocument - Any kind of link field or a document to
|
|
110
|
+
* resolve
|
|
111
|
+
* @param linkResolver - An optional link resolver function. Without it, you
|
|
112
|
+
* are expected to use the `routes` options from the API
|
|
102
113
|
*
|
|
103
|
-
* @
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* asLink(field, { linkResolver });
|
|
108
|
-
* ```
|
|
114
|
+
* @returns Resolved URL or, if the provided link field or document is empty,
|
|
115
|
+
* `null`
|
|
116
|
+
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
117
|
+
* @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
|
|
109
118
|
*/
|
|
110
119
|
<
|
|
111
120
|
LinkResolverFunctionReturnType = string | null | undefined,
|
|
@@ -136,7 +145,7 @@ export const asLink: {
|
|
|
136
145
|
return null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
137
146
|
}
|
|
138
147
|
|
|
139
|
-
// Converts document to
|
|
148
|
+
// Converts document to link field if needed
|
|
140
149
|
const linkField =
|
|
141
150
|
// prettier-ignore
|
|
142
151
|
(
|
|
@@ -172,7 +181,7 @@ export const asLink: {
|
|
|
172
181
|
|
|
173
182
|
case LinkType.Document: {
|
|
174
183
|
if ("id" in linkField && config.linkResolver) {
|
|
175
|
-
// When using
|
|
184
|
+
// When using link resolver...
|
|
176
185
|
const resolvedURL = config.linkResolver(linkField);
|
|
177
186
|
|
|
178
187
|
if (resolvedURL != null) {
|
|
@@ -184,14 +193,14 @@ export const asLink: {
|
|
|
184
193
|
}
|
|
185
194
|
|
|
186
195
|
if ("url" in linkField && linkField.url) {
|
|
187
|
-
// When using
|
|
196
|
+
// When using route resolver...
|
|
188
197
|
return linkField.url as AsLinkReturnType<
|
|
189
198
|
LinkResolverFunctionReturnType,
|
|
190
199
|
Field
|
|
191
200
|
>;
|
|
192
201
|
}
|
|
193
202
|
|
|
194
|
-
// When empty or
|
|
203
|
+
// When empty or link resolver and route resolver are not used...
|
|
195
204
|
return null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
196
205
|
}
|
|
197
206
|
|