contensis-cli 1.4.1-beta.1 → 1.4.2-beta.0
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/CHANGELOG.md +8 -0
- package/README.md +360 -1
- package/dist/commands/create.js +83 -2
- package/dist/commands/create.js.map +2 -2
- package/dist/commands/get.js +33 -1
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/import.js +62 -0
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/list.js +48 -1
- package/dist/commands/list.js.map +2 -2
- package/dist/commands/remove.js +50 -1
- package/dist/commands/remove.js.map +2 -2
- package/dist/localisation/en-GB.js +38 -8
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/providers/HttpProvider.js +4 -4
- package/dist/providers/HttpProvider.js.map +2 -2
- package/dist/providers/ManifestProvider.js +2 -2
- package/dist/providers/ManifestProvider.js.map +2 -2
- package/dist/providers/SessionCacheProvider.js +6 -3
- package/dist/providers/SessionCacheProvider.js.map +2 -2
- package/dist/providers/file-provider.js +2 -2
- package/dist/providers/file-provider.js.map +2 -2
- package/dist/services/ContensisCliService.js +370 -22
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/shell.js +14 -1
- package/dist/shell.js.map +2 -2
- package/dist/util/assert.js +62 -0
- package/dist/util/assert.js.map +7 -0
- package/dist/util/index.js +11 -36
- package/dist/util/index.js.map +2 -2
- package/dist/util/logger.js +17 -6
- package/dist/util/logger.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/create.ts +118 -0
- package/src/commands/get.ts +48 -1
- package/src/commands/import.ts +86 -0
- package/src/commands/list.ts +80 -1
- package/src/commands/remove.ts +91 -1
- package/src/localisation/en-GB.ts +62 -9
- package/src/models/Cache.d.ts +2 -1
- package/src/providers/HttpProvider.ts +1 -1
- package/src/providers/ManifestProvider.ts +1 -1
- package/src/providers/SessionCacheProvider.ts +6 -1
- package/src/providers/file-provider.ts +1 -1
- package/src/services/ContensisCliService.ts +480 -24
- package/src/shell.ts +14 -1
- package/src/util/assert.ts +35 -0
- package/src/util/index.ts +15 -36
- package/src/util/logger.ts +18 -6
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.1](https://github.com/contensis/cli/compare/contensis-cli-v1.4.0...contensis-cli-v1.4.1) (2025-03-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* issue downloading assets from some environments in `import` commands and progress/error logging fixes when loading assets ([4c8852a](https://github.com/contensis/cli/commit/4c8852a2c0baec4859cb0f9939a5195d1a4130a6))
|
|
9
|
+
* missing environments.json error for new users ([1716094](https://github.com/contensis/cli/commit/171609437b1b483490578f53a499a6dae25855ea))
|
|
10
|
+
|
|
3
11
|
## [1.4.0](https://github.com/contensis/cli/compare/contensis-cli-v1.3.0...contensis-cli-v1.4.0) (2024-12-05)
|
|
4
12
|
|
|
5
13
|
|
package/README.md
CHANGED
|
@@ -246,6 +246,15 @@ contensis >
|
|
|
246
246
|
- [Get entries using the Delivery API](#get-entries-using-the-delivery-api)
|
|
247
247
|
- [Output results to a file](#output-results-to-a-file)
|
|
248
248
|
- [Format output](#format-output)
|
|
249
|
+
- [Manage tags and tag groups](#manage-tags-and-tag-groups)
|
|
250
|
+
- [List tag groups](#list-tag-groups)
|
|
251
|
+
- [List tags](#list-tags)
|
|
252
|
+
- [List tags in group](#list-tags-in-group)
|
|
253
|
+
- [Create tag group](#create-tag-group)
|
|
254
|
+
- [Create tags](#create-tags)
|
|
255
|
+
- [Create tags in group](#create-tags-in-group)
|
|
256
|
+
- [Remove tags](#remove-tags)
|
|
257
|
+
- [Remove tags in group](#remove-tags-in-group)
|
|
249
258
|
- [Manage API keys](#manage-api-keys)
|
|
250
259
|
- [List keys](#list-keys)
|
|
251
260
|
- [Create key](#create-key)
|
|
@@ -274,6 +283,7 @@ contensis >
|
|
|
274
283
|
- [Import content models](#import-content-models)
|
|
275
284
|
- [Import from another Contensis environment](#import-from-another-contensis-environment)
|
|
276
285
|
- [From a file](#from-a-file)
|
|
286
|
+
- [Import tags and groups](#import-tags-and-groups)
|
|
277
287
|
- [Import entries](#import-entries)
|
|
278
288
|
- [Import from another Contensis environment](#import-from-another-contensis-environment-1)
|
|
279
289
|
- [Import from a file](#import-from-a-file-1)
|
|
@@ -856,6 +866,283 @@ The `--format` and `--output` options are available with most commands (check co
|
|
|
856
866
|
|
|
857
867
|
Output will normally default to JSON when saved with the `--output` flag.
|
|
858
868
|
|
|
869
|
+
## Manage tags and tag groups
|
|
870
|
+
|
|
871
|
+
You can use the cli or shell to manage tags and groups that can be used to attach tags to content entries
|
|
872
|
+
|
|
873
|
+
### List tag groups
|
|
874
|
+
|
|
875
|
+
Separate collections of tags are organised and stored in tag groups. Each tag belongs to one tag group.
|
|
876
|
+
|
|
877
|
+
```shell
|
|
878
|
+
website t.durden@example-dev> list taggroups
|
|
879
|
+
[cli] ✅ [example-dev] Retrieved 2 tag groups
|
|
880
|
+
|
|
881
|
+
id: keywords
|
|
882
|
+
name: Keywords
|
|
883
|
+
description: Contains keyword tags to categorise, filter, and enhance asset discoverability in the CMS
|
|
884
|
+
tagCount: 0
|
|
885
|
+
|
|
886
|
+
id: resourcesTagGroup
|
|
887
|
+
name: Resources Tag Group
|
|
888
|
+
description: A tag group that holds tags to show available resources
|
|
889
|
+
tagCount: 2
|
|
890
|
+
|
|
891
|
+
website t.durden@example-dev>
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
### List tags
|
|
895
|
+
|
|
896
|
+
List tags across all groups or provide further options to filter the output
|
|
897
|
+
|
|
898
|
+
```shell
|
|
899
|
+
website t.durden@example-dev> list tags
|
|
900
|
+
[24/06 15:52:18] [INFO] Fetching tags in all groups from example-dev website
|
|
901
|
+
[cli] ✅ [example-dev] Retrieved 2 tags
|
|
902
|
+
|
|
903
|
+
groupId: resourcesTagGroup
|
|
904
|
+
id: 01346722-cafc-4c01-9688-a28ea6291fa5
|
|
905
|
+
value: tag1
|
|
906
|
+
label:
|
|
907
|
+
- en-GB: Tag 1
|
|
908
|
+
usageCount: 1
|
|
909
|
+
|
|
910
|
+
groupId: resourcesTagGroup
|
|
911
|
+
id: bd32ebdb-ab99-40c7-a45b-cd221e00f4d2
|
|
912
|
+
value: tag2
|
|
913
|
+
label:
|
|
914
|
+
- en-GB: Tag 2
|
|
915
|
+
usageCount: 1
|
|
916
|
+
|
|
917
|
+
website t.durden@example-dev>
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
### List tags in group
|
|
921
|
+
|
|
922
|
+
List a collection of tags in a particular group, providing options to further filter the output
|
|
923
|
+
|
|
924
|
+
```shell
|
|
925
|
+
[24/06 15:53:21] [INFO] Fetching tags in group resourcesTagGroup from example-dev website
|
|
926
|
+
[cli] ✅ [example-dev] Retrieved 2 tags
|
|
927
|
+
|
|
928
|
+
groupId: resourcesTagGroup
|
|
929
|
+
id: 01346722-cafc-4c01-9688-a28ea6291fa5
|
|
930
|
+
value: tag1
|
|
931
|
+
label:
|
|
932
|
+
- en-GB: Tag 1
|
|
933
|
+
usageCount: 1
|
|
934
|
+
|
|
935
|
+
groupId: resourcesTagGroup
|
|
936
|
+
id: bd32ebdb-ab99-40c7-a45b-cd221e00f4d2
|
|
937
|
+
value: tag2
|
|
938
|
+
label:
|
|
939
|
+
- en-GB: Tag 2
|
|
940
|
+
usageCount: 1
|
|
941
|
+
|
|
942
|
+
website t.durden@example-dev>
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
### Create tag group
|
|
946
|
+
|
|
947
|
+
Create a new collection of tags by first creating a new tag group, also create some tags in this group by supplying tag name(s) with the `--tags` option
|
|
948
|
+
|
|
949
|
+
```shell
|
|
950
|
+
website t.durden@example-dev> create taggroup topics "Topics" --tags Books Faces History Places Spelling
|
|
951
|
+
-------------------------------------
|
|
952
|
+
[cli] ✅ 🔍 IMPORT PREVIEW 🔭
|
|
953
|
+
[25/06 14:03:46] [INFO] Fetching tags in all groups from target environment example-dev website
|
|
954
|
+
|
|
955
|
+
1/1 tag group to migrate into website
|
|
956
|
+
|
|
957
|
+
status total
|
|
958
|
+
-----------------------
|
|
959
|
+
create 1
|
|
960
|
+
-----------------------
|
|
961
|
+
|
|
962
|
+
id status name description
|
|
963
|
+
--------------------------------------------
|
|
964
|
+
topics create Topics
|
|
965
|
+
--------------------------------------------
|
|
966
|
+
|
|
967
|
+
5/5 tags to migrate into website
|
|
968
|
+
|
|
969
|
+
status total
|
|
970
|
+
-----------------------
|
|
971
|
+
create 5
|
|
972
|
+
-----------------------
|
|
973
|
+
|
|
974
|
+
id value status groupId label
|
|
975
|
+
------------------------------------------------------------------------------------------
|
|
976
|
+
109eb3e9-98c9-5ab2-b9df-f1c80af3ac5c books create topics {"en-GB":"Books"}
|
|
977
|
+
d59eddbe-cb9f-51ab-9d22-532f63cd7893 faces create topics {"en-GB":"Faces"}
|
|
978
|
+
c4cc205f-d543-55c7-8f1a-7490275be437 history create topics {"en-GB":"History"}
|
|
979
|
+
a7702648-df77-5fbb-b5ec-26a148a39b52 places create topics {"en-GB":"Places"}
|
|
980
|
+
d8fe7193-6fe7-5c03-bf2e-590e151c47e7 spelling create topics {"en-GB":"Spelling"}
|
|
981
|
+
------------------------------------------------------------------------------------------
|
|
982
|
+
|
|
983
|
+
[25/06 14:03:46] [OK] Tags migration preview ready
|
|
984
|
+
|
|
985
|
+
[cli] ✅ Will import 1 tag group and 5 tags into example-dev environment
|
|
986
|
+
|
|
987
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
988
|
+
|
|
989
|
+
website t.durden@example-dev>
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
### Create tags
|
|
993
|
+
|
|
994
|
+
Create one or more tags providing the tag name(s), each name is separated by a space and any tag that contains a space should be wrapped in "double quotes". Specify the tag group to create the tags in with the required `--group` option.
|
|
995
|
+
|
|
996
|
+
### Create tags in group
|
|
997
|
+
|
|
998
|
+
Create one or more tags in a tag group providing the `groupId` first and then the tag name(s). Seperate each tag to create by a space and any tag that contains a space should be wrapped in "double quotes"
|
|
999
|
+
|
|
1000
|
+
```shell
|
|
1001
|
+
website t.durden@example-dev> create tags in topics Books Faces History Places Spelling
|
|
1002
|
+
-------------------------------------
|
|
1003
|
+
[cli] ✅ 🔍 IMPORT PREVIEW 🔭
|
|
1004
|
+
[25/06 16:41:41] [INFO] Fetching tags in all groups from target environment example-dev website
|
|
1005
|
+
|
|
1006
|
+
No tag group to migrate into website
|
|
1007
|
+
|
|
1008
|
+
status total
|
|
1009
|
+
-----------------------
|
|
1010
|
+
no change 1
|
|
1011
|
+
-----------------------
|
|
1012
|
+
|
|
1013
|
+
No tags to migrate into website
|
|
1014
|
+
|
|
1015
|
+
status total
|
|
1016
|
+
-----------------------
|
|
1017
|
+
no change 5
|
|
1018
|
+
-----------------------
|
|
1019
|
+
|
|
1020
|
+
[25/06 16:41:42] [OK] Tags migration preview ready
|
|
1021
|
+
|
|
1022
|
+
[cli] ❌ [example-dev] Unable to create tags
|
|
1023
|
+
|
|
1024
|
+
website t.durden@example-dev>
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
### Remove tags
|
|
1028
|
+
|
|
1029
|
+
Delete one or more tags, provide specific tag ids or delete all tags with the `--all` option
|
|
1030
|
+
|
|
1031
|
+
```shell
|
|
1032
|
+
website t.durden@example-dev> remove tags 109eb3e9-98c9-5ab2-b9df-f1c80af3ac5c d59eddbe-cb9f-51ab-9d22-532f63cd7893
|
|
1033
|
+
-------------------------------------
|
|
1034
|
+
[cli] ✅ 🔍 DELETE PREVIEW 🔭
|
|
1035
|
+
[25/06 15:08:53] [INFO] Fetching 2 tags from target environment example-dev website
|
|
1036
|
+
[25/06 15:08:53] [INFO] Delete tags preview ready
|
|
1037
|
+
|
|
1038
|
+
groupId: topics
|
|
1039
|
+
id: 109eb3e9-98c9-5ab2-b9df-f1c80af3ac5c
|
|
1040
|
+
value: books
|
|
1041
|
+
label:
|
|
1042
|
+
- en-GB: Books
|
|
1043
|
+
usageCount: 0
|
|
1044
|
+
status: delete
|
|
1045
|
+
|
|
1046
|
+
groupId: topics
|
|
1047
|
+
id: d59eddbe-cb9f-51ab-9d22-532f63cd7893
|
|
1048
|
+
value: faces
|
|
1049
|
+
label:
|
|
1050
|
+
- en-GB: Faces
|
|
1051
|
+
usageCount: 0
|
|
1052
|
+
status: delete
|
|
1053
|
+
|
|
1054
|
+
[cli] ✅ [example-dev] Will delete 2 tags
|
|
1055
|
+
|
|
1056
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1057
|
+
|
|
1058
|
+
website t.durden@example-dev>
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
### Remove tags in group
|
|
1062
|
+
|
|
1063
|
+
Delete one or more tags in a specific tag group, provide options to filter the returned tags or delete all tags with the `--all` option
|
|
1064
|
+
|
|
1065
|
+
```shell
|
|
1066
|
+
website t.durden@example-dev> remove tags in topics --all
|
|
1067
|
+
-------------------------------------
|
|
1068
|
+
[cli] ✅ 🔍 DELETE PREVIEW 🔭
|
|
1069
|
+
[25/06 14:15:20] [INFO] Fetching tags in group topics from target environment example-dev website
|
|
1070
|
+
[25/06 14:15:21] [INFO] Delete tags preview ready
|
|
1071
|
+
|
|
1072
|
+
groupId: topics
|
|
1073
|
+
id: 109eb3e9-98c9-5ab2-b9df-f1c80af3ac5c
|
|
1074
|
+
value: books
|
|
1075
|
+
label:
|
|
1076
|
+
- en-GB: Books
|
|
1077
|
+
usageCount: 0
|
|
1078
|
+
status: delete
|
|
1079
|
+
|
|
1080
|
+
groupId: topics
|
|
1081
|
+
id: d59eddbe-cb9f-51ab-9d22-532f63cd7893
|
|
1082
|
+
value: faces
|
|
1083
|
+
label:
|
|
1084
|
+
- en-GB: Faces
|
|
1085
|
+
usageCount: 0
|
|
1086
|
+
status: delete
|
|
1087
|
+
|
|
1088
|
+
groupId: topics
|
|
1089
|
+
id: c4cc205f-d543-55c7-8f1a-7490275be437
|
|
1090
|
+
value: history
|
|
1091
|
+
label:
|
|
1092
|
+
- en-GB: History
|
|
1093
|
+
usageCount: 0
|
|
1094
|
+
status: delete
|
|
1095
|
+
|
|
1096
|
+
groupId: topics
|
|
1097
|
+
id: a7702648-df77-5fbb-b5ec-26a148a39b52
|
|
1098
|
+
value: places
|
|
1099
|
+
label:
|
|
1100
|
+
- en-GB: Places
|
|
1101
|
+
usageCount: 0
|
|
1102
|
+
status: delete
|
|
1103
|
+
|
|
1104
|
+
groupId: topics
|
|
1105
|
+
id: d8fe7193-6fe7-5c03-bf2e-590e151c47e7
|
|
1106
|
+
value: spelling
|
|
1107
|
+
label:
|
|
1108
|
+
- en-GB: Spelling
|
|
1109
|
+
usageCount: 0
|
|
1110
|
+
status: delete
|
|
1111
|
+
|
|
1112
|
+
[cli] ✅ [example-dev] Will delete 5 tags
|
|
1113
|
+
|
|
1114
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1115
|
+
|
|
1116
|
+
website t.durden@example-dev>
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
### Remove tag group
|
|
1120
|
+
|
|
1121
|
+
When all tags have been removed from the tag group we are able to delete the tag group
|
|
1122
|
+
|
|
1123
|
+
```shell
|
|
1124
|
+
website t.durden@example-dev> remove taggroup topics
|
|
1125
|
+
-------------------------------------
|
|
1126
|
+
[cli] ✅ 🔍 DELETE PREVIEW 🔭
|
|
1127
|
+
[25/06 14:50:42] [INFO] Delete tag groups preview ready
|
|
1128
|
+
|
|
1129
|
+
id: topics
|
|
1130
|
+
name: Topics
|
|
1131
|
+
version:
|
|
1132
|
+
- versionNo: 1.0
|
|
1133
|
+
created: 2025-06-25T13:06:46.273Z
|
|
1134
|
+
createdBy: testzengenti
|
|
1135
|
+
modified: 2025-06-25T13:06:46.273Z
|
|
1136
|
+
modifiedBy: testzengenti
|
|
1137
|
+
tagCount: 0
|
|
1138
|
+
|
|
1139
|
+
[cli] ✅ [example-dev] Will delete tag group topics
|
|
1140
|
+
|
|
1141
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1142
|
+
|
|
1143
|
+
website t.durden@example-dev>
|
|
1144
|
+
```
|
|
1145
|
+
|
|
859
1146
|
## Manage API keys
|
|
860
1147
|
|
|
861
1148
|
You can use the cli or shell to manage API keys that are used to provide access to external application integrations
|
|
@@ -1090,7 +1377,7 @@ website t.durden@example-dev> set role enabled "Test role"
|
|
|
1090
1377
|
[cli] ✅ Succesfully updated role
|
|
1091
1378
|
|
|
1092
1379
|
id: 1329b3cc-0267-480e-a115-b0beaae8fe5b
|
|
1093
|
-
projectId:
|
|
1380
|
+
projectId: website
|
|
1094
1381
|
name: Test role
|
|
1095
1382
|
description: Role to demonstrate cli
|
|
1096
1383
|
enabled: true
|
|
@@ -1549,6 +1836,78 @@ The output will be the same as the `import models` examples above
|
|
|
1549
1836
|
|
|
1550
1837
|
<sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
|
|
1551
1838
|
|
|
1839
|
+
## Import tags and groups
|
|
1840
|
+
### Import from another Contensis environment
|
|
1841
|
+
|
|
1842
|
+
Connect to your "source" environment, ensure you can fetch the tags from this environment first and that these are the right tags you plan on importing to your "target" environment.
|
|
1843
|
+
|
|
1844
|
+
Choose your required options to check that the right tags will eventually be imported with the `list tags` or `list tags in <groupId>` command
|
|
1845
|
+
|
|
1846
|
+
When you are happy the expected tags are being returned for your import, you should then `connect` to your "target" environment (and `set project`) and when we are successfully connected to our target project, call the `import tags` command, ensuring you add any arguments you used with your `list tags` check earlier.
|
|
1847
|
+
|
|
1848
|
+
#### Import all tags (and groups) from the source project
|
|
1849
|
+
|
|
1850
|
+
```shell
|
|
1851
|
+
website t.durden@example-dev> import tags --source-alias example-dev --source-project-id leif
|
|
1852
|
+
-------------------------------------
|
|
1853
|
+
[cli] ✅ 🔍 IMPORT PREVIEW 🔭
|
|
1854
|
+
[25/06 15:26:37] [INFO] Fetching tags in all groups from example-dev leif
|
|
1855
|
+
[25/06 15:26:37] [INFO] Fetching tags in all groups from target environment example-dev website
|
|
1856
|
+
|
|
1857
|
+
1/2 tag groups to migrate into website
|
|
1858
|
+
|
|
1859
|
+
status total
|
|
1860
|
+
-----------------------
|
|
1861
|
+
create 1
|
|
1862
|
+
no change 1
|
|
1863
|
+
-----------------------
|
|
1864
|
+
|
|
1865
|
+
id status name description
|
|
1866
|
+
------------------------------------------------------------------------------------------------
|
|
1867
|
+
newGroup create New group
|
|
1868
|
+
------------------------------------------------------------------------------------------------
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
5/7 tags to migrate into website
|
|
1872
|
+
|
|
1873
|
+
status total
|
|
1874
|
+
-----------------------
|
|
1875
|
+
create 5
|
|
1876
|
+
no change 2
|
|
1877
|
+
-----------------------
|
|
1878
|
+
|
|
1879
|
+
id value status groupId label
|
|
1880
|
+
------------------------------------------------------------------------------------------------
|
|
1881
|
+
02bcb977-1196-4c3f-a921-d2dfce3ca32b new1 create newGroup {"en-GB":"New 1"}
|
|
1882
|
+
f48eb862-7b73-4a77-a2af-09492a88a8f0 new2 create newGroup {"en-GB":"New 2"}
|
|
1883
|
+
8673e419-55c9-4ba0-bcd7-28c7c6fa46cc new3 create newGroup {"en-GB":"New 3"}
|
|
1884
|
+
90a11d09-3727-45c2-a0df-86f1865828ab tag3 create newGroup {"en-GB":"Tag 3"}
|
|
1885
|
+
d4267b35-0d25-41ae-bce9-eeb490c793f4 tag3 create resourcesTagGroup {"en-GB":"Tag 3"}
|
|
1886
|
+
------------------------------------------------------------------------------------------------
|
|
1887
|
+
|
|
1888
|
+
[25/06 15:26:38] [OK] Tags migration preview ready
|
|
1889
|
+
|
|
1890
|
+
[cli] ✅ Will import 5 tags into example-dev environment
|
|
1891
|
+
|
|
1892
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1893
|
+
|
|
1894
|
+
website t.durden@example-dev>
|
|
1895
|
+
```
|
|
1896
|
+
|
|
1897
|
+
### Import from a file
|
|
1898
|
+
|
|
1899
|
+
Import resources directly from a JSON file. The path can be relative or absolute. The file will be processed as an array of Tags (and Tag Groups). Generate a JSON file by exporting some existing tags using the command `list tags --output tags.json`.
|
|
1900
|
+
|
|
1901
|
+
```shell
|
|
1902
|
+
website t.durden@example-dev> import tags --from-file ./tags.json
|
|
1903
|
+
```
|
|
1904
|
+
```shell
|
|
1905
|
+
website t.durden@example-dev> import taggroups --from-file ./taggroups.json
|
|
1906
|
+
```
|
|
1907
|
+
```shell
|
|
1908
|
+
website t.durden@example-dev> import tags --from-file ./tags-and-groups.json
|
|
1909
|
+
```
|
|
1910
|
+
|
|
1552
1911
|
## Import entries
|
|
1553
1912
|
|
|
1554
1913
|
### Import from another Contensis environment
|
package/dist/commands/create.js
CHANGED
|
@@ -22,11 +22,13 @@ __export(create_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(create_exports);
|
|
24
24
|
var import_commander = require("commander");
|
|
25
|
+
var import_globalOptions = require("./globalOptions");
|
|
25
26
|
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
26
27
|
var import_shell = require("../shell");
|
|
28
|
+
var import_api_ids = require("../util/api-ids");
|
|
27
29
|
const makeCreateCommand = () => {
|
|
28
30
|
const create = new import_commander.Command().command("create").description("create command").addHelpText("after", `
|
|
29
|
-
`).showHelpAfterError(true).exitOverride();
|
|
31
|
+
`).showHelpAfterError(true).enablePositionalOptions().exitOverride();
|
|
30
32
|
create.command("project").description("create a new project").argument("<projectId>", "the id of the project to create").argument("<name>", "the name of the project to create").argument("[description]", "optional description of the project").option(
|
|
31
33
|
"-l --language <language>",
|
|
32
34
|
"the default language of the project to create",
|
|
@@ -44,7 +46,8 @@ const makeCreateCommand = () => {
|
|
|
44
46
|
name,
|
|
45
47
|
description,
|
|
46
48
|
primaryLanguage: opts.language,
|
|
47
|
-
supportedLanguages: opts.supportedLanguages || []
|
|
49
|
+
supportedLanguages: opts.supportedLanguages || [],
|
|
50
|
+
deliverySysExclusions: []
|
|
48
51
|
};
|
|
49
52
|
const project = await (0, import_ContensisCliService.cliCommand)(
|
|
50
53
|
["create", "project", projectId],
|
|
@@ -80,6 +83,84 @@ Example call:
|
|
|
80
83
|
permissions: { contentTypes: [], entries: [] }
|
|
81
84
|
});
|
|
82
85
|
});
|
|
86
|
+
create.command("taggroup").description("create a new tag group").argument("<groupId>", "the API id of the tag group to create").argument('<"Name">', "the name of the tag group to create").argument('["Description"]', "a description for the tag group").option(
|
|
87
|
+
"--tags <tagNames...>",
|
|
88
|
+
"a list of tag names to create under the new tag group"
|
|
89
|
+
).addOption(import_globalOptions.commit).addHelpText(
|
|
90
|
+
"after",
|
|
91
|
+
`
|
|
92
|
+
Example call:
|
|
93
|
+
> create taggroup example "Example tags" "This group is a test"
|
|
94
|
+
> create taggroup topics "Topics" --tags Books Faces History Places Spelling
|
|
95
|
+
`
|
|
96
|
+
).action(
|
|
97
|
+
async (groupId, name, description, opts) => {
|
|
98
|
+
var _a;
|
|
99
|
+
const tagGroup = {
|
|
100
|
+
id: groupId,
|
|
101
|
+
name,
|
|
102
|
+
description
|
|
103
|
+
};
|
|
104
|
+
await (0, import_ContensisCliService.cliCommand)(
|
|
105
|
+
["create", "taggroup", groupId, name],
|
|
106
|
+
opts
|
|
107
|
+
).ImportTagGroups({
|
|
108
|
+
commit: opts.commit,
|
|
109
|
+
data: [tagGroup],
|
|
110
|
+
tags: (_a = opts.tags) == null ? void 0 : _a.map((label) => ({
|
|
111
|
+
groupId,
|
|
112
|
+
label: { "en-GB": label },
|
|
113
|
+
value: (0, import_api_ids.toApiId)(label, "camelCase", true)
|
|
114
|
+
}))
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
const tags = create.command("tags").description("create new tags in a tag group").argument('<"Label"...>', "create tag(s) with label(s)").passThroughOptions().option("-in --group <groupId>", "create tags in this tag group").addOption(import_globalOptions.commit).addHelpText(
|
|
119
|
+
"after",
|
|
120
|
+
`
|
|
121
|
+
Example call:
|
|
122
|
+
> create tags "Test tag" --group example
|
|
123
|
+
> create tags Books Faces History Places Spelling -in topics
|
|
124
|
+
`
|
|
125
|
+
).action(async (tagLabels, opts) => {
|
|
126
|
+
var _a;
|
|
127
|
+
const groupId = opts.group;
|
|
128
|
+
const cli = (0, import_ContensisCliService.cliCommand)(["create", "tags", ...tagLabels], opts);
|
|
129
|
+
const language = ((_a = cli.env.projects.find((p) => p.id === cli.env.currentProject)) == null ? void 0 : _a.primaryLanguage) || "en-GB";
|
|
130
|
+
await cli.ImportTags({
|
|
131
|
+
commit: opts.commit,
|
|
132
|
+
data: tagLabels.map((label) => ({
|
|
133
|
+
groupId,
|
|
134
|
+
label: { [language]: label },
|
|
135
|
+
value: (0, import_api_ids.toApiId)(label, "camelCase", true)
|
|
136
|
+
}))
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
tags.command("in").description("create new tags in a tag group").argument("<groupId>", "create tag(s) in this tag group").argument('<"Label"...>', "create tag(s) with label(s)").addOption(import_globalOptions.commit).addHelpText(
|
|
140
|
+
"after",
|
|
141
|
+
`
|
|
142
|
+
Example call:
|
|
143
|
+
> create tags in example "Tag 1" "Second Tag" Third
|
|
144
|
+
> create tags ih topics Books Faces History Places Spelling
|
|
145
|
+
`
|
|
146
|
+
).action(async (groupId, tagLabels, opts, cmd) => {
|
|
147
|
+
var _a;
|
|
148
|
+
const parentOptions = cmd.optsWithGlobals();
|
|
149
|
+
const cli = (0, import_ContensisCliService.cliCommand)(["create", "tags", "in", groupId, ...tagLabels], {
|
|
150
|
+
...opts,
|
|
151
|
+
...parentOptions
|
|
152
|
+
});
|
|
153
|
+
const language = ((_a = cli.env.projects.find((p) => p.id === cli.env.currentProject)) == null ? void 0 : _a.primaryLanguage) || "en-GB";
|
|
154
|
+
await cli.ImportTags({
|
|
155
|
+
commit: parentOptions.commit,
|
|
156
|
+
data: tagLabels.map((label) => ({
|
|
157
|
+
groupId,
|
|
158
|
+
label: { [language]: label },
|
|
159
|
+
value: (0, import_api_ids.toApiId)(label, "camelCase", true)
|
|
160
|
+
}))
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
(0, import_globalOptions.addGlobalOptions)(tags);
|
|
83
164
|
return create;
|
|
84
165
|
};
|
|
85
166
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/create.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { Project } from 'contensis-core-api';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\n\nexport const makeCreateCommand = () => {\n const create = new Command()\n .command('create')\n .description('create command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n create\n .command('project')\n .description('create a new project')\n .argument('<projectId>', 'the id of the project to create')\n .argument('<name>', 'the name of the project to create')\n .argument('[description]', 'optional description of the project')\n .option(\n '-l --language <language>',\n 'the default language of the project to create',\n 'en-GB'\n )\n .option(\n '-langs --supported-languages <langs...>',\n 'space separated list of other supported languages'\n )\n .usage(\n 'projectId \"Project name\" [\"Description of project\"] --language en-GB --supported-languages es-ES de-DE nl-NL'\n )\n .addHelpText('after', `\\n`)\n .action(\n async (projectId: string, name: string, description = '', opts: any) => {\n const createProject: Project = {\n id: projectId,\n name,\n description,\n primaryLanguage: opts.language,\n supportedLanguages: opts.supportedLanguages || [],\n };\n\n const project = await cliCommand(\n ['create', 'project', projectId],\n opts\n ).CreateProject(createProject);\n if (project) await shell().restart();\n }\n );\n\n create\n .command('key')\n .description('create a new api key')\n .argument('<\"key name\">', 'the name of the key to create')\n .argument('[\"description\"]', 'provide a description for the key (optional)')\n .usage('<\"key name\"> [\"description\"] (both args in \"double quotes\")')\n .addHelpText(\n 'after',\n `\nExample call:\n > create key \"my new key\" \"Created key for demonstration\"\\n`\n )\n .action(async (name: string, description: string, opts: any) => {\n await cliCommand(['create', 'key', name], opts).CreateApiKey(\n name,\n description\n );\n });\n\n create\n .command('role')\n .description('create a new role')\n .argument('<\"Role name\">', 'the name of the role to create')\n .argument('[\"Role description\">', 'the description of the role')\n .option('--disabled', 'do not enable the created role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > create role \"My role\" \"This role is for testing\" --disabled \\n`\n )\n .action(async (roleName: string, description: string, opts) => {\n await cliCommand(['create', 'role', roleName], opts).CreateRole({\n name: roleName,\n description,\n enabled: !opts.disabled,\n assignments: { apiKeys: [], groups: [], users: [] },\n permissions: { contentTypes: [], entries: [] },\n });\n });\n\n return create;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,iCAA2B;AAC3B,mBAAsB;
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { Project } from 'contensis-core-api';\nimport { addGlobalOptions, commit } from './globalOptions';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { shell } from '~/shell';\nimport { toApiId } from '~/util/api-ids';\n\nexport const makeCreateCommand = () => {\n const create = new Command()\n .command('create')\n .description('create command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .enablePositionalOptions()\n .exitOverride();\n\n create\n .command('project')\n .description('create a new project')\n .argument('<projectId>', 'the id of the project to create')\n .argument('<name>', 'the name of the project to create')\n .argument('[description]', 'optional description of the project')\n .option(\n '-l --language <language>',\n 'the default language of the project to create',\n 'en-GB'\n )\n .option(\n '-langs --supported-languages <langs...>',\n 'space separated list of other supported languages'\n )\n .usage(\n 'projectId \"Project name\" [\"Description of project\"] --language en-GB --supported-languages es-ES de-DE nl-NL'\n )\n .addHelpText('after', `\\n`)\n .action(\n async (projectId: string, name: string, description = '', opts: any) => {\n const createProject: Project = {\n id: projectId,\n name,\n description,\n primaryLanguage: opts.language,\n supportedLanguages: opts.supportedLanguages || [],\n deliverySysExclusions: [],\n };\n\n const project = await cliCommand(\n ['create', 'project', projectId],\n opts\n ).CreateProject(createProject);\n if (project) await shell().restart();\n }\n );\n\n create\n .command('key')\n .description('create a new api key')\n .argument('<\"key name\">', 'the name of the key to create')\n .argument('[\"description\"]', 'provide a description for the key (optional)')\n .usage('<\"key name\"> [\"description\"] (both args in \"double quotes\")')\n .addHelpText(\n 'after',\n `\nExample call:\n > create key \"my new key\" \"Created key for demonstration\"\\n`\n )\n .action(async (name: string, description: string, opts: any) => {\n await cliCommand(['create', 'key', name], opts).CreateApiKey(\n name,\n description\n );\n });\n\n create\n .command('role')\n .description('create a new role')\n .argument('<\"Role name\">', 'the name of the role to create')\n .argument('[\"Role description\">', 'the description of the role')\n .option('--disabled', 'do not enable the created role', false)\n .addHelpText(\n 'after',\n `\nExample call:\n > create role \"My role\" \"This role is for testing\" --disabled \\n`\n )\n .action(async (roleName: string, description: string, opts) => {\n await cliCommand(['create', 'role', roleName], opts).CreateRole({\n name: roleName,\n description,\n enabled: !opts.disabled,\n assignments: { apiKeys: [], groups: [], users: [] },\n permissions: { contentTypes: [], entries: [] },\n });\n });\n\n create\n .command('taggroup')\n .description('create a new tag group')\n .argument('<groupId>', 'the API id of the tag group to create')\n .argument('<\"Name\">', 'the name of the tag group to create')\n .argument('[\"Description\"]', 'a description for the tag group')\n .option(\n '--tags <tagNames...>',\n 'a list of tag names to create under the new tag group'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\n Example call:\n > create taggroup example \"Example tags\" \"This group is a test\" \n > create taggroup topics \"Topics\" --tags Books Faces History Places Spelling \\n`\n )\n .action(\n async (groupId: string, name: string, description: string, opts) => {\n const tagGroup = {\n id: groupId,\n name,\n description,\n };\n\n await cliCommand(\n ['create', 'taggroup', groupId, name],\n opts\n ).ImportTagGroups({\n commit: opts.commit,\n data: [tagGroup],\n tags: opts.tags?.map((label: string) => ({\n groupId,\n label: { 'en-GB': label },\n value: toApiId(label, 'camelCase', true),\n })),\n });\n }\n );\n\n const tags = create\n .command('tags')\n .description('create new tags in a tag group')\n .argument('<\"Label\"...>', 'create tag(s) with label(s)')\n .passThroughOptions()\n .option('-in --group <groupId>', 'create tags in this tag group')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\n Example call:\n > create tags \"Test tag\" --group example\n > create tags Books Faces History Places Spelling -in topics \\n`\n )\n .action(async (tagLabels: string[], opts) => {\n const groupId = opts.group;\n const cli = cliCommand(['create', 'tags', ...tagLabels], opts);\n\n const language =\n cli.env.projects.find(p => p.id === cli.env.currentProject)\n ?.primaryLanguage || 'en-GB';\n\n await cli.ImportTags({\n commit: opts.commit,\n data: tagLabels.map(label => ({\n groupId,\n label: { [language]: label },\n value: toApiId(label, 'camelCase', true),\n })),\n });\n });\n\n tags\n .command('in')\n .description('create new tags in a tag group')\n .argument('<groupId>', 'create tag(s) in this tag group')\n .argument('<\"Label\"...>', 'create tag(s) with label(s)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\n Example call:\n > create tags in example \"Tag 1\" \"Second Tag\" Third\n > create tags ih topics Books Faces History Places Spelling \\n`\n )\n .action(async (groupId: string, tagLabels: string[], opts, cmd) => {\n // workaround for opts.commit being always false\n // read the (shared) options that were parsed by the parent cmd\n // https://github.com/tj/commander.js/issues/476#issuecomment-1675757628\n const parentOptions = cmd.optsWithGlobals();\n\n const cli = cliCommand(['create', 'tags', 'in', groupId, ...tagLabels], {\n ...opts,\n ...parentOptions,\n });\n\n const language =\n cli.env.projects.find(p => p.id === cli.env.currentProject)\n ?.primaryLanguage || 'en-GB';\n\n await cli.ImportTags({\n commit: parentOptions.commit,\n data: tagLabels.map(label => ({\n groupId,\n label: { [language]: label },\n value: toApiId(label, 'camelCase', true),\n })),\n });\n });\n\n // Add global opts for inner sub-commands\n addGlobalOptions(tags);\n\n return create;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAExB,2BAAyC;AACzC,i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nB,QAAQ,cAAc;AAAA,MACtB,MAAM,UAAU,IAAI,YAAU;AAAA,QAC5B;AAAA,QACA,OAAO,EAAE,CAAC,QAAQ,GAAG,MAAM;AAAA,QAC3B,WAAO,wBAAQ,OAAO,aAAa,IAAI;AAAA,MACzC,EAAE;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AAGH,6CAAiB,IAAI;AAErB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/get.js
CHANGED
|
@@ -24,8 +24,9 @@ __export(get_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(get_exports);
|
|
25
25
|
var import_commander = require("commander");
|
|
26
26
|
var import_lodash = require("lodash");
|
|
27
|
-
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
28
27
|
var import_globalOptions = require("./globalOptions");
|
|
28
|
+
var import_ContensisCliService = require("../services/ContensisCliService");
|
|
29
|
+
var import_assert = require("../util/assert");
|
|
29
30
|
const makeGetCommand = () => {
|
|
30
31
|
const program = new import_commander.Command().command("get").description("get command").addHelpText("after", `
|
|
31
32
|
`).showHelpAfterError(true).exitOverride();
|
|
@@ -89,6 +90,37 @@ Example call:
|
|
|
89
90
|
roleNameOrId
|
|
90
91
|
);
|
|
91
92
|
});
|
|
93
|
+
program.command("tag").description("get a tag").argument("[idOrLabel]", "find a tag with this id or label").option("-in --group <groupId>", "id of the tag group containing tags").option("-l --language <language>", "find tags in the supplied language").option("-d --dependents", "find and return tag groups for all found tags").addHelpText(
|
|
94
|
+
"after",
|
|
95
|
+
`
|
|
96
|
+
Example call:
|
|
97
|
+
> get tag "Places" --group topics
|
|
98
|
+
> get tag "Places" -in topics
|
|
99
|
+
> get tag "Lieux" --language fr-FR -in topics
|
|
100
|
+
> get tag d4267b35-0d25-41ae-bce9-eeb490c793f4
|
|
101
|
+
`
|
|
102
|
+
).action(async (idOrlabel, opts) => {
|
|
103
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "tag", idOrlabel], opts).PrintTag(
|
|
104
|
+
{
|
|
105
|
+
id: (0, import_assert.isUuid)(idOrlabel) ? idOrlabel : void 0,
|
|
106
|
+
groupId: opts.group,
|
|
107
|
+
label: (0, import_assert.isUuid)(idOrlabel) ? void 0 : idOrlabel,
|
|
108
|
+
language: opts.language
|
|
109
|
+
},
|
|
110
|
+
opts.dependents
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
program.command("taggroup").description("get a tag group").argument("<groupId>", "id of the tag group to get").addHelpText(
|
|
114
|
+
"after",
|
|
115
|
+
`
|
|
116
|
+
Example call:
|
|
117
|
+
> get taggroup topics
|
|
118
|
+
`
|
|
119
|
+
).action(async (groupId, opts) => {
|
|
120
|
+
await (0, import_ContensisCliService.cliCommand)(["get", "taggroup", groupId], opts).PrintTagGroup(
|
|
121
|
+
groupId
|
|
122
|
+
);
|
|
123
|
+
});
|
|
92
124
|
program.command("webhook").description("get a webhook").argument("<webhookNameOrId...>", "id or name of the webhook(s) to get").addHelpText(
|
|
93
125
|
"after",
|
|
94
126
|
`
|