@datocms/cma-client 5.1.2 → 5.1.4

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 (205) hide show
  1. package/dist/cjs/fieldTypes/boolean.js +7 -1
  2. package/dist/cjs/fieldTypes/boolean.js.map +1 -1
  3. package/dist/cjs/fieldTypes/color.js +7 -1
  4. package/dist/cjs/fieldTypes/color.js.map +1 -1
  5. package/dist/cjs/fieldTypes/date.js +7 -1
  6. package/dist/cjs/fieldTypes/date.js.map +1 -1
  7. package/dist/cjs/fieldTypes/date_time.js +7 -1
  8. package/dist/cjs/fieldTypes/date_time.js.map +1 -1
  9. package/dist/cjs/fieldTypes/file.js +7 -1
  10. package/dist/cjs/fieldTypes/file.js.map +1 -1
  11. package/dist/cjs/fieldTypes/float.js +7 -1
  12. package/dist/cjs/fieldTypes/float.js.map +1 -1
  13. package/dist/cjs/fieldTypes/gallery.js +7 -1
  14. package/dist/cjs/fieldTypes/gallery.js.map +1 -1
  15. package/dist/cjs/fieldTypes/integer.js +7 -1
  16. package/dist/cjs/fieldTypes/integer.js.map +1 -1
  17. package/dist/cjs/fieldTypes/json.js +7 -1
  18. package/dist/cjs/fieldTypes/json.js.map +1 -1
  19. package/dist/cjs/fieldTypes/lat_lon.js +9 -3
  20. package/dist/cjs/fieldTypes/lat_lon.js.map +1 -1
  21. package/dist/cjs/fieldTypes/link.js +7 -1
  22. package/dist/cjs/fieldTypes/link.js.map +1 -1
  23. package/dist/cjs/fieldTypes/links.js +7 -1
  24. package/dist/cjs/fieldTypes/links.js.map +1 -1
  25. package/dist/cjs/fieldTypes/rich_text.js +19 -1
  26. package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
  27. package/dist/cjs/fieldTypes/seo.js +7 -1
  28. package/dist/cjs/fieldTypes/seo.js.map +1 -1
  29. package/dist/cjs/fieldTypes/single_block.js +19 -1
  30. package/dist/cjs/fieldTypes/single_block.js.map +1 -1
  31. package/dist/cjs/fieldTypes/slug.js +8 -2
  32. package/dist/cjs/fieldTypes/slug.js.map +1 -1
  33. package/dist/cjs/fieldTypes/string.js +7 -1
  34. package/dist/cjs/fieldTypes/string.js.map +1 -1
  35. package/dist/cjs/fieldTypes/structured_text.js +19 -1
  36. package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
  37. package/dist/cjs/fieldTypes/text.js +7 -1
  38. package/dist/cjs/fieldTypes/text.js.map +1 -1
  39. package/dist/cjs/fieldTypes/video.js +7 -1
  40. package/dist/cjs/fieldTypes/video.js.map +1 -1
  41. package/dist/cjs/generated/Client.js +1 -1
  42. package/dist/cjs/generated/resources/Item.js +41 -23
  43. package/dist/cjs/generated/resources/Item.js.map +1 -1
  44. package/dist/cjs/generated/resources/ScheduledPublication.js +4 -2
  45. package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
  46. package/dist/cjs/generated/resources/ScheduledUnpublishing.js +4 -2
  47. package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
  48. package/dist/cjs/generated/resources/Upload.js +4 -2
  49. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  50. package/dist/cjs/index.js +2 -0
  51. package/dist/cjs/index.js.map +1 -1
  52. package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
  53. package/dist/cjs/utilities/itemDefinition.js +3 -0
  54. package/dist/cjs/utilities/itemDefinition.js.map +1 -0
  55. package/dist/esm/fieldTypes/boolean.d.ts +2 -0
  56. package/dist/esm/fieldTypes/boolean.js +5 -0
  57. package/dist/esm/fieldTypes/boolean.js.map +1 -1
  58. package/dist/esm/fieldTypes/color.d.ts +2 -0
  59. package/dist/esm/fieldTypes/color.js +5 -0
  60. package/dist/esm/fieldTypes/color.js.map +1 -1
  61. package/dist/esm/fieldTypes/date.d.ts +2 -0
  62. package/dist/esm/fieldTypes/date.js +5 -0
  63. package/dist/esm/fieldTypes/date.js.map +1 -1
  64. package/dist/esm/fieldTypes/date_time.d.ts +2 -0
  65. package/dist/esm/fieldTypes/date_time.js +5 -0
  66. package/dist/esm/fieldTypes/date_time.js.map +1 -1
  67. package/dist/esm/fieldTypes/file.d.ts +2 -0
  68. package/dist/esm/fieldTypes/file.js +5 -0
  69. package/dist/esm/fieldTypes/file.js.map +1 -1
  70. package/dist/esm/fieldTypes/float.d.ts +2 -0
  71. package/dist/esm/fieldTypes/float.js +5 -0
  72. package/dist/esm/fieldTypes/float.js.map +1 -1
  73. package/dist/esm/fieldTypes/gallery.d.ts +2 -0
  74. package/dist/esm/fieldTypes/gallery.js +5 -0
  75. package/dist/esm/fieldTypes/gallery.js.map +1 -1
  76. package/dist/esm/fieldTypes/integer.d.ts +2 -0
  77. package/dist/esm/fieldTypes/integer.js +5 -0
  78. package/dist/esm/fieldTypes/integer.js.map +1 -1
  79. package/dist/esm/fieldTypes/json.d.ts +2 -0
  80. package/dist/esm/fieldTypes/json.js +5 -0
  81. package/dist/esm/fieldTypes/json.js.map +1 -1
  82. package/dist/esm/fieldTypes/lat_lon.d.ts +6 -4
  83. package/dist/esm/fieldTypes/lat_lon.js +6 -1
  84. package/dist/esm/fieldTypes/lat_lon.js.map +1 -1
  85. package/dist/esm/fieldTypes/link.d.ts +2 -0
  86. package/dist/esm/fieldTypes/link.js +5 -0
  87. package/dist/esm/fieldTypes/link.js.map +1 -1
  88. package/dist/esm/fieldTypes/links.d.ts +2 -0
  89. package/dist/esm/fieldTypes/links.js +5 -0
  90. package/dist/esm/fieldTypes/links.js.map +1 -1
  91. package/dist/esm/fieldTypes/rich_text.d.ts +13 -8
  92. package/dist/esm/fieldTypes/rich_text.js +15 -0
  93. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  94. package/dist/esm/fieldTypes/seo.d.ts +2 -0
  95. package/dist/esm/fieldTypes/seo.js +5 -0
  96. package/dist/esm/fieldTypes/seo.js.map +1 -1
  97. package/dist/esm/fieldTypes/single_block.d.ts +17 -12
  98. package/dist/esm/fieldTypes/single_block.js +15 -0
  99. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  100. package/dist/esm/fieldTypes/slug.d.ts +2 -0
  101. package/dist/esm/fieldTypes/slug.js +6 -1
  102. package/dist/esm/fieldTypes/slug.js.map +1 -1
  103. package/dist/esm/fieldTypes/string.d.ts +2 -0
  104. package/dist/esm/fieldTypes/string.js +5 -0
  105. package/dist/esm/fieldTypes/string.js.map +1 -1
  106. package/dist/esm/fieldTypes/structured_text.d.ts +15 -10
  107. package/dist/esm/fieldTypes/structured_text.js +15 -0
  108. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  109. package/dist/esm/fieldTypes/text.d.ts +2 -0
  110. package/dist/esm/fieldTypes/text.js +5 -0
  111. package/dist/esm/fieldTypes/text.js.map +1 -1
  112. package/dist/esm/fieldTypes/video.d.ts +2 -0
  113. package/dist/esm/fieldTypes/video.js +5 -0
  114. package/dist/esm/fieldTypes/video.js.map +1 -1
  115. package/dist/esm/generated/ApiTypes.d.ts +67 -62
  116. package/dist/esm/generated/Client.js +1 -1
  117. package/dist/esm/generated/RawApiTypes.d.ts +116 -121
  118. package/dist/esm/generated/resources/Field.d.ts +700 -700
  119. package/dist/esm/generated/resources/Item.d.ts +42 -24
  120. package/dist/esm/generated/resources/Item.js +41 -23
  121. package/dist/esm/generated/resources/Item.js.map +1 -1
  122. package/dist/esm/generated/resources/ItemVersion.d.ts +1 -1
  123. package/dist/esm/generated/resources/ScheduledPublication.d.ts +5 -2
  124. package/dist/esm/generated/resources/ScheduledPublication.js +4 -2
  125. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  126. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +5 -2
  127. package/dist/esm/generated/resources/ScheduledUnpublishing.js +4 -2
  128. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  129. package/dist/esm/generated/resources/Upload.d.ts +10 -2
  130. package/dist/esm/generated/resources/Upload.js +4 -2
  131. package/dist/esm/generated/resources/Upload.js.map +1 -1
  132. package/dist/esm/index.d.ts +2 -0
  133. package/dist/esm/index.js +2 -0
  134. package/dist/esm/index.js.map +1 -1
  135. package/dist/esm/utilities/buildBlockRecord.d.ts +5 -31
  136. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  137. package/dist/esm/utilities/fieldValue.d.ts +1 -1
  138. package/dist/esm/utilities/itemDefinition.d.ts +74 -0
  139. package/dist/esm/utilities/itemDefinition.js +2 -0
  140. package/dist/esm/utilities/itemDefinition.js.map +1 -0
  141. package/dist/types/fieldTypes/boolean.d.ts +2 -0
  142. package/dist/types/fieldTypes/color.d.ts +2 -0
  143. package/dist/types/fieldTypes/date.d.ts +2 -0
  144. package/dist/types/fieldTypes/date_time.d.ts +2 -0
  145. package/dist/types/fieldTypes/file.d.ts +2 -0
  146. package/dist/types/fieldTypes/float.d.ts +2 -0
  147. package/dist/types/fieldTypes/gallery.d.ts +2 -0
  148. package/dist/types/fieldTypes/integer.d.ts +2 -0
  149. package/dist/types/fieldTypes/json.d.ts +2 -0
  150. package/dist/types/fieldTypes/lat_lon.d.ts +6 -4
  151. package/dist/types/fieldTypes/link.d.ts +2 -0
  152. package/dist/types/fieldTypes/links.d.ts +2 -0
  153. package/dist/types/fieldTypes/rich_text.d.ts +13 -8
  154. package/dist/types/fieldTypes/seo.d.ts +2 -0
  155. package/dist/types/fieldTypes/single_block.d.ts +17 -12
  156. package/dist/types/fieldTypes/slug.d.ts +2 -0
  157. package/dist/types/fieldTypes/string.d.ts +2 -0
  158. package/dist/types/fieldTypes/structured_text.d.ts +15 -10
  159. package/dist/types/fieldTypes/text.d.ts +2 -0
  160. package/dist/types/fieldTypes/video.d.ts +2 -0
  161. package/dist/types/generated/ApiTypes.d.ts +67 -62
  162. package/dist/types/generated/RawApiTypes.d.ts +116 -121
  163. package/dist/types/generated/resources/Field.d.ts +700 -700
  164. package/dist/types/generated/resources/Item.d.ts +42 -24
  165. package/dist/types/generated/resources/ItemVersion.d.ts +1 -1
  166. package/dist/types/generated/resources/ScheduledPublication.d.ts +5 -2
  167. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +5 -2
  168. package/dist/types/generated/resources/Upload.d.ts +10 -2
  169. package/dist/types/index.d.ts +2 -0
  170. package/dist/types/utilities/buildBlockRecord.d.ts +5 -31
  171. package/dist/types/utilities/fieldValue.d.ts +1 -1
  172. package/dist/types/utilities/itemDefinition.d.ts +74 -0
  173. package/package.json +5 -5
  174. package/resources.json +564 -0
  175. package/src/fieldTypes/boolean.ts +11 -0
  176. package/src/fieldTypes/color.ts +11 -0
  177. package/src/fieldTypes/date.ts +11 -0
  178. package/src/fieldTypes/date_time.ts +11 -0
  179. package/src/fieldTypes/file.ts +11 -0
  180. package/src/fieldTypes/float.ts +11 -0
  181. package/src/fieldTypes/gallery.ts +11 -0
  182. package/src/fieldTypes/integer.ts +11 -0
  183. package/src/fieldTypes/json.ts +11 -0
  184. package/src/fieldTypes/lat_lon.ts +15 -6
  185. package/src/fieldTypes/link.ts +11 -0
  186. package/src/fieldTypes/links.ts +11 -0
  187. package/src/fieldTypes/rich_text.ts +51 -12
  188. package/src/fieldTypes/seo.ts +11 -0
  189. package/src/fieldTypes/single_block.ts +69 -28
  190. package/src/fieldTypes/slug.ts +12 -1
  191. package/src/fieldTypes/string.ts +11 -0
  192. package/src/fieldTypes/structured_text.ts +87 -19
  193. package/src/fieldTypes/text.ts +11 -0
  194. package/src/fieldTypes/video.ts +11 -0
  195. package/src/generated/ApiTypes.ts +110 -70
  196. package/src/generated/Client.ts +1 -1
  197. package/src/generated/RawApiTypes.ts +160 -138
  198. package/src/generated/resources/Item.ts +360 -108
  199. package/src/generated/resources/ScheduledPublication.ts +31 -11
  200. package/src/generated/resources/ScheduledUnpublishing.ts +31 -11
  201. package/src/generated/resources/Upload.ts +54 -12
  202. package/src/index.ts +2 -0
  203. package/src/utilities/buildBlockRecord.ts +19 -3
  204. package/src/utilities/fieldValue.ts +1 -1
  205. package/src/utilities/itemDefinition.ts +229 -0
@@ -9,6 +9,8 @@ import {
9
9
  isInlineBlock,
10
10
  } from 'datocms-structured-text-utils';
11
11
  import type * as RawApiTypes from '../generated/RawApiTypes';
12
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
13
+ import type { ItemDefinition } from '../utilities/itemDefinition';
12
14
  import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
13
15
  import {
14
16
  type BlockItemInARequest,
@@ -55,17 +57,26 @@ import type { StructuredTextLinksValidator } from './validators/structured_text_
55
57
  /**
56
58
  * Variant of 'block' structured text node for API requests
57
59
  */
58
- export type BlockAsRequest = Block<BlockItemInARequest>;
60
+ export type BlockAsRequest<D extends ItemDefinition = ItemDefinition> = Block<
61
+ BlockItemInARequest<D>
62
+ >;
59
63
 
60
64
  /**
61
65
  * Variant of 'inlineBlock' structured text node for API requests
62
66
  */
63
- export type InlineBlockAsRequest = InlineBlock<BlockItemInARequest>;
67
+ export type InlineBlockAsRequest<D extends ItemDefinition = ItemDefinition> =
68
+ InlineBlock<BlockItemInARequest<D>>;
64
69
 
65
70
  /**
66
71
  * Variant of Structured Text document for API requests
67
72
  */
68
- export type DocumentAsRequest = Document<BlockItemInARequest>;
73
+ export type DocumentAsRequest<
74
+ BlockItemDefinition extends ItemDefinition = ItemDefinition,
75
+ InlineBlockItemDefinition extends ItemDefinition = ItemDefinition,
76
+ > = Document<
77
+ BlockItemInARequest<BlockItemDefinition>,
78
+ BlockItemInARequest<InlineBlockItemDefinition>
79
+ >;
69
80
 
70
81
  /**
71
82
  * =============================================================================
@@ -80,17 +91,26 @@ export type DocumentAsRequest = Document<BlockItemInARequest>;
80
91
  /**
81
92
  * Variant of 'block' structured text node for ?nested=true API responses
82
93
  */
83
- export type BlockWithNestedBlocks = Block<RawApiTypes.Item>;
94
+ export type BlockWithNestedBlocks<D extends ItemDefinition = ItemDefinition> =
95
+ Block<RawApiTypes.Item<D>>;
84
96
 
85
97
  /**
86
98
  * Variant of 'inlineBlock' structured text node for ?nested=true API responses
87
99
  */
88
- export type InlineBlockWithNestedBlocks = InlineBlock<RawApiTypes.Item>;
100
+ export type InlineBlockWithNestedBlocks<
101
+ D extends ItemDefinition = ItemDefinition,
102
+ > = InlineBlock<RawApiTypes.Item<D>>;
89
103
 
90
104
  /**
91
105
  * Variant of Structured Text document for ?nested=true API responses
92
106
  */
93
- export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
107
+ export type DocumentWithNestedBlocks<
108
+ BlockItemDefinition extends ItemDefinition = ItemDefinition,
109
+ InlineBlockItemDefinition extends ItemDefinition = ItemDefinition,
110
+ > = Document<
111
+ RawApiTypes.Item<BlockItemDefinition>,
112
+ RawApiTypes.Item<InlineBlockItemDefinition>
113
+ >;
94
114
 
95
115
  /**
96
116
  * =============================================================================
@@ -103,21 +123,29 @@ export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
103
123
  * Can be null (empty field) or a document with blocks as string IDs
104
124
  */
105
125
  export type StructuredTextFieldValue = Document | null;
106
- export type StructuredTextFieldValueAsRequest = DocumentAsRequest | null;
107
- export type StructuredTextFieldValueWithNestedBlocks =
108
- DocumentWithNestedBlocks | null;
126
+ export type StructuredTextFieldValueAsRequest<
127
+ BlockItemDefinition extends ItemDefinition = ItemDefinition,
128
+ InlineBlockItemDefinition extends ItemDefinition = ItemDefinition,
129
+ > = DocumentAsRequest<BlockItemDefinition, InlineBlockItemDefinition> | null;
130
+ export type StructuredTextFieldValueWithNestedBlocks<
131
+ BlockItemDefinition extends ItemDefinition = ItemDefinition,
132
+ InlineBlockItemDefinition extends ItemDefinition = ItemDefinition,
133
+ > = DocumentWithNestedBlocks<
134
+ BlockItemDefinition,
135
+ InlineBlockItemDefinition
136
+ > | null;
109
137
 
110
138
  /**
111
139
  * Utility function to validate all block/inlineBlock nodes in a structured text document tree.
112
140
  * Calls the provided callback for each block/inlineBlock node found and returns true only if all pass.
113
141
  */
114
- function validateAllBlockNodes<T>(
115
- node: Node<T>,
116
- callback: (node: Block<T> | InlineBlock<T>) => boolean,
142
+ function validateAllBlockNodes<B, I>(
143
+ node: Node<B, I>,
144
+ callback: (node: Block<B> | InlineBlock<I>) => boolean,
117
145
  ): boolean {
118
146
  return everyNode(node, (currentNode) => {
119
147
  // If this is a block or inlineBlock node, validate it with the callback
120
- if (isBlock<T>(currentNode) || isInlineBlock<T>(currentNode)) {
148
+ if (isBlock(currentNode) || isInlineBlock(currentNode)) {
121
149
  return callback(currentNode);
122
150
  }
123
151
  // For all other node types, they're valid by default
@@ -134,7 +162,7 @@ export function isStructuredTextFieldValue(
134
162
  ): value is StructuredTextFieldValue {
135
163
  if (value === null) return true;
136
164
 
137
- if (!isDocument<unknown>(value)) {
165
+ if (!isDocument<unknown, unknown>(value)) {
138
166
  return false;
139
167
  }
140
168
 
@@ -144,13 +172,29 @@ export function isStructuredTextFieldValue(
144
172
  });
145
173
  }
146
174
 
175
+ export function isLocalizedStructuredTextFieldValue(
176
+ value: unknown,
177
+ ): value is LocalizedFieldValue<StructuredTextFieldValue> {
178
+ return (
179
+ typeof value === 'object' &&
180
+ value !== null &&
181
+ Object.values(value).every(isStructuredTextFieldValue)
182
+ );
183
+ }
184
+
147
185
  /**
148
186
  * Type guard for structured text field values in API request format.
149
187
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
150
188
  */
151
- export function isStructuredTextFieldValueAsRequest(
189
+ export function isStructuredTextFieldValueAsRequest<
190
+ BlockItemDefinition extends ItemDefinition = ItemDefinition,
191
+ InlineBlockItemDefinition extends ItemDefinition = ItemDefinition,
192
+ >(
152
193
  value: unknown,
153
- ): value is StructuredTextFieldValueAsRequest {
194
+ ): value is StructuredTextFieldValueAsRequest<
195
+ BlockItemDefinition,
196
+ InlineBlockItemDefinition
197
+ > {
154
198
  if (value === null) return true;
155
199
 
156
200
  if (!isDocument<unknown>(value)) {
@@ -169,13 +213,25 @@ export function isStructuredTextFieldValueAsRequest(
169
213
  });
170
214
  }
171
215
 
216
+ export function isLocalizedStructuredTextFieldValueAsRequest<
217
+ D extends ItemDefinition = ItemDefinition,
218
+ >(
219
+ value: unknown,
220
+ ): value is LocalizedFieldValue<StructuredTextFieldValueAsRequest<D>> {
221
+ return (
222
+ typeof value === 'object' &&
223
+ value !== null &&
224
+ Object.values(value).every(isStructuredTextFieldValueAsRequest)
225
+ );
226
+ }
227
+
172
228
  /**
173
229
  * Type guard for structured text field values with nested blocks (?nested=true format).
174
230
  * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
175
231
  */
176
- export function isStructuredTextFieldValueWithNestedBlocks(
177
- value: unknown,
178
- ): value is StructuredTextFieldValueWithNestedBlocks {
232
+ export function isStructuredTextFieldValueWithNestedBlocks<
233
+ D extends ItemDefinition = ItemDefinition,
234
+ >(value: unknown): value is StructuredTextFieldValueWithNestedBlocks<D> {
179
235
  if (value === null) return true;
180
236
 
181
237
  if (!isDocument<unknown>(value)) {
@@ -191,6 +247,18 @@ export function isStructuredTextFieldValueWithNestedBlocks(
191
247
  });
192
248
  }
193
249
 
250
+ export function isLocalizedStructuredTextFieldValueWithNestedBlocks<
251
+ D extends ItemDefinition = ItemDefinition,
252
+ >(
253
+ value: unknown,
254
+ ): value is LocalizedFieldValue<StructuredTextFieldValueWithNestedBlocks<D>> {
255
+ return (
256
+ typeof value === 'object' &&
257
+ value !== null &&
258
+ Object.values(value).every(isStructuredTextFieldValueWithNestedBlocks)
259
+ );
260
+ }
261
+
194
262
  export type StructuredTextFieldValidators = {
195
263
  /** Only accept references to block records of the specified block models */
196
264
  structured_text_blocks: StructuredTextBlocksValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { MarkdownEditorConfiguration } from './appearance/markdown';
2
3
  import type { TextareaEditorConfiguration } from './appearance/textarea';
3
4
  import type { WysiwygEditorConfiguration } from './appearance/wysiwyg';
@@ -12,6 +13,16 @@ export function isTextFieldValue(value: unknown): value is TextFieldValue {
12
13
  return typeof value === 'string' || value === null;
13
14
  }
14
15
 
16
+ export function isLocalizedTextFieldValue(
17
+ value: unknown,
18
+ ): value is LocalizedFieldValue<TextFieldValue> {
19
+ return (
20
+ typeof value === 'object' &&
21
+ value !== null &&
22
+ Object.values(value).every(isTextFieldValue)
23
+ );
24
+ }
25
+
15
26
  export type TextFieldValidators = {
16
27
  /** Value must be specified or it won't be valid */
17
28
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { VideoEditorConfiguration } from './appearance/video';
2
3
  import type { RequiredValidator } from './validators/required';
3
4
 
@@ -22,6 +23,16 @@ export function isVideoFieldValue(value: unknown): value is VideoFieldValue {
22
23
  );
23
24
  }
24
25
 
26
+ export function isLocalizedVideoFieldValue(
27
+ value: unknown,
28
+ ): value is LocalizedFieldValue<VideoFieldValue> {
29
+ return (
30
+ typeof value === 'object' &&
31
+ value !== null &&
32
+ Object.values(value).every(isVideoFieldValue)
33
+ );
34
+ }
35
+
25
36
  export type VideoFieldValidators = {
26
37
  /** Value must be specified or it won't be valid */
27
38
  required?: RequiredValidator;