contentful-management 11.48.3 → 11.49.0-beta.2

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