@datocms/cma-client 5.2.0-alpha.4 → 5.2.0-alpha.5

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.
Files changed (31) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/generated/Client.js +1 -1
  3. package/dist/cjs/generated/resources/ItemType.js +12 -12
  4. package/dist/cjs/generated/resources/SearchIndex.js +10 -22
  5. package/dist/cjs/generated/resources/SearchIndex.js.map +1 -1
  6. package/dist/cjs/utilities/schemaRepository.js +131 -0
  7. package/dist/cjs/utilities/schemaRepository.js.map +1 -1
  8. package/dist/esm/generated/ApiTypes.d.ts +161 -158
  9. package/dist/esm/generated/Client.js +1 -1
  10. package/dist/esm/generated/RawApiTypes.d.ts +148 -141
  11. package/dist/esm/generated/resources/ItemType.d.ts +12 -12
  12. package/dist/esm/generated/resources/ItemType.js +12 -12
  13. package/dist/esm/generated/resources/SearchIndex.d.ts +8 -8
  14. package/dist/esm/generated/resources/SearchIndex.js +10 -22
  15. package/dist/esm/generated/resources/SearchIndex.js.map +1 -1
  16. package/dist/esm/utilities/schemaRepository.d.ts +42 -2
  17. package/dist/esm/utilities/schemaRepository.js +132 -1
  18. package/dist/esm/utilities/schemaRepository.js.map +1 -1
  19. package/dist/types/generated/ApiTypes.d.ts +161 -158
  20. package/dist/types/generated/RawApiTypes.d.ts +148 -141
  21. package/dist/types/generated/resources/ItemType.d.ts +12 -12
  22. package/dist/types/generated/resources/SearchIndex.d.ts +8 -8
  23. package/dist/types/utilities/schemaRepository.d.ts +42 -2
  24. package/package.json +3 -3
  25. package/resources.json +10 -12
  26. package/src/generated/ApiTypes.ts +161 -158
  27. package/src/generated/Client.ts +1 -1
  28. package/src/generated/RawApiTypes.ts +148 -141
  29. package/src/generated/resources/ItemType.ts +12 -12
  30. package/src/generated/resources/SearchIndex.ts +10 -22
  31. package/src/utilities/schemaRepository.ts +167 -9
@@ -4,7 +4,7 @@ import type * as RawApiTypes from '../RawApiTypes';
4
4
  export default class ItemType extends BaseResource {
5
5
  static readonly TYPE: "item_type";
6
6
  /**
7
- * Create a new model
7
+ * Create a new model/block model
8
8
  *
9
9
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/create
10
10
  *
@@ -13,7 +13,7 @@ export default class ItemType extends BaseResource {
13
13
  */
14
14
  create(body: ApiTypes.ItemTypeCreateSchema, queryParams?: ApiTypes.ItemTypeCreateHrefSchema): Promise<ApiTypes.ItemType>;
15
15
  /**
16
- * Create a new model
16
+ * Create a new model/block model
17
17
  *
18
18
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/create
19
19
  *
@@ -22,7 +22,7 @@ export default class ItemType extends BaseResource {
22
22
  */
23
23
  rawCreate(body: RawApiTypes.ItemTypeCreateSchema, queryParams?: RawApiTypes.ItemTypeCreateHrefSchema): Promise<RawApiTypes.ItemTypeCreateTargetSchema>;
24
24
  /**
25
- * Update a model
25
+ * Update a model/block model
26
26
  *
27
27
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/update
28
28
  *
@@ -31,7 +31,7 @@ export default class ItemType extends BaseResource {
31
31
  */
32
32
  update(itemTypeId: string | ApiTypes.ItemTypeData, body: ApiTypes.ItemTypeUpdateSchema): Promise<ApiTypes.ItemType>;
33
33
  /**
34
- * Update a model
34
+ * Update a model/block model
35
35
  *
36
36
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/update
37
37
  *
@@ -40,7 +40,7 @@ export default class ItemType extends BaseResource {
40
40
  */
41
41
  rawUpdate(itemTypeId: string, body: RawApiTypes.ItemTypeUpdateSchema): Promise<RawApiTypes.ItemTypeUpdateJobSchema>;
42
42
  /**
43
- * List all models
43
+ * List all models/block models
44
44
  *
45
45
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/instances
46
46
  *
@@ -49,7 +49,7 @@ export default class ItemType extends BaseResource {
49
49
  */
50
50
  list(): Promise<ApiTypes.ItemTypeInstancesTargetSchema>;
51
51
  /**
52
- * List all models
52
+ * List all models/block models
53
53
  *
54
54
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/instances
55
55
  *
@@ -58,7 +58,7 @@ export default class ItemType extends BaseResource {
58
58
  */
59
59
  rawList(): Promise<RawApiTypes.ItemTypeInstancesTargetSchema>;
60
60
  /**
61
- * Retrieve a model
61
+ * Retrieve a model/block model
62
62
  *
63
63
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/self
64
64
  *
@@ -67,7 +67,7 @@ export default class ItemType extends BaseResource {
67
67
  */
68
68
  find(itemTypeId: string | ApiTypes.ItemTypeData): Promise<ApiTypes.ItemType>;
69
69
  /**
70
- * Retrieve a model
70
+ * Retrieve a model/block model
71
71
  *
72
72
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/self
73
73
  *
@@ -76,7 +76,7 @@ export default class ItemType extends BaseResource {
76
76
  */
77
77
  rawFind(itemTypeId: string): Promise<RawApiTypes.ItemTypeSelfTargetSchema>;
78
78
  /**
79
- * Duplicate model
79
+ * Duplicate model/block model
80
80
  *
81
81
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/duplicate
82
82
  *
@@ -85,7 +85,7 @@ export default class ItemType extends BaseResource {
85
85
  */
86
86
  duplicate(itemTypeId: string | ApiTypes.ItemTypeData): Promise<ApiTypes.ItemType>;
87
87
  /**
88
- * Duplicate model
88
+ * Duplicate model/block model
89
89
  *
90
90
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/duplicate
91
91
  *
@@ -94,7 +94,7 @@ export default class ItemType extends BaseResource {
94
94
  */
95
95
  rawDuplicate(itemTypeId: string): Promise<RawApiTypes.ItemTypeDuplicateTargetSchema>;
96
96
  /**
97
- * Delete a model
97
+ * Delete a model/block model
98
98
  *
99
99
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/destroy
100
100
  *
@@ -103,7 +103,7 @@ export default class ItemType extends BaseResource {
103
103
  */
104
104
  destroy(itemTypeId: string | ApiTypes.ItemTypeData, queryParams?: ApiTypes.ItemTypeDestroyHrefSchema): Promise<ApiTypes.ItemType>;
105
105
  /**
106
- * Delete a model
106
+ * Delete a model/block model
107
107
  *
108
108
  * Read more: https://www.datocms.com/docs/content-management-api/resources/item-type/destroy
109
109
  *
@@ -40,7 +40,7 @@ export default class SearchIndex extends BaseResource {
40
40
  */
41
41
  rawFind(searchIndexId: string): Promise<RawApiTypes.SearchIndexSelfTargetSchema>;
42
42
  /**
43
- * Create search index
43
+ * Create a search index
44
44
  *
45
45
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/create
46
46
  *
@@ -49,7 +49,7 @@ export default class SearchIndex extends BaseResource {
49
49
  */
50
50
  create(body: ApiTypes.SearchIndexCreateSchema): Promise<ApiTypes.SearchIndex>;
51
51
  /**
52
- * Create search index
52
+ * Create a search index
53
53
  *
54
54
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/create
55
55
  *
@@ -58,7 +58,7 @@ export default class SearchIndex extends BaseResource {
58
58
  */
59
59
  rawCreate(body: RawApiTypes.SearchIndexCreateSchema): Promise<RawApiTypes.SearchIndexCreateTargetSchema>;
60
60
  /**
61
- * Update search index
61
+ * Update a search index
62
62
  *
63
63
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/update
64
64
  *
@@ -67,7 +67,7 @@ export default class SearchIndex extends BaseResource {
67
67
  */
68
68
  update(searchIndexId: string | ApiTypes.SearchIndexData, body: ApiTypes.SearchIndexUpdateSchema): Promise<ApiTypes.SearchIndex>;
69
69
  /**
70
- * Update search index
70
+ * Update a search index
71
71
  *
72
72
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/update
73
73
  *
@@ -76,7 +76,7 @@ export default class SearchIndex extends BaseResource {
76
76
  */
77
77
  rawUpdate(searchIndexId: string, body: RawApiTypes.SearchIndexUpdateSchema): Promise<RawApiTypes.SearchIndexUpdateTargetSchema>;
78
78
  /**
79
- * Trigger a site search indexing
79
+ * Trigger the indexing process
80
80
  *
81
81
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/trigger
82
82
  *
@@ -85,7 +85,7 @@ export default class SearchIndex extends BaseResource {
85
85
  */
86
86
  trigger(searchIndexId: string | ApiTypes.SearchIndexData): Promise<void>;
87
87
  /**
88
- * Trigger a site search indexing
88
+ * Trigger the indexing process
89
89
  *
90
90
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/trigger
91
91
  *
@@ -94,7 +94,7 @@ export default class SearchIndex extends BaseResource {
94
94
  */
95
95
  rawTrigger(searchIndexId: string): Promise<void>;
96
96
  /**
97
- * Abort a site search spidering and mark it as failed
97
+ * Abort a the current indexing process and mark it as failed
98
98
  *
99
99
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/abort
100
100
  *
@@ -103,7 +103,7 @@ export default class SearchIndex extends BaseResource {
103
103
  */
104
104
  abort(searchIndexId: string | ApiTypes.SearchIndexData): Promise<void>;
105
105
  /**
106
- * Abort a site search spidering and mark it as failed
106
+ * Abort a the current indexing process and mark it as failed
107
107
  *
108
108
  * Read more: https://www.datocms.com/docs/content-management-api/resources/search-index/abort
109
109
  *
@@ -194,7 +194,7 @@ export declare class SchemaRepository {
194
194
  * @param itemType - The item type to get fields for
195
195
  * @returns Promise that resolves to an array of fields
196
196
  */
197
- getRawItemTypeFields(itemType: RawApiTypes.ItemType): Promise<RawApiTypes.Field[]>;
197
+ getRawItemTypeFields(itemType: ApiTypes.ItemType | RawApiTypes.ItemType): Promise<RawApiTypes.Field[]>;
198
198
  /**
199
199
  * Gets all fieldsets for a given item type.
200
200
  * Fieldsets are cached after the first request for performance.
@@ -208,7 +208,7 @@ export declare class SchemaRepository {
208
208
  * @param itemType - The item type to get fieldsets for
209
209
  * @returns Promise that resolves to an array of fieldsets
210
210
  */
211
- getRawItemTypeFieldsets(itemType: RawApiTypes.ItemType): Promise<RawApiTypes.Fieldset[]>;
211
+ getRawItemTypeFieldsets(itemType: ApiTypes.ItemType | RawApiTypes.ItemType): Promise<RawApiTypes.Fieldset[]>;
212
212
  /**
213
213
  * Loads and caches all plugins from the DatoCMS API.
214
214
  * This method is called lazily and caches the result for subsequent calls.
@@ -285,5 +285,45 @@ export declare class SchemaRepository {
285
285
  * @returns Promise that resolves to array of models that embed these blocks
286
286
  */
287
287
  getModelsEmbeddingBlocks(blocks: Array<ApiTypes.ItemType | RawApiTypes.ItemType>): Promise<Array<ApiTypes.ItemType>>;
288
+ /**
289
+ * Gets all block models that are directly or indirectly nested within the given item types.
290
+ * This method recursively traverses the schema to find all blocks that are nested
291
+ * within the provided item types, either directly through block fields or indirectly through
292
+ * other nested block models.
293
+ *
294
+ * @param itemTypes - Array of item types to find nested blocks for
295
+ * @returns Promise that resolves to array of all block models nested in these item types
296
+ */
297
+ getRawNestedBlocks(itemTypes: Array<ApiTypes.ItemType | RawApiTypes.ItemType>): Promise<Array<RawApiTypes.ItemType>>;
298
+ /**
299
+ * Gets all block models that are directly or indirectly nested within the given item types.
300
+ * This method recursively traverses the schema to find all blocks that are nested
301
+ * within the provided item types, either directly through block fields or indirectly through
302
+ * other nested block models.
303
+ *
304
+ * @param itemTypes - Array of item types to find nested blocks for
305
+ * @returns Promise that resolves to array of all block models nested in these item types
306
+ */
307
+ getNestedBlocks(itemTypes: Array<ApiTypes.ItemType | RawApiTypes.ItemType>): Promise<Array<ApiTypes.ItemType>>;
308
+ /**
309
+ * Gets all models that are directly or indirectly nested/referenced within the given item types.
310
+ * This method recursively traverses the schema to find all models that are referenced
311
+ * by the provided item types through link fields, either directly or indirectly through
312
+ * other referenced blocks.
313
+ *
314
+ * @param itemTypes - Array of item types to find nested models for
315
+ * @returns Promise that resolves to array of all models nested in these item types
316
+ */
317
+ getRawNestedModels(itemTypes: Array<ApiTypes.ItemType | RawApiTypes.ItemType>): Promise<Array<RawApiTypes.ItemType>>;
318
+ /**
319
+ * Gets all models that are directly or indirectly nested/referenced within the given item types.
320
+ * This method recursively traverses the schema to find all models that are referenced
321
+ * by the provided item types through link fields, either directly or indirectly through
322
+ * other referenced blocks.
323
+ *
324
+ * @param itemTypes - Array of item types to find nested models for
325
+ * @returns Promise that resolves to array of all models nested in these item types
326
+ */
327
+ getNestedModels(itemTypes: Array<ApiTypes.ItemType | RawApiTypes.ItemType>): Promise<Array<ApiTypes.ItemType>>;
288
328
  }
289
329
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datocms/cma-client",
3
- "version": "5.2.0-alpha.4",
3
+ "version": "5.2.0-alpha.5",
4
4
  "description": "JS client for DatoCMS REST Content Management API",
5
5
  "keywords": [
6
6
  "datocms",
@@ -42,8 +42,8 @@
42
42
  "uuid": "^9.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@datocms/dashboard-client": "^5.2.0-alpha.4",
45
+ "@datocms/dashboard-client": "^5.2.0-alpha.5",
46
46
  "@types/uuid": "^9.0.7"
47
47
  },
48
- "gitHead": "319efa216e04297104dc7278ef514c7a8ab10355"
48
+ "gitHead": "9f4282b559889e0e27011246d4ebe42d9c0f8cb8"
49
49
  }
package/resources.json CHANGED
@@ -959,7 +959,7 @@
959
959
  "rel": "create",
960
960
  "urlTemplate": "/item-types",
961
961
  "method": "POST",
962
- "comment": "Create a new model",
962
+ "comment": "Create a new model/block model",
963
963
  "urlPlaceholders": [],
964
964
  "requestBodyType": "ItemTypeCreateSchema",
965
965
  "optionalRequestBody": false,
@@ -1006,7 +1006,7 @@
1006
1006
  "rel": "update",
1007
1007
  "urlTemplate": "/item-types/${itemTypeId}",
1008
1008
  "method": "PUT",
1009
- "comment": "Update a model",
1009
+ "comment": "Update a model/block model",
1010
1010
  "urlPlaceholders": [
1011
1011
  {
1012
1012
  "variableName": "itemTypeId",
@@ -1065,7 +1065,7 @@
1065
1065
  "rel": "instances",
1066
1066
  "urlTemplate": "/item-types",
1067
1067
  "method": "GET",
1068
- "comment": "List all models",
1068
+ "comment": "List all models/block models",
1069
1069
  "urlPlaceholders": [],
1070
1070
  "optionalRequestBody": false,
1071
1071
  "queryParamsRequired": false,
@@ -1081,7 +1081,7 @@
1081
1081
  "rel": "self",
1082
1082
  "urlTemplate": "/item-types/${itemTypeId}",
1083
1083
  "method": "GET",
1084
- "comment": "Retrieve a model",
1084
+ "comment": "Retrieve a model/block model",
1085
1085
  "urlPlaceholders": [
1086
1086
  {
1087
1087
  "variableName": "itemTypeId",
@@ -1108,7 +1108,7 @@
1108
1108
  "rel": "duplicate",
1109
1109
  "urlTemplate": "/item-types/${itemTypeId}/duplicate",
1110
1110
  "method": "POST",
1111
- "comment": "Duplicate model",
1111
+ "comment": "Duplicate model/block model",
1112
1112
  "urlPlaceholders": [
1113
1113
  {
1114
1114
  "variableName": "itemTypeId",
@@ -1135,7 +1135,7 @@
1135
1135
  "rel": "destroy",
1136
1136
  "urlTemplate": "/item-types/${itemTypeId}",
1137
1137
  "method": "DELETE",
1138
- "comment": "Delete a model",
1138
+ "comment": "Delete a model/block model",
1139
1139
  "urlPlaceholders": [
1140
1140
  {
1141
1141
  "variableName": "itemTypeId",
@@ -4053,7 +4053,7 @@
4053
4053
  "rel": "create",
4054
4054
  "urlTemplate": "/search-indexes",
4055
4055
  "method": "POST",
4056
- "comment": "Create search index",
4056
+ "comment": "Create a search index",
4057
4057
  "urlPlaceholders": [],
4058
4058
  "requestBodyType": "SearchIndexCreateSchema",
4059
4059
  "optionalRequestBody": false,
@@ -4062,7 +4062,6 @@
4062
4062
  "attributes": [
4063
4063
  "name",
4064
4064
  "enabled",
4065
- "build_trigger_indexing_enabled",
4066
4065
  "frontend_url",
4067
4066
  "user_agent_suffix"
4068
4067
  ],
@@ -4081,7 +4080,7 @@
4081
4080
  "rel": "update",
4082
4081
  "urlTemplate": "/search-indexes/${searchIndexId}",
4083
4082
  "method": "PUT",
4084
- "comment": "Update search index",
4083
+ "comment": "Update a search index",
4085
4084
  "urlPlaceholders": [
4086
4085
  {
4087
4086
  "variableName": "searchIndexId",
@@ -4102,7 +4101,6 @@
4102
4101
  "attributes": [
4103
4102
  "name",
4104
4103
  "enabled",
4105
- "build_trigger_indexing_enabled",
4106
4104
  "frontend_url",
4107
4105
  "user_agent_suffix"
4108
4106
  ],
@@ -4121,7 +4119,7 @@
4121
4119
  "rel": "trigger",
4122
4120
  "urlTemplate": "/search-indexes/${searchIndexId}/trigger",
4123
4121
  "method": "POST",
4124
- "comment": "Trigger a site search indexing",
4122
+ "comment": "Trigger the indexing process",
4125
4123
  "urlPlaceholders": [
4126
4124
  {
4127
4125
  "variableName": "searchIndexId",
@@ -4147,7 +4145,7 @@
4147
4145
  "rel": "abort",
4148
4146
  "urlTemplate": "/search-indexes/${searchIndexId}/abort",
4149
4147
  "method": "DELETE",
4150
- "comment": "Abort a site search spidering and mark it as failed",
4148
+ "comment": "Abort a the current indexing process and mark it as failed",
4151
4149
  "urlPlaceholders": [
4152
4150
  {
4153
4151
  "variableName": "searchIndexId",