@contentstack/cli-cm-bulk-publish 1.3.9 → 1.3.10

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.3.9 linux-x64 node-v18.16.1
21
+ @contentstack/cli-cm-bulk-publish/1.3.10 linux-x64 node-v18.17.0
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -231,6 +231,7 @@ FLAGS
231
231
  -a, --alias=<value> Alias(name) for the management token
232
232
  -c, --config=<value> Path to the config file
233
233
  -e, --environments=<value>... Environments where entries will be published
234
+ -k, --stack-api-key=<value> Stack api key to be used
234
235
  -l, --locales=<value>... Locales where entries will be published
235
236
  -t, --contentTypes=<value>... The Contenttypes from which entries will be published
236
237
  -y, --yes Agree to process the command with the current configuration
@@ -256,7 +257,7 @@ ALIASES
256
257
  EXAMPLES
257
258
  General Usage
258
259
 
259
- $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]
260
+ $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]
260
261
 
261
262
 
262
263
 
@@ -278,7 +279,13 @@ EXAMPLES
278
279
 
279
280
  Using --branch
280
281
 
281
- $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]
282
+ $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]
283
+
284
+
285
+
286
+ Using --stack-api-key
287
+
288
+ $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY]
282
289
  ```
283
290
 
284
291
  ## `csdx cm:assets:publish [-a <value>] [--retry-failed <value>] [-e <value>] [--folder-uid <value>] [--bulk-publish <value>] [-c <value>] [-y] [--locales <value>] [--branch <value>] [--delivery-token <value>] [--source-env <value>]`
@@ -393,10 +400,11 @@ The configure command is used to generate a configuration file for publish scrip
393
400
 
394
401
  ```
395
402
  USAGE
396
- $ csdx cm:bulk-publish:configure [-a <value>]
403
+ $ csdx cm:bulk-publish:configure [-a <value>] [-k <value>]
397
404
 
398
405
  FLAGS
399
- -a, --alias=<value> Alias(name) for the management token
406
+ -a, --alias=<value> Alias(name) for the management token
407
+ -k, --stack-api-key=<value> Stack api key to be used
400
408
 
401
409
  DESCRIPTION
402
410
  The configure command is used to generate a configuration file for publish scripts.
@@ -410,6 +418,8 @@ EXAMPLES
410
418
  $ csdx cm:stacks:publish-configure -a <management_token_alias>
411
419
 
412
420
  $ csdx cm:stacks:publish-configure --alias <management_token_alias>
421
+
422
+ $ csdx cm:stacks:publish-configure --stack-api-key <stack_api_key>
413
423
  ```
414
424
 
415
425
  ## `csdx cm:bulk-publish:cross-publish [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--content-type <value>] [--locales <value>] [--source-env <value>] [--environments <value>] [--delivery-token <value>] [-c <value>] [-y] [--branch <value>] [--onlyAssets] [--onlyEntries]`
@@ -506,6 +516,7 @@ FLAGS
506
516
  -c, --config=<value> Path for the external config file (A new config file can be generated at the current
507
517
  working directory using `csdx cm:bulk-publish:configure -a [ALIAS]`)
508
518
  -e, --environments=<value>... Environments where entries will be published
519
+ -k, --stack-api-key=<value> Stack api key to be used
509
520
  -l, --locales=<value>... Locales where entries will be published
510
521
  -y, --yes Agree to process the command with the current configuration
511
522
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
@@ -565,6 +576,12 @@ EXAMPLES
565
576
  Using --source-env
566
577
 
567
578
  $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]
579
+
580
+
581
+
582
+ Using --stack-api-key
583
+
584
+ $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]
568
585
  ```
569
586
 
570
587
  ## `csdx cm:entries:publish-modified [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--source-env <value>] [--content-types <value>] [--locales <value>] [-e <value>] [-c <value>] [-y] [--branch <value>]`
@@ -582,6 +599,7 @@ FLAGS
582
599
  -a, --alias=<value> Alias(name) for the management token
583
600
  -c, --config=<value> Path to the config file
584
601
  -e, --environments=<value>... Destination environments
602
+ -k, --stack-api-key=<value> Stack api key to be used
585
603
  -l, --locales=<value>... Locales where edited entries will be published
586
604
  -y, --yes Agree to process the command with the current configuration
587
605
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
@@ -632,6 +650,12 @@ EXAMPLES
632
650
  Using --branch
633
651
 
634
652
  $ csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]
653
+
654
+
655
+
656
+ Using --stack-api-key
657
+
658
+ $ csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -stack-api-key [STACK API KEY]
635
659
  ```
636
660
 
637
661
  ## `csdx cm:entries:publish-non-localized-fields [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--source-env <value>] [--content-types <value>] [-e <value>] [-c <value>] [-y] [--branch <value>]`
@@ -649,6 +673,7 @@ FLAGS
649
673
  -a, --alias=<value> Alias(name) for the management token
650
674
  -c, --config=<value> Path to the config file
651
675
  -e, --environments=<value>... Destination environments
676
+ -k, --stack-api-key=<value> Stack api key to be used
652
677
  -y, --yes Agree to process the command with the current configuration
653
678
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
654
679
  --bulk-publish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
@@ -695,6 +720,12 @@ EXAMPLES
695
720
  Using --branch flag
696
721
 
697
722
  $ csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV] --branch [BRANCH NAME]
723
+
724
+
725
+
726
+ Using --stack-api-key flag
727
+
728
+ $ csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENV]
698
729
  ```
699
730
 
700
731
  ## `csdx cm:bulk-publish:revert`
@@ -741,18 +772,19 @@ USAGE
741
772
  [--only-assets] [--only-entries]
742
773
 
743
774
  FLAGS
744
- -B, --branch=<value> [default: main] Specify the branch to fetch the content from (default is main branch)
745
- -a, --alias=<value> Alias(name) for the management token
746
- -c, --config=<value> Path to the config file
747
- -e, --environment=<value> Source Environment
748
- -l, --locale=<value> Locale filter
749
- -y, --yes Agree to process the command with the current configuration
750
- --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
751
- --bulk-unpublish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
752
- bulkpublish API will be used to unpublish the entries and assets
753
- --content-type=<value> Content type filter
754
- --delivery-token=<value> Delivery token for source environment
755
- --retry-failed=<value> Retry publishing failed entries from the logfile (optional, overrides all other flags)
775
+ -B, --branch=<value> [default: main] Specify the branch to fetch the content from (default is main branch)
776
+ -a, --alias=<value> Alias(name) for the management token
777
+ -c, --config=<value> Path to the config file
778
+ -e, --environment=<value> Source Environment
779
+ -k, --stack-api-key=<value> Stack api key to be used
780
+ -l, --locale=<value> Locale filter
781
+ -y, --yes Agree to process the command with the current configuration
782
+ --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
783
+ --bulk-unpublish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
784
+ bulkpublish API will be used to unpublish the entries and assets
785
+ --content-type=<value> Content type filter
786
+ --delivery-token=<value> Delivery token for source environment
787
+ --retry-failed=<value> Retry publishing failed entries from the logfile (optional, overrides all other flags)
756
788
 
757
789
  DESCRIPTION
758
790
  Unpublish entries or assets of given content types from the specified environment
@@ -818,6 +850,12 @@ EXAMPLES
818
850
  Using --branch flag
819
851
 
820
852
  $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]
853
+
854
+
855
+
856
+ Using --stack-api-key flag
857
+
858
+ $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]
821
859
  ```
822
860
 
823
861
  ## `csdx cm:entries:publish-only-unpublished [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--source-env <value>] [--content-types <value>] [--locales <value>] [-e <value>] [-c <value>] [-y] [--branch <value>]`
@@ -838,6 +876,7 @@ FLAGS
838
876
  bulkpublish API will be used to publish the entries
839
877
  -c, --config=<value> Path to the config file
840
878
  -e, --environments=<value>... Destination environments
879
+ -k, --stack-api-key=<value> Stack api key to be used
841
880
  -y, --yes Agree to process the command with the current configuration
842
881
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
843
882
  --content-types=<value>... The Contenttypes from which entries will be published
@@ -884,6 +923,12 @@ EXAMPLES
884
923
  Using --branch
885
924
 
886
925
  $ csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME] -source-env [SOURCE ENV]
926
+
927
+
928
+
929
+ Using --stack-api-key
930
+
931
+ $ csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --stack-api-key [STACK API KEY] -source-env [SOURCE ENV]
887
932
  ```
888
933
 
889
934
  ## `csdx cm:entries:publish [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--publish-all-content-types] [--content-types <value>] [--locales <value>] [-e <value>] [-c <value>] [-y] [--branch <value>] [--delivery-token <value>] [--source-env <value>]`
@@ -903,6 +948,7 @@ FLAGS
903
948
  -c, --config=<value> Path for the external config file (A new config file can be generated at the current
904
949
  working directory using `csdx cm:bulk-publish:configure -a [ALIAS]`)
905
950
  -e, --environments=<value>... Environments where entries will be published
951
+ -k, --stack-api-key=<value> Stack api key to be used
906
952
  -l, --locales=<value>... Locales where entries will be published
907
953
  -y, --yes Agree to process the command with the current configuration
908
954
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
@@ -962,6 +1008,12 @@ EXAMPLES
962
1008
  Using --source-env
963
1009
 
964
1010
  $ csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]
1011
+
1012
+
1013
+
1014
+ Using --stack-api-key
1015
+
1016
+ $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]
965
1017
  ```
966
1018
 
967
1019
  _See code: [src/commands/cm/entries/publish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js)_
@@ -981,6 +1033,7 @@ FLAGS
981
1033
  -a, --alias=<value> Alias(name) for the management token
982
1034
  -c, --config=<value> Path to the config file
983
1035
  -e, --environments=<value>... Destination environments
1036
+ -k, --stack-api-key=<value> Stack api key to be used
984
1037
  -l, --locales=<value>... Locales where edited entries will be published
985
1038
  -y, --yes Agree to process the command with the current configuration
986
1039
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
@@ -1031,6 +1084,12 @@ EXAMPLES
1031
1084
  Using --branch
1032
1085
 
1033
1086
  $ csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]
1087
+
1088
+
1089
+
1090
+ Using --stack-api-key
1091
+
1092
+ $ csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -stack-api-key [STACK API KEY]
1034
1093
  ```
1035
1094
 
1036
1095
  _See code: [src/commands/cm/entries/publish-modified.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish-modified.js)_
@@ -1050,6 +1109,7 @@ FLAGS
1050
1109
  -a, --alias=<value> Alias(name) for the management token
1051
1110
  -c, --config=<value> Path to the config file
1052
1111
  -e, --environments=<value>... Destination environments
1112
+ -k, --stack-api-key=<value> Stack api key to be used
1053
1113
  -y, --yes Agree to process the command with the current configuration
1054
1114
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
1055
1115
  --bulk-publish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
@@ -1096,6 +1156,12 @@ EXAMPLES
1096
1156
  Using --branch flag
1097
1157
 
1098
1158
  $ csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV] --branch [BRANCH NAME]
1159
+
1160
+
1161
+
1162
+ Using --stack-api-key flag
1163
+
1164
+ $ csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENV]
1099
1165
  ```
1100
1166
 
1101
1167
  _See code: [src/commands/cm/entries/publish-non-localized-fields.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish-non-localized-fields.js)_
@@ -1118,6 +1184,7 @@ FLAGS
1118
1184
  bulkpublish API will be used to publish the entries
1119
1185
  -c, --config=<value> Path to the config file
1120
1186
  -e, --environments=<value>... Destination environments
1187
+ -k, --stack-api-key=<value> Stack api key to be used
1121
1188
  -y, --yes Agree to process the command with the current configuration
1122
1189
  --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
1123
1190
  --content-types=<value>... The Contenttypes from which entries will be published
@@ -1164,6 +1231,12 @@ EXAMPLES
1164
1231
  Using --branch
1165
1232
 
1166
1233
  $ csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME] -source-env [SOURCE ENV]
1234
+
1235
+
1236
+
1237
+ Using --stack-api-key
1238
+
1239
+ $ csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --stack-api-key [STACK API KEY] -source-env [SOURCE ENV]
1167
1240
  ```
1168
1241
 
1169
1242
  _See code: [src/commands/cm/entries/publish-only-unpublished.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish-only-unpublished.js)_
@@ -1174,24 +1247,25 @@ Unpublish entries from the given environment
1174
1247
 
1175
1248
  ```
1176
1249
  USAGE
1177
- $ csdx cm:entries:unpublish [-a <value>] [-e <value>] [-c <value>] [-y] [--locale <value>] [--branch <value>]
1178
- [--retry-failed <value>] [--bulk-unpublish <value>] [--api-version <value>] [--content-type <value>]
1250
+ $ csdx cm:entries:unpublish [-a <value>] [-k <value>] [-e <value>] [-c <value>] [-y] [--locale <value>] [--branch
1251
+ <value>] [--retry-failed <value>] [--bulk-unpublish <value>] [--api-version <value>] [--content-type <value>]
1179
1252
  [--delivery-token <value>]
1180
1253
 
1181
1254
  FLAGS
1182
- -a, --alias=<value> Alias(name) for the management token
1183
- -c, --config=<value> Path to the config file
1184
- -e, --environment=<value> Source Environment
1185
- -y, --yes Agree to process the command with the current configuration
1186
- --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
1187
- --branch=<value> [default: main] Specify the branch to fetch the content (by default the main branch is
1188
- selected)
1189
- --bulk-unpublish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
1190
- bulkpublish API will be used to unpublish the entries
1191
- --content-type=<value> Content type filter
1192
- --delivery-token=<value> Delivery token for source environment
1193
- --locale=<value> Locale filter
1194
- --retry-failed=<value> Retry publishing failed entries from the logfile
1255
+ -a, --alias=<value> Alias(name) for the management token
1256
+ -c, --config=<value> Path to the config file
1257
+ -e, --environment=<value> Source Environment
1258
+ -k, --stack-api-key=<value> Stack api key to be used
1259
+ -y, --yes Agree to process the command with the current configuration
1260
+ --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
1261
+ --branch=<value> [default: main] Specify the branch to fetch the content (by default the main branch is
1262
+ selected)
1263
+ --bulk-unpublish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
1264
+ bulkpublish API will be used to unpublish the entries
1265
+ --content-type=<value> Content type filter
1266
+ --delivery-token=<value> Delivery token for source environment
1267
+ --locale=<value> Locale filter
1268
+ --retry-failed=<value> Retry publishing failed entries from the logfile
1195
1269
 
1196
1270
  DESCRIPTION
1197
1271
  Unpublish entries from the given environment
@@ -1223,11 +1297,15 @@ EXAMPLES
1223
1297
 
1224
1298
 
1225
1299
 
1226
-
1227
-
1228
1300
  Using --branch flag
1229
1301
 
1230
1302
  $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]
1303
+
1304
+
1305
+
1306
+ Using --stack-api-key flag
1307
+
1308
+ $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]
1231
1309
  ```
1232
1310
 
1233
1311
  _See code: [src/commands/cm/entries/unpublish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/unpublish.js)_
@@ -1247,6 +1325,7 @@ FLAGS
1247
1325
  -a, --alias=<value> Alias(name) for the management token
1248
1326
  -c, --config=<value> Path to the config file
1249
1327
  -e, --environments=<value>... Environments where entries will be published
1328
+ -k, --stack-api-key=<value> Stack api key to be used
1250
1329
  -l, --locales=<value>... Locales where entries will be published
1251
1330
  -t, --contentTypes=<value>... The Contenttypes from which entries will be published
1252
1331
  -y, --yes Agree to process the command with the current configuration
@@ -1272,7 +1351,7 @@ ALIASES
1272
1351
  EXAMPLES
1273
1352
  General Usage
1274
1353
 
1275
- $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]
1354
+ $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]
1276
1355
 
1277
1356
 
1278
1357
 
@@ -1294,7 +1373,13 @@ EXAMPLES
1294
1373
 
1295
1374
  Using --branch
1296
1375
 
1297
- $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]
1376
+ $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]
1377
+
1378
+
1379
+
1380
+ Using --stack-api-key
1381
+
1382
+ $ csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY]
1298
1383
  ```
1299
1384
 
1300
1385
  _See code: [src/commands/cm/entries/update-and-publish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/update-and-publish.js)_
@@ -1387,10 +1472,11 @@ The configure command is used to generate a configuration file for publish scrip
1387
1472
 
1388
1473
  ```
1389
1474
  USAGE
1390
- $ csdx cm:stacks:publish-configure [-a <value>]
1475
+ $ csdx cm:stacks:publish-configure [-a <value>] [-k <value>]
1391
1476
 
1392
1477
  FLAGS
1393
- -a, --alias=<value> Alias(name) for the management token
1478
+ -a, --alias=<value> Alias(name) for the management token
1479
+ -k, --stack-api-key=<value> Stack api key to be used
1394
1480
 
1395
1481
  DESCRIPTION
1396
1482
  The configure command is used to generate a configuration file for publish scripts.
@@ -1404,6 +1490,8 @@ EXAMPLES
1404
1490
  $ csdx cm:stacks:publish-configure -a <management_token_alias>
1405
1491
 
1406
1492
  $ csdx cm:stacks:publish-configure --alias <management_token_alias>
1493
+
1494
+ $ csdx cm:stacks:publish-configure --stack-api-key <stack_api_key>
1407
1495
  ```
1408
1496
 
1409
1497
  _See code: [src/commands/cm/stacks/publish-configure.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/stacks/publish-configure.js)_
@@ -1454,18 +1542,19 @@ USAGE
1454
1542
  [--only-assets] [--only-entries]
1455
1543
 
1456
1544
  FLAGS
1457
- -B, --branch=<value> [default: main] Specify the branch to fetch the content from (default is main branch)
1458
- -a, --alias=<value> Alias(name) for the management token
1459
- -c, --config=<value> Path to the config file
1460
- -e, --environment=<value> Source Environment
1461
- -l, --locale=<value> Locale filter
1462
- -y, --yes Agree to process the command with the current configuration
1463
- --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
1464
- --bulk-unpublish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
1465
- bulkpublish API will be used to unpublish the entries and assets
1466
- --content-type=<value> Content type filter
1467
- --delivery-token=<value> Delivery token for source environment
1468
- --retry-failed=<value> Retry publishing failed entries from the logfile (optional, overrides all other flags)
1545
+ -B, --branch=<value> [default: main] Specify the branch to fetch the content from (default is main branch)
1546
+ -a, --alias=<value> Alias(name) for the management token
1547
+ -c, --config=<value> Path to the config file
1548
+ -e, --environment=<value> Source Environment
1549
+ -k, --stack-api-key=<value> Stack api key to be used
1550
+ -l, --locale=<value> Locale filter
1551
+ -y, --yes Agree to process the command with the current configuration
1552
+ --api-version=<value> API Version to be used. Values [Default: 3, Nested Reference Publishing: 3.2].
1553
+ --bulk-unpublish=<value> [default: true] This flag is set to true by default. It indicates that contentstack's
1554
+ bulkpublish API will be used to unpublish the entries and assets
1555
+ --content-type=<value> Content type filter
1556
+ --delivery-token=<value> Delivery token for source environment
1557
+ --retry-failed=<value> Retry publishing failed entries from the logfile (optional, overrides all other flags)
1469
1558
 
1470
1559
  DESCRIPTION
1471
1560
  Unpublish entries or assets of given content types from the specified environment
@@ -1531,6 +1620,12 @@ EXAMPLES
1531
1620
  Using --branch flag
1532
1621
 
1533
1622
  $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]
1623
+
1624
+
1625
+
1626
+ Using --stack-api-key flag
1627
+
1628
+ $ csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]
1534
1629
  ```
1535
1630
 
1536
1631
  _See code: [src/commands/cm/stacks/unpublish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/stacks/unpublish.js)_
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.9",
2
+ "version": "1.3.10",
3
3
  "commands": {
4
4
  "cm:assets:publish": {
5
5
  "id": "cm:assets:publish",
@@ -491,7 +491,10 @@
491
491
  "csdx cm:entries:publish-modified -r [LOG FILE NAME]",
492
492
  "",
493
493
  "Using --branch",
494
- "csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]"
494
+ "csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]",
495
+ "",
496
+ "Using --stack-api-key",
497
+ "csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -stack-api-key [STACK API KEY]"
495
498
  ],
496
499
  "flags": {
497
500
  "alias": {
@@ -501,6 +504,14 @@
501
504
  "description": "Alias(name) for the management token",
502
505
  "multiple": false
503
506
  },
507
+ "stack-api-key": {
508
+ "name": "stack-api-key",
509
+ "type": "option",
510
+ "char": "k",
511
+ "description": "Stack api key to be used",
512
+ "required": false,
513
+ "multiple": false
514
+ },
504
515
  "retryFailed": {
505
516
  "name": "retryFailed",
506
517
  "type": "option",
@@ -627,7 +638,10 @@
627
638
  "csdx cm:entries:publish-non-localized-fields --retry-failed [LOG FILE NAME]",
628
639
  "",
629
640
  "Using --branch flag",
630
- "csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV] --branch [BRANCH NAME]"
641
+ "csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV] --branch [BRANCH NAME]",
642
+ "",
643
+ "Using --stack-api-key flag",
644
+ "csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENV]"
631
645
  ],
632
646
  "flags": {
633
647
  "alias": {
@@ -637,6 +651,14 @@
637
651
  "description": "Alias(name) for the management token",
638
652
  "multiple": false
639
653
  },
654
+ "stack-api-key": {
655
+ "name": "stack-api-key",
656
+ "type": "option",
657
+ "char": "k",
658
+ "description": "Stack api key to be used",
659
+ "required": false,
660
+ "multiple": false
661
+ },
640
662
  "retry-failed": {
641
663
  "name": "retry-failed",
642
664
  "type": "option",
@@ -757,7 +779,10 @@
757
779
  "csdx cm:entries:publish-only-unpublished --retry-failed [LOG FILE NAME]",
758
780
  "",
759
781
  "Using --branch",
760
- "csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME] -source-env [SOURCE ENV]"
782
+ "csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME] -source-env [SOURCE ENV]",
783
+ "",
784
+ "Using --stack-api-key",
785
+ "csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --stack-api-key [STACK API KEY] -source-env [SOURCE ENV]"
761
786
  ],
762
787
  "flags": {
763
788
  "alias": {
@@ -767,6 +792,13 @@
767
792
  "description": "Alias(name) for the management token",
768
793
  "multiple": false
769
794
  },
795
+ "stack-api-key": {
796
+ "name": "stack-api-key",
797
+ "type": "option",
798
+ "char": "k",
799
+ "description": "Stack api key to be used",
800
+ "multiple": false
801
+ },
770
802
  "retryFailed": {
771
803
  "name": "retryFailed",
772
804
  "type": "option",
@@ -906,7 +938,10 @@
906
938
  "csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]",
907
939
  "",
908
940
  "Using --source-env",
909
- "csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]"
941
+ "csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]",
942
+ "",
943
+ "Using --stack-api-key",
944
+ "csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]"
910
945
  ],
911
946
  "flags": {
912
947
  "alias": {
@@ -916,6 +951,13 @@
916
951
  "description": "Alias(name) for the management token",
917
952
  "multiple": false
918
953
  },
954
+ "stack-api-key": {
955
+ "name": "stack-api-key",
956
+ "type": "option",
957
+ "char": "k",
958
+ "description": "Stack api key to be used",
959
+ "multiple": false
960
+ },
919
961
  "retryFailed": {
920
962
  "name": "retryFailed",
921
963
  "type": "option",
@@ -1050,9 +1092,11 @@
1050
1092
  "Using --retry-failed flag",
1051
1093
  "csdx cm:stacks:unpublish --retry-failed [LOG FILE NAME]",
1052
1094
  "",
1053
- "",
1054
1095
  "Using --branch flag",
1055
- "csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]"
1096
+ "csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]",
1097
+ "",
1098
+ "Using --stack-api-key flag",
1099
+ "csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]"
1056
1100
  ],
1057
1101
  "flags": {
1058
1102
  "alias": {
@@ -1062,6 +1106,13 @@
1062
1106
  "description": "Alias(name) for the management token",
1063
1107
  "multiple": false
1064
1108
  },
1109
+ "stack-api-key": {
1110
+ "name": "stack-api-key",
1111
+ "type": "option",
1112
+ "char": "k",
1113
+ "description": "Stack api key to be used",
1114
+ "multiple": false
1115
+ },
1065
1116
  "environment": {
1066
1117
  "name": "environment",
1067
1118
  "type": "option",
@@ -1143,7 +1194,7 @@
1143
1194
  ],
1144
1195
  "examples": [
1145
1196
  "General Usage",
1146
- "csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]",
1197
+ "csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]",
1147
1198
  "",
1148
1199
  "Using --config or -c flag",
1149
1200
  "Generate a config file at the current working directory using `csdx cm:stacks:publish-configure -a [ALIAS]`",
@@ -1154,7 +1205,10 @@
1154
1205
  "csdx cm:entries:update-and-publish --retry-failed [LOG FILE NAME]",
1155
1206
  "",
1156
1207
  "Using --branch",
1157
- "csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]"
1208
+ "csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]",
1209
+ "",
1210
+ "Using --stack-api-key",
1211
+ "csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY]"
1158
1212
  ],
1159
1213
  "flags": {
1160
1214
  "alias": {
@@ -1164,6 +1218,13 @@
1164
1218
  "description": "Alias(name) for the management token",
1165
1219
  "multiple": false
1166
1220
  },
1221
+ "stack-api-key": {
1222
+ "name": "stack-api-key",
1223
+ "type": "option",
1224
+ "char": "k",
1225
+ "description": "Stack api key to be used",
1226
+ "multiple": false
1227
+ },
1167
1228
  "retry-failed": {
1168
1229
  "name": "retry-failed",
1169
1230
  "type": "option",
@@ -1311,7 +1372,8 @@
1311
1372
  "examples": [
1312
1373
  "csdx cm:stacks:publish-configure",
1313
1374
  "csdx cm:stacks:publish-configure -a <management_token_alias>",
1314
- "csdx cm:stacks:publish-configure --alias <management_token_alias>"
1375
+ "csdx cm:stacks:publish-configure --alias <management_token_alias>",
1376
+ "csdx cm:stacks:publish-configure --stack-api-key <stack_api_key>"
1315
1377
  ],
1316
1378
  "flags": {
1317
1379
  "alias": {
@@ -1320,6 +1382,13 @@
1320
1382
  "char": "a",
1321
1383
  "description": "Alias(name) for the management token",
1322
1384
  "multiple": false
1385
+ },
1386
+ "stack-api-key": {
1387
+ "name": "stack-api-key",
1388
+ "type": "option",
1389
+ "char": "k",
1390
+ "description": "Stack api key to be used",
1391
+ "multiple": false
1323
1392
  }
1324
1393
  },
1325
1394
  "args": {}
@@ -1436,7 +1505,10 @@
1436
1505
  "csdx cm:stacks:unpublish --contentType [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --only-entries (Will unpublish only entries, (from CONTENT TYPE) from the source environment)",
1437
1506
  "",
1438
1507
  "Using --branch flag",
1439
- "csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]"
1508
+ "csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]",
1509
+ "",
1510
+ "Using --stack-api-key flag",
1511
+ "csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]"
1440
1512
  ],
1441
1513
  "flags": {
1442
1514
  "alias": {
@@ -1446,6 +1518,13 @@
1446
1518
  "description": "Alias(name) for the management token",
1447
1519
  "multiple": false
1448
1520
  },
1521
+ "stack-api-key": {
1522
+ "name": "stack-api-key",
1523
+ "type": "option",
1524
+ "char": "k",
1525
+ "description": "Stack api key to be used",
1526
+ "multiple": false
1527
+ },
1449
1528
  "environment": {
1450
1529
  "name": "environment",
1451
1530
  "type": "option",
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.3.9",
4
+ "version": "1.3.10",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "^1.2.10",
9
- "@contentstack/cli-utilities": "^1.5.0",
8
+ "@contentstack/cli-command": "^1.2.11",
9
+ "@contentstack/cli-utilities": "^1.5.1",
10
10
  "bluebird": "^3.7.2",
11
11
  "chalk": "^4.1.2",
12
12
  "dotenv": "^16.1.4",
@@ -32,29 +32,34 @@ class PublishModifiedCommand extends Command {
32
32
  if (this.validate(updatedFlags)) {
33
33
  let stack;
34
34
  if (!updatedFlags.retryFailed) {
35
- if (!updatedFlags.alias) {
36
- updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
37
- }
38
- updatedFlags.bulkPublish = updatedFlags.bulkPublish !== 'false';
39
- // Validate management token alias.
40
- try {
41
- this.getToken(updatedFlags.alias);
42
- } catch (error) {
43
- this.error(
44
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
45
- { exit: 2 },
46
- );
47
- }
48
35
  config = {
49
36
  alias: updatedFlags.alias,
50
37
  host: this.cmaHost,
51
38
  cda: this.cdaHost,
52
39
  branch: entryEditsFlags.branch,
53
40
  };
41
+ if (updatedFlags.alias) {
42
+ try {
43
+ this.getToken(updatedFlags.alias);
44
+ } catch (error) {
45
+ this.error(
46
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
47
+ { exit: 2 },
48
+ );
49
+ }
50
+ } else if (updatedFlags['stack-api-key']) {
51
+ config.stackApiKey = updatedFlags['stack-api-key'];
52
+ } else {
53
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
54
+ }
55
+ updatedFlags.bulkPublish = updatedFlags.bulkPublish !== 'false';
54
56
  stack = await getStack(config);
55
57
  }
56
58
  if (await this.confirmFlags(updatedFlags)) {
57
59
  try {
60
+ if (process.env.NODE_ENV === 'test') {
61
+ return;
62
+ }
58
63
  if (!updatedFlags.retryFailed) {
59
64
  await start(updatedFlags, stack, config);
60
65
  } else {
@@ -121,6 +126,11 @@ But, if retry-failed flag is set, then only a logfile is required
121
126
 
122
127
  PublishModifiedCommand.flags = {
123
128
  alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
129
+ 'stack-api-key': flags.string({
130
+ char: 'k',
131
+ description: 'Stack api key to be used',
132
+ required: false,
133
+ }),
124
134
  retryFailed: flags.string({
125
135
  char: 'r',
126
136
  description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
@@ -197,6 +207,9 @@ PublishModifiedCommand.examples = [
197
207
  '',
198
208
  'Using --branch',
199
209
  'csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]',
210
+ '',
211
+ 'Using --stack-api-key',
212
+ 'csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -stack-api-key [STACK API KEY]',
200
213
  ];
201
214
 
202
215
  PublishModifiedCommand.aliases = ['cm:bulk-publish:entry-edits'];
@@ -40,25 +40,34 @@ class NonlocalizedFieldChangesCommand extends Command {
40
40
  let stack;
41
41
  if (!updatedFlags.retryFailed) {
42
42
  updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true;
43
- // Validate management token alias.
44
- try {
45
- this.getToken(updatedFlags.alias);
46
- } catch (error) {
47
- this.error(
48
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
49
- { exit: 2 },
50
- );
51
- }
52
43
  config = {
53
44
  alias: updatedFlags.alias,
54
45
  host: this.cmaHost,
55
46
  cda: this.cdaHost,
56
47
  branch: nonlocalizedFieldChangesFlags.branch,
57
48
  };
49
+ if (updatedFlags.alias) {
50
+ try {
51
+ this.getToken(updatedFlags.alias);
52
+ config.alias = updatedFlags.alias;
53
+ } catch (error) {
54
+ this.error(
55
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
56
+ { exit: 2 },
57
+ );
58
+ }
59
+ } else if (updatedFlags['stack-api-key']) {
60
+ config.stackApiKey = updatedFlags['stack-api-key'];
61
+ } else {
62
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
63
+ }
58
64
  stack = await getStack(config);
59
65
  }
60
66
  if (await this.confirmFlags(updatedFlags)) {
61
67
  try {
68
+ if (process.env.NODE_ENV === 'test') {
69
+ return;
70
+ }
62
71
  if (!updatedFlags.retryFailed) {
63
72
  await start(updatedFlags, stack, config);
64
73
  } else {
@@ -122,6 +131,11 @@ NonlocalizedFieldChangesCommand.flags = {
122
131
  char: 'a',
123
132
  description: 'Alias(name) for the management token',
124
133
  }),
134
+ 'stack-api-key': flags.string({
135
+ char: 'k',
136
+ description: 'Stack api key to be used',
137
+ required: false,
138
+ }),
125
139
  'retry-failed': flags.string({
126
140
  description: 'Retry publishing failed entries from the logfile',
127
141
  }),
@@ -204,6 +218,9 @@ NonlocalizedFieldChangesCommand.examples = [
204
218
  '',
205
219
  'Using --branch flag',
206
220
  'csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV] --branch [BRANCH NAME]',
221
+ '',
222
+ 'Using --stack-api-key flag',
223
+ 'csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENV]',
207
224
  ];
208
225
 
209
226
  NonlocalizedFieldChangesCommand.aliases = ['cm:bulk-publish:nonlocalized-field-changes'];
@@ -22,6 +22,10 @@ But, if retry-failed flag is set, then only a logfile is required
22
22
 
23
23
  PublishOnlyUnpublished.flags = {
24
24
  alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
25
+ 'stack-api-key': flags.string({
26
+ char: 'k',
27
+ description: 'Stack api key to be used',
28
+ }),
25
29
  retryFailed: flags.string({
26
30
  char: 'r',
27
31
  hidden: true,
@@ -102,6 +106,9 @@ PublishOnlyUnpublished.examples = [
102
106
  '',
103
107
  'Using --branch',
104
108
  'csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME] -source-env [SOURCE ENV]',
109
+ '',
110
+ 'Using --stack-api-key',
111
+ 'csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --stack-api-key [STACK API KEY] -source-env [SOURCE ENV]',
105
112
  ];
106
113
 
107
114
  PublishOnlyUnpublished.aliases = ['cm:bulk-publish:unpublished-entries'];
@@ -37,25 +37,27 @@ class PublishEntriesCommand extends Command {
37
37
  if (this.validate(updatedFlags)) {
38
38
  let stack;
39
39
  if (!updatedFlags.retryFailed) {
40
- if (!updatedFlags.alias) {
41
- updatedFlags.alias = await cliux.prompt('Provide the alias of the management token to use');
42
- }
43
- updatedFlags.bulkPublish = updatedFlags.bulkPublish !== 'false';
44
- // Validate management token alias.
45
- try {
46
- this.getToken(updatedFlags.alias);
47
- } catch (error) {
48
- this.error(
49
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
50
- { exit: 2 },
51
- );
52
- }
53
40
  config = {
54
41
  alias: updatedFlags.alias,
55
42
  host: this.cmaHost,
56
43
  cda: this.cdaHost,
57
44
  branch: entriesFlags.branch,
58
45
  };
46
+ if (updatedFlags.alias) {
47
+ try {
48
+ this.getToken(updatedFlags.alias);
49
+ } catch (error) {
50
+ this.error(
51
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
52
+ { exit: 2 },
53
+ );
54
+ }
55
+ } else if (updatedFlags['stack-api-key']) {
56
+ config.stackApiKey = updatedFlags['stack-api-key'];
57
+ } else {
58
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
59
+ }
60
+ updatedFlags.bulkPublish = updatedFlags.bulkPublish !== 'false';
59
61
  stack = await getStack(config);
60
62
  }
61
63
  if (await this.confirmFlags(updatedFlags)) {
@@ -167,6 +169,10 @@ But, if retry-failed flag is set, then only a logfile is required
167
169
 
168
170
  PublishEntriesCommand.flags = {
169
171
  alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
172
+ 'stack-api-key': flags.string({
173
+ char: 'k',
174
+ description: 'Stack api key to be used',
175
+ }),
170
176
  retryFailed: flags.string({
171
177
  char: 'r',
172
178
  description:
@@ -258,6 +264,9 @@ PublishEntriesCommand.examples = [
258
264
  '',
259
265
  'Using --source-env',
260
266
  'csdx cm:entries:publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]',
267
+ '',
268
+ 'Using --stack-api-key',
269
+ 'csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN]',
261
270
  ];
262
271
 
263
272
  PublishEntriesCommand.aliases = ['cm:bulk-publish:entries'];
@@ -35,28 +35,31 @@ class UnpublishCommand extends Command {
35
35
  if (this.validate(updatedFlags)) {
36
36
  let stack;
37
37
  if (!updatedFlags.retryFailed) {
38
- if (!updatedFlags.alias) {
39
- updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
40
- }
41
- if (!updatedFlags.deliveryToken) {
42
- updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment');
43
- }
44
- updatedFlags.bulkUnpublish = updatedFlags.bulkUnpublish === 'false' ? false : true;
45
- // Validate management token alias.
46
- try {
47
- this.getToken(updatedFlags.alias);
48
- } catch (error) {
49
- this.error(
50
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add --alias ${updatedFlags.alias}'`,
51
- { exit: 2 },
52
- );
53
- }
54
38
  config = {
55
39
  alias: updatedFlags.alias,
56
40
  host: this.cmaHost,
57
41
  cda: this.cdaHost,
58
42
  branch: unpublishFlags.branch,
59
43
  };
44
+ if (updatedFlags.alias) {
45
+ try {
46
+ this.getToken(updatedFlags.alias);
47
+ } catch (error) {
48
+ this.error(
49
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add --alias ${updatedFlags.alias}'`,
50
+ { exit: 2 },
51
+ );
52
+ }
53
+ } else if (updatedFlags['stack-api-key']) {
54
+ config.stackApiKey = updatedFlags['stack-api-key'];
55
+ } else {
56
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
57
+ }
58
+ if (!updatedFlags.deliveryToken) {
59
+ updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment');
60
+ }
61
+ updatedFlags.bulkUnpublish = updatedFlags.bulkUnpublish === 'false' ? false : true;
62
+
60
63
  stack = await getStack(config);
61
64
  }
62
65
  if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
@@ -134,6 +137,10 @@ UnpublishCommand.flags = {
134
137
  char: 'a',
135
138
  description: 'Alias(name) for the management token',
136
139
  }),
140
+ 'stack-api-key': flags.string({
141
+ char: 'k',
142
+ description: 'Stack api key to be used',
143
+ }),
137
144
  environment: flags.string({
138
145
  char: 'e',
139
146
  description: 'Source Environment',
@@ -184,9 +191,11 @@ UnpublishCommand.examples = [
184
191
  'Using --retry-failed flag',
185
192
  'csdx cm:stacks:unpublish --retry-failed [LOG FILE NAME]',
186
193
  '',
187
- '',
188
194
  'Using --branch flag',
189
195
  'csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]',
196
+ '',
197
+ 'Using --stack-api-key flag',
198
+ 'csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]',
190
199
  ];
191
200
 
192
201
  module.exports = UnpublishCommand;
@@ -30,25 +30,29 @@ class UpdateAndPublishCommand extends Command {
30
30
  if (this.validate(updatedFlags)) {
31
31
  let stack;
32
32
  if (!updatedFlags.retryFailed) {
33
- if (!updatedFlags.alias) {
34
- updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
35
- }
36
- updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true;
37
- // Validate management token alias.
38
- try {
39
- this.getToken(updatedFlags.alias);
40
- } catch (error) {
41
- this.error(
42
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
43
- { exit: 2 },
44
- );
45
- }
46
33
  config = {
47
34
  alias: updatedFlags.alias,
48
35
  host: this.cmaHost,
49
36
  cda: this.cdaHost,
50
37
  branch: addFieldsFlags.branch,
51
38
  };
39
+ if (updatedFlags.alias) {
40
+ try {
41
+ this.getToken(updatedFlags.alias);
42
+ config.alias = updatedFlags.alias;
43
+ } catch (error) {
44
+ this.error(
45
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
46
+ { exit: 2 },
47
+ );
48
+ }
49
+ } else if (updatedFlags['stack-api-key']) {
50
+ config.stackApiKey = updatedFlags['stack-api-key'];
51
+ } else {
52
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
53
+ }
54
+ updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true;
55
+
52
56
  stack = await getStack(config);
53
57
  }
54
58
  if (await this.confirmFlags(updatedFlags)) {
@@ -114,6 +118,10 @@ But, if retry-failed flag is set, then only a logfile is required
114
118
 
115
119
  UpdateAndPublishCommand.flags = {
116
120
  alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
121
+ 'stack-api-key': flags.string({
122
+ char: 'k',
123
+ description: 'Stack api key to be used',
124
+ }),
117
125
  'retry-failed': flags.string({
118
126
  description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
119
127
  }),
@@ -177,7 +185,7 @@ UpdateAndPublishCommand.flags = {
177
185
 
178
186
  UpdateAndPublishCommand.examples = [
179
187
  'General Usage',
180
- 'csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]',
188
+ 'csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]',
181
189
  '',
182
190
  'Using --config or -c flag',
183
191
  'Generate a config file at the current working directory using `csdx cm:stacks:publish-configure -a [ALIAS]`',
@@ -188,7 +196,10 @@ UpdateAndPublishCommand.examples = [
188
196
  'csdx cm:entries:update-and-publish --retry-failed [LOG FILE NAME]',
189
197
  '',
190
198
  'Using --branch',
191
- 'csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locale [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]',
199
+ 'csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]',
200
+ '',
201
+ 'Using --stack-api-key',
202
+ 'csdx cm:entries:update-and-publish --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY]',
192
203
  ];
193
204
 
194
205
  UpdateAndPublishCommand.aliases = ['cm:bulk-publish:add-fields'];
@@ -9,22 +9,25 @@ class ConfigureCommand extends Command {
9
9
  async run() {
10
10
  const { flags: configureFlags } = await this.parse(ConfigureCommand);
11
11
 
12
- if (!configureFlags.alias) {
13
- configureFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
14
- }
15
-
16
- try {
17
- this.getToken(configureFlags.alias);
18
- } catch (error) {
19
- this.error(`The configured management token alias ${configureFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${configureFlags.alias}'`, { exit: 2 })
12
+ if (configureFlags.alias) {
13
+ try {
14
+ this.getToken(configureFlags.alias);
15
+ } catch (error) {
16
+ this.error(`The configured management token alias ${configureFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${configureFlags.alias}'`, { exit: 2 })
17
+ }
18
+ } else if (configureFlags['stack-api-key']) {
19
+ configureFlags.stackApiKey = configureFlags['stack-api-key'];
20
+ } else {
21
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
20
22
  }
21
23
 
22
24
  this.setConfig(configureFlags);
23
25
  this.log('The configuration has been saved successfully.');
24
26
  }
25
27
 
26
- setConfig({ alias }) {
28
+ setConfig({ alias, stackApiKey }) {
27
29
  if (alias) config.alias = alias;
30
+ else if (stackApiKey) config.stackApiKey = stackApiKey;
28
31
  fs.writeFileSync(path.join(process.cwd(), 'config.js'), `module.exports = ${JSON.stringify(config, null, 2)}`);
29
32
  }
30
33
  }
@@ -33,12 +36,14 @@ ConfigureCommand.description = `The configure command is used to generate a conf
33
36
 
34
37
  ConfigureCommand.flags = {
35
38
  alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
39
+ 'stack-api-key': flags.string({ char: 'k', description: 'Stack api key to be used' }),
36
40
  };
37
41
 
38
42
  ConfigureCommand.examples = [
39
43
  'csdx cm:stacks:publish-configure',
40
44
  'csdx cm:stacks:publish-configure -a <management_token_alias>',
41
45
  'csdx cm:stacks:publish-configure --alias <management_token_alias>',
46
+ 'csdx cm:stacks:publish-configure --stack-api-key <stack_api_key>',
42
47
  ];
43
48
 
44
49
  ConfigureCommand.aliases = ['cm:bulk-publish:configure'];
@@ -9,9 +9,8 @@ class StackPublishCommand extends Command {
9
9
  async run() {
10
10
  try {
11
11
  this.optionController = new OptionController();
12
-
13
- this.entriesPublishReceiver = new EntriesPublishReceiverCommand(this.argv);
14
- this.assetsPublishReceiver = new AssetsPublishReceiverCommand(this.argv);
12
+ this.entriesPublishReceiver = new EntriesPublishReceiverCommand(this.argv, this.config);
13
+ this.assetsPublishReceiver = new AssetsPublishReceiverCommand(this.argv, this.config);
15
14
  this.entriesAndAssetsPublishReceiver = new PublishEntriesAndAssetsCommand();
16
15
 
17
16
  this.publishEntriesCommand = new PublishEntriesCommand(this.entriesPublishReceiver);
@@ -37,28 +37,31 @@ class UnpublishCommand extends Command {
37
37
  if (this.validate(updatedFlags)) {
38
38
  let stack;
39
39
  if (!updatedFlags.retryFailed) {
40
- if (!updatedFlags.alias) {
41
- updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
42
- }
43
- if (!updatedFlags.deliveryToken) {
44
- updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment');
45
- }
46
- updatedFlags.bulkUnpublish = updatedFlags.bulkUnpublish === 'false' ? false : true;
47
- // Validate management token alias.
48
- try {
49
- this.getToken(updatedFlags.alias);
50
- } catch (error) {
51
- this.error(
52
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add --alias ${updatedFlags.alias}'`,
53
- { exit: 2 },
54
- );
55
- }
56
40
  config = {
57
41
  alias: updatedFlags.alias,
58
42
  host: this.cmaHost,
59
43
  cda: this.cdaHost,
60
44
  branch: unpublishFlags.branch,
61
45
  };
46
+ if (updatedFlags.alias) {
47
+ try {
48
+ this.getToken(updatedFlags.alias);
49
+ config.alias = updatedFlags.alias;
50
+ } catch (error) {
51
+ this.error(
52
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
53
+ { exit: 2 },
54
+ );
55
+ }
56
+ } else if (updatedFlags['stack-api-key']) {
57
+ config.stackApiKey = updatedFlags['stack-api-key'];
58
+ } else {
59
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
60
+ }
61
+ if (!updatedFlags.deliveryToken) {
62
+ updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment');
63
+ }
64
+ updatedFlags.bulkUnpublish = updatedFlags.bulkUnpublish === 'false' ? false : true;
62
65
  stack = await getStack(config);
63
66
  }
64
67
  if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
@@ -161,6 +164,10 @@ UnpublishCommand.flags = {
161
164
  char: 'a',
162
165
  description: 'Alias(name) for the management token',
163
166
  }),
167
+ 'stack-api-key': flags.string({
168
+ char: 'k',
169
+ description: 'Stack api key to be used',
170
+ }),
164
171
  environment: flags.string({
165
172
  char: 'e',
166
173
  description: 'Source Environment',
@@ -277,6 +284,9 @@ UnpublishCommand.examples = [
277
284
  '',
278
285
  'Using --branch flag',
279
286
  'csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]',
287
+ '',
288
+ 'Using --stack-api-key flag',
289
+ 'csdx cm:stacks:unpublish --bulk-unpublish --content-type [CONTENT TYPE] --environment [SOURCE ENV] --locale [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]',
280
290
  ];
281
291
 
282
292
  UnpublishCommand.aliases = ['cm:bulk-publish:unpublish'];
@@ -24,27 +24,29 @@ async function publishOnlyUnpublishedService(UnpublishedEntriesCommand) {
24
24
  if (validate.apply(this, [updatedFlags])) {
25
25
  let stack;
26
26
  if (!updatedFlags.retryFailed) {
27
- if (!updatedFlags.alias) {
28
- updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
29
- }
30
- updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true;
31
- // Validate management token alias.
32
- try {
33
- this.getToken(updatedFlags.alias);
34
- } catch (error) {
35
- this.error(
36
- `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
37
- { exit: 2 },
38
- );
39
- }
40
27
  config = {
41
28
  alias: updatedFlags.alias,
42
29
  host: this.cmaHost,
43
30
  cda: this.cdaHost,
44
31
  branch: unpublishedEntriesFlags.branch,
45
32
  };
46
- stack = await getStack(config);
33
+ if (updatedFlags.alias) {
34
+ try {
35
+ this.getToken(updatedFlags.alias);
36
+ } catch (error) {
37
+ this.error(
38
+ `The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
39
+ { exit: 2 },
40
+ );
41
+ }
42
+ } else if (updatedFlags['stack-api-key']) {
43
+ config.stackApiKey = updatedFlags['stack-api-key'];
44
+ } else {
45
+ this.error('Please use `--alias` or `--stack-api-key` to proceed.', { exit: 2 });
46
+ }
47
47
  }
48
+ updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true;
49
+ stack = await getStack(config);
48
50
  if (await confirmFlags(updatedFlags)) {
49
51
  try {
50
52
  if (!updatedFlags.retryFailed) {