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 | 14-10-2024 | Release #1616

Merged
merged 75 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
cb7dcc1
feat: added rate limit support in entries & assets bulk publish
aman19K Aug 30, 2024
eff430e
formatting
aman19K Aug 30, 2024
a82ea75
Merge pull request #1535 from contentstack/feat/DX-1238-bulk-publish-…
aman19K Aug 30, 2024
d080f64
implementation get and remove rate limit commands
harshithad0703 Sep 3, 2024
870c6fe
resolved the conversations, updated structure of rate limit, removed …
harshithad0703 Sep 4, 2024
db2bdac
removed authentication for remove command
harshithad0703 Sep 4, 2024
106c115
removed isAuthenticated from import
harshithad0703 Sep 4, 2024
01a4e13
handle delete directly with config handler
harshithad0703 Sep 4, 2024
c52b22e
formated get limit, removed message handler
harshithad0703 Sep 4, 2024
1b2cd56
Merge pull request #1543 from contentstack/feat/dx-1201-get-rate-limit
harshithad0703 Sep 4, 2024
f2384ce
added set rate limit command
harshithad0703 Sep 2, 2024
56b9cc9
Merge branch 'feat/config-rate-limit' into feat/DX-1112-rate-limit-se…
harshithad0703 Sep 4, 2024
58eab0c
_flags -> flag, remove console log, limit-name is optional, file rename
harshithad0703 Sep 4, 2024
e615e30
updates the limit name fetched from org plan
harshithad0703 Sep 6, 2024
e083e9b
remove console.log
harshithad0703 Sep 6, 2024
e60ce66
update the limits passed through limit-name flag
harshithad0703 Sep 6, 2024
c312864
added common utilities and other minor changes
harshithad0703 Sep 6, 2024
b9b0ff3
added check for limit names, utilize values and comma separated value…
harshithad0703 Sep 9, 2024
3872fc3
feat: set default rate limit using hook
aman19K Sep 9, 2024
83da4e5
formatting
aman19K Sep 9, 2024
335df23
Merge pull request #1551 from contentstack/feat/DX-1348
aman19K Sep 9, 2024
3b1cc14
refactored code
harshithad0703 Sep 9, 2024
74072a0
Merge pull request #1544 from contentstack/feat/DX-1112-rate-limit-se…
harshithad0703 Sep 10, 2024
e3810b2
Merge branch 'feat/config-rate-limit' into feat/bulk-publish-rate-limit
aman19K Sep 10, 2024
ce3eee1
Merge pull request #1553 from contentstack/feat/bulk-publish-rate-limit
aman19K Sep 10, 2024
5756494
Merge branch 'development' into feat/config-rate-limit
harshithad0703 Sep 12, 2024
5d96b83
added test cases for set rate limit command
harshithad0703 Sep 11, 2024
31e0f8e
added get and remove rate limit command test cases and updated set co…
harshithad0703 Sep 11, 2024
5d09a81
setup repo
harshithad0703 Sep 12, 2024
4071f25
added clius succes message after handling rate limit
harshithad0703 Sep 12, 2024
0512ee4
improved coverage and updated readme
harshithad0703 Sep 13, 2024
486b743
Merge pull request #1565 from contentstack/test/dx-1203-test-cases-ra…
harshithad0703 Sep 13, 2024
802547d
passing host in config and get limit value from org
harshithad0703 Sep 19, 2024
f82132e
Merge pull request #1571 from contentstack/fix/dx-1472-set-rate-limit…
harshithad0703 Sep 19, 2024
5ea5fb6
added abbreviation for config rate limits
harshithad0703 Sep 20, 2024
aa33566
Merge pull request #1574 from contentstack/feat/dx-1444-abbreviation-…
harshithad0703 Sep 20, 2024
6feb2be
Merge branch 'development' into fix/merge-conflicts
harshithad0703 Sep 20, 2024
8e50604
Merge pull request #1577 from contentstack/fix/merge-conflicts
harshithad0703 Sep 20, 2024
c56f532
fixed the asset in custom extension
cs-raj Sep 24, 2024
396f860
lock-file update
cs-raj Sep 24, 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
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
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
8ab0c4b
fix: update rate limits accordingly
harshithad0703 Oct 4, 2024
5c8c6d0
Merge pull request #1605 from contentstack/fix/dx-1540-set-limits-acc…
harshithad0703 Oct 4, 2024
0ad1796
version bump
harshithad0703 Oct 8, 2024
fc65108
Merge pull request #1608 from contentstack/fix/rate-limit-version-nump
harshithad0703 Oct 8, 2024
0496641
Merge remote-tracking branch 'origin/development' into fix/rate-limit…
harshithad0703 Oct 8, 2024
ca9ecb9
update pnpm lock
harshithad0703 Oct 8, 2024
fe34c46
Merge pull request #1610 from contentstack/fix/rate-limit-merge-confl…
harshithad0703 Oct 9, 2024
78e5b91
fixed the failing check
harshithad0703 Oct 9, 2024
da51c5a
Merge branch 'staging' into development
cs-raj Oct 9, 2024
6a0135d
fix lock file
cs-raj Oct 9, 2024
a5afea2
Merge pull request #1612 from contentstack/fix/dev
cs-raj Oct 9, 2024
f020a4a
fix: variant entries not found issue when branch flag is provided
aman19K Oct 9, 2024
6c300a6
Merge branch 'development' into fix/merge-conflict-rate-limit
harshithad0703 Oct 9, 2024
826df4a
updated pnpm and package-lock
harshithad0703 Oct 9, 2024
43bdc8a
Merge pull request #1613 from contentstack/fix/DX-1573
aman19K Oct 9, 2024
71fb918
Merge pull request #1614 from contentstack/fix/merge-conflict-rate-limit
harshithad0703 Oct 9, 2024
8d3927a
Merge branch 'development' into feat/config-rate-limit
harshithad0703 Oct 9, 2024
f5b5c37
Merge pull request #1611 from contentstack/feat/config-rate-limit
harshithad0703 Oct 9, 2024
2752ad5
Merge branch 'staging' into development
cs-raj Oct 9, 2024
2cf1eb1
fixed the lockfile
cs-raj Oct 9, 2024
3ec1f21
Merge pull request #1615 from contentstack/fix/dev2
cs-raj Oct 9, 2024
2c9456d
Merge branch 'staging' into fix/dev3
cs-raj Oct 9, 2024
835f326
fixed lock file
cs-raj Oct 9, 2024
ca8673e
Merge pull request #1617 from contentstack/fix/dev3
cs-raj Oct 9, 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
1,907 changes: 1,287 additions & 620 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 8 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.9/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/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.9/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/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.9/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/src/commands/plugins/install.ts)_

## `csdx plugins:link PATH`

Expand All @@ -412,6 +412,7 @@ FLAGS
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
Expand All @@ -422,7 +423,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

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

## `csdx plugins:remove [PLUGIN]`

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

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

## `csdx plugins:uninstall [PLUGIN]`

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

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

## `csdx plugins:unlink [PLUGIN]`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.9/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.14/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-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.4 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-branches/1.2.0 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 4 additions & 2 deletions packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"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": {
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-utilities": "~1.8.0",
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-utilities": "~1.8.0",
"@oclif/core": "^3.26.5",
Expand All @@ -26,7 +28,7 @@
},
"devDependencies": {
"@contentstack/cli-auth": "~1.3.22",
"@contentstack/cli-config": "~1.7.3",
"@contentstack/cli-config": "~1.8.0",
"@contentstack/cli-dev-dependencies": "~1.2.4",
"@oclif/plugin-help": "^5.1.19",
"@oclif/test": "^2.5.6",
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
Loading