@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/dist/createClient.d.ts
CHANGED
|
@@ -56,7 +56,8 @@ export interface RequestInitLike extends Pick<RequestInit, "cache"> {
|
|
|
56
56
|
/**
|
|
57
57
|
* An AbortSignal to set the `fetch()` request's signal.
|
|
58
58
|
*
|
|
59
|
-
* See:
|
|
59
|
+
* See:
|
|
60
|
+
* [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
60
61
|
*/
|
|
61
62
|
signal?: AbortSignalLike;
|
|
62
63
|
}
|
|
@@ -96,6 +97,16 @@ export type HttpRequestLike = /**
|
|
|
96
97
|
* function can optionally be asynchronous.
|
|
97
98
|
*/
|
|
98
99
|
type RefStringOrThunk = string | (() => string | undefined | Promise<string | undefined>);
|
|
100
|
+
/**
|
|
101
|
+
* Options or a function that returns options provided to the client's `fetch()`
|
|
102
|
+
* on all network requests. These options will be merged with internally
|
|
103
|
+
* required options. They can also be overriden on a per-query basis using the
|
|
104
|
+
* query's `fetchOptions` parameter.
|
|
105
|
+
*
|
|
106
|
+
* If the options must be determined on-demand, a function can be provided. This
|
|
107
|
+
* function can be asynchronous.
|
|
108
|
+
*/
|
|
109
|
+
export type RequestInitLikeOrThunk = RequestInitLike | ((url: string, init?: RequestInitLike) => RequestInitLike | undefined | Promise<RequestInitLike | undefined>);
|
|
99
110
|
/**
|
|
100
111
|
* Configuration for clients that determine how content is queried.
|
|
101
112
|
*/
|
|
@@ -112,16 +123,16 @@ export type ClientConfig = {
|
|
|
112
123
|
*/
|
|
113
124
|
ref?: RefStringOrThunk;
|
|
114
125
|
/**
|
|
115
|
-
* A list of
|
|
116
|
-
* is resolved.
|
|
126
|
+
* A list of route resolver objects that define how a document's `url`
|
|
127
|
+
* property is resolved.
|
|
117
128
|
*
|
|
118
129
|
* {@link https://prismic.io/docs/route-resolver}
|
|
119
130
|
*/
|
|
120
131
|
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
121
132
|
/**
|
|
122
133
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
123
|
-
* `url` property for broken
|
|
124
|
-
* link is a
|
|
134
|
+
* `url` property for broken link or content relationship fields. A broken
|
|
135
|
+
* link is a link or content relationship field whose linked document has been
|
|
125
136
|
* unpublished or deleted.
|
|
126
137
|
*
|
|
127
138
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -139,37 +150,41 @@ export type ClientConfig = {
|
|
|
139
150
|
*/
|
|
140
151
|
fetch?: FetchLike;
|
|
141
152
|
/**
|
|
142
|
-
* Options provided to the client's
|
|
143
|
-
* These options will be merged with
|
|
144
|
-
* can also be overriden on a per-query
|
|
145
|
-
* `fetchOptions` parameter.
|
|
153
|
+
* Options or a function that returns options provided to the client's
|
|
154
|
+
* `fetch()` on all network requests. These options will be merged with
|
|
155
|
+
* internally required options. They can also be overriden on a per-query
|
|
156
|
+
* basis using the query's `fetchOptions` parameter.
|
|
157
|
+
*
|
|
158
|
+
* If the options must be determined on-demand, a function can be provided.
|
|
159
|
+
* This function can be asynchronous.
|
|
160
|
+
*
|
|
161
|
+
* @experimental
|
|
146
162
|
*/
|
|
147
|
-
fetchOptions?:
|
|
163
|
+
fetchOptions?: RequestInitLikeOrThunk;
|
|
148
164
|
};
|
|
149
165
|
/**
|
|
150
166
|
* Parameters for any client method that use `fetch()`.
|
|
151
167
|
*/
|
|
152
168
|
type FetchParams = {
|
|
153
169
|
/**
|
|
154
|
-
* Options provided to the client's
|
|
155
|
-
* These options will be merged with
|
|
156
|
-
* can also be overriden on a per-query
|
|
157
|
-
* `fetchOptions` parameter.
|
|
170
|
+
* Options or a function that returns options provided to the client's
|
|
171
|
+
* `fetch()` on all network requests. These options will be merged with
|
|
172
|
+
* internally required options. They can also be overriden on a per-query
|
|
173
|
+
* basis using the query's `fetchOptions` parameter.
|
|
174
|
+
*
|
|
175
|
+
* If the options must be determined on-demand, a function can be provided.
|
|
176
|
+
* This function can be asynchronous.
|
|
177
|
+
*
|
|
178
|
+
* @experimental
|
|
158
179
|
*/
|
|
159
|
-
fetchOptions?:
|
|
180
|
+
fetchOptions?: RequestInitLikeOrThunk;
|
|
160
181
|
/**
|
|
161
182
|
* An `AbortSignal` provided by an `AbortController`. This allows the network
|
|
162
183
|
* request to be cancelled if necessary.
|
|
163
184
|
*
|
|
164
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}
|
|
165
|
-
*
|
|
166
185
|
* @deprecated Move the `signal` parameter into `fetchOptions.signal`:
|
|
167
186
|
*
|
|
168
|
-
*
|
|
169
|
-
* client.getByUID("page", "home",{
|
|
170
|
-
* fetchOptions: { signal }
|
|
171
|
-
* });
|
|
172
|
-
* ```
|
|
187
|
+
* @see \<https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\>
|
|
173
188
|
*/
|
|
174
189
|
signal?: AbortSignalLike;
|
|
175
190
|
};
|
|
@@ -193,7 +208,7 @@ type ResolvePreviewArgs<LinkResolverReturnType> = {
|
|
|
193
208
|
*/
|
|
194
209
|
linkResolver?: LinkResolverFunction<LinkResolverReturnType>;
|
|
195
210
|
/**
|
|
196
|
-
* A fallback URL if the
|
|
211
|
+
* A fallback URL if the link resolver does not return a value.
|
|
197
212
|
*/
|
|
198
213
|
defaultURL: string;
|
|
199
214
|
/**
|
|
@@ -260,7 +275,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
260
275
|
*/
|
|
261
276
|
accessToken?: string;
|
|
262
277
|
/**
|
|
263
|
-
* A list of
|
|
278
|
+
* A list of route resolver objects that define how a document's `url` field
|
|
264
279
|
* is resolved.
|
|
265
280
|
*
|
|
266
281
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -268,8 +283,8 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
268
283
|
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
269
284
|
/**
|
|
270
285
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
271
|
-
* `url` property for broken
|
|
272
|
-
* link is a
|
|
286
|
+
* `url` property for broken link or content relationship fields. A broken
|
|
287
|
+
* link is a link or content relationship field whose linked document has been
|
|
273
288
|
* unpublished or deleted.
|
|
274
289
|
*
|
|
275
290
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -281,7 +296,18 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
281
296
|
* Node.js, this function must be provided.
|
|
282
297
|
*/
|
|
283
298
|
fetchFn: FetchLike;
|
|
284
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Options or a function that returns options provided to the client's
|
|
301
|
+
* `fetch()` on all network requests. These options will be merged with
|
|
302
|
+
* internally required options. They can also be overriden on a per-query
|
|
303
|
+
* basis using the query's `fetchOptions` parameter.
|
|
304
|
+
*
|
|
305
|
+
* If the options must be determined on-demand, a function can be provided.
|
|
306
|
+
* This function can be asynchronous.
|
|
307
|
+
*
|
|
308
|
+
* @experimental
|
|
309
|
+
*/
|
|
310
|
+
fetchOptions?: RequestInitLikeOrThunk;
|
|
285
311
|
/**
|
|
286
312
|
* Default parameters that will be sent with each query. These parameters can
|
|
287
313
|
* be overridden on each query if needed.
|
|
@@ -379,6 +405,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
379
405
|
* ```
|
|
380
406
|
*
|
|
381
407
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
408
|
+
*
|
|
382
409
|
* @param params - Parameters to filter, sort, and paginate results.
|
|
383
410
|
*
|
|
384
411
|
* @returns A paginated response containing the result of the query.
|
|
@@ -395,6 +422,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
395
422
|
* ```
|
|
396
423
|
*
|
|
397
424
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
425
|
+
*
|
|
398
426
|
* @param params - Parameters to filter, sort, and paginate results. @returns
|
|
399
427
|
* The first result of the query, if any.
|
|
400
428
|
*/
|
|
@@ -417,6 +445,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
417
445
|
* ```
|
|
418
446
|
*
|
|
419
447
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
448
|
+
*
|
|
420
449
|
* @param params - Parameters to filter, sort, and paginate results.
|
|
421
450
|
*
|
|
422
451
|
* @returns A list of documents matching the query.
|
|
@@ -429,7 +458,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
429
458
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
430
459
|
* for all documents and is made available on its `id` property. A UID is
|
|
431
460
|
* provided in the Prismic editor and is unique among all documents of its
|
|
432
|
-
*
|
|
461
|
+
* custom type.
|
|
433
462
|
* @example
|
|
434
463
|
*
|
|
435
464
|
* ```ts
|
|
@@ -437,6 +466,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
437
466
|
* ```
|
|
438
467
|
*
|
|
439
468
|
* @typeParam TDocument- Type of the Prismic document returned.
|
|
469
|
+
*
|
|
440
470
|
* @param id - ID of the document.
|
|
441
471
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
442
472
|
*
|
|
@@ -451,7 +481,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
451
481
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
452
482
|
* for all documents and is made available on its `id` property. A UID is
|
|
453
483
|
* provided in the Prismic editor and is unique among all documents of its
|
|
454
|
-
*
|
|
484
|
+
* custom type.
|
|
455
485
|
* @example
|
|
456
486
|
*
|
|
457
487
|
* ```ts
|
|
@@ -462,6 +492,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
462
492
|
* ```
|
|
463
493
|
*
|
|
464
494
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
495
|
+
*
|
|
465
496
|
* @param ids - A list of document IDs.
|
|
466
497
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
467
498
|
*
|
|
@@ -479,7 +510,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
479
510
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
480
511
|
* for all documents and is made available on its `id` property. A UID is
|
|
481
512
|
* provided in the Prismic editor and is unique among all documents of its
|
|
482
|
-
*
|
|
513
|
+
* custom type.
|
|
483
514
|
* @example
|
|
484
515
|
*
|
|
485
516
|
* ```ts
|
|
@@ -490,6 +521,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
490
521
|
* ```
|
|
491
522
|
*
|
|
492
523
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
524
|
+
*
|
|
493
525
|
* @param ids - A list of document IDs.
|
|
494
526
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
495
527
|
*
|
|
@@ -498,13 +530,13 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
498
530
|
getAllByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
499
531
|
/**
|
|
500
532
|
* Queries a document from the Prismic repository with a specific UID and
|
|
501
|
-
*
|
|
533
|
+
* custom type.
|
|
502
534
|
*
|
|
503
535
|
* @remarks
|
|
504
536
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
505
537
|
* for all documents and is made available on its `id` property. A UID is
|
|
506
538
|
* provided in the Prismic editor and is unique among all documents of its
|
|
507
|
-
*
|
|
539
|
+
* custom type.
|
|
508
540
|
* @example
|
|
509
541
|
*
|
|
510
542
|
* ```ts
|
|
@@ -512,7 +544,8 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
512
544
|
* ```
|
|
513
545
|
*
|
|
514
546
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
515
|
-
*
|
|
547
|
+
*
|
|
548
|
+
* @param documentType - The API ID of the document's custom type.
|
|
516
549
|
* @param uid - UID of the document.
|
|
517
550
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
518
551
|
*
|
|
@@ -528,7 +561,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
528
561
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
529
562
|
* for all documents and is made available on its `id` property. A UID is
|
|
530
563
|
* provided in the Prismic editor and is unique among all documents of its
|
|
531
|
-
*
|
|
564
|
+
* custom type.
|
|
532
565
|
* @example
|
|
533
566
|
*
|
|
534
567
|
* ```ts
|
|
@@ -539,7 +572,8 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
539
572
|
* ```
|
|
540
573
|
*
|
|
541
574
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
542
|
-
*
|
|
575
|
+
*
|
|
576
|
+
* @param documentType - The API ID of the document's custom type.
|
|
543
577
|
* @param uids - A list of document UIDs.
|
|
544
578
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
545
579
|
*
|
|
@@ -549,7 +583,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
549
583
|
getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
550
584
|
/**
|
|
551
585
|
* Queries all documents from the Prismic repository with specific UIDs and
|
|
552
|
-
*
|
|
586
|
+
* custom type.
|
|
553
587
|
*
|
|
554
588
|
* This method may make multiple network requests to query all matching
|
|
555
589
|
* content.
|
|
@@ -558,7 +592,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
558
592
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
559
593
|
* for all documents and is made available on its `id` property. A UID is
|
|
560
594
|
* provided in the Prismic editor and is unique among all documents of its
|
|
561
|
-
*
|
|
595
|
+
* custom type.
|
|
562
596
|
* @example
|
|
563
597
|
*
|
|
564
598
|
* ```ts
|
|
@@ -569,7 +603,8 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
569
603
|
* ```
|
|
570
604
|
*
|
|
571
605
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
572
|
-
*
|
|
606
|
+
*
|
|
607
|
+
* @param documentType - The API ID of the document's custom type.
|
|
573
608
|
* @param uids - A list of document UIDs.
|
|
574
609
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
575
610
|
*
|
|
@@ -578,12 +613,12 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
578
613
|
getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
579
614
|
/**
|
|
580
615
|
* Queries a singleton document from the Prismic repository for a specific
|
|
581
|
-
*
|
|
616
|
+
* custom type.
|
|
582
617
|
*
|
|
583
618
|
* @remarks
|
|
584
619
|
* A singleton document is one that is configured in Prismic to only allow one
|
|
585
620
|
* instance. For example, a repository may be configured to contain just one
|
|
586
|
-
* Settings document. This is in contrast to a repeatable
|
|
621
|
+
* Settings document. This is in contrast to a repeatable custom type which
|
|
587
622
|
* allows multiple instances of itself.
|
|
588
623
|
* @example
|
|
589
624
|
*
|
|
@@ -592,18 +627,19 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
592
627
|
* ```
|
|
593
628
|
*
|
|
594
629
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
595
|
-
*
|
|
630
|
+
*
|
|
631
|
+
* @param documentType - The API ID of the singleton custom type.
|
|
596
632
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
597
633
|
*
|
|
598
|
-
* @returns The singleton document for the
|
|
634
|
+
* @returns The singleton document for the custom type, if a matching document
|
|
599
635
|
* exists.
|
|
600
636
|
*/
|
|
601
637
|
getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
602
638
|
/**
|
|
603
|
-
* Queries documents from the Prismic repository for a specific
|
|
639
|
+
* Queries documents from the Prismic repository for a specific custom type.
|
|
604
640
|
*
|
|
605
641
|
* Use `getAllByType` instead if you need to query all documents for a
|
|
606
|
-
* specific
|
|
642
|
+
* specific custom type.
|
|
607
643
|
*
|
|
608
644
|
* @example
|
|
609
645
|
*
|
|
@@ -612,10 +648,11 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
612
648
|
* ```
|
|
613
649
|
*
|
|
614
650
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
615
|
-
*
|
|
651
|
+
*
|
|
652
|
+
* @param documentType - The API ID of the custom type.
|
|
616
653
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
617
654
|
*
|
|
618
|
-
* @returns A paginated response containing documents of the
|
|
655
|
+
* @returns A paginated response containing documents of the custom type.
|
|
619
656
|
*/
|
|
620
657
|
getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
621
658
|
/**
|
|
@@ -632,10 +669,11 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
632
669
|
* ```
|
|
633
670
|
*
|
|
634
671
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
635
|
-
*
|
|
672
|
+
*
|
|
673
|
+
* @param documentType - The API ID of the custom type.
|
|
636
674
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
637
675
|
*
|
|
638
|
-
* @returns A list of all documents of the
|
|
676
|
+
* @returns A list of all documents of the custom type.
|
|
639
677
|
*/
|
|
640
678
|
getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
641
679
|
/**
|
|
@@ -651,6 +689,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
651
689
|
* ```
|
|
652
690
|
*
|
|
653
691
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
692
|
+
*
|
|
654
693
|
* @param tag - The tag that must be included on a document.
|
|
655
694
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
656
695
|
*
|
|
@@ -670,6 +709,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
670
709
|
* ```
|
|
671
710
|
*
|
|
672
711
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
712
|
+
*
|
|
673
713
|
* @param tag - The tag that must be included on a document.
|
|
674
714
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
675
715
|
*
|
|
@@ -687,6 +727,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
687
727
|
* ```
|
|
688
728
|
*
|
|
689
729
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
730
|
+
*
|
|
690
731
|
* @param tags - A list of tags that must be included on a document.
|
|
691
732
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
692
733
|
*
|
|
@@ -707,6 +748,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
707
748
|
* ```
|
|
708
749
|
*
|
|
709
750
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
751
|
+
*
|
|
710
752
|
* @param tags - A list of tags that must be included on a document.
|
|
711
753
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
712
754
|
*
|
|
@@ -725,6 +767,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
725
767
|
* ```
|
|
726
768
|
*
|
|
727
769
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
770
|
+
*
|
|
728
771
|
* @param tags - A list of tags that must be included on a document.
|
|
729
772
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
730
773
|
*
|
|
@@ -747,6 +790,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
747
790
|
* ```
|
|
748
791
|
*
|
|
749
792
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
793
|
+
*
|
|
750
794
|
* @param tags - A list of tags that must be included on a document.
|
|
751
795
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
752
796
|
*
|
|
@@ -943,6 +987,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
943
987
|
* supported.
|
|
944
988
|
*
|
|
945
989
|
* @returns The `fetch()` Response for the request.
|
|
990
|
+
*
|
|
946
991
|
* @experimental
|
|
947
992
|
*/
|
|
948
993
|
graphQLFetch(input: RequestInfo, init?: Omit<RequestInit, "signal"> & {
|
|
@@ -961,6 +1006,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
961
1006
|
* @param name - Name of the form.
|
|
962
1007
|
*
|
|
963
1008
|
* @returns The repository form.
|
|
1009
|
+
*
|
|
964
1010
|
* @throws If a matching form cannot be found.
|
|
965
1011
|
*/
|
|
966
1012
|
private getCachedRepositoryForm;
|
|
@@ -994,6 +1040,7 @@ export declare class Client<TDocuments extends PrismicDocument = PrismicDocument
|
|
|
994
1040
|
* normalizes unsuccessful network requests.
|
|
995
1041
|
*
|
|
996
1042
|
* @typeParam T - The JSON response.
|
|
1043
|
+
*
|
|
997
1044
|
* @param url - URL to the resource to fetch.
|
|
998
1045
|
* @param params - Prismic REST API parameters for the network request.
|
|
999
1046
|
*
|