@contentstack/cli 2.0.0-beta.12 → 2.0.0-beta.14

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
18
18
  $ csdx COMMAND
19
19
  running command...
20
20
  $ csdx (--version|-v)
21
- @contentstack/cli/2.0.0-beta.12 linux-x64 node-v22.22.0
21
+ @contentstack/cli/2.0.0-beta.14 darwin-arm64 node-v22.13.1
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -41,6 +41,8 @@ USAGE
41
41
  * [`csdx cm:branches:delete [-uid <value>] [-k <value>]`](#csdx-cmbranchesdelete--uid-value--k-value)
42
42
  * [`csdx cm:branches:diff [--base-branch <value>] [--compare-branch <value>] [-k <value>][--module <value>] [--format <value>] [--csv-path <value>]`](#csdx-cmbranchesdiff---base-branch-value---compare-branch-value--k-value--module-value---format-value---csv-path-value)
43
43
  * [`csdx cm:branches:merge [-k <value>][--compare-branch <value>] [--no-revert] [--export-summary-path <value>] [--use-merge-summary <value>] [--comment <value>] [--base-branch <value>]`](#csdx-cmbranchesmerge--k-value--compare-branch-value---no-revert---export-summary-path-value---use-merge-summary-value---comment-value---base-branch-value)
44
+ * [`csdx cm:export-to-csv`](#csdx-cmexport-to-csv)
45
+ * [`csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value---config-file-value---config-value---multiple)
44
46
  * [`csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent)
45
47
  * [`csdx cm:stacks:audit`](#csdx-cmstacksaudit)
46
48
  * [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix)
@@ -50,6 +52,7 @@ USAGE
50
52
  * [`csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`](#csdx-cmstacksexport---config-value---stack-api-key-value---data-dir-value---alias-value---module-value---content-types-value---branch-value---secured-assets)
51
53
  * [`csdx cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksimport---config-value---stack-api-key-value---data-dir-value---alias-value---module-value---backup-dir-value---branch-value---import-webhook-status-disablecurrent)
52
54
  * [`csdx cm:stacks:import-setup [-k <value>] [-d <value>] [-a <value>] [--modules <value,value>]`](#csdx-cmstacksimport-setup--k-value--d-value--a-value---modules-valuevalue)
55
+ * [`csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`](#csdx-cmstacksmigration--k-value--a-value---file-path-value---branch-value---config-file-value---config-value---multiple)
53
56
  * [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [--yes <value>] [--alias <value>] [--locale <value>]`](#csdx-cmstacksseed---repo-value---org-value---stack-api-key-value---stack-name-value---yes-value---alias-value---locale-value)
54
57
  * [`csdx config:get:base-branch`](#csdx-configgetbase-branch)
55
58
  * [`csdx config:get:ea-header`](#csdx-configgetea-header)
@@ -489,6 +492,142 @@ EXAMPLES
489
492
 
490
493
  _See code: [@contentstack/cli-cm-branches](https://github.com/contentstack/cli/blob/main/packages/contentstack-export/src/commands/cm/branches/merge.ts)_
491
494
 
495
+ ## `csdx cm:export-to-csv`
496
+
497
+ Export entries, taxonomies, terms or organization users to csv using this command
498
+
499
+ ```
500
+ USAGE
501
+ $ csdx cm:export-to-csv [--action entries|users|teams|taxonomies] [-a <value>] [--org <value>] [-n <value>] [-k
502
+ <value>] [--org-name <value>] [--locale <value>] [--content-type <value>] [--branch <value>] [--team-uid <value>]
503
+ [--taxonomy-uid <value>] [--include-fallback] [--fallback-locale <value>] [--delimiter <value>]
504
+
505
+ FLAGS
506
+ -a, --alias=<value> Alias of the management token.
507
+ -k, --stack-api-key=<value> API Key of the source stack.
508
+ -n, --stack-name=<value> Name of the stack that needs to be created as CSV filename.
509
+ --action=<option> Option to export data (entries, users, teams, taxonomies). <options:
510
+ entries|users|teams|taxonomies>
511
+ <options: entries|users|teams|taxonomies>
512
+ --branch=<value> Branch from which entries will be exported.
513
+ --content-type=<value> Content type of entries that will be exported.
514
+ --delimiter=<value> [default: ,] [optional] Provide a delimiter to separate individual data fields within
515
+ the CSV file. For example: cm:export-to-csv --delimiter '|'
516
+ --fallback-locale=<value> [Optional] Specify a specific fallback locale for taxonomy export. This locale will be
517
+ used when a taxonomy term doesn't exist in the primary locale. Takes priority over
518
+ branch fallback hierarchy when both are specified.
519
+ --include-fallback [Optional] Include fallback locale data when exporting taxonomies. When enabled, if a
520
+ taxonomy term doesn't exist in the specified locale, it will fallback to the hierarchy
521
+ defined in the branch settings.
522
+ --locale=<value> Locale of entries that will be exported.
523
+ --org=<value> Provide organization UID to clone org users.
524
+ --org-name=<value> Name of the organization that needs to be created as CSV filename.
525
+ --taxonomy-uid=<value> Provide the taxonomy UID of the related terms you want to export.
526
+ --team-uid=<value> Provide the UID of a specific team in an organization.
527
+
528
+ DESCRIPTION
529
+ Export entries, taxonomies, terms or organization users to csv using this command
530
+
531
+ ALIASES
532
+ $ csdx cm:export-to-csv
533
+
534
+ EXAMPLES
535
+ $ csdx cm:export-to-csv
536
+
537
+
538
+
539
+ Exporting entries to CSV
540
+
541
+ $ csdx cm:export-to-csv --action entries --locale <locale> --alias <management-token-alias> --content-type <content-type>
542
+
543
+
544
+
545
+ Exporting entries to CSV with stack name and branch
546
+
547
+ $ csdx cm:export-to-csv --action entries --locale <locale> --alias <management-token-alias> --content-type <content-type> --stack-name <stack-name> --branch <branch-name>
548
+
549
+
550
+
551
+ Exporting organization users to CSV
552
+
553
+ $ csdx cm:export-to-csv --action users --org <org-uid>
554
+
555
+
556
+
557
+ Exporting organization teams to CSV
558
+
559
+ $ csdx cm:export-to-csv --action teams --org <org-uid>
560
+
561
+
562
+
563
+ Exporting teams with specific team UID
564
+
565
+ $ csdx cm:export-to-csv --action teams --org <org-uid> --team-uid <team-uid>
566
+
567
+
568
+
569
+ Exporting taxonomies to CSV
570
+
571
+ $ csdx cm:export-to-csv --action taxonomies --alias <management-token-alias>
572
+
573
+
574
+
575
+ Exporting specific taxonomy with locale
576
+
577
+ $ csdx cm:export-to-csv --action taxonomies --alias <management-token-alias> --taxonomy-uid <taxonomy-uid> --locale <locale>
578
+
579
+
580
+
581
+ Exporting taxonomies with fallback locale
582
+
583
+ $ csdx cm:export-to-csv --action taxonomies --alias <management-token-alias> --locale <locale> --include-fallback --fallback-locale <fallback-locale>
584
+ ```
585
+
586
+ _See code: [@contentstack/cli-cm-export-to-csv](https://github.com/contentstack/cli/blob/main/packages/contentstack-export-to-csv/src/commands/cm/export-to-csv.ts)_
587
+
588
+ ## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
589
+
590
+ Contentstack migration script.
591
+
592
+ ```
593
+ USAGE
594
+ $ csdx cm:migration cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>]
595
+ [--config-file <value>] [--config <value>] [--multiple]
596
+
597
+ FLAGS
598
+ -a, --alias=<value> Use this flag to add the management token alias. You must use either the --alias flag or
599
+ the --stack-api-key flag.
600
+ -k, --stack-api-key=<value> Use this flag to add the API key of your stack. You must use either the --stack-api-key
601
+ flag or the --alias flag.
602
+ --branch=<value> Use this flag to add the branch name where you want to perform the migration. (target
603
+ branch name)
604
+ --config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes
605
+ the script re-usable.
606
+ --config-file=<value> [optional] Path of the JSON configuration file.
607
+ --file-path=<value> Use this flag to provide the path of the file of the migration script.
608
+ --multiple This flag helps you to migrate multiple content files in a single instance. Mention the
609
+ folder path where your migration script files are stored.
610
+
611
+ DESCRIPTION
612
+ Contentstack migration script.
613
+
614
+ ALIASES
615
+ $ csdx cm:migration
616
+
617
+ EXAMPLES
618
+ $ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>
619
+
620
+ $ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
621
+
622
+ $ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
623
+
624
+ $ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
625
+
626
+ $ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
627
+
628
+ $ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
629
+ ```
630
+
492
631
  ## `csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`
493
632
 
494
633
  Clone data (structure/content or both) of a stack into another stack
@@ -715,7 +854,7 @@ EXAMPLES
715
854
  $ csdx cm:stacks:bulk-assets --revert ./bulk-operation -a myAlias
716
855
  ```
717
856
 
718
- _See code: [@contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations/blob/v1.0.0-beta/src/commands/cm/stacks/bulk-assets.ts)_
857
+ _See code: [@contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations/blob/v1.0.0/src/commands/cm/stacks/bulk-assets.ts)_
719
858
 
720
859
  ## `csdx cm:stacks:bulk-entries`
721
860
 
@@ -788,6 +927,12 @@ EXAMPLES
788
927
 
789
928
  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --filter modified -k blt123
790
929
 
930
+ $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --filter draft -k blt123
931
+
932
+ $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --filter unpublished -k blt123
933
+
934
+ $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --filter non-localized -k blt123
935
+
791
936
  $ csdx cm:stacks:bulk-entries --operation publish --content-types blog --environments prod --locales en-us --include-variants -k blt123
792
937
 
793
938
  $ csdx cm:stacks:bulk-entries --retry-failed ./bulk-operation
@@ -795,7 +940,7 @@ EXAMPLES
795
940
  $ csdx cm:stacks:bulk-entries --revert ./bulk-operation
796
941
  ```
797
942
 
798
- _See code: [@contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations/blob/v1.0.0-beta/src/commands/cm/stacks/bulk-entries.ts)_
943
+ _See code: [@contentstack/cli-bulk-operations](https://github.com/contentstack/cli-bulk-operations/blob/v1.0.0/src/commands/cm/stacks/bulk-entries.ts)_
799
944
 
800
945
  ## `csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`
801
946
 
@@ -1028,6 +1173,51 @@ EXAMPLES
1028
1173
 
1029
1174
  _See code: [@contentstack/cli-cm-import-setup](https://github.com/contentstack/cli/blob/main/packages/contentstack-import-setup/src/commands/cm/stacks/import-setup.ts)_
1030
1175
 
1176
+ ## `csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>] [--config <value>] [--multiple]`
1177
+
1178
+ Contentstack migration script.
1179
+
1180
+ ```
1181
+ USAGE
1182
+ $ csdx cm:stacks:migration [-k <value>] [-a <value>] [--file-path <value>] [--branch <value>] [--config-file <value>]
1183
+ [--config <value>] [--multiple]
1184
+
1185
+ FLAGS
1186
+ -a, --alias=<value> Use this flag to add the management token alias. You must use either the --alias flag or
1187
+ the --stack-api-key flag.
1188
+ -k, --stack-api-key=<value> Use this flag to add the API key of your stack. You must use either the --stack-api-key
1189
+ flag or the --alias flag.
1190
+ --branch=<value> Use this flag to add the branch name where you want to perform the migration. (target
1191
+ branch name)
1192
+ --config=<value>... [optional] Inline configuration, <key1>:<value1>. Passing an external configuration makes
1193
+ the script re-usable.
1194
+ --config-file=<value> [optional] Path of the JSON configuration file.
1195
+ --file-path=<value> Use this flag to provide the path of the file of the migration script.
1196
+ --multiple This flag helps you to migrate multiple content files in a single instance. Mention the
1197
+ folder path where your migration script files are stored.
1198
+
1199
+ DESCRIPTION
1200
+ Contentstack migration script.
1201
+
1202
+ ALIASES
1203
+ $ csdx cm:migration
1204
+
1205
+ EXAMPLES
1206
+ $ csdx cm:migration --file-path <migration/script/file/path> -k <api-key>
1207
+
1208
+ $ csdx cm:migration --file-path <migration/script/file/path> -k <api-key> --branch <target branch name>
1209
+
1210
+ $ csdx cm:migration --config <key1>:<value1> <key2>:<value2> ... --file-path <migration/script/file/path>
1211
+
1212
+ $ csdx cm:migration --config-file <path/to/json/config/file> --file-path <migration/script/file/path>
1213
+
1214
+ $ csdx cm:migration --multiple --file-path <migration/scripts/dir/path>
1215
+
1216
+ $ csdx cm:migration --alias <management-token-alias> --file-path <migration/script/file/path>
1217
+ ```
1218
+
1219
+ _See code: [@contentstack/cli-migration](https://github.com/contentstack/cli/blob/main/packages/contentstack-migration/src/commands/cm/stacks/migration.ts)_
1220
+
1031
1221
  ## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [--yes <value>] [--alias <value>] [--locale <value>]`
1032
1222
 
1033
1223
  Create a stack from existing content types, entries, assets, etc
@@ -1470,23 +1660,25 @@ Set region for CLI
1470
1660
  ```
1471
1661
  USAGE
1472
1662
  $ csdx config:set:region [REGION] [--cda <value> --cma <value> --ui-host <value> -n <value>] [--developer-hub
1473
- <value>] [--personalize <value>] [--launch <value>] [--studio <value>]
1663
+ <value>] [--personalize <value>] [--launch <value>] [--studio <value>] [--asset-management <value>]
1474
1664
 
1475
1665
  ARGUMENTS
1476
1666
  [REGION] Name for the region
1477
1667
 
1478
1668
  FLAGS
1479
- -n, --name=<value> Name for the region, if this flag is added then cda, cma and ui-host flags are required
1480
- --cda=<value> Custom host to set for content delivery API, if this flag is added then cma, ui-host and
1481
- name flags are required
1482
- --cma=<value> Custom host to set for content management API, , if this flag is added then cda, ui-host
1483
- and name flags are required
1484
- --developer-hub=<value> Custom host to set for Developer hub API
1485
- --launch=<value> Custom host to set for Launch API
1486
- --personalize=<value> Custom host to set for Personalize API
1487
- --studio=<value> Custom host to set for Studio API
1488
- --ui-host=<value> Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are
1489
- required
1669
+ -n, --name=<value> Name for the region, if this flag is added then cda, cma and ui-host flags are
1670
+ required
1671
+ --asset-management=<value> Custom host to set for Asset Management API
1672
+ --cda=<value> Custom host to set for content delivery API, if this flag is added then cma, ui-host
1673
+ and name flags are required
1674
+ --cma=<value> Custom host to set for content management API, , if this flag is added then cda,
1675
+ ui-host and name flags are required
1676
+ --developer-hub=<value> Custom host to set for Developer hub API
1677
+ --launch=<value> Custom host to set for Launch API
1678
+ --personalize=<value> Custom host to set for Personalize API
1679
+ --studio=<value> Custom host to set for Studio API
1680
+ --ui-host=<value> Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are
1681
+ required
1490
1682
 
1491
1683
  DESCRIPTION
1492
1684
  Set region for CLI
@@ -1518,6 +1710,8 @@ EXAMPLES
1518
1710
 
1519
1711
  $ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --studio <custom_studio_url>
1520
1712
 
1713
+ $ csdx config:set:region --cma <custom_cma_host_url> --cda <custom_cda_host_url> --ui-host <custom_ui_host_url> --name "India" --asset-management <asset_management_url>
1714
+
1521
1715
  $ csdx config:set:region --cda <custom_cda_host_url> --cma <custom_cma_host_url> --ui-host <custom_ui_host_url> --name "India" --developer-hub <custom_developer_hub_url> --launch <custom_launch_url> --personalize <custom_personalize_url> --studio <custom_studio_url>
1522
1716
  ```
1523
1717
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli",
3
3
  "description": "Command-line tool (CLI) to interact with Contentstack",
4
- "version": "2.0.0-beta.12",
4
+ "version": "2.0.0-beta.14",
5
5
  "author": "Contentstack",
6
6
  "bin": {
7
7
  "csdx": "./bin/run.js"
@@ -9,8 +9,8 @@
9
9
  "main": "lib/index.js",
10
10
  "types": "lib/index.d.ts",
11
11
  "scripts": {
12
- "build": "npm run clean && npm run compile",
13
- "clean": "rm -rf ./lib ./node_modules tsconfig.build.tsbuildinfo",
12
+ "build": "pnpm compile && oclif manifest && oclif readme",
13
+ "clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo",
14
14
  "compile": "tsc -b tsconfig.json",
15
15
  "postpack": "rm -f oclif.manifest.json",
16
16
  "version": "oclif readme && git add README.md",
@@ -22,24 +22,24 @@
22
22
  "prepack": "pnpm compile && oclif manifest && oclif readme"
23
23
  },
24
24
  "dependencies": {
25
- "@contentstack/cli-audit": "~2.0.0-beta.4",
26
- "@contentstack/cli-cm-export": "~2.0.0-beta.9",
27
- "@contentstack/cli-cm-import": "~2.0.0-beta.9",
28
- "@contentstack/cli-auth": "~2.0.0-beta.5",
29
- "@contentstack/cli-bulk-operations": "^1.0.0-beta",
30
- "@contentstack/cli-cm-bootstrap": "~2.0.0-beta.9",
31
- "@contentstack/cli-cm-branches": "~2.0.0-beta",
32
- "@contentstack/cli-cm-clone": "~2.0.0-beta.10",
33
- "@contentstack/cli-cm-export-to-csv": "~2.0.0-beta",
34
- "@contentstack/cli-cm-import-setup": "~2.0.0-beta.4",
35
- "@contentstack/cli-cm-seed": "~2.0.0-beta.8",
36
- "@contentstack/cli-command": "~2.0.0-beta",
37
- "@contentstack/cli-config": "~2.0.0-beta.1",
25
+ "@contentstack/cli-audit": "~2.0.0-beta.6",
26
+ "@contentstack/cli-cm-export": "~2.0.0-beta.11",
27
+ "@contentstack/cli-cm-import": "~2.0.0-beta.11",
28
+ "@contentstack/cli-auth": "~2.0.0-beta.7",
29
+ "@contentstack/cli-bulk-operations": "^1.0.0",
30
+ "@contentstack/cli-cm-bootstrap": "~2.0.0-beta.11",
31
+ "@contentstack/cli-cm-branches": "~2.0.0-beta.2",
32
+ "@contentstack/cli-cm-clone": "~2.0.0-beta.12",
33
+ "@contentstack/cli-cm-export-to-csv": "~2.0.0-beta.2",
34
+ "@contentstack/cli-cm-import-setup": "~2.0.0-beta.6",
35
+ "@contentstack/cli-cm-seed": "~2.0.0-beta.10",
36
+ "@contentstack/cli-command": "~2.0.0-beta.2",
37
+ "@contentstack/cli-config": "~2.0.0-beta.3",
38
38
  "@contentstack/cli-launch": "^1.9.6",
39
- "@contentstack/cli-migration": "~2.0.0-beta.5",
40
- "@contentstack/cli-utilities": "~2.0.0-beta",
41
- "@contentstack/cli-variants": "~2.0.0-beta.5",
42
- "@contentstack/management": "~1.27.5",
39
+ "@contentstack/cli-migration": "~2.0.0-beta.7",
40
+ "@contentstack/cli-utilities": "~2.0.0-beta.2",
41
+ "@contentstack/cli-variants": "~2.0.0-beta.8",
42
+ "@contentstack/management": "~1.27.6",
43
43
  "@contentstack/utils": "~1.7.0",
44
44
  "@oclif/core": "^4.8.0",
45
45
  "@oclif/plugin-help": "^6.2.37",
@@ -167,4 +167,4 @@
167
167
  }
168
168
  },
169
169
  "repository": "https://github.com/contentstack/cli"
170
- }
170
+ }
@@ -1,8 +0,0 @@
1
- declare const _default: {
2
- logger: {
3
- level: string;
4
- silent: boolean;
5
- };
6
- commandRegexPattern: RegExp;
7
- };
8
- export default _default;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- logger: {
5
- level: 'error',
6
- silent: false,
7
- },
8
- commandRegexPattern: /^(config|auth)+:/,
9
- };
package/lib/help.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { Help } from '@contentstack/cli-utilities';
2
- export default class MyHelpClass extends Help {
3
- constructor(config: any, opts: any);
4
- showRootHelp(): any;
5
- showCommandHelp(command: any): any;
6
- formatCommands(commands: any): string;
7
- }
package/lib/help.js DELETED
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const figlet = tslib_1.__importStar(require("figlet"));
5
- const cli_utilities_1 = require("@contentstack/cli-utilities");
6
- class MyHelpClass extends cli_utilities_1.Help {
7
- constructor(config, opts) {
8
- super(config, opts);
9
- }
10
- showRootHelp() {
11
- // Shows Contentstack graphics
12
- cli_utilities_1.cliux.print(figlet.textSync('Contentstack', {
13
- horizontalLayout: 'default',
14
- verticalLayout: 'default',
15
- }));
16
- super.showRootHelp();
17
- }
18
- showCommandHelp(command) {
19
- if (command.id === 'cm:bulk-publish') {
20
- let { context: { plugin: { commands = [] } = {} } = {} } = this.config;
21
- commands = commands.map((c) => {
22
- return Object.assign(Object.assign({}, c), { name: c.id });
23
- });
24
- const title = command.description && this.render(command.description).split('\n')[0];
25
- if (title)
26
- console.log(title + '\n');
27
- console.log(this.formatCommand(command));
28
- console.log('');
29
- if (commands.length > 0) {
30
- console.log(this.formatCommands(commands));
31
- console.log('');
32
- }
33
- return;
34
- }
35
- super.showCommandHelp(command);
36
- }
37
- formatCommands(commands) {
38
- if (commands.length === 0)
39
- return '';
40
- const body = this.renderList(commands
41
- // if aliases do not contain the current command's id it is the main command
42
- .filter(c => !c.aliases.some(a => a === c.id))
43
- .map(c => {
44
- if (this.config.topicSeparator !== ':')
45
- c.id = c.id.replace(/:/g, this.config.topicSeparator);
46
- // Add aliases at the end of summary
47
- const summary = c.aliases.length > 0 ? `${this.summary(c)} (ALIASES: ${c.aliases.join(', ')})` : this.summary(c);
48
- return [c.id, summary];
49
- }), {
50
- spacer: '\n',
51
- stripAnsi: this.opts.stripAnsi,
52
- indentation: 2
53
- });
54
- return this.section('COMMANDS', body);
55
- }
56
- }
57
- exports.default = MyHelpClass;
@@ -1,4 +0,0 @@
1
- /**
2
- * Set the cli context
3
- */
4
- export default function (opts: any): void;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../utils");
4
- const cli_utilities_1 = require("@contentstack/cli-utilities");
5
- /**
6
- * Set the cli context
7
- */
8
- function default_1(opts) {
9
- // Store command ID for session-based log organization
10
- if (opts.id) {
11
- cli_utilities_1.configHandler.set('currentCommandId', opts.id);
12
- }
13
- this.config.context = new utils_1.CsdxContext(opts, this.config);
14
- }
15
- exports.default = default_1;
@@ -1,4 +0,0 @@
1
- /**
2
- * Initialize the utilities
3
- */
4
- export default function (_opts: any): void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_utilities_1 = require("@contentstack/cli-utilities");
4
- /**
5
- * Initialize the utilities
6
- */
7
- function default_1(_opts) {
8
- const { context } = this.config;
9
- cli_utilities_1.messageHandler.init(context);
10
- cli_utilities_1.cliux.init(context);
11
- cli_utilities_1.managementSDKInitiator.init(context);
12
- cli_utilities_1.marketplaceSDKInitiator.init(context);
13
- }
14
- exports.default = default_1;
@@ -1 +0,0 @@
1
- export default function (opts: any): Promise<void>;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_utilities_1 = require("@contentstack/cli-utilities");
4
- // TBD: run region command if region is not there
5
- async function default_1(opts) {
6
- const { context: { plugin: { config: { protectedCommands = {} } = {} } = {}, region = null } = {} } = this.config;
7
- if (opts.Command.id !== 'config:set:region') {
8
- if (!region) {
9
- cli_utilities_1.cliux.error('No region found, please set a region $config:set:region');
10
- this.exit();
11
- return;
12
- }
13
- cli_utilities_1.cliux.print(`Currently using region: ${region.name}`, { color: 'grey' });
14
- }
15
- // Auth guard
16
- if (protectedCommands[opts.Command.id]) {
17
- if (!(0, cli_utilities_1.isAuthenticated)()) {
18
- (0, cli_utilities_1.handleAndLogError)(new Error('Authentication required for this command'), { module: 'auth-guard', commandId: opts.Command.id });
19
- cli_utilities_1.cliux.error('Please log in to execute the command');
20
- this.exit();
21
- }
22
- const client = await (0, cli_utilities_1.managementSDKClient)({ host: region.cma });
23
- try {
24
- const result = await client.getUser();
25
- if (!result) {
26
- (0, cli_utilities_1.handleAndLogError)(new Error('Error in auth validation'), { module: 'auth-guard' });
27
- cli_utilities_1.cliux.error('Please log in to execute the command');
28
- this.exit();
29
- }
30
- cli_utilities_1.log.debug('Logged-in user', { module: 'auth-guard', userData: result.data });
31
- }
32
- catch (error) {
33
- (0, cli_utilities_1.handleAndLogError)(error, { module: 'auth-guard' }, 'Error in auth validation');
34
- cli_utilities_1.cliux.error('Please log in to execute the command');
35
- process.exit();
36
- }
37
- }
38
- }
39
- exports.default = default_1;
@@ -1 +0,0 @@
1
- export default function (): void;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cli_utilities_1 = require("@contentstack/cli-utilities");
4
- function default_1() {
5
- const rateLimit = cli_utilities_1.configHandler.get('rateLimit');
6
- if (!(rateLimit === null || rateLimit === void 0 ? void 0 : rateLimit.default)) {
7
- const defaultPlan = {
8
- getLimit: { value: 10, utilize: 50 },
9
- limit: { value: 10, utilize: 50 },
10
- bulkLimit: { value: 1, utilize: 50 },
11
- };
12
- cli_utilities_1.configHandler.set('rateLimit', { default: defaultPlan });
13
- cli_utilities_1.cliux.print(`Default rate limit configuration is set to ${JSON.stringify(defaultPlan)}. Please use this command csdx config:set:rate-limit to set the custom rate limit config.`, { color: 'blue' });
14
- }
15
- }
16
- exports.default = default_1;
@@ -1 +0,0 @@
1
- export default function (_opts: any): Promise<void>;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const cli_utilities_1 = require("@contentstack/cli-utilities");
5
- const semver = tslib_1.__importStar(require("semver"));
6
- const versionUpgradeWarningFrequency = {
7
- versionSyncDuration: 3 * 24 * 60 * 60 * 1000, // 3 days
8
- };
9
- async function default_1(_opts) {
10
- var _a, _b;
11
- const now = Date.now();
12
- const today = new Date().toISOString().split('T')[0];
13
- let cache = { lastChecked: 0, lastWarnedDate: '', latestVersion: '' };
14
- // if CLI_VERSION is not set or is not the same as the current version, set it
15
- if (!cli_utilities_1.configHandler.get('CLI_VERSION') || cli_utilities_1.configHandler.get('CLI_VERSION') !== this.config.version) {
16
- cli_utilities_1.configHandler.set('CLI_VERSION', this.config.version); // set current version in configHandler
17
- }
18
- if (!cli_utilities_1.configHandler.get('versionUpgradeWarningFrequency')) {
19
- cli_utilities_1.configHandler.set('versionUpgradeWarningFrequency', versionUpgradeWarningFrequency);
20
- }
21
- const versionUpgradeWarningFrequencyConfig = cli_utilities_1.configHandler.get('versionUpgradeWarningFrequency');
22
- // Load cache if it exists
23
- if (cli_utilities_1.configHandler.get('versionUpgradeWarningCache')) {
24
- cache = cli_utilities_1.configHandler.get('versionUpgradeWarningCache');
25
- }
26
- // Perform update check if needed
27
- const httpClient = new cli_utilities_1.HttpClient();
28
- if (now - cache.lastChecked > versionUpgradeWarningFrequencyConfig.versionSyncDuration) {
29
- try {
30
- const latestVersion = (_b = (_a = (await httpClient.get(`https://registry.npmjs.org/@contentstack/cli/latest`))) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.version;
31
- if (!latestVersion) {
32
- (0, cli_utilities_1.handleAndLogError)(new Error('Failed to retrieve the latest version from the registry.'), { module: 'latest-version-warning' });
33
- return;
34
- }
35
- cache.latestVersion = latestVersion;
36
- cache.lastChecked = now;
37
- // Save updated cache
38
- cli_utilities_1.configHandler.set('versionUpgradeWarningCache', cache);
39
- }
40
- catch (error) {
41
- (0, cli_utilities_1.handleAndLogError)(error, { module: 'latest-version-warning' }, 'Failed to check the latest version');
42
- return;
43
- }
44
- }
45
- // Show warning if an update is available and last warning was yesterday
46
- if (semver.gt(cache.latestVersion, this.config.version) && cache.lastWarnedDate !== today) {
47
- cli_utilities_1.cliux.print(`You are not using the most recent CLI release. Please update to the latest version for an improved experience.`, { color: 'yellow' });
48
- // Update the last warned timestamp
49
- cache.lastWarnedDate = today;
50
- cli_utilities_1.configHandler.set('versionUpgradeWarningCache', cache);
51
- }
52
- }
53
- exports.default = default_1;
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const _default: "@oclif/core";
2
- export default _default;
package/lib/index.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '@oclif/core';
@@ -1,39 +0,0 @@
1
- import { Config, Plugin } from '@contentstack/cli-utilities';
2
- export interface PrintOptions {
3
- color?: string;
4
- }
5
- export interface InquirePayload {
6
- type: string;
7
- name: string;
8
- message: string;
9
- choices?: Array<any>;
10
- transformer?: Function;
11
- }
12
- export interface Region {
13
- name: string;
14
- cma: string;
15
- cda: string;
16
- }
17
- export interface Context {
18
- id: string;
19
- user: {
20
- authtoken: string;
21
- email: string;
22
- };
23
- region: any;
24
- plugin: Plugin;
25
- config: any;
26
- info: any;
27
- messageFilePath: any;
28
- }
29
- export interface CLIConfig extends Config {
30
- context: Context;
31
- }
32
- export interface IVersionUpgradeCache {
33
- lastChecked: number;
34
- lastWarnedDate: string;
35
- latestVersion: string;
36
- }
37
- export interface IVersionUpgradeWarningFrequency {
38
- versionSyncDuration: number;
39
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- export default class CsdxContext {
2
- readonly sessionId: string;
3
- readonly clientId: string;
4
- readonly user?: object;
5
- readonly region?: object;
6
- readonly config: object;
7
- readonly info: any;
8
- readonly plugin: any;
9
- readonly pluginConfig: any;
10
- readonly messageFilePath: string;
11
- readonly analyticsInfo: string;
12
- flagWarningPrintState: any;
13
- flags: any;
14
- cliVersion: string;
15
- constructor(cliOpts: any, cliConfig: any);
16
- getToken(alias: string): any;
17
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const shortUUID = tslib_1.__importStar(require("short-uuid"));
5
- const path = tslib_1.__importStar(require("path"));
6
- const cli_utilities_1 = require("@contentstack/cli-utilities");
7
- const node_machine_id_1 = require("node-machine-id");
8
- class CsdxContext {
9
- constructor(cliOpts, cliConfig) {
10
- var _a, _b, _c;
11
- const analyticsInfo = [];
12
- const command = cliConfig.findCommand(cliOpts.id) || {};
13
- const config = cli_utilities_1.configHandler;
14
- const platform = cliConfig.platform && cliConfig.arch ? `${cliConfig.platform}-${cliConfig.arch}` : 'none';
15
- analyticsInfo.push(platform);
16
- const nodeVersion = process.versions.node ? `v${process.versions.node}` : process.version;
17
- analyticsInfo.push(nodeVersion || 'none');
18
- analyticsInfo.push(cliConfig.version || 'none');
19
- this.clientId = cli_utilities_1.configHandler.get('clientId');
20
- if (!this.clientId) {
21
- this.clientId = (0, node_machine_id_1.machineIdSync)(true);
22
- cli_utilities_1.configHandler.set('clientId', this.clientId);
23
- }
24
- analyticsInfo.push(this.clientId);
25
- const sessionId = shortUUID.generate();
26
- cli_utilities_1.configHandler.set('sessionId', sessionId);
27
- this.sessionId = sessionId;
28
- analyticsInfo.push(this.sessionId);
29
- this.user = {
30
- authtoken: cli_utilities_1.configHandler.get('authtoken'),
31
- email: cli_utilities_1.configHandler.get('email'),
32
- };
33
- this.config = Object.assign({}, config);
34
- this.cliVersion = cliConfig.version;
35
- this.region = cli_utilities_1.configHandler.get('region');
36
- this.info = { command: cliOpts.id };
37
- if (command.pluginName) {
38
- this.plugin = (cliConfig.plugins || new Map()).get(command.pluginName) || {};
39
- this.plugin.name = command.pluginName;
40
- this.plugin.config = Object.assign({}, ((this.plugin.pjson && this.plugin.pjson.csdxConfig) || {}));
41
- this.messageFilePath = (0, cli_utilities_1.pathValidator)(path.resolve((0, cli_utilities_1.sanitizePath)(this.plugin.root), (0, cli_utilities_1.sanitizePath)(this.plugin.config.messageFilePath) || './messages/index.json'));
42
- this.info.shortCommandName = (_c = (_b = (_a = this.plugin) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.shortCommandName) === null || _c === void 0 ? void 0 : _c[cliOpts.id];
43
- analyticsInfo.push(this.info.shortCommandName || cliOpts.id);
44
- }
45
- this.flagWarningPrintState = {};
46
- this.analyticsInfo = analyticsInfo.join(';');
47
- }
48
- getToken(alias) {
49
- if (alias) {
50
- const token = cli_utilities_1.configHandler.get(`tokens.${alias}`);
51
- if (token)
52
- return token;
53
- }
54
- }
55
- }
56
- exports.default = CsdxContext;
@@ -1 +0,0 @@
1
- export { default as CsdxContext } from './context-handler';
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CsdxContext = void 0;
7
- var context_handler_1 = require("./context-handler");
8
- Object.defineProperty(exports, "CsdxContext", { enumerable: true, get: function () { return __importDefault(context_handler_1).default; } });
@@ -1,4 +0,0 @@
1
- {
2
- "commands": {},
3
- "version": "2.0.0-beta.12"
4
- }