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.
- package/README.md +73 -48
- package/dist/contentful-management.browser.js +23430 -27836
- package/dist/contentful-management.browser.min.js +1 -2
- package/dist/contentful-management.cjs +36550 -0
- package/dist/{es-modules → esm}/adapters/REST/endpoints/access-token.js +20 -22
- package/dist/esm/adapters/REST/endpoints/api-key.js +41 -0
- package/dist/esm/adapters/REST/endpoints/app-access-token.js +7 -0
- package/dist/esm/adapters/REST/endpoints/app-action-call.js +61 -0
- package/dist/esm/adapters/REST/endpoints/app-action.js +35 -0
- package/dist/esm/adapters/REST/endpoints/app-bundle.js +34 -0
- package/dist/esm/adapters/REST/endpoints/app-definition.js +39 -0
- package/dist/esm/adapters/REST/endpoints/app-details.js +13 -0
- package/dist/esm/adapters/REST/endpoints/app-event-subscription.js +13 -0
- package/dist/esm/adapters/REST/endpoints/app-installation.js +35 -0
- package/dist/esm/adapters/REST/endpoints/app-key.js +16 -0
- package/dist/esm/adapters/REST/endpoints/app-signed-request.js +7 -0
- package/dist/esm/adapters/REST/endpoints/app-signing-secret.js +13 -0
- package/dist/esm/adapters/REST/endpoints/app-upload.js +24 -0
- package/dist/esm/adapters/REST/endpoints/asset-key.js +31 -0
- package/dist/esm/adapters/REST/endpoints/asset.js +170 -0
- package/dist/esm/adapters/REST/endpoints/bulk-action.js +16 -0
- package/dist/esm/adapters/REST/endpoints/comment.js +85 -0
- package/dist/esm/adapters/REST/endpoints/concept-scheme.js +40 -0
- package/dist/esm/adapters/REST/endpoints/concept.js +59 -0
- package/dist/esm/adapters/REST/endpoints/content-type.js +47 -0
- package/dist/esm/adapters/REST/endpoints/editor-interface.js +20 -0
- package/dist/esm/adapters/REST/endpoints/entry.js +90 -0
- package/dist/esm/adapters/REST/endpoints/environment-alias.js +38 -0
- package/dist/esm/adapters/REST/endpoints/environment-template-installation.js +20 -0
- package/dist/esm/adapters/REST/endpoints/environment-template.js +38 -0
- package/dist/esm/adapters/REST/endpoints/environment.js +40 -0
- package/dist/esm/adapters/REST/endpoints/extension.js +36 -0
- package/dist/esm/adapters/REST/endpoints/function-log.js +20 -0
- package/dist/esm/adapters/REST/endpoints/function.js +21 -0
- package/dist/esm/adapters/REST/endpoints/http.js +22 -0
- package/dist/esm/adapters/REST/endpoints/index.js +133 -0
- package/dist/esm/adapters/REST/endpoints/locale.js +31 -0
- package/dist/{es-modules → esm}/adapters/REST/endpoints/oauth-application.js +21 -22
- package/dist/esm/adapters/REST/endpoints/organization-invitation.js +20 -0
- package/dist/esm/adapters/REST/endpoints/organization-membership.js +27 -0
- package/dist/esm/adapters/REST/endpoints/organization.js +25 -0
- package/dist/esm/adapters/REST/endpoints/personal-access-token.js +32 -0
- package/dist/esm/adapters/REST/endpoints/preview-api-key.js +12 -0
- package/dist/esm/adapters/REST/endpoints/raw.js +37 -0
- package/dist/esm/adapters/REST/endpoints/release-action.js +17 -0
- package/dist/esm/adapters/REST/endpoints/release.js +50 -0
- package/dist/esm/adapters/REST/endpoints/resource-provider.js +14 -0
- package/dist/esm/adapters/REST/endpoints/resource-type.js +24 -0
- package/dist/esm/adapters/REST/endpoints/resource.js +8 -0
- package/dist/esm/adapters/REST/endpoints/role.js +40 -0
- package/dist/esm/adapters/REST/endpoints/scheduled-action.js +38 -0
- package/dist/esm/adapters/REST/endpoints/snapshot.js +25 -0
- package/dist/esm/adapters/REST/endpoints/space-member.js +8 -0
- package/dist/esm/adapters/REST/endpoints/space-membership.js +51 -0
- package/dist/esm/adapters/REST/endpoints/space.js +27 -0
- package/dist/esm/adapters/REST/endpoints/tag.js +31 -0
- package/dist/esm/adapters/REST/endpoints/task.js +33 -0
- package/dist/esm/adapters/REST/endpoints/team-membership.js +28 -0
- package/dist/esm/adapters/REST/endpoints/team-space-membership.js +38 -0
- package/dist/esm/adapters/REST/endpoints/team.js +29 -0
- package/dist/esm/adapters/REST/endpoints/ui-config.js +19 -0
- package/dist/esm/adapters/REST/endpoints/upload-credentials.js +14 -0
- package/dist/esm/adapters/REST/endpoints/upload.js +38 -0
- package/dist/esm/adapters/REST/endpoints/usage.js +14 -0
- package/dist/esm/adapters/REST/endpoints/user-ui-config.js +19 -0
- package/dist/esm/adapters/REST/endpoints/user.js +21 -0
- package/dist/esm/adapters/REST/endpoints/utils.js +17 -0
- package/dist/esm/adapters/REST/endpoints/webhook.js +82 -0
- package/dist/esm/adapters/REST/endpoints/workflow-definition.js +35 -0
- package/dist/esm/adapters/REST/endpoints/workflow.js +42 -0
- package/dist/esm/adapters/REST/endpoints/workflows-changelog.js +9 -0
- package/dist/esm/adapters/REST/make-request.js +17 -0
- package/dist/esm/adapters/REST/rest-adapter.js +30 -0
- package/dist/esm/common-types.js +6 -0
- package/dist/esm/common-utils.js +32 -0
- package/dist/esm/constants/editor-interface-defaults/controls-defaults.js +153 -0
- package/dist/esm/constants/editor-interface-defaults/editors-defaults.js +37 -0
- package/dist/esm/constants/editor-interface-defaults/index.js +12 -0
- package/dist/esm/constants/editor-interface-defaults/sidebar-defaults.js +68 -0
- package/dist/esm/constants/editor-interface-defaults/types.js +15 -0
- package/dist/esm/create-adapter.js +19 -0
- package/dist/esm/create-app-definition-api.js +252 -0
- package/dist/esm/create-contentful-api.js +590 -0
- package/dist/esm/create-entry-api.js +479 -0
- package/dist/esm/create-environment-api.js +2347 -0
- package/dist/esm/create-environment-template-api.js +268 -0
- package/dist/esm/create-organization-api.js +1134 -0
- package/dist/esm/create-space-api.js +1436 -0
- package/dist/esm/create-ui-config-api.js +53 -0
- package/dist/esm/create-user-ui-config-api.js +53 -0
- package/dist/{es-modules → esm}/enhance-with-methods.js +13 -11
- package/dist/esm/entities/access-token.js +33 -0
- package/dist/esm/entities/api-key.js +56 -0
- package/dist/esm/entities/app-access-token.js +15 -0
- package/dist/esm/entities/app-action-call.js +61 -0
- package/dist/esm/entities/app-action.js +45 -0
- package/dist/esm/entities/app-bundle.js +45 -0
- package/dist/esm/entities/app-definition.js +26 -0
- package/dist/esm/entities/app-details.js +37 -0
- package/dist/esm/entities/app-event-subscription.js +32 -0
- package/dist/esm/entities/app-installation.js +52 -0
- package/dist/esm/entities/app-key.js +41 -0
- package/dist/{es-modules → esm}/entities/app-signed-request.js +7 -4
- package/dist/esm/entities/app-signing-secret.js +32 -0
- package/dist/esm/entities/app-upload.js +44 -0
- package/dist/{es-modules → esm}/entities/asset-key.js +7 -4
- package/dist/esm/entities/asset.js +121 -0
- package/dist/esm/entities/bulk-action.js +58 -0
- package/dist/esm/entities/comment.js +57 -0
- package/dist/esm/entities/concept-scheme.js +1 -0
- package/dist/esm/entities/concept.js +1 -0
- package/dist/esm/entities/content-type.js +117 -0
- package/dist/esm/entities/editor-interface.js +47 -0
- package/dist/esm/entities/entry.js +24 -0
- package/dist/esm/entities/environment-alias.js +55 -0
- package/dist/esm/entities/environment-template-installation.js +20 -0
- package/dist/esm/entities/environment-template.js +15 -0
- package/dist/esm/entities/environment.js +31 -0
- package/dist/esm/entities/extension.js +51 -0
- package/dist/{es-modules → esm}/entities/function-log.js +9 -7
- package/dist/esm/entities/function.js +63 -0
- package/dist/esm/entities/index.js +125 -0
- package/dist/esm/entities/locale.js +54 -0
- package/dist/esm/entities/oauth-application.js +63 -0
- package/dist/esm/entities/organization-invitation.js +15 -0
- package/dist/esm/entities/organization-membership.js +50 -0
- package/dist/esm/entities/organization.js +29 -0
- package/dist/esm/entities/personal-access-token.js +33 -0
- package/dist/esm/entities/preview-api-key.js +28 -0
- package/dist/esm/entities/release-action.js +52 -0
- package/dist/esm/entities/release.js +107 -0
- package/dist/esm/entities/resource-provider.js +137 -0
- package/dist/esm/entities/resource-type.js +94 -0
- package/dist/esm/entities/resource.js +10 -0
- package/dist/esm/entities/role.js +50 -0
- package/dist/esm/entities/scheduled-action.js +148 -0
- package/dist/esm/entities/snapshot.js +33 -0
- package/dist/esm/entities/space-member.js +20 -0
- package/dist/esm/entities/space-membership.js +50 -0
- package/dist/esm/entities/space.js +30 -0
- package/dist/esm/entities/tag.js +50 -0
- package/dist/esm/entities/task.js +51 -0
- package/dist/esm/entities/team-membership.js +51 -0
- package/dist/esm/entities/team-space-membership.js +50 -0
- package/dist/esm/entities/team.js +50 -0
- package/dist/esm/entities/ui-config.js +18 -0
- package/dist/esm/entities/upload.js +36 -0
- package/dist/esm/entities/usage.js +22 -0
- package/dist/esm/entities/user-ui-config.js +18 -0
- package/dist/esm/entities/user.js +25 -0
- package/dist/esm/entities/webhook.js +74 -0
- package/dist/esm/entities/workflow-definition.js +73 -0
- package/dist/esm/index.js +36 -0
- package/dist/esm/methods/action.js +49 -0
- package/dist/esm/methods/content-type.js +49 -0
- package/dist/esm/methods/utils.js +9 -0
- package/dist/esm/plain/as-iterator.js +30 -0
- package/dist/esm/plain/checks.js +10 -0
- package/dist/esm/plain/pagination-helper.js +54 -0
- package/dist/esm/plain/plain-client.js +503 -0
- package/dist/esm/plain/wrappers/wrap.js +24 -0
- package/dist/esm/upload-http-client.js +15 -0
- package/dist/stats-browser-min.html +4842 -0
- package/dist/{typings → types}/create-contentful-api.d.ts +1 -0
- package/dist/{typings → types}/create-environment-api.d.ts +2 -2
- package/dist/{typings → types}/create-ui-config-api.d.ts +1 -1
- package/dist/{typings → types}/create-user-ui-config-api.d.ts +1 -1
- package/dist/{typings → types}/entities/ui-config.d.ts +1 -1
- package/dist/{typings → types}/entities/user-ui-config.d.ts +1 -1
- package/dist/{typings/contentful-management.d.ts → types/index.d.ts} +1 -1
- package/dist/{typings → types}/plain/common-types.d.ts +1 -0
- package/package.json +49 -45
- package/dist/contentful-management.browser.js.map +0 -1
- package/dist/contentful-management.node.js +0 -32061
- package/dist/contentful-management.node.js.map +0 -1
- package/dist/contentful-management.node.min.js +0 -2
- package/dist/es-modules/adapters/REST/endpoints/api-key.js +0 -47
- package/dist/es-modules/adapters/REST/endpoints/app-access-token.js +0 -8
- package/dist/es-modules/adapters/REST/endpoints/app-action-call.js +0 -69
- package/dist/es-modules/adapters/REST/endpoints/app-action.js +0 -32
- package/dist/es-modules/adapters/REST/endpoints/app-bundle.js +0 -36
- package/dist/es-modules/adapters/REST/endpoints/app-definition.js +0 -45
- package/dist/es-modules/adapters/REST/endpoints/app-details.js +0 -10
- package/dist/es-modules/adapters/REST/endpoints/app-event-subscription.js +0 -10
- package/dist/es-modules/adapters/REST/endpoints/app-installation.js +0 -39
- package/dist/es-modules/adapters/REST/endpoints/app-key.js +0 -13
- package/dist/es-modules/adapters/REST/endpoints/app-signed-request.js +0 -4
- package/dist/es-modules/adapters/REST/endpoints/app-signing-secret.js +0 -10
- package/dist/es-modules/adapters/REST/endpoints/app-upload.js +0 -23
- package/dist/es-modules/adapters/REST/endpoints/asset-key.js +0 -33
- package/dist/es-modules/adapters/REST/endpoints/asset.js +0 -220
- package/dist/es-modules/adapters/REST/endpoints/bulk-action.js +0 -13
- package/dist/es-modules/adapters/REST/endpoints/comment.js +0 -101
- package/dist/es-modules/adapters/REST/endpoints/concept-scheme.js +0 -52
- package/dist/es-modules/adapters/REST/endpoints/concept.js +0 -85
- package/dist/es-modules/adapters/REST/endpoints/content-type.js +0 -61
- package/dist/es-modules/adapters/REST/endpoints/editor-interface.js +0 -24
- package/dist/es-modules/adapters/REST/endpoints/entry.js +0 -113
- package/dist/es-modules/adapters/REST/endpoints/environment-alias.js +0 -46
- package/dist/es-modules/adapters/REST/endpoints/environment-template-installation.js +0 -43
- package/dist/es-modules/adapters/REST/endpoints/environment-template.js +0 -88
- package/dist/es-modules/adapters/REST/endpoints/environment.js +0 -42
- package/dist/es-modules/adapters/REST/endpoints/extension.js +0 -44
- package/dist/es-modules/adapters/REST/endpoints/function-log.js +0 -22
- package/dist/es-modules/adapters/REST/endpoints/function.js +0 -20
- package/dist/es-modules/adapters/REST/endpoints/http.js +0 -39
- package/dist/es-modules/adapters/REST/endpoints/index.js +0 -130
- package/dist/es-modules/adapters/REST/endpoints/locale.js +0 -35
- package/dist/es-modules/adapters/REST/endpoints/organization-invitation.js +0 -22
- package/dist/es-modules/adapters/REST/endpoints/organization-membership.js +0 -35
- package/dist/es-modules/adapters/REST/endpoints/organization.js +0 -26
- package/dist/es-modules/adapters/REST/endpoints/personal-access-token.js +0 -33
- package/dist/es-modules/adapters/REST/endpoints/preview-api-key.js +0 -9
- package/dist/es-modules/adapters/REST/endpoints/raw.js +0 -42
- package/dist/es-modules/adapters/REST/endpoints/release-action.js +0 -21
- package/dist/es-modules/adapters/REST/endpoints/release.js +0 -58
- package/dist/es-modules/adapters/REST/endpoints/resource-provider.js +0 -13
- package/dist/es-modules/adapters/REST/endpoints/resource-type.js +0 -23
- package/dist/es-modules/adapters/REST/endpoints/resource.js +0 -5
- package/dist/es-modules/adapters/REST/endpoints/role.js +0 -44
- package/dist/es-modules/adapters/REST/endpoints/scheduled-action.js +0 -35
- package/dist/es-modules/adapters/REST/endpoints/snapshot.js +0 -22
- package/dist/es-modules/adapters/REST/endpoints/space-member.js +0 -5
- package/dist/es-modules/adapters/REST/endpoints/space-membership.js +0 -55
- package/dist/es-modules/adapters/REST/endpoints/space.js +0 -32
- package/dist/es-modules/adapters/REST/endpoints/tag.js +0 -46
- package/dist/es-modules/adapters/REST/endpoints/task.js +0 -47
- package/dist/es-modules/adapters/REST/endpoints/team-membership.js +0 -34
- package/dist/es-modules/adapters/REST/endpoints/team-space-membership.js +0 -45
- package/dist/es-modules/adapters/REST/endpoints/team.js +0 -35
- package/dist/es-modules/adapters/REST/endpoints/ui-config.js +0 -16
- package/dist/es-modules/adapters/REST/endpoints/upload-credentials.js +0 -11
- package/dist/es-modules/adapters/REST/endpoints/upload.js +0 -37
- package/dist/es-modules/adapters/REST/endpoints/usage.js +0 -11
- package/dist/es-modules/adapters/REST/endpoints/user-ui-config.js +0 -16
- package/dist/es-modules/adapters/REST/endpoints/user.js +0 -20
- package/dist/es-modules/adapters/REST/endpoints/utils.js +0 -28
- package/dist/es-modules/adapters/REST/endpoints/webhook.js +0 -93
- package/dist/es-modules/adapters/REST/endpoints/workflow-definition.js +0 -46
- package/dist/es-modules/adapters/REST/endpoints/workflow.js +0 -59
- package/dist/es-modules/adapters/REST/endpoints/workflows-changelog.js +0 -6
- package/dist/es-modules/adapters/REST/make-request.js +0 -28
- package/dist/es-modules/adapters/REST/rest-adapter.js +0 -42
- package/dist/es-modules/adapters/REST/types.js +0 -1
- package/dist/es-modules/common-types.js +0 -61
- package/dist/es-modules/common-utils.js +0 -30
- package/dist/es-modules/constants/editor-interface-defaults/controls-defaults.js +0 -255
- package/dist/es-modules/constants/editor-interface-defaults/editors-defaults.js +0 -34
- package/dist/es-modules/constants/editor-interface-defaults/index.js +0 -9
- package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +0 -57
- package/dist/es-modules/constants/editor-interface-defaults/types.js +0 -14
- package/dist/es-modules/contentful-management.js +0 -66
- package/dist/es-modules/create-adapter.js +0 -16
- package/dist/es-modules/create-app-definition-api.js +0 -263
- package/dist/es-modules/create-contentful-api.js +0 -663
- package/dist/es-modules/create-entry-api.js +0 -548
- package/dist/es-modules/create-environment-api.js +0 -2464
- package/dist/es-modules/create-environment-template-api.js +0 -316
- package/dist/es-modules/create-organization-api.js +0 -1306
- package/dist/es-modules/create-space-api.js +0 -1565
- package/dist/es-modules/create-ui-config-api.js +0 -60
- package/dist/es-modules/create-user-ui-config-api.js +0 -60
- package/dist/es-modules/entities/access-token.js +0 -38
- package/dist/es-modules/entities/api-key.js +0 -55
- package/dist/es-modules/entities/app-access-token.js +0 -12
- package/dist/es-modules/entities/app-action-call.js +0 -70
- package/dist/es-modules/entities/app-action.js +0 -53
- package/dist/es-modules/entities/app-bundle.js +0 -44
- package/dist/es-modules/entities/app-definition.js +0 -24
- package/dist/es-modules/entities/app-details.js +0 -35
- package/dist/es-modules/entities/app-event-subscription.js +0 -30
- package/dist/es-modules/entities/app-installation.js +0 -51
- package/dist/es-modules/entities/app-key.js +0 -40
- package/dist/es-modules/entities/app-signing-secret.js +0 -30
- package/dist/es-modules/entities/app-upload.js +0 -43
- package/dist/es-modules/entities/asset.js +0 -131
- package/dist/es-modules/entities/bulk-action.js +0 -61
- package/dist/es-modules/entities/comment.js +0 -77
- package/dist/es-modules/entities/concept-scheme.js +0 -1
- package/dist/es-modules/entities/concept.js +0 -1
- package/dist/es-modules/entities/content-type-fields.js +0 -1
- package/dist/es-modules/entities/content-type.js +0 -146
- package/dist/es-modules/entities/editor-interface.js +0 -46
- package/dist/es-modules/entities/entry.js +0 -22
- package/dist/es-modules/entities/environment-alias.js +0 -54
- package/dist/es-modules/entities/environment-template-installation.js +0 -17
- package/dist/es-modules/entities/environment-template.js +0 -12
- package/dist/es-modules/entities/environment.js +0 -29
- package/dist/es-modules/entities/extension.js +0 -50
- package/dist/es-modules/entities/field-type.js +0 -1
- package/dist/es-modules/entities/function.js +0 -61
- package/dist/es-modules/entities/index.js +0 -122
- package/dist/es-modules/entities/locale.js +0 -53
- package/dist/es-modules/entities/oauth-application.js +0 -62
- package/dist/es-modules/entities/organization-invitation.js +0 -12
- package/dist/es-modules/entities/organization-membership.js +0 -49
- package/dist/es-modules/entities/organization.js +0 -32
- package/dist/es-modules/entities/personal-access-token.js +0 -38
- package/dist/es-modules/entities/preview-api-key.js +0 -27
- package/dist/es-modules/entities/release-action.js +0 -53
- package/dist/es-modules/entities/release.js +0 -105
- package/dist/es-modules/entities/resource-provider.js +0 -139
- package/dist/es-modules/entities/resource-type.js +0 -93
- package/dist/es-modules/entities/resource.js +0 -7
- package/dist/es-modules/entities/role.js +0 -49
- package/dist/es-modules/entities/scheduled-action.js +0 -155
- package/dist/es-modules/entities/snapshot.js +0 -31
- package/dist/es-modules/entities/space-member.js +0 -18
- package/dist/es-modules/entities/space-membership.js +0 -49
- package/dist/es-modules/entities/space.js +0 -28
- package/dist/es-modules/entities/tag.js +0 -56
- package/dist/es-modules/entities/task.js +0 -57
- package/dist/es-modules/entities/team-membership.js +0 -50
- package/dist/es-modules/entities/team-space-membership.js +0 -49
- package/dist/es-modules/entities/team.js +0 -49
- package/dist/es-modules/entities/ui-config.js +0 -15
- package/dist/es-modules/entities/upload-credential.js +0 -33
- package/dist/es-modules/entities/upload.js +0 -34
- package/dist/es-modules/entities/usage.js +0 -20
- package/dist/es-modules/entities/user-ui-config.js +0 -15
- package/dist/es-modules/entities/user.js +0 -23
- package/dist/es-modules/entities/utils.js +0 -1
- package/dist/es-modules/entities/webhook.js +0 -80
- package/dist/es-modules/entities/widget-parameters.js +0 -1
- package/dist/es-modules/entities/workflow-definition.js +0 -87
- package/dist/es-modules/entities/workflow.js +0 -76
- package/dist/es-modules/entities/workflows-changelog-entry.js +0 -24
- package/dist/es-modules/export-types.js +0 -3
- package/dist/es-modules/methods/action.js +0 -54
- package/dist/es-modules/methods/bulk-action.js +0 -15
- package/dist/es-modules/methods/content-type.js +0 -47
- package/dist/es-modules/methods/release-action.js +0 -17
- package/dist/es-modules/methods/utils.js +0 -7
- package/dist/es-modules/plain/as-iterator.js +0 -47
- package/dist/es-modules/plain/checks.js +0 -8
- package/dist/es-modules/plain/common-types.js +0 -1
- package/dist/es-modules/plain/entities/app-access-token.js +0 -1
- package/dist/es-modules/plain/entities/app-action-call.js +0 -1
- package/dist/es-modules/plain/entities/app-action.js +0 -1
- package/dist/es-modules/plain/entities/app-bundle.js +0 -1
- package/dist/es-modules/plain/entities/app-definition.js +0 -1
- package/dist/es-modules/plain/entities/app-details.js +0 -1
- package/dist/es-modules/plain/entities/app-event-subscription.js +0 -1
- package/dist/es-modules/plain/entities/app-installation.js +0 -1
- package/dist/es-modules/plain/entities/app-key.js +0 -1
- package/dist/es-modules/plain/entities/app-signed-request.js +0 -1
- package/dist/es-modules/plain/entities/app-signing-secret.js +0 -1
- package/dist/es-modules/plain/entities/app-upload.js +0 -1
- package/dist/es-modules/plain/entities/comment.js +0 -1
- package/dist/es-modules/plain/entities/concept-scheme.js +0 -1
- package/dist/es-modules/plain/entities/concept.js +0 -1
- package/dist/es-modules/plain/entities/editor-interface.js +0 -1
- package/dist/es-modules/plain/entities/environment-alias.js +0 -1
- package/dist/es-modules/plain/entities/environment.js +0 -1
- package/dist/es-modules/plain/entities/extension.js +0 -1
- package/dist/es-modules/plain/entities/function-log.js +0 -1
- package/dist/es-modules/plain/entities/function.js +0 -1
- package/dist/es-modules/plain/entities/locale.js +0 -1
- package/dist/es-modules/plain/entities/oauth-application.js +0 -1
- package/dist/es-modules/plain/entities/organization.js +0 -1
- package/dist/es-modules/plain/entities/resource-provider.js +0 -1
- package/dist/es-modules/plain/entities/resource-type.js +0 -1
- package/dist/es-modules/plain/entities/resource.js +0 -1
- package/dist/es-modules/plain/entities/role.js +0 -1
- package/dist/es-modules/plain/entities/space-member.js +0 -1
- package/dist/es-modules/plain/entities/space-membership.js +0 -1
- package/dist/es-modules/plain/entities/space.js +0 -1
- package/dist/es-modules/plain/entities/tag.js +0 -1
- package/dist/es-modules/plain/entities/task.js +0 -1
- package/dist/es-modules/plain/entities/team-membership.js +0 -1
- package/dist/es-modules/plain/entities/team-space-membership.js +0 -1
- package/dist/es-modules/plain/entities/team.js +0 -1
- package/dist/es-modules/plain/entities/ui-config.js +0 -1
- package/dist/es-modules/plain/entities/upload-credential.js +0 -1
- package/dist/es-modules/plain/entities/upload.js +0 -1
- package/dist/es-modules/plain/entities/usage.js +0 -1
- package/dist/es-modules/plain/entities/user-ui-config.js +0 -1
- package/dist/es-modules/plain/entities/user.js +0 -1
- package/dist/es-modules/plain/entities/webhook.js +0 -1
- package/dist/es-modules/plain/entities/workflow-definition.js +0 -1
- package/dist/es-modules/plain/entities/workflow.js +0 -1
- package/dist/es-modules/plain/entities/workflows-changelog.js +0 -1
- package/dist/es-modules/plain/pagination-helper.js +0 -76
- package/dist/es-modules/plain/plain-client.js +0 -531
- package/dist/es-modules/plain/wrappers/wrap.js +0 -46
- package/dist/es-modules/plain/wrappers/wrap.test-d.js +0 -15
- package/dist/es-modules/upload-http-client.js +0 -17
- /package/dist/{typings → types}/adapters/REST/endpoints/access-token.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/api-key.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-access-token.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-action-call.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-action.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-bundle.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-definition.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-details.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-event-subscription.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-installation.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-key.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-signed-request.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-signing-secret.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/app-upload.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/asset-key.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/asset.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/bulk-action.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/comment.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/concept-scheme.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/concept.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/content-type.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/editor-interface.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/entry.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/environment-alias.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/environment-template-installation.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/environment-template.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/environment.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/extension.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/function-log.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/function.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/http.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/index.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/locale.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/oauth-application.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/organization-invitation.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/organization-membership.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/organization.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/personal-access-token.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/preview-api-key.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/raw.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/release-action.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/release.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/resource-provider.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/resource-type.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/resource.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/role.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/scheduled-action.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/snapshot.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/space-member.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/space-membership.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/space.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/tag.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/task.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/team-membership.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/team-space-membership.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/team.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/ui-config.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/upload-credentials.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/upload.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/usage.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/user-ui-config.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/user.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/utils.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/webhook.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/workflow-definition.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/workflow.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/endpoints/workflows-changelog.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/make-request.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/rest-adapter.d.ts +0 -0
- /package/dist/{typings → types}/adapters/REST/types.d.ts +0 -0
- /package/dist/{typings → types}/common-types.d.ts +0 -0
- /package/dist/{typings → types}/common-utils.d.ts +0 -0
- /package/dist/{typings → types}/constants/editor-interface-defaults/controls-defaults.d.ts +0 -0
- /package/dist/{typings → types}/constants/editor-interface-defaults/editors-defaults.d.ts +0 -0
- /package/dist/{typings → types}/constants/editor-interface-defaults/index.d.ts +0 -0
- /package/dist/{typings → types}/constants/editor-interface-defaults/sidebar-defaults.d.ts +0 -0
- /package/dist/{typings → types}/constants/editor-interface-defaults/types.d.ts +0 -0
- /package/dist/{typings → types}/create-adapter.d.ts +0 -0
- /package/dist/{typings → types}/create-app-definition-api.d.ts +0 -0
- /package/dist/{typings → types}/create-entry-api.d.ts +0 -0
- /package/dist/{typings → types}/create-environment-template-api.d.ts +0 -0
- /package/dist/{typings → types}/create-organization-api.d.ts +0 -0
- /package/dist/{typings → types}/create-space-api.d.ts +0 -0
- /package/dist/{typings → types}/enhance-with-methods.d.ts +0 -0
- /package/dist/{typings → types}/entities/access-token.d.ts +0 -0
- /package/dist/{typings → types}/entities/api-key.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-access-token.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-action-call.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-action.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-bundle.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-definition.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-details.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-event-subscription.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-installation.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-key.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-signed-request.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-signing-secret.d.ts +0 -0
- /package/dist/{typings → types}/entities/app-upload.d.ts +0 -0
- /package/dist/{typings → types}/entities/asset-key.d.ts +0 -0
- /package/dist/{typings → types}/entities/asset.d.ts +0 -0
- /package/dist/{typings → types}/entities/bulk-action.d.ts +0 -0
- /package/dist/{typings → types}/entities/comment.d.ts +0 -0
- /package/dist/{typings → types}/entities/concept-scheme.d.ts +0 -0
- /package/dist/{typings → types}/entities/concept.d.ts +0 -0
- /package/dist/{typings → types}/entities/content-type-fields.d.ts +0 -0
- /package/dist/{typings → types}/entities/content-type.d.ts +0 -0
- /package/dist/{typings → types}/entities/editor-interface.d.ts +0 -0
- /package/dist/{typings → types}/entities/entry.d.ts +0 -0
- /package/dist/{typings → types}/entities/environment-alias.d.ts +0 -0
- /package/dist/{typings → types}/entities/environment-template-installation.d.ts +0 -0
- /package/dist/{typings → types}/entities/environment-template.d.ts +0 -0
- /package/dist/{typings → types}/entities/environment.d.ts +0 -0
- /package/dist/{typings → types}/entities/extension.d.ts +0 -0
- /package/dist/{typings → types}/entities/field-type.d.ts +0 -0
- /package/dist/{typings → types}/entities/function-log.d.ts +0 -0
- /package/dist/{typings → types}/entities/function.d.ts +0 -0
- /package/dist/{typings → types}/entities/index.d.ts +0 -0
- /package/dist/{typings → types}/entities/locale.d.ts +0 -0
- /package/dist/{typings → types}/entities/oauth-application.d.ts +0 -0
- /package/dist/{typings → types}/entities/organization-invitation.d.ts +0 -0
- /package/dist/{typings → types}/entities/organization-membership.d.ts +0 -0
- /package/dist/{typings → types}/entities/organization.d.ts +0 -0
- /package/dist/{typings → types}/entities/personal-access-token.d.ts +0 -0
- /package/dist/{typings → types}/entities/preview-api-key.d.ts +0 -0
- /package/dist/{typings → types}/entities/release-action.d.ts +0 -0
- /package/dist/{typings → types}/entities/release.d.ts +0 -0
- /package/dist/{typings → types}/entities/resource-provider.d.ts +0 -0
- /package/dist/{typings → types}/entities/resource-type.d.ts +0 -0
- /package/dist/{typings → types}/entities/resource.d.ts +0 -0
- /package/dist/{typings → types}/entities/role.d.ts +0 -0
- /package/dist/{typings → types}/entities/scheduled-action.d.ts +0 -0
- /package/dist/{typings → types}/entities/snapshot.d.ts +0 -0
- /package/dist/{typings → types}/entities/space-member.d.ts +0 -0
- /package/dist/{typings → types}/entities/space-membership.d.ts +0 -0
- /package/dist/{typings → types}/entities/space.d.ts +0 -0
- /package/dist/{typings → types}/entities/tag.d.ts +0 -0
- /package/dist/{typings → types}/entities/task.d.ts +0 -0
- /package/dist/{typings → types}/entities/team-membership.d.ts +0 -0
- /package/dist/{typings → types}/entities/team-space-membership.d.ts +0 -0
- /package/dist/{typings → types}/entities/team.d.ts +0 -0
- /package/dist/{typings → types}/entities/upload-credential.d.ts +0 -0
- /package/dist/{typings → types}/entities/upload.d.ts +0 -0
- /package/dist/{typings → types}/entities/usage.d.ts +0 -0
- /package/dist/{typings → types}/entities/user.d.ts +0 -0
- /package/dist/{typings → types}/entities/utils.d.ts +0 -0
- /package/dist/{typings → types}/entities/webhook.d.ts +0 -0
- /package/dist/{typings → types}/entities/widget-parameters.d.ts +0 -0
- /package/dist/{typings → types}/entities/workflow-definition.d.ts +0 -0
- /package/dist/{typings → types}/entities/workflow.d.ts +0 -0
- /package/dist/{typings → types}/entities/workflows-changelog-entry.d.ts +0 -0
- /package/dist/{typings → types}/export-types.d.ts +0 -0
- /package/dist/{typings → types}/methods/action.d.ts +0 -0
- /package/dist/{typings → types}/methods/bulk-action.d.ts +0 -0
- /package/dist/{typings → types}/methods/content-type.d.ts +0 -0
- /package/dist/{typings → types}/methods/release-action.d.ts +0 -0
- /package/dist/{typings → types}/methods/utils.d.ts +0 -0
- /package/dist/{typings → types}/plain/as-iterator.d.ts +0 -0
- /package/dist/{typings → types}/plain/checks.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-access-token.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-action-call.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-action.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-bundle.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-definition.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-details.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-event-subscription.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-installation.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-key.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-signed-request.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-signing-secret.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/app-upload.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/comment.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/concept-scheme.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/concept.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/editor-interface.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/environment-alias.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/environment.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/extension.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/function-log.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/function.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/locale.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/oauth-application.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/organization.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/resource-provider.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/resource-type.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/resource.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/role.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/space-member.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/space-membership.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/space.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/tag.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/task.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/team-membership.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/team-space-membership.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/team.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/ui-config.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/upload-credential.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/upload.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/usage.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/user-ui-config.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/user.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/webhook.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/workflow-definition.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/workflow.d.ts +0 -0
- /package/dist/{typings → types}/plain/entities/workflows-changelog.d.ts +0 -0
- /package/dist/{typings → types}/plain/pagination-helper.d.ts +0 -0
- /package/dist/{typings → types}/plain/plain-client.d.ts +0 -0
- /package/dist/{typings → types}/plain/wrappers/wrap.d.ts +0 -0
- /package/dist/{typings → types}/plain/wrappers/wrap.test-d.d.ts +0 -0
- /package/dist/{typings → types}/upload-http-client.d.ts +0 -0
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
2
|
import copy from 'fast-copy';
|
|
3
|
-
import { wrapCollection } from '../common-utils';
|
|
3
|
+
import { wrapCollection } from '../common-utils.js';
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* @private
|
|
6
7
|
* @param makeRequest - function to make requests via an adapter
|
|
7
8
|
* @param data - raw contentful-Function data
|
|
8
9
|
* @return Wrapped Function data
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
function wrapFunctionLog(makeRequest, data) {
|
|
12
|
+
const functionLog = toPlainObject(copy(data));
|
|
13
|
+
return freezeSys(functionLog);
|
|
13
14
|
}
|
|
14
|
-
|
|
15
15
|
/**
|
|
16
16
|
* @private
|
|
17
17
|
* @param makeRequest - function to make requests via an adapter
|
|
18
18
|
* @param data - raw contentful-function data
|
|
19
19
|
* @return Wrapped App Function collection data
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const wrapFunctionLogCollection = wrapCollection(wrapFunctionLog);
|
|
22
|
+
|
|
23
|
+
export { wrapFunctionLog, wrapFunctionLogCollection };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
import { wrapCollection } from '../common-utils.js';
|
|
4
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
function createFunctionApi(makeRequest) {
|
|
10
|
+
return {
|
|
11
|
+
getFunction: function getFunction() {
|
|
12
|
+
const raw = this.toPlainObject();
|
|
13
|
+
return makeRequest({
|
|
14
|
+
entityType: 'Function',
|
|
15
|
+
action: 'get',
|
|
16
|
+
params: {
|
|
17
|
+
organizationId: raw.sys.organization.sys.id,
|
|
18
|
+
appDefinitionId: raw.sys.appDefinition.sys.id,
|
|
19
|
+
functionId: raw.sys.id,
|
|
20
|
+
},
|
|
21
|
+
}).then((data) => wrapFunction(makeRequest, data));
|
|
22
|
+
},
|
|
23
|
+
getManyFunctions: function getManyFunctions() {
|
|
24
|
+
const raw = this.toPlainObject();
|
|
25
|
+
return makeRequest({
|
|
26
|
+
entityType: 'Function',
|
|
27
|
+
action: 'getMany',
|
|
28
|
+
params: {
|
|
29
|
+
appDefinitionId: raw.sys.appDefinition.sys.id,
|
|
30
|
+
organizationId: raw.sys.organization.sys.id,
|
|
31
|
+
},
|
|
32
|
+
}).then((data) => wrapFunctionCollection(makeRequest, data));
|
|
33
|
+
},
|
|
34
|
+
getManyFunctionsForEnvironment(spaceId, environmentId, appInstallationId) {
|
|
35
|
+
return makeRequest({
|
|
36
|
+
entityType: 'Function',
|
|
37
|
+
action: 'getManyForEnvironment',
|
|
38
|
+
params: {
|
|
39
|
+
spaceId: spaceId,
|
|
40
|
+
environmentId: environmentId,
|
|
41
|
+
appInstallationId: appInstallationId,
|
|
42
|
+
},
|
|
43
|
+
}).then((data) => wrapFunctionCollection(makeRequest, data));
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
* @param makeRequest - (real) function to make requests via an adapter
|
|
50
|
+
* @param data - raw contentful-Function data
|
|
51
|
+
* @return Wrapped Function data
|
|
52
|
+
*/
|
|
53
|
+
function wrapFunction(makeRequest, data) {
|
|
54
|
+
const func = toPlainObject(copy(data));
|
|
55
|
+
const funcWithMethods = enhanceWithMethods(func, createFunctionApi(makeRequest));
|
|
56
|
+
return freezeSys(funcWithMethods);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
const wrapFunctionCollection = wrapCollection(wrapFunction);
|
|
62
|
+
|
|
63
|
+
export { wrapFunction, wrapFunctionCollection };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as apiKey from './api-key.js';
|
|
2
|
+
import * as appAction from './app-action.js';
|
|
3
|
+
import * as appActionCall from './app-action-call.js';
|
|
4
|
+
import * as appBundle from './app-bundle.js';
|
|
5
|
+
import * as appDefinition from './app-definition.js';
|
|
6
|
+
import * as appDetails from './app-details.js';
|
|
7
|
+
import * as appInstallation from './app-installation.js';
|
|
8
|
+
import * as appSignedRequest from './app-signed-request.js';
|
|
9
|
+
import * as appSigningSecret from './app-signing-secret.js';
|
|
10
|
+
import * as appEventSubscription from './app-event-subscription.js';
|
|
11
|
+
import * as appKey from './app-key.js';
|
|
12
|
+
import * as appAccessToken from './app-access-token.js';
|
|
13
|
+
import * as appUpload from './app-upload.js';
|
|
14
|
+
import * as asset from './asset.js';
|
|
15
|
+
import * as assetKey from './asset-key.js';
|
|
16
|
+
import * as bulkAction from './bulk-action.js';
|
|
17
|
+
import * as comment from './comment.js';
|
|
18
|
+
import * as contentType from './content-type.js';
|
|
19
|
+
import * as editorInterface from './editor-interface.js';
|
|
20
|
+
import * as entry from './entry.js';
|
|
21
|
+
import * as environment from './environment.js';
|
|
22
|
+
import * as environmentAlias from './environment-alias.js';
|
|
23
|
+
import * as environmentTemplate from './environment-template.js';
|
|
24
|
+
import * as environmentTemplateInstallation from './environment-template-installation.js';
|
|
25
|
+
import * as extension from './extension.js';
|
|
26
|
+
import * as _function from './function.js';
|
|
27
|
+
import * as functionLog from './function-log.js';
|
|
28
|
+
import * as locale from './locale.js';
|
|
29
|
+
import * as oauthApplication from './oauth-application.js';
|
|
30
|
+
import * as organization from './organization.js';
|
|
31
|
+
import * as organizationInvitation from './organization-invitation.js';
|
|
32
|
+
import * as organizationMembership from './organization-membership.js';
|
|
33
|
+
import * as personalAccessToken from './personal-access-token.js';
|
|
34
|
+
import * as accessToken from './access-token.js';
|
|
35
|
+
import * as previewApiKey from './preview-api-key.js';
|
|
36
|
+
import * as release from './release.js';
|
|
37
|
+
import * as releaseAction from './release-action.js';
|
|
38
|
+
import * as role from './role.js';
|
|
39
|
+
import * as scheduledAction from './scheduled-action.js';
|
|
40
|
+
import * as snapshot from './snapshot.js';
|
|
41
|
+
import * as space from './space.js';
|
|
42
|
+
import * as spaceMember from './space-member.js';
|
|
43
|
+
import * as spaceMembership from './space-membership.js';
|
|
44
|
+
import * as tag from './tag.js';
|
|
45
|
+
import * as task from './task.js';
|
|
46
|
+
import * as team from './team.js';
|
|
47
|
+
import * as teamMembership from './team-membership.js';
|
|
48
|
+
import * as teamSpaceMembership from './team-space-membership.js';
|
|
49
|
+
import * as uiConfig from './ui-config.js';
|
|
50
|
+
import * as upload from './upload.js';
|
|
51
|
+
import * as usage from './usage.js';
|
|
52
|
+
import * as user from './user.js';
|
|
53
|
+
import * as userUiConfig from './user-ui-config.js';
|
|
54
|
+
import * as webhook from './webhook.js';
|
|
55
|
+
import * as workflowDefinition from './workflow-definition.js';
|
|
56
|
+
import * as concept from './concept.js';
|
|
57
|
+
import * as conceptScheme from './concept-scheme.js';
|
|
58
|
+
import * as resourceProvider from './resource-provider.js';
|
|
59
|
+
import * as resourceType from './resource-type.js';
|
|
60
|
+
import * as resource from './resource.js';
|
|
61
|
+
|
|
62
|
+
var entities = {
|
|
63
|
+
accessToken,
|
|
64
|
+
appAction,
|
|
65
|
+
appActionCall,
|
|
66
|
+
appBundle,
|
|
67
|
+
apiKey,
|
|
68
|
+
appDefinition,
|
|
69
|
+
appInstallation,
|
|
70
|
+
appUpload,
|
|
71
|
+
appDetails,
|
|
72
|
+
appSignedRequest,
|
|
73
|
+
appSigningSecret,
|
|
74
|
+
appEventSubscription,
|
|
75
|
+
appKey,
|
|
76
|
+
appAccessToken,
|
|
77
|
+
asset,
|
|
78
|
+
assetKey,
|
|
79
|
+
bulkAction,
|
|
80
|
+
comment,
|
|
81
|
+
concept,
|
|
82
|
+
conceptScheme,
|
|
83
|
+
contentType,
|
|
84
|
+
editorInterface,
|
|
85
|
+
entry,
|
|
86
|
+
environment,
|
|
87
|
+
environmentAlias,
|
|
88
|
+
environmentTemplate,
|
|
89
|
+
environmentTemplateInstallation,
|
|
90
|
+
extension,
|
|
91
|
+
func: _function,
|
|
92
|
+
functionLog,
|
|
93
|
+
locale,
|
|
94
|
+
oauthApplication,
|
|
95
|
+
organization,
|
|
96
|
+
organizationInvitation,
|
|
97
|
+
organizationMembership,
|
|
98
|
+
personalAccessToken,
|
|
99
|
+
previewApiKey,
|
|
100
|
+
release,
|
|
101
|
+
releaseAction,
|
|
102
|
+
resourceProvider,
|
|
103
|
+
resourceType,
|
|
104
|
+
resource,
|
|
105
|
+
role,
|
|
106
|
+
scheduledAction,
|
|
107
|
+
snapshot,
|
|
108
|
+
space,
|
|
109
|
+
spaceMember,
|
|
110
|
+
spaceMembership,
|
|
111
|
+
tag,
|
|
112
|
+
task,
|
|
113
|
+
team,
|
|
114
|
+
teamMembership,
|
|
115
|
+
teamSpaceMembership,
|
|
116
|
+
uiConfig,
|
|
117
|
+
upload,
|
|
118
|
+
usage,
|
|
119
|
+
user,
|
|
120
|
+
userUIConfig: userUiConfig,
|
|
121
|
+
webhook,
|
|
122
|
+
workflowDefinition,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export { entities as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import copy from 'fast-copy';
|
|
2
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
3
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
4
|
+
import { wrapCollection } from '../common-utils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
function createLocaleApi(makeRequest) {
|
|
10
|
+
const getParams = (locale) => ({
|
|
11
|
+
spaceId: locale.sys.space.sys.id,
|
|
12
|
+
environmentId: locale.sys.environment.sys.id,
|
|
13
|
+
localeId: locale.sys.id,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
update: function () {
|
|
17
|
+
const raw = this.toPlainObject();
|
|
18
|
+
return makeRequest({
|
|
19
|
+
entityType: 'Locale',
|
|
20
|
+
action: 'update',
|
|
21
|
+
params: getParams(raw),
|
|
22
|
+
payload: raw,
|
|
23
|
+
}).then((data) => wrapLocale(makeRequest, data));
|
|
24
|
+
},
|
|
25
|
+
delete: function () {
|
|
26
|
+
const raw = this.toPlainObject();
|
|
27
|
+
return makeRequest({
|
|
28
|
+
entityType: 'Locale',
|
|
29
|
+
action: 'delete',
|
|
30
|
+
params: getParams(raw),
|
|
31
|
+
}).then(() => {
|
|
32
|
+
// noop
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
* @param makeRequest - function to make requests via an adapter
|
|
40
|
+
* @param data - Raw locale data
|
|
41
|
+
* @return Wrapped locale data
|
|
42
|
+
*/
|
|
43
|
+
function wrapLocale(makeRequest, data) {
|
|
44
|
+
delete data.internal_code;
|
|
45
|
+
const locale = toPlainObject(copy(data));
|
|
46
|
+
const localeWithMethods = enhanceWithMethods(locale, createLocaleApi(makeRequest));
|
|
47
|
+
return freezeSys(localeWithMethods);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
const wrapLocaleCollection = wrapCollection(wrapLocale);
|
|
53
|
+
|
|
54
|
+
export { wrapLocale, wrapLocaleCollection };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
3
|
+
import copy from 'fast-copy';
|
|
4
|
+
import { wrapCursorPaginatedCollection } from '../common-utils.js';
|
|
5
|
+
|
|
6
|
+
var ScopeValues;
|
|
7
|
+
(function (ScopeValues) {
|
|
8
|
+
ScopeValues["Read"] = "content_management_read";
|
|
9
|
+
ScopeValues["Manage"] = "content_management_manage";
|
|
10
|
+
})(ScopeValues || (ScopeValues = {}));
|
|
11
|
+
/**
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
function createOAuthApplicationApi(makeRequest, userId) {
|
|
15
|
+
const getParams = (data) => ({
|
|
16
|
+
userId,
|
|
17
|
+
oauthApplicationId: data.sys.id,
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
/**
|
|
21
|
+
* Updates an OAuth application
|
|
22
|
+
* @return Promise for the updated OAuth application
|
|
23
|
+
*/
|
|
24
|
+
async update() {
|
|
25
|
+
const raw = this.toPlainObject();
|
|
26
|
+
return makeRequest({
|
|
27
|
+
entityType: 'OAuthApplication',
|
|
28
|
+
action: 'update',
|
|
29
|
+
params: getParams(raw),
|
|
30
|
+
payload: raw,
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Deletes an OAuth application
|
|
35
|
+
* @return Promise for the deleted OAuth application
|
|
36
|
+
*/
|
|
37
|
+
async delete() {
|
|
38
|
+
const raw = this.toPlainObject();
|
|
39
|
+
return makeRequest({
|
|
40
|
+
entityType: 'OAuthApplication',
|
|
41
|
+
action: 'delete',
|
|
42
|
+
params: getParams(raw),
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
* @param makeRequest - function to make requests via an adapter
|
|
50
|
+
* @param data - Raw OAuth application data
|
|
51
|
+
* @return Wrapped OAuth application data
|
|
52
|
+
*/
|
|
53
|
+
function wrapOAuthApplication(makeRequest, data, userId) {
|
|
54
|
+
const oauthApplication = toPlainObject(copy(data));
|
|
55
|
+
const oauthApplicationWithMethods = enhanceWithMethods(oauthApplication, createOAuthApplicationApi(makeRequest, userId));
|
|
56
|
+
return freezeSys(oauthApplicationWithMethods);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
const wrapOAuthApplicationCollection = wrapCursorPaginatedCollection(wrapOAuthApplication);
|
|
62
|
+
|
|
63
|
+
export { ScopeValues, wrapOAuthApplication, wrapOAuthApplicationCollection };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* @param makeRequest - function to make requests via an adapter
|
|
7
|
+
* @param data - Raw invitation data
|
|
8
|
+
* @return {OrganizationInvitation} Wrapped Inviation data
|
|
9
|
+
*/
|
|
10
|
+
function wrapOrganizationInvitation(_makeRequest, data) {
|
|
11
|
+
const invitation = toPlainObject(copy(data));
|
|
12
|
+
return freezeSys(invitation);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { wrapOrganizationInvitation };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import copy from 'fast-copy';
|
|
2
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
3
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
4
|
+
import { wrapCollection } from '../common-utils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
function createOrganizationMembershipApi(makeRequest, organizationId) {
|
|
10
|
+
const getParams = (data) => ({
|
|
11
|
+
organizationMembershipId: data.sys.id,
|
|
12
|
+
organizationId,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
update: function () {
|
|
16
|
+
const raw = this.toPlainObject();
|
|
17
|
+
return makeRequest({
|
|
18
|
+
entityType: 'OrganizationMembership',
|
|
19
|
+
action: 'update',
|
|
20
|
+
params: getParams(raw),
|
|
21
|
+
payload: raw,
|
|
22
|
+
}).then((data) => wrapOrganizationMembership(makeRequest, data, organizationId));
|
|
23
|
+
},
|
|
24
|
+
delete: function del() {
|
|
25
|
+
const raw = this.toPlainObject();
|
|
26
|
+
return makeRequest({
|
|
27
|
+
entityType: 'OrganizationMembership',
|
|
28
|
+
action: 'delete',
|
|
29
|
+
params: getParams(raw),
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @private
|
|
36
|
+
* @param {function} makeRequest - function to make requests via an adapter
|
|
37
|
+
* @param {Object} data - Raw organization membership data
|
|
38
|
+
* @return {OrganizationMembership} Wrapped organization membership data
|
|
39
|
+
*/
|
|
40
|
+
function wrapOrganizationMembership(makeRequest, data, organizationId) {
|
|
41
|
+
const organizationMembership = toPlainObject(copy(data));
|
|
42
|
+
const organizationMembershipWithMethods = enhanceWithMethods(organizationMembership, createOrganizationMembershipApi(makeRequest, organizationId));
|
|
43
|
+
return freezeSys(organizationMembershipWithMethods);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
const wrapOrganizationMembershipCollection = wrapCollection(wrapOrganizationMembership);
|
|
49
|
+
|
|
50
|
+
export { wrapOrganizationMembership, wrapOrganizationMembershipCollection };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import copy from 'fast-copy';
|
|
2
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
3
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
4
|
+
import createOrganizationApi from '../create-organization-api.js';
|
|
5
|
+
import { wrapCollection } from '../common-utils.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This method creates the API for the given organization with all the methods for
|
|
9
|
+
* reading and creating other entities. It also passes down a clone of the
|
|
10
|
+
* http client with an organization id, so the base path for requests now has the
|
|
11
|
+
* organization id already set.
|
|
12
|
+
* @private
|
|
13
|
+
* @param makeRequest - function to make requests via an adapter
|
|
14
|
+
* @param data - API response for an Organization
|
|
15
|
+
* @return {Organization}
|
|
16
|
+
*/
|
|
17
|
+
function wrapOrganization(makeRequest, data) {
|
|
18
|
+
const org = toPlainObject(copy(data));
|
|
19
|
+
const orgApi = createOrganizationApi(makeRequest);
|
|
20
|
+
const enhancedOrganization = enhanceWithMethods(org, orgApi);
|
|
21
|
+
return freezeSys(enhancedOrganization);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This method normalizes each organization in a collection.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
const wrapOrganizationCollection = wrapCollection(wrapOrganization);
|
|
28
|
+
|
|
29
|
+
export { wrapOrganization, wrapOrganizationCollection };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import copy from 'fast-copy';
|
|
2
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
3
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
4
|
+
import { wrapCollection } from '../common-utils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
* @param makeRequest - function to make requests via an adapter
|
|
9
|
+
* @param data - Raw personal access token data
|
|
10
|
+
* @return Wrapped personal access token
|
|
11
|
+
*/
|
|
12
|
+
function wrapPersonalAccessToken(makeRequest, data) {
|
|
13
|
+
const personalAccessToken = toPlainObject(copy(data));
|
|
14
|
+
const personalAccessTokenWithMethods = enhanceWithMethods(personalAccessToken, {
|
|
15
|
+
revoke: function () {
|
|
16
|
+
return makeRequest({
|
|
17
|
+
entityType: 'PersonalAccessToken',
|
|
18
|
+
action: 'revoke',
|
|
19
|
+
params: { tokenId: data.sys.id },
|
|
20
|
+
}).then((data) => wrapPersonalAccessToken(makeRequest, data));
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return freezeSys(personalAccessTokenWithMethods);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @param makeRequest - function to make requests via an adapter
|
|
28
|
+
* @param data - Raw personal access collection data
|
|
29
|
+
* @return Wrapped personal access token collection data
|
|
30
|
+
*/
|
|
31
|
+
const wrapPersonalAccessTokenCollection = wrapCollection(wrapPersonalAccessToken);
|
|
32
|
+
|
|
33
|
+
export { wrapPersonalAccessToken, wrapPersonalAccessTokenCollection };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
import { wrapCollection } from '../common-utils.js';
|
|
4
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
function createPreviewApiKeyApi() {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @private
|
|
14
|
+
* @param makeRequest - function to make requests via an adapter
|
|
15
|
+
* @param data - Raw api key data
|
|
16
|
+
* @return Wrapped preview api key data
|
|
17
|
+
*/
|
|
18
|
+
function wrapPreviewApiKey(_makeRequest, data) {
|
|
19
|
+
const previewApiKey = toPlainObject(copy(data));
|
|
20
|
+
const previewApiKeyWithMethods = enhanceWithMethods(previewApiKey, createPreviewApiKeyApi());
|
|
21
|
+
return freezeSys(previewApiKeyWithMethods);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
const wrapPreviewApiKeyCollection = wrapCollection(wrapPreviewApiKey);
|
|
27
|
+
|
|
28
|
+
export { wrapPreviewApiKey, wrapPreviewApiKeyCollection };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
import { wrapCollection } from '../common-utils.js';
|
|
4
|
+
import { pollAsyncActionStatus } from '../methods/action.js';
|
|
5
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
/**
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
function createReleaseActionApi(makeRequest) {
|
|
12
|
+
const getParams = (self) => {
|
|
13
|
+
const action = self.toPlainObject();
|
|
14
|
+
return {
|
|
15
|
+
spaceId: action.sys.space.sys.id,
|
|
16
|
+
environmentId: action.sys.environment.sys.id,
|
|
17
|
+
releaseId: action.sys.release.sys.id,
|
|
18
|
+
actionId: action.sys.id,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
async get() {
|
|
23
|
+
const params = getParams(this);
|
|
24
|
+
return makeRequest({
|
|
25
|
+
entityType: 'ReleaseAction',
|
|
26
|
+
action: 'get',
|
|
27
|
+
params,
|
|
28
|
+
}).then((releaseAction) => wrapReleaseAction(makeRequest, releaseAction));
|
|
29
|
+
},
|
|
30
|
+
/** Waits for a Release Action to complete */
|
|
31
|
+
async waitProcessing(options) {
|
|
32
|
+
return pollAsyncActionStatus(async () => this.get(), options);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @private
|
|
38
|
+
* @param makeRequest - function to make requests via an adapter
|
|
39
|
+
* @param data - Raw Release data
|
|
40
|
+
* @return Wrapped Release data
|
|
41
|
+
*/
|
|
42
|
+
function wrapReleaseAction(makeRequest, data) {
|
|
43
|
+
const releaseAction = toPlainObject(copy(data));
|
|
44
|
+
const releaseActionWithApiMethods = enhanceWithMethods(releaseAction, createReleaseActionApi(makeRequest));
|
|
45
|
+
return freezeSys(releaseActionWithApiMethods);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
const wrapReleaseActionCollection = wrapCollection(wrapReleaseAction);
|
|
51
|
+
|
|
52
|
+
export { wrapReleaseAction, wrapReleaseActionCollection };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { toPlainObject, freezeSys } from 'contentful-sdk-core';
|
|
2
|
+
import copy from 'fast-copy';
|
|
3
|
+
import { ScheduledActionReferenceFilters } from '../common-types.js';
|
|
4
|
+
import { wrapCursorPaginatedCollection } from '../common-utils.js';
|
|
5
|
+
import enhanceWithMethods from '../enhance-with-methods.js';
|
|
6
|
+
import { wrapReleaseAction } from './release-action.js';
|
|
7
|
+
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
const ReleaseReferenceFilters = ScheduledActionReferenceFilters;
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
function createReleaseApi(makeRequest) {
|
|
14
|
+
const getParams = (self) => {
|
|
15
|
+
const release = self.toPlainObject();
|
|
16
|
+
return {
|
|
17
|
+
spaceId: release.sys.space.sys.id,
|
|
18
|
+
environmentId: release.sys.environment.sys.id,
|
|
19
|
+
releaseId: release.sys.id,
|
|
20
|
+
version: release.sys.version,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
async archive() {
|
|
25
|
+
const params = getParams(this);
|
|
26
|
+
return makeRequest({
|
|
27
|
+
entityType: 'Release',
|
|
28
|
+
action: 'archive',
|
|
29
|
+
params,
|
|
30
|
+
}).then((release) => wrapRelease(makeRequest, release));
|
|
31
|
+
},
|
|
32
|
+
async unarchive() {
|
|
33
|
+
const params = getParams(this);
|
|
34
|
+
return makeRequest({
|
|
35
|
+
entityType: 'Release',
|
|
36
|
+
action: 'unarchive',
|
|
37
|
+
params,
|
|
38
|
+
}).then((release) => wrapRelease(makeRequest, release));
|
|
39
|
+
},
|
|
40
|
+
async update(payload) {
|
|
41
|
+
const params = getParams(this);
|
|
42
|
+
return makeRequest({
|
|
43
|
+
entityType: 'Release',
|
|
44
|
+
action: 'update',
|
|
45
|
+
params,
|
|
46
|
+
payload,
|
|
47
|
+
}).then((release) => wrapRelease(makeRequest, release));
|
|
48
|
+
},
|
|
49
|
+
async delete() {
|
|
50
|
+
const params = getParams(this);
|
|
51
|
+
await makeRequest({
|
|
52
|
+
entityType: 'Release',
|
|
53
|
+
action: 'delete',
|
|
54
|
+
params,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
async publish(options) {
|
|
58
|
+
const params = getParams(this);
|
|
59
|
+
return makeRequest({
|
|
60
|
+
entityType: 'Release',
|
|
61
|
+
action: 'publish',
|
|
62
|
+
params,
|
|
63
|
+
})
|
|
64
|
+
.then((data) => wrapReleaseAction(makeRequest, data))
|
|
65
|
+
.then((action) => action.waitProcessing(options));
|
|
66
|
+
},
|
|
67
|
+
async unpublish(options) {
|
|
68
|
+
const params = getParams(this);
|
|
69
|
+
return makeRequest({
|
|
70
|
+
entityType: 'Release',
|
|
71
|
+
action: 'unpublish',
|
|
72
|
+
params,
|
|
73
|
+
})
|
|
74
|
+
.then((data) => wrapReleaseAction(makeRequest, data))
|
|
75
|
+
.then((action) => action.waitProcessing(options));
|
|
76
|
+
},
|
|
77
|
+
async validate(options) {
|
|
78
|
+
const params = getParams(this);
|
|
79
|
+
return makeRequest({
|
|
80
|
+
entityType: 'Release',
|
|
81
|
+
action: 'validate',
|
|
82
|
+
params,
|
|
83
|
+
payload: options === null || options === void 0 ? void 0 : options.payload,
|
|
84
|
+
})
|
|
85
|
+
.then((data) => wrapReleaseAction(makeRequest, data))
|
|
86
|
+
.then((action) => action.waitProcessing(options === null || options === void 0 ? void 0 : options.processingOptions));
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Return a Release object enhanced with its own API helper functions.
|
|
92
|
+
* @private
|
|
93
|
+
* @param makeRequest - function to make requests via an adapter
|
|
94
|
+
* @param data - Raw Release data
|
|
95
|
+
* @return Wrapped Release data
|
|
96
|
+
*/
|
|
97
|
+
function wrapRelease(makeRequest, data) {
|
|
98
|
+
const release = toPlainObject(copy(data));
|
|
99
|
+
const releaseWithApiMethods = enhanceWithMethods(release, createReleaseApi(makeRequest));
|
|
100
|
+
return freezeSys(releaseWithApiMethods);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
const wrapReleaseCollection = wrapCursorPaginatedCollection(wrapRelease);
|
|
106
|
+
|
|
107
|
+
export { ReleaseReferenceFilters, wrapRelease, wrapReleaseCollection };
|