@prismicio/client 6.6.4 → 6.7.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/index.d.ts CHANGED
@@ -150,6 +150,27 @@ interface Ordering {
150
150
  /**
151
151
  * A `routes` parameter that determines how a document's URL field is resolved.
152
152
  *
153
+ * @example With a document's UID field.
154
+ *
155
+ * ```ts
156
+ * {
157
+ * "type": "page",
158
+ * "path": "/:uid"
159
+ * }
160
+ * ```
161
+ *
162
+ * @example With a Content Relationship `parent` field.
163
+ *
164
+ * ```ts
165
+ * {
166
+ * "type": "page",
167
+ * "path": "/:parent?/:uid",
168
+ * "resolvers": {
169
+ * "parent": "parent"
170
+ * }
171
+ * }
172
+ * ```
173
+ *
153
174
  * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
154
175
  */
155
176
  interface Route {
@@ -157,6 +178,16 @@ interface Route {
157
178
  * The Custom Type of the document.
158
179
  */
159
180
  type: string;
181
+ /**
182
+ * A specific UID to which this route definition is scoped. The route is only
183
+ * defined for the document whose UID matches the given UID.
184
+ */
185
+ uid?: string;
186
+ /**
187
+ * A specific language to which this route definition is scoped. The route is
188
+ * only defined for documents whose language matches the given language.
189
+ */
190
+ lang?: string;
160
191
  /**
161
192
  * The resolved path of the document with optional placeholders.
162
193
  */
@@ -240,6 +271,15 @@ interface QueryParams {
240
271
  * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
241
272
  */
242
273
  routes?: Route | string | (Route | string)[];
274
+ /**
275
+ * The `brokenRoute` option allows you to define the route populated in the
276
+ * `url` property for broken Link or Content Relationship fields. A broken
277
+ * link is a Link or Content Relationship field whose linked document has been
278
+ * unpublished or deleted.
279
+ *
280
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
281
+ */
282
+ brokenRoute?: string;
243
283
  }
244
284
  /**
245
285
  * Arguments for `buildQueryURL` to construct a Query URL.
@@ -312,11 +352,20 @@ declare type ClientConfig = {
312
352
  * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
313
353
  */
314
354
  routes?: NonNullable<BuildQueryURLArgs["routes"]>;
355
+ /**
356
+ * The `brokenRoute` option allows you to define the route populated in the
357
+ * `url` property for broken Link or Content Relationship fields. A broken
358
+ * link is a Link or Content Relationship field whose linked document has been
359
+ * unpublished or deleted.
360
+ *
361
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
362
+ */
363
+ brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
315
364
  /**
316
365
  * Default parameters that will be sent with each query. These parameters can
317
366
  * be overridden on each query if needed.
318
367
  */
319
- defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
368
+ defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes" | "brokenRoute">;
320
369
  /**
321
370
  * The function used to make network requests to the Prismic REST API. In
322
371
  * environments where a global `fetch` function does not exist, such as
@@ -430,6 +479,15 @@ declare class Client<TDocuments extends prismicT.PrismicDocument = prismicT.Pris
430
479
  * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
431
480
  */
432
481
  routes?: NonNullable<BuildQueryURLArgs["routes"]>;
482
+ /**
483
+ * The `brokenRoute` option allows you to define the route populated in the
484
+ * `url` property for broken Link or Content Relationship fields. A broken
485
+ * link is a Link or Content Relationship field whose linked document has been
486
+ * unpublished or deleted.
487
+ *
488
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
489
+ */
490
+ brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
433
491
  /**
434
492
  * The function used to make network requests to the Prismic REST API. In
435
493
  * environments where a global `fetch` function does not exist, such as
package/dist/index.js CHANGED
@@ -274,6 +274,7 @@ class Client {
274
274
  }
275
275
  this.accessToken = options.accessToken;
276
276
  this.routes = options.routes;
277
+ this.brokenRoute = options.brokenRoute;
277
278
  this.defaultParams = options.defaultParams;
278
279
  if (options.ref) {
279
280
  this.queryContentFromRef(options.ref);
@@ -490,6 +491,7 @@ class Client {
490
491
  ref,
491
492
  integrationFieldsRef,
492
493
  routes: params.routes || this.routes,
494
+ brokenRoute: params.brokenRoute || this.brokenRoute,
493
495
  accessToken: params.accessToken || this.accessToken
494
496
  });
495
497
  }