diff --git a/package-lock.json b/package-lock.json index 0d4b44a1e0..ba64b2f7d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26960,7 +26960,7 @@ "@contentstack/cli-auth": "~1.3.22", "@contentstack/cli-cm-bootstrap": "~1.13.0", "@contentstack/cli-cm-branches": "~1.2.0", - "@contentstack/cli-cm-bulk-publish": "~1.6.0", + "@contentstack/cli-cm-bulk-publish": "~1.7.0", "@contentstack/cli-cm-clone": "~1.13.0", "@contentstack/cli-cm-export": "~1.14.1", "@contentstack/cli-cm-export-to-csv": "~1.7.3", @@ -27546,7 +27546,7 @@ }, "packages/contentstack-bulk-publish": { "name": "@contentstack/cli-cm-bulk-publish", - "version": "1.6.0", + "version": "1.7.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.3.2", @@ -29385,11 +29385,11 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/management": "~1.17.2", - "@contentstack/marketplace-sdk": "^1.2.4", - "@oclif/core": "^3.27.0", - "axios": "^1.7.7", - "chalk": "^4.1.2", + "@contentstack/management": "~1.18.0", + "@contentstack/marketplace-sdk": "^1.2.1", + "@oclif/core": "^3.26.5", + "axios": "^1.7.4", + "chalk": "^4.0.0", "cli-cursor": "^3.1.0", "cli-table": "^0.3.11", "conf": "^10.2.0", @@ -29439,21 +29439,6 @@ "typescript": "^4.9.5" } }, - "packages/contentstack-utilities/node_modules/@contentstack/management": { - "version": "1.17.2", - "resolved": "https://registry.npmjs.org/@contentstack/management/-/management-1.17.2.tgz", - "integrity": "sha512-ufRY7VwQZGZhNe1Sd62GJGi16/fRZXgiIPuXo8XrDytdz/DvOqa+JD7FG9YqZD9RzxCx9h7Qwcl1PxmFz/H7Kw==", - "license": "MIT", - "dependencies": { - "axios": "^1.7.4", - "form-data": "^3.0.1", - "lodash": "^4.17.21", - "qs": "^6.13.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, "packages/contentstack-utilities/node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -29542,20 +29527,6 @@ "node": ">=12.0.0" } }, - "packages/contentstack-utilities/node_modules/form-data": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.2.tgz", - "integrity": "sha512-sJe+TQb2vIaIyO783qN6BlMYWMw3WBOHA1Ay2qxsnjuafEOQFJ2JakedOQirT6D5XPRxDvS7AHYyem9fTpb4LQ==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "packages/contentstack-utilities/node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", diff --git a/packages/contentstack-branches/README.md b/packages/contentstack-branches/README.md index 86878e4e0c..c4ab52bb2c 100755 --- a/packages/contentstack-branches/README.md +++ b/packages/contentstack-branches/README.md @@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-branches/1.2.0 darwin-arm64 node-v22.8.0 +@contentstack/cli-cm-branches/1.2.0 darwin-arm64 node-v22.2.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bulk-publish/README.md b/packages/contentstack-bulk-publish/README.md index 42be050662..3f834b2766 100644 --- a/packages/contentstack-bulk-publish/README.md +++ b/packages/contentstack-bulk-publish/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-bulk-publish/1.6.0 darwin-arm64 node-v22.2.0 +@contentstack/cli-cm-bulk-publish/1.7.0 darwin-arm64 node-v22.2.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND @@ -36,14 +36,14 @@ USAGE * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value-1) * [`csdx cm:bulk-publish:clear`](#csdx-cmbulk-publishclear) * [`csdx cm:bulk-publish:configure`](#csdx-cmbulk-publishconfigure) -* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries) -* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value) +* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries---include-variants) +* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value) * [`csdx cm:bulk-publish:revert`](#csdx-cmbulk-publishrevert) * [`csdx csdx cm:stacks:unpublish [-a ] [-e ] [-c ] [-y] [--locale ] [--branch ] [--retry-failed ] [--bulk-unpublish ] [--content-type ] [--delivery-token ] [--only-assets] [--only-entries]`](#csdx-csdx-cmstacksunpublish--a-value--e-value--c-value--y---locale-value---branch-value---retry-failed-value---bulk-unpublish-value---content-type-value---delivery-token-value---only-assets---only-entries) * [`csdx cm:entries:publish-only-unpublished [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-only-unpublished--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) -* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value-1) +* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants-1) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value-1) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value-1) * [`csdx cm:entries:publish-only-unpublished [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-only-unpublished--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value-1) @@ -455,7 +455,7 @@ EXAMPLES $ csdx cm:stacks:publish-configure --stack-api-key ``` -## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]` +## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]` Publish entries and assets from one environment to other environments @@ -463,7 +463,7 @@ Publish entries and assets from one environment to other environments USAGE $ csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] - [-y] [--branch ] [--onlyAssets] [--onlyEntries] + [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants] FLAGS -B, --branch= [default: main] Specify the branch to fetch the content (by default the main branch is @@ -478,6 +478,7 @@ FLAGS --content-type=... The Contenttypes from which entries will be published --delivery-token= The delivery token of the source environment. --environments=... Destination Environments + --include-variants Include Variants flag will publish all associated variant entries. --locales= Source locale --onlyAssets Unpublish only assets --onlyEntries Unpublish only entries @@ -528,11 +529,17 @@ EXAMPLES Using --stack-api-key flag $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants flag + + $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] [--include-variants] ``` _See code: [src/commands/cm/bulk-publish/cross-publish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js)_ -## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]` +## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]` Publish entries from multiple contenttypes to multiple environments and locales @@ -540,7 +547,7 @@ Publish entries from multiple contenttypes to multiple environments and locales USAGE $ csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch - ] [--delivery-token ] [--source-env ] + ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants] FLAGS -B, --branch= [default: main] The name of the branch where you want to perform the bulk publish @@ -563,6 +570,8 @@ FLAGS --content-types=... The UID of the content type(s) whose entries you want to publish in bulk. In case of multiple content types, specify the IDs separated by spaces. --delivery-token= The delivery token of the source environment. + --entry-uid= Entry Uid for publish all associated variant entries. + --include-variants Include Variants flag will publish all associated variant entries with base entry. --publish-all-content-types (optional) Set it to true to bulk publish entries from all content types. If the --content-types option is already used, then you cannot use this option. --retry-failed= (optional) Use this option to retry publishing the failed entries/ assets from the @@ -622,6 +631,18 @@ EXAMPLES Using --stack-api-key $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants] + + + + Using --entry-uid and --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants] ``` ## `csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]` @@ -998,7 +1019,7 @@ EXAMPLES $ csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --stack-api-key [STACK API KEY] -source-env [SOURCE ENV] ``` -## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]` +## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]` Publish entries from multiple contenttypes to multiple environments and locales @@ -1006,7 +1027,7 @@ Publish entries from multiple contenttypes to multiple environments and locales USAGE $ csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch - ] [--delivery-token ] [--source-env ] + ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants] FLAGS -B, --branch= [default: main] The name of the branch where you want to perform the bulk publish @@ -1029,6 +1050,8 @@ FLAGS --content-types=... The UID of the content type(s) whose entries you want to publish in bulk. In case of multiple content types, specify the IDs separated by spaces. --delivery-token= The delivery token of the source environment. + --entry-uid= Entry Uid for publish all associated variant entries. + --include-variants Include Variants flag will publish all associated variant entries with base entry. --publish-all-content-types (optional) Set it to true to bulk publish entries from all content types. If the --content-types option is already used, then you cannot use this option. --retry-failed= (optional) Use this option to retry publishing the failed entries/ assets from the @@ -1088,6 +1111,18 @@ EXAMPLES Using --stack-api-key $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants] + + + + Using --entry-uid and --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants] ``` _See code: [src/commands/cm/entries/publish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js)_ @@ -1348,7 +1383,7 @@ Unpublish entries from the given environment USAGE $ csdx cm:entries:unpublish [-a ] [-k ] [-e ] [-c ] [-y] [--locale ] [--branch ] [--retry-failed ] [--bulk-unpublish ] [--api-version ] [--content-type ] - [--delivery-token ] + [--delivery-token ] [--include-variants] FLAGS -a, --alias= Alias (name) for the management token. You must use either the --alias flag or the @@ -1366,6 +1401,7 @@ FLAGS Bulk Publish APIs will be used to unpublish the entries. --content-type= The UID of the content type whose entries you want to unpublish in bulk. --delivery-token= The delivery token of the source environment. + --include-variants Include Variants flag will unpublish all associated variant entries. --locale= Locale from which entries/assets will be unpublished, e.g., en-us. --retry-failed= (optional) Use this option to retry unpublishing the failed entries from the logfile. Specify the name of the logfile that lists failed unpublish calls. If used, this option @@ -1410,6 +1446,12 @@ EXAMPLES Using --stack-api-key flag $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants flag + + $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] --include-variants ``` _See code: [src/commands/cm/entries/unpublish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js)_ diff --git a/packages/contentstack-bulk-publish/package.json b/packages/contentstack-bulk-publish/package.json index 50e223b127..2b64c6faa6 100644 --- a/packages/contentstack-bulk-publish/package.json +++ b/packages/contentstack-bulk-publish/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-bulk-publish", "description": "Contentstack CLI plugin for bulk publish actions", - "version": "1.6.0", + "version": "1.7.0", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js b/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js index d8c32f34f4..4765f2d8f6 100644 --- a/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js +++ b/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js @@ -46,7 +46,7 @@ class CrossPublishCommand extends Command { updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment'); } updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true; - + updatedFlags.includeVariants = updatedFlags.includeVariants === false ? false : true; stack = await getStack(config); } @@ -155,6 +155,10 @@ class CrossPublishCommand extends Command { _flags.deliveryToken = _flags['delivery-token']; delete _flags['delivery-token']; } + if ('include-variants' in _flags) { + _flags.includeVariants = _flags['include-variants']; + delete _flags['include-variants']; + } return _flags; } } @@ -257,6 +261,10 @@ CrossPublishCommand.flags = { }), onlyAssets: flags.boolean({ description: 'Unpublish only assets', default: false }), onlyEntries: flags.boolean({ description: 'Unpublish only entries', default: false }), + 'include-variants': flags.boolean({ + description: 'Include Variants flag will publish all associated variant entries.', + default: false, + }), }; CrossPublishCommand.examples = [ @@ -278,8 +286,11 @@ CrossPublishCommand.examples = [ 'Using --stack-api-key flag', 'csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]', '', + 'Using --include-variants flag', + 'csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] [--include-variants]', + '', ]; -CrossPublishCommand.usage = `cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]`; +CrossPublishCommand.usage = `cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]`; module.exports = CrossPublishCommand; diff --git a/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js b/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js index 7e700eb13b..60796a8028 100644 --- a/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js +++ b/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js @@ -21,11 +21,19 @@ class PublishEntriesCommand extends Command { entriesFlags.publishAllContentTypes = entriesFlags['publish-all-content-types'] || entriesFlags.publishAllContentTypes || false; entriesFlags.apiVersion = entriesFlags['api-version'] || '3'; + entriesFlags.includeVariants = entriesFlags['include-variants'] || entriesFlags.includeVariants || false; + entriesFlags.entryUid = entriesFlags['entry-uid'] || entriesFlags.entryUid; + + if (entriesFlags.entryUid === undefined) { + delete entriesFlags['entryUid']; + } delete entriesFlags['api-version']; delete entriesFlags['retry-failed']; delete entriesFlags['content-types']; delete entriesFlags['bulk-publish']; delete entriesFlags['publish-all-content-types']; + delete entriesFlags['include-variants']; + delete entriesFlags['entry-uid']; let updatedFlags; try { @@ -243,6 +251,11 @@ PublishEntriesCommand.flags = { }), 'delivery-token': flags.string({ description: 'The delivery token of the source environment.' }), 'source-env': flags.string({ description: 'Source environment' }), + 'entry-uid': flags.string({ description: 'Entry Uid for publish all associated variant entries.' }), + 'include-variants': flags.boolean({ + default: false, // set the default value to false + description: 'Include Variants flag will publish all associated variant entries with base entry.', + }), }; PublishEntriesCommand.examples = [ @@ -266,11 +279,17 @@ PublishEntriesCommand.examples = [ '', 'Using --stack-api-key', 'csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]', + '', + 'Using --include-variants', + 'csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants]', + '', + 'Using --entry-uid and --include-variants', + 'csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants]', ]; PublishEntriesCommand.aliases = ['cm:bulk-publish:entries']; PublishEntriesCommand.usage = - 'cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]'; + 'cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]'; module.exports = PublishEntriesCommand; diff --git a/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js b/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js index 523ea2c1bd..1350785bd3 100644 --- a/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js +++ b/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js @@ -19,11 +19,13 @@ class UnpublishCommand extends Command { unpublishFlags.onlyAssets = false; unpublishFlags.onlyEntries = true; unpublishFlags.apiVersion = unpublishFlags['api-version'] || '3'; + unpublishFlags.includeVariants = unpublishFlags['include-variants'] || false; delete unpublishFlags['api-version']; delete unpublishFlags['retry-failed']; delete unpublishFlags['bulk-unpublish']; delete unpublishFlags['content-type']; delete unpublishFlags['delivery-token']; + delete unpublishFlags['include-variants']; let updatedFlags; try { @@ -59,7 +61,6 @@ class UnpublishCommand extends Command { updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment'); } updatedFlags.bulkUnpublish = updatedFlags.bulkUnpublish === 'false' ? false : true; - stack = await getStack(config); } if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) { @@ -136,6 +137,7 @@ UnpublishCommand.flags = { alias: flags.string({ char: 'a', description: 'Alias (name) for the management token. You must use either the --alias flag or the --stack-api-key flag.', + description: 'Alias (name) for the management token. You must use either the --alias flag or the --stack-api-key flag.', }), 'stack-api-key': flags.string({ char: 'k', @@ -176,6 +178,10 @@ UnpublishCommand.flags = { 'delivery-token': flags.string({ description: 'The delivery token of the source environment.', }), + 'include-variants': flags.boolean({ + default: false, // set the default value to false + description: 'Include Variants flag will unpublish all associated variant entries.' + }), }; UnpublishCommand.examples = [ @@ -195,6 +201,9 @@ UnpublishCommand.examples = [ '', 'Using --stack-api-key flag', 'csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]', + '', + 'Using --include-variants flag', + 'csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] --include-variants', ]; module.exports = UnpublishCommand; diff --git a/packages/contentstack-bulk-publish/src/producer/cross-publish.js b/packages/contentstack-bulk-publish/src/producer/cross-publish.js index 5778374ea1..2fbf2223e7 100644 --- a/packages/contentstack-bulk-publish/src/producer/cross-publish.js +++ b/packages/contentstack-bulk-publish/src/producer/cross-publish.js @@ -16,6 +16,7 @@ const { Command } = require('@contentstack/cli-command'); const command = new Command(); const { isEmpty } = require('../util'); const { fetchBulkPublishLimit } = require('../util/common-utility'); +const VARIANTS_PUBLISH_API_VERSION = '3.2'; let bulkPublishSet = []; let bulkPublishAssetSet = []; @@ -34,20 +35,30 @@ function getQueryParams(filter) { return queryString; } -async function bulkAction(stack, items, bulkPublish, filter, destEnv, apiVersion, bulkPublishLimit) { +async function bulkAction(stack, items, bulkPublish, filter, destEnv, apiVersion, bulkPublishLimit, variantsFlag = false) { return new Promise(async (resolve) => { for (let index = 0; index < items.length; index++) { changedFlag = true; if (bulkPublish) { if (bulkPublishSet.length < bulkPublishLimit && items[index].type === 'entry_published') { - bulkPublishSet.push({ + const entry = { uid: items[index].data.uid, content_type: items[index].content_type_uid, locale: items[index].data.locale || 'en-us', version: items[index].data._version, publish_details: [items[index].data.publish_details] || [], - }); + }; + + if (variantsFlag && Array.isArray(items[index].data.variants) && items[index].data.variants.length > 0) { + entry.variants = items[index].data.variants || []; + entry.variant_rules = { + publish_latest_base: false, + publish_latest_base_conditionally: true + }; + } + + bulkPublishSet.push(JSON.parse(JSON.stringify(entry))); } if (bulkPublishAssetSet.length < bulkPublishLimit && items[index].type === 'asset_published') { @@ -145,6 +156,7 @@ async function getSyncEntries( destEnv, apiVersion, bulkPublishLimit, + variantsFlag = false, paginationToken = null, ) { return new Promise(async (resolve, reject) => { @@ -200,8 +212,19 @@ async function getSyncEntries( ); } + if (variantsFlag) { + for (let index = 0; index < entriesResponse?.items?.length; index++) { + let variants = []; + const entries = entriesResponse.items[index]; + variants = await getVariantEntries(stack, entries.content_type_uid, entriesResponse, index, queryParamsObj); + if (variants.length > 0) { + entriesResponse.items[index].data.variants = variants; + } + } + } + if (entriesResponse.items.length > 0) { - await bulkAction(stack, entriesResponse.items, bulkPublish, filter, destEnv, apiVersion, bulkPublishLimit); + await bulkAction(stack, entriesResponse.items, bulkPublish, filter, destEnv, apiVersion, bulkPublishLimit, variantsFlag); } if (!entriesResponse.pagination_token) { if (!changedFlag) console.log('No Entries/Assets Found published on specified environment'); @@ -244,6 +267,48 @@ function setConfig(conf, bp) { filePath = initializeLogger(logFileName); } +async function getVariantEntries(stack, contentType, entries, index, queryParams, skip = 0) { + try { + let variantQueryParams = { + locale: queryParams.locale || 'en-us', + include_count: true, + skip: skip, // Adding skip parameter for pagination + limit: 100, // Set a limit to fetch up to 100 entries per request + }; + const entryUid = entries.items[index].data.uid + const variantsEntriesResponse = await stack + .contentType(contentType) + .entry(entryUid) + .variants() + .query(variantQueryParams) + .find(); + + const variants = variantsEntriesResponse.items.map((entry) => ({ + uid: entry.variants._variant._uid, + })); + + if (variantsEntriesResponse.items.length === variantQueryParams.limit) { + const nextVariants = await getVariantEntries( + stack, + contentType, + entries, + index, + queryParams, + skip + variantQueryParams.limit, + ); + return Array.isArray(nextVariants) ? variants.concat(nextVariants) : variants; + } + return variants; + } catch (error) { + const errorMessage = + error?.errorMessage || + error?.message || + error?.errors || + 'Falied to fetch the variant entries, Please contact the admin for support.'; + throw new Error(`Error fetching variants: ${errorMessage}`); + } +} + async function start( { retryFailed, @@ -258,6 +323,7 @@ async function start( destEnv, f_types, apiVersion, + includeVariants, }, stack, config, @@ -310,7 +376,20 @@ async function start( // filter.type = (f_types) ? f_types : types // types mentioned in the config file (f_types) are given preference const queryParams = getQueryParams(filter); const bulkPublishLimit = fetchBulkPublishLimit(stack?.org_uid); - await getSyncEntries(stack, config, queryParams, bulkPublish, filter, deliveryToken, destEnv, apiVersion, bulkPublishLimit); + if (includeVariants) { + apiVersion = VARIANTS_PUBLISH_API_VERSION; + } + await getSyncEntries( + stack, + config, + queryParams, + bulkPublish, + filter, + deliveryToken, + destEnv, + apiVersion, bulkPublishLimit, + includeVariants, + ); } } diff --git a/packages/contentstack-bulk-publish/src/producer/publish-entries.js b/packages/contentstack-bulk-publish/src/producer/publish-entries.js index 0f6cce121f..607b731696 100644 --- a/packages/contentstack-bulk-publish/src/producer/publish-entries.js +++ b/packages/contentstack-bulk-publish/src/producer/publish-entries.js @@ -9,6 +9,7 @@ const retryFailedLogs = require('../util/retryfailed'); const { validateFile } = require('../util/fs'); const { isEmpty } = require('../util'); const { fetchBulkPublishLimit } = require('../util/common-utility'); +const VARIANTS_PUBLISH_API_VERSION = '3.2'; const queue = getQueue(); @@ -27,6 +28,8 @@ async function getEntries( environments, apiVersion, bulkPublishLimit, + variantsFlag = false, + entry_uid = undefined, skip = 0, ) { return new Promise((resolve, reject) => { @@ -39,6 +42,13 @@ async function getEntries( include_publish_details: true, }; + if (variantsFlag) { + queryParams.apiVersion = VARIANTS_PUBLISH_API_VERSION; + } + if (entry_uid) { + queryParams.uid = entry_uid; + } + stack .contentType(contentType) .entry() @@ -47,16 +57,31 @@ async function getEntries( .then(async (entriesResponse) => { skipCount += entriesResponse.items.length; let entries = entriesResponse.items; - for (let index = 0; index < entriesResponse.items.length; index++) { + + for (let index = 0; index < entries.length; index++) { + let variants = []; if (bulkPublish) { + let entry; if (bulkPublishSet.length < bulkPublishLimit) { - bulkPublishSet.push({ + entry = { uid: entries[index].uid, content_type: contentType, locale, publish_details: entries[index].publish_details || [], - }); + }; + + if (variantsFlag) { + variants = await getVariantEntries(stack, contentType, entries, index, queryParams); + if (variants.length > 0) { + entry.variant_rules = { + publish_latest_base: false, + publish_latest_base_conditionally: true, + }; + entry.variants = variants; + } + } } + bulkPublishSet.push(entry); if (bulkPublishSet.length === bulkPublishLimit) { await queue.Enqueue({ @@ -71,7 +96,7 @@ async function getEntries( } if ( - index === entriesResponse.items.length - 1 && + index === entries.length - 1 && bulkPublishSet.length <= bulkPublishLimit && bulkPublishSet.length > 0 ) { @@ -84,7 +109,7 @@ async function getEntries( apiVersion, }); bulkPublishSet = []; - } // bulkPublish + } } else { await queue.Enqueue({ content_type: contentType, @@ -110,6 +135,8 @@ async function getEntries( environments, apiVersion, bulkPublishLimit, + variantsFlag, + entry_uid, skipCount, ); return resolve(); @@ -118,6 +145,56 @@ async function getEntries( }); } +async function getVariantEntries(stack, contentType, entries, index, queryParams, skip = 0) { + try { + let variantQueryParams = { + locale: queryParams.locale || 'en-us', + include_count: true, + skip: skip, // Adding skip parameter for pagination + limit: 100, // Set a limit to fetch up to 100 entries per request + include_publish_details: true, + }; + + const variantsEntriesResponse = await stack + .contentType(contentType) + .entry(entries[index].uid) + .variants() + .query(variantQueryParams) + .find(); + + // Map the response items to extract variant UIDs + const variants = variantsEntriesResponse.items.map((entry) => ({ + uid: entry.variants._variant._uid, + })); + + // Check if there are more entries to fetch + if (variantsEntriesResponse.items.length === variantQueryParams.limit) { + // Recursively fetch the next set of variants with updated skip value + const nextVariants = await getVariantEntries( + stack, + contentType, + entries, + index, + queryParams, + skip + variantQueryParams.limit, + ); + + // Ensure nextVariants is an array before concatenation + return Array.isArray(nextVariants) ? variants.concat(nextVariants) : variants; + } + + return variants; + } catch (error) { + // Handle error message retrieval from different properties + const errorMessage = + error?.errorMessage || + error?.message || + error?.errors || + 'Falied to fetch the variant entries, Please contact the admin for support.'; + throw new Error(`Error fetching variants: ${errorMessage}`); + } +} + async function getContentTypes(stack, skip = 0, contentTypes = []) { return new Promise((resolve, reject) => { skipCount = skip; @@ -154,7 +231,17 @@ function setConfig(conf, bp) { } async function start( - { retryFailed, bulkPublish, publishAllContentTypes, contentTypes, locales, environments, apiVersion }, + { + retryFailed, + bulkPublish, + publishAllContentTypes, + contentTypes, + locales, + environments, + apiVersion, + includeVariants, + entryUid, + }, stack, config, ) { @@ -168,12 +255,16 @@ async function start( } process.exit(0); }); + + if (includeVariants) { + apiVersion = VARIANTS_PUBLISH_API_VERSION; + } + if (retryFailed) { if (typeof retryFailed === 'string') { if (!validateFile(retryFailed, ['publish-entries', 'bulk-publish-entries'])) { return false; } - bulkPublish = retryFailed.match(new RegExp('bulk')) ? true : false; setConfig(config, bulkPublish); if (bulkPublish) { @@ -201,6 +292,8 @@ async function start( environments, apiVersion, bulkPublishLimit, + includeVariants, + entryUid, ); /* eslint-enable no-await-in-loop */ } diff --git a/packages/contentstack-bulk-publish/src/producer/unpublish.js b/packages/contentstack-bulk-publish/src/producer/unpublish.js index 94bea5d850..2d750545cd 100644 --- a/packages/contentstack-bulk-publish/src/producer/unpublish.js +++ b/packages/contentstack-bulk-publish/src/producer/unpublish.js @@ -16,6 +16,7 @@ const { Command } = require('@contentstack/cli-command'); const command = new Command(); const { isEmpty } = require('../util'); const { fetchBulkPublishLimit } = require('../util/common-utility'); +const VARIANTS_UNPUBLISH_API_VERSION = '3.2'; let bulkUnPublishSet = []; let bulkUnPulishAssetSet = []; @@ -51,19 +52,26 @@ function getQueryParams(filter) { return queryString; } -function bulkAction(stack, items, bulkUnpublish, environment, locale, apiVersion, bulkPublishLimit) { +function bulkAction(stack, items, bulkUnpublish, environment, locale, apiVersion, bulkPublishLimit, variantsFlag = false) { return new Promise(async (resolve) => { for (let index = 0; index < items.length; index++) { changedFlag = true; if (bulkUnpublish) { if (bulkUnPublishSet.length < bulkPublishLimit && items[index].type === 'entry_published') { - bulkUnPublishSet.push({ + const entryData = { uid: items[index].data.uid, content_type: items[index].content_type_uid, locale: items[index].data.locale || 'en-us', - publish_details: [items[index].data.publish_details] || [], - }); + publish_details: items[index].data.publish_details || [], + }; + + if (variantsFlag && Array.isArray(items[index].data.variants) && items[index].data.variants.length > 0) { + const entryWithVariants = { ...entryData, variants: items[index].data.variants }; + bulkUnPublishSet.push(entryWithVariants); + } else { + bulkUnPublishSet.push(entryData); + } } if (bulkUnPulishAssetSet.length < bulkPublishLimit && items[index].type === 'asset_published') { @@ -122,7 +130,7 @@ function bulkAction(stack, items, bulkUnpublish, environment, locale, apiVersion } } else { if (items[index].type === 'entry_published') { - await entryQueue.Enqueue({ + await entryQueue.Enqueue({ content_type: items[index].content_type_uid, publish_details: [items[index].data.publish_details], environments: [environment], @@ -130,6 +138,7 @@ function bulkAction(stack, items, bulkUnpublish, environment, locale, apiVersion locale: items[index].data.locale || 'en-us', Type: 'entry', stack: stack, + apiVersion, }); } if (items[index].type === 'asset_published') { @@ -157,6 +166,7 @@ async function getSyncEntries( deliveryToken, apiVersion, bulkPublishLimit, + variantsFlag, paginationToken = null, ) { return new Promise(async (resolve, reject) => { @@ -205,10 +215,17 @@ async function getSyncEntries( } const entriesResponse = await Stack.sync(syncData); - if (entriesResponse.items.length > 0) { - await bulkAction(stack, entriesResponse.items, bulkUnpublish, environment, locale, apiVersion, bulkPublishLimit); + if (variantsFlag) { + queryParamsObj.apiVersion = VARIANTS_UNPUBLISH_API_VERSION; + const itemsWithVariants = await attachVariantsToItems(stack, entriesResponse.items, queryParamsObj); + // Call bulkAction for entries with variants + await bulkAction(stack, itemsWithVariants, bulkUnpublish, environment, locale, apiVersion, bulkPublishLimit, variantsFlag); + } + // Call bulkAction for entries without variants + await bulkAction(stack, entriesResponse.items, bulkUnpublish, environment, locale, apiVersion, bulkPublishLimit, false); } + if (entriesResponse.items.length === 0) { if (!changedFlag) console.log('No Entries/Assets Found published on specified environment'); return resolve(); @@ -224,6 +241,7 @@ async function getSyncEntries( deliveryToken, apiVersion, bulkPublishLimit, + variantsFlag, null, ); }, 3000); @@ -232,6 +250,52 @@ async function getSyncEntries( } }); } +async function attachVariantsToItems(stack, items, queryParams) { + for (const item of items) { + const { content_type_uid, data } = item; + const variantEntries = await getVariantEntries(stack, content_type_uid, item, queryParams); // Fetch the variants using fetchVariants method + item.data.variants = variantEntries; // Attach the fetched variants to the data object in the item + } + return items; +} + +async function getVariantEntries(stack, contentType, entries, queryParams, skip = 0) { + try { + let variantQueryParams = { + locale: queryParams.locale || 'en-us', + include_count: true, + skip: skip, // Adding skip parameter for pagination + limit: 100, // Set a limit to fetch up to 100 entries per request + }; + + const variantsEntriesResponse = await stack + .contentType(contentType) + .entry(entries.data.uid) + .variants() + .query(variantQueryParams) + .find(); + + // Map the response items to extract variant UIDs + const variants = variantsEntriesResponse.items.map(entry => ({ + uid: entry.variants._variant._uid, + })); + + // Check if there are more entries to fetch + if (variantsEntriesResponse.items.length === variantQueryParams.limit) { + // Recursively fetch the next set of variants with updated skip value + const nextVariants = await getVariantEntries(stack, contentType, entries, queryParams, skip + variantQueryParams.limit); + + // Ensure nextVariants is an array before concatenation + return Array.isArray(nextVariants) ? variants.concat(nextVariants) : variants; + } + + return variants; + } catch (error) { + // Handle error message retrieval from different properties + const errorMessage = error?.errorMessage || error?.message || error?.errors || 'Falied to fetch the variant entries, Please contact the admin for support.'; + throw new Error(`Error fetching variants: ${errorMessage}`); + } +} async function start( { @@ -245,6 +309,7 @@ async function start( onlyEntries, f_types, apiVersion, + includeVariants, }, stack, config, @@ -259,7 +324,9 @@ async function start( } process.exit(0); }); - + if (includeVariants) { + apiVersion = VARIANTS_UNPUBLISH_API_VERSION; + } if (retryFailed) { if (typeof retryFailed === 'string' && retryFailed.length > 0) { if (!validateFile(retryFailed, ['unpublish', 'bulk-unpublish'])) { @@ -298,7 +365,7 @@ async function start( setConfig(config, bulkUnpublish); const queryParams = getQueryParams(filter); const bulkPublishLimit = fetchBulkPublishLimit(stack?.org_uid); - await getSyncEntries(stack, config, locale, queryParams, bulkUnpublish, environment, deliveryToken, apiVersion, bulkPublishLimit); + await getSyncEntries(stack, config, locale, queryParams, bulkUnpublish, environment, deliveryToken, apiVersion, bulkPublishLimit, includeVariants); } } @@ -309,4 +376,4 @@ module.exports = { setConfig, getQueryParams, start, -}; +}; \ No newline at end of file diff --git a/packages/contentstack-clone/README.md b/packages/contentstack-clone/README.md index c4a8aba55a..30ad3aab98 100644 --- a/packages/contentstack-clone/README.md +++ b/packages/contentstack-clone/README.md @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-clone $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-clone/1.13.0 darwin-arm64 node-v22.8.0 +@contentstack/cli-cm-clone/1.13.0 darwin-arm64 node-v22.2.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-export/README.md b/packages/contentstack-export/README.md index 30aaac0996..2f5f11db33 100755 --- a/packages/contentstack-export/README.md +++ b/packages/contentstack-export/README.md @@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-export/1.14.1 darwin-arm64 node-v22.8.0 +@contentstack/cli-cm-export/1.14.1 darwin-arm64 node-v22.2.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-import/README.md b/packages/contentstack-import/README.md index ec43c1d56f..3b62de0c0d 100644 --- a/packages/contentstack-import/README.md +++ b/packages/contentstack-import/README.md @@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-import/1.19.2 darwin-arm64 node-v22.8.0 +@contentstack/cli-cm-import/1.19.2 darwin-arm64 node-v22.2.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-utilities/package.json b/packages/contentstack-utilities/package.json index 092c37748d..e9ac8b6790 100644 --- a/packages/contentstack-utilities/package.json +++ b/packages/contentstack-utilities/package.json @@ -32,11 +32,11 @@ "author": "contentstack", "license": "MIT", "dependencies": { - "@contentstack/management": "~1.17.2", - "@contentstack/marketplace-sdk": "^1.2.4", - "@oclif/core": "^3.27.0", - "axios": "^1.7.7", - "chalk": "^4.1.2", + "@contentstack/management": "~1.18.0", + "@contentstack/marketplace-sdk": "^1.2.1", + "@oclif/core": "^3.26.5", + "axios": "^1.7.4", + "chalk": "^4.0.0", "cli-cursor": "^3.1.0", "cli-table": "^0.3.11", "conf": "^10.2.0", diff --git a/packages/contentstack-variants/tsconfig.tsbuildinfo b/packages/contentstack-variants/tsconfig.tsbuildinfo deleted file mode 100644 index d2b5f2c97d..0000000000 --- a/packages/contentstack-variants/tsconfig.tsbuildinfo +++ /dev/null @@ -1 +0,0 @@ -{"root":["./src/index.ts"],"version":"5.6.2"} \ No newline at end of file diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index 0b309861df..7ae7cd9993 100644 --- a/packages/contentstack/README.md +++ b/packages/contentstack/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli $ csdx COMMAND running command... $ csdx (--version|-v) -@contentstack/cli/1.29.0 darwin-arm64 node-v22.8.0 +@contentstack/cli/1.29.0 darwin-arm64 node-v22.2.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND @@ -50,15 +50,15 @@ USAGE * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value-1) * [`csdx cm:bulk-publish:clear`](#csdx-cmbulk-publishclear) * [`csdx cm:bulk-publish:configure`](#csdx-cmbulk-publishconfigure) -* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries) -* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value) +* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries---include-variants) +* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value) * [`csdx cm:bulk-publish:revert`](#csdx-cmbulk-publishrevert) * [`csdx csdx cm:stacks:unpublish [-a ] [-e ] [-c ] [-y] [--locale ] [--branch ] [--retry-failed ] [--bulk-unpublish ] [--content-type ] [--delivery-token ] [--only-assets] [--only-entries]`](#csdx-csdx-cmstacksunpublish--a-value--e-value--c-value--y---locale-value---branch-value---retry-failed-value---bulk-unpublish-value---content-type-value---delivery-token-value---only-assets---only-entries) * [`csdx cm:entries:publish-only-unpublished [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-only-unpublished--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) * [`csdx cm:entries:migrate-html-rte`](#csdx-cmentriesmigrate-html-rte) -* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value-1) +* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants-1) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value-1) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value-1) * [`csdx cm:entries:publish-only-unpublished [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-only-unpublished--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value-1) @@ -997,7 +997,7 @@ EXAMPLES $ csdx cm:stacks:publish-configure --stack-api-key ``` -## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]` +## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]` Publish entries and assets from one environment to other environments @@ -1005,7 +1005,7 @@ Publish entries and assets from one environment to other environments USAGE $ csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] - [--branch ] [--onlyAssets] [--onlyEntries] + [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants] FLAGS -B, --branch= [default: main] Specify the branch to fetch the content (by default the main branch is @@ -1020,6 +1020,7 @@ FLAGS --content-type=... The Contenttypes from which entries will be published --delivery-token= The delivery token of the source environment. --environments=... Destination Environments + --include-variants Include Variants flag will publish all associated variant entries. --locales= Source locale --onlyAssets Unpublish only assets --onlyEntries Unpublish only entries @@ -1070,11 +1071,17 @@ EXAMPLES Using --stack-api-key flag $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants flag + + $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] [--include-variants] ``` _See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js)_ -## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]` +## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]` Publish entries from multiple contenttypes to multiple environments and locales @@ -1082,7 +1089,7 @@ Publish entries from multiple contenttypes to multiple environments and locales USAGE $ csdx cm:bulk-publish:entries cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch - ] [--delivery-token ] [--source-env ] + ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants] FLAGS -B, --branch= [default: main] The name of the branch where you want to perform the bulk publish @@ -1106,6 +1113,8 @@ FLAGS --content-types=... The UID of the content type(s) whose entries you want to publish in bulk. In case of multiple content types, specify the IDs separated by spaces. --delivery-token= The delivery token of the source environment. + --entry-uid= Entry Uid for publish all associated variant entries. + --include-variants Include Variants flag will publish all associated variant entries with base entry. --publish-all-content-types (optional) Set it to true to bulk publish entries from all content types. If the --content-types option is already used, then you cannot use this option. --retry-failed= (optional) Use this option to retry publishing the failed entries/ assets from the @@ -1165,6 +1174,18 @@ EXAMPLES Using --stack-api-key $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants] + + + + Using --entry-uid and --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants] ``` ## `csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]` @@ -1607,7 +1628,7 @@ EXAMPLES _See code: [@contentstack/cli-cm-migrate-rte](https://github.com/contentstack/cli/blob/main/packages/contentstack-migrate-rte/src/commands/cm/entries/migrate-html-rte.js)_ -## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]` +## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]` Publish entries from multiple contenttypes to multiple environments and locales @@ -1615,7 +1636,7 @@ Publish entries from multiple contenttypes to multiple environments and locales USAGE $ csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token - ] [--source-env ] + ] [--source-env ] [--entry-uid ] [--include-variants] FLAGS -B, --branch= [default: main] The name of the branch where you want to perform the bulk publish @@ -1639,6 +1660,8 @@ FLAGS --content-types=... The UID of the content type(s) whose entries you want to publish in bulk. In case of multiple content types, specify the IDs separated by spaces. --delivery-token= The delivery token of the source environment. + --entry-uid= Entry Uid for publish all associated variant entries. + --include-variants Include Variants flag will publish all associated variant entries with base entry. --publish-all-content-types (optional) Set it to true to bulk publish entries from all content types. If the --content-types option is already used, then you cannot use this option. --retry-failed= (optional) Use this option to retry publishing the failed entries/ assets from the @@ -1698,6 +1721,18 @@ EXAMPLES Using --stack-api-key $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants] + + + + Using --entry-uid and --include-variants + + $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants] ``` _See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js)_ @@ -1958,7 +1993,7 @@ Unpublish entries from the given environment USAGE $ csdx cm:entries:unpublish [-a ] [-k ] [-e ] [-c ] [-y] [--locale ] [--branch ] [--retry-failed ] [--bulk-unpublish ] [--api-version ] [--content-type ] - [--delivery-token ] + [--delivery-token ] [--include-variants] FLAGS -a, --alias= Alias (name) for the management token. You must use either the --alias flag or the @@ -1976,6 +2011,7 @@ FLAGS Bulk Publish APIs will be used to unpublish the entries. --content-type= The UID of the content type whose entries you want to unpublish in bulk. --delivery-token= The delivery token of the source environment. + --include-variants Include Variants flag will unpublish all associated variant entries. --locale= Locale from which entries/assets will be unpublished, e.g., en-us. --retry-failed= (optional) Use this option to retry unpublishing the failed entries from the logfile. Specify the name of the logfile that lists failed unpublish calls. If used, this option @@ -2020,6 +2056,12 @@ EXAMPLES Using --stack-api-key flag $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants flag + + $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] --include-variants ``` _See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js)_ diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index f5257ddf8c..626aeb281e 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -26,7 +26,7 @@ "@contentstack/cli-auth": "~1.3.22", "@contentstack/cli-cm-bootstrap": "~1.13.0", "@contentstack/cli-cm-branches": "~1.2.0", - "@contentstack/cli-cm-bulk-publish": "~1.6.0", + "@contentstack/cli-cm-bulk-publish": "~1.7.0", "@contentstack/cli-cm-export": "~1.14.1", "@contentstack/cli-cm-clone": "~1.13.0", "@contentstack/cli-cm-export-to-csv": "~1.7.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8259e021b7..c569d8a573 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: '@contentstack/cli-auth': ~1.3.22 '@contentstack/cli-cm-bootstrap': ~1.13.0 '@contentstack/cli-cm-branches': ~1.2.0 - '@contentstack/cli-cm-bulk-publish': ~1.6.0 + '@contentstack/cli-cm-bulk-publish': ~1.7.0 '@contentstack/cli-cm-clone': ~1.13.0 '@contentstack/cli-cm-export': ~1.14.1 '@contentstack/cli-cm-export-to-csv': ~1.7.3 @@ -1056,9 +1056,9 @@ importers: packages/contentstack-utilities: specifiers: '@contentstack/cli-dev-dependencies': ^1.2.4 - '@contentstack/management': ~1.17.2 - '@contentstack/marketplace-sdk': ^1.2.4 - '@oclif/core': ^3.27.0 + '@contentstack/management': ~1.18.0 + '@contentstack/marketplace-sdk': ^1.2.1 + '@oclif/core': ^3.26.5 '@oclif/test': ^2.5.6 '@types/chai': ^4.3.20 '@types/inquirer': ^9.0.7 @@ -1067,9 +1067,9 @@ importers: '@types/node': ^14.18.63 '@types/sinon': ^10.0.20 '@types/traverse': ^0.6.34 - axios: ^1.7.7 + axios: ^1.7.4 chai: ^4.5.0 - chalk: ^4.1.2 + chalk: ^4.0.0 cli-cursor: ^3.1.0 cli-table: ^0.3.11 conf: ^10.2.0 @@ -1106,7 +1106,7 @@ importers: winston: ^3.7.2 xdg-basedir: ^4.0.0 dependencies: - '@contentstack/management': 1.17.2_debug@4.3.7 + '@contentstack/management': 1.18.3_debug@4.3.7 '@contentstack/marketplace-sdk': 1.2.4_debug@4.3.7 '@oclif/core': 3.27.0 axios: 1.7.7_debug@4.3.7