contentful-management 12.0.0-beta.12 → 12.0.0-beta.14
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/dist/contentful-management.bundle.browser.js +20691 -21710
- package/dist/contentful-management.bundle.browser.js.map +1 -1
- package/dist/contentful-management.bundle.browser.min.js +1 -1
- package/dist/contentful-management.bundle.browser.min.js.map +1 -1
- package/dist/contentful-management.bundle.node.cjs +470 -237
- package/dist/contentful-management.bundle.node.cjs.map +1 -1
- package/dist/esm/adapters/REST/endpoints/bulk-action.js +13 -1
- package/dist/esm/adapters/REST/endpoints/bulk-action.js.map +1 -1
- package/dist/esm/adapters/REST/endpoints/environment-template-installation.js +2 -2
- package/dist/esm/adapters/REST/endpoints/environment-template-installation.js.map +1 -1
- package/dist/esm/common-types.js.map +1 -1
- package/dist/esm/create-contentful-api.js +1 -1
- package/dist/esm/create-environment-template-api.js +3 -1
- package/dist/esm/create-environment-template-api.js.map +1 -1
- package/dist/esm/entities/app-definition.js.map +1 -1
- package/dist/esm/entities/bulk-action.js.map +1 -1
- package/dist/esm/entities/environment-template-installation.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plain/plain-client.js +5 -1
- package/dist/esm/plain/plain-client.js.map +1 -1
- package/dist/stats-browser-min.html +1 -1
- package/dist/types/adapters/REST/endpoints/bulk-action.d.ts +4 -0
- package/dist/types/adapters/REST/endpoints/bulk-action.js +13 -1
- package/dist/types/adapters/REST/endpoints/bulk-action.js.map +1 -1
- package/dist/types/adapters/REST/endpoints/environment-template-installation.js +2 -2
- package/dist/types/adapters/REST/endpoints/environment-template-installation.js.map +1 -1
- package/dist/types/common-types.d.ts +26 -1
- package/dist/types/common-types.js.map +1 -1
- package/dist/types/create-environment-template-api.d.ts +3 -1
- package/dist/types/create-environment-template-api.js +3 -1
- package/dist/types/create-environment-template-api.js.map +1 -1
- package/dist/types/entities/app-definition.d.ts +7 -1
- package/dist/types/entities/app-definition.js.map +1 -1
- package/dist/types/entities/bulk-action.d.ts +31 -3
- package/dist/types/entities/bulk-action.js.map +1 -1
- package/dist/types/entities/environment-template-installation.d.ts +1 -0
- package/dist/types/entities/environment-template-installation.js.map +1 -1
- package/dist/types/export-types.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/plain/common-types.d.ts +7 -1
- package/dist/types/plain/plain-client.js +4 -0
- package/dist/types/plain/plain-client.js.map +1 -1
- package/package.json +36 -35
- package/dist/types/methods/bulk-action.d.ts +0 -14
|
@@ -120,6 +120,7 @@ function createEnvironmentTemplateApi(makeRequest, organizationId) {
|
|
|
120
120
|
* Gets a collection of all installations for the environment template
|
|
121
121
|
* @param [installationParams.spaceId] - Space ID to filter installations by space and environment
|
|
122
122
|
* @param [installationParams.environmentId] - Environment ID to filter installations by space and environment
|
|
123
|
+
* @param [installationParams.latestOnly] - Boolean flag to only return the latest installation per environment
|
|
123
124
|
* @return Promise for a collection of EnvironmentTemplateInstallations
|
|
124
125
|
* ```javascript
|
|
125
126
|
* const contentful = require('contentful-management')
|
|
@@ -136,7 +137,7 @@ function createEnvironmentTemplateApi(makeRequest, organizationId) {
|
|
|
136
137
|
* .catch(console.error)
|
|
137
138
|
* ```
|
|
138
139
|
*/
|
|
139
|
-
getInstallations: function getEnvironmentTemplateInstallations({ spaceId, environmentId, ...query } = {}) {
|
|
140
|
+
getInstallations: function getEnvironmentTemplateInstallations({ spaceId, environmentId, latestOnly, ...query } = {}) {
|
|
140
141
|
const raw = this.toPlainObject();
|
|
141
142
|
return makeRequest({
|
|
142
143
|
entityType: 'EnvironmentTemplateInstallation',
|
|
@@ -147,6 +148,7 @@ function createEnvironmentTemplateApi(makeRequest, organizationId) {
|
|
|
147
148
|
query: { ...createRequestConfig({ query }).params },
|
|
148
149
|
spaceId,
|
|
149
150
|
environmentId,
|
|
151
|
+
latestOnly,
|
|
150
152
|
},
|
|
151
153
|
}).then((data) => wrapEnvironmentTemplateInstallationCollection(makeRequest, data));
|
|
152
154
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-environment-template-api.js","sources":["../../../lib/create-environment-template-api.ts"],"sourcesContent":["import { createRequestConfig } from 'contentful-sdk-core'\nimport type { BasicCursorPaginationOptions, MakeRequest } from './common-types.js'\nimport {\n wrapEnvironmentTemplate,\n wrapEnvironmentTemplateCollection,\n type EnvironmentTemplateProps,\n} from './entities/environment-template.js'\nimport {\n wrapEnvironmentTemplateInstallationCollection,\n type CreateEnvironmentTemplateInstallationProps,\n type ValidateEnvironmentTemplateInstallationProps,\n} from './entities/environment-template-installation.js'\n\nexport type ContentfulEnvironmentTemplateApi = ReturnType<typeof createEnvironmentTemplateApi>\n\nexport function createEnvironmentTemplateApi(makeRequest: MakeRequest, organizationId: string) {\n return {\n /**\n * Updates a environment template\n * @return Promise for new version of the template\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => {\n * environmentTemplate.name = 'New name'\n * return environmentTemplate.update()\n * })\n * .then((environmentTemplate) =>\n * console.log(`Environment template ${environmentTemplate.sys.id} renamed.`)\n * ).catch(console.error)\n * ```\n */\n update: function updateEnvironmentTemplate() {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'update',\n params: { organizationId, environmentTemplateId: raw.sys.id },\n payload: raw,\n }).then((data) => wrapEnvironmentTemplate(makeRequest, data, organizationId))\n },\n /**\n * Updates environment template version data\n * @param version.versionName - Name of the environment template version\n * @param version.versionDescription - Description of the environment template version\n * @return Promise for an updated EnvironmentTemplate\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => {\n * return environmentTemplate.updateVersion({\n * versionName: 'New Name',\n * versionDescription: 'New Description',\n * })\n * })\n * .then((environmentTemplate) =>\n * console.log(`Environment template version ${environmentTemplate.sys.id} renamed.`)\n * ).catch(console.error)\n * ```\n */\n updateVersion: function updateEnvironmentTemplateVersion({\n versionName,\n versionDescription,\n }: {\n versionName: string\n versionDescription: string\n }) {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'versionUpdate',\n params: { organizationId, environmentTemplateId: raw.sys.id, version: raw.sys.version },\n payload: { versionName, versionDescription },\n }).then((data) => wrapEnvironmentTemplate(makeRequest, data, organizationId))\n },\n /**\n * Deletes the environment template\n * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.\n * @example ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.delete())\n * .then(() => console.log('Environment template deleted.'))\n * .catch(console.error)\n * ```\n */\n delete: function deleteEnvironmentTemplate() {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'delete',\n params: { organizationId, environmentTemplateId: raw.sys.id },\n })\n },\n /**\n * Gets a collection of all versions for the environment template\n * @return Promise for a EnvironmentTemplate\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.getVersions())\n * .then((environmentTemplateVersions) => console.log(environmentTemplateVersions.items))\n * .catch(console.error)\n * ```\n */\n getVersions: function getEnvironmentTemplateVersions() {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'versions',\n params: {\n organizationId,\n environmentTemplateId: raw.sys.id,\n },\n }).then((data) => wrapEnvironmentTemplateCollection(makeRequest, data, organizationId))\n },\n /**\n * Gets a collection of all installations for the environment template\n * @param [installationParams.spaceId] - Space ID to filter installations by space and environment\n * @param [installationParams.environmentId] - Environment ID to filter installations by space and environment\n * @return Promise for a collection of EnvironmentTemplateInstallations\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.getInstallations())\n * .then((environmentTemplateInstallations) =>\n * console.log(environmentTemplateInstallations.items)\n * )\n * .catch(console.error)\n * ```\n */\n getInstallations: function getEnvironmentTemplateInstallations({\n spaceId,\n environmentId,\n ...query\n }: {\n spaceId?: string\n environmentId?: string\n } & BasicCursorPaginationOptions = {}) {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplateInstallation',\n action: 'getMany',\n params: {\n organizationId,\n environmentTemplateId: raw.sys.id,\n query: { ...createRequestConfig({ query }).params },\n spaceId,\n environmentId,\n },\n }).then((data) => wrapEnvironmentTemplateInstallationCollection(makeRequest, data))\n },\n /**\n * Validates an environment template against a given space and environment\n * @param params.spaceId - Space ID where the template should be installed into\n * @param params.environmentId - Environment ID where the template should be installed into\n * @param [params.version] - Version of the template\n * @param [params.installation.takeover] - Already existing Content types to takeover in the target environment\n * @param [params.changeSet] - Change set which should be applied\n * @return Promise for a EnvironmentTemplateValidation\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.validate({\n * spaceId: '<space_id>',\n * environmentId: '<environment_id>',\n * version: <version>,\n * }))\n * .then((validationResult) => console.log(validationResult))\n * .catch(console.error)\n * ```\n */\n validate: function validateEnvironmentTemplate({\n spaceId,\n environmentId,\n version,\n takeover,\n changeSet,\n }: {\n spaceId: string\n environmentId: string\n version?: number\n } & ValidateEnvironmentTemplateInstallationProps) {\n const raw: EnvironmentTemplateProps = this.toPlainObject()\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'validate',\n params: {\n spaceId,\n version,\n environmentId,\n environmentTemplateId: raw.sys.id,\n },\n payload: {\n ...(takeover && { takeover }),\n ...(changeSet && { changeSet }),\n },\n })\n },\n /**\n * Installs a template against a given space and environment\n * @param params.spaceId - Space ID where the template should be installed into\n * @param params.environmentId - Environment ID where the template should be installed into\n * @param params.installation.version- Template version which should be installed\n * @param [params.installation.takeover] - Already existing Content types tp takeover in the target environment\n * @param [params.changeSet] - Change set which should be applied\n * @return Promise for a EnvironmentTemplateInstallation\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.validate({\n * spaceId: '<space_id>',\n * environmentId: '<environment_id>',\n * installation: {\n * version: <version>,\n * }\n * }))\n * .then((installation) => console.log(installation))\n * .catch(console.error)\n * ```\n */\n install: function installEnvironmentTemplate({\n spaceId,\n environmentId,\n installation,\n }: {\n spaceId: string\n environmentId: string\n installation: CreateEnvironmentTemplateInstallationProps\n }) {\n const raw: EnvironmentTemplateProps = this.toPlainObject()\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'install',\n params: {\n spaceId,\n environmentId,\n environmentTemplateId: raw.sys.id,\n },\n payload: installation,\n })\n },\n /**\n * Disconnects the template from a given environment\n * @param params.spaceId - Space ID where the template should be installed into\n * @param params.environmentId - Environment ID where the template should be installed into\n * @return Promise for the disconnection with no data\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then(environmentTemplate) => environmentTemplate.disconnected())\n * .then(() => console.log('Template disconnected'))\n * .catch(console.error)\n * ```\n */\n disconnect: function disconnectEnvironmentTemplate({\n spaceId,\n environmentId,\n }: {\n spaceId: string\n environmentId: string\n }) {\n const raw: EnvironmentTemplateProps = this.toPlainObject()\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'disconnect',\n params: {\n spaceId,\n environmentId,\n environmentTemplateId: raw.sys.id,\n },\n })\n },\n }\n}\n"],"names":[],"mappings":";;;;AAeM,SAAU,4BAA4B,CAAC,WAAwB,EAAE,cAAsB,EAAA;IAC3F,OAAO;AACL;;;;;;;;;;;;;;;;;;;AAmBG;QACH,MAAM,EAAE,SAAS,yBAAyB,GAAA;AACxC,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,EAA8B;AAC5D,YAAA,OAAO,WAAW,CAAC;AACjB,gBAAA,UAAU,EAAE,qBAAqB;AACjC,gBAAA,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE;AAC7D,gBAAA,OAAO,EAAE,GAAG;AACb,aAAA,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,uBAAuB,CAAC,WAAW,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC/E,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;AAuBG;QACH,aAAa,EAAE,SAAS,gCAAgC,CAAC,EACvD,WAAW,EACX,kBAAkB,GAInB,EAAA;AACC,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,EAA8B;AAC5D,YAAA,OAAO,WAAW,CAAC;AACjB,gBAAA,UAAU,EAAE,qBAAqB;AACjC,gBAAA,MAAM,EAAE,eAAe;AACvB,gBAAA,MAAM,EAAE,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,CAAC,GAAG,CAAC,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AAO,WAAW,CAAC;AACjB,gBAAA,UAAU,EAAE,qBAAqB;AACjC,gBAAA,MAAM,EAAE,SAAS;AACjB,gBAAA,MAAM,EAAE;oBACN,OAAO;oBACP,aAAa;AACb,oBAAA,qBAAqB,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE;AAClC,iBAAA;AACD,gBAAA,OAAO,EAAE,YAAY;AACtB,aAAA,CAAC;QACJ,CAAC;AACD;;;;;;;;;;;;;;;;;AAiBG;QACH,UAAU,EAAE,SAAS,6BAA6B,CAAC,EACjD,OAAO,EACP,aAAa,GAId,EAAA;AACC,YAAA,MAAM,GAAG,GAA6B,IAAI,CAAC,aAAa,EAAE;AAC1D,YAAA,OAAO,WAAW,CAAC;AACjB,gBAAA,UAAU,EAAE,qBAAqB;AACjC,gBAAA,MAAM,EAAE,YAAY;AACpB,gBAAA,MAAM,EAAE;oBACN,OAAO;oBACP,aAAa;AACb,oBAAA,qBAAqB,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE;AAClC,iBAAA;AACF,aAAA,CAAC;QACJ,CAAC;KACF;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"create-environment-template-api.js","sources":["../../../lib/create-environment-template-api.ts"],"sourcesContent":["import { createRequestConfig } from 'contentful-sdk-core'\nimport type { BasicCursorPaginationOptions, MakeRequest } from './common-types.js'\nimport {\n wrapEnvironmentTemplate,\n wrapEnvironmentTemplateCollection,\n type EnvironmentTemplateProps,\n} from './entities/environment-template.js'\nimport {\n wrapEnvironmentTemplateInstallationCollection,\n type CreateEnvironmentTemplateInstallationProps,\n type ValidateEnvironmentTemplateInstallationProps,\n} from './entities/environment-template-installation.js'\n\nexport type ContentfulEnvironmentTemplateApi = ReturnType<typeof createEnvironmentTemplateApi>\n\nexport function createEnvironmentTemplateApi(makeRequest: MakeRequest, organizationId: string) {\n return {\n /**\n * Updates a environment template\n * @return Promise for new version of the template\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => {\n * environmentTemplate.name = 'New name'\n * return environmentTemplate.update()\n * })\n * .then((environmentTemplate) =>\n * console.log(`Environment template ${environmentTemplate.sys.id} renamed.`)\n * ).catch(console.error)\n * ```\n */\n update: function updateEnvironmentTemplate() {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'update',\n params: { organizationId, environmentTemplateId: raw.sys.id },\n payload: raw,\n }).then((data) => wrapEnvironmentTemplate(makeRequest, data, organizationId))\n },\n /**\n * Updates environment template version data\n * @param version.versionName - Name of the environment template version\n * @param version.versionDescription - Description of the environment template version\n * @return Promise for an updated EnvironmentTemplate\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => {\n * return environmentTemplate.updateVersion({\n * versionName: 'New Name',\n * versionDescription: 'New Description',\n * })\n * })\n * .then((environmentTemplate) =>\n * console.log(`Environment template version ${environmentTemplate.sys.id} renamed.`)\n * ).catch(console.error)\n * ```\n */\n updateVersion: function updateEnvironmentTemplateVersion({\n versionName,\n versionDescription,\n }: {\n versionName: string\n versionDescription: string\n }) {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'versionUpdate',\n params: { organizationId, environmentTemplateId: raw.sys.id, version: raw.sys.version },\n payload: { versionName, versionDescription },\n }).then((data) => wrapEnvironmentTemplate(makeRequest, data, organizationId))\n },\n /**\n * Deletes the environment template\n * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.\n * @example ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.delete())\n * .then(() => console.log('Environment template deleted.'))\n * .catch(console.error)\n * ```\n */\n delete: function deleteEnvironmentTemplate() {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'delete',\n params: { organizationId, environmentTemplateId: raw.sys.id },\n })\n },\n /**\n * Gets a collection of all versions for the environment template\n * @return Promise for a EnvironmentTemplate\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.getVersions())\n * .then((environmentTemplateVersions) => console.log(environmentTemplateVersions.items))\n * .catch(console.error)\n * ```\n */\n getVersions: function getEnvironmentTemplateVersions() {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'versions',\n params: {\n organizationId,\n environmentTemplateId: raw.sys.id,\n },\n }).then((data) => wrapEnvironmentTemplateCollection(makeRequest, data, organizationId))\n },\n /**\n * Gets a collection of all installations for the environment template\n * @param [installationParams.spaceId] - Space ID to filter installations by space and environment\n * @param [installationParams.environmentId] - Environment ID to filter installations by space and environment\n * @param [installationParams.latestOnly] - Boolean flag to only return the latest installation per environment\n * @return Promise for a collection of EnvironmentTemplateInstallations\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.getInstallations())\n * .then((environmentTemplateInstallations) =>\n * console.log(environmentTemplateInstallations.items)\n * )\n * .catch(console.error)\n * ```\n */\n getInstallations: function getEnvironmentTemplateInstallations({\n spaceId,\n environmentId,\n latestOnly,\n ...query\n }: {\n spaceId?: string\n environmentId?: string\n latestOnly?: boolean\n } & BasicCursorPaginationOptions = {}) {\n const raw = this.toPlainObject() as EnvironmentTemplateProps\n return makeRequest({\n entityType: 'EnvironmentTemplateInstallation',\n action: 'getMany',\n params: {\n organizationId,\n environmentTemplateId: raw.sys.id,\n query: { ...createRequestConfig({ query }).params },\n spaceId,\n environmentId,\n latestOnly,\n },\n }).then((data) => wrapEnvironmentTemplateInstallationCollection(makeRequest, data))\n },\n /**\n * Validates an environment template against a given space and environment\n * @param params.spaceId - Space ID where the template should be installed into\n * @param params.environmentId - Environment ID where the template should be installed into\n * @param [params.version] - Version of the template\n * @param [params.installation.takeover] - Already existing Content types to takeover in the target environment\n * @param [params.changeSet] - Change set which should be applied\n * @return Promise for a EnvironmentTemplateValidation\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.validate({\n * spaceId: '<space_id>',\n * environmentId: '<environment_id>',\n * version: <version>,\n * }))\n * .then((validationResult) => console.log(validationResult))\n * .catch(console.error)\n * ```\n */\n validate: function validateEnvironmentTemplate({\n spaceId,\n environmentId,\n version,\n takeover,\n changeSet,\n }: {\n spaceId: string\n environmentId: string\n version?: number\n } & ValidateEnvironmentTemplateInstallationProps) {\n const raw: EnvironmentTemplateProps = this.toPlainObject()\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'validate',\n params: {\n spaceId,\n version,\n environmentId,\n environmentTemplateId: raw.sys.id,\n },\n payload: {\n ...(takeover && { takeover }),\n ...(changeSet && { changeSet }),\n },\n })\n },\n /**\n * Installs a template against a given space and environment\n * @param params.spaceId - Space ID where the template should be installed into\n * @param params.environmentId - Environment ID where the template should be installed into\n * @param params.installation.version- Template version which should be installed\n * @param [params.installation.takeover] - Already existing Content types tp takeover in the target environment\n * @param [params.changeSet] - Change set which should be applied\n * @return Promise for a EnvironmentTemplateInstallation\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then((environmentTemplate) => environmentTemplate.validate({\n * spaceId: '<space_id>',\n * environmentId: '<environment_id>',\n * installation: {\n * version: <version>,\n * }\n * }))\n * .then((installation) => console.log(installation))\n * .catch(console.error)\n * ```\n */\n install: function installEnvironmentTemplate({\n spaceId,\n environmentId,\n installation,\n }: {\n spaceId: string\n environmentId: string\n installation: CreateEnvironmentTemplateInstallationProps\n }) {\n const raw: EnvironmentTemplateProps = this.toPlainObject()\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'install',\n params: {\n spaceId,\n environmentId,\n environmentTemplateId: raw.sys.id,\n },\n payload: installation,\n })\n },\n /**\n * Disconnects the template from a given environment\n * @param params.spaceId - Space ID where the template should be installed into\n * @param params.environmentId - Environment ID where the template should be installed into\n * @return Promise for the disconnection with no data\n * ```javascript\n * const contentful = require('contentful-management')\n *\n * const client = contentful.createClient({\n * accessToken: '<content_management_api_key>'\n * })\n *\n * client.getEnvironmentTemplate('<organization_id>', '<environment_template_id>')\n * .then(environmentTemplate) => environmentTemplate.disconnected())\n * .then(() => console.log('Template disconnected'))\n * .catch(console.error)\n * ```\n */\n disconnect: function disconnectEnvironmentTemplate({\n spaceId,\n environmentId,\n }: {\n spaceId: string\n environmentId: string\n }) {\n const raw: EnvironmentTemplateProps = this.toPlainObject()\n return makeRequest({\n entityType: 'EnvironmentTemplate',\n action: 'disconnect',\n params: {\n spaceId,\n environmentId,\n environmentTemplateId: raw.sys.id,\n },\n })\n },\n }\n}\n"],"names":[],"mappings":";;;;AAeM,SAAU,4BAA4B,CAAC,WAAwB,EAAE,cAAsB,EAAA;IAC3F,OAAO;AACL;;;;;;;;;;;;;;;;;;;AAmBG;QACH,MAAM,EAAE,SAAS,yBAAyB,GAAA;AACxC,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,EAA8B;AAC5D,YAAA,OAAO,WAAW,CAAC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AAa;AACb,oBAAA,qBAAqB,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE;AAClC,iBAAA;AACF,aAAA,CAAC;QACJ,CAAC;KACF;AACH;;;;"}
|
|
@@ -9,7 +9,13 @@ export interface NavigationItem {
|
|
|
9
9
|
name: string;
|
|
10
10
|
path: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* These locations are currently restricted to internal Contentful apps only.
|
|
14
|
+
* If you are interested in using these locations for your app,
|
|
15
|
+
* please reach out to Contentful Support (https://www.contentful.com/support/).
|
|
16
|
+
*/
|
|
17
|
+
type InternalLocationType = 'agent';
|
|
18
|
+
type LocationType = 'app-config' | 'entry-sidebar' | 'entry-editor' | 'dialog' | 'page' | 'home' | InternalLocationType;
|
|
13
19
|
export interface SimpleLocation {
|
|
14
20
|
location: LocationType;
|
|
15
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-definition.js","sources":["../../../../lib/entities/app-definition.ts"],"sourcesContent":["import copy from 'fast-copy'\nimport { freezeSys, toPlainObject } from 'contentful-sdk-core'\nimport type { DefaultElements, BasicMetaSysProps, MakeRequest, Link } from '../common-types.js'\nimport enhanceWithMethods from '../enhance-with-methods.js'\nimport { wrapCollection } from '../common-utils.js'\nimport type { ContentfulAppDefinitionAPI } from '../create-app-definition-api.js'\nimport createAppDefinitionApi from '../create-app-definition-api.js'\nimport type { SetOptional, Except } from 'type-fest'\nimport type { FieldType } from './field-type.js'\nimport type { InstallationParameterType, ParameterDefinition } from './widget-parameters.js'\nimport type { AppInstallationProps } from './app-installation.js'\nimport type { EnvironmentProps } from './environment.js'\n\nexport interface NavigationItem {\n name: string\n path: string\n}\n\ntype
|
|
1
|
+
{"version":3,"file":"app-definition.js","sources":["../../../../lib/entities/app-definition.ts"],"sourcesContent":["import copy from 'fast-copy'\nimport { freezeSys, toPlainObject } from 'contentful-sdk-core'\nimport type { DefaultElements, BasicMetaSysProps, MakeRequest, Link } from '../common-types.js'\nimport enhanceWithMethods from '../enhance-with-methods.js'\nimport { wrapCollection } from '../common-utils.js'\nimport type { ContentfulAppDefinitionAPI } from '../create-app-definition-api.js'\nimport createAppDefinitionApi from '../create-app-definition-api.js'\nimport type { SetOptional, Except } from 'type-fest'\nimport type { FieldType } from './field-type.js'\nimport type { InstallationParameterType, ParameterDefinition } from './widget-parameters.js'\nimport type { AppInstallationProps } from './app-installation.js'\nimport type { EnvironmentProps } from './environment.js'\n\nexport interface NavigationItem {\n name: string\n path: string\n}\n\n/**\n * These locations are currently restricted to internal Contentful apps only.\n * If you are interested in using these locations for your app,\n * please reach out to Contentful Support (https://www.contentful.com/support/).\n */\ntype InternalLocationType = 'agent'\n\ntype LocationType =\n | 'app-config'\n | 'entry-sidebar'\n | 'entry-editor'\n | 'dialog'\n | 'page'\n | 'home'\n | InternalLocationType\n\nexport interface SimpleLocation {\n location: LocationType\n}\n\nexport interface EntryFieldLocation {\n location: 'entry-field'\n fieldTypes: FieldType[]\n}\n\nexport interface PageLocation {\n location: 'page'\n navigationItem?: NavigationItem\n}\n\nexport type AppLocation = SimpleLocation | EntryFieldLocation | PageLocation\n\nexport type AppDefinitionProps = {\n /**\n * System metadata\n */\n sys: BasicMetaSysProps & {\n organization: Link<'Organization'>\n shared: boolean\n }\n /**\n * App name\n */\n name: string\n /**\n * URL where the root HTML document of the app can be found\n */\n src?: string\n /**\n * Link to an AppBundle\n */\n bundle?: Link<'AppBundle'>\n /**\n * Locations where the app can be installed\n */\n locations?: AppLocation[]\n /**\n * Instance parameter definitions\n */\n parameters?: {\n instance?: ParameterDefinition[]\n installation?: ParameterDefinition<InstallationParameterType>[]\n }\n}\n\nexport type CreateAppDefinitionProps = SetOptional<\n Except<AppDefinitionProps, 'sys' | 'bundle'>,\n 'src' | 'locations'\n>\n\nexport type AppDefinition = ContentfulAppDefinitionAPI &\n AppDefinitionProps &\n DefaultElements<AppDefinitionProps>\n\nexport type AppInstallationsForOrganizationProps = {\n sys: {\n type: 'Array'\n }\n items: AppInstallationProps[]\n includes: {\n Environment: EnvironmentProps[]\n }\n}\n\n/**\n * @private\n * @param makeRequest - function to make requests via an adapter\n * @param data - Raw App Definition data\n * @return Wrapped App Definition data\n */\nexport function wrapAppDefinition(\n makeRequest: MakeRequest,\n data: AppDefinitionProps,\n): AppDefinition {\n const appDefinition = toPlainObject(copy(data))\n const appDefinitionWithMethods = enhanceWithMethods(\n appDefinition,\n createAppDefinitionApi(makeRequest),\n )\n return freezeSys(appDefinitionWithMethods)\n}\n\n/**\n * @private\n * @param makeRequest - function to make requests via an adapter\n * @param data - Raw App Definition collection data\n * @return Wrapped App Definition collection data\n */\nexport const wrapAppDefinitionCollection = wrapCollection(wrapAppDefinition)\n"],"names":[],"mappings":";;;;;;AAsGA;;;;;AAKG;AACG,SAAU,iBAAiB,CAC/B,WAAwB,EACxB,IAAwB,EAAA;IAExB,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,wBAAwB,GAAG,kBAAkB,CACjD,aAAa,EACb,sBAAsB,CAAC,WAAW,CAAC,CACpC;AACD,IAAA,OAAO,SAAS,CAAC,wBAAwB,CAAC;AAC5C;AAEA;;;;;AAKG;MACU,2BAA2B,GAAG,cAAc,CAAC,iBAAiB;;;;"}
|
|
@@ -57,6 +57,34 @@ export interface BulkActionPublishPayload extends MakeRequestPayload {
|
|
|
57
57
|
items: Collection<VersionedLink<Entity>>;
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
interface AddFieldsEntity<L extends Link<Entity> | VersionedLink<Entity>> {
|
|
61
|
+
entity: L;
|
|
62
|
+
add?: {
|
|
63
|
+
fields: Record<'*', string[]>;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
interface RemoveFieldsEntity<L extends Link<Entity> | VersionedLink<Entity>> {
|
|
67
|
+
entity: L;
|
|
68
|
+
remove?: {
|
|
69
|
+
fields: Record<'*', string[]>;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
type BulkActionEntity<L extends Link<Entity> | VersionedLink<Entity>> = {
|
|
73
|
+
entity: L;
|
|
74
|
+
};
|
|
75
|
+
export interface PublishBulkActionV2Payload<PublishActionType extends 'add' | 'remove' = 'add'> {
|
|
76
|
+
action: 'publish';
|
|
77
|
+
entities: PublishActionType extends 'remove' ? RemoveFieldsEntity<VersionedLink<Entity>>[] : AddFieldsEntity<VersionedLink<Entity>>[];
|
|
78
|
+
}
|
|
79
|
+
export interface ValidateBulkActionV2Payload<PublishActionType extends 'add' | 'remove' = 'add'> {
|
|
80
|
+
action: 'validate';
|
|
81
|
+
entities: PublishActionType extends 'remove' ? RemoveFieldsEntity<Link<Entity>>[] : AddFieldsEntity<Link<Entity>>[];
|
|
82
|
+
}
|
|
83
|
+
export interface UnpublishBulkActionV2Payload {
|
|
84
|
+
action: 'unpublish';
|
|
85
|
+
entities: BulkActionEntity<Link<Entity>>[];
|
|
86
|
+
}
|
|
87
|
+
export type BulkActionV2Payload = PublishBulkActionV2Payload<'add'> | PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload | ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>;
|
|
60
88
|
export type BulkActionSysProps = {
|
|
61
89
|
id: string;
|
|
62
90
|
type: 'BulkAction';
|
|
@@ -68,7 +96,7 @@ export type BulkActionSysProps = {
|
|
|
68
96
|
updatedAt: ISO8601Timestamp;
|
|
69
97
|
};
|
|
70
98
|
/** The object returned by the BulkActions API */
|
|
71
|
-
export interface BulkActionProps<TPayload extends BulkActionPayload = any> {
|
|
99
|
+
export interface BulkActionProps<TPayload extends BulkActionPayload | BulkActionV2Payload = any> {
|
|
72
100
|
sys: BulkActionSysProps;
|
|
73
101
|
action: BulkActionType;
|
|
74
102
|
/** original payload when BulkAction was created */
|
|
@@ -82,7 +110,7 @@ export interface BulkActionApiMethods {
|
|
|
82
110
|
/** Waits until the BulkAction is in one of the final states (`succeeded` or `failed`) and returns it. */
|
|
83
111
|
waitProcessing(options?: AsyncActionProcessingOptions): Promise<BulkAction>;
|
|
84
112
|
}
|
|
85
|
-
export interface BulkAction<T extends BulkActionPayload = any> extends BulkActionProps<T>, BulkActionApiMethods, DefaultElements<BulkActionProps<T>> {
|
|
113
|
+
export interface BulkAction<T extends BulkActionPayload | BulkActionV2Payload = any> extends BulkActionProps<T>, BulkActionApiMethods, DefaultElements<BulkActionProps<T>> {
|
|
86
114
|
}
|
|
87
115
|
/**
|
|
88
116
|
* @private
|
|
@@ -90,5 +118,5 @@ export interface BulkAction<T extends BulkActionPayload = any> extends BulkActio
|
|
|
90
118
|
* @param data - Raw BulkAction data
|
|
91
119
|
* @return Wrapped BulkAction data
|
|
92
120
|
*/
|
|
93
|
-
export declare function wrapBulkAction<TPayload extends BulkActionPayload = any>(makeRequest: MakeRequest, data: BulkActionProps<BulkActionPayload>): BulkAction<TPayload>;
|
|
121
|
+
export declare function wrapBulkAction<TPayload extends BulkActionPayload | BulkActionV2Payload = any>(makeRequest: MakeRequest, data: BulkActionProps<BulkActionPayload | BulkActionV2Payload>): BulkAction<TPayload>;
|
|
94
122
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-action.js","sources":["../../../../lib/entities/bulk-action.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { freezeSys, toPlainObject } from 'contentful-sdk-core'\nimport copy from 'fast-copy'\nimport type {\n DefaultElements,\n ISO8601Timestamp,\n Link,\n MakeRequest,\n MakeRequestPayload,\n VersionedLink,\n} from '../common-types.js'\nimport enhanceWithMethods from '../enhance-with-methods.js'\nimport type { AsyncActionProcessingOptions } from '../methods/action.js'\nimport { pollAsyncActionStatus } from '../methods/action.js'\n\n/** Entity types supported by the BulkAction API */\ntype Entity = 'Entry' | 'Asset'\ntype Collection<T> = Array<T>\ntype EntityError = { entity: VersionedLink<Entity> | Link<Entity>; error: any }\n\nexport type BulkActionType = 'publish' | 'unpublish' | 'validate'\n\n/** Represents the state of the BulkAction */\nexport enum BulkActionStatus {\n /** BulkAction is pending execution */\n created = 'created',\n /** BulkAction has been started and pending completion */\n inProgress = 'inProgress',\n /** BulkAction was completed successfully (terminal state) */\n succeeded = 'succeeded',\n /** BulkAction failed to complete (terminal state) */\n failed = 'failed',\n}\n\nconst STATUSES = Object.values(BulkActionStatus)\ntype BulkActionStatuses = (typeof STATUSES)[number]\n\ninterface BulkActionFailedError {\n sys: { type: 'Error'; id: 'BulkActionFailed' }\n message?: string\n details?: {\n errors: Collection<EntityError>\n }\n}\n\nexport type BulkActionPayload =\n | BulkActionPublishPayload\n | BulkActionUnpublishPayload\n | BulkActionValidatePayload\n\nexport interface BulkActionValidatePayload extends MakeRequestPayload {\n action?: 'publish'\n entities: {\n sys?: { type: 'Array' }\n items: Collection<Link<Entity>>\n }\n}\nexport interface BulkActionUnpublishPayload extends MakeRequestPayload {\n entities: {\n sys?: { type: 'Array' }\n items: Collection<Link<Entity>>\n }\n}\n\nexport interface BulkActionPublishPayload extends MakeRequestPayload {\n entities: {\n sys?: { type: 'Array' }\n items: Collection<VersionedLink<Entity>>\n }\n}\n\nexport type BulkActionSysProps = {\n id: string\n type: 'BulkAction'\n status: BulkActionStatuses\n space: Link<'Space'>\n environment: Link<'Environment'>\n createdBy: Link<'User'>\n createdAt: ISO8601Timestamp\n updatedAt: ISO8601Timestamp\n}\n\n/** The object returned by the BulkActions API */\nexport interface BulkActionProps<TPayload extends BulkActionPayload = any> {\n sys: BulkActionSysProps\n action: BulkActionType\n /** original payload when BulkAction was created */\n payload: TPayload\n /** error information, if present */\n error?: BulkActionFailedError\n}\n\nexport interface BulkActionApiMethods {\n /** Performs a new GET request and returns the wrapper BulkAction */\n get(): BulkAction\n /** Waits until the BulkAction is in one of the final states (`succeeded` or `failed`) and returns it. */\n waitProcessing(options?: AsyncActionProcessingOptions): Promise<BulkAction>\n}\n\n/**\n * @private\n */\nfunction createBulkActionApi(makeRequest: MakeRequest) {\n const getParams = (self: BulkAction) => {\n const bulkAction = self.toPlainObject()\n\n return {\n spaceId: bulkAction.sys.space.sys.id,\n environmentId: bulkAction.sys.environment.sys.id,\n bulkActionId: bulkAction.sys.id,\n }\n }\n\n return {\n async get() {\n const params = getParams(this)\n return makeRequest({\n entityType: 'BulkAction',\n action: 'get',\n params,\n }).then((bulkAction) => wrapBulkAction(makeRequest, bulkAction))\n },\n async waitProcessing<TPayload extends BulkActionPayload = any>(\n options?: AsyncActionProcessingOptions,\n ): Promise<BulkActionProps<TPayload>> {\n return pollAsyncActionStatus<BulkActionProps<TPayload>>(async () => this.get(), options)\n },\n }\n}\n\nexport interface BulkAction<T extends BulkActionPayload = any>\n extends BulkActionProps<T>,\n BulkActionApiMethods,\n DefaultElements<BulkActionProps<T>> {}\n\n/**\n * @private\n * @param makeRequest - function to make requests via an adapter\n * @param data - Raw BulkAction data\n * @return Wrapped BulkAction data\n */\nexport function wrapBulkAction<TPayload extends BulkActionPayload = any>(\n makeRequest: MakeRequest,\n data: BulkActionProps<BulkActionPayload>,\n): BulkAction<TPayload> {\n const bulkAction = toPlainObject(copy(data))\n const bulkActionWithApiMethods = enhanceWithMethods(\n bulkAction as any,\n createBulkActionApi(makeRequest),\n )\n return freezeSys(bulkActionWithApiMethods) as BulkAction<TPayload>\n}\n"],"names":[],"mappings":";;;;;AAAA;AAsBA;IACY;AAAZ,CAAA,UAAY,gBAAgB,EAAA;;AAE1B,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;;AAEnB,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;;AAEzB,IAAA,gBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;;AAEvB,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACnB,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;AAWX,MAAM,CAAC,MAAM,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"bulk-action.js","sources":["../../../../lib/entities/bulk-action.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { freezeSys, toPlainObject } from 'contentful-sdk-core'\nimport copy from 'fast-copy'\nimport type {\n DefaultElements,\n ISO8601Timestamp,\n Link,\n MakeRequest,\n MakeRequestPayload,\n VersionedLink,\n} from '../common-types.js'\nimport enhanceWithMethods from '../enhance-with-methods.js'\nimport type { AsyncActionProcessingOptions } from '../methods/action.js'\nimport { pollAsyncActionStatus } from '../methods/action.js'\n\n/** Entity types supported by the BulkAction API */\ntype Entity = 'Entry' | 'Asset'\ntype Collection<T> = Array<T>\ntype EntityError = { entity: VersionedLink<Entity> | Link<Entity>; error: any }\n\nexport type BulkActionType = 'publish' | 'unpublish' | 'validate'\n\n/** Represents the state of the BulkAction */\nexport enum BulkActionStatus {\n /** BulkAction is pending execution */\n created = 'created',\n /** BulkAction has been started and pending completion */\n inProgress = 'inProgress',\n /** BulkAction was completed successfully (terminal state) */\n succeeded = 'succeeded',\n /** BulkAction failed to complete (terminal state) */\n failed = 'failed',\n}\n\nconst STATUSES = Object.values(BulkActionStatus)\ntype BulkActionStatuses = (typeof STATUSES)[number]\n\ninterface BulkActionFailedError {\n sys: { type: 'Error'; id: 'BulkActionFailed' }\n message?: string\n details?: {\n errors: Collection<EntityError>\n }\n}\n\nexport type BulkActionPayload =\n | BulkActionPublishPayload\n | BulkActionUnpublishPayload\n | BulkActionValidatePayload\n\nexport interface BulkActionValidatePayload extends MakeRequestPayload {\n action?: 'publish'\n entities: {\n sys?: { type: 'Array' }\n items: Collection<Link<Entity>>\n }\n}\nexport interface BulkActionUnpublishPayload extends MakeRequestPayload {\n entities: {\n sys?: { type: 'Array' }\n items: Collection<Link<Entity>>\n }\n}\n\nexport interface BulkActionPublishPayload extends MakeRequestPayload {\n entities: {\n sys?: { type: 'Array' }\n items: Collection<VersionedLink<Entity>>\n }\n}\n\ninterface AddFieldsEntity<L extends Link<Entity> | VersionedLink<Entity>> {\n entity: L\n add?: {\n fields: Record<'*', string[]>\n }\n}\n\ninterface RemoveFieldsEntity<L extends Link<Entity> | VersionedLink<Entity>> {\n entity: L\n remove?: {\n fields: Record<'*', string[]>\n }\n}\ntype BulkActionEntity<L extends Link<Entity> | VersionedLink<Entity>> = {\n entity: L\n}\n\nexport interface PublishBulkActionV2Payload<PublishActionType extends 'add' | 'remove' = 'add'> {\n action: 'publish'\n entities: PublishActionType extends 'remove'\n ? RemoveFieldsEntity<VersionedLink<Entity>>[]\n : AddFieldsEntity<VersionedLink<Entity>>[]\n}\n\nexport interface ValidateBulkActionV2Payload<PublishActionType extends 'add' | 'remove' = 'add'> {\n action: 'validate'\n entities: PublishActionType extends 'remove'\n ? RemoveFieldsEntity<Link<Entity>>[]\n : AddFieldsEntity<Link<Entity>>[]\n}\n\nexport interface UnpublishBulkActionV2Payload {\n action: 'unpublish'\n entities: BulkActionEntity<Link<Entity>>[]\n}\n\nexport type BulkActionV2Payload =\n | PublishBulkActionV2Payload<'add'>\n | PublishBulkActionV2Payload<'remove'>\n | UnpublishBulkActionV2Payload\n | ValidateBulkActionV2Payload<'add'>\n | ValidateBulkActionV2Payload<'remove'>\n\nexport type BulkActionSysProps = {\n id: string\n type: 'BulkAction'\n status: BulkActionStatuses\n space: Link<'Space'>\n environment: Link<'Environment'>\n createdBy: Link<'User'>\n createdAt: ISO8601Timestamp\n updatedAt: ISO8601Timestamp\n}\n\n/** The object returned by the BulkActions API */\nexport interface BulkActionProps<TPayload extends BulkActionPayload | BulkActionV2Payload = any> {\n sys: BulkActionSysProps\n action: BulkActionType\n /** original payload when BulkAction was created */\n payload: TPayload\n /** error information, if present */\n error?: BulkActionFailedError\n}\n\nexport interface BulkActionApiMethods {\n /** Performs a new GET request and returns the wrapper BulkAction */\n get(): BulkAction\n /** Waits until the BulkAction is in one of the final states (`succeeded` or `failed`) and returns it. */\n waitProcessing(options?: AsyncActionProcessingOptions): Promise<BulkAction>\n}\n\n/**\n * @private\n */\nfunction createBulkActionApi(makeRequest: MakeRequest) {\n const getParams = (self: BulkAction) => {\n const bulkAction = self.toPlainObject()\n\n return {\n spaceId: bulkAction.sys.space.sys.id,\n environmentId: bulkAction.sys.environment.sys.id,\n bulkActionId: bulkAction.sys.id,\n }\n }\n\n return {\n async get() {\n const params = getParams(this)\n return makeRequest({\n entityType: 'BulkAction',\n action: 'get',\n params,\n }).then((bulkAction) => wrapBulkAction(makeRequest, bulkAction))\n },\n async waitProcessing<TPayload extends BulkActionPayload | BulkActionV2Payload = any>(\n options?: AsyncActionProcessingOptions,\n ): Promise<BulkActionProps<TPayload>> {\n return pollAsyncActionStatus<BulkActionProps<TPayload>>(async () => this.get(), options)\n },\n }\n}\n\nexport interface BulkAction<T extends BulkActionPayload | BulkActionV2Payload = any>\n extends BulkActionProps<T>,\n BulkActionApiMethods,\n DefaultElements<BulkActionProps<T>> {}\n\n/**\n * @private\n * @param makeRequest - function to make requests via an adapter\n * @param data - Raw BulkAction data\n * @return Wrapped BulkAction data\n */\nexport function wrapBulkAction<TPayload extends BulkActionPayload | BulkActionV2Payload = any>(\n makeRequest: MakeRequest,\n data: BulkActionProps<BulkActionPayload | BulkActionV2Payload>,\n): BulkAction<TPayload> {\n const bulkAction = toPlainObject(copy(data))\n const bulkActionWithApiMethods = enhanceWithMethods(\n bulkAction as any,\n createBulkActionApi(makeRequest),\n )\n return freezeSys(bulkActionWithApiMethods) as BulkAction<TPayload>\n}\n"],"names":[],"mappings":";;;;;AAAA;AAsBA;IACY;AAAZ,CAAA,UAAY,gBAAgB,EAAA;;AAE1B,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;;AAEnB,IAAA,gBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;;AAEzB,IAAA,gBAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;;AAEvB,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACnB,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;AAWX,MAAM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|
|
36
36
|
};
|
|
37
37
|
changeSet?: Link<'ChangeSet'>;
|
|
38
|
+
deleteDeletedFields?: boolean;
|
|
38
39
|
};
|
|
39
40
|
export type ValidateEnvironmentTemplateInstallationProps = Omit<CreateEnvironmentTemplateInstallationProps, 'version'>;
|
|
40
41
|
export type ValidationFinding = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-template-installation.js","sources":["../../../../lib/entities/environment-template-installation.ts"],"sourcesContent":["import { freezeSys, toPlainObject } from 'contentful-sdk-core'\nimport copy from 'fast-copy'\nimport type {\n BasicMetaSysProps,\n DefaultElements,\n ISO8601Timestamp,\n Link,\n MakeRequest,\n VersionedLink,\n} from '../common-types.js'\nimport { wrapCursorPaginatedCollection } from '../common-utils.js'\n\ntype JsonObject = { [Key in string]?: JsonValue }\ntype JsonArray = Array<JsonValue>\ntype JsonValue = string | number | boolean | JsonObject | JsonArray | null\n\nenum EnvironmentTemplateInstallationStatuses {\n created = 'created',\n inProgress = 'inProgress',\n failed = 'failed',\n succeeded = 'succeeded',\n disconnected = 'disconnected',\n inRetry = 'inRetry',\n}\n\nexport type EnvironmentTemplateInstallationStatus =\n keyof typeof EnvironmentTemplateInstallationStatuses\n\nexport type EnvironmentTemplateInstallationProps = {\n sys: BasicMetaSysProps & {\n type: 'EnvironmentTemplateInstallation'\n space: Link<'Space'>\n template: VersionedLink<'Template'>\n status: EnvironmentTemplateInstallationStatus\n createdAt: ISO8601Timestamp\n updatedAt: ISO8601Timestamp\n createdBy: Link<'User' | 'AppDefinition'>\n updatedBy: Link<'User' | 'AppDefinition'>\n completedAt?: ISO8601Timestamp\n errors?: JsonArray\n environment: Link<'Environment'>\n version: number\n }\n}\n\nexport type CreateEnvironmentTemplateInstallationProps = {\n version: number\n takeover?: {\n items: Link<'ContentType'>[]\n }\n changeSet?: Link<'ChangeSet'>\n}\n\nexport type ValidateEnvironmentTemplateInstallationProps = Omit<\n CreateEnvironmentTemplateInstallationProps,\n 'version'\n>\n\nexport type ValidationFinding = {\n message: string\n details: Record<string, unknown>\n}\n\nexport type EnvironmentTemplateValidationProps<T = ValidationFinding> = {\n sys: {\n type: 'Array'\n environment: Link<'Environment'>\n space: Link<'Space'>\n changeSet: Link<'ChangeSet'>\n }\n items: T[]\n}\n\nexport type EnvironmentTemplateInstallation = EnvironmentTemplateInstallationProps &\n DefaultElements<EnvironmentTemplateInstallationProps>\n\nexport function wrapEnvironmentTemplateInstallation(\n makeRequest: MakeRequest,\n data: EnvironmentTemplateInstallationProps,\n): EnvironmentTemplateInstallation {\n const environmentTemplate = toPlainObject(copy(data))\n return freezeSys(environmentTemplate)\n}\n\nexport const wrapEnvironmentTemplateInstallationCollection = wrapCursorPaginatedCollection(\n wrapEnvironmentTemplateInstallation,\n)\n"],"names":[],"mappings":";;;;AAgBA,IAAK,uCAOJ;AAPD,CAAA,UAAK,uCAAuC,EAAA;AAC1C,IAAA,uCAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,uCAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,uCAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,uCAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,uCAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AAC7B,IAAA,uCAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAPI,uCAAuC,KAAvC,uCAAuC,GAAA,EAAA,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"environment-template-installation.js","sources":["../../../../lib/entities/environment-template-installation.ts"],"sourcesContent":["import { freezeSys, toPlainObject } from 'contentful-sdk-core'\nimport copy from 'fast-copy'\nimport type {\n BasicMetaSysProps,\n DefaultElements,\n ISO8601Timestamp,\n Link,\n MakeRequest,\n VersionedLink,\n} from '../common-types.js'\nimport { wrapCursorPaginatedCollection } from '../common-utils.js'\n\ntype JsonObject = { [Key in string]?: JsonValue }\ntype JsonArray = Array<JsonValue>\ntype JsonValue = string | number | boolean | JsonObject | JsonArray | null\n\nenum EnvironmentTemplateInstallationStatuses {\n created = 'created',\n inProgress = 'inProgress',\n failed = 'failed',\n succeeded = 'succeeded',\n disconnected = 'disconnected',\n inRetry = 'inRetry',\n}\n\nexport type EnvironmentTemplateInstallationStatus =\n keyof typeof EnvironmentTemplateInstallationStatuses\n\nexport type EnvironmentTemplateInstallationProps = {\n sys: BasicMetaSysProps & {\n type: 'EnvironmentTemplateInstallation'\n space: Link<'Space'>\n template: VersionedLink<'Template'>\n status: EnvironmentTemplateInstallationStatus\n createdAt: ISO8601Timestamp\n updatedAt: ISO8601Timestamp\n createdBy: Link<'User' | 'AppDefinition'>\n updatedBy: Link<'User' | 'AppDefinition'>\n completedAt?: ISO8601Timestamp\n errors?: JsonArray\n environment: Link<'Environment'>\n version: number\n }\n}\n\nexport type CreateEnvironmentTemplateInstallationProps = {\n version: number\n takeover?: {\n items: Link<'ContentType'>[]\n }\n changeSet?: Link<'ChangeSet'>\n deleteDeletedFields?: boolean\n}\n\nexport type ValidateEnvironmentTemplateInstallationProps = Omit<\n CreateEnvironmentTemplateInstallationProps,\n 'version'\n>\n\nexport type ValidationFinding = {\n message: string\n details: Record<string, unknown>\n}\n\nexport type EnvironmentTemplateValidationProps<T = ValidationFinding> = {\n sys: {\n type: 'Array'\n environment: Link<'Environment'>\n space: Link<'Space'>\n changeSet: Link<'ChangeSet'>\n }\n items: T[]\n}\n\nexport type EnvironmentTemplateInstallation = EnvironmentTemplateInstallationProps &\n DefaultElements<EnvironmentTemplateInstallationProps>\n\nexport function wrapEnvironmentTemplateInstallation(\n makeRequest: MakeRequest,\n data: EnvironmentTemplateInstallationProps,\n): EnvironmentTemplateInstallation {\n const environmentTemplate = toPlainObject(copy(data))\n return freezeSys(environmentTemplate)\n}\n\nexport const wrapEnvironmentTemplateInstallationCollection = wrapCursorPaginatedCollection(\n wrapEnvironmentTemplateInstallation,\n)\n"],"names":[],"mappings":";;;;AAgBA,IAAK,uCAOJ;AAPD,CAAA,UAAK,uCAAuC,EAAA;AAC1C,IAAA,uCAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,uCAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,uCAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,uCAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,uCAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AAC7B,IAAA,uCAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAPI,uCAAuC,KAAvC,uCAAuC,GAAA,EAAA,CAAA,CAAA;AA6DtC,SAAU,mCAAmC,CACjD,WAAwB,EACxB,IAA0C,EAAA;IAE1C,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,IAAA,OAAO,SAAS,CAAC,mBAAmB,CAAC;AACvC;MAEa,6CAA6C,GAAG,6BAA6B,CACxF,mCAAmC;;;;"}
|
|
@@ -17,7 +17,7 @@ export type { AppSigningSecret, AppSigningSecretProps, CreateAppSigningSecretPro
|
|
|
17
17
|
export type { AppUpload, AppUploadProps } from './entities/app-upload.js';
|
|
18
18
|
export type { Asset, AssetFileProp, AssetProps, CreateAssetProps } from './entities/asset.js';
|
|
19
19
|
export type { AssetKey, AssetKeyProps, CreateAssetKeyProps } from './entities/asset-key.js';
|
|
20
|
-
export type { BulkAction, BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionStatus, BulkActionType, BulkActionUnpublishPayload, BulkActionValidatePayload, } from './entities/bulk-action.js';
|
|
20
|
+
export type { BulkAction, BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionStatus, BulkActionType, BulkActionUnpublishPayload, BulkActionValidatePayload, BulkActionV2Payload, PublishBulkActionV2Payload, UnpublishBulkActionV2Payload, ValidateBulkActionV2Payload, } from './entities/bulk-action.js';
|
|
21
21
|
export type { Comment, CommentProps, CommentStatus, CreateCommentProps, DeleteCommentParams, GetCommentParentEntityParams, GetManyCommentsParams, RichTextCommentDocument, RichTextCommentProps, UpdateCommentProps, } from './entities/comment.js';
|
|
22
22
|
export type { AnnotationAssignment, ContentType, ContentTypeMetadata, ContentTypeProps, CreateContentTypeProps, } from './entities/content-type.js';
|
|
23
23
|
export type { ContentFields, ContentTypeFieldValidation, ContentfulEntryResource, ExternalResource, } from './entities/content-type-fields.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { ClientAPI } from './create-contentful-api.js';
|
|
|
10
10
|
import type { PlainClientAPI } from './plain/common-types.js';
|
|
11
11
|
import type { DefaultParams } from './plain/plain-client.js';
|
|
12
12
|
import * as editorInterfaceDefaults from './constants/editor-interface-defaults/index.js';
|
|
13
|
+
import { ScheduledActionStatus } from './entities/scheduled-action.js';
|
|
13
14
|
export type { ClientAPI } from './create-contentful-api.js';
|
|
14
15
|
export { asIterator } from './plain/as-iterator.js';
|
|
15
16
|
export { fetchAll } from './plain/pagination-helper.js';
|
|
@@ -22,6 +23,7 @@ export { makeRequest } from './adapters/REST/make-request.js';
|
|
|
22
23
|
export { editorInterfaceDefaults };
|
|
23
24
|
export type PlainClientDefaultParams = DefaultParams;
|
|
24
25
|
export * from './export-types.js';
|
|
26
|
+
export { ScheduledActionStatus };
|
|
25
27
|
interface UserAgentParams {
|
|
26
28
|
/**
|
|
27
29
|
* Application name and version e.g myApp/version
|
package/dist/types/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import createClientApi from './create-contentful-api.js';
|
|
|
4
4
|
import { createPlainClient } from './plain/plain-client.js';
|
|
5
5
|
import * as index from './constants/editor-interface-defaults/index.js';
|
|
6
6
|
export { index as editorInterfaceDefaults };
|
|
7
|
+
export { ScheduledActionStatus } from './entities/scheduled-action.js';
|
|
7
8
|
export { asIterator } from './plain/as-iterator.js';
|
|
8
9
|
export { fetchAll } from './plain/pagination-helper.js';
|
|
9
10
|
export { isDraft, isPublished, isUpdated } from './plain/checks.js';
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../lib/index.ts"],"sourcesContent":["/**\n * Contentful Management API SDK. Allows you to create instances of a client\n * with access to the Contentful Content Management API.\n * @packageDocumentation\n */\n\nimport { getUserAgentHeader } from 'contentful-sdk-core'\nimport type { RestAdapterParams } from './adapters/REST/rest-adapter.js'\nimport type { MakeRequest, XOR } from './common-types.js'\nimport type { AdapterParams } from './create-adapter.js'\nimport { createAdapter } from './create-adapter.js'\nimport type { ClientAPI } from './create-contentful-api.js'\nimport createContentfulApi from './create-contentful-api.js'\nimport type { PlainClientAPI } from './plain/common-types.js'\nimport type { DefaultParams } from './plain/plain-client.js'\nimport { createPlainClient } from './plain/plain-client.js'\nimport * as editorInterfaceDefaults from './constants/editor-interface-defaults/index.js'\n\nexport type { ClientAPI } from './create-contentful-api.js'\nexport { asIterator } from './plain/as-iterator.js'\nexport { fetchAll } from './plain/pagination-helper.js'\nexport { isDraft, isPublished, isUpdated } from './plain/checks.js'\nexport type { PlainClientAPI } from './plain/common-types.js'\nexport { createClient }\nexport { RestAdapter } from './adapters/REST/rest-adapter.js'\nexport type { RestAdapterParams } from './adapters/REST/rest-adapter.js'\nexport { makeRequest } from './adapters/REST/make-request.js'\nexport { editorInterfaceDefaults }\nexport type PlainClientDefaultParams = DefaultParams\nexport * from './export-types.js'\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../lib/index.ts"],"sourcesContent":["/**\n * Contentful Management API SDK. Allows you to create instances of a client\n * with access to the Contentful Content Management API.\n * @packageDocumentation\n */\n\nimport { getUserAgentHeader } from 'contentful-sdk-core'\nimport type { RestAdapterParams } from './adapters/REST/rest-adapter.js'\nimport type { MakeRequest, XOR } from './common-types.js'\nimport type { AdapterParams } from './create-adapter.js'\nimport { createAdapter } from './create-adapter.js'\nimport type { ClientAPI } from './create-contentful-api.js'\nimport createContentfulApi from './create-contentful-api.js'\nimport type { PlainClientAPI } from './plain/common-types.js'\nimport type { DefaultParams } from './plain/plain-client.js'\nimport { createPlainClient } from './plain/plain-client.js'\nimport * as editorInterfaceDefaults from './constants/editor-interface-defaults/index.js'\nimport { ScheduledActionStatus } from './entities/scheduled-action.js'\n\nexport type { ClientAPI } from './create-contentful-api.js'\nexport { asIterator } from './plain/as-iterator.js'\nexport { fetchAll } from './plain/pagination-helper.js'\nexport { isDraft, isPublished, isUpdated } from './plain/checks.js'\nexport type { PlainClientAPI } from './plain/common-types.js'\nexport { createClient }\nexport { RestAdapter } from './adapters/REST/rest-adapter.js'\nexport type { RestAdapterParams } from './adapters/REST/rest-adapter.js'\nexport { makeRequest } from './adapters/REST/make-request.js'\nexport { editorInterfaceDefaults }\nexport type PlainClientDefaultParams = DefaultParams\nexport * from './export-types.js'\nexport { ScheduledActionStatus }\ninterface UserAgentParams {\n /**\n * Application name and version e.g myApp/version\n */\n application?: string\n /**\n * Integration name and version e.g react/version\n */\n integration?: string\n\n feature?: string\n}\n\n/**\n * @deprecated\n */\nexport type ClientParams = RestAdapterParams & UserAgentParams\n\nexport type ClientOptions = UserAgentParams & XOR<RestAdapterParams, AdapterParams>\n\n/**\n * Create a client instance\n * @param params - Client initialization parameters\n *\n * ```javascript\n * const client = contentfulManagement.createClient({\n * accessToken: 'myAccessToken'\n * })\n * ```\n */\nfunction createClient(params: ClientOptions): ClientAPI\nfunction createClient(\n params: ClientOptions,\n opts: {\n type: 'plain'\n defaults?: DefaultParams\n },\n): PlainClientAPI\n// Usually, overloads with more specific signatures should come first but some IDEs are often not able to handle overloads with separate TSDocs correctly\n/**\n * @deprecated The `alphaFeatures` option is no longer supported. Please use the function without this option.\n */\nfunction createClient(\n params: ClientOptions,\n opts: {\n type?: 'plain'\n alphaFeatures: string[]\n defaults?: DefaultParams\n },\n): ClientAPI | PlainClientAPI\nfunction createClient(\n params: ClientOptions,\n opts: {\n type?: 'plain'\n defaults?: DefaultParams\n } = {},\n): ClientAPI | PlainClientAPI {\n const sdkMain =\n opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js'\n const userAgent = getUserAgentHeader(\n `${sdkMain}/${__VERSION__}`,\n params.application,\n params.integration,\n params.feature,\n )\n\n const adapter = createAdapter({ ...params, userAgent })\n\n // Parameters<?> and ReturnType<?> only return the types of the last overload\n // https://github.com/microsoft/TypeScript/issues/26591\n // @ts-expect-error\n const makeRequest: MakeRequest = (options: Parameters<MakeRequest>[0]): ReturnType<MakeRequest> =>\n adapter.makeRequest({ ...options, userAgent })\n\n if (opts.type === 'plain') {\n return createPlainClient(makeRequest, opts.defaults)\n } else {\n return createContentfulApi(makeRequest) as ClientAPI\n }\n}\n"],"names":["createContentfulApi"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;AAIG;AA8EH,SAAS,YAAY,CACnB,MAAqB,EACrB,OAGI,EAAE,EAAA;AAEN,IAAA,MAAM,OAAO,GACX,IAAI,CAAC,IAAI,KAAK,OAAO,GAAG,gCAAgC,GAAG,0BAA0B;IACvF,MAAM,SAAS,GAAG,kBAAkB,CAClC,GAAG,OAAO,CAAA,CAAA,EAAI,WAAW,CAAA,CAAE,EAC3B,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,OAAO,CACf;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,CAAC;;;;AAKvD,IAAA,MAAM,WAAW,GAAgB,CAAC,OAAmC,KACnE,OAAO,CAAC,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC;AAEhD,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;QACzB,OAAO,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC;IACtD;SAAO;AACL,QAAA,OAAOA,eAAmB,CAAC,WAAW,CAAc;IACtD;AACF;;;;"}
|
|
@@ -5,7 +5,7 @@ import type { AccessTokenProps, CreatePersonalAccessTokenProps as CreatePATProps
|
|
|
5
5
|
import type { ApiKeyProps, CreateApiKeyProps } from '../entities/api-key.js';
|
|
6
6
|
import type { AssetFileProp, AssetProcessingForLocale, AssetProps, CreateAssetProps } from '../entities/asset.js';
|
|
7
7
|
import type { AssetKeyProps, CreateAssetKeyProps } from '../entities/asset-key.js';
|
|
8
|
-
import type { BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionValidatePayload } from '../entities/bulk-action.js';
|
|
8
|
+
import type { BulkActionPayload, BulkActionProps, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionV2Payload, BulkActionValidatePayload, PublishBulkActionV2Payload, UnpublishBulkActionV2Payload, ValidateBulkActionV2Payload } from '../entities/bulk-action.js';
|
|
9
9
|
import type { ContentTypeProps, CreateContentTypeProps } from '../entities/content-type.js';
|
|
10
10
|
import type { CreateEntryProps, EntryProps, EntryReferenceProps } from '../entities/entry.js';
|
|
11
11
|
import type { CreateEnvironmentTemplateProps, EnvironmentTemplateProps } from '../entities/environment-template.js';
|
|
@@ -120,6 +120,7 @@ export type PlainClientAPI = {
|
|
|
120
120
|
versions(params: GetEnvironmentTemplateParams & {
|
|
121
121
|
query?: BasicCursorPaginationOptions & {
|
|
122
122
|
select?: string;
|
|
123
|
+
installable?: boolean;
|
|
123
124
|
};
|
|
124
125
|
}, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<EnvironmentTemplateProps>>;
|
|
125
126
|
validate(params: EnvironmentTemplateParams & {
|
|
@@ -134,6 +135,7 @@ export type PlainClientAPI = {
|
|
|
134
135
|
environmentTemplateId: string;
|
|
135
136
|
organizationId: string;
|
|
136
137
|
spaceId?: string;
|
|
138
|
+
latestOnly?: boolean;
|
|
137
139
|
}, headers?: RawAxiosRequestHeaders): Promise<CursorPaginatedCollectionProp<EnvironmentTemplateInstallationProps>>;
|
|
138
140
|
getForEnvironment(params: BasicCursorPaginationOptions & EnvironmentTemplateParams & {
|
|
139
141
|
installationId?: string;
|
|
@@ -144,6 +146,10 @@ export type PlainClientAPI = {
|
|
|
144
146
|
publish(params: GetSpaceEnvironmentParams, payload: BulkActionPublishPayload): Promise<BulkActionProps<BulkActionPublishPayload>>;
|
|
145
147
|
unpublish(params: GetSpaceEnvironmentParams, payload: BulkActionUnpublishPayload): Promise<BulkActionProps<BulkActionUnpublishPayload>>;
|
|
146
148
|
validate(params: GetSpaceEnvironmentParams, payload: BulkActionValidatePayload): Promise<BulkActionProps<BulkActionValidatePayload>>;
|
|
149
|
+
getV2(params: GetBulkActionParams): Promise<BulkActionProps<BulkActionV2Payload>>;
|
|
150
|
+
publishV2(params: GetSpaceEnvironmentParams, payload: PublishBulkActionV2Payload<'add'>): Promise<BulkActionProps<PublishBulkActionV2Payload<'add'>>>;
|
|
151
|
+
unpublishV2(params: GetSpaceEnvironmentParams, payload: PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload): Promise<BulkActionProps<PublishBulkActionV2Payload<'remove'> | UnpublishBulkActionV2Payload>>;
|
|
152
|
+
validateV2(params: GetSpaceEnvironmentParams, payload: ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>): Promise<BulkActionProps<ValidateBulkActionV2Payload<'add'> | ValidateBulkActionV2Payload<'remove'>>>;
|
|
147
153
|
};
|
|
148
154
|
comment: CommentPlainClientAPI;
|
|
149
155
|
concept: ConceptPlainClientAPI;
|
|
@@ -186,6 +186,10 @@ const createPlainClient = (makeRequest, defaults) => {
|
|
|
186
186
|
publish: wrap(wrapParams, 'BulkAction', 'publish'),
|
|
187
187
|
unpublish: wrap(wrapParams, 'BulkAction', 'unpublish'),
|
|
188
188
|
validate: wrap(wrapParams, 'BulkAction', 'validate'),
|
|
189
|
+
getV2: wrap(wrapParams, 'BulkAction', 'getV2'),
|
|
190
|
+
publishV2: wrap(wrapParams, 'BulkAction', 'publishV2'),
|
|
191
|
+
unpublishV2: wrap(wrapParams, 'BulkAction', 'unpublishV2'),
|
|
192
|
+
validateV2: wrap(wrapParams, 'BulkAction', 'validateV2'),
|
|
189
193
|
},
|
|
190
194
|
comment: {
|
|
191
195
|
get: wrap(wrapParams, 'Comment', 'get'),
|