Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
8109938
Merge pull request #1567 from contentstack/development
cs-raj Sep 16, 2024
17b2c6c
replaced personalize-url with getter methodcd
harshitha-cstk Aug 28, 2024
56de4c3
updated for personalize url in attributes
harshitha-cstk Aug 29, 2024
6b3602b
updated personalizeUrl im import, export and variants
harshitha-cstk Sep 19, 2024
e81b530
reverting
harshitha-cstk Sep 19, 2024
6c25fe1
Merge pull request #1572 from contentstack/fix/dx-1171-replace-person…
harshithad0703 Sep 19, 2024
3034129
refactor: entry variant api response & replaced personalization with …
aman19K Sep 20, 2024
c9afbe5
added build info in gitignore file
aman19K Sep 20, 2024
cc3142c
refactor: replaced personalizationConfig with personalizeConfig
aman19K Sep 20, 2024
c2674cb
fixed regex dos issue in variants message
cs-raj Sep 23, 2024
11724b3
Merge pull request #1578 from contentstack/fix/staging
cs-raj Sep 23, 2024
649e65e
Added support for experience versioning
shafeeqd959 Sep 23, 2024
d36adbf
conflicts resolved
shafeeqd959 Sep 23, 2024
d80fafc
sanitized path
shafeeqd959 Sep 23, 2024
28cb71b
Merge pull request #1579 from contentstack/feat/CS-1402,CS-1401
aman19K Sep 23, 2024
0cac4b3
Merge branch 'next-feature-update' into feat/DX-1463
aman19K Sep 23, 2024
dec8e88
refactor: experience & variant-entries code
aman19K Sep 23, 2024
e63632e
refactor: error handling in attribute, audiences &events
aman19K Sep 23, 2024
c56f532
fixed the asset in custom extension
cs-raj Sep 24, 2024
11c00ad
fixed
shafeeqd959 Sep 24, 2024
f89fcd1
refactor: added personalize url
aman19K Sep 24, 2024
f9efe71
Merge pull request #1581 from contentstack/fix/feat/DX-1463
aman19K Sep 24, 2024
eaec0e3
Merge pull request #1573 from contentstack/feat/DX-1463
aman19K Sep 24, 2024
6536c30
Merge branch 'staging' of github.com:contentstack/cli into next-featu…
shafeeqd959 Sep 24, 2024
c8b78d4
version bumped
shafeeqd959 Sep 24, 2024
9e1476e
Merge branch 'next-feature-update' of github.com:contentstack/cli int…
shafeeqd959 Sep 24, 2024
1b3c63f
Merge pull request #1568 from contentstack/staging
cs-raj Sep 24, 2024
f052c89
Merge pull request #1584 from contentstack/main
cs-raj Sep 24, 2024
396f860
lock-file update
cs-raj Sep 24, 2024
18c1b28
refactor: error formatting
aman19K Sep 24, 2024
e5266a3
Merge pull request #1586 from contentstack/fix/error
aman19K Sep 24, 2024
8937aaf
fix: handle forbidden error
aman19K Sep 24, 2024
8d3c6ea
Merge branch 'staging' into next-feature-update
aman19K Sep 24, 2024
fa9b502
update lock & yaml file
aman19K Sep 25, 2024
ea1ac64
Merge pull request #1582 from contentstack/next-feature-update
aman19K Sep 25, 2024
0958f61
fix: snyk issues
aman19K Sep 25, 2024
948313f
Merge pull request #1588 from contentstack/fix/DX-1498
aman19K Sep 25, 2024
dda94aa
fix: duplicate project error issue
aman19K Sep 25, 2024
fac8aca
Merge pull request #1589 from contentstack/fix/duplicate-project-issue
aman19K Sep 25, 2024
0683f91
Merge pull request #1587 from contentstack/staging
aman19K Sep 26, 2024
3a32edf
fixed the login issue
cs-raj Sep 26, 2024
f0cb35e
Merge pull request #1583 from contentstack/fix/DX-1434
cs-raj Sep 26, 2024
9c22681
fixed regex dos issue in variants message
cs-raj Sep 23, 2024
5912102
Merge pull request #1590 from contentstack/main
aman19K Sep 26, 2024
6b0abb4
Merge branch 'development' into fix/development
cs-raj Sep 26, 2024
ce0b5d1
Merge branch 'staging' into fix/development
cs-raj Sep 26, 2024
fa0ed53
fix lock file
cs-raj Sep 26, 2024
56142a6
Merge pull request #1585 from contentstack/fix/development
cs-raj Sep 26, 2024
edbfdb5
config version bump
aman19K Sep 26, 2024
6c79df8
Merge pull request #1591 from contentstack/release-config
aman19K Sep 26, 2024
4c65f38
Merge pull request #1592 from contentstack/main
cs-raj Sep 26, 2024
042f0c9
Merge branch 'staging' into development
cs-raj Sep 26, 2024
886434c
Merge pull request #1594 from contentstack/fix/dev
cs-raj Sep 26, 2024
7704315
fixed auth integration test cases
cs-raj Sep 30, 2024
005c7c9
Merge pull request #1597 from contentstack/fix/authTest
cs-raj Sep 30, 2024
0496641
Merge remote-tracking branch 'origin/development' into fix/rate-limit…
harshitha-cstk Oct 8, 2024
ca9ecb9
update pnpm lock
harshitha-cstk Oct 8, 2024
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
178 changes: 92 additions & 86 deletions package-lock.json

Large diffs are not rendered by default.

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

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

## `csdx plugins:add PLUGIN`

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

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

## `csdx plugins:install PLUGIN`

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

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

## `csdx plugins:link PATH`

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

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

## `csdx plugins:remove [PLUGIN]`

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

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

## `csdx plugins:uninstall [PLUGIN]`

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

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

## `csdx plugins:unlink [PLUGIN]`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.8/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/update.ts)_
<!-- commandsstop -->
3 changes: 3 additions & 0 deletions packages/contentstack-auth/src/commands/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export default class LoginCommand extends BaseCommand<typeof LoginCommand> {
}
} catch (error) {
let errorMessage = formatError(error) || 'Something went wrong while logging. Please try again.';
if (typeof errorMessage === 'object' && Object.keys(errorMessage)?.length === 0) {
console.log(error);
}
this.logger.error('login failed', errorMessage);
cliux.error('CLI_AUTH_LOGIN_FAILED');
cliux.error(errorMessage);
Expand Down
20 changes: 12 additions & 8 deletions packages/contentstack-auth/test/integration/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('contentstack-auth plugin test', () => {

describe('Check auth:login command with wrong credentials', () => {
test
.loadConfig({ root: process.cwd() })
// @ts-ignore
.stub(CliUx, 'inquire', async (inquire) => {
switch (inquire.name) {
Expand All @@ -34,24 +35,27 @@ describe('contentstack-auth plugin test', () => {
return 'WrongPassword@12345%$#@!'; // NOTE forcing wrong password
}
})
.stub(process,'exit',()=>{})
.stdout({ print: PRINT_LOGS || false })
.command(['auth:login'])
.it('Login should fail due to wrong credentials.!', (ctx) => {
expect(ctx.stdout).to.a('string').includes('Login Error\nLooks like your email or password is invalid');
expect(ctx.stdout).to.be.includes('Login Error\nLooks like your email or password is invalid. Please try again or reset your password.');
});
});

describe('Check auth:login command with --username, --password flags and wrong credentials', () => {
test
test.loadConfig({ root: process.cwd() })
.stdout({ print: PRINT_LOGS || false })
.stub(process,'exit',()=>{})
.command(['auth:login', `--username=${username}`, '--password=WrongPassword@12345%$#@!'])
.it('Login should fail due to wrong credentials.!', (ctx) => {
expect(ctx.stdout).to.a('string').includes('Login Error\nLooks like your email or password is invalid');
expect(ctx.stdout).to.a('string').includes('Login Error\nLooks like your email or password is invalid. Please try again or reset your password.');
});
});

//NOTE
describe('Check auth:login command with correct credentials.', () => {
test
test.loadConfig({ root: process.cwd() })
// @ts-ignore
.stub(CliUx, 'inquire', async (inquire) => {
switch (inquire.name) {
Expand All @@ -69,17 +73,17 @@ describe('contentstack-auth plugin test', () => {
});

describe('Check auth:logout command', () => {
test
test.loadConfig({ root: process.cwd() })
.stub(CliUx, 'inquire', async () => 'Yes')
.stdout({ print: PRINT_LOGS || false })
.command(['auth:logout'])
.command(['auth:logout','--yes'])
.it('Logout should succeed.!', (ctx) => {
expect(ctx.stdout).to.a('string').includes('Successfully logged out');
});
});

describe('Check auth:login command with --username, --password flags', () => {
test
test.loadConfig({ root: process.cwd() })
.stdout({ print: PRINT_LOGS || false })
.command(['auth:login', `-u=${username}`, `-p=${password}`])
.it('Login should succeed!', (ctx) => {
Expand All @@ -95,7 +99,7 @@ describe('contentstack-auth plugin test', () => {
after(() => {
mail = '';
});
test
test.loadConfig({ root: process.cwd() })
.stdout({ print: PRINT_LOGS || false })
.command(['whoami'])
.it('shows user email who logged in', (ctx) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bootstrap/1.11.0 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-bootstrap/1.12.0 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-bootstrap",
"description": "Bootstrap contentstack apps",
"version": "1.11.0",
"version": "1.12.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
},
"dependencies": {
"@contentstack/cli-cm-seed": "~1.8.0",
"@contentstack/cli-cm-seed": "~1.9.0",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.2",
"inquirer": "8.2.4",
Expand Down
2 changes: 1 addition & 1 deletion 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.4",
"version": "1.2.0",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
79 changes: 45 additions & 34 deletions packages/contentstack-branches/src/utils/entry-create-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ export function entryCreateScript(contentType) {
findAssetIdsFromJsonRte(entry, schema);
parent.pop();
}
if (
schema[i].data_type === 'json' &&
schema[i].field_metadata.extension &&
schema[i].field_metadata.is_asset
) {
fetchAssetFromFileFields(parent,schema[i],entry);
}
if (
schema[i].data_type === 'text' &&
schema[i].field_metadata &&
Expand All @@ -121,43 +128,47 @@ export function entryCreateScript(contentType) {
parent.pop();
}
if (schema[i].data_type === 'file') {
parent.push(schema[i].uid);
let updatedEntry = entry;
for (let i = 0; i < parent.length; i++) {
updatedEntry = updatedEntry[parent[i]];
}
const imgDetails = updatedEntry;
if (schema[i].multiple) {
if (imgDetails && imgDetails.length) {
imgDetails.forEach((img) => {
const obj = {
uid: img.uid,
parent_uid: img.parent_uid,
description: img.description,
title: img.title,
filename: img.filename,
url: img.url,
};
cAssetDetails.push(obj);
});
}
} else {
if (imgDetails) {
const obj = {
uid: imgDetails.uid,
parent_uid: imgDetails.parent_uid,
description: imgDetails.description,
title: imgDetails.title,
filename: imgDetails.filename,
url: imgDetails.url,
};
cAssetDetails.push(obj);
}
}
parent.pop();
fetchAssetFromFileFields(parent,schema[i],entry);
}
}
};

function fetchAssetFromFileFields (parent, schema, entry) {
parent.push(schema.uid);
let updatedEntry = entry;
for (let i = 0; i < parent.length; i++) {
updatedEntry = updatedEntry[parent[i]];
}
const imgDetails = updatedEntry;
if (schema.multiple) {
if (imgDetails && imgDetails.length) {
imgDetails.forEach((img) => {
const obj = {
uid: img.uid,
parent_uid: img.parent_uid,
description: img.description,
title: img.title,
filename: img.filename,
url: img.url,
};
assetDetails.push(obj);
});
}
} else {
if (imgDetails) {
const obj = {
uid: imgDetails.uid,
parent_uid: imgDetails.parent_uid,
description: imgDetails.description,
title: imgDetails.title,
filename: imgDetails.filename,
url: imgDetails.url,
};
assetDetails.push(obj);
}
}
parent.pop();
}

function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ export function entryCreateUpdateScript(contentType) {
findAssetIdsFromJsonRte(entry, schema);
parent.pop();
}

if (
schema[i].data_type === 'json' &&
schema[i].field_metadata.extension &&
schema[i].field_metadata.is_asset
) {
fetchAssetFromFileFields(parent,schema[i],entry);
}

if (
schema[i].data_type === 'text' &&
schema[i].field_metadata &&
Expand All @@ -143,44 +152,47 @@ export function entryCreateUpdateScript(contentType) {
parent.pop();
}
if (schema[i].data_type === 'file') {
parent.push(schema[i].uid);
let updatedEntry = entry;
for (let i = 0; i < parent.length; i++) {
updatedEntry = updatedEntry[parent[i]];
}
const imgDetails = updatedEntry;
if (schema[i].multiple) {
if (imgDetails && imgDetails.length) {
imgDetails.forEach((img) => {
const obj = {
uid: img.uid,
parent_uid: img.parent_uid,
description: img.description,
title: img.title,
filename: img.filename,
url: img.url,
};
assetDetails.push(obj);
});
}
} else {
if (imgDetails) {
const obj = {
uid: imgDetails.uid,
parent_uid: imgDetails.parent_uid,
description: imgDetails.description,
title: imgDetails.title,
filename: imgDetails.filename,
url: imgDetails.url,
};
assetDetails.push(obj);
}
}
parent.pop();
fetchAssetFromFileFields(parent,schema[i],entry);
}
}
};

function fetchAssetFromFileFields (parent, schema, entry) {
parent.push(schema.uid);
let updatedEntry = entry;
for (let i = 0; i < parent.length; i++) {
updatedEntry = updatedEntry[parent[i]];
}
const imgDetails = updatedEntry;
if (schema.multiple) {
if (imgDetails && imgDetails.length) {
imgDetails.forEach((img) => {
const obj = {
uid: img.uid,
parent_uid: img.parent_uid,
description: img.description,
title: img.title,
filename: img.filename,
url: img.url,
};
assetDetails.push(obj);
});
}
} else {
if (imgDetails) {
const obj = {
uid: imgDetails.uid,
parent_uid: imgDetails.parent_uid,
description: imgDetails.description,
title: imgDetails.title,
filename: imgDetails.filename,
url: imgDetails.url,
};
assetDetails.push(obj);
}
}
parent.pop();
}
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
let match;
Expand Down
Loading