Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
620fcde
Update .talismanrc
harshithad0703 Aug 11, 2025
bc195ba
update package-lock
harshitha-cstk Aug 11, 2025
ddd5577
update talismanrc
harshitha-cstk Aug 11, 2025
3679bb1
update git-ignore
harshitha-cstk Aug 11, 2025
06ab860
Refactor constructors in audit classes to initialize missingRefs prop…
harshitha-cstk Aug 11, 2025
d9dfa60
Remove unused import from integration test file
harshitha-cstk Aug 11, 2025
ee69450
Update import statement in run.test.ts to specify JSON type
harshitha-cstk Aug 11, 2025
d33ea0e
Reorganize config import to improve readability
harshitha-cstk Aug 11, 2025
8387072
Refactor lodash imports to use ES module syntax
harshitha-cstk Aug 11, 2025
9b47b77
Refactor imports in run.test.ts to use ES module syntax and improve c…
harshitha-cstk Aug 11, 2025
6b0ff50
Refactor import in message-handler.test.ts to use ES module syntax
harshitha-cstk Aug 11, 2025
ee0c146
Comment out tests for Contentstack Import Setup in unit-test.yml
harshitha-cstk Aug 11, 2025
fe4bde8
Merge pull request #2054 from contentstack/fix/talismanrc-6
harshithad0703 Aug 11, 2025
640125a
Feat: Added Config command to set the totp
cs-raj Aug 11, 2025
e0554e5
Adding last_updated
cs-raj Aug 11, 2025
6da4240
Merge branch 'staging' into feat/DX-3412
cs-raj Aug 11, 2025
4179fd2
Merge branch 'feat/DX-3412' into fix/DX-3413
cs-raj Aug 11, 2025
10117bb
Lock-file update
cs-raj Aug 11, 2025
c2b4723
Fixed Test cases
cs-raj Aug 11, 2025
f539bfb
Fixed the test cases
cs-raj Aug 11, 2025
d3f2a47
Changed the totp to MFA
cs-raj Aug 12, 2025
af47903
Updated talismand and command shortcut name
cs-raj Aug 12, 2025
a46f34d
Readme update
cs-raj Aug 12, 2025
e64af71
Tests updated
cs-raj Aug 12, 2025
2b59ba6
Integration Test fixes and unit test fixes
cs-raj Aug 12, 2025
6ba4223
Fixed the stub
cs-raj Aug 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
working-directory: ./packages/contentstack-auth
run: npm run test

- name: Run tests for Contentstack Import Setup
working-directory: ./packages/contentstack-import-setup
run: npm run test:unit
# - name: Run tests for Contentstack Import Setup
# working-directory: ./packages/contentstack-import-setup
# run: npm run test:unit


- name: Run tests for Contentstack Bulk Publish
Expand Down
50 changes: 47 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 14f5e6720c8596c182735dffd28e7da2e5175670ec24cd8299809fb05d6735a5
- filename: package-lock.json
checksum: 12cf2fe3303ea849646a97f767e720ff48847ecdcf4439140488dfd3157a0844
checksum: ddcdc0f28b1df533e26c370f92810f1c877aae48ed2157f8822a1f275adad612
- filename: pnpm-lock.yaml
checksum: c32024bc35de63368636624ef52c1b0cf6c4e1dbcfa93ced09e57f6e8ca454ca
- filename: packages/contentstack-import-setup/test/unit/backup-handler.test.ts
checksum: 0582d62b88834554cf12951c8690a73ef3ddbb78b82d2804d994cf4148e1ef93
- filename: packages/contentstack-import-setup/test/config.json
checksum: 187fd202d00e7d2c3d8b00f983ff21d8535e0fdb76cebec3f39c400258c88d05
- filename: packages/contentstack-command/test/config.json
checksum: 7c15663b3a6562b99d3082ead5035932b0276e4fd53774b3f838372a19b291ef
- filename: packages/contentstack-import-setup/test/unit/modules/content-types.test.ts
checksum: ce8772281171927e7dee7d6a761a029c902393b808e2696624fdcf0f5b80ea5c
- filename: packages/contentstack-import-setup/test/unit/modules/entries.test.ts
checksum: 17652bfc125879bb37facf8ea9f54dc4f97627ca625ec148c9d551a20196d85b
- filename: packages/contentstack-import-setup/test/unit/modules/extensions.test.ts
checksum: eaafdf39fc8a947aa490232bfc7da950c882bd69b5b27a0362ef2bee21f6a177
- filename: packages/contentstack-import-setup/test/unit/modules/global-fields.test.ts
checksum: fd49cfab6d374254c0c6eb4c7e7ee8ff4fe6c2b46e7b0d7f7437cbe665d1ce8b
- filename: packages/contentstack-import-setup/test/unit/modules/marketplace-apps.test.ts
checksum: c35dfe96d685fb12427de4b77c9240b34b9bee5e158ad7489acaa0d061ad562e
- filename: packages/contentstack-import-setup/test/unit/modules/taxonomies.test.ts
checksum: 3868ff9e8833a670350590f070c6f635807f2a1f534accba677af4709fab0e4a
- filename: packages/contentstack-import-setup/test/unit/import-config-handler.test.ts
checksum: f2f2c994543c388f2eecaf8128f789eab2895f1f78d659e58ef9491972c6f9a8
- filename: packages/contentstack-import-setup/test/unit/common-helper.test.ts
checksum: a0c98c6f0ee88a398e3f1bd80cac0a6cc0ede7eee01957cf7d6e1f199f3da643
- filename: packages/contentstack-import-setup/test/unit/modules/base-setup.test.ts
checksum: 862c52e2bbd1975b963f45ce3e89c243d047858cdbe7339918395ce2fc52bf89
- filename: packages/contentstack-import-setup/test/unit/import-setup.test.ts
checksum: 1eee4f461fa5b115894d1806a14af6f45336cbe6c0392f16078bd2877fadff67
- filename: packages/contentstack-import-setup/test/unit/login-handler.test.ts
checksum: e549f9ca3a9aae0d93b7284f7e771d55c0610725ddcb4333612df2f215e92769
- filename: packages/contentstack/README.md
checksum: c09f6dc93702caff3adf689b501ec32586a16c865c1fe3a63b53ae645ca22349
- filename: packages/contentstack-import-setup/test/unit/modules/assets.test.ts
checksum: 449a5e3383631a6f78d1291aa3c28c91681879289398f0a933158fba5c5d5acf
- filename: packages/contentstack-config/src/services/mfa/types.ts
checksum: 2817710204fc907642803e514bb51df506f60a196d00548362e7178a3bf21208
- filename: packages/contentstack-config/src/services/mfa/mfa-service.interface.ts
checksum: 68158e62e4e5f6d51538bed0789074a4f595f1e4b3a37e82edce6afe5b69bc30
- filename: packages/contentstack-config/test/unit/services/mfa.service.test.ts
checksum: 8ba652904813cc27d5be3c7829588c3f4b0a3b3fab50439676690fe95a1d4733
- filename: packages/contentstack-config/README.md
checksum: b560bf300a07b40d9c24534c8e3493b7569233de061cfcdd58eb615c96e83d75
- filename: packages/contentstack-auth/test/integration/auth.test.ts
checksum: 96a66c141cf8f83443f967f62be210c3a95e06cf3d6c7bcb25229a4de7f05c5f
- filename: packages/contentstack-auth/test/unit/commands/login.test.ts
checksum: c256cb00cbe8a5f2ded2907677f7a55b4661cd95f1145d7bbd10740702e10e5c
version: "1.0"
2,749 changes: 1,308 additions & 1,441 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/contentstack-audit/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ dependabot.yml
.editorconfig
oclif.manifest.json
*.env
.vscode/
.vscode/
audit-report
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,25 @@ describe('Content types', () => {
let constructorParam: ModuleConstructorParam & CtConstructorParam;

class AuditTempClass extends ContentType {
constructor(public missingRefs: Record<string, any> = {}) {
public missingRefs: Record<string, any>;

constructor(missingRefs: Record<string, any> = {}) {
super(constructorParam);
this.currentUid = 'audit';
this.currentTitle = 'Audit';
this.missingRefs = missingRefs;
this.missingRefs['audit'] = [];
}
}

class AuditFixTempClass extends ContentType {
constructor(public missingRefs: Record<string, any> = {}) {
public missingRefs: Record<string, any>;

constructor(missingRefs: Record<string, any> = {}) {
super({ ...constructorParam, fix: true, moduleName: undefined });
this.currentUid = 'audit-fix';
this.currentTitle = 'Audit fix';
this.missingRefs = missingRefs;
this.missingRefs['audit-fix'] = [];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,25 @@ describe('Field Rules', () => {
let constructorParam: ModuleConstructorParam & CtConstructorParam;

class AuditTempClass extends FieldRule {
constructor(public missingRefs: Record<string, any> = {}) {
public missingRefs: Record<string, any>;

constructor(missingRefs: Record<string, any> = {}) {
super(constructorParam);
this.currentUid = 'audit';
this.currentTitle = 'Audit';
this.missingRefs = missingRefs;
this.missingRefs['audit'] = [];
}
}

class AuditFixTempClass extends FieldRule {
constructor(public missingRefs: Record<string, any> = {}) {
public missingRefs: Record<string, any>;

constructor(missingRefs: Record<string, any> = {}) {
super({ ...constructorParam, fix: true, moduleName: undefined });
this.currentUid = 'audit-fix';
this.currentTitle = 'Audit fix';
this.missingRefs = missingRefs;
this.missingRefs['audit-fix'] = [];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ describe('Global Fields', () => {
let constructorParam: ModuleConstructorParam & CtConstructorParam;

class AuditFixTempClass extends GlobalField {
constructor(public missingRefs: Record<string, any> = {}) {
public missingRefs: Record<string, any>;

constructor(missingRefs: Record<string, any> = {}) {
super({ ...constructorParam, fix: true, moduleName: 'global-fields' });
this.currentUid = 'audit-fix';
this.currentTitle = 'Audit fix';
this.missingRefs = missingRefs;
this.missingRefs['audit-fix'] = [];
}
}
Expand Down
30 changes: 11 additions & 19 deletions packages/contentstack-auth/src/commands/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,12 @@ export default class LoginCommand extends BaseCommand<typeof LoginCommand> {
required: false,
exclusive: ['oauth'],
}),
'totp-secret': flags.string({
description: 'TOTP secret for 2FA authentication.',
exclusive: ['oauth'],
}),

oauth: flags.boolean({
description: 'Enables single sign-on (SSO) in Contentstack CLI.',
required: false,
default: false,
exclusive: ['username', 'password', 'totp-secret'],
exclusive: ['username', 'password'],
}),
};

Expand Down Expand Up @@ -80,15 +77,13 @@ export default class LoginCommand extends BaseCommand<typeof LoginCommand> {
log.debug('Starting basic authentication flow', this.contextDetails);
const username = loginFlags?.username || (await interactive.askUsername());
const password = loginFlags?.password || (await interactive.askPassword());
const totpSecret = loginFlags?.['totp-secret'];
log.debug('Credentials obtained', {
...this.contextDetails,
hasUsername: !!username,
hasPassword: !!password,
hasTotpSecret: !!totpSecret
hasPassword: !!password
});

await this.login(username, password, totpSecret);
await this.login(username, password);
}
} catch (error) {
log.debug('Login command failed', { ...this.contextDetails, error });
Expand All @@ -98,22 +93,19 @@ export default class LoginCommand extends BaseCommand<typeof LoginCommand> {
}
}

async login(username: string, password: string, totpSecret?: string): Promise<void> {
async login(username: string, password: string): Promise<void> {
log.debug('Starting login process', { ...this.contextDetails, username });

try {
log.debug('Calling auth handler login', this.contextDetails);
let tfaToken: string | undefined;

if (totpSecret) {
log.debug('Generating TOTP token from provided secret', this.contextDetails);
try {
tfaToken = totpHandler.generateTOTPFromSecret(totpSecret);
log.debug('TOTP token generated successfully', this.contextDetails);
} catch (error) {
log.debug('Failed to generate TOTP token', { ...this.contextDetails, error });
tfaToken = undefined;
}
try {
tfaToken = await totpHandler.getTOTPCode();
log.debug('TOTP token generated from stored configuration', this.contextDetails);
} catch (error) {
log.debug('Failed to generate TOTP token from config', { ...this.contextDetails, error });
tfaToken = undefined;
Comment thread
cs-raj marked this conversation as resolved.
}

const user: User = await authHandler.login(username, password, tfaToken);
Expand Down
Loading