Skip to content

Commit efc54b8

Browse files
committed
Fix the Cleanup
2 parents fb4a844 + 1d2ab67 commit efc54b8

36 files changed

Lines changed: 2794 additions & 2355 deletions

File tree

.talismanrc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
fileignoreconfig:
22
- filename: package-lock.json
3-
checksum: 732118725964b623c44dd9e64d6b92eed5cddd2c96282938ba122bdf3855fc1c
3+
checksum: e548106b45789387d74c77500706242b9b5ccd378f57fe8b14a42d5d4c55109c
44
- filename: pnpm-lock.yaml
5-
checksum: 1791262a8fd93fa162219b876ba955d29039c04970b77907a092c37ab52b0d27
5+
checksum: 6c44d657aff5fad97f8370bba29c191b3002fa785f942e4f2eb8de5af8284e99
66
- filename: packages/contentstack-import-setup/test/unit/backup-handler.test.ts
77
checksum: 0582d62b88834554cf12951c8690a73ef3ddbb78b82d2804d994cf4148e1ef93
88
- filename: packages/contentstack-import-setup/test/config.json
@@ -281,5 +281,13 @@ fileignoreconfig:
281281
checksum: 1e6c1fba1172512401038d5454c8d218201ec62262449c5c878609592e0124c4
282282
- filename: packages/contentstack-audit/src/modules/composable-studio.ts
283283
checksum: 4fc97ff582d6dff9a54b3a50dfa3cbb5febd38a55aeb8737034b97188ad543ba
284+
- filename: packages/contentstack-config/src/utils/interactive.ts
285+
checksum: 09ebc9918e5161e423238df8879b782daf673e52a5ca97e000a9618517a40b96
286+
- filename: packages/contentstack-config/src/commands/config/set/proxy.ts
287+
checksum: 058c98f96a2de7e75a65536933e5fcd88f0fb7e8a487d9c172f4daacd0d05bea
288+
- filename: packages/contentstack-utilities/src/proxy-helper.ts
289+
checksum: 2a8379d7a34acb3c14093599fb4ba7307c94b0f280ea70d6d862ecb2448fe924
290+
- filename: packages/contentstack-config/src/commands/config/get/proxy.ts
291+
checksum: 9c49c2e6246ecdc5a4141c7e5f413d34f1fc799e25b3bbf60b61372c7a9a6f36
284292
version: '1.0'
285293

package-lock.json

Lines changed: 916 additions & 934 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-audit/1.16.2 darwin-arm64 node-v22.13.1
22+
@contentstack/cli-audit/1.17.0 darwin-arm64 node-v22.14.0
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND
@@ -53,13 +53,14 @@ Perform audits and find possible errors in the exported Contentstack data
5353
```
5454
USAGE
5555
$ csdx audit [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
56-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--columns <value>]
57-
[--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
56+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
57+
[--columns <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output
58+
csv|json|yaml]
5859
5960
FLAGS
6061
--modules=<option>... Provide the list of modules to be audited
61-
<options:
62-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
62+
<options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-ru
63+
les|composable-studio>
6364
--report-path=<value> Path to store the audit reports
6465
6566
COMMON FLAGS
@@ -103,18 +104,19 @@ Perform audits and fix possible errors in the exported Contentstack data.
103104
```
104105
USAGE
105106
$ csdx audit:fix [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
106-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--copy-path <value>
107-
--copy-dir] [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns
108-
<value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
107+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
108+
[--copy-path <value> --copy-dir] [--fix-only
109+
reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns <value>] [--sort <value>]
110+
[--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
109111
110112
FLAGS
111113
--copy-dir Create backup from the original data.
112114
--copy-path=<value> Provide the path to backup the copied data
113115
--fix-only=<option>... Provide the list of fix options
114116
<options: reference|global_field|json:rte|json:extension|blocks|group|content_types>
115117
--modules=<option>... Provide the list of modules to be audited
116-
<options:
117-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
118+
<options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-r
119+
ules|composable-studio>
118120
--report-path=<value> Path to store the audit reports
119121
120122
COMMON FLAGS
@@ -160,13 +162,14 @@ Perform audits and find possible errors in the exported Contentstack data
160162
```
161163
USAGE
162164
$ csdx cm:stacks:audit [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
163-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--columns <value>]
164-
[--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
165+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
166+
[--columns <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output
167+
csv|json|yaml]
165168
166169
FLAGS
167170
--modules=<option>... Provide the list of modules to be audited
168-
<options:
169-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
171+
<options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-ru
172+
les|composable-studio>
170173
--report-path=<value> Path to store the audit reports
171174
172175
COMMON FLAGS
@@ -212,18 +215,19 @@ Perform audits and fix possible errors in the exported Contentstack data.
212215
```
213216
USAGE
214217
$ csdx cm:stacks:audit:fix [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
215-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--copy-path <value>
216-
--copy-dir] [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns
217-
<value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
218+
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
219+
[--copy-path <value> --copy-dir] [--fix-only
220+
reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns <value>] [--sort <value>]
221+
[--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
218222
219223
FLAGS
220224
--copy-dir Create backup from the original data.
221225
--copy-path=<value> Provide the path to backup the copied data
222226
--fix-only=<option>... Provide the list of fix options
223227
<options: reference|global_field|json:rte|json:extension|blocks|group|content_types>
224228
--modules=<option>... Provide the list of modules to be audited
225-
<options:
226-
content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
229+
<options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-r
230+
ules|composable-studio>
227231
--report-path=<value> Path to store the audit reports
228232
229233
COMMON FLAGS

packages/contentstack-audit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"/oclif.manifest.json"
1919
],
2020
"dependencies": {
21-
"@contentstack/cli-command": "~1.7.1",
22-
"@contentstack/cli-utilities": "~1.16.0",
21+
"@contentstack/cli-command": "~1.7.2",
22+
"@contentstack/cli-utilities": "~1.17.0",
2323
"@oclif/core": "^4.3.0",
2424
"@oclif/plugin-help": "^6.2.28",
2525
"@oclif/plugin-plugins": "^5.4.54",

packages/contentstack-auth/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-auth",
33
"description": "Contentstack CLI plugin for authentication activities",
4-
"version": "1.6.3",
4+
"version": "1.7.1",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -22,8 +22,8 @@
2222
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
2323
},
2424
"dependencies": {
25-
"@contentstack/cli-command": "~1.7.1",
26-
"@contentstack/cli-utilities": "~1.16.0",
25+
"@contentstack/cli-command": "~1.7.2",
26+
"@contentstack/cli-utilities": "~1.17.0",
2727
"@oclif/core": "^4.3.0",
2828
"@oclif/plugin-help": "^6.2.28",
2929
"otplib": "^12.0.1"

packages/contentstack-auth/src/utils/auth-handler.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,26 @@ class AuthHandler {
118118
if (result.user) {
119119
log.debug('Login successful, user found', { module: 'auth-handler', userEmail: result.user.email });
120120
resolve(result.user as User);
121-
} else if (result.error_code === 294) {
122-
const tfToken = await this.handleOTPFlow(tfaToken, loginPayload);
123-
121+
} else {
122+
log.debug('Login failed: no user found.', { module: 'auth-handler', result });
123+
reject(new Error(messageHandler.parse('CLI_AUTH_LOGIN_NO_USER')));
124+
}
125+
})
126+
.catch(async (error: any) => {
127+
if (error.errorCode === 294) {
124128
try {
129+
const tfToken = await this.handleOTPFlow(tfaToken, loginPayload);
125130
resolve(await this.login(email, password, tfToken));
126131
} catch (error) {
127132
log.debug('Login with TFA token failed.', { module: 'auth-handler', error });
128133
cliux.print('CLI_AUTH_2FA_FAILED', { color: 'red' });
129134
reject(error);
130135
}
131136
} else {
132-
log.debug('Login failed: no user found.', { module: 'auth-handler', result });
133-
reject(new Error(messageHandler.parse('CLI_AUTH_LOGIN_NO_USER')));
137+
log.debug('Login API call failed.', { module: 'auth-handler', error: error?.errorMessage || error });
138+
cliux.print('CLI_AUTH_LOGIN_FAILED', { color: 'yellow' });
139+
reject(error);
134140
}
135-
})
136-
.catch((error: any) => {
137-
log.debug('Login API call failed.', { module: 'auth-handler', error: error?.errorMessage || error });
138-
cliux.print('CLI_AUTH_LOGIN_FAILED', { color: 'yellow' });
139-
handleAndLogError(error, { module: 'auth-handler' });
140141
});
141142
} else {
142143
const hasEmail = !!email;
@@ -203,7 +204,7 @@ class AuthHandler {
203204
.catch((error: Error) => {
204205
log.debug('Token validation failed.', { module: 'auth-handler', error: error.message });
205206
cliux.print('CLI_AUTH_TOKEN_VALIDATION_FAILED', { color: 'yellow' });
206-
handleAndLogError(error, { module: 'auth-handler' });
207+
reject(error);
207208
});
208209
} else {
209210
log.debug('Token validation failed: no auth token provided.', { module: 'auth-handler' });

packages/contentstack-auth/src/utils/mfa-handler.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,6 @@ class MFAHandler {
8787
}
8888
}
8989

90-
if (!secret) {
91-
log.debug('Checking stored MFA secret', { module: 'mfa-handler' });
92-
const mfaConfig = configHandler.get('mfa');
93-
if (mfaConfig?.secret) {
94-
try {
95-
secret = this.encrypter.decrypt(mfaConfig.secret);
96-
source = 'stored configuration';
97-
} catch (error) {
98-
log.debug('Failed to decrypt stored MFA secret', { module: 'mfa-handler', error });
99-
handleAndLogError(error, { module: 'mfa-handler' }, messageHandler.parse('CLI_AUTH_MFA_DECRYPT_FAILED'));
100-
}
101-
}
102-
}
103-
10490
if (secret) {
10591
try {
10692
const code = this.generateMFACode(secret);

packages/contentstack-auth/test/unit/auth-handler.test.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ describe('Auth Handler', function () {
3030
return Promise.reject(new Error('Invalid 2FA code'));
3131
}
3232
} else {
33-
return Promise.resolve({ error_code: 294 });
33+
const error: any = new Error('2FA required');
34+
error.errorCode = 294;
35+
return Promise.reject(error);
3436
}
3537
}
3638
return Promise.resolve({ user });
@@ -113,13 +115,23 @@ describe('Auth Handler', function () {
113115
it('Login with 2FA enabled invalid otp, failed to login', async function () {
114116
this.timeout(10000);
115117
TFAEnabled = true;
116-
let result;
118+
askOTPStub.restore();
119+
askOTPStub = sinon.stub(interactive, 'askOTP').callsFake(function () {
120+
return Promise.resolve(InvalidTFATestToken);
121+
});
117122
try {
118-
result = await authHandler.login(credentials.email, credentials.password);
123+
await authHandler.login(credentials.email, credentials.password);
124+
expect.fail('Should have thrown an error');
119125
} catch (error) {
120-
result = error;
126+
expect(error).to.be.instanceOf(Error);
127+
expect((error as Error).message).to.include('Invalid 2FA code');
128+
} finally {
129+
TFAEnabled = false;
130+
askOTPStub.restore();
131+
askOTPStub = sinon.stub(interactive, 'askOTP').callsFake(function () {
132+
return Promise.resolve(TFATestToken);
133+
});
121134
}
122-
TFAEnabled = false;
123135
});
124136

125137
it('Login with 2FA enabled with sms channel, should be logged in successfully', async function () {

packages/contentstack-bootstrap/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-bootstrap",
33
"description": "Bootstrap contentstack apps",
4-
"version": "1.18.0",
4+
"version": "1.18.1",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -16,14 +16,14 @@
1616
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
1717
},
1818
"dependencies": {
19-
"@contentstack/cli-cm-seed": "~1.14.0",
20-
"@contentstack/cli-command": "~1.7.1",
21-
"@contentstack/cli-utilities": "~1.16.0",
19+
"@contentstack/cli-cm-seed": "~1.14.1",
20+
"@contentstack/cli-command": "~1.7.2",
21+
"@contentstack/cli-utilities": "~1.17.0",
2222
"@oclif/core": "^4.3.0",
2323
"@oclif/plugin-help": "^6.2.28",
2424
"inquirer": "8.2.7",
2525
"mkdirp": "^1.0.4",
26-
"tar": "^6.2.1 "
26+
"tar": "^7.5.6"
2727
},
2828
"devDependencies": {
2929
"@oclif/test": "^4.1.13",

packages/contentstack-branches/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@contentstack/cli-cm-branches",
33
"description": "Contentstack CLI plugin to do branches operations",
4-
"version": "1.6.2",
4+
"version": "1.6.3",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"dependencies": {
8-
"@contentstack/cli-command": "~1.7.1",
8+
"@contentstack/cli-command": "~1.7.2",
99
"@oclif/core": "^4.3.0",
1010
"@oclif/plugin-help": "^6.2.28",
11-
"@contentstack/cli-utilities": "~1.16.0",
11+
"@contentstack/cli-utilities": "~1.17.0",
1212
"chalk": "^4.1.2",
1313
"just-diff": "^6.0.2",
1414
"lodash": "^4.17.21"

0 commit comments

Comments
 (0)