diff --git a/package-lock.json b/package-lock.json index 1a74fab8cc..27d1b2469d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -883,11 +883,12 @@ } }, "node_modules/@contentstack/management": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/@contentstack/management/-/management-1.13.0.tgz", - "integrity": "sha512-zVApJ9dpZTq6yBvSTdwrTjPxe20PiXy9x5CGU49by2n1V7hWhsKtSpcIK+Fx9jylYfYU4SEM/HQIKq/i0roMew==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/@contentstack/management/-/management-1.15.3.tgz", + "integrity": "sha512-huI2T8Il+o+lQVQ78DupaIT+R0iE9XdBknh5jcua6nbwL0m9YiyVwGaf1QZGGwCqZNhJLad/Nf8JJgNlzVCCsA==", "dependencies": { - "axios": "^1.6.0", + "@slack/bolt": "^3.17.1", + "axios": "^1.6.5", "form-data": "^3.0.1", "lodash": "^4.17.21", "qs": "^6.11.2" @@ -2801,6 +2802,221 @@ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz", "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==" }, + "node_modules/@slack/bolt": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/@slack/bolt/-/bolt-3.17.1.tgz", + "integrity": "sha512-N+4WxpkM59RXi7BL3IXUtENnn9cF7TOBn7ttaHpgvlnjUaro+yQyY60arXTlP4ytVDFJ1w0mSdfftcM17h+i2w==", + "dependencies": { + "@slack/logger": "^4.0.0", + "@slack/oauth": "^2.6.2", + "@slack/socket-mode": "^1.3.3", + "@slack/types": "^2.11.0", + "@slack/web-api": "^6.11.2", + "@types/express": "^4.16.1", + "@types/promise.allsettled": "^1.0.3", + "@types/tsscmp": "^1.0.0", + "axios": "^1.6.0", + "express": "^4.16.4", + "path-to-regexp": "^6.2.1", + "please-upgrade-node": "^3.2.0", + "promise.allsettled": "^1.0.2", + "raw-body": "^2.3.3", + "tsscmp": "^1.0.6" + }, + "engines": { + "node": ">=12.13.0", + "npm": ">=6.12.0" + } + }, + "node_modules/@slack/bolt/node_modules/path-to-regexp": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" + }, + "node_modules/@slack/logger": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-4.0.0.tgz", + "integrity": "sha512-Wz7QYfPAlG/DR+DfABddUZeNgoeY7d1J39OCR2jR+v7VBsB8ezulDK5szTnDDPDwLH5IWhLvXIHlCFZV7MSKgA==", + "dependencies": { + "@types/node": ">=18.0.0" + }, + "engines": { + "node": ">= 18", + "npm": ">= 8.6.0" + } + }, + "node_modules/@slack/oauth": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/@slack/oauth/-/oauth-2.6.2.tgz", + "integrity": "sha512-2R3MyB/R63hTRXzk5J6wcui59TBxXzhk+Uh2/Xu3Wp3O4pXg/BNucQhP/DQbL/ScVhLvFtMXirLrKi0Yo5gIVw==", + "dependencies": { + "@slack/logger": "^3.0.0", + "@slack/web-api": "^6.11.2", + "@types/jsonwebtoken": "^8.3.7", + "@types/node": ">=12", + "jsonwebtoken": "^9.0.0", + "lodash.isstring": "^4.0.1" + }, + "engines": { + "node": ">=12.13.0", + "npm": ">=6.12.0" + } + }, + "node_modules/@slack/oauth/node_modules/@slack/logger": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-3.0.0.tgz", + "integrity": "sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==", + "dependencies": { + "@types/node": ">=12.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/socket-mode": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@slack/socket-mode/-/socket-mode-1.3.3.tgz", + "integrity": "sha512-vN3zG4woRtf2Ut6rZgRW6G/Oe56uLMlnz39I08Q7DOvVfB+1MmDbNv0PNOiFgujdKXJR+bXF41/F/VvryXcqlw==", + "dependencies": { + "@slack/logger": "^3.0.0", + "@slack/web-api": "^6.11.2", + "@types/node": ">=12.0.0", + "@types/p-queue": "^2.3.2", + "@types/ws": "^7.4.7", + "eventemitter3": "^3.1.0", + "finity": "^0.5.4", + "p-cancelable": "^1.1.0", + "p-queue": "^2.4.2", + "ws": "^7.5.3" + }, + "engines": { + "node": ">=12.13.0", + "npm": ">=6.12.0" + } + }, + "node_modules/@slack/socket-mode/node_modules/@slack/logger": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-3.0.0.tgz", + "integrity": "sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==", + "dependencies": { + "@types/node": ">=12.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/socket-mode/node_modules/eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + }, + "node_modules/@slack/socket-mode/node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@slack/socket-mode/node_modules/p-queue": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-2.4.2.tgz", + "integrity": "sha512-n8/y+yDJwBjoLQe1GSJbbaYQLTI7QHNZI2+rpmCDbe++WLf9HC3gf6iqj5yfPAV71W4UF3ql5W1+UBPXoXTxng==", + "engines": { + "node": ">=4" + } + }, + "node_modules/@slack/socket-mode/node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@slack/types": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@slack/types/-/types-2.11.0.tgz", + "integrity": "sha512-UlIrDWvuLaDly3QZhCPnwUSI/KYmV1N9LyhuH6EDKCRS1HWZhyTG3Ja46T3D0rYfqdltKYFXbJSSRPwZpwO0cQ==", + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/web-api": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.12.0.tgz", + "integrity": "sha512-RPw6F8rWfGveGkZEJ4+4jUin5iazxRK2q3FpQDz/FvdgzC3nZmPyLx8WRzc6nh0w3MBjEbphNnp2VZksfhpBIQ==", + "dependencies": { + "@slack/logger": "^3.0.0", + "@slack/types": "^2.11.0", + "@types/is-stream": "^1.1.0", + "@types/node": ">=12.0.0", + "axios": "^1.6.5", + "eventemitter3": "^3.1.0", + "form-data": "^2.5.0", + "is-electron": "2.2.2", + "is-stream": "^1.1.0", + "p-queue": "^6.6.1", + "p-retry": "^4.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/web-api/node_modules/@slack/logger": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@slack/logger/-/logger-3.0.0.tgz", + "integrity": "sha512-DTuBFbqu4gGfajREEMrkq5jBhcnskinhr4+AnfJEk48zhVeEv3XnUKGIX98B74kxhYsIMfApGGySTn7V3b5yBA==", + "dependencies": { + "@types/node": ">=12.0.0" + }, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/web-api/node_modules/eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + }, + "node_modules/@slack/web-api/node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/@slack/web-api/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@szmarczak/http-timer": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", @@ -3102,6 +3318,14 @@ "tslib": "^2.1.0" } }, + "node_modules/@types/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@types/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-jkZatu4QVbR60mpIzjINmtS1ZF4a/FqdTUTBeQDVOQ2PYyidtwFKr0B5G6ERukKwliq+7mIXvxyppwzG5EgRYg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -3157,6 +3381,14 @@ "@types/node": "*" } }, + "node_modules/@types/jsonwebtoken": { + "version": "8.5.9", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.9.tgz", + "integrity": "sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/keyv": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", @@ -3243,6 +3475,11 @@ "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dev": true }, + "node_modules/@types/p-queue": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@types/p-queue/-/p-queue-2.3.2.tgz", + "integrity": "sha512-eKAv5Ql6k78dh3ULCsSBxX6bFNuGjTmof5Q/T6PiECDq0Yf8IIn46jCyp3RJvCi8owaEmm3DZH1PEImjBMd/vQ==" + }, "node_modules/@types/progress-stream": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@types/progress-stream/-/progress-stream-2.0.5.tgz", @@ -3252,6 +3489,11 @@ "@types/node": "*" } }, + "node_modules/@types/promise.allsettled": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/promise.allsettled/-/promise.allsettled-1.0.6.tgz", + "integrity": "sha512-wA0UT0HeT2fGHzIFV9kWpYz5mdoyLxKrTgMdZQM++5h6pYAFH73HXcQhefg24nD1yivUFEn5KU+EF4b+CXJ4Wg==" + }, "node_modules/@types/qs": { "version": "6.9.11", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.11.tgz", @@ -3271,6 +3513,11 @@ "@types/node": "*" } }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" + }, "node_modules/@types/semver": { "version": "7.5.6", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", @@ -3351,6 +3598,11 @@ "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" }, + "node_modules/@types/tsscmp": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/tsscmp/-/tsscmp-1.0.2.tgz", + "integrity": "sha512-cy7BRSU8GYYgxjcx0Py+8lo5MthuDhlyu076KUcYzVNXL23luYgRHkMG2fIFEc6neckeh/ntP82mw+U4QjZq+g==" + }, "node_modules/@types/uuid": { "version": "9.0.7", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz", @@ -3367,6 +3619,14 @@ "@types/node": "*" } }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -3972,7 +4232,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "is-array-buffer": "^3.0.1" @@ -4085,11 +4344,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array.prototype.map": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.6.tgz", + "integrity": "sha512-nK1psgF2cXqP3wSyCSq0Hc7zwNq3sfljQqaG27r/7a7ooNUnn5nGq6yYWyks9jMO5EoFQ0ax80hSg6oXSRNXaw==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-array-method-boxes-properly": "^1.0.0", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/arraybuffer.prototype.slice": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", - "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "call-bind": "^1.0.2", @@ -4190,7 +4466,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -4655,6 +4930,11 @@ "isarray": "^1.0.0" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -6059,7 +6339,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dev": true, "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", @@ -6256,6 +6535,14 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -6417,7 +6704,6 @@ "version": "1.22.3", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", - "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "arraybuffer.prototype.slice": "^1.0.2", @@ -6466,11 +6752,39 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" + }, + "node_modules/es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-get-iterator/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, "node_modules/es-set-tostringtag": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", - "dev": true, "dependencies": { "get-intrinsic": "^1.2.2", "has-tostringtag": "^1.0.0", @@ -6493,7 +6807,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -7694,8 +8007,7 @@ "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, "node_modules/events": { "version": "1.1.1", @@ -8209,6 +8521,11 @@ "pkg-dir": "^4.2.0" } }, + "node_modules/finity": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/finity/-/finity-0.5.4.tgz", + "integrity": "sha512-3l+5/1tuw616Lgb0QBimxfdd2TqaDGpfCBpfX6EqtFmqUV3FtQnVEX4Aa62DagYEqnsTIjZcTfbq9msDbXYgyA==" + }, "node_modules/first-chunk-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", @@ -8293,7 +8610,6 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, "dependencies": { "is-callable": "^1.1.3" } @@ -8449,7 +8765,6 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -8473,7 +8788,6 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8571,7 +8885,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -8678,7 +8991,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", - "dev": true, "dependencies": { "define-properties": "^1.1.3" }, @@ -8830,7 +9142,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8880,7 +9191,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -10006,7 +10316,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", - "dev": true, "dependencies": { "get-intrinsic": "^1.2.2", "hasown": "^2.0.0", @@ -10067,7 +10376,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -10083,7 +10391,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.0", @@ -10103,7 +10410,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, "dependencies": { "has-bigints": "^1.0.1" }, @@ -10127,7 +10433,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -10158,7 +10463,6 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -10181,7 +10485,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -10206,6 +10509,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-electron": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz", + "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==" + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -10301,6 +10609,14 @@ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "dev": true }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-nan": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", @@ -10321,7 +10637,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -10341,7 +10656,6 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -10428,7 +10742,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -10461,11 +10774,18 @@ "node": ">=8" } }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", - "dev": true, "dependencies": { "call-bind": "^1.0.2" }, @@ -10488,7 +10808,6 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -10503,7 +10822,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -10518,7 +10836,6 @@ "version": "1.1.12", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", - "dev": true, "dependencies": { "which-typed-array": "^1.1.11" }, @@ -10567,7 +10884,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, "dependencies": { "call-bind": "^1.0.2" }, @@ -10774,6 +11090,26 @@ "node": ">=8" } }, + "node_modules/iterate-iterator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.2.tgz", + "integrity": "sha512-t91HubM4ZDQ70M9wqp+pcNpu8OyJ9UAtXntT/Bcsvp5tZMnz9vRa+IunKXeI8AnfZMTv0jNuVEmGeLSMjVvfPw==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/iterate-value": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", + "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", + "dependencies": { + "es-get-iterator": "^1.0.2", + "iterate-iterator": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jackspeak": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", @@ -11961,6 +12297,27 @@ "node": "*" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, "node_modules/just-diff": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz", @@ -11977,6 +12334,25 @@ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==" }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -12423,6 +12799,11 @@ "resolved": "https://registry.npmjs.org/lodash.groupby/-/lodash.groupby-4.6.0.tgz", "integrity": "sha512-5dcWxm23+VAoz+awKmBaiBvzox8+RqMgFhi7UvX9DHZr2HdxHXM/Wrf8cfKpsW37RNrvtPn6hSwNqurSILbmJw==" }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, "node_modules/lodash.isboolean": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", @@ -12443,11 +12824,21 @@ "resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz", "integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==" }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, "node_modules/lodash.isnil": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/lodash.isnil/-/lodash.isnil-4.0.0.tgz", "integrity": "sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng==" }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, "node_modules/lodash.isobject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", @@ -12458,6 +12849,11 @@ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, "node_modules/lodash.isundefined": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash.isundefined/-/lodash.isundefined-3.0.1.tgz", @@ -12486,6 +12882,11 @@ "integrity": "sha512-XeqSp49hNGmlkj2EJlfrQFIzQ6lXdNro9sddtQzcJY8QaoC2GO0DT7xaIokHeyM+mIT0mPMlPvkYzg2xCuHdZg==", "dev": true }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, "node_modules/lodash.padend": { "version": "4.6.1", "resolved": "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz", @@ -17262,7 +17663,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, "engines": { "node": ">= 0.4" } @@ -17288,7 +17688,6 @@ "version": "4.1.5", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", - "dev": true, "dependencies": { "call-bind": "^1.0.5", "define-properties": "^1.2.1", @@ -17592,7 +17991,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", - "dev": true, "engines": { "node": ">=4" } @@ -17647,7 +18045,6 @@ "version": "6.6.2", "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", - "dev": true, "dependencies": { "eventemitter3": "^4.0.4", "p-timeout": "^3.2.0" @@ -17659,11 +18056,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/p-timeout": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", - "dev": true, "dependencies": { "p-finally": "^1.0.0" }, @@ -18136,6 +18544,14 @@ "node": ">=4" } }, + "node_modules/please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dependencies": { + "semver-compare": "^1.0.0" + } + }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", @@ -18352,6 +18768,25 @@ "node": ">= 4" } }, + "node_modules/promise.allsettled": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.7.tgz", + "integrity": "sha512-hezvKvQQmsFkOdrZfYxUxkyxl8mgFQeT259Ajj9PXdbg9VzBCWrItOev72JyWxkCD5VSSqAeHmlN3tWx4DlmsA==", + "dependencies": { + "array.prototype.map": "^1.0.5", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "iterate-value": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/prompt": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/prompt/-/prompt-1.3.0.tgz", @@ -19097,7 +19532,6 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -19292,7 +19726,6 @@ "version": "0.13.1", "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", - "dev": true, "engines": { "node": ">= 4" } @@ -19389,7 +19822,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", - "dev": true, "dependencies": { "call-bind": "^1.0.5", "get-intrinsic": "^1.2.2", @@ -19406,8 +19838,7 @@ "node_modules/safe-array-concat/node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" }, "node_modules/safe-buffer": { "version": "5.2.1", @@ -19441,7 +19872,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", - "dev": true, "dependencies": { "call-bind": "^1.0.5", "get-intrinsic": "^1.2.2", @@ -19507,6 +19937,11 @@ "node": ">=10" } }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==" + }, "node_modules/semver/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -19612,7 +20047,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", - "dev": true, "dependencies": { "define-data-property": "^1.0.1", "functions-have-names": "^1.2.3", @@ -20393,6 +20827,17 @@ "node": ">=8.0.0" } }, + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "dependencies": { + "internal-slot": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/stream-connect": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stream-connect/-/stream-connect-1.0.2.tgz", @@ -20484,7 +20929,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -20501,7 +20945,6 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -20515,7 +20958,6 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -21130,6 +21572,14 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "node_modules/tsscmp": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", + "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==", + "engines": { + "node": ">=0.6.x" + } + }, "node_modules/tsutils": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", @@ -21507,7 +21957,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.1", @@ -21521,7 +21970,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "for-each": "^0.3.3", @@ -21539,7 +21987,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", - "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -21558,7 +22005,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "for-each": "^0.3.3", @@ -21618,7 +22064,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "has-bigints": "^1.0.2", @@ -22021,7 +22466,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, "dependencies": { "is-bigint": "^1.0.1", "is-boolean-object": "^1.1.0", @@ -22056,7 +22500,6 @@ "version": "1.1.13", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", - "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.4", @@ -23560,18 +24003,18 @@ "@contentstack/cli-cm-bootstrap": "~1.9.0", "@contentstack/cli-cm-branches": "~1.0.22", "@contentstack/cli-cm-bulk-publish": "~1.4.0", - "@contentstack/cli-cm-clone": "~1.10.0", - "@contentstack/cli-cm-export": "~1.10.5", - "@contentstack/cli-cm-export-to-csv": "~1.6.2", - "@contentstack/cli-cm-import": "~1.13.5", + "@contentstack/cli-cm-clone": "~1.10.1", + "@contentstack/cli-cm-export": "~1.11.0", + "@contentstack/cli-cm-export-to-csv": "~1.7.0", + "@contentstack/cli-cm-import": "~1.14.0", "@contentstack/cli-cm-migrate-rte": "~1.4.15", "@contentstack/cli-cm-seed": "~1.7.1", "@contentstack/cli-command": "~1.2.17", "@contentstack/cli-config": "~1.6.2", "@contentstack/cli-launch": "~1.0.16", - "@contentstack/cli-migration": "~1.4.2", + "@contentstack/cli-migration": "~1.5.0", "@contentstack/cli-utilities": "~1.5.12", - "@contentstack/management": "~1.13.0", + "@contentstack/management": "~1.15.3", "@oclif/core": "^2.9.3", "@oclif/plugin-help": "^5", "@oclif/plugin-not-found": "^2.4.0", @@ -24100,12 +24543,12 @@ }, "packages/contentstack-clone": { "name": "@contentstack/cli-cm-clone", - "version": "1.10.0", + "version": "1.10.1", "license": "MIT", "dependencies": { "@colors/colors": "^1.5.0", - "@contentstack/cli-cm-export": "~1.10.5", - "@contentstack/cli-cm-import": "~1.13.5", + "@contentstack/cli-cm-export": "~1.11.0", + "@contentstack/cli-cm-import": "~1.14.0", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.13", "async": "^3.2.4", @@ -24537,7 +24980,7 @@ }, "packages/contentstack-export": { "name": "@contentstack/cli-cm-export", - "version": "1.10.5", + "version": "1.11.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", @@ -24587,7 +25030,7 @@ }, "packages/contentstack-export-to-csv": { "name": "@contentstack/cli-cm-export-to-csv", - "version": "1.6.2", + "version": "1.7.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", @@ -25005,13 +25448,13 @@ }, "packages/contentstack-import": { "name": "@contentstack/cli-cm-import", - "version": "1.13.5", + "version": "1.14.0", "license": "MIT", "dependencies": { "@contentstack/cli-audit": "~1.4.0", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.13", - "@contentstack/management": "~1.13.0", + "@contentstack/management": "~1.15.3", "@oclif/core": "^2.9.3", "big-json": "^3.2.0", "bluebird": "^3.7.2", @@ -25448,7 +25891,7 @@ }, "packages/contentstack-migration": { "name": "@contentstack/cli-migration", - "version": "1.4.2", + "version": "1.5.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "~1.2.16", @@ -25484,7 +25927,7 @@ "version": "1.7.1", "license": "MIT", "dependencies": { - "@contentstack/cli-cm-import": "~1.13.5", + "@contentstack/cli-cm-import": "~1.14.0", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.13", "inquirer": "8.2.4", @@ -25571,7 +26014,7 @@ "version": "1.5.13", "license": "MIT", "dependencies": { - "@contentstack/management": "~1.13.0", + "@contentstack/management": "~1.15.3", "@contentstack/marketplace-sdk": "^1.0.1", "@oclif/core": "^2.9.3", "axios": "^1.6.4", @@ -25688,6 +26131,21 @@ "url": "https://github.com/sponsors/isaacs" } }, + "packages/contentstack/node_modules/@contentstack/cli-cm-export-to-csv/node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "extraneous": true, + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "packages/contentstack/node_modules/@contentstack/cli-cm-seed/node_modules/@contentstack/cli-cm-import": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@contentstack/cli-cm-import/-/cli-cm-import-1.10.0.tgz", diff --git a/packages/contentstack-bootstrap/README.md b/packages/contentstack-bootstrap/README.md index e4995d2897..2c40af0a0f 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.7.1 darwin-arm64 node-v20.8.0 +@contentstack/cli-cm-bootstrap/1.8.0 darwin-arm64 node-v18.19.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-clone/README.md b/packages/contentstack-clone/README.md index 85de4211c1..2d16d69ea4 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.10.0 darwin-arm64 node-v20.8.0 +@contentstack/cli-cm-clone/1.10.1 darwin-arm64 node-v20.8.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-clone/package.json b/packages/contentstack-clone/package.json index 9fefe51e13..167a528116 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.10.0", + "version": "1.10.1", "author": "Contentstack", "bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues", "dependencies": { - "@contentstack/cli-cm-export": "~1.10.5", - "@contentstack/cli-cm-import": "~1.13.5", + "@contentstack/cli-cm-export": "~1.11.0", + "@contentstack/cli-cm-import": "~1.14.0", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.13", "@colors/colors": "^1.5.0", diff --git a/packages/contentstack-export-to-csv/package.json b/packages/contentstack-export-to-csv/package.json index 6909033e04..1214c2c401 100644 --- a/packages/contentstack-export-to-csv/package.json +++ b/packages/contentstack-export-to-csv/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-export-to-csv", "description": "Export entities to csv", - "version": "1.6.2", + "version": "1.7.0", "author": "Abhinav Gupta @abhinav-from-contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-export-to-csv/src/util/index.js b/packages/contentstack-export-to-csv/src/util/index.js index 4c646b3779..150c74c02b 100644 --- a/packages/contentstack-export-to-csv/src/util/index.js +++ b/packages/contentstack-export-to-csv/src/util/index.js @@ -460,7 +460,7 @@ function write(command, entries, fileName, message, delimiter, headers) { process.chdir(directory); } // eslint-disable-next-line no-undef - cliux.print(`Writing ${message} to file: ${process.cwd()}${delimeter}${fileName}`); + cliux.print(`Writing ${message} to file: "${process.cwd()}${delimeter}${fileName}"`); if (headers?.length) fastcsv.writeToPath(fileName, entries, { headers, delimiter }); else fastcsv.writeToPath(fileName, entries, { headers: true, delimiter }); } @@ -700,10 +700,10 @@ function handleErrorMsg(err) { /** * This function does the sdk calls to get all the teams in org - * @param {object} managementAPIClient - * @param {object} org - * @param {object} queryParam - * @returns + * @param {object} managementAPIClient + * @param {object} org + * @param {object} queryParam + * @returns */ async function getAllTeams(managementAPIClient, org, queryParam = {}) { try { @@ -715,8 +715,8 @@ async function getAllTeams(managementAPIClient, org, queryParam = {}) { /** * This function is used to handle the pagination and call the sdk - * @param {object} managementAPIClient - * @param {object} org + * @param {object} managementAPIClient + * @param {object} org */ async function exportOrgTeams(managementAPIClient, org) { let allTeamsInOrg = []; @@ -737,9 +737,9 @@ async function exportOrgTeams(managementAPIClient, org) { } /** - * This function will get all the org level roles - * @param {object} managementAPIClient - * @param {object} org + * This function will get all the org level roles + * @param {object} managementAPIClient + * @param {object} org */ async function getOrgRolesForTeams(managementAPIClient, org) { let roleMap = {}; // for org level there are two roles only admin and member @@ -763,9 +763,9 @@ async function getOrgRolesForTeams(managementAPIClient, org) { /** * Removes the unnecessary fields from the objects in the data and assign org level roles to the team based on role uid - * @param {array} data - * @param {object} managementAPIClient - * @param {object} org + * @param {array} data + * @param {object} managementAPIClient + * @param {object} org */ async function cleanTeamsData(data, managementAPIClient, org) { const roleMap = await getOrgRolesForTeams(managementAPIClient, org); @@ -784,7 +784,7 @@ async function cleanTeamsData(data, managementAPIClient, org) { 'delete', 'fetch', 'stackRoleMappings', - 'teamUsers' + 'teamUsers', ]; if (data?.length) { return data.map((team) => { @@ -806,10 +806,10 @@ async function cleanTeamsData(data, managementAPIClient, org) { /** * This function is used to call all the other teams function to export the required files - * @param {object} managementAPIClient - * @param {object} organization - * @param {string} teamUid - * @param {character} delimiter + * @param {object} managementAPIClient + * @param {object} organization + * @param {string} teamUid + * @param {character} delimiter */ async function exportTeams(managementAPIClient, organization, teamUid, delimiter) { cliux.print( @@ -852,10 +852,10 @@ async function exportTeams(managementAPIClient, organization, teamUid, delimiter /** * This function is used to get individual team user details and write to file - * @param {array} allTeamsData - * @param {object} organization + * @param {array} allTeamsData + * @param {object} organization * @param {string} teamUid optional - * @param {character} delimiter + * @param {character} delimiter */ async function getTeamsDetail(allTeamsData, organization, teamUid, delimiter) { if (!teamUid) { @@ -883,10 +883,10 @@ async function getTeamsDetail(allTeamsData, organization, teamUid, delimiter) { /** * This will export the role mappings of the team, for which stack the team has which role - * @param {object} managementAPIClient - * @param {array} allTeamsData Data for all the teams in the stack + * @param {object} managementAPIClient + * @param {array} allTeamsData Data for all the teams in the stack * @param {string} teamUid for a particular team who's data we want - * @param {character} delimiter + * @param {character} delimiter */ async function exportRoleMappings(managementAPIClient, allTeamsData, teamUid, delimiter) { let stackRoleWithTeamData = []; @@ -935,7 +935,7 @@ async function exportRoleMappings(managementAPIClient, allTeamsData, teamUid, de ]; try { const exportStackRole = await inquirer.prompt(export_stack_role); - if(exportStackRole.chooseExport==='no') { + if (exportStackRole.chooseExport === 'no') { process.exit(1); } } catch (error) { @@ -953,10 +953,10 @@ async function exportRoleMappings(managementAPIClient, allTeamsData, teamUid, de /** * Mapping the team stacks with the stack role and returning and array of object - * @param {object} managementAPIClient - * @param {array} stackRoleMapping - * @param {string} teamName - * @param {string} teamUid + * @param {object} managementAPIClient + * @param {array} stackRoleMapping + * @param {string} teamName + * @param {string} teamUid */ async function mapRoleWithTeams(managementAPIClient, stackRoleMapping, teamName, teamUid) { const roles = await getRoleData(managementAPIClient, stackRoleMapping.stackApiKey); @@ -982,8 +982,8 @@ async function mapRoleWithTeams(managementAPIClient, stackRoleMapping, teamName, /** * Making sdk call to get all the roles in the given stack - * @param {object} managementAPIClient - * @param {string} stackApiKey + * @param {object} managementAPIClient + * @param {string} stackApiKey */ async function getRoleData(managementAPIClient, stackApiKey) { try { @@ -995,7 +995,7 @@ async function getRoleData(managementAPIClient, stackApiKey) { /** * Here in the users array we are adding the team-name and team-uid to individual users and returning an array of object of user details only - * @param {array} teams + * @param {array} teams */ async function getTeamsUserDetails(teams) { const allTeamUsers = []; @@ -1080,7 +1080,7 @@ async function getTaxonomy(payload) { * @returns {*} Promise */ async function taxonomySDKHandler(payload, skip) { - const { stackAPIClient, taxonomyUID, type } = payload; + const { stackAPIClient, taxonomyUID, type, format } = payload; const queryParams = { include_count: true, limit: payload.limit }; if (skip >= 0) queryParams['skip'] = skip || 0; @@ -1092,13 +1092,13 @@ async function taxonomySDKHandler(payload, skip) { .query(queryParams) .find() .then((data) => data) - .catch((err) => handleErrorMsg(err)); + .catch((err) => handleTaxonomyErrorMsg(err)); case 'taxonomy': return await stackAPIClient .taxonomy(taxonomyUID) .fetch() .then((data) => data) - .catch((err) => handleErrorMsg(err)); + .catch((err) => handleTaxonomyErrorMsg(err)); case 'terms': queryParams['depth'] = 0; return await stackAPIClient @@ -1107,9 +1107,15 @@ async function taxonomySDKHandler(payload, skip) { .query(queryParams) .find() .then((data) => data) - .catch((err) => handleErrorMsg(err)); + .catch((err) => handleTaxonomyErrorMsg(err)); + case 'export-taxonomies': + return await stackAPIClient + .taxonomy(taxonomyUID) + .export({ format }) + .then((data) => data) + .catch((err) => handleTaxonomyErrorMsg(err)); default: - handleErrorMsg({ errorMessage: 'Invalid module!' }); + handleTaxonomyErrorMsg({ errorMessage: 'Invalid module!' }); } } @@ -1152,11 +1158,9 @@ function formatTermsOfTaxonomyData(terms, taxonomyUID) { } } -function handleErrorMsg(err) { - if (err?.errorMessage) { - cliux.print(`Error: ${err.errorMessage}`, { color: 'red' }); - } else if (err?.message) { - const errorMsg = err?.errors?.taxonomy || err?.errors?.term || err?.message; +function handleTaxonomyErrorMsg(err) { + if (err?.errorMessage || err?.message) { + const errorMsg = err?.errorMessage || err?.errors?.taxonomy || err?.errors?.term || err?.message; cliux.print(`Error: ${errorMsg}`, { color: 'red' }); } else { console.log(err); @@ -1166,60 +1170,53 @@ function handleErrorMsg(err) { } /** - * create an importable CSV file, to utilize with the migration script. + * Generate a CSV file that can be imported for use with the migration script. * @param {*} payload api request payload * @param {*} taxonomies taxonomies data * @returns */ async function createImportableCSV(payload, taxonomies) { - let taxonomiesData = []; - let headers = ['Taxonomy Name', 'Taxonomy UID', 'Taxonomy Description']; - for (let index = 0; index < taxonomies?.length; index++) { - const taxonomy = taxonomies[index]; - const taxonomyUID = taxonomy?.uid; - if (taxonomyUID) { - const sanitizedTaxonomy = sanitizeData({ - 'Taxonomy Name': taxonomy?.name, - 'Taxonomy UID': taxonomyUID, - 'Taxonomy Description': taxonomy?.description, - }); - taxonomiesData.push(sanitizedTaxonomy); - payload['taxonomyUID'] = taxonomyUID; - const terms = await getAllTermsOfTaxonomy(payload); - //fetch all parent terms - const parentTerms = terms.filter((term) => term?.parent_uid === null); - const termsData = getParentAndChildTerms(parentTerms, terms, headers); - taxonomiesData.push(...termsData); + let taxonomiesData = []; + let headers = []; + payload['type'] = 'export-taxonomies'; + payload['format'] = 'csv'; + for (const taxonomy of taxonomies) { + if (taxonomy?.uid) { + payload['taxonomyUID'] = taxonomy?.uid; + const data = await taxonomySDKHandler(payload); + const taxonomies = await csvParse(data, headers); + taxonomiesData.push(...taxonomies); + } } - } - return { taxonomiesData, headers }; + return { taxonomiesData, headers }; } /** - * Get the parent and child terms, then arrange them hierarchically in a CSV file. - * @param {*} parentTerms list of parent terms - * @param {*} terms respective terms of taxonomies - * @param {*} headers list of csv headers include taxonomy and terms column - * @param {*} termsData parent and child terms + * Parse the CSV data and segregate the headers from the actual data. + * @param {*} data taxonomy csv data with headers + * @param {*} headers list of csv headers + * @returns taxonomy data without headers */ -function getParentAndChildTerms(parentTerms, terms, headers, termsData = []) { - for (let i = 0; i < parentTerms?.length; i++) { - const parentTerm = parentTerms[i]; - const levelUID = `Term Level${parentTerm.depth} UID`; - const levelName = `Term Level${parentTerm.depth} Name`; - if (headers.indexOf(levelName) === -1) headers.push(levelName); - if (headers.indexOf(levelUID) === -1) headers.push(levelUID); - const sanitizedTermData = sanitizeData({ [levelName]: parentTerm.name, [levelUID]: parentTerm.uid }); - termsData.push(sanitizedTermData); - //fetch all sibling terms - const newParents = terms.filter((term) => term.parent_uid === parentTerm.uid); - if (newParents?.length) { - getParentAndChildTerms(newParents, terms, headers, termsData); - } - } - return termsData; -} +const csvParse = (data, headers) => { + return new Promise((resolve, reject) => { + const taxonomies = []; + const stream = fastcsv.parseStream(fastcsv.parse()); + stream.write(data); + stream.end(); + stream + .on('data', (data) => { + taxonomies.push(data); + }) + .on('error', (err) => reject(err)) + .on('end', () => { + taxonomies[0]?.forEach((header) => { + if (!headers.includes(header)) headers.push(header); + }); + resolve(taxonomies.splice(1)); + }); + }); +}; module.exports = { chooseOrganization: chooseOrganization, 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 index 24ad077062..e715cd5c60 100644 --- a/packages/contentstack-export-to-csv/test/mock-data/common.mock.json +++ b/packages/contentstack-export-to-csv/test/mock-data/common.mock.json @@ -395,5 +395,6 @@ "users": ["user_1_uid_member", "user_2_uid_member", "user_3_uid_member", "user_4_uid_member"] } ] - } + }, + "taxonomyCSVData": "`taxonomy1,taxonomy1,,,,,,,\n,,,term1,term1,,,,\n,,,,,term1_2,term1_2,,\n,,,term2,term2,,,,\n,,,,,term2_2,term2_2,,\n,,,,,,,term2_2_1,term2_2_1\n,,,,,term2_1,term2_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 7afb959731..0891675929 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,7 +1,6 @@ const fs = require('fs'); const mkdirp = require('mkdirp'); -const { test, expect } = require('@oclif/test'); -const { join } = require('path'); +const { test: fancy } = require('@oclif/test'); const { PassThrough } = require('stream'); const inquirer = require('inquirer'); const mockData = require('../../mock-data/common.mock.json'); @@ -10,6 +9,7 @@ const { configHandler } = require('@contentstack/cli-utilities'); const { cma } = configHandler.get('region'); describe('export-to-csv with action taxonomies', () => { + const test = fancy.loadConfig({ root: process.cwd() }); describe('Create taxonomies & terms csv file with all flags including taxonomy uid', () => { test .stdout({ print: process.env.PRINT === 'true' || false }) @@ -29,9 +29,9 @@ describe('export-to-csv with action taxonomies', () => { .nock(cma, (api) => { api .get( - `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/terms?include_count=true&limit=100&skip=0&depth=0`, + `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/export?format=csv`, ) - .reply(200, mockData.termsResp); + .reply(200, mockData.taxonomyCSVData); }) .command([ 'cm:export-to-csv', @@ -64,16 +64,16 @@ describe('export-to-csv with action taxonomies', () => { .nock(cma, (api) => { api .get( - `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/terms?include_count=true&limit=100&skip=0&depth=0`, + `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/export?format=csv`, ) - .reply(200, mockData.termsResp); + .reply(200, mockData.taxonomyCSVData); }) .nock(cma, (api) => { api .get( - `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[1].uid}/terms?include_count=true&limit=100&skip=0&depth=0`, + `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[1].uid}/export?format=csv`, ) - .reply(200, { terms: [], count: 0 }); + .reply(200, mockData.taxonomyCSVData); }) .command([ 'cm:export-to-csv', @@ -117,9 +117,9 @@ describe('export-to-csv with action taxonomies', () => { .nock(cma, (api) => { api .get( - `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/terms?include_count=true&limit=100&skip=0&depth=0`, + `/v3/taxonomies/${mockData.taxonomiesResp.taxonomies[0].uid}/export?format=csv`, ) - .reply(200, mockData.termsResp); + .reply(200, mockData.taxonomyCSVData); }) .command(['cm:export-to-csv', '--taxonomy-uid', 'taxonomy_uid_1']) .it('CSV file should be created'); @@ -127,6 +127,7 @@ describe('export-to-csv with action taxonomies', () => { }); describe('export-to-csv with action entries', () => { + const test = fancy.loadConfig({ root: process.cwd() }); describe('Create entries csv file with flags', () => { test .stdout({ print: process.env.PRINT === 'true' || false }) @@ -239,6 +240,7 @@ describe('export-to-csv with action entries', () => { }); describe('export-to-csv with action users', () => { + const test = fancy.loadConfig({ root: process.cwd() }); describe('Export users csv file with flags', () => { test .stdout({ print: process.env.PRINT === 'true' || false }) @@ -290,7 +292,7 @@ describe('export-to-csv with action users', () => { }); describe('Testing the teams support in cli export-to-csv', () => { - + const test = fancy.loadConfig({ root: process.cwd() }); describe('Testing Teams Command with using org flag and team flag', () => { test .stdout({ print: process.env.PRINT === 'true' || false }) @@ -409,4 +411,4 @@ describe('Testing the teams support in cli export-to-csv', () => { .command(['cm:export-to-csv']) .it('CSV file should be created'); }); -}); \ No newline at end of file +}); diff --git a/packages/contentstack-export/README.md b/packages/contentstack-export/README.md index ae1378c585..43f58bcb94 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.10.5 darwin-arm64 node-v20.8.0 +@contentstack/cli-cm-export/1.11.0 darwin-arm64 node-v18.19.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-export/package.json b/packages/contentstack-export/package.json index 26dc1f4053..188bad75c0 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.10.5", + "version": "1.11.0", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-export/src/config/index.ts b/packages/contentstack-export/src/config/index.ts index ec027efe10..cee96c6d46 100644 --- a/packages/contentstack-export/src/config/index.ts +++ b/packages/contentstack-export/src/config/index.ts @@ -165,13 +165,8 @@ const config: DefaultConfig = { taxonomies: { dirName: 'taxonomies', fileName: 'taxonomies.json', - invalidKeys: ['updated_at', 'created_by', 'updated_by', 'stackHeaders', 'urlPath'], - }, - terms: { - dirName: 'terms', - fileName: 'terms.json', - invalidKeys: ['updated_at', 'created_by', 'updated_by', 'stackHeaders', 'urlPath'], - }, + invalidKeys: ['updated_at', 'created_by', 'updated_by', 'stackHeaders', 'urlPath', 'created_at'], + } }, languagesCode: [ 'af-za', diff --git a/packages/contentstack-export/src/export/modules/base-class.ts b/packages/contentstack-export/src/export/modules/base-class.ts index 90cb015942..8cd2473c78 100644 --- a/packages/contentstack-export/src/export/modules/base-class.ts +++ b/packages/contentstack-export/src/export/modules/base-class.ts @@ -47,7 +47,8 @@ export type ApiModuleType = | 'content-types' | 'stacks' | 'versioned-entries' - | 'download-asset'; + | 'download-asset' + | 'export-taxonomy'; export default abstract class BaseClass { readonly client: any; @@ -176,6 +177,12 @@ export default abstract class BaseClass { .download({ url, responseType: 'stream' }) .then((response: any) => resolve({ response, isLastRequest, additionalInfo })) .catch((error: any) => reject({ error, isLastRequest, additionalInfo })); + case 'export-taxonomy': + return this.stack + .taxonomy(uid) + .export() + .then((response: any) => resolve({ response, uid })) + .catch((error: any) => reject({ error, uid })); default: return Promise.resolve(); } diff --git a/packages/contentstack-export/src/export/modules/taxonomies.ts b/packages/contentstack-export/src/export/modules/taxonomies.ts index 7fbe221247..12c88f6b55 100644 --- a/packages/contentstack-export/src/export/modules/taxonomies.ts +++ b/packages/contentstack-export/src/export/modules/taxonomies.ts @@ -5,43 +5,34 @@ import { resolve as pResolve } from 'node:path'; import BaseClass from './base-class'; import { log, fsUtil } from '../../utils'; -import { TaxonomiesConfig, TermsConfig, ModuleClassParams } from '../../types'; +import { TaxonomiesConfig, ModuleClassParams } from '../../types'; export default class ExportTaxonomies extends BaseClass { private taxonomies: Record>; - private terms: Record[]; private taxonomiesConfig: TaxonomiesConfig; - private termsConfig: TermsConfig; private qs: { include_count: boolean; skip: number; asc: string; - depth?: number; }; public taxonomiesFolderPath: string; - public termsFolderPath: string; constructor({ exportConfig, stackAPIClient }: ModuleClassParams) { super({ exportConfig, stackAPIClient }); this.taxonomies = {}; - this.terms = []; this.taxonomiesConfig = exportConfig.modules.taxonomies; - this.termsConfig = exportConfig.modules.terms; - this.qs = { include_count: true, skip: 0, asc: 'created_at' }; } async start(): Promise { log(this.exportConfig, 'Starting taxonomies export', 'info'); - //create taxonomies and terms folder in data directory path + //create taxonomies folder this.taxonomiesFolderPath = pResolve( this.exportConfig.data, this.exportConfig.branchName || '', this.taxonomiesConfig.dirName, ); await fsUtil.makeDirectory(this.taxonomiesFolderPath); - this.termsFolderPath = pResolve(this.taxonomiesFolderPath, this.termsConfig.dirName); - await fsUtil.makeDirectory(this.termsFolderPath); //fetch all taxonomies and write into taxonomies folder await this.getAllTaxonomies(); @@ -49,12 +40,11 @@ export default class ExportTaxonomies extends BaseClass { log(this.exportConfig, 'No taxonomies found!', 'info'); return; } else { - fsUtil.writeFile(pResolve(this.taxonomiesFolderPath, this.taxonomiesConfig.fileName), this.taxonomies); - log(this.exportConfig, 'All taxonomies exported successfully!', 'success'); + fsUtil.writeFile(pResolve(this.taxonomiesFolderPath, 'taxonomies.json'), this.taxonomies); + await this.exportTaxonomies(); } - //fetch all terms of respective and write into taxonomies/terms folder - await this.getAllTerms(); + log(this.exportConfig, `All taxonomies exported successfully!`, 'success'); } /** @@ -62,7 +52,7 @@ export default class ExportTaxonomies extends BaseClass { * @param {number} skip * @returns {Promise} */ - async getAllTaxonomies(skip = 0): Promise { + async getAllTaxonomies(skip: number = 0): Promise { if (skip) { this.qs.skip = skip; } @@ -97,75 +87,41 @@ export default class ExportTaxonomies extends BaseClass { for (let index = 0; index < taxonomies?.length; index++) { const taxonomyUID = taxonomies[index].uid; this.taxonomies[taxonomyUID] = omit(taxonomies[index], this.taxonomiesConfig.invalidKeys); - log(this.exportConfig, `'${taxonomyUID}' taxonomy exported successfully!`, 'success'); } } /** - * fetch all terms of respective taxonomy and write it into -terms file + * Export all taxonomies details using metadata(this.taxonomies) and write it into respective .json file * @returns {Promise} */ - async getAllTerms() { + async exportTaxonomies(): Promise { const taxonomiesUID = keys(this.taxonomies) || []; - this.qs.depth = 0; - for (let index = 0; index < taxonomiesUID?.length; index++) { - const taxonomyUID = taxonomiesUID[index]; - this.terms = []; - await this.fetchTermsOfTaxonomy(taxonomyUID); - if (!this.terms?.length) { - log(this.exportConfig, `No terms found for taxonomy - '${taxonomyUID}'!`, 'info'); + const onSuccess = ({ response, uid }: any) => { + const filePath = pResolve(this.taxonomiesFolderPath, `${uid}.json`); + fsUtil.writeFile(filePath, response); + log(this.exportConfig, `'${uid}' taxonomy exported successfully!`, 'success'); + }; + + const onReject = ({ error, uid }: any) => { + if (error?.errorMessage) { + log(this.exportConfig, `Failed to export taxonomy - '${uid}'! ${error.errorMessage}`, 'error'); + } else if (error?.message) { + const errorMsg = error?.errors?.taxonomy || error?.errors?.term || error?.message; + log(this.exportConfig, `Failed to export taxonomy - '${uid}'! ${errorMsg}`, 'error'); } else { - fsUtil.writeFile(pResolve(this.termsFolderPath, `${taxonomyUID}-${this.termsConfig.fileName}`), this.terms); - log(this.exportConfig, `Terms from taxonomy '${taxonomyUID}' exported successfully!`, 'success'); + log(this.exportConfig, `Failed to export taxonomy - '${uid}'! ${error}`, 'error'); } - } - log(this.exportConfig, `All the terms exported successfully!`, 'success'); - } - - /** - * fetch all terms of the provided taxonomy uid - * @async - * @param {string} taxonomyUID - * @param {number} skip - * @returns {Promise} - */ - async fetchTermsOfTaxonomy(taxonomyUID: string, skip = 0): Promise { - if (skip) { - this.qs.skip = skip; - } - await this.stack - .taxonomy(taxonomyUID) - .terms() - .query(this.qs) - .find() - .then(async (data: any) => { - const { items, count } = data; - const termsCount = count !== undefined ? count : items?.length; + }; - if (items?.length) { - this.sanitizeTermsAttribs(items); - skip += this.taxonomiesConfig.limit || 100; - if (skip >= termsCount) { - return; - } - return await this.fetchTermsOfTaxonomy(taxonomyUID, skip); - } - }) - .catch((error: any) => { - this.handleErrorMsg(error); + for (let index = 0; index < taxonomiesUID?.length; index++) { + const taxonomyUID = taxonomiesUID[index]; + await this.makeAPICall({ + reject: onReject, + resolve: onSuccess, + uid: taxonomyUID, + module: 'export-taxonomy', }); - } - - /** - * remove invalid keys and write data into taxonomies - * @function sanitizeTaxonomiesAttribs - * @param terms - */ - sanitizeTermsAttribs(terms: Record[]) { - for (let index = 0; index < terms?.length; index++) { - const term = omit(terms[index], this.termsConfig.invalidKeys); - this.terms.push(term) } } @@ -175,7 +131,7 @@ export default class ExportTaxonomies extends BaseClass { } else if (err?.message) { const errorMsg = err?.errors?.taxonomy || err?.errors?.term || err?.message; log(this.exportConfig, `Failed to export! ${errorMsg}`, 'error'); - }else{ + } else { log(this.exportConfig, `Failed to export! ${err}`, 'error'); } } diff --git a/packages/contentstack-export/src/types/default-config.ts b/packages/contentstack-export/src/types/default-config.ts index ca2d5ef886..ecfdf28c78 100644 --- a/packages/contentstack-export/src/types/default-config.ts +++ b/packages/contentstack-export/src/types/default-config.ts @@ -152,12 +152,6 @@ export default interface DefaultConfig { invalidKeys: string[]; dependencies?: Modules[]; }; - terms: { - dirName: string; - fileName: string; - invalidKeys: string[]; - dependencies?: Modules[]; - }; }; languagesCode: string[]; apis: { diff --git a/packages/contentstack-export/src/types/index.ts b/packages/contentstack-export/src/types/index.ts index 77d2327cd0..875695c4ff 100644 --- a/packages/contentstack-export/src/types/index.ts +++ b/packages/contentstack-export/src/types/index.ts @@ -100,7 +100,7 @@ export interface WebhookConfig { limit?: number; } -export interface WorkflowConfig{ +export interface WorkflowConfig { dirName: string; fileName: string; invalidKeys: string[]; @@ -108,29 +108,21 @@ export interface WorkflowConfig{ limit?: number; } -export interface CustomRoleConfig{ +export interface CustomRoleConfig { dirName: string; fileName: string; customRolesLocalesFileName: string; dependencies?: Modules[]; } -export interface StackConfig{ - dirName: string; - fileName: string; - dependencies?: Modules[]; - limit?: number; -} - -export interface TaxonomiesConfig{ +export interface StackConfig { dirName: string; fileName: string; - invalidKeys: string[]; dependencies?: Modules[]; limit?: number; } -export interface TermsConfig{ +export interface TaxonomiesConfig { dirName: string; fileName: string; invalidKeys: string[]; @@ -140,4 +132,4 @@ export interface TermsConfig{ export { default as DefaultConfig } from './default-config'; export { default as ExportConfig } from './export-config'; -export * from './marketplace-app' +export * from './marketplace-app'; diff --git a/packages/contentstack-import/README.md b/packages/contentstack-import/README.md index 5daa5975aa..79bb066471 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.13.4 darwin-arm64 node-v20.10.0 +@contentstack/cli-cm-import/1.14.0 darwin-arm64 node-v20.8.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-import/package.json b/packages/contentstack-import/package.json index 18c6f20bf0..38fdd5c8f9 100644 --- a/packages/contentstack-import/package.json +++ b/packages/contentstack-import/package.json @@ -1,14 +1,14 @@ { "name": "@contentstack/cli-cm-import", "description": "Contentstack CLI plugin to import content into stack", - "version": "1.13.5", + "version": "1.14.0", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@contentstack/cli-audit": "~1.4.0", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.13", - "@contentstack/management": "~1.13.0", + "@contentstack/management": "~1.15.3", "@oclif/core": "^2.9.3", "big-json": "^3.2.0", "bluebird": "^3.7.2", diff --git a/packages/contentstack-import/src/config/index.ts b/packages/contentstack-import/src/config/index.ts index 80ceffdcd8..3ce1294bae 100644 --- a/packages/contentstack-import/src/config/index.ts +++ b/packages/contentstack-import/src/config/index.ts @@ -148,11 +148,7 @@ const config: DefaultConfig = { taxonomies: { dirName: 'taxonomies', fileName: 'taxonomies.json', - }, - terms: { - dirName: 'terms', - fileName: 'terms.json', - }, + } }, languagesCode: [ 'af-za', diff --git a/packages/contentstack-import/src/import/modules/base-class.ts b/packages/contentstack-import/src/import/modules/base-class.ts index 72b2374897..c118970b58 100644 --- a/packages/contentstack-import/src/import/modules/base-class.ts +++ b/packages/contentstack-import/src/import/modules/base-class.ts @@ -11,8 +11,6 @@ import { LocaleData } from '@contentstack/management/types/stack/locale'; import { PublishConfig } from '@contentstack/management/types/utility/publish'; import { FolderData } from '@contentstack/management/types/stack/asset/folder'; import { ExtensionData } from '@contentstack/management/types/stack/extension'; -import { GlobalFieldData } from '@contentstack/management/types/stack/globalField'; -import { ContentTypeData } from '@contentstack/management/types/stack/contentType'; import { EnvironmentData } from '@contentstack/management/types/stack/environment'; import { LabelData } from '@contentstack/management/types/stack/label'; import { WebhookData } from '@contentstack/management/types/stack/webhook'; @@ -50,7 +48,8 @@ export type ApiModuleType = | 'publish-entries' | 'delete-entries' | 'create-taxonomies' - | 'create-terms'; + | 'create-terms' + | 'import-taxonomy'; export type ApiOptions = { uid?: string; @@ -389,14 +388,17 @@ export default abstract class BaseClass { case 'create-taxonomies': return this.stack.taxonomy().create({ taxonomy: apiData }).then(onSuccess).catch(onReject); case 'create-terms': - if (apiData?.taxonomy_uid) { - return this.stack - .taxonomy(apiData.taxonomy_uid) - .terms() - .create({ term: apiData }) - .then(onSuccess) - .catch(onReject); + return this.stack + .taxonomy(apiData.taxonomy_uid) + .terms() + .create({ term: apiData }) + .then(onSuccess) + .catch(onReject); + case 'import-taxonomy': + if(!apiData || !apiData.filePath){ + return Promise.resolve(); } + return this.stack.taxonomy(uid).import({ taxonomy: apiData.filePath }).then(onSuccess).catch(onReject); default: return Promise.resolve(); } diff --git a/packages/contentstack-import/src/import/modules/taxonomies.ts b/packages/contentstack-import/src/import/modules/taxonomies.ts index 5c1e320d12..f033715768 100644 --- a/packages/contentstack-import/src/import/modules/taxonomies.ts +++ b/packages/contentstack-import/src/import/modules/taxonomies.ts @@ -1,12 +1,10 @@ -import keys from 'lodash/keys'; -import pick from 'lodash/pick'; import { join } from 'node:path'; import values from 'lodash/values'; import isEmpty from 'lodash/isEmpty'; import BaseClass, { ApiOptions } from './base-class'; import { log, formatError, fsUtil, fileHelper } from '../../utils'; -import { ModuleClassParams, TaxonomiesConfig, TermsConfig } from '../../types'; +import { ModuleClassParams, TaxonomiesConfig } from '../../types'; export default class ImportTaxonomies extends BaseClass { private taxonomiesMapperDirPath: string; @@ -15,26 +13,20 @@ export default class ImportTaxonomies extends BaseClass { private taxFailsPath: string; private taxonomiesConfig: TaxonomiesConfig; private taxonomies: Record; - private termsFolderPath: string; private termsMapperDirPath: string; - private termsConfig: TermsConfig; private termsSuccessPath: string; private termsFailsPath: string; - public taxonomiesSuccess: Record = {}; - public taxonomiesFailed: Record = {}; - public termsSuccess: Record> = {}; - public termsFailed: Record> = {}; - public terms: Record = []; - public taxonomyUIDs: string[] = []; + public createdTaxonomies: Record = {}; + public failedTaxonomies: Record = {}; + public createdTerms: Record> = {}; + public failedTerms: Record> = {}; constructor({ importConfig, stackAPIClient }: ModuleClassParams) { super({ importConfig, stackAPIClient }); this.taxonomiesConfig = importConfig.modules.taxonomies; - this.termsConfig = importConfig.modules.terms; this.taxonomiesMapperDirPath = join(importConfig.backupDir, 'mapper', 'taxonomies'); this.termsMapperDirPath = join(this.taxonomiesMapperDirPath, 'terms'); this.taxonomiesFolderPath = join(importConfig.backupDir, this.taxonomiesConfig.dirName); - this.termsFolderPath = join(this.taxonomiesFolderPath, this.termsConfig.dirName); this.taxSuccessPath = join(this.taxonomiesMapperDirPath, 'success.json'); this.taxFailsPath = join(this.taxonomiesMapperDirPath, 'fails.json'); this.termsSuccessPath = join(this.termsMapperDirPath, 'success.json'); @@ -62,18 +54,10 @@ export default class ImportTaxonomies extends BaseClass { //Step 2 create taxonomies & terms mapper directory await fsUtil.makeDirectory(this.taxonomiesMapperDirPath); await fsUtil.makeDirectory(this.termsMapperDirPath); - - //Step 3 import taxonomy and create success & failure file + // Step 3 import taxonomies await this.importTaxonomies(); - this.createTaxonomySuccessAndFailedFile(); - - if (!fileHelper.fileExistsSync(this.termsFolderPath)) { - log(this.importConfig, `No such file or directory - '${this.termsFolderPath}'`, 'error'); - return; - } - //Step 4 import terms and create success & failure file - await this.importTerms(); - this.createTermSuccessAndFailedFile(); + //Step 4 create taxonomy & related terms success & failure file + this.createSuccessAndFailedFile(); log(this.importConfig, 'Taxonomies imported successfully!', 'success'); } @@ -90,25 +74,25 @@ export default class ImportTaxonomies extends BaseClass { return; } - const apiContent = values(this.taxonomies) as Record[]; - this.taxonomyUIDs = keys(this.taxonomies); + const apiContent = values(this.taxonomies); - const onSuccess = ({ response }: any) => { - const { uid } = response; - this.taxonomiesSuccess[uid] = pick(response, ['name', 'description']); - log(this.importConfig, `Taxonomy '${uid}' imported successfully!`, 'success'); + const onSuccess = ({ apiData }: any) => { + const taxonomyUID = apiData?.taxonomy?.uid; + this.createdTaxonomies[taxonomyUID] = apiData?.taxonomy; + this.createdTerms[taxonomyUID] = apiData?.terms; + log(this.importConfig, `Taxonomy '${taxonomyUID}' imported successfully!`, 'success'); }; const onReject = ({ error, apiData }: any) => { - const err = error?.message ? JSON.parse(error.message) : error; - const { uid } = apiData; - if (err?.errors?.taxonomy) { - this.taxonomiesFailed[uid] = apiData; - log(this.importConfig, `Taxonomy '${uid}' failed to be import! ${err.errors.taxonomy}`, 'error'); + const taxonomyUID = apiData?.taxonomy?.uid; + if (error?.errorMessage || error?.message) { + const errorMsg = error?.errorMessage || error?.errors?.taxonomy || error?.errors?.term || error?.message; + log(this.importConfig, `Taxonomy '${taxonomyUID}' failed to be import! ${errorMsg}`, 'error'); } else { - this.taxonomiesFailed[apiData.uid] = apiData; - log(this.importConfig, `Taxonomy '${uid}' failed to be import! ${formatError(error)}`, 'error'); + log(this.importConfig, `Taxonomy '${taxonomyUID}' failed to be import! ${formatError(error)}`, 'error'); } + this.failedTaxonomies[taxonomyUID] = apiData?.taxonomy; + this.failedTerms[taxonomyUID] = apiData?.terms; }; await this.makeConcurrentCall( @@ -119,7 +103,7 @@ export default class ImportTaxonomies extends BaseClass { serializeData: this.serializeTaxonomy.bind(this), reject: onReject, resolve: onSuccess, - entity: 'create-taxonomies', + entity: 'import-taxonomy', includeParamOnCompletion: true, }, concurrencyLimit: this.importConfig.concurrency || this.importConfig.fetchConcurrency || 1, @@ -135,124 +119,38 @@ export default class ImportTaxonomies extends BaseClass { * @returns {ApiOptions} ApiOptions */ serializeTaxonomy(apiOptions: ApiOptions): ApiOptions { - const { apiData: taxonomy } = apiOptions; - apiOptions.apiData = taxonomy; + const { apiData } = apiOptions; + const filePath = join(this.taxonomiesFolderPath, `${apiData?.uid}.json`); + if (fileHelper.fileExistsSync(filePath)) { + const taxonomyDetails = fsUtil.readFile(filePath, true) as Record; + apiOptions.apiData = { filePath, taxonomy: taxonomyDetails?.taxonomy, terms: taxonomyDetails?.terms }; + } else { + log(this.importConfig, `No such file - ${filePath}`, 'error'); + apiOptions.apiData = undefined; + } return apiOptions; } /** * create taxonomies success and fail in (mapper/taxonomies) - * @method createTaxonomySuccessAndFailedFile - */ - createTaxonomySuccessAndFailedFile() { - if (this.taxonomiesSuccess !== undefined && !isEmpty(this.taxonomiesSuccess)) { - fsUtil.writeFile(this.taxSuccessPath, this.taxonomiesSuccess); - } - - if (this.taxonomiesFailed !== undefined && !isEmpty(this.taxonomiesFailed)) { - fsUtil.writeFile(this.taxFailsPath, this.taxonomiesFailed); - } - } - - /** - * create terms and enter success & failure related data into terms mapper file - * @method importTerms - * @async - * @returns {Promise} Promise + * create terms success and fail in (mapper/taxonomies/terms) + * @method createSuccessAndFailedFile */ - async importTerms(): Promise { - if (!this.taxonomyUIDs?.length) { - return; - } - - const onSuccess = ({ response, apiData: { taxonomy_uid } = { taxonomy_uid: null } }: any) => { - const { uid } = response; - if (!this.termsSuccess?.[taxonomy_uid]) this.termsSuccess[taxonomy_uid] = {}; - this.termsSuccess[taxonomy_uid][uid] = pick(response, ['name']); - log(this.importConfig, `Term '${uid}' imported successfully!`, 'success'); - }; - - const onReject = ({ error, apiData }: any) => { - const { taxonomy_uid, uid } = apiData; - if (!this.termsFailed?.[taxonomy_uid]) this.termsFailed[taxonomy_uid] = {}; - const err = error?.message ? JSON.parse(error.message) : error; - - if (err?.errors?.term) { - this.termsFailed[taxonomy_uid][uid] = apiData; - log(this.importConfig, `Term '${uid}' failed to be import! ${err.errors.term}`, 'error'); - } else { - this.termsFailed[taxonomy_uid][uid] = apiData; - log(this.importConfig, `Term '${uid}' failed to be import! ${formatError(error)}`, 'error'); - } - }; - - for (const taxUID of this.taxonomyUIDs) { - //read terms from respective taxonomy - this.terms = fsUtil.readFile( - join(this.termsFolderPath, `${taxUID}-${this.termsConfig.fileName}`), - true, - ) as Record; - - if (this.terms?.length) { - const apiContent = this.terms as Record[]; - await this.makeConcurrentCall( - { - apiContent, - processName: 'import terms', - apiParams: { - serializeData: this.serializeTerms.bind(this), - reject: onReject, - resolve: onSuccess, - entity: 'create-terms', - includeParamOnCompletion: true, - }, - concurrencyLimit: this.importConfig.concurrency || this.importConfig.fetchConcurrency || 1, - }, - undefined, - false, - ); - } + createSuccessAndFailedFile() { + if (this.createdTaxonomies !== undefined && !isEmpty(this.createdTaxonomies)) { + fsUtil.writeFile(this.taxSuccessPath, this.createdTaxonomies); } - } - /** - * @method serializeTerms - * @param {ApiOptions} apiOptions ApiOptions - * @returns {ApiOptions} ApiOptions - */ - serializeTerms(apiOptions: ApiOptions): ApiOptions { - const { apiData: term } = apiOptions; - const {parent_uid, taxonomy_uid} = term; - - //check whether parent term exists or not in taxonomy - if (parent_uid !== null) { - if (!this.termsSuccess?.[taxonomy_uid]?.[parent_uid]) { - log( - this.importConfig, - `Parent term '${term?.parent_uid}' does not exist! Skipping '${term.uid}' creation to avoid further issues.`, - 'info', - ); - apiOptions.apiData = undefined; - } else { - apiOptions.apiData = term; - } - } else { - apiOptions.apiData = term; + if (this.failedTaxonomies !== undefined && !isEmpty(this.failedTaxonomies)) { + fsUtil.writeFile(this.taxFailsPath, this.failedTaxonomies); } - return apiOptions; - } - /** - * create terms success and fail in (mapper/taxonomies/terms) - * @method createTermSuccessAndFailedFile - */ - createTermSuccessAndFailedFile() { - if (this.termsSuccess !== undefined && !isEmpty(this.termsSuccess)) { - fsUtil.writeFile(this.termsSuccessPath, this.termsSuccess); + if (this.createdTerms !== undefined && !isEmpty(this.createdTerms)) { + fsUtil.writeFile(this.termsSuccessPath, this.createdTerms); } - if (this.termsFailed !== undefined && !isEmpty(this.termsFailed)) { - fsUtil.writeFile(this.termsFailsPath, this.termsFailed); + if (this.failedTerms !== undefined && !isEmpty(this.failedTerms)) { + fsUtil.writeFile(this.termsFailsPath, this.failedTerms); } } } diff --git a/packages/contentstack-import/src/types/default-config.ts b/packages/contentstack-import/src/types/default-config.ts index 9242d5b2bf..0b5358e647 100644 --- a/packages/contentstack-import/src/types/default-config.ts +++ b/packages/contentstack-import/src/types/default-config.ts @@ -118,11 +118,6 @@ export default interface DefaultConfig { fileName: string; dependencies?: Modules[]; }; - terms: { - dirName: string; - fileName: string; - dependencies?: Modules[]; - }; }; languagesCode: string[]; apis: { diff --git a/packages/contentstack-import/src/types/index.ts b/packages/contentstack-import/src/types/index.ts index 16b6785a88..fb9c041d05 100644 --- a/packages/contentstack-import/src/types/index.ts +++ b/packages/contentstack-import/src/types/index.ts @@ -96,12 +96,6 @@ export interface TaxonomiesConfig{ dependencies?: Modules[]; } -export interface TermsConfig{ - dirName: string; - fileName: string; - dependencies?: Modules[]; -} - export { default as DefaultConfig } from './default-config'; export { default as ImportConfig } from './import-config'; diff --git a/packages/contentstack-import/src/utils/taxonomies-helper.ts b/packages/contentstack-import/src/utils/taxonomies-helper.ts index 09755fc2e2..9095cd373a 100644 --- a/packages/contentstack-import/src/utils/taxonomies-helper.ts +++ b/packages/contentstack-import/src/utils/taxonomies-helper.ts @@ -1,6 +1,7 @@ /** * taxonomy lookup */ +import find from 'lodash/find'; import { log } from './'; import { ImportConfig } from '../types'; @@ -63,11 +64,7 @@ const verifyAndRemoveTaxonomy = function ( } if (!taxonomyFieldData?.length) { - log( - importConfig, - 'Taxonomy does not exist. Removing the field from content type', - 'warn', - ); + log(importConfig, 'Taxonomy does not exist. Removing the field from content type', 'warn'); isTaxonomyFieldRemoved = true; } @@ -94,7 +91,12 @@ export const lookUpTerms = function ( if (ctSchema[index].data_type === 'taxonomy') { const taxonomyFieldData = entry[ctSchema[index].uid]; const updatedTaxonomyData = verifyAndRemoveTerms(taxonomyFieldData, taxonomiesAndTermData, importConfig); - entry[ctSchema[index].uid] = updatedTaxonomyData; + if (updatedTaxonomyData?.length) { + entry[ctSchema[index].uid] = updatedTaxonomyData; + } else { + //Delete taxonomy from entry if taxonomy field removed from CT + delete entry[ctSchema[index].uid]; + } } } }; @@ -115,11 +117,11 @@ const verifyAndRemoveTerms = function ( const taxonomyData = taxonomyFieldData[index]; const taxUID = taxonomyData?.taxonomy_uid; const termUID = taxonomyData?.term_uid; - if ( taxonomiesAndTermData === undefined || !taxonomiesAndTermData.hasOwnProperty(taxUID) || - (taxonomiesAndTermData.hasOwnProperty(taxUID) && !taxonomiesAndTermData[taxUID].hasOwnProperty(termUID)) + (taxonomiesAndTermData.hasOwnProperty(taxUID) && + !find(taxonomiesAndTermData[taxUID], (term: Record) => term?.uid === termUID)) ) { // remove term from taxonomies field data with warning if respective term doesn't exists log(importConfig, `Term '${termUID}' does not exist. Removing it from taxonomy - '${taxUID}'`, 'warn'); @@ -129,4 +131,4 @@ const verifyAndRemoveTerms = function ( } return taxonomyFieldData; -}; \ No newline at end of file +}; diff --git a/packages/contentstack-migration/README.md b/packages/contentstack-migration/README.md index 53eda842c2..6446ecfdaa 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.4.2 darwin-arm64 node-v20.8.0 +@contentstack/cli-migration/1.5.0 darwin-arm64 node-v20.8.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-migration/examples/taxonomies/import-taxonomies.js b/packages/contentstack-migration/examples/taxonomies/import-taxonomies.js index c889e5f4bd..f6bb70503c 100644 --- a/packages/contentstack-migration/examples/taxonomies/import-taxonomies.js +++ b/packages/contentstack-migration/examples/taxonomies/import-taxonomies.js @@ -1,6 +1,6 @@ const fs = require('fs'); +const path = require('path'); const fastcsv = require('fast-csv'); -const find = require('lodash/find'); module.exports = ({ migration, stackSDKInstance, managementAPIClient, config }) => { const dataDir = config['data-dir']; @@ -10,34 +10,29 @@ module.exports = ({ migration, stackSDKInstance, managementAPIClient, config }) let stack; let depth = 1, parentUID = null; + let taxonomies = {}; const stackClient = () => { return managementAPIClient.stack({ api_key: stackSDKInstance.api_key }); }; - const createTaxonomy = async (apiData) => { - await stack - .taxonomy() - .create({ taxonomy: apiData }) - .catch((err) => handleErrorMsg(err)); + const pushTaxonomyDetails = async (apiData) => { + if (!taxonomies[apiData?.uid]) taxonomies[apiData?.uid] = { taxonomy: apiData }; }; - const createTerm = async (apiData) => { - await stack - .taxonomy(apiData.taxonomy_uid) - .terms() - .create({ term: apiData }) - .catch((err) => handleErrorMsg(err)); + const pushTermDetails = async (apiData) => { + if (taxonomies[apiData?.taxonomy_uid]) { + const terms = (taxonomies[apiData.taxonomy_uid].terms ||= []); + terms.push({ uid: apiData.uid, name: apiData.name, parent_uid: apiData.parent_uid }); + } }; function handleErrorMsg(err) { - let errMsg = 'Something went wrong! Please try again'; - if (err?.errorMessage) { - errMsg = err.errorMessage; - } else if (err?.message) { - errMsg = err?.errors?.taxonomy || err?.errors?.term || JSON.stringify(err?.errors) || err?.message; + let errMsg; + if (err?.errorMessage || err?.message) { + errMsg = err?.errorMessage || err?.errors?.taxonomy || err?.errors?.term || JSON.stringify(err?.errors) || err?.message; } - throw errMsg; + throw errMsg ?? err; } const readCsv = (path, options) => { @@ -55,6 +50,23 @@ module.exports = ({ migration, stackSDKInstance, managementAPIClient, config }) }); }; + const importTaxonomies = async () => { + for (const taxonomyUID in taxonomies) { + const filePath = path.resolve(process.cwd(), `${taxonomyUID}.json`); + if (!fs.existsSync(filePath)) { + fs.writeFileSync(filePath, JSON.stringify(taxonomies[taxonomyUID])); + } + await stack + .taxonomy() + .import({ taxonomy: filePath }) + .then(() => console.log(`Taxonomy ${taxonomyUID} migrated successfully!`)) + .catch((err) => { + handleErrorMsg(err); + }); + fs.unlinkSync(filePath); + } + }; + const toSnakeCase = (str) => str .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) @@ -69,74 +81,54 @@ module.exports = ({ migration, stackSDKInstance, managementAPIClient, config }) task: async (params) => { try { stack = stackClient(); - if (!fs.existsSync(dataDir)) { - throw new Error(`No such file or directory - ${dataDir}`); - } + if (!fs.existsSync(dataDir)) throw new Error(`No such file or directory - ${dataDir}`); const taxonomies = await readCsv(dataDir, { headers: true, delimiter }); - if (!taxonomies?.length) { - throw new Error('No Taxonomies found!'); - } + if (!taxonomies?.length) throw new Error('No Taxonomies found!'); - for (let row = 0; row < taxonomies?.length; row++) { - const taxDetails = taxonomies[row]; + for (const taxDetails of taxonomies) { + const taxonomyName = taxDetails['Taxonomy Name'] ?? ''; + const taxonomyUID = taxDetails['Taxonomy Uid'] ?? ''; + const taxonomyDesc = taxDetails['Taxonomy Description'] ?? ''; //taxonomy name required - if (taxDetails['Taxonomy Name']?.length) { - const taxonomyName = taxDetails['Taxonomy Name']; - const taxonomyUID = taxDetails['Taxonomy UID'] ?? ''; - const taxonomyDesc = taxDetails['Taxonomy Description'] ?? ''; + if (taxonomyName) { const reqTaxonomyObj = { name: taxonomyName, - uid: taxonomyUID?.length ? taxonomyUID : toSnakeCase(taxonomyName), + uid: taxonomyUID ?? toSnakeCase(taxonomyName), description: taxonomyDesc, }; - parentDetails = {}; - parentDetails['taxonomy_uid'] = reqTaxonomyObj.uid; - await createTaxonomy(reqTaxonomyObj); - } else if (!taxDetails['Taxonomy Name']?.length && parentDetails['taxonomy_uid']) { - const column = find(Object.keys(taxDetails), (col) => { - if (taxDetails[col] !== '') { - return col; - } - }); - const termLevel = column?.split(' ')?.[1] ?? ''; // Output:- Level1/Level2 - const termDepth = +termLevel.replace(/[^0-9]/g, ''); // fetch depth from header - const termName = taxDetails[`Term ${termLevel} Name`] ?? ''; + parentDetails = { taxonomy_uid: reqTaxonomyObj.uid }; + await pushTaxonomyDetails(reqTaxonomyObj); + } else if (!taxonomyName && parentDetails['taxonomy_uid']) { + const column = Object.keys(taxDetails).find((col) => taxDetails[col] !== ''); + if (!column) continue; + + const termLevel = (column.match(/Level \d+/) || [''])[0]; // Output:- Level 1/Level 2 + const termDepth = +termLevel.replace(/\D/g, ''); // fetch depth from header + const termName = taxDetails[`${termLevel} Term Name`] ?? ''; - //term name required field - if (termName?.length && termDepth) { - const termUID = taxDetails[`Term ${termLevel} UID`]?.length - ? taxDetails[`Term ${termLevel} UID`] - : toSnakeCase(termName); - if (termDepth > depth) { - //child term case - parentUID = parentDetails[termDepth - 1] || null; - depth = termDepth; - parentDetails[depth] = termUID; - } else if (termDepth === 1) { - //parent term case - depth = 1; - parentUID = null; - parentDetails[depth] = termUID; - } else if (termDepth === depth) { - //sibling term case - parentUID = parentDetails[termDepth - 1]; - } else if (termDepth < depth) { - //diff parent term case - parentUID = parentDetails[termDepth - 1] || null; - depth = termDepth; - parentDetails[depth] = termUID; - } + //term name required field to generate term uid + if (termName && termDepth) { + const termUID = taxDetails[`${termLevel} Term Uid`] || toSnakeCase(termName); + //Handled cases + //1.child term case 2.sibling term 3.different parent term parentUID = parentDetails[termDepth - 1] || null + //4.parent term -> parentUID = null & depth=1 + parentUID = parentDetails[termDepth - 1] || (termDepth === 1 ? null : parentUID); + depth = termDepth; + parentDetails[depth] = termUID; const reqTermObj = { uid: termUID, name: termName, parent_uid: parentUID, taxonomy_uid: parentDetails['taxonomy_uid'], }; - await createTerm(reqTermObj); + await pushTermDetails(reqTermObj); } } } + + // create json file & remove it after migrating taxonomy + await importTaxonomies(); } catch (error) { throw error; } @@ -146,6 +138,6 @@ module.exports = ({ migration, stackSDKInstance, managementAPIClient, config }) if (config?.['data-dir']) { migration.addTask(createTaxonomyTask()); } else { - console.error('Please provide config using --config data-dir: ""'); + console.error('Please provide config using --config data-dir:""'); } }; diff --git a/packages/contentstack-migration/examples/taxonomies/test_taxonomies.csv b/packages/contentstack-migration/examples/taxonomies/test_taxonomies.csv index f18b4eb9dc..c551596d25 100644 --- a/packages/contentstack-migration/examples/taxonomies/test_taxonomies.csv +++ b/packages/contentstack-migration/examples/taxonomies/test_taxonomies.csv @@ -1,22 +1,21 @@ -Taxonomy Name,Taxonomy UID,Taxonomy Description,Term Level1 Name,Term Level1 UID,Term Level2 Name,Term Level2 UID,Term Level3 Name,Term Level3 UID,Term Level4 Name,Term Level4 UID -name taxonomy,name_taxonomy,,,,,,,,, -,,,term 2,term_2,,,,,, -,,,,,term 8,term_8,,,, -,,,,,,,term 9,term_9,, -,,,,,,,,,term 10,term_10 -,,,term 1,term_1,,,,,, -,,,,,term 4,term_4,,,, -,,,,,,,term 5,term_5,, -,,,,,,,,,term 7,term_7 -,,,,,term 3,term_3,,,, -,,,,,,,term 6,term_6,, -taxonomy1,taxonomy1,,,,,,,,, -,,,May,may,,,,,, -,,,,,Summer 2023,summer_2023,,,, -,,,December,december,,,,,, -,,,,,Winter 2022,winter_2022,,,, -clothes,clothes,clothes taxonomy,,,,,,,, -,,,fdshfgadf,fdshfgadf,,,,,, -,,,jeans,jeans,,,,,, -,,,shirt,shirt,,,,,, -,,,,,dfgdshfga,dfgdshfga,,,, \ No newline at end of file +Taxonomy Name,Taxonomy Uid,Taxonomy Description,Level 1 Term Name,Level 1 Term Uid,Level 2 Term Name,Level 2 Term Uid,Level 3 Term Name,Level 3 Term Uid,Level 4 Term Name,Level 4 Term Uid,Level 5 Term Name,Level 5 Term Uid,Level 6 Term Name,Level 6 Term Uid,Level 7 Term Name,Level 7 Term Uid,Level 8 Term Name,Level 8 Term Uid,Level 9 Term Name,Level 9 Term Uid,Level 10 Term Name,Level 10 Term Uid +Regions,regions,A Taxonomy which focuses on the categorization of various regions & it's sub regions,,,,,,,,,,,,,,,,,,,, +,,,EMEA,emea,,,,,,,,,,,,,,,,,, +,,,,,Europe,europe,,,,,,,,,,,,,,,, +,,,,,Middle East,middle_east,,,,,,,,,,,,,,,, +,,,,,Africa,africa,,,,,,,,,,,,,,,, +,,,APAC,apac,,,,,,,,,,,,,,,,,, +,,,,,Asia,asia,,,,,,,,,,,,,,,, +,,,,,,,Northeastern Asia,northeastern_asia,,,,,,,,,,,,,, +,,,,,,,Central and South Asia,central_and_south_asia,,,,,,,,,,,,,, +,,,,,,,,,Central Asia,central_asia,,,,,,,,,,,, +,,,,,,,,,South Asia,south_asia,,,,,,,,,,,, +,,,,,,,,,,,India,india,,,,,,,,,, +,,,,,,,,,,,,,Maharashtra,maharashtra,,,,,,,, +,,,,,,,,,,,,,,,Mumbai,mumbai,,,,,, +,,,,,,,Southeastern Asia,southeastern_asia,,,,,,,,,,,,,, +,,,,,Pacific,pacific,,,,,,,,,,,,,,,, +clothes,clothes,categorization of various clothes,,,,,,,,,,,,,,,,,,,, +,,,Casual wear,casual,,,,,,,,,,,,,,,,,, +,,,Formal wear,formal,,,,,,,,,,,,,,,,,, +,,,Sports wear,sports,,,,,,,,,,,,,,,,,, \ No newline at end of file diff --git a/packages/contentstack-migration/package.json b/packages/contentstack-migration/package.json index a5b07daa4e..96589c4fc4 100644 --- a/packages/contentstack-migration/package.json +++ b/packages/contentstack-migration/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/cli-migration", - "version": "1.4.2", + "version": "1.5.0", "author": "@contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { diff --git a/packages/contentstack-migration/src/utils/error-helper.js b/packages/contentstack-migration/src/utils/error-helper.js index 4b5e64b89c..86184b0c03 100644 --- a/packages/contentstack-migration/src/utils/error-helper.js +++ b/packages/contentstack-migration/src/utils/error-helper.js @@ -1,6 +1,7 @@ const { highlight } = require('cardinal'); const { keys } = Object; const chalk = require('chalk'); +const isEmpty = require('lodash/isEmpty') const { readFile } = require('./fs-helper'); const groupBy = require('./group-by'); @@ -50,10 +51,11 @@ module.exports = (errors) => { messages.push(`${fileErrorsMessage}${errorMessages}`); } - // eslint-disable-next-line - // console.error(chalk`{red.bold Validation failed}\n\n`); - // eslint-disable-next-line - console.log(messages.join('\n')); + if (isEmpty(messages) && errors?.length) { + console.error('Migration error---', errors); + } else { + console.log(messages.join('\n')); + } // eslint-disable-next-line console.log(chalk`{bold.red Migration unsuccessful}`); }; diff --git a/packages/contentstack-seed/package.json b/packages/contentstack-seed/package.json index 0876826649..b5feb65551 100644 --- a/packages/contentstack-seed/package.json +++ b/packages/contentstack-seed/package.json @@ -5,7 +5,7 @@ "author": "Contentstack", "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { - "@contentstack/cli-cm-import": "~1.13.5", + "@contentstack/cli-cm-import": "~1.14.0", "@contentstack/cli-command": "~1.2.16", "@contentstack/cli-utilities": "~1.5.13", "inquirer": "8.2.4", diff --git a/packages/contentstack-utilities/package.json b/packages/contentstack-utilities/package.json index 3e2d8b6a7f..3719bec421 100644 --- a/packages/contentstack-utilities/package.json +++ b/packages/contentstack-utilities/package.json @@ -32,7 +32,7 @@ "author": "contentstack", "license": "MIT", "dependencies": { - "@contentstack/management": "~1.13.0", + "@contentstack/management": "~1.15.3", "@contentstack/marketplace-sdk": "^1.0.1", "@oclif/core": "^2.9.3", "axios": "^1.6.4", diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index 092ad93fcf..2a6ee9444b 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.13.3 darwin-arm64 node-v20.8.0 +@contentstack/cli/1.14.0 darwin-arm64 node-v20.8.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND @@ -169,14 +169,14 @@ Perform audits and fix possible errors in the exported Contentstack data. USAGE $ csdx audit:fix [-c ] [-d ] [--report-path ] [--modules content-types|global-fields|entries] [--copy-path --copy-dir] [--fix-only - reference|global_field|json:rte|json:custom-field|blocks|group] [--columns | ] [--sort ] [--filter + reference|global_field|json:rte|json:extension|blocks|group] [--columns | ] [--sort ] [--filter ] [--csv | --no-truncate] FLAGS --copy-dir Create backup from the original data. --copy-path= Provide the path to backup the copied data --fix-only=