Skip to content

Commit

Permalink
Merge pull request #1265 from contentstack/staging
Browse files Browse the repository at this point in the history
Merge staging to main
  • Loading branch information
aman19K authored Jan 29, 2024
2 parents 8d4e8e8 + 32c0f3d commit 77f028a
Show file tree
Hide file tree
Showing 36 changed files with 1,394 additions and 956 deletions.
1,840 changes: 1,169 additions & 671 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 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.3.2 darwin-arm64 node-v20.8.0
@contentstack/cli-audit/1.3.4 darwin-arm64 node-v18.12.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -285,7 +285,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/index.ts)_

## `csdx plugins:install PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/install.ts)_

## `csdx plugins:link PLUGIN`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/link.ts)_

## `csdx plugins:uninstall PLUGIN...`

Expand Down Expand Up @@ -465,7 +465,7 @@ USAGE
$ csdx plugins:reset
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/uninstall.ts)_

## `csdx plugins:uninstall PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.10/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/update.ts)_
<!-- commandsstop -->
8 changes: 5 additions & 3 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.3.3",
"version": "1.3.4",
"description": "Contentstack audit plugin",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/cli",
Expand All @@ -19,7 +19,7 @@
],
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^4.1.9",
"chalk": "^4.1.2",
Expand All @@ -34,6 +34,7 @@
"@oclif/test": "^2.0.3",
"@types/chai": "^4.3.5",
"@types/fs-extra": "^11.0.2",
"@types/mocha": "^10.0.6",
"@types/node": "^20.3.1",
"@types/uuid": "^9.0.4",
"chai": "^4.3.7",
Expand Down Expand Up @@ -71,6 +72,7 @@
"lint": "eslint . --ext .ts --config .eslintrc",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "npm run lint",
"compile": "shx rm -rf lib && tsc -b",
"prepack": "npm run build && oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif readme && git add README.md",
Expand All @@ -84,4 +86,4 @@
"keywords": [
"oclif"
]
}
}
15 changes: 9 additions & 6 deletions packages/contentstack-audit/src/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ export default class Entries {
field as ReferenceFieldDataType,
entry[uid] as EntryReferenceFieldDataType[],
);
if (!entry[uid]) {
delete entry[uid];
}
break;
case 'blocks':
entry[uid] = this.fixModularBlocksReferences(
Expand All @@ -504,6 +507,7 @@ export default class Entries {
) as EntryGroupFieldDataType;
break;
}

});

return entry;
Expand Down Expand Up @@ -546,12 +550,12 @@ export default class Entries {
entry: EntryModularBlocksDataType[],
) {
entry = entry
.map((block, index) => this.modularBlockRefCheck(tree, blocks, block, index))
?.map((block, index) => this.modularBlockRefCheck(tree, blocks, block, index))
.filter((val) => !isEmpty(val));

blocks.forEach((block) => {
entry = entry
.map((eBlock) => {
?.map((eBlock) => {
if (!isEmpty(block.schema)) {
if (eBlock[block.uid]) {
eBlock[block.uid] = this.runFixOnSchema(
Expand Down Expand Up @@ -666,9 +670,9 @@ export default class Entries {
field: ReferenceFieldDataType | JsonRTEFieldDataType,
entry: EntryReferenceFieldDataType[],
) {

const missingRefs: Record<string, any>[] = [];
entry = entry
.map((reference) => {
entry = entry?.map((reference) => {
const { uid } = reference;
const refExist = find(this.entryMetaData, { uid });

Expand All @@ -678,8 +682,7 @@ export default class Entries {
}

return reference;
})
.filter((val) => val) as EntryReferenceFieldDataType[];
}).filter((val) => val) as EntryReferenceFieldDataType[];

if (!isEmpty(missingRefs)) {
this.missingRefs[this.currentUid].push({
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-audit/test/unit/commands/fix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ describe('AuditFix command', () => {
} as FileTransportInstance;

describe('AuditFix run method', () => {
fancy
const test = fancy.loadConfig({ root: process.cwd() });
test
.stdout({ print: process.env.PRINT === 'true' || false })
.stub(fs, 'rmSync', () => {})
.stub(winston.transports, 'File', () => fsTransport)
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-audit/test/unit/commands/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import winston from 'winston';
import { expect, test } from '@oclif/test';
import { expect, test as fancy } from '@oclif/test';
import { FileTransportInstance } from 'winston/lib/winston/transports';

import { AuditBaseCommand } from '../../../src/audit-base-command';
Expand All @@ -10,6 +10,7 @@ describe('Audit command', () => {
} as FileTransportInstance;

describe('Audit run method', () => {
const test = fancy.loadConfig({ root: process.cwd() });
test
.stdout({ print: process.env.PRINT === 'true' || false })
.stub(winston.transports, 'File', () => fsTransport)
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
Expand Down Expand Up @@ -96,4 +96,4 @@
}
},
"repository": "contentstack/cli"
}
}
4 changes: 2 additions & 2 deletions packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@contentstack/cli-cm-seed": "~1.7.0",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"inquirer": "8.2.4",
"mkdirp": "^1.0.4",
"tar": "^6.1.13"
Expand Down Expand Up @@ -73,4 +73,4 @@
}
},
"repository": "contentstack/cli"
}
}
8 changes: 4 additions & 4 deletions packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@contentstack/cli-cm-branches",
"description": "Contentstack CLI plugin to do branches operations",
"version": "1.0.21",
"version": "1.0.22",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"@oclif/core": "^2.9.3",
"async": "^3.2.4",
"big-json": "^3.2.0",
Expand All @@ -26,7 +26,7 @@
},
"devDependencies": {
"@contentstack/cli-auth": "~1.3.17",
"@contentstack/cli-config": "~1.4.15",
"@contentstack/cli-config": "~1.6.0",
"@contentstack/cli-dev-dependencies": "~1.2.4",
"@oclif/plugin-help": "^5.1.19",
"@oclif/test": "^1.2.6",
Expand Down Expand Up @@ -95,4 +95,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function entryCreateScript(contentType) {
text = JSON.stringify(_entry);
}
markdownRegEx = new RegExp(
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
'g',
);
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function entryCreateUpdateScript(contentType) {
text = JSON.stringify(_entry);
}
markdownRegEx = new RegExp(
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
'g',
);
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function entryUpdateScript(contentType) {
text = JSON.stringify(_entry);
}
markdownRegEx = new RegExp(
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
'g',
);
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-bulk-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"bluebird": "^3.7.2",
"chalk": "^4.1.2",
"dotenv": "^16.1.4",
Expand Down Expand Up @@ -99,4 +99,4 @@
"version": "oclif readme && git add README.md",
"clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo"
}
}
}
8 changes: 4 additions & 4 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@contentstack/cli-cm-export": "~1.10.2",
"@contentstack/cli-cm-import": "~1.13.1",
"@contentstack/cli-cm-export": "~1.10.4",
"@contentstack/cli-cm-import": "~1.13.2",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"@colors/colors": "^1.5.0",
"async": "^3.2.4",
"chalk": "^4.1.0",
Expand Down Expand Up @@ -70,4 +70,4 @@
"cm:stack-clone": "O-CLN"
}
}
}
}
4 changes: 2 additions & 2 deletions packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"format": "eslint src/**/*.ts --fix"
},
"dependencies": {
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"contentstack": "^3.10.1"
},
"devDependencies": {
Expand Down Expand Up @@ -65,4 +65,4 @@
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-command/<%- commandPath %>"
},
"repository": "contentstack/cli"
}
}
6 changes: 3 additions & 3 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-config",
"description": "Contentstack CLI plugin for configuration",
"version": "1.5.1",
"version": "1.6.0",
"author": "Contentstack",
"scripts": {
"build": "npm run clean && npm run compile",
Expand All @@ -22,7 +22,7 @@
},
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
Expand Down Expand Up @@ -84,4 +84,4 @@
}
},
"repository": "contentstack/cli"
}
}
6 changes: 6 additions & 0 deletions packages/contentstack-config/src/utils/region-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ const regions = {
uiHost: 'https://azure-eu-app.contentstack.com',
name: 'AZURE-EU',
},
'GCP-NA': {
cma: 'https://gcp-na-api.contentstack.com',
cda: 'https://gcp-na-cdn.contentstack.com',
uiHost: 'https://gcp-na-app.contentstack.com',
name: 'GCP-NA',
},
};

class UserConfig {
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-export-to-csv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.10",
"@contentstack/cli-utilities": "~1.5.11",
"chalk": "^4.1.0",
"fast-csv": "^4.3.6",
"inquirer": "8.2.4",
Expand Down Expand Up @@ -65,4 +65,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
Loading

0 comments on commit 77f028a

Please sign in to comment.