From 6e93062999ee29973ad4beced65e7793eadccfb5 Mon Sep 17 00:00:00 2001 From: Netraj Patel Date: Tue, 28 Apr 2026 11:54:25 +0530 Subject: [PATCH 1/2] uuid, short-uuid and eslint major version bump --- .talismanrc | 4 +- packages/contentstack-auth/README.md | 2 +- packages/contentstack-auth/package.json | 2 +- packages/contentstack-command/package.json | 2 +- packages/contentstack-config/README.md | 2 +- packages/contentstack-config/package.json | 2 +- packages/contentstack-utilities/package.json | 4 +- .../test/unit/auth-handler.test.ts | 63 +- packages/contentstack/README.md | 257 +------- packages/contentstack/package.json | 7 +- pnpm-lock.yaml | 562 +++++++++--------- pnpm-workspace.yaml | 1 + 12 files changed, 337 insertions(+), 571 deletions(-) diff --git a/.talismanrc b/.talismanrc index 212f9b2b77..e07468387c 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,4 +1,6 @@ fileignoreconfig: - filename: pnpm-lock.yaml - checksum: 5bf275a8f6843072ceadaef8e1aafaef8a80ef71d8d0719a653dc6ecee6e9355 + checksum: 18165cc0d24a142ba68182e5251b8f6ead686824119754067a442677cb37acba + - filename: packages/contentstack/README.md + checksum: 4fbf9f74f2288364521d67cca0145f83db5387286923f24e08207e331011e9d5 version: '1.0' diff --git a/packages/contentstack-auth/README.md b/packages/contentstack-auth/README.md index 9d8a9a4fe7..69ad0517d0 100644 --- a/packages/contentstack-auth/README.md +++ b/packages/contentstack-auth/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-auth/1.8.0 darwin-arm64 node-v24.14.0 +@contentstack/cli-auth/1.8.1 darwin-arm64 node-v24.14.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-auth/package.json b/packages/contentstack-auth/package.json index 88c9b7ef82..347e29aff3 100644 --- a/packages/contentstack-auth/package.json +++ b/packages/contentstack-auth/package.json @@ -37,7 +37,7 @@ "@types/sinon": "^21.0.0", "chai": "^4.5.0", "dotenv": "^16.4.7", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^5.2.2", "eslint-config-oclif-typescript": "^3.1.14", "mocha": "10.8.2", diff --git a/packages/contentstack-command/package.json b/packages/contentstack-command/package.json index d33be95fcf..4385bd49b2 100644 --- a/packages/contentstack-command/package.json +++ b/packages/contentstack-command/package.json @@ -29,7 +29,7 @@ "@types/mkdirp": "^1.0.2", "@types/mocha": "^8.2.3", "@types/node": "^14.18.63", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^6.0.15", "eslint-config-oclif-typescript": "^3.1.13", "mocha": "10.8.2", diff --git a/packages/contentstack-config/README.md b/packages/contentstack-config/README.md index 65be566e9b..aab6ff8958 100644 --- a/packages/contentstack-config/README.md +++ b/packages/contentstack-config/README.md @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config $ csdx COMMAND running command... $ csdx (--version) -@contentstack/cli-config/1.20.1 darwin-arm64 node-v24.14.0 +@contentstack/cli-config/1.20.2 darwin-arm64 node-v24.14.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND diff --git a/packages/contentstack-config/package.json b/packages/contentstack-config/package.json index d342826c20..4a2f18944c 100644 --- a/packages/contentstack-config/package.json +++ b/packages/contentstack-config/package.json @@ -33,7 +33,7 @@ "@types/node": "^14.18.63", "@types/sinon": "^21.0.0", "chai": "^4.5.0", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^6.0.62", "eslint-config-oclif-typescript": "^3.1.14", "mocha": "10.8.2", diff --git a/packages/contentstack-utilities/package.json b/packages/contentstack-utilities/package.json index f781ddeb7e..08f28525b5 100644 --- a/packages/contentstack-utilities/package.json +++ b/packages/contentstack-utilities/package.json @@ -53,7 +53,7 @@ "traverse": "^0.6.11", "tty-table": "^4.2.3", "unique-string": "^2.0.0", - "uuid": "^9.0.1", + "uuid": "^14.0.0", "winston": "^3.19.0", "xdg-basedir": "^4.0.0" }, @@ -71,7 +71,7 @@ "@types/sinon": "^21.0.0", "@types/traverse": "^0.6.37", "chai": "^4.5.0", - "eslint": "^8.57.1", + "eslint": "^9.26.0", "eslint-config-oclif": "^6.0.62", "eslint-config-oclif-typescript": "^3.1.14", "fancy-test": "^2.0.42", diff --git a/packages/contentstack-utilities/test/unit/auth-handler.test.ts b/packages/contentstack-utilities/test/unit/auth-handler.test.ts index 295da6f037..551f6bf7f8 100644 --- a/packages/contentstack-utilities/test/unit/auth-handler.test.ts +++ b/packages/contentstack-utilities/test/unit/auth-handler.test.ts @@ -166,25 +166,17 @@ describe('Auth Handler', () => { refresh_token: refreshToken, }; - try { - const expectedPayload = { - grant_type: 'authorization_code', - client_id: authHandler.OAuthClientId, - code_verifier: authHandler.codeVerifier, - redirect_uri: authHandler.OAuthRedirectURL, - code, - }; - - const httpClientStub = sandbox.stub(HttpClient.prototype, 'post').resolves({ data: userData }); - const getUserDetailsStub = sandbox.stub(authHandler, 'getUserDetails').resolves(userData); - const setConfigDataStub = sandbox.stub(authHandler, 'setConfigData').resolves(); - - await authHandler.getAccessToken(code); - - assert.calledWith(httpClientStub, `${authHandler.OAuthBaseURL}/apps-api/apps/token`, expectedPayload); - assert.calledWith(getUserDetailsStub, userData); - assert.calledWith(setConfigDataStub, 'oauth', userData); - } catch (error) {} + const exchangeStub = sandbox.stub().resolves(userData); + sandbox.stub(authHandler, 'oauthHandler').value({ + exchangeCodeForToken: exchangeStub, + }); + const getUserDetailsStub = sandbox.stub(authHandler, 'getUserDetails').resolves(userData); + const setConfigDataStub = sandbox.stub(authHandler, 'setConfigData').resolves(); + await authHandler.getAccessToken(code); + // Verify the actual calls made: + assert.calledWith(exchangeStub, code); // exchangeCodeForToken called with code + assert.calledWith(getUserDetailsStub, userData); // getUserDetails called with result from exchange + assert.calledWith(setConfigDataStub, 'oauth', userData); // setConfigData called with 'oauth' and userData }); }); @@ -296,30 +288,31 @@ describe('Auth Handler', () => { }); it('should refresh the token and resolve with data when refresh token is valid', async () => { - const configOauthRefreshToken = 'valid_refresh_token'; // Set a valid refresh token here + const configOauthRefreshToken = 'valid_refresh_token'; const configAuthorisationType = authHandler.authorisationTypeOAUTHValue; const expectedData = { - access_token: config.access_token, + access_token: 'new_access_token', refresh_token: 'new_refresh_token', }; - - const postStub = sandbox.stub().resolves({ data: expectedData }); - const httpClientStub = { - post: postStub, - }; - const httpClientInstance = new HttpClient().headers().asFormParams(); - sandbox.stub(httpClientInstance, 'post').value(httpClientStub); - - sandbox.stub(authHandler, 'setConfigData').resolves(expectedData); - + // Stub oauthHandler with refreshAccessToken method + const refreshAccessTokenStub = sandbox.stub().resolves(expectedData); + sandbox.stub(authHandler, 'oauthHandler').value({ + refreshAccessToken: refreshAccessTokenStub, + }); + // Stub configHandler.get to return proper values sandbox .stub(configHandler, 'get') .withArgs(authHandler.oauthRefreshTokenKeyName) .returns(configOauthRefreshToken) .withArgs(authHandler.authorisationTypeKeyName) .returns(configAuthorisationType); - - authHandler.refreshToken(); + // Stub setConfigData + sandbox.stub(authHandler, 'setConfigData').resolves(expectedData); + const result = await authHandler.refreshToken(); + // Verify calls + assert.calledWith(refreshAccessTokenStub, configOauthRefreshToken); + assert.calledWith(authHandler.setConfigData, 'refreshToken', expectedData); + expect(result).to.deep.equal(expectedData); }); }); @@ -354,7 +347,7 @@ describe('Auth Handler', () => { const data = { access_token: '', }; - + try { await authHandler.getUserDetails(data); throw new Error('Expected getUserDetails to throw'); // ensure failure if no error is thrown @@ -362,7 +355,7 @@ describe('Auth Handler', () => { expect(error).to.be.instanceOf(Error); expect(error.message).to.equal('Invalid or empty access token.'); } - }); + }); }); describe('isAuthenticated', () => { diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index a18406b226..a3ff1cf571 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.60.1 darwin-arm64 node-v24.14.0 +@contentstack/cli/1.61.1 darwin-arm64 node-v24.14.0 $ csdx --help [COMMAND] USAGE $ csdx COMMAND @@ -39,12 +39,12 @@ USAGE * [`csdx auth:whoami`](#csdx-authwhoami) * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value) * [`csdx cm:assets:unpublish`](#csdx-cmassetsunpublish) -* [`csdx cm:bootstrap`](#csdx-cmbootstrap) * [`csdx cm:branches`](#csdx-cmbranches) * [`csdx cm:branches:create`](#csdx-cmbranchescreate) * [`csdx cm:branches:delete [-uid ] [-k ]`](#csdx-cmbranchesdelete--uid-value--k-value) * [`csdx cm:branches:diff [--base-branch ] [--compare-branch ] [-k ][--module ] [--format ] [--csv-path ]`](#csdx-cmbranchesdiff---base-branch-value---compare-branch-value--k-value--module-value---format-value---csv-path-value) * [`csdx cm:branches:merge [-k ][--compare-branch ] [--no-revert] [--export-summary-path ] [--use-merge-summary ] [--comment ] [--base-branch ]`](#csdx-cmbranchesmerge--k-value--compare-branch-value---no-revert---export-summary-path-value---use-merge-summary-value---comment-value---base-branch-value) +* [`csdx cm:branches:merge-status -k --merge-uid `](#csdx-cmbranchesmerge-status--k-value---merge-uid-value) * [`csdx cm:bulk-publish`](#csdx-cmbulk-publish) * [`csdx cm:entries:update-and-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-types ] [-t ] [-e ] [-c ] [-y] [--locales ] [--branch ]`](#csdx-cmentriesupdate-and-publish--a-value---retry-failed-value---bulk-publish-value---content-types-value--t-value--e-value--c-value--y---locales-value---branch-value) * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value) @@ -70,11 +70,8 @@ USAGE * [`csdx cm:stacks:import-setup [-k ] [-d ] [-a ] [--modules ]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue) * [`csdx cm:migrate-rte`](#csdx-cmmigrate-rte) * [`csdx cm:stacks:migration [-k ] [-a ] [--file-path ] [--branch ] [--config-file ] [--config ] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value---config-file-value---config-value---multiple) -* [`csdx cm:stacks:seed [--repo ] [--org ] [-k ] [-n ] [-y] [-s ] [--locale ]`](#csdx-cmstacksseed---repo-value---org-value--k-value--n-value--y--s-value---locale-value) -* [`csdx cm:stacks:clone [--source-branch ] [--target-branch ] [--source-management-token-alias ] [--destination-management-token-alias ] [-n ] [--type a|b] [--source-stack-api-key ] [--destination-stack-api-key ] [--import-webhook-status disable|current]`](#csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent) * [`csdx cm:stacks:audit`](#csdx-cmstacksaudit) * [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix) -* [`csdx cm:stacks:clone [--source-branch ] [--target-branch ] [--source-management-token-alias ] [--destination-management-token-alias ] [-n ] [--type a|b] [--source-stack-api-key ] [--destination-stack-api-key ] [--import-webhook-status disable|current]`](#csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent) * [`csdx cm:stacks:export [-c ] [-k ] [-d ] [-a ] [--module ] [--content-types ] [--branch ] [--secured-assets]`](#csdx-cmstacksexport--c-value--k-value--d-value--a-value---module-value---content-types-value---branch-value---secured-assets) * [`csdx cm:stacks:import [-c ] [-k ] [-d ] [-a ] [--module ] [--backup-dir ] [--branch ] [--import-webhook-status disable|current]`](#csdx-cmstacksimport--c-value--k-value--d-value--a-value---module-value---backup-dir-value---branch-value---import-webhook-status-disablecurrent) * [`csdx cm:stacks:import-setup [-k ] [-d ] [-a ] [--modules ]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue) @@ -83,7 +80,6 @@ USAGE * [`csdx cm:stacks:publish-clear-logs`](#csdx-cmstackspublish-clear-logs) * [`csdx cm:stacks:publish-configure`](#csdx-cmstackspublish-configure) * [`csdx cm:stacks:publish-revert`](#csdx-cmstackspublish-revert) -* [`csdx cm:stacks:seed [--repo ] [--org ] [-k ] [-n ] [-y] [-s ] [--locale ]`](#csdx-cmstacksseed---repo-value---org-value--k-value--n-value--y--s-value---locale-value) * [`csdx csdx cm:stacks:unpublish [-a ] [-e ] [-c ] [-y] [--locale ] [--branch ] [--retry-failed ] [--bulk-unpublish ] [--content-type ] [--delivery-token ] [--only-assets] [--only-entries]`](#csdx-csdx-cmstacksunpublish--a-value--e-value--c-value--y---locale-value---branch-value---retry-failed-value---bulk-unpublish-value---content-type-value---delivery-token-value---only-assets---only-entries) * [`csdx config:get:base-branch`](#csdx-configgetbase-branch) * [`csdx config:get:ea-header`](#csdx-configgetea-header) @@ -576,46 +572,6 @@ EXAMPLES _See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/assets/unpublish.js)_ -## `csdx cm:bootstrap` - -Bootstrap contentstack apps - -``` -USAGE - $ csdx cm:bootstrap [--app-name ] [--project-dir ] [-k | --org | -n ] [-y] - [--run-dev-server] [-a ] - -FLAGS - -a, --alias= Alias of the management token - -k, --stack-api-key= Provide stack API key to seed content - -n, --stack-name= Name of the new stack that will be created. - -y, --yes [Optional] Skip stack confirmation - --app-name= App name, kickstart-next, kickstart-next-ssr, kickstart-next-ssg, kickstart-next-graphql, - kickstart-next-middleware, kickstart-nuxt, kickstart-nuxt-ssr - --org= Provide organization UID to create a new stack - --project-dir= Directory to setup the project. If directory name has a space then provide the path as a - string or escap the space using back slash eg: "../../test space" or ../../test\ space - --run-dev-server Automatically start the development server after setup - -DESCRIPTION - Bootstrap contentstack apps - -EXAMPLES - $ csdx cm:bootstrap - - $ csdx cm:bootstrap --project-dir - - $ csdx cm:bootstrap --app-name "kickstart-next" --project-dir - - $ csdx cm:bootstrap --app-name "kickstart-next" --project-dir --stack-api-key "stack-api-key" - - $ csdx cm:bootstrap --app-name "kickstart-next" --project-dir --org "your-org-uid" --stack-name "stack-name" - - $ csdx cm:bootstrap --app-name "kickstart-next" --project-dir --run-dev-server -``` - -_See code: [@contentstack/cli-cm-bootstrap](https://github.com/contentstack/cli/blob/main/packages/contentstack-bootstrap/src/commands/cm/bootstrap.ts)_ - ## `csdx cm:branches` List the branches @@ -793,6 +749,29 @@ EXAMPLES _See code: [@contentstack/cli-cm-branches](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/src/commands/cm/branches/merge.ts)_ +## `csdx cm:branches:merge-status -k --merge-uid ` + +Check the status of a branch merge job + +``` +USAGE + $ csdx cm:branches:merge-status -k --merge-uid + +FLAGS + -k, --stack-api-key= (required) Provide your stack API key. + --merge-uid= (required) Merge job UID to check status for. + +DESCRIPTION + Check the status of a branch merge job + +EXAMPLES + $ csdx cm:branches:merge-status -k bltxxxxxxxx --merge-uid merge_abc123 + + $ csdx cm:branches:merge-status --stack-api-key bltxxxxxxxx --merge-uid merge_abc123 +``` + +_See code: [@contentstack/cli-cm-branches](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/src/commands/cm/branches/merge-status.ts)_ + ## `csdx cm:bulk-publish` Bulk Publish script for managing entries and assets @@ -2566,97 +2545,6 @@ EXAMPLES $ csdx cm:migration --alias --file-path -k ``` -## `csdx cm:stacks:seed [--repo ] [--org ] [-k ] [-n ] [-y] [-s ] [--locale ]` - -Create a stack from existing content types, entries, assets, etc - -``` -USAGE - $ csdx cm:seed cm:stacks:seed [--repo ] [--org ] [-k ] [-n ] [-y] [-s ] - [--locale ] - -FLAGS - -a, --alias= Alias of the management token - -k, --stack-api-key= Provide stack API key to seed content to - -n, --stack-name= Name of a new stack that needs to be created. - -o, --org= Provide Organization UID to create a new stack - -r, --repo= GitHub organization name or GitHub user name/repository name. - -s, --stack= Provide the stack UID to seed content. - -y, --yes [Optional] Skip the stack confirmation. - -DESCRIPTION - Create a stack from existing content types, entries, assets, etc - -ALIASES - $ csdx cm:seed - -EXAMPLES - $ csdx cm:stacks:seed - - $ csdx cm:stacks:seed --repo "account" - - $ csdx cm:stacks:seed --repo "account/repository" - - $ csdx cm:stacks:seed --repo "account/repository" --stack-api-key "stack-api-key" //seed content into specific stack - - $ csdx cm:stacks:seed --repo "account/repository" --org "your-org-uid" --stack-name "stack-name" //create a new stack in given org uid -``` - -## `csdx cm:stacks:clone [--source-branch ] [--target-branch ] [--source-management-token-alias ] [--destination-management-token-alias ] [-n ] [--type a|b] [--source-stack-api-key ] [--destination-stack-api-key ] [--import-webhook-status disable|current]` - -Clone data (structure/content or both) of a stack into another stack - -``` -USAGE - $ csdx cm:stack-clone cm:stacks:clone [--source-branch ] [--target-branch ] - [--source-management-token-alias ] [--destination-management-token-alias ] [-n ] [--type a|b] - [--source-stack-api-key ] [--destination-stack-api-key ] [--import-webhook-status disable|current] - -FLAGS - -c, --config= Path for the external configuration - -n, --stack-name= Provide a name for the new stack to store the cloned content. - -y, --yes Force override all Marketplace prompts. - --destination-management-token-alias= Destination management token alias. - --destination-stack-api-key= Destination stack API key - --import-webhook-status=