@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.js
CHANGED
|
@@ -65,7 +65,7 @@ class Client {
|
|
|
65
65
|
*/
|
|
66
66
|
__publicField(this, "accessToken");
|
|
67
67
|
/**
|
|
68
|
-
* A list of
|
|
68
|
+
* A list of route resolver objects that define how a document's `url` field
|
|
69
69
|
* is resolved.
|
|
70
70
|
*
|
|
71
71
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -73,8 +73,8 @@ class Client {
|
|
|
73
73
|
__publicField(this, "routes");
|
|
74
74
|
/**
|
|
75
75
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
76
|
-
* `url` property for broken
|
|
77
|
-
* link is a
|
|
76
|
+
* `url` property for broken link or content relationship fields. A broken
|
|
77
|
+
* link is a link or content relationship field whose linked document has been
|
|
78
78
|
* unpublished or deleted.
|
|
79
79
|
*
|
|
80
80
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -86,6 +86,17 @@ class Client {
|
|
|
86
86
|
* Node.js, this function must be provided.
|
|
87
87
|
*/
|
|
88
88
|
__publicField(this, "fetchFn");
|
|
89
|
+
/**
|
|
90
|
+
* Options or a function that returns options provided to the client's
|
|
91
|
+
* `fetch()` on all network requests. These options will be merged with
|
|
92
|
+
* internally required options. They can also be overriden on a per-query
|
|
93
|
+
* basis using the query's `fetchOptions` parameter.
|
|
94
|
+
*
|
|
95
|
+
* If the options must be determined on-demand, a function can be provided.
|
|
96
|
+
* This function can be asynchronous.
|
|
97
|
+
*
|
|
98
|
+
* @experimental
|
|
99
|
+
*/
|
|
89
100
|
__publicField(this, "fetchOptions");
|
|
90
101
|
/**
|
|
91
102
|
* Default parameters that will be sent with each query. These parameters can
|
|
@@ -215,6 +226,7 @@ class Client {
|
|
|
215
226
|
* ```
|
|
216
227
|
*
|
|
217
228
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
229
|
+
*
|
|
218
230
|
* @param params - Parameters to filter, sort, and paginate results.
|
|
219
231
|
*
|
|
220
232
|
* @returns A paginated response containing the result of the query.
|
|
@@ -234,6 +246,7 @@ class Client {
|
|
|
234
246
|
* ```
|
|
235
247
|
*
|
|
236
248
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
249
|
+
*
|
|
237
250
|
* @param params - Parameters to filter, sort, and paginate results. @returns
|
|
238
251
|
* The first result of the query, if any.
|
|
239
252
|
*/
|
|
@@ -269,6 +282,7 @@ class Client {
|
|
|
269
282
|
* ```
|
|
270
283
|
*
|
|
271
284
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
285
|
+
*
|
|
272
286
|
* @param params - Parameters to filter, sort, and paginate results.
|
|
273
287
|
*
|
|
274
288
|
* @returns A list of documents matching the query.
|
|
@@ -299,7 +313,7 @@ class Client {
|
|
|
299
313
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
300
314
|
* for all documents and is made available on its `id` property. A UID is
|
|
301
315
|
* provided in the Prismic editor and is unique among all documents of its
|
|
302
|
-
*
|
|
316
|
+
* custom type.
|
|
303
317
|
* @example
|
|
304
318
|
*
|
|
305
319
|
* ```ts
|
|
@@ -307,6 +321,7 @@ class Client {
|
|
|
307
321
|
* ```
|
|
308
322
|
*
|
|
309
323
|
* @typeParam TDocument- Type of the Prismic document returned.
|
|
324
|
+
*
|
|
310
325
|
* @param id - ID of the document.
|
|
311
326
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
312
327
|
*
|
|
@@ -323,7 +338,7 @@ class Client {
|
|
|
323
338
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
324
339
|
* for all documents and is made available on its `id` property. A UID is
|
|
325
340
|
* provided in the Prismic editor and is unique among all documents of its
|
|
326
|
-
*
|
|
341
|
+
* custom type.
|
|
327
342
|
* @example
|
|
328
343
|
*
|
|
329
344
|
* ```ts
|
|
@@ -334,6 +349,7 @@ class Client {
|
|
|
334
349
|
* ```
|
|
335
350
|
*
|
|
336
351
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
352
|
+
*
|
|
337
353
|
* @param ids - A list of document IDs.
|
|
338
354
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
339
355
|
*
|
|
@@ -353,7 +369,7 @@ class Client {
|
|
|
353
369
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
354
370
|
* for all documents and is made available on its `id` property. A UID is
|
|
355
371
|
* provided in the Prismic editor and is unique among all documents of its
|
|
356
|
-
*
|
|
372
|
+
* custom type.
|
|
357
373
|
* @example
|
|
358
374
|
*
|
|
359
375
|
* ```ts
|
|
@@ -364,6 +380,7 @@ class Client {
|
|
|
364
380
|
* ```
|
|
365
381
|
*
|
|
366
382
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
383
|
+
*
|
|
367
384
|
* @param ids - A list of document IDs.
|
|
368
385
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
369
386
|
*
|
|
@@ -374,13 +391,13 @@ class Client {
|
|
|
374
391
|
}
|
|
375
392
|
/**
|
|
376
393
|
* Queries a document from the Prismic repository with a specific UID and
|
|
377
|
-
*
|
|
394
|
+
* custom type.
|
|
378
395
|
*
|
|
379
396
|
* @remarks
|
|
380
397
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
381
398
|
* for all documents and is made available on its `id` property. A UID is
|
|
382
399
|
* provided in the Prismic editor and is unique among all documents of its
|
|
383
|
-
*
|
|
400
|
+
* custom type.
|
|
384
401
|
* @example
|
|
385
402
|
*
|
|
386
403
|
* ```ts
|
|
@@ -388,7 +405,8 @@ class Client {
|
|
|
388
405
|
* ```
|
|
389
406
|
*
|
|
390
407
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
391
|
-
*
|
|
408
|
+
*
|
|
409
|
+
* @param documentType - The API ID of the document's custom type.
|
|
392
410
|
* @param uid - UID of the document.
|
|
393
411
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
394
412
|
*
|
|
@@ -409,7 +427,7 @@ class Client {
|
|
|
409
427
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
410
428
|
* for all documents and is made available on its `id` property. A UID is
|
|
411
429
|
* provided in the Prismic editor and is unique among all documents of its
|
|
412
|
-
*
|
|
430
|
+
* custom type.
|
|
413
431
|
* @example
|
|
414
432
|
*
|
|
415
433
|
* ```ts
|
|
@@ -420,7 +438,8 @@ class Client {
|
|
|
420
438
|
* ```
|
|
421
439
|
*
|
|
422
440
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
423
|
-
*
|
|
441
|
+
*
|
|
442
|
+
* @param documentType - The API ID of the document's custom type.
|
|
424
443
|
* @param uids - A list of document UIDs.
|
|
425
444
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
426
445
|
*
|
|
@@ -435,7 +454,7 @@ class Client {
|
|
|
435
454
|
}
|
|
436
455
|
/**
|
|
437
456
|
* Queries all documents from the Prismic repository with specific UIDs and
|
|
438
|
-
*
|
|
457
|
+
* custom type.
|
|
439
458
|
*
|
|
440
459
|
* This method may make multiple network requests to query all matching
|
|
441
460
|
* content.
|
|
@@ -444,7 +463,7 @@ class Client {
|
|
|
444
463
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
445
464
|
* for all documents and is made available on its `id` property. A UID is
|
|
446
465
|
* provided in the Prismic editor and is unique among all documents of its
|
|
447
|
-
*
|
|
466
|
+
* custom type.
|
|
448
467
|
* @example
|
|
449
468
|
*
|
|
450
469
|
* ```ts
|
|
@@ -455,7 +474,8 @@ class Client {
|
|
|
455
474
|
* ```
|
|
456
475
|
*
|
|
457
476
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
458
|
-
*
|
|
477
|
+
*
|
|
478
|
+
* @param documentType - The API ID of the document's custom type.
|
|
459
479
|
* @param uids - A list of document UIDs.
|
|
460
480
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
461
481
|
*
|
|
@@ -469,12 +489,12 @@ class Client {
|
|
|
469
489
|
}
|
|
470
490
|
/**
|
|
471
491
|
* Queries a singleton document from the Prismic repository for a specific
|
|
472
|
-
*
|
|
492
|
+
* custom type.
|
|
473
493
|
*
|
|
474
494
|
* @remarks
|
|
475
495
|
* A singleton document is one that is configured in Prismic to only allow one
|
|
476
496
|
* instance. For example, a repository may be configured to contain just one
|
|
477
|
-
* Settings document. This is in contrast to a repeatable
|
|
497
|
+
* Settings document. This is in contrast to a repeatable custom type which
|
|
478
498
|
* allows multiple instances of itself.
|
|
479
499
|
* @example
|
|
480
500
|
*
|
|
@@ -483,20 +503,21 @@ class Client {
|
|
|
483
503
|
* ```
|
|
484
504
|
*
|
|
485
505
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
486
|
-
*
|
|
506
|
+
*
|
|
507
|
+
* @param documentType - The API ID of the singleton custom type.
|
|
487
508
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
488
509
|
*
|
|
489
|
-
* @returns The singleton document for the
|
|
510
|
+
* @returns The singleton document for the custom type, if a matching document
|
|
490
511
|
* exists.
|
|
491
512
|
*/
|
|
492
513
|
async getSingle(documentType, params) {
|
|
493
514
|
return await this.getFirst(appendFilters(params, typeFilter(documentType)));
|
|
494
515
|
}
|
|
495
516
|
/**
|
|
496
|
-
* Queries documents from the Prismic repository for a specific
|
|
517
|
+
* Queries documents from the Prismic repository for a specific custom type.
|
|
497
518
|
*
|
|
498
519
|
* Use `getAllByType` instead if you need to query all documents for a
|
|
499
|
-
* specific
|
|
520
|
+
* specific custom type.
|
|
500
521
|
*
|
|
501
522
|
* @example
|
|
502
523
|
*
|
|
@@ -505,10 +526,11 @@ class Client {
|
|
|
505
526
|
* ```
|
|
506
527
|
*
|
|
507
528
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
508
|
-
*
|
|
529
|
+
*
|
|
530
|
+
* @param documentType - The API ID of the custom type.
|
|
509
531
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
510
532
|
*
|
|
511
|
-
* @returns A paginated response containing documents of the
|
|
533
|
+
* @returns A paginated response containing documents of the custom type.
|
|
512
534
|
*/
|
|
513
535
|
async getByType(documentType, params) {
|
|
514
536
|
return await this.get(appendFilters(params, typeFilter(documentType)));
|
|
@@ -527,10 +549,11 @@ class Client {
|
|
|
527
549
|
* ```
|
|
528
550
|
*
|
|
529
551
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
530
|
-
*
|
|
552
|
+
*
|
|
553
|
+
* @param documentType - The API ID of the custom type.
|
|
531
554
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
532
555
|
*
|
|
533
|
-
* @returns A list of all documents of the
|
|
556
|
+
* @returns A list of all documents of the custom type.
|
|
534
557
|
*/
|
|
535
558
|
async getAllByType(documentType, params) {
|
|
536
559
|
return await this.dangerouslyGetAll(appendFilters(params, typeFilter(documentType)));
|
|
@@ -548,6 +571,7 @@ class Client {
|
|
|
548
571
|
* ```
|
|
549
572
|
*
|
|
550
573
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
574
|
+
*
|
|
551
575
|
* @param tag - The tag that must be included on a document.
|
|
552
576
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
553
577
|
*
|
|
@@ -569,6 +593,7 @@ class Client {
|
|
|
569
593
|
* ```
|
|
570
594
|
*
|
|
571
595
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
596
|
+
*
|
|
572
597
|
* @param tag - The tag that must be included on a document.
|
|
573
598
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
574
599
|
*
|
|
@@ -588,6 +613,7 @@ class Client {
|
|
|
588
613
|
* ```
|
|
589
614
|
*
|
|
590
615
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
616
|
+
*
|
|
591
617
|
* @param tags - A list of tags that must be included on a document.
|
|
592
618
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
593
619
|
*
|
|
@@ -610,6 +636,7 @@ class Client {
|
|
|
610
636
|
* ```
|
|
611
637
|
*
|
|
612
638
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
639
|
+
*
|
|
613
640
|
* @param tags - A list of tags that must be included on a document.
|
|
614
641
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
615
642
|
*
|
|
@@ -630,6 +657,7 @@ class Client {
|
|
|
630
657
|
* ```
|
|
631
658
|
*
|
|
632
659
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
660
|
+
*
|
|
633
661
|
* @param tags - A list of tags that must be included on a document.
|
|
634
662
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
635
663
|
*
|
|
@@ -654,6 +682,7 @@ class Client {
|
|
|
654
682
|
* ```
|
|
655
683
|
*
|
|
656
684
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
685
|
+
*
|
|
657
686
|
* @param tags - A list of tags that must be included on a document.
|
|
658
687
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
659
688
|
*
|
|
@@ -954,6 +983,7 @@ class Client {
|
|
|
954
983
|
* supported.
|
|
955
984
|
*
|
|
956
985
|
* @returns The `fetch()` Response for the request.
|
|
986
|
+
*
|
|
957
987
|
* @experimental
|
|
958
988
|
*/
|
|
959
989
|
async graphQLFetch(input, init) {
|
|
@@ -1019,6 +1049,7 @@ class Client {
|
|
|
1019
1049
|
* @param name - Name of the form.
|
|
1020
1050
|
*
|
|
1021
1051
|
* @returns The repository form.
|
|
1052
|
+
*
|
|
1022
1053
|
* @throws If a matching form cannot be found.
|
|
1023
1054
|
*/
|
|
1024
1055
|
async getCachedRepositoryForm(name, params) {
|
|
@@ -1093,21 +1124,23 @@ class Client {
|
|
|
1093
1124
|
* normalizes unsuccessful network requests.
|
|
1094
1125
|
*
|
|
1095
1126
|
* @typeParam T - The JSON response.
|
|
1127
|
+
*
|
|
1096
1128
|
* @param url - URL to the resource to fetch.
|
|
1097
1129
|
* @param params - Prismic REST API parameters for the network request.
|
|
1098
1130
|
*
|
|
1099
1131
|
* @returns The JSON response from the network request.
|
|
1100
1132
|
*/
|
|
1101
1133
|
async fetch(url, params = {}) {
|
|
1102
|
-
|
|
1134
|
+
const paramsFetchOptions = await castThunk(params.fetchOptions)(url);
|
|
1135
|
+
const thisFetchOptions = await castThunk(this.fetchOptions)(url, paramsFetchOptions);
|
|
1103
1136
|
const requestInit = {
|
|
1104
|
-
...
|
|
1105
|
-
...
|
|
1137
|
+
...paramsFetchOptions,
|
|
1138
|
+
...thisFetchOptions,
|
|
1106
1139
|
headers: {
|
|
1107
|
-
...
|
|
1108
|
-
...
|
|
1140
|
+
...paramsFetchOptions == null ? void 0 : paramsFetchOptions.headers,
|
|
1141
|
+
...thisFetchOptions == null ? void 0 : thisFetchOptions.headers
|
|
1109
1142
|
},
|
|
1110
|
-
signal: (
|
|
1143
|
+
signal: (paramsFetchOptions == null ? void 0 : paramsFetchOptions.signal) || params.signal || (thisFetchOptions == null ? void 0 : thisFetchOptions.signal)
|
|
1111
1144
|
};
|
|
1112
1145
|
let job;
|
|
1113
1146
|
if (this.fetchJobs[url] && this.fetchJobs[url].has(requestInit.signal)) {
|