Skip to content

Commit

Permalink
Merge pull request #1044 from contentstack/staging
Browse files Browse the repository at this point in the history
Staging -> Main
  • Loading branch information
netrajpatel authored Sep 25, 2023
2 parents 6222878 + 387ec8f commit 0a9e7d7
Show file tree
Hide file tree
Showing 34 changed files with 22,016 additions and 17,237 deletions.
38,633 changes: 21,628 additions & 17,005 deletions package-lock.json

Large diffs are not rendered by default.

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.13 darwin-arm64 node-v20.3.1
@contentstack/cli-auth/1.3.13 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
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.4.15 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-bootstrap/1.4.16 darwin-x64 node-v20.7.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.4.15",
"version": "1.4.16",
"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.4.15",
"@contentstack/cli-cm-seed": "~1.4.16",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"inquirer": "8.2.4",
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.0.12 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-branches/1.0.13 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
4 changes: 1 addition & 3 deletions packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"name": "@contentstack/cli-cm-branches",
"description": "Contentstack CLI plugin to do branches operations",
"version": "1.0.12",
"version": "1.0.13",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"@oclif/command": "^1.8.16",
"@oclif/config": "^1.18.3",
"@oclif/core": "^2.9.3",
"async": "^3.2.4",
"big-json": "^3.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ export function entryCreateScript(contentType) {
.query({ query: { title: compareRefEntry.title } })
.find();
updateValueByPath(entryDetails, references[i], baseRefEntry.items[0].uid);
if(baseRefEntry?.items?.length > 0 && baseRefEntry.items[0]?.uid){
updateValueByPath(entryDetails, references[i], baseRefEntry.items[0].uid);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,9 @@ export function entryCreateUpdateScript(contentType) {
.query({ query: { title: compareRefEntry.title } })
.find();
updateValueByPath(entryDetails, references[i], baseRefEntry.items[0].uid);
if(baseRefEntry?.items?.length > 0 && baseRefEntry.items[0]?.uid){
updateValueByPath(entryDetails, references[i], baseRefEntry.items[0].uid);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ export function entryUpdateScript(contentType) {
.query({ query: { title: compareRefEntry.title } })
.find();
updateValueByPath(entryDetails, references[i], baseRefEntry.items[0].uid);
if(baseRefEntry?.items?.length > 0 && baseRefEntry.items[0]?.uid){
updateValueByPath(entryDetails, references[i], baseRefEntry.items[0].uid);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bulk-publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bulk-publish/1.3.11 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-bulk-publish/1.3.11 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-clone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-clone
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-clone/1.4.16 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-clone/1.4.17 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@contentstack/cli-cm-clone",
"description": "Contentstack stack clone plugin",
"version": "1.4.16",
"version": "1.4.17",
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@contentstack/cli-cm-export": "~1.8.1",
"@contentstack/cli-cm-import": "~1.8.3",
"@contentstack/cli-cm-export": "~1.8.2",
"@contentstack/cli-cm-import": "~1.8.4",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"@colors/colors": "^1.5.0",
Expand Down Expand Up @@ -70,4 +70,4 @@
"cm:stack-clone": "O-CLN"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.4.11 darwin-arm64 node-v20.3.1
@contentstack/cli-config/1.4.11 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export-to-csv/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-export-to-csv",
"description": "Export entities to csv",
"version": "1.4.1",
"version": "1.4.2",
"author": "Abhinav Gupta @abhinav-from-contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
18 changes: 17 additions & 1 deletion packages/contentstack-export-to-csv/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,22 @@ function exitProgram() {
process.exit();
}

function sanitizeEntries(flatEntry) {
// sanitize against CSV Injections
const CSVRegex = /^[\\+\\=@\\-]/
for (key in flatEntry) {
if (typeof flatEntry[key] === 'string' && flatEntry[key].match(CSVRegex)) {
flatEntry[key] = flatEntry[key].replace(/\"/g, "\"\"");
flatEntry[key] = `"'${flatEntry[key]}"`
} else if (typeof flatEntry[key] === 'object') {
// convert any objects or arrays to string
// to store this data correctly in csv
flatEntry[key] = JSON.stringify(flatEntry[key]);
}
}
return flatEntry;
}

function cleanEntries(entries, language, environments, contentTypeUid) {
const filteredEntries = entries.filter((entry) => {
return entry['locale'] === language;
Expand All @@ -393,6 +409,7 @@ function cleanEntries(entries, language, environments, contentTypeUid) {
}
}
entry = flatten(entry);
entry = sanitizeEntries(entry);
entry['publish_details'] = envArr;
entry['_workflow'] = workflow;
entry['ACL'] = JSON.stringify({}); // setting ACL to empty obj
Expand All @@ -409,7 +426,6 @@ function cleanEntries(entries, language, environments, contentTypeUid) {
delete entry.publishRequest;
return entry;
});
console.log(filteredEntries.length);
}

function getDateTime() {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-export/1.8.1 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-export/1.8.2 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 2 additions & 4 deletions packages/contentstack-export/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"name": "@contentstack/cli-cm-export",
"description": "Contentstack CLI plugin to export content from stack",
"version": "1.8.1",
"version": "1.8.2",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"@oclif/command": "^1.8.16",
"@oclif/config": "^1.18.3",
"@oclif/core": "^2.9.3",
"async": "^3.2.4",
"big-json": "^3.2.0",
Expand Down Expand Up @@ -100,4 +98,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import/1.8.3 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-import/1.8.4 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
5 changes: 2 additions & 3 deletions packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.8.3",
"version": "1.8.4",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"@contentstack/management": "~1.10.0",
"@oclif/config": "^1.18.3",
"@oclif/core": "^2.9.3",
"big-json": "^3.2.0",
"bluebird": "^3.7.2",
Expand Down Expand Up @@ -96,4 +95,4 @@
}
},
"repository": "https://github.com/contentstack/cli"
}
}
6 changes: 3 additions & 3 deletions packages/contentstack-import/src/import/modules-js/entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = class ImportEntries {
ctPath;
lPath;
importConcurrency;
skipFiles = ['__master.json', '__priority.json', 'schema.json'];
skipFiles = ['__master.json', '__priority.json', 'schema.json','.DS_Store'];

constructor(importConfig, stackAPIClient) {
this.config = _.merge(config, importConfig);
Expand Down Expand Up @@ -1258,7 +1258,7 @@ module.exports = class ImportEntries {

if (element.length) {
for (const item of element) {
if ((item.type === 'p' || item.type === 'a') && item.children && item.children.length > 0) {
if ((item.type === 'p' || item.type === 'a' || item.type === 'span') && item.children && item.children.length > 0) {
return this.doEntryReferencesExist(item.children);
} else if (this.isEntryRef(item)) {
return true;
Expand All @@ -1269,7 +1269,7 @@ module.exports = class ImportEntries {
return true;
}

if ((element.type === 'p' || element.type === 'a') && element.children && element.children.length > 0) {
if ((element.type === 'p' || element.type === 'a' || element.type ==='span') && element.children && element.children.length > 0) {
return this.doEntryReferencesExist(element.children);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ module.exports = class importWorkflows {
});

const updateWorkflow = this.stackAPIClient.workflow(workflow.uid);
Object.assign(updateWorkflow, { workflow_stages: newWorkflowStages, name: workflow.name });
Object.assign(updateWorkflow, {
name: workflow.name,
branches: workflow.branches,
workflow_stages: newWorkflowStages,
});
return updateWorkflow.update();
}
};
6 changes: 5 additions & 1 deletion packages/contentstack-import/src/import/modules/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ export default class ImportWorkflows extends BaseClass {
});

const updateWorkflow = this.stack.workflow(workflow.uid);
Object.assign(updateWorkflow, { workflow_stages: newWorkflowStages, name: workflow.name });
Object.assign(updateWorkflow, {
name: workflow.name,
branches: workflow.branches,
workflow_stages: newWorkflowStages,
});

return updateWorkflow.update();
}
Expand Down
3 changes: 1 addition & 2 deletions packages/contentstack-import/src/utils/asset-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ export const lookupAssets = function (
jsonRteData.children.forEach((element: any) => {
if (element.type) {
switch (element.type) {
case 'a':
case 'p': {
default: {
if (element.children && element.children.length > 0) {
gatherJsonRteAssetIds(element);
}
Expand Down
7 changes: 3 additions & 4 deletions packages/contentstack-import/src/utils/entries-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export const lookupEntries = function (data: any, mappedUids: Record<string, any
jsonRteData.children.forEach((element: any) => {
if (element.type) {
switch (element.type) {
case 'a':
case 'p': {
default: {
if (element.children && element.children.length > 0) {
gatherJsonRteEntryIds(element);
}
Expand Down Expand Up @@ -412,7 +411,7 @@ function doEntryReferencesExist(element: Record<string, any>[] | any): boolean {

if (element.length) {
for (const item of element) {
if ((item.type === 'p' || item.type === 'a') && item.children && item.children.length > 0) {
if ((item.type === 'p' || item.type === 'a' || item.type === 'span') && item.children && item.children.length > 0) {
return doEntryReferencesExist(item.children);
} else if (isEntryRef(item)) {
return true;
Expand All @@ -423,7 +422,7 @@ function doEntryReferencesExist(element: Record<string, any>[] | any): boolean {
return true;
}

if ((element.type === 'p' || element.type === 'a') && element.children && element.children.length > 0) {
if ((element.type === 'p' || element.type === 'a' || element.type === 'span') && element.children && element.children.length > 0) {
return doEntryReferencesExist(element.children);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-launch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-launch/1.0.11 darwin-arm64 node-v20.3.1
@contentstack/cli-launch/1.0.12 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-launch/oclif.manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.10",
"version": "1.0.12",
"commands": {
"launch:base-command": {
"id": "launch:base-command",
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-launch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-launch",
"version": "1.0.11",
"version": "1.0.12",
"description": "Launch related operations",
"author": "Contentstack CLI",
"bin": {
Expand All @@ -21,7 +21,7 @@
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^2.3.2",
"@oclif/plugin-plugins": "^3.3.2",
"@oclif/core": "^2.9.3",
"@types/express": "^4.17.17",
"@types/express-serve-static-core": "^4.17.34",
Expand All @@ -32,7 +32,7 @@
"esm": "^3.2.25",
"express": "^4.18.2",
"form-data": "^4.0.0",
"graphql": "^16.6.0",
"graphql": "^16.8.1",
"ini": "^3.0.1",
"lodash": "^4.17.21",
"open": "^8.4.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-migrate-rte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-migrate-rte
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-migrate-rte/1.4.11 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-migrate-rte/1.4.11 darwin-x64 node-v20.7.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
Loading

0 comments on commit 0a9e7d7

Please sign in to comment.