@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
@@ -0,0 +1,237 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /**
11
+ * Determines whether a DatoCMS field is localized or not.
12
+ *
13
+ * This function handles both full Schema field objects and simplified Schema field objects
14
+ * by checking the appropriate property based on the object structure.
15
+ *
16
+ * @param field - The DatoCMS field definition (either full or simple schema)
17
+ * @returns true if the field is localized, false otherwise
18
+ */
19
+ export function isLocalized(field) {
20
+ return 'attributes' in field ? field.attributes.localized : field.localized;
21
+ }
22
+ /**
23
+ * Converts a field value (localized or non-localized) into a uniform array of entries.
24
+ *
25
+ * This function normalizes the handling of field values by converting them into a consistent
26
+ * array format, regardless of whether the field is localized or not.
27
+ *
28
+ * @param field - The DatoCMS field definition that determines localization behavior
29
+ * @param value - The field value to convert (either a localized object or direct value)
30
+ * @returns Array of entries where each entry contains a locale (string for localized, undefined for non-localized) and the corresponding value
31
+ */
32
+ export function fieldValueToEntries(field, value) {
33
+ if (isLocalized(field)) {
34
+ const localizedValue = value;
35
+ return Object.entries(localizedValue).map(([locale, value]) => ({ locale, value }));
36
+ }
37
+ return [{ locale: undefined, value }];
38
+ }
39
+ /**
40
+ * Converts an array of possibly localized entries back into the appropriate field value format.
41
+ *
42
+ * This function is the inverse of `fieldValueToPossiblyLocalizedEntries`. It takes a uniform
43
+ * array of entries and converts them back to either a localized object or a direct value,
44
+ * depending on the field's localization setting.
45
+ *
46
+ * @param field - The DatoCMS field definition that determines the output format
47
+ * @param possiblyLocalizedEntries - Array of entries to convert back to field value format
48
+ * @returns Either a localized object (for localized fields) or the direct value (for non-localized fields)
49
+ */
50
+ export function entriesToFieldValue(field, possiblyLocalizedEntries) {
51
+ var _a;
52
+ if (isLocalized(field)) {
53
+ return Object.fromEntries(possiblyLocalizedEntries.map(({ locale, value }) => [locale, value]));
54
+ }
55
+ return (_a = possiblyLocalizedEntries[0]) === null || _a === void 0 ? void 0 : _a.value;
56
+ }
57
+ /**
58
+ * Maps field values using a provided mapping function.
59
+ * For localized fields, applies the mapping function to each locale value.
60
+ * For non-localized fields, applies the mapping function directly to the value.
61
+ *
62
+ * @template T - The type that the mapping function returns
63
+ * @param field - The DatoCMS field definition
64
+ * @param value - The field value (either localized object or direct value)
65
+ * @param mapFn - The function to apply to each locale value or the direct value
66
+ * @returns The mapped value with the same structure as the input
67
+ */
68
+ export function mapFieldValue(field, value, mapFn) {
69
+ const entries = fieldValueToEntries(field, value);
70
+ const mappedEntries = entries.map(({ locale, value }) => ({
71
+ locale,
72
+ value: mapFn(locale, value),
73
+ }));
74
+ return entriesToFieldValue(field, mappedEntries);
75
+ }
76
+ /**
77
+ * Maps field values using a provided mapping function (async version).
78
+ * For localized fields, applies the mapping function to each locale value.
79
+ * For non-localized fields, applies the mapping function directly to the value.
80
+ *
81
+ * @template T - The type that the mapping function returns
82
+ * @param field - The DatoCMS field definition
83
+ * @param value - The field value (either localized object or direct value)
84
+ * @param mapFn - The function to apply to each locale value or the direct value
85
+ * @returns The mapped value with the same structure as the input
86
+ */
87
+ export function mapFieldValueAsync(field, value, mapFn) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const entries = fieldValueToEntries(field, value);
90
+ const mappedEntries = yield Promise.all(entries.map(({ locale, value }) => __awaiter(this, void 0, void 0, function* () {
91
+ return ({
92
+ locale,
93
+ value: yield mapFn(locale, value),
94
+ });
95
+ })));
96
+ return entriesToFieldValue(field, mappedEntries);
97
+ });
98
+ }
99
+ /**
100
+ * Filters field values using a provided filter function.
101
+ * For localized fields, filters each locale value.
102
+ * For non-localized fields, returns the value if the filter passes, otherwise undefined.
103
+ *
104
+ * @param field - The DatoCMS field definition
105
+ * @param value - The field value (either localized object or direct value)
106
+ * @param filterFn - The function to test each locale value or the direct value
107
+ * @returns The filtered value with the same structure as the input
108
+ */
109
+ export function filterFieldValue(field, value, filterFn) {
110
+ var _a;
111
+ const entries = fieldValueToEntries(field, value);
112
+ const filteredEntries = entries.filter(({ locale, value }) => filterFn(locale, value));
113
+ if (isLocalized(field)) {
114
+ return entriesToFieldValue(field, filteredEntries);
115
+ }
116
+ return filteredEntries.length > 0 ? (_a = filteredEntries[0]) === null || _a === void 0 ? void 0 : _a.value : undefined;
117
+ }
118
+ /**
119
+ * Filters field values using a provided filter function (async version).
120
+ * For localized fields, filters each locale value.
121
+ * For non-localized fields, returns the value if the filter passes, otherwise undefined.
122
+ *
123
+ * @param field - The DatoCMS field definition
124
+ * @param value - The field value (either localized object or direct value)
125
+ * @param filterFn - The function to test each locale value or the direct value
126
+ * @returns The filtered value with the same structure as the input
127
+ */
128
+ export function filterFieldValueAsync(field, value, filterFn) {
129
+ var _a;
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ const entries = fieldValueToEntries(field, value);
132
+ const results = yield Promise.all(entries.map(({ locale, value }) => __awaiter(this, void 0, void 0, function* () {
133
+ return ({
134
+ locale,
135
+ value,
136
+ passed: yield filterFn(locale, value),
137
+ });
138
+ })));
139
+ const filteredEntries = results
140
+ .filter(({ passed }) => passed)
141
+ .map(({ locale, value }) => ({ locale, value }));
142
+ if (isLocalized(field)) {
143
+ return entriesToFieldValue(field, filteredEntries);
144
+ }
145
+ return filteredEntries.length > 0 ? (_a = filteredEntries[0]) === null || _a === void 0 ? void 0 : _a.value : undefined;
146
+ });
147
+ }
148
+ /**
149
+ * Tests whether at least one field value passes the test implemented by the provided function.
150
+ * For localized fields, tests each locale value.
151
+ * For non-localized fields, tests the direct value.
152
+ *
153
+ * @param field - The DatoCMS field definition
154
+ * @param value - The field value (either localized object or direct value)
155
+ * @param testFn - The function to test each locale value or the direct value
156
+ * @returns true if at least one value passes the test, false otherwise
157
+ */
158
+ export function someFieldValue(field, value, testFn) {
159
+ const entries = fieldValueToEntries(field, value);
160
+ return entries.some(({ locale, value }) => testFn(locale, value));
161
+ }
162
+ /**
163
+ * Tests whether at least one field value passes the test implemented by the provided function (async version).
164
+ * For localized fields, tests each locale value.
165
+ * For non-localized fields, tests the direct value.
166
+ *
167
+ * @param field - The DatoCMS field definition
168
+ * @param value - The field value (either localized object or direct value)
169
+ * @param testFn - The function to test each locale value or the direct value
170
+ * @returns true if at least one value passes the test, false otherwise
171
+ */
172
+ export function someFieldValueAsync(field, value, testFn) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ const entries = fieldValueToEntries(field, value);
175
+ const results = yield Promise.all(entries.map(({ locale, value }) => testFn(locale, value)));
176
+ return results.some((result) => result);
177
+ });
178
+ }
179
+ /**
180
+ * Tests whether all field values pass the test implemented by the provided function.
181
+ * For localized fields, tests each locale value.
182
+ * For non-localized fields, tests the direct value.
183
+ *
184
+ * @param field - The DatoCMS field definition
185
+ * @param value - The field value (either localized object or direct value)
186
+ * @param testFn - The function to test each locale value or the direct value
187
+ * @returns true if all values pass the test, false otherwise
188
+ */
189
+ export function everyFieldValue(field, value, testFn) {
190
+ return !someFieldValue(field, value, (locale, localeValue) => !testFn(locale, localeValue));
191
+ }
192
+ /**
193
+ * Tests whether all field values pass the test implemented by the provided function (async version).
194
+ * For localized fields, tests each locale value.
195
+ * For non-localized fields, tests the direct value.
196
+ *
197
+ * @param field - The DatoCMS field definition
198
+ * @param value - The field value (either localized object or direct value)
199
+ * @param testFn - The function to test each locale value or the direct value
200
+ * @returns true if all values pass the test, false otherwise
201
+ */
202
+ export function everyFieldValueAsync(field, value, testFn) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ return !(yield someFieldValueAsync(field, value, (locale, localeValue) => __awaiter(this, void 0, void 0, function* () { return !(yield testFn(locale, localeValue)); })));
205
+ });
206
+ }
207
+ /**
208
+ * Visits each field value with the provided function.
209
+ * For localized fields, visits each locale value.
210
+ * For non-localized fields, visits the direct value.
211
+ *
212
+ * @param field - The DatoCMS field definition
213
+ * @param value - The field value (either localized object or direct value)
214
+ * @param visitFn - The function to call for each locale value or the direct value
215
+ */
216
+ export function visitFieldValue(field, value, visitFn) {
217
+ const entries = fieldValueToEntries(field, value);
218
+ for (const { locale, value } of entries) {
219
+ visitFn(locale, value);
220
+ }
221
+ }
222
+ /**
223
+ * Visits each field value with the provided function (async version).
224
+ * For localized fields, visits each locale value.
225
+ * For non-localized fields, visits the direct value.
226
+ *
227
+ * @param field - The DatoCMS field definition
228
+ * @param value - The field value (either localized object or direct value)
229
+ * @param visitFn - The function to call for each locale value or the direct value
230
+ */
231
+ export function visitFieldValueAsync(field, value, visitFn) {
232
+ return __awaiter(this, void 0, void 0, function* () {
233
+ const entries = fieldValueToEntries(field, value);
234
+ yield Promise.all(entries.map(({ locale, value }) => visitFn(locale, value)));
235
+ });
236
+ }
237
+ //# sourceMappingURL=fieldValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldValue.js","sourceRoot":"","sources":["../../../src/utilities/fieldValue.ts"],"names":[],"mappings":";;;;;;;;;AA+BA;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,KAAyC;IAEzC,OAAO,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,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OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;CAAA"}
@@ -1,4 +1,4 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
2
- import type * as SimpleSchemaTypes from '../generated/SimpleSchemaTypes';
3
- export declare function modelIdsReferencedInField(field: SchemaTypes.Field | SimpleSchemaTypes.Field): string[];
4
- export declare function blockModelIdsReferencedInField(field: SchemaTypes.Field | SimpleSchemaTypes.Field): string[];
1
+ import type * as ApiTypes from '../generated/ApiTypes';
2
+ import type * as RawApiTypes from '../generated/RawApiTypes';
3
+ export declare function modelIdsReferencedInField(field: RawApiTypes.Field | ApiTypes.Field): string[];
4
+ export declare function blockModelIdsReferencedInField(field: RawApiTypes.Field | ApiTypes.Field): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"fieldsContainingReferences.js","sourceRoot":"","sources":["../../../src/utilities/fieldsContainingReferences.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,yBAAyB,CACvC,KAAkD;IAElD,MAAM,UAAU,GAAG,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,QAAQ,UAAU,CAAC,UAAU,EAAE;QAC7B,KAAK,MAAM,CAAC,CAAC;YACX,OAAO,UAAU,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC;SACxD;QACD,KAAK,OAAO,CAAC,CAAC;YACZ,OAAO,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,UAAU,CAAC;SACzD;QACD,KAAK,iBAAiB,CAAC,CAAC;YACtB,OAAO,UAAU,CAAC,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC;SAC/D;QACD,OAAO,CAAC,CAAC;YACP,OAAO,EAAE,CAAC;SACX;KACF;AACH,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,KAAkD;IAElD,MAAM,UAAU,GAAG,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,QAAQ,UAAU,CAAC,UAAU,EAAE;QAC7B,KAAK,cAAc,CAAC,CAAC;YACnB,OAAO,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC,UAAU,CAAC;SAC7D;QACD,KAAK,WAAW,CAAC,CAAC;YAChB,OAAO,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC;SAC1D;QACD,KAAK,iBAAiB,CAAC,CAAC;YACtB,OAAO;gBACL,GAAG,UAAU,CAAC,UAAU,CAAC,sBAAsB,CAAC,UAAU;gBAC1D,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,6BAA6B;oBACrD,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU;oBAChE,CAAC,CAAC,EAAE,CAAC;aACR,CAAC;SACH;QACD,OAAO,CAAC,CAAC;YACP,OAAO,EAAE,CAAC;SACX;KACF;AACH,CAAC"}
1
+ {"version":3,"file":"fieldsContainingReferences.js","sourceRoot":"","sources":["../../../src/utilities/fieldsContainingReferences.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,yBAAyB,CACvC,KAAyC;IAEzC,MAAM,UAAU,GAAG,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,QAAQ,UAAU,CAAC,UAAU,EAAE;QAC7B,KAAK,MAAM,CAAC,CAAC;YACX,OAAO,UAAU,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC;SACxD;QACD,KAAK,OAAO,CAAC,CAAC;YACZ,OAAO,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,UAAU,CAAC;SACzD;QACD,KAAK,iBAAiB,CAAC,CAAC;YACtB,OAAO,UAAU,CAAC,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC;SAC/D;QACD,OAAO,CAAC,CAAC;YACP,OAAO,EAAE,CAAC;SACX;KACF;AACH,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,KAAyC;IAEzC,MAAM,UAAU,GAAG,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpE,QAAQ,UAAU,CAAC,UAAU,EAAE;QAC7B,KAAK,cAAc,CAAC,CAAC;YACnB,OAAO,UAAU,CAAC,UAAU,CAAC,mBAAmB,CAAC,UAAU,CAAC;SAC7D;QACD,KAAK,WAAW,CAAC,CAAC;YAChB,OAAO,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC;SAC1D;QACD,KAAK,iBAAiB,CAAC,CAAC;YACtB,OAAO;gBACL,GAAG,UAAU,CAAC,UAAU,CAAC,sBAAsB,CAAC,UAAU;gBAC1D,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,6BAA6B;oBACrD,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,6BAA6B,CAAC,UAAU;oBAChE,CAAC,CAAC,EAAE,CAAC;aACR,CAAC;SACH;QACD,OAAO,CAAC,CAAC;YACP,OAAO,EAAE,CAAC;SACX;KACF;AACH,CAAC"}
@@ -1,15 +1,18 @@
1
1
  import { type BlockItemInARequest } from '../fieldTypes';
2
- import type * as SchemaTypes from '../generated/SchemaTypes';
3
- import type * as SimpleSchemaTypes from '../generated/SimpleSchemaTypes';
2
+ import type * as ApiTypes from '../generated/ApiTypes';
3
+ import type * as RawApiTypes from '../generated/RawApiTypes';
4
4
  import type { SchemaRepository } from './schemaRepository';
5
- import type { TreePath } from './structuredText';
6
- export declare function visitBlocksInFieldValues(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, visitor: (item: BlockItemInARequest, path: TreePath) => void | Promise<void>, path?: TreePath): Promise<void>;
7
- export declare function findAllBlocksInFieldValues(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<Array<{
5
+ /**
6
+ * Path through a field value (ie. ['content', 0, 'attributes', 'title'])
7
+ */
8
+ export type TreePath = readonly (string | number)[];
9
+ export declare function visitBlocksInFieldValues(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, visitor: (item: BlockItemInARequest, path: TreePath) => void | Promise<void>, path?: TreePath): Promise<void>;
10
+ export declare function findAllBlocksInFieldValues(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<Array<{
8
11
  item: BlockItemInARequest;
9
12
  path: TreePath;
10
13
  }>>;
11
- export declare function filterBlocksInFieldValues(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<unknown>;
12
- export declare function reduceBlocksInFieldValues<R>(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, reducer: (accumulator: R, item: BlockItemInARequest, path: TreePath) => R | Promise<R>, initialValue: R, path?: TreePath): Promise<R>;
13
- export declare function someBlocksInFieldValues(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<boolean>;
14
- export declare function everyBlockInFieldValues(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<boolean>;
15
- export declare function mapBlocksInFieldValues(schemaRepository: SchemaRepository, field: SchemaTypes.Field | SimpleSchemaTypes.Field, value: unknown, mapper: (item: BlockItemInARequest, path: TreePath) => BlockItemInARequest | Promise<BlockItemInARequest>, path?: TreePath): Promise<unknown>;
14
+ export declare function filterBlocksInFieldValues(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<unknown>;
15
+ export declare function reduceBlocksInFieldValues<R>(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, reducer: (accumulator: R, item: BlockItemInARequest, path: TreePath) => R | Promise<R>, initialValue: R, path?: TreePath): Promise<R>;
16
+ export declare function someBlocksInFieldValues(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<boolean>;
17
+ export declare function everyBlockInFieldValues(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, predicate: (item: BlockItemInARequest, path: TreePath) => boolean | Promise<boolean>, path?: TreePath): Promise<boolean>;
18
+ export declare function mapBlocksInFieldValues(schemaRepository: SchemaRepository, field: RawApiTypes.Field | ApiTypes.Field, value: unknown, mapper: (item: BlockItemInARequest, path: TreePath) => BlockItemInARequest | Promise<BlockItemInARequest>, path?: TreePath): Promise<unknown>;
@@ -7,20 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { isBlockObject } from '../fieldTypes';
10
+ import { isItemWithOptionalIdAndMeta, } from '../fieldTypes';
11
11
  import { nonRecursiveFilterBlocksInFieldValueAsync, nonRecursiveFindAllBlocksInFieldValueAsync, nonRecursiveMapBlocksInFieldValueAsync, nonRecursiveReduceBlocksInFieldValueAsync, nonRecursiveSomeBlocksInFieldValueAsync, nonRecursiveVisitBlocksInFieldValueAsync, } from './blocks';
12
- import { mapLocalizedFieldValuesAsync, visitLocalizedFieldValuesAsync, } from './fieldValueLocalization';
12
+ import { mapFieldValueAsync, visitFieldValueAsync } from './fieldValue';
13
13
  export function visitBlocksInFieldValues(schemaRepository, field, value, visitor, path = []) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  yield nonRecursiveVisitBlocksInFieldValueAsync(field, value, (block, innerPath) => __awaiter(this, void 0, void 0, function* () {
16
16
  yield visitor(block, [...path, ...innerPath]);
17
- if (!isBlockObject(block)) {
17
+ if (!isItemWithOptionalIdAndMeta(block)) {
18
18
  return;
19
19
  }
20
20
  const itemType = yield schemaRepository.getRawItemTypeById(block.relationships.item_type.data.id);
21
21
  const fields = yield schemaRepository.getRawItemTypeFields(itemType);
22
22
  for (const field of fields) {
23
- yield visitLocalizedFieldValuesAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => visitBlocksInFieldValues(schemaRepository, field, valueForLocale, visitor, [
23
+ yield visitFieldValueAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => visitBlocksInFieldValues(schemaRepository, field, valueForLocale, visitor, [
24
24
  ...path,
25
25
  ...innerPath,
26
26
  'attributes',
@@ -40,13 +40,13 @@ export function findAllBlocksInFieldValues(schemaRepository, field, value, predi
40
40
  path: [...path, ...innerPath],
41
41
  })));
42
42
  yield nonRecursiveVisitBlocksInFieldValueAsync(field, value, (block, innerPath) => __awaiter(this, void 0, void 0, function* () {
43
- if (!isBlockObject(block)) {
43
+ if (!isItemWithOptionalIdAndMeta(block)) {
44
44
  return;
45
45
  }
46
46
  const itemType = yield schemaRepository.getRawItemTypeById(block.relationships.item_type.data.id);
47
47
  const fields = yield schemaRepository.getRawItemTypeFields(itemType);
48
48
  for (const field of fields) {
49
- yield visitLocalizedFieldValuesAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => __awaiter(this, void 0, void 0, function* () {
49
+ yield visitFieldValueAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => __awaiter(this, void 0, void 0, function* () {
50
50
  const nestedResults = yield findAllBlocksInFieldValues(schemaRepository, field, valueForLocale, predicate, [
51
51
  ...path,
52
52
  ...innerPath,
@@ -69,19 +69,18 @@ export function filterBlocksInFieldValues(schemaRepository, field, value, predic
69
69
  if (!passes) {
70
70
  return false;
71
71
  }
72
- if (!isBlockObject(block)) {
72
+ if (!isItemWithOptionalIdAndMeta(block)) {
73
73
  return true;
74
74
  }
75
75
  const itemType = yield schemaRepository.getRawItemTypeById(block.relationships.item_type.data.id);
76
76
  const fields = yield schemaRepository.getRawItemTypeFields(itemType);
77
77
  for (const field of fields) {
78
- block.attributes[field.attributes.api_key] =
79
- yield mapLocalizedFieldValuesAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => filterBlocksInFieldValues(schemaRepository, field, valueForLocale, predicate, [
80
- ...blockPath,
81
- 'attributes',
82
- field.attributes.api_key,
83
- ...(locale ? [locale] : []),
84
- ]));
78
+ block.attributes[field.attributes.api_key] = yield mapFieldValueAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => filterBlocksInFieldValues(schemaRepository, field, valueForLocale, predicate, [
79
+ ...blockPath,
80
+ 'attributes',
81
+ field.attributes.api_key,
82
+ ...(locale ? [locale] : []),
83
+ ]));
85
84
  }
86
85
  return true;
87
86
  }));
@@ -91,13 +90,13 @@ export function reduceBlocksInFieldValues(schemaRepository, field, value, reduce
91
90
  return __awaiter(this, void 0, void 0, function* () {
92
91
  let accumulator = yield nonRecursiveReduceBlocksInFieldValueAsync(field, value, (acc, block, innerPath) => __awaiter(this, void 0, void 0, function* () { return yield reducer(acc, block, [...path, ...innerPath]); }), initialValue);
93
92
  yield nonRecursiveVisitBlocksInFieldValueAsync(field, value, (block, innerPath) => __awaiter(this, void 0, void 0, function* () {
94
- if (!isBlockObject(block)) {
93
+ if (!isItemWithOptionalIdAndMeta(block)) {
95
94
  return;
96
95
  }
97
96
  const itemType = yield schemaRepository.getRawItemTypeById(block.relationships.item_type.data.id);
98
97
  const fields = yield schemaRepository.getRawItemTypeFields(itemType);
99
98
  for (const field of fields) {
100
- yield visitLocalizedFieldValuesAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => __awaiter(this, void 0, void 0, function* () {
99
+ yield visitFieldValueAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => __awaiter(this, void 0, void 0, function* () {
101
100
  accumulator = yield reduceBlocksInFieldValues(schemaRepository, field, valueForLocale, reducer, accumulator, [
102
101
  ...path,
103
102
  ...innerPath,
@@ -119,7 +118,7 @@ export function someBlocksInFieldValues(schemaRepository, field, value, predicat
119
118
  }
120
119
  let found = false;
121
120
  yield nonRecursiveVisitBlocksInFieldValueAsync(field, value, (block, innerPath) => __awaiter(this, void 0, void 0, function* () {
122
- if (found || !isBlockObject(block)) {
121
+ if (found || !isItemWithOptionalIdAndMeta(block)) {
123
122
  return;
124
123
  }
125
124
  const itemType = yield schemaRepository.getRawItemTypeById(block.relationships.item_type.data.id);
@@ -127,7 +126,7 @@ export function someBlocksInFieldValues(schemaRepository, field, value, predicat
127
126
  for (const field of fields) {
128
127
  if (found)
129
128
  break;
130
- yield visitLocalizedFieldValuesAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => __awaiter(this, void 0, void 0, function* () {
129
+ yield visitFieldValueAsync(field, block.attributes[field.attributes.api_key], (locale, valueForLocale) => __awaiter(this, void 0, void 0, function* () {
131
130
  if (found)
132
131
  return;
133
132
  const nestedMatch = yield someBlocksInFieldValues(schemaRepository, field, valueForLocale, predicate, [
@@ -155,14 +154,14 @@ export function mapBlocksInFieldValues(schemaRepository, field, value, mapper, p
155
154
  return __awaiter(this, void 0, void 0, function* () {
156
155
  return nonRecursiveMapBlocksInFieldValueAsync(field, value, (block, innerPath) => __awaiter(this, void 0, void 0, function* () {
157
156
  const newBlock = yield mapper(block, [...path, ...innerPath]);
158
- if (!isBlockObject(newBlock)) {
157
+ if (!isItemWithOptionalIdAndMeta(newBlock)) {
159
158
  return newBlock;
160
159
  }
161
160
  const itemType = yield schemaRepository.getRawItemTypeById(newBlock.relationships.item_type.data.id);
162
161
  const fields = yield schemaRepository.getRawItemTypeFields(itemType);
163
162
  for (const field of fields) {
164
163
  newBlock.attributes[field.attributes.api_key] =
165
- yield mapLocalizedFieldValuesAsync(field, newBlock.attributes[field.attributes.api_key], (locale, valueForLocale) => mapBlocksInFieldValues(schemaRepository, field, valueForLocale, mapper, [
164
+ yield mapFieldValueAsync(field, newBlock.attributes[field.attributes.api_key], (locale, valueForLocale) => mapBlocksInFieldValues(schemaRepository, field, valueForLocale, mapper, [
166
165
  ...path,
167
166
  ...innerPath,
168
167
  'attributes',
@@ -1 +1 @@
1
- {"version":3,"file":"recursiveBlocks.js","sourceRoot":"","sources":["../../../src/utilities/recursiveBlocks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAA4B,aAAa,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,EACL,yCAAyC,EACzC,0CAA0C,EAC1C,sCAAsC,EACtC,yCAAyC,EACzC,uCAAuC,EACvC,wCAAwC,GACzC,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAIlC,MAAM,UAAgB,wBAAwB,CAC5C,gBAAkC,EAClC,KAAkD,EAClD,KAAc,EACd,OAA4E,EAC5E,OAAiB,EAAE;;QAEnB,MAAM,wCAAwC,CAC5C,KAAK,EACL,KAAK,EACL,CAAO,KAAK,EAAE,SAAS,EAAE,EAAE;YACzB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;YAE9C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;gBACzB,OAAO;aACR;YAED,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,kBAAkB,CACxD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,I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AAsB,CACpB,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,MAAM,EACN;wBACE,GAAG,IAAI;wBACP,GAAG,SAAS;wBACZ,YAAY;wBACZ,KAAK,CAAC,UAAU,CAAC,OAAO;wBACxB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;qBAC5B,CACF,CACJ,CAAC;aACL;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA,CACF,CAAC;IACJ,CAAC;CAAA"}
@@ -1,24 +1,27 @@
1
- import type * as SchemaTypes from '../generated/SchemaTypes';
2
- import type * as SimpleSchemaTypes from '../generated/SimpleSchemaTypes';
1
+ import type * as ApiTypes from '../generated/ApiTypes';
2
+ import type * as RawApiTypes from '../generated/RawApiTypes';
3
3
  interface GenericClient {
4
4
  itemTypes: {
5
5
  rawList(): Promise<{
6
- data: SchemaTypes.ItemType[];
6
+ data: RawApiTypes.ItemType[];
7
7
  }>;
8
8
  };
9
9
  fields: {
10
10
  rawList(itemTypeId: string): Promise<{
11
- data: SchemaTypes.Field[];
11
+ data: RawApiTypes.Field[];
12
+ }>;
13
+ rawReferencing(itemTypeId: string): Promise<{
14
+ data: RawApiTypes.Field[];
12
15
  }>;
13
16
  };
14
17
  fieldsets: {
15
18
  rawList(itemTypeId: string): Promise<{
16
- data: SchemaTypes.Fieldset[];
19
+ data: RawApiTypes.Fieldset[];
17
20
  }>;
18
21
  };
19
22
  plugins: {
20
23
  rawList(): Promise<{
21
- data: SchemaTypes.Plugin[];
24
+ data: RawApiTypes.Plugin[];
22
25
  }>;
23
26
  };
24
27
  }
@@ -51,88 +54,88 @@ export declare class SchemaRepository {
51
54
  * Gets all item types from the DatoCMS project.
52
55
  * @returns Promise that resolves to an array of all item types
53
56
  */
54
- getAllItemTypes(): Promise<SimpleSchemaTypes.ItemType[]>;
57
+ getAllItemTypes(): Promise<ApiTypes.ItemType[]>;
55
58
  /**
56
59
  * Gets all item types from the DatoCMS project.
57
60
  * @returns Promise that resolves to an array of all item types
58
61
  */
59
- getAllRawItemTypes(): Promise<SchemaTypes.ItemType[]>;
62
+ getAllRawItemTypes(): Promise<RawApiTypes.ItemType[]>;
60
63
  /**
61
64
  * Gets all item types that are models (not modular blocks).
62
65
  * @returns Promise that resolves to an array of model item types
63
66
  */
64
- getAllModels(): Promise<SimpleSchemaTypes.ItemType[]>;
67
+ getAllModels(): Promise<ApiTypes.ItemType[]>;
65
68
  /**
66
69
  * Gets all item types that are models (not modular blocks).
67
70
  * @returns Promise that resolves to an array of model item types
68
71
  */
69
- getAllRawModels(): Promise<SchemaTypes.ItemType[]>;
72
+ getAllRawModels(): Promise<RawApiTypes.ItemType[]>;
70
73
  /**
71
74
  * Gets all item types that are modular blocks.
72
75
  * @returns Promise that resolves to an array of block model item types
73
76
  */
74
- getAllBlockModels(): Promise<SimpleSchemaTypes.ItemType[]>;
77
+ getAllBlockModels(): Promise<ApiTypes.ItemType[]>;
75
78
  /**
76
79
  * Gets all item types that are modular blocks.
77
80
  * @returns Promise that resolves to an array of block model item types
78
81
  */
79
- getAllRawBlockModels(): Promise<SchemaTypes.ItemType[]>;
82
+ getAllRawBlockModels(): Promise<RawApiTypes.ItemType[]>;
80
83
  /**
81
84
  * Gets an item type by its API key.
82
85
  * @param apiKey - The API key of the item type to retrieve
83
86
  * @returns Promise that resolves to the item type
84
87
  * @throws Error if the item type is not found
85
88
  */
86
- getItemTypeByApiKey(apiKey: string): Promise<SimpleSchemaTypes.ItemType>;
89
+ getItemTypeByApiKey(apiKey: string): Promise<ApiTypes.ItemType>;
87
90
  /**
88
91
  * Gets an item type by its API key.
89
92
  * @param apiKey - The API key of the item type to retrieve
90
93
  * @returns Promise that resolves to the item type
91
94
  * @throws Error if the item type is not found
92
95
  */
93
- getRawItemTypeByApiKey(apiKey: string): Promise<SchemaTypes.ItemType>;
96
+ getRawItemTypeByApiKey(apiKey: string): Promise<RawApiTypes.ItemType>;
94
97
  /**
95
98
  * Gets an item type by its ID.
96
99
  * @param id - The ID of the item type to retrieve
97
100
  * @returns Promise that resolves to the item type
98
101
  * @throws Error if the item type is not found
99
102
  */
100
- getItemTypeById(id: string): Promise<SimpleSchemaTypes.ItemType>;
103
+ getItemTypeById(id: string): Promise<ApiTypes.ItemType>;
101
104
  /**
102
105
  * Gets an item type by its ID.
103
106
  * @param id - The ID of the item type to retrieve
104
107
  * @returns Promise that resolves to the item type
105
108
  * @throws Error if the item type is not found
106
109
  */
107
- getRawItemTypeById(id: string): Promise<SchemaTypes.ItemType>;
110
+ getRawItemTypeById(id: string): Promise<RawApiTypes.ItemType>;
108
111
  /**
109
112
  * Gets all fields for a given item type.
110
113
  * Fields are cached after the first request for performance.
111
114
  * @param itemType - The item type to get fields for
112
115
  * @returns Promise that resolves to an array of fields
113
116
  */
114
- getItemTypeFields(itemType: SimpleSchemaTypes.ItemType | SchemaTypes.ItemType): Promise<SimpleSchemaTypes.Field[]>;
117
+ getItemTypeFields(itemType: ApiTypes.ItemType | RawApiTypes.ItemType): Promise<ApiTypes.Field[]>;
115
118
  /**
116
119
  * Gets all fields for a given item type.
117
120
  * Fields are cached after the first request for performance.
118
121
  * @param itemType - The item type to get fields for
119
122
  * @returns Promise that resolves to an array of fields
120
123
  */
121
- getRawItemTypeFields(itemType: SchemaTypes.ItemType): Promise<SchemaTypes.Field[]>;
124
+ getRawItemTypeFields(itemType: RawApiTypes.ItemType): Promise<RawApiTypes.Field[]>;
122
125
  /**
123
126
  * Gets all fieldsets for a given item type.
124
127
  * Fieldsets are cached after the first request for performance.
125
128
  * @param itemType - The item type to get fieldsets for
126
129
  * @returns Promise that resolves to an array of fieldsets
127
130
  */
128
- getItemTypeFieldsets(itemType: SimpleSchemaTypes.ItemType | SchemaTypes.ItemType): Promise<SimpleSchemaTypes.Fieldset[]>;
131
+ getItemTypeFieldsets(itemType: ApiTypes.ItemType | RawApiTypes.ItemType): Promise<ApiTypes.Fieldset[]>;
129
132
  /**
130
133
  * Gets all fieldsets for a given item type.
131
134
  * Fieldsets are cached after the first request for performance.
132
135
  * @param itemType - The item type to get fieldsets for
133
136
  * @returns Promise that resolves to an array of fieldsets
134
137
  */
135
- getRawItemTypeFieldsets(itemType: SchemaTypes.ItemType): Promise<SchemaTypes.Fieldset[]>;
138
+ getRawItemTypeFieldsets(itemType: RawApiTypes.ItemType): Promise<RawApiTypes.Fieldset[]>;
136
139
  /**
137
140
  * Loads and caches all plugins from the DatoCMS API.
138
141
  * This method is called lazily and caches the result for subsequent calls.
@@ -143,39 +146,39 @@ export declare class SchemaRepository {
143
146
  * Gets all plugins from the DatoCMS project.
144
147
  * @returns Promise that resolves to an array of all plugins
145
148
  */
146
- getAllPlugins(): Promise<SimpleSchemaTypes.Plugin[]>;
149
+ getAllPlugins(): Promise<ApiTypes.Plugin[]>;
147
150
  /**
148
151
  * Gets all plugins from the DatoCMS project.
149
152
  * @returns Promise that resolves to an array of all plugins
150
153
  */
151
- getAllRawPlugins(): Promise<SchemaTypes.Plugin[]>;
154
+ getAllRawPlugins(): Promise<RawApiTypes.Plugin[]>;
152
155
  /**
153
156
  * Gets a plugin by its ID.
154
157
  * @param id - The ID of the plugin to retrieve
155
158
  * @returns Promise that resolves to the plugin
156
159
  * @throws Error if the plugin is not found
157
160
  */
158
- getPluginById(id: string): Promise<SimpleSchemaTypes.Plugin>;
161
+ getPluginById(id: string): Promise<ApiTypes.Plugin>;
159
162
  /**
160
163
  * Gets a plugin by its ID.
161
164
  * @param id - The ID of the plugin to retrieve
162
165
  * @returns Promise that resolves to the plugin
163
166
  * @throws Error if the plugin is not found
164
167
  */
165
- getRawPluginById(id: string): Promise<SchemaTypes.Plugin>;
168
+ getRawPluginById(id: string): Promise<RawApiTypes.Plugin>;
166
169
  /**
167
170
  * Gets a plugin by its package name.
168
171
  * @param packageName - The package name of the plugin to retrieve
169
172
  * @returns Promise that resolves to the plugin
170
173
  * @throws Error if the plugin is not found
171
174
  */
172
- getPluginByPackageName(packageName: string): Promise<SimpleSchemaTypes.Plugin>;
175
+ getPluginByPackageName(packageName: string): Promise<ApiTypes.Plugin>;
173
176
  /**
174
177
  * Gets a plugin by its package name.
175
178
  * @param packageName - The package name of the plugin to retrieve
176
179
  * @returns Promise that resolves to the plugin
177
180
  * @throws Error if the plugin is not found
178
181
  */
179
- getRawPluginByPackageName(packageName: string): Promise<SchemaTypes.Plugin>;
182
+ getRawPluginByPackageName(packageName: string): Promise<RawApiTypes.Plugin>;
180
183
  }
181
184
  export {};