From fb83941832033f8421c46a9eb3c3bc3437ef6b2a Mon Sep 17 00:00:00 2001 From: raj pandey Date: Wed, 9 Aug 2023 18:52:44 +0530 Subject: [PATCH 01/52] Error while importing the global feilds refrences not removed --- .../src/utils/content-type-helper.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/contentstack-import/src/utils/content-type-helper.ts b/packages/contentstack-import/src/utils/content-type-helper.ts index 72c2778143..a098c3ec8f 100644 --- a/packages/contentstack-import/src/utils/content-type-helper.ts +++ b/packages/contentstack-import/src/utils/content-type-helper.ts @@ -90,7 +90,7 @@ export const removeReferenceFields = async function ( for (var block in schema[i].blocks) { await removeReferenceFields(schema[i].blocks[block].schema, flag, stackAPIClient); } - } else if (schema[i].data_type === 'reference' || schema[i].reference_to) { + } else if (schema[i].data_type === 'reference') { flag.supressed = true; // Check if content-type exists // If exists, then no change should be required. @@ -129,6 +129,16 @@ export const removeReferenceFields = async function ( } } return true; + } else if ( + // handling entry references in json rte + schema[i].data_type === 'json' && + schema[i].field_metadata.allow_json_rte && + schema[i].field_metadata.embed_entry && + schema[i].reference_to.length > 1 + ) { + flag.supressed = true; + schema[i].reference_to = ['sys_assets']; + return true; } else if ( // handling entry references in json rte schema[i].data_type === 'json' && From bd88c471c340ebbd414eb83b4ee594707e8b5c2e Mon Sep 17 00:00:00 2001 From: raj pandey Date: Thu, 10 Aug 2023 15:03:15 +0530 Subject: [PATCH 02/52] Restricting packages to minor version updates --- package-lock.json | 192 +++++++++--------- packages/contentstack-auth/package.json | 4 +- packages/contentstack-bootstrap/package.json | 6 +- packages/contentstack-branches/package.json | 10 +- .../contentstack-bulk-publish/package.json | 4 +- packages/contentstack-clone/package.json | 4 +- packages/contentstack-command/package.json | 2 +- packages/contentstack-config/package.json | 4 +- .../contentstack-export-to-csv/package.json | 4 +- packages/contentstack-export/package.json | 10 +- packages/contentstack-import/package.json | 4 +- packages/contentstack-launch/package.json | 4 +- .../contentstack-migrate-rte/package.json | 6 +- packages/contentstack-migration/package.json | 4 +- packages/contentstack-seed/package.json | 4 +- packages/contentstack/package.json | 26 +-- pnpm-lock.yaml | 96 ++++----- 17 files changed, 192 insertions(+), 192 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4cd2869217..c9dda70718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20301,21 +20301,21 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.14", - "@contentstack/cli-cm-branches": "^1.0.10", - "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-auth": "~1.3.12", + "@contentstack/cli-cm-bootstrap": "~1.4.14", + "@contentstack/cli-cm-branches": "~1.0.10", + "@contentstack/cli-cm-bulk-publish": "~1.3.10", + "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", - "@contentstack/cli-cm-export-to-csv": "^1.3.12", + "@contentstack/cli-cm-export-to-csv": "~1.3.12", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.10", - "@contentstack/cli-migration": "^1.3.10", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-migrate-rte": "~1.4.10", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.10", + "@contentstack/cli-launch": "~1.0.10", + "@contentstack/cli-migration": "~1.3.10", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", @@ -20368,8 +20368,8 @@ "version": "1.3.12", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", @@ -20409,9 +20409,9 @@ "version": "1.4.14", "license": "MIT", "dependencies": { - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13" @@ -20488,8 +20488,8 @@ "version": "1.0.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -20510,9 +20510,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/flat": "^5.0.2", @@ -20551,8 +20551,8 @@ "version": "1.3.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "bluebird": "^3.7.2", "chalk": "^4.1.2", "dotenv": "^16.1.4", @@ -20603,8 +20603,8 @@ "@colors/colors": "^1.5.0", "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "async": "^3.2.4", "chalk": "^4.1.0", "child_process": "^1.0.2", @@ -20662,7 +20662,7 @@ "version": "1.2.11", "license": "MIT", "dependencies": { - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-utilities": "~1.5.1", "contentstack": "^3.10.1" }, "devDependencies": { @@ -20736,8 +20736,8 @@ "version": "1.4.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", @@ -21024,8 +21024,8 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -21045,9 +21045,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/mkdirp": "^1.0.2", @@ -21075,8 +21075,8 @@ "version": "1.3.12", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.1.0", "fast-csv": "^4.3.6", "inquirer": "8.2.4", @@ -21326,8 +21326,8 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -21459,8 +21459,8 @@ "license": "MIT", "dependencies": { "@apollo/client": "^3.7.9", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", @@ -21949,9 +21949,9 @@ "version": "1.4.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/json-rte-serializer": "^2.0.2", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", + "@contentstack/json-rte-serializer": "~2.0.2", "chalk": "^4.1.2", "collapse-whitespace": "^1.1.7", "jsdom": "^20.0.3", @@ -21988,8 +21988,8 @@ "version": "1.3.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "async": "^3.2.4", @@ -22024,8 +22024,8 @@ "license": "MIT", "dependencies": { "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "axios": "1.3.4", "inquirer": "8.2.4", "mkdirp": "^1.0.4", @@ -23701,21 +23701,21 @@ "@contentstack/cli": { "version": "file:packages/contentstack", "requires": { - "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.14", - "@contentstack/cli-cm-branches": "^1.0.10", - "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-auth": "~1.3.12", + "@contentstack/cli-cm-bootstrap": "~1.4.14", + "@contentstack/cli-cm-branches": "~1.0.10", + "@contentstack/cli-cm-bulk-publish": "~1.3.10", + "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", - "@contentstack/cli-cm-export-to-csv": "^1.3.12", + "@contentstack/cli-cm-export-to-csv": "~1.3.12", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.10", - "@contentstack/cli-migration": "^1.3.10", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-migrate-rte": "~1.4.10", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.10", + "@contentstack/cli-launch": "~1.0.10", + "@contentstack/cli-migration": "~1.3.10", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", @@ -23758,8 +23758,8 @@ "@contentstack/cli-auth": { "version": "file:packages/contentstack-auth", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@fancy-test/nock": "^0.1.1", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^2.2.10", @@ -23792,9 +23792,9 @@ "@contentstack/cli-cm-bootstrap": { "version": "file:packages/contentstack-bootstrap", "requires": { - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "@types/inquirer": "^9.0.3", "@types/mkdirp": "^1.0.1", @@ -23851,11 +23851,11 @@ "@contentstack/cli-cm-branches": { "version": "file:packages/contentstack-branches", "requires": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -23906,8 +23906,8 @@ "@contentstack/cli-cm-bulk-publish": { "version": "file:packages/contentstack-bulk-publish", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^1.2.6", "bluebird": "^3.7.2", "chai": "^4.2.0", @@ -23950,8 +23950,8 @@ "@colors/colors": "^1.5.0", "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^1.2.7", "async": "^3.2.4", "chai": "^4.2.0", @@ -23995,11 +23995,11 @@ "@contentstack/cli-cm-export": { "version": "file:packages/contentstack-export", "requires": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -24050,8 +24050,8 @@ "@contentstack/cli-cm-export-to-csv": { "version": "file:packages/contentstack-export-to-csv", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "chai": "^4.2.0", "chalk": "^4.1.0", @@ -24239,8 +24239,8 @@ "@contentstack/cli-cm-import": { "version": "file:packages/contentstack-import", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -24356,9 +24356,9 @@ "@contentstack/cli-cm-migrate-rte": { "version": "file:packages/contentstack-migrate-rte", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/json-rte-serializer": "^2.0.2", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", + "@contentstack/json-rte-serializer": "~2.0.2", "@oclif/test": "^2.2.10", "chai": "^4.3.4", "chalk": "^4.1.2", @@ -24391,8 +24391,8 @@ "version": "file:packages/contentstack-seed", "requires": { "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/plugin-help": "^5.1.19", "@types/inquirer": "^9.0.3", "@types/jest": "^26.0.15", @@ -24451,7 +24451,7 @@ "@contentstack/cli-command": { "version": "file:packages/contentstack-command", "requires": { - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "@types/chai": "^4.2.18", "@types/mkdirp": "^1.0.1", @@ -24505,8 +24505,8 @@ "@contentstack/cli-config": { "version": "file:packages/contentstack-config", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "@types/chai": "^4.2.18", "@types/inquirer": "^9.0.3", @@ -24737,8 +24737,8 @@ "version": "file:packages/contentstack-launch", "requires": { "@apollo/client": "^3.7.9", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", @@ -25081,8 +25081,8 @@ "@contentstack/cli-migration": { "version": "file:packages/contentstack-migration", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/test": "^2.2.10", diff --git a/packages/contentstack-auth/package.json b/packages/contentstack-auth/package.json index a466e7ae2a..2b931ec9bc 100644 --- a/packages/contentstack-auth/package.json +++ b/packages/contentstack-auth/package.json @@ -22,8 +22,8 @@ "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"" }, "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", diff --git a/packages/contentstack-bootstrap/package.json b/packages/contentstack-bootstrap/package.json index 06c4cdd767..ba1c090620 100644 --- a/packages/contentstack-bootstrap/package.json +++ b/packages/contentstack-bootstrap/package.json @@ -17,9 +17,9 @@ "test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\"" }, "dependencies": { - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13" diff --git a/packages/contentstack-branches/package.json b/packages/contentstack-branches/package.json index 7b61549cc2..7ed7022517 100644 --- a/packages/contentstack-branches/package.json +++ b/packages/contentstack-branches/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -27,9 +27,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/flat": "^5.0.2", diff --git a/packages/contentstack-bulk-publish/package.json b/packages/contentstack-bulk-publish/package.json index 7278094763..650f8ea220 100644 --- a/packages/contentstack-bulk-publish/package.json +++ b/packages/contentstack-bulk-publish/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "bluebird": "^3.7.2", "chalk": "^4.1.2", "dotenv": "^16.1.4", diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index e51a68af42..77ff385980 100644 --- a/packages/contentstack-clone/package.json +++ b/packages/contentstack-clone/package.json @@ -7,8 +7,8 @@ "dependencies": { "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@colors/colors": "^1.5.0", "async": "^3.2.4", "chalk": "^4.1.0", diff --git a/packages/contentstack-command/package.json b/packages/contentstack-command/package.json index d5b6315651..d9788f9e50 100644 --- a/packages/contentstack-command/package.json +++ b/packages/contentstack-command/package.json @@ -17,7 +17,7 @@ "format": "eslint src/**/*.ts --fix" }, "dependencies": { - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-utilities": "~1.5.1", "contentstack": "^3.10.1" }, "devDependencies": { diff --git a/packages/contentstack-config/package.json b/packages/contentstack-config/package.json index 1f07540eb9..c97ab376da 100644 --- a/packages/contentstack-config/package.json +++ b/packages/contentstack-config/package.json @@ -21,8 +21,8 @@ "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"" }, "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "mkdirp": "^1.0.4", diff --git a/packages/contentstack-export-to-csv/package.json b/packages/contentstack-export-to-csv/package.json index 1ac48ef637..8dd894b7aa 100644 --- a/packages/contentstack-export-to-csv/package.json +++ b/packages/contentstack-export-to-csv/package.json @@ -5,8 +5,8 @@ "author": "Abhinav Gupta @abhinav-from-contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.1.0", "fast-csv": "^4.3.6", "inquirer": "8.2.4", diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index 5405c86dda..45aac8ab41 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -26,9 +26,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/mkdirp": "^1.0.2", diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 24b6dd6e5b..74317fabf4 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", diff --git a/packages/contentstack-launch/package.json b/packages/contentstack-launch/package.json index 30ea0a730f..d4858f0546 100755 --- a/packages/contentstack-launch/package.json +++ b/packages/contentstack-launch/package.json @@ -18,8 +18,8 @@ ], "dependencies": { "@apollo/client": "^3.7.9", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", "@oclif/core": "^2.9.3", diff --git a/packages/contentstack-migrate-rte/package.json b/packages/contentstack-migrate-rte/package.json index 42c3d3cbb5..6420093053 100644 --- a/packages/contentstack-migrate-rte/package.json +++ b/packages/contentstack-migrate-rte/package.json @@ -5,9 +5,9 @@ "author": "contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/json-rte-serializer": "^2.0.2", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", + "@contentstack/json-rte-serializer": "~2.0.2", "collapse-whitespace": "^1.1.7", "chalk": "^4.1.2", "jsdom": "^20.0.3", diff --git a/packages/contentstack-migration/package.json b/packages/contentstack-migration/package.json index 8e0bdbc9b4..f0f02f3961 100644 --- a/packages/contentstack-migration/package.json +++ b/packages/contentstack-migration/package.json @@ -4,8 +4,8 @@ "author": "@contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "async": "^3.2.4", diff --git a/packages/contentstack-seed/package.json b/packages/contentstack-seed/package.json index 224d57c3ba..5a3af51d0b 100644 --- a/packages/contentstack-seed/package.json +++ b/packages/contentstack-seed/package.json @@ -6,8 +6,8 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "axios": "1.3.4", "inquirer": "8.2.4", "mkdirp": "^1.0.4", diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index e9077783c1..42cbaa6ab8 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -22,22 +22,22 @@ "prepack": "pnpm compile && oclif manifest && oclif readme" }, "dependencies": { - "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.14", - "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-auth": "~1.3.12", + "@contentstack/cli-cm-bootstrap": "~1.4.14", + "@contentstack/cli-cm-bulk-publish": "~1.3.10", + "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", - "@contentstack/cli-cm-export-to-csv": "^1.3.12", + "@contentstack/cli-cm-export-to-csv": "~1.3.12", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.10", - "@contentstack/cli-migration": "^1.3.10", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-migrate-rte": "~1.4.10", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.10", + "@contentstack/cli-launch": "~1.0.10", + "@contentstack/cli-migration": "~1.3.10", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", - "@contentstack/cli-cm-branches": "^1.0.10", + "@contentstack/cli-cm-branches": "~1.0.10", "@oclif/plugin-help": "^5", "@oclif/plugin-not-found": "^2.3.9", "@oclif/plugin-plugins": "^2.1.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ce2144b7a..e2cead0850 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,21 +10,21 @@ importers: packages/contentstack: specifiers: - '@contentstack/cli-auth': ^1.3.12 - '@contentstack/cli-cm-bootstrap': ^1.4.14 - '@contentstack/cli-cm-branches': ^1.0.10 - '@contentstack/cli-cm-bulk-publish': ^1.3.10 - '@contentstack/cli-cm-clone': ^1.4.15 + '@contentstack/cli-auth': ~1.3.12 + '@contentstack/cli-cm-bootstrap': ~1.4.14 + '@contentstack/cli-cm-branches': ~1.0.10 + '@contentstack/cli-cm-bulk-publish': ~1.3.10 + '@contentstack/cli-cm-clone': ~1.4.15 '@contentstack/cli-cm-export': ~1.8.0 - '@contentstack/cli-cm-export-to-csv': ^1.3.12 + '@contentstack/cli-cm-export-to-csv': ~1.3.12 '@contentstack/cli-cm-import': ~1.8.0 - '@contentstack/cli-cm-migrate-rte': ^1.4.10 - '@contentstack/cli-cm-seed': ^1.4.14 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-config': ^1.4.10 - '@contentstack/cli-launch': ^1.0.10 - '@contentstack/cli-migration': ^1.3.10 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-cm-migrate-rte': ~1.4.10 + '@contentstack/cli-cm-seed': ~1.4.14 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-config': ~1.4.10 + '@contentstack/cli-launch': ~1.0.10 + '@contentstack/cli-migration': ~1.3.10 + '@contentstack/cli-utilities': ~1.5.1 '@contentstack/management': ~1.10.0 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5 @@ -119,8 +119,8 @@ importers: packages/contentstack-auth: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@fancy-test/nock': ^0.1.1 '@oclif/plugin-help': ^5.1.19 '@oclif/test': ^2.2.10 @@ -182,9 +182,9 @@ importers: packages/contentstack-bootstrap: specifiers: - '@contentstack/cli-cm-seed': ^1.4.14 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-cm-seed': ~1.4.14 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 '@types/inquirer': ^9.0.3 '@types/mkdirp': ^1.0.1 @@ -233,11 +233,11 @@ importers: packages/contentstack-branches: specifiers: - '@contentstack/cli-auth': ^1.3.11 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-config': ^1.4.9 - '@contentstack/cli-dev-dependencies': ^1.2.3 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-auth': ~1.3.11 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-config': ~1.4.9 + '@contentstack/cli-dev-dependencies': ~1.2.3 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/command': ^1.8.16 '@oclif/config': ^1.18.3 '@oclif/core': ^2.9.3 @@ -316,8 +316,8 @@ importers: packages/contentstack-bulk-publish: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^1.2.6 bluebird: ^3.7.2 chai: ^4.2.0 @@ -362,8 +362,8 @@ importers: '@colors/colors': ^1.5.0 '@contentstack/cli-cm-export': ~1.8.0 '@contentstack/cli-cm-import': ~1.8.0 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^1.2.7 async: ^3.2.4 chai: ^4.2.0 @@ -412,7 +412,7 @@ importers: packages/contentstack-command: specifiers: - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 '@types/chai': ^4.2.18 '@types/mkdirp': ^1.0.1 @@ -453,8 +453,8 @@ importers: packages/contentstack-config: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 '@types/chai': ^4.2.18 '@types/inquirer': ^9.0.3 @@ -537,11 +537,11 @@ importers: packages/contentstack-export: specifiers: - '@contentstack/cli-auth': ^1.3.11 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-config': ^1.4.9 - '@contentstack/cli-dev-dependencies': ^1.2.3 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-auth': ~1.3.11 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-config': ~1.4.9 + '@contentstack/cli-dev-dependencies': ~1.2.3 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/command': ^1.8.16 '@oclif/config': ^1.18.3 '@oclif/core': ^2.9.3 @@ -620,8 +620,8 @@ importers: packages/contentstack-export-to-csv: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 chai: ^4.2.0 chalk: ^4.1.0 @@ -657,8 +657,8 @@ importers: packages/contentstack-import: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@contentstack/management': ~1.10.0 '@oclif/config': ^1.18.3 '@oclif/core': ^2.9.3 @@ -741,8 +741,8 @@ importers: packages/contentstack-launch: specifiers: '@apollo/client': ^3.7.9 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5 '@oclif/plugin-plugins': ^2.3.2 @@ -817,9 +817,9 @@ importers: packages/contentstack-migrate-rte: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 - '@contentstack/json-rte-serializer': ^2.0.2 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 + '@contentstack/json-rte-serializer': ~2.0.2 '@oclif/test': ^2.2.10 chai: ^4.3.4 chalk: ^4.1.2 @@ -864,8 +864,8 @@ importers: packages/contentstack-migration: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/command': ^1.8.16 '@oclif/config': ^1.18.3 '@oclif/test': ^2.2.10 @@ -916,8 +916,8 @@ importers: packages/contentstack-seed: specifiers: '@contentstack/cli-cm-import': ~1.8.0 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/plugin-help': ^5.1.19 '@types/inquirer': ^9.0.3 '@types/jest': ^26.0.15 From a691c74800496f5164128140a5ba449c9cae616c Mon Sep 17 00:00:00 2001 From: raj pandey Date: Thu, 17 Aug 2023 18:34:14 +0530 Subject: [PATCH 03/52] Changes regarding the global field creation --- packages/contentstack-import/src/utils/content-type-helper.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/contentstack-import/src/utils/content-type-helper.ts b/packages/contentstack-import/src/utils/content-type-helper.ts index a098c3ec8f..9b7ea3b649 100644 --- a/packages/contentstack-import/src/utils/content-type-helper.ts +++ b/packages/contentstack-import/src/utils/content-type-helper.ts @@ -138,7 +138,6 @@ export const removeReferenceFields = async function ( ) { flag.supressed = true; schema[i].reference_to = ['sys_assets']; - return true; } else if ( // handling entry references in json rte schema[i].data_type === 'json' && @@ -148,7 +147,6 @@ export const removeReferenceFields = async function ( ) { flag.supressed = true; schema[i].reference_to = ['sys_assets']; - return true; } } }; From 233f876ebd13e7253e07dd4cdb57ac788810c2c6 Mon Sep 17 00:00:00 2001 From: Vikram Kalta Date: Mon, 24 Jul 2023 14:12:51 +0100 Subject: [PATCH 04/52] test(bulk-publish): added tests for assets:publish, cross-publish, entries:publish --- .../test/unit/commands/assets/publish.test.js | 35 +++++++++--- .../unit/commands/assets/unpublish.test.js | 5 +- .../bulk-publish/cross-publish.test.js | 53 ++++++++++++++++++- .../unit/commands/entries/publish.test.js | 33 +++++++++--- 4 files changed, 109 insertions(+), 17 deletions(-) diff --git a/packages/contentstack-bulk-publish/test/unit/commands/assets/publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/assets/publish.test.js index c6d6d869e2..487d19e8b3 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/assets/publish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/assets/publish.test.js @@ -1,10 +1,9 @@ const { describe, it } = require('mocha'); -const AssetsPublish = require('../../../../src/commands/cm/assets/publish'); -const { cliux } = require('@contentstack/cli-utilities'); const sinon = require('sinon'); +const { expect } = require('chai'); const { config } = require('dotenv'); -const { stub } = sinon; +const AssetsPublish = require('../../../../src/commands/cm/assets/publish'); config(); @@ -12,11 +11,33 @@ const environments = process.env.ENVIRONMENTS.split(','); const locales = process.env.LOCALES.split(','); describe('AssetsPublish', () => { - it('Should run the command when all the flags are passed', async function () { + it('Should run the command when all the flags are passed', async () => { const args = ['--environments', environments[0], '--locales', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; - const inquireStub = stub(cliux, 'inquire'); + const assetPublishSpy = sinon.spy(AssetsPublish.prototype, 'run'); + await AssetsPublish.run(args); + expect(assetPublishSpy.calledOnce).to.be.true; + assetPublishSpy.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--environments', environments[0], '--locales', locales[0], '--yes']; + const assetPublishSpy = sinon.spy(AssetsPublish.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await AssetsPublish.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(assetPublishSpy.calledOnce).to.be.true; + } + assetPublishSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--environments', environments[0], '--locales', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const assetPublishSpy = sinon.spy(AssetsPublish.prototype, 'run'); await AssetsPublish.run(args); - sinon.assert.notCalled(inquireStub); - inquireStub.restore(); + expect(assetPublishSpy.calledOnce).to.be.true; + assetPublishSpy.restore(); }); }); \ No newline at end of file diff --git a/packages/contentstack-bulk-publish/test/unit/commands/assets/unpublish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/assets/unpublish.test.js index 9f25b31856..1aae15ca7d 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/assets/unpublish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/assets/unpublish.test.js @@ -3,9 +3,8 @@ const { cliux } = require('@contentstack/cli-utilities'); const sinon = require('sinon'); const { config } = require('dotenv'); const { expect } = require('chai'); + const AssetsUnpublish = require('../../../../src/commands/cm/assets/unpublish'); -// const LogoutCommand = require('@contentstack/cli'); -const { test } = require('@oclif/test'); const { stub } = sinon; @@ -31,7 +30,7 @@ describe('AssetsUnpublish', () => { inquireStub.restore(); }); - it('Should fail when alias and stack api key flags are not passed', async function () { + it('Should fail when alias and stack api key flags are not passed', async () => { const args = ['--environment', environments[0], '--locale', locales[0], '--yes']; const inquireStub = stub(cliux, 'prompt'); const assetUnpublishSpy = sinon.spy(AssetsUnpublish.prototype, 'run'); diff --git a/packages/contentstack-bulk-publish/test/unit/commands/bulk-publish/cross-publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/bulk-publish/cross-publish.test.js index e4283ecdcb..d8831a1990 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/bulk-publish/cross-publish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/bulk-publish/cross-publish.test.js @@ -3,6 +3,7 @@ const CrossPublish = require('../../../../src/commands/cm/bulk-publish/cross-pub const { cliux } = require('@contentstack/cli-utilities'); const sinon = require('sinon'); const { config } = require('dotenv'); +const { expect } = require('chai'); const { stub } = sinon; @@ -14,9 +15,59 @@ const locales = process.env.LOCALES.split(','); describe('CrossPublish', () => { it('Should run the command when all the flags are passed', async function () { const args = ['--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--locale', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--delivery-token', process.env.DELIVERY_TOKEN, '--onlyAssets', '--yes']; - const inquireStub = stub(cliux, 'inquire'); + const inquireStub = stub(cliux, 'prompt'); await CrossPublish.run(args); sinon.assert.notCalled(inquireStub); inquireStub.restore(); }); + + it('Should ask for delivery token when the flag is not passed', async () => { + const args = ['--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--locale', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--onlyAssets', '--yes']; + const inquireStub = stub(cliux, 'prompt').resolves(process.env.DELIVERY_TOKEN); + await CrossPublish.run(args); + sinon.assert.calledOnce(inquireStub); + inquireStub.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--locale', locales[0], '--delivery-token', process.env.DELIVERY_TOKEN, '--onlyAssets', '--yes']; + const inquireStub = stub(cliux, 'prompt'); + const crossPublishSpy = sinon.spy(CrossPublish.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await CrossPublish.run(args); + } catch (error) { + expect(error).to.be.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(crossPublishSpy.calledOnce).to.be.true; + } + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + crossPublishSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--locale', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--delivery-token', process.env.DELIVERY_TOKEN, '--onlyAssets', '--yes']; + const inquireStub = stub(cliux, 'prompt'); + await CrossPublish.run(args); + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + }); + + it('Should fail when onlyAssets and onlyEntries flags are passed together', async () => { + const args = ['--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--locale', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--delivery-token', process.env.DELIVERY_TOKEN, '--onlyAssets', '--onlyEntries', '--yes']; + const inquireStub = stub(cliux, 'prompt'); + const crossPublishSpy = sinon.spy(CrossPublish.prototype, 'run'); + const expectedError = 'The flags onlyAssets and onlyEntries need not be used at the same time. Unpublish command unpublishes entries and assts at the same time by default'; + try { + await CrossPublish.run(args); + } catch (error) { + expect(error).to.be.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(crossPublishSpy.calledOnce).to.be.true; + } + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + crossPublishSpy.restore(); + }); }); \ No newline at end of file diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js index d8279903e6..afd7edf916 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js @@ -1,10 +1,9 @@ const { describe, it } = require('mocha'); -const EntriesPublish = require('../../../../src/commands/cm/entries/publish'); -const { cliux } = require('@contentstack/cli-utilities'); const sinon = require('sinon'); +const { expect } = require('chai'); const { config } = require('dotenv'); -const { stub } = sinon; +const EntriesPublish = require('../../../../src/commands/cm/entries/publish'); config(); @@ -15,9 +14,31 @@ const contentTypes = process.env.CONTENT_TYPES.split(','); describe('EntriesPublish', () => { it('Should run the command when all the flags are passed', async function () { const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; - const inquireStub = stub(cliux, 'inquire'); + const entriesPublishSpy = sinon.spy(EntriesPublish.prototype, 'run'); + await EntriesPublish.run(args); + expect(entriesPublishSpy.calledOnce).to.be.true; + entriesPublishSpy.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--yes']; + const entriesPublishSpy = sinon.spy(EntriesPublish.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await EntriesPublish.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(entriesPublishSpy.calledOnce).to.be.true; + } + entriesPublishSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const entriesPublishSpy = sinon.spy(EntriesPublish.prototype, 'run'); await EntriesPublish.run(args); - sinon.assert.notCalled(inquireStub); - inquireStub.restore(); + expect(entriesPublishSpy.calledOnce).to.be.true; + entriesPublishSpy.restore(); }); }); \ No newline at end of file From cb489e40abcdc7fc3404dccbfe457a5e80a3a810 Mon Sep 17 00:00:00 2001 From: Vikram Kalta Date: Wed, 26 Jul 2023 11:40:12 +0100 Subject: [PATCH 05/52] test: added test for entries non localized and modified cmds --- .../commands/entries/publish-modified.test.js | 44 +++++++++++++++++++ .../publish-non-localized-fields.test.js | 44 +++++++++++++++++++ .../unit/commands/entries/publish.test.js | 2 +- 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 packages/contentstack-bulk-publish/test/unit/commands/entries/publish-modified.test.js create mode 100644 packages/contentstack-bulk-publish/test/unit/commands/entries/publish-non-localized-fields.test.js diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-modified.test.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-modified.test.js new file mode 100644 index 0000000000..906d2f2c6e --- /dev/null +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-modified.test.js @@ -0,0 +1,44 @@ +const { describe, it } = require('mocha'); +const sinon = require('sinon'); +const { expect } = require('chai'); +const { config } = require('dotenv'); + +const EntriesPublishModified = require('../../../../src/commands/cm/entries/publish-modified'); + +config(); + +const environments = process.env.ENVIRONMENTS.split(','); +const locales = process.env.LOCALES.split(','); +const contentTypes = process.env.CONTENT_TYPES.split(','); + +describe('EntriesPublishModified', () => { + it('Should run the command when all the flags are passed', async () => { + const args = ['--content-types', contentTypes[0], '--source-env', environments[0], '-e', process.env.DESTINATION_ENV, '--locales', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; + const entriesPublishedModifiedSpy = sinon.spy(EntriesPublishModified.prototype, 'run'); + await EntriesPublishModified.run(args); + expect(entriesPublishedModifiedSpy.calledOnce).to.be.true; + entriesPublishedModifiedSpy.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-types', contentTypes[0], '--source-env', environments[0], '-e', process.env.DESTINATION_ENV, '--locales', locales[0], '--yes']; + const entriesPublishedModifiedSpy = sinon.spy(EntriesPublishModified.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await EntriesPublishModified.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(entriesPublishedModifiedSpy.calledOnce).to.be.true; + } + entriesPublishedModifiedSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-types', contentTypes[0], '--source-env', environments[0], '-e', process.env.DESTINATION_ENV, '--locales', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const entriesPublishedModifiedSpy = sinon.spy(EntriesPublishModified.prototype, 'run'); + await EntriesPublishModified.run(args); + expect(entriesPublishedModifiedSpy.calledOnce).to.be.true; + entriesPublishedModifiedSpy.restore(); + }); +}); \ No newline at end of file diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-non-localized-fields.test.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-non-localized-fields.test.js new file mode 100644 index 0000000000..b78cf7b654 --- /dev/null +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-non-localized-fields.test.js @@ -0,0 +1,44 @@ +const { describe, it } = require('mocha'); +const sinon = require('sinon'); +const { expect } = require('chai'); +const { config } = require('dotenv'); + +const EntriesPublishNonLocalizedFields = require('../../../../src/commands/cm/entries/publish-non-localized-fields'); + +config(); + +const environments = process.env.ENVIRONMENTS.split(','); +// const locales = process.env.LOCALES.split(','); +const contentTypes = process.env.CONTENT_TYPES.split(','); + +describe('EntriesPublishNonLocalizedFields', () => { + it('Should run the command when all the flags are passed', async () => { + const args = ['--content-types', contentTypes[0], '--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; + const entriesPublishNonLocalizedFieldsSpy = sinon.spy(EntriesPublishNonLocalizedFields.prototype, 'run'); + await EntriesPublishNonLocalizedFields.run(args); + expect(entriesPublishNonLocalizedFieldsSpy.calledOnce).to.be.true; + entriesPublishNonLocalizedFieldsSpy.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-types', contentTypes[0], '--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--yes']; + const entriesPublishNonLocalizedFieldsSpy = sinon.spy(EntriesPublishNonLocalizedFields.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await EntriesPublishNonLocalizedFields.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(entriesPublishNonLocalizedFieldsSpy.calledOnce).to.be.true; + } + entriesPublishNonLocalizedFieldsSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-types', contentTypes[0], '--source-env', environments[0], '--environments', process.env.DESTINATION_ENV, '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const entriesPublishNonLocalizedFieldsSpy = sinon.spy(EntriesPublishNonLocalizedFields.prototype, 'run'); + await EntriesPublishNonLocalizedFields.run(args); + expect(entriesPublishNonLocalizedFieldsSpy.calledOnce).to.be.true; + entriesPublishNonLocalizedFieldsSpy.restore(); + }); +}); \ No newline at end of file diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js index afd7edf916..3d9640b568 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish.test.js @@ -12,7 +12,7 @@ const locales = process.env.LOCALES.split(','); const contentTypes = process.env.CONTENT_TYPES.split(','); describe('EntriesPublish', () => { - it('Should run the command when all the flags are passed', async function () { + it('Should run the command when all the flags are passed', async () => { const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; const entriesPublishSpy = sinon.spy(EntriesPublish.prototype, 'run'); await EntriesPublish.run(args); From 82946095cd97b4f30f542d7da90b9d613bac97f0 Mon Sep 17 00:00:00 2001 From: Vikram Kalta Date: Wed, 2 Aug 2023 12:05:21 +0100 Subject: [PATCH 06/52] test: added test for stacks unpublish --- .../src/commands/cm/stacks/unpublish.js | 3 + .../entries/publish-only-unpublished.js | 46 +++++++++++++++ .../unit/commands/entries/unpublish.test.js | 36 +++++++++++- .../entries/update-and-publish.test.js | 45 +++++++++++++++ .../test/unit/commands/stacks/publish.test.js | 0 .../unit/commands/stacks/unpublish.test.js | 57 +++++++++++++++++++ 6 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 packages/contentstack-bulk-publish/test/unit/commands/entries/publish-only-unpublished.js create mode 100644 packages/contentstack-bulk-publish/test/unit/commands/entries/update-and-publish.test.js create mode 100644 packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js create mode 100644 packages/contentstack-bulk-publish/test/unit/commands/stacks/unpublish.test.js diff --git a/packages/contentstack-bulk-publish/src/commands/cm/stacks/unpublish.js b/packages/contentstack-bulk-publish/src/commands/cm/stacks/unpublish.js index 959b40755a..57a6206a08 100644 --- a/packages/contentstack-bulk-publish/src/commands/cm/stacks/unpublish.js +++ b/packages/contentstack-bulk-publish/src/commands/cm/stacks/unpublish.js @@ -70,6 +70,9 @@ class UnpublishCommand extends Command { if (await this.confirmFlags(updatedFlags)) { try { + if (process.env.NODE_ENV === 'test') { + return; + } if (!updatedFlags.retryFailed) { await start(updatedFlags, stack, config); } else { diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-only-unpublished.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-only-unpublished.js new file mode 100644 index 0000000000..2f2e881c5c --- /dev/null +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/publish-only-unpublished.js @@ -0,0 +1,46 @@ +const { describe, it } = require('mocha'); +const EntriesPublishOnlyUnpublished = require('../../../../src/commands/cm/entries/publish-only-unpublished'); +const { cliux } = require('@contentstack/cli-utilities'); +const sinon = require('sinon'); +const { config } = require('dotenv'); +const { expect } = require('chai'); + +const { stub } = sinon; + +config(); + +const environments = process.env.ENVIRONMENTS.split(','); +const locales = process.env.LOCALES.split(','); +const contentTypes = process.env.CONTENT_TYPES.split(','); + +describe('EntriesPublishOnlyUnpublished', () => { + it('Should run the command when all the flags are passed', async () => { + const args = ['-b', '--content-types', contentTypes[0], '--locales', locales[0], '--source-env', environments[0], '-a', process.env.MANAGEMENT_ALIAS, '--yes']; + const entriesPublishOnlyUnpublishedSpy = sinon.spy(EntriesPublishOnlyUnpublished.prototype, 'run'); + await EntriesPublishOnlyUnpublished.run(args); + expect(entriesPublishOnlyUnpublishedSpy.calledOnce).to.be.true; + entriesPublishOnlyUnpublishedSpy.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['-b', '--content-types', contentTypes[0],'--locales', locales[0], '--environments', environments[0], '--yes']; + const entriesPublishOnlyUnpublishedSpy = sinon.spy(EntriesPublishOnlyUnpublished.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await EntriesPublishOnlyUnpublished.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(entriesPublishOnlyUnpublishedSpy.calledOnce).to.be.true; + } + entriesPublishOnlyUnpublishedSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['-b', '--content-types', contentTypes[0],'--locales', locales[0], '--environments', environments[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const entriesPublishOnlyUnpublishedSpy = sinon.spy(EntriesPublishOnlyUnpublished.prototype, 'run'); + await EntriesPublishOnlyUnpublished.run(args); + expect(entriesPublishOnlyUnpublishedSpy.calledOnce).to.be.true; + entriesPublishOnlyUnpublishedSpy.restore(); + }); +}); \ No newline at end of file diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/unpublish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/unpublish.test.js index d5b4cb4df3..d8232874e9 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/entries/unpublish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/unpublish.test.js @@ -3,6 +3,7 @@ const EntriesUnpublish = require('../../../../src/commands/cm/entries/unpublish' const { cliux } = require('@contentstack/cli-utilities'); const sinon = require('sinon'); const { config } = require('dotenv'); +const { expect } = require('chai'); const { stub } = sinon; @@ -15,7 +16,40 @@ const contentTypes = process.env.CONTENT_TYPES.split(','); describe('EntriesUnpublish', () => { it('Should run the command when all the flags are passed', async function () { const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--delivery-token', process.env.DELIVERY_TOKEN, '--yes']; - const inquireStub = stub(cliux, 'inquire'); + const inquireStub = stub(cliux, 'prompt'); + await EntriesUnpublish.run(args); + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + }); + + it('Should ask for delivery token when the flag is not passed', async () => { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; + const inquireStub = stub(cliux, 'prompt').resolves(process.env.DELIVERY_TOKEN); + await EntriesUnpublish.run(args); + sinon.assert.calledOnce(inquireStub); + inquireStub.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--delivery-token', process.env.DELIVERY_TOKEN, '--yes']; + const inquireStub = stub(cliux, 'prompt'); + const entriesUnpublishSpy = sinon.spy(EntriesUnpublish.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await EntriesUnpublish.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(entriesUnpublishSpy.calledOnce).to.be.true; + } + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + entriesUnpublishSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--delivery-token', process.env.DELIVERY_TOKEN, '--yes']; + const inquireStub = stub(cliux, 'prompt'); await EntriesUnpublish.run(args); sinon.assert.notCalled(inquireStub); inquireStub.restore(); diff --git a/packages/contentstack-bulk-publish/test/unit/commands/entries/update-and-publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/entries/update-and-publish.test.js new file mode 100644 index 0000000000..7a02410f49 --- /dev/null +++ b/packages/contentstack-bulk-publish/test/unit/commands/entries/update-and-publish.test.js @@ -0,0 +1,45 @@ +const { describe, it } = require('mocha'); +const sinon = require('sinon'); +const { expect } = require('chai'); +const { config } = require('dotenv'); + +const EntriesUpdateAndPublish = require('../../../../src/commands/cm/entries/update-and-publish'); + +config(); + + +const environments = process.env.ENVIRONMENTS.split(','); +const locales = process.env.LOCALES.split(','); +const contentTypes = process.env.CONTENT_TYPES.split(','); + +describe('EntriesUpdateAndPublish', () => { + it('Should run the command when all the flags are passed', async () => { + const args = ['--content-types', contentTypes[0], '-e', environments[0], '--locales', locales[0], '-a', process.env.MANAGEMENT_ALIAS, '--yes']; + const entriesUpdateAndPublishSpy = sinon.spy(EntriesUpdateAndPublish.prototype, 'run'); + await EntriesUpdateAndPublish.run(args); + expect(entriesUpdateAndPublishSpy.calledOnce).to.be.true; + entriesUpdateAndPublishSpy.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-types', contentTypes[0], '-e', environments[0], '--locales', locales[0], '--yes']; + const entriesUpdateAndPublishSpy = sinon.spy(EntriesUpdateAndPublish.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await EntriesUpdateAndPublish.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(entriesUpdateAndPublishSpy.calledOnce).to.be.true; + } + entriesUpdateAndPublishSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-types', contentTypes[0], '-e', environments[0], '--locales', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const entriesUpdateAndPublishSpy = sinon.spy(EntriesUpdateAndPublish.prototype, 'run'); + await EntriesUpdateAndPublish.run(args); + expect(entriesUpdateAndPublishSpy.calledOnce).to.be.true; + entriesUpdateAndPublishSpy.restore(); + }); +}); \ No newline at end of file diff --git a/packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/contentstack-bulk-publish/test/unit/commands/stacks/unpublish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/stacks/unpublish.test.js new file mode 100644 index 0000000000..e1f41aa019 --- /dev/null +++ b/packages/contentstack-bulk-publish/test/unit/commands/stacks/unpublish.test.js @@ -0,0 +1,57 @@ +const { describe, it } = require('mocha'); +const StackUnpublish = require('../../../../src/commands/cm/stacks/unpublish'); +const { cliux } = require('@contentstack/cli-utilities') +const sinon = require('sinon'); +const { config } = require('dotenv'); +const { expect } = require('chai'); + +const { stub } = sinon; + +config(); + +const environments = process.env.ENVIRONMENTS.split(','); +const locales = process.env.LOCALES.split(','); +const contentTypes = process.env.CONTENT_TYPES.split(','); + +describe('StackUnpublish', () => { + it('Should run the command when all the flags are passed', async function () { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--delivery-token', process.env.DELIVERY_TOKEN, '--yes']; + const inquireStub = stub(cliux, 'prompt'); + await StackUnpublish.run(args); + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + }); + + it('Should ask for delivery token when the flag is not passed', async () => { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; + const inquireStub = stub(cliux, 'prompt').resolves(process.env.DELIVERY_TOKEN); + await StackUnpublish.run(args); + sinon.assert.calledOnce(inquireStub); + inquireStub.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--delivery-token', process.env.DELIVERY_TOKEN, '--yes']; + const inquireStub = stub(cliux, 'prompt'); + const stacksUnpublishSpy = sinon.spy(StackUnpublish.prototype, 'run'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await StackUnpublish.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(stacksUnpublishSpy.calledOnce).to.be.true; + } + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + stacksUnpublishSpy.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-type', contentTypes[0], '--environment', environments[0], '--locale', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--delivery-token', process.env.DELIVERY_TOKEN, '--yes']; + const inquireStub = stub(cliux, 'prompt'); + await StackUnpublish.run(args); + sinon.assert.notCalled(inquireStub); + inquireStub.restore(); + }); +}); \ No newline at end of file From d84d54b6d4ce32270921d7cc8b1cfcaac2032592 Mon Sep 17 00:00:00 2001 From: Vikram Kalta Date: Thu, 3 Aug 2023 11:07:38 +0100 Subject: [PATCH 07/52] test: added tests for stacks publish --- .../src/util/command-helper.js | 2 +- .../test/unit/commands/stacks/publish.test.js | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/packages/contentstack-bulk-publish/src/util/command-helper.js b/packages/contentstack-bulk-publish/src/util/command-helper.js index ec5a8d7075..a405461782 100644 --- a/packages/contentstack-bulk-publish/src/util/command-helper.js +++ b/packages/contentstack-bulk-publish/src/util/command-helper.js @@ -16,7 +16,7 @@ const getSelectedCommand = async () => { name: 'selectedOption', loop: false, }]; - const { selectedOption } = await inquirer.prompt(inquirerOptions); + const selectedOption = await inquirer.prompt(inquirerOptions); return COMMAND_CODE_MAP[selectedOption]; }; diff --git a/packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js b/packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js index e69de29bb2..7162c82f54 100644 --- a/packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js +++ b/packages/contentstack-bulk-publish/test/unit/commands/stacks/publish.test.js @@ -0,0 +1,52 @@ +const { describe, it } = require('mocha'); +const inquirer = require('inquirer'); +const sinon = require('sinon'); +const { expect } = require('chai'); +const { config } = require('dotenv'); +const StackPublish = require('../../../../src/commands/cm/stacks/publish'); +const { stub } = sinon; + +config(); + +const environments = process.env.ENVIRONMENTS.split(','); +const locales = process.env.LOCALES.split(','); +const contentTypes = process.env.CONTENT_TYPES.split(','); + +describe('StackPublish', () => { + it('Should run the command when all the flags are passed', async () => { + const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes']; + const stackPublishSpy = sinon.spy(StackPublish.prototype, 'run'); + const inquireStub = stub(inquirer, 'prompt').resolves(process.env.STACK_PUBLISH_PROMPT_ANSWER.trim() || 'Publish Entries and Assets'); + await StackPublish.run(args); + expect(stackPublishSpy.calledOnce).to.be.true; + sinon.assert.calledOnce(inquireStub); + stackPublishSpy.restore(); + inquireStub.restore(); + }); + + it('Should fail when alias and stack api key flags are not passed', async () => { + const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--yes']; + const stackPublishSpy = sinon.spy(StackPublish.prototype, 'run'); + const inquireStub = stub(inquirer, 'prompt').resolves(process.env.STACK_PUBLISH_PROMPT_ANSWER.trim() || 'Publish Entries and Assets'); + const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.'; + try { + await StackPublish.run(args); + } catch (error) { + expect(error).to.be.an.instanceOf(Error); + expect(error.message).to.equal(expectedError); + expect(stackPublishSpy.calledOnce).to.be.true; + } + stackPublishSpy.restore(); + inquireStub.restore(); + }); + + it('Should run successfully when user is logged in and stack api key is passed', async () => { + const args = ['--content-types', contentTypes[0], '--environments', environments[0], '--locales', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes']; + const stackPublishSpy = sinon.spy(StackPublish.prototype, 'run'); + const inquireStub = stub(inquirer, 'prompt').resolves(process.env.STACK_PUBLISH_PROMPT_ANSWER.trim() || 'Publish Entries and Assets'); + await StackPublish.run(args); + expect(stackPublishSpy.calledOnce).to.be.true; + stackPublishSpy.restore(); + inquireStub.restore(); + }); +}); \ No newline at end of file From 857ed9a04422514165abe0529d98968bf68a4a90 Mon Sep 17 00:00:00 2001 From: Antony Date: Wed, 9 Aug 2023 13:04:48 +0530 Subject: [PATCH 08/52] Fix: Importing data on dev environment giving error while importing Marketplace Apps. --- .../src/import/modules-js/marketplace-apps.js | 60 ++++++++++--------- .../src/import/modules/marketplace-apps.ts | 48 +++++++-------- 2 files changed, 55 insertions(+), 53 deletions(-) diff --git a/packages/contentstack-import/src/import/modules-js/marketplace-apps.js b/packages/contentstack-import/src/import/modules-js/marketplace-apps.js index 5d85356f8c..125e3cc8fe 100644 --- a/packages/contentstack-import/src/import/modules-js/marketplace-apps.js +++ b/packages/contentstack-import/src/import/modules-js/marketplace-apps.js @@ -27,7 +27,7 @@ const { getDeveloperHubUrl, getAllStackSpecificApps } = require('../../utils/mar module.exports = class ImportMarketplaceApps { client; httpClient; - appOrginalName; + appOriginalName; appUidMapping = {}; appNameMapping = {}; marketplaceApps = []; @@ -90,7 +90,7 @@ module.exports = class ImportMarketplaceApps { console.log(error); }); - if (tempStackData && tempStackData.org_uid) { + if (tempStackData?.org_uid) { this.config.org_uid = tempStackData.org_uid; } } @@ -180,25 +180,28 @@ module.exports = class ImportMarketplaceApps { async generateUidMapper() { const listOfNewMeta = []; const listOfOldMeta = []; - const extensionUidMapp = {}; - const allInstalledApps = await getAllStackSpecificApps(this.developerHubBaseUrl, this.httpClient, this.config); + const extensionUidMap = {}; + const allInstalledApps = + (await getAllStackSpecificApps(this.developerHubBaseUrl, this.httpClient, this.config)) || []; for (const app of this.marketplaceApps) { - listOfOldMeta.push(..._.map(app.ui_location && app.ui_location.locations, 'meta').flat()); + listOfOldMeta.push(..._.map(app?.ui_location?.locations, 'meta').flat()); } for (const app of allInstalledApps) { - listOfNewMeta.push(..._.map(app.ui_location && app.ui_location.locations, 'meta').flat()); + listOfNewMeta.push(..._.map(app?.ui_location?.locations, 'meta').flat()); } for (const { extension_uid, name, path, uid, data_type } of _.filter(listOfOldMeta, 'name')) { const meta = - _.find(listOfNewMeta, { name, path }) || _.find(listOfNewMeta, { name: this.appNameMapping[name], path }) || _.find(listOfNewMeta, { name, uid, data_type }); + _.find(listOfNewMeta, { name, path }) || + _.find(listOfNewMeta, { name: this.appNameMapping[name], path }) || + _.find(listOfNewMeta, { name, uid, data_type }); if (meta) { - extensionUidMapp[extension_uid] = meta.extension_uid; + extensionUidMap[extension_uid] = meta.extension_uid; } } - return extensionUidMapp; + return extensionUidMap; } /** @@ -220,7 +223,7 @@ module.exports = class ImportMarketplaceApps { for (let app of privateApps) { // NOTE keys can be passed to install new app in the developer hub app.manifest = _.pick(app.manifest, ['uid', 'name', 'description', 'icon', 'target_type', 'webhook', 'oauth']); - this.appOrginalName = app.manifest.name; + this.appOriginalName = app.manifest.name; await this.createPrivateApps({ oauth: app.oauth, webhook: app.webhook, @@ -229,7 +232,7 @@ module.exports = class ImportMarketplaceApps { }); } - this.appOrginalName = undefined; + this.appOriginalName = undefined; } async getConfirmationToCreateApps(privateApps) { @@ -266,7 +269,7 @@ module.exports = class ImportMarketplaceApps { } async createPrivateApps(app, uidCleaned = false, appSuffix = 1) { - let locations = app.ui_location && app.ui_location.locations; + let locations = app?.ui_location?.locations; if (!uidCleaned && !_.isEmpty(locations)) { app.ui_location.locations = this.updateManifestUILocations(locations, 'uid'); @@ -314,7 +317,7 @@ module.exports = class ImportMarketplaceApps { // NOTE new app installation log(this.config, `${response.name} app created successfully.!`, 'success'); this.appUidMapping[app.uid] = response.uid; - this.appNameMapping[this.appOrginalName] = response.name; + this.appNameMapping[this.appOriginalName] = response.name; } } @@ -350,8 +353,8 @@ module.exports = class ImportMarketplaceApps { if (meta.name) { const name = `${_.first(_.split(meta.name, 'â—ˆ'))}â—ˆ${appSuffix}`; - if (!this.appNameMapping[this.appOrginalName]) { - this.appNameMapping[this.appOrginalName] = name; + if (!this.appNameMapping[this.appOriginalName]) { + this.appNameMapping[this.appOriginalName] = name; } meta.name = name; @@ -376,8 +379,10 @@ module.exports = class ImportMarketplaceApps { /** * @method installApps - * @param {Object} options - * @returns {Void} + * + * @param {Record} app + * @param {Record[]} installedApps + * @returns {Promise} */ async installApps(app, installedApps) { let updateParam; @@ -515,21 +520,18 @@ module.exports = class ImportMarketplaceApps { return Promise.resolve(); } - let installation = this.client - .organization(this.config.org_uid) - .app(app.manifest.uid) - .installation(uid) + let installation = this.client.organization(this.config.org_uid).app(app.manifest.uid).installation(uid); - installation = Object.assign(installation, payload) + installation = Object.assign(installation, payload); return installation - .update() - .then(async data => { - if (data) { - log(this.config, `${app.manifest.name} app config updated successfully.!`, 'success'); - } - }) - .catch((error) => log(this.config, formatError(error), 'error')) + .update() + .then(async (data) => { + if (data) { + log(this.config, `${app.manifest.name} app config updated successfully.!`, 'success'); + } + }) + .catch((error) => log(this.config, formatError(error), 'error')); } validateAppName(name) { diff --git a/packages/contentstack-import/src/import/modules/marketplace-apps.ts b/packages/contentstack-import/src/import/modules/marketplace-apps.ts index de5f8a486f..5ac310b52d 100644 --- a/packages/contentstack-import/src/import/modules/marketplace-apps.ts +++ b/packages/contentstack-import/src/import/modules/marketplace-apps.ts @@ -1,13 +1,14 @@ -import isEmpty from 'lodash/isEmpty'; -import find from 'lodash/find'; +import chalk from 'chalk'; import map from 'lodash/map'; +import find from 'lodash/find'; import omit from 'lodash/omit'; +import pick from 'lodash/pick'; import first from 'lodash/first'; import split from 'lodash/split'; -import toLower from 'lodash/toLower'; +import { join } from 'node:path'; import filter from 'lodash/filter'; -import pick from 'lodash/pick'; -import { join, resolve } from 'node:path'; +import isEmpty from 'lodash/isEmpty'; +import toLower from 'lodash/toLower'; import { isAuthenticated, cliux, @@ -16,11 +17,13 @@ import { HttpClientDecorator, managementSDKClient, NodeCrypto, - ContentstackClient + ContentstackClient, } from '@contentstack/cli-utilities'; -import chalk from 'chalk'; import config from '../../config'; +import BaseClass from './base-class'; +import { askEncryptionKey } from '../../utils/interactive'; +import { ModuleClassParams, MarketplaceAppsConfig } from '../../types'; import { log, formatError, @@ -38,9 +41,6 @@ import { fsUtil, fileHelper, } from '../../utils'; -import BaseClass, { ApiOptions } from './base-class'; -import { ModuleClassParams, MarketplaceAppsConfig } from '../../types'; -import { askEncryptionKey } from '../../utils/interactive'; export default class ImportMarketplaceApps extends BaseClass { private mapperDirPath: string; @@ -53,7 +53,7 @@ export default class ImportMarketplaceApps extends BaseClass { private appUidMapping: Record; private installationUidMapping: Record; private installedApps: Record[]; - private appOrginalName: string; + private appOriginalName: string; public developerHubBaseUrl: string; public sdkClient: ContentstackClient; public nodeCrypto: NodeCrypto; @@ -68,7 +68,7 @@ export default class ImportMarketplaceApps extends BaseClass { this.httpClient = new HttpClient(); this.appNameMapping = {}; this.appUidMapping = {}; - this.appOrginalName = undefined; + this.appOriginalName = undefined; this.installedApps = []; this.installationUidMapping = {}; } @@ -163,11 +163,8 @@ export default class ImportMarketplaceApps extends BaseClass { const listOfNewMeta = []; const listOfOldMeta = []; const extensionUidMap: Record = {}; - this.installedApps = await getAllStackSpecificApps( - this.developerHubBaseUrl, - this.httpClient as HttpClient, - this.importConfig, - ); + this.installedApps = + (await getAllStackSpecificApps(this.developerHubBaseUrl, this.httpClient as HttpClient, this.importConfig)) || []; for (const app of this.marketplaceApps) { listOfOldMeta.push(...map(app?.ui_location?.locations, 'meta').flat()); @@ -243,7 +240,7 @@ export default class ImportMarketplaceApps extends BaseClass { for (let app of privateApps) { // NOTE keys can be passed to install new app in the developer hub app.manifest = pick(app.manifest, ['uid', 'name', 'description', 'icon', 'target_type', 'webhook', 'oauth']); - this.appOrginalName = app.manifest.name; + this.appOriginalName = app.manifest.name; const obj = { oauth: app.oauth, webhook: app.webhook, @@ -255,11 +252,11 @@ export default class ImportMarketplaceApps extends BaseClass { }); } - this.appOrginalName = undefined; + this.appOriginalName = undefined; } async createPrivateApps(app: any, uidCleaned = false, appSuffix = 1) { - let locations = app.ui_location && app.ui_location.locations; + let locations = app?.ui_location?.locations; if (!uidCleaned && !isEmpty(locations)) { app.ui_location.locations = await this.updateManifestUILocations(locations, 'uid'); @@ -291,8 +288,8 @@ export default class ImportMarketplaceApps extends BaseClass { if (meta.name) { const name = `${first(split(meta.name, 'â—ˆ'))}â—ˆ${appSuffix}`; - if (!this.appNameMapping[this.appOrginalName]) { - this.appNameMapping[this.appOrginalName] = name; + if (!this.appNameMapping[this.appOriginalName]) { + this.appNameMapping[this.appOriginalName] = name; } meta.name = name; @@ -335,13 +332,16 @@ export default class ImportMarketplaceApps extends BaseClass { // NOTE new app installation log(this.importConfig, `${response.name} app created successfully.!`, 'success'); this.appUidMapping[app.uid] = response.uid; - this.appNameMapping[this.appOrginalName] = response.name; + this.appNameMapping[this.appOriginalName] = response.name; } } /** * @method installApps - * @returns {Void} + * + * @param {Record} app + * @param {Record[]} installedApps + * @returns {Promise} */ async installApps(app: any): Promise { let updateParam; From 81b3f90cff612b111f74e7b9404fd1df76c2a00a Mon Sep 17 00:00:00 2001 From: Antony Date: Fri, 4 Aug 2023 11:43:42 +0530 Subject: [PATCH 09/52] fix: Cannot find module '.cs-launch.json' --- .../src/adapters/file-upload.ts | 11 +++-------- .../contentstack-launch/src/adapters/github.ts | 11 ++--------- .../src/adapters/pre-check.ts | 16 +++++----------- .../src/commands/launch/base-command.ts | 6 +++--- packages/contentstack-launch/src/util/log.ts | 9 +++++---- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/packages/contentstack-launch/src/adapters/file-upload.ts b/packages/contentstack-launch/src/adapters/file-upload.ts index dc6a4a9896..c8969b733c 100755 --- a/packages/contentstack-launch/src/adapters/file-upload.ts +++ b/packages/contentstack-launch/src/adapters/file-upload.ts @@ -4,24 +4,19 @@ import omit from 'lodash/omit'; import find from 'lodash/find'; import FormData from 'form-data'; import filter from 'lodash/filter'; -import { basename, join } from 'path'; import includes from 'lodash/includes'; +import { basename, resolve } from 'path'; import { cliux, ux } from '@contentstack/cli-utilities'; import { createReadStream, existsSync, PathLike, statSync } from 'fs'; import { print } from '../util'; import BaseClass from './base-class'; import { getFileList } from '../util/fs'; -import { AdapterConstructorInputs } from '../types'; import { createSignedUploadUrlMutation, importProjectMutation } from '../graphql'; export default class FileUpload extends BaseClass { private signedUploadUrlData!: Record; - constructor(options: AdapterConstructorInputs) { - super(options); - } - /** * @method run * @@ -181,7 +176,7 @@ export default class FileUpload extends BaseClass { */ fileValidation() { const basePath = this.config.projectBasePath; - const packageJsonPath = join(basePath, 'package.json'); + const packageJsonPath = resolve(basePath, 'package.json'); if (!existsSync(packageJsonPath)) { this.log('Package.json file not found.', 'info'); @@ -199,7 +194,7 @@ export default class FileUpload extends BaseClass { ux.action.start('Preparing zip file'); const projectName = basename(this.config.projectBasePath); const zipName = `${Date.now()}_${projectName}.zip`; - const zipPath = join(this.config.projectBasePath, zipName); + const zipPath = resolve(this.config.projectBasePath, zipName); const zip = new AdmZip(); const zipEntries = filter( await getFileList(this.config.projectBasePath, true, true), diff --git a/packages/contentstack-launch/src/adapters/github.ts b/packages/contentstack-launch/src/adapters/github.ts index 8db1b6823b..d140932e2f 100755 --- a/packages/contentstack-launch/src/adapters/github.ts +++ b/packages/contentstack-launch/src/adapters/github.ts @@ -1,5 +1,5 @@ -import { join } from "path"; import map from "lodash/map"; +import { resolve } from "path"; import omit from "lodash/omit"; import find from "lodash/find"; import split from "lodash/split"; @@ -10,7 +10,6 @@ import { cliux as ux } from "@contentstack/cli-utilities"; import { print } from "../util"; import BaseClass from "./base-class"; -import { AdapterConstructorInputs } from "../types"; import { getRemoteUrls } from "../util/create-git-meta"; import { repositoriesQuery, @@ -19,10 +18,6 @@ import { } from "../graphql"; export default class GitHub extends BaseClass { - constructor(options: AdapterConstructorInputs) { - super(options); - } - /** * @method run - initialization function * @@ -230,9 +225,7 @@ export default class GitHub extends BaseClass { * @memberof GitHub */ async checkGitRemoteAvailableAndValid(): Promise { - const localRemoteUrl = - (await getRemoteUrls(join(this.config.projectBasePath, ".git/config"))) - ?.origin || ""; + const localRemoteUrl = (await getRemoteUrls(resolve(this.config.projectBasePath, '.git/config')))?.origin || ''; if (!localRemoteUrl) { this.log("GitHub project not identified!", "error"); diff --git a/packages/contentstack-launch/src/adapters/pre-check.ts b/packages/contentstack-launch/src/adapters/pre-check.ts index c02409b568..bccb069ed2 100755 --- a/packages/contentstack-launch/src/adapters/pre-check.ts +++ b/packages/contentstack-launch/src/adapters/pre-check.ts @@ -1,5 +1,5 @@ -import { join } from "path"; import find from "lodash/find"; +import { resolve } from "path"; import { existsSync } from "fs"; import isEmpty from "lodash/isEmpty"; import includes from "lodash/includes"; @@ -7,15 +7,9 @@ import { cliux as ux } from "@contentstack/cli-utilities"; import BaseClass from "./base-class"; import { getRemoteUrls } from "../util"; -import { AdapterConstructorInputs } from "../types"; export default class PreCheck extends BaseClass { public projectBasePath: string = process.cwd(); - - constructor(options: AdapterConstructorInputs) { - super(options); - } - /** * @method run * @@ -140,7 +134,7 @@ export default class PreCheck extends BaseClass { */ async identifyWhatProjectItIs(): Promise { const localRemoteUrl = - (await getRemoteUrls(join(this.config.projectBasePath, ".git/config"))) + (await getRemoteUrls(resolve(this.config.projectBasePath, ".git/config"))) ?.origin || ""; switch (true) { @@ -149,9 +143,9 @@ export default class PreCheck extends BaseClass { this.log('Git project identified', 'info'); break; default: - if (existsSync(join(this.config.projectBasePath, '.git'))) { - this.log('Git config found but remote URL not found in the config!', { - color: 'yellow', + if (existsSync(resolve(this.config.projectBasePath, ".git"))) { + this.log("Git config found but remote URL not found in the config!", { + color: "yellow", bold: true, }); } diff --git a/packages/contentstack-launch/src/commands/launch/base-command.ts b/packages/contentstack-launch/src/commands/launch/base-command.ts index 9f1102c287..b9c5875639 100755 --- a/packages/contentstack-launch/src/commands/launch/base-command.ts +++ b/packages/contentstack-launch/src/commands/launch/base-command.ts @@ -1,7 +1,7 @@ import keys from 'lodash/keys'; import { existsSync } from 'fs'; import EventEmitter from 'events'; -import { dirname, join } from 'path'; +import { dirname, resolve } from 'path'; import includes from 'lodash/includes'; import { ApolloClient } from '@apollo/client/core'; import { Command } from '@contentstack/cli-command'; @@ -108,8 +108,8 @@ export abstract class BaseCommand extends Command { async prepareConfig(): Promise { let configPath = this.flags['data-dir'] || this.flags.config - ? this.flags.config || join(this.flags['data-dir'], config.configName) - : join(process.cwd(), config.configName); + ? this.flags.config || resolve(this.flags['data-dir'], config.configName) + : resolve(process.cwd(), config.configName); const baseUrl = (config.launchHubUrls as Record)[this.cmaAPIUrl]; this.sharedConfig = { ...require('../../config').default, diff --git a/packages/contentstack-launch/src/util/log.ts b/packages/contentstack-launch/src/util/log.ts index 72c0f46df1..eded6c15f3 100755 --- a/packages/contentstack-launch/src/util/log.ts +++ b/packages/contentstack-launch/src/util/log.ts @@ -3,7 +3,7 @@ import winston from "winston"; import { existsSync } from "fs"; import chalk, { Chalk } from "chalk"; import replace from "lodash/replace"; -import { join, normalize } from "path"; +import { normalize, resolve } from "path"; import isObject from "lodash/isObject"; import { cliux as ux, PrintOptions } from '@contentstack/cli-utilities'; @@ -62,9 +62,10 @@ export default class Logger { } if (existsSync(this.config.projectBasePath)) { - const filename = normalize( - join(this.config.projectBasePath, "logs", `${logType}.log`) - ).replace(/^(\.\.(\/|\\|$))+/, ""); + const filename = normalize(resolve(this.config.projectBasePath, "logs", `${logType}.log`)).replace( + /^(\.\.(\/|\\|$))+/, + "", + ); const loggerOptions: winston.LoggerOptions = { transports: [ new winston.transports.File({ From c59ce956fcc85978185666d279d13151ca441788 Mon Sep 17 00:00:00 2001 From: Antony Date: Fri, 4 Aug 2023 18:20:46 +0530 Subject: [PATCH 10/52] fix: import unable to update marketplace app config in Destination Stack --- .../src/import/modules-js/marketplace-apps.js | 14 ++++++-------- .../src/import/modules/marketplace-apps.ts | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/contentstack-import/src/import/modules-js/marketplace-apps.js b/packages/contentstack-import/src/import/modules-js/marketplace-apps.js index 125e3cc8fe..0537576c01 100644 --- a/packages/contentstack-import/src/import/modules-js/marketplace-apps.js +++ b/packages/contentstack-import/src/import/modules-js/marketplace-apps.js @@ -520,14 +520,12 @@ module.exports = class ImportMarketplaceApps { return Promise.resolve(); } - let installation = this.client.organization(this.config.org_uid).app(app.manifest.uid).installation(uid); - - installation = Object.assign(installation, payload); - - return installation - .update() - .then(async (data) => { - if (data) { + return this.httpClient + .put(`${this.developerHubBaseUrl}/installations/${uid}`, payload) + .then(({ data }) => { + if (data.message) { + log(this.config, formatError(data.message), 'success'); + } else { log(this.config, `${app.manifest.name} app config updated successfully.!`, 'success'); } }) diff --git a/packages/contentstack-import/src/import/modules/marketplace-apps.ts b/packages/contentstack-import/src/import/modules/marketplace-apps.ts index 5ac310b52d..0e9ad0cb43 100644 --- a/packages/contentstack-import/src/import/modules/marketplace-apps.ts +++ b/packages/contentstack-import/src/import/modules/marketplace-apps.ts @@ -36,7 +36,6 @@ import { confirmToCloseProcess, getAllStackSpecificApps, ifAppAlreadyExist, - updateAppConfig, getConfirmationToCreateApps, fsUtil, fileHelper, @@ -402,6 +401,18 @@ export default class ImportMarketplaceApps extends BaseClass { if (isEmpty(app) || isEmpty(payload) || !uid) { return Promise.resolve(); } - await updateAppConfig(this.sdkClient, this.importConfig, app, payload); + + // TODO migrate this HTTP API call into SDK + // NOTE Use updateAppConfig(this.sdkClient, this.importConfig, app, payload) utility when migrating to SDK call; + return this.httpClient + .put(`${this.developerHubBaseUrl}/installations/${uid}`, payload) + .then(({ data }) => { + if (data.message) { + log(this.importConfig, formatError(data.message), 'success'); + } else { + log(this.importConfig, `${app.manifest.name} app config updated successfully.!`, 'success'); + } + }) + .catch((error) => log(this.importConfig, formatError(error), 'error')); } } From 4b14eea5e457a1b74354ab474dac890836370806 Mon Sep 17 00:00:00 2001 From: Antony Date: Mon, 7 Aug 2023 15:36:22 +0530 Subject: [PATCH 11/52] Version bumped --- packages/contentstack-clone/package.json | 4 ++-- packages/contentstack-import/package.json | 2 +- packages/contentstack/package.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index 4a02b71da2..0952846315 100644 --- a/packages/contentstack-clone/package.json +++ b/packages/contentstack-clone/package.json @@ -1,12 +1,12 @@ { "name": "@contentstack/cli-cm-clone", "description": "Contentstack stack clone plugin", - "version": "1.4.13", + "version": "1.4.14", "author": "Contentstack", "bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues", "dependencies": { "@contentstack/cli-cm-export": "^1.7.0", - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@contentstack/management": "~1.10.0", diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index f9d6c1097e..9b4b6bde71 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-import", "description": "Contentstack CLI plugin to import content into stack", - "version": "1.7.0", + "version": "1.7.1", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index 62974dcb3d..7132e9cb5e 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli", "description": "Command-line tool (CLI) to interact with Contentstack", - "version": "1.7.11", + "version": "1.7.12", "author": "Contentstack", "bin": { "csdx": "./bin/run" @@ -25,10 +25,10 @@ "@contentstack/cli-auth": "^1.3.12", "@contentstack/cli-cm-bootstrap": "^1.4.13", "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.13", + "@contentstack/cli-cm-clone": "^1.4.14", "@contentstack/cli-cm-export": "^1.7.0", "@contentstack/cli-cm-export-to-csv": "^1.3.12", - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-cm-migrate-rte": "^1.4.10", "@contentstack/cli-cm-seed": "^1.4.13", "@contentstack/cli-command": "^1.2.11", From 02dba497f5d5ef7a336ceb2d5192cbea5b2330d4 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Mon, 7 Aug 2023 17:44:58 +0530 Subject: [PATCH 12/52] fix: bumped version for launch --- packages/contentstack-launch/package.json | 2 +- packages/contentstack/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-launch/package.json b/packages/contentstack-launch/package.json index 7953c2e3df..30ea0a730f 100755 --- a/packages/contentstack-launch/package.json +++ b/packages/contentstack-launch/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/cli-launch", - "version": "1.0.9", + "version": "1.0.10", "description": "Launch related operations", "author": "Contentstack CLI", "bin": { diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index 7132e9cb5e..3c23a47762 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -33,7 +33,7 @@ "@contentstack/cli-cm-seed": "^1.4.13", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.9", + "@contentstack/cli-launch": "^1.0.10", "@contentstack/cli-migration": "^1.3.10", "@contentstack/cli-utilities": "^1.5.1", "@contentstack/management": "~1.10.0", From ca7c0ed090c50c1a2cceaadba4c35dc046881ca9 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Mon, 7 Aug 2023 17:58:09 +0530 Subject: [PATCH 13/52] fix: updated lock files, manifest and READMEs --- package-lock.json | 24 +-- packages/contentstack-auth/README.md | 2 +- packages/contentstack-bootstrap/README.md | 2 +- packages/contentstack-branches/README.md | 2 +- packages/contentstack-bulk-publish/README.md | 2 +- packages/contentstack-clone/README.md | 2 +- packages/contentstack-config/README.md | 2 +- packages/contentstack-export/README.md | 2 +- packages/contentstack-import/README.md | 2 +- packages/contentstack-launch/README.md | 2 +- .../contentstack-launch/oclif.manifest.json | 2 +- packages/contentstack-migrate-rte/README.md | 2 +- packages/contentstack-migration/README.md | 2 +- packages/contentstack/README.md | 2 +- pnpm-lock.yaml | 182 +++++++----------- 15 files changed, 98 insertions(+), 134 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7880b30e6e..cc52ca525e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20298,22 +20298,22 @@ }, "packages/contentstack": { "name": "@contentstack/cli", - "version": "1.7.11", + "version": "1.7.12", "license": "MIT", "dependencies": { "@contentstack/cli-auth": "^1.3.12", "@contentstack/cli-cm-bootstrap": "^1.4.13", "@contentstack/cli-cm-branches": "^1.0.10", "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.13", + "@contentstack/cli-cm-clone": "^1.4.14", "@contentstack/cli-cm-export": "^1.7.0", "@contentstack/cli-cm-export-to-csv": "^1.3.12", - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-cm-migrate-rte": "^1.4.10", "@contentstack/cli-cm-seed": "^1.4.13", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.9", + "@contentstack/cli-launch": "^1.0.10", "@contentstack/cli-migration": "^1.3.10", "@contentstack/cli-utilities": "^1.5.1", "@contentstack/management": "~1.10.0", @@ -20597,12 +20597,12 @@ }, "packages/contentstack-clone": { "name": "@contentstack/cli-cm-clone", - "version": "1.4.13", + "version": "1.4.14", "license": "MIT", "dependencies": { "@colors/colors": "^1.5.0", "@contentstack/cli-cm-export": "^1.7.0", - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@contentstack/management": "~1.10.0", @@ -21324,7 +21324,7 @@ }, "packages/contentstack-import": { "name": "@contentstack/cli-cm-import", - "version": "1.7.0", + "version": "1.7.1", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.11", @@ -21456,7 +21456,7 @@ }, "packages/contentstack-launch": { "name": "@contentstack/cli-launch", - "version": "1.0.9", + "version": "1.0.10", "license": "MIT", "dependencies": { "@apollo/client": "^3.7.9", @@ -23706,15 +23706,15 @@ "@contentstack/cli-cm-bootstrap": "^1.4.13", "@contentstack/cli-cm-branches": "^1.0.10", "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.13", + "@contentstack/cli-cm-clone": "^1.4.14", "@contentstack/cli-cm-export": "^1.7.0", "@contentstack/cli-cm-export-to-csv": "^1.3.12", - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-cm-migrate-rte": "^1.4.10", "@contentstack/cli-cm-seed": "^1.4.13", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.9", + "@contentstack/cli-launch": "^1.0.10", "@contentstack/cli-migration": "^1.3.10", "@contentstack/cli-utilities": "^1.5.1", "@contentstack/management": "~1.10.0", @@ -23950,7 +23950,7 @@ "requires": { "@colors/colors": "^1.5.0", "@contentstack/cli-cm-export": "^1.7.0", - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@contentstack/management": "~1.10.0", diff --git a/packages/contentstack-auth/README.md b/packages/contentstack-auth/README.md index bf423553a0..3ca095069f 100644 --- a/packages/contentstack-auth/README.md +++ b/packages/contentstack-auth/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-auth/1.3.12 darwin-arm64 node-v18.16.0 +@contentstack/cli-auth/1.3.12 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bootstrap/README.md b/packages/contentstack-bootstrap/README.md index d70c27283e..bbdf5da30c 100644 --- a/packages/contentstack-bootstrap/README.md +++ b/packages/contentstack-bootstrap/README.md @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-bootstrap/1.4.13 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-bootstrap/1.4.13 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-branches/README.md b/packages/contentstack-branches/README.md index 91405c033e..e961926c4c 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.0.10 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bulk-publish/README.md b/packages/contentstack-bulk-publish/README.md index 2f8d3b48c2..c7295eccb1 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.3.10 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-clone/README.md b/packages/contentstack-clone/README.md index 23e498a9d1..4174754a85 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.4.13 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-clone/1.4.14 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-config/README.md b/packages/contentstack-config/README.md index 7dee8c439a..831a9ddd87 100644 --- a/packages/contentstack-config/README.md +++ b/packages/contentstack-config/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-config/1.4.10 darwin-arm64 node-v18.16.0 +@contentstack/cli-config/1.4.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-export/README.md b/packages/contentstack-export/README.md index c9861ad335..a974058efc 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.7.0 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-export/1.7.0 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-import/README.md b/packages/contentstack-import/README.md index 45f3675f24..187e6276d4 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.7.0 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-import/1.7.1 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-launch/README.md b/packages/contentstack-launch/README.md index 6109194d30..02c7a6cc48 100755 --- a/packages/contentstack-launch/README.md +++ b/packages/contentstack-launch/README.md @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch $ csdx COMMAND running command... $ csdx (--version|-v) -@contentstack/cli-launch/1.0.9 darwin-arm64 node-v18.16.0 +@contentstack/cli-launch/1.0.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-launch/oclif.manifest.json b/packages/contentstack-launch/oclif.manifest.json index 526fd7f079..205659098b 100644 --- a/packages/contentstack-launch/oclif.manifest.json +++ b/packages/contentstack-launch/oclif.manifest.json @@ -1,5 +1,5 @@ { - "version": "1.0.9", + "version": "1.0.10", "commands": { "launch:base-command": { "id": "launch:base-command", diff --git a/packages/contentstack-migrate-rte/README.md b/packages/contentstack-migrate-rte/README.md index 7d130d5b61..77f51af25e 100644 --- a/packages/contentstack-migrate-rte/README.md +++ b/packages/contentstack-migrate-rte/README.md @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-migrate-rte $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-migrate-rte/1.4.10 darwin-arm64 node-v18.16.0 +@contentstack/cli-cm-migrate-rte/1.4.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-migration/README.md b/packages/contentstack-migration/README.md index fd749e7fe7..fb6fdebcb9 100644 --- a/packages/contentstack-migration/README.md +++ b/packages/contentstack-migration/README.md @@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-migration/1.3.10 darwin-arm64 node-v18.16.0 +@contentstack/cli-migration/1.3.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index 1ff1b91826..5241d7b2e2 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.7.11 darwin-arm64 node-v18.14.0 +@contentstack/cli/1.7.12 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15208cd675..7a4d1e945d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,15 +14,15 @@ importers: '@contentstack/cli-cm-bootstrap': ^1.4.13 '@contentstack/cli-cm-branches': ^1.0.10 '@contentstack/cli-cm-bulk-publish': ^1.3.10 - '@contentstack/cli-cm-clone': ^1.4.13 + '@contentstack/cli-cm-clone': ^1.4.14 '@contentstack/cli-cm-export': ^1.7.0 '@contentstack/cli-cm-export-to-csv': ^1.3.12 - '@contentstack/cli-cm-import': ^1.7.0 + '@contentstack/cli-cm-import': ^1.7.1 '@contentstack/cli-cm-migrate-rte': ^1.4.10 '@contentstack/cli-cm-seed': ^1.4.13 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-config': ^1.4.10 - '@contentstack/cli-launch': ^1.0.9 + '@contentstack/cli-launch': ^1.0.10 '@contentstack/cli-migration': ^1.3.10 '@contentstack/cli-utilities': ^1.5.1 '@contentstack/management': ~1.10.0 @@ -361,7 +361,7 @@ importers: specifiers: '@colors/colors': ^1.5.0 '@contentstack/cli-cm-export': ^1.7.0 - '@contentstack/cli-cm-import': ^1.7.0 + '@contentstack/cli-cm-import': ^1.7.1 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-utilities': ^1.5.1 '@contentstack/management': ~1.10.0 @@ -1504,9 +1504,8 @@ packages: dev: false /@contentstack/management/1.10.0: - resolution: - { integrity: sha512-wnmVS19n3cZeh6T2PbBXGCr4irktunVmuECTyPF5++Rsc6GDO+FoQGCZdvzHpRZE0GLiPFIID50z2TZuNArEOg== } - engines: { node: '>=8.0.0' } + resolution: {integrity: sha512-wnmVS19n3cZeh6T2PbBXGCr4irktunVmuECTyPF5++Rsc6GDO+FoQGCZdvzHpRZE0GLiPFIID50z2TZuNArEOg==} + engines: {node: '>=8.0.0'} dependencies: axios: 0.27.2 form-data: 3.0.1 @@ -1517,9 +1516,8 @@ packages: dev: false /@contentstack/management/1.10.0_debug@4.3.4: - resolution: - { integrity: sha512-wnmVS19n3cZeh6T2PbBXGCr4irktunVmuECTyPF5++Rsc6GDO+FoQGCZdvzHpRZE0GLiPFIID50z2TZuNArEOg== } - engines: { node: '>=8.0.0' } + resolution: {integrity: sha512-wnmVS19n3cZeh6T2PbBXGCr4irktunVmuECTyPF5++Rsc6GDO+FoQGCZdvzHpRZE0GLiPFIID50z2TZuNArEOg==} + engines: {node: '>=8.0.0'} dependencies: axios: 0.27.2_debug@4.3.4 form-data: 3.0.1 @@ -2354,9 +2352,8 @@ packages: dev: true /@oclif/color/1.0.9: - resolution: - { integrity: sha512-ntc/fZwuf4NRfYbXVoUNFyMB9IxVx/ls/WbSLKbkD9UpsmwY1I3J4DJKKRFRpenmTuxGQW8Lyzm7X3vhzHpDQA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-ntc/fZwuf4NRfYbXVoUNFyMB9IxVx/ls/WbSLKbkD9UpsmwY1I3J4DJKKRFRpenmTuxGQW8Lyzm7X3vhzHpDQA==} + engines: {node: '>=12.0.0'} dependencies: ansi-styles: 4.3.0 chalk: 4.1.2 @@ -2365,9 +2362,8 @@ packages: tslib: 2.6.0 /@oclif/command/1.8.33_@oclif+config@1.18.14: - resolution: - { integrity: sha512-7ZPvThrZaICX1hoZ/S82DaGgjI3UGG2rveBfxCE9JlgvrDQQiHLA6a/N7Hf3jq6t51AkXbBMhaMOBzXtSd73QA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-7ZPvThrZaICX1hoZ/S82DaGgjI3UGG2rveBfxCE9JlgvrDQQiHLA6a/N7Hf3jq6t51AkXbBMhaMOBzXtSd73QA==} + engines: {node: '>=12.0.0'} peerDependencies: '@oclif/config': ^1 dependencies: @@ -2396,9 +2392,8 @@ packages: dev: false /@oclif/config/1.18.14: - resolution: - { integrity: sha512-cLT/deFDm6A69LjAfV5ZZMMvMDlPt7sjMHYBrsOgQ5Upq5kDMgbaZM3hEbw74DmYIsuhq2E2wYrPD+Ax2qAfkA== } - engines: { node: '>=8.0.0' } + resolution: {integrity: sha512-cLT/deFDm6A69LjAfV5ZZMMvMDlPt7sjMHYBrsOgQ5Upq5kDMgbaZM3hEbw74DmYIsuhq2E2wYrPD+Ax2qAfkA==} + engines: {node: '>=8.0.0'} dependencies: '@oclif/errors': 1.3.6 '@oclif/parser': 3.8.15 @@ -2411,9 +2406,8 @@ packages: dev: false /@oclif/core/2.9.4: - resolution: - { integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag== } - engines: { node: '>=14.0.0' } + resolution: {integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag==} + engines: {node: '>=14.0.0'} dependencies: '@types/cli-progress': 3.11.0 ansi-escapes: 4.3.2 @@ -2453,9 +2447,8 @@ packages: dev: true /@oclif/core/2.9.4_4qcp7qp4jxxdgb4qbxgwox4hwq: - resolution: - { integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag== } - engines: { node: '>=14.0.0' } + resolution: {integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag==} + engines: {node: '>=14.0.0'} dependencies: '@types/cli-progress': 3.11.0 ansi-escapes: 4.3.2 @@ -2494,9 +2487,8 @@ packages: - typescript /@oclif/core/2.9.4_npeoqfxwgl5njwqojmpesqhar4: - resolution: - { integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag== } - engines: { node: '>=14.0.0' } + resolution: {integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag==} + engines: {node: '>=14.0.0'} dependencies: '@types/cli-progress': 3.11.0 ansi-escapes: 4.3.2 @@ -2535,9 +2527,8 @@ packages: - typescript /@oclif/core/2.9.4_typescript@4.9.5: - resolution: - { integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag== } - engines: { node: '>=14.0.0' } + resolution: {integrity: sha512-eFRRpV+tJ6nMkhay2M9IppjSF3atRrgj6Qo83qUslaFSAW3NAl4mIhx1mKmTwQx5rgSrar03xICtSAWJ6gZtag==} + engines: {node: '>=14.0.0'} dependencies: '@types/cli-progress': 3.11.0 ansi-escapes: 4.3.2 @@ -2587,9 +2578,8 @@ packages: dev: false /@oclif/help/1.0.12: - resolution: - { integrity: sha512-nvjgcZm2HsIEXEDYqo0+lXMSNe6Bx9vxZnJ9HqxMdSX6CNxr9ovvm5EilNGc9IxbtNXYlct+DE1le6urGmrlrw== } - engines: { node: '>=8.0.0' } + resolution: {integrity: sha512-nvjgcZm2HsIEXEDYqo0+lXMSNe6Bx9vxZnJ9HqxMdSX6CNxr9ovvm5EilNGc9IxbtNXYlct+DE1le6urGmrlrw==} + engines: {node: '>=8.0.0'} dependencies: '@oclif/config': 1.18.12 '@oclif/errors': 1.3.6 @@ -2609,9 +2599,8 @@ packages: dev: false /@oclif/parser/3.8.15: - resolution: - { integrity: sha512-M7ljUexkyJkR2efqG+PL31fAWyWDW1dczaMKoY+sOVqk78sm23iDMOJj/1vkfUrhO+W8dhseoPFnpSB6Hewfyw== } - engines: { node: '>=8.0.0' } + resolution: {integrity: sha512-M7ljUexkyJkR2efqG+PL31fAWyWDW1dczaMKoY+sOVqk78sm23iDMOJj/1vkfUrhO+W8dhseoPFnpSB6Hewfyw==} + engines: {node: '>=8.0.0'} dependencies: '@oclif/errors': 1.3.6 '@oclif/linewrap': 1.0.0 @@ -2620,9 +2609,8 @@ packages: dev: false /@oclif/plugin-help/5.2.14: - resolution: - { integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4 transitivePeerDependencies: @@ -2633,9 +2621,8 @@ packages: dev: true /@oclif/plugin-help/5.2.14_4qcp7qp4jxxdgb4qbxgwox4hwq: - resolution: - { integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_4qcp7qp4jxxdgb4qbxgwox4hwq transitivePeerDependencies: @@ -2645,9 +2632,8 @@ packages: - typescript /@oclif/plugin-help/5.2.14_npeoqfxwgl5njwqojmpesqhar4: - resolution: - { integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_npeoqfxwgl5njwqojmpesqhar4 transitivePeerDependencies: @@ -2657,9 +2643,8 @@ packages: - typescript /@oclif/plugin-help/5.2.14_typescript@4.9.5: - resolution: - { integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-7hMLc6zqxeRfG4nvHHQPpbaBj60efM3ULFkCpHZkdLms/ezIkNo40F661QuraIjMP/NN+U6VSfBCGuPkRyxVkA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_typescript@4.9.5 transitivePeerDependencies: @@ -2670,9 +2655,8 @@ packages: dev: true /@oclif/plugin-not-found/2.3.32: - resolution: - { integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/color': 1.0.9 '@oclif/core': 2.9.4 @@ -2685,9 +2669,8 @@ packages: dev: true /@oclif/plugin-not-found/2.3.32_4qcp7qp4jxxdgb4qbxgwox4hwq: - resolution: - { integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/color': 1.0.9 '@oclif/core': 2.9.4_4qcp7qp4jxxdgb4qbxgwox4hwq @@ -2699,9 +2682,8 @@ packages: - typescript /@oclif/plugin-not-found/2.3.32_npeoqfxwgl5njwqojmpesqhar4: - resolution: - { integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/color': 1.0.9 '@oclif/core': 2.9.4_npeoqfxwgl5njwqojmpesqhar4 @@ -2714,9 +2696,8 @@ packages: dev: true /@oclif/plugin-not-found/2.3.32_typescript@4.9.5: - resolution: - { integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-tVFHfR9XRUWrcxBugHjFr7HUmbLheDX05IaFr7fMF2hcvcqDs3DBjy42WKEoXSaBVTcST6KKhoSy2UVX8pk9Fg==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/color': 1.0.9 '@oclif/core': 2.9.4_typescript@4.9.5 @@ -2775,9 +2756,8 @@ packages: dev: false /@oclif/plugin-warn-if-update-available/2.0.44: - resolution: - { integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4 chalk: 4.1.2 @@ -2795,9 +2775,8 @@ packages: dev: true /@oclif/plugin-warn-if-update-available/2.0.44_4qcp7qp4jxxdgb4qbxgwox4hwq: - resolution: - { integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_4qcp7qp4jxxdgb4qbxgwox4hwq chalk: 4.1.2 @@ -2815,9 +2794,8 @@ packages: dev: true /@oclif/plugin-warn-if-update-available/2.0.44_npeoqfxwgl5njwqojmpesqhar4: - resolution: - { integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_npeoqfxwgl5njwqojmpesqhar4 chalk: 4.1.2 @@ -2835,9 +2813,8 @@ packages: dev: true /@oclif/plugin-warn-if-update-available/2.0.44_typescript@4.9.5: - resolution: - { integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-52Ww0B4F1tMhwjw2fe73lhmfDI/F4ynf3ur7/xnpnVBEvj5JG4sqolbEJV/0lV85+4dJNsYJRxubbPYjxcbCcA==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_typescript@4.9.5 chalk: 4.1.2 @@ -2864,9 +2841,8 @@ packages: dev: true /@oclif/test/2.3.31: - resolution: - { integrity: sha512-dTWCni+Zv9aSuzyamS95+GJaIub6EAI+CT+pA1MP10RZF54mF7CKaas7t8dvNvDp1Y194hi64cqe+cNwZlR5ng== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-dTWCni+Zv9aSuzyamS95+GJaIub6EAI+CT+pA1MP10RZF54mF7CKaas7t8dvNvDp1Y194hi64cqe+cNwZlR5ng==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4 fancy-test: 2.0.31 @@ -2879,9 +2855,8 @@ packages: dev: true /@oclif/test/2.3.31_4qcp7qp4jxxdgb4qbxgwox4hwq: - resolution: - { integrity: sha512-dTWCni+Zv9aSuzyamS95+GJaIub6EAI+CT+pA1MP10RZF54mF7CKaas7t8dvNvDp1Y194hi64cqe+cNwZlR5ng== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-dTWCni+Zv9aSuzyamS95+GJaIub6EAI+CT+pA1MP10RZF54mF7CKaas7t8dvNvDp1Y194hi64cqe+cNwZlR5ng==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_4qcp7qp4jxxdgb4qbxgwox4hwq fancy-test: 2.0.31 @@ -2894,9 +2869,8 @@ packages: dev: true /@oclif/test/2.3.31_npeoqfxwgl5njwqojmpesqhar4: - resolution: - { integrity: sha512-dTWCni+Zv9aSuzyamS95+GJaIub6EAI+CT+pA1MP10RZF54mF7CKaas7t8dvNvDp1Y194hi64cqe+cNwZlR5ng== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-dTWCni+Zv9aSuzyamS95+GJaIub6EAI+CT+pA1MP10RZF54mF7CKaas7t8dvNvDp1Y194hi64cqe+cNwZlR5ng==} + engines: {node: '>=12.0.0'} dependencies: '@oclif/core': 2.9.4_npeoqfxwgl5njwqojmpesqhar4 fancy-test: 2.0.31 @@ -3041,23 +3015,20 @@ packages: dev: false /@sigstore/bundle/1.0.0: - resolution: - { integrity: sha512-yLvrWDOh6uMOUlFCTJIZEnwOT9Xte7NPXUqVexEKGSF5XtBAuSg5du0kn3dRR0p47a4ah10Y0mNt8+uyeQXrBQ== } - engines: { node: ^14.17.0 || ^16.13.0 || >=18.0.0 } + resolution: {integrity: sha512-yLvrWDOh6uMOUlFCTJIZEnwOT9Xte7NPXUqVexEKGSF5XtBAuSg5du0kn3dRR0p47a4ah10Y0mNt8+uyeQXrBQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: '@sigstore/protobuf-specs': 0.2.0 dev: true /@sigstore/protobuf-specs/0.2.0: - resolution: - { integrity: sha512-8ZhZKAVfXjIspDWwm3D3Kvj0ddbJ0HqDZ/pOs5cx88HpT8mVsotFrg7H1UMnXOuDHz6Zykwxn4mxG3QLuN+RUg== } - engines: { node: ^14.17.0 || ^16.13.0 || >=18.0.0 } + resolution: {integrity: sha512-8ZhZKAVfXjIspDWwm3D3Kvj0ddbJ0HqDZ/pOs5cx88HpT8mVsotFrg7H1UMnXOuDHz6Zykwxn4mxG3QLuN+RUg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dev: true /@sigstore/tuf/1.0.3: - resolution: - { integrity: sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg== } - engines: { node: ^14.17.0 || ^16.13.0 || >=18.0.0 } + resolution: {integrity: sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dependencies: '@sigstore/protobuf-specs': 0.2.0 tuf-js: 1.1.7 @@ -4214,9 +4185,8 @@ packages: dev: true /aws-sdk/2.1418.0: - resolution: - { integrity: sha512-6WDMJQAWKwVt+44+61c/SAXKpUSwToqBMeaqizhEe3GN8TWfxMc9RfCnsYIIwS+L+5hedmKC5oc6Fg2ujs8KUQ== } - engines: { node: '>= 10.0.0' } + resolution: {integrity: sha512-6WDMJQAWKwVt+44+61c/SAXKpUSwToqBMeaqizhEe3GN8TWfxMc9RfCnsYIIwS+L+5hedmKC5oc6Fg2ujs8KUQ==} + engines: {node: '>= 10.0.0'} dependencies: buffer: 4.9.2 events: 1.1.1 @@ -4687,8 +4657,7 @@ packages: dev: true /caniuse-lite/1.0.30001517: - resolution: - { integrity: sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA== } + resolution: {integrity: sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==} dev: true /cardinal/2.1.1: @@ -5493,8 +5462,7 @@ packages: jake: 10.8.7 /electron-to-chromium/1.4.466: - resolution: - { integrity: sha512-TSkRvbXRXD8BwhcGlZXDsbI2lRoP8dvqR7LQnqQNk9KxXBc4tG8O+rTuXgTyIpEdiqSGKEBSqrxdqEntnjNncA== } + resolution: {integrity: sha512-TSkRvbXRXD8BwhcGlZXDsbI2lRoP8dvqR7LQnqQNk9KxXBc4tG8O+rTuXgTyIpEdiqSGKEBSqrxdqEntnjNncA==} dev: true /elegant-spinner/1.0.1: @@ -6344,9 +6312,8 @@ packages: - supports-color /fancy-test/2.0.31: - resolution: - { integrity: sha512-Ok4L7GuoVdOBKtwlHdSnBYDBSFeWazcr6+/lhcC0LWS+sJYOXgbyCPP54fTt2TM1T8QWUm4ULHKQGOHKS61pfg== } - engines: { node: '>=12.0.0' } + resolution: {integrity: sha512-Ok4L7GuoVdOBKtwlHdSnBYDBSFeWazcr6+/lhcC0LWS+sJYOXgbyCPP54fTt2TM1T8QWUm4ULHKQGOHKS61pfg==} + engines: {node: '>=12.0.0'} dependencies: '@types/chai': 4.3.5 '@types/lodash': 4.14.195 @@ -10425,9 +10392,8 @@ packages: dev: true /pnpm/7.33.5: - resolution: - { integrity: sha512-TkmfIv/+WEWqj5Rj4ThrLXLDE04OvvlAk2CthE/vApDoK0ebMusuwPMOVmB+GCDCIWeCn9YmVtQaj9DMSg9CZw== } - engines: { node: '>=14.6' } + resolution: {integrity: sha512-TkmfIv/+WEWqj5Rj4ThrLXLDE04OvvlAk2CthE/vApDoK0ebMusuwPMOVmB+GCDCIWeCn9YmVtQaj9DMSg9CZw==} + engines: {node: '>=14.6'} hasBin: true dev: true @@ -11200,9 +11166,8 @@ packages: dev: true /sigstore/1.8.0: - resolution: - { integrity: sha512-ogU8qtQ3VFBawRJ8wjsBEX/vIFeHuGs1fm4jZtjWQwjo8pfAt7T/rh+udlAN4+QUe0IzA8qRSc/YZ7dHP6kh+w== } - engines: { node: ^14.17.0 || ^16.13.0 || >=18.0.0 } + resolution: {integrity: sha512-ogU8qtQ3VFBawRJ8wjsBEX/vIFeHuGs1fm4jZtjWQwjo8pfAt7T/rh+udlAN4+QUe0IzA8qRSc/YZ7dHP6kh+w==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} hasBin: true dependencies: '@sigstore/bundle': 1.0.0 @@ -12342,8 +12307,7 @@ packages: dev: false /whatwg-fetch/3.6.16: - resolution: - { integrity: sha512-83avoGbZ0qtjtNrU3UTT3/Xd3uZ7DyfSYLuc1fL5iYs+93P+UkIVF6/6xpRVWeQcvbc7kSnVybSAVbd6QFW5Fg== } + resolution: {integrity: sha512-83avoGbZ0qtjtNrU3UTT3/Xd3uZ7DyfSYLuc1fL5iYs+93P+UkIVF6/6xpRVWeQcvbc7kSnVybSAVbd6QFW5Fg==} dev: false /whatwg-mimetype/3.0.0: From 25b854f39992b516275c2d411e7bc85e4fae508c Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Wed, 9 Aug 2023 18:50:41 +0530 Subject: [PATCH 14/52] fix: added prepack sections for export and import commands --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 962a304c9b..2c4c326084 100755 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -102,6 +102,10 @@ jobs: if: ${{ env.release_releaseAll == 'true' || env.release_plugins_export == 'true'}} working-directory: ./packages/contentstack-export run: npm install + - name: Compiling export + if: ${{ steps.export-installation.conclusion == 'success' }} + working-directory: ./packages/contentstack-export + run: npm run prepack - name: Publishing export uses: JS-DevTools/npm-publish@v1 if: ${{ steps.export-installation.conclusion == 'success' }} @@ -113,6 +117,10 @@ jobs: if: ${{env.release_releaseAll == 'true' || env.release_plugins_import == 'true'}} working-directory: ./packages/contentstack-import run: npm install + - name: Compiling import + if: ${{ steps.import-installation.conclusion == 'success' }} + working-directory: ./packages/contentstack-import + run: npm run prepack - name: Publishing import uses: JS-DevTools/npm-publish@v1 if: ${{ steps.import-installation.conclusion == 'success' }} From a21d355f65dc0fcd7699632d257bfbdd92bc2e95 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Thu, 27 Jul 2023 14:51:30 +0530 Subject: [PATCH 15/52] entries export --- .../contentstack-export/src/config/index.ts | 2 + .../src/export/modules-js/entries.js | 22 +- .../src/export/modules/base-class.ts | 3 + .../src/export/modules/entries.ts | 233 ++++++++++++++++++ .../src/types/default-config.ts | 1 + .../src/import/modules/base-class.ts | 10 +- 6 files changed, 265 insertions(+), 6 deletions(-) create mode 100644 packages/contentstack-export/src/export/modules/entries.ts diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index c25532d772..2ebb905edb 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -137,6 +137,7 @@ const config: DefaultConfig = { // total no of entries fetched in each content type in a single call limit: 100, dependencies: ['locales', 'content-types'], + exportVersions: true, }, extensions: { dirName: 'extensions', @@ -378,6 +379,7 @@ const config: DefaultConfig = { 'custom-roles', 'global-fields', 'content-types', + 'entries', ], apis: { userSession: '/user-session/', diff --git a/packages/contentstack-export/src/export/modules-js/entries.js b/packages/contentstack-export/src/export/modules-js/entries.js index ae6a402e38..c9be167646 100644 --- a/packages/contentstack-export/src/export/modules-js/entries.js +++ b/packages/contentstack-export/src/export/modules-js/entries.js @@ -1,5 +1,6 @@ const path = require('path'); const chalk = require('chalk'); +const { values } = require('lodash'); const { executeTask, formatError, fileHelper, log } = require('../../utils'); class EntriesExport { @@ -59,7 +60,7 @@ class EntriesExport { `Started export versioned entries of type '${requestOption.content_type}' locale '${requestOption.locale}'`, 'info', ); - for (let entry of entries) { + for (let entry of values(entries)) { const versionedEntries = await this.getEntryByVersion( { ...requestOption, @@ -193,6 +194,25 @@ class EntriesExport { }); return entriesList; } + + async getEntryByVersion(requestOptions, version, entries = []) { + const queryRequestObject = { + locale: requestOptions.locale, + except: { + BASE: this.entriesConfig.invalidKeys, + }, + version, + }; + const entryResponse = await this.stackAPIClient + .contentType(requestOptions.content_type) + .entry(requestOptions.uid) + .fetch(queryRequestObject); + entries.push(entryResponse); + if (--version > 0) { + return await this.getEntryByVersion(requestOptions, version, entries); + } + return entries; + } } module.exports = EntriesExport; diff --git a/packages/contentstack-export/src/export/modules/base-class.ts b/packages/contentstack-export/src/export/modules/base-class.ts index 7fffb256bc..90cb015942 100644 --- a/packages/contentstack-export/src/export/modules/base-class.ts +++ b/packages/contentstack-export/src/export/modules/base-class.ts @@ -30,6 +30,7 @@ export type EnvType = { export type CustomPromiseHandlerInput = { index: number; batchIndex: number; + element?: Record; apiParams?: ApiOptions; isLastRequest: boolean; }; @@ -45,6 +46,7 @@ export type ApiModuleType = | 'content-type' | 'content-types' | 'stacks' + | 'versioned-entries' | 'download-asset'; export default abstract class BaseClass { @@ -98,6 +100,7 @@ export default abstract class BaseClass { if (promisifyHandler instanceof Function) { promise = promisifyHandler({ apiParams, + element, isLastRequest, index: Number(index), batchIndex: Number(batchIndex), diff --git a/packages/contentstack-export/src/export/modules/entries.ts b/packages/contentstack-export/src/export/modules/entries.ts new file mode 100644 index 0000000000..15557cbbdd --- /dev/null +++ b/packages/contentstack-export/src/export/modules/entries.ts @@ -0,0 +1,233 @@ +import * as path from 'path'; +import { ContentstackClient, FsUtility } from '@contentstack/cli-utilities'; +import { log, formatError, fsUtil } from '../../utils'; +import { ExportConfig, ModuleClassParams } from '../../types'; +import BaseClass, { ApiOptions } from './base-class'; + +export default class EntriesExport extends BaseClass { + private stackAPIClient: ReturnType; + public exportConfig: ExportConfig; + private entriesConfig: { + dirName?: string; + fileName?: string; + invalidKeys?: string[]; + fetchConcurrency?: number; + writeConcurrency?: number; + limit?: number; + chunkFileSize?: number; + batchLimit?: number; + exportVersions: boolean; + }; + private entriesDirPath: string; + private localesFilePath: string; + private schemaFilePath: string; + private entriesFileHelper: FsUtility; + + constructor({ exportConfig, stackAPIClient }: ModuleClassParams) { + super({ exportConfig, stackAPIClient }); + this.stackAPIClient = stackAPIClient; + this.exportConfig = exportConfig; + this.entriesConfig = exportConfig.modules.entries; + this.entriesDirPath = path.resolve(exportConfig.data, exportConfig.branchName || '', this.entriesConfig.dirName); + this.localesFilePath = path.resolve( + exportConfig.data, + exportConfig.branchName || '', + exportConfig.modules.locales.dirName, + exportConfig.modules.locales.fileName, + ); + this.schemaFilePath = path.resolve( + exportConfig.data, + exportConfig.branchName || '', + exportConfig.modules.content_types.dirName, + 'schema.json', + ); + } + + async start() { + try { + log(this.exportConfig, 'Starting entries export', 'info'); + const locales = fsUtil.readFile(this.localesFilePath) as Array>; + const contentTypes = fsUtil.readFile(this.schemaFilePath) as Array>; + if (contentTypes.length === 0) { + log(this.exportConfig, 'No content types found to export entries', 'info'); + return; + } + const entryRequestOptions = this.createRequestObjects(locales, contentTypes); + for (let entryRequestOption of entryRequestOptions) { + log( + this.exportConfig, + `Starting export of entries of contenttype - ${entryRequestOption.contentType} locale - ${entryRequestOption.locale}`, + 'info', + ); + await this.getEntries(entryRequestOption); + this.entriesFileHelper?.completeFile(true); + log( + this.exportConfig, + `Exported entries of type '${entryRequestOption.contentType}' locale '${entryRequestOption.locale}'`, + 'success', + ); + } + log(this.exportConfig, 'Entries exported successfully', 'success'); + } catch (error) { + log(this.exportConfig, `Failed to export entries ${formatError(error)}`, 'error'); + throw new Error('Failed to export entries'); + } + } + + createRequestObjects( + locales: Array>, + contentTypes: Array>, + ): Array> { + let requestObjects: Array> = []; + contentTypes.forEach((contentType) => { + if (Object.keys(locales).length !== 0) { + for (let locale in locales) { + requestObjects.push({ + contentType: contentType.uid, + locale: locales[locale].code, + }); + } + } + requestObjects.push({ + contentType: contentType.uid, + locale: this.exportConfig.master_locale.code, + }); + }); + + return requestObjects; + } + + async getEntries(options: Record): Promise { + options.skip = options.skip || 0; + let requestObject = { + locale: options.locale, + skip: options.skip, + limit: this.entriesConfig.limit, + include_count: true, + include_publish_details: true, + query: { + locale: options.locale, + }, + }; + + const entriesSearchResponse = await this.stackAPIClient + .contentType(options.contentType) + .entry() + .query(requestObject) + .find(); + + if (Array.isArray(entriesSearchResponse.items) && entriesSearchResponse.items.length > 0) { + if (options.skip === 0) { + const entryBasePath = path.join(this.entriesDirPath, options.contentType, options.locale); + await fsUtil.makeDirectory(entryBasePath); + this.entriesFileHelper = new FsUtility({ + moduleName: 'entries', + indexFileName: 'index.json', + basePath: entryBasePath, + chunkFileSize: this.entriesConfig.chunkFileSize, + keepMetadata: false, + omitKeys: this.entriesConfig.invalidKeys, + }); + } + this.entriesFileHelper.writeIntoFile(entriesSearchResponse.items, { mapKeyVal: true }); + if (this.entriesConfig.exportVersions) { + let versionedEntryPath = path.join(this.entriesDirPath, options.contentType, options.locale, 'versions'); + fsUtil.makeDirectory(versionedEntryPath); + await this.fetchEntriesVersions(entriesSearchResponse.items, { + locale: options.locale, + contentType: options.contentType, + versionedEntryPath, + }); + } + options.skip += this.entriesConfig.limit || 100; + if (options.skip >= entriesSearchResponse.count) { + return Promise.resolve(true); + } + return await this.getEntries(options); + } + } + + async fetchEntriesVersions( + entries: any, + options: { locale: string; contentType: string; versionedEntryPath: string }, + ): Promise { + const onSuccess = ({ response, apiData: entry }: any) => { + fsUtil.writeFile(path.join(options.versionedEntryPath, `${entry.uid}.json`), response); + log( + this.exportConfig, + `Exported versioned entries of type '${options.contentType}' locale '${options.locale}'`, + 'success', + ); + }; + const onReject = ({ error, apiData: { uid } = undefined }: any) => { + log(this.exportConfig, `failed to export versions of entry ${uid}`, 'error'); + log(this.exportConfig, formatError(error), 'error'); + }; + + return await this.makeConcurrentCall( + { + apiBatches: [entries], + module: 'versioned-entries', + totalCount: entries.length, + concurrencyLimit: this.entriesConfig.batchLimit, + apiParams: { + module: 'versioned-entries', + queryParam: options, + resolve: onSuccess, + reject: onReject, + }, + }, + this.entryVersionHandler.bind(this), + ); + } + + async entryVersionHandler({ + apiParams, + element: entry, + }: { + apiParams: ApiOptions; + element: Record; + isLastRequest: boolean; + }) { + return new Promise(async (resolve, reject) => { + return await this.getEntryByVersion(apiParams.queryParam, entry) + .then((response) => { + apiParams.resolve({ + response, + apiData: entry, + }); + resolve(true); + }) + .catch((error) => { + apiParams.reject({ + error, + apiData: entry, + }); + reject(true); + }); + }); + } + + async getEntryByVersion( + options: any, + entry: Record, + entries: Array> = [], + ): Promise { + const queryRequestObject = { + locale: options.locale, + except: { + BASE: this.entriesConfig.invalidKeys, + }, + version: entry._version, + }; + const entryResponse = await this.stackAPIClient + .contentType(options.contentType) + .entry(entry.uid) + .fetch(queryRequestObject); + entries.push(entryResponse); + if (--entry._version > 0) { + return await this.getEntryByVersion(options, entry, entries); + } + return entries; + } +} diff --git a/packages/contentstack-export/src/types/default-config.ts b/packages/contentstack-export/src/types/default-config.ts index 56187de12f..918786bdac 100644 --- a/packages/contentstack-export/src/types/default-config.ts +++ b/packages/contentstack-export/src/types/default-config.ts @@ -113,6 +113,7 @@ export default interface DefaultConfig { // total no of entries fetched in each content type in a single call limit: number; dependencies?: Modules[]; + exportVersions: boolean; }; extensions: { dirName: string; diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index 1ce3b2eb50..d7e303f235 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -299,11 +299,11 @@ export default abstract class BaseClass { case 'update-gfs': return apiData.update().then(onSuccess).catch(onReject); case 'create-environments': - // return this.stack - // .environment() - // .create({ environment: omit(apiData, ['uid']) as EnvironmentData }) - // .then(onSuccess) - // .catch(onReject); + // return this.stack + // .environment() + // .create({ environment: omit(apiData, ['uid']) as EnvironmentData }) + // .then(onSuccess) + // .catch(onReject); case 'create-labels': return this.stack .label() From 8eebaa7cea79aed188532dfafc5948ea4b8a3fc6 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Wed, 26 Jul 2023 14:01:46 +0530 Subject: [PATCH 16/52] fix: backup dir flag issue --- packages/contentstack-import/src/utils/backup-handler.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-import/src/utils/backup-handler.ts b/packages/contentstack-import/src/utils/backup-handler.ts index 47ca3fbe18..581ad8db26 100755 --- a/packages/contentstack-import/src/utils/backup-handler.ts +++ b/packages/contentstack-import/src/utils/backup-handler.ts @@ -1,13 +1,17 @@ import * as path from 'path'; import ncp from 'ncp'; + import { ImportConfig } from '../types'; +import { fileHelper } from './index'; export default function setupBackupDir(importConfig: ImportConfig): Promise { return new Promise(async (resolve, reject) => { - if (importConfig.hasOwnProperty('useBackedupDir')) { + if (fileHelper.fileExistsSync(importConfig.useBackedupDir)) { return resolve(importConfig.useBackedupDir); } - const backupDirPath = path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); + + const backupDirPath = + importConfig?.useBackedupDir || path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); const limit = importConfig.backupConcurrency || 16; if (path.isAbsolute(importConfig.contentDir)) { return ncp(importConfig.contentDir, backupDirPath, { limit }, (error) => { From cffebdca152a596f0855d5b490409b3cb91ead7c Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Wed, 26 Jul 2023 14:05:11 +0530 Subject: [PATCH 17/52] revert: backup dir changes --- packages/contentstack-import/src/utils/backup-handler.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/contentstack-import/src/utils/backup-handler.ts b/packages/contentstack-import/src/utils/backup-handler.ts index 581ad8db26..47ca3fbe18 100755 --- a/packages/contentstack-import/src/utils/backup-handler.ts +++ b/packages/contentstack-import/src/utils/backup-handler.ts @@ -1,17 +1,13 @@ import * as path from 'path'; import ncp from 'ncp'; - import { ImportConfig } from '../types'; -import { fileHelper } from './index'; export default function setupBackupDir(importConfig: ImportConfig): Promise { return new Promise(async (resolve, reject) => { - if (fileHelper.fileExistsSync(importConfig.useBackedupDir)) { + if (importConfig.hasOwnProperty('useBackedupDir')) { return resolve(importConfig.useBackedupDir); } - - const backupDirPath = - importConfig?.useBackedupDir || path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); + const backupDirPath = path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); const limit = importConfig.backupConcurrency || 16; if (path.isAbsolute(importConfig.contentDir)) { return ncp(importConfig.contentDir, backupDirPath, { limit }, (error) => { From a2ac03b86d83cea62d721fde751647ca5e6995d7 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Wed, 26 Jul 2023 16:07:55 +0530 Subject: [PATCH 18/52] fix: backup-dir import command --- packages/contentstack-import/src/utils/backup-handler.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-import/src/utils/backup-handler.ts b/packages/contentstack-import/src/utils/backup-handler.ts index 47ca3fbe18..c909705e18 100755 --- a/packages/contentstack-import/src/utils/backup-handler.ts +++ b/packages/contentstack-import/src/utils/backup-handler.ts @@ -1,13 +1,17 @@ import * as path from 'path'; import ncp from 'ncp'; + import { ImportConfig } from '../types'; +import { fileHelper } from './index'; export default function setupBackupDir(importConfig: ImportConfig): Promise { return new Promise(async (resolve, reject) => { - if (importConfig.hasOwnProperty('useBackedupDir')) { + if (fileHelper.fileExistsSync(importConfig.useBackedupDir)) { return resolve(importConfig.useBackedupDir); } - const backupDirPath = path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); + + const backupDirPath = + importConfig?.useBackedupDir || path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); const limit = importConfig.backupConcurrency || 16; if (path.isAbsolute(importConfig.contentDir)) { return ncp(importConfig.contentDir, backupDirPath, { limit }, (error) => { From 342983df640ce5b29bdc6f3d5c0f68b7e62b4310 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Wed, 26 Jul 2023 16:08:45 +0530 Subject: [PATCH 19/52] enable new file structure export & import --- packages/contentstack-export/src/config/index.ts | 2 +- packages/contentstack-import/src/config/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index 2ebb905edb..00ab77a641 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -400,7 +400,7 @@ const config: DefaultConfig = { writeConcurrency: 5, developerHubBaseUrl: '', marketplaceAppEncryptionKey: 'nF2ejRQcTv', - useNewModuleStructure: false, + useNewModuleStructure: true, }; export default config; diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 6fa1596759..8915665086 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -388,7 +388,7 @@ const config: DefaultConfig = { developerHubBaseUrl: '', marketplaceAppEncryptionKey: 'nF2ejRQcTv', getEncryptionKeyMaxRetry: 3, - useNewModuleStructure: false, + useNewModuleStructure: true, // useBackedupDir: '', // backupConcurrency: 10, }; From f82e741f9936589090b1117a4f47d9fbd4aaf4f0 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Thu, 27 Jul 2023 11:56:04 +0530 Subject: [PATCH 20/52] fix: create backup directory using config --- .../example_config/auth_config.json | 3 ++- packages/contentstack-import/src/config/index.ts | 1 + .../contentstack-import/src/types/default-config.ts | 1 + .../contentstack-import/src/utils/backup-handler.ts | 13 ++++++++++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/contentstack-import/example_config/auth_config.json b/packages/contentstack-import/example_config/auth_config.json index 8a595ff0d3..b638c36c32 100644 --- a/packages/contentstack-import/example_config/auth_config.json +++ b/packages/contentstack-import/example_config/auth_config.json @@ -12,5 +12,6 @@ "fetchConcurrency": 5, "writeConcurrency": 5, "securedAssets":false, - "developerHubBaseUrl": "" + "developerHubBaseUrl": "", + "createBackupDirPath": "./temp" } diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 8915665086..e65cad55e1 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -389,6 +389,7 @@ const config: DefaultConfig = { marketplaceAppEncryptionKey: 'nF2ejRQcTv', getEncryptionKeyMaxRetry: 3, useNewModuleStructure: true, + createBackupDir: './temp' // useBackedupDir: '', // backupConcurrency: 10, }; diff --git a/packages/contentstack-import/src/types/default-config.ts b/packages/contentstack-import/src/types/default-config.ts index 4c30c98ba9..b833ed90fa 100644 --- a/packages/contentstack-import/src/types/default-config.ts +++ b/packages/contentstack-import/src/types/default-config.ts @@ -141,4 +141,5 @@ export default interface DefaultConfig { marketplaceAppEncryptionKey: string; getEncryptionKeyMaxRetry: number; useNewModuleStructure: boolean; + createBackupDir?: string; } diff --git a/packages/contentstack-import/src/utils/backup-handler.ts b/packages/contentstack-import/src/utils/backup-handler.ts index c909705e18..5a04ca9e15 100755 --- a/packages/contentstack-import/src/utils/backup-handler.ts +++ b/packages/contentstack-import/src/utils/backup-handler.ts @@ -6,12 +6,19 @@ import { fileHelper } from './index'; export default function setupBackupDir(importConfig: ImportConfig): Promise { return new Promise(async (resolve, reject) => { - if (fileHelper.fileExistsSync(importConfig.useBackedupDir)) { + if (importConfig.hasOwnProperty('useBackedupDir')) { return resolve(importConfig.useBackedupDir); } - const backupDirPath = - importConfig?.useBackedupDir || path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); + //NOTE: If the backup folder's directory is provided, create it at that location; otherwise, the default path (working directory). + let backupDirPath = path.join(process.cwd(), '_backup_' + Math.floor(Math.random() * 1000)); + if (importConfig.createBackupDir) { + if (!fileHelper.fileExistsSync(importConfig.createBackupDir)) { + fileHelper.makeDirectory(importConfig.createBackupDir); + } + backupDirPath = importConfig.createBackupDir; + } + const limit = importConfig.backupConcurrency || 16; if (path.isAbsolute(importConfig.contentDir)) { return ncp(importConfig.contentDir, backupDirPath, { limit }, (error) => { From b064791085e3307673bc4640a232a8aa82c107c9 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Thu, 27 Jul 2023 12:21:46 +0530 Subject: [PATCH 21/52] updated example config --- .../contentstack-export/example_config/management_config.json | 3 ++- packages/contentstack-import/example_config/auth_config.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-export/example_config/management_config.json b/packages/contentstack-export/example_config/management_config.json index 23cf19e331..d2dd367007 100644 --- a/packages/contentstack-export/example_config/management_config.json +++ b/packages/contentstack-export/example_config/management_config.json @@ -13,5 +13,6 @@ "locales" ], "useNewModuleStructure": true, - "securedAssets": false + "securedAssets": false, + "createBackupDir": "./temp" } \ No newline at end of file diff --git a/packages/contentstack-import/example_config/auth_config.json b/packages/contentstack-import/example_config/auth_config.json index b638c36c32..fb329ee1f2 100644 --- a/packages/contentstack-import/example_config/auth_config.json +++ b/packages/contentstack-import/example_config/auth_config.json @@ -13,5 +13,5 @@ "writeConcurrency": 5, "securedAssets":false, "developerHubBaseUrl": "", - "createBackupDirPath": "./temp" + "createBackupDir": "./temp" } From e095621e981d4e462ec7bfcb62ee8939e08a792f Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Thu, 27 Jul 2023 12:37:31 +0530 Subject: [PATCH 22/52] refactor: import config --- packages/contentstack-import/src/config/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index e65cad55e1..89da6a35cc 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -388,8 +388,7 @@ const config: DefaultConfig = { developerHubBaseUrl: '', marketplaceAppEncryptionKey: 'nF2ejRQcTv', getEncryptionKeyMaxRetry: 3, - useNewModuleStructure: true, - createBackupDir: './temp' + useNewModuleStructure: true // useBackedupDir: '', // backupConcurrency: 10, }; From ea06b06a558a1af68506d8141653e5d2b1921dac Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Wed, 2 Aug 2023 17:29:13 +0530 Subject: [PATCH 23/52] entries import --- packages/contentstack-export/package.json | 4 +- .../contentstack-export/src/config/index.ts | 2 +- .../src/export/modules/entries.ts | 2 +- packages/contentstack-export/tsconfig.json | 2 +- packages/contentstack-import/package.json | 8 +- .../contentstack-import/src/config/index.ts | 2 +- .../src/import/modules/base-class.ts | 16 +- .../src/import/modules/entries.ts | 311 ++++++++++++++++++ .../src/utils/asset-helper.ts | 10 +- .../src/utils/entries-helper.ts | 182 ++++++++++ .../contentstack-import/src/utils/index.ts | 4 +- packages/contentstack-import/tsconfig.json | 2 +- 12 files changed, 524 insertions(+), 21 deletions(-) create mode 100644 packages/contentstack-import/src/import/modules/entries.ts diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index e9a1149102..bfd320b7ee 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -80,9 +80,9 @@ "plugin" ], "license": "MIT", - "main": "./lib/commands/cm/stacks/export.js", + "main": "./src/commands/cm/stacks/export.js", "oclif": { - "commands": "./lib/commands", + "commands": "./src/commands", "bin": "csdx", "devPlugins": [ "@oclif/plugin-help" diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index 00ab77a641..b35863519d 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -137,7 +137,7 @@ const config: DefaultConfig = { // total no of entries fetched in each content type in a single call limit: 100, dependencies: ['locales', 'content-types'], - exportVersions: true, + exportVersions: false, }, extensions: { dirName: 'extensions', diff --git a/packages/contentstack-export/src/export/modules/entries.ts b/packages/contentstack-export/src/export/modules/entries.ts index 15557cbbdd..f795cee78c 100644 --- a/packages/contentstack-export/src/export/modules/entries.ts +++ b/packages/contentstack-export/src/export/modules/entries.ts @@ -56,7 +56,7 @@ export default class EntriesExport extends BaseClass { for (let entryRequestOption of entryRequestOptions) { log( this.exportConfig, - `Starting export of entries of contenttype - ${entryRequestOption.contentType} locale - ${entryRequestOption.locale}`, + `Starting export of entries of content type - ${entryRequestOption.contentType} locale - ${entryRequestOption.locale}`, 'info', ); await this.getEntries(entryRequestOption); diff --git a/packages/contentstack-export/tsconfig.json b/packages/contentstack-export/tsconfig.json index 5136623392..da8fc4b724 100644 --- a/packages/contentstack-export/tsconfig.json +++ b/packages/contentstack-export/tsconfig.json @@ -12,7 +12,7 @@ "skipLibCheck": true, "sourceMap": false, "esModuleInterop": true, - "noImplicitAny": true, + "noImplicitAny": false, "lib": [ "ES2019", "es2020.promise" diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 9b4b6bde71..b671eeefa0 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -7,7 +7,7 @@ "dependencies": { "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/management": "~1.10.0", + "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", "big-json": "^3.2.0", @@ -79,10 +79,10 @@ "cli", "plugin" ], - "main": "./lib/commands/cm/stacks/import.js", + "main": "./src/commands/cm/stacks/import.js", "license": "MIT", "oclif": { - "commands": "./lib/commands", + "commands": "./src/commands", "bin": "csdx", "repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-import/<%- commandPath %>" }, @@ -96,4 +96,4 @@ } }, "repository": "https://github.com/contentstack/cli" -} +} \ No newline at end of file diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 89da6a35cc..8915665086 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -388,7 +388,7 @@ const config: DefaultConfig = { developerHubBaseUrl: '', marketplaceAppEncryptionKey: 'nF2ejRQcTv', getEncryptionKeyMaxRetry: 3, - useNewModuleStructure: true + useNewModuleStructure: true, // useBackedupDir: '', // backupConcurrency: 10, }; diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index d7e303f235..374e79c5a5 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -43,7 +43,8 @@ export type ApiModuleType = | 'update-labels' | 'create-webhooks' | 'create-workflows' - | 'create-custom-role'; + | 'create-custom-role' + | 'create-entries'; export type ApiOptions = { uid?: string; @@ -231,7 +232,7 @@ export default abstract class BaseClass { apiOptions = apiOptions.serializeData(apiOptions); } - const { uid, entity, reject, resolve, apiData, additionalInfo, includeParamOnCompletion } = apiOptions; + const { uid, entity, reject, resolve, apiData, additionalInfo = {}, includeParamOnCompletion } = apiOptions; const onSuccess = (response: any) => resolve({ @@ -295,6 +296,9 @@ export default abstract class BaseClass { case 'create-cts': return this.stack.contentType().create(apiData).then(onSuccess).catch(onReject); case 'update-cts': + if (additionalInfo.skip) { + return Promise.resolve(onSuccess(apiData)); + } return apiData.update().then(onSuccess).catch(onReject); case 'update-gfs': return apiData.update().then(onSuccess).catch(onReject); @@ -337,7 +341,13 @@ export default abstract class BaseClass { .create({ role: apiData as RoleData }) .then(onSuccess) .catch(onReject); - + case 'create-entries': + return this.stack + .contentType(additionalInfo.ctUid) + .entry() + .create({ entry: apiData }) + .then(onSuccess) + .catch(onReject); default: return Promise.resolve(); } diff --git a/packages/contentstack-import/src/import/modules/entries.ts b/packages/contentstack-import/src/import/modules/entries.ts new file mode 100644 index 0000000000..7bed6a68c1 --- /dev/null +++ b/packages/contentstack-import/src/import/modules/entries.ts @@ -0,0 +1,311 @@ +/* eslint-disable no-prototype-builtins */ +/*! + * Contentstack Import + * Copyright (c) 2019 Contentstack LLC + * MIT Licensed + */ + +import * as path from 'path'; +import { isEmpty, values, cloneDeep } from 'lodash'; +import { FsUtility } from '@contentstack/cli-utilities'; +import { + fsUtil, + log, + formatError, + lookupExtension, + suppressSchemaReference, + removeUidsFromJsonRteFields, + removeEntryRefsFromJSONRTE, + lookupAssets, +} from '../../utils'; +import { ModuleClassParams } from '../../types'; +import BaseClass, { ApiOptions } from './base-class'; + +export default class EntriesImport extends BaseClass { + private assetUidMapperPath: string; + private assetUidMapper: Record; + private assetUrlMapper: Record; + private assetUrlMapperPath: string; + private entriesMapperPath: string; + private envPath: string; + private entriesUIDMapperPath: string; + private uniqueUidMapperPath: string; + private modifiedCTsPath: string; + private marketplaceAppMapperPath: string; + private entriesConfig: Record; + private cTsPath: string; + private localesPath: string; + private importConcurrency: number; + private entriesPath: string; + private cTs: Record[]; + private modifiedCTs: Record[]; + private refCTs: Record; + private jsonRteCTs: Record; + private jsonRteCTsWithRef: Record; + private jsonRteEntries: Record; + private installedExtensions: Record[]; + private createdEntries: Record[]; + private failedEntries: Record[]; + private locales: Record[]; + private entriesUidMapper: Record; + + constructor({ importConfig, stackAPIClient }: ModuleClassParams) { + super({ importConfig, stackAPIClient }); + this.assetUidMapperPath = path.resolve(importConfig.data, 'mapper', 'assets', 'uid-mapping.json'); + this.assetUrlMapperPath = path.resolve(importConfig.data, 'mapper', 'assets', 'url-mapping.json'); + this.entriesMapperPath = path.resolve(importConfig.data, 'mapper', 'entries'); + this.envPath = path.resolve(importConfig.data, 'environments', 'environments.json'); + this.entriesUIDMapperPath = path.join(this.entriesMapperPath, 'uid-mapping.json'); + this.uniqueUidMapperPath = path.join(this.entriesMapperPath, 'unique-mapping.json'); + this.modifiedCTsPath = path.join(this.entriesMapperPath, 'modified-schemas.json'); + this.marketplaceAppMapperPath = path.join(this.importConfig.data, 'mapper', 'marketplace_apps', 'uid-mapping.json'); + // this.createdEntriesWOUidPath = path.join(this.entryMapperPath, 'created-entries-wo-uid.json'); + // this.failedWOPath = path.join(this.entryMapperPath, 'failedWO.json'); + this.entriesConfig = importConfig.modules.entries; + this.entriesPath = path.resolve(importConfig.data, this.entriesConfig.dirName); + this.cTsPath = path.resolve(importConfig.data, importConfig.modules['content-types'].dirName); + this.localesPath = path.resolve( + importConfig.data, + importConfig.modules.locales.dirName, + importConfig.modules.locales.fileName, + ); + this.importConcurrency = this.entriesConfig.importConcurrency || importConfig.importConcurrency; + this.entriesUidMapper = {}; + } + + async start(): Promise { + try { + /** + * Read CTS + * Suppress CTS + * Read locales + * Create request objs + * create entries + * update entries + */ + + this.cTs = fsUtil.readFile(path.join(this.cTsPath, 'schema.json')) as Record[]; + if (!this.cTs || isEmpty(this.cTs)) { + log(this.importConfig, 'No content type found', 'info'); + return; + } + this.installedExtensions = ( + ((await fsUtil.readFile(this.marketplaceAppMapperPath)) as any) || { extension_uid: {} } + ).extension_uid; + + this.assetUidMapper = (fsUtil.readFile(this.assetUidMapperPath) as Record) || {}; + this.assetUrlMapper = (fsUtil.readFile(this.assetUrlMapperPath) as Record) || {}; + + await this.disableMandatoryCTReferences(); + fsUtil.makeDirectory(this.entriesMapperPath); + this.locales = fsUtil.readFile(this.localesPath) as Record[]; + const entryRequestOptions = this.populateEntryCreatePayload(); + for (let entryRequestOption of entryRequestOptions) { + log( + this.importConfig, + `Starting to create entries for ${entryRequestOption.cTUid} in locale ${entryRequestOption.locale}`, + 'info', + ); + await this.createEntries(entryRequestOption); + } + log(this.importConfig, 'Entries created successfully', 'info'); + } catch (error) { + log(this.importConfig, formatError(error), 'error'); + throw new Error('Error while importing entries'); + } + } + + async disableMandatoryCTReferences() { + const onSuccess = ({ response: contentType, apiData: { uid } }: any) => { + log(this.importConfig, `${uid} content type references removed temporarily`, 'success'); + }; + const onReject = ({ error, apiData: { uid } }: any) => { + log(this.importConfig, formatError(error), 'error'); + throw new Error(`${uid} content type references removal failed`); + }; + return await this.makeConcurrentCall({ + processName: 'Update content types (removing mandatory references temporarily)', + apiContent: this.cTs, + apiParams: { + serializeData: this.serializeUpdateCTs.bind(this), + reject: onReject.bind(this), + resolve: onSuccess.bind(this), + entity: 'update-cts', + includeParamOnCompletion: true, + }, + concurrencyLimit: this.importConcurrency, + }).then(() => { + fsUtil.writeFile(this.modifiedCTsPath, this.modifiedCTs); + }); + } + + /** + * @method serializeUpdateCTs + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializeUpdateCTs(apiOptions: ApiOptions): ApiOptions { + const { apiData: contentType } = apiOptions; + if (contentType.field_rules) { + delete contentType.field_rules; + } + const flag = { + suppressed: false, + references: false, + jsonRte: false, + jsonRteEmbeddedEntries: false, + }; + suppressSchemaReference(contentType.schema, flag); + // Check if suppress modified flag + if (flag.suppressed) { + this.modifiedCTs.push(this.cTs[contentType.uid]); + } else { + // Note: Skips the content type from update if no reference found + apiOptions.additionalInfo = { skip: true }; + return apiOptions; + } + + if (flag.references) { + this.refCTs.push(contentType.uid); + } + + if (flag.jsonRte) { + this.jsonRteCTs.push(contentType.uid); + if (flag.jsonRteEmbeddedEntries) { + this.jsonRteCTsWithRef.push(contentType.uid); + if (this.refCTs.indexOf(contentType.uid) === -1) { + this.refCTs.push(contentType.uid); + } + } + } + lookupExtension( + this.importConfig, + contentType.schema, + this.importConfig.preserveStackVersion, + this.installedExtensions, + ); + const contentTypePayload = this.stack.contentType(contentType.uid); + Object.assign(contentTypePayload, cloneDeep(contentType)); + apiOptions.apiData = contentTypePayload; + return apiOptions; + } + + populateEntryCreatePayload(): { cTUid: string; locale: string }[] { + const requestObjects: { cTUid: string; locale: string }[] = []; + this.cTs.forEach((contentType) => { + for (let locale in this.locales) { + requestObjects.push({ + cTUid: contentType.uid, + locale: this.locales[locale].code, + }); + } + requestObjects.push({ + cTUid: contentType.uid, + locale: this.importConfig.master_locale.code, + }); + }); + + return requestObjects; + } + + async createEntries({ cTUid, locale }: { cTUid: string; locale: string }): Promise { + const processName = 'Create Entries'; + const indexFileName = 'index.json'; + const basePath = path.join(this.entriesPath, cTUid, locale); + const fs = new FsUtility({ basePath, indexFileName }); + const indexer = fs.indexFileContent; + const indexerCount = values(indexer).length; + // Write created entries + const entriesCreateFileHelper = new FsUtility({ + moduleName: 'created-entries', + indexFileName: 'index.json', + basePath: path.join(this.entriesMapperPath, cTUid, locale), + chunkFileSize: this.entriesConfig.chunkFileSize, + keepMetadata: false, + omitKeys: this.entriesConfig.invalidKeys, + }); + + const onSuccess = ({ response, apiData: { uid, url, title } }: any) => { + log(this.importConfig, `Created entry: '${title}' of content type ${cTUid} in locale ${locale}`, 'info'); + this.entriesUidMapper[uid] = response.uid; + entriesCreateFileHelper.writeIntoFile({ [uid]: response } as any, { mapKeyVal: true }); + }; + const onReject = ({ error, apiData: { uid, title } }: any) => { + log(this.importConfig, `${title} entry of content type ${cTUid} in locale ${locale} failed to create`, 'error'); + log(this.importConfig, formatError(error), 'error'); + this.failedEntries.push({ content_type: cTUid, locale, entry: { uid, title } }); + }; + + for (const index in indexer) { + const chunk = await fs.readChunkFiles.next().catch((error) => { + log(this.importConfig, formatError(error), 'error'); + }); + + if (chunk) { + let apiContent = values(chunk as Record[]); + await this.makeConcurrentCall({ + apiContent, + processName, + indexerCount, + currentIndexer: +index, + apiParams: { + reject: onReject, + resolve: onSuccess, + entity: 'create-entries', + includeParamOnCompletion: true, + serializeData: this.serializeEntries.bind(this), + additionalInfo: { cTUid, locale }, + }, + concurrencyLimit: this.importConcurrency, + }).then(() => { + fs?.completeFile(true); + log(this.importConfig, `Created entries for content type ${cTUid} in locale ${locale}`, 'success'); + }); + } + } + } + + /** + * @method serializeEntries + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializeEntries(apiOptions: ApiOptions): ApiOptions { + let { + apiData: entry, + additionalInfo: { cTUid, locale }, + } = apiOptions; + + if (this.jsonRteCTs.indexOf(cTUid) > -1) { + entry = removeUidsFromJsonRteFields(entry, this.cTs[cTUid].schema); + } + // remove entry references from json-rte fields + if (this.jsonRteCTsWithRef.indexOf(cTUid) > -1) { + entry = removeEntryRefsFromJSONRTE(entry, this.cTs[cTUid].schema); + } + // will replace all old asset uid/urls with new ones + entry = lookupAssets( + { + content_type: this.cTs[cTUid], + entry: entry, + }, + this.assetUidMapper, + this.assetUrlMapper, + path.join(this.entriesPath, cTUid, locale), + this.installedExtensions, + ); + delete entry.publish_details; + apiOptions.apiData = entry; + return apiOptions; + } + + async updateEntriesWithReferences(): Promise {} + + async enableMandatoryCTReferences(): Promise {} + + async removeAutoCreatedEntries(): Promise {} + + async updateFieldRules(): Promise {} + + async publishEntries(): Promise {} +} diff --git a/packages/contentstack-import/src/utils/asset-helper.ts b/packages/contentstack-import/src/utils/asset-helper.ts index 0832824d88..c8fa8cb1ea 100644 --- a/packages/contentstack-import/src/utils/asset-helper.ts +++ b/packages/contentstack-import/src/utils/asset-helper.ts @@ -53,11 +53,11 @@ export const uploadAssetHelper = function (config: ImportConfig, req: any, fsPat // get assets object export const lookupAssets = function ( - data: any, - mappedAssetUids: string[], - mappedAssetUrls: string[], - assetUidMapperPath: string[], - installedExtensions: string[], + data: Record, + mappedAssetUids: Record, + mappedAssetUrls: Record, + assetUidMapperPath: string, + installedExtensions: Record[], ) { if ( !_.has(data, 'entry') || diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index e432fe01eb..f869058b3f 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -244,3 +244,185 @@ function findUidsInNewRefFields(entry: any, uids: string[]) { } } } + +export const removeUidsFromJsonRteFields = ( + entry: Record, + ctSchema: Record[], +): Record => { + for (const element of ctSchema) { + switch (element.data_type) { + case 'blocks': { + if (entry[element.uid]) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((e: any) => { + let key = Object.keys(e).pop(); + let subBlock = element.blocks.filter((block: any) => block.uid === key).pop(); + e[key] = removeUidsFromJsonRteFields(e[key], subBlock.schema); + return e; + }); + } + } + break; + } + case 'global_field': + case 'group': { + if (entry[element.uid]) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((e) => { + e = removeUidsFromJsonRteFields(e, element.schema); + return e; + }); + } else { + entry[element.uid] = removeUidsFromJsonRteFields(entry[element.uid], element.schema); + } + } + break; + } + case 'json': { + if (entry[element.uid] && element.field_metadata.rich_text_type) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((jsonRteData: any) => { + delete jsonRteData.uid; // remove uid + + if (_.isObject(jsonRteData.attrs)) { + jsonRteData.attrs.dirty = true; + } + + if (!_.isEmpty(jsonRteData.children)) { + jsonRteData.children = _.map(jsonRteData.children, (child) => removeUidsFromChildren(child)); + } + + return jsonRteData; + }); + } else { + delete entry[element.uid].uid; // remove uid + if (entry[element.uid] && _.isObject(entry[element.uid].attrs)) { + entry[element.uid].attrs.dirty = true; + } + if (entry[element.uid] && !_.isEmpty(entry[element.uid].children)) { + entry[element.uid].children = _.map(entry[element.uid].children, (child) => + removeUidsFromChildren(child), + ); + } + } + } + break; + } + } + } + return entry; +}; + +function removeUidsFromChildren(children: Record[] | any) { + if (children.length && children.length > 0) { + return children.map((child: any) => { + if (child.type && child.type.length > 0) { + delete child.uid; // remove uid + + if (_.isObject(child.attrs)) { + child.attrs.dirty = true; + } + } + if (child.children && child.children.length > 0) { + child.children = removeUidsFromChildren(child.children); + } + return child; + }); + } else { + if (children.type && children.type.length > 0) { + delete children.uid; // remove uid + if (_.isObject(children.attrs)) { + children.attrs.dirty = true; + } + } + if (children.children && children.children.length > 0) { + children.children = removeUidsFromChildren(children.children); + } + return children; + } +} + +export const removeEntryRefsFromJSONRTE = (entry: Record, ctSchema: Record[]) => { + for (const element of ctSchema) { + switch (element.data_type) { + case 'blocks': { + if (entry[element.uid]) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((e: any) => { + let key = Object.keys(e).pop(); + let subBlock = element.blocks.filter((block: any) => block.uid === key).pop(); + e[key] = removeEntryRefsFromJSONRTE(e[key], subBlock.schema); + return e; + }); + } + } + break; + } + case 'global_field': + case 'group': { + if (entry[element.uid]) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((e) => { + e = removeEntryRefsFromJSONRTE(e, element.schema); + return e; + }); + } else { + entry[element.uid] = removeEntryRefsFromJSONRTE(entry[element.uid], element.schema); + } + } + break; + } + case 'json': { + if (entry[element.uid] && element.field_metadata.rich_text_type) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((jsonRteData: any) => { + // repeated code from else block, will abstract later + let entryReferences = jsonRteData.children.filter((e: any) => doEntryReferencesExist(e)); + if (entryReferences.length > 0) { + jsonRteData.children = jsonRteData.children.filter((e: any) => !doEntryReferencesExist(e)); + return jsonRteData; // return jsonRteData without entry references + } else { + return jsonRteData; // return jsonRteData as it is, because there are no entry references + } + }); + } else { + let entryReferences = entry[element.uid].children.filter((e: any) => doEntryReferencesExist(e)); + if (entryReferences.length > 0) { + entry[element.uid].children = entry[element.uid].children.filter((e: any) => !doEntryReferencesExist(e)); + } + } + } + break; + } + } + } + return entry; +}; + +function doEntryReferencesExist(element: Record[] | any): boolean { + // checks if the children of p element contain any references + // only checking one level deep, not recursive + + if (element.length) { + for (const item of element) { + if ((item.type === 'p' || item.type === 'a') && item.children && item.children.length > 0) { + return doEntryReferencesExist(item.children); + } else if (isEntryRef(item)) { + return true; + } + } + } else { + if (isEntryRef(element)) { + return true; + } + + if ((element.type === 'p' || element.type === 'a') && element.children && element.children.length > 0) { + return doEntryReferencesExist(element.children); + } + } + return false; +} + +function isEntryRef(element: any) { + return element.type === 'reference' && element.attrs.type === 'entry'; +} diff --git a/packages/contentstack-import/src/utils/index.ts b/packages/contentstack-import/src/utils/index.ts index 138e589111..f794713082 100644 --- a/packages/contentstack-import/src/utils/index.ts +++ b/packages/contentstack-import/src/utils/index.ts @@ -16,9 +16,9 @@ export { confirmToCloseProcess, getAllStackSpecificApps, ifAppAlreadyExist, - updateAppConfig + updateAppConfig, } from './marketplace-app-helper'; export { schemaTemplate, suppressSchemaReference, removeReferenceFields } from './content-type-helper'; export { lookupExtension } from './extension-helper'; -export { lookupEntries } from './entries-helper'; +export { lookupEntries, removeUidsFromJsonRteFields, removeEntryRefsFromJSONRTE } from './entries-helper'; export * from './common-helper'; diff --git a/packages/contentstack-import/tsconfig.json b/packages/contentstack-import/tsconfig.json index 679afbeaf5..44beaaf137 100644 --- a/packages/contentstack-import/tsconfig.json +++ b/packages/contentstack-import/tsconfig.json @@ -11,7 +11,7 @@ "skipLibCheck": true, "sourceMap": false, "esModuleInterop": true, - "noImplicitAny": true, + "noImplicitAny": false, "lib": [ "es2019", "es2020.promise", From d1c72e697d21e05d71e90fd2657dd10b2ba8b7b1 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Wed, 2 Aug 2023 16:01:54 +0530 Subject: [PATCH 24/52] refactor: remove temp file --- packages/contentstack-import/src/utils/backup-handler.ts | 5 +++-- packages/contentstack-import/src/utils/file-helper.ts | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-import/src/utils/backup-handler.ts b/packages/contentstack-import/src/utils/backup-handler.ts index 5a04ca9e15..bc87f1b5bf 100755 --- a/packages/contentstack-import/src/utils/backup-handler.ts +++ b/packages/contentstack-import/src/utils/backup-handler.ts @@ -13,9 +13,10 @@ export default function setupBackupDir(importConfig: ImportConfig): Promise Date: Fri, 21 Jul 2023 18:23:16 +0530 Subject: [PATCH 25/52] workflow export rewrite --- .../src/export/modules/workflows.ts | 100 ++++++++++++++++++ .../test/integration/assets.test.js | 16 +-- .../test/integration/content-types.test.js | 16 +-- .../test/integration/custom-roles.test.js | 16 +-- .../test/integration/labels.test.js | 16 +-- .../test/integration/locales.test.js | 16 +-- 6 files changed, 140 insertions(+), 40 deletions(-) create mode 100644 packages/contentstack-export/src/export/modules/workflows.ts diff --git a/packages/contentstack-export/src/export/modules/workflows.ts b/packages/contentstack-export/src/export/modules/workflows.ts new file mode 100644 index 0000000000..e78cbe4cf8 --- /dev/null +++ b/packages/contentstack-export/src/export/modules/workflows.ts @@ -0,0 +1,100 @@ +import omit from 'lodash/omit'; +import isEmpty from 'lodash/isEmpty'; +import { resolve as pResolve } from 'node:path'; + +import config from '../../config'; +import BaseClass from './base-class'; +import { log, formatError, fsUtil } from '../../utils'; +import { WorkflowConfig, ModuleClassParams } from '../../types'; + +export default class ExportWorkFlows extends BaseClass { + private workflows: Record>; + private workflowConfig: WorkflowConfig; + public webhooksFolderPath: string; + private qs: { + include_count: boolean; + skip?: number; + }; + + constructor({ exportConfig, stackAPIClient }: ModuleClassParams) { + super({ exportConfig, stackAPIClient }); + this.workflows = {}; + this.workflowConfig = config.modules.workflows; + this.qs = { include_count: true }; + } + + async start(): Promise { + log(this.exportConfig, 'Starting workflows export', 'info'); + + this.webhooksFolderPath = pResolve( + this.exportConfig.data, + this.exportConfig.branchName || '', + this.workflowConfig.dirName, + ); + + await fsUtil.makeDirectory(this.webhooksFolderPath); + await this.getWorkflows(); + + if (this.workflows === undefined || isEmpty(this.workflows)) { + log(this.exportConfig, 'No workflows found', 'info'); + } else { + fsUtil.writeFile(pResolve(this.webhooksFolderPath, this.workflowConfig.fileName), this.workflows); + log(this.exportConfig, 'All the workflows have been exported successfully!', 'success'); + } + } + + async getWorkflows(skip = 0): Promise { + if (skip) { + this.qs.skip = skip; + } + + await this.stack + .workflow() + .fetchAll(this.qs) + .then(async (data: any) => { + const { items, count } = data; + if (items?.length) { + await this.sanitizeAttribs(items); + skip += this.workflowConfig.limit || 100; + if (skip >= count) { + return; + } + return await this.getWorkflows(skip); + } + }) + .catch(({ error }: any) => { + log(this.exportConfig, `Failed to export workflows.${formatError(error)}`, 'error'); + log(this.exportConfig, error, 'error'); + }); + } + + async sanitizeAttribs(workflows: Record[]) { + for (let index = 0; index < workflows?.length; index++) { + await this.getWorkflowRoles(workflows[index]); + const workflowUid = workflows[index].uid; + const workflowName = workflows[index]?.name || ''; + this.workflows[workflowUid] = omit(workflows[index], this.workflowConfig.invalidKeys); + log(this.exportConfig, `'${workflowName}' workflow was exported successfully`, 'success'); + } + } + + async getWorkflowRoles(workflow: Record) { + for (const stage of workflow?.workflow_stages) { + for (let i = 0; i < stage?.SYS_ACL?.roles?.uids?.length; i++) { + const roleUid = stage.SYS_ACL.roles.uids[i]; + const roleData = await this.getRoles(roleUid); + stage.SYS_ACL.roles.uids[i] = roleData; + } + } + } + + async getRoles(roleUid: number): Promise { + return await this.stack + .role(roleUid) + .fetch({ include_rules: true, include_permissions: true }) + .then((data: any) => data) + .catch((err: any) => + log(this.exportConfig, `Failed to fetch roles.${formatError(err)}`, 'error'), + ); + } +} diff --git a/packages/contentstack-export/test/integration/assets.test.js b/packages/contentstack-export/test/integration/assets.test.js index 7f00c19c1c..9359718e81 100644 --- a/packages/contentstack-export/test/integration/assets.test.js +++ b/packages/contentstack-export/test/integration/assets.test.js @@ -1,11 +1,10 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const path = require('path'); const uniqBy = require('lodash/uniqBy'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getAssetAndFolderCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -29,11 +28,12 @@ module.exports = (region) => { describe('cm:stacks:export assets [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -105,9 +105,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; diff --git a/packages/contentstack-export/test/integration/content-types.test.js b/packages/contentstack-export/test/integration/content-types.test.js index 336694ab32..20524d8394 100644 --- a/packages/contentstack-export/test/integration/content-types.test.js +++ b/packages/contentstack-export/test/integration/content-types.test.js @@ -1,11 +1,10 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const { promises: fsPromises } = fs; const path = require('path'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getContentTypesCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -28,11 +27,12 @@ module.exports = (region) => { describe('cm:stacks:export content-types [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -92,9 +92,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; diff --git a/packages/contentstack-export/test/integration/custom-roles.test.js b/packages/contentstack-export/test/integration/custom-roles.test.js index 824805dc9f..a2dd74c16f 100644 --- a/packages/contentstack-export/test/integration/custom-roles.test.js +++ b/packages/contentstack-export/test/integration/custom-roles.test.js @@ -1,10 +1,9 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const path = require('path'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getCustomRolesCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -27,11 +26,12 @@ module.exports = (region) => { describe('cm:stacks:export custom-roles [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -86,9 +86,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; diff --git a/packages/contentstack-export/test/integration/labels.test.js b/packages/contentstack-export/test/integration/labels.test.js index 9b599925ba..907667de58 100644 --- a/packages/contentstack-export/test/integration/labels.test.js +++ b/packages/contentstack-export/test/integration/labels.test.js @@ -1,10 +1,9 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const path = require('path'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getLabelsCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -27,11 +26,12 @@ module.exports = (region) => { describe('cm:stacks:export labels [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -85,9 +85,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; diff --git a/packages/contentstack-export/test/integration/locales.test.js b/packages/contentstack-export/test/integration/locales.test.js index ea8c5dbfc0..03d42c115d 100644 --- a/packages/contentstack-export/test/integration/locales.test.js +++ b/packages/contentstack-export/test/integration/locales.test.js @@ -1,10 +1,9 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const path = require('path'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getLocalesCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -27,11 +26,12 @@ module.exports = (region) => { describe('cm:stacks:export locales [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -87,9 +87,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; From d1c478fc6376e60b445214c11e13544164c2b3bf Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Mon, 31 Jul 2023 19:15:57 +0530 Subject: [PATCH 26/52] workflow import rewrite --- .../contentstack-export/src/config/index.ts | 1 + .../contentstack-import/src/config/index.ts | 1 + .../src/import/modules/workflows.ts | 249 ++++++++++++++++++ 3 files changed, 251 insertions(+) create mode 100644 packages/contentstack-import/src/import/modules/workflows.ts diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index b35863519d..29258d5c70 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -380,6 +380,7 @@ const config: DefaultConfig = { 'global-fields', 'content-types', 'entries', + 'workflows' ], apis: { userSession: '/user-session/', diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 8915665086..4cf99aca40 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -377,6 +377,7 @@ const config: DefaultConfig = { 'content-types', 'webhooks', 'custom-roles', + 'workflows' ], rateLimit: 5, preserveStackVersion: false, diff --git a/packages/contentstack-import/src/import/modules/workflows.ts b/packages/contentstack-import/src/import/modules/workflows.ts new file mode 100644 index 0000000000..4d2cb8e419 --- /dev/null +++ b/packages/contentstack-import/src/import/modules/workflows.ts @@ -0,0 +1,249 @@ +import chalk from 'chalk'; +import isEmpty from 'lodash/isEmpty'; +import values from 'lodash/values'; +import find from 'lodash/find'; +import findIndex from 'lodash/findIndex'; +import { join, resolve } from 'node:path'; + +import config from '../../config'; +import BaseClass, { ApiOptions } from './base-class'; +import { log, formatError, fsUtil, fileHelper } from '../../utils'; +import { ModuleClassParams, WorkflowConfig } from '../../types'; + +export default class ImportWorkflows extends BaseClass { + private mapperDirPath: string; + private workflowsFolderPath: string; + private workflowUidMapperPath: string; + private createdWorkflowsPath: string; + private failedWorkflowsPath: string; + private workflowsConfig: WorkflowConfig; + private workflows: Record; + private workflowUidMapper: Record; + private createdWorkflows: Record[]; + private failedWebhooks: Record[]; + private roleNameMap: Record; + + constructor({ importConfig, stackAPIClient }: ModuleClassParams) { + super({ importConfig, stackAPIClient }); + this.workflowsConfig = config.modules.workflows; + this.mapperDirPath = join(this.importConfig.backupDir, 'mapper', 'workflows'); + this.workflowsFolderPath = join(this.importConfig.backupDir, this.workflowsConfig.dirName); + this.workflowUidMapperPath = join(this.mapperDirPath, 'uid-mapping.json'); + this.createdWorkflowsPath = join(this.mapperDirPath, 'success.json'); + this.failedWorkflowsPath = join(this.mapperDirPath, 'fails.json'); + this.workflows = {}; + this.failedWebhooks = []; + this.createdWorkflows = []; + this.workflowUidMapper = {}; + this.roleNameMap = {}; + } + + /** + * @method start + * @returns {Promise} Promise + */ + async start(): Promise { + log(this.importConfig, 'Migrating workflows', 'info'); + + //Step1 check folder exists or not + if (fileHelper.fileExistsSync(this.workflowsFolderPath)) { + this.workflows = fsUtil.readFile(join(this.workflowsFolderPath, this.workflowsConfig.fileName), true) as Record; + } else { + log(this.importConfig, `No such file or directory - '${this.workflowsFolderPath}'`, 'error'); + return; + } + + //create workflows in mapper directory + await fsUtil.makeDirectory(this.mapperDirPath); + this.workflowUidMapper = fileHelper.fileExistsSync(this.workflowUidMapperPath) + ? (fsUtil.readFile(join(this.workflowUidMapperPath), true) as Record) + : {}; + + if (this.workflows === undefined || isEmpty(this.workflows)) { + log(this.importConfig, 'No Workflow Found', 'info'); + return; + } + + //fetch all roles + await this.getRoles(); + await this.importWorkflows(); + + if (this.createdWorkflows?.length) { + fsUtil.writeFile(this.createdWorkflowsPath, this.createdWorkflows); + } + + if (this.failedWebhooks?.length) { + fsUtil.writeFile(this.failedWorkflowsPath, this.failedWebhooks); + } + + log(this.importConfig, 'Workflows have been imported successfully!', 'success'); + } + + async getRoles(): Promise { + const roles = await this.stack + .role() + .fetchAll() + .then((data: any) => data) + .catch((err: any) => log(this.importConfig, `Failed to fetch roles. ${formatError(err)}`, 'error')); + + for (const role of roles?.items) { + this.roleNameMap[role.name] = role.uid; + } + } + + async importWorkflows() { + const apiContent = values(this.workflows); + + //check and create custom roles if not exists + for (const workflow of values(this.workflows)) { + if (!this.workflowUidMapper.hasOwnProperty(workflow.uid)) { + await this.createCustomRoleIfNotExists(workflow); + } + } + + const onSuccess = ({ response, apiData: { uid, name } = { uid: null, name: '' } }: any) => { + this.createdWorkflows.push(response); + this.workflowUidMapper[uid] = response.uid; + log(this.importConfig, `Workflow '${name}' imported successfully`, 'success'); + fsUtil.writeFile(this.workflowUidMapperPath, this.workflowUidMapper); + }; + + const onReject = ({ error, apiData }: any) => { + const err = error?.message ? JSON.parse(error.message) : error; + const { name } = apiData; + if (err?.errors?.name) { + log(this.importConfig, `Workflow '${name}' already exists`, 'info'); + } else { + this.failedWebhooks.push(apiData); + if (error.errors['workflow_stages.0.users']) { + log( + this.importConfig, + "Failed to import Workflows as you've specified certain roles in the Stage transition and access rules section. We currently don't import roles to the stack.", + 'error', + ); + } else { + log(this.importConfig, `Workflow '${name}' failed to be import. ${formatError(error)}`, 'error'); + } + } + }; + + await this.makeConcurrentCall( + { + apiContent, + processName: 'create workflows', + apiParams: { + serializeData: this.serializeWorkflows.bind(this), + reject: onReject, + resolve: onSuccess, + entity: 'create-workflows', + includeParamOnCompletion: true, + }, + concurrencyLimit: config.fetchConcurrency || 1, + }, + undefined, + false, + ); + } + + /** + * @method serializeWorkflows + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializeWorkflows(apiOptions: ApiOptions): ApiOptions { + let { apiData: workflow } = apiOptions; + + if (this.workflowUidMapper.hasOwnProperty(workflow.uid)) { + log(this.importConfig, `Workflow '${workflow.name}' already exists. Skipping it to avoid duplicates!`, 'info'); + apiOptions.entity = undefined; + } else { + if (workflow.admin_users !== undefined) { + log(this.importConfig, chalk.yellow('We are skipping import of `Workflow superuser(s)` from workflow'), 'info'); + delete workflow.admin_users; + } + // One branch is required to create workflow. + if (!workflow.branches) { + workflow.branches = ['main']; + } + apiOptions.apiData = workflow; + } + return apiOptions; + } + + async createCustomRoleIfNotExists(workflow: Record) { + const onSuccess = ({ response, apiData, additionalInfo: { workflowUid, stageIndex } }: any) => { + const { name } = apiData; + this.updateRoleData({ workflowUid, stageIndex, roleData: apiData }); + this.roleNameMap[name] = response?.uid; + }; + + const onReject = ({ error, apiData: { name } = { name: '' } }: any) => { + log(this.importConfig, `Failed to create custom roles '${name}'.${formatError(error)}`, 'error'); + }; + + const workflowStages = workflow.workflow_stages; + let stageIndex = 0; + for (const stage of workflowStages) { + if (stage?.SYS_ACL?.users?.uids?.length && stage?.SYS_ACL?.users?.uids[0] !== '$all') { + stage.SYS_ACL.users.uids = ['$all']; + } + if (stage?.SYS_ACL?.roles?.uids?.length) { + const apiContent = stage.SYS_ACL.roles.uids; + await this.makeConcurrentCall( + { + apiContent, + processName: 'create custom role', + apiParams: { + serializeData: this.serializeCustomRoles.bind(this), + reject: onReject, + resolve: onSuccess, + entity: 'create-custom-role', + includeParamOnCompletion: true, + additionalInfo: { workflowUid: workflow.uid, stageIndex }, + }, + concurrencyLimit: config.fetchConcurrency || 1, + }, + undefined, + false, + ); + } + stageIndex++; + } + } + + /** + * @method serializeCustomRoles + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializeCustomRoles(apiOptions: ApiOptions): ApiOptions { + let { + apiData: roleData, + additionalInfo: { workflowUid, stageIndex }, + } = apiOptions; + if (!this.roleNameMap[roleData.name]) { + // rules.branch is required to create custom roles. + const branchRuleExists = find(roleData.rules, (rule: any) => rule.module === 'branch'); + if (!branchRuleExists) { + roleData.rules.push({ + module: 'branch', + branches: ['main'], + acl: { read: true }, + }); + } + apiOptions = roleData; + } else { + apiOptions.entity = undefined; + this.updateRoleData({ workflowUid, stageIndex, roleData }); + } + return apiOptions; + } + + updateRoleData(params: { workflowUid: string; stageIndex: number; roleData: any }) { + const { workflowUid, stageIndex, roleData } = params; + const workflowStage = this.workflows[workflowUid].workflow_stages; + const roles = workflowStage[stageIndex].SYS_ACL.roles.uids; + const index = findIndex(roles, ['uid', roleData.uid]); + roles[index >= 0 ? index : roles.length] = this.roleNameMap[roleData.name]; + } +} From 3c84ff0375688a0506f8c9ceb57f544eed2bd3c1 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 1 Aug 2023 16:39:13 +0530 Subject: [PATCH 27/52] feat: stack export rewrite --- .../contentstack-export/src/config/index.ts | 3 +- .../src/export/modules-js/stack.js | 4 +- .../src/export/modules/stack.ts | 93 +++++++++++++++++++ .../src/types/export-config.ts | 1 + .../contentstack-export/src/types/index.ts | 7 ++ 5 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 packages/contentstack-export/src/export/modules/stack.ts diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index 29258d5c70..92edaa0001 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -380,7 +380,8 @@ const config: DefaultConfig = { 'global-fields', 'content-types', 'entries', - 'workflows' + 'workflows', + 'stack' ], apis: { userSession: '/user-session/', diff --git a/packages/contentstack-export/src/export/modules-js/stack.js b/packages/contentstack-export/src/export/modules-js/stack.js index 157b99b269..4f4e8329c4 100644 --- a/packages/contentstack-export/src/export/modules-js/stack.js +++ b/packages/contentstack-export/src/export/modules-js/stack.js @@ -49,8 +49,8 @@ class ExportStack { return self.getLocales(apiDetails); } else if (self.config.preserveStackVersion) { log(self.config, 'Exporting stack details', 'success'); - let stackFolderPath = path.resolve(self.config.data, stackConfig.dirName); - let stackContentsFile = path.resolve(stackFolderPath, stackConfig.fileName); + let stackFolderPath = path.resolve(self.config.data, this.stackConfig.dirName); + let stackContentsFile = path.resolve(stackFolderPath, this.stackConfig.fileName); mkdirp.sync(stackFolderPath); diff --git a/packages/contentstack-export/src/export/modules/stack.ts b/packages/contentstack-export/src/export/modules/stack.ts new file mode 100644 index 0000000000..3a50374158 --- /dev/null +++ b/packages/contentstack-export/src/export/modules/stack.ts @@ -0,0 +1,93 @@ +import find from 'lodash/find'; +import { resolve as pResolve } from 'node:path'; +import { isAuthenticated } from '@contentstack/cli-utilities'; + +import config from '../../config'; +import BaseClass from './base-class'; +import { log, formatError, fsUtil } from '../../utils'; +import { StackConfig, ModuleClassParams } from '../../types'; + +export default class ExportStack extends BaseClass { + private stackConfig: StackConfig; + private stackFolderPath: string; + private qs: { + include_count: boolean; + skip?: number; + }; + + constructor({ exportConfig, stackAPIClient }: ModuleClassParams) { + super({ exportConfig, stackAPIClient }); + this.stackConfig = config.modules.stack; + this.qs = { include_count: true }; + this.stackFolderPath = pResolve(this.exportConfig.data, this.stackConfig.dirName); + } + + async start(): Promise { + if (isAuthenticated) { + const stackData = await this.getStack(); + if (stackData?.org_uid) { + this.exportConfig.org_uid = stackData.org_uid; + this.exportConfig.sourceStackName = stackData.name; + } + } + if (!this.exportConfig.preserveStackVersion && !this.exportConfig.hasOwnProperty('master_locale')) { + return this.getLocales(); + } else if (this.exportConfig.preserveStackVersion) { + return this.exportStack(); + } + } + + async getStack() { + return await this.stack.fetch().catch((error: any) => { + log(this.exportConfig, `Failed to export stack. ${formatError(error)}`, 'error'); + }); + } + + async getLocales(skip: number = 0) { + if (skip) { + this.qs.skip = skip; + } + return await this.stack + .locale() + .query(this.qs) + .find() + .then(async (data: any) => { + const { items, count } = data; + if (items?.length) { + skip += this.stackConfig.limit || 100; + const masterLocalObj = find(items, (locale: any) => { + if (locale.fallback_locale === null) { + return locale; + } + }); + if (masterLocalObj) { + return masterLocalObj; + } else if (skip >= count) { + log(this.exportConfig, 'Master locale not found', 'error'); + return; + } else { + return await this.getLocales(skip); + } + } + }) + .catch((error: any) => { + log(this.exportConfig, `Failed to export locales. ${formatError(error)}`, 'error'); + log(this.exportConfig, error, 'error'); + }); + } + + async exportStack() { + log(this.exportConfig, 'Exporting stack details', 'success'); + await fsUtil.makeDirectory(this.stackFolderPath); + return this.stack + .fetch() + .then((resp: any) => { + fsUtil.writeFile(pResolve(this.stackFolderPath, this.stackConfig.fileName), resp); + log(this.exportConfig, 'Exported stack details successfully!', 'success'); + return resp; + }) + .catch((error: any) => { + log(this.exportConfig, `Failed to export stack. ${formatError(error)}`, 'error'); + }); + } +} diff --git a/packages/contentstack-export/src/types/export-config.ts b/packages/contentstack-export/src/types/export-config.ts index 5aa1e7de24..a56db980e6 100644 --- a/packages/contentstack-export/src/types/export-config.ts +++ b/packages/contentstack-export/src/types/export-config.ts @@ -27,6 +27,7 @@ export default interface ExportConfig extends DefaultConfig { access_token?: string; org_uid?: string; source_stack?: string; + sourceStackName?:string; } type branch = { diff --git a/packages/contentstack-export/src/types/index.ts b/packages/contentstack-export/src/types/index.ts index 3839a6de98..ccf95c0918 100644 --- a/packages/contentstack-export/src/types/index.ts +++ b/packages/contentstack-export/src/types/index.ts @@ -114,5 +114,12 @@ export interface CustomRoleConfig{ dependencies?: Modules[]; } +export interface StackConfig{ + dirName: string; + fileName: string; + dependencies?: Modules[]; + limit?: number; +} + export { default as DefaultConfig } from './default-config'; export { default as ExportConfig } from './export-config'; From ff1a5b6668dc7477287cdc651de2dcb5bb77cd7f Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 1 Aug 2023 16:40:02 +0530 Subject: [PATCH 28/52] refactor: remove management dependency from clone --- package-lock.json | 2 -- packages/contentstack-clone/package.json | 1 - pnpm-lock.yaml | 23 ----------------------- 3 files changed, 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc52ca525e..971d7b0e09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20605,7 +20605,6 @@ "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/management": "~1.10.0", "async": "^3.2.4", "chalk": "^4.1.0", "child_process": "^1.0.2", @@ -23953,7 +23952,6 @@ "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/management": "~1.10.0", "@oclif/test": "^1.2.7", "async": "^3.2.4", "chai": "^4.2.0", diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index 0952846315..995abce831 100644 --- a/packages/contentstack-clone/package.json +++ b/packages/contentstack-clone/package.json @@ -9,7 +9,6 @@ "@contentstack/cli-cm-import": "^1.7.1", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/management": "~1.10.0", "@colors/colors": "^1.5.0", "async": "^3.2.4", "chalk": "^4.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a4d1e945d..81635a510c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -364,7 +364,6 @@ importers: '@contentstack/cli-cm-import': ^1.7.1 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-utilities': ^1.5.1 - '@contentstack/management': ~1.10.0 '@oclif/test': ^1.2.7 async: ^3.2.4 chai: ^4.2.0 @@ -390,7 +389,6 @@ importers: '@contentstack/cli-cm-import': link:../contentstack-import '@contentstack/cli-command': link:../contentstack-command '@contentstack/cli-utilities': link:../contentstack-utilities - '@contentstack/management': 1.10.0 async: 3.2.4 chalk: 4.1.2 child_process: 1.0.2 @@ -1503,18 +1501,6 @@ packages: uuid: 8.3.2 dev: false - /@contentstack/management/1.10.0: - resolution: {integrity: sha512-wnmVS19n3cZeh6T2PbBXGCr4irktunVmuECTyPF5++Rsc6GDO+FoQGCZdvzHpRZE0GLiPFIID50z2TZuNArEOg==} - engines: {node: '>=8.0.0'} - dependencies: - axios: 0.27.2 - form-data: 3.0.1 - lodash: 4.17.21 - qs: 6.11.2 - transitivePeerDependencies: - - debug - dev: false - /@contentstack/management/1.10.0_debug@4.3.4: resolution: {integrity: sha512-wnmVS19n3cZeh6T2PbBXGCr4irktunVmuECTyPF5++Rsc6GDO+FoQGCZdvzHpRZE0GLiPFIID50z2TZuNArEOg==} engines: {node: '>=8.0.0'} @@ -4200,15 +4186,6 @@ packages: xml2js: 0.5.0 dev: true - /axios/0.27.2: - resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} - dependencies: - follow-redirects: 1.15.2 - form-data: 4.0.0 - transitivePeerDependencies: - - debug - dev: false - /axios/0.27.2_debug@4.3.4: resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} dependencies: From ab77b1597d7ed75f23a6336c85cf387a00306014 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 1 Aug 2023 17:01:00 +0530 Subject: [PATCH 29/52] refactor: stack export --- packages/contentstack-export/src/export/modules/stack.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-export/src/export/modules/stack.ts b/packages/contentstack-export/src/export/modules/stack.ts index 3a50374158..c98a87bc8a 100644 --- a/packages/contentstack-export/src/export/modules/stack.ts +++ b/packages/contentstack-export/src/export/modules/stack.ts @@ -31,13 +31,14 @@ export default class ExportStack extends BaseClass { } } if (!this.exportConfig.preserveStackVersion && !this.exportConfig.hasOwnProperty('master_locale')) { + //fetch master locale details return this.getLocales(); } else if (this.exportConfig.preserveStackVersion) { return this.exportStack(); } } - async getStack() { + async getStack(): Promise { return await this.stack.fetch().catch((error: any) => { log(this.exportConfig, `Failed to export stack. ${formatError(error)}`, 'error'); }); @@ -76,7 +77,7 @@ export default class ExportStack extends BaseClass { }); } - async exportStack() { + async exportStack(): Promise { log(this.exportConfig, 'Exporting stack details', 'success'); await fsUtil.makeDirectory(this.stackFolderPath); return this.stack From 33e2ce338fad994827b22bbba3484aa2758177de Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Thu, 3 Aug 2023 15:26:45 +0530 Subject: [PATCH 30/52] added entries import --- packages/contentstack-export/package.json | 4 +- packages/contentstack-import/package.json | 4 +- .../contentstack-import/src/config/index.ts | 3 +- .../src/import/modules/base-class.ts | 18 +- .../src/import/modules/entries.ts | 416 ++++++++++++++++-- .../src/utils/entries-helper.ts | 159 ++++++- .../contentstack-import/src/utils/index.ts | 7 +- 7 files changed, 564 insertions(+), 47 deletions(-) diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index bfd320b7ee..e9a1149102 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -80,9 +80,9 @@ "plugin" ], "license": "MIT", - "main": "./src/commands/cm/stacks/export.js", + "main": "./lib/commands/cm/stacks/export.js", "oclif": { - "commands": "./src/commands", + "commands": "./lib/commands", "bin": "csdx", "devPlugins": [ "@oclif/plugin-help" diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index b671eeefa0..86c110ed3c 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -79,10 +79,10 @@ "cli", "plugin" ], - "main": "./src/commands/cm/stacks/import.js", + "main": "./lib/commands/cm/stacks/import.js", "license": "MIT", "oclif": { - "commands": "./src/commands", + "commands": "./lib/commands", "bin": "csdx", "repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-import/<%- commandPath %>" }, diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 4cf99aca40..4a5621fd05 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -377,7 +377,8 @@ const config: DefaultConfig = { 'content-types', 'webhooks', 'custom-roles', - 'workflows' + 'workflows', + 'entries', ], rateLimit: 5, preserveStackVersion: false, diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index 374e79c5a5..167d678148 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -44,7 +44,9 @@ export type ApiModuleType = | 'create-webhooks' | 'create-workflows' | 'create-custom-role' - | 'create-entries'; + | 'create-entries' + | 'update-entries' + | 'publish-entries'; export type ApiOptions = { uid?: string; @@ -343,11 +345,23 @@ export default abstract class BaseClass { .catch(onReject); case 'create-entries': return this.stack - .contentType(additionalInfo.ctUid) + .contentType(additionalInfo.cTUid) .entry() .create({ entry: apiData }) .then(onSuccess) .catch(onReject); + case 'update-entries': + return apiData.update().then(onSuccess).catch(onReject); + case 'publish-entries': + if (additionalInfo.skip) { + return Promise.resolve(onSuccess(apiData)); + } + return this.stack + .contentType(additionalInfo.cTUid) + .entry(additionalInfo.entryUid) + .publish({ publishDetails: apiData, locale: additionalInfo.locale }) + .then(onSuccess) + .catch(onReject); default: return Promise.resolve(); } diff --git a/packages/contentstack-import/src/import/modules/entries.ts b/packages/contentstack-import/src/import/modules/entries.ts index 7bed6a68c1..c87e1d8f96 100644 --- a/packages/contentstack-import/src/import/modules/entries.ts +++ b/packages/contentstack-import/src/import/modules/entries.ts @@ -6,8 +6,8 @@ */ import * as path from 'path'; -import { isEmpty, values, cloneDeep } from 'lodash'; -import { FsUtility } from '@contentstack/cli-utilities'; +import { isEmpty, values, cloneDeep, find, indexOf, forEach } from 'lodash'; +import { ContentType, FsUtility } from '@contentstack/cli-utilities'; import { fsUtil, log, @@ -16,7 +16,10 @@ import { suppressSchemaReference, removeUidsFromJsonRteFields, removeEntryRefsFromJSONRTE, + restoreJsonRteEntryRefs, + lookupEntries, lookupAssets, + fileHelper, } from '../../utils'; import { ModuleClassParams } from '../../types'; import BaseClass, { ApiOptions } from './base-class'; @@ -39,7 +42,7 @@ export default class EntriesImport extends BaseClass { private entriesPath: string; private cTs: Record[]; private modifiedCTs: Record[]; - private refCTs: Record; + private refCTs: string[]; private jsonRteCTs: Record; private jsonRteCTsWithRef: Record; private jsonRteEntries: Record; @@ -48,6 +51,7 @@ export default class EntriesImport extends BaseClass { private failedEntries: Record[]; private locales: Record[]; private entriesUidMapper: Record; + private envs: Record; constructor({ importConfig, stackAPIClient }: ModuleClassParams) { super({ importConfig, stackAPIClient }); @@ -59,8 +63,6 @@ export default class EntriesImport extends BaseClass { this.uniqueUidMapperPath = path.join(this.entriesMapperPath, 'unique-mapping.json'); this.modifiedCTsPath = path.join(this.entriesMapperPath, 'modified-schemas.json'); this.marketplaceAppMapperPath = path.join(this.importConfig.data, 'mapper', 'marketplace_apps', 'uid-mapping.json'); - // this.createdEntriesWOUidPath = path.join(this.entryMapperPath, 'created-entries-wo-uid.json'); - // this.failedWOPath = path.join(this.entryMapperPath, 'failedWO.json'); this.entriesConfig = importConfig.modules.entries; this.entriesPath = path.resolve(importConfig.data, this.entriesConfig.dirName); this.cTsPath = path.resolve(importConfig.data, importConfig.modules['content-types'].dirName); @@ -71,6 +73,11 @@ export default class EntriesImport extends BaseClass { ); this.importConcurrency = this.entriesConfig.importConcurrency || importConfig.importConcurrency; this.entriesUidMapper = {}; + this.modifiedCTs = []; + this.refCTs = []; + this.jsonRteCTs = []; + this.jsonRteCTsWithRef = []; + this.envs = {}; } async start(): Promise { @@ -96,19 +103,72 @@ export default class EntriesImport extends BaseClass { this.assetUidMapper = (fsUtil.readFile(this.assetUidMapperPath) as Record) || {}; this.assetUrlMapper = (fsUtil.readFile(this.assetUrlMapperPath) as Record) || {}; - await this.disableMandatoryCTReferences(); fsUtil.makeDirectory(this.entriesMapperPath); - this.locales = fsUtil.readFile(this.localesPath) as Record[]; + await this.disableMandatoryCTReferences(); + this.locales = values(fsUtil.readFile(this.localesPath) as Record[]); + this.locales.unshift(this.importConfig.master_locale); // adds master locale to the list + + //Create Entries const entryRequestOptions = this.populateEntryCreatePayload(); for (let entryRequestOption of entryRequestOptions) { - log( - this.importConfig, - `Starting to create entries for ${entryRequestOption.cTUid} in locale ${entryRequestOption.locale}`, - 'info', - ); await this.createEntries(entryRequestOption); } - log(this.importConfig, 'Entries created successfully', 'info'); + await fileHelper.writeLargeFile(path.join(this.entriesMapperPath, 'uid-mapping.json'), this.entriesUidMapper); // TBD: manages mapper in one file, should find an alternative + fsUtil.writeFile(path.join(this.entriesMapperPath, 'failed-entries.json'), this.failedEntries); + + // Update entries with references + const entryUpdateRequestOptions = this.populateEntryUpdatePayload(); + for (let entryUpdateRequestOption of entryUpdateRequestOptions) { + await this.updateEntriesWithReferences(entryUpdateRequestOption).catch((error) => { + log( + this.importConfig, + `Error while updating entries references of ${entryUpdateRequestOption.cTUid} in locale ${entryUpdateRequestOption.locale}`, + 'error', + ); + log(this.importConfig, formatError(error), 'error'); + }); + } + fsUtil.writeFile(path.join(this.entriesMapperPath, 'failed-entries.json'), this.failedEntries); + + log(this.importConfig, 'Restoring content type changes', 'info'); + await this.enableMandatoryCTReferences().catch((error) => { + log(this.importConfig, `failed update content type references ${formatError(error)}`, 'error'); + }); + + log(this.importConfig, 'Removing entries from master language which got created by default', 'info'); + await this.removeAutoCreatedEntries().catch((error) => { + log(this.importConfig, `failed to remove auto created entries in master locale ${formatError(error)}`, 'error'); + }); + + // Update field rule of content types which are got removed earlier + log(this.importConfig, 'Updating the field rules of content type', 'info'); + await this.updateFieldRules().catch((error) => { + log(this.importConfig, `Error while updating field rules of content type ${formatError(error)}`, 'error'); + }); + log(this.importConfig, 'Entries imported successfully', 'success'); + + // Publishing entries + if (this.importConfig.entriesPublish) { + log(this.importConfig, 'Publishing entries', 'info'); + this.envs = fileHelper.readFileSync(this.envPath); + for (let entryRequestOption of entryRequestOptions) { + log( + this.importConfig, + `Starting publish entries for ${entryRequestOption.cTUid} in locale ${entryRequestOption.locale}`, + 'info', + ); + await this.publishEntries(entryRequestOption).catch((error) => { + log( + this.importConfig, + `Error in publishing entries of ${entryRequestOption.cTUid} in locale ${ + entryRequestOption.locale + } ${formatError(error)}`, + 'error', + ); + }); + } + log(this.importConfig, 'All the entries have been published successfully', 'success'); + } } catch (error) { log(this.importConfig, formatError(error), 'error'); throw new Error('Error while importing entries'); @@ -158,7 +218,7 @@ export default class EntriesImport extends BaseClass { suppressSchemaReference(contentType.schema, flag); // Check if suppress modified flag if (flag.suppressed) { - this.modifiedCTs.push(this.cTs[contentType.uid]); + this.modifiedCTs.push(find(this.cTs, { uid: contentType.uid })); } else { // Note: Skips the content type from update if no reference found apiOptions.additionalInfo = { skip: true }; @@ -191,21 +251,16 @@ export default class EntriesImport extends BaseClass { } populateEntryCreatePayload(): { cTUid: string; locale: string }[] { - const requestObjects: { cTUid: string; locale: string }[] = []; - this.cTs.forEach((contentType) => { - for (let locale in this.locales) { - requestObjects.push({ + const requestOptions: { cTUid: string; locale: string }[] = []; + for (let locale of this.locales) { + for (let contentType of this.cTs) { + requestOptions.push({ cTUid: contentType.uid, - locale: this.locales[locale].code, + locale: locale.code, }); } - requestObjects.push({ - cTUid: contentType.uid, - locale: this.importConfig.master_locale.code, - }); - }); - - return requestObjects; + } + return requestOptions; } async createEntries({ cTUid, locale }: { cTUid: string; locale: string }): Promise { @@ -215,6 +270,10 @@ export default class EntriesImport extends BaseClass { const fs = new FsUtility({ basePath, indexFileName }); const indexer = fs.indexFileContent; const indexerCount = values(indexer).length; + if (indexerCount === 0) { + return Promise.resolve(); + } + log(this.importConfig, `Starting to create entries for ${cTUid} in locale ${locale}`, 'info'); // Write created entries const entriesCreateFileHelper = new FsUtility({ moduleName: 'created-entries', @@ -224,11 +283,14 @@ export default class EntriesImport extends BaseClass { keepMetadata: false, omitKeys: this.entriesConfig.invalidKeys, }); + const contentType = find(this.cTs, { uid: cTUid }); - const onSuccess = ({ response, apiData: { uid, url, title } }: any) => { + const onSuccess = ({ response, apiData: { uid, url, title }, additionalInfo: { entryFileName } }: any) => { log(this.importConfig, `Created entry: '${title}' of content type ${cTUid} in locale ${locale}`, 'info'); this.entriesUidMapper[uid] = response.uid; - entriesCreateFileHelper.writeIntoFile({ [uid]: response } as any, { mapKeyVal: true }); + response.sourceEntryFilePath = path.join(basePath, entryFileName); // stores source file path temporarily + response.entryOldUid = uid; // stores old uid temporarily + entriesCreateFileHelper.writeIntoFile({ [response.uid]: response } as any, { mapKeyVal: true }); }; const onReject = ({ error, apiData: { uid, title } }: any) => { log(this.importConfig, `${title} entry of content type ${cTUid} in locale ${locale} failed to create`, 'error'); @@ -254,11 +316,11 @@ export default class EntriesImport extends BaseClass { entity: 'create-entries', includeParamOnCompletion: true, serializeData: this.serializeEntries.bind(this), - additionalInfo: { cTUid, locale }, + additionalInfo: { contentType, locale, cTUid, entryFileName: indexer[index] }, }, concurrencyLimit: this.importConcurrency, }).then(() => { - fs?.completeFile(true); + entriesCreateFileHelper?.completeFile(true); log(this.importConfig, `Created entries for content type ${cTUid} in locale ${locale}`, 'success'); }); } @@ -273,20 +335,20 @@ export default class EntriesImport extends BaseClass { serializeEntries(apiOptions: ApiOptions): ApiOptions { let { apiData: entry, - additionalInfo: { cTUid, locale }, + additionalInfo: { cTUid, locale, contentType }, } = apiOptions; if (this.jsonRteCTs.indexOf(cTUid) > -1) { - entry = removeUidsFromJsonRteFields(entry, this.cTs[cTUid].schema); + entry = removeUidsFromJsonRteFields(entry, contentType.schema); } // remove entry references from json-rte fields if (this.jsonRteCTsWithRef.indexOf(cTUid) > -1) { - entry = removeEntryRefsFromJSONRTE(entry, this.cTs[cTUid].schema); + entry = removeEntryRefsFromJSONRTE(entry, contentType.schema); } // will replace all old asset uid/urls with new ones entry = lookupAssets( { - content_type: this.cTs[cTUid], + content_type: contentType, entry: entry, }, this.assetUidMapper, @@ -299,13 +361,291 @@ export default class EntriesImport extends BaseClass { return apiOptions; } - async updateEntriesWithReferences(): Promise {} + populateEntryUpdatePayload(): { cTUid: string; locale: string }[] { + const requestOptions: { cTUid: string; locale: string }[] = []; + for (let locale of this.locales) { + for (let cTUid of this.refCTs) { + requestOptions.push({ + cTUid, + locale: locale.code, + }); + } + } + return requestOptions; + } + + async updateEntriesWithReferences({ cTUid, locale }: { cTUid: string; locale: string }): Promise { + const processName = 'Update Entries'; + const indexFileName = 'index.json'; + const basePath = path.join(this.entriesMapperPath, cTUid, locale); + const fs = new FsUtility({ basePath, indexFileName }); + const indexer = fs.indexFileContent; + const indexerCount = values(indexer).length; + if (indexerCount === 0) { + return Promise.resolve(); + } + log(this.importConfig, `Starting to update entries with references for ${cTUid} in locale ${locale}`, 'info'); + + const contentType = find(this.cTs, { uid: cTUid }); + + const onSuccess = ({ response, apiData: { uid, url, title } }: any) => { + log(this.importConfig, `Updated entry: '${title}' of content type ${cTUid} in locale ${locale}`, 'info'); + }; + const onReject = ({ error, apiData: { uid, title } }: any) => { + log(this.importConfig, `${title} entry of content type ${cTUid} in locale ${locale} failed to update`, 'error'); + log(this.importConfig, formatError(error), 'error'); + this.failedEntries.push({ content_type: cTUid, locale, entry: { uid, title } }); + }; + + for (const index in indexer) { + const chunk = await fs.readChunkFiles.next().catch((error) => { + log(this.importConfig, formatError(error), 'error'); + }); + + if (chunk) { + let apiContent = values(chunk as Record[]); + await this.makeConcurrentCall({ + apiContent, + processName, + indexerCount, + currentIndexer: +index, + apiParams: { + reject: onReject, + resolve: onSuccess, + entity: 'update-entries', + includeParamOnCompletion: true, + serializeData: this.serializeUpdateEntries.bind(this), + additionalInfo: { contentType, locale, cTUid }, + }, + concurrencyLimit: this.importConcurrency, + }).then(() => { + log(this.importConfig, `Updated entries for content type ${cTUid} in locale ${locale}`, 'success'); + }); + } + } + } + + /** + * @method serializeUpdateEntries + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializeUpdateEntries(apiOptions: ApiOptions): ApiOptions { + let { + apiData: entry, + additionalInfo: { cTUid, locale, contentType }, + } = apiOptions; + + try { + const sourceEntryFilePath = entry.sourceEntryFilePath; + const sourceEntry = (fsUtil.readFile(sourceEntryFilePath) || {})[entry.entryOldUid]; + // Removing temp values + delete entry.sourceEntryFilePath; + delete entry.entryOldUid; + if (this.jsonRteCTs.indexOf(cTUid) > -1) { + // the entries stored in eSuccessFilePath, have the same uids as the entries from source data + entry = restoreJsonRteEntryRefs(entry, sourceEntry, contentType.schema, { + mappedAssetUids: this.assetUidMapper, + mappedAssetUrls: this.assetUrlMapper, + }); + } + + entry = lookupEntries( + { + content_type: contentType, + entry, + }, + this.entriesUidMapper, + path.join(this.entriesMapperPath, cTUid, locale), + ); + + const entryResponse = this.stack.contentType(contentType.uid).entry(entry.uid); + Object.assign(entryResponse, entry); + delete entryResponse.publish_details; + apiOptions.apiData = entryResponse; + return apiOptions; + } catch (error) { + console.log('error', error); + } + } + + async enableMandatoryCTReferences(): Promise { + const onSuccess = ({ response: contentType, apiData: { uid } }: any) => { + log(this.importConfig, `${uid} content type references updated`, 'success'); + }; + const onReject = ({ error, apiData: { uid } }: any) => { + log(this.importConfig, formatError(error), 'error'); + throw new Error(`Failed to update references of content type ${uid}`); + }; + return await this.makeConcurrentCall({ + processName: 'Update content type references', + apiContent: this.modifiedCTs, + apiParams: { + serializeData: this.serializeUpdateCTsWithRef.bind(this), + reject: onReject.bind(this), + resolve: onSuccess.bind(this), + entity: 'update-cts', + includeParamOnCompletion: true, + }, + concurrencyLimit: this.importConcurrency, + }); + } - async enableMandatoryCTReferences(): Promise {} + /** + * @method serializeUpdateCTsWithRef + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializeUpdateCTsWithRef(apiOptions: ApiOptions): ApiOptions { + const { apiData: contentType } = apiOptions; + if (contentType.field_rules) { + delete contentType.field_rules; + } + lookupExtension( + this.importConfig, + contentType.schema, + this.importConfig.preserveStackVersion, + this.installedExtensions, + ); + const contentTypePayload = this.stack.contentType(contentType.uid); + Object.assign(contentTypePayload, cloneDeep(contentType)); + apiOptions.apiData = contentTypePayload; + return apiOptions; + } async removeAutoCreatedEntries(): Promise {} - async updateFieldRules(): Promise {} + async updateFieldRules(): Promise { + let cTsWithFieldRules = fsUtil.readFile(path.join(this.cTsPath + '/field_rules_uid.json')) as Record[]; + if (!cTsWithFieldRules || cTsWithFieldRules?.length === 0) { + return; + } + for (let cTUid of cTsWithFieldRules) { + const contentType = find(this.cTs, { uid: cTUid }); + if (contentType.field_rules) { + let fieldRuleLength = contentType.field_rules.length; + for (let k = 0; k < fieldRuleLength; k++) { + let fieldRuleConditionLength = contentType.field_rules[k].conditions.length; + for (let i = 0; i < fieldRuleConditionLength; i++) { + if (contentType.field_rules[k].conditions[i].operand_field === 'reference') { + let fieldRulesValue = contentType.field_rules[k].conditions[i].value; + let fieldRulesArray = fieldRulesValue.split('.'); + let updatedValue = []; + for (const element of fieldRulesArray) { + let splittedFieldRulesValue = element; + if (this.entriesUidMapper.hasOwnProperty(splittedFieldRulesValue)) { + updatedValue.push(this.entriesUidMapper[splittedFieldRulesValue]); + } else { + updatedValue.push(element); + } + } + contentType.field_rules[k].conditions[i].value = updatedValue.join('.'); + } + } + } + + const contentTypeResponse: any = await this.stack + .contentType(contentType.uid) + .fetch() + .catch((error) => { + log(this.importConfig, `failed to update the field rules of ${cTUid} ${formatError(error)}`, 'error'); + }); + if (!contentTypeResponse) { + continue; + } + contentTypeResponse.field_rules = contentType.field_rules; + await contentTypeResponse.update().catch((error) => { + log(this.importConfig, `failed to update the field rules of ${cTUid} ${formatError(error)}`, 'error'); + }); + } else { + log(this.importConfig, `No field rules found in content type ${cTUid} to update`, 'error'); + } + } + } + + async publishEntries({ cTUid, locale }: { cTUid: string; locale: string }): Promise { + const processName = 'Publish Entries'; + const indexFileName = 'index.json'; + const basePath = path.join(this.entriesPath, cTUid, locale); + const fs = new FsUtility({ basePath, indexFileName }); + const indexer = fs.indexFileContent; + const indexerCount = values(indexer).length; + const contentType = find(this.cTs, { uid: cTUid }); + + const onSuccess = ({ response, apiData: { environments }, additionalInfo: { entryUid } }: any) => { + log( + this.importConfig, + `Published entry: '${entryUid}' of content type ${cTUid} and locale ${locale} in ${environments?.join( + ',', + )} environments`, + 'info', + ); + }; + const onReject = ({ error, apiData, additionalInfo: { entryUid } }: any) => { + log( + this.importConfig, + `${entryUid} entry of content type ${cTUid} in locale ${locale} failed to publish`, + 'error', + ); + log(this.importConfig, formatError(error), 'error'); + }; - async publishEntries(): Promise {} + for (const index in indexer) { + const chunk = await fs.readChunkFiles.next().catch((error) => { + log(this.importConfig, formatError(error), 'error'); + }); + + if (chunk) { + let apiContent = values(chunk as Record[]); + await this.makeConcurrentCall({ + apiContent, + processName, + indexerCount, + currentIndexer: +index, + apiParams: { + reject: onReject, + resolve: onSuccess, + entity: 'publish-entries', + includeParamOnCompletion: true, + serializeData: this.serializeEntries.bind(this), + additionalInfo: { contentType, locale, cTUid }, + }, + concurrencyLimit: this.importConcurrency, + }).then(() => { + log(this.importConfig, `Published entries for content type ${cTUid} in locale ${locale}`, 'success'); + }); + } + } + } + + /** + * @method serializeEntries + * @param {ApiOptions} apiOptions ApiOptions + * @returns {ApiOptions} ApiOptions + */ + serializePublishEntries(apiOptions: ApiOptions): ApiOptions { + let { apiData: entry, additionalInfo } = apiOptions; + additionalInfo.entryUid = this.entriesUidMapper[entry.uid]; + const requestObject = { + environments: [], + locales: [], + }; + if (entry.publish_details && entry.publish_details.length > 0) { + forEach(entry.publish_details, (pubObject) => { + if ( + this.envs.hasOwnProperty(pubObject.environment) && + indexOf(requestObject.environments, this.envs[pubObject.environment].name) === -1 + ) { + requestObject.environments.push(this.envs[pubObject.environment].name); + } + if (pubObject.locale && indexOf(requestObject.locales, pubObject.locale) === -1) { + requestObject.locales.push(pubObject.locale); + } + }); + } else { + additionalInfo.skip = true; + } + apiOptions.apiData = requestObject; + return apiOptions; + } } diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index f869058b3f..9d5bd0ea65 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -8,7 +8,7 @@ import config from '../config'; import * as fileHelper from './file-helper'; // update references in entry object -export const lookupEntries = function (data: any, mappedUids: string[], uidMapperPath: string) { +export const lookupEntries = function (data: any, mappedUids: Record, uidMapperPath: string) { let parent: string[] = []; let uids: string[] = []; let unmapped: string[] = []; @@ -426,3 +426,160 @@ function doEntryReferencesExist(element: Record[] | any): boolean { function isEntryRef(element: any) { return element.type === 'reference' && element.attrs.type === 'entry'; } + +export const restoreJsonRteEntryRefs = ( + entry: Record, + sourceStackEntry, + ctSchema, + { mappedAssetUids, mappedAssetUrls }, +) => { + // let mappedAssetUids = fileHelper.readFileSync(this.mappedAssetUidPath) || {}; + // let mappedAssetUrls = fileHelper.readFileSync(this.mappedAssetUrlPath) || {}; + for (const element of ctSchema) { + switch (element.data_type) { + case 'blocks': { + if (entry[element.uid]) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((e, eIndex) => { + let key = Object.keys(e).pop(); + let subBlock = element.blocks.filter((block) => block.uid === key).pop(); + let sourceStackElement = sourceStackEntry[element.uid][eIndex][key]; + e[key] = restoreJsonRteEntryRefs(e[key], sourceStackElement, subBlock.schema, { + mappedAssetUids, + mappedAssetUrls, + }); + return e; + }); + } + } + break; + } + case 'global_field': + case 'group': { + if (entry[element.uid]) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((e, eIndex) => { + let sourceStackElement = sourceStackEntry[element.uid][eIndex]; + e = restoreJsonRteEntryRefs(e, sourceStackElement, element.schema, { mappedAssetUids, mappedAssetUrls }); + return e; + }); + } else { + let sourceStackElement = sourceStackEntry[element.uid]; + entry[element.uid] = restoreJsonRteEntryRefs(entry[element.uid], sourceStackElement, element.schema, { + mappedAssetUids, + mappedAssetUrls, + }); + } + } + break; + } + case 'json': { + if (entry[element.uid] && element.field_metadata.rich_text_type) { + if (element.multiple) { + entry[element.uid] = entry[element.uid].map((field, index) => { + // i am facing a Maximum call stack exceeded issue, + // probably because of this loop operation + + let entryRefs = sourceStackEntry[element.uid][index].children + .map((e, i) => { + return { index: i, value: e }; + }) + .filter((e) => doEntryReferencesExist(e.value)) + .map((e) => { + // commenting the line below resolved the maximum call stack exceeded issue + // e.value = this.setDirtyTrue(e.value) + setDirtyTrue(e.value); + return e; + }) + .map((e) => { + // commenting the line below resolved the maximum call stack exceeded issue + // e.value = this.resolveAssetRefsInEntryRefsForJsonRte(e, mappedAssetUids, mappedAssetUrls) + resolveAssetRefsInEntryRefsForJsonRte(e.value, mappedAssetUids, mappedAssetUrls); + return e; + }); + + if (entryRefs.length > 0) { + entryRefs.forEach((entryRef) => { + field.children.splice(entryRef.index, 0, entryRef.value); + }); + } + return field; + }); + } else { + let entryRefs = sourceStackEntry[element.uid].children + .map((e, index) => { + return { index: index, value: e }; + }) + .filter((e) => doEntryReferencesExist(e.value)) + .map((e) => { + setDirtyTrue(e.value); + return e; + }) + .map((e) => { + resolveAssetRefsInEntryRefsForJsonRte(e.value, mappedAssetUids, mappedAssetUrls); + return e; + }); + + if (entryRefs.length > 0) { + entryRefs.forEach((entryRef) => { + if (!_.isEmpty(entry[element.uid]) && entry[element.uid].children) { + entry[element.uid].children.splice(entryRef.index, 0, entryRef.value); + } + }); + } + } + } + break; + } + } + } + return entry; +}; + +function setDirtyTrue(jsonRteChild: Record) { + // also removing uids in this function + if (jsonRteChild.type) { + if (_.isObject(jsonRteChild.attrs)) { + jsonRteChild.attrs['dirty'] = true; + } + delete jsonRteChild.uid; + + if (jsonRteChild.children && jsonRteChild.children.length > 0) { + jsonRteChild.children = jsonRteChild.children.map((subElement) => this.setDirtyTrue(subElement)); + } + } + return jsonRteChild; +} + +function resolveAssetRefsInEntryRefsForJsonRte(jsonRteChild, mappedAssetUids, mappedAssetUrls) { + if (jsonRteChild.type) { + if (jsonRteChild.attrs.type === 'asset') { + let assetUrl; + if (mappedAssetUids[jsonRteChild.attrs['asset-uid']]) { + jsonRteChild.attrs['asset-uid'] = mappedAssetUids[jsonRteChild.attrs['asset-uid']]; + } + + if (jsonRteChild.attrs['display-type'] !== 'link') { + assetUrl = jsonRteChild.attrs['asset-link']; + } else { + assetUrl = jsonRteChild.attrs['href']; + } + + if (mappedAssetUrls[assetUrl]) { + if (jsonRteChild.attrs['display-type'] !== 'link') { + jsonRteChild.attrs['asset-link'] = mappedAssetUrls[assetUrl]; + } else { + jsonRteChild.attrs['href'] = mappedAssetUrls[assetUrl]; + } + } + } + + if (jsonRteChild.children && jsonRteChild.children.length > 0) { + jsonRteChild.children = jsonRteChild.children.map((subElement) => + resolveAssetRefsInEntryRefsForJsonRte(subElement, mappedAssetUids, mappedAssetUrls), + ); + } + } + + return jsonRteChild; +} diff --git a/packages/contentstack-import/src/utils/index.ts b/packages/contentstack-import/src/utils/index.ts index f794713082..19cfca611e 100644 --- a/packages/contentstack-import/src/utils/index.ts +++ b/packages/contentstack-import/src/utils/index.ts @@ -20,5 +20,10 @@ export { } from './marketplace-app-helper'; export { schemaTemplate, suppressSchemaReference, removeReferenceFields } from './content-type-helper'; export { lookupExtension } from './extension-helper'; -export { lookupEntries, removeUidsFromJsonRteFields, removeEntryRefsFromJSONRTE } from './entries-helper'; +export { + lookupEntries, + removeUidsFromJsonRteFields, + removeEntryRefsFromJSONRTE, + restoreJsonRteEntryRefs, +} from './entries-helper'; export * from './common-helper'; From dd751bf603c57df6947c26c0ae604400c396db16 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Thu, 3 Aug 2023 18:54:20 +0530 Subject: [PATCH 31/52] fixed issues --- .../src/import/modules/base-class.ts | 2 +- .../src/import/modules/entries.ts | 34 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index 167d678148..4fbe6f04f0 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -351,7 +351,7 @@ export default abstract class BaseClass { .then(onSuccess) .catch(onReject); case 'update-entries': - return apiData.update().then(onSuccess).catch(onReject); + return apiData.update({ locale: additionalInfo.locale }).then(onSuccess).catch(onReject); case 'publish-entries': if (additionalInfo.skip) { return Promise.resolve(onSuccess(apiData)); diff --git a/packages/contentstack-import/src/import/modules/entries.ts b/packages/contentstack-import/src/import/modules/entries.ts index c87e1d8f96..4f001524af 100644 --- a/packages/contentstack-import/src/import/modules/entries.ts +++ b/packages/contentstack-import/src/import/modules/entries.ts @@ -152,11 +152,6 @@ export default class EntriesImport extends BaseClass { log(this.importConfig, 'Publishing entries', 'info'); this.envs = fileHelper.readFileSync(this.envPath); for (let entryRequestOption of entryRequestOptions) { - log( - this.importConfig, - `Starting publish entries for ${entryRequestOption.cTUid} in locale ${entryRequestOption.locale}`, - 'info', - ); await this.publishEntries(entryRequestOption).catch((error) => { log( this.importConfig, @@ -285,12 +280,12 @@ export default class EntriesImport extends BaseClass { }); const contentType = find(this.cTs, { uid: cTUid }); - const onSuccess = ({ response, apiData: { uid, url, title }, additionalInfo: { entryFileName } }: any) => { - log(this.importConfig, `Created entry: '${title}' of content type ${cTUid} in locale ${locale}`, 'info'); - this.entriesUidMapper[uid] = response.uid; - response.sourceEntryFilePath = path.join(basePath, entryFileName); // stores source file path temporarily - response.entryOldUid = uid; // stores old uid temporarily - entriesCreateFileHelper.writeIntoFile({ [response.uid]: response } as any, { mapKeyVal: true }); + const onSuccess = ({ response, apiData: entry, additionalInfo: { entryFileName } }: any) => { + log(this.importConfig, `Created entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`, 'info'); + this.entriesUidMapper[entry.uid] = response.uid; + entry.sourceEntryFilePath = path.join(basePath, entryFileName); // stores source file path temporarily + entry.entryOldUid = entry.uid; // stores old uid temporarily + entriesCreateFileHelper.writeIntoFile({ [response.uid]: entry } as any, { mapKeyVal: true }); }; const onReject = ({ error, apiData: { uid, title } }: any) => { log(this.importConfig, `${title} entry of content type ${cTUid} in locale ${locale} failed to create`, 'error'); @@ -353,7 +348,7 @@ export default class EntriesImport extends BaseClass { }, this.assetUidMapper, this.assetUrlMapper, - path.join(this.entriesPath, cTUid, locale), + path.join(this.entriesPath, cTUid), this.installedExtensions, ); delete entry.publish_details; @@ -394,7 +389,7 @@ export default class EntriesImport extends BaseClass { const onReject = ({ error, apiData: { uid, title } }: any) => { log(this.importConfig, `${title} entry of content type ${cTUid} in locale ${locale} failed to update`, 'error'); log(this.importConfig, formatError(error), 'error'); - this.failedEntries.push({ content_type: cTUid, locale, entry: { uid, title } }); + this.failedEntries.push({ content_type: cTUid, locale, entry: { uid: this.entriesUidMapper[uid], title } }); }; for (const index in indexer) { @@ -459,8 +454,8 @@ export default class EntriesImport extends BaseClass { path.join(this.entriesMapperPath, cTUid, locale), ); - const entryResponse = this.stack.contentType(contentType.uid).entry(entry.uid); - Object.assign(entryResponse, entry); + const entryResponse = this.stack.contentType(contentType.uid).entry(this.entriesUidMapper[entry.uid]); + Object.assign(entryResponse, cloneDeep(entry)); delete entryResponse.publish_details; apiOptions.apiData = entryResponse; return apiOptions; @@ -543,7 +538,6 @@ export default class EntriesImport extends BaseClass { } } } - const contentTypeResponse: any = await this.stack .contentType(contentType.uid) .fetch() @@ -557,6 +551,7 @@ export default class EntriesImport extends BaseClass { await contentTypeResponse.update().catch((error) => { log(this.importConfig, `failed to update the field rules of ${cTUid} ${formatError(error)}`, 'error'); }); + log(this.importConfig, `Updated the field rules of ${cTUid}`, 'info'); } else { log(this.importConfig, `No field rules found in content type ${cTUid} to update`, 'error'); } @@ -572,6 +567,11 @@ export default class EntriesImport extends BaseClass { const indexerCount = values(indexer).length; const contentType = find(this.cTs, { uid: cTUid }); + if (indexerCount === 0) { + return Promise.resolve(); + } + log(this.importConfig, `Starting publish entries for ${cTUid} in locale ${locale}`, 'info'); + const onSuccess = ({ response, apiData: { environments }, additionalInfo: { entryUid } }: any) => { log( this.importConfig, @@ -607,7 +607,7 @@ export default class EntriesImport extends BaseClass { resolve: onSuccess, entity: 'publish-entries', includeParamOnCompletion: true, - serializeData: this.serializeEntries.bind(this), + serializeData: this.serializePublishEntries.bind(this), additionalInfo: { contentType, locale, cTUid }, }, concurrencyLimit: this.importConcurrency, From 76ed1e1322048ebb012540a204398c54e181d8fe Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Fri, 4 Aug 2023 12:24:34 +0530 Subject: [PATCH 32/52] added removal of autocreated entries in masterlocale feature --- packages/contentstack-export/tsconfig.json | 2 +- .../src/import/modules/base-class.ts | 12 +++- .../src/import/modules/entries.ts | 56 +++++++++++++------ packages/contentstack-import/tsconfig.json | 2 +- 4 files changed, 52 insertions(+), 20 deletions(-) diff --git a/packages/contentstack-export/tsconfig.json b/packages/contentstack-export/tsconfig.json index da8fc4b724..5136623392 100644 --- a/packages/contentstack-export/tsconfig.json +++ b/packages/contentstack-export/tsconfig.json @@ -12,7 +12,7 @@ "skipLibCheck": true, "sourceMap": false, "esModuleInterop": true, - "noImplicitAny": false, + "noImplicitAny": true, "lib": [ "ES2019", "es2020.promise" diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index 4fbe6f04f0..f2efc86e3c 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -46,7 +46,8 @@ export type ApiModuleType = | 'create-custom-role' | 'create-entries' | 'update-entries' - | 'publish-entries'; + | 'publish-entries' + | 'delete-entries'; export type ApiOptions = { uid?: string; @@ -347,7 +348,7 @@ export default abstract class BaseClass { return this.stack .contentType(additionalInfo.cTUid) .entry() - .create({ entry: apiData }) + .create({ entry: apiData }, { locale: additionalInfo.locale }) .then(onSuccess) .catch(onReject); case 'update-entries': @@ -362,6 +363,13 @@ export default abstract class BaseClass { .publish({ publishDetails: apiData, locale: additionalInfo.locale }) .then(onSuccess) .catch(onReject); + case 'delete-entries': + return this.stack + .contentType(apiData.cTUid) + .entry(apiData.entryUid) + .delete({ locale: this.importConfig?.master_locale?.code }) + .then(onSuccess) + .catch(onReject); default: return Promise.resolve(); } diff --git a/packages/contentstack-import/src/import/modules/entries.ts b/packages/contentstack-import/src/import/modules/entries.ts index 4f001524af..129698a16c 100644 --- a/packages/contentstack-import/src/import/modules/entries.ts +++ b/packages/contentstack-import/src/import/modules/entries.ts @@ -52,6 +52,7 @@ export default class EntriesImport extends BaseClass { private locales: Record[]; private entriesUidMapper: Record; private envs: Record; + private autoCreatedEntries: Record[]; constructor({ importConfig, stackAPIClient }: ModuleClassParams) { super({ importConfig, stackAPIClient }); @@ -78,19 +79,11 @@ export default class EntriesImport extends BaseClass { this.jsonRteCTs = []; this.jsonRteCTsWithRef = []; this.envs = {}; + this.autoCreatedEntries = []; } async start(): Promise { try { - /** - * Read CTS - * Suppress CTS - * Read locales - * Create request objs - * create entries - * update entries - */ - this.cTs = fsUtil.readFile(path.join(this.cTsPath, 'schema.json')) as Record[]; if (!this.cTs || isEmpty(this.cTs)) { log(this.importConfig, 'No content type found', 'info'); @@ -132,14 +125,19 @@ export default class EntriesImport extends BaseClass { log(this.importConfig, 'Restoring content type changes', 'info'); await this.enableMandatoryCTReferences().catch((error) => { - log(this.importConfig, `failed update content type references ${formatError(error)}`, 'error'); - }); - - log(this.importConfig, 'Removing entries from master language which got created by default', 'info'); - await this.removeAutoCreatedEntries().catch((error) => { - log(this.importConfig, `failed to remove auto created entries in master locale ${formatError(error)}`, 'error'); + log(this.importConfig, `Error while updating content type references ${formatError(error)}`, 'error'); }); + if (this.autoCreatedEntries.length > 0) { + log(this.importConfig, 'Removing entries from master language which got created by default', 'info'); + await this.removeAutoCreatedEntries().catch((error) => { + log( + this.importConfig, + `Error while removing auto created entries in master locale ${formatError(error)}`, + 'error', + ); + }); + } // Update field rule of content types which are got removed earlier log(this.importConfig, 'Updating the field rules of content type', 'info'); await this.updateFieldRules().catch((error) => { @@ -269,6 +267,7 @@ export default class EntriesImport extends BaseClass { return Promise.resolve(); } log(this.importConfig, `Starting to create entries for ${cTUid} in locale ${locale}`, 'info'); + const isMasterLocale = locale === this.importConfig?.master_locale?.code; // Write created entries const entriesCreateFileHelper = new FsUtility({ moduleName: 'created-entries', @@ -285,6 +284,9 @@ export default class EntriesImport extends BaseClass { this.entriesUidMapper[entry.uid] = response.uid; entry.sourceEntryFilePath = path.join(basePath, entryFileName); // stores source file path temporarily entry.entryOldUid = entry.uid; // stores old uid temporarily + if (!isMasterLocale) { + this.autoCreatedEntries.push({ cTUid, locale, entryUid: response.uid }); + } entriesCreateFileHelper.writeIntoFile({ [response.uid]: entry } as any, { mapKeyVal: true }); }; const onReject = ({ error, apiData: { uid, title } }: any) => { @@ -508,7 +510,29 @@ export default class EntriesImport extends BaseClass { return apiOptions; } - async removeAutoCreatedEntries(): Promise {} + async removeAutoCreatedEntries(): Promise { + const onSuccess = ({ response, apiData: { entryUid } }: any) => { + log(this.importConfig, `Auto created entry in master locale removed - entry uid ${entryUid} `, 'success'); + }; + const onReject = ({ error, apiData: { entryUid } }: any) => { + log( + this.importConfig, + `Failed to remove auto created entry in master locale - entry uid ${entryUid} \n ${formatError(error)}`, + 'error', + ); + }; + return await this.makeConcurrentCall({ + processName: 'Remove auto created entry in master locale', + apiContent: this.autoCreatedEntries, + apiParams: { + reject: onReject.bind(this), + resolve: onSuccess.bind(this), + entity: 'delete-entries', + includeParamOnCompletion: true, + }, + concurrencyLimit: this.importConcurrency, + }); + } async updateFieldRules(): Promise { let cTsWithFieldRules = fsUtil.readFile(path.join(this.cTsPath + '/field_rules_uid.json')) as Record[]; diff --git a/packages/contentstack-import/tsconfig.json b/packages/contentstack-import/tsconfig.json index 44beaaf137..679afbeaf5 100644 --- a/packages/contentstack-import/tsconfig.json +++ b/packages/contentstack-import/tsconfig.json @@ -11,7 +11,7 @@ "skipLibCheck": true, "sourceMap": false, "esModuleInterop": true, - "noImplicitAny": false, + "noImplicitAny": true, "lib": [ "es2019", "es2020.promise", From 9683a64f6f9bf441b678c579c8769ea37b6ec4bc Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Thu, 3 Aug 2023 14:36:25 +0530 Subject: [PATCH 33/52] fix: export plugin test cases --- packages/contentstack-export/package.json | 1 + .../src/export/modules/locales.ts | 3 ++- .../test/integration/custom-roles.test.js | 4 ---- .../test/integration/global-fields.test.js | 20 ++++++++----------- .../test/integration/locales.test.js | 3 --- .../test/integration/marketplace-apps.test.js | 2 +- .../test/integration/webhooks.test.js | 4 ---- .../test/integration/workflows.test.js | 20 ++++++++----------- 8 files changed, 20 insertions(+), 37 deletions(-) diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index e9a1149102..f109661ef1 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -62,6 +62,7 @@ "lint": "eslint src/**/*.ts", "format": "eslint src/**/*.ts --fix", "test:integration": "INTEGRATION_TEST=true mocha --config ./test/.mocharc.js --forbid-only \"test/run.test.js\"", + "test:integration:report": "INTEGRATION_TEST=true nyc --extension .js mocha --config ./test/.mocharc.js --forbid-only \"test/run.test.js\"", "test:unit": "mocha --forbid-only \"test/unit/*.test.ts\"" }, "engines": { diff --git a/packages/contentstack-export/src/export/modules/locales.ts b/packages/contentstack-export/src/export/modules/locales.ts index 365efc78d4..5043882215 100644 --- a/packages/contentstack-export/src/export/modules/locales.ts +++ b/packages/contentstack-export/src/export/modules/locales.ts @@ -81,7 +81,8 @@ export default class LocaleExport extends BaseClass { delete locale[key]; } } - if (locale.code === this.exportConfig.master_locale.code) { + + if (locale?.code === this.exportConfig?.master_locale?.code) { this.masterLocale[locale.uid] = locale; } else { this.locales[locale.uid] = locale; diff --git a/packages/contentstack-export/test/integration/custom-roles.test.js b/packages/contentstack-export/test/integration/custom-roles.test.js index a2dd74c16f..eab4871ebc 100644 --- a/packages/contentstack-export/test/integration/custom-roles.test.js +++ b/packages/contentstack-export/test/integration/custom-roles.test.js @@ -17,10 +17,6 @@ module.exports = (region) => { : path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`); const customRolesBasePath = path.join(exportBasePath, modules.customRoles.dirName); const customRolesJson = path.join(customRolesBasePath, modules.customRoles.fileName); - const messageFilePath = path.join(__dirname, '..', '..', 'messages/index.json'); - - messageHandler.init({ messageFilePath }); - const { promptMessageList } = require(messageFilePath); describe('ContentStack-Export custom-roles', () => { describe('cm:stacks:export custom-roles [auth-token]', () => { diff --git a/packages/contentstack-export/test/integration/global-fields.test.js b/packages/contentstack-export/test/integration/global-fields.test.js index 8d7ada352e..a6a0fa3323 100644 --- a/packages/contentstack-export/test/integration/global-fields.test.js +++ b/packages/contentstack-export/test/integration/global-fields.test.js @@ -1,10 +1,9 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const path = require('path'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getGlobalFieldsCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -18,20 +17,17 @@ module.exports = (region) => { : path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`); const globalFieldsBasePath = path.join(exportBasePath, modules.globalfields.dirName); const globalFieldsJson = path.join(globalFieldsBasePath, modules.globalfields.fileName); - const messageFilePath = path.join(__dirname, '..', '..', 'messages/index.json'); - - messageHandler.init({ messageFilePath }); - const { promptMessageList } = require(messageFilePath); describe('ContentStack-Export global-fields', () => { describe('cm:stacks:export global-fields [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -85,9 +81,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; diff --git a/packages/contentstack-export/test/integration/locales.test.js b/packages/contentstack-export/test/integration/locales.test.js index 03d42c115d..d0e95fd217 100644 --- a/packages/contentstack-export/test/integration/locales.test.js +++ b/packages/contentstack-export/test/integration/locales.test.js @@ -18,9 +18,6 @@ module.exports = (region) => { const localeBasePath = path.join(exportBasePath, modules.locales.dirName); const localeJson = path.join(localeBasePath, modules.locales.fileName); - const messageFilePath = path.join(__dirname, '..', '..', 'messages/index.json'); - messageHandler.init({ messageFilePath }); - const { promptMessageList } = require(messageFilePath); describe('ContentStack-Export locales', () => { describe('cm:stacks:export locales [auth-token]', () => { diff --git a/packages/contentstack-export/test/integration/marketplace-apps.test.js b/packages/contentstack-export/test/integration/marketplace-apps.test.js index 5ee81acf39..2c224d9d1e 100644 --- a/packages/contentstack-export/test/integration/marketplace-apps.test.js +++ b/packages/contentstack-export/test/integration/marketplace-apps.test.js @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); const { test } = require('@oclif/test'); -const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); +const { cliux: cliUX } = require('@contentstack/cli-utilities'); const { default: config } = require('../../lib/config'); const modules = config.modules; diff --git a/packages/contentstack-export/test/integration/webhooks.test.js b/packages/contentstack-export/test/integration/webhooks.test.js index f1705a8af9..14fc5ccac3 100644 --- a/packages/contentstack-export/test/integration/webhooks.test.js +++ b/packages/contentstack-export/test/integration/webhooks.test.js @@ -17,10 +17,6 @@ module.exports = (region) => { : path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`); const webhooksBasePath = path.join(exportBasePath, modules.webhooks.dirName); const webhooksJson = path.join(webhooksBasePath, modules.webhooks.fileName); - const messageFilePath = path.join(__dirname, '..', '..', 'messages/index.json'); - - messageHandler.init({ messageFilePath }); - const { promptMessageList } = require(messageFilePath); describe('ContentStack-Export webhooks', () => { describe('cm:stacks:export webhooks [auth-token]', () => { diff --git a/packages/contentstack-export/test/integration/workflows.test.js b/packages/contentstack-export/test/integration/workflows.test.js index 4fc624915c..f9e40564e3 100644 --- a/packages/contentstack-export/test/integration/workflows.test.js +++ b/packages/contentstack-export/test/integration/workflows.test.js @@ -1,10 +1,9 @@ -let defaultConfig = require('../../src/config/default'); const fs = require('fs'); const path = require('path'); const { test } = require('@oclif/test'); const { cliux: cliUX, messageHandler } = require('@contentstack/cli-utilities'); -const { default: config } = require('../../src/config'); +const { default: config } = require('../../lib/config'); const modules = config.modules; const { getStackDetailsByRegion, getWorkflowsCount, cleanUp, checkCounts } = require('./utils/helper'); const { EXPORT_PATH, DEFAULT_TIMEOUT } = require('./config.json'); @@ -18,20 +17,17 @@ module.exports = (region) => { : path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`); const workflowsBasePath = path.join(exportBasePath, modules.workflows.dirName); const workflowsJson = path.join(workflowsBasePath, modules.workflows.fileName); - const messageFilePath = path.join(__dirname, '..', '..', 'messages/index.json'); - - messageHandler.init({ messageFilePath }); - const { promptMessageList } = require(messageFilePath); describe('ContentStack-Export workflows', () => { describe('cm:stacks:export workfows [auth-token]', () => { test .timeout(DEFAULT_TIMEOUT || 600000) // NOTE setting default timeout as 10 minutes - .stub(cliUX, 'prompt', async (name) => { + .stub(cliUX, 'inquire', async (input) => { + const { name } = input; switch (name) { - case promptMessageList.promptSourceStack: + case 'apiKey': return stackDetails[stack].STACK_API_KEY; - case promptMessageList.promptPathStoredData: + case 'dir': return `${EXPORT_PATH}_${stack}`; } }) @@ -85,9 +81,9 @@ module.exports = (region) => { afterEach(async () => { await cleanUp(path.join(__dirname, '..', '..', `${EXPORT_PATH}_${stack}`)); - defaultConfig.management_token = undefined; - defaultConfig.branch = undefined; - defaultConfig.branches = []; + config.management_token = undefined; + config.branch = undefined; + config.branches = []; }); } }; From 4bec25c5f993a8e0ecd56d04cba8e4c97439343b Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Thu, 3 Aug 2023 15:21:12 +0530 Subject: [PATCH 34/52] refactor: test report --- packages/contentstack-export/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index f109661ef1..6534551533 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -62,7 +62,7 @@ "lint": "eslint src/**/*.ts", "format": "eslint src/**/*.ts --fix", "test:integration": "INTEGRATION_TEST=true mocha --config ./test/.mocharc.js --forbid-only \"test/run.test.js\"", - "test:integration:report": "INTEGRATION_TEST=true nyc --extension .js mocha --config ./test/.mocharc.js --forbid-only \"test/run.test.js\"", + "test:integration:report": "INTEGRATION_TEST=true nyc --extension .js mocha --forbid-only \"test/run.test.js\"", "test:unit": "mocha --forbid-only \"test/unit/*.test.ts\"" }, "engines": { From 05249079a0260940cfb05960a55f6c558e50f8b9 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Mon, 7 Aug 2023 12:57:12 +0530 Subject: [PATCH 35/52] fix: stack module rewrite --- packages/contentstack-export/src/export/modules/stack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contentstack-export/src/export/modules/stack.ts b/packages/contentstack-export/src/export/modules/stack.ts index c98a87bc8a..8e7890f710 100644 --- a/packages/contentstack-export/src/export/modules/stack.ts +++ b/packages/contentstack-export/src/export/modules/stack.ts @@ -23,7 +23,7 @@ export default class ExportStack extends BaseClass { } async start(): Promise { - if (isAuthenticated) { + if (isAuthenticated()) { const stackData = await this.getStack(); if (stackData?.org_uid) { this.exportConfig.org_uid = stackData.org_uid; From b227fa9cf91ad90aa64a8f025a489e9d37c5fcf3 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Mon, 7 Aug 2023 13:52:25 +0530 Subject: [PATCH 36/52] fix: mg token with login issue --- packages/contentstack-export/src/export/modules/stack.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-export/src/export/modules/stack.ts b/packages/contentstack-export/src/export/modules/stack.ts index 8e7890f710..e05ddffcee 100644 --- a/packages/contentstack-export/src/export/modules/stack.ts +++ b/packages/contentstack-export/src/export/modules/stack.ts @@ -1,6 +1,6 @@ import find from 'lodash/find'; import { resolve as pResolve } from 'node:path'; -import { isAuthenticated } from '@contentstack/cli-utilities'; +import { isAuthenticated, managementSDKClient } from '@contentstack/cli-utilities'; import config from '../../config'; import BaseClass from './base-class'; @@ -39,7 +39,11 @@ export default class ExportStack extends BaseClass { } async getStack(): Promise { - return await this.stack.fetch().catch((error: any) => { + const tempAPIClient = await managementSDKClient({ host: this.exportConfig.host }); + return await tempAPIClient + .stack({ api_key: this.exportConfig.source_stack }) + .fetch() + .catch((error: any) => { log(this.exportConfig, `Failed to export stack. ${formatError(error)}`, 'error'); }); } From 59cb5df2c2306ff805eb48182d13031420e98296 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Mon, 7 Aug 2023 16:12:16 +0530 Subject: [PATCH 37/52] fix: handle workflow & webhook error --- packages/contentstack-export/src/export/modules/webhooks.ts | 2 +- packages/contentstack-export/src/export/modules/workflows.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-export/src/export/modules/webhooks.ts b/packages/contentstack-export/src/export/modules/webhooks.ts index f7662dd186..77b7b99e4f 100644 --- a/packages/contentstack-export/src/export/modules/webhooks.ts +++ b/packages/contentstack-export/src/export/modules/webhooks.ts @@ -62,7 +62,7 @@ export default class ExportWebhooks extends BaseClass { return await this.getWebhooks(skip); } }) - .catch(({ error }: any) => { + .catch((error: any) => { log(this.exportConfig, `Failed to export webhooks.${formatError(error)}`, 'error'); log(this.exportConfig, error, 'error'); }); diff --git a/packages/contentstack-export/src/export/modules/workflows.ts b/packages/contentstack-export/src/export/modules/workflows.ts index e78cbe4cf8..cdce55e359 100644 --- a/packages/contentstack-export/src/export/modules/workflows.ts +++ b/packages/contentstack-export/src/export/modules/workflows.ts @@ -62,7 +62,7 @@ export default class ExportWorkFlows extends BaseClass { return await this.getWorkflows(skip); } }) - .catch(({ error }: any) => { + .catch((error: any) => { log(this.exportConfig, `Failed to export workflows.${formatError(error)}`, 'error'); log(this.exportConfig, error, 'error'); }); From 575a582e5c5e58f625f9cd34bb8b61cffcaeb41e Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 8 Aug 2023 11:16:05 +0530 Subject: [PATCH 38/52] fix: import-webhook-status flag issue --- packages/contentstack-import/src/utils/import-config-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contentstack-import/src/utils/import-config-handler.ts b/packages/contentstack-import/src/utils/import-config-handler.ts index 6bab5151ef..f02681ce4b 100644 --- a/packages/contentstack-import/src/utils/import-config-handler.ts +++ b/packages/contentstack-import/src/utils/import-config-handler.ts @@ -56,7 +56,7 @@ const setupConfig = async (importCmdFlags: any): Promise => { //Note to support the old key config.source_stack = config.apiKey; - config.importWebhookStatus = importCmdFlags.importWebhookStatus; + config.importWebhookStatus = importCmdFlags['import-webhook-status']; config.forceStopMarketplaceAppsPrompt = importCmdFlags.yes; if (importCmdFlags['branch']) { From 5347da8660b0e5d95ffe9565ebee4a7034b390d9 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Wed, 9 Aug 2023 12:15:43 +0530 Subject: [PATCH 39/52] fixed type issues --- .../src/import/modules/entries.ts | 9 ++-- .../src/utils/entries-helper.ts | 46 +++++++++---------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/packages/contentstack-import/src/import/modules/entries.ts b/packages/contentstack-import/src/import/modules/entries.ts index 129698a16c..2d711d9afa 100644 --- a/packages/contentstack-import/src/import/modules/entries.ts +++ b/packages/contentstack-import/src/import/modules/entries.ts @@ -435,7 +435,7 @@ export default class EntriesImport extends BaseClass { try { const sourceEntryFilePath = entry.sourceEntryFilePath; - const sourceEntry = (fsUtil.readFile(sourceEntryFilePath) || {})[entry.entryOldUid]; + const sourceEntry = ((fsUtil.readFile(sourceEntryFilePath) || {}) as Record)[entry.entryOldUid]; // Removing temp values delete entry.sourceEntryFilePath; delete entry.entryOldUid; @@ -572,7 +572,7 @@ export default class EntriesImport extends BaseClass { continue; } contentTypeResponse.field_rules = contentType.field_rules; - await contentTypeResponse.update().catch((error) => { + await contentTypeResponse.update().catch((error: Error) => { log(this.importConfig, `failed to update the field rules of ${cTUid} ${formatError(error)}`, 'error'); }); log(this.importConfig, `Updated the field rules of ${cTUid}`, 'info'); @@ -650,7 +650,10 @@ export default class EntriesImport extends BaseClass { serializePublishEntries(apiOptions: ApiOptions): ApiOptions { let { apiData: entry, additionalInfo } = apiOptions; additionalInfo.entryUid = this.entriesUidMapper[entry.uid]; - const requestObject = { + const requestObject: { + environments: Array; + locales: Array; + } = { environments: [], locales: [], }; diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index 9d5bd0ea65..c0d56d42ce 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -268,7 +268,7 @@ export const removeUidsFromJsonRteFields = ( case 'group': { if (entry[element.uid]) { if (element.multiple) { - entry[element.uid] = entry[element.uid].map((e) => { + entry[element.uid] = entry[element.uid].map((e: any) => { e = removeUidsFromJsonRteFields(e, element.schema); return e; }); @@ -362,7 +362,7 @@ export const removeEntryRefsFromJSONRTE = (entry: Record, ctSchema: case 'group': { if (entry[element.uid]) { if (element.multiple) { - entry[element.uid] = entry[element.uid].map((e) => { + entry[element.uid] = entry[element.uid].map((e: any) => { e = removeEntryRefsFromJSONRTE(e, element.schema); return e; }); @@ -429,9 +429,9 @@ function isEntryRef(element: any) { export const restoreJsonRteEntryRefs = ( entry: Record, - sourceStackEntry, - ctSchema, - { mappedAssetUids, mappedAssetUrls }, + sourceStackEntry: any, + ctSchema: any, + { mappedAssetUids, mappedAssetUrls }: any, ) => { // let mappedAssetUids = fileHelper.readFileSync(this.mappedAssetUidPath) || {}; // let mappedAssetUrls = fileHelper.readFileSync(this.mappedAssetUrlPath) || {}; @@ -440,9 +440,9 @@ export const restoreJsonRteEntryRefs = ( case 'blocks': { if (entry[element.uid]) { if (element.multiple) { - entry[element.uid] = entry[element.uid].map((e, eIndex) => { + entry[element.uid] = entry[element.uid].map((e: any, eIndex: number) => { let key = Object.keys(e).pop(); - let subBlock = element.blocks.filter((block) => block.uid === key).pop(); + let subBlock = element.blocks.filter((block: any) => block.uid === key).pop(); let sourceStackElement = sourceStackEntry[element.uid][eIndex][key]; e[key] = restoreJsonRteEntryRefs(e[key], sourceStackElement, subBlock.schema, { mappedAssetUids, @@ -458,7 +458,7 @@ export const restoreJsonRteEntryRefs = ( case 'group': { if (entry[element.uid]) { if (element.multiple) { - entry[element.uid] = entry[element.uid].map((e, eIndex) => { + entry[element.uid] = entry[element.uid].map((e: any, eIndex: number) => { let sourceStackElement = sourceStackEntry[element.uid][eIndex]; e = restoreJsonRteEntryRefs(e, sourceStackElement, element.schema, { mappedAssetUids, mappedAssetUrls }); return e; @@ -476,22 +476,22 @@ export const restoreJsonRteEntryRefs = ( case 'json': { if (entry[element.uid] && element.field_metadata.rich_text_type) { if (element.multiple) { - entry[element.uid] = entry[element.uid].map((field, index) => { + entry[element.uid] = entry[element.uid].map((field: any, index: number) => { // i am facing a Maximum call stack exceeded issue, // probably because of this loop operation let entryRefs = sourceStackEntry[element.uid][index].children - .map((e, i) => { + .map((e: any, i: number) => { return { index: i, value: e }; }) - .filter((e) => doEntryReferencesExist(e.value)) - .map((e) => { + .filter((e: any) => doEntryReferencesExist(e.value)) + .map((e: any) => { // commenting the line below resolved the maximum call stack exceeded issue // e.value = this.setDirtyTrue(e.value) setDirtyTrue(e.value); return e; }) - .map((e) => { + .map((e: any) => { // commenting the line below resolved the maximum call stack exceeded issue // e.value = this.resolveAssetRefsInEntryRefsForJsonRte(e, mappedAssetUids, mappedAssetUrls) resolveAssetRefsInEntryRefsForJsonRte(e.value, mappedAssetUids, mappedAssetUrls); @@ -499,7 +499,7 @@ export const restoreJsonRteEntryRefs = ( }); if (entryRefs.length > 0) { - entryRefs.forEach((entryRef) => { + entryRefs.forEach((entryRef: any) => { field.children.splice(entryRef.index, 0, entryRef.value); }); } @@ -507,21 +507,21 @@ export const restoreJsonRteEntryRefs = ( }); } else { let entryRefs = sourceStackEntry[element.uid].children - .map((e, index) => { + .map((e: any, index: number) => { return { index: index, value: e }; }) - .filter((e) => doEntryReferencesExist(e.value)) - .map((e) => { + .filter((e: any) => doEntryReferencesExist(e.value)) + .map((e: any) => { setDirtyTrue(e.value); return e; }) - .map((e) => { + .map((e: any) => { resolveAssetRefsInEntryRefsForJsonRte(e.value, mappedAssetUids, mappedAssetUrls); return e; }); if (entryRefs.length > 0) { - entryRefs.forEach((entryRef) => { + entryRefs.forEach((entryRef: any) => { if (!_.isEmpty(entry[element.uid]) && entry[element.uid].children) { entry[element.uid].children.splice(entryRef.index, 0, entryRef.value); } @@ -536,7 +536,7 @@ export const restoreJsonRteEntryRefs = ( return entry; }; -function setDirtyTrue(jsonRteChild: Record) { +function setDirtyTrue(jsonRteChild: any) { // also removing uids in this function if (jsonRteChild.type) { if (_.isObject(jsonRteChild.attrs)) { @@ -545,13 +545,13 @@ function setDirtyTrue(jsonRteChild: Record) { delete jsonRteChild.uid; if (jsonRteChild.children && jsonRteChild.children.length > 0) { - jsonRteChild.children = jsonRteChild.children.map((subElement) => this.setDirtyTrue(subElement)); + jsonRteChild.children = jsonRteChild.children.map((subElement: any) => this.setDirtyTrue(subElement)); } } return jsonRteChild; } -function resolveAssetRefsInEntryRefsForJsonRte(jsonRteChild, mappedAssetUids, mappedAssetUrls) { +function resolveAssetRefsInEntryRefsForJsonRte(jsonRteChild: any, mappedAssetUids: any, mappedAssetUrls: any) { if (jsonRteChild.type) { if (jsonRteChild.attrs.type === 'asset') { let assetUrl; @@ -575,7 +575,7 @@ function resolveAssetRefsInEntryRefsForJsonRte(jsonRteChild, mappedAssetUids, ma } if (jsonRteChild.children && jsonRteChild.children.length > 0) { - jsonRteChild.children = jsonRteChild.children.map((subElement) => + jsonRteChild.children = jsonRteChild.children.map((subElement: any) => resolveAssetRefsInEntryRefsForJsonRte(subElement, mappedAssetUids, mappedAssetUrls), ); } From 72f9da4cf2fc13f5471cf25dcfec3fd6ce0c55e6 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Wed, 9 Aug 2023 18:17:28 +0530 Subject: [PATCH 40/52] fix --- .../src/import/modules/entries.ts | 54 +++++++++---------- .../src/utils/entries-helper.ts | 2 +- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/packages/contentstack-import/src/import/modules/entries.ts b/packages/contentstack-import/src/import/modules/entries.ts index 2d711d9afa..cf84edfe08 100644 --- a/packages/contentstack-import/src/import/modules/entries.ts +++ b/packages/contentstack-import/src/import/modules/entries.ts @@ -433,37 +433,33 @@ export default class EntriesImport extends BaseClass { additionalInfo: { cTUid, locale, contentType }, } = apiOptions; - try { - const sourceEntryFilePath = entry.sourceEntryFilePath; - const sourceEntry = ((fsUtil.readFile(sourceEntryFilePath) || {}) as Record)[entry.entryOldUid]; - // Removing temp values - delete entry.sourceEntryFilePath; - delete entry.entryOldUid; - if (this.jsonRteCTs.indexOf(cTUid) > -1) { - // the entries stored in eSuccessFilePath, have the same uids as the entries from source data - entry = restoreJsonRteEntryRefs(entry, sourceEntry, contentType.schema, { - mappedAssetUids: this.assetUidMapper, - mappedAssetUrls: this.assetUrlMapper, - }); - } + const sourceEntryFilePath = entry.sourceEntryFilePath; + const sourceEntry = ((fsUtil.readFile(sourceEntryFilePath) || {}) as Record)[entry.entryOldUid]; + // Removing temp values + delete entry.sourceEntryFilePath; + delete entry.entryOldUid; + if (this.jsonRteCTs.indexOf(cTUid) > -1) { + // the entries stored in eSuccessFilePath, have the same uids as the entries from source data + entry = restoreJsonRteEntryRefs(entry, sourceEntry, contentType.schema, { + mappedAssetUids: this.assetUidMapper, + mappedAssetUrls: this.assetUrlMapper, + }); + } - entry = lookupEntries( - { - content_type: contentType, - entry, - }, - this.entriesUidMapper, - path.join(this.entriesMapperPath, cTUid, locale), - ); + entry = lookupEntries( + { + content_type: contentType, + entry, + }, + this.entriesUidMapper, + path.join(this.entriesMapperPath, cTUid, locale), + ); - const entryResponse = this.stack.contentType(contentType.uid).entry(this.entriesUidMapper[entry.uid]); - Object.assign(entryResponse, cloneDeep(entry)); - delete entryResponse.publish_details; - apiOptions.apiData = entryResponse; - return apiOptions; - } catch (error) { - console.log('error', error); - } + const entryResponse = this.stack.contentType(contentType.uid).entry(this.entriesUidMapper[entry.uid]); + Object.assign(entryResponse, cloneDeep(entry)); + delete entryResponse.publish_details; + apiOptions.apiData = entryResponse; + return apiOptions; } async enableMandatoryCTReferences(): Promise { diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index c0d56d42ce..acca676921 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -90,7 +90,7 @@ export const lookupEntries = function (data: any, mappedUids: Record Date: Wed, 9 Aug 2023 18:21:54 +0530 Subject: [PATCH 41/52] rewrite changes --- packages/contentstack-export/src/config/index.ts | 4 ++-- packages/contentstack-import/src/config/index.ts | 2 +- pnpm-lock.yaml | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index 92edaa0001..52a0bd214b 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -381,7 +381,7 @@ const config: DefaultConfig = { 'content-types', 'entries', 'workflows', - 'stack' + 'stack', ], apis: { userSession: '/user-session/', @@ -402,7 +402,7 @@ const config: DefaultConfig = { writeConcurrency: 5, developerHubBaseUrl: '', marketplaceAppEncryptionKey: 'nF2ejRQcTv', - useNewModuleStructure: true, + useNewModuleStructure: false, }; export default config; diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 4a5621fd05..63fb403e5f 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -390,7 +390,7 @@ const config: DefaultConfig = { developerHubBaseUrl: '', marketplaceAppEncryptionKey: 'nF2ejRQcTv', getEncryptionKeyMaxRetry: 3, - useNewModuleStructure: true, + useNewModuleStructure: false, // useBackedupDir: '', // backupConcurrency: 10, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 81635a510c..95f69d7249 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4186,6 +4186,16 @@ packages: xml2js: 0.5.0 dev: true + /axios/0.27.2: + resolution: + { integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== } + dependencies: + follow-redirects: 1.15.2 + form-data: 4.0.0 + transitivePeerDependencies: + - debug + dev: false + /axios/0.27.2_debug@4.3.4: resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} dependencies: From fbda94a7dcf845f8ae8713c8d902c6709a326f8d Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Thu, 10 Aug 2023 12:23:58 +0530 Subject: [PATCH 42/52] entries update --- .../src/export/modules-js/entries.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/packages/contentstack-export/src/export/modules-js/entries.js b/packages/contentstack-export/src/export/modules-js/entries.js index c9be167646..e3aaf126e0 100644 --- a/packages/contentstack-export/src/export/modules-js/entries.js +++ b/packages/contentstack-export/src/export/modules-js/entries.js @@ -194,25 +194,6 @@ class EntriesExport { }); return entriesList; } - - async getEntryByVersion(requestOptions, version, entries = []) { - const queryRequestObject = { - locale: requestOptions.locale, - except: { - BASE: this.entriesConfig.invalidKeys, - }, - version, - }; - const entryResponse = await this.stackAPIClient - .contentType(requestOptions.content_type) - .entry(requestOptions.uid) - .fetch(queryRequestObject); - entries.push(entryResponse); - if (--version > 0) { - return await this.getEntryByVersion(requestOptions, version, entries); - } - return entries; - } } module.exports = EntriesExport; From c77bed35c66b2ff66d40bf25548dfc6cf107b275 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Thu, 10 Aug 2023 12:33:15 +0530 Subject: [PATCH 43/52] version bumps --- packages/contentstack-bootstrap/package.json | 6 +++--- packages/contentstack-clone/package.json | 8 ++++---- packages/contentstack-export/package.json | 2 +- packages/contentstack-import/package.json | 2 +- packages/contentstack-seed/package.json | 6 +++--- packages/contentstack/package.json | 12 ++++++------ 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/contentstack-bootstrap/package.json b/packages/contentstack-bootstrap/package.json index e546973d9b..06c4cdd767 100644 --- a/packages/contentstack-bootstrap/package.json +++ b/packages/contentstack-bootstrap/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-bootstrap", "description": "Bootstrap contentstack apps", - "version": "1.4.13", + "version": "1.4.14", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "scripts": { @@ -17,7 +17,7 @@ "test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\"" }, "dependencies": { - "@contentstack/cli-cm-seed": "^1.4.13", + "@contentstack/cli-cm-seed": "^1.4.14", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "inquirer": "8.2.4", @@ -73,4 +73,4 @@ } }, "repository": "contentstack/cli" -} +} \ No newline at end of file diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index 995abce831..e51a68af42 100644 --- a/packages/contentstack-clone/package.json +++ b/packages/contentstack-clone/package.json @@ -1,12 +1,12 @@ { "name": "@contentstack/cli-cm-clone", "description": "Contentstack stack clone plugin", - "version": "1.4.14", + "version": "1.4.15", "author": "Contentstack", "bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues", "dependencies": { - "@contentstack/cli-cm-export": "^1.7.0", - "@contentstack/cli-cm-import": "^1.7.1", + "@contentstack/cli-cm-export": "~1.8.0", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@colors/colors": "^1.5.0", @@ -70,4 +70,4 @@ "cm:stack-clone": "O-CLN" } } -} +} \ No newline at end of file diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index 6534551533..5405c86dda 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-export", "description": "Contentstack CLI plugin to export content from stack", - "version": "1.7.0", + "version": "1.8.0", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 86c110ed3c..24b6dd6e5b 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-import", "description": "Contentstack CLI plugin to import content into stack", - "version": "1.7.1", + "version": "1.8.0", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-seed/package.json b/packages/contentstack-seed/package.json index fdf6c95164..224d57c3ba 100644 --- a/packages/contentstack-seed/package.json +++ b/packages/contentstack-seed/package.json @@ -1,11 +1,11 @@ { "name": "@contentstack/cli-cm-seed", "description": "create a Stack from existing content types, entries, assets, etc.", - "version": "1.4.13", + "version": "1.4.14", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "axios": "1.3.4", @@ -73,4 +73,4 @@ "version": "oclif readme && git add README.md", "clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo" } -} +} \ No newline at end of file diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index 3c23a47762..e9077783c1 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli", "description": "Command-line tool (CLI) to interact with Contentstack", - "version": "1.7.12", + "version": "1.8.0", "author": "Contentstack", "bin": { "csdx": "./bin/run" @@ -23,14 +23,14 @@ }, "dependencies": { "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.13", + "@contentstack/cli-cm-bootstrap": "^1.4.14", "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.14", - "@contentstack/cli-cm-export": "^1.7.0", + "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-export-to-csv": "^1.3.12", - "@contentstack/cli-cm-import": "^1.7.1", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.13", + "@contentstack/cli-cm-seed": "^1.4.14", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-config": "^1.4.10", "@contentstack/cli-launch": "^1.0.10", From 2757fbcb647b87a854aa81d75eba8262683ad50f Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Thu, 10 Aug 2023 13:43:29 +0530 Subject: [PATCH 44/52] version bump --- package-lock.json | 48 ++++++++++---------- packages/contentstack-auth/README.md | 2 +- packages/contentstack-bootstrap/README.md | 2 +- packages/contentstack-branches/README.md | 2 +- packages/contentstack-bulk-publish/README.md | 2 +- packages/contentstack-clone/README.md | 2 +- packages/contentstack-config/README.md | 2 +- packages/contentstack-export/README.md | 2 +- packages/contentstack-import/README.md | 2 +- packages/contentstack-launch/README.md | 2 +- packages/contentstack-migrate-rte/README.md | 2 +- packages/contentstack-migration/README.md | 2 +- packages/contentstack/README.md | 2 +- pnpm-lock.yaml | 28 ++++-------- 14 files changed, 45 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index 971d7b0e09..4cd2869217 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20298,19 +20298,19 @@ }, "packages/contentstack": { "name": "@contentstack/cli", - "version": "1.7.12", + "version": "1.8.0", "license": "MIT", "dependencies": { "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.13", + "@contentstack/cli-cm-bootstrap": "^1.4.14", "@contentstack/cli-cm-branches": "^1.0.10", "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.14", - "@contentstack/cli-cm-export": "^1.7.0", + "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-export-to-csv": "^1.3.12", - "@contentstack/cli-cm-import": "^1.7.1", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.13", + "@contentstack/cli-cm-seed": "^1.4.14", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-config": "^1.4.10", "@contentstack/cli-launch": "^1.0.10", @@ -20406,10 +20406,10 @@ }, "packages/contentstack-bootstrap": { "name": "@contentstack/cli-cm-bootstrap", - "version": "1.4.13", + "version": "1.4.14", "license": "MIT", "dependencies": { - "@contentstack/cli-cm-seed": "^1.4.13", + "@contentstack/cli-cm-seed": "^1.4.14", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "inquirer": "8.2.4", @@ -20597,12 +20597,12 @@ }, "packages/contentstack-clone": { "name": "@contentstack/cli-cm-clone", - "version": "1.4.14", + "version": "1.4.15", "license": "MIT", "dependencies": { "@colors/colors": "^1.5.0", - "@contentstack/cli-cm-export": "^1.7.0", - "@contentstack/cli-cm-import": "^1.7.1", + "@contentstack/cli-cm-export": "~1.8.0", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "async": "^3.2.4", @@ -21021,7 +21021,7 @@ }, "packages/contentstack-export": { "name": "@contentstack/cli-cm-export", - "version": "1.7.0", + "version": "1.8.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.11", @@ -21323,7 +21323,7 @@ }, "packages/contentstack-import": { "name": "@contentstack/cli-cm-import", - "version": "1.7.1", + "version": "1.8.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.11", @@ -22020,10 +22020,10 @@ }, "packages/contentstack-seed": { "name": "@contentstack/cli-cm-seed", - "version": "1.4.13", + "version": "1.4.14", "license": "MIT", "dependencies": { - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "axios": "1.3.4", @@ -23702,15 +23702,15 @@ "version": "file:packages/contentstack", "requires": { "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.13", + "@contentstack/cli-cm-bootstrap": "^1.4.14", "@contentstack/cli-cm-branches": "^1.0.10", "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.14", - "@contentstack/cli-cm-export": "^1.7.0", + "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-export-to-csv": "^1.3.12", - "@contentstack/cli-cm-import": "^1.7.1", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.13", + "@contentstack/cli-cm-seed": "^1.4.14", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-config": "^1.4.10", "@contentstack/cli-launch": "^1.0.10", @@ -23792,7 +23792,7 @@ "@contentstack/cli-cm-bootstrap": { "version": "file:packages/contentstack-bootstrap", "requires": { - "@contentstack/cli-cm-seed": "^1.4.13", + "@contentstack/cli-cm-seed": "^1.4.14", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@oclif/test": "^2.2.10", @@ -23948,8 +23948,8 @@ "version": "file:packages/contentstack-clone", "requires": { "@colors/colors": "^1.5.0", - "@contentstack/cli-cm-export": "^1.7.0", - "@contentstack/cli-cm-import": "^1.7.1", + "@contentstack/cli-cm-export": "~1.8.0", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@oclif/test": "^1.2.7", @@ -24390,7 +24390,7 @@ "@contentstack/cli-cm-seed": { "version": "file:packages/contentstack-seed", "requires": { - "@contentstack/cli-cm-import": "^1.7.0", + "@contentstack/cli-cm-import": "~1.8.0", "@contentstack/cli-command": "^1.2.11", "@contentstack/cli-utilities": "^1.5.1", "@oclif/plugin-help": "^5.1.19", diff --git a/packages/contentstack-auth/README.md b/packages/contentstack-auth/README.md index 3ca095069f..2f2c47b143 100644 --- a/packages/contentstack-auth/README.md +++ b/packages/contentstack-auth/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-auth/1.3.12 darwin-arm64 node-v20.3.1 +@contentstack/cli-auth/1.3.12 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bootstrap/README.md b/packages/contentstack-bootstrap/README.md index bbdf5da30c..c7a8e634fb 100644 --- a/packages/contentstack-bootstrap/README.md +++ b/packages/contentstack-bootstrap/README.md @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-bootstrap/1.4.13 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-bootstrap/1.4.14 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-branches/README.md b/packages/contentstack-branches/README.md index e961926c4c..02187683e3 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.0.10 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bulk-publish/README.md b/packages/contentstack-bulk-publish/README.md index c7295eccb1..bb323bc369 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.3.10 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-clone/README.md b/packages/contentstack-clone/README.md index 4174754a85..a18e49330c 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.4.14 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-clone/1.4.15 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-config/README.md b/packages/contentstack-config/README.md index 831a9ddd87..a8715d82b1 100644 --- a/packages/contentstack-config/README.md +++ b/packages/contentstack-config/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-config/1.4.10 darwin-arm64 node-v20.3.1 +@contentstack/cli-config/1.4.10 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-export/README.md b/packages/contentstack-export/README.md index a974058efc..b78b5f62df 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.7.0 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-export/1.8.0 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-import/README.md b/packages/contentstack-import/README.md index 187e6276d4..b88d1ff985 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.7.1 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-import/1.8.0 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-launch/README.md b/packages/contentstack-launch/README.md index 02c7a6cc48..018e169057 100755 --- a/packages/contentstack-launch/README.md +++ b/packages/contentstack-launch/README.md @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch $ csdx COMMAND running command... $ csdx (--version|-v) -@contentstack/cli-launch/1.0.10 darwin-arm64 node-v20.3.1 +@contentstack/cli-launch/1.0.10 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-migrate-rte/README.md b/packages/contentstack-migrate-rte/README.md index 77f51af25e..dfd4e10f39 100644 --- a/packages/contentstack-migrate-rte/README.md +++ b/packages/contentstack-migrate-rte/README.md @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-migrate-rte $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-migrate-rte/1.4.10 darwin-arm64 node-v20.3.1 +@contentstack/cli-cm-migrate-rte/1.4.10 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-migration/README.md b/packages/contentstack-migration/README.md index fb6fdebcb9..05ed4d7c8a 100644 --- a/packages/contentstack-migration/README.md +++ b/packages/contentstack-migration/README.md @@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-migration/1.3.10 darwin-arm64 node-v20.3.1 +@contentstack/cli-migration/1.3.10 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index 5241d7b2e2..371575eed8 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.7.12 darwin-arm64 node-v20.3.1 +@contentstack/cli/1.8.0 darwin-arm64 node-v18.11.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95f69d7249..0ce2144b7a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,15 +11,15 @@ importers: packages/contentstack: specifiers: '@contentstack/cli-auth': ^1.3.12 - '@contentstack/cli-cm-bootstrap': ^1.4.13 + '@contentstack/cli-cm-bootstrap': ^1.4.14 '@contentstack/cli-cm-branches': ^1.0.10 '@contentstack/cli-cm-bulk-publish': ^1.3.10 - '@contentstack/cli-cm-clone': ^1.4.14 - '@contentstack/cli-cm-export': ^1.7.0 + '@contentstack/cli-cm-clone': ^1.4.15 + '@contentstack/cli-cm-export': ~1.8.0 '@contentstack/cli-cm-export-to-csv': ^1.3.12 - '@contentstack/cli-cm-import': ^1.7.1 + '@contentstack/cli-cm-import': ~1.8.0 '@contentstack/cli-cm-migrate-rte': ^1.4.10 - '@contentstack/cli-cm-seed': ^1.4.13 + '@contentstack/cli-cm-seed': ^1.4.14 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-config': ^1.4.10 '@contentstack/cli-launch': ^1.0.10 @@ -182,7 +182,7 @@ importers: packages/contentstack-bootstrap: specifiers: - '@contentstack/cli-cm-seed': ^1.4.13 + '@contentstack/cli-cm-seed': ^1.4.14 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-utilities': ^1.5.1 '@oclif/test': ^2.2.10 @@ -360,8 +360,8 @@ importers: packages/contentstack-clone: specifiers: '@colors/colors': ^1.5.0 - '@contentstack/cli-cm-export': ^1.7.0 - '@contentstack/cli-cm-import': ^1.7.1 + '@contentstack/cli-cm-export': ~1.8.0 + '@contentstack/cli-cm-import': ~1.8.0 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-utilities': ^1.5.1 '@oclif/test': ^1.2.7 @@ -915,7 +915,7 @@ importers: packages/contentstack-seed: specifiers: - '@contentstack/cli-cm-import': ^1.7.0 + '@contentstack/cli-cm-import': ~1.8.0 '@contentstack/cli-command': ^1.2.11 '@contentstack/cli-utilities': ^1.5.1 '@oclif/plugin-help': ^5.1.19 @@ -4186,16 +4186,6 @@ packages: xml2js: 0.5.0 dev: true - /axios/0.27.2: - resolution: - { integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== } - dependencies: - follow-redirects: 1.15.2 - form-data: 4.0.0 - transitivePeerDependencies: - - debug - dev: false - /axios/0.27.2_debug@4.3.4: resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} dependencies: From edf7fb09a05b47ee2a4af066e81b1606fddcddd2 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Thu, 10 Aug 2023 15:03:15 +0530 Subject: [PATCH 45/52] Restricting packages to minor version updates --- package-lock.json | 192 +++++++++--------- packages/contentstack-auth/package.json | 4 +- packages/contentstack-bootstrap/package.json | 6 +- packages/contentstack-branches/package.json | 10 +- .../contentstack-bulk-publish/package.json | 4 +- packages/contentstack-clone/package.json | 4 +- packages/contentstack-command/package.json | 2 +- packages/contentstack-config/package.json | 4 +- .../contentstack-export-to-csv/package.json | 4 +- packages/contentstack-export/package.json | 10 +- packages/contentstack-import/package.json | 4 +- packages/contentstack-launch/package.json | 4 +- .../contentstack-migrate-rte/package.json | 6 +- packages/contentstack-migration/package.json | 4 +- packages/contentstack-seed/package.json | 4 +- packages/contentstack/package.json | 26 +-- pnpm-lock.yaml | 96 ++++----- 17 files changed, 192 insertions(+), 192 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4cd2869217..c9dda70718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20301,21 +20301,21 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.14", - "@contentstack/cli-cm-branches": "^1.0.10", - "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-auth": "~1.3.12", + "@contentstack/cli-cm-bootstrap": "~1.4.14", + "@contentstack/cli-cm-branches": "~1.0.10", + "@contentstack/cli-cm-bulk-publish": "~1.3.10", + "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", - "@contentstack/cli-cm-export-to-csv": "^1.3.12", + "@contentstack/cli-cm-export-to-csv": "~1.3.12", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.10", - "@contentstack/cli-migration": "^1.3.10", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-migrate-rte": "~1.4.10", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.10", + "@contentstack/cli-launch": "~1.0.10", + "@contentstack/cli-migration": "~1.3.10", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", @@ -20368,8 +20368,8 @@ "version": "1.3.12", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", @@ -20409,9 +20409,9 @@ "version": "1.4.14", "license": "MIT", "dependencies": { - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13" @@ -20488,8 +20488,8 @@ "version": "1.0.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -20510,9 +20510,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/flat": "^5.0.2", @@ -20551,8 +20551,8 @@ "version": "1.3.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "bluebird": "^3.7.2", "chalk": "^4.1.2", "dotenv": "^16.1.4", @@ -20603,8 +20603,8 @@ "@colors/colors": "^1.5.0", "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "async": "^3.2.4", "chalk": "^4.1.0", "child_process": "^1.0.2", @@ -20662,7 +20662,7 @@ "version": "1.2.11", "license": "MIT", "dependencies": { - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-utilities": "~1.5.1", "contentstack": "^3.10.1" }, "devDependencies": { @@ -20736,8 +20736,8 @@ "version": "1.4.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", @@ -21024,8 +21024,8 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -21045,9 +21045,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/mkdirp": "^1.0.2", @@ -21075,8 +21075,8 @@ "version": "1.3.12", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.1.0", "fast-csv": "^4.3.6", "inquirer": "8.2.4", @@ -21326,8 +21326,8 @@ "version": "1.8.0", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -21459,8 +21459,8 @@ "license": "MIT", "dependencies": { "@apollo/client": "^3.7.9", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", @@ -21949,9 +21949,9 @@ "version": "1.4.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/json-rte-serializer": "^2.0.2", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", + "@contentstack/json-rte-serializer": "~2.0.2", "chalk": "^4.1.2", "collapse-whitespace": "^1.1.7", "jsdom": "^20.0.3", @@ -21988,8 +21988,8 @@ "version": "1.3.10", "license": "MIT", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "async": "^3.2.4", @@ -22024,8 +22024,8 @@ "license": "MIT", "dependencies": { "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "axios": "1.3.4", "inquirer": "8.2.4", "mkdirp": "^1.0.4", @@ -23701,21 +23701,21 @@ "@contentstack/cli": { "version": "file:packages/contentstack", "requires": { - "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.14", - "@contentstack/cli-cm-branches": "^1.0.10", - "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-auth": "~1.3.12", + "@contentstack/cli-cm-bootstrap": "~1.4.14", + "@contentstack/cli-cm-branches": "~1.0.10", + "@contentstack/cli-cm-bulk-publish": "~1.3.10", + "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", - "@contentstack/cli-cm-export-to-csv": "^1.3.12", + "@contentstack/cli-cm-export-to-csv": "~1.3.12", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.10", - "@contentstack/cli-migration": "^1.3.10", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-migrate-rte": "~1.4.10", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.10", + "@contentstack/cli-launch": "~1.0.10", + "@contentstack/cli-migration": "~1.3.10", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", @@ -23758,8 +23758,8 @@ "@contentstack/cli-auth": { "version": "file:packages/contentstack-auth", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@fancy-test/nock": "^0.1.1", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^2.2.10", @@ -23792,9 +23792,9 @@ "@contentstack/cli-cm-bootstrap": { "version": "file:packages/contentstack-bootstrap", "requires": { - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "@types/inquirer": "^9.0.3", "@types/mkdirp": "^1.0.1", @@ -23851,11 +23851,11 @@ "@contentstack/cli-cm-branches": { "version": "file:packages/contentstack-branches", "requires": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -23906,8 +23906,8 @@ "@contentstack/cli-cm-bulk-publish": { "version": "file:packages/contentstack-bulk-publish", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^1.2.6", "bluebird": "^3.7.2", "chai": "^4.2.0", @@ -23950,8 +23950,8 @@ "@colors/colors": "^1.5.0", "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^1.2.7", "async": "^3.2.4", "chai": "^4.2.0", @@ -23995,11 +23995,11 @@ "@contentstack/cli-cm-export": { "version": "file:packages/contentstack-export", "requires": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -24050,8 +24050,8 @@ "@contentstack/cli-cm-export-to-csv": { "version": "file:packages/contentstack-export-to-csv", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "chai": "^4.2.0", "chalk": "^4.1.0", @@ -24239,8 +24239,8 @@ "@contentstack/cli-cm-import": { "version": "file:packages/contentstack-import", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -24356,9 +24356,9 @@ "@contentstack/cli-cm-migrate-rte": { "version": "file:packages/contentstack-migrate-rte", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/json-rte-serializer": "^2.0.2", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", + "@contentstack/json-rte-serializer": "~2.0.2", "@oclif/test": "^2.2.10", "chai": "^4.3.4", "chalk": "^4.1.2", @@ -24391,8 +24391,8 @@ "version": "file:packages/contentstack-seed", "requires": { "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/plugin-help": "^5.1.19", "@types/inquirer": "^9.0.3", "@types/jest": "^26.0.15", @@ -24451,7 +24451,7 @@ "@contentstack/cli-command": { "version": "file:packages/contentstack-command", "requires": { - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "@types/chai": "^4.2.18", "@types/mkdirp": "^1.0.1", @@ -24505,8 +24505,8 @@ "@contentstack/cli-config": { "version": "file:packages/contentstack-config", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/test": "^2.2.10", "@types/chai": "^4.2.18", "@types/inquirer": "^9.0.3", @@ -24737,8 +24737,8 @@ "version": "file:packages/contentstack-launch", "requires": { "@apollo/client": "^3.7.9", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", @@ -25081,8 +25081,8 @@ "@contentstack/cli-migration": { "version": "file:packages/contentstack-migration", "requires": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/test": "^2.2.10", diff --git a/packages/contentstack-auth/package.json b/packages/contentstack-auth/package.json index a466e7ae2a..2b931ec9bc 100644 --- a/packages/contentstack-auth/package.json +++ b/packages/contentstack-auth/package.json @@ -22,8 +22,8 @@ "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"" }, "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "inquirer": "8.2.4", diff --git a/packages/contentstack-bootstrap/package.json b/packages/contentstack-bootstrap/package.json index 06c4cdd767..ba1c090620 100644 --- a/packages/contentstack-bootstrap/package.json +++ b/packages/contentstack-bootstrap/package.json @@ -17,9 +17,9 @@ "test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\"" }, "dependencies": { - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "inquirer": "8.2.4", "mkdirp": "^1.0.4", "tar": "^6.1.13" diff --git a/packages/contentstack-branches/package.json b/packages/contentstack-branches/package.json index 7b61549cc2..7ed7022517 100644 --- a/packages/contentstack-branches/package.json +++ b/packages/contentstack-branches/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -27,9 +27,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/flat": "^5.0.2", diff --git a/packages/contentstack-bulk-publish/package.json b/packages/contentstack-bulk-publish/package.json index 7278094763..650f8ea220 100644 --- a/packages/contentstack-bulk-publish/package.json +++ b/packages/contentstack-bulk-publish/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "bluebird": "^3.7.2", "chalk": "^4.1.2", "dotenv": "^16.1.4", diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index e51a68af42..77ff385980 100644 --- a/packages/contentstack-clone/package.json +++ b/packages/contentstack-clone/package.json @@ -7,8 +7,8 @@ "dependencies": { "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@colors/colors": "^1.5.0", "async": "^3.2.4", "chalk": "^4.1.0", diff --git a/packages/contentstack-command/package.json b/packages/contentstack-command/package.json index d5b6315651..d9788f9e50 100644 --- a/packages/contentstack-command/package.json +++ b/packages/contentstack-command/package.json @@ -17,7 +17,7 @@ "format": "eslint src/**/*.ts --fix" }, "dependencies": { - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-utilities": "~1.5.1", "contentstack": "^3.10.1" }, "devDependencies": { diff --git a/packages/contentstack-config/package.json b/packages/contentstack-config/package.json index 1f07540eb9..c97ab376da 100644 --- a/packages/contentstack-config/package.json +++ b/packages/contentstack-config/package.json @@ -21,8 +21,8 @@ "test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\"" }, "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.0.0", "debug": "^4.1.1", "mkdirp": "^1.0.4", diff --git a/packages/contentstack-export-to-csv/package.json b/packages/contentstack-export-to-csv/package.json index 1ac48ef637..8dd894b7aa 100644 --- a/packages/contentstack-export-to-csv/package.json +++ b/packages/contentstack-export-to-csv/package.json @@ -5,8 +5,8 @@ "author": "Abhinav Gupta @abhinav-from-contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "chalk": "^4.1.0", "fast-csv": "^4.3.6", "inquirer": "8.2.4", diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index 5405c86dda..45aac8ab41 100644 --- a/packages/contentstack-export/package.json +++ b/packages/contentstack-export/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", @@ -26,9 +26,9 @@ "winston": "^3.7.2" }, "devDependencies": { - "@contentstack/cli-auth": "^1.3.11", - "@contentstack/cli-config": "^1.4.9", - "@contentstack/cli-dev-dependencies": "^1.2.3", + "@contentstack/cli-auth": "~1.3.11", + "@contentstack/cli-config": "~1.4.9", + "@contentstack/cli-dev-dependencies": "~1.2.3", "@oclif/plugin-help": "^5.1.19", "@oclif/test": "^1.2.6", "@types/mkdirp": "^1.0.2", diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 24b6dd6e5b..74317fabf4 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -5,8 +5,8 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", "@oclif/config": "^1.18.3", "@oclif/core": "^2.9.3", diff --git a/packages/contentstack-launch/package.json b/packages/contentstack-launch/package.json index 30ea0a730f..d4858f0546 100755 --- a/packages/contentstack-launch/package.json +++ b/packages/contentstack-launch/package.json @@ -18,8 +18,8 @@ ], "dependencies": { "@apollo/client": "^3.7.9", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", "@oclif/core": "^2.9.3", diff --git a/packages/contentstack-migrate-rte/package.json b/packages/contentstack-migrate-rte/package.json index 42c3d3cbb5..6420093053 100644 --- a/packages/contentstack-migrate-rte/package.json +++ b/packages/contentstack-migrate-rte/package.json @@ -5,9 +5,9 @@ "author": "contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", - "@contentstack/json-rte-serializer": "^2.0.2", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", + "@contentstack/json-rte-serializer": "~2.0.2", "collapse-whitespace": "^1.1.7", "chalk": "^4.1.2", "jsdom": "^20.0.3", diff --git a/packages/contentstack-migration/package.json b/packages/contentstack-migration/package.json index 8e0bdbc9b4..f0f02f3961 100644 --- a/packages/contentstack-migration/package.json +++ b/packages/contentstack-migration/package.json @@ -4,8 +4,8 @@ "author": "@contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "@oclif/command": "^1.8.16", "@oclif/config": "^1.18.3", "async": "^3.2.4", diff --git a/packages/contentstack-seed/package.json b/packages/contentstack-seed/package.json index 224d57c3ba..5a3af51d0b 100644 --- a/packages/contentstack-seed/package.json +++ b/packages/contentstack-seed/package.json @@ -6,8 +6,8 @@ "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-utilities": "~1.5.1", "axios": "1.3.4", "inquirer": "8.2.4", "mkdirp": "^1.0.4", diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index e9077783c1..42cbaa6ab8 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -22,22 +22,22 @@ "prepack": "pnpm compile && oclif manifest && oclif readme" }, "dependencies": { - "@contentstack/cli-auth": "^1.3.12", - "@contentstack/cli-cm-bootstrap": "^1.4.14", - "@contentstack/cli-cm-bulk-publish": "^1.3.10", - "@contentstack/cli-cm-clone": "^1.4.15", + "@contentstack/cli-auth": "~1.3.12", + "@contentstack/cli-cm-bootstrap": "~1.4.14", + "@contentstack/cli-cm-bulk-publish": "~1.3.10", + "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", - "@contentstack/cli-cm-export-to-csv": "^1.3.12", + "@contentstack/cli-cm-export-to-csv": "~1.3.12", "@contentstack/cli-cm-import": "~1.8.0", - "@contentstack/cli-cm-migrate-rte": "^1.4.10", - "@contentstack/cli-cm-seed": "^1.4.14", - "@contentstack/cli-command": "^1.2.11", - "@contentstack/cli-config": "^1.4.10", - "@contentstack/cli-launch": "^1.0.10", - "@contentstack/cli-migration": "^1.3.10", - "@contentstack/cli-utilities": "^1.5.1", + "@contentstack/cli-cm-migrate-rte": "~1.4.10", + "@contentstack/cli-cm-seed": "~1.4.14", + "@contentstack/cli-command": "~1.2.11", + "@contentstack/cli-config": "~1.4.10", + "@contentstack/cli-launch": "~1.0.10", + "@contentstack/cli-migration": "~1.3.10", + "@contentstack/cli-utilities": "~1.5.1", "@contentstack/management": "~1.10.0", - "@contentstack/cli-cm-branches": "^1.0.10", + "@contentstack/cli-cm-branches": "~1.0.10", "@oclif/plugin-help": "^5", "@oclif/plugin-not-found": "^2.3.9", "@oclif/plugin-plugins": "^2.1.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ce2144b7a..e2cead0850 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,21 +10,21 @@ importers: packages/contentstack: specifiers: - '@contentstack/cli-auth': ^1.3.12 - '@contentstack/cli-cm-bootstrap': ^1.4.14 - '@contentstack/cli-cm-branches': ^1.0.10 - '@contentstack/cli-cm-bulk-publish': ^1.3.10 - '@contentstack/cli-cm-clone': ^1.4.15 + '@contentstack/cli-auth': ~1.3.12 + '@contentstack/cli-cm-bootstrap': ~1.4.14 + '@contentstack/cli-cm-branches': ~1.0.10 + '@contentstack/cli-cm-bulk-publish': ~1.3.10 + '@contentstack/cli-cm-clone': ~1.4.15 '@contentstack/cli-cm-export': ~1.8.0 - '@contentstack/cli-cm-export-to-csv': ^1.3.12 + '@contentstack/cli-cm-export-to-csv': ~1.3.12 '@contentstack/cli-cm-import': ~1.8.0 - '@contentstack/cli-cm-migrate-rte': ^1.4.10 - '@contentstack/cli-cm-seed': ^1.4.14 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-config': ^1.4.10 - '@contentstack/cli-launch': ^1.0.10 - '@contentstack/cli-migration': ^1.3.10 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-cm-migrate-rte': ~1.4.10 + '@contentstack/cli-cm-seed': ~1.4.14 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-config': ~1.4.10 + '@contentstack/cli-launch': ~1.0.10 + '@contentstack/cli-migration': ~1.3.10 + '@contentstack/cli-utilities': ~1.5.1 '@contentstack/management': ~1.10.0 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5 @@ -119,8 +119,8 @@ importers: packages/contentstack-auth: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@fancy-test/nock': ^0.1.1 '@oclif/plugin-help': ^5.1.19 '@oclif/test': ^2.2.10 @@ -182,9 +182,9 @@ importers: packages/contentstack-bootstrap: specifiers: - '@contentstack/cli-cm-seed': ^1.4.14 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-cm-seed': ~1.4.14 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 '@types/inquirer': ^9.0.3 '@types/mkdirp': ^1.0.1 @@ -233,11 +233,11 @@ importers: packages/contentstack-branches: specifiers: - '@contentstack/cli-auth': ^1.3.11 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-config': ^1.4.9 - '@contentstack/cli-dev-dependencies': ^1.2.3 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-auth': ~1.3.11 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-config': ~1.4.9 + '@contentstack/cli-dev-dependencies': ~1.2.3 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/command': ^1.8.16 '@oclif/config': ^1.18.3 '@oclif/core': ^2.9.3 @@ -316,8 +316,8 @@ importers: packages/contentstack-bulk-publish: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^1.2.6 bluebird: ^3.7.2 chai: ^4.2.0 @@ -362,8 +362,8 @@ importers: '@colors/colors': ^1.5.0 '@contentstack/cli-cm-export': ~1.8.0 '@contentstack/cli-cm-import': ~1.8.0 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^1.2.7 async: ^3.2.4 chai: ^4.2.0 @@ -412,7 +412,7 @@ importers: packages/contentstack-command: specifiers: - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 '@types/chai': ^4.2.18 '@types/mkdirp': ^1.0.1 @@ -453,8 +453,8 @@ importers: packages/contentstack-config: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 '@types/chai': ^4.2.18 '@types/inquirer': ^9.0.3 @@ -537,11 +537,11 @@ importers: packages/contentstack-export: specifiers: - '@contentstack/cli-auth': ^1.3.11 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-config': ^1.4.9 - '@contentstack/cli-dev-dependencies': ^1.2.3 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-auth': ~1.3.11 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-config': ~1.4.9 + '@contentstack/cli-dev-dependencies': ~1.2.3 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/command': ^1.8.16 '@oclif/config': ^1.18.3 '@oclif/core': ^2.9.3 @@ -620,8 +620,8 @@ importers: packages/contentstack-export-to-csv: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/test': ^2.2.10 chai: ^4.2.0 chalk: ^4.1.0 @@ -657,8 +657,8 @@ importers: packages/contentstack-import: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@contentstack/management': ~1.10.0 '@oclif/config': ^1.18.3 '@oclif/core': ^2.9.3 @@ -741,8 +741,8 @@ importers: packages/contentstack-launch: specifiers: '@apollo/client': ^3.7.9 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/core': ^2.9.3 '@oclif/plugin-help': ^5 '@oclif/plugin-plugins': ^2.3.2 @@ -817,9 +817,9 @@ importers: packages/contentstack-migrate-rte: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 - '@contentstack/json-rte-serializer': ^2.0.2 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 + '@contentstack/json-rte-serializer': ~2.0.2 '@oclif/test': ^2.2.10 chai: ^4.3.4 chalk: ^4.1.2 @@ -864,8 +864,8 @@ importers: packages/contentstack-migration: specifiers: - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/command': ^1.8.16 '@oclif/config': ^1.18.3 '@oclif/test': ^2.2.10 @@ -916,8 +916,8 @@ importers: packages/contentstack-seed: specifiers: '@contentstack/cli-cm-import': ~1.8.0 - '@contentstack/cli-command': ^1.2.11 - '@contentstack/cli-utilities': ^1.5.1 + '@contentstack/cli-command': ~1.2.11 + '@contentstack/cli-utilities': ~1.5.1 '@oclif/plugin-help': ^5.1.19 '@types/inquirer': ^9.0.3 '@types/jest': ^26.0.15 From 5bbd0de583c8c3a776221a975965180e0bbb7544 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Thu, 17 Aug 2023 18:59:42 +0530 Subject: [PATCH 46/52] undo remove --- packages/contentstack-import/src/utils/content-type-helper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/contentstack-import/src/utils/content-type-helper.ts b/packages/contentstack-import/src/utils/content-type-helper.ts index 9b7ea3b649..20b4738621 100644 --- a/packages/contentstack-import/src/utils/content-type-helper.ts +++ b/packages/contentstack-import/src/utils/content-type-helper.ts @@ -147,6 +147,7 @@ export const removeReferenceFields = async function ( ) { flag.supressed = true; schema[i].reference_to = ['sys_assets']; + return true; // undo remove } } }; From a2116ad3124ed0388dfb3b970ba32869c250e220 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Fri, 18 Aug 2023 12:56:44 +0530 Subject: [PATCH 47/52] fix: removed return true statements --- packages/contentstack-import/src/utils/content-type-helper.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/contentstack-import/src/utils/content-type-helper.ts b/packages/contentstack-import/src/utils/content-type-helper.ts index 20b4738621..140576af8f 100644 --- a/packages/contentstack-import/src/utils/content-type-helper.ts +++ b/packages/contentstack-import/src/utils/content-type-helper.ts @@ -128,7 +128,6 @@ export const removeReferenceFields = async function ( }); } } - return true; } else if ( // handling entry references in json rte schema[i].data_type === 'json' && @@ -147,7 +146,6 @@ export const removeReferenceFields = async function ( ) { flag.supressed = true; schema[i].reference_to = ['sys_assets']; - return true; // undo remove } } }; From bc2bb2ee4d30ecb093cd9038d4bbf459c0dffafa Mon Sep 17 00:00:00 2001 From: raj pandey Date: Tue, 22 Aug 2023 10:19:15 +0530 Subject: [PATCH 48/52] JSON rte childrens passed empty --- .../src/import/modules-js/entries.js | 18 +++++++++++------- .../src/utils/entries-helper.ts | 4 ++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/contentstack-import/src/import/modules-js/entries.js b/packages/contentstack-import/src/import/modules-js/entries.js index de2f8a7361..03afbd6b03 100755 --- a/packages/contentstack-import/src/import/modules-js/entries.js +++ b/packages/contentstack-import/src/import/modules-js/entries.js @@ -406,9 +406,9 @@ module.exports = class ImportEntries { } else { log( this.config, - `Failed to create an entry '${eUid}' ${formatError(error)} Title of the failed entry: '${ - entries[eUid].title - }'`, + `Failed to create an entry '${eUid}' ${formatError( + error, + )} Title of the failed entry: '${entries[eUid].title}'`, 'error', ); } @@ -498,7 +498,7 @@ module.exports = class ImportEntries { return resolve(); }) .catch((error) => { - let title = JSON.parse(error?.request?.data ||"{}").entry?.title + let title = JSON.parse(error?.request?.data || '{}').entry?.title; addlogs( this.config, chalk.red( @@ -506,7 +506,7 @@ module.exports = class ImportEntries { lang + "' language. " + 'Title of the failed entry: ' + - `'${title||""}'`, + `'${title || ''}'`, ), 'error', ); @@ -991,9 +991,9 @@ module.exports = class ImportEntries { if (schema.field_rules) { let fieldRuleLength = schema.field_rules.length; const fieldDatatypeMap = {}; - for (let i = 0; i < schema.schema.length ; i++) { + for (let i = 0; i < schema.schema.length; i++) { const field = schema.schema[i].uid; - fieldDatatypeMap[field] = schema.schema[i].data_type; + fieldDatatypeMap[field] = schema.schema[i].data_type; } for (let k = 0; k < fieldRuleLength; k++) { let fieldRuleConditionLength = schema.field_rules[k].conditions.length; @@ -1218,6 +1218,7 @@ module.exports = class ImportEntries { break; } case 'json': { + const structuredPTag = '{"type":"p","attrs":{},"children":[{"text":""}]}'; if (entry[element.uid] && element.field_metadata.rich_text_type) { if (element.multiple) { entry[element.uid] = entry[element.uid].map((jsonRteData) => { @@ -1236,6 +1237,9 @@ module.exports = class ImportEntries { entry[element.uid].children = entry[element.uid].children.filter( (e) => !this.doEntryReferencesExist(e), ); + if (entry[element.uid].children.length === 0) { + entry[element.uid].children.push(JSON.parse(structuredPTag)); + } } } } diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index acca676921..55131a9689 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -373,6 +373,7 @@ export const removeEntryRefsFromJSONRTE = (entry: Record, ctSchema: break; } case 'json': { + const structuredPTag = '{"type":"p","attrs":{},"children":[{"text":""}]}'; if (entry[element.uid] && element.field_metadata.rich_text_type) { if (element.multiple) { entry[element.uid] = entry[element.uid].map((jsonRteData: any) => { @@ -389,6 +390,9 @@ export const removeEntryRefsFromJSONRTE = (entry: Record, ctSchema: let entryReferences = entry[element.uid].children.filter((e: any) => doEntryReferencesExist(e)); if (entryReferences.length > 0) { entry[element.uid].children = entry[element.uid].children.filter((e: any) => !doEntryReferencesExist(e)); + if (entry[element.uid].children.length === 0) { + entry[element.uid].children.push(JSON.parse(structuredPTag)); + } } } } From 5ab3876814bcbcbfb94e00054b3d1e131fd0b776 Mon Sep 17 00:00:00 2001 From: Shafeeq PP Date: Tue, 22 Aug 2023 15:47:05 +0530 Subject: [PATCH 49/52] fix for html rte asset reference --- packages/contentstack-import/package.json | 2 +- .../contentstack-import/src/utils/asset-helper.ts | 15 ++++++++++++++- packages/contentstack/package.json | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 74317fabf4..0a6f07f064 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-import", "description": "Contentstack CLI plugin to import content into stack", - "version": "1.8.0", + "version": "1.8.1", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-import/src/utils/asset-helper.ts b/packages/contentstack-import/src/utils/asset-helper.ts index c8fa8cb1ea..6b46050c42 100644 --- a/packages/contentstack-import/src/utils/asset-helper.ts +++ b/packages/contentstack-import/src/utils/asset-helper.ts @@ -85,6 +85,9 @@ export const lookupAssets = function ( ) { parent.push(schema[i].uid); findFileUrls(schema[i], entryToFind, assetUrls); + if (schema[i].field_metadata.rich_text_type) { + findAssetIdsFromHtmlRte(entryToFind, schema[i]); + } parent.pop(); } if (schema[i].data_type === 'group' || schema[i].data_type === 'global_field') { @@ -145,6 +148,15 @@ export const lookupAssets = function ( }); } + function findAssetIdsFromHtmlRte(entryObj: any, ctSchema: any) { + const regex = / Date: Tue, 22 Aug 2023 18:11:48 +0530 Subject: [PATCH 50/52] fix: added empty children condition to the multiple case --- packages/contentstack-import/src/import/modules-js/entries.js | 3 +++ packages/contentstack-import/src/utils/entries-helper.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/contentstack-import/src/import/modules-js/entries.js b/packages/contentstack-import/src/import/modules-js/entries.js index 03afbd6b03..a9dce59a43 100755 --- a/packages/contentstack-import/src/import/modules-js/entries.js +++ b/packages/contentstack-import/src/import/modules-js/entries.js @@ -1226,6 +1226,9 @@ module.exports = class ImportEntries { let entryReferences = jsonRteData.children.filter((e) => this.doEntryReferencesExist(e)); if (entryReferences.length > 0) { jsonRteData.children = jsonRteData.children.filter((e) => !this.doEntryReferencesExist(e)); + if (jsonRteData.children.length === 0) { + jsonRteData.children.push(JSON.parse(structuredPTag)); + } return jsonRteData; // return jsonRteData without entry references } else { return jsonRteData; // return jsonRteData as it is, because there are no entry references diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index 55131a9689..bdbbf473a1 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -381,6 +381,9 @@ export const removeEntryRefsFromJSONRTE = (entry: Record, ctSchema: let entryReferences = jsonRteData.children.filter((e: any) => doEntryReferencesExist(e)); if (entryReferences.length > 0) { jsonRteData.children = jsonRteData.children.filter((e: any) => !doEntryReferencesExist(e)); + if (jsonRteData.children.length === 0) { // empty children array are no longer acceptable by the API, a default structure must be there + jsonRteData.children.push(JSON.parse(structuredPTag)); + } return jsonRteData; // return jsonRteData without entry references } else { return jsonRteData; // return jsonRteData as it is, because there are no entry references From cc3ecb0d715c49a3a22c36d4db68ce0a747258b9 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Wed, 23 Aug 2023 14:10:42 +0530 Subject: [PATCH 51/52] fix: bumped cli version --- packages/contentstack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contentstack/package.json b/packages/contentstack/package.json index f510658fc5..601cb825da 100755 --- a/packages/contentstack/package.json +++ b/packages/contentstack/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli", "description": "Command-line tool (CLI) to interact with Contentstack", - "version": "1.8.0", + "version": "1.8.1", "author": "Contentstack", "bin": { "csdx": "./bin/run" From 3800796598ad7cee362df5f3724939b4fad67bc3 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Wed, 23 Aug 2023 14:12:42 +0530 Subject: [PATCH 52/52] fix: updated lock files and READMEs --- package-lock.json | 8 ++++---- packages/contentstack-auth/README.md | 2 +- packages/contentstack-bootstrap/README.md | 2 +- packages/contentstack-branches/README.md | 2 +- packages/contentstack-bulk-publish/README.md | 2 +- packages/contentstack-clone/README.md | 2 +- packages/contentstack-config/README.md | 2 +- packages/contentstack-export/README.md | 2 +- packages/contentstack-import/README.md | 2 +- packages/contentstack-launch/README.md | 2 +- packages/contentstack-migrate-rte/README.md | 2 +- packages/contentstack-migration/README.md | 2 +- packages/contentstack/README.md | 2 +- pnpm-lock.yaml | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index c9dda70718..ed4e058c42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20298,7 +20298,7 @@ }, "packages/contentstack": { "name": "@contentstack/cli", - "version": "1.8.0", + "version": "1.8.1", "license": "MIT", "dependencies": { "@contentstack/cli-auth": "~1.3.12", @@ -20308,7 +20308,7 @@ "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-export-to-csv": "~1.3.12", - "@contentstack/cli-cm-import": "~1.8.0", + "@contentstack/cli-cm-import": "~1.8.1", "@contentstack/cli-cm-migrate-rte": "~1.4.10", "@contentstack/cli-cm-seed": "~1.4.14", "@contentstack/cli-command": "~1.2.11", @@ -21323,7 +21323,7 @@ }, "packages/contentstack-import": { "name": "@contentstack/cli-cm-import", - "version": "1.8.0", + "version": "1.8.1", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.11", @@ -23708,7 +23708,7 @@ "@contentstack/cli-cm-clone": "~1.4.15", "@contentstack/cli-cm-export": "~1.8.0", "@contentstack/cli-cm-export-to-csv": "~1.3.12", - "@contentstack/cli-cm-import": "~1.8.0", + "@contentstack/cli-cm-import": "~1.8.1", "@contentstack/cli-cm-migrate-rte": "~1.4.10", "@contentstack/cli-cm-seed": "~1.4.14", "@contentstack/cli-command": "~1.2.11", diff --git a/packages/contentstack-auth/README.md b/packages/contentstack-auth/README.md index 2f2c47b143..3ca095069f 100644 --- a/packages/contentstack-auth/README.md +++ b/packages/contentstack-auth/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-auth/1.3.12 darwin-arm64 node-v18.11.0 +@contentstack/cli-auth/1.3.12 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bootstrap/README.md b/packages/contentstack-bootstrap/README.md index c7a8e634fb..993ef9d09c 100644 --- a/packages/contentstack-bootstrap/README.md +++ b/packages/contentstack-bootstrap/README.md @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-bootstrap/1.4.14 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-bootstrap/1.4.14 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-branches/README.md b/packages/contentstack-branches/README.md index 02187683e3..e961926c4c 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.0.10 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-bulk-publish/README.md b/packages/contentstack-bulk-publish/README.md index bb323bc369..c7295eccb1 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.3.10 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-clone/README.md b/packages/contentstack-clone/README.md index a18e49330c..f270ae94b7 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.4.15 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-clone/1.4.15 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-config/README.md b/packages/contentstack-config/README.md index a8715d82b1..831a9ddd87 100644 --- a/packages/contentstack-config/README.md +++ b/packages/contentstack-config/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-config/1.4.10 darwin-arm64 node-v18.11.0 +@contentstack/cli-config/1.4.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-export/README.md b/packages/contentstack-export/README.md index b78b5f62df..7d803b6478 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.8.0 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-export/1.8.0 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-import/README.md b/packages/contentstack-import/README.md index b88d1ff985..d4e8c90c41 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.8.0 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-import/1.8.1 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-launch/README.md b/packages/contentstack-launch/README.md index 018e169057..02c7a6cc48 100755 --- a/packages/contentstack-launch/README.md +++ b/packages/contentstack-launch/README.md @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch $ csdx COMMAND running command... $ csdx (--version|-v) -@contentstack/cli-launch/1.0.10 darwin-arm64 node-v18.11.0 +@contentstack/cli-launch/1.0.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-migrate-rte/README.md b/packages/contentstack-migrate-rte/README.md index dfd4e10f39..77f51af25e 100644 --- a/packages/contentstack-migrate-rte/README.md +++ b/packages/contentstack-migrate-rte/README.md @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-migrate-rte $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-cm-migrate-rte/1.4.10 darwin-arm64 node-v18.11.0 +@contentstack/cli-cm-migrate-rte/1.4.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-migration/README.md b/packages/contentstack-migration/README.md index 05ed4d7c8a..fb6fdebcb9 100644 --- a/packages/contentstack-migration/README.md +++ b/packages/contentstack-migration/README.md @@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-migration/1.3.10 darwin-arm64 node-v18.11.0 +@contentstack/cli-migration/1.3.10 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index 371575eed8..2747f10302 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.8.0 darwin-arm64 node-v18.11.0 +@contentstack/cli/1.8.1 darwin-arm64 node-v20.3.1 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2cead0850..baf5ef35e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,7 @@ importers: '@contentstack/cli-cm-clone': ~1.4.15 '@contentstack/cli-cm-export': ~1.8.0 '@contentstack/cli-cm-export-to-csv': ~1.3.12 - '@contentstack/cli-cm-import': ~1.8.0 + '@contentstack/cli-cm-import': ~1.8.1 '@contentstack/cli-cm-migrate-rte': ~1.4.10 '@contentstack/cli-cm-seed': ~1.4.14 '@contentstack/cli-command': ~1.2.11