contentful-management 11.52.1 → 12.0.0-beta.1

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 (613) hide show
  1. package/README.md +73 -48
  2. package/dist/contentful-management.browser.js +23913 -28421
  3. package/dist/contentful-management.browser.min.js +1 -2
  4. package/dist/contentful-management.cjs +37008 -0
  5. package/dist/{es-modules → esm}/adapters/REST/endpoints/access-token.js +20 -22
  6. package/dist/esm/adapters/REST/endpoints/ai-action-invocation.js +7 -0
  7. package/dist/esm/adapters/REST/endpoints/ai-action.js +44 -0
  8. package/dist/esm/adapters/REST/endpoints/api-key.js +41 -0
  9. package/dist/esm/adapters/REST/endpoints/app-access-token.js +7 -0
  10. package/dist/esm/adapters/REST/endpoints/app-action-call.js +61 -0
  11. package/dist/esm/adapters/REST/endpoints/app-action.js +35 -0
  12. package/dist/esm/adapters/REST/endpoints/app-bundle.js +34 -0
  13. package/dist/esm/adapters/REST/endpoints/app-definition.js +39 -0
  14. package/dist/esm/adapters/REST/endpoints/app-details.js +13 -0
  15. package/dist/esm/adapters/REST/endpoints/app-event-subscription.js +13 -0
  16. package/dist/esm/adapters/REST/endpoints/app-installation.js +35 -0
  17. package/dist/esm/adapters/REST/endpoints/app-key.js +16 -0
  18. package/dist/esm/adapters/REST/endpoints/app-signed-request.js +7 -0
  19. package/dist/esm/adapters/REST/endpoints/app-signing-secret.js +13 -0
  20. package/dist/esm/adapters/REST/endpoints/app-upload.js +24 -0
  21. package/dist/esm/adapters/REST/endpoints/asset-key.js +31 -0
  22. package/dist/esm/adapters/REST/endpoints/asset.js +170 -0
  23. package/dist/esm/adapters/REST/endpoints/bulk-action.js +16 -0
  24. package/dist/esm/adapters/REST/endpoints/comment.js +85 -0
  25. package/dist/esm/adapters/REST/endpoints/concept-scheme.js +35 -0
  26. package/dist/esm/adapters/REST/endpoints/concept.js +54 -0
  27. package/dist/esm/adapters/REST/endpoints/content-type.js +47 -0
  28. package/dist/esm/adapters/REST/endpoints/editor-interface.js +20 -0
  29. package/dist/esm/adapters/REST/endpoints/entry.js +90 -0
  30. package/dist/esm/adapters/REST/endpoints/environment-alias.js +38 -0
  31. package/dist/esm/adapters/REST/endpoints/environment-template-installation.js +20 -0
  32. package/dist/esm/adapters/REST/endpoints/environment-template.js +38 -0
  33. package/dist/esm/adapters/REST/endpoints/environment.js +40 -0
  34. package/dist/esm/adapters/REST/endpoints/extension.js +36 -0
  35. package/dist/esm/adapters/REST/endpoints/function-log.js +20 -0
  36. package/dist/esm/adapters/REST/endpoints/function.js +21 -0
  37. package/dist/esm/adapters/REST/endpoints/http.js +22 -0
  38. package/dist/esm/adapters/REST/endpoints/index.js +137 -0
  39. package/dist/esm/adapters/REST/endpoints/locale.js +31 -0
  40. package/dist/{es-modules → esm}/adapters/REST/endpoints/oauth-application.js +21 -22
  41. package/dist/esm/adapters/REST/endpoints/organization-invitation.js +20 -0
  42. package/dist/esm/adapters/REST/endpoints/organization-membership.js +27 -0
  43. package/dist/esm/adapters/REST/endpoints/organization.js +25 -0
  44. package/dist/esm/adapters/REST/endpoints/personal-access-token.js +32 -0
  45. package/dist/esm/adapters/REST/endpoints/preview-api-key.js +12 -0
  46. package/dist/esm/adapters/REST/endpoints/raw.js +37 -0
  47. package/dist/esm/adapters/REST/endpoints/release-action.js +17 -0
  48. package/dist/esm/adapters/REST/endpoints/release.js +50 -0
  49. package/dist/esm/adapters/REST/endpoints/resource-provider.js +14 -0
  50. package/dist/esm/adapters/REST/endpoints/resource-type.js +24 -0
  51. package/dist/esm/adapters/REST/endpoints/resource.js +8 -0
  52. package/dist/esm/adapters/REST/endpoints/role.js +40 -0
  53. package/dist/esm/adapters/REST/endpoints/scheduled-action.js +38 -0
  54. package/dist/esm/adapters/REST/endpoints/snapshot.js +25 -0
  55. package/dist/esm/adapters/REST/endpoints/space-member.js +8 -0
  56. package/dist/esm/adapters/REST/endpoints/space-membership.js +51 -0
  57. package/dist/esm/adapters/REST/endpoints/space.js +27 -0
  58. package/dist/esm/adapters/REST/endpoints/tag.js +31 -0
  59. package/dist/esm/adapters/REST/endpoints/task.js +33 -0
  60. package/dist/esm/adapters/REST/endpoints/team-membership.js +28 -0
  61. package/dist/esm/adapters/REST/endpoints/team-space-membership.js +38 -0
  62. package/dist/esm/adapters/REST/endpoints/team.js +29 -0
  63. package/dist/esm/adapters/REST/endpoints/ui-config.js +19 -0
  64. package/dist/esm/adapters/REST/endpoints/upload-credentials.js +14 -0
  65. package/dist/esm/adapters/REST/endpoints/upload.js +38 -0
  66. package/dist/esm/adapters/REST/endpoints/usage.js +14 -0
  67. package/dist/esm/adapters/REST/endpoints/user-ui-config.js +19 -0
  68. package/dist/esm/adapters/REST/endpoints/user.js +21 -0
  69. package/dist/esm/adapters/REST/endpoints/utils.js +17 -0
  70. package/dist/esm/adapters/REST/endpoints/webhook.js +82 -0
  71. package/dist/esm/adapters/REST/endpoints/workflow-definition.js +35 -0
  72. package/dist/esm/adapters/REST/endpoints/workflow.js +42 -0
  73. package/dist/esm/adapters/REST/endpoints/workflows-changelog.js +9 -0
  74. package/dist/esm/adapters/REST/make-request.js +17 -0
  75. package/dist/esm/adapters/REST/rest-adapter.js +30 -0
  76. package/dist/esm/common-types.js +6 -0
  77. package/dist/esm/common-utils.js +32 -0
  78. package/dist/esm/constants/editor-interface-defaults/controls-defaults.js +153 -0
  79. package/dist/esm/constants/editor-interface-defaults/editors-defaults.js +37 -0
  80. package/dist/esm/constants/editor-interface-defaults/index.js +12 -0
  81. package/dist/esm/constants/editor-interface-defaults/sidebar-defaults.js +68 -0
  82. package/dist/esm/constants/editor-interface-defaults/types.js +15 -0
  83. package/dist/esm/create-adapter.js +19 -0
  84. package/dist/esm/create-app-definition-api.js +252 -0
  85. package/dist/esm/create-contentful-api.js +590 -0
  86. package/dist/esm/create-entry-api.js +479 -0
  87. package/dist/esm/create-environment-api.js +2401 -0
  88. package/dist/esm/create-environment-template-api.js +268 -0
  89. package/dist/esm/create-organization-api.js +1134 -0
  90. package/dist/esm/create-space-api.js +1589 -0
  91. package/dist/esm/create-ui-config-api.js +53 -0
  92. package/dist/esm/create-user-ui-config-api.js +53 -0
  93. package/dist/{es-modules → esm}/enhance-with-methods.js +13 -11
  94. package/dist/esm/entities/access-token.js +33 -0
  95. package/dist/esm/entities/ai-action-invocation.js +42 -0
  96. package/dist/esm/entities/ai-action.js +91 -0
  97. package/dist/esm/entities/api-key.js +56 -0
  98. package/dist/esm/entities/app-access-token.js +15 -0
  99. package/dist/esm/entities/app-action-call.js +61 -0
  100. package/dist/esm/entities/app-action.js +45 -0
  101. package/dist/esm/entities/app-bundle.js +45 -0
  102. package/dist/esm/entities/app-definition.js +26 -0
  103. package/dist/esm/entities/app-details.js +37 -0
  104. package/dist/esm/entities/app-event-subscription.js +32 -0
  105. package/dist/esm/entities/app-installation.js +52 -0
  106. package/dist/esm/entities/app-key.js +41 -0
  107. package/dist/{es-modules → esm}/entities/app-signed-request.js +7 -4
  108. package/dist/esm/entities/app-signing-secret.js +32 -0
  109. package/dist/esm/entities/app-upload.js +44 -0
  110. package/dist/{es-modules → esm}/entities/asset-key.js +7 -4
  111. package/dist/esm/entities/asset.js +121 -0
  112. package/dist/esm/entities/bulk-action.js +58 -0
  113. package/dist/esm/entities/comment.js +57 -0
  114. package/dist/esm/entities/concept-scheme.js +1 -0
  115. package/dist/esm/entities/concept.js +1 -0
  116. package/dist/esm/entities/content-type.js +117 -0
  117. package/dist/esm/entities/editor-interface.js +47 -0
  118. package/dist/esm/entities/entry.js +24 -0
  119. package/dist/esm/entities/environment-alias.js +55 -0
  120. package/dist/esm/entities/environment-template-installation.js +20 -0
  121. package/dist/esm/entities/environment-template.js +15 -0
  122. package/dist/esm/entities/environment.js +31 -0
  123. package/dist/esm/entities/extension.js +51 -0
  124. package/dist/{es-modules → esm}/entities/function-log.js +9 -7
  125. package/dist/esm/entities/function.js +63 -0
  126. package/dist/esm/entities/index.js +129 -0
  127. package/dist/esm/entities/locale.js +54 -0
  128. package/dist/esm/entities/oauth-application.js +63 -0
  129. package/dist/esm/entities/organization-invitation.js +15 -0
  130. package/dist/esm/entities/organization-membership.js +50 -0
  131. package/dist/esm/entities/organization.js +29 -0
  132. package/dist/esm/entities/personal-access-token.js +33 -0
  133. package/dist/esm/entities/preview-api-key.js +28 -0
  134. package/dist/esm/entities/release-action.js +52 -0
  135. package/dist/esm/entities/release.js +107 -0
  136. package/dist/esm/entities/resource-provider.js +137 -0
  137. package/dist/esm/entities/resource-type.js +94 -0
  138. package/dist/esm/entities/resource.js +10 -0
  139. package/dist/esm/entities/role.js +50 -0
  140. package/dist/esm/entities/scheduled-action.js +148 -0
  141. package/dist/esm/entities/snapshot.js +33 -0
  142. package/dist/esm/entities/space-member.js +20 -0
  143. package/dist/esm/entities/space-membership.js +50 -0
  144. package/dist/esm/entities/space.js +30 -0
  145. package/dist/esm/entities/tag.js +50 -0
  146. package/dist/esm/entities/task.js +51 -0
  147. package/dist/esm/entities/team-membership.js +51 -0
  148. package/dist/esm/entities/team-space-membership.js +50 -0
  149. package/dist/esm/entities/team.js +50 -0
  150. package/dist/esm/entities/ui-config.js +18 -0
  151. package/dist/esm/entities/upload.js +36 -0
  152. package/dist/esm/entities/usage.js +22 -0
  153. package/dist/esm/entities/user-ui-config.js +18 -0
  154. package/dist/esm/entities/user.js +25 -0
  155. package/dist/esm/entities/webhook.js +74 -0
  156. package/dist/esm/entities/workflow-definition.js +73 -0
  157. package/dist/esm/index.js +36 -0
  158. package/dist/esm/methods/action.js +49 -0
  159. package/dist/esm/methods/content-type.js +49 -0
  160. package/dist/esm/methods/utils.js +9 -0
  161. package/dist/esm/plain/as-iterator.js +30 -0
  162. package/dist/esm/plain/checks.js +10 -0
  163. package/dist/esm/plain/pagination-helper.js +54 -0
  164. package/dist/esm/plain/plain-client.js +514 -0
  165. package/dist/esm/plain/wrappers/wrap.js +24 -0
  166. package/dist/esm/upload-http-client.js +15 -0
  167. package/dist/stats-browser-min.html +4842 -0
  168. package/dist/{typings → types}/adapters/REST/endpoints/concept-scheme.d.ts +0 -1
  169. package/dist/{typings → types}/adapters/REST/endpoints/concept.d.ts +0 -1
  170. package/dist/{typings → types}/common-types.d.ts +22 -39
  171. package/dist/{typings → types}/create-contentful-api.d.ts +3 -2
  172. package/dist/{typings → types}/create-environment-api.d.ts +3 -3
  173. package/dist/{typings → types}/create-organization-api.d.ts +90 -90
  174. package/dist/{typings → types}/create-ui-config-api.d.ts +1 -1
  175. package/dist/{typings → types}/create-user-ui-config-api.d.ts +1 -1
  176. package/dist/{typings → types}/entities/access-token.d.ts +3 -3
  177. package/dist/{typings → types}/entities/ai-action-invocation.d.ts +4 -4
  178. package/dist/{typings → types}/entities/ai-action.d.ts +4 -21
  179. package/dist/{typings → types}/entities/api-key.d.ts +4 -8
  180. package/dist/{typings → types}/entities/app-access-token.d.ts +5 -5
  181. package/dist/{typings → types}/entities/app-action-call.d.ts +6 -6
  182. package/dist/{typings → types}/entities/app-action.d.ts +4 -4
  183. package/dist/{typings → types}/entities/app-bundle.d.ts +4 -4
  184. package/dist/{typings → types}/entities/app-definition.d.ts +3 -3
  185. package/dist/{typings → types}/entities/app-details.d.ts +4 -4
  186. package/dist/{typings → types}/entities/app-event-subscription.d.ts +4 -4
  187. package/dist/{typings → types}/entities/app-installation.d.ts +6 -6
  188. package/dist/{typings → types}/entities/app-key.d.ts +4 -4
  189. package/dist/{typings → types}/entities/app-signed-request.d.ts +5 -5
  190. package/dist/{typings → types}/entities/app-signing-secret.d.ts +4 -4
  191. package/dist/{typings → types}/entities/app-upload.d.ts +3 -3
  192. package/dist/{typings → types}/entities/asset.d.ts +1 -2
  193. package/dist/{typings → types}/entities/comment.d.ts +4 -4
  194. package/dist/{typings → types}/entities/content-type.d.ts +4 -4
  195. package/dist/{typings → types}/entities/editor-interface.d.ts +5 -11
  196. package/dist/{typings → types}/entities/entry.d.ts +5 -1
  197. package/dist/{typings → types}/entities/environment-alias.d.ts +4 -6
  198. package/dist/{typings → types}/entities/environment-template-installation.d.ts +1 -1
  199. package/dist/{typings → types}/entities/environment-template.d.ts +1 -1
  200. package/dist/{typings → types}/entities/environment.d.ts +6 -6
  201. package/dist/{typings → types}/entities/extension.d.ts +4 -4
  202. package/dist/{typings → types}/entities/locale.d.ts +4 -4
  203. package/dist/{typings → types}/entities/oauth-application.d.ts +1 -1
  204. package/dist/{typings → types}/entities/organization-invitation.d.ts +3 -5
  205. package/dist/{typings → types}/entities/organization-membership.d.ts +3 -5
  206. package/dist/{typings → types}/entities/organization.d.ts +1 -1
  207. package/dist/{typings → types}/entities/personal-access-token.d.ts +1 -1
  208. package/dist/{typings → types}/entities/preview-api-key.d.ts +1 -1
  209. package/dist/{typings → types}/entities/resource-provider.d.ts +5 -5
  210. package/dist/{typings → types}/entities/resource-type.d.ts +5 -5
  211. package/dist/{typings → types}/entities/resource.d.ts +4 -4
  212. package/dist/{typings → types}/entities/role.d.ts +3 -3
  213. package/dist/{typings → types}/entities/scheduled-action.d.ts +3 -5
  214. package/dist/{typings → types}/entities/snapshot.d.ts +1 -1
  215. package/dist/{typings → types}/entities/space-member.d.ts +3 -5
  216. package/dist/{typings → types}/entities/space-membership.d.ts +6 -6
  217. package/dist/{typings → types}/entities/space.d.ts +1 -1
  218. package/dist/{typings → types}/entities/tag.d.ts +4 -4
  219. package/dist/{typings → types}/entities/task.d.ts +4 -4
  220. package/dist/{typings → types}/entities/team-membership.d.ts +5 -11
  221. package/dist/{typings → types}/entities/team-space-membership.d.ts +5 -11
  222. package/dist/{typings → types}/entities/team.d.ts +3 -5
  223. package/dist/{typings → types}/entities/ui-config.d.ts +5 -5
  224. package/dist/{typings → types}/entities/upload-credential.d.ts +4 -4
  225. package/dist/{typings → types}/entities/upload.d.ts +4 -4
  226. package/dist/{typings → types}/entities/usage.d.ts +7 -7
  227. package/dist/{typings → types}/entities/user-ui-config.d.ts +5 -5
  228. package/dist/{typings → types}/entities/user.d.ts +1 -1
  229. package/dist/{typings → types}/entities/webhook.d.ts +10 -16
  230. package/dist/{typings → types}/entities/workflow-definition.d.ts +4 -4
  231. package/dist/{typings → types}/entities/workflow.d.ts +6 -6
  232. package/dist/{typings → types}/entities/workflows-changelog-entry.d.ts +2 -2
  233. package/dist/{typings → types}/export-types.d.ts +1 -1
  234. package/dist/{typings/contentful-management.d.ts → types/index.d.ts} +1 -1
  235. package/dist/types/plain/checks.d.ts +13 -0
  236. package/dist/{typings → types}/plain/common-types.d.ts +3 -2
  237. package/dist/{typings → types}/plain/entities/concept-scheme.d.ts +3 -20
  238. package/dist/{typings → types}/plain/entities/concept.d.ts +4 -21
  239. package/dist/{typings → types}/plain/entities/upload-credential.d.ts +1 -1
  240. package/package.json +49 -45
  241. package/dist/contentful-management.browser.js.map +0 -1
  242. package/dist/contentful-management.node.js +0 -32624
  243. package/dist/contentful-management.node.js.map +0 -1
  244. package/dist/contentful-management.node.min.js +0 -2
  245. package/dist/es-modules/adapters/REST/endpoints/ai-action-invocation.js +0 -6
  246. package/dist/es-modules/adapters/REST/endpoints/ai-action.js +0 -61
  247. package/dist/es-modules/adapters/REST/endpoints/api-key.js +0 -47
  248. package/dist/es-modules/adapters/REST/endpoints/app-access-token.js +0 -8
  249. package/dist/es-modules/adapters/REST/endpoints/app-action-call.js +0 -69
  250. package/dist/es-modules/adapters/REST/endpoints/app-action.js +0 -32
  251. package/dist/es-modules/adapters/REST/endpoints/app-bundle.js +0 -36
  252. package/dist/es-modules/adapters/REST/endpoints/app-definition.js +0 -45
  253. package/dist/es-modules/adapters/REST/endpoints/app-details.js +0 -10
  254. package/dist/es-modules/adapters/REST/endpoints/app-event-subscription.js +0 -10
  255. package/dist/es-modules/adapters/REST/endpoints/app-installation.js +0 -39
  256. package/dist/es-modules/adapters/REST/endpoints/app-key.js +0 -13
  257. package/dist/es-modules/adapters/REST/endpoints/app-signed-request.js +0 -4
  258. package/dist/es-modules/adapters/REST/endpoints/app-signing-secret.js +0 -10
  259. package/dist/es-modules/adapters/REST/endpoints/app-upload.js +0 -23
  260. package/dist/es-modules/adapters/REST/endpoints/asset-key.js +0 -33
  261. package/dist/es-modules/adapters/REST/endpoints/asset.js +0 -220
  262. package/dist/es-modules/adapters/REST/endpoints/bulk-action.js +0 -13
  263. package/dist/es-modules/adapters/REST/endpoints/comment.js +0 -101
  264. package/dist/es-modules/adapters/REST/endpoints/concept-scheme.js +0 -52
  265. package/dist/es-modules/adapters/REST/endpoints/concept.js +0 -85
  266. package/dist/es-modules/adapters/REST/endpoints/content-type.js +0 -61
  267. package/dist/es-modules/adapters/REST/endpoints/editor-interface.js +0 -24
  268. package/dist/es-modules/adapters/REST/endpoints/entry.js +0 -113
  269. package/dist/es-modules/adapters/REST/endpoints/environment-alias.js +0 -46
  270. package/dist/es-modules/adapters/REST/endpoints/environment-template-installation.js +0 -43
  271. package/dist/es-modules/adapters/REST/endpoints/environment-template.js +0 -88
  272. package/dist/es-modules/adapters/REST/endpoints/environment.js +0 -42
  273. package/dist/es-modules/adapters/REST/endpoints/extension.js +0 -44
  274. package/dist/es-modules/adapters/REST/endpoints/function-log.js +0 -22
  275. package/dist/es-modules/adapters/REST/endpoints/function.js +0 -20
  276. package/dist/es-modules/adapters/REST/endpoints/http.js +0 -39
  277. package/dist/es-modules/adapters/REST/endpoints/index.js +0 -134
  278. package/dist/es-modules/adapters/REST/endpoints/locale.js +0 -35
  279. package/dist/es-modules/adapters/REST/endpoints/organization-invitation.js +0 -22
  280. package/dist/es-modules/adapters/REST/endpoints/organization-membership.js +0 -35
  281. package/dist/es-modules/adapters/REST/endpoints/organization.js +0 -26
  282. package/dist/es-modules/adapters/REST/endpoints/personal-access-token.js +0 -33
  283. package/dist/es-modules/adapters/REST/endpoints/preview-api-key.js +0 -9
  284. package/dist/es-modules/adapters/REST/endpoints/raw.js +0 -42
  285. package/dist/es-modules/adapters/REST/endpoints/release-action.js +0 -21
  286. package/dist/es-modules/adapters/REST/endpoints/release.js +0 -58
  287. package/dist/es-modules/adapters/REST/endpoints/resource-provider.js +0 -13
  288. package/dist/es-modules/adapters/REST/endpoints/resource-type.js +0 -23
  289. package/dist/es-modules/adapters/REST/endpoints/resource.js +0 -5
  290. package/dist/es-modules/adapters/REST/endpoints/role.js +0 -44
  291. package/dist/es-modules/adapters/REST/endpoints/scheduled-action.js +0 -35
  292. package/dist/es-modules/adapters/REST/endpoints/snapshot.js +0 -22
  293. package/dist/es-modules/adapters/REST/endpoints/space-member.js +0 -5
  294. package/dist/es-modules/adapters/REST/endpoints/space-membership.js +0 -55
  295. package/dist/es-modules/adapters/REST/endpoints/space.js +0 -32
  296. package/dist/es-modules/adapters/REST/endpoints/tag.js +0 -46
  297. package/dist/es-modules/adapters/REST/endpoints/task.js +0 -47
  298. package/dist/es-modules/adapters/REST/endpoints/team-membership.js +0 -34
  299. package/dist/es-modules/adapters/REST/endpoints/team-space-membership.js +0 -45
  300. package/dist/es-modules/adapters/REST/endpoints/team.js +0 -35
  301. package/dist/es-modules/adapters/REST/endpoints/ui-config.js +0 -16
  302. package/dist/es-modules/adapters/REST/endpoints/upload-credentials.js +0 -11
  303. package/dist/es-modules/adapters/REST/endpoints/upload.js +0 -37
  304. package/dist/es-modules/adapters/REST/endpoints/usage.js +0 -11
  305. package/dist/es-modules/adapters/REST/endpoints/user-ui-config.js +0 -16
  306. package/dist/es-modules/adapters/REST/endpoints/user.js +0 -20
  307. package/dist/es-modules/adapters/REST/endpoints/utils.js +0 -28
  308. package/dist/es-modules/adapters/REST/endpoints/webhook.js +0 -93
  309. package/dist/es-modules/adapters/REST/endpoints/workflow-definition.js +0 -46
  310. package/dist/es-modules/adapters/REST/endpoints/workflow.js +0 -59
  311. package/dist/es-modules/adapters/REST/endpoints/workflows-changelog.js +0 -6
  312. package/dist/es-modules/adapters/REST/make-request.js +0 -28
  313. package/dist/es-modules/adapters/REST/rest-adapter.js +0 -42
  314. package/dist/es-modules/adapters/REST/types.js +0 -1
  315. package/dist/es-modules/common-types.js +0 -61
  316. package/dist/es-modules/common-utils.js +0 -30
  317. package/dist/es-modules/constants/editor-interface-defaults/controls-defaults.js +0 -255
  318. package/dist/es-modules/constants/editor-interface-defaults/editors-defaults.js +0 -34
  319. package/dist/es-modules/constants/editor-interface-defaults/index.js +0 -9
  320. package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +0 -57
  321. package/dist/es-modules/constants/editor-interface-defaults/types.js +0 -14
  322. package/dist/es-modules/contentful-management.js +0 -66
  323. package/dist/es-modules/create-adapter.js +0 -16
  324. package/dist/es-modules/create-app-definition-api.js +0 -263
  325. package/dist/es-modules/create-contentful-api.js +0 -663
  326. package/dist/es-modules/create-entry-api.js +0 -548
  327. package/dist/es-modules/create-environment-api.js +0 -2525
  328. package/dist/es-modules/create-environment-template-api.js +0 -316
  329. package/dist/es-modules/create-organization-api.js +0 -1306
  330. package/dist/es-modules/create-space-api.js +0 -1750
  331. package/dist/es-modules/create-ui-config-api.js +0 -60
  332. package/dist/es-modules/create-user-ui-config-api.js +0 -60
  333. package/dist/es-modules/entities/access-token.js +0 -38
  334. package/dist/es-modules/entities/ai-action-invocation.js +0 -46
  335. package/dist/es-modules/entities/ai-action.js +0 -88
  336. package/dist/es-modules/entities/api-key.js +0 -55
  337. package/dist/es-modules/entities/app-access-token.js +0 -12
  338. package/dist/es-modules/entities/app-action-call.js +0 -70
  339. package/dist/es-modules/entities/app-action.js +0 -53
  340. package/dist/es-modules/entities/app-bundle.js +0 -44
  341. package/dist/es-modules/entities/app-definition.js +0 -24
  342. package/dist/es-modules/entities/app-details.js +0 -35
  343. package/dist/es-modules/entities/app-event-subscription.js +0 -30
  344. package/dist/es-modules/entities/app-installation.js +0 -51
  345. package/dist/es-modules/entities/app-key.js +0 -40
  346. package/dist/es-modules/entities/app-signing-secret.js +0 -30
  347. package/dist/es-modules/entities/app-upload.js +0 -43
  348. package/dist/es-modules/entities/asset.js +0 -131
  349. package/dist/es-modules/entities/bulk-action.js +0 -61
  350. package/dist/es-modules/entities/comment.js +0 -77
  351. package/dist/es-modules/entities/concept-scheme.js +0 -1
  352. package/dist/es-modules/entities/concept.js +0 -1
  353. package/dist/es-modules/entities/content-type-fields.js +0 -1
  354. package/dist/es-modules/entities/content-type.js +0 -146
  355. package/dist/es-modules/entities/editor-interface.js +0 -46
  356. package/dist/es-modules/entities/entry.js +0 -22
  357. package/dist/es-modules/entities/environment-alias.js +0 -54
  358. package/dist/es-modules/entities/environment-template-installation.js +0 -17
  359. package/dist/es-modules/entities/environment-template.js +0 -12
  360. package/dist/es-modules/entities/environment.js +0 -29
  361. package/dist/es-modules/entities/extension.js +0 -50
  362. package/dist/es-modules/entities/field-type.js +0 -1
  363. package/dist/es-modules/entities/function.js +0 -61
  364. package/dist/es-modules/entities/index.js +0 -126
  365. package/dist/es-modules/entities/locale.js +0 -53
  366. package/dist/es-modules/entities/oauth-application.js +0 -62
  367. package/dist/es-modules/entities/organization-invitation.js +0 -12
  368. package/dist/es-modules/entities/organization-membership.js +0 -49
  369. package/dist/es-modules/entities/organization.js +0 -32
  370. package/dist/es-modules/entities/personal-access-token.js +0 -38
  371. package/dist/es-modules/entities/preview-api-key.js +0 -27
  372. package/dist/es-modules/entities/release-action.js +0 -53
  373. package/dist/es-modules/entities/release.js +0 -105
  374. package/dist/es-modules/entities/resource-provider.js +0 -139
  375. package/dist/es-modules/entities/resource-type.js +0 -93
  376. package/dist/es-modules/entities/resource.js +0 -7
  377. package/dist/es-modules/entities/role.js +0 -49
  378. package/dist/es-modules/entities/scheduled-action.js +0 -155
  379. package/dist/es-modules/entities/snapshot.js +0 -31
  380. package/dist/es-modules/entities/space-member.js +0 -18
  381. package/dist/es-modules/entities/space-membership.js +0 -49
  382. package/dist/es-modules/entities/space.js +0 -28
  383. package/dist/es-modules/entities/tag.js +0 -56
  384. package/dist/es-modules/entities/task.js +0 -57
  385. package/dist/es-modules/entities/team-membership.js +0 -50
  386. package/dist/es-modules/entities/team-space-membership.js +0 -49
  387. package/dist/es-modules/entities/team.js +0 -49
  388. package/dist/es-modules/entities/ui-config.js +0 -15
  389. package/dist/es-modules/entities/upload-credential.js +0 -33
  390. package/dist/es-modules/entities/upload.js +0 -34
  391. package/dist/es-modules/entities/usage.js +0 -20
  392. package/dist/es-modules/entities/user-ui-config.js +0 -15
  393. package/dist/es-modules/entities/user.js +0 -23
  394. package/dist/es-modules/entities/utils.js +0 -1
  395. package/dist/es-modules/entities/webhook.js +0 -80
  396. package/dist/es-modules/entities/widget-parameters.js +0 -1
  397. package/dist/es-modules/entities/workflow-definition.js +0 -87
  398. package/dist/es-modules/entities/workflow.js +0 -76
  399. package/dist/es-modules/entities/workflows-changelog-entry.js +0 -24
  400. package/dist/es-modules/export-types.js +0 -3
  401. package/dist/es-modules/methods/action.js +0 -54
  402. package/dist/es-modules/methods/bulk-action.js +0 -15
  403. package/dist/es-modules/methods/content-type.js +0 -47
  404. package/dist/es-modules/methods/release-action.js +0 -17
  405. package/dist/es-modules/methods/utils.js +0 -7
  406. package/dist/es-modules/plain/as-iterator.js +0 -47
  407. package/dist/es-modules/plain/checks.js +0 -8
  408. package/dist/es-modules/plain/common-types.js +0 -1
  409. package/dist/es-modules/plain/entities/ai-action-invocation.js +0 -1
  410. package/dist/es-modules/plain/entities/ai-action.js +0 -1
  411. package/dist/es-modules/plain/entities/app-access-token.js +0 -1
  412. package/dist/es-modules/plain/entities/app-action-call.js +0 -1
  413. package/dist/es-modules/plain/entities/app-action.js +0 -1
  414. package/dist/es-modules/plain/entities/app-bundle.js +0 -1
  415. package/dist/es-modules/plain/entities/app-definition.js +0 -1
  416. package/dist/es-modules/plain/entities/app-details.js +0 -1
  417. package/dist/es-modules/plain/entities/app-event-subscription.js +0 -1
  418. package/dist/es-modules/plain/entities/app-installation.js +0 -1
  419. package/dist/es-modules/plain/entities/app-key.js +0 -1
  420. package/dist/es-modules/plain/entities/app-signed-request.js +0 -1
  421. package/dist/es-modules/plain/entities/app-signing-secret.js +0 -1
  422. package/dist/es-modules/plain/entities/app-upload.js +0 -1
  423. package/dist/es-modules/plain/entities/comment.js +0 -1
  424. package/dist/es-modules/plain/entities/concept-scheme.js +0 -1
  425. package/dist/es-modules/plain/entities/concept.js +0 -1
  426. package/dist/es-modules/plain/entities/editor-interface.js +0 -1
  427. package/dist/es-modules/plain/entities/environment-alias.js +0 -1
  428. package/dist/es-modules/plain/entities/environment.js +0 -1
  429. package/dist/es-modules/plain/entities/extension.js +0 -1
  430. package/dist/es-modules/plain/entities/function-log.js +0 -1
  431. package/dist/es-modules/plain/entities/function.js +0 -1
  432. package/dist/es-modules/plain/entities/locale.js +0 -1
  433. package/dist/es-modules/plain/entities/oauth-application.js +0 -1
  434. package/dist/es-modules/plain/entities/organization.js +0 -1
  435. package/dist/es-modules/plain/entities/resource-provider.js +0 -1
  436. package/dist/es-modules/plain/entities/resource-type.js +0 -1
  437. package/dist/es-modules/plain/entities/resource.js +0 -1
  438. package/dist/es-modules/plain/entities/role.js +0 -1
  439. package/dist/es-modules/plain/entities/space-member.js +0 -1
  440. package/dist/es-modules/plain/entities/space-membership.js +0 -1
  441. package/dist/es-modules/plain/entities/space.js +0 -1
  442. package/dist/es-modules/plain/entities/tag.js +0 -1
  443. package/dist/es-modules/plain/entities/task.js +0 -1
  444. package/dist/es-modules/plain/entities/team-membership.js +0 -1
  445. package/dist/es-modules/plain/entities/team-space-membership.js +0 -1
  446. package/dist/es-modules/plain/entities/team.js +0 -1
  447. package/dist/es-modules/plain/entities/ui-config.js +0 -1
  448. package/dist/es-modules/plain/entities/upload-credential.js +0 -1
  449. package/dist/es-modules/plain/entities/upload.js +0 -1
  450. package/dist/es-modules/plain/entities/usage.js +0 -1
  451. package/dist/es-modules/plain/entities/user-ui-config.js +0 -1
  452. package/dist/es-modules/plain/entities/user.js +0 -1
  453. package/dist/es-modules/plain/entities/webhook.js +0 -1
  454. package/dist/es-modules/plain/entities/workflow-definition.js +0 -1
  455. package/dist/es-modules/plain/entities/workflow.js +0 -1
  456. package/dist/es-modules/plain/entities/workflows-changelog.js +0 -1
  457. package/dist/es-modules/plain/pagination-helper.js +0 -76
  458. package/dist/es-modules/plain/plain-client.js +0 -544
  459. package/dist/es-modules/plain/wrappers/wrap.js +0 -46
  460. package/dist/es-modules/plain/wrappers/wrap.test-d.js +0 -15
  461. package/dist/es-modules/upload-http-client.js +0 -17
  462. package/dist/typings/plain/checks.d.ts +0 -13
  463. /package/dist/{typings → types}/adapters/REST/endpoints/access-token.d.ts +0 -0
  464. /package/dist/{typings → types}/adapters/REST/endpoints/ai-action-invocation.d.ts +0 -0
  465. /package/dist/{typings → types}/adapters/REST/endpoints/ai-action.d.ts +0 -0
  466. /package/dist/{typings → types}/adapters/REST/endpoints/api-key.d.ts +0 -0
  467. /package/dist/{typings → types}/adapters/REST/endpoints/app-access-token.d.ts +0 -0
  468. /package/dist/{typings → types}/adapters/REST/endpoints/app-action-call.d.ts +0 -0
  469. /package/dist/{typings → types}/adapters/REST/endpoints/app-action.d.ts +0 -0
  470. /package/dist/{typings → types}/adapters/REST/endpoints/app-bundle.d.ts +0 -0
  471. /package/dist/{typings → types}/adapters/REST/endpoints/app-definition.d.ts +0 -0
  472. /package/dist/{typings → types}/adapters/REST/endpoints/app-details.d.ts +0 -0
  473. /package/dist/{typings → types}/adapters/REST/endpoints/app-event-subscription.d.ts +0 -0
  474. /package/dist/{typings → types}/adapters/REST/endpoints/app-installation.d.ts +0 -0
  475. /package/dist/{typings → types}/adapters/REST/endpoints/app-key.d.ts +0 -0
  476. /package/dist/{typings → types}/adapters/REST/endpoints/app-signed-request.d.ts +0 -0
  477. /package/dist/{typings → types}/adapters/REST/endpoints/app-signing-secret.d.ts +0 -0
  478. /package/dist/{typings → types}/adapters/REST/endpoints/app-upload.d.ts +0 -0
  479. /package/dist/{typings → types}/adapters/REST/endpoints/asset-key.d.ts +0 -0
  480. /package/dist/{typings → types}/adapters/REST/endpoints/asset.d.ts +0 -0
  481. /package/dist/{typings → types}/adapters/REST/endpoints/bulk-action.d.ts +0 -0
  482. /package/dist/{typings → types}/adapters/REST/endpoints/comment.d.ts +0 -0
  483. /package/dist/{typings → types}/adapters/REST/endpoints/content-type.d.ts +0 -0
  484. /package/dist/{typings → types}/adapters/REST/endpoints/editor-interface.d.ts +0 -0
  485. /package/dist/{typings → types}/adapters/REST/endpoints/entry.d.ts +0 -0
  486. /package/dist/{typings → types}/adapters/REST/endpoints/environment-alias.d.ts +0 -0
  487. /package/dist/{typings → types}/adapters/REST/endpoints/environment-template-installation.d.ts +0 -0
  488. /package/dist/{typings → types}/adapters/REST/endpoints/environment-template.d.ts +0 -0
  489. /package/dist/{typings → types}/adapters/REST/endpoints/environment.d.ts +0 -0
  490. /package/dist/{typings → types}/adapters/REST/endpoints/extension.d.ts +0 -0
  491. /package/dist/{typings → types}/adapters/REST/endpoints/function-log.d.ts +0 -0
  492. /package/dist/{typings → types}/adapters/REST/endpoints/function.d.ts +0 -0
  493. /package/dist/{typings → types}/adapters/REST/endpoints/http.d.ts +0 -0
  494. /package/dist/{typings → types}/adapters/REST/endpoints/index.d.ts +0 -0
  495. /package/dist/{typings → types}/adapters/REST/endpoints/locale.d.ts +0 -0
  496. /package/dist/{typings → types}/adapters/REST/endpoints/oauth-application.d.ts +0 -0
  497. /package/dist/{typings → types}/adapters/REST/endpoints/organization-invitation.d.ts +0 -0
  498. /package/dist/{typings → types}/adapters/REST/endpoints/organization-membership.d.ts +0 -0
  499. /package/dist/{typings → types}/adapters/REST/endpoints/organization.d.ts +0 -0
  500. /package/dist/{typings → types}/adapters/REST/endpoints/personal-access-token.d.ts +0 -0
  501. /package/dist/{typings → types}/adapters/REST/endpoints/preview-api-key.d.ts +0 -0
  502. /package/dist/{typings → types}/adapters/REST/endpoints/raw.d.ts +0 -0
  503. /package/dist/{typings → types}/adapters/REST/endpoints/release-action.d.ts +0 -0
  504. /package/dist/{typings → types}/adapters/REST/endpoints/release.d.ts +0 -0
  505. /package/dist/{typings → types}/adapters/REST/endpoints/resource-provider.d.ts +0 -0
  506. /package/dist/{typings → types}/adapters/REST/endpoints/resource-type.d.ts +0 -0
  507. /package/dist/{typings → types}/adapters/REST/endpoints/resource.d.ts +0 -0
  508. /package/dist/{typings → types}/adapters/REST/endpoints/role.d.ts +0 -0
  509. /package/dist/{typings → types}/adapters/REST/endpoints/scheduled-action.d.ts +0 -0
  510. /package/dist/{typings → types}/adapters/REST/endpoints/snapshot.d.ts +0 -0
  511. /package/dist/{typings → types}/adapters/REST/endpoints/space-member.d.ts +0 -0
  512. /package/dist/{typings → types}/adapters/REST/endpoints/space-membership.d.ts +0 -0
  513. /package/dist/{typings → types}/adapters/REST/endpoints/space.d.ts +0 -0
  514. /package/dist/{typings → types}/adapters/REST/endpoints/tag.d.ts +0 -0
  515. /package/dist/{typings → types}/adapters/REST/endpoints/task.d.ts +0 -0
  516. /package/dist/{typings → types}/adapters/REST/endpoints/team-membership.d.ts +0 -0
  517. /package/dist/{typings → types}/adapters/REST/endpoints/team-space-membership.d.ts +0 -0
  518. /package/dist/{typings → types}/adapters/REST/endpoints/team.d.ts +0 -0
  519. /package/dist/{typings → types}/adapters/REST/endpoints/ui-config.d.ts +0 -0
  520. /package/dist/{typings → types}/adapters/REST/endpoints/upload-credentials.d.ts +0 -0
  521. /package/dist/{typings → types}/adapters/REST/endpoints/upload.d.ts +0 -0
  522. /package/dist/{typings → types}/adapters/REST/endpoints/usage.d.ts +0 -0
  523. /package/dist/{typings → types}/adapters/REST/endpoints/user-ui-config.d.ts +0 -0
  524. /package/dist/{typings → types}/adapters/REST/endpoints/user.d.ts +0 -0
  525. /package/dist/{typings → types}/adapters/REST/endpoints/utils.d.ts +0 -0
  526. /package/dist/{typings → types}/adapters/REST/endpoints/webhook.d.ts +0 -0
  527. /package/dist/{typings → types}/adapters/REST/endpoints/workflow-definition.d.ts +0 -0
  528. /package/dist/{typings → types}/adapters/REST/endpoints/workflow.d.ts +0 -0
  529. /package/dist/{typings → types}/adapters/REST/endpoints/workflows-changelog.d.ts +0 -0
  530. /package/dist/{typings → types}/adapters/REST/make-request.d.ts +0 -0
  531. /package/dist/{typings → types}/adapters/REST/rest-adapter.d.ts +0 -0
  532. /package/dist/{typings → types}/adapters/REST/types.d.ts +0 -0
  533. /package/dist/{typings → types}/common-utils.d.ts +0 -0
  534. /package/dist/{typings → types}/constants/editor-interface-defaults/controls-defaults.d.ts +0 -0
  535. /package/dist/{typings → types}/constants/editor-interface-defaults/editors-defaults.d.ts +0 -0
  536. /package/dist/{typings → types}/constants/editor-interface-defaults/index.d.ts +0 -0
  537. /package/dist/{typings → types}/constants/editor-interface-defaults/sidebar-defaults.d.ts +0 -0
  538. /package/dist/{typings → types}/constants/editor-interface-defaults/types.d.ts +0 -0
  539. /package/dist/{typings → types}/create-adapter.d.ts +0 -0
  540. /package/dist/{typings → types}/create-app-definition-api.d.ts +0 -0
  541. /package/dist/{typings → types}/create-entry-api.d.ts +0 -0
  542. /package/dist/{typings → types}/create-environment-template-api.d.ts +0 -0
  543. /package/dist/{typings → types}/create-space-api.d.ts +0 -0
  544. /package/dist/{typings → types}/enhance-with-methods.d.ts +0 -0
  545. /package/dist/{typings → types}/entities/asset-key.d.ts +0 -0
  546. /package/dist/{typings → types}/entities/bulk-action.d.ts +0 -0
  547. /package/dist/{typings → types}/entities/concept-scheme.d.ts +0 -0
  548. /package/dist/{typings → types}/entities/concept.d.ts +0 -0
  549. /package/dist/{typings → types}/entities/content-type-fields.d.ts +0 -0
  550. /package/dist/{typings → types}/entities/field-type.d.ts +0 -0
  551. /package/dist/{typings → types}/entities/function-log.d.ts +0 -0
  552. /package/dist/{typings → types}/entities/function.d.ts +0 -0
  553. /package/dist/{typings → types}/entities/index.d.ts +0 -0
  554. /package/dist/{typings → types}/entities/release-action.d.ts +0 -0
  555. /package/dist/{typings → types}/entities/release.d.ts +0 -0
  556. /package/dist/{typings → types}/entities/utils.d.ts +0 -0
  557. /package/dist/{typings → types}/entities/widget-parameters.d.ts +0 -0
  558. /package/dist/{typings → types}/methods/action.d.ts +0 -0
  559. /package/dist/{typings → types}/methods/bulk-action.d.ts +0 -0
  560. /package/dist/{typings → types}/methods/content-type.d.ts +0 -0
  561. /package/dist/{typings → types}/methods/release-action.d.ts +0 -0
  562. /package/dist/{typings → types}/methods/utils.d.ts +0 -0
  563. /package/dist/{typings → types}/plain/as-iterator.d.ts +0 -0
  564. /package/dist/{typings → types}/plain/entities/ai-action-invocation.d.ts +0 -0
  565. /package/dist/{typings → types}/plain/entities/ai-action.d.ts +0 -0
  566. /package/dist/{typings → types}/plain/entities/app-access-token.d.ts +0 -0
  567. /package/dist/{typings → types}/plain/entities/app-action-call.d.ts +0 -0
  568. /package/dist/{typings → types}/plain/entities/app-action.d.ts +0 -0
  569. /package/dist/{typings → types}/plain/entities/app-bundle.d.ts +0 -0
  570. /package/dist/{typings → types}/plain/entities/app-definition.d.ts +0 -0
  571. /package/dist/{typings → types}/plain/entities/app-details.d.ts +0 -0
  572. /package/dist/{typings → types}/plain/entities/app-event-subscription.d.ts +0 -0
  573. /package/dist/{typings → types}/plain/entities/app-installation.d.ts +0 -0
  574. /package/dist/{typings → types}/plain/entities/app-key.d.ts +0 -0
  575. /package/dist/{typings → types}/plain/entities/app-signed-request.d.ts +0 -0
  576. /package/dist/{typings → types}/plain/entities/app-signing-secret.d.ts +0 -0
  577. /package/dist/{typings → types}/plain/entities/app-upload.d.ts +0 -0
  578. /package/dist/{typings → types}/plain/entities/comment.d.ts +0 -0
  579. /package/dist/{typings → types}/plain/entities/editor-interface.d.ts +0 -0
  580. /package/dist/{typings → types}/plain/entities/environment-alias.d.ts +0 -0
  581. /package/dist/{typings → types}/plain/entities/environment.d.ts +0 -0
  582. /package/dist/{typings → types}/plain/entities/extension.d.ts +0 -0
  583. /package/dist/{typings → types}/plain/entities/function-log.d.ts +0 -0
  584. /package/dist/{typings → types}/plain/entities/function.d.ts +0 -0
  585. /package/dist/{typings → types}/plain/entities/locale.d.ts +0 -0
  586. /package/dist/{typings → types}/plain/entities/oauth-application.d.ts +0 -0
  587. /package/dist/{typings → types}/plain/entities/organization.d.ts +0 -0
  588. /package/dist/{typings → types}/plain/entities/resource-provider.d.ts +0 -0
  589. /package/dist/{typings → types}/plain/entities/resource-type.d.ts +0 -0
  590. /package/dist/{typings → types}/plain/entities/resource.d.ts +0 -0
  591. /package/dist/{typings → types}/plain/entities/role.d.ts +0 -0
  592. /package/dist/{typings → types}/plain/entities/space-member.d.ts +0 -0
  593. /package/dist/{typings → types}/plain/entities/space-membership.d.ts +0 -0
  594. /package/dist/{typings → types}/plain/entities/space.d.ts +0 -0
  595. /package/dist/{typings → types}/plain/entities/tag.d.ts +0 -0
  596. /package/dist/{typings → types}/plain/entities/task.d.ts +0 -0
  597. /package/dist/{typings → types}/plain/entities/team-membership.d.ts +0 -0
  598. /package/dist/{typings → types}/plain/entities/team-space-membership.d.ts +0 -0
  599. /package/dist/{typings → types}/plain/entities/team.d.ts +0 -0
  600. /package/dist/{typings → types}/plain/entities/ui-config.d.ts +0 -0
  601. /package/dist/{typings → types}/plain/entities/upload.d.ts +0 -0
  602. /package/dist/{typings → types}/plain/entities/usage.d.ts +0 -0
  603. /package/dist/{typings → types}/plain/entities/user-ui-config.d.ts +0 -0
  604. /package/dist/{typings → types}/plain/entities/user.d.ts +0 -0
  605. /package/dist/{typings → types}/plain/entities/webhook.d.ts +0 -0
  606. /package/dist/{typings → types}/plain/entities/workflow-definition.d.ts +0 -0
  607. /package/dist/{typings → types}/plain/entities/workflow.d.ts +0 -0
  608. /package/dist/{typings → types}/plain/entities/workflows-changelog.d.ts +0 -0
  609. /package/dist/{typings → types}/plain/pagination-helper.d.ts +0 -0
  610. /package/dist/{typings → types}/plain/plain-client.d.ts +0 -0
  611. /package/dist/{typings → types}/plain/wrappers/wrap.d.ts +0 -0
  612. /package/dist/{typings → types}/plain/wrappers/wrap.test-d.d.ts +0 -0
  613. /package/dist/{typings → types}/upload-http-client.d.ts +0 -0
@@ -0,0 +1,2401 @@
1
+ import { __rest } from 'tslib';
2
+ import { createRequestConfig } from 'contentful-sdk-core';
3
+ import entities from './entities/index.js';
4
+ import { wrapReleaseAction, wrapReleaseActionCollection } from './entities/release-action.js';
5
+ import { wrapRelease, wrapReleaseCollection } from './entities/release.js';
6
+ import { wrapTag, wrapTagCollection } from './entities/tag.js';
7
+ import { wrapUIConfig } from './entities/ui-config.js';
8
+ import { wrapUserUIConfig } from './entities/user-ui-config.js';
9
+ import { wrapEnvironmentTemplateInstallationCollection } from './entities/environment-template-installation.js';
10
+ import { wrapFunctionCollection } from './entities/function.js';
11
+ import { wrapFunctionLogCollection, wrapFunctionLog } from './entities/function-log.js';
12
+ import { wrapAiActionInvocation } from './entities/ai-action-invocation.js';
13
+
14
+ /**
15
+ * Creates API object with methods to access the Environment API
16
+ * @param {ContentfulEnvironmentAPI} makeRequest - function to make requests via an adapter
17
+ * @return {ContentfulSpaceAPI}
18
+ * @private
19
+ */
20
+ function createEnvironmentApi(makeRequest) {
21
+ const { wrapEnvironment } = entities.environment;
22
+ const { wrapContentType, wrapContentTypeCollection } = entities.contentType;
23
+ const { wrapEntry, wrapEntryCollection } = entities.entry;
24
+ const { wrapAsset, wrapAssetCollection } = entities.asset;
25
+ const { wrapAssetKey } = entities.assetKey;
26
+ const { wrapLocale, wrapLocaleCollection } = entities.locale;
27
+ const { wrapSnapshotCollection } = entities.snapshot;
28
+ const { wrapEditorInterface, wrapEditorInterfaceCollection } = entities.editorInterface;
29
+ const { wrapUpload } = entities.upload;
30
+ const { wrapExtension, wrapExtensionCollection } = entities.extension;
31
+ const { wrapAppInstallation, wrapAppInstallationCollection } = entities.appInstallation;
32
+ const { wrapAppSignedRequest } = entities.appSignedRequest;
33
+ const { wrapAppActionCall } = entities.appActionCall;
34
+ const { wrapBulkAction } = entities.bulkAction;
35
+ const { wrapAppAccessToken } = entities.appAccessToken;
36
+ const { wrapResourceTypesForEnvironmentCollection } = entities.resourceType;
37
+ const { wrapResourceCollection } = entities.resource;
38
+ return {
39
+ /**
40
+ * Deletes the environment
41
+ * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
42
+ * @example ```javascript
43
+ * const contentful = require('contentful-management')
44
+ *
45
+ * const client = contentful.createClient({
46
+ * accessToken: '<content_management_api_key>'
47
+ * })
48
+ *
49
+ * client.getSpace('<space_id>')
50
+ * .then((space) => space.getEnvironment('<environment-id>'))
51
+ * .then((environment) => environment.delete())
52
+ * .then(() => console.log('Environment deleted.'))
53
+ * .catch(console.error)
54
+ * ```
55
+ */
56
+ delete: function deleteEnvironment() {
57
+ const raw = this.toPlainObject();
58
+ return makeRequest({
59
+ entityType: 'Environment',
60
+ action: 'delete',
61
+ params: { spaceId: raw.sys.space.sys.id, environmentId: raw.sys.id },
62
+ }).then(() => {
63
+ // noop
64
+ });
65
+ },
66
+ /**
67
+ * Updates the environment
68
+ * @return Promise for the updated environment.
69
+ * @example ```javascript
70
+ * const contentful = require('contentful-management')
71
+ *
72
+ * const client = contentful.createClient({
73
+ * accessToken: '<content_management_api_key>'
74
+ * })
75
+ *
76
+ * client.getSpace('<space_id>')
77
+ * .then((space) => space.getEnvironment('<environment-id>'))
78
+ * .then((environment) => {
79
+ * environment.name = 'New name'
80
+ * return environment.update()
81
+ * })
82
+ * .then((environment) => console.log(`Environment ${environment.sys.id} renamed.`)
83
+ * .catch(console.error)
84
+ * ```
85
+ */
86
+ update: function updateEnvironment() {
87
+ const raw = this.toPlainObject();
88
+ return makeRequest({
89
+ entityType: 'Environment',
90
+ action: 'update',
91
+ params: { spaceId: raw.sys.space.sys.id, environmentId: raw.sys.id },
92
+ payload: raw,
93
+ }).then((data) => wrapEnvironment(makeRequest, data));
94
+ },
95
+ /**
96
+ * Creates SDK Entry object (locally) from entry data
97
+ * @param entryData - Entry Data
98
+ * @return Entry
99
+ * @example ```javascript
100
+ * environment.getEntry('entryId').then(entry => {
101
+ *
102
+ * // Build a plainObject in order to make it usable for React (saving in state or redux)
103
+ * const plainObject = entry.toPlainObject();
104
+ *
105
+ * // The entry is being updated in some way as plainObject:
106
+ * const updatedPlainObject = {
107
+ * ...plainObject,
108
+ * fields: {
109
+ * ...plainObject.fields,
110
+ * title: {
111
+ * 'en-US': 'updatedTitle'
112
+ * }
113
+ * }
114
+ * };
115
+ *
116
+ * // Rebuild an sdk object out of the updated plainObject:
117
+ * const entryWithMethodsAgain = environment.getEntryFromData(updatedPlainObject);
118
+ *
119
+ * // Update with help of the sdk method:
120
+ * entryWithMethodsAgain.update();
121
+ *
122
+ * });
123
+ * ```
124
+ **/
125
+ getEntryFromData(entryData) {
126
+ return wrapEntry(makeRequest, entryData);
127
+ },
128
+ /**
129
+ * Creates SDK Asset object (locally) from entry data
130
+ * @param assetData - Asset ID
131
+ * @return Asset
132
+ * @example ```javascript
133
+ * environment.getAsset('asset_id').then(asset => {
134
+ *
135
+ * // Build a plainObject in order to make it usable for React (saving in state or redux)
136
+ * const plainObject = asset.toPlainObject();
137
+ *
138
+ * // The asset is being updated in some way as plainObject:
139
+ * const updatedPlainObject = {
140
+ * ...plainObject,
141
+ * fields: {
142
+ * ...plainObject.fields,
143
+ * title: {
144
+ * 'en-US': 'updatedTitle'
145
+ * }
146
+ * }
147
+ * };
148
+ *
149
+ * // Rebuild an sdk object out of the updated plainObject:
150
+ * const assetWithMethodsAgain = environment.getAssetFromData(updatedPlainObject);
151
+ *
152
+ * // Update with help of the sdk method:
153
+ * assetWithMethodsAgain.update();
154
+ *
155
+ * });
156
+ * ```
157
+ */
158
+ getAssetFromData(assetData) {
159
+ return wrapAsset(makeRequest, assetData);
160
+ },
161
+ /**
162
+ *
163
+ * @description Get a BulkAction by ID.
164
+ * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/bulk-action
165
+ * @param bulkActionId - ID of the BulkAction to fetch
166
+ * @returns - Promise with the BulkAction
167
+ *
168
+ * @example ```javascript
169
+ * const contentful = require('contentful-management')
170
+ *
171
+ * const client = contentful.createClient({
172
+ * accessToken: '<content_management_api_key>'
173
+ * })
174
+ *
175
+ * client.getSpace('<space_id>')
176
+ * .then((space) => space.getEnvironment('<environment_id>'))
177
+ * .then((environment) => environment.getBulkAction('<bulk_action_id>'))
178
+ * .then((bulkAction) => console.log(bulkAction))
179
+ * ```
180
+ */
181
+ getBulkAction(bulkActionId) {
182
+ const raw = this.toPlainObject();
183
+ return makeRequest({
184
+ entityType: 'BulkAction',
185
+ action: 'get',
186
+ params: {
187
+ spaceId: raw.sys.space.sys.id,
188
+ environmentId: raw.sys.id,
189
+ bulkActionId,
190
+ },
191
+ }).then((data) => wrapBulkAction(makeRequest, data));
192
+ },
193
+ /**
194
+ * @description Creates a BulkAction that will attempt to publish all items contained in the payload.
195
+ * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/publish-bulk-action
196
+ * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
197
+ * @returns - Promise with the BulkAction
198
+ *
199
+ * @example
200
+ *
201
+ * ```javascript
202
+ * const contentful = require('contentful-management')
203
+ *
204
+ * const client = contentful.createClient({
205
+ * accessToken: '<content_management_api_key>'
206
+ * })
207
+ *
208
+ * const payload = {
209
+ * entities: {
210
+ * sys: { type: 'Array' }
211
+ * items: [
212
+ * { sys: { type: 'Link', id: '<entry-id>', linkType: 'Entry', version: 2 } }
213
+ * ]
214
+ * }
215
+ * }
216
+ *
217
+ * // Using Thenables
218
+ * client.getSpace('<space_id>')
219
+ * .then((space) => space.getEnvironment('<environment_id>'))
220
+ * .then((environment) => environment.createPublishBulkAction(payload))
221
+ * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
222
+ * .catch(console.error)
223
+ *
224
+ * // Using async/await
225
+ * try {
226
+ * const space = await client.getSpace('<space_id>')
227
+ * const environment = await space.getEnvironment('<environment_id>')
228
+ * const bulkActionInProgress = await environment.createPublishBulkAction(payload)
229
+ *
230
+ * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
231
+ * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
232
+ * console.log(bulkActionCompleted)
233
+ * } catch (error) {
234
+ * console.log(error)
235
+ * }
236
+ * ```
237
+ */
238
+ createPublishBulkAction(payload) {
239
+ const raw = this.toPlainObject();
240
+ return makeRequest({
241
+ entityType: 'BulkAction',
242
+ action: 'publish',
243
+ params: {
244
+ spaceId: raw.sys.space.sys.id,
245
+ environmentId: raw.sys.id,
246
+ },
247
+ payload,
248
+ }).then((data) => wrapBulkAction(makeRequest, data));
249
+ },
250
+ /**
251
+ * @description Creates a BulkAction that will attempt to validate all items contained in the payload.
252
+ * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/validate-bulk-action
253
+ * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
254
+ * @returns - Promise with the BulkAction
255
+ *
256
+ * @example
257
+ *
258
+ * ```javascript
259
+ * const contentful = require('contentful-management')
260
+ *
261
+ * const client = contentful.createClient({
262
+ * accessToken: '<content_management_api_key>'
263
+ * })
264
+ *
265
+ * const payload = {
266
+ * action: 'publish',
267
+ * entities: {
268
+ * sys: { type: 'Array' }
269
+ * items: [
270
+ * { sys: { type: 'Link', id: '<entry-id>', linkType: 'Entry' } }
271
+ * ]
272
+ * }
273
+ * }
274
+ *
275
+ * // Using Thenables
276
+ * client.getSpace('<space_id>')
277
+ * .then((space) => space.getEnvironment('<environment_id>'))
278
+ * .then((environment) => environment.createValidateBulkAction(payload))
279
+ * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
280
+ * .catch(console.error)
281
+ *
282
+ * // Using async/await
283
+ * try {
284
+ * const space = await client.getSpace('<space_id>')
285
+ * const environment = await space.getEnvironment('<environment_id>')
286
+ * const bulkActionInProgress = await environment.createValidateBulkAction(payload)
287
+ *
288
+ * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
289
+ * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
290
+ * console.log(bulkActionCompleted)
291
+ * } catch (error) {
292
+ * console.log(error)
293
+ * }
294
+ * ```
295
+ */
296
+ createValidateBulkAction(payload) {
297
+ const raw = this.toPlainObject();
298
+ return makeRequest({
299
+ entityType: 'BulkAction',
300
+ action: 'validate',
301
+ params: {
302
+ spaceId: raw.sys.space.sys.id,
303
+ environmentId: raw.sys.id,
304
+ },
305
+ payload,
306
+ }).then((data) => wrapBulkAction(makeRequest, data));
307
+ },
308
+ /**
309
+ * @description Creates a BulkAction that will attempt to unpublish all items contained in the payload.
310
+ * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/unpublish-bulk-action
311
+ * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
312
+ * @returns - Promise with the BulkAction
313
+ *
314
+ * @example
315
+ *
316
+ * ```javascript
317
+ * const contentful = require('contentful-management')
318
+ *
319
+ * const client = contentful.createClient({
320
+ * accessToken: '<content_management_api_key>'
321
+ * })
322
+ *
323
+ * const payload = {
324
+ * entities: {
325
+ * sys: { type: 'Array' }
326
+ * items: [
327
+ * { sys: { type: 'Link', id: 'entry-id', linkType: 'Entry' } }
328
+ * ]
329
+ * }
330
+ * }
331
+ *
332
+ * // Using Thenables
333
+ * client.getSpace('<space_id>')
334
+ * .then((space) => space.getEnvironment('<environment_id>'))
335
+ * .then((environment) => environment.createUnpublishBulkAction(payload))
336
+ * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
337
+ * .catch(console.error)
338
+ *
339
+ * // Using async/await
340
+ * try {
341
+ * const space = await clientgetSpace('<space_id>')
342
+ * const environment = await space.getEnvironment('<environment_id>')
343
+ * const bulkActionInProgress = await environment.createUnpublishBulkAction(payload)
344
+ *
345
+ * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
346
+ * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
347
+ * console.log(bulkActionCompleted)
348
+ * } catch (error) {
349
+ * console.log(error)
350
+ * }
351
+ * ```
352
+ */
353
+ createUnpublishBulkAction(payload) {
354
+ const raw = this.toPlainObject();
355
+ return makeRequest({
356
+ entityType: 'BulkAction',
357
+ action: 'unpublish',
358
+ params: {
359
+ spaceId: raw.sys.space.sys.id,
360
+ environmentId: raw.sys.id,
361
+ },
362
+ payload,
363
+ }).then((data) => wrapBulkAction(makeRequest, data));
364
+ },
365
+ /**
366
+ * Gets a Content Type
367
+ * @param contentTypeId - Content Type ID
368
+ * @return Promise for a Content Type
369
+ * @example ```javascript
370
+ * const contentful = require('contentful-management')
371
+ *
372
+ * const client = contentful.createClient({
373
+ * accessToken: '<content_management_api_key>'
374
+ * })
375
+ *
376
+ * client.getSpace('<space_id>')
377
+ * .then((space) => space.getEnvironment('<environment-id>'))
378
+ * .then((environment) => environment.getContentType('<content_type_id>'))
379
+ * .then((contentType) => console.log(contentType))
380
+ * .catch(console.error)
381
+ * ```
382
+ */
383
+ getContentType(contentTypeId) {
384
+ const raw = this.toPlainObject();
385
+ return makeRequest({
386
+ entityType: 'ContentType',
387
+ action: 'get',
388
+ params: {
389
+ spaceId: raw.sys.space.sys.id,
390
+ environmentId: raw.sys.id,
391
+ contentTypeId,
392
+ },
393
+ }).then((data) => wrapContentType(makeRequest, data));
394
+ },
395
+ /**
396
+ * Gets a collection of Content Types
397
+ * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
398
+ * @return Promise for a collection of Content Types
399
+ * @example ```javascript
400
+ * const contentful = require('contentful-management')
401
+ *
402
+ * const client = contentful.createClient({
403
+ * accessToken: '<content_management_api_key>'
404
+ * })
405
+ *
406
+ * client.getSpace('<space_id>')
407
+ * .then((space) => space.getEnvironment('<environment-id>'))
408
+ * .then((environment) => environment.getContentTypes())
409
+ * .then((response) => console.log(response.items))
410
+ * .catch(console.error)
411
+ * ```
412
+ */
413
+ getContentTypes(query = {}) {
414
+ const raw = this.toPlainObject();
415
+ return makeRequest({
416
+ entityType: 'ContentType',
417
+ action: 'getMany',
418
+ params: {
419
+ spaceId: raw.sys.space.sys.id,
420
+ environmentId: raw.sys.id,
421
+ query: createRequestConfig({ query }).params,
422
+ },
423
+ }).then((data) => wrapContentTypeCollection(makeRequest, data));
424
+ },
425
+ /**
426
+ * Creates a Content Type
427
+ * @param data - Object representation of the Content Type to be created
428
+ * @return Promise for the newly created Content Type
429
+ * @example ```javascript
430
+ * const contentful = require('contentful-management')
431
+ *
432
+ * const client = contentful.createClient({
433
+ * accessToken: '<content_management_api_key>'
434
+ * })
435
+ *
436
+ * client.getSpace('<space_id>')
437
+ * .then((space) => space.getEnvironment('<environment-id>'))
438
+ * .then((environment) => environment.createContentType({
439
+ * name: 'Blog Post',
440
+ * fields: [
441
+ * {
442
+ * id: 'title',
443
+ * name: 'Title',
444
+ * required: true,
445
+ * localized: false,
446
+ * type: 'Text'
447
+ * }
448
+ * ]
449
+ * }))
450
+ * .then((contentType) => console.log(contentType))
451
+ * .catch(console.error)
452
+ * ```
453
+ */
454
+ createContentType(data) {
455
+ const raw = this.toPlainObject();
456
+ return makeRequest({
457
+ entityType: 'ContentType',
458
+ action: 'create',
459
+ params: {
460
+ spaceId: raw.sys.space.sys.id,
461
+ environmentId: raw.sys.id,
462
+ },
463
+ payload: data,
464
+ }).then((response) => wrapContentType(makeRequest, response));
465
+ },
466
+ /**
467
+ * Creates a Content Type with a custom ID
468
+ * @param contentTypeId - Content Type ID
469
+ * @param data - Object representation of the Content Type to be created
470
+ * @return Promise for the newly created Content Type
471
+ * @example ```javascript
472
+ * const contentful = require('contentful-management')
473
+ *
474
+ * const client = contentful.createClient({
475
+ * accessToken: '<content_management_api_key>'
476
+ * })
477
+ *
478
+ * client.getSpace('<space_id>')
479
+ * .then((space) => space.getEnvironment('<environment-id>'))
480
+ * .then((environment) => environment.createContentTypeWithId('<content-type-id>', {
481
+ * name: 'Blog Post',
482
+ * fields: [
483
+ * {
484
+ * id: 'title',
485
+ * name: 'Title',
486
+ * required: true,
487
+ * localized: false,
488
+ * type: 'Text'
489
+ * }
490
+ * ]
491
+ * }))
492
+ * .then((contentType) => console.log(contentType))
493
+ * .catch(console.error)
494
+ * ```
495
+ */
496
+ createContentTypeWithId(contentTypeId, data) {
497
+ const raw = this.toPlainObject();
498
+ return makeRequest({
499
+ entityType: 'ContentType',
500
+ action: 'createWithId',
501
+ params: {
502
+ spaceId: raw.sys.space.sys.id,
503
+ environmentId: raw.sys.id,
504
+ contentTypeId,
505
+ },
506
+ payload: data,
507
+ }).then((response) => wrapContentType(makeRequest, response));
508
+ },
509
+ /**
510
+ * Gets an EditorInterface for a ContentType
511
+ * @param contentTypeId - Content Type ID
512
+ * @return Promise for an EditorInterface
513
+ * @example ```javascript
514
+ * const contentful = require('contentful-management')
515
+ *
516
+ * const client = contentful.createClient({
517
+ * accessToken: '<content_management_api_key>'
518
+ * })
519
+ *
520
+ * client.getSpace('<space_id>')
521
+ * .then((space) => space.getEnvironment('<environment-id>'))
522
+ * .then((environment) => environment.getEditorInterfaceForContentType('<content_type_id>'))
523
+ * .then((EditorInterface) => console.log(EditorInterface))
524
+ * .catch(console.error)
525
+ * ```
526
+ */
527
+ getEditorInterfaceForContentType(contentTypeId) {
528
+ const raw = this.toPlainObject();
529
+ return makeRequest({
530
+ entityType: 'EditorInterface',
531
+ action: 'get',
532
+ params: {
533
+ spaceId: raw.sys.space.sys.id,
534
+ environmentId: raw.sys.id,
535
+ contentTypeId,
536
+ },
537
+ }).then((response) => wrapEditorInterface(makeRequest, response));
538
+ },
539
+ /**
540
+ * Gets all EditorInterfaces
541
+ * @return Promise for a collection of EditorInterface
542
+ * @example ```javascript
543
+ * const contentful = require('contentful-management')
544
+ *
545
+ * const client = contentful.createClient({
546
+ * accessToken: '<content_management_api_key>'
547
+ * })
548
+ *
549
+ * client.getSpace('<space_id>')
550
+ * .then((space) => space.getEnvironment('<environment-id>'))
551
+ * .then((environment) => environment.getEditorInterfaces())
552
+ * .then((response) => console.log(response.items))
553
+ * .catch(console.error)
554
+ * ```
555
+ */
556
+ getEditorInterfaces() {
557
+ const raw = this.toPlainObject();
558
+ return makeRequest({
559
+ entityType: 'EditorInterface',
560
+ action: 'getMany',
561
+ params: {
562
+ spaceId: raw.sys.space.sys.id,
563
+ environmentId: raw.sys.id,
564
+ },
565
+ }).then((response) => wrapEditorInterfaceCollection(makeRequest, response));
566
+ },
567
+ /**
568
+ * Gets an Entry
569
+ * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
570
+ * from your entry in the backend
571
+ * @param id - Entry ID
572
+ * @param query - Object with search parameters. In this method it's only useful for `locale`.
573
+ * @return Promise for an Entry
574
+ * @example ```javascript
575
+ * const contentful = require('contentful-management')
576
+ *
577
+ * const client = contentful.createClient({
578
+ * accessToken: '<content_management_api_key>'
579
+ * })
580
+ *
581
+ * client.getSpace('<space_id>')
582
+ * .then((space) => space.getEnvironment('<environment-id>'))
583
+ * .then((environment) => environment.getEntry('<entry-id>'))
584
+ * .then((entry) => console.log(entry))
585
+ * .catch(console.error)
586
+ * ```
587
+ */
588
+ getEntry(id, query = {}) {
589
+ const raw = this.toPlainObject();
590
+ return makeRequest({
591
+ entityType: 'Entry',
592
+ action: 'get',
593
+ params: {
594
+ spaceId: raw.sys.space.sys.id,
595
+ environmentId: raw.sys.id,
596
+ entryId: id,
597
+ query: createRequestConfig({ query: query }).params,
598
+ },
599
+ }).then((data) => wrapEntry(makeRequest, data));
600
+ },
601
+ /**
602
+ * Deletes an Entry of this environment
603
+ * @param id - Entry ID
604
+ * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
605
+ * @example ```javascript
606
+ * const contentful = require('contentful-management')
607
+ *
608
+ * const client = contentful.createClient({
609
+ * accessToken: '<content_management_api_key>'
610
+ * })
611
+ *
612
+ * client.getSpace('<space_id>')
613
+ * .then((space) => space.getEnvironment('<environment-id>'))
614
+ * .then((environment) => environment.deleteEntry("4bmLXiuviAZH3jkj5DLRWE"))
615
+ * .then(() => console.log('Entry deleted.'))
616
+ * .catch(console.error)
617
+ * ```
618
+ */
619
+ deleteEntry(id) {
620
+ const raw = this.toPlainObject();
621
+ return makeRequest({
622
+ entityType: 'Entry',
623
+ action: 'delete',
624
+ params: {
625
+ spaceId: raw.sys.space.sys.id,
626
+ environmentId: raw.sys.id,
627
+ entryId: id,
628
+ },
629
+ }).then(() => {
630
+ // noop
631
+ });
632
+ },
633
+ /**
634
+ * Gets a collection of Entries
635
+ * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
636
+ * from your entry in the backend
637
+ * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
638
+ * @return Promise for a collection of Entries
639
+ * @example ```javascript
640
+ * const contentful = require('contentful-management')
641
+ *
642
+ * const client = contentful.createClient({
643
+ * accessToken: '<content_management_api_key>'
644
+ * })
645
+ *
646
+ * client.getSpace('<space_id>')
647
+ * .then((space) => space.getEnvironment('<environment-id>'))
648
+ * .then((environment) => environment.getEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value'
649
+ * .then((response) => console.log(response.items))
650
+ * .catch(console.error)
651
+ * ```
652
+ */
653
+ getEntries(query = {}) {
654
+ const raw = this.toPlainObject();
655
+ return makeRequest({
656
+ entityType: 'Entry',
657
+ action: 'getMany',
658
+ params: {
659
+ spaceId: raw.sys.space.sys.id,
660
+ environmentId: raw.sys.id,
661
+ query: createRequestConfig({ query: query }).params,
662
+ },
663
+ }).then((data) => wrapEntryCollection(makeRequest, data));
664
+ },
665
+ /**
666
+ * Gets a collection of published Entries
667
+ * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
668
+ * @return Promise for a collection of published Entries
669
+ * @example ```javascript
670
+ * const contentful = require('contentful-management')
671
+ *
672
+ * const client = contentful.createClient({
673
+ * accessToken: '<content_management_api_key>'
674
+ * })
675
+ *
676
+ * client.getSpace('<space_id>')
677
+ * .then((space) => space.getEnvironment('<environment-id>'))
678
+ * .then((environment) => environment.getPublishedEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value'
679
+ * .then((response) => console.log(response.items))
680
+ * .catch(console.error)
681
+ * ```
682
+ */
683
+ getPublishedEntries(query = {}) {
684
+ const raw = this.toPlainObject();
685
+ return makeRequest({
686
+ entityType: 'Entry',
687
+ action: 'getPublished',
688
+ params: {
689
+ spaceId: raw.sys.space.sys.id,
690
+ environmentId: raw.sys.id,
691
+ query: createRequestConfig({ query: query }).params,
692
+ },
693
+ }).then((data) => wrapEntryCollection(makeRequest, data));
694
+ },
695
+ /**
696
+ * Creates a Entry
697
+ * @param contentTypeId - The Content Type ID of the newly created Entry
698
+ * @param data - Object representation of the Entry to be created
699
+ * @return Promise for the newly created Entry
700
+ * @example ```javascript
701
+ * const contentful = require('contentful-management')
702
+ *
703
+ * const client = contentful.createClient({
704
+ * accessToken: '<content_management_api_key>'
705
+ * })
706
+ *
707
+ * client.getSpace('<space_id>')
708
+ * .then((space) => space.getEnvironment('<environment-id>'))
709
+ * .then((environment) => environment.createEntry('<content_type_id>', {
710
+ * fields: {
711
+ * title: {
712
+ * 'en-US': 'Entry title'
713
+ * }
714
+ * }
715
+ * }))
716
+ * .then((entry) => console.log(entry))
717
+ * .catch(console.error)
718
+ * ```
719
+ */
720
+ createEntry(contentTypeId, data) {
721
+ const raw = this.toPlainObject();
722
+ return makeRequest({
723
+ entityType: 'Entry',
724
+ action: 'create',
725
+ params: {
726
+ spaceId: raw.sys.space.sys.id,
727
+ environmentId: raw.sys.id,
728
+ contentTypeId: contentTypeId,
729
+ },
730
+ payload: data,
731
+ }).then((response) => wrapEntry(makeRequest, response));
732
+ },
733
+ /**
734
+ * Creates a Entry with a custom ID
735
+ * @param contentTypeId - The Content Type of the newly created Entry
736
+ * @param id - Entry ID
737
+ * @param data - Object representation of the Entry to be created
738
+ * @return Promise for the newly created Entry
739
+ * @example ```javascript
740
+ * const contentful = require('contentful-management')
741
+ *
742
+ * const client = contentful.createClient({
743
+ * accessToken: '<content_management_api_key>'
744
+ * })
745
+ *
746
+ * // Create entry
747
+ * client.getSpace('<space_id>')
748
+ * .then((space) => space.getEnvironment('<environment-id>'))
749
+ * .then((environment) => environment.createEntryWithId('<content_type_id>', '<entry_id>', {
750
+ * fields: {
751
+ * title: {
752
+ * 'en-US': 'Entry title'
753
+ * }
754
+ * }
755
+ * }))
756
+ * .then((entry) => console.log(entry))
757
+ * .catch(console.error)
758
+ * ```
759
+ */
760
+ createEntryWithId(contentTypeId, id, data) {
761
+ const raw = this.toPlainObject();
762
+ return makeRequest({
763
+ entityType: 'Entry',
764
+ action: 'createWithId',
765
+ params: {
766
+ spaceId: raw.sys.space.sys.id,
767
+ environmentId: raw.sys.id,
768
+ entryId: id,
769
+ contentTypeId: contentTypeId,
770
+ },
771
+ payload: data,
772
+ }).then((response) => wrapEntry(makeRequest, response));
773
+ },
774
+ /**
775
+ * Get entry references
776
+ * @param entryId - Entry ID
777
+ * @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
778
+ * @returns Promise of Entry references
779
+ * @example ```javascript
780
+ * const contentful = require('contentful-management');
781
+ *
782
+ * const client = contentful.createClient({
783
+ * accessToken: '<contentful_management_api_key>
784
+ * })
785
+ *
786
+ * // Get entry references
787
+ * client.getSpace('<space_id>')
788
+ * .then((space) => space.getEnvironment('<environment_id>'))
789
+ * .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
790
+ * .then((entry) => console.log(entry.includes))
791
+ * // or
792
+ * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
793
+ * .catch(console.error)
794
+ * ```
795
+ */
796
+ getEntryReferences(entryId, options) {
797
+ const raw = this.toPlainObject();
798
+ return makeRequest({
799
+ entityType: 'Entry',
800
+ action: 'references',
801
+ params: {
802
+ spaceId: raw.sys.space.sys.id,
803
+ environmentId: raw.sys.id,
804
+ entryId: entryId,
805
+ include: options === null || options === void 0 ? void 0 : options.include,
806
+ },
807
+ }).then((response) => wrapEntryCollection(makeRequest, response));
808
+ },
809
+ /**
810
+ * Gets an Asset
811
+ * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
812
+ * from your entry in the backend
813
+ * @param id - Asset ID
814
+ * @param query - Object with search parameters. In this method it's only useful for `locale`.
815
+ * @return Promise for an Asset
816
+ * @example ```javascript
817
+ * const contentful = require('contentful-management')
818
+ *
819
+ * const client = contentful.createClient({
820
+ * accessToken: '<content_management_api_key>'
821
+ * })
822
+ *
823
+ * client.getSpace('<space_id>')
824
+ * .then((space) => space.getEnvironment('<environment-id>'))
825
+ * .then((environment) => environment.getAsset('<asset_id>'))
826
+ * .then((asset) => console.log(asset))
827
+ * .catch(console.error)
828
+ * ```
829
+ */
830
+ getAsset(id, query = {}) {
831
+ const raw = this.toPlainObject();
832
+ return makeRequest({
833
+ entityType: 'Asset',
834
+ action: 'get',
835
+ params: {
836
+ spaceId: raw.sys.space.sys.id,
837
+ environmentId: raw.sys.id,
838
+ assetId: id,
839
+ query: createRequestConfig({ query: query }).params,
840
+ },
841
+ }).then((data) => wrapAsset(makeRequest, data));
842
+ },
843
+ /**
844
+ * Gets a collection of Assets
845
+ * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
846
+ * from your entry in the backend
847
+ * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
848
+ * @return Promise for a collection of Assets
849
+ * @example ```javascript
850
+ * const contentful = require('contentful-management')
851
+ *
852
+ * const client = contentful.createClient({
853
+ * accessToken: '<content_management_api_key>'
854
+ * })
855
+ *
856
+ * client.getSpace('<space_id>')
857
+ * .then((space) => space.getEnvironment('<environment-id>'))
858
+ * .then((environment) => environment.getAssets())
859
+ * .then((response) => console.log(response.items))
860
+ * .catch(console.error)
861
+ * ```
862
+ */
863
+ getAssets(query = {}) {
864
+ const raw = this.toPlainObject();
865
+ return makeRequest({
866
+ entityType: 'Asset',
867
+ action: 'getMany',
868
+ params: {
869
+ spaceId: raw.sys.space.sys.id,
870
+ environmentId: raw.sys.id,
871
+ query: createRequestConfig({ query: query }).params,
872
+ },
873
+ }).then((data) => wrapAssetCollection(makeRequest, data));
874
+ },
875
+ /**
876
+ * Gets a collection of published Assets
877
+ * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
878
+ * @return Promise for a collection of published Assets
879
+ * @example ```javascript
880
+ * const contentful = require('contentful-management')
881
+ *
882
+ * const client = contentful.createClient({
883
+ * accessToken: '<content_management_api_key>'
884
+ * })
885
+ *
886
+ * client.getSpace('<space_id>')
887
+ * .then((space) => space.getEnvironment('<environment-id>'))
888
+ * .then((environment) => environment.getPublishedAssets())
889
+ * .then((response) => console.log(response.items))
890
+ * .catch(console.error)
891
+ * ```
892
+ */
893
+ getPublishedAssets(query = {}) {
894
+ const raw = this.toPlainObject();
895
+ return makeRequest({
896
+ entityType: 'Asset',
897
+ action: 'getPublished',
898
+ params: {
899
+ spaceId: raw.sys.space.sys.id,
900
+ environmentId: raw.sys.id,
901
+ query: createRequestConfig({ query: query }).params,
902
+ },
903
+ }).then((data) => wrapAssetCollection(makeRequest, data));
904
+ },
905
+ /**
906
+ * Creates a Asset. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
907
+ * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished.
908
+ * @return Promise for the newly created Asset
909
+ * @example ```javascript
910
+ * const client = contentful.createClient({
911
+ * accessToken: '<content_management_api_key>'
912
+ * })
913
+ *
914
+ * // Create asset
915
+ * client.getSpace('<space_id>')
916
+ * .then((space) => space.getEnvironment('<environment-id>'))
917
+ * .then((environment) => environment.createAsset({
918
+ * fields: {
919
+ * title: {
920
+ * 'en-US': 'Playsam Streamliner'
921
+ * },
922
+ * file: {
923
+ * 'en-US': {
924
+ * contentType: 'image/jpeg',
925
+ * fileName: 'example.jpeg',
926
+ * upload: 'https://example.com/example.jpg'
927
+ * }
928
+ * }
929
+ * }
930
+ * }))
931
+ * .then((asset) => asset.processForLocale("en-US")) // OR asset.processForAllLocales()
932
+ * .then((asset) => console.log(asset))
933
+ * .catch(console.error)
934
+ * ```
935
+ */
936
+ createAsset(data) {
937
+ const raw = this.toPlainObject();
938
+ return makeRequest({
939
+ entityType: 'Asset',
940
+ action: 'create',
941
+ params: {
942
+ spaceId: raw.sys.space.sys.id,
943
+ environmentId: raw.sys.id,
944
+ },
945
+ payload: data,
946
+ }).then((response) => wrapAsset(makeRequest, response));
947
+ },
948
+ /**
949
+ * Creates a Asset with a custom ID. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
950
+ * @param id - Asset ID
951
+ * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished.
952
+ * @return Promise for the newly created Asset
953
+ * @example ```javascript
954
+ * const client = contentful.createClient({
955
+ * accessToken: '<content_management_api_key>'
956
+ * })
957
+ *
958
+ * // Create asset
959
+ * client.getSpace('<space_id>')
960
+ * .then((space) => space.getEnvironment('<environment-id>'))
961
+ * .then((environment) => environment.createAssetWithId('<asset_id>', {
962
+ * title: {
963
+ * 'en-US': 'Playsam Streamliner'
964
+ * },
965
+ * file: {
966
+ * 'en-US': {
967
+ * contentType: 'image/jpeg',
968
+ * fileName: 'example.jpeg',
969
+ * upload: 'https://example.com/example.jpg'
970
+ * }
971
+ * }
972
+ * }))
973
+ * .then((asset) => asset.process())
974
+ * .then((asset) => console.log(asset))
975
+ * .catch(console.error)
976
+ * ```
977
+ */
978
+ createAssetWithId(id, data) {
979
+ const raw = this.toPlainObject();
980
+ return makeRequest({
981
+ entityType: 'Asset',
982
+ action: 'createWithId',
983
+ params: {
984
+ spaceId: raw.sys.space.sys.id,
985
+ environmentId: raw.sys.id,
986
+ assetId: id,
987
+ },
988
+ payload: data,
989
+ }).then((response) => wrapAsset(makeRequest, response));
990
+ },
991
+ /**
992
+ * Creates a Asset based on files. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
993
+ * @param data - Object representation of the Asset to be created. Note that the field object should have an uploadFrom property on asset creation, which will be removed and replaced with an url property when processing is finished.
994
+ * @param data.fields.file.[LOCALE].file - Can be a string, an ArrayBuffer or a Stream.
995
+ * @return Promise for the newly created Asset
996
+ * @example ```javascript
997
+ * const client = contentful.createClient({
998
+ * accessToken: '<content_management_api_key>'
999
+ * })
1000
+ *
1001
+ * client.getSpace('<space_id>')
1002
+ * .then((space) => space.getEnvironment('<environment-id>'))
1003
+ * .then((environment) => environment.createAssetFromFiles({
1004
+ * fields: {
1005
+ * file: {
1006
+ * 'en-US': {
1007
+ * contentType: 'image/jpeg',
1008
+ * fileName: 'filename_english.jpg',
1009
+ * file: createReadStream('path/to/filename_english.jpg')
1010
+ * },
1011
+ * 'de-DE': {
1012
+ * contentType: 'image/svg+xml',
1013
+ * fileName: 'filename_german.svg',
1014
+ * file: '<svg><path fill="red" d="M50 50h150v50H50z"/></svg>'
1015
+ * }
1016
+ * }
1017
+ * }
1018
+ * }))
1019
+ * .then((asset) => console.log(asset))
1020
+ * .catch(console.error)
1021
+ * ```
1022
+ */
1023
+ createAssetFromFiles(data, options) {
1024
+ const raw = this.toPlainObject();
1025
+ return makeRequest({
1026
+ entityType: 'Asset',
1027
+ action: 'createFromFiles',
1028
+ params: {
1029
+ spaceId: raw.sys.space.sys.id,
1030
+ environmentId: raw.sys.id,
1031
+ uploadTimeout: options === null || options === void 0 ? void 0 : options.uploadTimeout,
1032
+ },
1033
+ payload: data,
1034
+ }).then((response) => wrapAsset(makeRequest, response));
1035
+ },
1036
+ /**
1037
+ * Creates an asset key for signing asset URLs (Embargoed Assets)
1038
+ * @param data Object with request payload
1039
+ * @param data.expiresAt number a UNIX timestamp in the future (but not more than 48 hours from time of calling)
1040
+ * @return Promise for the newly created AssetKey
1041
+ * @example ```javascript
1042
+ * const client = contentful.createClient({
1043
+ * accessToken: '<content_management_api_key>'
1044
+ * })
1045
+ *
1046
+ * // Create assetKey
1047
+ * now = () => Math.floor(Date.now() / 1000)
1048
+ * const withExpiryIn1Hour = () => now() + 1 * 60 * 60
1049
+ * client.getSpace('<space_id>')
1050
+ * .then((space) => space.getEnvironment('<environment-id>'))
1051
+ * .then((environment) => environment.createAssetKey({ expiresAt: withExpiryIn1Hour() }))
1052
+ * .then((policy, secret) => console.log({ policy, secret }))
1053
+ * .catch(console.error)
1054
+ * ```
1055
+ */
1056
+ createAssetKey(payload) {
1057
+ const raw = this.toPlainObject();
1058
+ return makeRequest({
1059
+ entityType: 'AssetKey',
1060
+ action: 'create',
1061
+ params: {
1062
+ spaceId: raw.sys.space.sys.id,
1063
+ environmentId: raw.sys.id,
1064
+ },
1065
+ payload,
1066
+ }).then((data) => wrapAssetKey(makeRequest, data));
1067
+ },
1068
+ /**
1069
+ * Gets an Upload
1070
+ * @param id - Upload ID
1071
+ * @return Promise for an Upload
1072
+ * @example ```javascript
1073
+ * const client = contentful.createClient({
1074
+ * accessToken: '<content_management_api_key>'
1075
+ * })
1076
+ * const uploadStream = createReadStream('path/to/filename_english.jpg')
1077
+ *
1078
+ * client.getSpace('<space_id>')
1079
+ * .then((space) => space.getEnvironment('<environment-id>'))
1080
+ * .then((environment) => environment.getUpload('<upload-id>')
1081
+ * .then((upload) => console.log(upload))
1082
+ * .catch(console.error)
1083
+ */
1084
+ getUpload(id) {
1085
+ const raw = this.toPlainObject();
1086
+ return makeRequest({
1087
+ entityType: 'Upload',
1088
+ action: 'get',
1089
+ params: {
1090
+ spaceId: raw.sys.space.sys.id,
1091
+ environmentId: raw.sys.id,
1092
+ uploadId: id,
1093
+ },
1094
+ }).then((data) => wrapUpload(makeRequest, data));
1095
+ },
1096
+ /**
1097
+ * Creates a Upload.
1098
+ * @param data - Object with file information.
1099
+ * @param data.file - Actual file content. Can be a string, an ArrayBuffer or a Stream.
1100
+ * @return Upload object containing information about the uploaded file.
1101
+ * @example ```javascript
1102
+ * const client = contentful.createClient({
1103
+ * accessToken: '<content_management_api_key>'
1104
+ * })
1105
+ * const uploadStream = createReadStream('path/to/filename_english.jpg')
1106
+ *
1107
+ * client.getSpace('<space_id>')
1108
+ * .then((space) => space.getEnvironment('<environment-id>'))
1109
+ * .then((environment) => environment.createUpload({file: uploadStream})
1110
+ * .then((upload) => console.log(upload))
1111
+ * .catch(console.error)
1112
+ * ```
1113
+ */
1114
+ createUpload: function createUpload(data) {
1115
+ const raw = this.toPlainObject();
1116
+ return makeRequest({
1117
+ entityType: 'Upload',
1118
+ action: 'create',
1119
+ params: {
1120
+ spaceId: raw.sys.space.sys.id,
1121
+ environmentId: raw.sys.id,
1122
+ },
1123
+ payload: data,
1124
+ }).then((data) => wrapUpload(makeRequest, data));
1125
+ },
1126
+ /**
1127
+ * Gets a Locale
1128
+ * @param localeId - Locale ID
1129
+ * @return Promise for an Locale
1130
+ * @example ```javascript
1131
+ * const contentful = require('contentful-management')
1132
+ *
1133
+ * const client = contentful.createClient({
1134
+ * accessToken: '<content_management_api_key>'
1135
+ * })
1136
+ *
1137
+ * client.getSpace('<space_id>')
1138
+ * .then((space) => space.getEnvironment('<environment-id>'))
1139
+ * .then((environment) => environment.getLocale('<locale_id>'))
1140
+ * .then((locale) => console.log(locale))
1141
+ * .catch(console.error)
1142
+ * ```
1143
+ */
1144
+ getLocale(localeId) {
1145
+ const raw = this.toPlainObject();
1146
+ return makeRequest({
1147
+ entityType: 'Locale',
1148
+ action: 'get',
1149
+ params: {
1150
+ spaceId: raw.sys.space.sys.id,
1151
+ environmentId: raw.sys.id,
1152
+ localeId,
1153
+ },
1154
+ }).then((data) => wrapLocale(makeRequest, data));
1155
+ },
1156
+ /**
1157
+ * Gets a collection of Locales
1158
+ * @return Promise for a collection of Locales
1159
+ * @example ```javascript
1160
+ * const contentful = require('contentful-management')
1161
+ *
1162
+ * const client = contentful.createClient({
1163
+ * accessToken: '<content_management_api_key>'
1164
+ * })
1165
+ *
1166
+ * client.getSpace('<space_id>')
1167
+ * .then((space) => space.getEnvironment('<environment-id>'))
1168
+ * .then((environment) => environment.getLocales())
1169
+ * .then((response) => console.log(response.items))
1170
+ * .catch(console.error)
1171
+ * ```
1172
+ */
1173
+ getLocales(query = {}) {
1174
+ const raw = this.toPlainObject();
1175
+ return makeRequest({
1176
+ entityType: 'Locale',
1177
+ action: 'getMany',
1178
+ params: {
1179
+ spaceId: raw.sys.space.sys.id,
1180
+ environmentId: raw.sys.id,
1181
+ query: createRequestConfig({ query }).params,
1182
+ },
1183
+ }).then((data) => wrapLocaleCollection(makeRequest, data));
1184
+ },
1185
+ /**
1186
+ * Creates a Locale
1187
+ * @param data - Object representation of the Locale to be created
1188
+ * @return Promise for the newly created Locale
1189
+ * @example ```javascript
1190
+ * const contentful = require('contentful-management')
1191
+ *
1192
+ * const client = contentful.createClient({
1193
+ * accessToken: '<content_management_api_key>'
1194
+ * })
1195
+ *
1196
+ * // Create locale
1197
+ * client.getSpace('<space_id>')
1198
+ * .then((space) => space.getEnvironment('<environment-id>'))
1199
+ * .then((environment) => environment.createLocale({
1200
+ * name: 'German (Austria)',
1201
+ * code: 'de-AT',
1202
+ * fallbackCode: 'de-DE',
1203
+ * optional: true
1204
+ * }))
1205
+ * .then((locale) => console.log(locale))
1206
+ * .catch(console.error)
1207
+ * ```
1208
+ */
1209
+ createLocale(data) {
1210
+ const raw = this.toPlainObject();
1211
+ return makeRequest({
1212
+ entityType: 'Locale',
1213
+ action: 'create',
1214
+ params: {
1215
+ spaceId: raw.sys.space.sys.id,
1216
+ environmentId: raw.sys.id,
1217
+ },
1218
+ payload: data,
1219
+ }).then((response) => wrapLocale(makeRequest, response));
1220
+ },
1221
+ /**
1222
+ * Gets an UI Extension
1223
+ * @param id - Extension ID
1224
+ * @return Promise for an UI Extension
1225
+ * @example ```javascript
1226
+ * const contentful = require('contentful-management')
1227
+ *
1228
+ * const client = contentful.createClient({
1229
+ * accessToken: '<content_management_api_key>'
1230
+ * })
1231
+ *
1232
+ * client.getSpace('<space_id>')
1233
+ * .then((space) => space.getEnvironment('<environment-id>'))
1234
+ * .then((environment) => environment.getUiExtension('<extension-id>'))
1235
+ * .then((extension) => console.log(extension))
1236
+ * .catch(console.error)
1237
+ * ```
1238
+ */
1239
+ getUiExtension(id) {
1240
+ const raw = this.toPlainObject();
1241
+ return makeRequest({
1242
+ entityType: 'Extension',
1243
+ action: 'get',
1244
+ params: {
1245
+ spaceId: raw.sys.space.sys.id,
1246
+ environmentId: raw.sys.id,
1247
+ extensionId: id,
1248
+ },
1249
+ }).then((data) => wrapExtension(makeRequest, data));
1250
+ },
1251
+ /**
1252
+ * Gets a collection of UI Extension
1253
+ * @return Promise for a collection of UI Extensions
1254
+ * @example ```javascript
1255
+ * const contentful = require('contentful-management')
1256
+ *
1257
+ * const client = contentful.createClient({
1258
+ * accessToken: '<content_management_api_key>'
1259
+ * })
1260
+ *
1261
+ * client.getSpace('<space_id>')
1262
+ * .then((space) => space.getEnvironment('<environment-id>'))
1263
+ * .then((environment) => environment.getUiExtensions()
1264
+ * .then((response) => console.log(response.items))
1265
+ * .catch(console.error)
1266
+ * ```
1267
+ */
1268
+ getUiExtensions() {
1269
+ const raw = this.toPlainObject();
1270
+ return makeRequest({
1271
+ entityType: 'Extension',
1272
+ action: 'getMany',
1273
+ params: {
1274
+ spaceId: raw.sys.space.sys.id,
1275
+ environmentId: raw.sys.id,
1276
+ },
1277
+ }).then((response) => wrapExtensionCollection(makeRequest, response));
1278
+ },
1279
+ /**
1280
+ * Creates a UI Extension
1281
+ * @param data - Object representation of the UI Extension to be created
1282
+ * @return Promise for the newly created UI Extension
1283
+ * @example ```javascript
1284
+ * const contentful = require('contentful-management')
1285
+ *
1286
+ * const client = contentful.createClient({
1287
+ * accessToken: '<content_management_api_key>'
1288
+ * })
1289
+ *
1290
+ * client.getSpace('<space_id>')
1291
+ * .then((space) => space.getEnvironment('<environment-id>'))
1292
+ * .then((environment) => environment.createUiExtension({
1293
+ * extension: {
1294
+ * name: 'My awesome extension',
1295
+ * src: 'https://example.com/my',
1296
+ * fieldTypes: [
1297
+ * {
1298
+ * type: 'Symbol'
1299
+ * },
1300
+ * {
1301
+ * type: 'Text'
1302
+ * }
1303
+ * ],
1304
+ * sidebar: false
1305
+ * }
1306
+ * }))
1307
+ * .then((extension) => console.log(extension))
1308
+ * .catch(console.error)
1309
+ * ```
1310
+ */
1311
+ createUiExtension(data) {
1312
+ const raw = this.toPlainObject();
1313
+ return makeRequest({
1314
+ entityType: 'Extension',
1315
+ action: 'create',
1316
+ params: {
1317
+ spaceId: raw.sys.space.sys.id,
1318
+ environmentId: raw.sys.id,
1319
+ },
1320
+ payload: data,
1321
+ }).then((response) => wrapExtension(makeRequest, response));
1322
+ },
1323
+ /**
1324
+ * Creates a UI Extension with a custom ID
1325
+ * @param id - Extension ID
1326
+ * @param data - Object representation of the UI Extension to be created
1327
+ * @return Promise for the newly created UI Extension
1328
+ * @example ```javascript
1329
+ * const contentful = require('contentful-management')
1330
+ *
1331
+ * const client = contentful.createClient({
1332
+ * accessToken: '<content_management_api_key>'
1333
+ * })
1334
+ *
1335
+ * client.getSpace('<space_id>')
1336
+ * .then((space) => space.getEnvironment('<environment-id>'))
1337
+ * .then((environment) => environment.createUiExtensionWithId('<extension_id>', {
1338
+ * extension: {
1339
+ * name: 'My awesome extension',
1340
+ * src: 'https://example.com/my',
1341
+ * fieldTypes: [
1342
+ * {
1343
+ * type: 'Symbol'
1344
+ * },
1345
+ * {
1346
+ * type: 'Text'
1347
+ * }
1348
+ * ],
1349
+ * sidebar: false
1350
+ * }
1351
+ * }))
1352
+ * .then((extension) => console.log(extension))
1353
+ * .catch(console.error)
1354
+ * ```
1355
+ */
1356
+ createUiExtensionWithId(id, data) {
1357
+ const raw = this.toPlainObject();
1358
+ return makeRequest({
1359
+ entityType: 'Extension',
1360
+ action: 'createWithId',
1361
+ params: {
1362
+ spaceId: raw.sys.space.sys.id,
1363
+ environmentId: raw.sys.id,
1364
+ extensionId: id,
1365
+ },
1366
+ payload: data,
1367
+ }).then((response) => wrapExtension(makeRequest, response));
1368
+ },
1369
+ /**
1370
+ * Creates an App Installation
1371
+ * @param appDefinitionId - AppDefinition ID
1372
+ * @param data - AppInstallation data
1373
+ * @param options.acceptAllTerms - Flag for accepting Apps' Marketplace EULA, Terms, and Privacy policy (need to pass `{acceptAllTerms: true}` to install a marketplace app)
1374
+ * @return Promise for an App Installation
1375
+ * @example ```javascript
1376
+ * const contentful = require('contentful-management')
1377
+ *
1378
+ * const client = contentful.createClient({
1379
+ * accessToken: '<content_management_api_key>'
1380
+ * })
1381
+ *
1382
+ * client.getSpace('<space_id>')
1383
+ * .then((space) => space.getEnvironment('<environment-id>'))
1384
+ * .then((environment) => environment.createAppInstallation('<app_definition_id>', {
1385
+ * parameters: {
1386
+ * someParameter: someValue
1387
+ * }
1388
+ * })
1389
+ * .then((appInstallation) => console.log(appInstallation))
1390
+ * .catch(console.error)
1391
+ * ```
1392
+ */
1393
+ createAppInstallation(appDefinitionId, data, { acceptAllTerms } = {}) {
1394
+ const raw = this.toPlainObject();
1395
+ return makeRequest({
1396
+ entityType: 'AppInstallation',
1397
+ action: 'upsert',
1398
+ params: {
1399
+ spaceId: raw.sys.space.sys.id,
1400
+ environmentId: raw.sys.id,
1401
+ appDefinitionId,
1402
+ acceptAllTerms,
1403
+ },
1404
+ payload: data,
1405
+ }).then((payload) => wrapAppInstallation(makeRequest, payload));
1406
+ },
1407
+ /**
1408
+ * Gets an App Installation
1409
+ * @param id - AppDefintion ID
1410
+ * @return Promise for an App Installation
1411
+ * @example ```javascript
1412
+ * const contentful = require('contentful-management')
1413
+ *
1414
+ * const client = contentful.createClient({
1415
+ * accessToken: '<content_management_api_key>'
1416
+ * })
1417
+ *
1418
+ * client.getSpace('<space_id>')
1419
+ * .then((space) => space.getEnvironment('<environment-id>'))
1420
+ * .then((environment) => environment.getAppInstallation('<app-definition-id>'))
1421
+ * .then((appInstallation) => console.log(appInstallation))
1422
+ * .catch(console.error)
1423
+ * ```
1424
+ */
1425
+ getAppInstallation(id) {
1426
+ const raw = this.toPlainObject();
1427
+ return makeRequest({
1428
+ entityType: 'AppInstallation',
1429
+ action: 'get',
1430
+ params: {
1431
+ spaceId: raw.sys.space.sys.id,
1432
+ environmentId: raw.sys.id,
1433
+ appDefinitionId: id,
1434
+ },
1435
+ }).then((data) => wrapAppInstallation(makeRequest, data));
1436
+ },
1437
+ /**
1438
+ * Gets a collection of App Installation
1439
+ * @return Promise for a collection of App Installations
1440
+ * @example ```javascript
1441
+ * const contentful = require('contentful-management')
1442
+ *
1443
+ * const client = contentful.createClient({
1444
+ * accessToken: '<content_management_api_key>'
1445
+ * })
1446
+ *
1447
+ * client.getSpace('<space_id>')
1448
+ * .then((space) => space.getEnvironment('<environment-id>'))
1449
+ * .then((environment) => environment.getAppInstallations()
1450
+ * .then((response) => console.log(response.items))
1451
+ * .catch(console.error)
1452
+ * ```
1453
+ */
1454
+ getAppInstallations() {
1455
+ const raw = this.toPlainObject();
1456
+ return makeRequest({
1457
+ entityType: 'AppInstallation',
1458
+ action: 'getMany',
1459
+ params: {
1460
+ spaceId: raw.sys.space.sys.id,
1461
+ environmentId: raw.sys.id,
1462
+ },
1463
+ }).then((data) => wrapAppInstallationCollection(makeRequest, data));
1464
+ },
1465
+ /**
1466
+ * Creates an app action call
1467
+ * @param appDefinitionId - AppDefinition ID
1468
+ * @param appActionId - action ID
1469
+ * @param data - App Action Call data
1470
+ * @return Promise for an App Action Call
1471
+ * @example ```javascript
1472
+ * const contentful = require('contentful-management')
1473
+ *
1474
+ * const client = contentful.createClient({
1475
+ * accessToken: '<content_management_api_key>'
1476
+ * })
1477
+ *
1478
+ * const data = {
1479
+ * headers: {
1480
+ * 'x-my-header': 'some-value'
1481
+ * },
1482
+ * body: {
1483
+ * 'some-body-value': true
1484
+ * }
1485
+ * }
1486
+ *
1487
+ * client.getSpace('<space_id>')
1488
+ * .then((space) => space.getEnvironment('<environment-id>'))
1489
+ * .then((environment) => environment.createAppActionCall('<app_definition_id>', '<action_id>', data)
1490
+ * .then((appActionCall) => console.log(appActionCall))
1491
+ * .catch(console.error)
1492
+ * ```
1493
+ */
1494
+ createAppActionCall(appDefinitionId, appActionId, data) {
1495
+ const raw = this.toPlainObject();
1496
+ return makeRequest({
1497
+ entityType: 'AppActionCall',
1498
+ action: 'create',
1499
+ params: {
1500
+ spaceId: raw.sys.space.sys.id,
1501
+ environmentId: raw.sys.id,
1502
+ appDefinitionId,
1503
+ appActionId,
1504
+ },
1505
+ payload: data,
1506
+ }).then((payload) => wrapAppActionCall(makeRequest, payload));
1507
+ },
1508
+ /**
1509
+ * Creates an app signed request
1510
+ * @param appDefinitionId - AppDefinition ID
1511
+ * @param data - SignedRequest data
1512
+ * @return Promise for a Signed Request
1513
+ * @example ```javascript
1514
+ * const contentful = require('contentful-management')
1515
+ *
1516
+ * const client = contentful.createClient({
1517
+ * accessToken: '<content_management_api_key>'
1518
+ * })
1519
+ *
1520
+ * const data = {
1521
+ * method: 'POST',
1522
+ * path: '/request_path',
1523
+ * body: '{ "key": "data" }',
1524
+ * headers: {
1525
+ * 'x-my-header': 'some-value'
1526
+ * },
1527
+ * }
1528
+ *
1529
+ * client.getSpace('<space_id>')
1530
+ * .then((space) => space.getEnvironment('<environment-id>'))
1531
+ * .then((environment) => environment.createAppSignedRequest('<app_definition_id>', data)
1532
+ * .then((signedRequest) => console.log(signedRequest))
1533
+ * .catch(console.error)
1534
+ * ```
1535
+ */
1536
+ createAppSignedRequest(appDefinitionId, data) {
1537
+ const raw = this.toPlainObject();
1538
+ return makeRequest({
1539
+ entityType: 'AppSignedRequest',
1540
+ action: 'create',
1541
+ params: {
1542
+ spaceId: raw.sys.space.sys.id,
1543
+ environmentId: raw.sys.id,
1544
+ appDefinitionId,
1545
+ },
1546
+ payload: data,
1547
+ }).then((payload) => wrapAppSignedRequest(makeRequest, payload));
1548
+ },
1549
+ /**
1550
+ * Creates an app access token
1551
+ * @param appDefinitionId - AppDefinition ID
1552
+ * @param data - Json Web Token
1553
+ * @return Promise for an app access token
1554
+ * @example ```javascript
1555
+ * const contentful = require('contentful-management')
1556
+ * const { sign } = require('jsonwebtoken')
1557
+ *
1558
+ * const signOptions = { algorithm: 'RS256', issuer: '<app_definition_id>', expiresIn: '10m' }
1559
+ *
1560
+ * const client = contentful.createClient({
1561
+ * accessToken: '<content_management_api_key>'
1562
+ * })
1563
+ *
1564
+ * const data = {
1565
+ * jwt: sign({}, '<private_key>', signOptions)
1566
+ * }
1567
+ *
1568
+ * client.getSpace('<space_id>')
1569
+ * .then((space) => space.getEnvironment('<environment-id>'))
1570
+ * .then((environment) => environment.createAppAccessToken('<app_definition_id>', data)
1571
+ * .then((appAccessToken) => console.log(appAccessToken))
1572
+ * .catch(console.error)
1573
+ * ```
1574
+ */
1575
+ createAppAccessToken(appDefinitionId, data) {
1576
+ const raw = this.toPlainObject();
1577
+ return makeRequest({
1578
+ entityType: 'AppAccessToken',
1579
+ action: 'create',
1580
+ params: {
1581
+ spaceId: raw.sys.space.sys.id,
1582
+ environmentId: raw.sys.id,
1583
+ appDefinitionId,
1584
+ },
1585
+ payload: data,
1586
+ }).then((payload) => wrapAppAccessToken(makeRequest, payload));
1587
+ },
1588
+ /**
1589
+ * Gets a collection of Functions for a given environment
1590
+ * @param appInstallationId
1591
+ * @param {import('../common-types').AcceptsQueryOptions} query - optional query parameter for filtering functions by action
1592
+ * @return Promise containing wrapped collection of Functions in an environment
1593
+ * @example ```javascript
1594
+ * const contentful = require('contentful-management')
1595
+ *
1596
+ * const client = contentful.createClient({
1597
+ * accessToken: '<content_management_api_key>'
1598
+ * })
1599
+ *
1600
+ * client
1601
+ * .getSpace('<space-id>')
1602
+ * .then((space) => space.getEnvironment('<environment-id>'))
1603
+ * .then((environment) => environment.getFunctionsForEnvironment('<app-installation-id>', { 'accepts[all]': '<action>' }))
1604
+ * .then((functions) => console.log(functions.items))
1605
+ * .catch(console.error)
1606
+ * ```
1607
+ */
1608
+ getFunctionsForEnvironment(appInstallationId, query) {
1609
+ const raw = this.toPlainObject();
1610
+ return makeRequest({
1611
+ entityType: 'Function',
1612
+ action: 'getManyForEnvironment',
1613
+ params: {
1614
+ spaceId: raw.sys.space.sys.id,
1615
+ environmentId: raw.sys.id,
1616
+ appInstallationId,
1617
+ query,
1618
+ },
1619
+ }).then((data) => wrapFunctionCollection(makeRequest, data));
1620
+ },
1621
+ /**
1622
+ * Gets a collection of FunctionLogs for a given app installation id and FunctionId
1623
+ * @param appInstallationId
1624
+ * @param functionId
1625
+ * @param {import('../common-types').CursorBasedParams} query - optional query parameter for pagination (limit, nextPage, prevPage)
1626
+ * @return Promise containing wrapped collection of FunctionLogs
1627
+ * * @example ```javascript
1628
+ * const contentful = require('contentful-management')
1629
+ *
1630
+ * const client = contentful.createClient({
1631
+ * accessToken: '<content_management_api_key>'
1632
+ * })
1633
+ *
1634
+ * client
1635
+ * .getSpace('<space-id>')
1636
+ * .then((space) => space.getEnvironment('<environment-id>'))
1637
+ * .then((environment) =>
1638
+ * environment.getFunctionLogs(
1639
+ * '<app-installation-id>',
1640
+ * '<function-id>',
1641
+ * {
1642
+ * query: {
1643
+ * // optional limit
1644
+ * limit: 10,
1645
+ * // optional interval query
1646
+ * 'sys.createdAt[gte]': start,
1647
+ * 'sys.createdAt[lt]': end,
1648
+ * // optional cursor based pagination parameters
1649
+ * pagePrev: '<page_prev>',
1650
+ * },
1651
+ * },
1652
+ * )
1653
+ * )
1654
+ * .then((functionLogs) => console.log(functionLog.items))
1655
+ * .catch(console.error)
1656
+ * ```
1657
+ */
1658
+ getFunctionLogs(appInstallationId, functionId, query) {
1659
+ const raw = this.toPlainObject();
1660
+ return makeRequest({
1661
+ entityType: 'FunctionLog',
1662
+ action: 'getMany',
1663
+ params: {
1664
+ spaceId: raw.sys.space.sys.id,
1665
+ environmentId: raw.sys.id,
1666
+ appInstallationId,
1667
+ functionId,
1668
+ query: query ? createRequestConfig({ query }).params : undefined,
1669
+ },
1670
+ }).then((data) => wrapFunctionLogCollection(makeRequest, data));
1671
+ },
1672
+ /**
1673
+ * Gets a FunctionLog by appInstallationId, functionId and logId
1674
+ * @param appInstallationId
1675
+ * @param functionId
1676
+ * @param logId
1677
+ * @return Promise containing a wrapped FunctionLog
1678
+ * @example ```javascript
1679
+ * const contentful = require('contentful-management')
1680
+ *
1681
+ * const client = contentful.createClient({
1682
+ * accessToken: '<content_management_api_key>'
1683
+ * })
1684
+ *
1685
+ * client
1686
+ * .getSpace(<space-id>)
1687
+ * .then((space) => space.getEnvironment('<environment-id>'))
1688
+ * .then((environment) =>
1689
+ * environment.getFunctionLog(
1690
+ * '<app-installation-id>',
1691
+ * '<function-id>',
1692
+ * '<log-id>'
1693
+ * )
1694
+ * )
1695
+ * .then((functionLog) => console.log(functionLog))
1696
+ * .catch(console.error)
1697
+ * ```
1698
+ */
1699
+ getFunctionLog(appInstallationId, functionId, logId) {
1700
+ const raw = this.toPlainObject();
1701
+ return makeRequest({
1702
+ entityType: 'FunctionLog',
1703
+ action: 'get',
1704
+ params: {
1705
+ spaceId: raw.sys.space.sys.id,
1706
+ environmentId: raw.sys.id,
1707
+ appInstallationId,
1708
+ functionId,
1709
+ logId,
1710
+ },
1711
+ }).then((data) => wrapFunctionLog(makeRequest, data));
1712
+ },
1713
+ /**
1714
+ * Gets all snapshots of an entry
1715
+ * @func getEntrySnapshots
1716
+ * @param entryId - Entry ID
1717
+ * @param query - query additional query paramaters
1718
+ * @return Promise for a collection of Entry Snapshots
1719
+ * @example ```javascript
1720
+ * const contentful = require('contentful-management')
1721
+ *
1722
+ * const client = contentful.createClient({
1723
+ * accessToken: '<content_management_api_key>'
1724
+ * })
1725
+ *
1726
+ * client.getSpace('<space_id>')
1727
+ * .then((space) => space.getEnvironment('<environment-id>'))
1728
+ * .then((environment) => environment.getEntrySnapshots('<entry_id>'))
1729
+ * .then((snapshots) => console.log(snapshots.items))
1730
+ * .catch(console.error)
1731
+ * ```
1732
+ */
1733
+ getEntrySnapshots(entryId, query = {}) {
1734
+ const raw = this.toPlainObject();
1735
+ return makeRequest({
1736
+ entityType: 'Snapshot',
1737
+ action: 'getManyForEntry',
1738
+ params: {
1739
+ spaceId: raw.sys.space.sys.id,
1740
+ environmentId: raw.sys.id,
1741
+ entryId,
1742
+ query,
1743
+ },
1744
+ }).then((data) => wrapSnapshotCollection(makeRequest, data));
1745
+ },
1746
+ /**
1747
+ * Gets all snapshots of a contentType
1748
+ * @func getContentTypeSnapshots
1749
+ * @param contentTypeId - Content Type ID
1750
+ * @param query - query additional query paramaters
1751
+ * @return Promise for a collection of Content Type Snapshots
1752
+ * @example ```javascript
1753
+ * const contentful = require('contentful-management')
1754
+ *
1755
+ * const client = contentful.createClient({
1756
+ * accessToken: '<content_management_api_key>'
1757
+ * })
1758
+ *
1759
+ * client.getSpace('<space_id>')
1760
+ * .then((space) => space.getEnvironment('<environment-id>'))
1761
+ * .then((environment) => environment.getContentTypeSnapshots('<contentTypeId>'))
1762
+ * .then((snapshots) => console.log(snapshots.items))
1763
+ * .catch(console.error)
1764
+ * ```
1765
+ */
1766
+ getContentTypeSnapshots(contentTypeId, query = {}) {
1767
+ const raw = this.toPlainObject();
1768
+ return makeRequest({
1769
+ entityType: 'Snapshot',
1770
+ action: 'getManyForContentType',
1771
+ params: {
1772
+ spaceId: raw.sys.space.sys.id,
1773
+ environmentId: raw.sys.id,
1774
+ contentTypeId,
1775
+ query,
1776
+ },
1777
+ }).then((data) => wrapSnapshotCollection(makeRequest, data));
1778
+ },
1779
+ createTag(id, name, visibility) {
1780
+ const raw = this.toPlainObject();
1781
+ return makeRequest({
1782
+ entityType: 'Tag',
1783
+ action: 'createWithId',
1784
+ params: {
1785
+ spaceId: raw.sys.space.sys.id,
1786
+ environmentId: raw.sys.id,
1787
+ tagId: id,
1788
+ },
1789
+ payload: {
1790
+ name,
1791
+ sys: { visibility: visibility !== null && visibility !== void 0 ? visibility : 'private' },
1792
+ },
1793
+ }).then((data) => wrapTag(makeRequest, data));
1794
+ },
1795
+ getTags(query = {}) {
1796
+ const raw = this.toPlainObject();
1797
+ return makeRequest({
1798
+ entityType: 'Tag',
1799
+ action: 'getMany',
1800
+ params: {
1801
+ spaceId: raw.sys.space.sys.id,
1802
+ environmentId: raw.sys.id,
1803
+ query: createRequestConfig({ query }).params,
1804
+ },
1805
+ }).then((data) => wrapTagCollection(makeRequest, data));
1806
+ },
1807
+ getTag(id) {
1808
+ const raw = this.toPlainObject();
1809
+ return makeRequest({
1810
+ entityType: 'Tag',
1811
+ action: 'get',
1812
+ params: {
1813
+ spaceId: raw.sys.space.sys.id,
1814
+ environmentId: raw.sys.id,
1815
+ tagId: id,
1816
+ },
1817
+ }).then((data) => wrapTag(makeRequest, data));
1818
+ },
1819
+ /**
1820
+ * Retrieves a Release by ID
1821
+ * @param releaseId
1822
+ * @returns Promise containing a wrapped Release
1823
+ * @example ```javascript
1824
+ * const contentful = require('contentful-management')
1825
+ *
1826
+ * const client = contentful.createClient({
1827
+ * accessToken: '<content_management_api_key>'
1828
+ * })
1829
+ *
1830
+ * client.getSpace('<space_id>')
1831
+ * .then((space) => space.getEnvironment('<environment-id>'))
1832
+ * .then((environment) => environment.getRelease('<release_id>'))
1833
+ * .then((release) => console.log(release))
1834
+ * .catch(console.error)
1835
+ * ```
1836
+ */
1837
+ getRelease(releaseId) {
1838
+ const raw = this.toPlainObject();
1839
+ return makeRequest({
1840
+ entityType: 'Release',
1841
+ action: 'get',
1842
+ params: {
1843
+ spaceId: raw.sys.space.sys.id,
1844
+ environmentId: raw.sys.id,
1845
+ releaseId,
1846
+ },
1847
+ }).then((data) => wrapRelease(makeRequest, data));
1848
+ },
1849
+ /**
1850
+ * Gets a Collection of Releases,
1851
+ * @param {ReleaseQueryOptions} query filtering options for the collection result
1852
+ * @returns Promise containing a wrapped Release Collection
1853
+ * @example ```javascript
1854
+ * const contentful = require('contentful-management')
1855
+ *
1856
+ * const client = contentful.createClient({
1857
+ * accessToken: '<content_management_api_key>'
1858
+ * })
1859
+ *
1860
+ * client.getSpace('<space_id>')
1861
+ * .then((space) => space.getEnvironment('<environment-id>'))
1862
+ * .then((environment) => environment.getReleases({ 'entities.sys.id[in]': '<asset_id>,<entry_id>' }))
1863
+ * .then((releases) => console.log(releases))
1864
+ * .catch(console.error)
1865
+ * ```
1866
+ */
1867
+ getReleases(query) {
1868
+ const raw = this.toPlainObject();
1869
+ return makeRequest({
1870
+ entityType: 'Release',
1871
+ action: 'query',
1872
+ params: {
1873
+ spaceId: raw.sys.space.sys.id,
1874
+ environmentId: raw.sys.id,
1875
+ query,
1876
+ },
1877
+ }).then((data) => wrapReleaseCollection(makeRequest, data));
1878
+ },
1879
+ /**
1880
+ * Creates a new Release with the entities and title in the payload
1881
+ * @param payload Object containing the payload in order to create a Release
1882
+ * @returns Promise containing a wrapped Release, that has other helper methods within.
1883
+ * @example ```javascript
1884
+ * const contentful = require('contentful-management')
1885
+ *
1886
+ * const client = contentful.createClient({
1887
+ * accessToken: '<content_management_api_key>'
1888
+ * })
1889
+ *
1890
+ * const payload = {
1891
+ * title: 'My Release',
1892
+ * entities: {
1893
+ * sys: { type: 'Array' },
1894
+ * items: [
1895
+ * { sys: { linkType: 'Entry', type: 'Link', id: '<entry_id>' } }
1896
+ * ]
1897
+ * }
1898
+ * }
1899
+ *
1900
+ * client.getSpace('<space_id>')
1901
+ * .then((space) => space.getEnvironment('<environment-id>'))
1902
+ * .then((environment) => environment.createRelease(payload))
1903
+ * .then((release) => console.log(release))
1904
+ * .catch(console.error)
1905
+ * ```
1906
+ */
1907
+ createRelease(payload) {
1908
+ const raw = this.toPlainObject();
1909
+ return makeRequest({
1910
+ entityType: 'Release',
1911
+ action: 'create',
1912
+ params: {
1913
+ spaceId: raw.sys.space.sys.id,
1914
+ environmentId: raw.sys.id,
1915
+ },
1916
+ payload,
1917
+ }).then((data) => wrapRelease(makeRequest, data));
1918
+ },
1919
+ /**
1920
+ * Updates a Release and replaces all the properties.
1921
+ * @param {object} options,
1922
+ * @param options.releaseId the ID of the release
1923
+ * @param options.payload the payload to be updated in the Release
1924
+ * @param options.version Release sys.version that to be updated
1925
+ * @returns Promise containing a wrapped Release, that has helper methods within.
1926
+ *
1927
+ * @example ```javascript
1928
+ * const contentful = require('contentful-management')
1929
+ *
1930
+ * const client = contentful.createClient({
1931
+ * accessToken: '<content_management_api_key>'
1932
+ * })
1933
+ *
1934
+ *
1935
+ * const payload = {
1936
+ * title: "Updated Release title",
1937
+ * entities: {
1938
+ * sys: { type: 'Array' },
1939
+ * items: [
1940
+ * { sys: { linkType: 'Entry', type: 'Link', id: '<entry_id>' } }
1941
+ * ]
1942
+ * }
1943
+ * }
1944
+ *
1945
+ * client.getSpace('<space_id>')
1946
+ * .then((space) => space.getEnvironment('<environment-id>'))
1947
+ * .then((environment) => environment.updateRelease({ releaseId: '<release_id>', version: 1, payload } ))
1948
+ * .then((release) => console.log(release))
1949
+ * .catch(console.error)
1950
+ * ```
1951
+ */
1952
+ updateRelease({ releaseId, payload, version, }) {
1953
+ const raw = this.toPlainObject();
1954
+ return makeRequest({
1955
+ entityType: 'Release',
1956
+ action: 'update',
1957
+ params: {
1958
+ spaceId: raw.sys.space.sys.id,
1959
+ environmentId: raw.sys.id,
1960
+ releaseId,
1961
+ version,
1962
+ },
1963
+ payload,
1964
+ }).then((data) => wrapRelease(makeRequest, data));
1965
+ },
1966
+ /**
1967
+ * Deletes a Release by ID - does not delete any entities.
1968
+ * @param releaseId the ID of the release
1969
+ *
1970
+ * @returns Promise containing a wrapped Release, that has helper methods within.
1971
+ * @example ```javascript
1972
+ * const contentful = require('contentful-management')
1973
+ *
1974
+ * const client = contentful.createClient({
1975
+ * accessToken: '<content_management_api_key>'
1976
+ * })
1977
+ *
1978
+ * client.getSpace('<space_id>')
1979
+ * .then((space) => space.getEnvironment('<environment-id>'))
1980
+ * .then((environment) => environment.deleteRelease('<release_id>')
1981
+ * .catch(console.error)
1982
+ * ```
1983
+ */
1984
+ deleteRelease(releaseId) {
1985
+ const raw = this.toPlainObject();
1986
+ return makeRequest({
1987
+ entityType: 'Release',
1988
+ action: 'delete',
1989
+ params: {
1990
+ spaceId: raw.sys.space.sys.id,
1991
+ environmentId: raw.sys.id,
1992
+ releaseId,
1993
+ },
1994
+ });
1995
+ },
1996
+ /**
1997
+ * Publishes all Entities contained in a Release.
1998
+ * @param options.releaseId the ID of the release
1999
+ * @param options.version the version of the release that is to be published
2000
+ * @returns Promise containing a wrapped Release, that has helper methods within.
2001
+ *
2002
+ * @example ```javascript
2003
+ * const contentful = require('contentful-management')
2004
+ *
2005
+ * const client = contentful.createClient({
2006
+ * accessToken: '<content_management_api_key>'
2007
+ * })
2008
+ *
2009
+ * client.getSpace('<space_id>')
2010
+ * .then((space) => space.getEnvironment('<environment-id>'))
2011
+ * .then((environment) => environment.publishRelease({ releaseId: '<release_id>', version: 1 }))
2012
+ * .catch(console.error)
2013
+ * ```
2014
+ */
2015
+ publishRelease({ releaseId, version }) {
2016
+ const raw = this.toPlainObject();
2017
+ return makeRequest({
2018
+ entityType: 'Release',
2019
+ action: 'publish',
2020
+ params: {
2021
+ spaceId: raw.sys.space.sys.id,
2022
+ environmentId: raw.sys.id,
2023
+ releaseId,
2024
+ version,
2025
+ },
2026
+ }).then((data) => wrapReleaseAction(makeRequest, data));
2027
+ },
2028
+ /**
2029
+ * Unpublishes all Entities contained in a Release.
2030
+ * @param options.releaseId the ID of the release
2031
+ * @param options.version the version of the release that is to be published
2032
+ * @returns Promise containing a wrapped Release, that has helper methods within.
2033
+ *
2034
+ * @example ```javascript
2035
+ * const contentful = require('contentful-management')
2036
+ *
2037
+ * const client = contentful.createClient({
2038
+ * accessToken: '<content_management_api_key>'
2039
+ * })
2040
+ *
2041
+ * client.getSpace('<space_id>')
2042
+ * .then((space) => space.getEnvironment('<environment-id>'))
2043
+ * .then((environment) => environment.unpublishRelease({ releaseId: '<release_id>', version: 1 }))
2044
+ * .catch(console.error)
2045
+ * ```
2046
+ */
2047
+ unpublishRelease({ releaseId, version }) {
2048
+ const raw = this.toPlainObject();
2049
+ return makeRequest({
2050
+ entityType: 'Release',
2051
+ action: 'unpublish',
2052
+ params: {
2053
+ spaceId: raw.sys.space.sys.id,
2054
+ environmentId: raw.sys.id,
2055
+ releaseId,
2056
+ version,
2057
+ },
2058
+ }).then((data) => wrapReleaseAction(makeRequest, data));
2059
+ },
2060
+ /**
2061
+ * Validates all Entities contained in a Release against an action (publish or unpublish)
2062
+ * @param options.releaseId the ID of the release
2063
+ * @param options.payload (optional) the type of action to be validated against
2064
+ *
2065
+ * @returns Promise containing a wrapped Release, that has helper methods within.
2066
+ *
2067
+ * @example ```javascript
2068
+ * const contentful = require('contentful-management')
2069
+ *
2070
+ * const client = contentful.createClient({
2071
+ * accessToken: '<content_management_api_key>'
2072
+ * })
2073
+ *
2074
+ * client.getSpace('<space_id>')
2075
+ * .then((space) => space.getEnvironment('<environment-id>'))
2076
+ * .then((environment) => environment.validateRelease({ releaseId: '<release_id>', payload: { action: 'unpublish' } }))
2077
+ * .catch(console.error)
2078
+ * ```
2079
+ */
2080
+ validateRelease({ releaseId, payload, }) {
2081
+ const raw = this.toPlainObject();
2082
+ return makeRequest({
2083
+ entityType: 'Release',
2084
+ action: 'validate',
2085
+ params: {
2086
+ spaceId: raw.sys.space.sys.id,
2087
+ environmentId: raw.sys.id,
2088
+ releaseId,
2089
+ },
2090
+ payload,
2091
+ }).then((data) => wrapReleaseAction(makeRequest, data));
2092
+ },
2093
+ /**
2094
+ * Archives a Release and prevents new operations (publishing, unpublishing adding new entities etc).
2095
+ * @param options.releaseId the ID of the release
2096
+ * @param options.version the version of the release that is to be archived
2097
+ * @returns Promise containing a wrapped Release, that has helper methods within.
2098
+ *
2099
+ * @example ```javascript
2100
+ * const contentful = require('contentful-management')
2101
+ *
2102
+ * const client = contentful.createClient({
2103
+ * accessToken: '<content_management_api_key>'
2104
+ * })
2105
+ *
2106
+ * client.getSpace('<space_id>')
2107
+ * .then((space) => space.getEnvironment('<environment-id>'))
2108
+ * .then((environment) => environment.archiveRelease({ releaseId: '<release_id>', version: 1 }))
2109
+ * .catch(console.error)
2110
+ * ```
2111
+ */
2112
+ archiveRelease({ releaseId, version }) {
2113
+ const raw = this.toPlainObject();
2114
+ return makeRequest({
2115
+ entityType: 'Release',
2116
+ action: 'archive',
2117
+ params: {
2118
+ spaceId: raw.sys.space.sys.id,
2119
+ environmentId: raw.sys.id,
2120
+ releaseId,
2121
+ version,
2122
+ },
2123
+ }).then((data) => wrapRelease(makeRequest, data));
2124
+ },
2125
+ /**
2126
+ * Unarchives a previously archived Release - this enables the release to be published, unpublished etc.
2127
+ * @param options.releaseId the ID of the release
2128
+ * @param options.version the version of the release that is to be unarchived
2129
+ * @returns Promise containing a wrapped Release, that has helper methods within.
2130
+ *
2131
+ * @example ```javascript
2132
+ * const contentful = require('contentful-management')
2133
+ *
2134
+ * const client = contentful.createClient({
2135
+ * accessToken: '<content_management_api_key>'
2136
+ * })
2137
+ *
2138
+ * client.getSpace('<space_id>')
2139
+ * .then((space) => space.getEnvironment('<environment-id>'))
2140
+ * .then((environment) => environment.unarchiveRelease({ releaseId: '<release_id>', version: 1 }))
2141
+ * .catch(console.error)
2142
+ * ```
2143
+ */
2144
+ unarchiveRelease({ releaseId, version }) {
2145
+ const raw = this.toPlainObject();
2146
+ return makeRequest({
2147
+ entityType: 'Release',
2148
+ action: 'unarchive',
2149
+ params: {
2150
+ spaceId: raw.sys.space.sys.id,
2151
+ environmentId: raw.sys.id,
2152
+ releaseId,
2153
+ version,
2154
+ },
2155
+ }).then((data) => wrapRelease(makeRequest, data));
2156
+ },
2157
+ /**
2158
+ * Retrieves a ReleaseAction by ID
2159
+ * @param params.releaseId The ID of a Release
2160
+ * @param params.actionId The ID of a Release Action
2161
+ * @returns Promise containing a wrapped ReleaseAction
2162
+ * @example ```javascript
2163
+ * const contentful = require('contentful-management')
2164
+ *
2165
+ * const client = contentful.createClient({
2166
+ * accessToken: '<content_management_api_key>'
2167
+ * })
2168
+ *
2169
+ * client.getSpace('<space_id>')
2170
+ * .then((space) => space.getEnvironment('<environment-id>'))
2171
+ * .then((environment) => environment.getReleaseAction({ releaseId: '<release_id>', actionId: '<action_id>' }))
2172
+ * .then((releaseAction) => console.log(releaseAction))
2173
+ * .catch(console.error)
2174
+ * ```
2175
+ */
2176
+ getReleaseAction({ actionId, releaseId }) {
2177
+ const raw = this.toPlainObject();
2178
+ return makeRequest({
2179
+ entityType: 'ReleaseAction',
2180
+ action: 'get',
2181
+ params: {
2182
+ actionId,
2183
+ spaceId: raw.sys.space.sys.id,
2184
+ environmentId: raw.sys.id,
2185
+ releaseId,
2186
+ },
2187
+ }).then((data) => wrapReleaseAction(makeRequest, data));
2188
+ },
2189
+ /**
2190
+ * Gets a Collection of ReleaseActions
2191
+ * @param {string} params.releaseId ID of the Release to fetch the actions from
2192
+ * @param {ReleaseQueryOptions} params.query filtering options for the collection result
2193
+ * @returns Promise containing a wrapped ReleaseAction Collection
2194
+ *
2195
+ * @example ```javascript
2196
+ * const contentful = require('contentful-management')
2197
+ *
2198
+ * const client = contentful.createClient({
2199
+ * accessToken: '<content_management_api_key>'
2200
+ * })
2201
+ *
2202
+ * client.getSpace('<space_id>')
2203
+ * .then((space) => space.getEnvironment('<environment-id>'))
2204
+ * .then((environment) => environment.getReleaseActions({ query: { 'sys.id[in]': '<id_1>,<id_2>', 'sys.release.sys.id[in]': '<id1>,<id2>' } }))
2205
+ * .then((releaseActions) => console.log(releaseActions))
2206
+ * .catch(console.error)
2207
+ * ```
2208
+ */
2209
+ getReleaseActions({ query }) {
2210
+ const raw = this.toPlainObject();
2211
+ return makeRequest({
2212
+ entityType: 'ReleaseAction',
2213
+ action: 'getMany',
2214
+ params: {
2215
+ spaceId: raw.sys.space.sys.id,
2216
+ environmentId: raw.sys.id,
2217
+ query,
2218
+ },
2219
+ }).then((data) => wrapReleaseActionCollection(makeRequest, data));
2220
+ },
2221
+ async getUIConfig() {
2222
+ const raw = this.toPlainObject();
2223
+ const data = await makeRequest({
2224
+ entityType: 'UIConfig',
2225
+ action: 'get',
2226
+ params: {
2227
+ spaceId: raw.sys.space.sys.id,
2228
+ environmentId: raw.sys.id,
2229
+ },
2230
+ });
2231
+ return wrapUIConfig(makeRequest, data);
2232
+ },
2233
+ async getUserUIConfig() {
2234
+ const raw = this.toPlainObject();
2235
+ const data = await makeRequest({
2236
+ entityType: 'UserUIConfig',
2237
+ action: 'get',
2238
+ params: {
2239
+ spaceId: raw.sys.space.sys.id,
2240
+ environmentId: raw.sys.id,
2241
+ },
2242
+ });
2243
+ return wrapUserUIConfig(makeRequest, data);
2244
+ },
2245
+ /**
2246
+ * Gets a collection of all environment template installations in the environment for a given template
2247
+ * @param environmentTemplateId - Environment template ID to return installations for
2248
+ * @param [options.installationId] - Installation ID to filter for a specific installation
2249
+ * @return Promise for a collection of EnvironmentTemplateInstallations
2250
+ * ```javascript
2251
+ * const contentful = require('contentful-management')
2252
+ *
2253
+ * const client = contentful.createClient({
2254
+ * accessToken: '<content_management_api_key>'
2255
+ * })
2256
+ *
2257
+ * client.getSpace('<space_id>')
2258
+ * .then((space) => space.getEnvironment('<environment_id>'))
2259
+ * .then((environment) => environment.getEnvironmentTemplateInstallations('<environment_template_id>'))
2260
+ * .then((installations) => console.log(installations.items))
2261
+ * .catch(console.error)
2262
+ * ```
2263
+ */
2264
+ async getEnvironmentTemplateInstallations(environmentTemplateId, _a = {}) {
2265
+ var { installationId } = _a, query = __rest(_a, ["installationId"]);
2266
+ const raw = this.toPlainObject();
2267
+ return makeRequest({
2268
+ entityType: 'EnvironmentTemplateInstallation',
2269
+ action: 'getForEnvironment',
2270
+ params: Object.assign(Object.assign({ environmentTemplateId }, (installationId && { installationId })), { query: Object.assign({}, createRequestConfig({ query }).params), spaceId: raw.sys.space.sys.id, environmentId: raw.sys.id }),
2271
+ }).then((data) => wrapEnvironmentTemplateInstallationCollection(makeRequest, data));
2272
+ },
2273
+ /**
2274
+ * Gets a collection of all resource types based on native external references app installations in the environment
2275
+ * @param query - BasicCursorPaginationOptions
2276
+ * @return Promise for a collection of ResourceTypes
2277
+ * ```javascript
2278
+ * const contentful = require('contentful-management')
2279
+ *
2280
+ * const client = contentful.createClient({
2281
+ * accessToken: '<content_management_api_key>'
2282
+ * })
2283
+ *
2284
+ * client.getSpace('<space_id>')
2285
+ * .then((space) => space.getEnvironment('<environment_id>'))
2286
+ * .then((environment) => environment.getResourceTypes({limit: 10}))
2287
+ * .then((installations) => console.log(installations.items))
2288
+ * .catch(console.error)
2289
+ * ```
2290
+ */
2291
+ async getResourceTypes(query) {
2292
+ const raw = this.toPlainObject();
2293
+ return makeRequest({
2294
+ entityType: 'ResourceType',
2295
+ action: 'getForEnvironment',
2296
+ params: {
2297
+ query,
2298
+ spaceId: raw.sys.space.sys.id,
2299
+ environmentId: raw.sys.id,
2300
+ },
2301
+ }).then((data) => wrapResourceTypesForEnvironmentCollection(makeRequest, data));
2302
+ },
2303
+ /**
2304
+ * Gets a collection of all resources for a given resource type based on native external references app installations in the environment
2305
+ * @param resourceTypeId - Id of the resourceType to get its resources
2306
+ * @param query - Either LookupQuery options with 'sys.urn[in]' param or a Search query with 'query' param, in both cases you can add pagination options
2307
+ * @return Promise for a collection of Resources for a given resourceTypeId
2308
+ * ```javascript
2309
+ * const contentful = require('contentful-management')
2310
+ *
2311
+ * const client = contentful.createClient({
2312
+ * accessToken: '<content_management_api_key>'
2313
+ * })
2314
+ *
2315
+ * // Search Query
2316
+ * client.getSpace('<space_id>')
2317
+ * .then((space) => space.getEnvironment('<environment_id>'))
2318
+ * // <search_query> is a string you want to search for in the external resources
2319
+ * .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {query: '<search_query>', limit: 10}))
2320
+ * .then((installations) => console.log(installations.items))
2321
+ * .catch(console.error)
2322
+ *
2323
+ * // Lookup query
2324
+ *
2325
+ * client.getSpace('<space_id>')
2326
+ * .then((space) => space.getEnvironment('<environment_id>'))
2327
+ * .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {'sys.urn[in]': '<resource_urn1>,<resource_urn2>', limit: 10}))
2328
+ * .then((installations) => console.log(installations.items))
2329
+ * .catch(console.error)
2330
+ * ```
2331
+ */
2332
+ async getResourcesForResourceType(resourceTypeId, query) {
2333
+ const raw = this.toPlainObject();
2334
+ return makeRequest({
2335
+ entityType: 'Resource',
2336
+ action: 'getMany',
2337
+ params: {
2338
+ query,
2339
+ spaceId: raw.sys.space.sys.id,
2340
+ environmentId: raw.sys.id,
2341
+ resourceTypeId,
2342
+ },
2343
+ }).then((data) => wrapResourceCollection(makeRequest, data));
2344
+ },
2345
+ /**
2346
+ * Invokes an AI Action.
2347
+ * @param aiActionId - The ID of the AI Action to invoke.
2348
+ * @param payload - The invocation payload.
2349
+ * @returns Promise for an AI Action Invocation.
2350
+ * @example ```javascript
2351
+ * client.getSpace('<space_id>')
2352
+ * .then(space => space.getEnvironment('<environment_id>'))
2353
+ * .then(environment => environment.invokeAiAction('<ai_action_id>', {
2354
+ * variables: [ ... ],
2355
+ * outputFormat: 'RichText'
2356
+ * }))
2357
+ * .then(invocation => console.log(invocation))
2358
+ * .catch(console.error)
2359
+ * ```
2360
+ */
2361
+ invokeAiAction(aiActionId, payload) {
2362
+ const raw = this.toPlainObject();
2363
+ return makeRequest({
2364
+ entityType: 'AiAction',
2365
+ action: 'invoke',
2366
+ params: { spaceId: raw.sys.space.sys.id, environmentId: raw.sys.id, aiActionId },
2367
+ payload,
2368
+ }).then((data) => wrapAiActionInvocation(makeRequest, data));
2369
+ },
2370
+ /**
2371
+ * Retrieves an AI Action Invocation.
2372
+ * @param params - Object containing the AI Action ID and the Invocation ID.
2373
+ * @returns Promise for an AI Action Invocation.
2374
+ * @example ```javascript
2375
+ * client.getSpace('<space_id>')
2376
+ * .then(space => space.getEnvironment('<environment_id>'))
2377
+ * .then(environment => environment.getAiActionInvocation({
2378
+ * aiActionId: '<ai_action_id>',
2379
+ * invocationId: '<invocation_id>'
2380
+ * }))
2381
+ * .then(invocation => console.log(invocation))
2382
+ * .catch(console.error)
2383
+ * ```
2384
+ */
2385
+ getAiActionInvocation({ aiActionId, invocationId, }) {
2386
+ const raw = this.toPlainObject();
2387
+ return makeRequest({
2388
+ entityType: 'AiActionInvocation',
2389
+ action: 'get',
2390
+ params: {
2391
+ spaceId: raw.sys.space.sys.id,
2392
+ environmentId: raw.sys.id,
2393
+ aiActionId,
2394
+ invocationId,
2395
+ },
2396
+ }).then((data) => wrapAiActionInvocation(makeRequest, data));
2397
+ },
2398
+ };
2399
+ }
2400
+
2401
+ export { createEnvironmentApi as default };