Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX - 787 - Fixed the Snyk issues #1450

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/index.ts)_

## `csdx plugins:add PLUGIN`

Expand Down Expand Up @@ -341,7 +341,7 @@ EXAMPLES
$ csdx plugins:inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN`

Expand Down Expand Up @@ -390,7 +390,7 @@ EXAMPLES
$ csdx plugins:install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/install.ts)_

## `csdx plugins:link PATH`

Expand Down Expand Up @@ -420,7 +420,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/link.ts)_

## `csdx plugins:remove [PLUGIN]`

Expand Down Expand Up @@ -461,7 +461,7 @@ FLAGS
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall [PLUGIN]`

Expand Down Expand Up @@ -489,7 +489,7 @@ EXAMPLES
$ csdx plugins:uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/uninstall.ts)_

## `csdx plugins:unlink [PLUGIN]`

Expand Down Expand Up @@ -533,5 +533,5 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.2/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/update.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion packages/contentstack-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-auth/1.3.18 darwin-arm64 node-v22.2.0
@contentstack/cli-auth/1.3.19 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-auth",
"description": "Contentstack CLI plugin for authentication activities",
"version": "1.3.18",
"version": "1.3.19",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion packages/contentstack-auth/test/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"IS_TS": true,
"UNIT_EXECUTION_ORDER": [],
"INTEGRATION_EXECUTION_ORDER": []
"INTEGRATION_EXECUTION_ORDER": [],
"password": "testpassword",
"invalidPassowrd": "invalidpassword",
"validAPIKey": "adasdfagsf"
}
4 changes: 2 additions & 2 deletions packages/contentstack-auth/test/integration/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { expect, test } from '@oclif/test';
// @ts-ignore
import { Helper } from './helper';
// @ts-ignore
import { PRINT_LOGS } from './config.json';
import { PRINT_LOGS, encryptionKey } from './config.json';
import { cliux as CliUx, messageHandler, NodeCrypto } from '@contentstack/cli-utilities';

const messageFilePath = path.join(__dirname, '..', '..', '..', 'contentstack-utilities', 'messages/auth.json');
const crypto = new NodeCrypto({
typeIdentifier: '◈',
algorithm: 'aes-192-cbc',
encryptionKey: process.env.ENCRYPTION_KEY || '***REMOVED***'
encryptionKey: process.env.ENCRYPTION_KEY || encryptionKey
});
const username = process.env.ENCRYPTION_KEY ? crypto.decrypt(process.env.USERNAME) : process.env.USERNAME
const password = process.env.ENCRYPTION_KEY ? crypto.decrypt(process.env.PASSWORD) : process.env.PASSWORD
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-auth/test/integration/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"PRINT_LOGS": false
"PRINT_LOGS": false,
"encryptionKey": "***REMOVED***"
}
5 changes: 3 additions & 2 deletions packages/contentstack-auth/test/unit/auth-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import * as sinon from 'sinon';
import { authHandler, interactive } from '../../src/utils';
import { CLIError, cliux } from '@contentstack/cli-utilities';
import { User } from '../../src/interfaces';
import * as config from '../config.json';

const user: User = { email: '***REMOVED***', authtoken: 'testtoken' };
const credentials = { email: '***REMOVED***', password: 'testpassword' };
const invalidCredentials = { email: '***REMOVED***', password: 'invalidpassword' };
const credentials = { email: '***REMOVED***', password: config.password };
const invalidCredentials = { email: '***REMOVED***', password: config.invalidPassowrd };
let TFAEnabled = false;
let TFAChannel = 'authy';
const TFATestToken = '24563992';
Expand Down
5 changes: 3 additions & 2 deletions packages/contentstack-auth/test/unit/commands/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import * as sinon from 'sinon';
import LoginCommand from '../../../src/commands/auth/login';
import { authHandler, interactive } from '../../../src/utils';
import { configHandler, cliux } from '@contentstack/cli-utilities';
import * as conf from '../../config.json';

const config = configHandler;

const user = { email: '***REMOVED***', authtoken: 'testtoken' };
const credentials = { email: '***REMOVED***', password: 'testpassword' };
const invalidCredentials = { email: '***REMOVED***', password: 'invalidpassword' };
const credentials = { email: '***REMOVED***', password: conf.password };
const invalidCredentials = { email: '***REMOVED***', password: conf.invalidPassowrd };
const TFATestToken = '24563992';

describe('Login Command', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import TokensAddCommand from '../../../src/commands/auth/tokens/add';
import { tokenValidation } from '../../../src/utils';
import { stub, assert } from 'sinon';
import { config as dotenvConfig } from 'dotenv';
import * as conf from '../../config.json';

dotenvConfig();

Expand All @@ -24,7 +25,7 @@ describe('Tokens Add Command', () => {
let managementTokenValidationStub;
let environmentTokenValidationStub;
let printStub;
const validAPIKey = 'adasdfagsf';
const validAPIKey = conf.validAPIKey;
const validDeliveryToken = '***REMOVED***';
const validmanagementToken = 'cmajhsd98939482';
const validEnvironment = 'textenv';
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-auth/test/unit/interactive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import * as sinon from 'sinon';
import { interactive } from '../../src/utils';
import { cliux } from '@contentstack/cli-utilities';
import * as config from '../config.json'

describe('Interactive', () => {
let inquireStub;
Expand Down Expand Up @@ -31,7 +32,7 @@ describe('Interactive', () => {
});

it('ask password', async function () {
const password = 'testpassword';
const password = config.password
inquireStub.callsFake(function () {
return Promise.resolve(password);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/1.1.0 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-branches/1.1.1 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-branches",
"description": "Contentstack CLI plugin to do branches operations",
"version": "1.1.0",
"version": "1.1.1",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand All @@ -25,7 +25,7 @@
"winston": "^3.7.2"
},
"devDependencies": {
"@contentstack/cli-auth": "~1.3.18",
"@contentstack/cli-auth": "~1.3.19",
"@contentstack/cli-config": "~1.6.4",
"@contentstack/cli-dev-dependencies": "~1.2.4",
"@oclif/plugin-help": "^5.1.19",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { assetFolderCreateScript } from './asset-folder-create-script';

type CreateMergeScriptsProps = {
uid: string;
entry_merge_strategy: string;
entry_merge_strategy?: string;
type?: string;
status?: string;
};

export function generateMergeScripts(mergeSummary, mergeJobUID) {
Expand Down Expand Up @@ -43,11 +44,8 @@ export function generateMergeScripts(mergeSummary, mergeJobUID) {
cliux.print(`Info: Entries of ${messageType} content types selected for the migration`, { color: 'blue' });
}
};

processContentType(
{ type: 'assets', uid: '', entry_merge_strategy: '' },
mergeStrategies['asset_create_folder'],
);

processContentType({ type: 'assets', uid: '', entry_merge_strategy: '' }, mergeStrategies['asset_create_folder']);
processContentTypes(mergeSummary.modified, 'Modified');
processContentTypes(mergeSummary.added, 'New');

Expand Down Expand Up @@ -92,13 +90,13 @@ export function createMergeScripts(contentType: CreateMergeScriptsProps, mergeJo
fs.mkdirSync(fullPath);
}
let filePath: string;
let milliSeconds = date.getMilliseconds().toString().padStart(3, '0')
let milliSeconds = date.getMilliseconds().toString().padStart(3, '0');
if (contentType.type === 'assets') {
filePath = `${fullPath}/${fileCreatedAt}${milliSeconds}_create_assets_folder.js`;
} else {
filePath = `${fullPath}/${fileCreatedAt}${milliSeconds}_${getContentTypeMergeStatus(contentType.entry_merge_strategy)}_${
contentType.uid
}.js`;
filePath = `${fullPath}/${fileCreatedAt}${milliSeconds}_${getContentTypeMergeStatus(
contentType.entry_merge_strategy,
)}_${contentType.uid}.js`;
}
fs.writeFileSync(filePath, content, 'utf-8');
}
Expand Down
Loading
Loading