diff --git a/package-lock.json b/package-lock.json index 8ac7a4dd98..19a4a7eaaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2529,9 +2529,9 @@ } }, "node_modules/@types/chai": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", - "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==" + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==" }, "node_modules/@types/cli-progress": { "version": "3.11.0", @@ -4464,9 +4464,9 @@ } }, "node_modules/chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.8.tgz", + "integrity": "sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -23926,12 +23926,15 @@ }, "devDependencies": { "@oclif/test": "^2.2.10", - "chai": "^4.2.0", + "@types/chai": "^4.3.6", + "@types/mocha": "^10.0.1", + "chai": "^4.3.8", "debug": "^4.3.1", + "dotenv": "^16.3.1", "eslint": "^7.32.0", "eslint-config-oclif": "^4.0.0", "globby": "^10.0.2", - "mocha": "^10.0.0", + "mocha": "^10.2.0", "nyc": "^15.1.0", "oclif": "^3.8.1" }, @@ -23982,6 +23985,12 @@ "node": ">=10.10.0" } }, + "packages/contentstack-export-to-csv/node_modules/@types/mocha": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true + }, "packages/contentstack-export-to-csv/node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -24010,6 +24019,32 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "packages/contentstack-export-to-csv/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "packages/contentstack-export-to-csv/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "packages/contentstack-export-to-csv/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, "packages/contentstack-export-to-csv/node_modules/eslint": { "version": "7.32.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", @@ -24123,6 +24158,26 @@ "node": ">=4" } }, + "packages/contentstack-export-to-csv/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "packages/contentstack-export-to-csv/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -24150,6 +24205,22 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "packages/contentstack-export-to-csv/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "packages/contentstack-export-to-csv/node_modules/mkdirp": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", @@ -24164,6 +24235,94 @@ "url": "https://github.com/sponsors/isaacs" } }, + "packages/contentstack-export-to-csv/node_modules/mocha": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", + "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "dev": true, + "dependencies": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "nanoid": "3.3.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "packages/contentstack-export-to-csv/node_modules/mocha/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "packages/contentstack-export-to-csv/node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "packages/contentstack-export-to-csv/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "packages/contentstack-export-to-csv/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, "packages/contentstack-export/node_modules/@oclif/test": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/@oclif/test/-/test-1.2.9.tgz", @@ -26916,9 +27075,12 @@ "@contentstack/cli-command": "~1.2.12", "@contentstack/cli-utilities": "~1.5.2", "@oclif/test": "^2.2.10", - "chai": "^4.2.0", + "@types/chai": "^4.3.6", + "@types/mocha": "^10.0.1", + "chai": "^4.3.8", "chalk": "^4.1.0", "debug": "^4.3.1", + "dotenv": "^16.3.1", "eslint": "^7.32.0", "eslint-config-oclif": "^4.0.0", "fast-csv": "^4.3.6", @@ -26926,7 +27088,7 @@ "inquirer": "8.2.4", "inquirer-checkbox-plus-prompt": "1.0.1", "mkdirp": "^3.0.1", - "mocha": "^10.0.0", + "mocha": "^10.2.0", "nyc": "^15.1.0", "oclif": "^3.8.1" }, @@ -26968,6 +27130,12 @@ "minimatch": "^3.0.4" } }, + "@types/mocha": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", + "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", + "dev": true + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -26986,6 +27154,32 @@ "uri-js": "^4.2.2" } }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, "eslint": { "version": "7.32.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", @@ -27076,6 +27270,20 @@ } } }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -27097,10 +27305,90 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, "mkdirp": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==" + }, + "mocha": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", + "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "dev": true, + "requires": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "nanoid": "3.3.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } } } }, @@ -30272,9 +30560,9 @@ } }, "@types/chai": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.5.tgz", - "integrity": "sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==" + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz", + "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==" }, "@types/cli-progress": { "version": "3.11.0", @@ -31764,9 +32052,9 @@ } }, "chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.8.tgz", + "integrity": "sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ==", "dev": true, "requires": { "assertion-error": "^1.1.0", diff --git a/packages/contentstack-export-to-csv/package.json b/packages/contentstack-export-to-csv/package.json index a18250c162..84f3af0dab 100644 --- a/packages/contentstack-export-to-csv/package.json +++ b/packages/contentstack-export-to-csv/package.json @@ -15,12 +15,15 @@ }, "devDependencies": { "@oclif/test": "^2.2.10", - "chai": "^4.2.0", + "@types/chai": "^4.3.6", + "@types/mocha": "^10.0.1", + "chai": "^4.3.8", "debug": "^4.3.1", + "dotenv": "^16.3.1", "eslint": "^7.32.0", "eslint-config-oclif": "^4.0.0", "globby": "^10.0.2", - "mocha": "^10.0.0", + "mocha": "^10.2.0", "nyc": "^15.1.0", "oclif": "^3.8.1" }, @@ -44,7 +47,8 @@ "postpack": "rm -f oclif.manifest.json", "prepack": "oclif manifest && oclif readme", "test": "nyc mocha --forbid-only \"test/**/*.test.js\"", - "test:unit": "nyc mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.js\"", + "test:unit": "mocha --timeout 10000 --forbid-only \"test/unit/**/*.test.js\" \"test/util/common-utils.test.js\"", + "test:unit:report": "nyc --extension .js mocha --forbid-only \"test/unit/**/*.test.js\" \"test/util/common-utils.test.js\"", "version": "oclif readme && git add README.md", "clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo" }, @@ -61,4 +65,4 @@ } }, "repository": "https://github.com/contentstack/cli" -} \ No newline at end of file +} diff --git a/packages/contentstack-export-to-csv/src/util/index.js b/packages/contentstack-export-to-csv/src/util/index.js index 2c0f945fcd..812ae97064 100644 --- a/packages/contentstack-export-to-csv/src/util/index.js +++ b/packages/contentstack-export-to-csv/src/util/index.js @@ -156,9 +156,7 @@ function chooseStack(managementAPIClient, orgUid, stackApiKey) { async function chooseBranch(branchList) { try { - const branches = await branchList; - - const branchesArray = branches.map((branch) => branch.uid); + const branchesArray = branchList.map((branch) => branch.uid); let _chooseBranch = [ { @@ -401,7 +399,7 @@ function cleanEntries(entries, language, environments, contentTypeUid) { return filteredEntries.map((entry) => { let workflow = ''; const envArr = []; - if (entry.publish_details.length) { + if (entry?.publish_details?.length) { entry.publish_details.forEach((env) => { envArr.push(JSON.stringify([environments[env['environment']], env['locale'], env['time']])); }); @@ -862,4 +860,5 @@ module.exports = { formatTaxonomiesData, formatTermsOfTaxonomyData, getTaxonomy, + getStacks }; diff --git a/packages/contentstack-export-to-csv/test/mock-data/common.mock.json b/packages/contentstack-export-to-csv/test/mock-data/common.mock.json new file mode 100644 index 0000000000..d0fc9be610 --- /dev/null +++ b/packages/contentstack-export-to-csv/test/mock-data/common.mock.json @@ -0,0 +1,243 @@ +{ + "taxonomiesResp": { + "taxonomies": [ + { + "uid": "taxonomy_uid_1", + "name": "taxonomy uid 1", + "description": "", + "created_at": "2023-09-01T06:09:44.934Z", + "created_by": "user1", + "updated_at": "2023-09-01T06:44:16.604Z", + "updated_by": "user1" + }, + { + "uid": "taxonomy_uid_2", + "name": "taxonomy uid 2", + "description": "", + "created_at": "2023-09-01T06:09:44.934Z", + "created_by": "user1", + "updated_at": "2023-09-01T06:44:16.604Z", + "updated_by": "user1" + } + ], + "count": 2 + }, + "termsResp": { + "terms": [ + { + "uid": "wsq", + "name": "wsq", + "created_at": "2023-08-30T09:51:12.043Z", + "created_by": "user1", + "updated_at": "2023-08-30T09:51:12.043Z", + "updated_by": "user1", + "parent_uid": null, + "depth": 1 + }, + { + "uid": "term2", + "name": "term2", + "created_at": "2023-08-30T09:45:11.963Z", + "created_by": "user2", + "updated_at": "2023-08-30T09:45:11.963Z", + "updated_by": "user2", + "parent_uid": null, + "depth": 1 + } + ], + "count": 2 + }, + "organizations": [ + { + "uid": "test-uid-1", + "name": "test org 1" + }, + { + "uid": "test-uid-2", + "name": "test org 2" + } + ], + "stacks": [ + { + "name": "Stack 1", + "uid": "stack-uid-1", + "api_key": "stack_api_key_1" + }, + { + "name": "Stack 2", + "uid": "stack-uid-2", + "api_key": "stack_api_key_2" + } + ], + "users": [ + { + "uid": "uid1", + "email": "test@gmail.abc", + "user_uid": "user1", + "org_uid": "test-uid-1", + "invited_by": "user2", + "invited_at": "2023-08-21T11:08:41.038Z", + "status": "accepted", + "acceptance_token": "dfghdfgd", + "created_at": "2023-08-21T11:08:41.036Z", + "updated_at": "2023-08-21T11:09:11.342Z", + "urlPath": "/user", + "organizations": [ + { + "uid": "test-uid-1", + "name": "test org 1", + "org_roles": [ + { + "uid": "role1", + "name": "Admin", + "description": "Admin Role", + "org_uid": "test-uid-1", + "admin": true, + "default": true + } + ] + } + ] + }, + { + "uid": "test-uid-2", + "name": "test org 2" + } + ], + "roles": [ + { + "urlPath": "/roles/role1", + "uid": "role1", + "name": "admin", + "description": "The Admin role has rights to add/remove users from an organization, and has access to stacks created by self or shared by others.", + "org_uid": "test-uid-1", + "owner_uid": "user1", + "admin": true, + "default": true, + "users": ["user2", "user3"], + "created_at": "2023-08-08T10:09:43.445Z", + "updated_at": "2023-08-21T11:08:41.042Z" + } + ], + "contentTypes": [ + { + "stackHeaders": { + "api_key": "stack_api_key_1" + }, + "urlPath": "/content_types/ct1", + "created_at": "2023-08-08T13:52:31.980Z", + "updated_at": "2023-08-08T13:52:34.265Z", + "title": "CT 1", + "uid": "ct_1", + "_version": 2, + "inbuilt_class": false, + "schema": [ + { + "data_type": "text", + "display_name": "Title", + "field_metadata": { + "_default": true, + "version": 3 + }, + "mandatory": true, + "uid": "title", + "unique": true, + "multiple": false, + "non_localizable": false + } + ] + }, + { + "stackHeaders": { + "api_key": "stack_api_key_1" + }, + "urlPath": "/content_types/ct2", + "created_at": "2023-08-08T13:52:31.980Z", + "updated_at": "2023-08-08T13:52:34.265Z", + "title": "CT 2", + "uid": "ct_2", + "_version": 2, + "inbuilt_class": false, + "schema": [ + { + "data_type": "text", + "display_name": "Title", + "field_metadata": { + "_default": true, + "version": 3 + }, + "mandatory": true, + "uid": "title", + "unique": true, + "multiple": false, + "non_localizable": false + } + ] + } + ], + "branch": { + "stackHeaders": { + "api_key": "stack_api_key_1" + }, + "urlPath": "/stacks/branches/test_branch1", + "uid": "test_branch1", + "source": "", + "created_by": "user1", + "updated_by": "user1", + "created_at": "2023-08-08T13:51:43.217Z", + "updated_at": "2023-08-08T13:51:43.217Z", + "deleted_at": false + }, + "entry": [ + { + "stackHeaders": { + "api_key": "stack_api_key_1" + }, + "content_type_uid": "home", + "urlPath": "/content_types/ct1/entries/test_entry1", + "title": "Test Entry1", + "url": "/", + "tags": [], + "locale": "en1", + "uid": "test_entry1", + "created_by": "user1", + "updated_by": "user1", + "created_at": "2023-08-08T13:52:46.592Z", + "updated_at": "2023-08-08T13:52:46.592Z", + "_version": 1 + } + ], + "environments": [ + { + "stackHeaders": { + "api_key": "stack_api_key_1" + }, + "urlPath": "/environments/development", + "urls": [ + { + "url": "http://localhost:3000/", + "locale": "en1" + } + ], + "name": "development", + "_version": 3, + "uid": "env1", + "created_by": "user1", + "updated_by": "user1", + "created_at": "2023-06-12T18:59:56.853Z", + "updated_at": "2023-06-12T18:59:56.853Z" + } + ], + "locales": [ + { + "code": "en1", + "name": "English - En", + "fallback_locale": "en-us", + "uid": "gsfdasgdf", + "created_at": "2023-09-11T10:44:40.213Z", + "updated_at": "2023-09-11T10:44:40.213Z", + "ACL": [], + "_version": 1 + } + ] +} diff --git a/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.js b/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.js index d2415f7179..0f88eb5311 100644 --- a/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.js +++ b/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.js @@ -1,219 +1,287 @@ -/* eslint-disable no-undef */ -const { describe, it, beforeEach, afterEach } = require('mocha'); -const ExportToCsvCommand = require('../../../src/commands/cm/export-to-csv'); -const { stub, assert } = require('sinon'); -const { config } = require('dotenv'); +const fs = require('fs'); +const mkdirp = require('mkdirp'); +const { test, expect } = require('@oclif/test'); +const { join } = require('path'); +const { PassThrough } = require('stream'); const inquirer = require('inquirer'); -const { cliux } = require('@contentstack/cli-utilities'); +const checkboxPlus = require('inquirer-checkbox-plus-prompt'); +const { cliux, configHandler } = require('@contentstack/cli-utilities'); -config(); +const mockData = require('../../mock-data/common.mock.json'); -describe('Export to csv command with action = entries', () => { - let inquireStub; - let errorStub; - let consoleLogStub; +const { cma } = configHandler.get('region'); - beforeEach(() => { - inquireStub = stub(inquirer, 'prompt'); - errorStub = stub(cliux, 'error'); - consoleLogStub = stub(cliux, 'print'); +describe('export-to-csv with action taxonomies', () => { + describe('Create taxonomies & terms csv file with all flags including taxonomy uid', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .nock(cma, (api) => { + api + .get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`) + .reply(200, { stacks: mockData.stacks }); + }) + .nock(cma, (api) => { + api + .get(`/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}?include_count=true&skip=0&limit=30`) + .reply(200, { taxonomy: mockData.taxonomiesResp.taxonomies[0] }); + }) + .nock(cma, (api) => { + api + .get(`/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/terms?include_count=true&skip=0&limit=100`) + .reply(200, { terms: mockData.termsResp.terms, count: mockData.termsResp.count }); + }) + .command([ + 'cm:export-to-csv', + '--action', + 'taxonomies', + '--taxonomy-uid', + mockData.taxonomiesResp.taxonomies[0].uid, + '--stack-api-key', + mockData.stacks[0].api_key, + '--org', + mockData.organizations[0].uid, + ]) + .it('CSV file should be created'); }); - afterEach(() => { - inquireStub.restore(); - errorStub.restore(); - consoleLogStub.restore(); + describe('Create taxonomies & terms csv file with all flags excluding taxonomy uid', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .nock(cma, (api) => { + api + .get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`) + .reply(200, { stacks: mockData.stacks }); + }) + .nock(cma, (api) => { + api + .get('/v3/taxonomies?include_count=true&skip=0&limit=100') + .reply(200, { taxonomies: mockData.taxonomiesResp.taxonomies, count: mockData.taxonomiesResp.count }); + }) + .nock(cma, (api) => { + api + .get(`/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/terms?include_count=true&skip=0&limit=100`) + .reply(200, { terms: mockData.termsResp.terms, count: mockData.termsResp.count }); + }) + .nock(cma, (api) => { + api + .get(`/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[1].uid}/terms?include_count=true&skip=0&limit=100`) + .reply(200, { terms: [], count: 0 }); + }) + .command([ + 'cm:export-to-csv', + '--action', + 'taxonomies', + '--stack-api-key', + mockData.stacks[0].api_key, + '--org', + mockData.organizations[0].uid, + ]) + .it('file should be created'); }); - it('Should ask for action when action is not passed (entries or users)', async () => { - await ExportToCsvCommand.run([]); - assert.calledOnce(inquireStub); - }); - - it('Should ask for org when org is not passed', async () => { - const args = ['--action', 'entries']; - await ExportToCsvCommand.run(args); - assert.calledOnce(inquireStub); - }); - - it('Should ask for stack when stack api key flag is not passed', async (done) => { - const args = ['--action', 'entries', '--org', process.env.ORG]; - done(); - await ExportToCsvCommand.run(args); - assert.calledOnce(inquireStub); - }); - - it('Should ask for branch when branch flag is not passed', async () => { - const args = ['--action', 'entries', '--org', process.env.ORG, '--stack-api-key', process.env.STACK]; - await ExportToCsvCommand.run(args); - assert.calledTwice(inquireStub); - }); - - it('Should throw an error if stack does not have branches enabled', async () => { - const args = [ - '--action', - 'entries', - '--org', - process.env.ORG_WITH_NO_BRANCHES, - '--stack-api-key', - process.env.STACK_WITH_ORG_WITH_NO_BRANCHES, - '--branch', - 'invalid', - ]; - await ExportToCsvCommand.run(args); - assert.calledWith( - errorStub, - 'Branches are not part of your plan. Please contact support@contentstack.com to upgrade your plan.', - ); - }); - - it('Should ask for content type when content type flag is not passed', async () => { - const args = [ - '--action', - 'entries', - '--org', - process.env.ORG, - '--stack-api-key', - process.env.STACK, - '--branch', - process.env.BRANCH, - ]; - await ExportToCsvCommand.run(args); - assert.calledOnce(inquireStub); - }); - - it('Should create a file starting with the name passed as stack-name flag', async () => { - const args = [ - '--action', - 'entries', - '--org', - process.env.ORG, - '--stack-api-key', - process.env.STACK, - '--branch', - process.env.BRANCH, - '--content-type', - 'page', - '--locale', - 'en-us', - '--stack-name', - 'okok', - ]; - await ExportToCsvCommand.run(args); - assert.calledWith(consoleLogStub, `Writing entries to file: ${process.cwd()}/okok_page_en-us_entries_export.csv`); - }); - - it('Should throw an error when invalid org is passed', async () => { - const args = ['--action', 'entries', '--org', 'invalid']; - await ExportToCsvCommand.run(args); - assert.calledWith(errorStub, `Couldn't find the organization. Please check input parameters.`); - }); - - it('Should throw an error when invalid stack is passed', async () => { - const args = ['--action', 'entries', '--org', process.env.ORG, '--stack-api-key', 'invalid']; - await ExportToCsvCommand.run(args); - assert.calledWith(errorStub, 'Could not find stack'); - }); - - it('Should throw an error when invalid branch is passed', async () => { - const args = [ - '--action', - 'entries', - '--org', - process.env.ORG, - '--stack-api-key', - process.env.STACK, - '--branch', - process.env.INVALID_BRANCH, - ]; - await ExportToCsvCommand.run(args); - assert.calledWith(errorStub, 'Failed to fetch Branch. Please try again with valid parameters.'); - }); - - it('Should throw an error when invalid contenttype is passed', async () => { - const args = [ - '--action', - 'entries', - '--org', - process.env.ORG, - '--stack-api-key', - process.env.STACK, - '--branch', - process.env.BRANCH, - '--content-type', - 'invalid', - '--locale', - 'en-us', - ]; - await ExportToCsvCommand.run(args); - assert.calledWith( - errorStub, - `The Content Type invalid was not found. Please try again. Content Type is not valid.`, - ); - }); - - it('Should throw an error when invalid locale is passed', async () => { - const args = [ - '--action', - 'entries', - '--org', - process.env.ORG, - '--stack-api-key', - process.env.STACK, - '--branch', - process.env.BRANCH, - '--content-type', - 'header', - '--locale', - 'invalid', - ]; - await ExportToCsvCommand.run(args); - assert.calledWith(errorStub, 'Language was not found. Please try again.'); + describe('Create taxonomies & terms csv file with prompt', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .stub(inquirer, 'registerPrompt', () => {}) + .stub(inquirer, 'prompt', () => { + return Promise.resolve({ + action: 'taxonomies', + chosenOrg: mockData.organizations[0].name, + chosenStack: mockData.stacks[0].name, + }); + }) + .nock(cma, (api) => { + api + .get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`) + .reply(200, { stacks: mockData.stacks }); + }) + .nock(cma, (api) => { + api.get(`/v3/organizations?limit=100`).reply(200, { organizations: mockData.organizations }); + }) + .nock(cma, (api) => { + api + .get(`/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}?include_count=true&skip=0&limit=30`) + .reply(200, { taxonomy: mockData.taxonomiesResp.taxonomies[0] }); + }) + .nock(cma, (api) => { + api + .get(`/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/terms?include_count=true&skip=0&limit=100`) + .reply(200, { terms: mockData.termsResp.terms, count: mockData.termsResp.count }); + }) + .command(['cm:export-to-csv', '--taxonomy-uid', 'taxonomy_uid_1']) + .it('CSV file should be created'); }); }); -describe('Export to csv command with action = users', () => { - let inquireStub; - let errorStub; - let consoleLogStub; - - beforeEach(() => { - inquireStub = stub(inquirer, 'prompt'); - errorStub = stub(cliux, 'error'); - consoleLogStub = stub(cliux, 'print'); - }); +describe('export-to-csv with action entries', () => { - afterEach(() => { - inquireStub.restore(); - errorStub.restore(); - consoleLogStub.restore(); + describe('Create entries csv file with flags', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .nock(cma, (api) => { + api + .get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`) + .reply(200, { stacks: mockData.stacks }); + }) + .nock(cma, (api) => { + api.get('/v3/environments').reply(200, { environments: mockData.environments }); + }) + .nock(cma, (api) => { + api.get('/v3/content_types?count=true').reply(200, { content_types: 2 }); + }) + .nock(cma, (api) => { + api.get('/v3/content_types').reply(200, { content_types: mockData.contentTypes }); + }) + .nock(cma, (api) => { + api + .get( + `/v3/content_types/${mockData.contentTypes[0].uid}/entries?include_publish_details=true&locale=en1&count=true`, + ) + .reply(200, { entries: 2 }); + }) + .nock(cma, (api) => { + api + .get( + `/v3/content_types/${mockData.contentTypes[0].uid}/entries?include_publish_details=true&locale=en1&skip=0&limit=100&include_workflow=true`, + ) + .reply(200, { entries: mockData.entry }); + }) + .command([ + 'cm:export-to-csv', + '--action', + 'entries', + '--stack-api-key', + mockData.stacks[0].api_key, + '--org', + mockData.organizations[0].uid, + '--branch', + mockData.branch.uid, + '--locale', + 'en1', + '--content-type', + mockData.contentTypes[0].uid, + ]) + .it('Entries CSV file should be created'); }); - it('Should ask for org when org is not passed', async () => { - const args = ['--action', 'entries']; - await ExportToCsvCommand.run(args); - assert.calledOnce(inquireStub); - }); - - it('Should write users data to file if the user has permissions', async () => { - const args = ['--action', 'users', '--org', process.env.ORG]; - - await ExportToCsvCommand.run(args); - assert.calledWith( - consoleLogStub, - `Writing organization details to file: ${process.cwd()}/${process.env.ORG}_users_export.csv`, - ); + describe('Create entries csv file with prompt', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .stub(inquirer, 'registerPrompt', () => {}) + .stub(inquirer, 'prompt', () => { + return Promise.resolve({ + action: 'entries', + chosenOrg: mockData.organizations[0].name, + chosenLanguage: mockData.locales[0].name, + chosenStack: mockData.stacks[0].name, + chosenContentTypes: [mockData.contentTypes[0].uid], + branch: mockData.branch.uid, + }); + }) + .nock(cma, (api) => { + api.get(`/v3/organizations?limit=100`).reply(200, { organizations: mockData.organizations }); + }) + .nock(cma, (api) => { + api + .get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`) + .reply(200, { stacks: mockData.stacks }); + }) + .nock(cma, (api) => { + api.get('/v3/environments').reply(200, { environments: mockData.environments }); + }) + .nock(cma, (api) => { + api.get('/v3/locales').reply(200, { locales: mockData.locales }); + }) + .nock(cma, (api) => { + api.get('/v3/stacks/branches').reply(200, { branches: mockData.branch }); + }) + .nock(cma, (api) => { + api.get('/v3/content_types?count=true').reply(200, { content_types: 2 }); + }) + .nock(cma, (api) => { + api.get('/v3/content_types?skip=0&include_branch=true').reply(200, { content_types: mockData.contentTypes }); + }) + .nock(cma, (api) => { + api + .get( + `/v3/content_types/${mockData.contentTypes[0].uid}/entries?include_publish_details=true&locale=${mockData.locales[0].code}&count=true`, + ) + .reply(200, { entries: 1 }); + }) + .nock(cma, (api) => { + api + .get( + `/v3/content_types/${mockData.contentTypes[0].uid}/entries?include_publish_details=true&locale=${mockData.locales[0].code}&skip=0&limit=100&include_workflow=true`, + ) + .reply(200, { entries: mockData.entry }); + }) + .command(['cm:export-to-csv']) + .it('Entries CSV file should be created with prompt'); }); +}); - it('Should show an error that user does not have org permissions to perform the operation if user enters such org', async () => { - const args = ['--action', 'users', '--org', process.env.ORG_WITH_NO_PERMISSION]; - await ExportToCsvCommand.run(args); - assert.calledWith(errorStub, `You don't have the permission to do this operation.`); +describe('export-to-csv with action users', () => { + describe('Export users csv file with flags', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .nock(cma, (api) => { + api.get('/v3/user?include_orgs_roles=true').reply(200, { user: mockData.users[0] }).persist(); + }) + .nock(cma, (api) => { + api.get(`/v3/organizations/${mockData.organizations[0].uid}/roles`).reply(200, { roles: mockData.roles }); + }) + .nock(cma, (api) => { + api + .get(`/v3/organizations/${mockData.organizations[0].uid}/share?skip=0&page=1&limit=100`) + .reply(200, { users: mockData.users }); + }) + .command(['cm:export-to-csv', '--action', 'users', '--org', mockData.organizations[0].uid]) + .it('Users csv file should be successfully created'); }); - it('Should create a file starting with the name passed as org-name flag', async () => { - const args = ['--action', 'users', '--org', process.env.ORG, '--org-name', 'okok']; - await ExportToCsvCommand.run(args); - assert.calledWith(consoleLogStub, `Writing organization details to file: ${process.cwd()}/okok_users_export.csv`); + describe('Export users csv file with prompt', () => { + test + .stdout({ print: process.env.PRINT === 'true' || false }) + .stub(fs, 'createWriteStream', () => new PassThrough()) + .stub(mkdirp, 'sync', () => {}) + .stub(process, 'chdir', () => {}) + .stub(inquirer, 'registerPrompt', () => {}) + .stub(inquirer, 'prompt', () => { + return Promise.resolve({ action: 'users', chosenOrg: mockData.organizations[0].name }); + }) + .nock(cma, (api) => { + api.get(`/v3/organizations?limit=100`).reply(200, { organizations: mockData.organizations }); + }) + .nock(cma, (api) => { + api.get('/v3/user?include_orgs_roles=true').reply(200, { user: mockData.users[0] }).persist(); + }) + .nock(cma, (api) => { + api.get(`/v3/organizations/${mockData.organizations[0].uid}/roles`).reply(200, { roles: mockData.roles }); + }) + .nock(cma, (api) => { + api + .get(`/v3/organizations/${mockData.organizations[0].uid}/share?skip=0&page=1&limit=100`) + .reply(200, { users: mockData.users }); + }) + .command(['cm:export-to-csv']) + .it('Users csv file should be successfully created'); }); }); diff --git a/packages/contentstack-export-to-csv/test/util/common-utils.test.js b/packages/contentstack-export-to-csv/test/util/common-utils.test.js new file mode 100644 index 0000000000..042ff4b84b --- /dev/null +++ b/packages/contentstack-export-to-csv/test/util/common-utils.test.js @@ -0,0 +1,52 @@ +const { fancy } = require('fancy-test'); +const { test, expect } = require('@oclif/test'); +const inquirer = require('inquirer'); +const { cliux, configHandler, ContentstackClient, managementSDKClient } = require('@contentstack/cli-utilities'); + +const mockData = require('../mock-data/common.mock.json'); +const { getStacks, chooseBranch } = require('../../src/util/index'); + +const { cma } = configHandler.get('region'); + +describe('common utils', () => { + let managementSdk; + before(async () => { + managementSdk = await managementSDKClient({ + host: cma.replace('https://', ''), + }); + }); + + describe('chooseStack', () => { + describe('choose stack from list of stacks', () => { + fancy + .nock(cma, (api) => + api + .get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`) + .reply(200, { stacks: mockData.stacks }), + ) + .stub(inquirer, 'prompt', () => { + return Promise.resolve({ + chosenStack: mockData.stacks[0].name, + }); + }) + .it('Returns list of stacks', async () => { + await getStacks(managementSdk, mockData.organizations[0].uid); + }); + }); + }); + + describe('chooseBranch', () => { + describe('choose branch from list of branch', () => { + fancy + .stub(inquirer, 'prompt', () => { + return Promise.resolve({ + branch: mockData.branch.uid, + }); + }) + .it('Returns list of stacks', async () => { + const { branch } = await chooseBranch([mockData.branch]); + expect(branch).to.equal(mockData.branch.uid); + }); + }); + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 71c060cd31..9c9bb5be8e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -617,9 +617,12 @@ importers: '@contentstack/cli-command': ~1.2.12 '@contentstack/cli-utilities': ~1.5.2 '@oclif/test': ^2.2.10 - chai: ^4.2.0 + '@types/chai': ^4.3.6 + '@types/mocha': ^10.0.1 + chai: ^4.3.8 chalk: ^4.1.0 debug: ^4.3.1 + dotenv: ^16.3.1 eslint: ^7.32.0 eslint-config-oclif: ^4.0.0 fast-csv: ^4.3.6 @@ -627,7 +630,7 @@ importers: inquirer: 8.2.4 inquirer-checkbox-plus-prompt: 1.0.1 mkdirp: ^3.0.1 - mocha: ^10.0.0 + mocha: ^10.2.0 nyc: ^15.1.0 oclif: ^3.8.1 dependencies: @@ -640,12 +643,15 @@ importers: mkdirp: 3.0.1 devDependencies: '@oclif/test': 2.3.31 - chai: 4.3.7 + '@types/chai': 4.3.6 + '@types/mocha': 10.0.1 + chai: 4.3.8 debug: 4.3.4 + dotenv: 16.3.1 eslint: 7.32.0 eslint-config-oclif: 4.0.0_eslint@7.32.0 globby: 10.0.2 - mocha: 10.1.0 + mocha: 10.2.0 nyc: 15.1.0 oclif: 3.9.1 @@ -3241,6 +3247,10 @@ packages: /@types/chai/4.3.5: resolution: {integrity: sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==} + /@types/chai/4.3.6: + resolution: {integrity: sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==} + dev: true + /@types/cli-progress/3.11.0: resolution: {integrity: sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg==} dependencies: @@ -3413,6 +3423,10 @@ packages: '@types/node': 14.18.53 dev: true + /@types/mocha/10.0.1: + resolution: {integrity: sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==} + dev: true + /@types/mocha/8.2.3: resolution: {integrity: sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==} dev: true @@ -4737,6 +4751,19 @@ packages: type-detect: 4.0.8 dev: true + /chai/4.3.8: + resolution: {integrity: sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ==} + engines: {node: '>=4'} + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.2 + deep-eql: 4.1.3 + get-func-name: 2.0.0 + loupe: 2.3.6 + pathval: 1.1.1 + type-detect: 4.0.8 + dev: true + /chalk/1.1.3: resolution: {integrity: sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==} engines: {node: '>=0.10.0'} @@ -9308,6 +9335,34 @@ packages: yargs-unparser: 2.0.0 dev: true + /mocha/10.2.0: + resolution: {integrity: sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==} + engines: {node: '>= 14.0.0'} + hasBin: true + dependencies: + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.4_supports-color@8.1.1 + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.0.1 + ms: 2.1.3 + nanoid: 3.3.3 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.2.1 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + dev: true + /mock-stdin/1.0.0: resolution: {integrity: sha512-tukRdb9Beu27t6dN+XztSRHq9J0B/CoAOySGzHfn8UTfmqipA5yNT/sDUEyYdAV3Hpka6Wx6kOMxuObdOex60Q==}