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