Skip to content

Commit 23d15ff

Browse files
Merge pull request #2365 from contentstack/fix/merge-development-beta
Fix/merge development beta
2 parents f1cd85c + ca18307 commit 23d15ff

19 files changed

Lines changed: 568 additions & 897 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ jobs:
192192
if: ${{env.release_releaseAll == 'true' || env.release_plugins_clone == 'true'}}
193193
working-directory: ./packages/contentstack-clone
194194
run: npm install
195+
- name: Compiling Clone
196+
if: ${{ steps.clone-installation.conclusion == 'success' }}
197+
working-directory: ./packages/contentstack-clone
198+
run: npm run prepack
195199
- name: Publishing clone
196200
uses: JS-DevTools/npm-publish@v3
197201
if: ${{ steps.clone-installation.conclusion == 'success' }}

.talismanrc

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
11
fileignoreconfig:
2-
- filename: pnpm-lock.yaml
3-
checksum: f20d4336b379ba896f0092ed8dd03df2c6e5bc34fe200e58002efc2c77fd9359
4-
- filename: package-lock.json
5-
checksum: b41714137255ba498375116ae9410e04af150d75ba323c8dbaeb8995564a4677
6-
- filename: packages/contentstack-audit/test/unit/mock/contents/composable_studio/environments/environments.json
7-
checksum: 0402604e5919a7e38ecb5ff0916d6ae5ab7d98fe78ff6ac9eba8a9b8130af34d
8-
- filename: packages/contentstack-utilities/src/helpers.ts
9-
checksum: 6a741bb972f59c56d2c0f3a9f96e2963392361db2e401948c9c1796829478e13
10-
- filename: packages/contentstack-audit/test/unit/mock/contents/composable_studio/composable_studio.json
11-
checksum: 6912e5ea32b4456ad04d1645750c72bbb29ab1895368c3a242ab39e9350ec531
12-
- filename: packages/contentstack-utilities/src/logger/session-path.ts
13-
checksum: 4c66980a857bc12012a45e50790c0eaab06883db5e1476d84fb142a08b70b2e7
14-
- filename: packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts
15-
checksum: a9e24596e7ae54b71cc28a41cf9d65bbdbf6754446e08958288e90a579cc351d
16-
- filename: packages/contentstack-audit/src/modules/modulesData.ts
17-
checksum: 1e6c1fba1172512401038d5454c8d218201ec62262449c5c878609592e0124c4
18-
- filename: packages/contentstack-audit/test/unit/mock/contents/composable_studio/invalid_composable_studio.json
19-
checksum: e6465aa0011d1565a2de848d9cca74395d11419e6ac840e7dfb52e1d255b1c4f
20-
- filename: packages/contentstack-audit/src/modules/composable-studio.ts
21-
checksum: 4fc97ff582d6dff9a54b3a50dfa3cbb5febd38a55aeb8737034b97188ad543ba
22-
- filename: packages/contentstack-utilities/test/unit/logger.test.ts
23-
checksum: a1939dea16166b1893a248179524a76f2ed20b04b99c83bd1a5a13fcf6f0dadc
24-
- filename: packages/contentstack-clone/README.md
25-
checksum: 8580ab3f52a079a6411c27cbaad66e3a70d9ac5ea59fc429a8f17c95d09399f8
26-
- filename: packages/contentstack/README.md
27-
checksum: 72850c976661f2912b5bca39734de09d56c311c2266fc67696c45ed3fb0b7511
28-
version: "1.0"
2+
- filename: pnpm-lock.yaml
3+
checksum: 2ab7172b5b105a5e903aa7d4fc4b38d282e2c32befdc8b219c3bb3fb40aead2a
4+
- filename: package-lock.json
5+
checksum: 62030a34e011bd34bc4a071d868210cfe9c90ae5241250a576f7cb212084dbf1
6+
version: '1.0'

package-lock.json

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

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -182,36 +182,6 @@ class AuthHandler {
182182
}
183183
});
184184
}
185-
186-
/**
187-
* Validate token
188-
* @param {string} authtoken
189-
* @returns {Promise} Promise object returns response object from Contentstack
190-
*/
191-
async validateAuthtoken(authtoken: string): Promise<object> {
192-
log.debug('Starting token validation.', { module: 'auth-handler', hasAuthToken: !!authtoken });
193-
194-
return new Promise((resolve, reject) => {
195-
if (authtoken) {
196-
log.debug('Making token validation API call.', { module: 'auth-handler' });
197-
198-
this._client
199-
.getUser()
200-
.then((user: object) => {
201-
log.debug('Token validation successful.', { module: 'auth-handler', user });
202-
resolve(user);
203-
})
204-
.catch((error: Error) => {
205-
log.debug('Token validation failed.', { module: 'auth-handler', error: error.message });
206-
cliux.print('CLI_AUTH_TOKEN_VALIDATION_FAILED', { color: 'yellow' });
207-
reject(error);
208-
});
209-
} else {
210-
log.debug('Token validation failed: no auth token provided.', { module: 'auth-handler' });
211-
reject(new Error(messageHandler.parse('CLI_AUTH_TOKEN_VALIDATION_NO_TOKEN')));
212-
}
213-
});
214-
}
215185
}
216186

217187
export default new AuthHandler();
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export { default as authHandler } from './auth-handler';
22
export { default as mfaHandler } from './mfa-handler';
33
export * as interactive from './interactive';
4-
export * as tokenValidation from './tokens-validation';

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

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { cliux, NodeCrypto, log, messageHandler } from '@contentstack/cli-utilities';
1+
import { cliux, NodeCrypto, log } from '@contentstack/cli-utilities';
22
import { authenticator } from 'otplib';
3-
import { askOTP } from './interactive';
43

54
/**
65
* @class
@@ -104,32 +103,6 @@ class MFAHandler {
104103
}
105104
}
106105

107-
/**
108-
* Gets MFA code through manual user input
109-
* @returns Promise<string> The MFA code
110-
* @throws Error if code format is invalid
111-
*/
112-
async getManualMFACode(): Promise<string> {
113-
try {
114-
const code = await askOTP();
115-
if (!/^\d{6}$/.test(code)) {
116-
throw new Error(messageHandler.parse('CLI_AUTH_MFA_INVALID_CODE'));
117-
}
118-
return code;
119-
} catch (error) {
120-
log.debug('Failed to get MFA code', { module: 'mfa-handler', error });
121-
throw error;
122-
}
123-
}
124-
125-
/**
126-
* Validates an MFA code format
127-
* @param code The MFA code to validate
128-
* @returns boolean True if valid, false otherwise
129-
*/
130-
isValidMFACode(code: string): boolean {
131-
return /^\d{6}$/.test(code);
132-
}
133106
}
134107

135108
export default new MFAHandler();

packages/contentstack-auth/src/utils/tokens-validation.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

packages/contentstack-auth/test/unit/commands/tokens-add.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { expect } from 'chai';
22
import * as sinon from 'sinon';
33
import { configHandler, cliux } from '@contentstack/cli-utilities';
44
import TokensAddCommand from '../../../src/commands/auth/tokens/add';
5-
import { tokenValidation } from '../../../src/utils';
65
import { stub, assert } from 'sinon';
76
import { config as dotenvConfig } from 'dotenv';
87
import nock from 'nock';
@@ -70,8 +69,6 @@ function resetConfig() {
7069
config.delete(`${configKeyTokens}.newToken`);
7170
}
7271
describe('Tokens Add Command', () => {
73-
let apiKeyValidationStub: sinon.SinonStub;
74-
let environmentTokenValidationStub: sinon.SinonStub;
7572
let printStub: sinon.SinonStub;
7673
const validAPIKey = conf.validAPIKey;
7774
const validDeliveryToken = '***REMOVED***';
@@ -82,28 +79,9 @@ describe('Tokens Add Command', () => {
8279
resetConfig();
8380
if ((cliux.print as any).restore) (cliux.print as any).restore();
8481
printStub = stub(cliux, 'print');
85-
apiKeyValidationStub = sinon
86-
.stub(tokenValidation, 'validateAPIKey')
87-
.callsFake(function (client: any, apiKey: string): Promise<any> {
88-
if (apiKey === validAPIKey) {
89-
return Promise.resolve({ valid: true, message: 'success' });
90-
}
91-
return Promise.resolve({ valid: false, message: 'failed' });
92-
});
93-
94-
environmentTokenValidationStub = sinon
95-
.stub(tokenValidation, 'validateEnvironment')
96-
.callsFake(function (client: any, apiKey: string, environment): Promise<any> {
97-
if (environment === validEnvironment) {
98-
return Promise.resolve({ valid: true, message: 'success' });
99-
}
100-
return Promise.resolve({ valid: false, message: 'failed' });
101-
});
10282
});
10383

10484
after(() => {
105-
apiKeyValidationStub.restore();
106-
environmentTokenValidationStub.restore();
10785
printStub.restore();
10886
resetConfig();
10987
});

packages/contentstack-auth/test/unit/tokens-validation.test.ts

Lines changed: 0 additions & 92 deletions
This file was deleted.

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,4 @@ describe('MFAHandler', () => {
6464
expect(authenticator.verify({ token: code, secret: envSecret })).to.be.true;
6565
});
6666
});
67-
68-
describe('isValidMFACode', () => {
69-
it('should validate correct format MFA codes', () => {
70-
expect(mfaHandler.isValidMFACode('123456')).to.be.true;
71-
});
72-
73-
it('should reject incorrect format MFA codes', () => {
74-
expect(mfaHandler.isValidMFACode('12345')).to.be.false; // Too short
75-
expect(mfaHandler.isValidMFACode('1234567')).to.be.false; // Too long
76-
expect(mfaHandler.isValidMFACode('abcdef')).to.be.false; // Non-numeric
77-
});
78-
});
7967
});

0 commit comments

Comments
 (0)