@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.
@@ -84,6 +84,16 @@ export interface QueryParams {
84
84
  * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
85
85
  */
86
86
  routes?: Route | string | (Route | string)[];
87
+
88
+ /**
89
+ * The `brokenRoute` option allows you to define the route populated in the
90
+ * `url` property for broken Link or Content Relationship fields. A broken
91
+ * link is a Link or Content Relationship field whose linked document has been
92
+ * unpublished or deleted.
93
+ *
94
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
95
+ */
96
+ brokenRoute?: string;
87
97
  }
88
98
 
89
99
  /**
package/src/client.ts CHANGED
@@ -139,13 +139,23 @@ export type ClientConfig = {
139
139
  */
140
140
  routes?: NonNullable<BuildQueryURLArgs["routes"]>;
141
141
 
142
+ /**
143
+ * The `brokenRoute` option allows you to define the route populated in the
144
+ * `url` property for broken Link or Content Relationship fields. A broken
145
+ * link is a Link or Content Relationship field whose linked document has been
146
+ * unpublished or deleted.
147
+ *
148
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
149
+ */
150
+ brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
151
+
142
152
  /**
143
153
  * Default parameters that will be sent with each query. These parameters can
144
154
  * be overridden on each query if needed.
145
155
  */
146
156
  defaultParams?: Omit<
147
157
  BuildQueryURLArgs,
148
- "ref" | "integrationFieldsRef" | "accessToken" | "routes"
158
+ "ref" | "integrationFieldsRef" | "accessToken" | "routes" | "brokenRoute"
149
159
  >;
150
160
 
151
161
  /**
@@ -314,6 +324,16 @@ export class Client<
314
324
  */
315
325
  routes?: NonNullable<BuildQueryURLArgs["routes"]>;
316
326
 
327
+ /**
328
+ * The `brokenRoute` option allows you to define the route populated in the
329
+ * `url` property for broken Link or Content Relationship fields. A broken
330
+ * link is a Link or Content Relationship field whose linked document has been
331
+ * unpublished or deleted.
332
+ *
333
+ * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
334
+ */
335
+ brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
336
+
317
337
  /**
318
338
  * The function used to make network requests to the Prismic REST API. In
319
339
  * environments where a global `fetch` function does not exist, such as
@@ -382,6 +402,7 @@ export class Client<
382
402
 
383
403
  this.accessToken = options.accessToken;
384
404
  this.routes = options.routes;
405
+ this.brokenRoute = options.brokenRoute;
385
406
  this.defaultParams = options.defaultParams;
386
407
 
387
408
  if (options.ref) {
@@ -1235,6 +1256,7 @@ export class Client<
1235
1256
  ref,
1236
1257
  integrationFieldsRef,
1237
1258
  routes: params.routes || this.routes,
1259
+ brokenRoute: params.brokenRoute || this.brokenRoute,
1238
1260
  accessToken: params.accessToken || this.accessToken,
1239
1261
  });
1240
1262
  }
package/src/types.ts CHANGED
@@ -140,6 +140,27 @@ export interface Ordering {
140
140
  /**
141
141
  * A `routes` parameter that determines how a document's URL field is resolved.
142
142
  *
143
+ * @example With a document's UID field.
144
+ *
145
+ * ```ts
146
+ * {
147
+ * "type": "page",
148
+ * "path": "/:uid"
149
+ * }
150
+ * ```
151
+ *
152
+ * @example With a Content Relationship `parent` field.
153
+ *
154
+ * ```ts
155
+ * {
156
+ * "type": "page",
157
+ * "path": "/:parent?/:uid",
158
+ * "resolvers": {
159
+ * "parent": "parent"
160
+ * }
161
+ * }
162
+ * ```
163
+ *
143
164
  * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
144
165
  */
145
166
  export interface Route {
@@ -147,10 +168,24 @@ export interface Route {
147
168
  * The Custom Type of the document.
148
169
  */
149
170
  type: string;
171
+
172
+ /**
173
+ * A specific UID to which this route definition is scoped. The route is only
174
+ * defined for the document whose UID matches the given UID.
175
+ */
176
+ uid?: string;
177
+
178
+ /**
179
+ * A specific language to which this route definition is scoped. The route is
180
+ * only defined for documents whose language matches the given language.
181
+ */
182
+ lang?: string;
183
+
150
184
  /**
151
185
  * The resolved path of the document with optional placeholders.
152
186
  */
153
187
  path: string;
188
+
154
189
  /**
155
190
  * An object that lists the API IDs of the Content Relationships in the route.
156
191
  */