contensis-cli 1.0.0-beta.57 → 1.0.0-beta.58
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 +159 -69
- package/dist/localisation/en-GB.js +1 -1
- package/dist/localisation/en-GB.js.map +1 -1
- package/dist/services/ContensisCliService.js +3 -3
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/util/console.printer.js +4 -6
- package/dist/util/console.printer.js.map +2 -2
- package/dist/util/logger.js +2 -3
- package/dist/util/logger.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/localisation/en-GB.ts +1 -1
- package/src/services/ContensisCliService.ts +1 -0
- package/src/util/console.printer.ts +10 -20
- package/src/util/logger.ts +3 -3
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -219,6 +219,7 @@ contensis >
|
|
|
219
219
|
- [Import entries](#import-entries)
|
|
220
220
|
- [Import from another Contensis environment](#import-from-another-contensis-environment-1)
|
|
221
221
|
- [Import from a file](#import-from-a-file)
|
|
222
|
+
- [Remove entries](#remove-entries)
|
|
222
223
|
|
|
223
224
|
## Get started
|
|
224
225
|
|
|
@@ -1135,82 +1136,115 @@ When you are happy you can fetch only the data you intend to import, connect to
|
|
|
1135
1136
|
website t.durden@example-dev> import entries --preserve-guids --zenql "sys.contentTypeId = plant" --source-alias example-dev --source-project-id leif
|
|
1136
1137
|
-------------------------------------
|
|
1137
1138
|
-- IMPORT PREVIEW --
|
|
1138
|
-
[
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1139
|
+
[26/11 02:16:29] [INFO] Fetching initial entries in project 'leif'
|
|
1140
|
+
Fetch [leif] >> 100% 21 0.0s/0.0s 100000p/s
|
|
1141
|
+
Fetch [leif] >> 100% 79 0.0s/0.0s Infinityp/s
|
|
1142
|
+
Fetch [leif] >> 100% 13 0.0s/0.0s Infinityp/s
|
|
1143
|
+
|
|
1144
|
+
Found 113 entries in leif
|
|
1142
1145
|
--------------------------------------------
|
|
1143
1146
|
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
plant
|
|
1163
|
-
|
|
1164
|
-
plant
|
|
1165
|
-
|
|
1166
|
-
plant
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1147
|
+
id contentTypeId entryTitle entryDescrip
|
|
1148
|
+
------------------------------------------------------------------------------------------------------
|
|
1149
|
+
7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant Aloe vera Every kitche
|
|
1150
|
+
0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant Areca palm An easy-to-c
|
|
1151
|
+
43a60005-ea92-4b32-9af3-79560e48ecec plant Boston fern Brighten up
|
|
1152
|
+
f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant Calathea orbifolia This beautif
|
|
1153
|
+
d647012b-897e-4b6b-bfb5-b9844ef3d648 plant Canary Island Date Palm An easy-to-c
|
|
1154
|
+
b7129080-692c-4550-9e2b-28f8ec978651 plant Chinese evergreen Easy to care
|
|
1155
|
+
a3339124-4340-4f31-a209-5a6413a89f15 plant Chinese money plant The Chinese
|
|
1156
|
+
8c284599-b615-40a7-9d26-0ddd586fff51 plant Dracaena fragrans A great opti
|
|
1157
|
+
329e3104-332f-48a4-b43a-de852df796b3 plant Elephant ear Elephant ear
|
|
1158
|
+
504f7b7f-af03-4711-94ca-07edb90fbe00 plant Heartleaf philodendron Native to Ce
|
|
1159
|
+
a9a537e8-5508-4166-878c-d5fcd0d9a723 plant Maidenhair fern Easily ident
|
|
1160
|
+
9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant Parlour palm Add a bit of
|
|
1161
|
+
ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant Peace lily A classic ch
|
|
1162
|
+
6a71a864-6f61-471a-8cdd-f80237408666 plant Pink moth orchid Why buy cut
|
|
1163
|
+
50868245-3e53-4d9f-86ed-403593da67f6 plant Ponytail palm Despite its
|
|
1164
|
+
4f05979f-d8cf-4568-9045-05731a33f243 plant Spider plant Breate easy
|
|
1165
|
+
76a16c87-5e6d-465b-a343-3f14cf2fea0a plant String of nickels A hanging pl
|
|
1166
|
+
61a2af3a-332c-453c-b9f6-1851d9b7d936 plant Swiss cheese plant Bring laid-b
|
|
1167
|
+
8174fb53-b955-4e36-8f87-646bf286e396 plant Variegated snake plant Snake plants
|
|
1168
|
+
b8aa31da-f993-4d81-a361-94ecd5e42547 plant White moth orchid Why buy cut
|
|
1169
|
+
0d707ffe-f42d-44a6-b839-46156ee7f4f3 plant Yellow moth orchid Why buy cut
|
|
1170
|
+
51390024-f193-436f-8552-646cf77ccfdb image aloe-vera-closeup null
|
|
1171
|
+
c0d4ec16-6de2-4394-aaf4-03a56d343bff image aloe-vera-gold-pot null
|
|
1172
|
+
3b830d97-e976-467c-a833-1b4abcab65d0 image areca-palm-in-room null
|
|
1173
|
+
ed0300b0-e841-4c0f-bd1d-9ecd6bc2a354 image areca-palm-leaf null
|
|
1174
|
+
00119ef1-c3c4-4a49-9076-27eee5605515 image areca-palm-plant-collection null
|
|
1175
|
+
248e2817-6241-4de7-ac5d-75411be4339d image boston-fern-close-up null
|
|
1176
|
+
|
|
1177
|
+
- and 87 more...
|
|
1178
|
+
|
|
1179
|
+
[26/11 02:16:29] [INFO] Finding 113 entries in project 'website'
|
|
1180
|
+
Fetch [website] >> 100% 113 0.2s/0.0s 897p/s
|
|
1181
|
+
Fetch [website] >> 100% 4 0.0s/0.0s Infinityp/s
|
|
1182
|
+
[26/11 02:16:30] [INFO] Building 66 asset entries
|
|
1183
|
+
[26/11 02:16:30] [INFO] Building 47 content entries
|
|
1184
|
+
|
|
1185
|
+
37/113 entries to migrate into [website]
|
|
1186
|
+
|
|
1187
|
+
contentTypeId status total
|
|
1188
|
+
----------------------------------------------
|
|
1189
|
+
plantGenus error 4
|
|
1190
|
+
growingConditions update 4
|
|
1191
|
+
plant update 21
|
|
1192
|
+
pot update 12
|
|
1193
|
+
image no change 66
|
|
1194
|
+
plantType no change 5
|
|
1195
|
+
tag no change 1
|
|
1196
|
+
----------------------------------------------
|
|
1197
|
+
|
|
1198
|
+
id contentTypeId status updates entryTitle
|
|
1199
|
+
------------------------------------------------------------------------------------------------------
|
|
1200
|
+
98347340-a11c-4ee5-b4e7-1ae3b75496a2 plantGenus error Aglaonema
|
|
1201
|
+
fa464489-6476-4694-b3d4-e77d0c00a185 plantGenus error Alocasia
|
|
1202
|
+
309d5fd7-a21f-45a8-8abb-f01f820b8f16 plantGenus error Aloe
|
|
1203
|
+
4ebdcc63-929f-4b06-8848-fe046468a63d plantGenus error Beaucarnea
|
|
1204
|
+
636b925b-a386-4c56-9f33-96cd99cc391c growingConditions update -1,+0 Likes high humidity
|
|
1205
|
+
2d80e638-eb0d-4bc5-bc96-42b7b8f20678 growingConditions update -1,+0 Needs plenty of light
|
|
1206
|
+
711251f9-f9c6-473b-8b62-0ec8a0d4978c growingConditions update -1,+0 Partial shade
|
|
1207
|
+
d815819d-61c6-4037-95d3-c503acf52153 growingConditions update -1,+0 Prefers dry conditions
|
|
1208
|
+
7cf921a0-ee4f-4bd6-a3f2-0fb0fe1a2ac8 plant update -1,+0 Aloe vera
|
|
1209
|
+
0d94dbf2-89f8-45fb-96d5-175ae1f382ce plant update -1,+0 Areca palm
|
|
1210
|
+
43a60005-ea92-4b32-9af3-79560e48ecec plant update -1,+0 Boston fern
|
|
1211
|
+
f0cac96c-39a1-4b85-b14b-e8d7d3d08767 plant update -1,+0 Calathea orbifolia
|
|
1212
|
+
d647012b-897e-4b6b-bfb5-b9844ef3d648 plant update -1,+0 Canary Island Date Pal
|
|
1213
|
+
b7129080-692c-4550-9e2b-28f8ec978651 plant update -1,+0 Chinese evergreen
|
|
1214
|
+
a3339124-4340-4f31-a209-5a6413a89f15 plant update -1,+0 Chinese money plant
|
|
1215
|
+
8c284599-b615-40a7-9d26-0ddd586fff51 plant update -1,+0 Dracaena fragrans
|
|
1216
|
+
329e3104-332f-48a4-b43a-de852df796b3 plant update -1,+0 Elephant ear
|
|
1217
|
+
504f7b7f-af03-4711-94ca-07edb90fbe00 plant update -1,+0 Heartleaf philodendron
|
|
1218
|
+
a9a537e8-5508-4166-878c-d5fcd0d9a723 plant update -1,+0 Maidenhair fern
|
|
1219
|
+
9a3cc767-8fc1-4ee5-83e1-63c14a508c69 plant update -1,+0 Parlour palm
|
|
1220
|
+
ee488c3b-a3a3-4b9c-a3ad-c5a5bdc7e317 plant update -1,+0 Peace lily
|
|
1221
|
+
6a71a864-6f61-471a-8cdd-f80237408666 plant update -1,+0 Pink moth orchid
|
|
1222
|
+
50868245-3e53-4d9f-86ed-403593da67f6 plant update -1,+0 Ponytail palm
|
|
1223
|
+
4f05979f-d8cf-4568-9045-05731a33f243 plant update -1,+0 Spider plant
|
|
1224
|
+
76a16c87-5e6d-465b-a343-3f14cf2fea0a plant update -1,+0 String of nickels
|
|
1225
|
+
61a2af3a-332c-453c-b9f6-1851d9b7d936 plant update -1,+0 Swiss cheese plant
|
|
1226
|
+
8174fb53-b955-4e36-8f87-646bf286e396 plant update -1,+0 Variegated snake plant
|
|
1227
|
+
|
|
1228
|
+
- and 15 more...
|
|
1176
1229
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
[cli] ❌ Content type 'plantGenus' does not exist in project 'website'
|
|
1230
|
+
--------------------------------------------
|
|
1231
|
+
[26/11 02:16:30] [OK] Done migrating entries
|
|
1180
1232
|
|
|
1181
|
-
|
|
1182
|
-
309d5fd7-a21f-45a8-8abb-f01f820b8f16 error
|
|
1183
|
-
[cli] ❌ Content type 'plantGenus' does not exist in project 'website'
|
|
1233
|
+
[cli] ⏩ import from project leif to website
|
|
1184
1234
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1235
|
+
- growingConditions: 4 [existing: 100%] [needs update: 100%]
|
|
1236
|
+
- image: 66 up to date
|
|
1237
|
+
- plant: 21 [existing: 100%] [needs update: 100%]
|
|
1238
|
+
- plantGenus: 4 [existing: 0%]
|
|
1239
|
+
- plantType: 5 up to date
|
|
1240
|
+
- pot: 12 [existing: 100%] [needs update: 100%]
|
|
1241
|
+
- tag: 1 up to date
|
|
1242
|
+
- totalCount: 37
|
|
1243
|
+
- errors: 1
|
|
1188
1244
|
|
|
1245
|
+
[cli] ❌ Content type 'plantGenus' does not exist in project 'website'
|
|
1189
1246
|
|
|
1190
|
-
|
|
1191
|
-
90e128f5-582c-4430-a232-72022271ec8b no change
|
|
1192
|
-
plantType Foliage
|
|
1193
|
-
25f5a78b-9274-4cc9-9a58-03d8dcd4cd17 no change
|
|
1194
|
-
plantType Orchids
|
|
1195
|
-
44abca5b-a49b-48a1-8823-811ab31983c0 no change
|
|
1196
|
-
plantType Palm
|
|
1197
|
-
d66447c5-2198-4b19-bad3-c921e9ef0db0 no change
|
|
1198
|
-
plantType Succulents
|
|
1199
|
-
70149568-9725-4c39-8ff5-ef69221a0899 no change
|
|
1200
|
-
|
|
1201
|
-
pot Barro decorated terracotta pot
|
|
1202
|
-
fa67e1c6-0637-4548-bd4f-c207ec62af0e no change
|
|
1203
|
-
pot Bianco white pot
|
|
1204
|
-
e3b7907c-f524-45e4-ba5f-e62d1557b477 no change
|
|
1205
|
-
pot Canasta mid-sized pot
|
|
1206
|
-
058b20ba-99f7-49ec-9017-a0df35b00dcc no change
|
|
1207
|
-
pot Geo mid-sized pot
|
|
1208
|
-
dafc4810-a62e-43e5-a056-ab1248181eaf no change
|
|
1209
|
-
pot Grå small grey pot
|
|
1210
|
-
f2022069-7a92-491d-b197-a3564ab9a8ca no change
|
|
1211
|
-
|
|
1212
|
-
tag Promoted
|
|
1213
|
-
3659a333-8d10-4325-9ea6-2f49ae47e7fe no change
|
|
1247
|
+
[cli] ❌ [example-dev] Unable to import entries
|
|
1214
1248
|
|
|
1215
1249
|
website t.durden@example-dev>
|
|
1216
1250
|
```
|
|
@@ -1224,3 +1258,59 @@ website t.durden@example-dev> import entries --preserve-guids --from-file ./cont
|
|
|
1224
1258
|
The output will be the same as the previous command
|
|
1225
1259
|
|
|
1226
1260
|
<sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
|
|
1261
|
+
|
|
1262
|
+
## Remove entries
|
|
1263
|
+
|
|
1264
|
+
Delete entries by id
|
|
1265
|
+
|
|
1266
|
+
```shell
|
|
1267
|
+
website t.durden@example-dev> remove entries a1c25591-8c9b-50e2-96d8-f6c774fcf023 8df914cc-1da1-59d6-86e0-
|
|
1268
|
+
8ea4ebd99aaa
|
|
1269
|
+
-- PREVIEW --
|
|
1270
|
+
[26/11 02:19:53] [INFO] Fetching initial entries in project 'website'
|
|
1271
|
+
Fetch [website] >> 100% 2 0.0s/0.0s Infinityp/s
|
|
1272
|
+
[26/11 02:19:53] [INFO] Done deleting entries
|
|
1273
|
+
|
|
1274
|
+
a1c25591-8c9b-50e2-96d8-f6c774fcf023 delete homepage Find the perfect plant
|
|
1275
|
+
8df914cc-1da1-59d6-86e0-8ea4ebd99aaa delete pot Milano dipped pot
|
|
1276
|
+
|
|
1277
|
+
[cli] ⏩ delete from project website
|
|
1278
|
+
|
|
1279
|
+
- totalCount: 2 [to delete: 2]
|
|
1280
|
+
|
|
1281
|
+
[cli] ✅ [example-dev] Will delete entries
|
|
1282
|
+
|
|
1283
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1284
|
+
|
|
1285
|
+
website t.durden@example-dev>
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
Delete entries with a supplied zenql statement
|
|
1289
|
+
|
|
1290
|
+
```shell
|
|
1291
|
+
website t.durden@example-dev> remove entries --zenql "sys.version.created > 2022-11-25 14:00"
|
|
1292
|
+
-- PREVIEW --
|
|
1293
|
+
[26/11 02:20:52] [INFO] Fetching initial entries in project 'website'
|
|
1294
|
+
Fetch [website] >> 100% 7 0.0s/0.0s 100000p/s
|
|
1295
|
+
[26/11 02:20:53] [INFO] Done deleting entries
|
|
1296
|
+
|
|
1297
|
+
a1c25591-8c9b-50e2-96d8-f6c774fcf023 delete homepage Find the perfect plant
|
|
1298
|
+
bb850178-c88c-50a6-8bac-844273cb19b8 delete image parlour-palm-white-room
|
|
1299
|
+
1553d1c8-7a99-5dcd-b1cb-9a90d4cf1985 delete landingPage New subscription service
|
|
1300
|
+
f0b0ef1b-fdd1-52d6-99fc-4439e0c186e6 delete plantGenus Aglaonema
|
|
1301
|
+
f8f6ee36-9cc4-5d1e-be62-01ac73590947 delete plantGenus Aloe
|
|
1302
|
+
8df914cc-1da1-59d6-86e0-8ea4ebd99aaa delete pot Milano dipped pot
|
|
1303
|
+
4efeb0e4-dc19-5f87-ab89-47892b9c4169 delete pot Terra large terracotta pot
|
|
1304
|
+
|
|
1305
|
+
[cli] ⏩ delete from project website
|
|
1306
|
+
|
|
1307
|
+
- totalCount: 7 [to delete: 7]
|
|
1308
|
+
|
|
1309
|
+
[cli] ✅ [example-dev] Will delete entries
|
|
1310
|
+
|
|
1311
|
+
[cli] ⏩ Add --commit flag to commit the previewed changes
|
|
1312
|
+
|
|
1313
|
+
website t.durden@example-dev>
|
|
1314
|
+
```
|
|
1315
|
+
|
|
1316
|
+
<sup><sub>Add the `--commit` option to make the changes, be very careful using this! There is no going back</sub></sup>
|
|
@@ -173,7 +173,7 @@ ${import_logger.Logger.errorText(">>")} Available commands:`,
|
|
|
173
173
|
},
|
|
174
174
|
entries: {
|
|
175
175
|
imported: (env, commit, count) => `[${env}] ${commit ? `Imported` : `Will import`} ${count} entries`,
|
|
176
|
-
failedImport: (env) => `[${env}] Unable to
|
|
176
|
+
failedImport: (env) => `[${env}] Unable to import entries`,
|
|
177
177
|
removed: (env, commit) => `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,
|
|
178
178
|
failedRemove: (env) => `[${env}] Unable to delete entries`,
|
|
179
179
|
notFound: (env) => `[${env}] Entries were not found`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/localisation/en-GB.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n BlockRunningStatus,\n MigrateModelsResult,\n MigrateStatus,\n} from 'migratortron';\nimport { Logger } from '~/util/logger';\n\nexport const LogMessages = {\n app: {\n contensis: () => 'Contensis',\n quit: () => `Goodbye \uD83D\uDC4B\\n`,\n startup: (version: string) =>\n `v${version} \u00A9 2001-${new Date().getFullYear()} Zengenti \uD83C\uDDEC\uD83C\uDDE7. \\n - Creators of Contensis and purveyors of other fine software\\n\\n\uD83D\uDC4B Welcome to the contensis-cli\\n`,\n help: () =>\n 'Press [CTRL]+[C] or type \"quit\" to return to your system shell\\nPress [TAB] for suggestions\\n',\n suggestions: () =>\n `\\n${Logger.errorText('>>')} Press [TAB] for suggestions\\n`,\n autocomplete: () => `\\n${Logger.errorText('>>')} Available commands:`,\n unknownError: () => `Something went wrong...`,\n fileOutput: (format = 'json', path?: string) =>\n `Output ${format} file: ${Logger.infoText(path)}\\n`,\n noFileOutput: () => `No output written\\n`,\n },\n command: {\n notKnown: (command: string) => `${command} is not known`,\n },\n envs: {\n found: (num: number) =>\n `environments store found containing ${num} environment${\n num === 1 ? '' : 's'\n }`,\n tip: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n connect: {\n command: {\n name: () => 'connect',\n example: () => `Example call:\\n > connect example-dev`,\n },\n args: {\n alias: {\n name: () => '<alias>',\n description: () => 'the Contensis Cloud alias to connect with',\n },\n },\n noEnv: () => `Cannot connect - no environment alias specified`,\n unreachable: (url: string, status: number) =>\n `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,\n connected: (env: string) => `Current environment set to \"${env}\"`,\n help: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n projects: () => `Available projects:`,\n noProjects: () => `Cannot retrieve projects list`,\n tip: () =>\n `Introduce yourself with \"login {username}\" or \"login {clientId} -s {secret}\" or by passing credentials as options with your command`,\n },\n login: {\n command: {\n name: () => 'login',\n usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,\n example: () =>\n `Example call:\\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}`,\n },\n args: {\n user: {\n name: () => '<user/clientId>',\n description: () => 'the username to login with',\n },\n password: {\n name: () => '[password]',\n description: () =>\n 'the password to use to login with (optional/insecure)',\n },\n secret: {\n name: () => '-s --sharedSecret <sharedSecret>',\n description: () =>\n 'the shared secret to use when logging in with a client id',\n },\n },\n passwordPrompt: (env?: string, userId?: string) =>\n userId\n ? `Enter password for ${userId}@${env}:`\n : `Please enter a password`,\n failed: (env: string, userId: string) =>\n `Unable to login to ${env} as ${userId}`,\n success: (env: string, userId: string) =>\n `User ${userId} connected to ${env} successfully\\n`,\n insecurePassword: () =>\n `Could not connect to local keystore - your password could be stored unencrypted!`,\n noEnv: () => `No environment set, use \"contensis connect {alias}\" first`,\n noUserId: () => `No user id specified`,\n },\n projects: {\n list: () => `Available projects:`,\n noList: () => `Cannot retrieve projects list`,\n set: (projectId: string) =>\n `Current project is set to ${Logger.highlightText(projectId)}`,\n failedSet: (projectId: string) =>\n `Project ${Logger.highlightText(projectId)} not found`,\n tip: () =>\n `You need to set your current working project with \"set project {projectId}\"`,\n created: (env: string, id: string) =>\n `[${env}] Created project ${Logger.highlightText(id)}`,\n failedCreate: (env: string, id: string) =>\n `[${env}] Unable to create project ${Logger.highlightText(id)}`,\n updated: (env: string, id: string) =>\n `[${env}] Updated project ${Logger.highlightText(id)}`,\n failedUpdate: (env: string, id: string) =>\n `[${env}] Unable to update project ${Logger.highlightText(id)}`,\n },\n migrate: {\n models: {\n result: (\n status: keyof MigrateModelsResult['project']['contentTypes']\n ) => {\n switch (status) {\n case 'created':\n case 'updated':\n return Logger.successText;\n case 'errors':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n status: (status: MigrateStatus) => {\n switch (status) {\n case 'no change':\n return Logger.successText;\n case 'create':\n case 'two-pass':\n case 'update':\n case 'delete':\n return Logger.warningText;\n case 'error':\n case 'not found':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n models: {\n list: (projectId: string) =>\n `Content models in ${Logger.highlightText(projectId)}:`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve content models`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content models ${Logger.infoText(`[ ${id} ]`)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content models ${Logger.highlightText(id)}`,\n },\n contenttypes: {\n list: (projectId: string) =>\n `Content types in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content type ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content type ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Content type ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } content type ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete content type ${Logger.highlightText(id)}`,\n },\n components: {\n list: (projectId: string) =>\n `Components in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Component ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get component ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Component ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } component ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete component ${Logger.highlightText(id)}`,\n },\n version: {\n set: (env: string, versionStatus: string) =>\n `[${env}] Content version status set to \"${versionStatus}\"`,\n invalid: (versionStatus: string) =>\n `Content version status \"${versionStatus}\" is not valid, allowed values are \"published\" or \"latest\".`,\n noEnv: () =>\n `No Contensis environment set, connect to your Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n entries: {\n imported: (env: string, commit: boolean, count: number) =>\n `[${env}] ${commit ? `Imported` : `Will import`} ${count} entries`,\n failedImport: (env: string) => `[${env}] Unable to delete entries`,\n removed: (env: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,\n failedRemove: (env: string) => `[${env}] Unable to delete entries`,\n notFound: (env: string) => `[${env}] Entries were not found`,\n commitTip: () => `Add --commit flag to commit the previewed changes`,\n },\n keys: {\n list: (env: string) => `[${env}] API keys:`,\n noList: (env: string) => `[${env}] Cannot retrieve API`,\n created: (env: string, name: string) =>\n `[${env}] Created API key ${Logger.highlightText(name)}`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create API key ${Logger.highlightText(name)}`,\n removed: (env: string, id: string) =>\n `[${env}] Deleted API key ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete API key ${Logger.highlightText(id)}`,\n },\n blocks: {\n runningStatus: (status: BlockRunningStatus | 'broken') => {\n switch (status) {\n case 'available':\n return Logger.successText(status);\n case 'pending':\n case 'starting':\n case 'stopped':\n return Logger.warningText(status);\n case 'degraded':\n case 'faulted':\n case 'broken':\n return Logger.errorText(status);\n default:\n return Logger.infoText(status);\n }\n },\n get: (id: string, env: string, projectId?: string) =>\n `[${env}] Block ${id} in project ${projectId}:`,\n list: (env: string, projectId?: string) =>\n `[${env}] Blocks in project ${projectId}:`,\n noList: (env: string, projectId?: string) =>\n `[${env}] Cannot retrieve blocks in project ${projectId}`,\n getLogs: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Requesting logs from block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedGetLogs: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to fetch block logs for ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n tryPush: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Request to push block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n pushed: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Pushed block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedPush: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to push block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n released: (id: string, env: string, projectId?: string) =>\n `[${env}] Released block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedRelease: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to release block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n deleted: (id: string, env: string, projectId?: string) =>\n `[${env}] Deleted block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedDelete: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to delete block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n },\n webhooks: {\n list: (env: string) => `[${env}] Webhook subscriptions:`,\n noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,\n created: (env: string, name: string) =>\n `[${env}] Created Webhook subscription ${Logger.highlightText(name)}`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create Webhook subscription ${Logger.highlightText(\n name\n )}`,\n deleted: (env: string, id: string) =>\n `[${env}] Deleted Webhook subscription ${Logger.highlightText(id)}`,\n failedDelete: (env: string, id: string) =>\n `[${env}] Unable to delete Webhook subscription ${Logger.highlightText(\n id\n )}`,\n },\n};\n"],
|
|
4
|
+
"sourcesContent": ["import {\n BlockRunningStatus,\n MigrateModelsResult,\n MigrateStatus,\n} from 'migratortron';\nimport { Logger } from '~/util/logger';\n\nexport const LogMessages = {\n app: {\n contensis: () => 'Contensis',\n quit: () => `Goodbye \uD83D\uDC4B\\n`,\n startup: (version: string) =>\n `v${version} \u00A9 2001-${new Date().getFullYear()} Zengenti \uD83C\uDDEC\uD83C\uDDE7. \\n - Creators of Contensis and purveyors of other fine software\\n\\n\uD83D\uDC4B Welcome to the contensis-cli\\n`,\n help: () =>\n 'Press [CTRL]+[C] or type \"quit\" to return to your system shell\\nPress [TAB] for suggestions\\n',\n suggestions: () =>\n `\\n${Logger.errorText('>>')} Press [TAB] for suggestions\\n`,\n autocomplete: () => `\\n${Logger.errorText('>>')} Available commands:`,\n unknownError: () => `Something went wrong...`,\n fileOutput: (format = 'json', path?: string) =>\n `Output ${format} file: ${Logger.infoText(path)}\\n`,\n noFileOutput: () => `No output written\\n`,\n },\n command: {\n notKnown: (command: string) => `${command} is not known`,\n },\n envs: {\n found: (num: number) =>\n `environments store found containing ${num} environment${\n num === 1 ? '' : 's'\n }`,\n tip: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n connect: {\n command: {\n name: () => 'connect',\n example: () => `Example call:\\n > connect example-dev`,\n },\n args: {\n alias: {\n name: () => '<alias>',\n description: () => 'the Contensis Cloud alias to connect with',\n },\n },\n noEnv: () => `Cannot connect - no environment alias specified`,\n unreachable: (url: string, status: number) =>\n `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,\n connected: (env: string) => `Current environment set to \"${env}\"`,\n help: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n projects: () => `Available projects:`,\n noProjects: () => `Cannot retrieve projects list`,\n tip: () =>\n `Introduce yourself with \"login {username}\" or \"login {clientId} -s {secret}\" or by passing credentials as options with your command`,\n },\n login: {\n command: {\n name: () => 'login',\n usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,\n example: () =>\n `Example call:\\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}`,\n },\n args: {\n user: {\n name: () => '<user/clientId>',\n description: () => 'the username to login with',\n },\n password: {\n name: () => '[password]',\n description: () =>\n 'the password to use to login with (optional/insecure)',\n },\n secret: {\n name: () => '-s --sharedSecret <sharedSecret>',\n description: () =>\n 'the shared secret to use when logging in with a client id',\n },\n },\n passwordPrompt: (env?: string, userId?: string) =>\n userId\n ? `Enter password for ${userId}@${env}:`\n : `Please enter a password`,\n failed: (env: string, userId: string) =>\n `Unable to login to ${env} as ${userId}`,\n success: (env: string, userId: string) =>\n `User ${userId} connected to ${env} successfully\\n`,\n insecurePassword: () =>\n `Could not connect to local keystore - your password could be stored unencrypted!`,\n noEnv: () => `No environment set, use \"contensis connect {alias}\" first`,\n noUserId: () => `No user id specified`,\n },\n projects: {\n list: () => `Available projects:`,\n noList: () => `Cannot retrieve projects list`,\n set: (projectId: string) =>\n `Current project is set to ${Logger.highlightText(projectId)}`,\n failedSet: (projectId: string) =>\n `Project ${Logger.highlightText(projectId)} not found`,\n tip: () =>\n `You need to set your current working project with \"set project {projectId}\"`,\n created: (env: string, id: string) =>\n `[${env}] Created project ${Logger.highlightText(id)}`,\n failedCreate: (env: string, id: string) =>\n `[${env}] Unable to create project ${Logger.highlightText(id)}`,\n updated: (env: string, id: string) =>\n `[${env}] Updated project ${Logger.highlightText(id)}`,\n failedUpdate: (env: string, id: string) =>\n `[${env}] Unable to update project ${Logger.highlightText(id)}`,\n },\n migrate: {\n models: {\n result: (\n status: keyof MigrateModelsResult['project']['contentTypes']\n ) => {\n switch (status) {\n case 'created':\n case 'updated':\n return Logger.successText;\n case 'errors':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n status: (status: MigrateStatus) => {\n switch (status) {\n case 'no change':\n return Logger.successText;\n case 'create':\n case 'two-pass':\n case 'update':\n case 'delete':\n return Logger.warningText;\n case 'error':\n case 'not found':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n models: {\n list: (projectId: string) =>\n `Content models in ${Logger.highlightText(projectId)}:`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve content models`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content models ${Logger.infoText(`[ ${id} ]`)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content models ${Logger.highlightText(id)}`,\n },\n contenttypes: {\n list: (projectId: string) =>\n `Content types in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content type ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content type ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Content type ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } content type ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete content type ${Logger.highlightText(id)}`,\n },\n components: {\n list: (projectId: string) =>\n `Components in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Component ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get component ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Component ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } component ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete component ${Logger.highlightText(id)}`,\n },\n version: {\n set: (env: string, versionStatus: string) =>\n `[${env}] Content version status set to \"${versionStatus}\"`,\n invalid: (versionStatus: string) =>\n `Content version status \"${versionStatus}\" is not valid, allowed values are \"published\" or \"latest\".`,\n noEnv: () =>\n `No Contensis environment set, connect to your Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n entries: {\n imported: (env: string, commit: boolean, count: number) =>\n `[${env}] ${commit ? `Imported` : `Will import`} ${count} entries`,\n failedImport: (env: string) => `[${env}] Unable to import entries`,\n removed: (env: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,\n failedRemove: (env: string) => `[${env}] Unable to delete entries`,\n notFound: (env: string) => `[${env}] Entries were not found`,\n commitTip: () => `Add --commit flag to commit the previewed changes`,\n },\n keys: {\n list: (env: string) => `[${env}] API keys:`,\n noList: (env: string) => `[${env}] Cannot retrieve API`,\n created: (env: string, name: string) =>\n `[${env}] Created API key ${Logger.highlightText(name)}`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create API key ${Logger.highlightText(name)}`,\n removed: (env: string, id: string) =>\n `[${env}] Deleted API key ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete API key ${Logger.highlightText(id)}`,\n },\n blocks: {\n runningStatus: (status: BlockRunningStatus | 'broken') => {\n switch (status) {\n case 'available':\n return Logger.successText(status);\n case 'pending':\n case 'starting':\n case 'stopped':\n return Logger.warningText(status);\n case 'degraded':\n case 'faulted':\n case 'broken':\n return Logger.errorText(status);\n default:\n return Logger.infoText(status);\n }\n },\n get: (id: string, env: string, projectId?: string) =>\n `[${env}] Block ${id} in project ${projectId}:`,\n list: (env: string, projectId?: string) =>\n `[${env}] Blocks in project ${projectId}:`,\n noList: (env: string, projectId?: string) =>\n `[${env}] Cannot retrieve blocks in project ${projectId}`,\n getLogs: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Requesting logs from block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedGetLogs: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to fetch block logs for ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n tryPush: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Request to push block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n pushed: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Pushed block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedPush: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to push block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n released: (id: string, env: string, projectId?: string) =>\n `[${env}] Released block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedRelease: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to release block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n deleted: (id: string, env: string, projectId?: string) =>\n `[${env}] Deleted block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedDelete: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to delete block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n },\n webhooks: {\n list: (env: string) => `[${env}] Webhook subscriptions:`,\n noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,\n created: (env: string, name: string) =>\n `[${env}] Created Webhook subscription ${Logger.highlightText(name)}`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create Webhook subscription ${Logger.highlightText(\n name\n )}`,\n deleted: (env: string, id: string) =>\n `[${env}] Deleted Webhook subscription ${Logger.highlightText(id)}`,\n failedDelete: (env: string, id: string) =>\n `[${env}] Unable to delete Webhook subscription ${Logger.highlightText(\n id\n )}`,\n },\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,oBAAuB;AAEhB,MAAM,cAAc;AAAA,EACzB,KAAK;AAAA,IACH,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA;AAAA,IACZ,SAAS,CAAC,YACR,IAAI,qBAAkB,IAAI,KAAK,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,IAC/C,MAAM,MACJ;AAAA,IACF,aAAa,MACX;AAAA,EAAK,qBAAO,UAAU,IAAI;AAAA;AAAA,IAC5B,cAAc,MAAM;AAAA,EAAK,qBAAO,UAAU,IAAI;AAAA,IAC9C,cAAc,MAAM;AAAA,IACpB,YAAY,CAAC,SAAS,QAAQ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|
|
@@ -1117,7 +1117,7 @@ Components:`));
|
|
|
1117
1117
|
fromFile,
|
|
1118
1118
|
logOutput
|
|
1119
1119
|
}) => {
|
|
1120
|
-
var _a, _b, _c, _d;
|
|
1120
|
+
var _a, _b, _c, _d, _e;
|
|
1121
1121
|
const { currentEnv, currentProject, log, messages } = this;
|
|
1122
1122
|
const contensis = await this.ConnectContensisImport({
|
|
1123
1123
|
commit,
|
|
@@ -1141,12 +1141,12 @@ Components:`));
|
|
|
1141
1141
|
showChangedEntries: logOutput === "changes"
|
|
1142
1142
|
});
|
|
1143
1143
|
});
|
|
1144
|
-
if (!err && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && (((
|
|
1144
|
+
if (!err && !((_a = result.errors) == null ? void 0 : _a.length) && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && (((_b = result.migrateResult) == null ? void 0 : _b.created) || ((_c = result.migrateResult) == null ? void 0 : _c.updated)))) {
|
|
1145
1145
|
log.success(
|
|
1146
1146
|
messages.entries.imported(
|
|
1147
1147
|
currentEnv,
|
|
1148
1148
|
commit,
|
|
1149
|
-
commit ? (((
|
|
1149
|
+
commit ? (((_d = result.migrateResult) == null ? void 0 : _d.created) || 0) + (((_e = result.migrateResult) == null ? void 0 : _e.updated) || 0) : result.entriesToMigrate[currentProject].totalCount
|
|
1150
1150
|
)
|
|
1151
1151
|
);
|
|
1152
1152
|
if (!commit) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/services/ContensisCliService.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'fs';\nimport path from 'path';\nimport fetch from 'node-fetch';\nimport inquirer from 'inquirer';\nimport to from 'await-to-js';\nimport chalk from 'chalk';\nimport { Component, ContentType, Project } from 'contensis-core-api';\nimport { isPassword, isSharedSecret, isUuid, url } from '~/util';\nimport SessionCacheProvider from '../providers/SessionCacheProvider';\nimport ContensisAuthService from './ContensisAuthService';\nimport CredentialProvider from '~/providers/CredentialProvider';\nimport { logError, Logger } from '~/util/logger';\nimport { LogMessages } from '~/localisation/en-GB';\nimport {\n ContensisMigrationService,\n MigrateRequest,\n PushBlockParams,\n SourceCms,\n logEntriesTable,\n ContentTypesResult,\n Model,\n MigrateModelsResult,\n} from 'migratortron';\nimport { Entry } from 'contensis-management-api/lib/models';\n\nimport { csvFormatter } from '~/util/csv.formatter';\nimport { xmlFormatter } from '~/util/xml.formatter';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport {\n printBlockVersion,\n printMigrateResult,\n printModelMigrationAnalysis,\n printModelMigrationResult,\n} from '~/util/console.printer';\nimport { readJsonFile } from '~/providers/file-provider';\n\ntype OutputFormat = 'json' | 'csv' | 'xml';\n\ntype OutputOptions = {\n format?: OutputFormat;\n output?: string;\n};\n\ninterface IConnectOptions extends IAuthOptions {\n alias?: string;\n projectId?: string;\n}\n\ninterface IAuthOptions {\n user?: string;\n password?: string;\n clientId?: string;\n sharedSecret?: string;\n}\n\ninterface IImportOptions {\n sourceAlias?: string;\n sourceProjectId?: string;\n}\n\nlet insecurePasswordWarningShown = false;\n\nclass ContensisCli {\n static quit = (error?: Error) => {\n process.removeAllListeners('exit');\n const exitCode = error ? 1 : 0;\n\n // console.info(`\\nExiting contensis-cli with exit code: ${exitCode}\\n`);\n process.exit(exitCode);\n };\n\n private command: CliCommand;\n private format?: OutputFormat;\n private output?: string;\n private session: SessionCacheProvider;\n\n contensis?: ContensisMigrationService;\n contensisOpts: Partial<MigrateRequest>;\n currentProject: string;\n\n sourceAlias?: string;\n targetEnv?: string;\n urls:\n | {\n api: string;\n cms: string;\n liveWeb: string;\n previewWeb: string;\n iisWeb: string;\n iisPreviewWeb: string;\n }\n | undefined;\n log = Logger;\n messages = LogMessages;\n\n verb: string;\n noun: string;\n thirdArg: string;\n\n get cache() {\n return this.session.Get();\n }\n\n get currentEnv() {\n return this.cache.currentEnvironment || '';\n }\n\n set currentEnv(currentEnvironment: string) {\n this.session.Update({ currentEnvironment });\n }\n\n get env() {\n const currentEnvironment = this.currentEnv;\n const environments = this.cache.environments || {};\n\n if (!currentEnvironment) return {} as EnvironmentCache;\n else if (!!environments[currentEnvironment])\n return environments[currentEnvironment];\n else {\n return {\n history: [],\n lastUserId: '',\n projects: [],\n versionStatus: 'latest',\n } as EnvironmentCache;\n }\n }\n\n get contentTypes() {\n return this.contensis?.models.contentTypes();\n }\n\n get components() {\n return this.contensis?.models.components();\n }\n get models(): Model[] | undefined {\n return this.contensis?.models.contentModels();\n }\n\n constructor(\n args: string[],\n outputOpts?: OutputOptions & IConnectOptions & IImportOptions,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n // console.log('args: ', JSON.stringify(args, null, 2));\n\n const [exe, script, verb = '', noun = '', ...restArgs] = args;\n this.verb = verb?.toLowerCase();\n this.noun = noun?.toLowerCase();\n this.thirdArg = restArgs?.[0];\n\n const commandText = `${this.verb} ${this.noun} ${\n restArgs ? restArgs.join(' ') : ''\n }`.trim();\n\n this.session = new SessionCacheProvider();\n\n this.contensisOpts = contensisOpts;\n this.format = outputOpts?.format;\n this.output =\n outputOpts?.output && path.join(process.cwd(), outputOpts.output);\n\n const currentEnvironment = outputOpts?.alias || this.currentEnv;\n const environments = this.cache.environments || {};\n this.currentEnv = currentEnvironment;\n\n const env = this.env;\n\n if (outputOpts?.projectId) env.currentProject = outputOpts.projectId;\n if (outputOpts?.user) env.lastUserId = outputOpts.user;\n // setting this in env means passwordFallback is written to environments.json\n if (outputOpts?.password) env.passwordFallback = outputOpts.password;\n if (outputOpts?.clientId) env.lastUserId = outputOpts.clientId;\n if (outputOpts?.sharedSecret)\n env.passwordFallback = outputOpts.sharedSecret;\n\n this.currentProject = env?.currentProject || 'null';\n this.sourceAlias = outputOpts?.sourceAlias || currentEnvironment;\n\n if (currentEnvironment) {\n this.urls = url(currentEnvironment, env?.currentProject || 'website');\n }\n\n this.command = {\n commandText,\n createdDate: new Date().toISOString(),\n createdUserId: env?.lastUserId,\n };\n\n if (currentEnvironment) {\n env.history = [this.command];\n if (commandText) {\n environments[currentEnvironment] = env;\n this.session.Update({\n currentEnvironment,\n environments,\n history: [commandText],\n });\n }\n }\n }\n\n PrintEnvironments = () => {\n const { log, messages } = this;\n const { currentEnvironment, environments = {} } = this.cache;\n const envKeys = Object.keys(environments);\n log.success(messages.envs.found(envKeys.length));\n this.HandleFormattingAndOutput(envKeys, () => {\n // print the envKeys to console\n for (const env of envKeys) {\n console.log(` - ${currentEnvironment === env ? '* ' : ''}${env}`);\n }\n });\n if (envKeys.length === 0 || !currentEnvironment) {\n log.help(messages.envs.tip());\n }\n };\n\n Connect = async (environment: string) => {\n const { log, messages, session } = this;\n\n if (environment) {\n this.currentEnv = environment;\n this.urls = url(environment, 'website');\n\n const [fetchErr, response] = await to(fetch(this.urls.cms));\n if (response && response?.status < 400) {\n log.success(messages.connect.connected(environment));\n session.UpdateEnv(this.env, environment);\n\n if (this.env?.lastUserId) {\n // await this.ConnectContensis();\n await this.PrintProjects();\n } else {\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n } else {\n // Cannot reach environment - status X\n log.error(\n messages.connect.unreachable(this.urls.cms, response?.status || 0)\n );\n }\n } else {\n // No environment alias specified\n log.error(messages.connect.noEnv());\n }\n };\n\n ConnectContensis = async ({ commit = false } = {}) => {\n if (!this.contensis) {\n const { contensisOpts, currentEnv, env, log, messages } = this;\n const userId = env?.lastUserId;\n const isGuidId = userId && isUuid(userId);\n\n if (currentEnv && userId) {\n const credentials = await this.GetCredentials(\n userId,\n env.passwordFallback\n );\n\n const cachedPassword = credentials?.current?.password;\n\n if (cachedPassword) {\n this.contensis = new ContensisMigrationService(\n {\n ...contensisOpts,\n source: {\n url: this.urls?.cms || '',\n username: !isGuidId ? userId : undefined,\n password: !isGuidId ? cachedPassword : undefined,\n clientId: isGuidId ? userId : undefined,\n sharedSecret: isGuidId ? cachedPassword : undefined,\n project: env?.currentProject || '',\n assetHostname: this.urls?.previewWeb,\n },\n concurrency:\n typeof contensisOpts.concurrency !== 'undefined'\n ? contensisOpts.concurrency\n : 3,\n outputProgress: true,\n },\n !commit\n );\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!userId) log.help(messages.connect.tip());\n }\n }\n return this.contensis;\n };\n\n ConnectContensisImport = async ({\n commit = false,\n fromFile,\n importDataType,\n }: {\n commit?: boolean;\n fromFile?: string;\n importDataType?:\n | 'entries'\n | 'contentTypes'\n | 'components'\n | 'models'\n | 'user-input';\n }) => {\n const source: 'contensis' | 'file' = fromFile ? 'file' : 'contensis';\n\n const fileData = fromFile\n ? readJsonFile<(Entry | ContentType | Component)[]>(fromFile) || []\n : [];\n\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n const { contensisOpts, currentEnv, env, log, messages, sourceAlias } = this;\n const environments = this.cache.environments || {};\n const sourceEnvironment = environments[sourceAlias || ''] || {};\n const sourceCms =\n ('source' in contensisOpts && contensisOpts.source) ||\n ({} as Partial<SourceCms>);\n const sourceUserId =\n sourceCms.clientId || sourceCms.username || sourceEnvironment.lastUserId;\n const sourceProjectId =\n sourceCms.project || sourceEnvironment.currentProject || 'website';\n const isSourceGuidId = sourceUserId && isUuid(sourceUserId);\n const sourceUrls = url(sourceAlias || '', sourceProjectId);\n\n const sourcePassword =\n sourceCms.sharedSecret ||\n sourceCms.password ||\n sourceEnvironment.passwordFallback;\n\n const targetUserId = env?.lastUserId;\n const isTargetGuidId = targetUserId && isUuid(targetUserId);\n\n if (sourceUserId && currentEnv && targetUserId) {\n const sourceCredentials = await this.GetCredentials(\n sourceUserId,\n sourcePassword,\n sourceAlias,\n false\n );\n\n const cachedSourcePassword = sourceCredentials?.current?.password;\n\n const targetCredentials = await this.GetCredentials(\n targetUserId,\n env.passwordFallback\n );\n\n const cachedTargetPassword = targetCredentials?.current?.password;\n\n if (cachedSourcePassword && cachedTargetPassword) {\n if (source === 'file' || importDataType === 'user-input') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n ...(importDataType ? { [importDataType]: fileData } : {}),\n },\n !commit\n );\n } else if (source === 'contensis') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n source: {\n url: sourceUrls.cms || '',\n username: !isSourceGuidId ? sourceUserId : undefined,\n password: !isSourceGuidId ? cachedSourcePassword : undefined,\n clientId: isSourceGuidId ? sourceUserId : undefined,\n sharedSecret: isSourceGuidId ? cachedSourcePassword : undefined,\n project: sourceProjectId,\n assetHostname: sourceUrls.previewWeb,\n },\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n },\n !commit\n );\n }\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!targetUserId) log.help(messages.connect.tip());\n }\n return this.contensis;\n };\n\n GetCredentials = async (\n userId: string,\n password?: string,\n currentEnv = this.currentEnv,\n saveCurrentEnv = true\n ): Promise<CredentialProvider | undefined> => {\n const { log, messages } = this;\n if (userId) {\n const [credentialError, credentials] = await new CredentialProvider(\n { userId, alias: currentEnv },\n password\n ).Init();\n\n if (credentialError && !credentials.current) {\n // Log problem with Credential Provider\n log.error(credentialError as any);\n return;\n }\n\n if (credentials.remarks.secure !== true) {\n if (!insecurePasswordWarningShown) {\n log.warning(messages.login.insecurePassword());\n insecurePasswordWarningShown = true;\n }\n } else {\n const env = this.cache.environments[currentEnv];\n env.passwordFallback = undefined;\n this.session.UpdateEnv(env, currentEnv, saveCurrentEnv);\n }\n return credentials;\n }\n };\n\n Login = async (\n userId: string,\n {\n password = isPassword(this.env.passwordFallback),\n promptPassword = true,\n sharedSecret = isSharedSecret(this.env.passwordFallback),\n silent = false,\n attempt = 1,\n }: {\n password?: string;\n promptPassword?: boolean;\n sharedSecret?: string;\n silent?: boolean;\n attempt?: number;\n } = {}\n ): Promise<string | undefined> => {\n let inputPassword = password || sharedSecret;\n const { log, messages } = this;\n\n if (userId) {\n const { currentEnv, env } = this;\n\n if (currentEnv) {\n const credentials = await this.GetCredentials(userId, inputPassword);\n\n if (credentials) {\n const cachedPassword = isPassword(credentials.current?.password);\n const cachedSecret = isSharedSecret(credentials.current?.password);\n\n if (!cachedPassword && !cachedSecret && promptPassword) {\n // Password prompt\n ({ inputPassword } = await inquirer.prompt([\n {\n type: 'password',\n message: messages.login.passwordPrompt(currentEnv, userId),\n name: 'inputPassword',\n mask: '*',\n prefix: undefined,\n },\n ]));\n }\n\n if (inputPassword || cachedPassword || cachedSecret) {\n const authService = new ContensisAuthService({\n username: userId,\n password: inputPassword || cachedPassword,\n projectId: env?.currentProject || 'website',\n rootUrl: this.urls?.cms || '',\n clientId: userId,\n clientSecret: sharedSecret || cachedSecret,\n });\n\n const [authError, bearerToken] = await to(\n authService.BearerToken()\n );\n\n // Login successful\n if (bearerToken) {\n // Set env vars\n env.authToken = bearerToken;\n env.lastUserId = userId;\n env.passwordFallback =\n credentials.remarks.secure !== true\n ? credentials.current?.password\n : undefined;\n\n // Persist env before finding projects or doing anything else\n this.session.UpdateEnv(env);\n if (inputPassword) await credentials.Save(inputPassword);\n if (sharedSecret) await credentials.Save(sharedSecret);\n\n if (!silent) {\n Logger.success(messages.login.success(currentEnv, userId));\n await this.PrintProjects();\n }\n } else if (authError) {\n Logger.error(authError.toString());\n // Clear env vars\n env.authToken = '';\n env.lastUserId = '';\n env.passwordFallback = undefined;\n // Persist env to remove cleared values\n this.session.UpdateEnv(env);\n\n // If the auth error was raised using a cached password\n if (\n (cachedPassword || cachedSecret) &&\n credentials.remarks.secure\n ) {\n // Remove any bad stored credential and trigger login prompt again\n await credentials.Delete();\n return await this.Login(userId, { password, sharedSecret });\n } else {\n throw new Error(messages.login.failed(currentEnv, userId));\n }\n }\n\n return env.authToken;\n } else {\n Logger.error(messages.login.passwordPrompt());\n if (attempt < 2)\n return await this.Login(userId, { attempt: attempt + 1 });\n }\n }\n } else {\n // No environment set, use `contensis connect {alias}` first\n Logger.error(messages.login.noEnv());\n }\n } else {\n // No user id specified\n Logger.error(messages.login.noUserId());\n }\n };\n\n PrintContensisVersion = async () => {\n const { log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // Print contensis version to console\n this.HandleFormattingAndOutput(contensis.contensisVersion, () =>\n log.raw(log.highlightText(contensis.contensisVersion))\n );\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n PrintProjects = async () => {\n const { currentProject, log, messages, session } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // save these projects in cache\n const nextCurrentProject =\n currentProject && currentProject !== 'null'\n ? currentProject\n : projects.some(p => p.id === 'website')\n ? 'website'\n : undefined;\n\n session.UpdateEnv({\n projects: projects.map(p => p.id),\n currentProject: nextCurrentProject,\n });\n\n log.success(messages.projects.list());\n log.raw('');\n\n this.HandleFormattingAndOutput(projects, () => {\n // print the projects to console\n for (const project of projects.sort((a, b) =>\n a.id.localeCompare(b.id)\n )) {\n let color;\n try {\n color = chalk.keyword((project as any).color);\n } catch (ex) {\n color = chalk.white;\n }\n console.log(\n `${\n nextCurrentProject === project.id\n ? `>> ${log.boldText(color(project.id))}`\n : ` ${color(project.id)}`\n } ${log.infoText(\n `[${project.supportedLanguages\n .map(l =>\n l === project.primaryLanguage ? `*${log.boldText(l)}` : l\n )\n .join(' ')}]`\n )}`\n );\n }\n });\n\n if (!this.SetProject(nextCurrentProject))\n log.warning(messages.projects.tip());\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n PrintProject = async (projectId = this.currentProject) => {\n const { log, messages, session } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n const foundProject = projects?.find(\n p => p.id.toLowerCase() === projectId.toLowerCase()\n );\n\n if (foundProject) {\n log.raw('');\n this.HandleFormattingAndOutput(foundProject, log.object);\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n SetProject = (projectId = 'website') => {\n const { env, log, messages, session } = this;\n let nextProjectId: string | undefined;\n if (env?.projects.length > 0 && env?.lastUserId) {\n nextProjectId = env.projects.find(\n p => p.toLowerCase() === projectId.toLowerCase()\n );\n if (nextProjectId) {\n env.currentProject = nextProjectId;\n session.UpdateEnv(env);\n log.success(messages.projects.set(projectId));\n log.raw('');\n } else {\n log.error(messages.projects.failedSet(projectId));\n }\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n return nextProjectId;\n };\n\n SetVersion = (versionStatus: 'latest' | 'published') => {\n const { env, log, messages, session } = this;\n if (!['latest', 'published'].includes(versionStatus)) {\n log.error(messages.version.invalid(versionStatus));\n return false;\n }\n if (!env) {\n log.help(messages.version.noEnv());\n return false;\n }\n if (env?.projects.length > 0 && env?.lastUserId) {\n session.UpdateEnv({ versionStatus });\n log.success(messages.version.set(this.currentEnv, versionStatus));\n return true;\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n return false;\n }\n };\n\n HydrateContensis = async () => {\n const { log } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve content types list for env\n const [contensisErr, models] = await to(\n contensis.models.HydrateContensisRepositories()\n );\n\n if (contensisErr) {\n log.error(contensisErr.message);\n return contensisErr;\n }\n }\n };\n\n PrintApiKeys = async () => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n\n if (Array.isArray(apiKeys)) {\n log.success(messages.keys.list(currentEnv));\n this.HandleFormattingAndOutput(apiKeys, () => {\n // print the keys to console\n for (const {\n id,\n sharedSecret,\n name,\n description,\n dateModified,\n modifiedBy,\n } of apiKeys) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${dateModified.toString().substring(0, 10)} ${modifiedBy}]`\n );\n console.log(` ${id}`);\n console.log(` ${sharedSecret}`);\n }\n });\n }\n\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n }\n }\n };\n\n CreateApiKey = async (name: string, description?: string) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, key] = await contensis.apiKeys.CreateKey(name, description);\n\n if (key) {\n log.success(messages.keys.created(currentEnv, name));\n\n // print the key details to console\n console.log(\n ` - ${key.name}${\n key.description ? ` (${key.description})` : ''\n } [${key.dateModified.toString().substring(0, 10)} ${key.modifiedBy}]`\n );\n console.log(` - id: ${key.id}`);\n console.log(` - sharedSecret: ${key.sharedSecret}`);\n }\n console.log('');\n\n if (err) {\n log.error(messages.keys.failedCreate(currentEnv, name), err);\n }\n }\n };\n\n RemoveApiKey = async (id: string) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis({ commit: true });\n\n if (contensis) {\n const [err, key] = await contensis.apiKeys.RemoveKey(id);\n\n if (!err) {\n log.success(messages.keys.removed(currentEnv, id));\n console.log('');\n } else {\n log.error(messages.keys.failedRemove(currentEnv, id), err);\n }\n }\n };\n\n CreateProject = async (project: Project) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, created] = await contensis.projects.CreateProject(project);\n\n if (created) {\n log.success(messages.projects.created(currentEnv, project.id));\n\n this.HandleFormattingAndOutput(created, () => {\n // set the CLI project to the newly created project\n this.SetProject(project.id);\n // print all the projects to console\n this.PrintProjects();\n });\n return project.id;\n }\n\n if (err) {\n log.error(messages.projects.failedCreate(currentEnv, project.id), err);\n }\n }\n };\n\n UpdateProject = async (project: Partial<Project>) => {\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, updated] = await contensis.projects.UpdateProject({\n id: currentProject,\n ...project,\n });\n\n if (updated) {\n log.success(messages.projects.updated(currentEnv, currentProject));\n\n this.HandleFormattingAndOutput(updated, log.object);\n return updated.id;\n }\n\n if (err) {\n log.error(\n messages.projects.failedUpdate(currentEnv, currentProject),\n err\n );\n }\n }\n };\n\n GetContentTypes = async () => {\n const { currentProject, log, messages } = this;\n let err;\n if (!this.contensis) err = await this.HydrateContensis();\n\n if (err) log.error(messages.models.noList(currentProject));\n if (!this.contensis) log.warning(messages.models.noList(currentProject));\n\n return this.contensis;\n };\n\n PrintContentModels = async (modelIds: string[] = []) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.GetContentTypes();\n if (contensis) {\n // Retrieve models list for env\n const { models, contentTypes = [], components = [] } = this;\n\n // Models to output to console\n const returnModels = modelIds?.length\n ? models?.filter((m: Model) =>\n modelIds.some(id => id.toLowerCase() === m.id.toLowerCase())\n )\n : undefined;\n\n // Generate a list of contentTypeIds and componentIds from all models\n // and dependencies\n const contentTypeIds = Array.from(\n new Set([\n ...(returnModels || models || []).map(m => m.id),\n ...(returnModels || models || [])\n .map(m => m.dependencies?.contentTypes?.map(c => c[0]) || [])\n .flat(),\n ])\n );\n const componentIds = Array.from(\n new Set(\n (returnModels || models || [])\n .map(m => m.dependencies?.components?.map(c => c[0]) || [])\n .flat()\n )\n );\n\n // Create an array of all the content types and component definitions\n // we will use this when outputting to a file\n const contentModelBackup = [\n ...contentTypes.filter(c => contentTypeIds.includes(c.id)),\n ...components.filter(c => componentIds.includes(c.id)),\n ];\n\n if (Array.isArray(returnModels)) {\n log.success(messages.models.list(currentProject));\n this.HandleFormattingAndOutput(contentModelBackup, () => {\n // print the content models to console\n for (const model of returnModels) {\n log.raw('');\n log.object(model);\n }\n log.raw('');\n });\n } else {\n log.success(\n messages.models.get(currentProject, models?.length.toString() || '0')\n );\n log.raw('');\n if (models?.length) {\n this.HandleFormattingAndOutput(contentModelBackup, () => {\n // print the content models s#qto console\n for (const model of models) {\n const components = model.components?.length || 0;\n const contentTypes = model.contentTypes?.length || 0;\n const dependencies =\n (model.dependencies?.components?.length || 0) +\n (model.dependencies?.contentTypes?.length || 0);\n const dependencyOf =\n (model.dependencyOf?.components?.length || 0) +\n (model.dependencyOf?.contentTypes?.length || 0);\n\n const hasAny =\n components + contentTypes + dependencies + dependencyOf;\n log.raw(\n ` - ${log.highlightText(log.boldText(model.id))} ${\n hasAny\n ? log.infoText(\n `{ ${components ? `components: ${components}, ` : ''}${\n contentTypes ? `contentTypes: ${contentTypes}, ` : ''\n }${\n dependencies ? `references: ${dependencies}, ` : ''\n }${\n dependencyOf ? `required by: ${dependencyOf}` : ''\n } }`\n )\n : ''\n }`\n );\n }\n log.raw('');\n });\n }\n }\n }\n };\n\n ImportContentModels = async ({\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n }) => {\n const { currentProject, log, messages } = this;\n\n const fileData = fromFile\n ? readJsonFile<(ContentType | Component)[]>(fromFile) || []\n : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n const contensis = await this.ConnectContensisImport({\n commit,\n fromFile,\n importDataType: 'models',\n });\n\n if (contensis) {\n log.line();\n if (contensis.isPreview) {\n console.log(log.successText(` -- IMPORT PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING IMPORT *** `));\n }\n\n const [migrateErr, result] = await contensis.MigrateContentModels();\n\n if (migrateErr) logError(migrateErr);\n else\n this.HandleFormattingAndOutput(result, () => {\n // print the results to console\n if (!commit) {\n log.raw(log.boldText(`\\nContent types:`));\n if (!result.contentTypes) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.contentTypes);\n\n log.raw(log.boldText(`\\nComponents:`));\n if (!result.components) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.components);\n } else {\n const migrateResult = result as MigrateModelsResult;\n log.raw(log.boldText(`\\nContent types:`));\n printModelMigrationResult(\n this,\n migrateResult[currentProject].contentTypes\n );\n\n log.raw(log.boldText(`\\nComponents:`));\n printModelMigrationResult(\n this,\n migrateResult[currentProject].components\n );\n }\n });\n } else {\n log.warning(messages.models.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n PrintContentTypes = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n log.success(messages.contenttypes.list(currentProject));\n this.HandleFormattingAndOutput(contentTypes, () => {\n // print the content types to console\n for (const contentType of contentTypes) {\n const fieldsLength = contentType.fields?.length || 0;\n console.log(\n ` - ${contentType.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintContentType = async (contentTypeId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n const contentType = contentTypes.find(\n c => c.id.toLowerCase() === contentTypeId.toLowerCase()\n );\n if (contentType) {\n log.success(\n messages.contenttypes.get(currentProject, contentType.id)\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, log.object);\n } else {\n log.error(\n messages.contenttypes.failedGet(currentProject, contentTypeId)\n );\n }\n }\n }\n };\n\n RemoveContentTypes = async (contentTypeIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: 'user-input',\n });\n if (contensis) {\n const [err, result] = await contensis.DeleteContentTypes(contentTypeIds);\n\n if (err) {\n log.error(\n messages.contenttypes.failedRemove(\n currentProject,\n contentTypeIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.contenttypes.removed(\n currentProject,\n contentTypeIds.join('\", \"'),\n !contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.object(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportContentTypes = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n contentTypeIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<ContentType[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: fromFile ? 'user-input' : undefined,\n });\n\n if (contensis) {\n // Pass each content type to the target repo\n for (const contentType of fileData) {\n // Fix invalid data\n contentType.projectId = currentProject;\n delete contentType.uuid;\n\n const [err, created, createStatus] = await contensis.models.targetRepos[\n currentProject\n ].repo.UpsertContentType(false, contentType);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.contenttypes.created(\n currentProject,\n contentType.id,\n createStatus\n )\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, () => {});\n }\n }\n }\n };\n\n DiffModels = async (\n {\n fromFile,\n }: {\n fromFile: string;\n },\n modelIds: string[] = []\n ) => {\n const { log } = this;\n\n let fileData = fromFile ? readJsonFile<ContentType[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n const contensis = await this.ConnectContensisImport({\n fromFile,\n importDataType: 'models',\n });\n\n if (contensis) {\n const [err, result] = (await to(\n contensis.models.Diff(fileData.length ? fileData : modelIds)\n )) as [Error | null, ContentTypesResult | undefined];\n\n if (err) log.error(err.message, err);\n if (result)\n // print the content type to console\n this.HandleFormattingAndOutput(result, () => {\n log.success(\n `Queried models ${log.infoText(\n `\"${result.query.modelIds?.join(', ')}\"`\n )}\\n`\n );\n\n log.raw(log.boldText(`Content types:`));\n if (!result.contentTypes) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.contentTypes);\n\n log.raw(log.boldText(`Components:`));\n if (!result.components) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.components);\n });\n }\n };\n\n PrintComponents = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve components list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n log.success(messages.components.list(currentProject));\n\n this.HandleFormattingAndOutput(components, () => {\n // print the components to console\n for (const component of components) {\n const fieldsLength = component.fields?.length || 0;\n console.log(\n ` - ${component.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintComponent = async (componentId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n const component = components.find(\n c => c.id.toLowerCase() === componentId.toLowerCase()\n );\n if (component) {\n log.success(messages.components.get(currentProject, component.id));\n // print the component to console\n this.HandleFormattingAndOutput(component, log.object);\n } else {\n log.error(messages.components.failedGet(currentProject, componentId));\n }\n }\n }\n };\n\n RemoveComponents = async (componentIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: 'user-input',\n });\n if (contensis) {\n const [err, result] = await contensis.DeleteContentTypes(\n undefined,\n componentIds\n );\n\n if (err) {\n log.error(\n messages.components.failedRemove(\n currentProject,\n componentIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.components.removed(\n currentProject,\n componentIds.join('\", \"'),\n !contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.info(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportComponents = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n componentIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<Component[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: fromFile ? 'user-input' : undefined,\n });\n\n if (contensis) {\n // Pass each component to the target repo\n for (const component of fileData) {\n // Fix invalid data\n component.projectId = currentProject;\n delete component.uuid;\n\n const [err, created, createStatus] = await contensis.models.targetRepos[\n currentProject\n ].repo.UpsertComponent(false, component);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.components.created(\n currentProject,\n component.id,\n createStatus\n )\n );\n // print the component to console\n this.HandleFormattingAndOutput(component, () => {});\n }\n }\n }\n };\n\n RemoveEntries = async (commit = false) => {\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: 'user-input',\n });\n\n if (contensis) {\n if (contensis.isPreview) {\n console.log(log.successText(` -- PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING DELETE *** `));\n }\n const [err, result] = await contensis.DeleteEntries();\n if (result)\n this.HandleFormattingAndOutput(result, () => {\n // print the migrateResult to console\n printMigrateResult(this, result, {\n action: 'delete',\n showAllEntries: true,\n });\n });\n if (\n !err &&\n ((!commit && result.entriesToMigrate[currentProject].totalCount) ||\n (commit && result.migrateResult?.deleted))\n ) {\n log.success(messages.entries.removed(currentEnv, commit));\n if (!commit) {\n log.raw(``);\n log.help(messages.entries.commitTip());\n }\n } else {\n log.error(messages.entries.failedRemove(currentEnv), err);\n if (!result.entriesToMigrate[currentProject].totalCount)\n log.help(messages.entries.notFound(currentEnv));\n }\n }\n };\n\n GetEntries = async ({\n withDependents = false,\n }: {\n withDependents?: boolean;\n }) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n log.line();\n const entries = await contensis.GetEntries({ withDependents });\n this.HandleFormattingAndOutput(entries, () =>\n // print the entries to console\n logEntriesTable(\n entries,\n currentProject,\n contensis.payload.query?.fields\n )\n );\n } else {\n log.warning(messages.models.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n ImportEntries = async ({\n commit,\n fromFile,\n logOutput,\n }: {\n commit: boolean;\n fromFile: string;\n logOutput: string;\n }) => {\n const { currentEnv, currentProject, log, messages } = this;\n\n const contensis = await this.ConnectContensisImport({\n commit,\n fromFile,\n importDataType: 'entries',\n });\n\n if (contensis) {\n log.line();\n if (contensis.isPreview) {\n console.log(log.successText(` -- IMPORT PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING IMPORT *** `));\n }\n\n const [err, result] = await contensis.MigrateEntries();\n\n if (err) logError(err);\n else\n this.HandleFormattingAndOutput(result, () => {\n // print the migrateResult to console\n printMigrateResult(this, result, {\n showAllEntries: logOutput === 'all',\n showChangedEntries: logOutput === 'changes',\n });\n });\n\n if (\n !err &&\n ((!commit && result.entriesToMigrate[currentProject].totalCount) ||\n (commit &&\n (result.migrateResult?.created || result.migrateResult?.updated)))\n ) {\n log.success(\n messages.entries.imported(\n currentEnv,\n commit,\n commit\n ? (result.migrateResult?.created || 0) +\n (result.migrateResult?.updated || 0)\n : result.entriesToMigrate[currentProject].totalCount\n )\n );\n if (!commit) {\n log.raw(``);\n log.help(messages.entries.commitTip());\n }\n } else {\n log.error(messages.entries.failedImport(currentEnv), err);\n if (!result.entriesToMigrate[currentProject].totalCount)\n log.help(messages.entries.notFound(currentEnv));\n }\n } else {\n log.warning(messages.models.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n PrintWebhookSubscriptions = async (\n subscriptionIds?: string[],\n name?: string\n ) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve webhooks list for env\n const [webhooksErr, webhooks] =\n await contensis.subscriptions.webhooks.GetSubscriptions();\n\n const filteredResults =\n typeof name === 'string'\n ? webhooks?.filter(w =>\n w.name?.toLowerCase().includes(name.toLowerCase())\n )\n : Array.isArray(subscriptionIds)\n ? webhooks?.filter(w => subscriptionIds?.some(id => id === w.id))\n : webhooks;\n\n if (Array.isArray(filteredResults)) {\n this.HandleFormattingAndOutput(filteredResults, () => {\n // print the keys to console\n log.success(messages.webhooks.list(currentEnv));\n for (const {\n id,\n description,\n method,\n name,\n version,\n url,\n } of filteredResults) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${version.modified.toString().substring(0, 10)} ${\n version.modifiedBy\n }]`\n );\n console.log(` ${id}`);\n console.log(` [${method}] ${url}`);\n }\n console.log('');\n });\n }\n\n if (webhooksErr) {\n log.error(messages.webhooks.noList(currentEnv));\n log.error(jsonFormatter(webhooksErr));\n }\n }\n };\n\n PrintBlocks = async () => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve blocks list for env\n const [err, blocks] = await contensis.blocks.GetBlocks();\n\n if (Array.isArray(blocks)) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the blocks to console\n log.success(messages.blocks.list(currentEnv, env.currentProject));\n for (const {\n id,\n description,\n branches,\n liveVersion,\n madeLive,\n versionsSinceLive,\n } of blocks) {\n console.log(\n ` - ${id}${description ? ` (${description})` : ''}${\n madeLive\n ? ` [${madeLive.toString().substring(0, 10)} v${liveVersion}]`\n : ''\n }${\n versionsSinceLive\n ? log.warningText(` +${versionsSinceLive}`)\n : ''\n }`\n );\n for (const branch of branches)\n console.log(\n log.infoText(` [${branch.id}]: ${branch.status}`)\n );\n }\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockVersions = async (\n blockId: string,\n branch: string,\n version: string\n ) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block version\n const [err, blocks] = await contensis.blocks.GetBlockVersions(\n blockId,\n branch,\n version\n );\n\n if (blocks) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the version detail to console\n log.success(\n messages.blocks.get(blockId, currentEnv, env.currentProject)\n );\n for (const block of blocks)\n printBlockVersion(\n this,\n block,\n !version\n ? {\n showImage: false,\n showSource: true,\n showStaticPaths: false,\n showStatus: false,\n }\n : undefined\n );\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv, env.currentProject));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PushBlock = async (block: PushBlockParams) => {\n const { currentEnv, env, log, messages } = this;\n\n // Output request to console\n log.info(\n messages.blocks.tryPush(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n console.log(jsonFormatter(block));\n\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Push new block version\n const [err, blockVersion] = await contensis.blocks.PushBlockVersion(\n block\n );\n if (!err) {\n log.success(\n messages.blocks.pushed(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n }\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n printBlockVersion(this, blockVersion);\n });\n }\n if (err)\n throw new Error(\n messages.blocks.failedPush(block.id, currentEnv, env.currentProject)\n );\n } else {\n throw new Error(\n messages.blocks.failedPush(block.id, currentEnv, env.currentProject)\n );\n }\n };\n\n ReleaseBlock = async (blockId: string, version: string) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block version\n const [err, blockVersion] = await contensis.blocks.BlockAction(\n blockId,\n 'release',\n version\n );\n\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n log.success(\n messages.blocks.released(blockId, currentEnv, env.currentProject)\n );\n printBlockVersion(this, blockVersion);\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedRelease(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockLogs = async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london'\n ) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block logs\n log.success(\n messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)\n );\n\n const [err, blockLogs] = await contensis.blocks.GetBlockLogs({\n blockId,\n branchId: branch,\n version,\n dataCenter,\n });\n\n if (blockLogs) {\n this.HandleFormattingAndOutput(blockLogs, () => {\n // print the logs to console\n console.log(\n ` - ${blockId} ${branch} ${\n Number(version) ? `v${version}` : version\n } [${dataCenter}]`\n );\n log.line();\n console.log(log.infoText(blockLogs));\n log.line();\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedGetLogs(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n HandleFormattingAndOutput = <T>(obj: T, logFn: (obj: T) => void) => {\n const { format, log, messages, output } = this;\n if (!format) {\n // print the object to console\n logFn(obj);\n } else if (format === 'csv') {\n log.raw('');\n log.raw(log.infoText(csvFormatter(obj)));\n } else if (format === 'xml') {\n log.raw('');\n log.raw(log.infoText(xmlFormatter(obj)));\n } else if (format === 'json') {\n log.raw('');\n log.raw(log.infoText(jsonFormatter(obj)));\n }\n log.raw('');\n\n if (output) {\n let writeString = '';\n if (format === 'csv') {\n writeString = csvFormatter(obj as any);\n } else if (format === 'xml') {\n writeString = xmlFormatter(obj as any);\n } else writeString = jsonFormatter(obj);\n // write output to file\n if (writeString) {\n fs.writeFileSync(output, writeString);\n log.success(messages.app.fileOutput(format, output));\n } else {\n log.info(messages.app.noFileOutput());\n }\n }\n };\n}\n\nexport const cliCommand = (\n commandArgs: string[],\n outputOpts: OutputOptions & IConnectOptions = {},\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisCli(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\nexport default ContensisCli;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAiB;AACjB,wBAAkB;AAClB,sBAAqB;AACrB,yBAAe;AACf,mBAAkB;AAElB,kBAAwD;AACxD,kCAAiC;AACjC,kCAAiC;AACjC,gCAA+B;AAC/B,oBAAiC;AACjC,mBAA4B;AAC5B,0BASO;AAGP,iBAA6B;AAC7B,iBAA6B;AAC7B,kBAA8B;AAC9B,qBAKO;AACP,2BAA6B;AA0B7B,IAAI,+BAA+B;AAEnC,MAAM,aAAa;AAAA,EACjB,OAAO,OAAO,CAAC,UAAkB;AAC/B,YAAQ,mBAAmB,MAAM;AACjC,UAAM,WAAW,QAAQ,IAAI;AAG7B,YAAQ,KAAK,QAAQ;AAAA,EACvB;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAUA,MAAM;AAAA,EACN,WAAW;AAAA,EAEX;AAAA,EACA;AAAA,EACA;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,QAAQ,IAAI;AAAA,EAC1B;AAAA,EAEA,IAAI,aAAa;AACf,WAAO,KAAK,MAAM,sBAAsB;AAAA,EAC1C;AAAA,EAEA,IAAI,WAAW,oBAA4B;AACzC,SAAK,QAAQ,OAAO,EAAE,mBAAmB,CAAC;AAAA,EAC5C;AAAA,EAEA,IAAI,MAAM;AACR,UAAM,qBAAqB,KAAK;AAChC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W,OAAO;AAC3B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,IACzC,WAAW,WAAW,OAAO;AAC3B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,IACzC,WAAW,WAAW,QAAQ;AAC5B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,2BAAc,GAAG,CAAC,CAAC;AAAA,IAC1C;AACA,QAAI,IAAI,EAAE;AAEV,QAAI,QAAQ;AACV,UAAI,cAAc;AAClB,UAAI,WAAW,OAAO;AACpB,0BAAc,yBAAa,GAAU;AAAA,MACvC,WAAW,WAAW,OAAO;AAC3B,0BAAc,yBAAa,GAAU;AAAA,MACvC;AAAO,0BAAc,2BAAc,GAAG;AAEtC,UAAI,aAAa;AACf,kBAAAC,QAAG,cAAc,QAAQ,WAAW;AACpC,YAAI,QAAQ,SAAS,IAAI,WAAW,QAAQ,MAAM,CAAC;AAAA,MACrD,OAAO;AACL,YAAI,KAAK,SAAS,IAAI,aAAa,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,aAAa,CACxB,aACA,aAA8C,CAAC,GAC/C,gBAAyC,CAAC,MACvC;AACH,SAAO,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,WAAW,GAAG,YAAY,aAAa;AAC7E;AACA,IAAO,8BAAQ;",
|
|
4
|
+
"sourcesContent": ["import fs from 'fs';\nimport path from 'path';\nimport fetch from 'node-fetch';\nimport inquirer from 'inquirer';\nimport to from 'await-to-js';\nimport chalk from 'chalk';\nimport { Component, ContentType, Project } from 'contensis-core-api';\nimport { isPassword, isSharedSecret, isUuid, url } from '~/util';\nimport SessionCacheProvider from '../providers/SessionCacheProvider';\nimport ContensisAuthService from './ContensisAuthService';\nimport CredentialProvider from '~/providers/CredentialProvider';\nimport { logError, Logger } from '~/util/logger';\nimport { LogMessages } from '~/localisation/en-GB';\nimport {\n ContensisMigrationService,\n MigrateRequest,\n PushBlockParams,\n SourceCms,\n logEntriesTable,\n ContentTypesResult,\n Model,\n MigrateModelsResult,\n} from 'migratortron';\nimport { Entry } from 'contensis-management-api/lib/models';\n\nimport { csvFormatter } from '~/util/csv.formatter';\nimport { xmlFormatter } from '~/util/xml.formatter';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport {\n printBlockVersion,\n printMigrateResult,\n printModelMigrationAnalysis,\n printModelMigrationResult,\n} from '~/util/console.printer';\nimport { readJsonFile } from '~/providers/file-provider';\n\ntype OutputFormat = 'json' | 'csv' | 'xml';\n\ntype OutputOptions = {\n format?: OutputFormat;\n output?: string;\n};\n\ninterface IConnectOptions extends IAuthOptions {\n alias?: string;\n projectId?: string;\n}\n\ninterface IAuthOptions {\n user?: string;\n password?: string;\n clientId?: string;\n sharedSecret?: string;\n}\n\ninterface IImportOptions {\n sourceAlias?: string;\n sourceProjectId?: string;\n}\n\nlet insecurePasswordWarningShown = false;\n\nclass ContensisCli {\n static quit = (error?: Error) => {\n process.removeAllListeners('exit');\n const exitCode = error ? 1 : 0;\n\n // console.info(`\\nExiting contensis-cli with exit code: ${exitCode}\\n`);\n process.exit(exitCode);\n };\n\n private command: CliCommand;\n private format?: OutputFormat;\n private output?: string;\n private session: SessionCacheProvider;\n\n contensis?: ContensisMigrationService;\n contensisOpts: Partial<MigrateRequest>;\n currentProject: string;\n\n sourceAlias?: string;\n targetEnv?: string;\n urls:\n | {\n api: string;\n cms: string;\n liveWeb: string;\n previewWeb: string;\n iisWeb: string;\n iisPreviewWeb: string;\n }\n | undefined;\n log = Logger;\n messages = LogMessages;\n\n verb: string;\n noun: string;\n thirdArg: string;\n\n get cache() {\n return this.session.Get();\n }\n\n get currentEnv() {\n return this.cache.currentEnvironment || '';\n }\n\n set currentEnv(currentEnvironment: string) {\n this.session.Update({ currentEnvironment });\n }\n\n get env() {\n const currentEnvironment = this.currentEnv;\n const environments = this.cache.environments || {};\n\n if (!currentEnvironment) return {} as EnvironmentCache;\n else if (!!environments[currentEnvironment])\n return environments[currentEnvironment];\n else {\n return {\n history: [],\n lastUserId: '',\n projects: [],\n versionStatus: 'latest',\n } as EnvironmentCache;\n }\n }\n\n get contentTypes() {\n return this.contensis?.models.contentTypes();\n }\n\n get components() {\n return this.contensis?.models.components();\n }\n get models(): Model[] | undefined {\n return this.contensis?.models.contentModels();\n }\n\n constructor(\n args: string[],\n outputOpts?: OutputOptions & IConnectOptions & IImportOptions,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n // console.log('args: ', JSON.stringify(args, null, 2));\n\n const [exe, script, verb = '', noun = '', ...restArgs] = args;\n this.verb = verb?.toLowerCase();\n this.noun = noun?.toLowerCase();\n this.thirdArg = restArgs?.[0];\n\n const commandText = `${this.verb} ${this.noun} ${\n restArgs ? restArgs.join(' ') : ''\n }`.trim();\n\n this.session = new SessionCacheProvider();\n\n this.contensisOpts = contensisOpts;\n this.format = outputOpts?.format;\n this.output =\n outputOpts?.output && path.join(process.cwd(), outputOpts.output);\n\n const currentEnvironment = outputOpts?.alias || this.currentEnv;\n const environments = this.cache.environments || {};\n this.currentEnv = currentEnvironment;\n\n const env = this.env;\n\n if (outputOpts?.projectId) env.currentProject = outputOpts.projectId;\n if (outputOpts?.user) env.lastUserId = outputOpts.user;\n // setting this in env means passwordFallback is written to environments.json\n if (outputOpts?.password) env.passwordFallback = outputOpts.password;\n if (outputOpts?.clientId) env.lastUserId = outputOpts.clientId;\n if (outputOpts?.sharedSecret)\n env.passwordFallback = outputOpts.sharedSecret;\n\n this.currentProject = env?.currentProject || 'null';\n this.sourceAlias = outputOpts?.sourceAlias || currentEnvironment;\n\n if (currentEnvironment) {\n this.urls = url(currentEnvironment, env?.currentProject || 'website');\n }\n\n this.command = {\n commandText,\n createdDate: new Date().toISOString(),\n createdUserId: env?.lastUserId,\n };\n\n if (currentEnvironment) {\n env.history = [this.command];\n if (commandText) {\n environments[currentEnvironment] = env;\n this.session.Update({\n currentEnvironment,\n environments,\n history: [commandText],\n });\n }\n }\n }\n\n PrintEnvironments = () => {\n const { log, messages } = this;\n const { currentEnvironment, environments = {} } = this.cache;\n const envKeys = Object.keys(environments);\n log.success(messages.envs.found(envKeys.length));\n this.HandleFormattingAndOutput(envKeys, () => {\n // print the envKeys to console\n for (const env of envKeys) {\n console.log(` - ${currentEnvironment === env ? '* ' : ''}${env}`);\n }\n });\n if (envKeys.length === 0 || !currentEnvironment) {\n log.help(messages.envs.tip());\n }\n };\n\n Connect = async (environment: string) => {\n const { log, messages, session } = this;\n\n if (environment) {\n this.currentEnv = environment;\n this.urls = url(environment, 'website');\n\n const [fetchErr, response] = await to(fetch(this.urls.cms));\n if (response && response?.status < 400) {\n log.success(messages.connect.connected(environment));\n session.UpdateEnv(this.env, environment);\n\n if (this.env?.lastUserId) {\n // await this.ConnectContensis();\n await this.PrintProjects();\n } else {\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n } else {\n // Cannot reach environment - status X\n log.error(\n messages.connect.unreachable(this.urls.cms, response?.status || 0)\n );\n }\n } else {\n // No environment alias specified\n log.error(messages.connect.noEnv());\n }\n };\n\n ConnectContensis = async ({ commit = false } = {}) => {\n if (!this.contensis) {\n const { contensisOpts, currentEnv, env, log, messages } = this;\n const userId = env?.lastUserId;\n const isGuidId = userId && isUuid(userId);\n\n if (currentEnv && userId) {\n const credentials = await this.GetCredentials(\n userId,\n env.passwordFallback\n );\n\n const cachedPassword = credentials?.current?.password;\n\n if (cachedPassword) {\n this.contensis = new ContensisMigrationService(\n {\n ...contensisOpts,\n source: {\n url: this.urls?.cms || '',\n username: !isGuidId ? userId : undefined,\n password: !isGuidId ? cachedPassword : undefined,\n clientId: isGuidId ? userId : undefined,\n sharedSecret: isGuidId ? cachedPassword : undefined,\n project: env?.currentProject || '',\n assetHostname: this.urls?.previewWeb,\n },\n concurrency:\n typeof contensisOpts.concurrency !== 'undefined'\n ? contensisOpts.concurrency\n : 3,\n outputProgress: true,\n },\n !commit\n );\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!userId) log.help(messages.connect.tip());\n }\n }\n return this.contensis;\n };\n\n ConnectContensisImport = async ({\n commit = false,\n fromFile,\n importDataType,\n }: {\n commit?: boolean;\n fromFile?: string;\n importDataType?:\n | 'entries'\n | 'contentTypes'\n | 'components'\n | 'models'\n | 'user-input';\n }) => {\n const source: 'contensis' | 'file' = fromFile ? 'file' : 'contensis';\n\n const fileData = fromFile\n ? readJsonFile<(Entry | ContentType | Component)[]>(fromFile) || []\n : [];\n\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n const { contensisOpts, currentEnv, env, log, messages, sourceAlias } = this;\n const environments = this.cache.environments || {};\n const sourceEnvironment = environments[sourceAlias || ''] || {};\n const sourceCms =\n ('source' in contensisOpts && contensisOpts.source) ||\n ({} as Partial<SourceCms>);\n const sourceUserId =\n sourceCms.clientId || sourceCms.username || sourceEnvironment.lastUserId;\n const sourceProjectId =\n sourceCms.project || sourceEnvironment.currentProject || 'website';\n const isSourceGuidId = sourceUserId && isUuid(sourceUserId);\n const sourceUrls = url(sourceAlias || '', sourceProjectId);\n\n const sourcePassword =\n sourceCms.sharedSecret ||\n sourceCms.password ||\n sourceEnvironment.passwordFallback;\n\n const targetUserId = env?.lastUserId;\n const isTargetGuidId = targetUserId && isUuid(targetUserId);\n\n if (sourceUserId && currentEnv && targetUserId) {\n const sourceCredentials = await this.GetCredentials(\n sourceUserId,\n sourcePassword,\n sourceAlias,\n false\n );\n\n const cachedSourcePassword = sourceCredentials?.current?.password;\n\n const targetCredentials = await this.GetCredentials(\n targetUserId,\n env.passwordFallback\n );\n\n const cachedTargetPassword = targetCredentials?.current?.password;\n\n if (cachedSourcePassword && cachedTargetPassword) {\n if (source === 'file' || importDataType === 'user-input') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n ...(importDataType ? { [importDataType]: fileData } : {}),\n },\n !commit\n );\n } else if (source === 'contensis') {\n this.contensis = new ContensisMigrationService(\n {\n concurrency: 3,\n outputProgress: true,\n ...contensisOpts,\n source: {\n url: sourceUrls.cms || '',\n username: !isSourceGuidId ? sourceUserId : undefined,\n password: !isSourceGuidId ? cachedSourcePassword : undefined,\n clientId: isSourceGuidId ? sourceUserId : undefined,\n sharedSecret: isSourceGuidId ? cachedSourcePassword : undefined,\n project: sourceProjectId,\n assetHostname: sourceUrls.previewWeb,\n },\n target: {\n url: this.urls?.cms || '',\n username: !isTargetGuidId ? targetUserId : undefined,\n password: !isTargetGuidId ? cachedTargetPassword : undefined,\n clientId: isTargetGuidId ? targetUserId : undefined,\n sharedSecret: isTargetGuidId ? cachedTargetPassword : undefined,\n targetProjects: [env.currentProject || ''],\n assetHostname: this.urls?.previewWeb,\n },\n },\n !commit\n );\n }\n }\n } else {\n if (!currentEnv) log.help(messages.connect.help());\n if (!targetUserId) log.help(messages.connect.tip());\n }\n return this.contensis;\n };\n\n GetCredentials = async (\n userId: string,\n password?: string,\n currentEnv = this.currentEnv,\n saveCurrentEnv = true\n ): Promise<CredentialProvider | undefined> => {\n const { log, messages } = this;\n if (userId) {\n const [credentialError, credentials] = await new CredentialProvider(\n { userId, alias: currentEnv },\n password\n ).Init();\n\n if (credentialError && !credentials.current) {\n // Log problem with Credential Provider\n log.error(credentialError as any);\n return;\n }\n\n if (credentials.remarks.secure !== true) {\n if (!insecurePasswordWarningShown) {\n log.warning(messages.login.insecurePassword());\n insecurePasswordWarningShown = true;\n }\n } else {\n const env = this.cache.environments[currentEnv];\n env.passwordFallback = undefined;\n this.session.UpdateEnv(env, currentEnv, saveCurrentEnv);\n }\n return credentials;\n }\n };\n\n Login = async (\n userId: string,\n {\n password = isPassword(this.env.passwordFallback),\n promptPassword = true,\n sharedSecret = isSharedSecret(this.env.passwordFallback),\n silent = false,\n attempt = 1,\n }: {\n password?: string;\n promptPassword?: boolean;\n sharedSecret?: string;\n silent?: boolean;\n attempt?: number;\n } = {}\n ): Promise<string | undefined> => {\n let inputPassword = password || sharedSecret;\n const { log, messages } = this;\n\n if (userId) {\n const { currentEnv, env } = this;\n\n if (currentEnv) {\n const credentials = await this.GetCredentials(userId, inputPassword);\n\n if (credentials) {\n const cachedPassword = isPassword(credentials.current?.password);\n const cachedSecret = isSharedSecret(credentials.current?.password);\n\n if (!cachedPassword && !cachedSecret && promptPassword) {\n // Password prompt\n ({ inputPassword } = await inquirer.prompt([\n {\n type: 'password',\n message: messages.login.passwordPrompt(currentEnv, userId),\n name: 'inputPassword',\n mask: '*',\n prefix: undefined,\n },\n ]));\n }\n\n if (inputPassword || cachedPassword || cachedSecret) {\n const authService = new ContensisAuthService({\n username: userId,\n password: inputPassword || cachedPassword,\n projectId: env?.currentProject || 'website',\n rootUrl: this.urls?.cms || '',\n clientId: userId,\n clientSecret: sharedSecret || cachedSecret,\n });\n\n const [authError, bearerToken] = await to(\n authService.BearerToken()\n );\n\n // Login successful\n if (bearerToken) {\n // Set env vars\n env.authToken = bearerToken;\n env.lastUserId = userId;\n env.passwordFallback =\n credentials.remarks.secure !== true\n ? credentials.current?.password\n : undefined;\n\n // Persist env before finding projects or doing anything else\n this.session.UpdateEnv(env);\n if (inputPassword) await credentials.Save(inputPassword);\n if (sharedSecret) await credentials.Save(sharedSecret);\n\n if (!silent) {\n Logger.success(messages.login.success(currentEnv, userId));\n await this.PrintProjects();\n }\n } else if (authError) {\n Logger.error(authError.toString());\n // Clear env vars\n env.authToken = '';\n env.lastUserId = '';\n env.passwordFallback = undefined;\n // Persist env to remove cleared values\n this.session.UpdateEnv(env);\n\n // If the auth error was raised using a cached password\n if (\n (cachedPassword || cachedSecret) &&\n credentials.remarks.secure\n ) {\n // Remove any bad stored credential and trigger login prompt again\n await credentials.Delete();\n return await this.Login(userId, { password, sharedSecret });\n } else {\n throw new Error(messages.login.failed(currentEnv, userId));\n }\n }\n\n return env.authToken;\n } else {\n Logger.error(messages.login.passwordPrompt());\n if (attempt < 2)\n return await this.Login(userId, { attempt: attempt + 1 });\n }\n }\n } else {\n // No environment set, use `contensis connect {alias}` first\n Logger.error(messages.login.noEnv());\n }\n } else {\n // No user id specified\n Logger.error(messages.login.noUserId());\n }\n };\n\n PrintContensisVersion = async () => {\n const { log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // Print contensis version to console\n this.HandleFormattingAndOutput(contensis.contensisVersion, () =>\n log.raw(log.highlightText(contensis.contensisVersion))\n );\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n PrintProjects = async () => {\n const { currentProject, log, messages, session } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n if (Array.isArray(projects)) {\n // save these projects in cache\n const nextCurrentProject =\n currentProject && currentProject !== 'null'\n ? currentProject\n : projects.some(p => p.id === 'website')\n ? 'website'\n : undefined;\n\n session.UpdateEnv({\n projects: projects.map(p => p.id),\n currentProject: nextCurrentProject,\n });\n\n log.success(messages.projects.list());\n log.raw('');\n\n this.HandleFormattingAndOutput(projects, () => {\n // print the projects to console\n for (const project of projects.sort((a, b) =>\n a.id.localeCompare(b.id)\n )) {\n let color;\n try {\n color = chalk.keyword((project as any).color);\n } catch (ex) {\n color = chalk.white;\n }\n console.log(\n `${\n nextCurrentProject === project.id\n ? `>> ${log.boldText(color(project.id))}`\n : ` ${color(project.id)}`\n } ${log.infoText(\n `[${project.supportedLanguages\n .map(l =>\n l === project.primaryLanguage ? `*${log.boldText(l)}` : l\n )\n .join(' ')}]`\n )}`\n );\n }\n });\n\n if (!this.SetProject(nextCurrentProject))\n log.warning(messages.projects.tip());\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n PrintProject = async (projectId = this.currentProject) => {\n const { log, messages, session } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve projects list for env\n const [projectsErr, projects] = await to(\n contensis.projects.GetSourceProjects()\n );\n\n const foundProject = projects?.find(\n p => p.id.toLowerCase() === projectId.toLowerCase()\n );\n\n if (foundProject) {\n log.raw('');\n this.HandleFormattingAndOutput(foundProject, log.object);\n }\n\n if (projectsErr) {\n log.error(messages.projects.noList());\n log.error(projectsErr.message);\n }\n }\n };\n\n SetProject = (projectId = 'website') => {\n const { env, log, messages, session } = this;\n let nextProjectId: string | undefined;\n if (env?.projects.length > 0 && env?.lastUserId) {\n nextProjectId = env.projects.find(\n p => p.toLowerCase() === projectId.toLowerCase()\n );\n if (nextProjectId) {\n env.currentProject = nextProjectId;\n session.UpdateEnv(env);\n log.success(messages.projects.set(projectId));\n log.raw('');\n } else {\n log.error(messages.projects.failedSet(projectId));\n }\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n }\n return nextProjectId;\n };\n\n SetVersion = (versionStatus: 'latest' | 'published') => {\n const { env, log, messages, session } = this;\n if (!['latest', 'published'].includes(versionStatus)) {\n log.error(messages.version.invalid(versionStatus));\n return false;\n }\n if (!env) {\n log.help(messages.version.noEnv());\n return false;\n }\n if (env?.projects.length > 0 && env?.lastUserId) {\n session.UpdateEnv({ versionStatus });\n log.success(messages.version.set(this.currentEnv, versionStatus));\n return true;\n } else {\n // No projects for currentEnv, try logging in\n log.warning(messages.projects.noList());\n log.help(messages.connect.tip());\n return false;\n }\n };\n\n HydrateContensis = async () => {\n const { log } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve content types list for env\n const [contensisErr, models] = await to(\n contensis.models.HydrateContensisRepositories()\n );\n\n if (contensisErr) {\n log.error(contensisErr.message);\n return contensisErr;\n }\n }\n };\n\n PrintApiKeys = async () => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n\n if (Array.isArray(apiKeys)) {\n log.success(messages.keys.list(currentEnv));\n this.HandleFormattingAndOutput(apiKeys, () => {\n // print the keys to console\n for (const {\n id,\n sharedSecret,\n name,\n description,\n dateModified,\n modifiedBy,\n } of apiKeys) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${dateModified.toString().substring(0, 10)} ${modifiedBy}]`\n );\n console.log(` ${id}`);\n console.log(` ${sharedSecret}`);\n }\n });\n }\n\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n }\n }\n };\n\n CreateApiKey = async (name: string, description?: string) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, key] = await contensis.apiKeys.CreateKey(name, description);\n\n if (key) {\n log.success(messages.keys.created(currentEnv, name));\n\n // print the key details to console\n console.log(\n ` - ${key.name}${\n key.description ? ` (${key.description})` : ''\n } [${key.dateModified.toString().substring(0, 10)} ${key.modifiedBy}]`\n );\n console.log(` - id: ${key.id}`);\n console.log(` - sharedSecret: ${key.sharedSecret}`);\n }\n console.log('');\n\n if (err) {\n log.error(messages.keys.failedCreate(currentEnv, name), err);\n }\n }\n };\n\n RemoveApiKey = async (id: string) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis({ commit: true });\n\n if (contensis) {\n const [err, key] = await contensis.apiKeys.RemoveKey(id);\n\n if (!err) {\n log.success(messages.keys.removed(currentEnv, id));\n console.log('');\n } else {\n log.error(messages.keys.failedRemove(currentEnv, id), err);\n }\n }\n };\n\n CreateProject = async (project: Project) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, created] = await contensis.projects.CreateProject(project);\n\n if (created) {\n log.success(messages.projects.created(currentEnv, project.id));\n\n this.HandleFormattingAndOutput(created, () => {\n // set the CLI project to the newly created project\n this.SetProject(project.id);\n // print all the projects to console\n this.PrintProjects();\n });\n return project.id;\n }\n\n if (err) {\n log.error(messages.projects.failedCreate(currentEnv, project.id), err);\n }\n }\n };\n\n UpdateProject = async (project: Partial<Project>) => {\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n const [err, updated] = await contensis.projects.UpdateProject({\n id: currentProject,\n ...project,\n });\n\n if (updated) {\n log.success(messages.projects.updated(currentEnv, currentProject));\n\n this.HandleFormattingAndOutput(updated, log.object);\n return updated.id;\n }\n\n if (err) {\n log.error(\n messages.projects.failedUpdate(currentEnv, currentProject),\n err\n );\n }\n }\n };\n\n GetContentTypes = async () => {\n const { currentProject, log, messages } = this;\n let err;\n if (!this.contensis) err = await this.HydrateContensis();\n\n if (err) log.error(messages.models.noList(currentProject));\n if (!this.contensis) log.warning(messages.models.noList(currentProject));\n\n return this.contensis;\n };\n\n PrintContentModels = async (modelIds: string[] = []) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.GetContentTypes();\n if (contensis) {\n // Retrieve models list for env\n const { models, contentTypes = [], components = [] } = this;\n\n // Models to output to console\n const returnModels = modelIds?.length\n ? models?.filter((m: Model) =>\n modelIds.some(id => id.toLowerCase() === m.id.toLowerCase())\n )\n : undefined;\n\n // Generate a list of contentTypeIds and componentIds from all models\n // and dependencies\n const contentTypeIds = Array.from(\n new Set([\n ...(returnModels || models || []).map(m => m.id),\n ...(returnModels || models || [])\n .map(m => m.dependencies?.contentTypes?.map(c => c[0]) || [])\n .flat(),\n ])\n );\n const componentIds = Array.from(\n new Set(\n (returnModels || models || [])\n .map(m => m.dependencies?.components?.map(c => c[0]) || [])\n .flat()\n )\n );\n\n // Create an array of all the content types and component definitions\n // we will use this when outputting to a file\n const contentModelBackup = [\n ...contentTypes.filter(c => contentTypeIds.includes(c.id)),\n ...components.filter(c => componentIds.includes(c.id)),\n ];\n\n if (Array.isArray(returnModels)) {\n log.success(messages.models.list(currentProject));\n this.HandleFormattingAndOutput(contentModelBackup, () => {\n // print the content models to console\n for (const model of returnModels) {\n log.raw('');\n log.object(model);\n }\n log.raw('');\n });\n } else {\n log.success(\n messages.models.get(currentProject, models?.length.toString() || '0')\n );\n log.raw('');\n if (models?.length) {\n this.HandleFormattingAndOutput(contentModelBackup, () => {\n // print the content models s#qto console\n for (const model of models) {\n const components = model.components?.length || 0;\n const contentTypes = model.contentTypes?.length || 0;\n const dependencies =\n (model.dependencies?.components?.length || 0) +\n (model.dependencies?.contentTypes?.length || 0);\n const dependencyOf =\n (model.dependencyOf?.components?.length || 0) +\n (model.dependencyOf?.contentTypes?.length || 0);\n\n const hasAny =\n components + contentTypes + dependencies + dependencyOf;\n log.raw(\n ` - ${log.highlightText(log.boldText(model.id))} ${\n hasAny\n ? log.infoText(\n `{ ${components ? `components: ${components}, ` : ''}${\n contentTypes ? `contentTypes: ${contentTypes}, ` : ''\n }${\n dependencies ? `references: ${dependencies}, ` : ''\n }${\n dependencyOf ? `required by: ${dependencyOf}` : ''\n } }`\n )\n : ''\n }`\n );\n }\n log.raw('');\n });\n }\n }\n }\n };\n\n ImportContentModels = async ({\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n }) => {\n const { currentProject, log, messages } = this;\n\n const fileData = fromFile\n ? readJsonFile<(ContentType | Component)[]>(fromFile) || []\n : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n const contensis = await this.ConnectContensisImport({\n commit,\n fromFile,\n importDataType: 'models',\n });\n\n if (contensis) {\n log.line();\n if (contensis.isPreview) {\n console.log(log.successText(` -- IMPORT PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING IMPORT *** `));\n }\n\n const [migrateErr, result] = await contensis.MigrateContentModels();\n\n if (migrateErr) logError(migrateErr);\n else\n this.HandleFormattingAndOutput(result, () => {\n // print the results to console\n if (!commit) {\n log.raw(log.boldText(`\\nContent types:`));\n if (!result.contentTypes) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.contentTypes);\n\n log.raw(log.boldText(`\\nComponents:`));\n if (!result.components) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.components);\n } else {\n const migrateResult = result as MigrateModelsResult;\n log.raw(log.boldText(`\\nContent types:`));\n printModelMigrationResult(\n this,\n migrateResult[currentProject].contentTypes\n );\n\n log.raw(log.boldText(`\\nComponents:`));\n printModelMigrationResult(\n this,\n migrateResult[currentProject].components\n );\n }\n });\n } else {\n log.warning(messages.models.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n PrintContentTypes = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n log.success(messages.contenttypes.list(currentProject));\n this.HandleFormattingAndOutput(contentTypes, () => {\n // print the content types to console\n for (const contentType of contentTypes) {\n const fieldsLength = contentType.fields?.length || 0;\n console.log(\n ` - ${contentType.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintContentType = async (contentTypeId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { contentTypes } = this;\n\n if (Array.isArray(contentTypes)) {\n const contentType = contentTypes.find(\n c => c.id.toLowerCase() === contentTypeId.toLowerCase()\n );\n if (contentType) {\n log.success(\n messages.contenttypes.get(currentProject, contentType.id)\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, log.object);\n } else {\n log.error(\n messages.contenttypes.failedGet(currentProject, contentTypeId)\n );\n }\n }\n }\n };\n\n RemoveContentTypes = async (contentTypeIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: 'user-input',\n });\n if (contensis) {\n const [err, result] = await contensis.DeleteContentTypes(contentTypeIds);\n\n if (err) {\n log.error(\n messages.contenttypes.failedRemove(\n currentProject,\n contentTypeIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.contenttypes.removed(\n currentProject,\n contentTypeIds.join('\", \"'),\n !contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.object(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportContentTypes = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n contentTypeIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<ContentType[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: fromFile ? 'user-input' : undefined,\n });\n\n if (contensis) {\n // Pass each content type to the target repo\n for (const contentType of fileData) {\n // Fix invalid data\n contentType.projectId = currentProject;\n delete contentType.uuid;\n\n const [err, created, createStatus] = await contensis.models.targetRepos[\n currentProject\n ].repo.UpsertContentType(false, contentType);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.contenttypes.created(\n currentProject,\n contentType.id,\n createStatus\n )\n );\n // print the content type to console\n this.HandleFormattingAndOutput(contentType, () => {});\n }\n }\n }\n };\n\n DiffModels = async (\n {\n fromFile,\n }: {\n fromFile: string;\n },\n modelIds: string[] = []\n ) => {\n const { log } = this;\n\n let fileData = fromFile ? readJsonFile<ContentType[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n const contensis = await this.ConnectContensisImport({\n fromFile,\n importDataType: 'models',\n });\n\n if (contensis) {\n const [err, result] = (await to(\n contensis.models.Diff(fileData.length ? fileData : modelIds)\n )) as [Error | null, ContentTypesResult | undefined];\n\n if (err) log.error(err.message, err);\n if (result)\n // print the content type to console\n this.HandleFormattingAndOutput(result, () => {\n log.success(\n `Queried models ${log.infoText(\n `\"${result.query.modelIds?.join(', ')}\"`\n )}\\n`\n );\n\n log.raw(log.boldText(`Content types:`));\n if (!result.contentTypes) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.contentTypes);\n\n log.raw(log.boldText(`Components:`));\n if (!result.components) log.info(`- None returned\\n`);\n else printModelMigrationAnalysis(this, result.components);\n });\n }\n };\n\n PrintComponents = async () => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve components list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n log.success(messages.components.list(currentProject));\n\n this.HandleFormattingAndOutput(components, () => {\n // print the components to console\n for (const component of components) {\n const fieldsLength = component.fields?.length || 0;\n console.log(\n ` - ${component.id} [${fieldsLength} field${\n fieldsLength !== 1 ? 's' : ''\n }]`\n );\n }\n });\n }\n }\n };\n\n PrintComponent = async (componentId: string) => {\n const { currentProject, log, messages } = this;\n await this.GetContentTypes();\n if (this.contensis) {\n // Retrieve content types list for env\n const { components } = this;\n\n if (Array.isArray(components)) {\n const component = components.find(\n c => c.id.toLowerCase() === componentId.toLowerCase()\n );\n if (component) {\n log.success(messages.components.get(currentProject, component.id));\n // print the component to console\n this.HandleFormattingAndOutput(component, log.object);\n } else {\n log.error(messages.components.failedGet(currentProject, componentId));\n }\n }\n }\n };\n\n RemoveComponents = async (componentIds: string[], commit = false) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: 'user-input',\n });\n if (contensis) {\n const [err, result] = await contensis.DeleteContentTypes(\n undefined,\n componentIds\n );\n\n if (err) {\n log.error(\n messages.components.failedRemove(\n currentProject,\n componentIds.join('\", \"')\n ),\n err\n );\n } else {\n log.success(\n messages.components.removed(\n currentProject,\n componentIds.join('\", \"'),\n !contensis.isPreview\n )\n );\n // print the results to console\n this.HandleFormattingAndOutput(result, () =>\n log.info(jsonFormatter(result))\n );\n }\n }\n };\n\n ImportComponents = async (\n {\n commit,\n fromFile,\n }: {\n commit: boolean;\n fromFile: string;\n },\n componentIds: string[] = []\n ) => {\n const { currentProject, log, messages } = this;\n\n let fileData = fromFile ? readJsonFile<Component[]>(fromFile) || [] : [];\n if (typeof fileData === 'string')\n throw new Error(`Import file format must be of type JSON`);\n\n if (!Array.isArray(fileData)) fileData = [fileData];\n\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: fromFile ? 'user-input' : undefined,\n });\n\n if (contensis) {\n // Pass each component to the target repo\n for (const component of fileData) {\n // Fix invalid data\n component.projectId = currentProject;\n delete component.uuid;\n\n const [err, created, createStatus] = await contensis.models.targetRepos[\n currentProject\n ].repo.UpsertComponent(false, component);\n\n if (err) log.error(err.message, err);\n if (createStatus) {\n log.success(\n messages.components.created(\n currentProject,\n component.id,\n createStatus\n )\n );\n // print the component to console\n this.HandleFormattingAndOutput(component, () => {});\n }\n }\n }\n };\n\n RemoveEntries = async (commit = false) => {\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensisImport({\n commit,\n importDataType: 'user-input',\n });\n\n if (contensis) {\n if (contensis.isPreview) {\n console.log(log.successText(` -- PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING DELETE *** `));\n }\n const [err, result] = await contensis.DeleteEntries();\n if (result)\n this.HandleFormattingAndOutput(result, () => {\n // print the migrateResult to console\n printMigrateResult(this, result, {\n action: 'delete',\n showAllEntries: true,\n });\n });\n if (\n !err &&\n ((!commit && result.entriesToMigrate[currentProject].totalCount) ||\n (commit && result.migrateResult?.deleted))\n ) {\n log.success(messages.entries.removed(currentEnv, commit));\n if (!commit) {\n log.raw(``);\n log.help(messages.entries.commitTip());\n }\n } else {\n log.error(messages.entries.failedRemove(currentEnv), err);\n if (!result.entriesToMigrate[currentProject].totalCount)\n log.help(messages.entries.notFound(currentEnv));\n }\n }\n };\n\n GetEntries = async ({\n withDependents = false,\n }: {\n withDependents?: boolean;\n }) => {\n const { currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n log.line();\n const entries = await contensis.GetEntries({ withDependents });\n this.HandleFormattingAndOutput(entries, () =>\n // print the entries to console\n logEntriesTable(\n entries,\n currentProject,\n contensis.payload.query?.fields\n )\n );\n } else {\n log.warning(messages.models.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n ImportEntries = async ({\n commit,\n fromFile,\n logOutput,\n }: {\n commit: boolean;\n fromFile: string;\n logOutput: string;\n }) => {\n const { currentEnv, currentProject, log, messages } = this;\n\n const contensis = await this.ConnectContensisImport({\n commit,\n fromFile,\n importDataType: 'entries',\n });\n\n if (contensis) {\n log.line();\n if (contensis.isPreview) {\n console.log(log.successText(` -- IMPORT PREVIEW -- `));\n } else {\n console.log(log.warningText(` *** COMMITTING IMPORT *** `));\n }\n\n const [err, result] = await contensis.MigrateEntries();\n\n if (err) logError(err);\n else\n this.HandleFormattingAndOutput(result, () => {\n // print the migrateResult to console\n printMigrateResult(this, result, {\n showAllEntries: logOutput === 'all',\n showChangedEntries: logOutput === 'changes',\n });\n });\n\n if (\n !err &&\n !result.errors?.length &&\n ((!commit && result.entriesToMigrate[currentProject].totalCount) ||\n (commit &&\n (result.migrateResult?.created || result.migrateResult?.updated)))\n ) {\n log.success(\n messages.entries.imported(\n currentEnv,\n commit,\n commit\n ? (result.migrateResult?.created || 0) +\n (result.migrateResult?.updated || 0)\n : result.entriesToMigrate[currentProject].totalCount\n )\n );\n if (!commit) {\n log.raw(``);\n log.help(messages.entries.commitTip());\n }\n } else {\n log.error(messages.entries.failedImport(currentEnv), err);\n if (!result.entriesToMigrate[currentProject].totalCount)\n log.help(messages.entries.notFound(currentEnv));\n }\n } else {\n log.warning(messages.models.noList(currentProject));\n log.help(messages.connect.tip());\n }\n };\n\n PrintWebhookSubscriptions = async (\n subscriptionIds?: string[],\n name?: string\n ) => {\n const { currentEnv, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve webhooks list for env\n const [webhooksErr, webhooks] =\n await contensis.subscriptions.webhooks.GetSubscriptions();\n\n const filteredResults =\n typeof name === 'string'\n ? webhooks?.filter(w =>\n w.name?.toLowerCase().includes(name.toLowerCase())\n )\n : Array.isArray(subscriptionIds)\n ? webhooks?.filter(w => subscriptionIds?.some(id => id === w.id))\n : webhooks;\n\n if (Array.isArray(filteredResults)) {\n this.HandleFormattingAndOutput(filteredResults, () => {\n // print the keys to console\n log.success(messages.webhooks.list(currentEnv));\n for (const {\n id,\n description,\n method,\n name,\n version,\n url,\n } of filteredResults) {\n console.log(\n ` - ${name}${\n description ? ` (${description})` : ''\n } [${version.modified.toString().substring(0, 10)} ${\n version.modifiedBy\n }]`\n );\n console.log(` ${id}`);\n console.log(` [${method}] ${url}`);\n }\n console.log('');\n });\n }\n\n if (webhooksErr) {\n log.error(messages.webhooks.noList(currentEnv));\n log.error(jsonFormatter(webhooksErr));\n }\n }\n };\n\n PrintBlocks = async () => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve blocks list for env\n const [err, blocks] = await contensis.blocks.GetBlocks();\n\n if (Array.isArray(blocks)) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the blocks to console\n log.success(messages.blocks.list(currentEnv, env.currentProject));\n for (const {\n id,\n description,\n branches,\n liveVersion,\n madeLive,\n versionsSinceLive,\n } of blocks) {\n console.log(\n ` - ${id}${description ? ` (${description})` : ''}${\n madeLive\n ? ` [${madeLive.toString().substring(0, 10)} v${liveVersion}]`\n : ''\n }${\n versionsSinceLive\n ? log.warningText(` +${versionsSinceLive}`)\n : ''\n }`\n );\n for (const branch of branches)\n console.log(\n log.infoText(` [${branch.id}]: ${branch.status}`)\n );\n }\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockVersions = async (\n blockId: string,\n branch: string,\n version: string\n ) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block version\n const [err, blocks] = await contensis.blocks.GetBlockVersions(\n blockId,\n branch,\n version\n );\n\n if (blocks) {\n this.HandleFormattingAndOutput(blocks, () => {\n // print the version detail to console\n log.success(\n messages.blocks.get(blockId, currentEnv, env.currentProject)\n );\n for (const block of blocks)\n printBlockVersion(\n this,\n block,\n !version\n ? {\n showImage: false,\n showSource: true,\n showStaticPaths: false,\n showStatus: false,\n }\n : undefined\n );\n });\n }\n\n if (err) {\n log.error(messages.blocks.noList(currentEnv, env.currentProject));\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PushBlock = async (block: PushBlockParams) => {\n const { currentEnv, env, log, messages } = this;\n\n // Output request to console\n log.info(\n messages.blocks.tryPush(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n console.log(jsonFormatter(block));\n\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Push new block version\n const [err, blockVersion] = await contensis.blocks.PushBlockVersion(\n block\n );\n if (!err) {\n log.success(\n messages.blocks.pushed(\n block.id,\n block.source.branch,\n currentEnv,\n env.currentProject\n )\n );\n }\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n printBlockVersion(this, blockVersion);\n });\n }\n if (err)\n throw new Error(\n messages.blocks.failedPush(block.id, currentEnv, env.currentProject)\n );\n } else {\n throw new Error(\n messages.blocks.failedPush(block.id, currentEnv, env.currentProject)\n );\n }\n };\n\n ReleaseBlock = async (blockId: string, version: string) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block version\n const [err, blockVersion] = await contensis.blocks.BlockAction(\n blockId,\n 'release',\n version\n );\n\n if (blockVersion) {\n this.HandleFormattingAndOutput(blockVersion, () => {\n // print the version detail to console\n log.success(\n messages.blocks.released(blockId, currentEnv, env.currentProject)\n );\n printBlockVersion(this, blockVersion);\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedRelease(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n PrintBlockLogs = async (\n blockId: string,\n branch: string,\n version: string,\n dataCenter: 'hq' | 'manchester' | 'london'\n ) => {\n const { currentEnv, env, log, messages } = this;\n const contensis = await this.ConnectContensis();\n if (contensis) {\n // Retrieve block logs\n log.success(\n messages.blocks.getLogs(blockId, branch, currentEnv, env.currentProject)\n );\n\n const [err, blockLogs] = await contensis.blocks.GetBlockLogs({\n blockId,\n branchId: branch,\n version,\n dataCenter,\n });\n\n if (blockLogs) {\n this.HandleFormattingAndOutput(blockLogs, () => {\n // print the logs to console\n console.log(\n ` - ${blockId} ${branch} ${\n Number(version) ? `v${version}` : version\n } [${dataCenter}]`\n );\n log.line();\n console.log(log.infoText(blockLogs));\n log.line();\n });\n }\n\n if (err) {\n log.error(\n messages.blocks.failedGetLogs(blockId, currentEnv, env.currentProject)\n );\n log.error(jsonFormatter(err));\n }\n }\n };\n\n HandleFormattingAndOutput = <T>(obj: T, logFn: (obj: T) => void) => {\n const { format, log, messages, output } = this;\n if (!format) {\n // print the object to console\n logFn(obj);\n } else if (format === 'csv') {\n log.raw('');\n log.raw(log.infoText(csvFormatter(obj)));\n } else if (format === 'xml') {\n log.raw('');\n log.raw(log.infoText(xmlFormatter(obj)));\n } else if (format === 'json') {\n log.raw('');\n log.raw(log.infoText(jsonFormatter(obj)));\n }\n log.raw('');\n\n if (output) {\n let writeString = '';\n if (format === 'csv') {\n writeString = csvFormatter(obj as any);\n } else if (format === 'xml') {\n writeString = xmlFormatter(obj as any);\n } else writeString = jsonFormatter(obj);\n // write output to file\n if (writeString) {\n fs.writeFileSync(output, writeString);\n log.success(messages.app.fileOutput(format, output));\n } else {\n log.info(messages.app.noFileOutput());\n }\n }\n };\n}\n\nexport const cliCommand = (\n commandArgs: string[],\n outputOpts: OutputOptions & IConnectOptions = {},\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisCli(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\nexport default ContensisCli;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AACf,kBAAiB;AACjB,wBAAkB;AAClB,sBAAqB;AACrB,yBAAe;AACf,mBAAkB;AAElB,kBAAwD;AACxD,kCAAiC;AACjC,kCAAiC;AACjC,gCAA+B;AAC/B,oBAAiC;AACjC,mBAA4B;AAC5B,0BASO;AAGP,iBAA6B;AAC7B,iBAA6B;AAC7B,kBAA8B;AAC9B,qBAKO;AACP,2BAA6B;AA0B7B,IAAI,+BAA+B;AAEnC,MAAM,aAAa;AAAA,EACjB,OAAO,OAAO,CAAC,UAAkB;AAC/B,YAAQ,mBAAmB,MAAM;AACjC,UAAM,WAAW,QAAQ,IAAI;AAG7B,YAAQ,KAAK,QAAQ;AAAA,EACvB;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAUA,MAAM;AAAA,EACN,WAAW;AAAA,EAEX;AAAA,EACA;AAAA,EACA;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,QAAQ,IAAI;AAAA,EAC1B;AAAA,EAEA,IAAI,aAAa;AACf,WAAO,KAAK,MAAM,sBAAsB;AAAA,EAC1C;AAAA,EAEA,IAAI,WAAW,oBAA4B;AACzC,SAAK,QAAQ,OAAO,EAAE,mBAAmB,CAAC;AAAA,EAC5C;AAAA,EAEA,IAAI,MAAM;AACR,UAAM,qBAAqB,KAAK;AAChC,UAAM,eAAe,KAAK,MAAM,gBAAgB,CAAC;AAEjD,QAA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,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,IACzC,WAAW,WAAW,OAAO;AAC3B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,yBAAa,GAAG,CAAC,CAAC;AAAA,IACzC,WAAW,WAAW,QAAQ;AAC5B,UAAI,IAAI,EAAE;AACV,UAAI,IAAI,IAAI,aAAS,2BAAc,GAAG,CAAC,CAAC;AAAA,IAC1C;AACA,QAAI,IAAI,EAAE;AAEV,QAAI,QAAQ;AACV,UAAI,cAAc;AAClB,UAAI,WAAW,OAAO;AACpB,0BAAc,yBAAa,GAAU;AAAA,MACvC,WAAW,WAAW,OAAO;AAC3B,0BAAc,yBAAa,GAAU;AAAA,MACvC;AAAO,0BAAc,2BAAc,GAAG;AAEtC,UAAI,aAAa;AACf,kBAAAC,QAAG,cAAc,QAAQ,WAAW;AACpC,YAAI,QAAQ,SAAS,IAAI,WAAW,QAAQ,MAAM,CAAC;AAAA,MACrD,OAAO;AACL,YAAI,KAAK,SAAS,IAAI,aAAa,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,aAAa,CACxB,aACA,aAA8C,CAAC,GAC/C,gBAAyC,CAAC,MACvC;AACH,SAAO,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,WAAW,GAAG,YAAY,aAAa;AAC7E;AACA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["SessionCacheProvider", "path", "to", "fetch", "CredentialProvider", "inquirer", "ContensisAuthService", "chalk", "components", "contentTypes", "name", "url", "fs"]
|
|
7
7
|
}
|
|
@@ -181,20 +181,18 @@ const printMigrateResult = ({ log, messages, currentProject }, migrateResult, {
|
|
|
181
181
|
)}`}`
|
|
182
182
|
);
|
|
183
183
|
for (const [contentTypeId, count] of Object.entries(contentTypeCounts)) {
|
|
184
|
+
const isTotalCountRow = contentTypeId === "totalCount";
|
|
184
185
|
const migrateStatusAndCount = migrateResult.entriesToMigrate[currentProject][contentTypeId];
|
|
185
186
|
const existingCount = ((_b = (_a = migrateResult.existing) == null ? void 0 : _a[currentProject]) == null ? void 0 : _b[contentTypeId]) || 0;
|
|
186
187
|
const existingPercent = (existingCount / count * 100).toFixed(0);
|
|
187
188
|
const noChangeOrTotalEntriesCount = typeof migrateStatusAndCount !== "number" ? (migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["no change"]) || 0 : migrateStatusAndCount;
|
|
188
|
-
const isTotalCountRow = contentTypeId === "totalCount";
|
|
189
189
|
const changedPercentage = (noChangeOrTotalEntriesCount / count * 100).toFixed(0);
|
|
190
|
-
const existingColor = existingPercent === "0" ? log.warningText : log.infoText;
|
|
190
|
+
const existingColor = existingPercent === "0" || action === "delete" ? log.warningText : log.infoText;
|
|
191
191
|
const changedColor = isTotalCountRow ? log.helpText : changedPercentage === "100" ? log.successText : log.warningText;
|
|
192
192
|
console.log(
|
|
193
193
|
` - ${isTotalCountRow ? log.highlightText(
|
|
194
194
|
`${contentTypeId}: ${noChangeOrTotalEntriesCount}`
|
|
195
|
-
) : `${contentTypeId}: ${log.helpText(count)}`}${changedPercentage === "100" || action === "
|
|
196
|
-
` [existing: ${isTotalCountRow ? existingCount : `${existingPercent}%`}]`
|
|
197
|
-
)}${existingPercent === "0" ? "" : changedColor(
|
|
195
|
+
) : `${contentTypeId}: ${log.helpText(count)}`}${changedPercentage === "100" || isTotalCountRow ? "" : existingColor(` [existing: ${`${existingPercent}%`}]`)}${existingPercent === "0" || action === "import" && isTotalCountRow ? "" : changedColor(
|
|
198
196
|
` ${isTotalCountRow ? `[to ${action}: ${noChangeOrTotalEntriesCount}]` : changedPercentage === "100" ? "up to date" : `[needs update: ${100 - Number(changedPercentage)}%]`}`
|
|
199
197
|
)}`
|
|
200
198
|
);
|
|
@@ -206,7 +204,7 @@ const printMigrateResult = ({ log, messages, currentProject }, migrateResult, {
|
|
|
206
204
|
`
|
|
207
205
|
);
|
|
208
206
|
for (const error of migrateResult.errors)
|
|
209
|
-
log.error(error.message || error);
|
|
207
|
+
log.error(error.message || error, null, "");
|
|
210
208
|
}
|
|
211
209
|
};
|
|
212
210
|
const highlightDiffText = (str) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/console.printer.ts"],
|
|
4
|
-
"sourcesContent": ["import dayjs from 'dayjs';\nimport { BlockVersion, MigrateModelsResult, MigrateStatus } from 'migratortron';\nimport ContensisCli from '~/services/ContensisCliService';\nimport { Logger } from './logger';\n\nconst formatDate = (date: Date | string, format = 'DD/MM/YYYY HH:mm') =>\n dayjs(date).format(format);\n\nexport const printBlockVersion = (\n { log, messages }: ContensisCli,\n block: BlockVersion,\n printOptions = {\n showSource: true,\n showStatus: true,\n showStaticPaths: true,\n showImage: true,\n }\n) => {\n console.log(\n ` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`\n );\n console.log(\n ` state: ${messages.blocks.runningStatus(\n block.status.broken ? 'broken' : block.status.running.global\n )}`\n );\n console.log(\n ` released: ${log.infoText(\n block.version.released\n ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}`\n : 'no'\n )}`\n );\n if (block.version.madeLive)\n console.log(\n ` live: ${log.infoText(\n `[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`\n )}`\n );\n if (printOptions.showStatus) {\n console.log(` status:`);\n console.log(` deployment: ${log.infoText(block.status.deployment)}`);\n console.log(` workflow: ${log.infoText(block.status.workflow)}`);\n console.log(\n ` running status: ${messages.blocks.runningStatus(\n block.status.running.global\n )}`\n );\n console.log(` datacentres:`);\n console.log(\n ` hq: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.hq\n )}`\n );\n console.log(\n ` london: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.london\n )}`\n );\n console.log(\n ` manchester: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.manchester\n )}`\n );\n }\n if (printOptions.showSource) {\n console.log(` source:`);\n console.log(` commit: ${log.helpText(block.source.commit.id)}`);\n console.log(\n ` message: ${log.infoText(\n block.source.commit.message\n ?.replaceAll('\\n', '\\\\n')\n .replaceAll('\\\\n\\\\n', '\\\\n')\n .replaceAll('\\\\n', '; ')\n )}`\n );\n console.log(\n ` committed: ${log.infoText(\n `[${formatDate(block.source.commit.dateTime)}] ${\n block.source.commit.authorEmail\n }`\n )}`\n );\n console.log(\n ` pushed: ${log.infoText(\n `[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`\n )}`\n );\n console.log(` ${log.infoText(block.source.commit.commitUrl)}`);\n }\n if (printOptions.showImage) {\n console.log(` image:`);\n console.log(` uri: ${log.infoText(block.image.uri)}`);\n console.log(` tag: ${log.helpText(block.image.tag)}`);\n }\n if (printOptions.showStaticPaths) {\n if (block.staticPaths?.length) {\n console.log(` static paths:`);\n for (const path of block.staticPaths) console.log(` - ${path}`);\n }\n }\n if (block.stagingUrl)\n console.log(` staging url: ${log.infoText(block.stagingUrl)}`);\n console.log('');\n};\n\nexport const printMigrateResult = (\n { log, messages, currentProject }: ContensisCli,\n migrateResult: any,\n {\n action = 'import',\n showDiff = false,\n showAllEntries = false,\n showChangedEntries = false,\n }: {\n action?: 'import' | 'delete';\n showDiff?: boolean;\n showAllEntries?: boolean;\n showChangedEntries?: boolean;\n } = {}\n) => {\n // if (Object.keys(migrateResult.entriesToMigrate.entryIds).length)\n console.log(``);\n\n for (const [contentTypeId, entryRes] of Object.entries(\n migrateResult.entriesToMigrate.entryIds\n ) as [string, any]) {\n for (const [originalId, entryStatus] of Object.entries(entryRes) as [\n string,\n any\n ][]) {\n // console.log(`${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`);\n if (\n showAllEntries ||\n (showChangedEntries &&\n (\n Object.entries(\n Object.entries(entryStatus[currentProject])[0]\n )[1][1] as any\n ).status !== 'no change')\n ) {\n console.log(\n log.infoText(\n `${originalId} ${Object.entries(entryStatus || {})\n .filter(x => x[0] !== 'entryTitle')\n .map(([projectId, projectStatus]) => {\n const [targetGuid, { status }] = (Object.entries(\n projectStatus || {}\n )?.[0] as [string, { status: MigrateStatus }]) || [\n '',\n { x: { status: undefined } },\n ];\n return `${messages.migrate.status(status)(`${status}`)}${\n targetGuid !== originalId ? `-> ${targetGuid}` : ''\n }`;\n })}`\n ) + ` ${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`\n );\n\n for (const [projectId, projectStatus] of Object.entries(\n entryStatus\n ).filter(([key]) => key !== 'entryTitle') as [string, any][]) {\n const [targetGuid, { error, diff, status }] = Object.entries(\n projectStatus\n )[0] as [string, any];\n if (error) log.error(error);\n if (diff && showDiff) {\n console.log(\n ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(diff)\n )}\\n`\n );\n }\n }\n }\n }\n }\n if (showAllEntries || showChangedEntries) console.log(``);\n // if (\n // contensis?.isPreview &&\n // migrateResult.entriesToMigrate?.[currentProject]?.totalCount > 0 &&\n // !migrateResult.errors\n // ) {\n // log.help(messages.entries.commitTip());\n // }\n\n for (const [projectId, contentTypeCounts] of Object.entries(\n migrateResult.entries || {}\n ) as [string, any][]) {\n log.help(\n `${action} from project ${\n action === 'delete'\n ? log.warningText(currentProject)\n : `${log.highlightText(projectId)} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n for (const [contentTypeId, count] of Object.entries(contentTypeCounts) as [\n string,\n number\n ][]) {\n const migrateStatusAndCount =\n migrateResult.entriesToMigrate[currentProject][contentTypeId];\n const existingCount =\n migrateResult.existing?.[currentProject]?.[contentTypeId] || 0;\n const existingPercent = ((existingCount / count) * 100).toFixed(0);\n const noChangeOrTotalEntriesCount =\n typeof migrateStatusAndCount !== 'number'\n ? migrateStatusAndCount?.['no change'] || 0\n : migrateStatusAndCount;\n\n const isTotalCountRow = contentTypeId === 'totalCount';\n\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / count) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' ? log.warningText : log.infoText;\n const changedColor = isTotalCountRow\n ? log.helpText\n : changedPercentage === '100'\n ? log.successText\n : log.warningText;\n\n console.log(\n ` - ${\n isTotalCountRow\n ? log.highlightText(\n `${contentTypeId}: ${noChangeOrTotalEntriesCount}`\n )\n : `${contentTypeId}: ${log.helpText(count)}`\n }${\n changedPercentage === '100' || action === 'delete'\n ? ''\n : existingColor(\n ` [existing: ${\n isTotalCountRow ? existingCount : `${existingPercent}%`\n }]`\n )\n }${\n existingPercent === '0'\n ? ''\n : changedColor(\n ` ${\n isTotalCountRow\n ? `[to ${action}: ${noChangeOrTotalEntriesCount}]`\n : changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n for (const error of migrateResult.errors) log.error(error.message || error);\n }\n};\n\nconst highlightDiffText = (str: string) => {\n const addedRegex = new RegExp(/<<\\+>>(.*?)<<\\/\\+>>/, 'g');\n const removedRegex = new RegExp(/<<->>(.*?)<<\\/->>/, 'g');\n return str\n .replace(addedRegex, match => {\n return Logger.successText(\n match.replace(/<<\\+>>/g, '<+>').replace(/<<\\/\\+>>/g, '</+>')\n );\n })\n .replace(removedRegex, match => {\n return Logger.errorText(\n match.replace(/<<->>/g, '<->').replace(/<<\\/->>/g, '</->')\n );\n });\n};\n\nexport const printModelMigrationAnalysis = (\n { log, messages }: ContensisCli,\n result: any = {}\n) => {\n for (const [contentTypeId, model] of Object.entries(result) as [\n string,\n any\n ][]) {\n let mainOutput = log.standardText(` - ${contentTypeId}`);\n let extraOutput = '';\n let errorOutput = '';\n let diffOutput = '';\n for (const [key, details] of Object.entries(model) as [string, any][]) {\n if (key === 'dependencies') {\n extraOutput += log.infoText(\n ` references: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'dependencyOf') {\n extraOutput += log.infoText(\n ` required by: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'projects') {\n for (const [projectId, projectDetails] of Object.entries(details) as [\n string,\n any\n ][]) {\n mainOutput += log.infoText(\n ` [${messages.migrate.status(projectDetails.status)(\n `${projectId}: ${projectDetails.status}`\n )}] v${projectDetails.versionNo}`\n );\n if (projectDetails.diff)\n diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(projectDetails.diff)\n )}\\n`;\n if (projectDetails.error)\n errorOutput += ` ${log.highlightText(\n `error::`\n )} ${log.errorText(projectDetails.error)}`;\n }\n }\n }\n console.log(mainOutput);\n if (extraOutput) {\n const search = '\\n';\n const replace = '';\n console.log(\n extraOutput.replace(\n new RegExp(search + '([^' + search + ']*)$'),\n replace + '$1'\n )\n );\n }\n if (diffOutput) console.log(diffOutput);\n if (errorOutput) console.log(errorOutput);\n }\n};\n\ntype MigrateResultSummary = MigrateModelsResult['']['contentTypes'];\ntype MigrateResultStatus = keyof MigrateResultSummary;\n\nexport const printModelMigrationResult = (\n { log, messages }: ContensisCli,\n result: MigrateResultSummary\n) => {\n for (const [status, ids] of Object.entries(result) as [\n MigrateResultStatus,\n string[]\n ][]) {\n if (ids?.length) {\n if (status === 'errors') {\n const errors: [string, MappedError][] = ids as any;\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.map(id => id[0]).join(', ')\n )} ]\\n`\n );\n for (const [contentTypeId, error] of errors)\n log.error(\n `${log.highlightText(contentTypeId)}: ${error.message}`,\n error\n );\n } else\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.join(', ')\n )} ]`\n );\n }\n }\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGlB,oBAAuB;AAEvB,MAAM,aAAa,CAAC,MAAqB,SAAS,2BAChD,aAAAA,SAAM,IAAI,EAAE,OAAO,MAAM;AAEpB,MAAM,oBAAoB,CAC/B,EAAE,KAA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I,CAAC,MACF;AAxHL;
|
|
4
|
+
"sourcesContent": ["import dayjs from 'dayjs';\nimport { BlockVersion, MigrateModelsResult, MigrateStatus } from 'migratortron';\nimport ContensisCli from '~/services/ContensisCliService';\nimport { Logger } from './logger';\n\nconst formatDate = (date: Date | string, format = 'DD/MM/YYYY HH:mm') =>\n dayjs(date).format(format);\n\nexport const printBlockVersion = (\n { log, messages }: ContensisCli,\n block: BlockVersion,\n printOptions = {\n showSource: true,\n showStatus: true,\n showStaticPaths: true,\n showImage: true,\n }\n) => {\n console.log(\n ` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`\n );\n console.log(\n ` state: ${messages.blocks.runningStatus(\n block.status.broken ? 'broken' : block.status.running.global\n )}`\n );\n console.log(\n ` released: ${log.infoText(\n block.version.released\n ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}`\n : 'no'\n )}`\n );\n if (block.version.madeLive)\n console.log(\n ` live: ${log.infoText(\n `[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`\n )}`\n );\n if (printOptions.showStatus) {\n console.log(` status:`);\n console.log(` deployment: ${log.infoText(block.status.deployment)}`);\n console.log(` workflow: ${log.infoText(block.status.workflow)}`);\n console.log(\n ` running status: ${messages.blocks.runningStatus(\n block.status.running.global\n )}`\n );\n console.log(` datacentres:`);\n console.log(\n ` hq: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.hq\n )}`\n );\n console.log(\n ` london: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.london\n )}`\n );\n console.log(\n ` manchester: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.manchester\n )}`\n );\n }\n if (printOptions.showSource) {\n console.log(` source:`);\n console.log(` commit: ${log.helpText(block.source.commit.id)}`);\n console.log(\n ` message: ${log.infoText(\n block.source.commit.message\n ?.replaceAll('\\n', '\\\\n')\n .replaceAll('\\\\n\\\\n', '\\\\n')\n .replaceAll('\\\\n', '; ')\n )}`\n );\n console.log(\n ` committed: ${log.infoText(\n `[${formatDate(block.source.commit.dateTime)}] ${\n block.source.commit.authorEmail\n }`\n )}`\n );\n console.log(\n ` pushed: ${log.infoText(\n `[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`\n )}`\n );\n console.log(` ${log.infoText(block.source.commit.commitUrl)}`);\n }\n if (printOptions.showImage) {\n console.log(` image:`);\n console.log(` uri: ${log.infoText(block.image.uri)}`);\n console.log(` tag: ${log.helpText(block.image.tag)}`);\n }\n if (printOptions.showStaticPaths) {\n if (block.staticPaths?.length) {\n console.log(` static paths:`);\n for (const path of block.staticPaths) console.log(` - ${path}`);\n }\n }\n if (block.stagingUrl)\n console.log(` staging url: ${log.infoText(block.stagingUrl)}`);\n console.log('');\n};\n\nexport const printMigrateResult = (\n { log, messages, currentProject }: ContensisCli,\n migrateResult: any,\n {\n action = 'import',\n showDiff = false,\n showAllEntries = false,\n showChangedEntries = false,\n }: {\n action?: 'import' | 'delete';\n showDiff?: boolean;\n showAllEntries?: boolean;\n showChangedEntries?: boolean;\n } = {}\n) => {\n console.log(``);\n\n for (const [contentTypeId, entryRes] of Object.entries(\n migrateResult.entriesToMigrate.entryIds\n ) as [string, any]) {\n for (const [originalId, entryStatus] of Object.entries(entryRes) as [\n string,\n any\n ][]) {\n if (\n showAllEntries ||\n (showChangedEntries &&\n (\n Object.entries(\n Object.entries(entryStatus[currentProject])[0]\n )[1][1] as any\n ).status !== 'no change')\n ) {\n console.log(\n log.infoText(\n `${originalId} ${Object.entries(entryStatus || {})\n .filter(x => x[0] !== 'entryTitle')\n .map(([projectId, projectStatus]) => {\n const [targetGuid, { status }] = (Object.entries(\n projectStatus || {}\n )?.[0] as [string, { status: MigrateStatus }]) || [\n '',\n { x: { status: undefined } },\n ];\n return `${messages.migrate.status(status)(`${status}`)}${\n targetGuid !== originalId ? `-> ${targetGuid}` : ''\n }`;\n })}`\n ) + ` ${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`\n );\n\n for (const [projectId, projectStatus] of Object.entries(\n entryStatus\n ).filter(([key]) => key !== 'entryTitle') as [string, any][]) {\n const [targetGuid, { error, diff, status }] = Object.entries(\n projectStatus\n )[0] as [string, any];\n if (error) log.error(error);\n if (diff && showDiff) {\n console.log(\n ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(diff)\n )}\\n`\n );\n }\n }\n }\n }\n }\n if (showAllEntries || showChangedEntries) console.log(``);\n\n for (const [projectId, contentTypeCounts] of Object.entries(\n migrateResult.entries || {}\n ) as [string, any][]) {\n log.help(\n `${action} from project ${\n action === 'delete'\n ? log.warningText(currentProject)\n : `${log.highlightText(projectId)} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n for (const [contentTypeId, count] of Object.entries(contentTypeCounts) as [\n string,\n number\n ][]) {\n const isTotalCountRow = contentTypeId === 'totalCount';\n const migrateStatusAndCount =\n migrateResult.entriesToMigrate[currentProject][contentTypeId];\n const existingCount =\n migrateResult.existing?.[currentProject]?.[contentTypeId] || 0;\n const existingPercent = ((existingCount / count) * 100).toFixed(0);\n const noChangeOrTotalEntriesCount =\n typeof migrateStatusAndCount !== 'number'\n ? migrateStatusAndCount?.['no change'] || 0\n : migrateStatusAndCount;\n\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / count) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor = isTotalCountRow\n ? log.helpText\n : changedPercentage === '100'\n ? log.successText\n : log.warningText;\n\n console.log(\n ` - ${\n isTotalCountRow\n ? log.highlightText(\n `${contentTypeId}: ${noChangeOrTotalEntriesCount}`\n )\n : `${contentTypeId}: ${log.helpText(count)}`\n }${\n changedPercentage === '100' || isTotalCountRow\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0' || (action === 'import' && isTotalCountRow)\n ? ''\n : changedColor(\n ` ${\n isTotalCountRow\n ? `[to ${action}: ${noChangeOrTotalEntriesCount}]`\n : changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n for (const error of migrateResult.errors)\n log.error(error.message || error, null, '');\n }\n};\n\nconst highlightDiffText = (str: string) => {\n const addedRegex = new RegExp(/<<\\+>>(.*?)<<\\/\\+>>/, 'g');\n const removedRegex = new RegExp(/<<->>(.*?)<<\\/->>/, 'g');\n return str\n .replace(addedRegex, match => {\n return Logger.successText(\n match.replace(/<<\\+>>/g, '<+>').replace(/<<\\/\\+>>/g, '</+>')\n );\n })\n .replace(removedRegex, match => {\n return Logger.errorText(\n match.replace(/<<->>/g, '<->').replace(/<<\\/->>/g, '</->')\n );\n });\n};\n\nexport const printModelMigrationAnalysis = (\n { log, messages }: ContensisCli,\n result: any = {}\n) => {\n for (const [contentTypeId, model] of Object.entries(result) as [\n string,\n any\n ][]) {\n let mainOutput = log.standardText(` - ${contentTypeId}`);\n let extraOutput = '';\n let errorOutput = '';\n let diffOutput = '';\n for (const [key, details] of Object.entries(model) as [string, any][]) {\n if (key === 'dependencies') {\n extraOutput += log.infoText(\n ` references: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'dependencyOf') {\n extraOutput += log.infoText(\n ` required by: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'projects') {\n for (const [projectId, projectDetails] of Object.entries(details) as [\n string,\n any\n ][]) {\n mainOutput += log.infoText(\n ` [${messages.migrate.status(projectDetails.status)(\n `${projectId}: ${projectDetails.status}`\n )}] v${projectDetails.versionNo}`\n );\n if (projectDetails.diff)\n diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(projectDetails.diff)\n )}\\n`;\n if (projectDetails.error)\n errorOutput += ` ${log.highlightText(\n `error::`\n )} ${log.errorText(projectDetails.error)}`;\n }\n }\n }\n console.log(mainOutput);\n if (extraOutput) {\n const search = '\\n';\n const replace = '';\n console.log(\n extraOutput.replace(\n new RegExp(search + '([^' + search + ']*)$'),\n replace + '$1'\n )\n );\n }\n if (diffOutput) console.log(diffOutput);\n if (errorOutput) console.log(errorOutput);\n }\n};\n\ntype MigrateResultSummary = MigrateModelsResult['']['contentTypes'];\ntype MigrateResultStatus = keyof MigrateResultSummary;\n\nexport const printModelMigrationResult = (\n { log, messages }: ContensisCli,\n result: MigrateResultSummary\n) => {\n for (const [status, ids] of Object.entries(result) as [\n MigrateResultStatus,\n string[]\n ][]) {\n if (ids?.length) {\n if (status === 'errors') {\n const errors: [string, MappedError][] = ids as any;\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.map(id => id[0]).join(', ')\n )} ]\\n`\n );\n for (const [contentTypeId, error] of errors)\n log.error(\n `${log.highlightText(contentTypeId)}: ${error.message}`,\n error\n );\n } else\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.join(', ')\n )} ]`\n );\n }\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGlB,oBAAuB;AAEvB,MAAM,aAAa,CAAC,MAAqB,SAAS,2BAChD,aAAAA,SAAM,IAAI,EAAE,OAAO,MAAM;AAEpB,MAAM,oBAAoB,CAC/B,EAAE,KAAK,SAAS,GAChB,OACA,eAAe;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,WAAW;AACb,MACG;AAjBL;AAkBE,UAAQ;AAAA,IACN,KAAK,IAAI,aAAa,IAAI,MAAM,QAAQ,WAAW,KAAK,MAAM;AAAA,EAChE;AACA,UAAQ;AAAA,IACN,cAAc,SAAS,OAAO;AAAA,MAC5B,MAAM,OAAO,SAAS,WAAW,MAAM,OAAO,QAAQ;AAAA,IACxD;AAAA,EACF;AACA,UAAQ;AAAA,IACN,iBAAiB,IAAI;AAAA,MACnB,MA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,QAC3C;AAAA,MACF;AAAA,IACF;AACA,YAAQ,IAAI,UAAU;AACtB,QAAI,aAAa;AACf,YAAM,SAAS;AACf,YAAM,UAAU;AAChB,cAAQ;AAAA,QACN,YAAY;AAAA,UACV,IAAI,OAAO,SAAS,QAAQ,SAAS,MAAM;AAAA,UAC3C,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AACA,QAAI;AAAY,cAAQ,IAAI,UAAU;AACtC,QAAI;AAAa,cAAQ,IAAI,WAAW;AAAA,EAC1C;AACF;AAKO,MAAM,4BAA4B,CACvC,EAAE,KAAK,SAAS,GAChB,WACG;AACH,aAAW,CAAC,QAAQ,GAAG,KAAK,OAAO,QAAQ,MAAM,GAG5C;AACH,QAAI,2BAAK,QAAQ;AACf,UAAI,WAAW,UAAU;AACvB,cAAM,SAAkC;AACxC,YAAI;AAAA,UACF,OAAO,aAAa,SAAS,QAAQ,OAAO,OAAO,MAAM;AAAA,YACvD,IAAI,IAAI,QAAM,GAAG,EAAE,EAAE,KAAK,IAAI;AAAA,UAChC;AAAA;AAAA,QACF;AACA,mBAAW,CAAC,eAAe,KAAK,KAAK;AACnC,cAAI;AAAA,YACF,GAAG,IAAI,cAAc,aAAa,MAAM,MAAM;AAAA,YAC9C;AAAA,UACF;AAAA,MACJ;AACE,YAAI;AAAA,UACF,OAAO,aAAa,SAAS,QAAQ,OAAO,OAAO,MAAM;AAAA,YACvD,IAAI,KAAK,IAAI;AAAA,UACf;AAAA,QACF;AAAA,IACJ;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["dayjs", "_a"]
|
|
7
7
|
}
|
package/dist/util/logger.js
CHANGED
|
@@ -53,13 +53,12 @@ class Logger {
|
|
|
53
53
|
)} ${content}`;
|
|
54
54
|
console.log(message);
|
|
55
55
|
};
|
|
56
|
-
static error = (content, err) => {
|
|
56
|
+
static error = (content, err, newline = "\n") => {
|
|
57
57
|
const message = `${Logger.getPrefix()} ${Logger.errorText(
|
|
58
58
|
`${Logger.isUserTerminal ? "\u274C" : "[ERROR]"} ${content}${err ? `
|
|
59
59
|
|
|
60
60
|
${JSON.stringify(err, null, 2)}` : ""}`
|
|
61
|
-
)}
|
|
62
|
-
`;
|
|
61
|
+
)}${newline}`;
|
|
63
62
|
if (progress.active)
|
|
64
63
|
progress.current.interrupt(message);
|
|
65
64
|
else
|
package/dist/util/logger.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/logger.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport ProgressBar from 'progress';\nimport { tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err) => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err ? `\\n\\n${JSON.stringify(err, null, 2)}` : ''\n }`\n )}
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,sBAAwB;AACxB,eAA6B;AAatB,MAAM,OAAO;AAAA,EAClB,OAAO,iBAAiB,CAAC,CAAC,QAAQ,OAAO;AAAA,EACzC,OAAO,YAAY,MAAM;AACvB,WAAO,OAAO,iBACV,OAAO,SAAS,OAAO,IACvB,QAAI,kBAAAA,SAAW,IAAI,KAAK,GAAG,gBAAgB;AAAA,EACjD;AAAA,EACA,OAAO,YAAY,aAAAC,QAAM,KAAK;AAAA,EAC9B,OAAO,cAAc,aAAAA,QAAM,QAAQ,QAAQ;AAAA,EAC3C,OAAO,cAAc,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC1C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,gBAAgB,aAAAA,QAAM;AAAA,EAC7B,OAAO,WAAW,aAAAA,QAAM,QAAQ,MAAM;AAAA,EACtC,OAAO,eAAe,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC3C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,WAAsB,aAAW;AACtC,UAAM,UAAU,GAAG,OAAO,UAAU,MAAM,OAAO;AAAA,MAC/C;AAAA,IACF,KAAK;AACL,YAAQ,IAAI,OAAO;AAAA,EACrB;AAAA,EACA,OAAO,QAAwB,CAAC,SAAS,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport ProgressBar from 'progress';\nimport { tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err ? `\\n\\n${JSON.stringify(err, null, 2)}` : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n // if (process.env.DEBUG === 'true') {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content)) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else Logger.raw(`${indent}${item}`);\n }\n } else\n for (const [key, value] of Object.entries(content)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent}`);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${indent}${chalk.bold.grey(key)}: ${value}`);\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}`);\n });\n //Logger.line();\n return null;\n};\n\nexport const progress = {\n active: false,\n done: () => new ProgressBar('', 0),\n colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n current: new ProgressBar(`:bar`, {\n complete: '=',\n incomplete: ' ',\n width: 20,\n total: 100,\n }),\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,sBAAwB;AACxB,eAA6B;AAatB,MAAM,OAAO;AAAA,EAClB,OAAO,iBAAiB,CAAC,CAAC,QAAQ,OAAO;AAAA,EACzC,OAAO,YAAY,MAAM;AACvB,WAAO,OAAO,iBACV,OAAO,SAAS,OAAO,IACvB,QAAI,kBAAAA,SAAW,IAAI,KAAK,GAAG,gBAAgB;AAAA,EACjD;AAAA,EACA,OAAO,YAAY,aAAAC,QAAM,KAAK;AAAA,EAC9B,OAAO,cAAc,aAAAA,QAAM,QAAQ,QAAQ;AAAA,EAC3C,OAAO,cAAc,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC1C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,gBAAgB,aAAAA,QAAM;AAAA,EAC7B,OAAO,WAAW,aAAAA,QAAM,QAAQ,MAAM;AAAA,EACtC,OAAO,eAAe,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC3C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,WAAsB,aAAW;AACtC,UAAM,UAAU,GAAG,OAAO,UAAU,MAAM,OAAO;AAAA,MAC/C;AAAA,IACF,KAAK;AACL,YAAQ,IAAI,OAAO;AAAA,EACrB;AAAA,EACA,OAAO,QAAwB,CAAC,SAAS,KAAK,UAAU,SAAS;AAC/D,UAAM,UAAU,GAAG,OAAO,UAAU,KAAK,OAAO;AAAA,MAC9C,GAAG,OAAO,iBAAiB,WAAM,aAAa,U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EAC/D,CAAC;AAED,SAAO;AACT;AAEO,MAAM,WAAW;AAAA,EACtB,QAAQ;AAAA,EACR,MAAM,MAAM,IAAI,gBAAAE,QAAY,IAAI,CAAC;AAAA,EACjC,SAAS,EAAE,OAAO,oBAAwB,KAAK,mBAAuB;AAAA,EACtE,SAAS,IAAI,gBAAAA,QAAY,QAAQ;AAAA,IAC/B,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,OAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
6
|
"names": ["dateFormat", "chalk", "deepCleaner", "ProgressBar"]
|
|
7
7
|
}
|
package/dist/version.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
LIB_VERSION: () => LIB_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const LIB_VERSION = "1.0.0-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.0-beta.58";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.0-beta.58\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.58",
|
|
4
4
|
"description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
|
|
5
5
|
"repository": "https://github.com/contensis/node-cli",
|
|
6
6
|
"homepage": "https://github.com/contensis/node-cli/tree/main/packages/contensis-cli#readme",
|
|
@@ -194,7 +194,7 @@ export const LogMessages = {
|
|
|
194
194
|
entries: {
|
|
195
195
|
imported: (env: string, commit: boolean, count: number) =>
|
|
196
196
|
`[${env}] ${commit ? `Imported` : `Will import`} ${count} entries`,
|
|
197
|
-
failedImport: (env: string) => `[${env}] Unable to
|
|
197
|
+
failedImport: (env: string) => `[${env}] Unable to import entries`,
|
|
198
198
|
removed: (env: string, commit: boolean) =>
|
|
199
199
|
`[${env}] ${commit ? `Deleted` : `Will delete`} entries`,
|
|
200
200
|
failedRemove: (env: string) => `[${env}] Unable to delete entries`,
|
|
@@ -119,7 +119,6 @@ export const printMigrateResult = (
|
|
|
119
119
|
showChangedEntries?: boolean;
|
|
120
120
|
} = {}
|
|
121
121
|
) => {
|
|
122
|
-
// if (Object.keys(migrateResult.entriesToMigrate.entryIds).length)
|
|
123
122
|
console.log(``);
|
|
124
123
|
|
|
125
124
|
for (const [contentTypeId, entryRes] of Object.entries(
|
|
@@ -129,7 +128,6 @@ export const printMigrateResult = (
|
|
|
129
128
|
string,
|
|
130
129
|
any
|
|
131
130
|
][]) {
|
|
132
|
-
// console.log(`${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`);
|
|
133
131
|
if (
|
|
134
132
|
showAllEntries ||
|
|
135
133
|
(showChangedEntries &&
|
|
@@ -176,13 +174,6 @@ export const printMigrateResult = (
|
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
176
|
if (showAllEntries || showChangedEntries) console.log(``);
|
|
179
|
-
// if (
|
|
180
|
-
// contensis?.isPreview &&
|
|
181
|
-
// migrateResult.entriesToMigrate?.[currentProject]?.totalCount > 0 &&
|
|
182
|
-
// !migrateResult.errors
|
|
183
|
-
// ) {
|
|
184
|
-
// log.help(messages.entries.commitTip());
|
|
185
|
-
// }
|
|
186
177
|
|
|
187
178
|
for (const [projectId, contentTypeCounts] of Object.entries(
|
|
188
179
|
migrateResult.entries || {}
|
|
@@ -200,6 +191,7 @@ export const printMigrateResult = (
|
|
|
200
191
|
string,
|
|
201
192
|
number
|
|
202
193
|
][]) {
|
|
194
|
+
const isTotalCountRow = contentTypeId === 'totalCount';
|
|
203
195
|
const migrateStatusAndCount =
|
|
204
196
|
migrateResult.entriesToMigrate[currentProject][contentTypeId];
|
|
205
197
|
const existingCount =
|
|
@@ -210,15 +202,16 @@ export const printMigrateResult = (
|
|
|
210
202
|
? migrateStatusAndCount?.['no change'] || 0
|
|
211
203
|
: migrateStatusAndCount;
|
|
212
204
|
|
|
213
|
-
const isTotalCountRow = contentTypeId === 'totalCount';
|
|
214
|
-
|
|
215
205
|
const changedPercentage = (
|
|
216
206
|
(noChangeOrTotalEntriesCount / count) *
|
|
217
207
|
100
|
|
218
208
|
).toFixed(0);
|
|
219
209
|
|
|
220
210
|
const existingColor =
|
|
221
|
-
existingPercent === '0'
|
|
211
|
+
existingPercent === '0' || action === 'delete'
|
|
212
|
+
? log.warningText
|
|
213
|
+
: log.infoText;
|
|
214
|
+
|
|
222
215
|
const changedColor = isTotalCountRow
|
|
223
216
|
? log.helpText
|
|
224
217
|
: changedPercentage === '100'
|
|
@@ -233,15 +226,11 @@ export const printMigrateResult = (
|
|
|
233
226
|
)
|
|
234
227
|
: `${contentTypeId}: ${log.helpText(count)}`
|
|
235
228
|
}${
|
|
236
|
-
changedPercentage === '100' ||
|
|
229
|
+
changedPercentage === '100' || isTotalCountRow
|
|
237
230
|
? ''
|
|
238
|
-
: existingColor(
|
|
239
|
-
` [existing: ${
|
|
240
|
-
isTotalCountRow ? existingCount : `${existingPercent}%`
|
|
241
|
-
}]`
|
|
242
|
-
)
|
|
231
|
+
: existingColor(` [existing: ${`${existingPercent}%`}]`)
|
|
243
232
|
}${
|
|
244
|
-
existingPercent === '0'
|
|
233
|
+
existingPercent === '0' || (action === 'import' && isTotalCountRow)
|
|
245
234
|
? ''
|
|
246
235
|
: changedColor(
|
|
247
236
|
` ${
|
|
@@ -260,7 +249,8 @@ export const printMigrateResult = (
|
|
|
260
249
|
console.log(
|
|
261
250
|
` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\n`
|
|
262
251
|
);
|
|
263
|
-
for (const error of migrateResult.errors)
|
|
252
|
+
for (const error of migrateResult.errors)
|
|
253
|
+
log.error(error.message || error, null, '');
|
|
264
254
|
}
|
|
265
255
|
};
|
|
266
256
|
|
package/src/util/logger.ts
CHANGED
|
@@ -6,7 +6,7 @@ import ProgressBar from 'progress';
|
|
|
6
6
|
import { tryStringify } from '.';
|
|
7
7
|
|
|
8
8
|
type LogMethod = (content: string) => void;
|
|
9
|
-
type LogErrorMethod = (content: string, err?: any) => void;
|
|
9
|
+
type LogErrorMethod = (content: string, err?: any, newline?: string) => void;
|
|
10
10
|
type LogJsonMethod = (content: any, depth?: number, indent?: string) => void;
|
|
11
11
|
type LogJsonDepthMethod = (content: any, depth: number) => void;
|
|
12
12
|
type LogArrayMethod = (contentArray: string[]) => void;
|
|
@@ -37,12 +37,12 @@ export class Logger {
|
|
|
37
37
|
)} ${content}`;
|
|
38
38
|
console.log(message);
|
|
39
39
|
};
|
|
40
|
-
static error: LogErrorMethod = (content, err) => {
|
|
40
|
+
static error: LogErrorMethod = (content, err, newline = '\n') => {
|
|
41
41
|
const message = `${Logger.getPrefix()} ${Logger.errorText(
|
|
42
42
|
`${Logger.isUserTerminal ? '❌' : '[ERROR]'} ${content}${
|
|
43
43
|
err ? `\n\n${JSON.stringify(err, null, 2)}` : ''
|
|
44
44
|
}`
|
|
45
|
-
)}
|
|
45
|
+
)}${newline}`;
|
|
46
46
|
if (progress.active) progress.current.interrupt(message);
|
|
47
47
|
else console.log(message);
|
|
48
48
|
};
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.0-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.0-beta.58";
|