@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,4 +1,8 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
1
+ import type * as RawApiTypes from '../generated/RawApiTypes';
2
+ import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
3
+ import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
4
+ import type { RequiredValidator } from './validators/required';
5
+ import type { SingleBlockBlocksValidator } from './validators/single_block_blocks';
2
6
  /**
3
7
  * SINGLE BLOCK FIELD TYPE SYSTEM FOR DATOCMS
4
8
  *
@@ -39,20 +43,26 @@ export type SingleBlockFieldValue = string | null;
39
43
  * - Include full block object for updates
40
44
  * - Omit ID for new blocks being created
41
45
  */
46
+ /** Represents an existing block in a CMA request */
47
+ export type UnchangedBlockInARequest = string;
48
+ /** Represents a block we want to update in a CMA request */
49
+ export type UpdatedBlockInARequest = OptionalFields<RawApiTypes.Item, 'meta'>;
50
+ /** Represents a new block to create in a CMA request */
51
+ export type NewBlockInARequest = OptionalFields<RawApiTypes.Item, 'id' | 'meta'>;
42
52
  /**
43
53
  * Union type representing the different ways a block can be specified in API requests:
44
- * - string: Just the block ID (most common case)
45
- * - Full block object with ID (for updates)
46
- * - Block object without ID (for creation)
54
+ * - string: Just the block ID (to keep existing blocks unchanged)
55
+ * - Full block object with ID (to update an existing block)
56
+ * - Block object without ID (to create a new block)
47
57
  *
48
58
  * Also, 'meta' can always be omitted
49
59
  */
50
- export type BlockItemInARequest = string | OptionalFields<SchemaTypes.Item, 'id' | 'meta'>;
60
+ export type BlockItemInARequest = UnchangedBlockInARequest | UpdatedBlockInARequest | NewBlockInARequest;
51
61
  /**
52
62
  * Single Block field value for API requests - allows flexible block representations:
53
- * - string: Just the block ID (most common case)
54
- * - SchemaTypes.Item: Full block object with ID (for updates)
55
- * - Omit<SchemaTypes.Item, 'id'>: Block object without ID (for creation)
63
+ * - string: Just the block ID (to keep existing blocks unchanged)
64
+ * - Full block object with ID (to update an existing block)
65
+ * - Block object without ID (to create a new block)
56
66
  */
57
67
  export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
58
68
  /**
@@ -61,13 +71,13 @@ export type SingleBlockFieldValueAsRequest = BlockItemInARequest | null;
61
71
  * =============================================================================
62
72
  *
63
73
  * When using the ?nested=true query parameter, the API returns Single Block data
64
- * with embedded block fully populated as complete SchemaTypes.Item object instead
74
+ * with embedded block fully populated as complete RawApiTypes.Item object instead
65
75
  * of just string ID. This provides type safety for working with fully resolved data.
66
76
  */
67
77
  /**
68
78
  * Single Block field value with nested block - fully populated block object
69
79
  */
70
- export type SingleBlockFieldValueWithResolvedBlocks = SchemaTypes.Item | null;
80
+ export type SingleBlockFieldValueWithNestedBlocks = RawApiTypes.Item | null;
71
81
  /**
72
82
  * =============================================================================
73
83
  * SHARED UTILITY FUNCTIONS
@@ -75,19 +85,19 @@ export type SingleBlockFieldValueWithResolvedBlocks = SchemaTypes.Item | null;
75
85
  * These functions are used internally and can be imported by other modules
76
86
  */
77
87
  /**
78
- * Validates if a single block item is a string ID
88
+ * Validates if the input is a valid item (either block or record) ID
79
89
  */
80
- export declare function isBlockStringId(block: unknown): block is string;
81
- export type ItemWithOptionalIdAndMeta = OptionalFields<SchemaTypes.Item, 'id' | 'meta'>;
90
+ export declare function isItemId(input: unknown): input is string;
91
+ export type ItemWithOptionalIdAndMeta = OptionalFields<RawApiTypes.Item, 'id' | 'meta'>;
82
92
  /**
83
- * Validates if a single block item is a SchemaTypes.Item object (with or without ID)
93
+ * Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
84
94
  */
85
- export declare function isBlockObject(block: unknown): block is ItemWithOptionalIdAndMeta;
86
- export type ItemWithOptionalMeta = OptionalFields<SchemaTypes.Item, 'meta'>;
95
+ export declare function isItemWithOptionalIdAndMeta(block: unknown): block is ItemWithOptionalIdAndMeta;
96
+ export type ItemWithOptionalMeta = OptionalFields<RawApiTypes.Item, 'meta'>;
87
97
  /**
88
- * Validates if a single block item is a complete SchemaTypes.Item object with ID
98
+ * Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
89
99
  */
90
- export declare function isBlockObjectWithId(block: unknown): block is ItemWithOptionalMeta;
100
+ export declare function isItemWithOptionalMeta(block: unknown): block is ItemWithOptionalMeta;
91
101
  /**
92
102
  * =============================================================================
93
103
  * TYPE GUARDS - Runtime validation functions
@@ -105,13 +115,9 @@ export declare function isSingleBlockFieldValue(value: unknown): value is Single
105
115
  export declare function isSingleBlockFieldValueAsRequest(value: unknown): value is SingleBlockFieldValueAsRequest;
106
116
  /**
107
117
  * Type guard for Single Block field values with nested blocks (?nested=true format).
108
- * Ensures block is a full SchemaTypes.Item object with complete data.
118
+ * Ensures block is a full RawApiTypes.Item object with complete data.
109
119
  */
110
- export declare function isSingleBlockFieldValueWithResolvedBlocks(value: unknown): value is SingleBlockFieldValueWithResolvedBlocks;
111
- import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
112
- import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
113
- import type { RequiredValidator } from './validators/required';
114
- import type { SingleBlockBlocksValidator } from './validators/single_block_blocks';
120
+ export declare function isSingleBlockFieldValueWithNestedBlocks(value: unknown): value is SingleBlockFieldValueWithNestedBlocks;
115
121
  export type SingleBlockFieldValidators = {
116
122
  /** Only accept references to block records of the specified block models */
117
123
  single_block_blocks: SingleBlockBlocksValidator;
@@ -5,25 +5,27 @@
5
5
  * These functions are used internally and can be imported by other modules
6
6
  */
7
7
  /**
8
- * Validates if a single block item is a string ID
8
+ * Validates if the input is a valid item (either block or record) ID
9
9
  */
10
- export function isBlockStringId(block) {
11
- return typeof block === 'string';
10
+ export function isItemId(input) {
11
+ return typeof input === 'string';
12
12
  }
13
13
  /**
14
- * Validates if a single block item is a SchemaTypes.Item object (with or without ID)
14
+ * Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
15
15
  */
16
- export function isBlockObject(block) {
16
+ export function isItemWithOptionalIdAndMeta(block) {
17
17
  return (typeof block === 'object' &&
18
18
  block !== null &&
19
19
  'type' in block &&
20
20
  'attributes' in block);
21
21
  }
22
22
  /**
23
- * Validates if a single block item is a complete SchemaTypes.Item object with ID
23
+ * Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
24
24
  */
25
- export function isBlockObjectWithId(block) {
26
- return isBlockObject(block) && 'id' in block && typeof block.id === 'string';
25
+ export function isItemWithOptionalMeta(block) {
26
+ return (isItemWithOptionalIdAndMeta(block) &&
27
+ 'id' in block &&
28
+ typeof block.id === 'string');
27
29
  }
28
30
  /**
29
31
  * =============================================================================
@@ -44,20 +46,20 @@ export function isSingleBlockFieldValue(value) {
44
46
  export function isSingleBlockFieldValueAsRequest(value) {
45
47
  if (value === null)
46
48
  return true;
47
- // String ID _ referencing existing block
48
- if (isBlockStringId(value))
49
+ // String ID - referencing existing block
50
+ if (isItemId(value))
49
51
  return true;
50
52
  // Object (either with or without ID for updates/creation)
51
- return isBlockObject(value);
53
+ return isItemWithOptionalIdAndMeta(value);
52
54
  }
53
55
  /**
54
56
  * Type guard for Single Block field values with nested blocks (?nested=true format).
55
- * Ensures block is a full SchemaTypes.Item object with complete data.
57
+ * Ensures block is a full RawApiTypes.Item object with complete data.
56
58
  */
57
- export function isSingleBlockFieldValueWithResolvedBlocks(value) {
59
+ export function isSingleBlockFieldValueWithNestedBlocks(value) {
58
60
  if (value === null)
59
61
  return true;
60
62
  // Must be a full object with ID (nested format always includes complete block objects)
61
- return isBlockObjectWithId(value);
63
+ return isItemWithOptionalMeta(value);
62
64
  }
63
65
  //# sourceMappingURL=single_block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AAiFA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,YAAY,IAAI,KAAK,CACtB,CAAC;AACJ,CAAC;AAID;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAc;IAEd,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC;AAC/E,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,yCAAyC;IACzC,IAAI,eAAe,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,0DAA0D;IAC1D,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yCAAyC,CACvD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,uFAAuF;IACvF,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
1
+ {"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AAiGA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,YAAY,IAAI,KAAK,CACtB,CAAC;AACJ,CAAC;AAID;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,CACL,2BAA2B,CAAC,KAAK,CAAC;QAClC,IAAI,IAAI,KAAK;QACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAC7B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,yCAAyC;IACzC,IAAI,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,0DAA0D;IAC1D,OAAO,2BAA2B,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,uFAAuF;IACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -1,6 +1,11 @@
1
- import { type Block, type Document, type InlineBlock, type Root } from 'datocms-structured-text-utils';
2
- import type * as SchemaTypes from '../generated/SchemaTypes';
1
+ import { type Block, type Document, type InlineBlock } from 'datocms-structured-text-utils';
2
+ import type * as RawApiTypes from '../generated/RawApiTypes';
3
+ import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
3
4
  import { type BlockItemInARequest } from './single_block';
5
+ import type { LengthValidator } from './validators/length';
6
+ import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
7
+ import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
8
+ import type { StructuredTextLinksValidator } from './validators/structured_text_links';
4
9
  /**
5
10
  * STRUCTURED TEXT TYPE SYSTEM FOR DATOCMS
6
11
  *
@@ -10,10 +15,10 @@ import { type BlockItemInARequest } from './single_block';
10
15
  * The challenge we're solving:
11
16
  * - DatoCMS structured text can contain "blocks" (embedded content items) in bloth 'block'
12
17
  * and 'inlineBlock' nodes
13
- * - By default, API responses contain blocks as string IDs (lightweight references)
18
+ * - By default, CMA responses contain blocks as string IDs (lightweight references)
14
19
  * - With ?nested=true parameter though, API responses contain blocks as full item objects
15
20
  * (which in turn can contain other blocks)
16
- * - For API requests, blocks can be represented as:
21
+ * - For CMA requests, blocks can be represented as:
17
22
  * 1. String IDs (referencing existing items)
18
23
  * 2. Full item objects with IDs (for updates)
19
24
  * 3. Item objects without IDs (for creation)
@@ -33,62 +38,36 @@ import { type BlockItemInARequest } from './single_block';
33
38
  /**
34
39
  * Variant of 'block' structured text node for API requests
35
40
  */
36
- export type BlockAsRequest = Omit<Block, 'item'> & {
37
- item: BlockItemInARequest;
38
- };
41
+ export type BlockAsRequest = Block<BlockItemInARequest>;
39
42
  /**
40
43
  * Variant of 'inlineBlock' structured text node for API requests
41
44
  */
42
- export type InlineBlockAsRequest = Omit<InlineBlock, 'item'> & {
43
- item: BlockItemInARequest;
44
- };
45
- /**
46
- * 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
47
- */
48
- export type NodeAsRequest<T> = WithMappedChildren<T, DeepMapVariants<T extends {
49
- children: infer C;
50
- } ? C : never, BlockAsRequest, InlineBlockAsRequest>>;
45
+ export type InlineBlockAsRequest = InlineBlock<BlockItemInARequest>;
51
46
  /**
52
47
  * Variant of Structured Text document for API requests
53
48
  */
54
- export type DocumentAsRequest = {
55
- schema: 'dast';
56
- document: NodeAsRequest<Root>;
57
- };
49
+ export type DocumentAsRequest = Document<BlockItemInARequest>;
58
50
  /**
59
51
  * =============================================================================
60
52
  * NESTED VARIANTS - Types for API responses with ?nested=true parameter
61
53
  * =============================================================================
62
54
  *
63
- * When using the GET /items?nested=true, the API returns Structured Text documents
64
- * with embedded blocks fully populated as complete SchemaTypes.Item objects instead
55
+ * When using the GET /items?nested=true, the CMA returns Structured Text documents
56
+ * with embedded blocks fully populated as complete RawApiTypes.Item objects instead
65
57
  * of just string IDs.
66
58
  */
67
59
  /**
68
60
  * Variant of 'block' structured text node for ?nested=true API responses
69
61
  */
70
- export type BlockWithResolvedBlocks = Omit<Block, 'item'> & {
71
- item: SchemaTypes.Item;
72
- };
62
+ export type BlockWithNestedBlocks = Block<RawApiTypes.Item>;
73
63
  /**
74
64
  * Variant of 'inlineBlock' structured text node for ?nested=true API responses
75
65
  */
76
- export type InlineBlockWithResolvedBlocks = Omit<InlineBlock, 'item'> & {
77
- item: SchemaTypes.Item;
78
- };
79
- /**
80
- * 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
81
- */
82
- export type NodeWithResolvedBlocks<T> = WithMappedChildren<T, DeepMapVariants<T extends {
83
- children: infer C;
84
- } ? C : never, BlockWithResolvedBlocks, InlineBlockWithResolvedBlocks>>;
66
+ export type InlineBlockWithNestedBlocks = InlineBlock<RawApiTypes.Item>;
85
67
  /**
86
68
  * Variant of Structured Text document for ?nested=true API responses
87
69
  */
88
- export type DocumentWithResolvedBlocks = {
89
- schema: 'dast';
90
- document: NodeWithResolvedBlocks<Root>;
91
- };
70
+ export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
92
71
  /**
93
72
  * =============================================================================
94
73
  * MAIN APPLICATION TYPES
@@ -100,7 +79,7 @@ export type DocumentWithResolvedBlocks = {
100
79
  */
101
80
  export type StructuredTextFieldValue = Document | null;
102
81
  export type StructuredTextFieldValueAsRequest = DocumentAsRequest | null;
103
- export type StructuredTextFieldValueWithResolvedBlocks = DocumentWithResolvedBlocks | null;
82
+ export type StructuredTextFieldValueWithNestedBlocks = DocumentWithNestedBlocks | null;
104
83
  /**
105
84
  * Type guard for basic structured text field values (blocks as string IDs only).
106
85
  * Checks for the expected structure and ensures all block/inlineBlock nodes have string IDs.
@@ -113,52 +92,9 @@ export declare function isStructuredTextFieldValue(value: unknown): value is Str
113
92
  export declare function isStructuredTextFieldValueAsRequest(value: unknown): value is StructuredTextFieldValueAsRequest;
114
93
  /**
115
94
  * Type guard for structured text field values with nested blocks (?nested=true format).
116
- * Ensures all block/inlineBlock nodes have full SchemaTypes.Item objects.
117
- */
118
- export declare function isStructuredTextFieldValueWithResolvedBlocks(value: unknown): value is StructuredTextFieldValueWithResolvedBlocks;
119
- /**
120
- * =============================================================================
121
- * SHARED TRANSFORMATION UTILITIES
122
- * =============================================================================
123
- *
124
- * These utility types provide the machinery for automatically transforming
125
- * structured text types between their different variants. The goal is to
126
- * recursively walk through complex nested structures and apply the appropriate
127
- * transformations to Block and InlineBlock nodes while preserving all other types.
128
- */
129
- /**
130
- * Utility type that preserves the structure of T but replaces its children with ChildrenType.
131
- * If T doesn't have children, it returns T unchanged.
132
- */
133
- type WithMappedChildren<T, ChildrenType> = T extends {
134
- children: any;
135
- } ? Omit<T, 'children'> & {
136
- children: ChildrenType;
137
- } : T;
138
- /**
139
- * Generic transformation type that replace 'block' and 'inlineBlock' node types to their variants.
95
+ * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
140
96
  */
141
- type MapVariants<T, BlockVariant, InlineBlockVariant> = T extends Block ? BlockVariant : T extends InlineBlock ? InlineBlockVariant : T;
142
- /**
143
- * Recursively transform a Structured Text node type using the provided variants for 'block' and 'inlineBlock' nodes.
144
- *
145
- * This handles three cases:
146
- * _ Arrays: Transform each array element recursively
147
- * _ Objects with children: Transform the object itself AND recursively transform its children
148
- * _ Leaf nodes: Apply the variant mapping
149
- */
150
- type DeepMapVariants<T, BlockVariant, InlineBlockVariant> = T extends (infer U)[] ? DeepMapVariants<U, BlockVariant, InlineBlockVariant>[] : T extends {
151
- children: infer Children;
152
- } ? T extends {
153
- children: any;
154
- } ? Omit<T, 'children'> & {
155
- children: DeepMapVariants<Children, BlockVariant, InlineBlockVariant>;
156
- } : MapVariants<T, BlockVariant, InlineBlockVariant> : MapVariants<T, BlockVariant, InlineBlockVariant>;
157
- import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
158
- import type { LengthValidator } from './validators/length';
159
- import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
160
- import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
161
- import type { StructuredTextLinksValidator } from './validators/structured_text_links';
97
+ export declare function isStructuredTextFieldValueWithNestedBlocks(value: unknown): value is StructuredTextFieldValueWithNestedBlocks;
162
98
  export type StructuredTextFieldValidators = {
163
99
  /** Only accept references to block records of the specified block models */
164
100
  structured_text_blocks: StructuredTextBlocksValidator;
@@ -178,4 +114,3 @@ export type StructuredTextFieldAppearance = {
178
114
  /** Plugin configuration */
179
115
  parameters: Record<string, unknown>;
180
116
  };
181
- export {};
@@ -1,16 +1,5 @@
1
- import { isBlock, isInlineBlock, isNode, } from 'datocms-structured-text-utils';
2
- import { everyNode } from '../utilities/structuredText';
3
- import { isBlockObject, isBlockObjectWithId, isBlockStringId, } from './single_block';
4
- /**
5
- * Helper function to validate if a value has the expected structured text document structure.
6
- * Checks for the presence of 'schema' and 'document' properties on a non-null object.
7
- */
8
- function isValidDocumentStructure(value) {
9
- return (typeof value === 'object' &&
10
- value !== null &&
11
- 'schema' in value &&
12
- 'document' in value);
13
- }
1
+ import { everyNode, isBlock, isDocument, isInlineBlock, } from 'datocms-structured-text-utils';
2
+ import { isItemId, isItemWithOptionalIdAndMeta, isItemWithOptionalMeta, } from './single_block';
14
3
  /**
15
4
  * Utility function to validate all block/inlineBlock nodes in a structured text document tree.
16
5
  * Calls the provided callback for each block/inlineBlock node found and returns true only if all pass.
@@ -18,8 +7,7 @@ function isValidDocumentStructure(value) {
18
7
  function validateAllBlockNodes(node, callback) {
19
8
  return everyNode(node, (currentNode) => {
20
9
  // If this is a block or inlineBlock node, validate it with the callback
21
- if (isNode(currentNode) &&
22
- (isBlock(currentNode) || isInlineBlock(currentNode))) {
10
+ if (isBlock(currentNode) || isInlineBlock(currentNode)) {
23
11
  return callback(currentNode);
24
12
  }
25
13
  // For all other node types, they're valid by default
@@ -33,7 +21,7 @@ function validateAllBlockNodes(node, callback) {
33
21
  export function isStructuredTextFieldValue(value) {
34
22
  if (value === null)
35
23
  return true;
36
- if (!isValidDocumentStructure(value)) {
24
+ if (!isDocument(value)) {
37
25
  return false;
38
26
  }
39
27
  // Check that all block/inlineBlock nodes have string item IDs
@@ -48,34 +36,34 @@ export function isStructuredTextFieldValue(value) {
48
36
  export function isStructuredTextFieldValueAsRequest(value) {
49
37
  if (value === null)
50
38
  return true;
51
- if (!isValidDocumentStructure(value)) {
39
+ if (!isDocument(value)) {
52
40
  return false;
53
41
  }
54
42
  // Check that all block/inlineBlock nodes have valid request format items
55
43
  return validateAllBlockNodes(value.document, (node) => {
56
44
  const item = node.item;
57
45
  // String ID
58
- if (isBlockStringId(item))
46
+ if (isItemId(item))
59
47
  return true;
60
48
  // Object (either with or without ID)
61
- return isBlockObject(item);
49
+ return isItemWithOptionalIdAndMeta(item);
62
50
  });
63
51
  }
64
52
  /**
65
53
  * Type guard for structured text field values with nested blocks (?nested=true format).
66
- * Ensures all block/inlineBlock nodes have full SchemaTypes.Item objects.
54
+ * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
67
55
  */
68
- export function isStructuredTextFieldValueWithResolvedBlocks(value) {
56
+ export function isStructuredTextFieldValueWithNestedBlocks(value) {
69
57
  if (value === null)
70
58
  return true;
71
- if (!isValidDocumentStructure(value)) {
59
+ if (!isDocument(value)) {
72
60
  return false;
73
61
  }
74
62
  // Check that all block/inlineBlock nodes have full item objects
75
63
  return validateAllBlockNodes(value.document, (node) => {
76
64
  const item = node.item;
77
65
  // Must be a full object with ID (nested format always includes full items)
78
- return isBlockObjectWithId(item);
66
+ return isItemWithOptionalMeta(item);
79
67
  });
80
68
  }
81
69
  //# sourceMappingURL=structured_text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,OAAO,EACP,aAAa,EACb,MAAM,GACP,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAEL,aAAa,EACb,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AA8HxB;;;GAGG;AACH,SAAS,wBAAwB,CAC/B,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QACjB,UAAU,IAAI,KAAK,CACpB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAa,EACb,QAQY;IAEZ,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QACrC,wEAAwE;QACxE,IACE,MAAM,CAAC,WAAW,CAAC;YACnB,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,EACpD;YACA,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QACD,qDAAqD;QACrD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE;QACpC,OAAO,KAAK,CAAC;KACd;IAED,8DAA8D;IAC9D,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE;QACpC,OAAO,KAAK,CAAC;KACd;IAED,yEAAyE;IACzE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,YAAY;QACZ,IAAI,eAAe,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAEvC,qCAAqC;QACrC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4CAA4C,CAC1D,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE;QACpC,OAAO,KAAK,CAAC;KACd;IAED,gEAAgE;IAChE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,2EAA2E;QAC3E,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAEL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AA4FxB;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAa,EACb,QAAsD;IAEtD,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QACrC,wEAAwE;QACxE,IAAI,OAAO,CAAI,WAAW,CAAC,IAAI,aAAa,CAAI,WAAW,CAAC,EAAE;YAC5D,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QACD,qDAAqD;QACrD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,8DAA8D;IAC9D,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,yEAAyE;IACzE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,YAAY;QACZ,IAAI,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAEhC,qCAAqC;QACrC,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0CAA0C,CACxD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,gEAAgE;IAChE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,2EAA2E;QAC3E,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -4,7 +4,7 @@ import type { BooleanFieldAppearance, BooleanFieldValidators, BooleanFieldValue,
4
4
  */
5
5
  type FieldAppearanceConfig<TAppearance> = TAppearance & Omit<RawFieldAttributes['appearance'], keyof TAppearance>;
6
6
  /**
7
- * Base field configuration for attributes (non-localized), extending the original SchemaTypes
7
+ * Base field configuration for attributes (non-localized), extending the original RawApiTypes
8
8
  */
9
9
  type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
10
10
  field_type: FieldType;
@@ -14,7 +14,7 @@ type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFi
14
14
  appearance: FieldAppearanceConfig<FieldAppearance>;
15
15
  };
16
16
  /**
17
- * Base field configuration for attributes (localized), extending the original SchemaTypes
17
+ * Base field configuration for attributes (localized), extending the original RawApiTypes
18
18
  */
19
19
  type LocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
20
20
  field_type: FieldType;
@@ -30,16 +30,21 @@ type FieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttribute
30
30
  type GenericFieldAttributes<SourceType> = FieldAttributesForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldAttributesForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldAttributesForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldAttributesForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldAttributesForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldAttributesForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldAttributesForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldAttributesForFieldType<SourceType, 'lat_lon', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | FieldAttributesForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldAttributesForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldAttributesForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldAttributesForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldAttributesForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldAttributesForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldAttributesForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
31
31
  export type FieldAttributes = GenericFieldAttributes<RawFieldAttributes>;
32
32
  export type Field = GenericFieldAttributes<RawField>;
33
- /**
34
- * Helper type to conditionally handle default values based on localization for field creation
35
- */
36
- type FieldCreateDefaultValue<T> = T | Record<string, T> | undefined;
37
- type FieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance'> & {
33
+ type LocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
34
+ field_type: FieldType;
35
+ localized: true;
36
+ default_value?: Record<string, FieldValue>;
37
+ validators?: FieldValidators;
38
+ appearance?: FieldAppearanceConfig<FieldAppearance>;
39
+ };
40
+ type NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
38
41
  field_type: FieldType;
39
- default_value?: FieldCreateDefaultValue<FieldValue>;
42
+ localized?: false;
43
+ default_value?: FieldValue;
40
44
  validators?: FieldValidators;
41
45
  appearance?: FieldAppearanceConfig<FieldAppearance>;
42
46
  };
47
+ type FieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = LocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance> | NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance>;
43
48
  type FieldCreateConfig<SourceType> = FieldCreateConfigForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'lat_lon', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
44
49
  export type FieldCreateSchema = FieldCreateConfig<RawFieldCreateSchema>;
45
50
  /**
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ApiTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiTypes.js","sourceRoot":"","sources":["../../../src/generated/ApiTypes.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { type LogLevel, request } from '@datocms/rest-client-utils';
2
- import type { JobResult } from './SimpleSchemaTypes';
2
+ import type { JobResult } from './ApiTypes';
3
3
  import * as Resources from './resources';
4
4
  export type RequestOptions = {
5
5
  method: 'GET' | 'PUT' | 'POST' | 'DELETE';
@@ -62,7 +62,7 @@ export class Client {
62
62
  return this.config.baseUrl || Client.defaultBaseUrl;
63
63
  }
64
64
  request(options) {
65
- return request(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.0', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: Object.assign(Object.assign(Object.assign({}, (this.config.extraHeaders || {})), (this.config.environment
65
+ return request(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.2', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: Object.assign(Object.assign(Object.assign({}, (this.config.extraHeaders || {})), (this.config.environment
66
66
  ? { 'X-Environment': this.config.environment }
67
67
  : {})), { 'X-API-Version': '3' }), fetchJobResult: (jobId) => {
68
68
  return this.jobResultsFetcher
@@ -4,7 +4,7 @@ import type { BooleanFieldAppearance, BooleanFieldValidators, BooleanFieldValue,
4
4
  */
5
5
  type FieldAppearanceConfig<TAppearance> = TAppearance & Omit<RawFieldAttributes['appearance'], keyof TAppearance>;
6
6
  /**
7
- * Base field configuration for attributes (non-localized), extending the original SchemaTypes
7
+ * Base field configuration for attributes (non-localized), extending the original RawApiTypes
8
8
  */
9
9
  type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
10
10
  field_type: FieldType;
@@ -14,7 +14,7 @@ type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFi
14
14
  appearance: FieldAppearanceConfig<FieldAppearance>;
15
15
  };
16
16
  /**
17
- * Base field configuration for attributes (localized), extending the original SchemaTypes
17
+ * Base field configuration for attributes (localized), extending the original RawApiTypes
18
18
  */
19
19
  type LocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
20
20
  field_type: FieldType;
@@ -30,16 +30,21 @@ type FieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttribute
30
30
  type GenericFieldAttributes<SourceType> = FieldAttributesForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldAttributesForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldAttributesForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldAttributesForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldAttributesForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldAttributesForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldAttributesForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldAttributesForFieldType<SourceType, 'lat_lon', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | FieldAttributesForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldAttributesForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldAttributesForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldAttributesForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldAttributesForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldAttributesForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldAttributesForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
31
31
  export type FieldAttributes = GenericFieldAttributes<RawFieldAttributes>;
32
32
  export type Field = RawField;
33
- /**
34
- * Helper type to conditionally handle default values based on localization for field creation
35
- */
36
- type FieldCreateDefaultValue<T> = T | Record<string, T> | undefined;
37
- type FieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance'> & {
33
+ type LocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
34
+ field_type: FieldType;
35
+ localized: true;
36
+ default_value?: Record<string, FieldValue>;
37
+ validators?: FieldValidators;
38
+ appearance?: FieldAppearanceConfig<FieldAppearance>;
39
+ };
40
+ type NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
38
41
  field_type: FieldType;
39
- default_value?: FieldCreateDefaultValue<FieldValue>;
42
+ localized?: false;
43
+ default_value?: FieldValue;
40
44
  validators?: FieldValidators;
41
45
  appearance?: FieldAppearanceConfig<FieldAppearance>;
42
46
  };
47
+ type FieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = LocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance> | NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance>;
43
48
  type FieldCreateConfig<SourceType> = FieldCreateConfigForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'lat_lon', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
44
49
  export type FieldCreateSchema = Omit<RawFieldCreateSchema, 'data'> & {
45
50
  data: Omit<RawFieldCreateSchema['data'], 'attributes'> & {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RawApiTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RawApiTypes.js","sourceRoot":"","sources":["../../../src/generated/RawApiTypes.ts"],"names":[],"mappings":""}