@datocms/cma-client 5.1.0 → 5.1.2

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 (329) hide show
  1. package/dist/cjs/fieldTypes/rich_text.js +7 -7
  2. package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
  3. package/dist/cjs/fieldTypes/single_block.js +21 -19
  4. package/dist/cjs/fieldTypes/single_block.js.map +1 -1
  5. package/dist/cjs/fieldTypes/structured_text.js +12 -24
  6. package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
  7. package/dist/cjs/generated/{SchemaTypes.js → ApiTypes.js} +1 -1
  8. package/dist/cjs/generated/ApiTypes.js.map +1 -0
  9. package/dist/cjs/generated/Client.js +1 -1
  10. package/dist/cjs/generated/{SimpleSchemaTypes.js → RawApiTypes.js} +1 -1
  11. package/dist/cjs/generated/RawApiTypes.js.map +1 -0
  12. package/dist/cjs/generated/resources/AccessToken.js.map +1 -1
  13. package/dist/cjs/generated/resources/AuditLogEvent.js.map +1 -1
  14. package/dist/cjs/generated/resources/BuildEvent.js.map +1 -1
  15. package/dist/cjs/generated/resources/BuildTrigger.js.map +1 -1
  16. package/dist/cjs/generated/resources/EditingSession.js.map +1 -1
  17. package/dist/cjs/generated/resources/EmojiSuggestions.js.map +1 -1
  18. package/dist/cjs/generated/resources/Environment.js.map +1 -1
  19. package/dist/cjs/generated/resources/Field.js.map +1 -1
  20. package/dist/cjs/generated/resources/Fieldset.js.map +1 -1
  21. package/dist/cjs/generated/resources/Item.js.map +1 -1
  22. package/dist/cjs/generated/resources/ItemType.js.map +1 -1
  23. package/dist/cjs/generated/resources/ItemTypeFilter.js.map +1 -1
  24. package/dist/cjs/generated/resources/ItemVersion.js.map +1 -1
  25. package/dist/cjs/generated/resources/JobResult.js.map +1 -1
  26. package/dist/cjs/generated/resources/MaintenanceMode.js.map +1 -1
  27. package/dist/cjs/generated/resources/MenuItem.js.map +1 -1
  28. package/dist/cjs/generated/resources/Plugin.js.map +1 -1
  29. package/dist/cjs/generated/resources/PublicInfo.js.map +1 -1
  30. package/dist/cjs/generated/resources/Role.js.map +1 -1
  31. package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
  32. package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
  33. package/dist/cjs/generated/resources/SchemaMenuItem.js.map +1 -1
  34. package/dist/cjs/generated/resources/SearchResult.js.map +1 -1
  35. package/dist/cjs/generated/resources/Session.js.map +1 -1
  36. package/dist/cjs/generated/resources/Site.js.map +1 -1
  37. package/dist/cjs/generated/resources/SiteInvitation.js.map +1 -1
  38. package/dist/cjs/generated/resources/SsoGroup.js.map +1 -1
  39. package/dist/cjs/generated/resources/SsoSettings.js.map +1 -1
  40. package/dist/cjs/generated/resources/SsoUser.js.map +1 -1
  41. package/dist/cjs/generated/resources/SubscriptionLimit.js.map +1 -1
  42. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  43. package/dist/cjs/generated/resources/UploadCollection.js.map +1 -1
  44. package/dist/cjs/generated/resources/UploadFilter.js.map +1 -1
  45. package/dist/cjs/generated/resources/UploadRequest.js.map +1 -1
  46. package/dist/cjs/generated/resources/UploadSmartTag.js.map +1 -1
  47. package/dist/cjs/generated/resources/UploadTag.js.map +1 -1
  48. package/dist/cjs/generated/resources/UploadTrack.js.map +1 -1
  49. package/dist/cjs/generated/resources/UsageCounter.js.map +1 -1
  50. package/dist/cjs/generated/resources/User.js.map +1 -1
  51. package/dist/cjs/generated/resources/Webhook.js.map +1 -1
  52. package/dist/cjs/generated/resources/WebhookCall.js.map +1 -1
  53. package/dist/cjs/generated/resources/WhiteLabelSettings.js.map +1 -1
  54. package/dist/cjs/generated/resources/Workflow.js.map +1 -1
  55. package/dist/cjs/index.js +2 -5
  56. package/dist/cjs/index.js.map +1 -1
  57. package/dist/cjs/resources/Role.js.map +1 -1
  58. package/dist/cjs/utilities/blocks.js +7 -7
  59. package/dist/cjs/utilities/blocks.js.map +1 -1
  60. package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
  61. package/dist/cjs/utilities/fieldValue.js +253 -0
  62. package/dist/cjs/utilities/fieldValue.js.map +1 -0
  63. package/dist/cjs/utilities/fieldsContainingReferences.js.map +1 -1
  64. package/dist/cjs/utilities/recursiveBlocks.js +18 -19
  65. package/dist/cjs/utilities/recursiveBlocks.js.map +1 -1
  66. package/dist/cjs/utilities/schemaRepository.js.map +1 -1
  67. package/dist/esm/fieldTypes/rich_text.d.ts +7 -7
  68. package/dist/esm/fieldTypes/rich_text.js +6 -6
  69. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  70. package/dist/esm/fieldTypes/single_block.d.ts +30 -24
  71. package/dist/esm/fieldTypes/single_block.js +16 -14
  72. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  73. package/dist/esm/fieldTypes/structured_text.d.ts +20 -85
  74. package/dist/esm/fieldTypes/structured_text.js +11 -23
  75. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  76. package/dist/esm/generated/{SimpleSchemaTypes.d.ts → ApiTypes.d.ts} +13 -8
  77. package/dist/esm/generated/ApiTypes.js +2 -0
  78. package/dist/esm/generated/ApiTypes.js.map +1 -0
  79. package/dist/esm/generated/Client.d.ts +1 -1
  80. package/dist/esm/generated/Client.js +1 -1
  81. package/dist/esm/generated/{SchemaTypes.d.ts → RawApiTypes.d.ts} +13 -8
  82. package/dist/esm/generated/RawApiTypes.js +2 -0
  83. package/dist/esm/generated/RawApiTypes.js.map +1 -0
  84. package/dist/esm/generated/resources/AccessToken.d.ts +14 -14
  85. package/dist/esm/generated/resources/AccessToken.js.map +1 -1
  86. package/dist/esm/generated/resources/AuditLogEvent.d.ts +4 -4
  87. package/dist/esm/generated/resources/AuditLogEvent.js.map +1 -1
  88. package/dist/esm/generated/resources/BuildEvent.d.ts +8 -8
  89. package/dist/esm/generated/resources/BuildEvent.js.map +1 -1
  90. package/dist/esm/generated/resources/BuildTrigger.d.ts +16 -16
  91. package/dist/esm/generated/resources/BuildTrigger.js.map +1 -1
  92. package/dist/esm/generated/resources/DailyUsage.d.ts +4 -4
  93. package/dist/esm/generated/resources/EditingSession.d.ts +7 -7
  94. package/dist/esm/generated/resources/EditingSession.js.map +1 -1
  95. package/dist/esm/generated/resources/EmojiSuggestions.d.ts +4 -4
  96. package/dist/esm/generated/resources/EmojiSuggestions.js.map +1 -1
  97. package/dist/esm/generated/resources/Environment.d.ts +14 -14
  98. package/dist/esm/generated/resources/Environment.js.map +1 -1
  99. package/dist/esm/generated/resources/Field.d.ts +213 -213
  100. package/dist/esm/generated/resources/Field.js.map +1 -1
  101. package/dist/esm/generated/resources/Fieldset.d.ts +12 -12
  102. package/dist/esm/generated/resources/Fieldset.js.map +1 -1
  103. package/dist/esm/generated/resources/Item.d.ts +36 -36
  104. package/dist/esm/generated/resources/Item.js.map +1 -1
  105. package/dist/esm/generated/resources/ItemType.d.ts +15 -15
  106. package/dist/esm/generated/resources/ItemType.js.map +1 -1
  107. package/dist/esm/generated/resources/ItemTypeFilter.d.ts +12 -12
  108. package/dist/esm/generated/resources/ItemTypeFilter.js.map +1 -1
  109. package/dist/esm/generated/resources/ItemVersion.d.ts +10 -10
  110. package/dist/esm/generated/resources/ItemVersion.js.map +1 -1
  111. package/dist/esm/generated/resources/JobResult.d.ts +4 -4
  112. package/dist/esm/generated/resources/JobResult.js.map +1 -1
  113. package/dist/esm/generated/resources/MaintenanceMode.d.ts +8 -8
  114. package/dist/esm/generated/resources/MaintenanceMode.js.map +1 -1
  115. package/dist/esm/generated/resources/MenuItem.d.ts +14 -14
  116. package/dist/esm/generated/resources/MenuItem.js.map +1 -1
  117. package/dist/esm/generated/resources/Plugin.d.ts +14 -14
  118. package/dist/esm/generated/resources/Plugin.js.map +1 -1
  119. package/dist/esm/generated/resources/PublicInfo.d.ts +4 -4
  120. package/dist/esm/generated/resources/PublicInfo.js.map +1 -1
  121. package/dist/esm/generated/resources/Role.d.ts +14 -14
  122. package/dist/esm/generated/resources/Role.js.map +1 -1
  123. package/dist/esm/generated/resources/ScheduledPublication.d.ts +6 -6
  124. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  125. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +6 -6
  126. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  127. package/dist/esm/generated/resources/SchemaMenuItem.d.ts +14 -14
  128. package/dist/esm/generated/resources/SchemaMenuItem.js.map +1 -1
  129. package/dist/esm/generated/resources/SearchResult.d.ts +6 -6
  130. package/dist/esm/generated/resources/SearchResult.js.map +1 -1
  131. package/dist/esm/generated/resources/Session.d.ts +4 -4
  132. package/dist/esm/generated/resources/Session.js.map +1 -1
  133. package/dist/esm/generated/resources/Site.d.ts +24 -24
  134. package/dist/esm/generated/resources/Site.js.map +1 -1
  135. package/dist/esm/generated/resources/SiteInvitation.d.ts +14 -14
  136. package/dist/esm/generated/resources/SiteInvitation.js.map +1 -1
  137. package/dist/esm/generated/resources/SsoGroup.d.ts +10 -10
  138. package/dist/esm/generated/resources/SsoGroup.js.map +1 -1
  139. package/dist/esm/generated/resources/SsoSettings.d.ts +8 -8
  140. package/dist/esm/generated/resources/SsoSettings.js.map +1 -1
  141. package/dist/esm/generated/resources/SsoUser.d.ts +10 -10
  142. package/dist/esm/generated/resources/SsoUser.js.map +1 -1
  143. package/dist/esm/generated/resources/SubscriptionFeature.d.ts +4 -4
  144. package/dist/esm/generated/resources/SubscriptionLimit.d.ts +6 -6
  145. package/dist/esm/generated/resources/SubscriptionLimit.js.map +1 -1
  146. package/dist/esm/generated/resources/Upload.d.ts +22 -22
  147. package/dist/esm/generated/resources/Upload.js.map +1 -1
  148. package/dist/esm/generated/resources/UploadCollection.d.ts +14 -14
  149. package/dist/esm/generated/resources/UploadCollection.js.map +1 -1
  150. package/dist/esm/generated/resources/UploadFilter.d.ts +12 -12
  151. package/dist/esm/generated/resources/UploadFilter.js.map +1 -1
  152. package/dist/esm/generated/resources/UploadRequest.d.ts +4 -4
  153. package/dist/esm/generated/resources/UploadRequest.js.map +1 -1
  154. package/dist/esm/generated/resources/UploadSmartTag.d.ts +6 -6
  155. package/dist/esm/generated/resources/UploadSmartTag.js.map +1 -1
  156. package/dist/esm/generated/resources/UploadTag.d.ts +8 -8
  157. package/dist/esm/generated/resources/UploadTag.js.map +1 -1
  158. package/dist/esm/generated/resources/UploadTrack.d.ts +10 -10
  159. package/dist/esm/generated/resources/UploadTrack.js.map +1 -1
  160. package/dist/esm/generated/resources/UsageCounter.d.ts +4 -4
  161. package/dist/esm/generated/resources/UsageCounter.js.map +1 -1
  162. package/dist/esm/generated/resources/User.d.ts +12 -12
  163. package/dist/esm/generated/resources/User.js.map +1 -1
  164. package/dist/esm/generated/resources/Webhook.d.ts +12 -12
  165. package/dist/esm/generated/resources/Webhook.js.map +1 -1
  166. package/dist/esm/generated/resources/WebhookCall.d.ts +9 -9
  167. package/dist/esm/generated/resources/WebhookCall.js.map +1 -1
  168. package/dist/esm/generated/resources/WhiteLabelSettings.d.ts +6 -6
  169. package/dist/esm/generated/resources/WhiteLabelSettings.js.map +1 -1
  170. package/dist/esm/generated/resources/Workflow.d.ts +11 -11
  171. package/dist/esm/generated/resources/Workflow.js.map +1 -1
  172. package/dist/esm/index.d.ts +5 -4
  173. package/dist/esm/index.js +1 -4
  174. package/dist/esm/index.js.map +1 -1
  175. package/dist/esm/resources/Role.d.ts +4 -4
  176. package/dist/esm/resources/Role.js.map +1 -1
  177. package/dist/esm/utilities/blocks.d.ts +17 -17
  178. package/dist/esm/utilities/blocks.js +3 -3
  179. package/dist/esm/utilities/blocks.js.map +1 -1
  180. package/dist/esm/utilities/buildBlockRecord.d.ts +5 -5
  181. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  182. package/dist/esm/utilities/fieldValue.d.ts +166 -0
  183. package/dist/esm/utilities/fieldValue.js +237 -0
  184. package/dist/esm/utilities/fieldValue.js.map +1 -0
  185. package/dist/esm/utilities/fieldsContainingReferences.d.ts +4 -4
  186. package/dist/esm/utilities/fieldsContainingReferences.js.map +1 -1
  187. package/dist/esm/utilities/recursiveBlocks.d.ts +13 -10
  188. package/dist/esm/utilities/recursiveBlocks.js +19 -20
  189. package/dist/esm/utilities/recursiveBlocks.js.map +1 -1
  190. package/dist/esm/utilities/schemaRepository.d.ts +29 -26
  191. package/dist/esm/utilities/schemaRepository.js.map +1 -1
  192. package/dist/types/fieldTypes/rich_text.d.ts +7 -7
  193. package/dist/types/fieldTypes/single_block.d.ts +30 -24
  194. package/dist/types/fieldTypes/structured_text.d.ts +20 -85
  195. package/dist/types/generated/{SimpleSchemaTypes.d.ts → ApiTypes.d.ts} +13 -8
  196. package/dist/types/generated/Client.d.ts +1 -1
  197. package/dist/types/generated/{SchemaTypes.d.ts → RawApiTypes.d.ts} +13 -8
  198. package/dist/types/generated/resources/AccessToken.d.ts +14 -14
  199. package/dist/types/generated/resources/AuditLogEvent.d.ts +4 -4
  200. package/dist/types/generated/resources/BuildEvent.d.ts +8 -8
  201. package/dist/types/generated/resources/BuildTrigger.d.ts +16 -16
  202. package/dist/types/generated/resources/DailyUsage.d.ts +4 -4
  203. package/dist/types/generated/resources/EditingSession.d.ts +7 -7
  204. package/dist/types/generated/resources/EmojiSuggestions.d.ts +4 -4
  205. package/dist/types/generated/resources/Environment.d.ts +14 -14
  206. package/dist/types/generated/resources/Field.d.ts +213 -213
  207. package/dist/types/generated/resources/Fieldset.d.ts +12 -12
  208. package/dist/types/generated/resources/Item.d.ts +36 -36
  209. package/dist/types/generated/resources/ItemType.d.ts +15 -15
  210. package/dist/types/generated/resources/ItemTypeFilter.d.ts +12 -12
  211. package/dist/types/generated/resources/ItemVersion.d.ts +10 -10
  212. package/dist/types/generated/resources/JobResult.d.ts +4 -4
  213. package/dist/types/generated/resources/MaintenanceMode.d.ts +8 -8
  214. package/dist/types/generated/resources/MenuItem.d.ts +14 -14
  215. package/dist/types/generated/resources/Plugin.d.ts +14 -14
  216. package/dist/types/generated/resources/PublicInfo.d.ts +4 -4
  217. package/dist/types/generated/resources/Role.d.ts +14 -14
  218. package/dist/types/generated/resources/ScheduledPublication.d.ts +6 -6
  219. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +6 -6
  220. package/dist/types/generated/resources/SchemaMenuItem.d.ts +14 -14
  221. package/dist/types/generated/resources/SearchResult.d.ts +6 -6
  222. package/dist/types/generated/resources/Session.d.ts +4 -4
  223. package/dist/types/generated/resources/Site.d.ts +24 -24
  224. package/dist/types/generated/resources/SiteInvitation.d.ts +14 -14
  225. package/dist/types/generated/resources/SsoGroup.d.ts +10 -10
  226. package/dist/types/generated/resources/SsoSettings.d.ts +8 -8
  227. package/dist/types/generated/resources/SsoUser.d.ts +10 -10
  228. package/dist/types/generated/resources/SubscriptionFeature.d.ts +4 -4
  229. package/dist/types/generated/resources/SubscriptionLimit.d.ts +6 -6
  230. package/dist/types/generated/resources/Upload.d.ts +22 -22
  231. package/dist/types/generated/resources/UploadCollection.d.ts +14 -14
  232. package/dist/types/generated/resources/UploadFilter.d.ts +12 -12
  233. package/dist/types/generated/resources/UploadRequest.d.ts +4 -4
  234. package/dist/types/generated/resources/UploadSmartTag.d.ts +6 -6
  235. package/dist/types/generated/resources/UploadTag.d.ts +8 -8
  236. package/dist/types/generated/resources/UploadTrack.d.ts +10 -10
  237. package/dist/types/generated/resources/UsageCounter.d.ts +4 -4
  238. package/dist/types/generated/resources/User.d.ts +12 -12
  239. package/dist/types/generated/resources/Webhook.d.ts +12 -12
  240. package/dist/types/generated/resources/WebhookCall.d.ts +9 -9
  241. package/dist/types/generated/resources/WhiteLabelSettings.d.ts +6 -6
  242. package/dist/types/generated/resources/Workflow.d.ts +11 -11
  243. package/dist/types/index.d.ts +5 -4
  244. package/dist/types/resources/Role.d.ts +4 -4
  245. package/dist/types/utilities/blocks.d.ts +17 -17
  246. package/dist/types/utilities/buildBlockRecord.d.ts +5 -5
  247. package/dist/types/utilities/fieldValue.d.ts +166 -0
  248. package/dist/types/utilities/fieldsContainingReferences.d.ts +4 -4
  249. package/dist/types/utilities/recursiveBlocks.d.ts +13 -10
  250. package/dist/types/utilities/schemaRepository.d.ts +29 -26
  251. package/package.json +5 -5
  252. package/src/fieldTypes/rich_text.ts +14 -14
  253. package/src/fieldTypes/single_block.ts +48 -33
  254. package/src/fieldTypes/structured_text.ts +37 -153
  255. package/src/generated/{SimpleSchemaTypes.ts → ApiTypes.ts} +44 -9
  256. package/src/generated/Client.ts +2 -2
  257. package/src/generated/{SchemaTypes.ts → RawApiTypes.ts} +44 -9
  258. package/src/generated/resources/AccessToken.ts +32 -34
  259. package/src/generated/resources/AuditLogEvent.ts +8 -8
  260. package/src/generated/resources/BuildEvent.ts +16 -18
  261. package/src/generated/resources/BuildTrigger.ts +30 -30
  262. package/src/generated/resources/DailyUsage.ts +5 -5
  263. package/src/generated/resources/EditingSession.ts +12 -12
  264. package/src/generated/resources/EmojiSuggestions.ts +7 -7
  265. package/src/generated/resources/Environment.ts +33 -39
  266. package/src/generated/resources/Field.ts +40 -54
  267. package/src/generated/resources/Fieldset.ts +28 -36
  268. package/src/generated/resources/Item.ts +99 -126
  269. package/src/generated/resources/ItemType.ts +37 -45
  270. package/src/generated/resources/ItemTypeFilter.ts +26 -26
  271. package/src/generated/resources/ItemVersion.ts +22 -26
  272. package/src/generated/resources/JobResult.ts +6 -8
  273. package/src/generated/resources/MaintenanceMode.ts +13 -13
  274. package/src/generated/resources/MenuItem.ts +34 -44
  275. package/src/generated/resources/Plugin.ts +30 -42
  276. package/src/generated/resources/PublicInfo.ts +5 -7
  277. package/src/generated/resources/Role.ts +29 -44
  278. package/src/generated/resources/ScheduledPublication.ts +13 -13
  279. package/src/generated/resources/ScheduledUnpublishing.ts +13 -13
  280. package/src/generated/resources/SchemaMenuItem.ts +34 -34
  281. package/src/generated/resources/SearchResult.ts +12 -12
  282. package/src/generated/resources/Session.ts +8 -10
  283. package/src/generated/resources/Site.ts +43 -47
  284. package/src/generated/resources/SiteInvitation.ts +30 -30
  285. package/src/generated/resources/SsoGroup.ts +20 -24
  286. package/src/generated/resources/SsoSettings.ts +14 -16
  287. package/src/generated/resources/SsoUser.ts +18 -22
  288. package/src/generated/resources/SubscriptionFeature.ts +5 -5
  289. package/src/generated/resources/SubscriptionLimit.ts +9 -9
  290. package/src/generated/resources/Upload.ts +57 -73
  291. package/src/generated/resources/UploadCollection.ts +34 -34
  292. package/src/generated/resources/UploadFilter.ts +26 -26
  293. package/src/generated/resources/UploadRequest.ts +8 -8
  294. package/src/generated/resources/UploadSmartTag.ts +12 -12
  295. package/src/generated/resources/UploadTag.ts +18 -20
  296. package/src/generated/resources/UploadTrack.ts +25 -29
  297. package/src/generated/resources/UsageCounter.ts +8 -8
  298. package/src/generated/resources/User.ts +28 -39
  299. package/src/generated/resources/Webhook.ts +26 -34
  300. package/src/generated/resources/WebhookCall.ts +17 -19
  301. package/src/generated/resources/WhiteLabelSettings.ts +11 -11
  302. package/src/generated/resources/Workflow.ts +23 -29
  303. package/src/index.ts +7 -4
  304. package/src/resources/Role.ts +6 -6
  305. package/src/utilities/blocks.ts +36 -36
  306. package/src/utilities/buildBlockRecord.ts +4 -4
  307. package/src/utilities/{fieldValueLocalization.ts → fieldValue.ts} +161 -147
  308. package/src/utilities/fieldsContainingReferences.ts +4 -4
  309. package/src/utilities/recursiveBlocks.ts +47 -44
  310. package/src/utilities/schemaRepository.ts +53 -56
  311. package/dist/cjs/generated/SchemaTypes.js.map +0 -1
  312. package/dist/cjs/generated/SimpleSchemaTypes.js.map +0 -1
  313. package/dist/cjs/utilities/fieldValueLocalization.js +0 -218
  314. package/dist/cjs/utilities/fieldValueLocalization.js.map +0 -1
  315. package/dist/cjs/utilities/structuredText.js +0 -371
  316. package/dist/cjs/utilities/structuredText.js.map +0 -1
  317. package/dist/esm/generated/SchemaTypes.js +0 -2
  318. package/dist/esm/generated/SchemaTypes.js.map +0 -1
  319. package/dist/esm/generated/SimpleSchemaTypes.js +0 -2
  320. package/dist/esm/generated/SimpleSchemaTypes.js.map +0 -1
  321. package/dist/esm/utilities/fieldValueLocalization.d.ts +0 -123
  322. package/dist/esm/utilities/fieldValueLocalization.js +0 -204
  323. package/dist/esm/utilities/fieldValueLocalization.js.map +0 -1
  324. package/dist/esm/utilities/structuredText.d.ts +0 -177
  325. package/dist/esm/utilities/structuredText.js +0 -354
  326. package/dist/esm/utilities/structuredText.js.map +0 -1
  327. package/dist/types/utilities/fieldValueLocalization.d.ts +0 -123
  328. package/dist/types/utilities/structuredText.d.ts +0 -177
  329. package/src/utilities/structuredText.ts +0 -590
@@ -1,9 +1,9 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
1
+ import type * as RawApiTypes from '../generated/RawApiTypes';
2
2
  import {
3
3
  type BlockItemInARequest,
4
- isBlockObject,
5
- isBlockObjectWithId,
6
- isBlockStringId,
4
+ isItemId,
5
+ isItemWithOptionalIdAndMeta,
6
+ isItemWithOptionalMeta,
7
7
  } from './single_block';
8
8
 
9
9
  /**
@@ -53,8 +53,8 @@ export type RichTextFieldValue = string[] | null;
53
53
  /**
54
54
  * Modular Content field value for API requests - allows flexible block representations:
55
55
  * - 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)
56
+ * - RawApiTypes.Item: Full block object with ID (for updates)
57
+ * - Omit<RawApiTypes.Item, 'id'>: Block object without ID (for creation)
58
58
  */
59
59
  export type RichTextFieldValueAsRequest = BlockItemInARequest[] | null;
60
60
 
@@ -64,14 +64,14 @@ export type RichTextFieldValueAsRequest = BlockItemInARequest[] | null;
64
64
  * =============================================================================
65
65
  *
66
66
  * 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
67
+ * with embedded blocks fully populated as complete RawApiTypes.Item objects instead
68
68
  * of just string IDs. This provides type safety for working with fully resolved data.
69
69
  */
70
70
 
71
71
  /**
72
72
  * Modular Content field value with nested blocks - array of fully populated block objects
73
73
  */
74
- export type RichTextFieldValueWithResolvedBlocks = SchemaTypes.Item[] | null;
74
+ export type RichTextFieldValueWithNestedBlocks = RawApiTypes.Item[] | null;
75
75
 
76
76
  /**
77
77
  * =============================================================================
@@ -106,27 +106,27 @@ export function isRichTextFieldValueAsRequest(
106
106
 
107
107
  return value.every((block) => {
108
108
  // String ID - referencing existing block
109
- if (isBlockStringId(block)) return true;
109
+ if (isItemId(block)) return true;
110
110
 
111
111
  // Object (either with or without ID for updates/creation)
112
- return isBlockObject(block);
112
+ return isItemWithOptionalIdAndMeta(block);
113
113
  });
114
114
  }
115
115
 
116
116
  /**
117
117
  * 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.
118
+ * Ensures all blocks are full RawApiTypes.Item objects with complete data.
119
119
  */
120
- export function isRichTextFieldValueWithResolvedBlocks(
120
+ export function isRichTextFieldValueWithNestedBlocks(
121
121
  value: unknown,
122
- ): value is RichTextFieldValueWithResolvedBlocks {
122
+ ): value is RichTextFieldValueWithNestedBlocks {
123
123
  if (value === null) return true;
124
124
 
125
125
  if (!Array.isArray(value)) return false;
126
126
 
127
127
  return value.every((block) => {
128
128
  // Must be a full object with ID (nested format always includes complete block objects)
129
- return isBlockObjectWithId(block);
129
+ return isItemWithOptionalMeta(block);
130
130
  });
131
131
  }
132
132
 
@@ -1,4 +1,9 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
1
+ import type * as RawApiTypes from '../generated/RawApiTypes';
2
+
3
+ import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
4
+ import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
5
+ import type { RequiredValidator } from './validators/required';
6
+ import type { SingleBlockBlocksValidator } from './validators/single_block_blocks';
2
7
 
3
8
  /**
4
9
  * SINGLE BLOCK FIELD TYPE SYSTEM FOR DATOCMS
@@ -44,23 +49,34 @@ export type SingleBlockFieldValue = string | null;
44
49
  * - Omit ID for new blocks being created
45
50
  */
46
51
 
52
+ /** Represents an existing block in a CMA request */
53
+ export type UnchangedBlockInARequest = string;
54
+ /** Represents a block we want to update in a CMA request */
55
+ export type UpdatedBlockInARequest = OptionalFields<RawApiTypes.Item, 'meta'>;
56
+ /** Represents a new block to create in a CMA request */
57
+ export type NewBlockInARequest = OptionalFields<
58
+ RawApiTypes.Item,
59
+ 'id' | 'meta'
60
+ >;
61
+
47
62
  /**
48
63
  * 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)
64
+ * - string: Just the block ID (to keep existing blocks unchanged)
65
+ * - Full block object with ID (to update an existing block)
66
+ * - Block object without ID (to create a new block)
52
67
  *
53
68
  * Also, 'meta' can always be omitted
54
69
  */
55
70
  export type BlockItemInARequest =
56
- | string
57
- | OptionalFields<SchemaTypes.Item, 'id' | 'meta'>;
71
+ | UnchangedBlockInARequest
72
+ | UpdatedBlockInARequest
73
+ | NewBlockInARequest;
58
74
 
59
75
  /**
60
76
  * 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)
77
+ * - string: Just the block ID (to keep existing blocks unchanged)
78
+ * - Full block object with ID (to update an existing block)
79
+ * - Block object without ID (to create a new block)
64
80
  */
65
81
  export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
66
82
 
@@ -70,14 +86,14 @@ export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
70
86
  * =============================================================================
71
87
  *
72
88
  * 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
89
+ * with embedded block fully populated as complete RawApiTypes.Item object instead
74
90
  * of just string ID. This provides type safety for working with fully resolved data.
75
91
  */
76
92
 
77
93
  /**
78
94
  * Single Block field value with nested block - fully populated block object
79
95
  */
80
- export type SingleBlockFieldValueWithResolvedBlocks = SchemaTypes.Item | null;
96
+ export type SingleBlockFieldValueWithNestedBlocks = RawApiTypes.Item | null;
81
97
 
82
98
  /**
83
99
  * =============================================================================
@@ -87,21 +103,21 @@ export type SingleBlockFieldValueWithResolvedBlocks = SchemaTypes.Item | null;
87
103
  */
88
104
 
89
105
  /**
90
- * Validates if a single block item is a string ID
106
+ * Validates if the input is a valid item (either block or record) ID
91
107
  */
92
- export function isBlockStringId(block: unknown): block is string {
93
- return typeof block === 'string';
108
+ export function isItemId(input: unknown): input is string {
109
+ return typeof input === 'string';
94
110
  }
95
111
 
96
112
  export type ItemWithOptionalIdAndMeta = OptionalFields<
97
- SchemaTypes.Item,
113
+ RawApiTypes.Item,
98
114
  'id' | 'meta'
99
115
  >;
100
116
 
101
117
  /**
102
- * Validates if a single block item is a SchemaTypes.Item object (with or without ID)
118
+ * Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
103
119
  */
104
- export function isBlockObject(
120
+ export function isItemWithOptionalIdAndMeta(
105
121
  block: unknown,
106
122
  ): block is ItemWithOptionalIdAndMeta {
107
123
  return (
@@ -112,15 +128,19 @@ export function isBlockObject(
112
128
  );
113
129
  }
114
130
 
115
- export type ItemWithOptionalMeta = OptionalFields<SchemaTypes.Item, 'meta'>;
131
+ export type ItemWithOptionalMeta = OptionalFields<RawApiTypes.Item, 'meta'>;
116
132
 
117
133
  /**
118
- * Validates if a single block item is a complete SchemaTypes.Item object with ID
134
+ * Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
119
135
  */
120
- export function isBlockObjectWithId(
136
+ export function isItemWithOptionalMeta(
121
137
  block: unknown,
122
138
  ): block is ItemWithOptionalMeta {
123
- return isBlockObject(block) && 'id' in block && typeof block.id === 'string';
139
+ return (
140
+ isItemWithOptionalIdAndMeta(block) &&
141
+ 'id' in block &&
142
+ typeof block.id === 'string'
143
+ );
124
144
  }
125
145
 
126
146
  /**
@@ -148,31 +168,26 @@ export function isSingleBlockFieldValueAsRequest(
148
168
  ): value is SingleBlockFieldValueAsRequest {
149
169
  if (value === null) return true;
150
170
 
151
- // String ID _ referencing existing block
152
- if (isBlockStringId(value)) return true;
171
+ // String ID - referencing existing block
172
+ if (isItemId(value)) return true;
153
173
 
154
174
  // Object (either with or without ID for updates/creation)
155
- return isBlockObject(value);
175
+ return isItemWithOptionalIdAndMeta(value);
156
176
  }
157
177
 
158
178
  /**
159
179
  * 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.
180
+ * Ensures block is a full RawApiTypes.Item object with complete data.
161
181
  */
162
- export function isSingleBlockFieldValueWithResolvedBlocks(
182
+ export function isSingleBlockFieldValueWithNestedBlocks(
163
183
  value: unknown,
164
- ): value is SingleBlockFieldValueWithResolvedBlocks {
184
+ ): value is SingleBlockFieldValueWithNestedBlocks {
165
185
  if (value === null) return true;
166
186
 
167
187
  // Must be a full object with ID (nested format always includes complete block objects)
168
- return isBlockObjectWithId(value);
188
+ return isItemWithOptionalMeta(value);
169
189
  }
170
190
 
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';
175
-
176
191
  export type SingleBlockFieldValidators = {
177
192
  /** Only accept references to block records of the specified block models */
178
193
  single_block_blocks: SingleBlockBlocksValidator;
@@ -2,19 +2,24 @@ import {
2
2
  type Block,
3
3
  type Document,
4
4
  type InlineBlock,
5
- type Root,
5
+ type Node,
6
+ everyNode,
6
7
  isBlock,
8
+ isDocument,
7
9
  isInlineBlock,
8
- isNode,
9
10
  } from 'datocms-structured-text-utils';
10
- import type * as SchemaTypes from '../generated/SchemaTypes';
11
- import { everyNode } from '../utilities/structuredText';
11
+ import type * as RawApiTypes from '../generated/RawApiTypes';
12
+ import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
12
13
  import {
13
14
  type BlockItemInARequest,
14
- isBlockObject,
15
- isBlockObjectWithId,
16
- isBlockStringId,
15
+ isItemId,
16
+ isItemWithOptionalIdAndMeta,
17
+ isItemWithOptionalMeta,
17
18
  } from './single_block';
19
+ import type { LengthValidator } from './validators/length';
20
+ import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
21
+ import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
22
+ import type { StructuredTextLinksValidator } from './validators/structured_text_links';
18
23
 
19
24
  /**
20
25
  * STRUCTURED TEXT TYPE SYSTEM FOR DATOCMS
@@ -25,10 +30,10 @@ import {
25
30
  * The challenge we're solving:
26
31
  * - DatoCMS structured text can contain "blocks" (embedded content items) in bloth 'block'
27
32
  * and 'inlineBlock' nodes
28
- * - By default, API responses contain blocks as string IDs (lightweight references)
33
+ * - By default, CMA responses contain blocks as string IDs (lightweight references)
29
34
  * - With ?nested=true parameter though, API responses contain blocks as full item objects
30
35
  * (which in turn can contain other blocks)
31
- * - For API requests, blocks can be represented as:
36
+ * - For CMA requests, blocks can be represented as:
32
37
  * 1. String IDs (referencing existing items)
33
38
  * 2. Full item objects with IDs (for updates)
34
39
  * 3. Item objects without IDs (for creation)
@@ -50,80 +55,42 @@ import {
50
55
  /**
51
56
  * Variant of 'block' structured text node for API requests
52
57
  */
53
- export type BlockAsRequest = Omit<Block, 'item'> & {
54
- item: BlockItemInARequest;
55
- };
58
+ export type BlockAsRequest = Block<BlockItemInARequest>;
56
59
 
57
60
  /**
58
61
  * Variant of 'inlineBlock' structured text node for API requests
59
62
  */
60
- export type InlineBlockAsRequest = Omit<InlineBlock, 'item'> & {
61
- item: BlockItemInARequest;
62
- };
63
-
64
- /**
65
- * Generic type to transform a node that might be containing a 'block' or 'inlineBlock' as a (deeply nested) children to its variant for API requests
66
- */
67
- export type NodeAsRequest<T> = WithMappedChildren<
68
- T,
69
- DeepMapVariants<
70
- T extends { children: infer C } ? C : never,
71
- BlockAsRequest,
72
- InlineBlockAsRequest
73
- >
74
- >;
63
+ export type InlineBlockAsRequest = InlineBlock<BlockItemInARequest>;
75
64
 
76
65
  /**
77
66
  * Variant of Structured Text document for API requests
78
67
  */
79
- export type DocumentAsRequest = {
80
- schema: 'dast';
81
- document: NodeAsRequest<Root>;
82
- };
68
+ export type DocumentAsRequest = Document<BlockItemInARequest>;
83
69
 
84
70
  /**
85
71
  * =============================================================================
86
72
  * NESTED VARIANTS - Types for API responses with ?nested=true parameter
87
73
  * =============================================================================
88
74
  *
89
- * When using the GET /items?nested=true, the API returns Structured Text documents
90
- * with embedded blocks fully populated as complete SchemaTypes.Item objects instead
75
+ * When using the GET /items?nested=true, the CMA returns Structured Text documents
76
+ * with embedded blocks fully populated as complete RawApiTypes.Item objects instead
91
77
  * of just string IDs.
92
78
  */
93
79
 
94
80
  /**
95
81
  * Variant of 'block' structured text node for ?nested=true API responses
96
82
  */
97
- export type BlockWithResolvedBlocks = Omit<Block, 'item'> & {
98
- item: SchemaTypes.Item;
99
- };
83
+ export type BlockWithNestedBlocks = Block<RawApiTypes.Item>;
100
84
 
101
85
  /**
102
86
  * Variant of 'inlineBlock' structured text node for ?nested=true API responses
103
87
  */
104
- export type InlineBlockWithResolvedBlocks = Omit<InlineBlock, 'item'> & {
105
- item: SchemaTypes.Item;
106
- };
107
-
108
- /**
109
- * Generic type to transform a node that might be containing a 'block' or 'inlineBlock' as a (deeply nested) children to it's variant for ?nested=true API responses
110
- */
111
- export type NodeWithResolvedBlocks<T> = WithMappedChildren<
112
- T,
113
- DeepMapVariants<
114
- T extends { children: infer C } ? C : never,
115
- BlockWithResolvedBlocks,
116
- InlineBlockWithResolvedBlocks
117
- >
118
- >;
88
+ export type InlineBlockWithNestedBlocks = InlineBlock<RawApiTypes.Item>;
119
89
 
120
90
  /**
121
91
  * Variant of Structured Text document for ?nested=true API responses
122
92
  */
123
- export type DocumentWithResolvedBlocks = {
124
- schema: 'dast';
125
- document: NodeWithResolvedBlocks<Root>;
126
- };
93
+ export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
127
94
 
128
95
  /**
129
96
  * =============================================================================
@@ -137,46 +104,20 @@ export type DocumentWithResolvedBlocks = {
137
104
  */
138
105
  export type StructuredTextFieldValue = Document | null;
139
106
  export type StructuredTextFieldValueAsRequest = DocumentAsRequest | null;
140
- export type StructuredTextFieldValueWithResolvedBlocks =
141
- DocumentWithResolvedBlocks | null;
142
-
143
- /**
144
- * Helper function to validate if a value has the expected structured text document structure.
145
- * Checks for the presence of 'schema' and 'document' properties on a non-null object.
146
- */
147
- function isValidDocumentStructure(
148
- value: unknown,
149
- ): value is { schema: unknown; document: unknown } {
150
- return (
151
- typeof value === 'object' &&
152
- value !== null &&
153
- 'schema' in value &&
154
- 'document' in value
155
- );
156
- }
107
+ export type StructuredTextFieldValueWithNestedBlocks =
108
+ DocumentWithNestedBlocks | null;
157
109
 
158
110
  /**
159
111
  * Utility function to validate all block/inlineBlock nodes in a structured text document tree.
160
112
  * Calls the provided callback for each block/inlineBlock node found and returns true only if all pass.
161
113
  */
162
- function validateAllBlockNodes(
163
- node: unknown,
164
- callback: (
165
- node:
166
- | Block
167
- | BlockAsRequest
168
- | BlockWithResolvedBlocks
169
- | InlineBlock
170
- | InlineBlockAsRequest
171
- | InlineBlockWithResolvedBlocks,
172
- ) => boolean,
114
+ function validateAllBlockNodes<T>(
115
+ node: Node<T>,
116
+ callback: (node: Block<T> | InlineBlock<T>) => boolean,
173
117
  ): boolean {
174
118
  return everyNode(node, (currentNode) => {
175
119
  // If this is a block or inlineBlock node, validate it with the callback
176
- if (
177
- isNode(currentNode) &&
178
- (isBlock(currentNode) || isInlineBlock(currentNode))
179
- ) {
120
+ if (isBlock<T>(currentNode) || isInlineBlock<T>(currentNode)) {
180
121
  return callback(currentNode);
181
122
  }
182
123
  // For all other node types, they're valid by default
@@ -193,7 +134,7 @@ export function isStructuredTextFieldValue(
193
134
  ): value is StructuredTextFieldValue {
194
135
  if (value === null) return true;
195
136
 
196
- if (!isValidDocumentStructure(value)) {
137
+ if (!isDocument<unknown>(value)) {
197
138
  return false;
198
139
  }
199
140
 
@@ -212,7 +153,7 @@ export function isStructuredTextFieldValueAsRequest(
212
153
  ): value is StructuredTextFieldValueAsRequest {
213
154
  if (value === null) return true;
214
155
 
215
- if (!isValidDocumentStructure(value)) {
156
+ if (!isDocument<unknown>(value)) {
216
157
  return false;
217
158
  }
218
159
 
@@ -221,23 +162,23 @@ export function isStructuredTextFieldValueAsRequest(
221
162
  const item = node.item;
222
163
 
223
164
  // String ID
224
- if (isBlockStringId(item)) return true;
165
+ if (isItemId(item)) return true;
225
166
 
226
167
  // Object (either with or without ID)
227
- return isBlockObject(item);
168
+ return isItemWithOptionalIdAndMeta(item);
228
169
  });
229
170
  }
230
171
 
231
172
  /**
232
173
  * Type guard for structured text field values with nested blocks (?nested=true format).
233
- * Ensures all block/inlineBlock nodes have full SchemaTypes.Item objects.
174
+ * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
234
175
  */
235
- export function isStructuredTextFieldValueWithResolvedBlocks(
176
+ export function isStructuredTextFieldValueWithNestedBlocks(
236
177
  value: unknown,
237
- ): value is StructuredTextFieldValueWithResolvedBlocks {
178
+ ): value is StructuredTextFieldValueWithNestedBlocks {
238
179
  if (value === null) return true;
239
180
 
240
- if (!isValidDocumentStructure(value)) {
181
+ if (!isDocument<unknown>(value)) {
241
182
  return false;
242
183
  }
243
184
 
@@ -246,67 +187,10 @@ export function isStructuredTextFieldValueWithResolvedBlocks(
246
187
  const item = node.item;
247
188
 
248
189
  // Must be a full object with ID (nested format always includes full items)
249
- return isBlockObjectWithId(item);
190
+ return isItemWithOptionalMeta(item);
250
191
  });
251
192
  }
252
193
 
253
- /**
254
- * =============================================================================
255
- * SHARED TRANSFORMATION UTILITIES
256
- * =============================================================================
257
- *
258
- * These utility types provide the machinery for automatically transforming
259
- * structured text types between their different variants. The goal is to
260
- * recursively walk through complex nested structures and apply the appropriate
261
- * transformations to Block and InlineBlock nodes while preserving all other types.
262
- */
263
-
264
- /**
265
- * Utility type that preserves the structure of T but replaces its children with ChildrenType.
266
- * If T doesn't have children, it returns T unchanged.
267
- */
268
- type WithMappedChildren<T, ChildrenType> = T extends { children: any }
269
- ? Omit<T, 'children'> & { children: ChildrenType }
270
- : T;
271
-
272
- /**
273
- * Generic transformation type that replace 'block' and 'inlineBlock' node types to their variants.
274
- */
275
- type MapVariants<T, BlockVariant, InlineBlockVariant> = T extends Block
276
- ? BlockVariant
277
- : T extends InlineBlock
278
- ? InlineBlockVariant
279
- : T;
280
-
281
- /**
282
- * Recursively transform a Structured Text node type using the provided variants for 'block' and 'inlineBlock' nodes.
283
- *
284
- * This handles three cases:
285
- * _ Arrays: Transform each array element recursively
286
- * _ Objects with children: Transform the object itself AND recursively transform its children
287
- * _ Leaf nodes: Apply the variant mapping
288
- */
289
- type DeepMapVariants<T, BlockVariant, InlineBlockVariant> =
290
- T extends (infer U)[]
291
- ? DeepMapVariants<U, BlockVariant, InlineBlockVariant>[]
292
- : T extends { children: infer Children }
293
- ? T extends { children: any }
294
- ? Omit<T, 'children'> & {
295
- children: DeepMapVariants<
296
- Children,
297
- BlockVariant,
298
- InlineBlockVariant
299
- >;
300
- }
301
- : MapVariants<T, BlockVariant, InlineBlockVariant>
302
- : MapVariants<T, BlockVariant, InlineBlockVariant>;
303
-
304
- import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
305
- import type { LengthValidator } from './validators/length';
306
- import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
307
- import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
308
- import type { StructuredTextLinksValidator } from './validators/structured_text_links';
309
-
310
194
  export type StructuredTextFieldValidators = {
311
195
  /** Only accept references to block records of the specified block models */
312
196
  structured_text_blocks: StructuredTextBlocksValidator;
@@ -58,7 +58,7 @@ type FieldAppearanceConfig<TAppearance> = TAppearance &
58
58
  Omit<RawFieldAttributes['appearance'], keyof TAppearance>;
59
59
 
60
60
  /**
61
- * Base field configuration for attributes (non-localized), extending the original SchemaTypes
61
+ * Base field configuration for attributes (non-localized), extending the original RawApiTypes
62
62
  */
63
63
  type NonLocalizedFieldAttributesForFieldType<
64
64
  SourceType,
@@ -78,7 +78,7 @@ type NonLocalizedFieldAttributesForFieldType<
78
78
  };
79
79
 
80
80
  /**
81
- * Base field configuration for attributes (localized), extending the original SchemaTypes
81
+ * Base field configuration for attributes (localized), extending the original RawApiTypes
82
82
  */
83
83
  type LocalizedFieldAttributesForFieldType<
84
84
  SourceType,
@@ -278,12 +278,24 @@ export type FieldAttributes = GenericFieldAttributes<RawFieldAttributes>;
278
278
 
279
279
  export type Field = GenericFieldAttributes<RawField>;
280
280
 
281
- /**
282
- * Helper type to conditionally handle default values based on localization for field creation
283
- */
284
- type FieldCreateDefaultValue<T> = T | Record<string, T> | undefined;
281
+ type LocalizedFieldCreateConfigForFieldType<
282
+ SourceType,
283
+ FieldType extends RawFieldAttributes['field_type'],
284
+ FieldValue,
285
+ FieldValidators,
286
+ FieldAppearance,
287
+ > = Omit<
288
+ SourceType,
289
+ 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'
290
+ > & {
291
+ field_type: FieldType;
292
+ localized: true;
293
+ default_value?: Record<string, FieldValue>;
294
+ validators?: FieldValidators;
295
+ appearance?: FieldAppearanceConfig<FieldAppearance>;
296
+ };
285
297
 
286
- type FieldCreateConfigForFieldType<
298
+ type NonLocalizedFieldCreateConfigForFieldType<
287
299
  SourceType,
288
300
  FieldType extends RawFieldAttributes['field_type'],
289
301
  FieldValue,
@@ -291,14 +303,37 @@ type FieldCreateConfigForFieldType<
291
303
  FieldAppearance,
292
304
  > = Omit<
293
305
  SourceType,
294
- 'field_type' | 'default_value' | 'validators' | 'appearance'
306
+ 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'
295
307
  > & {
296
308
  field_type: FieldType;
297
- default_value?: FieldCreateDefaultValue<FieldValue>;
309
+ localized?: false;
310
+ default_value?: FieldValue;
298
311
  validators?: FieldValidators;
299
312
  appearance?: FieldAppearanceConfig<FieldAppearance>;
300
313
  };
301
314
 
315
+ type FieldCreateConfigForFieldType<
316
+ SourceType,
317
+ FieldType extends RawFieldAttributes['field_type'],
318
+ FieldValue,
319
+ FieldValidators,
320
+ FieldAppearance,
321
+ > =
322
+ | LocalizedFieldCreateConfigForFieldType<
323
+ SourceType,
324
+ FieldType,
325
+ FieldValue,
326
+ FieldValidators,
327
+ FieldAppearance
328
+ >
329
+ | NonLocalizedFieldCreateConfigForFieldType<
330
+ SourceType,
331
+ FieldType,
332
+ FieldValue,
333
+ FieldValidators,
334
+ FieldAppearance
335
+ >;
336
+
302
337
  type FieldCreateConfig<SourceType> =
303
338
  | FieldCreateConfigForFieldType<
304
339
  SourceType,
@@ -3,7 +3,7 @@ import {
3
3
  pollJobResult,
4
4
  request,
5
5
  } from '@datocms/rest-client-utils';
6
- import type { JobResult } from './SimpleSchemaTypes';
6
+ import type { JobResult } from './ApiTypes';
7
7
  import * as Resources from './resources';
8
8
 
9
9
  export type RequestOptions = {
@@ -147,7 +147,7 @@ export class Client {
147
147
  ...this.config,
148
148
  ...options,
149
149
  logFn: this.config.logFn || console.log,
150
- userAgent: '@datocms/cma-client v5.1.0',
150
+ userAgent: '@datocms/cma-client v5.1.2',
151
151
  baseUrl: this.baseUrl,
152
152
  preCallStack: new Error().stack,
153
153
  extraHeaders: {