@datocms/cma-client 5.1.1 → 5.1.3

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 (444) 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 +7 -1
  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 +23 -5
  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 +37 -17
  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 +28 -22
  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/{SchemaTypes.js → ApiTypes.js} +1 -1
  42. package/dist/cjs/generated/ApiTypes.js.map +1 -0
  43. package/dist/cjs/generated/Client.js +1 -1
  44. package/dist/cjs/generated/{SimpleSchemaTypes.js → RawApiTypes.js} +1 -1
  45. package/dist/cjs/generated/RawApiTypes.js.map +1 -0
  46. package/dist/cjs/generated/resources/AccessToken.js.map +1 -1
  47. package/dist/cjs/generated/resources/AuditLogEvent.js.map +1 -1
  48. package/dist/cjs/generated/resources/BuildEvent.js.map +1 -1
  49. package/dist/cjs/generated/resources/BuildTrigger.js.map +1 -1
  50. package/dist/cjs/generated/resources/EditingSession.js.map +1 -1
  51. package/dist/cjs/generated/resources/EmojiSuggestions.js.map +1 -1
  52. package/dist/cjs/generated/resources/Environment.js.map +1 -1
  53. package/dist/cjs/generated/resources/Field.js.map +1 -1
  54. package/dist/cjs/generated/resources/Fieldset.js.map +1 -1
  55. package/dist/cjs/generated/resources/Item.js.map +1 -1
  56. package/dist/cjs/generated/resources/ItemType.js.map +1 -1
  57. package/dist/cjs/generated/resources/ItemTypeFilter.js.map +1 -1
  58. package/dist/cjs/generated/resources/ItemVersion.js.map +1 -1
  59. package/dist/cjs/generated/resources/JobResult.js.map +1 -1
  60. package/dist/cjs/generated/resources/MaintenanceMode.js.map +1 -1
  61. package/dist/cjs/generated/resources/MenuItem.js.map +1 -1
  62. package/dist/cjs/generated/resources/Plugin.js.map +1 -1
  63. package/dist/cjs/generated/resources/PublicInfo.js.map +1 -1
  64. package/dist/cjs/generated/resources/Role.js.map +1 -1
  65. package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
  66. package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
  67. package/dist/cjs/generated/resources/SchemaMenuItem.js.map +1 -1
  68. package/dist/cjs/generated/resources/SearchResult.js.map +1 -1
  69. package/dist/cjs/generated/resources/Session.js.map +1 -1
  70. package/dist/cjs/generated/resources/Site.js.map +1 -1
  71. package/dist/cjs/generated/resources/SiteInvitation.js.map +1 -1
  72. package/dist/cjs/generated/resources/SsoGroup.js.map +1 -1
  73. package/dist/cjs/generated/resources/SsoSettings.js.map +1 -1
  74. package/dist/cjs/generated/resources/SsoUser.js.map +1 -1
  75. package/dist/cjs/generated/resources/SubscriptionLimit.js.map +1 -1
  76. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  77. package/dist/cjs/generated/resources/UploadCollection.js.map +1 -1
  78. package/dist/cjs/generated/resources/UploadFilter.js.map +1 -1
  79. package/dist/cjs/generated/resources/UploadRequest.js.map +1 -1
  80. package/dist/cjs/generated/resources/UploadSmartTag.js.map +1 -1
  81. package/dist/cjs/generated/resources/UploadTag.js.map +1 -1
  82. package/dist/cjs/generated/resources/UploadTrack.js.map +1 -1
  83. package/dist/cjs/generated/resources/UsageCounter.js.map +1 -1
  84. package/dist/cjs/generated/resources/User.js.map +1 -1
  85. package/dist/cjs/generated/resources/Webhook.js.map +1 -1
  86. package/dist/cjs/generated/resources/WebhookCall.js.map +1 -1
  87. package/dist/cjs/generated/resources/WhiteLabelSettings.js.map +1 -1
  88. package/dist/cjs/generated/resources/Workflow.js.map +1 -1
  89. package/dist/cjs/index.js +3 -5
  90. package/dist/cjs/index.js.map +1 -1
  91. package/dist/cjs/resources/Role.js.map +1 -1
  92. package/dist/cjs/utilities/blocks.js +7 -7
  93. package/dist/cjs/utilities/blocks.js.map +1 -1
  94. package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
  95. package/dist/cjs/utilities/{fieldValueLocalization.js → fieldValue.js} +52 -52
  96. package/dist/cjs/utilities/fieldValue.js.map +1 -0
  97. package/dist/cjs/utilities/fieldsContainingReferences.js.map +1 -1
  98. package/dist/cjs/utilities/recursiveBlocks.js +18 -19
  99. package/dist/cjs/utilities/recursiveBlocks.js.map +1 -1
  100. package/dist/cjs/utilities/schemaRepository.js.map +1 -1
  101. package/dist/esm/fieldTypes/boolean.d.ts +2 -0
  102. package/dist/esm/fieldTypes/boolean.js +5 -0
  103. package/dist/esm/fieldTypes/boolean.js.map +1 -1
  104. package/dist/esm/fieldTypes/color.d.ts +2 -0
  105. package/dist/esm/fieldTypes/color.js +5 -0
  106. package/dist/esm/fieldTypes/color.js.map +1 -1
  107. package/dist/esm/fieldTypes/date.d.ts +2 -0
  108. package/dist/esm/fieldTypes/date.js +5 -0
  109. package/dist/esm/fieldTypes/date.js.map +1 -1
  110. package/dist/esm/fieldTypes/date_time.d.ts +2 -0
  111. package/dist/esm/fieldTypes/date_time.js +5 -0
  112. package/dist/esm/fieldTypes/date_time.js.map +1 -1
  113. package/dist/esm/fieldTypes/file.d.ts +2 -0
  114. package/dist/esm/fieldTypes/file.js +5 -0
  115. package/dist/esm/fieldTypes/file.js.map +1 -1
  116. package/dist/esm/fieldTypes/float.d.ts +2 -0
  117. package/dist/esm/fieldTypes/float.js +5 -0
  118. package/dist/esm/fieldTypes/float.js.map +1 -1
  119. package/dist/esm/fieldTypes/gallery.d.ts +2 -0
  120. package/dist/esm/fieldTypes/gallery.js +5 -0
  121. package/dist/esm/fieldTypes/gallery.js.map +1 -1
  122. package/dist/esm/fieldTypes/integer.d.ts +2 -0
  123. package/dist/esm/fieldTypes/integer.js +5 -0
  124. package/dist/esm/fieldTypes/integer.js.map +1 -1
  125. package/dist/esm/fieldTypes/json.d.ts +2 -0
  126. package/dist/esm/fieldTypes/json.js +5 -0
  127. package/dist/esm/fieldTypes/json.js.map +1 -1
  128. package/dist/esm/fieldTypes/lat_lon.d.ts +2 -0
  129. package/dist/esm/fieldTypes/lat_lon.js +5 -0
  130. package/dist/esm/fieldTypes/lat_lon.js.map +1 -1
  131. package/dist/esm/fieldTypes/link.d.ts +2 -0
  132. package/dist/esm/fieldTypes/link.js +5 -0
  133. package/dist/esm/fieldTypes/link.js.map +1 -1
  134. package/dist/esm/fieldTypes/links.d.ts +2 -0
  135. package/dist/esm/fieldTypes/links.js +5 -0
  136. package/dist/esm/fieldTypes/links.js.map +1 -1
  137. package/dist/esm/fieldTypes/rich_text.d.ts +13 -9
  138. package/dist/esm/fieldTypes/rich_text.js +20 -5
  139. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  140. package/dist/esm/fieldTypes/seo.d.ts +2 -0
  141. package/dist/esm/fieldTypes/seo.js +5 -0
  142. package/dist/esm/fieldTypes/seo.js.map +1 -1
  143. package/dist/esm/fieldTypes/single_block.d.ts +33 -23
  144. package/dist/esm/fieldTypes/single_block.js +30 -13
  145. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  146. package/dist/esm/fieldTypes/slug.d.ts +2 -0
  147. package/dist/esm/fieldTypes/slug.js +6 -1
  148. package/dist/esm/fieldTypes/slug.js.map +1 -1
  149. package/dist/esm/fieldTypes/string.d.ts +2 -0
  150. package/dist/esm/fieldTypes/string.js +5 -0
  151. package/dist/esm/fieldTypes/string.js.map +1 -1
  152. package/dist/esm/fieldTypes/structured_text.d.ts +22 -83
  153. package/dist/esm/fieldTypes/structured_text.js +25 -22
  154. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  155. package/dist/esm/fieldTypes/text.d.ts +2 -0
  156. package/dist/esm/fieldTypes/text.js +5 -0
  157. package/dist/esm/fieldTypes/text.js.map +1 -1
  158. package/dist/esm/fieldTypes/video.d.ts +2 -0
  159. package/dist/esm/fieldTypes/video.js +5 -0
  160. package/dist/esm/fieldTypes/video.js.map +1 -1
  161. package/dist/esm/generated/{SimpleSchemaTypes.d.ts → ApiTypes.d.ts} +2 -2
  162. package/dist/esm/generated/ApiTypes.js +2 -0
  163. package/dist/esm/generated/ApiTypes.js.map +1 -0
  164. package/dist/esm/generated/Client.d.ts +1 -1
  165. package/dist/esm/generated/Client.js +1 -1
  166. package/dist/esm/generated/{SchemaTypes.d.ts → RawApiTypes.d.ts} +2 -2
  167. package/dist/esm/generated/RawApiTypes.js +2 -0
  168. package/dist/esm/generated/RawApiTypes.js.map +1 -0
  169. package/dist/esm/generated/resources/AccessToken.d.ts +14 -14
  170. package/dist/esm/generated/resources/AccessToken.js.map +1 -1
  171. package/dist/esm/generated/resources/AuditLogEvent.d.ts +4 -4
  172. package/dist/esm/generated/resources/AuditLogEvent.js.map +1 -1
  173. package/dist/esm/generated/resources/BuildEvent.d.ts +8 -8
  174. package/dist/esm/generated/resources/BuildEvent.js.map +1 -1
  175. package/dist/esm/generated/resources/BuildTrigger.d.ts +16 -16
  176. package/dist/esm/generated/resources/BuildTrigger.js.map +1 -1
  177. package/dist/esm/generated/resources/DailyUsage.d.ts +4 -4
  178. package/dist/esm/generated/resources/EditingSession.d.ts +7 -7
  179. package/dist/esm/generated/resources/EditingSession.js.map +1 -1
  180. package/dist/esm/generated/resources/EmojiSuggestions.d.ts +4 -4
  181. package/dist/esm/generated/resources/EmojiSuggestions.js.map +1 -1
  182. package/dist/esm/generated/resources/Environment.d.ts +14 -14
  183. package/dist/esm/generated/resources/Environment.js.map +1 -1
  184. package/dist/esm/generated/resources/Field.d.ts +713 -713
  185. package/dist/esm/generated/resources/Field.js.map +1 -1
  186. package/dist/esm/generated/resources/Fieldset.d.ts +12 -12
  187. package/dist/esm/generated/resources/Fieldset.js.map +1 -1
  188. package/dist/esm/generated/resources/Item.d.ts +36 -36
  189. package/dist/esm/generated/resources/Item.js.map +1 -1
  190. package/dist/esm/generated/resources/ItemType.d.ts +15 -15
  191. package/dist/esm/generated/resources/ItemType.js.map +1 -1
  192. package/dist/esm/generated/resources/ItemTypeFilter.d.ts +12 -12
  193. package/dist/esm/generated/resources/ItemTypeFilter.js.map +1 -1
  194. package/dist/esm/generated/resources/ItemVersion.d.ts +10 -10
  195. package/dist/esm/generated/resources/ItemVersion.js.map +1 -1
  196. package/dist/esm/generated/resources/JobResult.d.ts +4 -4
  197. package/dist/esm/generated/resources/JobResult.js.map +1 -1
  198. package/dist/esm/generated/resources/MaintenanceMode.d.ts +8 -8
  199. package/dist/esm/generated/resources/MaintenanceMode.js.map +1 -1
  200. package/dist/esm/generated/resources/MenuItem.d.ts +14 -14
  201. package/dist/esm/generated/resources/MenuItem.js.map +1 -1
  202. package/dist/esm/generated/resources/Plugin.d.ts +14 -14
  203. package/dist/esm/generated/resources/Plugin.js.map +1 -1
  204. package/dist/esm/generated/resources/PublicInfo.d.ts +4 -4
  205. package/dist/esm/generated/resources/PublicInfo.js.map +1 -1
  206. package/dist/esm/generated/resources/Role.d.ts +14 -14
  207. package/dist/esm/generated/resources/Role.js.map +1 -1
  208. package/dist/esm/generated/resources/ScheduledPublication.d.ts +6 -6
  209. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  210. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +6 -6
  211. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  212. package/dist/esm/generated/resources/SchemaMenuItem.d.ts +14 -14
  213. package/dist/esm/generated/resources/SchemaMenuItem.js.map +1 -1
  214. package/dist/esm/generated/resources/SearchResult.d.ts +6 -6
  215. package/dist/esm/generated/resources/SearchResult.js.map +1 -1
  216. package/dist/esm/generated/resources/Session.d.ts +4 -4
  217. package/dist/esm/generated/resources/Session.js.map +1 -1
  218. package/dist/esm/generated/resources/Site.d.ts +24 -24
  219. package/dist/esm/generated/resources/Site.js.map +1 -1
  220. package/dist/esm/generated/resources/SiteInvitation.d.ts +14 -14
  221. package/dist/esm/generated/resources/SiteInvitation.js.map +1 -1
  222. package/dist/esm/generated/resources/SsoGroup.d.ts +10 -10
  223. package/dist/esm/generated/resources/SsoGroup.js.map +1 -1
  224. package/dist/esm/generated/resources/SsoSettings.d.ts +8 -8
  225. package/dist/esm/generated/resources/SsoSettings.js.map +1 -1
  226. package/dist/esm/generated/resources/SsoUser.d.ts +10 -10
  227. package/dist/esm/generated/resources/SsoUser.js.map +1 -1
  228. package/dist/esm/generated/resources/SubscriptionFeature.d.ts +4 -4
  229. package/dist/esm/generated/resources/SubscriptionLimit.d.ts +6 -6
  230. package/dist/esm/generated/resources/SubscriptionLimit.js.map +1 -1
  231. package/dist/esm/generated/resources/Upload.d.ts +22 -22
  232. package/dist/esm/generated/resources/Upload.js.map +1 -1
  233. package/dist/esm/generated/resources/UploadCollection.d.ts +14 -14
  234. package/dist/esm/generated/resources/UploadCollection.js.map +1 -1
  235. package/dist/esm/generated/resources/UploadFilter.d.ts +12 -12
  236. package/dist/esm/generated/resources/UploadFilter.js.map +1 -1
  237. package/dist/esm/generated/resources/UploadRequest.d.ts +4 -4
  238. package/dist/esm/generated/resources/UploadRequest.js.map +1 -1
  239. package/dist/esm/generated/resources/UploadSmartTag.d.ts +6 -6
  240. package/dist/esm/generated/resources/UploadSmartTag.js.map +1 -1
  241. package/dist/esm/generated/resources/UploadTag.d.ts +8 -8
  242. package/dist/esm/generated/resources/UploadTag.js.map +1 -1
  243. package/dist/esm/generated/resources/UploadTrack.d.ts +10 -10
  244. package/dist/esm/generated/resources/UploadTrack.js.map +1 -1
  245. package/dist/esm/generated/resources/UsageCounter.d.ts +4 -4
  246. package/dist/esm/generated/resources/UsageCounter.js.map +1 -1
  247. package/dist/esm/generated/resources/User.d.ts +12 -12
  248. package/dist/esm/generated/resources/User.js.map +1 -1
  249. package/dist/esm/generated/resources/Webhook.d.ts +12 -12
  250. package/dist/esm/generated/resources/Webhook.js.map +1 -1
  251. package/dist/esm/generated/resources/WebhookCall.d.ts +9 -9
  252. package/dist/esm/generated/resources/WebhookCall.js.map +1 -1
  253. package/dist/esm/generated/resources/WhiteLabelSettings.d.ts +6 -6
  254. package/dist/esm/generated/resources/WhiteLabelSettings.js.map +1 -1
  255. package/dist/esm/generated/resources/Workflow.d.ts +11 -11
  256. package/dist/esm/generated/resources/Workflow.js.map +1 -1
  257. package/dist/esm/index.d.ts +6 -4
  258. package/dist/esm/index.js +2 -4
  259. package/dist/esm/index.js.map +1 -1
  260. package/dist/esm/resources/Role.d.ts +4 -4
  261. package/dist/esm/resources/Role.js.map +1 -1
  262. package/dist/esm/utilities/blocks.d.ts +17 -17
  263. package/dist/esm/utilities/blocks.js +3 -3
  264. package/dist/esm/utilities/blocks.js.map +1 -1
  265. package/dist/esm/utilities/buildBlockRecord.d.ts +5 -5
  266. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  267. package/dist/{types/utilities/fieldValueLocalization.d.ts → esm/utilities/fieldValue.d.ts} +30 -29
  268. package/dist/esm/utilities/{fieldValueLocalization.js → fieldValue.js} +39 -39
  269. package/dist/esm/utilities/fieldValue.js.map +1 -0
  270. package/dist/esm/utilities/fieldsContainingReferences.d.ts +4 -4
  271. package/dist/esm/utilities/fieldsContainingReferences.js.map +1 -1
  272. package/dist/esm/utilities/recursiveBlocks.d.ts +13 -10
  273. package/dist/esm/utilities/recursiveBlocks.js +19 -20
  274. package/dist/esm/utilities/recursiveBlocks.js.map +1 -1
  275. package/dist/esm/utilities/schemaRepository.d.ts +29 -26
  276. package/dist/esm/utilities/schemaRepository.js.map +1 -1
  277. package/dist/types/fieldTypes/boolean.d.ts +2 -0
  278. package/dist/types/fieldTypes/color.d.ts +2 -0
  279. package/dist/types/fieldTypes/date.d.ts +2 -0
  280. package/dist/types/fieldTypes/date_time.d.ts +2 -0
  281. package/dist/types/fieldTypes/file.d.ts +2 -0
  282. package/dist/types/fieldTypes/float.d.ts +2 -0
  283. package/dist/types/fieldTypes/gallery.d.ts +2 -0
  284. package/dist/types/fieldTypes/integer.d.ts +2 -0
  285. package/dist/types/fieldTypes/json.d.ts +2 -0
  286. package/dist/types/fieldTypes/lat_lon.d.ts +2 -0
  287. package/dist/types/fieldTypes/link.d.ts +2 -0
  288. package/dist/types/fieldTypes/links.d.ts +2 -0
  289. package/dist/types/fieldTypes/rich_text.d.ts +13 -9
  290. package/dist/types/fieldTypes/seo.d.ts +2 -0
  291. package/dist/types/fieldTypes/single_block.d.ts +33 -23
  292. package/dist/types/fieldTypes/slug.d.ts +2 -0
  293. package/dist/types/fieldTypes/string.d.ts +2 -0
  294. package/dist/types/fieldTypes/structured_text.d.ts +22 -83
  295. package/dist/types/fieldTypes/text.d.ts +2 -0
  296. package/dist/types/fieldTypes/video.d.ts +2 -0
  297. package/dist/types/generated/{SimpleSchemaTypes.d.ts → ApiTypes.d.ts} +2 -2
  298. package/dist/types/generated/Client.d.ts +1 -1
  299. package/dist/types/generated/{SchemaTypes.d.ts → RawApiTypes.d.ts} +2 -2
  300. package/dist/types/generated/resources/AccessToken.d.ts +14 -14
  301. package/dist/types/generated/resources/AuditLogEvent.d.ts +4 -4
  302. package/dist/types/generated/resources/BuildEvent.d.ts +8 -8
  303. package/dist/types/generated/resources/BuildTrigger.d.ts +16 -16
  304. package/dist/types/generated/resources/DailyUsage.d.ts +4 -4
  305. package/dist/types/generated/resources/EditingSession.d.ts +7 -7
  306. package/dist/types/generated/resources/EmojiSuggestions.d.ts +4 -4
  307. package/dist/types/generated/resources/Environment.d.ts +14 -14
  308. package/dist/types/generated/resources/Field.d.ts +713 -713
  309. package/dist/types/generated/resources/Fieldset.d.ts +12 -12
  310. package/dist/types/generated/resources/Item.d.ts +36 -36
  311. package/dist/types/generated/resources/ItemType.d.ts +15 -15
  312. package/dist/types/generated/resources/ItemTypeFilter.d.ts +12 -12
  313. package/dist/types/generated/resources/ItemVersion.d.ts +10 -10
  314. package/dist/types/generated/resources/JobResult.d.ts +4 -4
  315. package/dist/types/generated/resources/MaintenanceMode.d.ts +8 -8
  316. package/dist/types/generated/resources/MenuItem.d.ts +14 -14
  317. package/dist/types/generated/resources/Plugin.d.ts +14 -14
  318. package/dist/types/generated/resources/PublicInfo.d.ts +4 -4
  319. package/dist/types/generated/resources/Role.d.ts +14 -14
  320. package/dist/types/generated/resources/ScheduledPublication.d.ts +6 -6
  321. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +6 -6
  322. package/dist/types/generated/resources/SchemaMenuItem.d.ts +14 -14
  323. package/dist/types/generated/resources/SearchResult.d.ts +6 -6
  324. package/dist/types/generated/resources/Session.d.ts +4 -4
  325. package/dist/types/generated/resources/Site.d.ts +24 -24
  326. package/dist/types/generated/resources/SiteInvitation.d.ts +14 -14
  327. package/dist/types/generated/resources/SsoGroup.d.ts +10 -10
  328. package/dist/types/generated/resources/SsoSettings.d.ts +8 -8
  329. package/dist/types/generated/resources/SsoUser.d.ts +10 -10
  330. package/dist/types/generated/resources/SubscriptionFeature.d.ts +4 -4
  331. package/dist/types/generated/resources/SubscriptionLimit.d.ts +6 -6
  332. package/dist/types/generated/resources/Upload.d.ts +22 -22
  333. package/dist/types/generated/resources/UploadCollection.d.ts +14 -14
  334. package/dist/types/generated/resources/UploadFilter.d.ts +12 -12
  335. package/dist/types/generated/resources/UploadRequest.d.ts +4 -4
  336. package/dist/types/generated/resources/UploadSmartTag.d.ts +6 -6
  337. package/dist/types/generated/resources/UploadTag.d.ts +8 -8
  338. package/dist/types/generated/resources/UploadTrack.d.ts +10 -10
  339. package/dist/types/generated/resources/UsageCounter.d.ts +4 -4
  340. package/dist/types/generated/resources/User.d.ts +12 -12
  341. package/dist/types/generated/resources/Webhook.d.ts +12 -12
  342. package/dist/types/generated/resources/WebhookCall.d.ts +9 -9
  343. package/dist/types/generated/resources/WhiteLabelSettings.d.ts +6 -6
  344. package/dist/types/generated/resources/Workflow.d.ts +11 -11
  345. package/dist/types/index.d.ts +6 -4
  346. package/dist/types/resources/Role.d.ts +4 -4
  347. package/dist/types/utilities/blocks.d.ts +17 -17
  348. package/dist/types/utilities/buildBlockRecord.d.ts +5 -5
  349. package/dist/{esm/utilities/fieldValueLocalization.d.ts → types/utilities/fieldValue.d.ts} +30 -29
  350. package/dist/types/utilities/fieldsContainingReferences.d.ts +4 -4
  351. package/dist/types/utilities/recursiveBlocks.d.ts +13 -10
  352. package/dist/types/utilities/schemaRepository.d.ts +29 -26
  353. package/package.json +5 -5
  354. package/src/fieldTypes/boolean.ts +11 -0
  355. package/src/fieldTypes/color.ts +11 -0
  356. package/src/fieldTypes/date.ts +11 -0
  357. package/src/fieldTypes/date_time.ts +11 -0
  358. package/src/fieldTypes/file.ts +11 -0
  359. package/src/fieldTypes/float.ts +11 -0
  360. package/src/fieldTypes/gallery.ts +11 -0
  361. package/src/fieldTypes/integer.ts +11 -0
  362. package/src/fieldTypes/json.ts +11 -0
  363. package/src/fieldTypes/lat_lon.ts +11 -0
  364. package/src/fieldTypes/link.ts +11 -0
  365. package/src/fieldTypes/links.ts +11 -0
  366. package/src/fieldTypes/rich_text.ts +45 -15
  367. package/src/fieldTypes/seo.ts +11 -0
  368. package/src/fieldTypes/single_block.ts +76 -30
  369. package/src/fieldTypes/slug.ts +12 -1
  370. package/src/fieldTypes/string.ts +11 -0
  371. package/src/fieldTypes/structured_text.ts +63 -148
  372. package/src/fieldTypes/text.ts +11 -0
  373. package/src/fieldTypes/video.ts +11 -0
  374. package/src/generated/{SimpleSchemaTypes.ts → ApiTypes.ts} +2 -2
  375. package/src/generated/Client.ts +2 -2
  376. package/src/generated/{SchemaTypes.ts → RawApiTypes.ts} +2 -2
  377. package/src/generated/resources/AccessToken.ts +32 -34
  378. package/src/generated/resources/AuditLogEvent.ts +8 -8
  379. package/src/generated/resources/BuildEvent.ts +16 -18
  380. package/src/generated/resources/BuildTrigger.ts +30 -30
  381. package/src/generated/resources/DailyUsage.ts +5 -5
  382. package/src/generated/resources/EditingSession.ts +12 -12
  383. package/src/generated/resources/EmojiSuggestions.ts +7 -7
  384. package/src/generated/resources/Environment.ts +33 -39
  385. package/src/generated/resources/Field.ts +40 -54
  386. package/src/generated/resources/Fieldset.ts +28 -36
  387. package/src/generated/resources/Item.ts +99 -126
  388. package/src/generated/resources/ItemType.ts +37 -45
  389. package/src/generated/resources/ItemTypeFilter.ts +26 -26
  390. package/src/generated/resources/ItemVersion.ts +22 -26
  391. package/src/generated/resources/JobResult.ts +6 -8
  392. package/src/generated/resources/MaintenanceMode.ts +13 -13
  393. package/src/generated/resources/MenuItem.ts +34 -44
  394. package/src/generated/resources/Plugin.ts +30 -42
  395. package/src/generated/resources/PublicInfo.ts +5 -7
  396. package/src/generated/resources/Role.ts +29 -44
  397. package/src/generated/resources/ScheduledPublication.ts +13 -13
  398. package/src/generated/resources/ScheduledUnpublishing.ts +13 -13
  399. package/src/generated/resources/SchemaMenuItem.ts +34 -34
  400. package/src/generated/resources/SearchResult.ts +12 -12
  401. package/src/generated/resources/Session.ts +8 -10
  402. package/src/generated/resources/Site.ts +43 -47
  403. package/src/generated/resources/SiteInvitation.ts +30 -30
  404. package/src/generated/resources/SsoGroup.ts +20 -24
  405. package/src/generated/resources/SsoSettings.ts +14 -16
  406. package/src/generated/resources/SsoUser.ts +18 -22
  407. package/src/generated/resources/SubscriptionFeature.ts +5 -5
  408. package/src/generated/resources/SubscriptionLimit.ts +9 -9
  409. package/src/generated/resources/Upload.ts +57 -73
  410. package/src/generated/resources/UploadCollection.ts +34 -34
  411. package/src/generated/resources/UploadFilter.ts +26 -26
  412. package/src/generated/resources/UploadRequest.ts +8 -8
  413. package/src/generated/resources/UploadSmartTag.ts +12 -12
  414. package/src/generated/resources/UploadTag.ts +18 -20
  415. package/src/generated/resources/UploadTrack.ts +25 -29
  416. package/src/generated/resources/UsageCounter.ts +8 -8
  417. package/src/generated/resources/User.ts +28 -39
  418. package/src/generated/resources/Webhook.ts +26 -34
  419. package/src/generated/resources/WebhookCall.ts +17 -19
  420. package/src/generated/resources/WhiteLabelSettings.ts +11 -11
  421. package/src/generated/resources/Workflow.ts +23 -29
  422. package/src/index.ts +8 -4
  423. package/src/resources/Role.ts +6 -6
  424. package/src/utilities/blocks.ts +30 -30
  425. package/src/utilities/buildBlockRecord.ts +4 -4
  426. package/src/utilities/{fieldValueLocalization.ts → fieldValue.ts} +59 -74
  427. package/src/utilities/fieldsContainingReferences.ts +4 -4
  428. package/src/utilities/recursiveBlocks.ts +47 -44
  429. package/src/utilities/schemaRepository.ts +53 -56
  430. package/dist/cjs/generated/SchemaTypes.js.map +0 -1
  431. package/dist/cjs/generated/SimpleSchemaTypes.js.map +0 -1
  432. package/dist/cjs/utilities/fieldValueLocalization.js.map +0 -1
  433. package/dist/cjs/utilities/structuredText.js +0 -371
  434. package/dist/cjs/utilities/structuredText.js.map +0 -1
  435. package/dist/esm/generated/SchemaTypes.js +0 -2
  436. package/dist/esm/generated/SchemaTypes.js.map +0 -1
  437. package/dist/esm/generated/SimpleSchemaTypes.js +0 -2
  438. package/dist/esm/generated/SimpleSchemaTypes.js.map +0 -1
  439. package/dist/esm/utilities/fieldValueLocalization.js.map +0 -1
  440. package/dist/esm/utilities/structuredText.d.ts +0 -177
  441. package/dist/esm/utilities/structuredText.js +0 -354
  442. package/dist/esm/utilities/structuredText.js.map +0 -1
  443. package/dist/types/utilities/structuredText.d.ts +0 -177
  444. package/src/utilities/structuredText.ts +0 -590
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { ColorPickerEditorConfiguration } from './appearance/color_picker';
2
3
  import type { RequiredValidator } from './validators/required';
3
4
 
@@ -20,6 +21,16 @@ export function isColorFieldValue(value: unknown): value is ColorFieldValue {
20
21
  );
21
22
  }
22
23
 
24
+ export function isLocalizedColorFieldValue(
25
+ value: unknown,
26
+ ): value is LocalizedFieldValue<ColorFieldValue> {
27
+ return (
28
+ typeof value === 'object' &&
29
+ value !== null &&
30
+ Object.values(value).every(isColorFieldValue)
31
+ );
32
+ }
33
+
23
34
  export type ColorFieldValidators = {
24
35
  /** Value must be specified or it won't be valid */
25
36
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { DatePickerEditorConfiguration } from './appearance/date_picker';
2
3
  import type { DateRangeValidator } from './validators/date_range';
3
4
  import type { RequiredValidator } from './validators/required';
@@ -9,6 +10,16 @@ export function isDateFieldValue(value: unknown): value is DateFieldValue {
9
10
  return typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value);
10
11
  }
11
12
 
13
+ export function isLocalizedDateFieldValue(
14
+ value: unknown,
15
+ ): value is LocalizedFieldValue<DateFieldValue> {
16
+ return (
17
+ typeof value === 'object' &&
18
+ value !== null &&
19
+ Object.values(value).every(isDateFieldValue)
20
+ );
21
+ }
22
+
12
23
  export type DateFieldValidators = {
13
24
  /** Value must be specified or it won't be valid */
14
25
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { DateTimePickerEditorConfiguration } from './appearance/date_time_picker';
2
3
  import type { DateTimeRangeValidator } from './validators/date_time_range';
3
4
  import type { RequiredValidator } from './validators/required';
@@ -14,6 +15,16 @@ export function isDateTimeFieldValue(
14
15
  );
15
16
  }
16
17
 
18
+ export function isLocalizedDateTimeFieldValue(
19
+ value: unknown,
20
+ ): value is LocalizedFieldValue<DateTimeFieldValue> {
21
+ return (
22
+ typeof value === 'object' &&
23
+ value !== null &&
24
+ Object.values(value).every(isDateTimeFieldValue)
25
+ );
26
+ }
27
+
17
28
  export type DateTimeFieldValidators = {
18
29
  /** Value must be specified or it won't be valid */
19
30
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { FileEditorConfiguration } from './appearance/file';
2
3
  import type { ExtensionValidator } from './validators/extension';
3
4
  import type { FileSizeValidator } from './validators/file_size';
@@ -22,6 +23,16 @@ export function isFileFieldValue(value: unknown): value is FileFieldValue {
22
23
  return typeof value === 'object' && value !== null && 'upload_id' in value;
23
24
  }
24
25
 
26
+ export function isLocalizedFileFieldValue(
27
+ value: unknown,
28
+ ): value is LocalizedFieldValue<FileFieldValue> {
29
+ return (
30
+ typeof value === 'object' &&
31
+ value !== null &&
32
+ Object.values(value).every(isFileFieldValue)
33
+ );
34
+ }
35
+
25
36
  export type FileFieldValidators = {
26
37
  /** Value must be specified or it won't be valid */
27
38
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { FloatEditorConfiguration } from './appearance/float';
2
3
  import type { NumberRangeValidator } from './validators/number_range';
3
4
  import type { RequiredValidator } from './validators/required';
@@ -8,6 +9,16 @@ export function isFloatFieldValue(value: unknown): value is FloatFieldValue {
8
9
  return typeof value === 'number' || value === null;
9
10
  }
10
11
 
12
+ export function isLocalizedFloatFieldValue(
13
+ value: unknown,
14
+ ): value is LocalizedFieldValue<FloatFieldValue> {
15
+ return (
16
+ typeof value === 'object' &&
17
+ value !== null &&
18
+ Object.values(value).every(isFloatFieldValue)
19
+ );
20
+ }
21
+
11
22
  export type FloatFieldValidators = {
12
23
  /** Value must be specified or it won't be valid */
13
24
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { GalleryEditorConfiguration } from './appearance/gallery';
2
3
  import type { ExtensionValidator } from './validators/extension';
3
4
  import type { FileSizeValidator } from './validators/file_size';
@@ -30,6 +31,16 @@ export function isGalleryFieldValue(
30
31
  );
31
32
  }
32
33
 
34
+ export function isLocalizedGalleryFieldValue(
35
+ value: unknown,
36
+ ): value is LocalizedFieldValue<GalleryFieldValue> {
37
+ return (
38
+ typeof value === 'object' &&
39
+ value !== null &&
40
+ Object.values(value).every(isGalleryFieldValue)
41
+ );
42
+ }
43
+
33
44
  export type GalleryFieldValidators = {
34
45
  /** Only accept a number of items within the specified range */
35
46
  size?: SizeValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { IntegerEditorConfiguration } from './appearance/integer';
2
3
  import type { NumberRangeValidator } from './validators/number_range';
3
4
  import type { RequiredValidator } from './validators/required';
@@ -10,6 +11,16 @@ export function isIntegerFieldValue(
10
11
  return typeof value === 'number' || value === null;
11
12
  }
12
13
 
14
+ export function isLocalizedIntegerFieldValue(
15
+ value: unknown,
16
+ ): value is LocalizedFieldValue<IntegerFieldValue> {
17
+ return (
18
+ typeof value === 'object' &&
19
+ value !== null &&
20
+ Object.values(value).every(isIntegerFieldValue)
21
+ );
22
+ }
23
+
13
24
  export type IntegerFieldValidators = {
14
25
  /** Value must be specified or it won't be valid */
15
26
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { JsonEditorConfiguration } from './appearance/json';
2
3
  import type { StringCheckboxGroupEditorConfiguration } from './appearance/string_checkbox_group';
3
4
  import type { StringMultiSelectEditorConfiguration } from './appearance/string_multi_select';
@@ -16,6 +17,16 @@ export function isJsonFieldValue(value: unknown): value is JsonFieldValue {
16
17
  }
17
18
  }
18
19
 
20
+ export function isLocalizedJsonFieldValue(
21
+ value: unknown,
22
+ ): value is LocalizedFieldValue<JsonFieldValue> {
23
+ return (
24
+ typeof value === 'object' &&
25
+ value !== null &&
26
+ Object.values(value).every(isJsonFieldValue)
27
+ );
28
+ }
29
+
19
30
  export type JsonFieldValidators = {
20
31
  /** Value must be specified or it won't be valid */
21
32
  required?: RequiredValidator;
@@ -1,3 +1,4 @@
1
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
1
2
  import type { MapEditorConfiguration } from './appearance/map';
2
3
  import type { RequiredValidator } from './validators/required';
3
4
 
@@ -18,6 +19,16 @@ export function isLocationFieldValue(
18
19
  );
19
20
  }
20
21
 
22
+ export function isLocalizedLocationFieldValue(
23
+ value: unknown,
24
+ ): value is LocalizedFieldValue<LocationFieldValue> {
25
+ return (
26
+ typeof value === 'object' &&
27
+ value !== null &&
28
+ Object.values(value).every(isLocationFieldValue)
29
+ );
30
+ }
31
+
21
32
  export type LocationFieldValidators = {
22
33
  /** Value must be specified or it won't be valid */
23
34
  required?: RequiredValidator;
@@ -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';
@@ -10,6 +11,16 @@ export function isLinkFieldValue(value: unknown): value is LinkFieldValue {
10
11
  return typeof value === 'string' || value === null;
11
12
  }
12
13
 
14
+ export function isLocalizedLinkFieldValue(
15
+ value: unknown,
16
+ ): value is LocalizedFieldValue<LinkFieldValue> {
17
+ return (
18
+ typeof value === 'object' &&
19
+ value !== null &&
20
+ Object.values(value).every(isLinkFieldValue)
21
+ );
22
+ }
23
+
13
24
  export type LinkFieldValidators = {
14
25
  /** Only accept references to records of the specified models */
15
26
  item_item_type: ItemItemTypeValidator;
@@ -1,3 +1,4 @@
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';
@@ -12,6 +13,16 @@ export function isLinksFieldValue(value: unknown): value is LinksFieldValue {
12
13
  );
13
14
  }
14
15
 
16
+ export function isLocalizedLinksFieldValue(
17
+ value: unknown,
18
+ ): value is LocalizedFieldValue<LinksFieldValue> {
19
+ return (
20
+ typeof value === 'object' &&
21
+ value !== null &&
22
+ Object.values(value).every(isLinksFieldValue)
23
+ );
24
+ }
25
+
15
26
  export type LinksFieldValidators = {
16
27
  /** Only accept references to records of the specified models */
17
28
  items_item_type: ItemsItemTypeValidator;
@@ -1,10 +1,14 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
1
+ import type * as RawApiTypes from '../generated/RawApiTypes';
2
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
3
+ import type { RichTextEditorConfiguration } from './appearance/rich_text';
2
4
  import {
3
5
  type BlockItemInARequest,
4
- isBlockObject,
5
- isBlockObjectWithId,
6
- isBlockStringId,
6
+ isItemId,
7
+ isItemWithOptionalIdAndMeta,
8
+ isItemWithOptionalMeta,
7
9
  } from './single_block';
10
+ import type { RichTextBlocksValidator } from './validators/rich_text_blocks';
11
+ import type { SizeValidator } from './validators/size';
8
12
 
9
13
  /**
10
14
  * MODULAR CONTENT FIELD TYPE SYSTEM FOR DATOCMS
@@ -53,8 +57,8 @@ export type RichTextFieldValue = string[] | null;
53
57
  /**
54
58
  * Modular Content field value for API requests - allows flexible block representations:
55
59
  * - string: Just the block ID (most common case)
56
- * - SchemaTypes.Item: Full block object with ID (for updates)
57
- * - Omit<SchemaTypes.Item, 'id'>: Block object without ID (for creation)
60
+ * - RawApiTypes.Item: Full block object with ID (for updates)
61
+ * - Omit<RawApiTypes.Item, 'id'>: Block object without ID (for creation)
58
62
  */
59
63
  export type RichTextFieldValueAsRequest = BlockItemInARequest[] | null;
60
64
 
@@ -64,14 +68,14 @@ export type RichTextFieldValueAsRequest = BlockItemInARequest[] | null;
64
68
  * =============================================================================
65
69
  *
66
70
  * When using the ?nested=true query parameter, the API returns Modular Content data
67
- * with embedded blocks fully populated as complete SchemaTypes.Item objects instead
71
+ * with embedded blocks fully populated as complete RawApiTypes.Item objects instead
68
72
  * of just string IDs. This provides type safety for working with fully resolved data.
69
73
  */
70
74
 
71
75
  /**
72
76
  * Modular Content field value with nested blocks - array of fully populated block objects
73
77
  */
74
- export type RichTextFieldValueWithNestedBlocks = SchemaTypes.Item[] | null;
78
+ export type RichTextFieldValueWithNestedBlocks = RawApiTypes.Item[] | null;
75
79
 
76
80
  /**
77
81
  * =============================================================================
@@ -93,6 +97,16 @@ export function isRichTextFieldValue(
93
97
  );
94
98
  }
95
99
 
100
+ export function isLocalizedRichTextFieldValue(
101
+ value: unknown,
102
+ ): value is LocalizedFieldValue<RichTextFieldValue> {
103
+ return (
104
+ typeof value === 'object' &&
105
+ value !== null &&
106
+ Object.values(value).every(isRichTextFieldValue)
107
+ );
108
+ }
109
+
96
110
  /**
97
111
  * Type guard for Modular Content field values in API request format.
98
112
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
@@ -106,16 +120,26 @@ export function isRichTextFieldValueAsRequest(
106
120
 
107
121
  return value.every((block) => {
108
122
  // String ID - referencing existing block
109
- if (isBlockStringId(block)) return true;
123
+ if (isItemId(block)) return true;
110
124
 
111
125
  // Object (either with or without ID for updates/creation)
112
- return isBlockObject(block);
126
+ return isItemWithOptionalIdAndMeta(block);
113
127
  });
114
128
  }
115
129
 
130
+ export function isLocalizedRichTextFieldValueAsRequest(
131
+ value: unknown,
132
+ ): value is LocalizedFieldValue<RichTextFieldValueAsRequest> {
133
+ return (
134
+ typeof value === 'object' &&
135
+ value !== null &&
136
+ Object.values(value).every(isRichTextFieldValueAsRequest)
137
+ );
138
+ }
139
+
116
140
  /**
117
141
  * Type guard for Modular Content field values with nested blocks (?nested=true format).
118
- * Ensures all blocks are full SchemaTypes.Item objects with complete data.
142
+ * Ensures all blocks are full RawApiTypes.Item objects with complete data.
119
143
  */
120
144
  export function isRichTextFieldValueWithNestedBlocks(
121
145
  value: unknown,
@@ -126,13 +150,19 @@ export function isRichTextFieldValueWithNestedBlocks(
126
150
 
127
151
  return value.every((block) => {
128
152
  // Must be a full object with ID (nested format always includes complete block objects)
129
- return isBlockObjectWithId(block);
153
+ return isItemWithOptionalMeta(block);
130
154
  });
131
155
  }
132
156
 
133
- import type { RichTextEditorConfiguration } from './appearance/rich_text';
134
- import type { RichTextBlocksValidator } from './validators/rich_text_blocks';
135
- import type { SizeValidator } from './validators/size';
157
+ export function isLocalizedRichTextFieldValueWithNestedBlocks(
158
+ value: unknown,
159
+ ): value is LocalizedFieldValue<RichTextFieldValueWithNestedBlocks> {
160
+ return (
161
+ typeof value === 'object' &&
162
+ value !== null &&
163
+ Object.values(value).every(isRichTextFieldValueWithNestedBlocks)
164
+ );
165
+ }
136
166
 
137
167
  export type RichTextFieldValidators = {
138
168
  /** Only accept references to block records of the specified block models */
@@ -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';
@@ -27,6 +28,16 @@ export function isSeoFieldValue(value: unknown): value is SeoFieldValue {
27
28
  );
28
29
  }
29
30
 
31
+ export function isLocalizedSeoFieldValue(
32
+ value: unknown,
33
+ ): value is LocalizedFieldValue<SeoFieldValue> {
34
+ return (
35
+ typeof value === 'object' &&
36
+ value !== null &&
37
+ Object.values(value).every(isSeoFieldValue)
38
+ );
39
+ }
40
+
30
41
  export type SeoFieldValidators = {
31
42
  /** SEO field has to specify one or more properties, or it won't be valid */
32
43
  required_seo_fields?: RequiredSeoFieldsValidator;
@@ -1,4 +1,10 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
1
+ import type * as RawApiTypes from '../generated/RawApiTypes';
2
+ import type { LocalizedFieldValue } from '../utilities/fieldValue';
3
+
4
+ import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
5
+ import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
6
+ import type { RequiredValidator } from './validators/required';
7
+ import type { SingleBlockBlocksValidator } from './validators/single_block_blocks';
2
8
 
3
9
  /**
4
10
  * SINGLE BLOCK FIELD TYPE SYSTEM FOR DATOCMS
@@ -44,23 +50,34 @@ export type SingleBlockFieldValue = string | null;
44
50
  * - Omit ID for new blocks being created
45
51
  */
46
52
 
53
+ /** Represents an existing block in a CMA request */
54
+ export type UnchangedBlockInARequest = string;
55
+ /** Represents a block we want to update in a CMA request */
56
+ export type UpdatedBlockInARequest = OptionalFields<RawApiTypes.Item, 'meta'>;
57
+ /** Represents a new block to create in a CMA request */
58
+ export type NewBlockInARequest = OptionalFields<
59
+ RawApiTypes.Item,
60
+ 'id' | 'meta'
61
+ >;
62
+
47
63
  /**
48
64
  * Union type representing the different ways a block can be specified in API requests:
49
- * - string: Just the block ID (most common case)
50
- * - Full block object with ID (for updates)
51
- * - Block object without ID (for creation)
65
+ * - string: Just the block ID (to keep existing blocks unchanged)
66
+ * - Full block object with ID (to update an existing block)
67
+ * - Block object without ID (to create a new block)
52
68
  *
53
69
  * Also, 'meta' can always be omitted
54
70
  */
55
71
  export type BlockItemInARequest =
56
- | string
57
- | OptionalFields<SchemaTypes.Item, 'id' | 'meta'>;
72
+ | UnchangedBlockInARequest
73
+ | UpdatedBlockInARequest
74
+ | NewBlockInARequest;
58
75
 
59
76
  /**
60
77
  * Single Block field value for API requests - allows flexible block representations:
61
- * - string: Just the block ID (most common case)
62
- * - SchemaTypes.Item: Full block object with ID (for updates)
63
- * - Omit<SchemaTypes.Item, 'id'>: Block object without ID (for creation)
78
+ * - string: Just the block ID (to keep existing blocks unchanged)
79
+ * - Full block object with ID (to update an existing block)
80
+ * - Block object without ID (to create a new block)
64
81
  */
65
82
  export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
66
83
 
@@ -70,14 +87,14 @@ export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
70
87
  * =============================================================================
71
88
  *
72
89
  * When using the ?nested=true query parameter, the API returns Single Block data
73
- * with embedded block fully populated as complete SchemaTypes.Item object instead
90
+ * with embedded block fully populated as complete RawApiTypes.Item object instead
74
91
  * of just string ID. This provides type safety for working with fully resolved data.
75
92
  */
76
93
 
77
94
  /**
78
95
  * Single Block field value with nested block - fully populated block object
79
96
  */
80
- export type SingleBlockFieldValueWithNestedBlocks = SchemaTypes.Item | null;
97
+ export type SingleBlockFieldValueWithNestedBlocks = RawApiTypes.Item | null;
81
98
 
82
99
  /**
83
100
  * =============================================================================
@@ -87,21 +104,21 @@ export type SingleBlockFieldValueWithNestedBlocks = SchemaTypes.Item | null;
87
104
  */
88
105
 
89
106
  /**
90
- * Validates if a single block item is a string ID
107
+ * Validates if the input is a valid item (either block or record) ID
91
108
  */
92
- export function isBlockStringId(block: unknown): block is string {
93
- return typeof block === 'string';
109
+ export function isItemId(input: unknown): input is string {
110
+ return typeof input === 'string';
94
111
  }
95
112
 
96
113
  export type ItemWithOptionalIdAndMeta = OptionalFields<
97
- SchemaTypes.Item,
114
+ RawApiTypes.Item,
98
115
  'id' | 'meta'
99
116
  >;
100
117
 
101
118
  /**
102
- * Validates if a single block item is a SchemaTypes.Item object (with or without ID)
119
+ * Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
103
120
  */
104
- export function isBlockObject(
121
+ export function isItemWithOptionalIdAndMeta(
105
122
  block: unknown,
106
123
  ): block is ItemWithOptionalIdAndMeta {
107
124
  return (
@@ -112,15 +129,19 @@ export function isBlockObject(
112
129
  );
113
130
  }
114
131
 
115
- export type ItemWithOptionalMeta = OptionalFields<SchemaTypes.Item, 'meta'>;
132
+ export type ItemWithOptionalMeta = OptionalFields<RawApiTypes.Item, 'meta'>;
116
133
 
117
134
  /**
118
- * Validates if a single block item is a complete SchemaTypes.Item object with ID
135
+ * Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
119
136
  */
120
- export function isBlockObjectWithId(
137
+ export function isItemWithOptionalMeta(
121
138
  block: unknown,
122
139
  ): block is ItemWithOptionalMeta {
123
- return isBlockObject(block) && 'id' in block && typeof block.id === 'string';
140
+ return (
141
+ isItemWithOptionalIdAndMeta(block) &&
142
+ 'id' in block &&
143
+ typeof block.id === 'string'
144
+ );
124
145
  }
125
146
 
126
147
  /**
@@ -139,6 +160,16 @@ export function isSingleBlockFieldValue(
139
160
  return typeof value === 'string' || value === null;
140
161
  }
141
162
 
163
+ export function isLocalizedSingleBlockFieldValue(
164
+ value: unknown,
165
+ ): value is LocalizedFieldValue<SingleBlockFieldValue> {
166
+ return (
167
+ typeof value === 'object' &&
168
+ value !== null &&
169
+ Object.values(value).every(isSingleBlockFieldValue)
170
+ );
171
+ }
172
+
142
173
  /**
143
174
  * Type guard for Single Block field values in API request format.
144
175
  * Allows block as string ID, full object with ID, or object without ID.
@@ -148,16 +179,26 @@ export function isSingleBlockFieldValueAsRequest(
148
179
  ): value is SingleBlockFieldValueAsRequest {
149
180
  if (value === null) return true;
150
181
 
151
- // String ID _ referencing existing block
152
- if (isBlockStringId(value)) return true;
182
+ // String ID - referencing existing block
183
+ if (isItemId(value)) return true;
153
184
 
154
185
  // Object (either with or without ID for updates/creation)
155
- return isBlockObject(value);
186
+ return isItemWithOptionalIdAndMeta(value);
187
+ }
188
+
189
+ export function isLocalizedSingleBlockFieldValueAsRequest(
190
+ value: unknown,
191
+ ): value is LocalizedFieldValue<SingleBlockFieldValueAsRequest> {
192
+ return (
193
+ typeof value === 'object' &&
194
+ value !== null &&
195
+ Object.values(value).every(isSingleBlockFieldValueAsRequest)
196
+ );
156
197
  }
157
198
 
158
199
  /**
159
200
  * Type guard for Single Block field values with nested blocks (?nested=true format).
160
- * Ensures block is a full SchemaTypes.Item object with complete data.
201
+ * Ensures block is a full RawApiTypes.Item object with complete data.
161
202
  */
162
203
  export function isSingleBlockFieldValueWithNestedBlocks(
163
204
  value: unknown,
@@ -165,13 +206,18 @@ export function isSingleBlockFieldValueWithNestedBlocks(
165
206
  if (value === null) return true;
166
207
 
167
208
  // Must be a full object with ID (nested format always includes complete block objects)
168
- return isBlockObjectWithId(value);
209
+ return isItemWithOptionalMeta(value);
169
210
  }
170
211
 
171
- import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
172
- import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
173
- import type { RequiredValidator } from './validators/required';
174
- import type { SingleBlockBlocksValidator } from './validators/single_block_blocks';
212
+ export function isLocalizedSingleBlockFieldValueWithNestedBlocks(
213
+ value: unknown,
214
+ ): value is LocalizedFieldValue<SingleBlockFieldValueWithNestedBlocks> {
215
+ return (
216
+ typeof value === 'object' &&
217
+ value !== null &&
218
+ Object.values(value).every(isSingleBlockFieldValueWithNestedBlocks)
219
+ );
220
+ }
175
221
 
176
222
  export type SingleBlockFieldValidators = {
177
223
  /** Only accept references to block records of the specified block models */
@@ -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';
@@ -8,7 +9,17 @@ export type SlugFieldValue = string | null;
8
9
 
9
10
  export function isSlugFieldValue(value: unknown): value is SlugFieldValue {
10
11
  if (value === null) return true;
11
- return typeof value === 'string' && /^[a-z0-9_]+(?:-[a-z0-9]+)*$/.test(value);
12
+ return typeof value === 'string';
13
+ }
14
+
15
+ export function isLocalizedSlugFieldValue(
16
+ value: unknown,
17
+ ): value is LocalizedFieldValue<SlugFieldValue> {
18
+ return (
19
+ typeof value === 'object' &&
20
+ value !== null &&
21
+ Object.values(value).every(isSlugFieldValue)
22
+ );
12
23
  }
13
24
 
14
25
  export type SlugFieldValidators = {
@@ -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';
@@ -13,6 +14,16 @@ export function isStringFieldValue(value: unknown): value is StringFieldValue {
13
14
  return typeof value === 'string' || value === null;
14
15
  }
15
16
 
17
+ export function isLocalizedStringFieldValue(
18
+ value: unknown,
19
+ ): value is LocalizedFieldValue<StringFieldValue> {
20
+ return (
21
+ typeof value === 'object' &&
22
+ value !== null &&
23
+ Object.values(value).every(isStringFieldValue)
24
+ );
25
+ }
26
+
16
27
  export type StringFieldValidators = {
17
28
  /** Value must be specified or it won't be valid */
18
29
  required?: RequiredValidator;