@datocms/cma-client 5.1.23 → 5.1.25

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.
@@ -111,6 +111,24 @@ export default class ItemType extends BaseResource {
111
111
  * @throws {TimeoutError}
112
112
  */
113
113
  rawDestroy(itemTypeId: string, queryParams?: RawApiTypes.ItemTypeDestroyHrefSchema): Promise<RawApiTypes.ItemTypeDestroyJobSchema>;
114
+ /**
115
+ * List models referencing a model or block model
116
+ *
117
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/referencing
118
+ *
119
+ * @throws {ApiError}
120
+ * @throws {TimeoutError}
121
+ */
122
+ referencing(itemTypeId: string | ApiTypes.ItemTypeData): Promise<ApiTypes.ItemTypeReferencingTargetSchema>;
123
+ /**
124
+ * List models referencing a model or block model
125
+ *
126
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/referencing
127
+ *
128
+ * @throws {ApiError}
129
+ * @throws {TimeoutError}
130
+ */
131
+ rawReferencing(itemTypeId: string): Promise<RawApiTypes.ItemTypeReferencingTargetSchema>;
114
132
  /**
115
133
  * Reorders a set of fields and fieldsets within the model
116
134
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datocms/cma-client",
3
- "version": "5.1.23",
3
+ "version": "5.1.25",
4
4
  "description": "JS client for DatoCMS REST Content Management API",
5
5
  "keywords": [
6
6
  "datocms",
@@ -45,5 +45,5 @@
45
45
  "@datocms/dashboard-client": "^5.1.13",
46
46
  "@types/uuid": "^9.0.7"
47
47
  },
48
- "gitHead": "8b78b9756e1b6a5828210ac62f0419254d1bf8ce"
48
+ "gitHead": "ca047e3f4f8bf28262bb7b695a2887101dc935ed"
49
49
  }
package/resources.json CHANGED
@@ -1187,6 +1187,34 @@
1187
1187
  "name": "destroy",
1188
1188
  "rawName": "rawDestroy"
1189
1189
  },
1190
+ {
1191
+ "returnsCollection": false,
1192
+ "returnsItem": false,
1193
+ "requestBodyRequiresItem": false,
1194
+ "offersNestedItemsOptionInQueryParams": false,
1195
+ "docUrl": "https://www.datocms.com/docs/content-management-api/resources/item-type/referencing",
1196
+ "rel": "referencing",
1197
+ "urlTemplate": "/item-types/${itemTypeId}/referencing",
1198
+ "method": "GET",
1199
+ "comment": "List models referencing a model or block model",
1200
+ "urlPlaceholders": [
1201
+ {
1202
+ "variableName": "itemTypeId",
1203
+ "isEntityId": true,
1204
+ "relType": "ItemTypeData"
1205
+ }
1206
+ ],
1207
+ "entityIdPlaceholder": {
1208
+ "variableName": "itemTypeId",
1209
+ "isEntityId": true,
1210
+ "relType": "ItemTypeData"
1211
+ },
1212
+ "optionalRequestBody": false,
1213
+ "queryParamsRequired": false,
1214
+ "responseType": "ItemTypeReferencingTargetSchema",
1215
+ "name": "referencing",
1216
+ "rawName": "rawReferencing"
1217
+ },
1190
1218
  {
1191
1219
  "returnsCollection": false,
1192
1220
  "returnsItem": false,
@@ -8,7 +8,7 @@ export type SeoEditorConfiguration = {
8
8
  >;
9
9
  /** Specify which previews should be visible to editors */
10
10
  previews: Array<
11
- | 'google_search'
11
+ | 'google'
12
12
  | 'twitter'
13
13
  | 'slack'
14
14
  | 'whatsapp'
@@ -612,6 +612,11 @@ export type ItemTypeDestroyHrefSchema = {
612
612
  skip_menu_items_deletion?: boolean;
613
613
  [k: string]: unknown;
614
614
  };
615
+ /**
616
+ * This interface was referenced by `ItemType`'s JSON-Schema
617
+ * via the `referencing.targetSchema` link.
618
+ */
619
+ export type ItemTypeReferencingTargetSchema = ItemType[];
615
620
  /**
616
621
  * This interface was referenced by `ItemType`'s JSON-Schema
617
622
  * via the `reorder_fields_and_fieldsets.schema` link.
@@ -5251,11 +5256,11 @@ export type ItemTypeUpdateSchema = {
5251
5256
  * <details>
5252
5257
  * <summary>Multi-line text (<code>text</code>)</summary>
5253
5258
  *
5254
- * | Property | Value |
5255
- * | ------------------------------ | ---------------------------------------------- |
5256
- * | Code | `text` |
5257
- * | Built-in editors for the field | `markdown`, `wysiwyg`, `textarea` |
5258
- * | Available validators | `required`, `length`, `format`, `sanitization` |
5259
+ * | Property | Value |
5260
+ * | ------------------------------ | ------------------------------------------------ |
5261
+ * | Code | `text` |
5262
+ * | Built-in editors for the field | `markdown`, `wysiwyg`, `textarea` |
5263
+ * | Available validators | `required`, `length`, `format`, `sanitized_html` |
5259
5264
  *
5260
5265
  * </details>
5261
5266
  *
@@ -5361,11 +5366,11 @@ export type ItemTypeUpdateSchema = {
5361
5366
  * <details>
5362
5367
  * <summary>Slug (<code>slug</code>)</summary>
5363
5368
  *
5364
- * | Property | Value |
5365
- * | ------------------------------ | ------------------------------------------------------- |
5366
- * | Code | `slug` |
5367
- * | Built-in editors for the field | `slug` |
5368
- * | Available validators | `required`, `length`, `slug_format`, `slug_title_field` |
5369
+ * | Property | Value |
5370
+ * | ------------------------------ | ----------------------------------------------------------------- |
5371
+ * | Code | `slug` |
5372
+ * | Built-in editors for the field | `slug` |
5373
+ * | Available validators | `required`, `unique`, `length`, `slug_format`, `slug_title_field` |
5369
5374
  *
5370
5375
  * </details>
5371
5376
  *
@@ -5455,12 +5460,12 @@ export type ItemTypeUpdateSchema = {
5455
5460
  * <details>
5456
5461
  * <summary>Structured text (<code>structured_text</code>)</summary>
5457
5462
  *
5458
- * | Property | Value |
5459
- * | ------------------------------ | ------------------------------------------------- |
5460
- * | Code | `structured_text` |
5461
- * | Built-in editors for the field | `structured_text` |
5462
- * | Required validators | `structured_text_blocks`, `structured_text_links` |
5463
- * | Other validators available | `length`, `structured_text_inline_blocks` |
5463
+ * | Property | Value |
5464
+ * | ------------------------------ | ----------------------------------------------------- |
5465
+ * | Code | `structured_text` |
5466
+ * | Built-in editors for the field | `structured_text` |
5467
+ * | Required validators | `structured_text_blocks`, `structured_text_links` |
5468
+ * | Other validators available | `required`, `length`, `structured_text_inline_blocks` |
5464
5469
  *
5465
5470
  * </details>
5466
5471
  *
@@ -5774,9 +5779,9 @@ export type ItemTypeUpdateSchema = {
5774
5779
  * </details>
5775
5780
  *
5776
5781
  * <details>
5777
- * <summary><code>sanitization</code></summary>
5782
+ * <summary><code>sanitized_html</code></summary>
5778
5783
  *
5779
- * Checks for the presence of malicious cose in HTML fields: content is valid if no dangerous code is present.
5784
+ * Checks for the presence of malicious code in HTML fields: content is valid if no dangerous code is present.
5780
5785
  *
5781
5786
  * | Parameter | Type | Required | Description |
5782
5787
  * | ---------------------------- | --------- | -------- | ------------------------------------------------------------ |
@@ -6003,10 +6008,10 @@ export type ItemTypeUpdateSchema = {
6003
6008
  *
6004
6009
  * Built-in editor for _seo_ fields.
6005
6010
  *
6006
- * | Parameter | Type | Required | Description |
6007
- * | ---------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6008
- * | `fields` | `Array<String>` | ✅ | Specify which fields of the SEO input should be visible to editors. Valid values: `"title"`, `"description"`, `"image"`, `"no_index"`, `"twitter_card"` |
6009
- * | `previews` | `Array<String>` | ✅ | Specify which previews should be visible to editors. Valid values: `"google_search"`, `"twitter"`, `"slack"`, `"whatsapp"`, `"telegram"`, `"facebook"`, `"linkedin"` |
6011
+ * | Parameter | Type | Required | Description |
6012
+ * | ---------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6013
+ * | `fields` | `Array<String>` | ✅ | Specify which fields of the SEO input should be visible to editors. Valid values: `"title"`, `"description"`, `"image"`, `"no_index"`, `"twitter_card"` |
6014
+ * | `previews` | `Array<String>` | ✅ | Specify which previews should be visible to editors. Valid values: `"google"`, `"twitter"`, `"slack"`, `"whatsapp"`, `"telegram"`, `"facebook"`, `"linkedin"` |
6010
6015
  *
6011
6016
  * </details>
6012
6017
  *
@@ -6193,7 +6198,6 @@ export type FieldStableShell = {
6193
6198
  };
6194
6199
  [k: string]: unknown;
6195
6200
  }[];
6196
- [k: string]: unknown;
6197
6201
  };
6198
6202
  /**
6199
6203
  * Ordering index
@@ -6320,7 +6324,6 @@ export type FieldAttributesStableShell = {
6320
6324
  };
6321
6325
  [k: string]: unknown;
6322
6326
  }[];
6323
- [k: string]: unknown;
6324
6327
  };
6325
6328
  /**
6326
6329
  * Ordering index
@@ -6435,7 +6438,6 @@ export type FieldCreateSchemaStableShell = {
6435
6438
  };
6436
6439
  [k: string]: unknown;
6437
6440
  }[];
6438
- [k: string]: unknown;
6439
6441
  };
6440
6442
  /**
6441
6443
  * Ordering index
@@ -6543,7 +6545,6 @@ export type FieldUpdateSchemaStableShell = {
6543
6545
  };
6544
6546
  [k: string]: unknown;
6545
6547
  }[];
6546
- [k: string]: unknown;
6547
6548
  };
6548
6549
  /**
6549
6550
  * Ordering index
@@ -147,7 +147,7 @@ export class Client {
147
147
  ...this.config,
148
148
  ...options,
149
149
  logFn: this.config.logFn || console.log,
150
- userAgent: '@datocms/cma-client v5.1.23',
150
+ userAgent: '@datocms/cma-client v5.1.25',
151
151
  baseUrl: this.baseUrl,
152
152
  preCallStack: new Error().stack,
153
153
  extraHeaders: {
@@ -4758,6 +4758,13 @@ export type ItemTypeDestroyTargetSchema = {
4758
4758
  export type ItemTypeDestroyJobSchema = {
4759
4759
  data: ItemType;
4760
4760
  };
4761
+ /**
4762
+ * This interface was referenced by `ItemType`'s JSON-Schema
4763
+ * via the `referencing.targetSchema` link.
4764
+ */
4765
+ export type ItemTypeReferencingTargetSchema = {
4766
+ data: ItemType[];
4767
+ };
4761
4768
  /**
4762
4769
  * This interface was referenced by `ItemType`'s JSON-Schema
4763
4770
  * via the `reorder_fields_and_fieldsets.schema` link.
@@ -4931,11 +4938,11 @@ export type ItemTypeReorderFieldsAndFieldsetsJobSchema = {
4931
4938
  * <details>
4932
4939
  * <summary>Multi-line text (<code>text</code>)</summary>
4933
4940
  *
4934
- * | Property | Value |
4935
- * | ------------------------------ | ---------------------------------------------- |
4936
- * | Code | `text` |
4937
- * | Built-in editors for the field | `markdown`, `wysiwyg`, `textarea` |
4938
- * | Available validators | `required`, `length`, `format`, `sanitization` |
4941
+ * | Property | Value |
4942
+ * | ------------------------------ | ------------------------------------------------ |
4943
+ * | Code | `text` |
4944
+ * | Built-in editors for the field | `markdown`, `wysiwyg`, `textarea` |
4945
+ * | Available validators | `required`, `length`, `format`, `sanitized_html` |
4939
4946
  *
4940
4947
  * </details>
4941
4948
  *
@@ -5041,11 +5048,11 @@ export type ItemTypeReorderFieldsAndFieldsetsJobSchema = {
5041
5048
  * <details>
5042
5049
  * <summary>Slug (<code>slug</code>)</summary>
5043
5050
  *
5044
- * | Property | Value |
5045
- * | ------------------------------ | ------------------------------------------------------- |
5046
- * | Code | `slug` |
5047
- * | Built-in editors for the field | `slug` |
5048
- * | Available validators | `required`, `length`, `slug_format`, `slug_title_field` |
5051
+ * | Property | Value |
5052
+ * | ------------------------------ | ----------------------------------------------------------------- |
5053
+ * | Code | `slug` |
5054
+ * | Built-in editors for the field | `slug` |
5055
+ * | Available validators | `required`, `unique`, `length`, `slug_format`, `slug_title_field` |
5049
5056
  *
5050
5057
  * </details>
5051
5058
  *
@@ -5135,12 +5142,12 @@ export type ItemTypeReorderFieldsAndFieldsetsJobSchema = {
5135
5142
  * <details>
5136
5143
  * <summary>Structured text (<code>structured_text</code>)</summary>
5137
5144
  *
5138
- * | Property | Value |
5139
- * | ------------------------------ | ------------------------------------------------- |
5140
- * | Code | `structured_text` |
5141
- * | Built-in editors for the field | `structured_text` |
5142
- * | Required validators | `structured_text_blocks`, `structured_text_links` |
5143
- * | Other validators available | `length`, `structured_text_inline_blocks` |
5145
+ * | Property | Value |
5146
+ * | ------------------------------ | ----------------------------------------------------- |
5147
+ * | Code | `structured_text` |
5148
+ * | Built-in editors for the field | `structured_text` |
5149
+ * | Required validators | `structured_text_blocks`, `structured_text_links` |
5150
+ * | Other validators available | `required`, `length`, `structured_text_inline_blocks` |
5144
5151
  *
5145
5152
  * </details>
5146
5153
  *
@@ -5454,9 +5461,9 @@ export type ItemTypeReorderFieldsAndFieldsetsJobSchema = {
5454
5461
  * </details>
5455
5462
  *
5456
5463
  * <details>
5457
- * <summary><code>sanitization</code></summary>
5464
+ * <summary><code>sanitized_html</code></summary>
5458
5465
  *
5459
- * Checks for the presence of malicious cose in HTML fields: content is valid if no dangerous code is present.
5466
+ * Checks for the presence of malicious code in HTML fields: content is valid if no dangerous code is present.
5460
5467
  *
5461
5468
  * | Parameter | Type | Required | Description |
5462
5469
  * | ---------------------------- | --------- | -------- | ------------------------------------------------------------ |
@@ -5683,10 +5690,10 @@ export type ItemTypeReorderFieldsAndFieldsetsJobSchema = {
5683
5690
  *
5684
5691
  * Built-in editor for _seo_ fields.
5685
5692
  *
5686
- * | Parameter | Type | Required | Description |
5687
- * | ---------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5688
- * | `fields` | `Array<String>` | ✅ | Specify which fields of the SEO input should be visible to editors. Valid values: `"title"`, `"description"`, `"image"`, `"no_index"`, `"twitter_card"` |
5689
- * | `previews` | `Array<String>` | ✅ | Specify which previews should be visible to editors. Valid values: `"google_search"`, `"twitter"`, `"slack"`, `"whatsapp"`, `"telegram"`, `"facebook"`, `"linkedin"` |
5693
+ * | Parameter | Type | Required | Description |
5694
+ * | ---------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5695
+ * | `fields` | `Array<String>` | ✅ | Specify which fields of the SEO input should be visible to editors. Valid values: `"title"`, `"description"`, `"image"`, `"no_index"`, `"twitter_card"` |
5696
+ * | `previews` | `Array<String>` | ✅ | Specify which previews should be visible to editors. Valid values: `"google"`, `"twitter"`, `"slack"`, `"whatsapp"`, `"telegram"`, `"facebook"`, `"linkedin"` |
5690
5697
  *
5691
5698
  * </details>
5692
5699
  *
@@ -5883,7 +5890,6 @@ export type FieldAttributesStableShell = {
5883
5890
  };
5884
5891
  [k: string]: unknown;
5885
5892
  }[];
5886
- [k: string]: unknown;
5887
5893
  };
5888
5894
  /**
5889
5895
  * Ordering index
@@ -6013,7 +6019,6 @@ export type FieldCreateSchemaStableShell = {
6013
6019
  };
6014
6020
  [k: string]: unknown;
6015
6021
  }[];
6016
- [k: string]: unknown;
6017
6022
  };
6018
6023
  /**
6019
6024
  * Ordering index
@@ -6150,7 +6155,6 @@ export type FieldUpdateSchemaStableShell = {
6150
6155
  };
6151
6156
  [k: string]: unknown;
6152
6157
  }[];
6153
- [k: string]: unknown;
6154
6158
  };
6155
6159
  /**
6156
6160
  * Ordering index
@@ -272,6 +272,39 @@ export default class ItemType extends BaseResource {
272
272
  });
273
273
  }
274
274
 
275
+ /**
276
+ * List models referencing a model or block model
277
+ *
278
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/referencing
279
+ *
280
+ * @throws {ApiError}
281
+ * @throws {TimeoutError}
282
+ */
283
+ referencing(itemTypeId: string | ApiTypes.ItemTypeData) {
284
+ return this.rawReferencing(Utils.toId(itemTypeId)).then((body) =>
285
+ Utils.deserializeResponseBody<ApiTypes.ItemTypeReferencingTargetSchema>(
286
+ body,
287
+ ),
288
+ );
289
+ }
290
+
291
+ /**
292
+ * List models referencing a model or block model
293
+ *
294
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/referencing
295
+ *
296
+ * @throws {ApiError}
297
+ * @throws {TimeoutError}
298
+ */
299
+ rawReferencing(
300
+ itemTypeId: string,
301
+ ): Promise<RawApiTypes.ItemTypeReferencingTargetSchema> {
302
+ return this.client.request<RawApiTypes.ItemTypeReferencingTargetSchema>({
303
+ method: 'GET',
304
+ url: `/item-types/${itemTypeId}/referencing`,
305
+ });
306
+ }
307
+
275
308
  /**
276
309
  * Reorders a set of fields and fieldsets within the model
277
310
  *