Skip to content

Commit

Permalink
Merge pull request #1029 from contentstack/staging
Browse files Browse the repository at this point in the history
Merge staging to main
  • Loading branch information
aman19K authored Sep 11, 2023
2 parents 1ef6065 + 2fe0078 commit 4969cbd
Show file tree
Hide file tree
Showing 44 changed files with 442 additions and 294 deletions.
255 changes: 137 additions & 118 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.12 darwin-arm64 node-v20.3.1
@contentstack/cli-auth/1.3.13 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
1 change: 1 addition & 0 deletions packages/contentstack-auth/messages/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"CLI_AUTH_LOGOUT_FAILED": "Error in logout, please login again",
"CLI_AUTH_LOGOUT_DESCRIPTION": "User session logout",
"CLI_AUTH_LOGOUT_FLAG_FORCE": "Force logging out for skipping the confirmation",
"CLI_AUTH_LOGOUT_ALREADY": "You're already logged out",
"CLI_AUTH_WHOAMI_LOGGED_IN_AS": "You are currently logged in with email",
"CLI_AUTH_WHOAMI_FAILED": "Failed to get the current user details",
"CLI_AUTH_WHOAMI_DESCRIPTION": "Display current users email address",
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-auth",
"description": "Contentstack CLI plugin for authentication activities",
"version": "1.3.12",
"version": "1.3.13",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -22,8 +22,8 @@
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"inquirer": "8.2.4",
Expand Down
15 changes: 7 additions & 8 deletions packages/contentstack-auth/src/commands/auth/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,18 @@ export default class LogoutCommand extends Command {
try {
const managementAPIClient = await managementSDKClient({ host: this.cmaHost, skipTokenValidity: true });
authHandler.client = managementAPIClient;
if ((await oauthHandler.isAuthenticated()) && (await oauthHandler.isAuthorisationTypeBasic())) {
if (confirm === true) {
cliux.loader('CLI_AUTH_LOGOUT_LOADER_START');
if (confirm === true && (await oauthHandler.isAuthenticated())) {
cliux.loader('CLI_AUTH_LOGOUT_LOADER_START');
if (await oauthHandler.isAuthorisationTypeBasic()) {
await authHandler.logout(configHandler.get('authtoken'));
cliux.loader('');
logger.info('successfully logged out');
cliux.success('CLI_AUTH_LOGOUT_SUCCESS');
} else if (await oauthHandler.isAuthorisationTypeOAuth()) {
await oauthHandler.oauthLogout()
}
} else {
cliux.loader('CLI_AUTH_LOGOUT_LOADER_START');
cliux.loader('');
logger.info('successfully logged out');
cliux.success('CLI_AUTH_LOGOUT_SUCCESS');
} else {
cliux.success('CLI_AUTH_LOGOUT_ALREADY');
}
} catch (error) {
let errorMessage = '';
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.14 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-bootstrap/1.4.15 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
8 changes: 4 additions & 4 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.14",
"version": "1.4.15",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -17,9 +17,9 @@
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
},
"dependencies": {
"@contentstack/cli-cm-seed": "~1.4.14",
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-cm-seed": "~1.4.15",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"inquirer": "8.2.4",
"mkdirp": "^1.0.4",
"tar": "^6.1.13"
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.11 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-branches/1.0.12 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
10 changes: 5 additions & 5 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.11",
"version": "1.0.12",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@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",
Expand All @@ -27,8 +27,8 @@
"winston": "^3.7.2"
},
"devDependencies": {
"@contentstack/cli-auth": "~1.3.11",
"@contentstack/cli-config": "~1.4.9",
"@contentstack/cli-auth": "~1.3.13",
"@contentstack/cli-config": "~1.4.11",
"@contentstack/cli-dev-dependencies": "~1.2.3",
"@oclif/plugin-help": "^5.1.19",
"@oclif/test": "^1.2.6",
Expand Down
14 changes: 7 additions & 7 deletions packages/contentstack-branches/src/utils/merge-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ export const setupMergeInputs = async (mergeFlags) => {
if (!mergeFlags['stack-api-key']) {
mergeFlags['stack-api-key'] = await askStackAPIKey();
}
if (!mergeFlags['compare-branch']) {
if (!compare_branch) {
mergeFlags['compare-branch'] = await askCompareBranch();
} else {
mergeFlags['compare-branch'] = compare_branch;
}
}
if (!mergeFlags['base-branch']) {
if (!base_branch) {
mergeFlags['base-branch'] = getbranchConfig(mergeFlags['stack-api-key']);
Expand All @@ -79,6 +72,13 @@ export const setupMergeInputs = async (mergeFlags) => {
mergeFlags['base-branch'] = base_branch;
}
}
if (!mergeFlags['compare-branch']) {
if (!compare_branch) {
mergeFlags['compare-branch'] = await askCompareBranch();
} else {
mergeFlags['compare-branch'] = compare_branch;
}
}

return mergeFlags;
};
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.10 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-bulk-publish/1.3.11 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-bulk-publish/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@contentstack/cli-cm-bulk-publish",
"description": "Contentstack CLI plugin for bulk publish actions",
"version": "1.3.10",
"version": "1.3.11",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"bluebird": "^3.7.2",
"chalk": "^4.1.2",
"dotenv": "^16.1.4",
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.15 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-clone/1.4.16 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
10 changes: 5 additions & 5 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@contentstack/cli-cm-clone",
"description": "Contentstack stack clone plugin",
"version": "1.4.15",
"version": "1.4.16",
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@contentstack/cli-cm-export": "~1.8.0",
"@contentstack/cli-cm-import": "~1.8.0",
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-cm-export": "~1.8.1",
"@contentstack/cli-cm-import": "~1.8.3",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"@colors/colors": "^1.5.0",
"async": "^3.2.4",
"chalk": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-command",
"description": "Contentstack CLI plugin for configuration",
"version": "1.2.11",
"version": "1.2.12",
"author": "Contentstack",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -17,7 +17,7 @@
"format": "eslint src/**/*.ts --fix"
},
"dependencies": {
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-utilities": "~1.5.2",
"contentstack": "^3.10.1"
},
"devDependencies": {
Expand Down
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.10 darwin-arm64 node-v20.3.1
@contentstack/cli-config/1.4.11 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
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.4.10",
"version": "1.4.11",
"author": "Contentstack",
"scripts": {
"build": "npm run clean && npm run compile",
Expand All @@ -21,8 +21,8 @@
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"chalk": "^4.0.0",
"debug": "^4.1.1",
"mkdirp": "^1.0.4",
Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-export-to-csv/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "@contentstack/cli-cm-export-to-csv",
"description": "Export entities to csv",
"version": "1.4.0",
"version": "1.4.1",
"author": "Abhinav Gupta @abhinav-from-contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.11",
"@contentstack/cli-utilities": "~1.5.1",
"@contentstack/cli-command": "~1.2.12",
"@contentstack/cli-utilities": "~1.5.2",
"chalk": "^4.1.0",
"fast-csv": "^4.3.6",
"inquirer": "8.2.4",
"inquirer-checkbox-plus-prompt": "1.0.1",
"mkdirp": "^1.0.4"
"mkdirp": "^3.0.1"
},
"devDependencies": {
"@oclif/test": "^2.2.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class ExportToCsvCommand extends Command {
const entriesCount = await util.getEntriesCount(stackAPIClient, contentType, language.code);
let flatEntries = [];
for (let index = 0; index < entriesCount / 100; index++) {
const entriesResult = await util.getEntries(stackAPIClient, contentType, language.code, index);
const entriesResult = await util.getEntries(stackAPIClient, contentType, language.code, index, 100);
const flatEntriesResult = util.cleanEntries(
entriesResult.items,
language.code,
Expand Down
29 changes: 18 additions & 11 deletions packages/contentstack-export-to-csv/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function chooseContentType(stackAPIClient, skip) {
let _chooseContentType = [
{
type: 'checkbox',
message: 'Choose Content Type',
message: 'Choose Content Type (Press Space to select the content types) ',
choices: contentTypesList,
name: 'chosenContentTypes',
loop: false,
Expand All @@ -218,7 +218,7 @@ function chooseInMemContentTypes(contentTypesList) {
let _chooseContentType = [
{
type: 'checkbox-plus',
message: 'Choose Content Type',
message: 'Choose Content Type (Press Space to select the content types)',
choices: contentTypesList,
name: 'chosenContentTypes',
loop: false,
Expand Down Expand Up @@ -316,12 +316,12 @@ function getLanguages(stackAPIClient) {
});
}

function getEntries(stackAPIClient, contentType, language, skip) {
function getEntries(stackAPIClient, contentType, language, skip, limit) {
return new Promise((resolve, reject) => {
stackAPIClient
.contentType(contentType)
.entry()
.query({ include_publish_details: true, locale: language, skip: skip * 100 })
.query({ include_publish_details: true, locale: language, skip: skip * 100, limit: limit, include_workflow: true })
.find()
.then((entries) => resolve(entries))
.catch((error) => reject(error));
Expand Down Expand Up @@ -373,25 +373,31 @@ function exitProgram() {

function cleanEntries(entries, language, environments, contentTypeUid) {
const filteredEntries = entries.filter((entry) => {
return entry['locale'] === language && entry.publish_details.length > 0;
return entry['locale'] === language;
});

return filteredEntries.map((entry) => {
let workflow = '';
const envArr = [];
entry.publish_details.forEach((env) => {
envArr.push(JSON.stringify([environments[env['environment']], env['locale'], env['time']]));
});
if(entry.publish_details.length) {
entry.publish_details.forEach((env) => {
envArr.push(JSON.stringify([environments[env['environment']], env['locale'], env['time']]));
});
}

delete entry.publish_details;
delete entry.setWorkflowStage;
if ('_workflow' in entry) {
workflow = entry['_workflow']['name'];
delete entry['_workflow'];
if(entry._workflow?.name) {
workflow = entry['_workflow']['name'];
delete entry['_workflow'];
}
}
entry = flatten(entry);
entry['publish_details'] = envArr;
entry['_workflow'] = workflow;
entry['ACL'] = JSON.stringify({}); // setting ACL to empty obj
entry['content_type_uid'] = contentTypeUid; // content_type_uid is being returned as 'uid' from the sdk for some reason

// entry['url'] might also be wrong
delete entry.stackHeaders;
delete entry.update;
Expand All @@ -403,6 +409,7 @@ 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.0 darwin-arm64 node-v20.3.1
@contentstack/cli-cm-export/1.8.1 darwin-arm64 node-v20.3.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
Loading

0 comments on commit 4969cbd

Please sign in to comment.