@datocms/cma-client 5.1.9 → 5.1.10
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/cjs/generated/Client.js +1 -1
- package/dist/cjs/generated/Client.js.map +1 -1
- package/dist/cjs/generated/resources/Item.js.map +1 -1
- package/dist/cjs/generated/resources/Upload.js.map +1 -1
- package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/fieldTypes/single_block.d.ts +2 -2
- package/dist/esm/generated/Client.js +1 -1
- package/dist/esm/generated/Client.js.map +1 -1
- package/dist/esm/generated/resources/Item.d.ts +46 -28
- package/dist/esm/generated/resources/Item.js.map +1 -1
- package/dist/esm/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/esm/generated/resources/Upload.d.ts +10 -4
- package/dist/esm/generated/resources/Upload.js.map +1 -1
- package/dist/esm/utilities/buildBlockRecord.d.ts +3 -3
- package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/utilities/itemDefinition.d.ts +9 -9
- package/dist/types/fieldTypes/single_block.d.ts +2 -2
- package/dist/types/generated/resources/Item.d.ts +46 -28
- package/dist/types/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/types/generated/resources/Upload.d.ts +10 -4
- package/dist/types/utilities/buildBlockRecord.d.ts +3 -3
- package/dist/types/utilities/itemDefinition.d.ts +9 -9
- package/package.json +3 -3
- package/src/fieldTypes/single_block.ts +2 -2
- package/src/generated/Client.ts +1 -1
- package/src/generated/resources/Item.ts +129 -92
- package/src/generated/resources/ScheduledPublication.ts +6 -6
- package/src/generated/resources/ScheduledUnpublishing.ts +6 -6
- package/src/generated/resources/Upload.ts +36 -10
- package/src/utilities/buildBlockRecord.ts +8 -16
- package/src/utilities/itemDefinition.ts +23 -32
|
@@ -63,24 +63,24 @@ type LocalizeIfNeeded<T extends FieldDefinition, Value, Locales extends string>
|
|
|
63
63
|
/** Standard mapping */
|
|
64
64
|
type FieldDefinitionToFieldValue<T extends FieldDefinition, Locales extends string> = LocalizeIfNeeded<T, FieldTypeToValue[T['type']], Locales>;
|
|
65
65
|
/** AsRequest mapping (block fields become generic over allowed blocks) */
|
|
66
|
-
type FieldDefinitionToFieldValueAsRequest<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueAsRequest<
|
|
66
|
+
type FieldDefinitionToFieldValueAsRequest<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueAsRequest<ToItemDefinitionAsRequest<B>>, Locales> : T extends SingleBlockFieldDefinition<infer B> ? LocalizeIfNeeded<T, SingleBlockFieldValueAsRequest<ToItemDefinitionAsRequest<B>>, Locales> : T extends StructuredTextFieldDefinition<infer B, infer I> ? LocalizeIfNeeded<T, StructuredTextFieldValueAsRequest<T extends {
|
|
67
67
|
blocks: any;
|
|
68
|
-
} ?
|
|
68
|
+
} ? ToItemDefinitionAsRequest<B> : never, T extends {
|
|
69
69
|
inline_blocks: any;
|
|
70
|
-
} ?
|
|
71
|
-
type FieldDefinitionToFieldValueWithNestedBlocks<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueWithNestedBlocks<
|
|
70
|
+
} ? ToItemDefinitionAsRequest<I> : never>, Locales> : LocalizeIfNeeded<T, FieldTypeToValue[T['type']], Locales>;
|
|
71
|
+
type FieldDefinitionToFieldValueWithNestedBlocks<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueWithNestedBlocks<ToItemDefinitionWithNestedBlocks<B>>, Locales> : T extends SingleBlockFieldDefinition<infer B> ? LocalizeIfNeeded<T, SingleBlockFieldValueWithNestedBlocks<ToItemDefinitionWithNestedBlocks<B>>, Locales> : T extends StructuredTextFieldDefinition<infer B, infer I> ? LocalizeIfNeeded<T, StructuredTextFieldValueWithNestedBlocks<T extends {
|
|
72
72
|
blocks: any;
|
|
73
|
-
} ?
|
|
73
|
+
} ? ToItemDefinitionWithNestedBlocks<B> : never, T extends {
|
|
74
74
|
inline_blocks: any;
|
|
75
|
-
} ?
|
|
75
|
+
} ? ToItemDefinitionWithNestedBlocks<I> : never>, Locales> : LocalizeIfNeeded<T, FieldTypeToValue[T['type']], Locales>;
|
|
76
76
|
/** Transformers */
|
|
77
|
-
export type
|
|
77
|
+
export type ToItemDefinition<T extends ItemTypeDefinition<any, any, any>> = T extends ItemTypeDefinition<infer Settings, infer ItemTypeId, infer Fields> ? keyof Fields extends never ? ItemDefinition<ItemTypeId> : ItemDefinition<ItemTypeId, {
|
|
78
78
|
[K in keyof Fields]: Fields[K] extends FieldDefinition ? FieldDefinitionToFieldValue<Fields[K], Settings['locales']> : never;
|
|
79
79
|
}> : never;
|
|
80
|
-
export type
|
|
80
|
+
export type ToItemDefinitionAsRequest<T extends ItemTypeDefinition<any, any, any>> = T extends ItemTypeDefinition<infer Settings, infer ItemTypeId, infer Fields> ? keyof Fields extends never ? ItemDefinition<ItemTypeId> : ItemDefinition<ItemTypeId, Partial<{
|
|
81
81
|
[K in keyof Fields]: Fields[K] extends FieldDefinition ? FieldDefinitionToFieldValueAsRequest<Fields[K], Settings['locales']> : never;
|
|
82
82
|
}>> : never;
|
|
83
|
-
export type
|
|
83
|
+
export type ToItemDefinitionWithNestedBlocks<T extends ItemTypeDefinition<any, any, any>> = T extends ItemTypeDefinition<infer Settings, infer ItemTypeId, infer Fields> ? keyof Fields extends never ? ItemDefinition<ItemTypeId> : ItemDefinition<ItemTypeId, {
|
|
84
84
|
[K in keyof Fields]: Fields[K] extends FieldDefinition ? FieldDefinitionToFieldValueWithNestedBlocks<Fields[K], Settings['locales']> : never;
|
|
85
85
|
}> : never;
|
|
86
86
|
export type UnknownField = Record<string, unknown>;
|
|
@@ -90,12 +90,12 @@ export type SingleBlockFieldValueWithNestedBlocks<D extends ItemDefinition = Ite
|
|
|
90
90
|
* Validates if the input is a valid item (either block or record) ID
|
|
91
91
|
*/
|
|
92
92
|
export declare function isItemId(input: unknown): input is string;
|
|
93
|
-
export type ItemWithOptionalIdAndMeta<D extends ItemDefinition = ItemDefinition> = OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'
|
|
93
|
+
export type ItemWithOptionalIdAndMeta<D extends ItemDefinition = ItemDefinition> = D extends any ? OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'> : never;
|
|
94
94
|
/**
|
|
95
95
|
* Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
|
|
96
96
|
*/
|
|
97
97
|
export declare function isItemWithOptionalIdAndMeta<D extends ItemDefinition = ItemDefinition>(block: unknown): block is ItemWithOptionalIdAndMeta<D>;
|
|
98
|
-
export type ItemWithOptionalMeta<D extends ItemDefinition = ItemDefinition> = OptionalFields<RawApiTypes.Item<D>, 'meta'
|
|
98
|
+
export type ItemWithOptionalMeta<D extends ItemDefinition = ItemDefinition> = D extends any ? OptionalFields<RawApiTypes.Item<D>, 'meta'> : never;
|
|
99
99
|
/**
|
|
100
100
|
* Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
|
|
101
101
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Utils from '@datocms/rest-client-utils';
|
|
2
2
|
import BaseResource from '../../BaseResource';
|
|
3
|
-
import type { ItemTypeDefinition,
|
|
3
|
+
import type { ItemTypeDefinition, ToItemDefinition, ToItemDefinitionAsRequest, ToItemDefinitionWithNestedBlocks } from '../../utilities/itemDefinition';
|
|
4
4
|
import type * as ApiTypes from '../ApiTypes';
|
|
5
5
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
6
6
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
@@ -16,10 +16,10 @@ export default class Item extends BaseResource {
|
|
|
16
16
|
*/
|
|
17
17
|
list<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams: ApiTypes.ItemInstancesHrefSchema & {
|
|
18
18
|
nested: true;
|
|
19
|
-
}): Promise<ApiTypes.ItemInstancesTargetSchema<
|
|
19
|
+
}): Promise<ApiTypes.ItemInstancesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
20
20
|
list<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: ApiTypes.ItemInstancesHrefSchema & {
|
|
21
21
|
nested?: false | undefined;
|
|
22
|
-
}): Promise<ApiTypes.ItemInstancesTargetSchema<
|
|
22
|
+
}): Promise<ApiTypes.ItemInstancesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
23
23
|
/**
|
|
24
24
|
* List all records
|
|
25
25
|
*
|
|
@@ -28,7 +28,13 @@ export default class Item extends BaseResource {
|
|
|
28
28
|
* @throws {ApiError}
|
|
29
29
|
* @throws {TimeoutError}
|
|
30
30
|
*/
|
|
31
|
-
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams
|
|
31
|
+
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams: RawApiTypes.ItemInstancesHrefSchema & {
|
|
32
|
+
nested: true;
|
|
33
|
+
}): Promise<RawApiTypes.ItemInstancesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
34
|
+
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: RawApiTypes.ItemInstancesHrefSchema & {
|
|
35
|
+
nested?: false | undefined;
|
|
36
|
+
}): Promise<RawApiTypes.ItemInstancesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
37
|
+
rawList<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: RawApiTypes.ItemInstancesHrefSchema): Promise<RawApiTypes.ItemInstancesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
32
38
|
/**
|
|
33
39
|
* Async iterator to auto-paginate over elements returned by list()
|
|
34
40
|
*
|
|
@@ -37,7 +43,7 @@ export default class Item extends BaseResource {
|
|
|
37
43
|
* @throws {ApiError}
|
|
38
44
|
* @throws {TimeoutError}
|
|
39
45
|
*/
|
|
40
|
-
listPagedIterator<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: Utils.OmitFromKnownKeys<ApiTypes.ItemInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
46
|
+
listPagedIterator<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: Utils.OmitFromKnownKeys<ApiTypes.ItemInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinitionWithNestedBlocks<NoInfer<D>>>, void, unknown>;
|
|
41
47
|
/**
|
|
42
48
|
* Async iterator to auto-paginate over elements returned by rawList()
|
|
43
49
|
*
|
|
@@ -46,7 +52,7 @@ export default class Item extends BaseResource {
|
|
|
46
52
|
* @throws {ApiError}
|
|
47
53
|
* @throws {TimeoutError}
|
|
48
54
|
*/
|
|
49
|
-
rawListPagedIterator<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: Utils.OmitFromKnownKeys<RawApiTypes.ItemInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<Awaited<RawApiTypes.ApplyItemDefinitionToSchema<RawApiTypes.RawItem,
|
|
55
|
+
rawListPagedIterator<D extends ItemTypeDefinition = ItemTypeDefinition>(queryParams?: Utils.OmitFromKnownKeys<RawApiTypes.ItemInstancesHrefSchema, 'page'>, iteratorOptions?: Utils.IteratorOptions): AsyncGenerator<Awaited<RawApiTypes.ApplyItemDefinitionToSchema<RawApiTypes.RawItem, ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>, void, unknown>;
|
|
50
56
|
/**
|
|
51
57
|
* Validates an existing record field
|
|
52
58
|
*
|
|
@@ -57,7 +63,7 @@ export default class Item extends BaseResource {
|
|
|
57
63
|
*
|
|
58
64
|
* @deprecated This API call is to be considered private and might change without notice
|
|
59
65
|
*/
|
|
60
|
-
validateExisting<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body: ApiTypes.ItemValidateExistingSchema<
|
|
66
|
+
validateExisting<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body: ApiTypes.ItemValidateExistingSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<void>;
|
|
61
67
|
/**
|
|
62
68
|
* Validates an existing record field
|
|
63
69
|
*
|
|
@@ -68,7 +74,7 @@ export default class Item extends BaseResource {
|
|
|
68
74
|
*
|
|
69
75
|
* @deprecated This API call is to be considered private and might change without notice
|
|
70
76
|
*/
|
|
71
|
-
rawValidateExisting<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body: RawApiTypes.ItemValidateExistingSchema<
|
|
77
|
+
rawValidateExisting<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body: RawApiTypes.ItemValidateExistingSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<void>;
|
|
72
78
|
/**
|
|
73
79
|
* Validates a record field
|
|
74
80
|
*
|
|
@@ -79,7 +85,7 @@ export default class Item extends BaseResource {
|
|
|
79
85
|
*
|
|
80
86
|
* @deprecated This API call is to be considered private and might change without notice
|
|
81
87
|
*/
|
|
82
|
-
validateNew<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemValidateNewSchema<
|
|
88
|
+
validateNew<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemValidateNewSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<void>;
|
|
83
89
|
/**
|
|
84
90
|
* Validates a record field
|
|
85
91
|
*
|
|
@@ -90,7 +96,7 @@ export default class Item extends BaseResource {
|
|
|
90
96
|
*
|
|
91
97
|
* @deprecated This API call is to be considered private and might change without notice
|
|
92
98
|
*/
|
|
93
|
-
rawValidateNew<D extends ItemTypeDefinition = ItemTypeDefinition>(body: RawApiTypes.ItemValidateNewSchema<
|
|
99
|
+
rawValidateNew<D extends ItemTypeDefinition = ItemTypeDefinition>(body: RawApiTypes.ItemValidateNewSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<void>;
|
|
94
100
|
/**
|
|
95
101
|
* Create a new record
|
|
96
102
|
*
|
|
@@ -99,7 +105,7 @@ export default class Item extends BaseResource {
|
|
|
99
105
|
* @throws {ApiError}
|
|
100
106
|
* @throws {TimeoutError}
|
|
101
107
|
*/
|
|
102
|
-
create<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemCreateSchema<
|
|
108
|
+
create<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemCreateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
103
109
|
/**
|
|
104
110
|
* Create a new record
|
|
105
111
|
*
|
|
@@ -108,7 +114,7 @@ export default class Item extends BaseResource {
|
|
|
108
114
|
* @throws {ApiError}
|
|
109
115
|
* @throws {TimeoutError}
|
|
110
116
|
*/
|
|
111
|
-
rawCreate<D extends ItemTypeDefinition = ItemTypeDefinition>(body: RawApiTypes.ItemCreateSchema<
|
|
117
|
+
rawCreate<D extends ItemTypeDefinition = ItemTypeDefinition>(body: RawApiTypes.ItemCreateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<RawApiTypes.ItemCreateTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
112
118
|
/**
|
|
113
119
|
* Duplicate a record
|
|
114
120
|
*
|
|
@@ -117,7 +123,7 @@ export default class Item extends BaseResource {
|
|
|
117
123
|
* @throws {ApiError}
|
|
118
124
|
* @throws {TimeoutError}
|
|
119
125
|
*/
|
|
120
|
-
duplicate<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
126
|
+
duplicate<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
121
127
|
/**
|
|
122
128
|
* Duplicate a record
|
|
123
129
|
*
|
|
@@ -126,7 +132,7 @@ export default class Item extends BaseResource {
|
|
|
126
132
|
* @throws {ApiError}
|
|
127
133
|
* @throws {TimeoutError}
|
|
128
134
|
*/
|
|
129
|
-
rawDuplicate<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ItemDuplicateJobSchema<
|
|
135
|
+
rawDuplicate<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ItemDuplicateJobSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
130
136
|
/**
|
|
131
137
|
* Update a record
|
|
132
138
|
*
|
|
@@ -135,7 +141,7 @@ export default class Item extends BaseResource {
|
|
|
135
141
|
* @throws {ApiError}
|
|
136
142
|
* @throws {TimeoutError}
|
|
137
143
|
*/
|
|
138
|
-
update<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body: ApiTypes.ItemUpdateSchema<
|
|
144
|
+
update<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body: ApiTypes.ItemUpdateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
139
145
|
/**
|
|
140
146
|
* Update a record
|
|
141
147
|
*
|
|
@@ -144,7 +150,7 @@ export default class Item extends BaseResource {
|
|
|
144
150
|
* @throws {ApiError}
|
|
145
151
|
* @throws {TimeoutError}
|
|
146
152
|
*/
|
|
147
|
-
rawUpdate<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body: RawApiTypes.ItemUpdateSchema<
|
|
153
|
+
rawUpdate<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body: RawApiTypes.ItemUpdateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): Promise<RawApiTypes.ItemUpdateTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
148
154
|
/**
|
|
149
155
|
* Referenced records
|
|
150
156
|
*
|
|
@@ -155,10 +161,10 @@ export default class Item extends BaseResource {
|
|
|
155
161
|
*/
|
|
156
162
|
references<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, queryParams: ApiTypes.ItemReferencesHrefSchema & {
|
|
157
163
|
nested: true;
|
|
158
|
-
}): Promise<ApiTypes.ItemReferencesTargetSchema<
|
|
164
|
+
}): Promise<ApiTypes.ItemReferencesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
159
165
|
references<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, queryParams?: ApiTypes.ItemReferencesHrefSchema & {
|
|
160
166
|
nested?: false | undefined;
|
|
161
|
-
}): Promise<ApiTypes.ItemReferencesTargetSchema<
|
|
167
|
+
}): Promise<ApiTypes.ItemReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
162
168
|
/**
|
|
163
169
|
* Referenced records
|
|
164
170
|
*
|
|
@@ -167,7 +173,13 @@ export default class Item extends BaseResource {
|
|
|
167
173
|
* @throws {ApiError}
|
|
168
174
|
* @throws {TimeoutError}
|
|
169
175
|
*/
|
|
170
|
-
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams
|
|
176
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams: RawApiTypes.ItemReferencesHrefSchema & {
|
|
177
|
+
nested: true;
|
|
178
|
+
}): Promise<RawApiTypes.ItemReferencesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
179
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams?: RawApiTypes.ItemReferencesHrefSchema & {
|
|
180
|
+
nested?: false | undefined;
|
|
181
|
+
}): Promise<RawApiTypes.ItemReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
182
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams?: RawApiTypes.ItemReferencesHrefSchema): Promise<RawApiTypes.ItemReferencesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
171
183
|
/**
|
|
172
184
|
* Retrieve a record
|
|
173
185
|
*
|
|
@@ -178,10 +190,10 @@ export default class Item extends BaseResource {
|
|
|
178
190
|
*/
|
|
179
191
|
find<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, queryParams: ApiTypes.ItemSelfHrefSchema & {
|
|
180
192
|
nested: true;
|
|
181
|
-
}): Promise<ApiTypes.ItemSelfTargetSchema<
|
|
193
|
+
}): Promise<ApiTypes.ItemSelfTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
182
194
|
find<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, queryParams?: ApiTypes.ItemSelfHrefSchema & {
|
|
183
195
|
nested?: false | undefined;
|
|
184
|
-
}): Promise<ApiTypes.ItemSelfTargetSchema<
|
|
196
|
+
}): Promise<ApiTypes.ItemSelfTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
185
197
|
/**
|
|
186
198
|
* Retrieve a record
|
|
187
199
|
*
|
|
@@ -190,7 +202,13 @@ export default class Item extends BaseResource {
|
|
|
190
202
|
* @throws {ApiError}
|
|
191
203
|
* @throws {TimeoutError}
|
|
192
204
|
*/
|
|
193
|
-
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams
|
|
205
|
+
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams: RawApiTypes.ItemSelfHrefSchema & {
|
|
206
|
+
nested: true;
|
|
207
|
+
}): Promise<RawApiTypes.ItemSelfTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
208
|
+
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams?: RawApiTypes.ItemSelfHrefSchema & {
|
|
209
|
+
nested?: false | undefined;
|
|
210
|
+
}): Promise<RawApiTypes.ItemSelfTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
211
|
+
rawFind<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, queryParams?: RawApiTypes.ItemSelfHrefSchema): Promise<RawApiTypes.ItemSelfTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
194
212
|
/**
|
|
195
213
|
* Retrieve information regarding changes between current and published versions of the record
|
|
196
214
|
*
|
|
@@ -221,7 +239,7 @@ export default class Item extends BaseResource {
|
|
|
221
239
|
* @throws {ApiError}
|
|
222
240
|
* @throws {TimeoutError}
|
|
223
241
|
*/
|
|
224
|
-
destroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
242
|
+
destroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
225
243
|
/**
|
|
226
244
|
* Delete a record
|
|
227
245
|
*
|
|
@@ -230,7 +248,7 @@ export default class Item extends BaseResource {
|
|
|
230
248
|
* @throws {ApiError}
|
|
231
249
|
* @throws {TimeoutError}
|
|
232
250
|
*/
|
|
233
|
-
rawDestroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ItemDestroyJobSchema<
|
|
251
|
+
rawDestroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ItemDestroyJobSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
234
252
|
/**
|
|
235
253
|
* Publish a record
|
|
236
254
|
*
|
|
@@ -239,7 +257,7 @@ export default class Item extends BaseResource {
|
|
|
239
257
|
* @throws {ApiError}
|
|
240
258
|
* @throws {TimeoutError}
|
|
241
259
|
*/
|
|
242
|
-
publish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body?: ApiTypes.ItemPublishSchema, queryParams?: ApiTypes.ItemPublishHrefSchema): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
260
|
+
publish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body?: ApiTypes.ItemPublishSchema, queryParams?: ApiTypes.ItemPublishHrefSchema): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
243
261
|
/**
|
|
244
262
|
* Publish a record
|
|
245
263
|
*
|
|
@@ -248,7 +266,7 @@ export default class Item extends BaseResource {
|
|
|
248
266
|
* @throws {ApiError}
|
|
249
267
|
* @throws {TimeoutError}
|
|
250
268
|
*/
|
|
251
|
-
rawPublish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body?: RawApiTypes.ItemPublishSchema, queryParams?: RawApiTypes.ItemPublishHrefSchema): Promise<RawApiTypes.ItemPublishTargetSchema<
|
|
269
|
+
rawPublish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body?: RawApiTypes.ItemPublishSchema, queryParams?: RawApiTypes.ItemPublishHrefSchema): Promise<RawApiTypes.ItemPublishTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
252
270
|
/**
|
|
253
271
|
* Unpublish a record
|
|
254
272
|
*
|
|
@@ -257,7 +275,7 @@ export default class Item extends BaseResource {
|
|
|
257
275
|
* @throws {ApiError}
|
|
258
276
|
* @throws {TimeoutError}
|
|
259
277
|
*/
|
|
260
|
-
unpublish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body?: ApiTypes.ItemUnpublishSchema, queryParams?: ApiTypes.ItemUnpublishHrefSchema): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
278
|
+
unpublish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData, body?: ApiTypes.ItemUnpublishSchema, queryParams?: ApiTypes.ItemUnpublishHrefSchema): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
261
279
|
/**
|
|
262
280
|
* Unpublish a record
|
|
263
281
|
*
|
|
@@ -266,7 +284,7 @@ export default class Item extends BaseResource {
|
|
|
266
284
|
* @throws {ApiError}
|
|
267
285
|
* @throws {TimeoutError}
|
|
268
286
|
*/
|
|
269
|
-
rawUnpublish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body?: RawApiTypes.ItemUnpublishSchema, queryParams?: RawApiTypes.ItemUnpublishHrefSchema): Promise<RawApiTypes.ItemUnpublishTargetSchema<
|
|
287
|
+
rawUnpublish<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string, body?: RawApiTypes.ItemUnpublishSchema, queryParams?: RawApiTypes.ItemUnpublishHrefSchema): Promise<RawApiTypes.ItemUnpublishTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
270
288
|
/**
|
|
271
289
|
* Publish items in bulk
|
|
272
290
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseResource from '../../BaseResource';
|
|
2
|
-
import type { ItemTypeDefinition,
|
|
2
|
+
import type { ItemTypeDefinition, ToItemDefinition, ToItemDefinitionWithNestedBlocks } from '../../utilities/itemDefinition';
|
|
3
3
|
import type * as ApiTypes from '../ApiTypes';
|
|
4
4
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
5
5
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
@@ -31,7 +31,7 @@ export default class ScheduledPublication extends BaseResource {
|
|
|
31
31
|
* @throws {ApiError}
|
|
32
32
|
* @throws {TimeoutError}
|
|
33
33
|
*/
|
|
34
|
-
destroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
34
|
+
destroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
35
35
|
/**
|
|
36
36
|
* Delete a scheduled publication
|
|
37
37
|
*
|
|
@@ -40,6 +40,6 @@ export default class ScheduledPublication extends BaseResource {
|
|
|
40
40
|
* @throws {ApiError}
|
|
41
41
|
* @throws {TimeoutError}
|
|
42
42
|
*/
|
|
43
|
-
rawDestroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ScheduledPublicationDestroyTargetSchema<
|
|
43
|
+
rawDestroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ScheduledPublicationDestroyTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
44
44
|
}
|
|
45
45
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseResource from '../../BaseResource';
|
|
2
|
-
import type { ItemTypeDefinition,
|
|
2
|
+
import type { ItemTypeDefinition, ToItemDefinition, ToItemDefinitionWithNestedBlocks } from '../../utilities/itemDefinition';
|
|
3
3
|
import type * as ApiTypes from '../ApiTypes';
|
|
4
4
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
5
5
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
@@ -31,7 +31,7 @@ export default class ScheduledUnpublishing extends BaseResource {
|
|
|
31
31
|
* @throws {ApiError}
|
|
32
32
|
* @throws {TimeoutError}
|
|
33
33
|
*/
|
|
34
|
-
destroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem,
|
|
34
|
+
destroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string | ApiTypes.ItemData): Promise<ApiTypes.ApplyItemDefinitionToSchema<ApiTypes.RawItem, ToItemDefinition<NoInfer<D>>>>;
|
|
35
35
|
/**
|
|
36
36
|
* Delete a scheduled unpublishing
|
|
37
37
|
*
|
|
@@ -40,6 +40,6 @@ export default class ScheduledUnpublishing extends BaseResource {
|
|
|
40
40
|
* @throws {ApiError}
|
|
41
41
|
* @throws {TimeoutError}
|
|
42
42
|
*/
|
|
43
|
-
rawDestroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ScheduledUnpublishingDestroyTargetSchema<
|
|
43
|
+
rawDestroy<D extends ItemTypeDefinition = ItemTypeDefinition>(itemId: string): Promise<RawApiTypes.ScheduledUnpublishingDestroyTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
44
44
|
}
|
|
45
45
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Utils from '@datocms/rest-client-utils';
|
|
2
2
|
import BaseResource from '../../BaseResource';
|
|
3
|
-
import type { ItemTypeDefinition,
|
|
3
|
+
import type { ItemTypeDefinition, ToItemDefinition, ToItemDefinitionWithNestedBlocks } from '../../utilities/itemDefinition';
|
|
4
4
|
import type * as ApiTypes from '../ApiTypes';
|
|
5
5
|
import type * as RawApiTypes from '../RawApiTypes';
|
|
6
6
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
@@ -124,10 +124,10 @@ export default class Upload extends BaseResource {
|
|
|
124
124
|
*/
|
|
125
125
|
references<D extends ItemTypeDefinition = ItemTypeDefinition>(uploadId: string | ApiTypes.UploadData, queryParams: ApiTypes.UploadReferencesHrefSchema & {
|
|
126
126
|
nested: true;
|
|
127
|
-
}): Promise<ApiTypes.UploadReferencesTargetSchema<
|
|
127
|
+
}): Promise<ApiTypes.UploadReferencesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
128
128
|
references<D extends ItemTypeDefinition = ItemTypeDefinition>(uploadId: string | ApiTypes.UploadData, queryParams?: ApiTypes.UploadReferencesHrefSchema & {
|
|
129
129
|
nested?: false | undefined;
|
|
130
|
-
}): Promise<ApiTypes.UploadReferencesTargetSchema<
|
|
130
|
+
}): Promise<ApiTypes.UploadReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
131
131
|
/**
|
|
132
132
|
* Referenced records
|
|
133
133
|
*
|
|
@@ -136,7 +136,13 @@ export default class Upload extends BaseResource {
|
|
|
136
136
|
* @throws {ApiError}
|
|
137
137
|
* @throws {TimeoutError}
|
|
138
138
|
*/
|
|
139
|
-
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(uploadId: string, queryParams
|
|
139
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(uploadId: string, queryParams: RawApiTypes.UploadReferencesHrefSchema & {
|
|
140
|
+
nested: true;
|
|
141
|
+
}): Promise<RawApiTypes.UploadReferencesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
142
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(uploadId: string, queryParams?: RawApiTypes.UploadReferencesHrefSchema & {
|
|
143
|
+
nested?: false | undefined;
|
|
144
|
+
}): Promise<RawApiTypes.UploadReferencesTargetSchema<ToItemDefinition<NoInfer<D>>>>;
|
|
145
|
+
rawReferences<D extends ItemTypeDefinition = ItemTypeDefinition>(uploadId: string, queryParams?: RawApiTypes.UploadReferencesHrefSchema): Promise<RawApiTypes.UploadReferencesTargetSchema<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>>;
|
|
140
146
|
/**
|
|
141
147
|
* Add tags to assets in bulk
|
|
142
148
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ItemWithOptionalIdAndMeta, NewBlockInARequest } from '../fieldTypes';
|
|
2
2
|
import type * as ApiTypes from '../generated/ApiTypes';
|
|
3
|
-
import type { ItemTypeDefinition,
|
|
3
|
+
import type { ItemTypeDefinition, ToItemDefinitionAsRequest, ToItemDefinitionWithNestedBlocks } from './itemDefinition';
|
|
4
4
|
import type { SchemaRepository } from './schemaRepository';
|
|
5
5
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
6
|
-
export declare function buildBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemUpdateSchema<
|
|
7
|
-
export declare function duplicateBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(existingBlock: ItemWithOptionalIdAndMeta<
|
|
6
|
+
export declare function buildBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemUpdateSchema<ToItemDefinitionAsRequest<NoInfer<D>>>): NewBlockInARequest<ToItemDefinitionAsRequest<NoInfer<D>>>;
|
|
7
|
+
export declare function duplicateBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(existingBlock: ItemWithOptionalIdAndMeta<ToItemDefinitionWithNestedBlocks<NoInfer<D>>>, schemaRepository: SchemaRepository): Promise<NewBlockInARequest<ToItemDefinitionAsRequest<NoInfer<D>>>>;
|
|
8
8
|
export {};
|
|
@@ -63,24 +63,24 @@ type LocalizeIfNeeded<T extends FieldDefinition, Value, Locales extends string>
|
|
|
63
63
|
/** Standard mapping */
|
|
64
64
|
type FieldDefinitionToFieldValue<T extends FieldDefinition, Locales extends string> = LocalizeIfNeeded<T, FieldTypeToValue[T['type']], Locales>;
|
|
65
65
|
/** AsRequest mapping (block fields become generic over allowed blocks) */
|
|
66
|
-
type FieldDefinitionToFieldValueAsRequest<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueAsRequest<
|
|
66
|
+
type FieldDefinitionToFieldValueAsRequest<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueAsRequest<ToItemDefinitionAsRequest<B>>, Locales> : T extends SingleBlockFieldDefinition<infer B> ? LocalizeIfNeeded<T, SingleBlockFieldValueAsRequest<ToItemDefinitionAsRequest<B>>, Locales> : T extends StructuredTextFieldDefinition<infer B, infer I> ? LocalizeIfNeeded<T, StructuredTextFieldValueAsRequest<T extends {
|
|
67
67
|
blocks: any;
|
|
68
|
-
} ?
|
|
68
|
+
} ? ToItemDefinitionAsRequest<B> : never, T extends {
|
|
69
69
|
inline_blocks: any;
|
|
70
|
-
} ?
|
|
71
|
-
type FieldDefinitionToFieldValueWithNestedBlocks<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueWithNestedBlocks<
|
|
70
|
+
} ? ToItemDefinitionAsRequest<I> : never>, Locales> : LocalizeIfNeeded<T, FieldTypeToValue[T['type']], Locales>;
|
|
71
|
+
type FieldDefinitionToFieldValueWithNestedBlocks<T extends FieldDefinition, Locales extends string> = T extends RichTextFieldDefinition<infer B> ? LocalizeIfNeeded<T, RichTextFieldValueWithNestedBlocks<ToItemDefinitionWithNestedBlocks<B>>, Locales> : T extends SingleBlockFieldDefinition<infer B> ? LocalizeIfNeeded<T, SingleBlockFieldValueWithNestedBlocks<ToItemDefinitionWithNestedBlocks<B>>, Locales> : T extends StructuredTextFieldDefinition<infer B, infer I> ? LocalizeIfNeeded<T, StructuredTextFieldValueWithNestedBlocks<T extends {
|
|
72
72
|
blocks: any;
|
|
73
|
-
} ?
|
|
73
|
+
} ? ToItemDefinitionWithNestedBlocks<B> : never, T extends {
|
|
74
74
|
inline_blocks: any;
|
|
75
|
-
} ?
|
|
75
|
+
} ? ToItemDefinitionWithNestedBlocks<I> : never>, Locales> : LocalizeIfNeeded<T, FieldTypeToValue[T['type']], Locales>;
|
|
76
76
|
/** Transformers */
|
|
77
|
-
export type
|
|
77
|
+
export type ToItemDefinition<T extends ItemTypeDefinition<any, any, any>> = T extends ItemTypeDefinition<infer Settings, infer ItemTypeId, infer Fields> ? keyof Fields extends never ? ItemDefinition<ItemTypeId> : ItemDefinition<ItemTypeId, {
|
|
78
78
|
[K in keyof Fields]: Fields[K] extends FieldDefinition ? FieldDefinitionToFieldValue<Fields[K], Settings['locales']> : never;
|
|
79
79
|
}> : never;
|
|
80
|
-
export type
|
|
80
|
+
export type ToItemDefinitionAsRequest<T extends ItemTypeDefinition<any, any, any>> = T extends ItemTypeDefinition<infer Settings, infer ItemTypeId, infer Fields> ? keyof Fields extends never ? ItemDefinition<ItemTypeId> : ItemDefinition<ItemTypeId, Partial<{
|
|
81
81
|
[K in keyof Fields]: Fields[K] extends FieldDefinition ? FieldDefinitionToFieldValueAsRequest<Fields[K], Settings['locales']> : never;
|
|
82
82
|
}>> : never;
|
|
83
|
-
export type
|
|
83
|
+
export type ToItemDefinitionWithNestedBlocks<T extends ItemTypeDefinition<any, any, any>> = T extends ItemTypeDefinition<infer Settings, infer ItemTypeId, infer Fields> ? keyof Fields extends never ? ItemDefinition<ItemTypeId> : ItemDefinition<ItemTypeId, {
|
|
84
84
|
[K in keyof Fields]: Fields[K] extends FieldDefinition ? FieldDefinitionToFieldValueWithNestedBlocks<Fields[K], Settings['locales']> : never;
|
|
85
85
|
}> : never;
|
|
86
86
|
export type UnknownField = Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datocms/cma-client",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.10",
|
|
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.1.
|
|
45
|
+
"@datocms/dashboard-client": "^5.1.10",
|
|
46
46
|
"@types/uuid": "^9.0.7"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "3f5298b6aa1592b9425d92bd2e4ca0ad052a0bf0"
|
|
49
49
|
}
|
|
@@ -120,7 +120,7 @@ export function isItemId(input: unknown): input is string {
|
|
|
120
120
|
|
|
121
121
|
export type ItemWithOptionalIdAndMeta<
|
|
122
122
|
D extends ItemDefinition = ItemDefinition,
|
|
123
|
-
> = OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'
|
|
123
|
+
> = D extends any ? OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'> : never;
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
|
|
@@ -137,7 +137,7 @@ export function isItemWithOptionalIdAndMeta<
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
export type ItemWithOptionalMeta<D extends ItemDefinition = ItemDefinition> =
|
|
140
|
-
OptionalFields<RawApiTypes.Item<D>, 'meta'
|
|
140
|
+
D extends any ? OptionalFields<RawApiTypes.Item<D>, 'meta'> : never;
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
|
package/src/generated/Client.ts
CHANGED
|
@@ -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.
|
|
150
|
+
userAgent: '@datocms/cma-client v5.1.10',
|
|
151
151
|
baseUrl: this.baseUrl,
|
|
152
152
|
preCallStack: new Error().stack,
|
|
153
153
|
extraHeaders: {
|