Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
a71bce5
Feature nested global fields (#1771)
sunil-lakshman Feb 18, 2025
fb39bb6
Merge pull request #1773 from contentstack/development
sunil-lakshman Feb 18, 2025
a95078b
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Mar 19, 2025
f983b3e
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Mar 20, 2025
f8f0c01
Fix false flagging of global fields
cs-raj Mar 21, 2025
71a7fd0
Merge pull request #1826 from contentstack/fix/DX-2354
cs-raj Mar 27, 2025
7681037
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Apr 11, 2025
b2afac6
Fixed merge conflits
sunil-lakshman Apr 11, 2025
7320c58
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman Apr 14, 2025
4eaa258
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman May 15, 2025
5aa1c5c
Fixed PR comments
sunil-lakshman May 15, 2025
585fe65
[DX-2996], added logs to debug the variant export issue
May 19, 2025
608b3d1
removed consoles from entries file
May 21, 2025
c5b3c21
removed some consoles to debug the issue
May 21, 2025
780dc70
added logger to debug the error
May 22, 2025
d22619c
Merge branch 'development' into feat/nested-global-fields
cs-raj May 26, 2025
5473f4c
Lock file update
cs-raj May 26, 2025
b87021b
Handling nested global field in modular blocks
cs-raj May 26, 2025
9bc4fa0
talisman rc update
cs-raj May 26, 2025
82d40d3
Merge pull request #1935 from contentstack/main
harshithad0703 May 27, 2025
bf6880f
Merge pull request #1936 from contentstack/staging
harshithad0703 May 27, 2025
f829c08
Fix and Version bump
cs-raj May 27, 2025
3ec207a
Fixed Audit check for global fields
cs-raj May 27, 2025
4472cc2
Fix test case
cs-raj May 27, 2025
fa32a33
Merge pull request #1937 from contentstack/fix/DX-3073
cs-raj May 28, 2025
7f61cb4
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman May 28, 2025
cc630cf
Fixed uid issue
sunil-lakshman May 28, 2025
dae00c8
[DX-2770], fixed failing test cases and added workflow for bootstrap …
May 28, 2025
fd7c516
Merge pull request #1939 from contentstack/fix/DX-2770
naman-contentstack May 28, 2025
e49ac60
Merge branch 'development' into fix/DX-2996
May 28, 2025
5c9cc69
added console.error for debugging
May 28, 2025
4d319e7
Fixed global field update error
sunil-lakshman May 28, 2025
e784194
Removed console log
sunil-lakshman May 28, 2025
aaab042
Fixed Nested Global Field
cs-raj May 28, 2025
f950ef3
PR fixes
cs-raj May 28, 2025
e4101ae
Merge pull request #1940 from contentstack/fix/nested
cs-raj May 28, 2025
f253991
fix: Add Null Check for developerHubUrl Before Assigning to exportCon…
aman19K May 29, 2025
c409cbe
updated checksum
aman19K May 29, 2025
71e5a6b
Merge branch 'development' into fix/DX-3104
aman19K May 29, 2025
a3b5649
updated lock file & checksum
aman19K May 29, 2025
816a380
updated checksum
aman19K May 29, 2025
89c09e9
Merge pull request #1941 from contentstack/fix/DX-3104
aman19K May 29, 2025
e892e6a
Merge branch 'development' into fix/DX-2996
naman-contentstack May 29, 2025
3ce10fc
Fixed merge conflits
sunil-lakshman May 30, 2025
55e3c47
Merge pull request #1942 from contentstack/development
harshithad0703 May 30, 2025
d714aaf
Merge pull request #1928 from contentstack/fix/DX-2996
naman-contentstack May 30, 2025
e09d991
Fixed NGF update issue in import setup
sunil-lakshman May 30, 2025
8916bdb
Merge branch 'development' into feat/nested-global-fields
sunil-lakshman May 30, 2025
22890c1
fix: Max retry count reached error
aman19K May 30, 2025
ec9f859
Merge pull request #1943 from contentstack/fix/DX-2996-max-retry-error
aman19K May 30, 2025
133d695
Fixed merge conflits
sunil-lakshman May 30, 2025
17fb2cf
Merge pull request #1772 from contentstack/feat/nested-global-fields
sunil-lakshman May 30, 2025
edd15d9
feat: added error handler and logger support in cli
aman19K Jun 2, 2025
96a5282
fix: code & secret scan workflow issue
aman19K Jun 2, 2025
b09ec68
fix & updated test cases
aman19K Jun 2, 2025
67f3924
Merge pull request #1944 from contentstack/feat/DX-3076-cli-logger
aman19K Jun 3, 2025
df2497d
fix: message error code issue
aman19K Jun 3, 2025
a5b1226
Merge pull request #1945 from contentstack/fix/cli-message-issue
aman19K Jun 3, 2025
51352c1
Fix Developement
cs-raj Jun 4, 2025
6446419
Merge pull request #1947 from contentstack/fix/development
cs-raj Jun 4, 2025
0f2b9e3
Optional Check
cs-raj Jun 6, 2025
da632ff
Fix Comment
cs-raj Jun 6, 2025
40e9120
Fixed the empty title issue
cs-raj Jun 6, 2025
ced2b85
Merge pull request #1949 from contentstack/fix/audit
cs-raj Jun 6, 2025
2a088ca
Merge remote-tracking branch 'origin/staging' into fix/update-staging
harshithad0703 Jun 6, 2025
10670e9
add error log
harshithad0703 Jun 6, 2025
0631c86
Merge branch 'development' into fix/update-staging
harshithad0703 Jun 6, 2025
b2412fa
add error log
harshithad0703 Jun 6, 2025
9c752b1
Merge pull request #1951 from contentstack/fix/update-staging
harshithad0703 Jun 6, 2025
c12f256
update talismanrc
harshithad0703 Jun 6, 2025
36233e1
Merge pull request #1952 from contentstack/fix/talismanrc-3
harshithad0703 Jun 6, 2025
2ce048e
Merge pull request #1946 from contentstack/development
harshithad0703 Jun 6, 2025
18b30ad
update import plugin version bump
harshithad0703 Jun 6, 2025
c803b75
Merge pull request #1953 from contentstack/fix/version-bump-import
harshithad0703 Jun 6, 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
4 changes: 4 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
- name: Run tests for Contentstack Export To CSV
working-directory: ./packages/contentstack-export-to-csv
run: npm run test:unit

- name: Run tests for Contentstack Bootstrap
working-directory: ./packages/contentstack-bootstrap
run: npm run test
# - name: Fetch latest references
# run: |
# git fetch --prune
Expand Down
24 changes: 20 additions & 4 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,28 @@ fileignoreconfig:
checksum: 8cbd32dbbd2989c7c082f8a0b7615916125d211bce25531e9a882b8ebd5674af
- filename: .husky/pre-commit
checksum: 7a12030ddfea18d6f85edc25f1721fb2009df00fdd42bab66b05de25ab3e32b2
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
checksum: 0b0af505ce1a74eb8df519f106291e319eb3ea74003ca63e03527f59a8821d39
- filename: packages/contentstack-bootstrap/test/bootstrap.test.js
checksum: 5f0355a5048183d61b605cbc160e6727a9de32832d9159e903fee49f9ab751d5
- filename: packages/contentstack/package.json
checksum: 9b0fdd100effcdbb5ee3809f7f102bfd11c88dd76e49db5103434f3aa29473dd
- filename: pnpm-lock.yaml
checksum: 2edf846869b73d6fd640d9f660f9fdd664e721946a891554dad5297c75a1bfba
- filename: package-lock.json
checksum: 0c00a0335d48791b0736aae44c900c3e729de728c0bb62489d0697c9a2ed4200
checksum: 579849ef155d487ed7d1a8d30dab6ea906da2d571c725b3b033543a9a609f75c
- filename: packages/contentstack-audit/src/audit-base-command.ts
checksum: bd99d269c0b6694577f4751fa96b3d85856e41bbef624b4ec1196630d6c1d168
- filename: packages/contentstack-migrate-rte/test/commands/json-migration.test.js
checksum: 1f5ee5b39119667bd4830f9dbbbf757fb922f4ec3b7f6fad06bbfbf214fe7f73
version: '1.0'
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
checksum: 0b0af505ce1a74eb8df519f106291e319eb3ea74003ca63e03527f59a8821d39
- filename: packages/contentstack-bootstrap/test/bootstrap.test.js
checksum: 5f0355a5048183d61b605cbc160e6727a9de32832d9159e903fee49f9ab751d5
- filename: package-lock.json
checksum: 35c1a3c35a923ddf97a42edc85708a1bee9352710ebe135b6be6a32c95bde908
- filename: packages/contentstack-utilities/test/unit/logger.test.ts
checksum: c773181ea55c49d91363adacf0424b84c927e3cffd6bef1444ec2559ddf1b3b0
- filename: packages/contentstack-utilities/src/logger/cliErrorHandler.ts
checksum: 023cf08f215cd0778599fb8478c94419373d4687f04421c4eb99d87de86a4a3e
- filename: packages/contentstack-utilities/src/logger/logger.ts
checksum: 09f3b73dd995bafc253265c676f06308513e6b1842d9bc01d39e6b6945a54c7d
version: "1.0"
21,057 changes: 11,940 additions & 9,117 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-audit/1.12.1 darwin-arm64 node-v22.14.0
@contentstack/cli-audit/1.13.0 darwin-arm64 node-v22.14.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -282,7 +282,7 @@ DESCRIPTION
Display help for csdx.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.27/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.28/src/commands/help.ts)_

## `csdx plugins`

Expand All @@ -305,7 +305,7 @@ EXAMPLES
$ csdx plugins
```

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

## `csdx plugins:add PLUGIN`

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

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

## `csdx plugins:install PLUGIN`

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

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

## `csdx plugins:link PATH`

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

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

## `csdx plugins:remove [PLUGIN]`

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

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

## `csdx plugins:uninstall [PLUGIN]`

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

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

## `csdx plugins:unlink [PLUGIN]`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.36/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.39/src/commands/plugins/update.ts)_
<!-- commandsstop -->
14 changes: 7 additions & 7 deletions packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-audit",
"version": "1.12.1",
"version": "1.13.0",
"description": "Contentstack audit plugin",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/cli",
Expand All @@ -19,8 +19,8 @@
],
"dependencies": {
"@contentstack/cli-command": "~1.5.0",
"@oclif/plugin-help": "^6.2.27",
"@contentstack/cli-utilities": "~1.11.1",
"@oclif/plugin-help": "^6.2.28",
"@contentstack/cli-utilities": "~1.12.0",
"@oclif/plugin-plugins": "^5.4.36",
"chalk": "^4.1.2",
"fast-csv": "^4.3.6",
Expand All @@ -30,19 +30,19 @@
"winston": "^3.17.0"
},
"devDependencies": {
"@oclif/test": "^4.1.12",
"@oclif/test": "^4.1.13",
"@types/chai": "^4.3.20",
"@types/fs-extra": "^11.0.4",
"@types/mocha": "^10.0.10",
"@types/node": "^20.17.30",
"@types/node": "^20.17.50",
"@types/uuid": "^9.0.8",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"eslint-config-oclif": "^6.0.42",
"eslint-config-oclif": "^6.0.62",
"eslint-config-oclif-typescript": "^3.1.14",
"mocha": "^10.8.2",
"nyc": "^15.1.0",
"oclif": "^4.17.43",
"oclif": "^4.17.46",
"shx": "^0.4.0",
"sinon": "^19.0.5",
"ts-node": "^10.9.2",
Expand Down
6 changes: 5 additions & 1 deletion packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma

break;
case 'field-rules':
// NOTE: We are using the fixed content-type for validation of field rules
const data = this.getCtAndGfSchema();
constructorParam.ctSchema = data.ctSchema;
constructorParam.gfSchema = data.gfSchema;
missingFieldRules = await new FieldRule(cloneDeep(constructorParam)).run();
await this.prepareReport(module, missingFieldRules);
this.getAffectedData('field-rules', dataModuleWise['content-types'], missingFieldRules);
Expand Down Expand Up @@ -456,7 +460,7 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
key === 'missingCTSelectFieldValues' ||
key === 'missingFieldUid' ||
key === 'action' ||
key === 'Non-Fixable' ||
key === 'Non-Fixable' ||
key === 'Not-Fixed'
) {
return chalk.red(typeof cellValue === 'object' ? JSON.stringify(cellValue) : cellValue);
Expand Down
77 changes: 58 additions & 19 deletions packages/contentstack-audit/src/modules/content-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default class ContentType {
*/
async writeFixContent() {
let canWrite = true;

if (!this.inMemoryFix && this.fix) {
if (!this.config.flags['copy-dir'] && !this.config.flags['external-config']?.skipConfirm) {
canWrite = this.config.flags.yes ?? (await cliux.confirm(commonMsg.FIX_CONFIRMATION));
Expand Down Expand Up @@ -301,18 +301,35 @@ export default class ContentType {
*/
async validateGlobalField(tree: Record<string, unknown>[], field: GlobalFieldDataType): Promise<void> {
// NOTE Any GlobalField related logic can be added here
if (!field.schema && !this.fix) {
this.missingRefs[this.currentUid].push({
tree,
ct_uid: this.currentUid,
name: this.currentTitle,
data_type: field.data_type,
display_name: field.display_name,
missingRefs: 'Empty schema found',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
if (this.moduleName === 'global-fields') {
let { reference_to } = field;
const refExist = find(this.schema, { uid: reference_to });
if (!refExist) {
this.missingRefs[this.currentUid].push({
tree,
ct: this.currentUid,
name: this.currentTitle,
data_type: field.data_type,
display_name: field.display_name,
missingRefs: 'Referred Global Field Does not Exist',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
return void 0;
}
} else if (this.moduleName === 'content-types') {
if (!field.schema && !this.fix) {
this.missingRefs[this.currentUid].push({
tree,
ct_uid: this.currentUid,
name: this.currentTitle,
data_type: field.data_type,
display_name: field.display_name,
missingRefs: 'Empty schema found',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});

return void 0;
return void 0;
}
}

await this.lookForReference(tree, field);
Expand Down Expand Up @@ -443,7 +460,7 @@ export default class ContentType {
runFixOnSchema(tree: Record<string, unknown>[], schema: ContentTypeSchemaType[]) {
// NOTE Global field Fix
return schema
.map((field) => {
?.map((field) => {
const { data_type } = field;
const fixTypes = this.config.flags['fix-only'] ?? this.config['fix-fields'];

Expand Down Expand Up @@ -524,12 +541,11 @@ export default class ContentType {
missingRefs: [reference_to],
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
} else if (!field.schema) {
} else if (!field.schema && this.moduleName === 'content-types') {
const gfSchema = find(this.gfSchema, { uid: field.reference_to })?.schema;

if (gfSchema) {
field.schema = gfSchema as GlobalFieldSchemaTypes[];

} else {
this.missingRefs[this.currentUid].push({
tree,
data_type,
Expand All @@ -541,8 +557,27 @@ export default class ContentType {
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
}
} else if (!field.schema && this.moduleName === 'global-fields') {
const gfSchema = find(this.gfSchema, { uid: field.reference_to })?.schema;
if (gfSchema) {
field.schema = gfSchema as GlobalFieldSchemaTypes[];
} else {
this.missingRefs[this.currentUid].push({
tree,
data_type,
display_name,
fixStatus: 'Fixed',
ct_uid: this.currentUid,
name: this.currentTitle,
missingRefs: 'Referred Global Field Does not exist',
treeStr: tree.map(({ name }) => name).join(' ➜ '),
});
}
}

if(field.schema && !isEmpty(field.schema)){
field.schema = this.runFixOnSchema(tree, field.schema as ContentTypeSchemaType[]);
}
return refExist ? field : null;
}

Expand All @@ -559,7 +594,7 @@ export default class ContentType {
*/
fixModularBlocksReferences(tree: Record<string, unknown>[], blocks: ModularBlockType[]) {
return blocks
.map((block) => {
?.map((block) => {
const { reference_to, schema, title: display_name } = block;
tree = [...tree, { uid: block.uid, name: block.title }];
const refErrorObj = {
Expand All @@ -572,7 +607,7 @@ export default class ContentType {
treeStr: tree.map(({ name }) => name).join(' ➜ '),
};

if (!schema) {
if (!schema && this.moduleName === 'content-types') {
this.missingRefs[this.currentUid].push(refErrorObj);

return false;
Expand All @@ -581,7 +616,11 @@ export default class ContentType {
// NOTE Global field section
if (reference_to) {
const refExist = find(this.gfSchema, { uid: reference_to });
if (!refExist) {
this.missingRefs[this.currentUid].push(refErrorObj);

return false;
}
if (!refExist) {
this.missingRefs[this.currentUid].push(refErrorObj);

Expand All @@ -591,7 +630,7 @@ export default class ContentType {

block.schema = this.runFixOnSchema(tree, block.schema as ContentTypeSchemaType[]);

if (isEmpty(block.schema)) {
if (isEmpty(block.schema) && this.moduleName === 'content-types') {
this.missingRefs[this.currentUid].push({
...refErrorObj,
missingRefs: 'Empty schema found',
Expand Down
Loading
Loading