@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
@@ -1,4 +1,4 @@
1
- export function isLocationFieldValue(value) {
1
+ export function isLatLonFieldValue(value) {
2
2
  if (value === null)
3
3
  return true;
4
4
  return (typeof value === 'object' &&
@@ -6,4 +6,9 @@ export function isLocationFieldValue(value) {
6
6
  'latitude' in value &&
7
7
  'longitude' in value);
8
8
  }
9
+ export function isLocalizedLatLonFieldValue(value) {
10
+ return (typeof value === 'object' &&
11
+ value !== null &&
12
+ Object.values(value).every(isLatLonFieldValue));
13
+ }
9
14
  //# sourceMappingURL=lat_lon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lat_lon.js","sourceRoot":"","sources":["../../../src/fieldTypes/lat_lon.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,oBAAoB,CAClC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,WAAW,IAAI,KAAK,CACrB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"lat_lon.js","sourceRoot":"","sources":["../../../src/fieldTypes/lat_lon.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,WAAW,IAAI,KAAK,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAC/C,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { LinkEmbedEditorConfiguration } from './appearance/link_embed';
2
3
  import type { LinkSelectEditorConfiguration } from './appearance/link_select';
3
4
  import type { ItemItemTypeValidator } from './validators/item_item_type';
@@ -5,6 +6,7 @@ import type { RequiredValidator } from './validators/required';
5
6
  import type { UniqueValidator } from './validators/unique';
6
7
  export type LinkFieldValue = string | null;
7
8
  export declare function isLinkFieldValue(value: unknown): value is LinkFieldValue;
9
+ export declare function isLocalizedLinkFieldValue(value: unknown): value is LocalizedFieldValue<LinkFieldValue>;
8
10
  export type LinkFieldValidators = {
9
11
  /** Only accept references to records of the specified models */
10
12
  item_item_type: ItemItemTypeValidator;
@@ -1,4 +1,9 @@
1
1
  export function isLinkFieldValue(value) {
2
2
  return typeof value === 'string' || value === null;
3
3
  }
4
+ export function isLocalizedLinkFieldValue(value) {
5
+ return (typeof value === 'object' &&
6
+ value !== null &&
7
+ Object.values(value).every(isLinkFieldValue));
8
+ }
4
9
  //# sourceMappingURL=link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/fieldTypes/link.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/fieldTypes/link.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC7C,CAAC;AACJ,CAAC"}
@@ -1,9 +1,11 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { LinksEmbedEditorConfiguration } from './appearance/links_embed';
2
3
  import type { LinksSelectEditorConfiguration } from './appearance/links_select';
3
4
  import type { ItemsItemTypeValidator } from './validators/items_item_type';
4
5
  import type { SizeValidator } from './validators/size';
5
6
  export type LinksFieldValue = string[] | null;
6
7
  export declare function isLinksFieldValue(value: unknown): value is LinksFieldValue;
8
+ export declare function isLocalizedLinksFieldValue(value: unknown): value is LocalizedFieldValue<LinksFieldValue>;
7
9
  export type LinksFieldValidators = {
8
10
  /** Only accept references to records of the specified models */
9
11
  items_item_type: ItemsItemTypeValidator;
@@ -3,4 +3,9 @@ export function isLinksFieldValue(value) {
3
3
  return true;
4
4
  return (Array.isArray(value) && value.every((item) => typeof item === 'string'));
5
5
  }
6
+ export function isLocalizedLinksFieldValue(value) {
7
+ return (typeof value === 'object' &&
8
+ value !== null &&
9
+ Object.values(value).every(isLinksFieldValue));
10
+ }
6
11
  //# sourceMappingURL=links.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../src/fieldTypes/links.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CACxE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"links.js","sourceRoot":"","sources":["../../../src/fieldTypes/links.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CACxE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC9C,CAAC;AACJ,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import type * as RawApiTypes from '../generated/RawApiTypes';
2
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
3
+ import type { ItemDefinition } from '../utilities/itemDefinition';
4
+ import type { RichTextEditorConfiguration } from './appearance/rich_text';
2
5
  import { type BlockItemInARequest } from './single_block';
6
+ import type { RichTextBlocksValidator } from './validators/rich_text_blocks';
7
+ import type { SizeValidator } from './validators/size';
3
8
  /**
4
9
  * MODULAR CONTENT FIELD TYPE SYSTEM FOR DATOCMS
5
10
  *
@@ -29,7 +34,7 @@ import { type BlockItemInARequest } from './single_block';
29
34
  /**
30
35
  * Basic Modular Content field value - array of string block IDs (lightweight references)
31
36
  */
32
- export type RichTextFieldValue = string[] | null;
37
+ export type RichTextFieldValue = string[];
33
38
  /**
34
39
  * =============================================================================
35
40
  * REQUEST VARIANT - Type for sending data TO the DatoCMS API
@@ -46,7 +51,7 @@ export type RichTextFieldValue = string[] | null;
46
51
  * - RawApiTypes.Item: Full block object with ID (for updates)
47
52
  * - Omit<RawApiTypes.Item, 'id'>: Block object without ID (for creation)
48
53
  */
49
- export type RichTextFieldValueAsRequest = BlockItemInARequest[] | null;
54
+ export type RichTextFieldValueAsRequest<D extends ItemDefinition = ItemDefinition> = BlockItemInARequest<D>[] | null;
50
55
  /**
51
56
  * =============================================================================
52
57
  * NESTED VARIANT - Type for API responses with ?nested=true parameter
@@ -59,7 +64,7 @@ export type RichTextFieldValueAsRequest = BlockItemInARequest[] | null;
59
64
  /**
60
65
  * Modular Content field value with nested blocks - array of fully populated block objects
61
66
  */
62
- export type RichTextFieldValueWithNestedBlocks = RawApiTypes.Item[] | null;
67
+ export type RichTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition> = RawApiTypes.Item<D>[];
63
68
  /**
64
69
  * =============================================================================
65
70
  * TYPE GUARDS - Runtime validation functions
@@ -70,19 +75,19 @@ export type RichTextFieldValueWithNestedBlocks = RawApiTypes.Item[] | null;
70
75
  * Checks for array structure and ensures all blocks are string references.
71
76
  */
72
77
  export declare function isRichTextFieldValue(value: unknown): value is RichTextFieldValue;
78
+ export declare function isLocalizedRichTextFieldValue(value: unknown): value is LocalizedFieldValue<RichTextFieldValue>;
73
79
  /**
74
80
  * Type guard for Modular Content field values in API request format.
75
81
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
76
82
  */
77
- export declare function isRichTextFieldValueAsRequest(value: unknown): value is RichTextFieldValueAsRequest;
83
+ export declare function isRichTextFieldValueAsRequest<D extends ItemDefinition = ItemDefinition>(value: unknown): value is RichTextFieldValueAsRequest<D>;
84
+ export declare function isLocalizedRichTextFieldValueAsRequest<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<RichTextFieldValueAsRequest<D>>;
78
85
  /**
79
86
  * Type guard for Modular Content field values with nested blocks (?nested=true format).
80
87
  * Ensures all blocks are full RawApiTypes.Item objects with complete data.
81
88
  */
82
- export declare function isRichTextFieldValueWithNestedBlocks(value: unknown): value is RichTextFieldValueWithNestedBlocks;
83
- import type { RichTextEditorConfiguration } from './appearance/rich_text';
84
- import type { RichTextBlocksValidator } from './validators/rich_text_blocks';
85
- import type { SizeValidator } from './validators/size';
89
+ export declare function isRichTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is RichTextFieldValueWithNestedBlocks<D>;
90
+ export declare function isLocalizedRichTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<RichTextFieldValueWithNestedBlocks<D>>;
86
91
  export type RichTextFieldValidators = {
87
92
  /** Only accept references to block records of the specified block models */
88
93
  rich_text_blocks: RichTextBlocksValidator;
@@ -13,6 +13,11 @@ export function isRichTextFieldValue(value) {
13
13
  return true;
14
14
  return (Array.isArray(value) && value.every((block) => typeof block === 'string'));
15
15
  }
16
+ export function isLocalizedRichTextFieldValue(value) {
17
+ return (typeof value === 'object' &&
18
+ value !== null &&
19
+ Object.values(value).every(isRichTextFieldValue));
20
+ }
16
21
  /**
17
22
  * Type guard for Modular Content field values in API request format.
18
23
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
@@ -30,6 +35,11 @@ export function isRichTextFieldValueAsRequest(value) {
30
35
  return isItemWithOptionalIdAndMeta(block);
31
36
  });
32
37
  }
38
+ export function isLocalizedRichTextFieldValueAsRequest(value) {
39
+ return (typeof value === 'object' &&
40
+ value !== null &&
41
+ Object.values(value).every(isRichTextFieldValueAsRequest));
42
+ }
33
43
  /**
34
44
  * Type guard for Modular Content field values with nested blocks (?nested=true format).
35
45
  * Ensures all blocks are full RawApiTypes.Item objects with complete data.
@@ -44,4 +54,9 @@ export function isRichTextFieldValueWithNestedBlocks(value) {
44
54
  return isItemWithOptionalMeta(block);
45
55
  });
46
56
  }
57
+ export function isLocalizedRichTextFieldValueWithNestedBlocks(value) {
58
+ return (typeof value === 'object' &&
59
+ value !== null &&
60
+ Object.values(value).every(isRichTextFieldValueWithNestedBlocks));
61
+ }
47
62
  //# sourceMappingURL=rich_text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/rich_text.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAqExB;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK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AC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,6CAA6C,CAG3D,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC,CACjE,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { SeoEditorConfiguration } from './appearance/seo';
2
3
  import type { DescriptionLengthValidator } from './validators/description_length';
3
4
  import type { FileSizeValidator } from './validators/file_size';
@@ -13,6 +14,7 @@ export type SeoFieldValue = {
13
14
  no_index?: boolean;
14
15
  } | null;
15
16
  export declare function isSeoFieldValue(value: unknown): value is SeoFieldValue;
17
+ export declare function isLocalizedSeoFieldValue(value: unknown): value is LocalizedFieldValue<SeoFieldValue>;
16
18
  export type SeoFieldValidators = {
17
19
  /** SEO field has to specify one or more properties, or it won't be valid */
18
20
  required_seo_fields?: RequiredSeoFieldsValidator;
@@ -9,4 +9,9 @@ export function isSeoFieldValue(value) {
9
9
  'twitter_card' in value ||
10
10
  'no_index' in value));
11
11
  }
12
+ export function isLocalizedSeoFieldValue(value) {
13
+ return (typeof value === 'object' &&
14
+ value !== null &&
15
+ Object.values(value).every(isSeoFieldValue));
16
+ }
12
17
  //# sourceMappingURL=seo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seo.js","sourceRoot":"","sources":["../../../src/fieldTypes/seo.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,OAAO,IAAI,KAAK;YACf,aAAa,IAAI,KAAK;YACtB,OAAO,IAAI,KAAK;YAChB,cAAc,IAAI,KAAK;YACvB,UAAU,IAAI,KAAK,CAAC,CACvB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"seo.js","sourceRoot":"","sources":["../../../src/fieldTypes/seo.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,OAAO,IAAI,KAAK;YACf,aAAa,IAAI,KAAK;YACtB,OAAO,IAAI,KAAK;YAChB,cAAc,IAAI,KAAK;YACvB,UAAU,IAAI,KAAK,CAAC,CACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAC5C,CAAC;AACJ,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import type * as RawApiTypes from '../generated/RawApiTypes';
2
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
3
+ import type { ItemDefinition } from '../utilities/itemDefinition';
2
4
  import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
3
5
  import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
4
6
  import type { RequiredValidator } from './validators/required';
@@ -44,11 +46,11 @@ export type SingleBlockFieldValue = string | null;
44
46
  * - Omit ID for new blocks being created
45
47
  */
46
48
  /** Represents an existing block in a CMA request */
47
- export type UnchangedBlockInARequest = string;
49
+ export type UnchangedBlockInARequest<D extends ItemDefinition = ItemDefinition> = RawApiTypes.Item<D>['id'];
48
50
  /** Represents a block we want to update in a CMA request */
49
- export type UpdatedBlockInARequest = OptionalFields<RawApiTypes.Item, 'meta'>;
51
+ export type UpdatedBlockInARequest<D extends ItemDefinition = ItemDefinition> = OptionalFields<RawApiTypes.Item<D>, 'meta'>;
50
52
  /** Represents a new block to create in a CMA request */
51
- export type NewBlockInARequest = OptionalFields<RawApiTypes.Item, 'id' | 'meta'>;
53
+ export type NewBlockInARequest<D extends ItemDefinition = ItemDefinition> = OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'>;
52
54
  /**
53
55
  * Union type representing the different ways a block can be specified in API requests:
54
56
  * - string: Just the block ID (to keep existing blocks unchanged)
@@ -57,14 +59,14 @@ export type NewBlockInARequest = OptionalFields<RawApiTypes.Item, 'id' | 'meta'>
57
59
  *
58
60
  * Also, 'meta' can always be omitted
59
61
  */
60
- export type BlockItemInARequest = UnchangedBlockInARequest | UpdatedBlockInARequest | NewBlockInARequest;
62
+ export type BlockItemInARequest<D extends ItemDefinition = ItemDefinition> = UnchangedBlockInARequest | UpdatedBlockInARequest<D> | NewBlockInARequest<D>;
61
63
  /**
62
64
  * Single Block field value for API requests - allows flexible block representations:
63
65
  * - string: Just the block ID (to keep existing blocks unchanged)
64
66
  * - Full block object with ID (to update an existing block)
65
67
  * - Block object without ID (to create a new block)
66
68
  */
67
- export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
69
+ export type SingleBlockFieldValueAsRequest<D extends ItemDefinition = ItemDefinition> = BlockItemInARequest<D> | null;
68
70
  /**
69
71
  * =============================================================================
70
72
  * NESTED VARIANT - Type for API responses with ?nested=true parameter
@@ -77,7 +79,7 @@ export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
77
79
  /**
78
80
  * Single Block field value with nested block - fully populated block object
79
81
  */
80
- export type SingleBlockFieldValueWithNestedBlocks = RawApiTypes.Item | null;
82
+ export type SingleBlockFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition> = RawApiTypes.Item<D> | null;
81
83
  /**
82
84
  * =============================================================================
83
85
  * SHARED UTILITY FUNCTIONS
@@ -88,16 +90,16 @@ export type SingleBlockFieldValueWithNestedBlocks = RawApiTypes.Item | null;
88
90
  * Validates if the input is a valid item (either block or record) ID
89
91
  */
90
92
  export declare function isItemId(input: unknown): input is string;
91
- export type ItemWithOptionalIdAndMeta = OptionalFields<RawApiTypes.Item, 'id' | 'meta'>;
93
+ export type ItemWithOptionalIdAndMeta<D extends ItemDefinition = ItemDefinition> = OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'>;
92
94
  /**
93
95
  * Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
94
96
  */
95
- export declare function isItemWithOptionalIdAndMeta(block: unknown): block is ItemWithOptionalIdAndMeta;
96
- export type ItemWithOptionalMeta = OptionalFields<RawApiTypes.Item, 'meta'>;
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'>;
97
99
  /**
98
100
  * Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
99
101
  */
100
- export declare function isItemWithOptionalMeta(block: unknown): block is ItemWithOptionalMeta;
102
+ export declare function isItemWithOptionalMeta<D extends ItemDefinition = ItemDefinition>(block: unknown): block is ItemWithOptionalMeta<D>;
101
103
  /**
102
104
  * =============================================================================
103
105
  * TYPE GUARDS - Runtime validation functions
@@ -108,16 +110,19 @@ export declare function isItemWithOptionalMeta(block: unknown): block is ItemWit
108
110
  * Checks for string structure and ensures block is a string reference.
109
111
  */
110
112
  export declare function isSingleBlockFieldValue(value: unknown): value is SingleBlockFieldValue;
113
+ export declare function isLocalizedSingleBlockFieldValue(value: unknown): value is LocalizedFieldValue<SingleBlockFieldValue>;
111
114
  /**
112
115
  * Type guard for Single Block field values in API request format.
113
116
  * Allows block as string ID, full object with ID, or object without ID.
114
117
  */
115
- export declare function isSingleBlockFieldValueAsRequest(value: unknown): value is SingleBlockFieldValueAsRequest;
118
+ export declare function isSingleBlockFieldValueAsRequest<D extends ItemDefinition = ItemDefinition>(value: unknown): value is SingleBlockFieldValueAsRequest<D>;
119
+ export declare function isLocalizedSingleBlockFieldValueAsRequest<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<SingleBlockFieldValueAsRequest<D>>;
116
120
  /**
117
121
  * Type guard for Single Block field values with nested blocks (?nested=true format).
118
122
  * Ensures block is a full RawApiTypes.Item object with complete data.
119
123
  */
120
- export declare function isSingleBlockFieldValueWithNestedBlocks(value: unknown): value is SingleBlockFieldValueWithNestedBlocks;
124
+ export declare function isSingleBlockFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is SingleBlockFieldValueWithNestedBlocks<D>;
125
+ export declare function isLocalizedSingleBlockFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<SingleBlockFieldValueWithNestedBlocks<D>>;
121
126
  export type SingleBlockFieldValidators = {
122
127
  /** Only accept references to block records of the specified block models */
123
128
  single_block_blocks: SingleBlockBlocksValidator;
@@ -39,6 +39,11 @@ export function isItemWithOptionalMeta(block) {
39
39
  export function isSingleBlockFieldValue(value) {
40
40
  return typeof value === 'string' || value === null;
41
41
  }
42
+ export function isLocalizedSingleBlockFieldValue(value) {
43
+ return (typeof value === 'object' &&
44
+ value !== null &&
45
+ Object.values(value).every(isSingleBlockFieldValue));
46
+ }
42
47
  /**
43
48
  * Type guard for Single Block field values in API request format.
44
49
  * Allows block as string ID, full object with ID, or object without ID.
@@ -52,6 +57,11 @@ export function isSingleBlockFieldValueAsRequest(value) {
52
57
  // Object (either with or without ID for updates/creation)
53
58
  return isItemWithOptionalIdAndMeta(value);
54
59
  }
60
+ export function isLocalizedSingleBlockFieldValueAsRequest(value) {
61
+ return (typeof value === 'object' &&
62
+ value !== null &&
63
+ Object.values(value).every(isSingleBlockFieldValueAsRequest));
64
+ }
55
65
  /**
56
66
  * Type guard for Single Block field values with nested blocks (?nested=true format).
57
67
  * Ensures block is a full RawApiTypes.Item object with complete data.
@@ -62,4 +72,9 @@ export function isSingleBlockFieldValueWithNestedBlocks(value) {
62
72
  // Must be a full object with ID (nested format always includes complete block objects)
63
73
  return isItemWithOptionalMeta(value);
64
74
  }
75
+ export function isLocalizedSingleBlockFieldValueWithNestedBlocks(value) {
76
+ return (typeof value === 'object' &&
77
+ value !== null &&
78
+ Object.values(value).every(isSingleBlockFieldValueWithNestedBlocks));
79
+ }
65
80
  //# sourceMappingURL=single_block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AAiGA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,YAAY,IAAI,KAAK,CACtB,CAAC;AACJ,CAAC;AAID;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,CACL,2BAA2B,CAAC,KAAK,CAAC;QAClC,IAAI,IAAI,KAAK;QACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAC7B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,yCAAyC;IACzC,IAAI,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,0DAA0D;IAC1D,OAAO,2BAA2B,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED;;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CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,0DAA0D;IAC1D,OAAO,2BAA2B,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,yCAAyC,CAGvD,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CAErD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,uFAAuF;IACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,gDAAgD,CAG9D,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC,CACpE,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { SlugEditorConfiguration } from './appearance/slug';
2
3
  import type { LengthValidator } from './validators/length';
3
4
  import type { RequiredValidator } from './validators/required';
@@ -5,6 +6,7 @@ import type { SlugFormatValidator } from './validators/slug_format';
5
6
  import type { SlugTitleFieldValidator } from './validators/slug_title_field';
6
7
  export type SlugFieldValue = string | null;
7
8
  export declare function isSlugFieldValue(value: unknown): value is SlugFieldValue;
9
+ export declare function isLocalizedSlugFieldValue(value: unknown): value is LocalizedFieldValue<SlugFieldValue>;
8
10
  export type SlugFieldValidators = {
9
11
  /** Value must be specified or it won't be valid */
10
12
  required?: RequiredValidator;
@@ -1,6 +1,11 @@
1
1
  export function isSlugFieldValue(value) {
2
2
  if (value === null)
3
3
  return true;
4
- return typeof value === 'string' && /^[a-z0-9_]+(?:-[a-z0-9]+)*$/.test(value);
4
+ return typeof value === 'string';
5
+ }
6
+ export function isLocalizedSlugFieldValue(value) {
7
+ return (typeof value === 'object' &&
8
+ value !== null &&
9
+ Object.values(value).every(isSlugFieldValue));
5
10
  }
6
11
  //# sourceMappingURL=slug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC"}
1
+ {"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC7C,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { SingleLineEditorConfiguration } from './appearance/single_line';
2
3
  import type { StringRadioGroupEditorConfiguration } from './appearance/string_radio_group';
3
4
  import type { StringSelectEditorConfiguration } from './appearance/string_select';
@@ -8,6 +9,7 @@ import type { RequiredValidator } from './validators/required';
8
9
  import type { UniqueValidator } from './validators/unique';
9
10
  export type StringFieldValue = string | null;
10
11
  export declare function isStringFieldValue(value: unknown): value is StringFieldValue;
12
+ export declare function isLocalizedStringFieldValue(value: unknown): value is LocalizedFieldValue<StringFieldValue>;
11
13
  export type StringFieldValidators = {
12
14
  /** Value must be specified or it won't be valid */
13
15
  required?: RequiredValidator;
@@ -1,4 +1,9 @@
1
1
  export function isStringFieldValue(value) {
2
2
  return typeof value === 'string' || value === null;
3
3
  }
4
+ export function isLocalizedStringFieldValue(value) {
5
+ return (typeof value === 'object' &&
6
+ value !== null &&
7
+ Object.values(value).every(isStringFieldValue));
8
+ }
4
9
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/fieldTypes/string.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/fieldTypes/string.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAC/C,CAAC;AACJ,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { type Block, type Document, type InlineBlock } from 'datocms-structured-text-utils';
2
2
  import type * as RawApiTypes from '../generated/RawApiTypes';
3
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
4
+ import type { ItemDefinition } from '../utilities/itemDefinition';
3
5
  import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
4
6
  import { type BlockItemInARequest } from './single_block';
5
7
  import type { LengthValidator } from './validators/length';
@@ -38,15 +40,15 @@ import type { StructuredTextLinksValidator } from './validators/structured_text_
38
40
  /**
39
41
  * Variant of 'block' structured text node for API requests
40
42
  */
41
- export type BlockAsRequest = Block<BlockItemInARequest>;
43
+ export type BlockAsRequest<D extends ItemDefinition = ItemDefinition> = Block<BlockItemInARequest<D>>;
42
44
  /**
43
45
  * Variant of 'inlineBlock' structured text node for API requests
44
46
  */
45
- export type InlineBlockAsRequest = InlineBlock<BlockItemInARequest>;
47
+ export type InlineBlockAsRequest<D extends ItemDefinition = ItemDefinition> = InlineBlock<BlockItemInARequest<D>>;
46
48
  /**
47
49
  * Variant of Structured Text document for API requests
48
50
  */
49
- export type DocumentAsRequest = Document<BlockItemInARequest>;
51
+ export type DocumentAsRequest<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = Document<BlockItemInARequest<BlockItemDefinition>, BlockItemInARequest<InlineBlockItemDefinition>>;
50
52
  /**
51
53
  * =============================================================================
52
54
  * NESTED VARIANTS - Types for API responses with ?nested=true parameter
@@ -59,15 +61,15 @@ export type DocumentAsRequest = Document<BlockItemInARequest>;
59
61
  /**
60
62
  * Variant of 'block' structured text node for ?nested=true API responses
61
63
  */
62
- export type BlockWithNestedBlocks = Block<RawApiTypes.Item>;
64
+ export type BlockWithNestedBlocks<D extends ItemDefinition = ItemDefinition> = Block<RawApiTypes.Item<D>>;
63
65
  /**
64
66
  * Variant of 'inlineBlock' structured text node for ?nested=true API responses
65
67
  */
66
- export type InlineBlockWithNestedBlocks = InlineBlock<RawApiTypes.Item>;
68
+ export type InlineBlockWithNestedBlocks<D extends ItemDefinition = ItemDefinition> = InlineBlock<RawApiTypes.Item<D>>;
67
69
  /**
68
70
  * Variant of Structured Text document for ?nested=true API responses
69
71
  */
70
- export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
72
+ export type DocumentWithNestedBlocks<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = Document<RawApiTypes.Item<BlockItemDefinition>, RawApiTypes.Item<InlineBlockItemDefinition>>;
71
73
  /**
72
74
  * =============================================================================
73
75
  * MAIN APPLICATION TYPES
@@ -78,23 +80,26 @@ export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
78
80
  * Can be null (empty field) or a document with blocks as string IDs
79
81
  */
80
82
  export type StructuredTextFieldValue = Document | null;
81
- export type StructuredTextFieldValueAsRequest = DocumentAsRequest | null;
82
- export type StructuredTextFieldValueWithNestedBlocks = DocumentWithNestedBlocks | null;
83
+ export type StructuredTextFieldValueAsRequest<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = DocumentAsRequest<BlockItemDefinition, InlineBlockItemDefinition> | null;
84
+ export type StructuredTextFieldValueWithNestedBlocks<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = DocumentWithNestedBlocks<BlockItemDefinition, InlineBlockItemDefinition> | null;
83
85
  /**
84
86
  * Type guard for basic structured text field values (blocks as string IDs only).
85
87
  * Checks for the expected structure and ensures all block/inlineBlock nodes have string IDs.
86
88
  */
87
89
  export declare function isStructuredTextFieldValue(value: unknown): value is StructuredTextFieldValue;
90
+ export declare function isLocalizedStructuredTextFieldValue(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValue>;
88
91
  /**
89
92
  * Type guard for structured text field values in API request format.
90
93
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
91
94
  */
92
- export declare function isStructuredTextFieldValueAsRequest(value: unknown): value is StructuredTextFieldValueAsRequest;
95
+ export declare function isStructuredTextFieldValueAsRequest<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition>(value: unknown): value is StructuredTextFieldValueAsRequest<BlockItemDefinition, InlineBlockItemDefinition>;
96
+ export declare function isLocalizedStructuredTextFieldValueAsRequest<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueAsRequest<D>>;
93
97
  /**
94
98
  * Type guard for structured text field values with nested blocks (?nested=true format).
95
99
  * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
96
100
  */
97
- export declare function isStructuredTextFieldValueWithNestedBlocks(value: unknown): value is StructuredTextFieldValueWithNestedBlocks;
101
+ export declare function isStructuredTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is StructuredTextFieldValueWithNestedBlocks<D>;
102
+ export declare function isLocalizedStructuredTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueWithNestedBlocks<D>>;
98
103
  export type StructuredTextFieldValidators = {
99
104
  /** Only accept references to block records of the specified block models */
100
105
  structured_text_blocks: StructuredTextBlocksValidator;
@@ -29,6 +29,11 @@ export function isStructuredTextFieldValue(value) {
29
29
  return typeof node.item === 'string';
30
30
  });
31
31
  }
32
+ export function isLocalizedStructuredTextFieldValue(value) {
33
+ return (typeof value === 'object' &&
34
+ value !== null &&
35
+ Object.values(value).every(isStructuredTextFieldValue));
36
+ }
32
37
  /**
33
38
  * Type guard for structured text field values in API request format.
34
39
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
@@ -49,6 +54,11 @@ export function isStructuredTextFieldValueAsRequest(value) {
49
54
  return isItemWithOptionalIdAndMeta(item);
50
55
  });
51
56
  }
57
+ export function isLocalizedStructuredTextFieldValueAsRequest(value) {
58
+ return (typeof value === 'object' &&
59
+ value !== null &&
60
+ Object.values(value).every(isStructuredTextFieldValueAsRequest));
61
+ }
52
62
  /**
53
63
  * Type guard for structured text field values with nested blocks (?nested=true format).
54
64
  * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
@@ -66,4 +76,9 @@ export function isStructuredTextFieldValueWithNestedBlocks(value) {
66
76
  return isItemWithOptionalMeta(item);
67
77
  });
68
78
  }
79
+ export function isLocalizedStructuredTextFieldValueWithNestedBlocks(value) {
80
+ return (typeof value === 'object' &&
81
+ value !== null &&
82
+ Object.values(value).every(isStructuredTextFieldValueWithNestedBlocks));
83
+ }
69
84
  //# sourceMappingURL=structured_text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAEL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AA4FxB;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAa,EACb,QAAsD;IAEtD,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QACrC,wEAAwE;QACxE,IAAI,OAAO,CAAI,WAAW,CAAC,IAAI,aAAa,CAAI,WAAW,CAAC,EAAE;YAC5D,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QACD,qDAAqD;QACrD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,8DAA8D;IAC9D,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAA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ACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAChE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0CAA0C,CAExD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,gEAAgE;IAChE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,2EAA2E;QAC3E,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mDAAmD,CAGjE,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,0CAA0C,CAAC,CACvE,CAAC;AACJ,CAAC"}
@@ -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';
@@ -7,6 +8,7 @@ import type { RequiredValidator } from './validators/required';
7
8
  import type { SanitizationValidator } from './validators/sanitization';
8
9
  export type TextFieldValue = string | null;
9
10
  export declare function isTextFieldValue(value: unknown): value is TextFieldValue;
11
+ export declare function isLocalizedTextFieldValue(value: unknown): value is LocalizedFieldValue<TextFieldValue>;
10
12
  export type TextFieldValidators = {
11
13
  /** Value must be specified or it won't be valid */
12
14
  required?: RequiredValidator;
@@ -1,4 +1,9 @@
1
1
  export function isTextFieldValue(value) {
2
2
  return typeof value === 'string' || value === null;
3
3
  }
4
+ export function isLocalizedTextFieldValue(value) {
5
+ return (typeof value === 'object' &&
6
+ value !== null &&
7
+ Object.values(value).every(isTextFieldValue));
8
+ }
4
9
  //# sourceMappingURL=text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/fieldTypes/text.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/fieldTypes/text.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC7C,CAAC;AACJ,CAAC"}
@@ -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
  export type VideoFieldValue = {
@@ -10,6 +11,7 @@ export type VideoFieldValue = {
10
11
  title: string;
11
12
  } | null;
12
13
  export declare function isVideoFieldValue(value: unknown): value is VideoFieldValue;
14
+ export declare function isLocalizedVideoFieldValue(value: unknown): value is LocalizedFieldValue<VideoFieldValue>;
13
15
  export type VideoFieldValidators = {
14
16
  /** Value must be specified or it won't be valid */
15
17
  required?: RequiredValidator;
@@ -7,4 +7,9 @@ export function isVideoFieldValue(value) {
7
7
  'provider_uid' in value &&
8
8
  'url' in value);
9
9
  }
10
+ export function isLocalizedVideoFieldValue(value) {
11
+ return (typeof value === 'object' &&
12
+ value !== null &&
13
+ Object.values(value).every(isVideoFieldValue));
14
+ }
10
15
  //# sourceMappingURL=video.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/fieldTypes/video.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,cAAc,IAAI,KAAK;QACvB,KAAK,IAAI,KAAK,CACf,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/fieldTypes/video.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,cAAc,IAAI,KAAK;QACvB,KAAK,IAAI,KAAK,CACf,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC9C,CAAC;AACJ,CAAC"}