@contentstack/cli-cm-bulk-publish 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-bulk-publish",
3
3
  "description": "Contentstack CLI plugin for bulk publish actions",
4
- "version": "1.4.2",
4
+ "version": "1.4.4",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
8
  "@contentstack/cli-command": "~1.2.16",
9
- "@contentstack/cli-utilities": "~1.5.12",
9
+ "@contentstack/cli-utilities": "~1.6.0",
10
10
  "bluebird": "^3.7.2",
11
11
  "chalk": "^4.1.2",
12
12
  "dotenv": "^16.1.4",
@@ -43,7 +43,6 @@ async function publishEntry(data, _config, queue) {
43
43
  .publish({
44
44
  publishDetails: { environments: entryObj.environments, locales: lang },
45
45
  locale: entryObj.locale || 'en-us',
46
- version: entryObj.version
47
46
  })
48
47
  .then((publishEntryResponse) => {
49
48
  if (!publishEntryResponse.error_message) {
@@ -246,9 +245,10 @@ async function performBulkPublish(data, _config, queue) {
246
245
  .publish(payload)
247
246
  .then((bulkPublishEntriesResponse) => {
248
247
  if (!bulkPublishEntriesResponse.error_message) {
248
+ const sanitizedData = JSON.stringify(removePublishDetails(bulkPublishObj.entries));
249
249
  console.log(
250
250
  chalk.green(
251
- `Bulk entries sent for publish ${JSON.stringify(removePublishDetails(bulkPublishObj.entries))}`,
251
+ `Bulk entries sent for publish ${sanitizedData}`,
252
252
  ),
253
253
  (bulkPublishEntriesResponse.job_id) ? chalk.yellow(`job_id: ${bulkPublishEntriesResponse.job_id}`) : ''
254
254
  );
@@ -192,6 +192,12 @@ async function getSyncEntries(
192
192
 
193
193
  const entriesResponse = await Stack.sync(syncData);
194
194
 
195
+ if (filter?.content_type_uid?.length) {
196
+ entriesResponse.items = entriesResponse.items.filter((entry) =>
197
+ filter?.content_type_uid.includes(entry.content_type_uid),
198
+ );
199
+ }
200
+
195
201
  if (entriesResponse.items.length > 0) {
196
202
  await bulkAction(stack, entriesResponse.items, bulkPublish, filter, destEnv, apiVersion);
197
203
  }
package/src/util/store.js CHANGED
@@ -2,10 +2,11 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const config = require('../config/index.js');
4
4
  const chalk = require('chalk');
5
+ const {pathValidator} = require('@contentstack/cli-utilities')
5
6
 
6
7
  function save(key, data) {
7
8
  let bulkPublish = config ? config : {};
8
- let filePath = path.join(process.cwd(), config.json);
9
+ let filePath = pathValidator(config.json);
9
10
  bulkPublish[key] = data;
10
11
  fs.writeFile(filePath, JSON.stringify(bulkPublish), (error) => {
11
12
  if (error) {
@@ -49,7 +50,7 @@ function get(key, filePath) {
49
50
 
50
51
  function updateMissing(key, flags) {
51
52
  let savedConfig;
52
- savedConfig = get(key, path.resolve(flags.config));
53
+ savedConfig = get(key, pathValidator(flags.config));
53
54
  Object.keys(savedConfig).forEach((element) => {
54
55
  if (flags[element] === undefined) {
55
56
  console.log(`Using ${element} from config file`);