@contentstack/cli-cm-bulk-publish 1.10.0 → 1.10.2

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/README.md CHANGED
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish
18
18
  $ csdx COMMAND
19
19
  running command...
20
20
  $ csdx (--version)
21
- @contentstack/cli-cm-bulk-publish/1.10.0 darwin-arm64 node-v22.14.0
21
+ @contentstack/cli-cm-bulk-publish/1.10.1 darwin-arm64 node-v22.14.0
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-bulk-publish",
3
3
  "description": "Contentstack CLI plugin for bulk publish actions",
4
- "version": "1.10.0",
4
+ "version": "1.10.2",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
8
  "@contentstack/cli-command": "~1.6.1",
9
9
  "@contentstack/cli-config": "~1.15.0",
10
- "@contentstack/cli-utilities": "~1.13.1",
10
+ "@contentstack/cli-utilities": "~1.14.4",
11
11
  "@oclif/core": "^4.3.0",
12
12
  "@oclif/plugin-help": "^6.2.28",
13
13
  "chalk": "^4.1.2",
@@ -34,6 +34,7 @@ class AssetsPublishCommand extends Command {
34
34
  host: this.cmaHost,
35
35
  cda: this.cdaHost,
36
36
  branch: assetsFlags.branch,
37
+ delayMs: updatedFlags.delayMs,
37
38
  };
38
39
  if (updatedFlags.alias) {
39
40
  // Validate management token alias.
@@ -37,6 +37,7 @@ class UnpublishCommand extends Command {
37
37
  host: this.cmaHost,
38
38
  cda: this.cdaHost,
39
39
  branch: unpublishFlags.branch,
40
+ delayMs: updatedFlags.delayMs,
40
41
  };
41
42
  if (updatedFlags.alias) {
42
43
  // Validate management token alias.
@@ -26,6 +26,7 @@ class CrossPublishCommand extends Command {
26
26
  host: this.cmaHost,
27
27
  cda: this.cdaHost,
28
28
  branch: crossPublishFlags.branch,
29
+ delayMs: updatedFlags.delayMs,
29
30
  };
30
31
  if (updatedFlags.alias) {
31
32
  try {
@@ -37,6 +37,7 @@ class PublishModifiedCommand extends Command {
37
37
  host: this.cmaHost,
38
38
  cda: this.cdaHost,
39
39
  branch: entryEditsFlags.branch,
40
+ delayMs: updatedFlags.delayMs,
40
41
  };
41
42
  if (updatedFlags.alias) {
42
43
  try {
@@ -45,6 +45,7 @@ class NonlocalizedFieldChangesCommand extends Command {
45
45
  host: this.cmaHost,
46
46
  cda: this.cdaHost,
47
47
  branch: nonlocalizedFieldChangesFlags.branch,
48
+ delayMs: updatedFlags.delayMs,
48
49
  };
49
50
  if (updatedFlags.alias) {
50
51
  try {
@@ -50,6 +50,7 @@ class PublishEntriesCommand extends Command {
50
50
  host: this.cmaHost,
51
51
  cda: this.cdaHost,
52
52
  branch: entriesFlags.branch,
53
+ delayMs: updatedFlags.delayMs,
53
54
  };
54
55
  if (updatedFlags.alias) {
55
56
  try {
@@ -87,14 +88,20 @@ class PublishEntriesCommand extends Command {
87
88
  updatedFlags.destEnv = updatedFlags.environments;
88
89
  updatedFlags.environment = updatedFlags['source-env'];
89
90
  updatedFlags.onlyEntries = true;
90
- if (updatedFlags.locales instanceof Array) {
91
- updatedFlags.locales.forEach((locale) => {
92
- updatedFlags.locale = locale;
93
- publishFunction(startCrossPublish);
94
- });
95
- } else {
96
- updatedFlags.locale = locales;
97
- publishFunction(startCrossPublish);
91
+ if(Array.isArray(updatedFlags.contentTypes) && updatedFlags.contentTypes.length > 0){
92
+ for (const contentType of updatedFlags.contentTypes) {
93
+ updatedFlags.contentType = contentType;
94
+ if (Array.isArray(updatedFlags.locales)) {
95
+ for (const locale of updatedFlags.locales) {
96
+ updatedFlags.locale = locale;
97
+ console.log(`Bulk publish started for content type \x1b[36m${updatedFlags.contentType}\x1b[0m and locale is \x1b[36m${updatedFlags.locale}\x1b[0m`);
98
+ await publishFunction(startCrossPublish);
99
+ }
100
+ } else {
101
+ updatedFlags.locale = updatedFlags.locales;
102
+ publishFunction(startCrossPublish);
103
+ }
104
+ }
98
105
  }
99
106
  } else {
100
107
  publishFunction(startPublish);
@@ -42,6 +42,7 @@ class UnpublishCommand extends Command {
42
42
  host: this.cmaHost,
43
43
  cda: this.cdaHost,
44
44
  branch: unpublishFlags.branch,
45
+ delayMs: updatedFlags.delayMs,
45
46
  };
46
47
  if (updatedFlags.alias) {
47
48
  try {
@@ -35,6 +35,7 @@ class UpdateAndPublishCommand extends Command {
35
35
  host: this.cmaHost,
36
36
  cda: this.cdaHost,
37
37
  branch: addFieldsFlags.branch,
38
+ delayMs: updatedFlags.delayMs,
38
39
  };
39
40
  if (updatedFlags.alias) {
40
41
  try {
@@ -42,6 +42,7 @@ class UnpublishCommand extends Command {
42
42
  host: this.cmaHost,
43
43
  cda: this.cdaHost,
44
44
  branch: unpublishFlags.branch,
45
+ delayMs: updatedFlags.delayMs,
45
46
  };
46
47
  if (updatedFlags.alias) {
47
48
  try {
@@ -200,17 +200,15 @@ async function getSyncEntries(
200
200
  if (queryParamsObj.locale) {
201
201
  syncData['locale'] = queryParamsObj.locale;
202
202
  }
203
+ if (filter?.content_type_uid) {
204
+ syncData['content_type_uid'] = filter.content_type_uid;
205
+ }
203
206
  if (queryParamsObj.type) {
204
207
  syncData['type'] = queryParamsObj.type;
205
208
  }
209
+ let entriesResponse;
210
+ entriesResponse = await Stack.sync(syncData);
206
211
 
207
- const entriesResponse = await Stack.sync(syncData);
208
-
209
- if (filter?.content_type_uid?.length) {
210
- entriesResponse.items = entriesResponse.items.filter((entry) =>
211
- filter?.content_type_uid.includes(entry.content_type_uid),
212
- );
213
- }
214
212
 
215
213
  if (variantsFlag) {
216
214
  for (let index = 0; index < entriesResponse?.items?.length; index++) {
@@ -241,6 +239,7 @@ async function getSyncEntries(
241
239
  destEnv,
242
240
  apiVersion,
243
241
  bulkPublishLimit,
242
+ variantsFlag,
244
243
  entriesResponse.pagination_token,
245
244
  );
246
245
  }, 3000);
@@ -314,7 +313,7 @@ async function start(
314
313
  retryFailed,
315
314
  bulkPublish,
316
315
  deliveryToken,
317
- contentTypes,
316
+ contentType,
318
317
  environment,
319
318
  locale,
320
319
  onlyAssets,
@@ -372,8 +371,8 @@ async function start(
372
371
  };
373
372
  if (f_types) filter.type = f_types;
374
373
  // filter.type = (f_types) ? f_types : types // types mentioned in the config file (f_types) are given preference
375
- if (contentTypes) {
376
- filter.content_type_uid = contentTypes;
374
+ if (contentType) {
375
+ filter.content_type_uid = contentType;
377
376
  filter.type = 'entry_published';
378
377
  }
379
378
  if (onlyAssets) {
@@ -183,7 +183,8 @@ async function revertUsingLogs(logFileName) {
183
183
  apikey: response.file[0].message.api_key,
184
184
  alias: response.file[0].message.alias,
185
185
  host: response.file[0].message.host,
186
- branch: response.file[0].message.branch || 'main'
186
+ branch: response.file[0].message.branch || 'main',
187
+ delayMs: response.file[0].message.delayMs
187
188
  });
188
189
  logs = await formatLogData(stack, response.file);
189
190
  const bulkPublishLimit = fetchBulkPublishLimit(stack?.org_uid);
@@ -29,6 +29,7 @@ async function publishOnlyUnpublishedService(UnpublishedEntriesCommand) {
29
29
  host: this.cmaHost,
30
30
  cda: this.cdaHost,
31
31
  branch: unpublishedEntriesFlags.branch,
32
+ delayMs: updatedFlags.delayMs,
32
33
  };
33
34
  if (updatedFlags.alias) {
34
35
  try {
@@ -6,6 +6,7 @@ async function getStack(data) {
6
6
  const options = {
7
7
  host: data.host,
8
8
  branchName: data.branch,
9
+ delayMs: data.delayMs,
9
10
  };
10
11
  const stackOptions = {};
11
12
  if (data.alias) {
@@ -5,7 +5,7 @@ module.exports = async (filename, queue, Type) => {
5
5
  const logs = await getAllLogs(filename);
6
6
  if (logs.file.length > 0) {
7
7
  logs.file.forEach(async (log) => {
8
- const stackOptions = {host: log.message.host };
8
+ const stackOptions = {host: log.message.host, delayMs: log.message.delayMs };
9
9
  if(log.message.alias) {
10
10
  stackOptions["alias"] = log.message.alias
11
11
  } else {
package/src/util/store.js CHANGED
@@ -38,6 +38,7 @@ function get(key, filePath) {
38
38
  }
39
39
  return {
40
40
  alias: bulkPublish.alias,
41
+ delayMs: bulkPublish.delayMs,
41
42
  ...bulkPublish[key],
42
43
  };
43
44
  } catch (error) {