@uniformdev/cli 19.195.1-alpha.2 → 19.195.1-alpha.4
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/dist/index.mjs
CHANGED
|
@@ -11,19 +11,21 @@ import {
|
|
|
11
11
|
readFileToObject,
|
|
12
12
|
withApiOptions,
|
|
13
13
|
withConfiguration,
|
|
14
|
+
withDebugOptions,
|
|
14
15
|
withDiffOptions,
|
|
15
16
|
withFormatOptions,
|
|
16
17
|
withProjectOptions,
|
|
17
|
-
withTeamOptions
|
|
18
|
-
|
|
18
|
+
withTeamOptions,
|
|
19
|
+
withVerboseOption
|
|
20
|
+
} from "./chunk-MIERGFOU.mjs";
|
|
19
21
|
|
|
20
22
|
// src/index.ts
|
|
21
23
|
import * as dotenv from "dotenv";
|
|
22
|
-
import
|
|
24
|
+
import yargs37 from "yargs";
|
|
23
25
|
import { hideBin } from "yargs/helpers";
|
|
24
26
|
|
|
25
27
|
// src/commands/canvas/index.ts
|
|
26
|
-
import
|
|
28
|
+
import yargs18 from "yargs";
|
|
27
29
|
|
|
28
30
|
// src/commands/canvas/commands/asset.ts
|
|
29
31
|
import yargs from "yargs";
|
|
@@ -35,20 +37,20 @@ import { UncachedAssetClient } from "@uniformdev/assets";
|
|
|
35
37
|
async function createArraySyncEngineDataSource({
|
|
36
38
|
name,
|
|
37
39
|
objects,
|
|
38
|
-
selectIdentifier:
|
|
39
|
-
selectDisplayName:
|
|
40
|
+
selectIdentifier: selectIdentifier16,
|
|
41
|
+
selectDisplayName: selectDisplayName16 = selectIdentifier16,
|
|
40
42
|
onSyncComplete,
|
|
41
43
|
onBeforeDeleteObject
|
|
42
44
|
}) {
|
|
43
45
|
const objectIndex = objects.reduce(
|
|
44
46
|
(result, current) => {
|
|
45
|
-
const rawIdentifiers =
|
|
47
|
+
const rawIdentifiers = selectIdentifier16(current);
|
|
46
48
|
const identifiers = Array.isArray(rawIdentifiers) ? rawIdentifiers : [rawIdentifiers];
|
|
47
49
|
const existingResult = identifiers.find((id) => result[id]);
|
|
48
50
|
if (existingResult) {
|
|
49
51
|
throw new Error(`Identifier(s) ${identifiers} was not unique.`);
|
|
50
52
|
}
|
|
51
|
-
const displayName =
|
|
53
|
+
const displayName = selectDisplayName16(current);
|
|
52
54
|
result[identifiers[0]] = {
|
|
53
55
|
id: identifiers,
|
|
54
56
|
object: current,
|
|
@@ -78,7 +80,7 @@ async function createArraySyncEngineDataSource({
|
|
|
78
80
|
delete objectIndex[providerId];
|
|
79
81
|
},
|
|
80
82
|
writeObject: async (objectToWrite) => {
|
|
81
|
-
const id =
|
|
83
|
+
const id = selectIdentifier16(objectToWrite.object);
|
|
82
84
|
if (Array.isArray(id)) {
|
|
83
85
|
objectIndex[id[0]] = objectToWrite;
|
|
84
86
|
} else {
|
|
@@ -139,8 +141,8 @@ var loadConfig = (configPath) => {
|
|
|
139
141
|
async function createFileSyncEngineDataSource({
|
|
140
142
|
directory,
|
|
141
143
|
format = "yaml",
|
|
142
|
-
selectIdentifier:
|
|
143
|
-
selectDisplayName:
|
|
144
|
+
selectIdentifier: selectIdentifier16,
|
|
145
|
+
selectDisplayName: selectDisplayName16 = selectIdentifier16,
|
|
144
146
|
selectFilename: selectFilename3,
|
|
145
147
|
selectSchemaUrl: selectSchemaUrl2,
|
|
146
148
|
onBeforeDeleteObject
|
|
@@ -162,9 +164,9 @@ async function createFileSyncEngineDataSource({
|
|
|
162
164
|
const fullFilename = join(directory, filename);
|
|
163
165
|
try {
|
|
164
166
|
const contents = await readFileToObject(fullFilename);
|
|
165
|
-
const displayName =
|
|
167
|
+
const displayName = selectDisplayName16(contents);
|
|
166
168
|
const object = {
|
|
167
|
-
id:
|
|
169
|
+
id: selectIdentifier16(contents),
|
|
168
170
|
displayName: Array.isArray(displayName) ? displayName[0] : displayName,
|
|
169
171
|
providerId: fullFilename,
|
|
170
172
|
object: omit(contents, ["$schema"])
|
|
@@ -244,24 +246,25 @@ async function syncEngine({
|
|
|
244
246
|
const processDelete = async (object) => {
|
|
245
247
|
if (deleteTracker.has(object)) return;
|
|
246
248
|
deleteTracker.add(object);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
try {
|
|
250
|
+
if (!whatIf) {
|
|
249
251
|
await target.deleteObject(object.providerId, object);
|
|
250
|
-
log({
|
|
251
|
-
action: "delete",
|
|
252
|
-
id: object.id[0],
|
|
253
|
-
providerId: object.providerId,
|
|
254
|
-
displayName: object.displayName ?? object.providerId,
|
|
255
|
-
whatIf,
|
|
256
|
-
diff: diffLines(JSON.stringify(object.object, null, 2), "")
|
|
257
|
-
});
|
|
258
|
-
} catch (e) {
|
|
259
|
-
if (onError) {
|
|
260
|
-
onError(e, object);
|
|
261
|
-
} else {
|
|
262
|
-
throw new SyncEngineError(e, object);
|
|
263
|
-
}
|
|
264
252
|
}
|
|
253
|
+
} catch (e) {
|
|
254
|
+
if (onError) {
|
|
255
|
+
onError(e, object);
|
|
256
|
+
} else {
|
|
257
|
+
throw new SyncEngineError(e, object);
|
|
258
|
+
}
|
|
259
|
+
} finally {
|
|
260
|
+
log({
|
|
261
|
+
action: "delete",
|
|
262
|
+
id: object.id[0],
|
|
263
|
+
providerId: object.providerId,
|
|
264
|
+
displayName: object.displayName ?? object.providerId,
|
|
265
|
+
whatIf,
|
|
266
|
+
diff: diffLines(JSON.stringify(object.object, null, 2), "")
|
|
267
|
+
});
|
|
265
268
|
}
|
|
266
269
|
};
|
|
267
270
|
for await (const obj of target.objects) {
|
|
@@ -283,25 +286,26 @@ async function syncEngine({
|
|
|
283
286
|
if (!compareContents(sourceObject, targetObject)) {
|
|
284
287
|
if (mode === "createOrUpdate" || mode === "mirror") {
|
|
285
288
|
const process2 = async (sourceObject2, targetObject2) => {
|
|
286
|
-
|
|
287
|
-
|
|
289
|
+
try {
|
|
290
|
+
if (!whatIf) {
|
|
288
291
|
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
289
292
|
await target.writeObject(finalSourceObject, targetObject2);
|
|
290
|
-
log({
|
|
291
|
-
action: "update",
|
|
292
|
-
id: ids[0],
|
|
293
|
-
providerId: sourceObject2.providerId,
|
|
294
|
-
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
295
|
-
whatIf,
|
|
296
|
-
diff: diffJson(targetObject2.object, sourceObject2.object)
|
|
297
|
-
});
|
|
298
|
-
} catch (e) {
|
|
299
|
-
if (onError) {
|
|
300
|
-
onError(e, sourceObject2);
|
|
301
|
-
} else {
|
|
302
|
-
throw new SyncEngineError(e, sourceObject2);
|
|
303
|
-
}
|
|
304
293
|
}
|
|
294
|
+
} catch (e) {
|
|
295
|
+
if (onError) {
|
|
296
|
+
onError(e, sourceObject2);
|
|
297
|
+
} else {
|
|
298
|
+
throw new SyncEngineError(e, sourceObject2);
|
|
299
|
+
}
|
|
300
|
+
} finally {
|
|
301
|
+
log({
|
|
302
|
+
action: "update",
|
|
303
|
+
id: ids[0],
|
|
304
|
+
providerId: sourceObject2.providerId,
|
|
305
|
+
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
306
|
+
whatIf,
|
|
307
|
+
diff: diffJson(targetObject2.object, sourceObject2.object)
|
|
308
|
+
});
|
|
305
309
|
}
|
|
306
310
|
};
|
|
307
311
|
actions.push(process2(sourceObject, targetObject));
|
|
@@ -310,25 +314,26 @@ async function syncEngine({
|
|
|
310
314
|
ids.forEach((i) => targetItems.delete(i));
|
|
311
315
|
} else {
|
|
312
316
|
const process2 = async (sourceObject2, id) => {
|
|
313
|
-
|
|
314
|
-
|
|
317
|
+
try {
|
|
318
|
+
if (!whatIf) {
|
|
315
319
|
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
|
|
316
320
|
await target.writeObject(finalSourceObject);
|
|
317
|
-
log({
|
|
318
|
-
action: "create",
|
|
319
|
-
id,
|
|
320
|
-
providerId: id,
|
|
321
|
-
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
322
|
-
whatIf,
|
|
323
|
-
diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
|
|
324
|
-
});
|
|
325
|
-
} catch (e) {
|
|
326
|
-
if (onError) {
|
|
327
|
-
onError(e, sourceObject2);
|
|
328
|
-
} else {
|
|
329
|
-
throw new SyncEngineError(e, sourceObject2);
|
|
330
|
-
}
|
|
331
321
|
}
|
|
322
|
+
} catch (e) {
|
|
323
|
+
if (onError) {
|
|
324
|
+
onError(e, sourceObject2);
|
|
325
|
+
} else {
|
|
326
|
+
throw new SyncEngineError(e, sourceObject2);
|
|
327
|
+
}
|
|
328
|
+
} finally {
|
|
329
|
+
log({
|
|
330
|
+
action: "create",
|
|
331
|
+
id,
|
|
332
|
+
providerId: id,
|
|
333
|
+
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
334
|
+
whatIf,
|
|
335
|
+
diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
|
|
336
|
+
});
|
|
332
337
|
}
|
|
333
338
|
};
|
|
334
339
|
if (invalidTargetObjects.length > 0) {
|
|
@@ -419,12 +424,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
419
424
|
var AssetGetModule = {
|
|
420
425
|
command: "get <id>",
|
|
421
426
|
describe: "Get an asset",
|
|
422
|
-
builder: (
|
|
427
|
+
builder: (yargs38) => withConfiguration(
|
|
423
428
|
withFormatOptions(
|
|
424
429
|
withApiOptions(
|
|
425
430
|
withProjectOptions(
|
|
426
431
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
427
|
-
|
|
432
|
+
yargs38.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
428
433
|
)
|
|
429
434
|
)
|
|
430
435
|
)
|
|
@@ -445,7 +450,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
|
|
|
445
450
|
var AssetListModule = {
|
|
446
451
|
command: "list",
|
|
447
452
|
describe: "List assets",
|
|
448
|
-
builder: (
|
|
453
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
449
454
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
450
455
|
const fetch3 = nodeFetchProxy(proxy);
|
|
451
456
|
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -797,8 +802,8 @@ function prepCompositionForDisk(composition) {
|
|
|
797
802
|
delete prepped.state;
|
|
798
803
|
return prepped;
|
|
799
804
|
}
|
|
800
|
-
function withStateOptions(
|
|
801
|
-
return
|
|
805
|
+
function withStateOptions(yargs38, defaultState = "preview") {
|
|
806
|
+
return yargs38.option("state", {
|
|
802
807
|
type: "string",
|
|
803
808
|
describe: `State to fetch.`,
|
|
804
809
|
choices: ["preview", "published"],
|
|
@@ -865,11 +870,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
865
870
|
var AssetPullModule = {
|
|
866
871
|
command: "pull <directory>",
|
|
867
872
|
describe: "Pulls all assets to local files in a directory",
|
|
868
|
-
builder: (
|
|
873
|
+
builder: (yargs38) => withConfiguration(
|
|
869
874
|
withApiOptions(
|
|
870
875
|
withProjectOptions(
|
|
871
876
|
withDiffOptions(
|
|
872
|
-
|
|
877
|
+
yargs38.positional("directory", {
|
|
873
878
|
describe: "Directory to save the assets to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
874
879
|
type: "string"
|
|
875
880
|
}).option("format", {
|
|
@@ -987,11 +992,11 @@ import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
|
987
992
|
var AssetPushModule = {
|
|
988
993
|
command: "push <directory>",
|
|
989
994
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
990
|
-
builder: (
|
|
995
|
+
builder: (yargs38) => withConfiguration(
|
|
991
996
|
withApiOptions(
|
|
992
997
|
withProjectOptions(
|
|
993
998
|
withDiffOptions(
|
|
994
|
-
|
|
999
|
+
yargs38.positional("directory", {
|
|
995
1000
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
996
1001
|
type: "string"
|
|
997
1002
|
}).option("what-if", {
|
|
@@ -1092,9 +1097,9 @@ var AssetRemoveModule = {
|
|
|
1092
1097
|
command: "remove <id>",
|
|
1093
1098
|
aliases: ["delete", "rm"],
|
|
1094
1099
|
describe: "Delete an asset",
|
|
1095
|
-
builder: (
|
|
1100
|
+
builder: (yargs38) => withConfiguration(
|
|
1096
1101
|
withApiOptions(
|
|
1097
|
-
withProjectOptions(
|
|
1102
|
+
withProjectOptions(yargs38.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1098
1103
|
)
|
|
1099
1104
|
),
|
|
1100
1105
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1110,10 +1115,10 @@ var AssetUpdateModule = {
|
|
|
1110
1115
|
command: "update <filename>",
|
|
1111
1116
|
aliases: ["put"],
|
|
1112
1117
|
describe: "Insert or update an asset",
|
|
1113
|
-
builder: (
|
|
1118
|
+
builder: (yargs38) => withConfiguration(
|
|
1114
1119
|
withApiOptions(
|
|
1115
1120
|
withProjectOptions(
|
|
1116
|
-
|
|
1121
|
+
yargs38.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1117
1122
|
)
|
|
1118
1123
|
)
|
|
1119
1124
|
),
|
|
@@ -1129,7 +1134,7 @@ var AssetUpdateModule = {
|
|
|
1129
1134
|
var AssetModule = {
|
|
1130
1135
|
command: "asset <command>",
|
|
1131
1136
|
describe: "Commands for Assets",
|
|
1132
|
-
builder: (
|
|
1137
|
+
builder: (yargs38) => yargs38.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1133
1138
|
handler: () => {
|
|
1134
1139
|
yargs.help();
|
|
1135
1140
|
}
|
|
@@ -1143,11 +1148,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1143
1148
|
var CategoryGetModule = {
|
|
1144
1149
|
command: "get <id>",
|
|
1145
1150
|
describe: "Fetch a category",
|
|
1146
|
-
builder: (
|
|
1151
|
+
builder: (yargs38) => withConfiguration(
|
|
1147
1152
|
withFormatOptions(
|
|
1148
1153
|
withApiOptions(
|
|
1149
1154
|
withProjectOptions(
|
|
1150
|
-
|
|
1155
|
+
yargs38.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1151
1156
|
)
|
|
1152
1157
|
)
|
|
1153
1158
|
)
|
|
@@ -1172,7 +1177,7 @@ var CategoryListModule = {
|
|
|
1172
1177
|
command: "list",
|
|
1173
1178
|
describe: "List categories",
|
|
1174
1179
|
aliases: ["ls"],
|
|
1175
|
-
builder: (
|
|
1180
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38.options({}))))),
|
|
1176
1181
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1177
1182
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1178
1183
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1222,11 +1227,11 @@ function createCategoriesEngineDataSource({
|
|
|
1222
1227
|
var CategoryPullModule = {
|
|
1223
1228
|
command: "pull <directory>",
|
|
1224
1229
|
describe: "Pulls all categories to local files in a directory",
|
|
1225
|
-
builder: (
|
|
1230
|
+
builder: (yargs38) => withConfiguration(
|
|
1226
1231
|
withApiOptions(
|
|
1227
1232
|
withProjectOptions(
|
|
1228
1233
|
withDiffOptions(
|
|
1229
|
-
|
|
1234
|
+
yargs38.positional("directory", {
|
|
1230
1235
|
describe: "Directory to save the categories to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
1231
1236
|
type: "string"
|
|
1232
1237
|
}).option("format", {
|
|
@@ -1304,11 +1309,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1304
1309
|
var CategoryPushModule = {
|
|
1305
1310
|
command: "push <directory>",
|
|
1306
1311
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1307
|
-
builder: (
|
|
1312
|
+
builder: (yargs38) => withConfiguration(
|
|
1308
1313
|
withApiOptions(
|
|
1309
1314
|
withProjectOptions(
|
|
1310
1315
|
withDiffOptions(
|
|
1311
|
-
|
|
1316
|
+
yargs38.positional("directory", {
|
|
1312
1317
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1313
1318
|
type: "string"
|
|
1314
1319
|
}).option("what-if", {
|
|
@@ -1375,10 +1380,10 @@ var CategoryRemoveModule = {
|
|
|
1375
1380
|
command: "remove <id>",
|
|
1376
1381
|
aliases: ["delete", "rm"],
|
|
1377
1382
|
describe: "Delete a category",
|
|
1378
|
-
builder: (
|
|
1383
|
+
builder: (yargs38) => withConfiguration(
|
|
1379
1384
|
withApiOptions(
|
|
1380
1385
|
withProjectOptions(
|
|
1381
|
-
|
|
1386
|
+
yargs38.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1382
1387
|
)
|
|
1383
1388
|
)
|
|
1384
1389
|
),
|
|
@@ -1395,10 +1400,10 @@ var CategoryUpdateModule = {
|
|
|
1395
1400
|
command: "update <filename>",
|
|
1396
1401
|
aliases: ["put"],
|
|
1397
1402
|
describe: "Insert or update a category",
|
|
1398
|
-
builder: (
|
|
1403
|
+
builder: (yargs38) => withConfiguration(
|
|
1399
1404
|
withApiOptions(
|
|
1400
1405
|
withProjectOptions(
|
|
1401
|
-
|
|
1406
|
+
yargs38.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1402
1407
|
)
|
|
1403
1408
|
)
|
|
1404
1409
|
),
|
|
@@ -1415,7 +1420,7 @@ var CategoryModule = {
|
|
|
1415
1420
|
command: "category <command>",
|
|
1416
1421
|
aliases: ["cat"],
|
|
1417
1422
|
describe: "Commands for Canvas categories",
|
|
1418
|
-
builder: (
|
|
1423
|
+
builder: (yargs38) => yargs38.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1419
1424
|
handler: () => {
|
|
1420
1425
|
yargs2.help();
|
|
1421
1426
|
}
|
|
@@ -1436,11 +1441,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1436
1441
|
var ComponentGetModule = {
|
|
1437
1442
|
command: "get <id>",
|
|
1438
1443
|
describe: "Fetch a component definition",
|
|
1439
|
-
builder: (
|
|
1444
|
+
builder: (yargs38) => withConfiguration(
|
|
1440
1445
|
withFormatOptions(
|
|
1441
1446
|
withApiOptions(
|
|
1442
1447
|
withProjectOptions(
|
|
1443
|
-
|
|
1448
|
+
yargs38.positional("id", {
|
|
1444
1449
|
demandOption: true,
|
|
1445
1450
|
describe: "Component definition public ID to fetch"
|
|
1446
1451
|
})
|
|
@@ -1474,11 +1479,11 @@ var ComponentListModule = {
|
|
|
1474
1479
|
command: "list",
|
|
1475
1480
|
describe: "List component definitions",
|
|
1476
1481
|
aliases: ["ls"],
|
|
1477
|
-
builder: (
|
|
1482
|
+
builder: (yargs38) => withConfiguration(
|
|
1478
1483
|
withFormatOptions(
|
|
1479
1484
|
withApiOptions(
|
|
1480
1485
|
withProjectOptions(
|
|
1481
|
-
|
|
1486
|
+
yargs38.options({
|
|
1482
1487
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1483
1488
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1484
1489
|
})
|
|
@@ -1534,11 +1539,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1534
1539
|
var ComponentPullModule = {
|
|
1535
1540
|
command: "pull <directory>",
|
|
1536
1541
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1537
|
-
builder: (
|
|
1542
|
+
builder: (yargs38) => withConfiguration(
|
|
1538
1543
|
withApiOptions(
|
|
1539
1544
|
withProjectOptions(
|
|
1540
1545
|
withDiffOptions(
|
|
1541
|
-
|
|
1546
|
+
yargs38.positional("directory", {
|
|
1542
1547
|
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
1543
1548
|
type: "string"
|
|
1544
1549
|
}).option("format", {
|
|
@@ -1617,11 +1622,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1617
1622
|
var ComponentPushModule = {
|
|
1618
1623
|
command: "push <directory>",
|
|
1619
1624
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1620
|
-
builder: (
|
|
1625
|
+
builder: (yargs38) => withConfiguration(
|
|
1621
1626
|
withApiOptions(
|
|
1622
1627
|
withProjectOptions(
|
|
1623
1628
|
withDiffOptions(
|
|
1624
|
-
|
|
1629
|
+
yargs38.positional("directory", {
|
|
1625
1630
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1626
1631
|
type: "string"
|
|
1627
1632
|
}).option("what-if", {
|
|
@@ -1689,10 +1694,10 @@ var ComponentRemoveModule = {
|
|
|
1689
1694
|
command: "remove <id>",
|
|
1690
1695
|
aliases: ["delete", "rm"],
|
|
1691
1696
|
describe: "Delete a component definition",
|
|
1692
|
-
builder: (
|
|
1697
|
+
builder: (yargs38) => withConfiguration(
|
|
1693
1698
|
withApiOptions(
|
|
1694
1699
|
withProjectOptions(
|
|
1695
|
-
|
|
1700
|
+
yargs38.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1696
1701
|
)
|
|
1697
1702
|
)
|
|
1698
1703
|
),
|
|
@@ -1709,10 +1714,10 @@ var ComponentUpdateModule = {
|
|
|
1709
1714
|
command: "update <filename>",
|
|
1710
1715
|
aliases: ["put"],
|
|
1711
1716
|
describe: "Insert or update a component definition",
|
|
1712
|
-
builder: (
|
|
1717
|
+
builder: (yargs38) => withConfiguration(
|
|
1713
1718
|
withApiOptions(
|
|
1714
1719
|
withProjectOptions(
|
|
1715
|
-
|
|
1720
|
+
yargs38.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1716
1721
|
)
|
|
1717
1722
|
)
|
|
1718
1723
|
),
|
|
@@ -1729,7 +1734,7 @@ var ComponentModule = {
|
|
|
1729
1734
|
command: "component <command>",
|
|
1730
1735
|
aliases: ["def"],
|
|
1731
1736
|
describe: "Commands for Canvas component definitions",
|
|
1732
|
-
builder: (
|
|
1737
|
+
builder: (yargs38) => yargs38.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1733
1738
|
handler: () => {
|
|
1734
1739
|
yargs3.help();
|
|
1735
1740
|
}
|
|
@@ -1743,43 +1748,48 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1743
1748
|
var CompositionGetModule = {
|
|
1744
1749
|
command: "get <id>",
|
|
1745
1750
|
describe: "Fetch a composition",
|
|
1746
|
-
builder: (
|
|
1751
|
+
builder: (yargs38) => withFormatOptions(
|
|
1747
1752
|
withConfiguration(
|
|
1748
1753
|
withApiOptions(
|
|
1749
1754
|
withProjectOptions(
|
|
1750
1755
|
withStateOptions(
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1756
|
+
withVerboseOption(
|
|
1757
|
+
yargs38.positional("id", {
|
|
1758
|
+
demandOption: true,
|
|
1759
|
+
describe: "Composition/pattern public ID to fetch"
|
|
1760
|
+
}).option({
|
|
1761
|
+
resolvePatterns: {
|
|
1762
|
+
type: "boolean",
|
|
1763
|
+
default: false,
|
|
1764
|
+
describe: "Resolve pattern references in the composition"
|
|
1765
|
+
},
|
|
1766
|
+
resolveOverrides: {
|
|
1767
|
+
type: "boolean",
|
|
1768
|
+
default: false,
|
|
1769
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
1770
|
+
},
|
|
1771
|
+
componentIDs: {
|
|
1772
|
+
type: "boolean",
|
|
1773
|
+
default: false,
|
|
1774
|
+
describe: "Include individual component UIDs"
|
|
1775
|
+
},
|
|
1776
|
+
resolveData: {
|
|
1777
|
+
type: "boolean",
|
|
1778
|
+
default: false,
|
|
1779
|
+
describe: "Resolve all data resources used by the composition/pattern"
|
|
1780
|
+
},
|
|
1781
|
+
diagnostics: {
|
|
1782
|
+
type: "boolean",
|
|
1783
|
+
default: false,
|
|
1784
|
+
describe: "Include diagnostics information when resolving data"
|
|
1785
|
+
},
|
|
1786
|
+
resolutionDepth: {
|
|
1787
|
+
type: "number",
|
|
1788
|
+
default: 1,
|
|
1789
|
+
describe: "Controls how many levels deep content references should be resolved"
|
|
1790
|
+
}
|
|
1791
|
+
})
|
|
1792
|
+
)
|
|
1783
1793
|
)
|
|
1784
1794
|
)
|
|
1785
1795
|
)
|
|
@@ -1800,22 +1810,25 @@ var CompositionGetModule = {
|
|
|
1800
1810
|
componentIDs,
|
|
1801
1811
|
resolveData,
|
|
1802
1812
|
diagnostics,
|
|
1803
|
-
resolutionDepth
|
|
1813
|
+
resolutionDepth,
|
|
1814
|
+
verbose
|
|
1804
1815
|
}) => {
|
|
1805
|
-
const
|
|
1816
|
+
const parameters = {
|
|
1817
|
+
compositionId: id,
|
|
1818
|
+
state: convertStateOption(state),
|
|
1819
|
+
skipPatternResolution: !resolvePatterns,
|
|
1820
|
+
skipOverridesResolution: !resolveOverrides,
|
|
1821
|
+
withComponentIDs: componentIDs,
|
|
1822
|
+
skipDataResolution: !resolveData,
|
|
1823
|
+
diagnostics: resolveData ? diagnostics : void 0,
|
|
1824
|
+
resolutionDepth: resolveData ? resolutionDepth : void 0
|
|
1825
|
+
};
|
|
1826
|
+
if (verbose) {
|
|
1827
|
+
console.log(`\u{1F41B} get composition:`, parameters);
|
|
1828
|
+
}
|
|
1829
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1806
1830
|
const client = new UncachedCanvasClient7({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
|
|
1807
|
-
const res = prepCompositionForDisk(
|
|
1808
|
-
await client.getCompositionById({
|
|
1809
|
-
compositionId: id,
|
|
1810
|
-
state: convertStateOption(state),
|
|
1811
|
-
skipPatternResolution: !resolvePatterns,
|
|
1812
|
-
skipOverridesResolution: !resolveOverrides,
|
|
1813
|
-
withComponentIDs: componentIDs,
|
|
1814
|
-
skipDataResolution: !resolveData,
|
|
1815
|
-
diagnostics: resolveData ? diagnostics : void 0,
|
|
1816
|
-
resolutionDepth: resolveData ? resolutionDepth : void 0
|
|
1817
|
-
})
|
|
1818
|
-
);
|
|
1831
|
+
const res = prepCompositionForDisk(await client.getCompositionById(parameters));
|
|
1819
1832
|
emitWithFormat(res, format, filename);
|
|
1820
1833
|
}
|
|
1821
1834
|
};
|
|
@@ -1832,42 +1845,44 @@ var CompositionListModule = {
|
|
|
1832
1845
|
command: "list",
|
|
1833
1846
|
describe: "List compositions",
|
|
1834
1847
|
aliases: ["ls"],
|
|
1835
|
-
builder: (
|
|
1848
|
+
builder: (yargs38) => withFormatOptions(
|
|
1836
1849
|
withConfiguration(
|
|
1837
1850
|
withApiOptions(
|
|
1838
1851
|
withProjectOptions(
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1852
|
+
withDebugOptions(
|
|
1853
|
+
withStateOptions(
|
|
1854
|
+
yargs38.options({
|
|
1855
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1856
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1857
|
+
search: { describe: "Search query", type: "string", default: "" },
|
|
1858
|
+
resolvePatterns: {
|
|
1859
|
+
type: "boolean",
|
|
1860
|
+
default: false,
|
|
1861
|
+
describe: "Resolve pattern references in the composition"
|
|
1862
|
+
},
|
|
1863
|
+
resolveOverrides: {
|
|
1864
|
+
type: "boolean",
|
|
1865
|
+
default: false,
|
|
1866
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
1867
|
+
},
|
|
1868
|
+
onlyCompositions: {
|
|
1869
|
+
describe: "Only pulling compositions and not patterns",
|
|
1870
|
+
default: false,
|
|
1871
|
+
type: "boolean"
|
|
1872
|
+
},
|
|
1873
|
+
onlyPatterns: {
|
|
1874
|
+
describe: "Only pulling patterns and not compositions",
|
|
1875
|
+
default: false,
|
|
1876
|
+
type: "boolean",
|
|
1877
|
+
hidden: true
|
|
1878
|
+
},
|
|
1879
|
+
componentIDs: {
|
|
1880
|
+
type: "boolean",
|
|
1881
|
+
default: false,
|
|
1882
|
+
describe: "Include individual component UIDs"
|
|
1883
|
+
}
|
|
1884
|
+
})
|
|
1885
|
+
)
|
|
1871
1886
|
)
|
|
1872
1887
|
)
|
|
1873
1888
|
)
|
|
@@ -1889,11 +1904,10 @@ var CompositionListModule = {
|
|
|
1889
1904
|
state,
|
|
1890
1905
|
resolvePatterns,
|
|
1891
1906
|
resolveOverrides,
|
|
1892
|
-
componentIDs
|
|
1907
|
+
componentIDs,
|
|
1908
|
+
verbose
|
|
1893
1909
|
}) => {
|
|
1894
|
-
const
|
|
1895
|
-
const client = new UncachedCanvasClient8({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1896
|
-
const res = await client.getCompositionList({
|
|
1910
|
+
const parameters = {
|
|
1897
1911
|
limit,
|
|
1898
1912
|
offset,
|
|
1899
1913
|
search: search && search.length > 0 ? search : void 0,
|
|
@@ -1903,7 +1917,13 @@ var CompositionListModule = {
|
|
|
1903
1917
|
skipPatternResolution: !resolvePatterns,
|
|
1904
1918
|
withComponentIDs: componentIDs,
|
|
1905
1919
|
skipOverridesResolution: !resolveOverrides
|
|
1906
|
-
}
|
|
1920
|
+
};
|
|
1921
|
+
if (verbose) {
|
|
1922
|
+
console.log(`\u{1F41B} list compositions:`, parameters);
|
|
1923
|
+
}
|
|
1924
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1925
|
+
const client = new UncachedCanvasClient8({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1926
|
+
const res = await client.getCompositionList();
|
|
1907
1927
|
emitWithFormat(res.compositions, format, filename);
|
|
1908
1928
|
}
|
|
1909
1929
|
};
|
|
@@ -1912,12 +1932,12 @@ var CompositionListModule = {
|
|
|
1912
1932
|
var ComponentPatternListModule = {
|
|
1913
1933
|
...CompositionListModule,
|
|
1914
1934
|
describe: "List component patterns",
|
|
1915
|
-
builder: (
|
|
1935
|
+
builder: (yargs38) => withFormatOptions(
|
|
1916
1936
|
withConfiguration(
|
|
1917
1937
|
withApiOptions(
|
|
1918
1938
|
withProjectOptions(
|
|
1919
1939
|
withStateOptions(
|
|
1920
|
-
|
|
1940
|
+
yargs38.options({
|
|
1921
1941
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1922
1942
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1923
1943
|
resolvePatterns: {
|
|
@@ -1984,23 +2004,30 @@ function createComponentInstanceEngineDataSource({
|
|
|
1984
2004
|
onlyCompositions,
|
|
1985
2005
|
onlyPatterns,
|
|
1986
2006
|
patternType,
|
|
2007
|
+
verbose,
|
|
1987
2008
|
...clientOptions
|
|
1988
2009
|
}) {
|
|
1989
2010
|
const stateId = convertStateOption(state);
|
|
1990
2011
|
async function* getObjects() {
|
|
1991
2012
|
const componentInstances = paginateAsync(
|
|
1992
|
-
async (offset, limit) =>
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2013
|
+
async (offset, limit) => {
|
|
2014
|
+
const parameters = {
|
|
2015
|
+
...clientOptions,
|
|
2016
|
+
limit,
|
|
2017
|
+
offset,
|
|
2018
|
+
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
2019
|
+
state: stateId,
|
|
2020
|
+
skipPatternResolution: true,
|
|
2021
|
+
skipOverridesResolution: true,
|
|
2022
|
+
withComponentIDs: true,
|
|
2023
|
+
patternType,
|
|
2024
|
+
editions: "all"
|
|
2025
|
+
};
|
|
2026
|
+
if (verbose) {
|
|
2027
|
+
console.log(`\u{1F41B} pull compositions: `, parameters);
|
|
2028
|
+
}
|
|
2029
|
+
return (await client.getCompositionList(parameters)).compositions;
|
|
2030
|
+
},
|
|
2004
2031
|
{ pageSize: 100 }
|
|
2005
2032
|
);
|
|
2006
2033
|
for await (const compositionListItem of componentInstances) {
|
|
@@ -2017,9 +2044,15 @@ function createComponentInstanceEngineDataSource({
|
|
|
2017
2044
|
name: "Uniform API",
|
|
2018
2045
|
objects: getObjects(),
|
|
2019
2046
|
deleteObject: async (providerId) => {
|
|
2047
|
+
if (verbose) {
|
|
2048
|
+
console.log(`\u{1F41B} delete composition: (id: ${parseCompositionSerializedId(providerId)})`);
|
|
2049
|
+
}
|
|
2020
2050
|
await client.removeComposition(parseCompositionSerializedId(providerId));
|
|
2021
2051
|
},
|
|
2022
2052
|
writeObject: async (object) => {
|
|
2053
|
+
if (verbose) {
|
|
2054
|
+
console.log(`\u{1F41B} push composition: (id: ${object.object.composition._id})`);
|
|
2055
|
+
}
|
|
2023
2056
|
await client.updateComposition({ ...object.object, state: stateId });
|
|
2024
2057
|
}
|
|
2025
2058
|
};
|
|
@@ -2029,33 +2062,30 @@ function createComponentInstanceEngineDataSource({
|
|
|
2029
2062
|
var CompositionPublishModule = {
|
|
2030
2063
|
command: "publish [ids]",
|
|
2031
2064
|
describe: "Publishes composition(s)",
|
|
2032
|
-
builder: (
|
|
2065
|
+
builder: (yargs38) => withConfiguration(
|
|
2033
2066
|
withApiOptions(
|
|
2034
2067
|
withProjectOptions(
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
type: "boolean",
|
|
2057
|
-
hidden: true
|
|
2058
|
-
})
|
|
2068
|
+
withDebugOptions(
|
|
2069
|
+
withDiffOptions(
|
|
2070
|
+
yargs38.positional("ids", {
|
|
2071
|
+
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2072
|
+
type: "string"
|
|
2073
|
+
}).option("all", {
|
|
2074
|
+
alias: ["a"],
|
|
2075
|
+
describe: "Publishes all compositions. Use compositionId to publish one instead.",
|
|
2076
|
+
default: false,
|
|
2077
|
+
type: "boolean"
|
|
2078
|
+
}).option("onlyCompositions", {
|
|
2079
|
+
describe: "Only publishing compositions and not patterns",
|
|
2080
|
+
default: false,
|
|
2081
|
+
type: "boolean"
|
|
2082
|
+
}).option("onlyPatterns", {
|
|
2083
|
+
describe: "Only pulling patterns and not compositions",
|
|
2084
|
+
default: false,
|
|
2085
|
+
type: "boolean",
|
|
2086
|
+
hidden: true
|
|
2087
|
+
})
|
|
2088
|
+
)
|
|
2059
2089
|
)
|
|
2060
2090
|
)
|
|
2061
2091
|
)
|
|
@@ -2070,14 +2100,15 @@ var CompositionPublishModule = {
|
|
|
2070
2100
|
project: projectId,
|
|
2071
2101
|
onlyCompositions,
|
|
2072
2102
|
onlyPatterns,
|
|
2073
|
-
patternType
|
|
2103
|
+
patternType,
|
|
2104
|
+
verbose
|
|
2074
2105
|
}) => {
|
|
2075
2106
|
if (!all && !ids || all && ids) {
|
|
2076
2107
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
2077
2108
|
process.exit(1);
|
|
2078
2109
|
}
|
|
2079
2110
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
2080
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
2111
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2081
2112
|
const client = new UncachedCanvasClient9({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2082
2113
|
const source = createComponentInstanceEngineDataSource({
|
|
2083
2114
|
client,
|
|
@@ -2085,7 +2116,8 @@ var CompositionPublishModule = {
|
|
|
2085
2116
|
compositionIDs: compositionIDsArray,
|
|
2086
2117
|
onlyCompositions,
|
|
2087
2118
|
onlyPatterns,
|
|
2088
|
-
patternType
|
|
2119
|
+
patternType,
|
|
2120
|
+
verbose
|
|
2089
2121
|
});
|
|
2090
2122
|
const target = createComponentInstanceEngineDataSource({
|
|
2091
2123
|
client,
|
|
@@ -2093,7 +2125,8 @@ var CompositionPublishModule = {
|
|
|
2093
2125
|
compositionIDs: compositionIDsArray,
|
|
2094
2126
|
onlyCompositions,
|
|
2095
2127
|
onlyPatterns,
|
|
2096
|
-
patternType
|
|
2128
|
+
patternType,
|
|
2129
|
+
verbose
|
|
2097
2130
|
});
|
|
2098
2131
|
await syncEngine({
|
|
2099
2132
|
source,
|
|
@@ -2101,6 +2134,7 @@ var CompositionPublishModule = {
|
|
|
2101
2134
|
// Publishing is one-direction operation, so no need to support automatic un-publishing
|
|
2102
2135
|
mode: "createOrUpdate",
|
|
2103
2136
|
whatIf,
|
|
2137
|
+
verbose,
|
|
2104
2138
|
log: createPublishStatusSyncEngineConsoleLogger({ status: "publish" })
|
|
2105
2139
|
});
|
|
2106
2140
|
}
|
|
@@ -2110,11 +2144,11 @@ var CompositionPublishModule = {
|
|
|
2110
2144
|
var ComponentPatternPublishModule = {
|
|
2111
2145
|
...CompositionPublishModule,
|
|
2112
2146
|
describe: "Publishes component pattern(s)",
|
|
2113
|
-
builder: (
|
|
2147
|
+
builder: (yargs38) => withConfiguration(
|
|
2114
2148
|
withApiOptions(
|
|
2115
2149
|
withProjectOptions(
|
|
2116
2150
|
withDiffOptions(
|
|
2117
|
-
|
|
2151
|
+
yargs38.positional("ids", {
|
|
2118
2152
|
describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2119
2153
|
type: "string"
|
|
2120
2154
|
}).option("all", {
|
|
@@ -2158,41 +2192,38 @@ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
|
2158
2192
|
var CompositionPullModule = {
|
|
2159
2193
|
command: "pull <directory>",
|
|
2160
2194
|
describe: "Pulls all compositions to local files in a directory",
|
|
2161
|
-
builder: (
|
|
2195
|
+
builder: (yargs38) => withConfiguration(
|
|
2162
2196
|
withApiOptions(
|
|
2163
2197
|
withProjectOptions(
|
|
2164
2198
|
withStateOptions(
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
default: "mirror",
|
|
2194
|
-
type: "string"
|
|
2195
|
-
})
|
|
2199
|
+
withDebugOptions(
|
|
2200
|
+
withDiffOptions(
|
|
2201
|
+
yargs38.positional("directory", {
|
|
2202
|
+
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2203
|
+
type: "string"
|
|
2204
|
+
}).option("format", {
|
|
2205
|
+
alias: ["f"],
|
|
2206
|
+
describe: "Output format",
|
|
2207
|
+
default: "yaml",
|
|
2208
|
+
choices: ["yaml", "json"],
|
|
2209
|
+
type: "string"
|
|
2210
|
+
}).option("onlyCompositions", {
|
|
2211
|
+
describe: "Only pulling compositions and not patterns",
|
|
2212
|
+
default: false,
|
|
2213
|
+
type: "boolean"
|
|
2214
|
+
}).option("onlyPatterns", {
|
|
2215
|
+
describe: "Only pulling patterns and not compositions",
|
|
2216
|
+
default: false,
|
|
2217
|
+
type: "boolean",
|
|
2218
|
+
hidden: true
|
|
2219
|
+
}).option("mode", {
|
|
2220
|
+
alias: ["m"],
|
|
2221
|
+
describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
|
|
2222
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2223
|
+
default: "mirror",
|
|
2224
|
+
type: "string"
|
|
2225
|
+
})
|
|
2226
|
+
)
|
|
2196
2227
|
)
|
|
2197
2228
|
)
|
|
2198
2229
|
)
|
|
@@ -2212,9 +2243,10 @@ var CompositionPullModule = {
|
|
|
2212
2243
|
state,
|
|
2213
2244
|
project: projectId,
|
|
2214
2245
|
diff: diffMode,
|
|
2215
|
-
allowEmptySource
|
|
2246
|
+
allowEmptySource,
|
|
2247
|
+
verbose
|
|
2216
2248
|
}) => {
|
|
2217
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
2249
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2218
2250
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2219
2251
|
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2220
2252
|
const source = createComponentInstanceEngineDataSource({
|
|
@@ -2222,7 +2254,8 @@ var CompositionPullModule = {
|
|
|
2222
2254
|
state,
|
|
2223
2255
|
onlyCompositions,
|
|
2224
2256
|
onlyPatterns,
|
|
2225
|
-
patternType
|
|
2257
|
+
patternType,
|
|
2258
|
+
verbose
|
|
2226
2259
|
});
|
|
2227
2260
|
const isPackage = isPathAPackageFile(directory);
|
|
2228
2261
|
let target;
|
|
@@ -2273,12 +2306,12 @@ var CompositionPullModule = {
|
|
|
2273
2306
|
var ComponentPatternPullModule = {
|
|
2274
2307
|
...CompositionPullModule,
|
|
2275
2308
|
describe: "Pulls all component patterns to local files in a directory",
|
|
2276
|
-
builder: (
|
|
2309
|
+
builder: (yargs38) => withConfiguration(
|
|
2277
2310
|
withApiOptions(
|
|
2278
2311
|
withProjectOptions(
|
|
2279
2312
|
withStateOptions(
|
|
2280
2313
|
withDiffOptions(
|
|
2281
|
-
|
|
2314
|
+
yargs38.positional("directory", {
|
|
2282
2315
|
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2283
2316
|
type: "string"
|
|
2284
2317
|
}).option("format", {
|
|
@@ -2322,35 +2355,32 @@ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
|
2322
2355
|
var CompositionPushModule = {
|
|
2323
2356
|
command: "push <directory>",
|
|
2324
2357
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2325
|
-
builder: (
|
|
2358
|
+
builder: (yargs38) => withConfiguration(
|
|
2326
2359
|
withApiOptions(
|
|
2327
2360
|
withProjectOptions(
|
|
2328
2361
|
withStateOptions(
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
type: "boolean",
|
|
2352
|
-
hidden: true
|
|
2353
|
-
})
|
|
2362
|
+
withDebugOptions(
|
|
2363
|
+
withDiffOptions(
|
|
2364
|
+
yargs38.positional("directory", {
|
|
2365
|
+
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2366
|
+
type: "string"
|
|
2367
|
+
}).option("mode", {
|
|
2368
|
+
alias: ["m"],
|
|
2369
|
+
describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
|
|
2370
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2371
|
+
default: "mirror",
|
|
2372
|
+
type: "string"
|
|
2373
|
+
}).option("onlyCompositions", {
|
|
2374
|
+
describe: "Only pulling compositions and not patterns",
|
|
2375
|
+
default: false,
|
|
2376
|
+
type: "boolean"
|
|
2377
|
+
}).option("onlyPatterns", {
|
|
2378
|
+
describe: "Only pulling patterns and not compositions",
|
|
2379
|
+
default: false,
|
|
2380
|
+
type: "boolean",
|
|
2381
|
+
hidden: true
|
|
2382
|
+
})
|
|
2383
|
+
)
|
|
2354
2384
|
)
|
|
2355
2385
|
)
|
|
2356
2386
|
)
|
|
@@ -2369,9 +2399,10 @@ var CompositionPushModule = {
|
|
|
2369
2399
|
onlyPatterns,
|
|
2370
2400
|
patternType,
|
|
2371
2401
|
diff: diffMode,
|
|
2372
|
-
allowEmptySource
|
|
2402
|
+
allowEmptySource,
|
|
2403
|
+
verbose
|
|
2373
2404
|
}) => {
|
|
2374
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
2405
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2375
2406
|
const client = new UncachedCanvasClient11({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2376
2407
|
let source;
|
|
2377
2408
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -2395,7 +2426,8 @@ var CompositionPushModule = {
|
|
|
2395
2426
|
state,
|
|
2396
2427
|
onlyCompositions,
|
|
2397
2428
|
onlyPatterns,
|
|
2398
|
-
patternType
|
|
2429
|
+
patternType,
|
|
2430
|
+
verbose
|
|
2399
2431
|
});
|
|
2400
2432
|
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2401
2433
|
await syncEngine({
|
|
@@ -2403,6 +2435,7 @@ var CompositionPushModule = {
|
|
|
2403
2435
|
target,
|
|
2404
2436
|
mode,
|
|
2405
2437
|
whatIf,
|
|
2438
|
+
verbose,
|
|
2406
2439
|
allowEmptySource,
|
|
2407
2440
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2408
2441
|
onBeforeCompareObjects: async (sourceObject) => {
|
|
@@ -2424,12 +2457,12 @@ var CompositionPushModule = {
|
|
|
2424
2457
|
var ComponentPatternPushModule = {
|
|
2425
2458
|
...CompositionPushModule,
|
|
2426
2459
|
describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
|
|
2427
|
-
builder: (
|
|
2460
|
+
builder: (yargs38) => withConfiguration(
|
|
2428
2461
|
withApiOptions(
|
|
2429
2462
|
withProjectOptions(
|
|
2430
2463
|
withStateOptions(
|
|
2431
2464
|
withDiffOptions(
|
|
2432
|
-
|
|
2465
|
+
yargs38.positional("directory", {
|
|
2433
2466
|
describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
|
|
2434
2467
|
type: "string"
|
|
2435
2468
|
}).option("what-if", {
|
|
@@ -2467,15 +2500,23 @@ var CompositionRemoveModule = {
|
|
|
2467
2500
|
command: "remove <id>",
|
|
2468
2501
|
aliases: ["delete", "rm"],
|
|
2469
2502
|
describe: "Delete a composition",
|
|
2470
|
-
builder: (
|
|
2503
|
+
builder: (yargs38) => withConfiguration(
|
|
2471
2504
|
withApiOptions(
|
|
2472
|
-
|
|
2473
|
-
|
|
2505
|
+
withDebugOptions(
|
|
2506
|
+
withProjectOptions(
|
|
2507
|
+
yargs38.positional("id", {
|
|
2508
|
+
demandOption: true,
|
|
2509
|
+
describe: "Composition/pattern public ID to delete"
|
|
2510
|
+
})
|
|
2511
|
+
)
|
|
2474
2512
|
)
|
|
2475
2513
|
)
|
|
2476
2514
|
),
|
|
2477
|
-
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
2478
|
-
|
|
2515
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose }) => {
|
|
2516
|
+
if (verbose) {
|
|
2517
|
+
console.log(`\u{1F41B} remove composition: (id: ${id})`);
|
|
2518
|
+
}
|
|
2519
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2479
2520
|
const client = new UncachedCanvasClient12({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2480
2521
|
await client.removeComposition({ compositionId: id });
|
|
2481
2522
|
}
|
|
@@ -2496,37 +2537,34 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2496
2537
|
var CompositionUnpublishModule = {
|
|
2497
2538
|
command: "unpublish [ids]",
|
|
2498
2539
|
describe: "Unpublish a composition(s)",
|
|
2499
|
-
builder: (
|
|
2540
|
+
builder: (yargs38) => withConfiguration(
|
|
2500
2541
|
withApiOptions(
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
),
|
|
2528
|
-
handler: async ({
|
|
2529
|
-
apiHost,
|
|
2542
|
+
withDebugOptions(
|
|
2543
|
+
withProjectOptions(
|
|
2544
|
+
yargs38.positional("ids", {
|
|
2545
|
+
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2546
|
+
type: "string"
|
|
2547
|
+
}).option("all", {
|
|
2548
|
+
alias: ["a"],
|
|
2549
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
2550
|
+
default: false,
|
|
2551
|
+
type: "boolean"
|
|
2552
|
+
}).option("onlyCompositions", {
|
|
2553
|
+
describe: "Only publishing compositions and not patterns",
|
|
2554
|
+
default: false,
|
|
2555
|
+
type: "boolean"
|
|
2556
|
+
}).option("onlyPatterns", {
|
|
2557
|
+
describe: "Only pulling patterns and not compositions",
|
|
2558
|
+
default: false,
|
|
2559
|
+
type: "boolean",
|
|
2560
|
+
hidden: true
|
|
2561
|
+
})
|
|
2562
|
+
)
|
|
2563
|
+
)
|
|
2564
|
+
)
|
|
2565
|
+
),
|
|
2566
|
+
handler: async ({
|
|
2567
|
+
apiHost,
|
|
2530
2568
|
apiKey,
|
|
2531
2569
|
proxy,
|
|
2532
2570
|
ids,
|
|
@@ -2535,7 +2573,8 @@ var CompositionUnpublishModule = {
|
|
|
2535
2573
|
onlyPatterns,
|
|
2536
2574
|
patternType,
|
|
2537
2575
|
project: projectId,
|
|
2538
|
-
whatIf
|
|
2576
|
+
whatIf,
|
|
2577
|
+
verbose
|
|
2539
2578
|
}) => {
|
|
2540
2579
|
if (!all && !ids || all && ids) {
|
|
2541
2580
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
@@ -2543,7 +2582,7 @@ var CompositionUnpublishModule = {
|
|
|
2543
2582
|
}
|
|
2544
2583
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
2545
2584
|
const targetItems = /* @__PURE__ */ new Map();
|
|
2546
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
2585
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2547
2586
|
const client = new UncachedCanvasClient13({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2548
2587
|
const source = createComponentInstanceEngineDataSource({
|
|
2549
2588
|
client,
|
|
@@ -2551,7 +2590,8 @@ var CompositionUnpublishModule = {
|
|
|
2551
2590
|
compositionIDs: compositionIDsArray,
|
|
2552
2591
|
onlyCompositions,
|
|
2553
2592
|
onlyPatterns,
|
|
2554
|
-
patternType
|
|
2593
|
+
patternType,
|
|
2594
|
+
verbose
|
|
2555
2595
|
});
|
|
2556
2596
|
const target = createComponentInstanceEngineDataSource({
|
|
2557
2597
|
client,
|
|
@@ -2559,7 +2599,8 @@ var CompositionUnpublishModule = {
|
|
|
2559
2599
|
compositionIDs: compositionIDsArray,
|
|
2560
2600
|
onlyCompositions,
|
|
2561
2601
|
onlyPatterns,
|
|
2562
|
-
patternType
|
|
2602
|
+
patternType,
|
|
2603
|
+
verbose
|
|
2563
2604
|
});
|
|
2564
2605
|
const actions = [];
|
|
2565
2606
|
const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
@@ -2577,6 +2618,7 @@ var CompositionUnpublishModule = {
|
|
|
2577
2618
|
console.log(`Composition ${id} was not found`);
|
|
2578
2619
|
return;
|
|
2579
2620
|
}
|
|
2621
|
+
console.log(`\u{1F41B} unpublishing composition: (id: ${id})`);
|
|
2580
2622
|
actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
|
|
2581
2623
|
log({
|
|
2582
2624
|
action: "update",
|
|
@@ -2594,10 +2636,10 @@ var CompositionUnpublishModule = {
|
|
|
2594
2636
|
var ComponentPatternUnpublishModule = {
|
|
2595
2637
|
command: "unpublish [ids]",
|
|
2596
2638
|
describe: "Unpublish a component pattern(s)",
|
|
2597
|
-
builder: (
|
|
2639
|
+
builder: (yargs38) => withConfiguration(
|
|
2598
2640
|
withApiOptions(
|
|
2599
2641
|
withProjectOptions(
|
|
2600
|
-
|
|
2642
|
+
yargs38.positional("ids", {
|
|
2601
2643
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2602
2644
|
type: "string"
|
|
2603
2645
|
}).option("all", {
|
|
@@ -2636,17 +2678,25 @@ var CompositionUpdateModule = {
|
|
|
2636
2678
|
command: "update <filename>",
|
|
2637
2679
|
aliases: ["put"],
|
|
2638
2680
|
describe: "Insert or update a composition",
|
|
2639
|
-
builder: (
|
|
2681
|
+
builder: (yargs38) => withConfiguration(
|
|
2640
2682
|
withApiOptions(
|
|
2641
2683
|
withProjectOptions(
|
|
2642
|
-
|
|
2643
|
-
|
|
2684
|
+
withVerboseOption(
|
|
2685
|
+
withStateOptions(
|
|
2686
|
+
yargs38.positional("filename", {
|
|
2687
|
+
demandOption: true,
|
|
2688
|
+
describe: "Composition/pattern file to put"
|
|
2689
|
+
})
|
|
2690
|
+
)
|
|
2644
2691
|
)
|
|
2645
2692
|
)
|
|
2646
2693
|
)
|
|
2647
2694
|
),
|
|
2648
|
-
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, state }) => {
|
|
2649
|
-
|
|
2695
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, state, verbose }) => {
|
|
2696
|
+
if (verbose) {
|
|
2697
|
+
console.log(`\u{1F41B} update composition: (filename: ${filename}, state: ${convertStateOption(state)})`);
|
|
2698
|
+
}
|
|
2699
|
+
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2650
2700
|
const client = new UncachedCanvasClient14({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2651
2701
|
const file = readFileToObject(filename);
|
|
2652
2702
|
await client.updateComposition({ ...file, state: convertStateOption(state) });
|
|
@@ -2663,7 +2713,7 @@ var ComponentPatternUpdateModule = {
|
|
|
2663
2713
|
var ComponentPatternModule = {
|
|
2664
2714
|
command: "component-pattern <command>",
|
|
2665
2715
|
describe: "Commands for Canvas component patterns",
|
|
2666
|
-
builder: (
|
|
2716
|
+
builder: (yargs38) => yargs38.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
|
|
2667
2717
|
handler: () => {
|
|
2668
2718
|
yargs4.help();
|
|
2669
2719
|
}
|
|
@@ -2675,7 +2725,7 @@ var CompositionModule = {
|
|
|
2675
2725
|
command: "composition <command>",
|
|
2676
2726
|
describe: "Commands for Canvas compositions",
|
|
2677
2727
|
aliases: ["comp"],
|
|
2678
|
-
builder: (
|
|
2728
|
+
builder: (yargs38) => yargs38.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2679
2729
|
handler: () => {
|
|
2680
2730
|
yargs5.help();
|
|
2681
2731
|
}
|
|
@@ -2694,12 +2744,12 @@ var CompositionPatternGetModule = {
|
|
|
2694
2744
|
var CompositionPatternListModule = {
|
|
2695
2745
|
...CompositionListModule,
|
|
2696
2746
|
describe: "List composition patterns",
|
|
2697
|
-
builder: (
|
|
2747
|
+
builder: (yargs38) => withFormatOptions(
|
|
2698
2748
|
withConfiguration(
|
|
2699
2749
|
withApiOptions(
|
|
2700
2750
|
withProjectOptions(
|
|
2701
2751
|
withStateOptions(
|
|
2702
|
-
|
|
2752
|
+
yargs38.options({
|
|
2703
2753
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2704
2754
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2705
2755
|
resolvePatterns: {
|
|
@@ -2742,11 +2792,11 @@ var CompositionPatternListModule = {
|
|
|
2742
2792
|
var CompositionPatternPublishModule = {
|
|
2743
2793
|
...CompositionPublishModule,
|
|
2744
2794
|
describe: "Publishes composition pattern(s)",
|
|
2745
|
-
builder: (
|
|
2795
|
+
builder: (yargs38) => withConfiguration(
|
|
2746
2796
|
withApiOptions(
|
|
2747
2797
|
withProjectOptions(
|
|
2748
2798
|
withDiffOptions(
|
|
2749
|
-
|
|
2799
|
+
yargs38.positional("ids", {
|
|
2750
2800
|
describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2751
2801
|
type: "string"
|
|
2752
2802
|
}).option("all", {
|
|
@@ -2789,12 +2839,12 @@ var CompositionPatternPublishModule = {
|
|
|
2789
2839
|
var CompositionPatternPullModule = {
|
|
2790
2840
|
...CompositionPullModule,
|
|
2791
2841
|
describe: "Pulls all composition patterns to local files in a directory",
|
|
2792
|
-
builder: (
|
|
2842
|
+
builder: (yargs38) => withConfiguration(
|
|
2793
2843
|
withApiOptions(
|
|
2794
2844
|
withProjectOptions(
|
|
2795
2845
|
withStateOptions(
|
|
2796
2846
|
withDiffOptions(
|
|
2797
|
-
|
|
2847
|
+
yargs38.positional("directory", {
|
|
2798
2848
|
describe: "Directory to save the composition patterns to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2799
2849
|
type: "string"
|
|
2800
2850
|
}).option("format", {
|
|
@@ -2836,12 +2886,12 @@ var CompositionPatternPullModule = {
|
|
|
2836
2886
|
var CompositionPatternPushModule = {
|
|
2837
2887
|
...CompositionPushModule,
|
|
2838
2888
|
describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
|
|
2839
|
-
builder: (
|
|
2889
|
+
builder: (yargs38) => withConfiguration(
|
|
2840
2890
|
withApiOptions(
|
|
2841
2891
|
withProjectOptions(
|
|
2842
2892
|
withStateOptions(
|
|
2843
2893
|
withDiffOptions(
|
|
2844
|
-
|
|
2894
|
+
yargs38.positional("directory", {
|
|
2845
2895
|
describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
|
|
2846
2896
|
type: "string"
|
|
2847
2897
|
}).option("what-if", {
|
|
@@ -2883,10 +2933,10 @@ var CompositionPatternRemoveModule = {
|
|
|
2883
2933
|
var CompositionPatternUnpublishModule = {
|
|
2884
2934
|
command: "unpublish [ids]",
|
|
2885
2935
|
describe: "Unpublish a composition pattern(s)",
|
|
2886
|
-
builder: (
|
|
2936
|
+
builder: (yargs38) => withConfiguration(
|
|
2887
2937
|
withApiOptions(
|
|
2888
2938
|
withProjectOptions(
|
|
2889
|
-
|
|
2939
|
+
yargs38.positional("ids", {
|
|
2890
2940
|
describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2891
2941
|
type: "string"
|
|
2892
2942
|
}).option("all", {
|
|
@@ -2926,7 +2976,7 @@ var CompositionPatternUpdateModule = {
|
|
|
2926
2976
|
var CompositionPatternModule = {
|
|
2927
2977
|
command: "composition-pattern <command>",
|
|
2928
2978
|
describe: "Commands for Canvas composition patterns",
|
|
2929
|
-
builder: (
|
|
2979
|
+
builder: (yargs38) => yargs38.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
|
|
2930
2980
|
handler: () => {
|
|
2931
2981
|
yargs6.help();
|
|
2932
2982
|
}
|
|
@@ -2940,12 +2990,12 @@ import { ContentClient } from "@uniformdev/canvas";
|
|
|
2940
2990
|
var ContentTypeGetModule = {
|
|
2941
2991
|
command: "get <id>",
|
|
2942
2992
|
describe: "Get a content type",
|
|
2943
|
-
builder: (
|
|
2993
|
+
builder: (yargs38) => withConfiguration(
|
|
2944
2994
|
withFormatOptions(
|
|
2945
2995
|
withApiOptions(
|
|
2946
2996
|
withProjectOptions(
|
|
2947
2997
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2948
|
-
|
|
2998
|
+
yargs38.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2949
2999
|
)
|
|
2950
3000
|
)
|
|
2951
3001
|
)
|
|
@@ -2967,7 +3017,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2967
3017
|
var ContentTypeListModule = {
|
|
2968
3018
|
command: "list",
|
|
2969
3019
|
describe: "List content types",
|
|
2970
|
-
builder: (
|
|
3020
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
2971
3021
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2972
3022
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2973
3023
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3015,11 +3065,11 @@ function createContentTypeEngineDataSource({
|
|
|
3015
3065
|
var ContentTypePullModule = {
|
|
3016
3066
|
command: "pull <directory>",
|
|
3017
3067
|
describe: "Pulls all content types to local files in a directory",
|
|
3018
|
-
builder: (
|
|
3068
|
+
builder: (yargs38) => withConfiguration(
|
|
3019
3069
|
withApiOptions(
|
|
3020
3070
|
withProjectOptions(
|
|
3021
3071
|
withDiffOptions(
|
|
3022
|
-
|
|
3072
|
+
yargs38.positional("directory", {
|
|
3023
3073
|
describe: "Directory to save the content types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3024
3074
|
type: "string"
|
|
3025
3075
|
}).option("format", {
|
|
@@ -3103,11 +3153,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
3103
3153
|
var ContentTypePushModule = {
|
|
3104
3154
|
command: "push <directory>",
|
|
3105
3155
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
3106
|
-
builder: (
|
|
3156
|
+
builder: (yargs38) => withConfiguration(
|
|
3107
3157
|
withApiOptions(
|
|
3108
3158
|
withProjectOptions(
|
|
3109
3159
|
withDiffOptions(
|
|
3110
|
-
|
|
3160
|
+
yargs38.positional("directory", {
|
|
3111
3161
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
3112
3162
|
type: "string"
|
|
3113
3163
|
}).option("what-if", {
|
|
@@ -3180,10 +3230,10 @@ var ContentTypeRemoveModule = {
|
|
|
3180
3230
|
command: "remove <id>",
|
|
3181
3231
|
aliases: ["delete", "rm"],
|
|
3182
3232
|
describe: "Delete a content type",
|
|
3183
|
-
builder: (
|
|
3233
|
+
builder: (yargs38) => withConfiguration(
|
|
3184
3234
|
withApiOptions(
|
|
3185
3235
|
withProjectOptions(
|
|
3186
|
-
|
|
3236
|
+
yargs38.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
3187
3237
|
)
|
|
3188
3238
|
)
|
|
3189
3239
|
),
|
|
@@ -3200,10 +3250,10 @@ var ContentTypeUpdateModule = {
|
|
|
3200
3250
|
command: "update <filename>",
|
|
3201
3251
|
aliases: ["put"],
|
|
3202
3252
|
describe: "Insert or update a content type",
|
|
3203
|
-
builder: (
|
|
3253
|
+
builder: (yargs38) => withConfiguration(
|
|
3204
3254
|
withApiOptions(
|
|
3205
3255
|
withProjectOptions(
|
|
3206
|
-
|
|
3256
|
+
yargs38.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
3207
3257
|
)
|
|
3208
3258
|
)
|
|
3209
3259
|
),
|
|
@@ -3220,7 +3270,7 @@ var ContentTypeModule = {
|
|
|
3220
3270
|
command: "contenttype <command>",
|
|
3221
3271
|
aliases: ["ct"],
|
|
3222
3272
|
describe: "Commands for Content Types",
|
|
3223
|
-
builder: (
|
|
3273
|
+
builder: (yargs38) => yargs38.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
3224
3274
|
handler: () => {
|
|
3225
3275
|
yargs7.help();
|
|
3226
3276
|
}
|
|
@@ -3234,11 +3284,11 @@ import { DataSourceClient } from "@uniformdev/canvas";
|
|
|
3234
3284
|
var DataSourceGetModule = {
|
|
3235
3285
|
command: "get <id>",
|
|
3236
3286
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
3237
|
-
builder: (
|
|
3287
|
+
builder: (yargs38) => withConfiguration(
|
|
3238
3288
|
withApiOptions(
|
|
3239
3289
|
withProjectOptions(
|
|
3240
3290
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3241
|
-
|
|
3291
|
+
yargs38.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
3242
3292
|
)
|
|
3243
3293
|
)
|
|
3244
3294
|
),
|
|
@@ -3256,10 +3306,10 @@ var DataSourceRemoveModule = {
|
|
|
3256
3306
|
command: "remove <id>",
|
|
3257
3307
|
aliases: ["delete", "rm"],
|
|
3258
3308
|
describe: "Delete a data source",
|
|
3259
|
-
builder: (
|
|
3309
|
+
builder: (yargs38) => withConfiguration(
|
|
3260
3310
|
withApiOptions(
|
|
3261
3311
|
withProjectOptions(
|
|
3262
|
-
|
|
3312
|
+
yargs38.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
|
|
3263
3313
|
)
|
|
3264
3314
|
)
|
|
3265
3315
|
),
|
|
@@ -3276,10 +3326,10 @@ var DataSourceUpdateModule = {
|
|
|
3276
3326
|
command: "update <dataSource>",
|
|
3277
3327
|
aliases: ["put"],
|
|
3278
3328
|
describe: "Insert or update a data source",
|
|
3279
|
-
builder: (
|
|
3329
|
+
builder: (yargs38) => withConfiguration(
|
|
3280
3330
|
withApiOptions(
|
|
3281
3331
|
withProjectOptions(
|
|
3282
|
-
|
|
3332
|
+
yargs38.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
|
|
3283
3333
|
describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
|
|
3284
3334
|
type: "string",
|
|
3285
3335
|
demandOption: true
|
|
@@ -3299,7 +3349,7 @@ var DataSourceModule = {
|
|
|
3299
3349
|
command: "datasource <command>",
|
|
3300
3350
|
aliases: ["ds"],
|
|
3301
3351
|
describe: "Commands for Data Source definitions",
|
|
3302
|
-
builder: (
|
|
3352
|
+
builder: (yargs38) => yargs38.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
|
|
3303
3353
|
handler: () => {
|
|
3304
3354
|
yargs8.help();
|
|
3305
3355
|
}
|
|
@@ -3314,12 +3364,12 @@ var DataTypeGetModule = {
|
|
|
3314
3364
|
command: "get <id>",
|
|
3315
3365
|
describe: "Get a data type",
|
|
3316
3366
|
aliases: ["ls"],
|
|
3317
|
-
builder: (
|
|
3367
|
+
builder: (yargs38) => withConfiguration(
|
|
3318
3368
|
withFormatOptions(
|
|
3319
3369
|
withApiOptions(
|
|
3320
3370
|
withProjectOptions(
|
|
3321
3371
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3322
|
-
|
|
3372
|
+
yargs38.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
3323
3373
|
)
|
|
3324
3374
|
)
|
|
3325
3375
|
)
|
|
@@ -3342,7 +3392,7 @@ var DataTypeListModule = {
|
|
|
3342
3392
|
command: "list",
|
|
3343
3393
|
describe: "List data types",
|
|
3344
3394
|
aliases: ["ls"],
|
|
3345
|
-
builder: (
|
|
3395
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
3346
3396
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3347
3397
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3348
3398
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3392,11 +3442,11 @@ function createDataTypeEngineDataSource({
|
|
|
3392
3442
|
var DataTypePullModule = {
|
|
3393
3443
|
command: "pull <directory>",
|
|
3394
3444
|
describe: "Pulls all data types to local files in a directory",
|
|
3395
|
-
builder: (
|
|
3445
|
+
builder: (yargs38) => withConfiguration(
|
|
3396
3446
|
withApiOptions(
|
|
3397
3447
|
withProjectOptions(
|
|
3398
3448
|
withDiffOptions(
|
|
3399
|
-
|
|
3449
|
+
yargs38.positional("directory", {
|
|
3400
3450
|
describe: "Directory to save the data types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3401
3451
|
type: "string"
|
|
3402
3452
|
}).option("format", {
|
|
@@ -3480,11 +3530,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
3480
3530
|
var DataTypePushModule = {
|
|
3481
3531
|
command: "push <directory>",
|
|
3482
3532
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
3483
|
-
builder: (
|
|
3533
|
+
builder: (yargs38) => withConfiguration(
|
|
3484
3534
|
withApiOptions(
|
|
3485
3535
|
withProjectOptions(
|
|
3486
3536
|
withDiffOptions(
|
|
3487
|
-
|
|
3537
|
+
yargs38.positional("directory", {
|
|
3488
3538
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
3489
3539
|
type: "string"
|
|
3490
3540
|
}).option("what-if", {
|
|
@@ -3557,10 +3607,10 @@ var DataTypeRemoveModule = {
|
|
|
3557
3607
|
command: "remove <id>",
|
|
3558
3608
|
aliases: ["delete", "rm"],
|
|
3559
3609
|
describe: "Delete a data type",
|
|
3560
|
-
builder: (
|
|
3610
|
+
builder: (yargs38) => withConfiguration(
|
|
3561
3611
|
withApiOptions(
|
|
3562
3612
|
withProjectOptions(
|
|
3563
|
-
|
|
3613
|
+
yargs38.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
3564
3614
|
)
|
|
3565
3615
|
)
|
|
3566
3616
|
),
|
|
@@ -3577,10 +3627,10 @@ var DataTypeUpdateModule = {
|
|
|
3577
3627
|
command: "update <filename>",
|
|
3578
3628
|
aliases: ["put"],
|
|
3579
3629
|
describe: "Insert or update a data type",
|
|
3580
|
-
builder: (
|
|
3630
|
+
builder: (yargs38) => withConfiguration(
|
|
3581
3631
|
withApiOptions(
|
|
3582
3632
|
withProjectOptions(
|
|
3583
|
-
|
|
3633
|
+
yargs38.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
3584
3634
|
)
|
|
3585
3635
|
)
|
|
3586
3636
|
),
|
|
@@ -3597,7 +3647,7 @@ var DataTypeModule = {
|
|
|
3597
3647
|
command: "datatype <command>",
|
|
3598
3648
|
aliases: ["dt"],
|
|
3599
3649
|
describe: "Commands for Data Type definitions",
|
|
3600
|
-
builder: (
|
|
3650
|
+
builder: (yargs38) => yargs38.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3601
3651
|
handler: () => {
|
|
3602
3652
|
yargs9.help();
|
|
3603
3653
|
}
|
|
@@ -3611,12 +3661,12 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
|
3611
3661
|
var EntryGetModule = {
|
|
3612
3662
|
command: "get <id>",
|
|
3613
3663
|
describe: "Get an entry",
|
|
3614
|
-
builder: (
|
|
3664
|
+
builder: (yargs38) => withConfiguration(
|
|
3615
3665
|
withFormatOptions(
|
|
3616
3666
|
withApiOptions(
|
|
3617
3667
|
withProjectOptions(
|
|
3618
3668
|
withStateOptions(
|
|
3619
|
-
|
|
3669
|
+
yargs38.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
|
|
3620
3670
|
resolveData: {
|
|
3621
3671
|
type: "boolean",
|
|
3622
3672
|
default: false,
|
|
@@ -3680,12 +3730,12 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
|
3680
3730
|
var EntryListModule = {
|
|
3681
3731
|
command: "list",
|
|
3682
3732
|
describe: "List entries",
|
|
3683
|
-
builder: (
|
|
3733
|
+
builder: (yargs38) => withConfiguration(
|
|
3684
3734
|
withFormatOptions(
|
|
3685
3735
|
withApiOptions(
|
|
3686
3736
|
withProjectOptions(
|
|
3687
3737
|
withStateOptions(
|
|
3688
|
-
|
|
3738
|
+
yargs38.options({
|
|
3689
3739
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3690
3740
|
limit: { describe: "Number of rows to fetch", type: "number", default: LEGACY_DEFAULT_LIMIT },
|
|
3691
3741
|
search: { describe: "Search query", type: "string", default: "" }
|
|
@@ -3730,7 +3780,7 @@ var EntryListModule = {
|
|
|
3730
3780
|
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3731
3781
|
|
|
3732
3782
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3733
|
-
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
3783
|
+
import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
3734
3784
|
|
|
3735
3785
|
// src/commands/canvas/commands/entry/_util.ts
|
|
3736
3786
|
var selectEntryIdentifier = (e) => {
|
|
@@ -3761,18 +3811,27 @@ function createEntryEngineDataSource({
|
|
|
3761
3811
|
const stateId = convertStateOption(state);
|
|
3762
3812
|
async function* getObjects() {
|
|
3763
3813
|
const entries = paginateAsync(
|
|
3764
|
-
async (offset, limit) =>
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3814
|
+
async (offset, limit) => {
|
|
3815
|
+
try {
|
|
3816
|
+
return (await client.getEntries({
|
|
3817
|
+
offset,
|
|
3818
|
+
limit,
|
|
3819
|
+
entryIDs,
|
|
3820
|
+
pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
|
|
3821
|
+
skipDataResolution: true,
|
|
3822
|
+
skipOverridesResolution: true,
|
|
3823
|
+
skipPatternResolution: true,
|
|
3824
|
+
state: stateId,
|
|
3825
|
+
withComponentIDs: true,
|
|
3826
|
+
editions: "all"
|
|
3827
|
+
})).entries;
|
|
3828
|
+
} catch (error) {
|
|
3829
|
+
if (error instanceof ApiClientError && error.errorMessage === "Entry not found or not published") {
|
|
3830
|
+
return [];
|
|
3831
|
+
}
|
|
3832
|
+
throw error;
|
|
3833
|
+
}
|
|
3834
|
+
},
|
|
3776
3835
|
{ pageSize: 100 }
|
|
3777
3836
|
);
|
|
3778
3837
|
for await (const e of entries) {
|
|
@@ -3801,11 +3860,11 @@ function createEntryEngineDataSource({
|
|
|
3801
3860
|
var EntryPublishModule = {
|
|
3802
3861
|
command: "publish [ids]",
|
|
3803
3862
|
describe: "Publishes entry(ies)",
|
|
3804
|
-
builder: (
|
|
3863
|
+
builder: (yargs38) => withConfiguration(
|
|
3805
3864
|
withApiOptions(
|
|
3806
3865
|
withProjectOptions(
|
|
3807
3866
|
withDiffOptions(
|
|
3808
|
-
|
|
3867
|
+
yargs38.positional("ids", {
|
|
3809
3868
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3810
3869
|
type: "string"
|
|
3811
3870
|
}).option("all", {
|
|
@@ -3860,12 +3919,12 @@ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
|
3860
3919
|
var EntryPullModule = {
|
|
3861
3920
|
command: "pull <directory>",
|
|
3862
3921
|
describe: "Pulls all entries to local files in a directory",
|
|
3863
|
-
builder: (
|
|
3922
|
+
builder: (yargs38) => withConfiguration(
|
|
3864
3923
|
withApiOptions(
|
|
3865
3924
|
withProjectOptions(
|
|
3866
3925
|
withStateOptions(
|
|
3867
3926
|
withDiffOptions(
|
|
3868
|
-
|
|
3927
|
+
yargs38.positional("directory", {
|
|
3869
3928
|
describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3870
3929
|
type: "string"
|
|
3871
3930
|
}).option("format", {
|
|
@@ -3965,12 +4024,12 @@ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
|
3965
4024
|
var EntryPushModule = {
|
|
3966
4025
|
command: "push <directory>",
|
|
3967
4026
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3968
|
-
builder: (
|
|
4027
|
+
builder: (yargs38) => withConfiguration(
|
|
3969
4028
|
withApiOptions(
|
|
3970
4029
|
withProjectOptions(
|
|
3971
4030
|
withStateOptions(
|
|
3972
4031
|
withDiffOptions(
|
|
3973
|
-
|
|
4032
|
+
yargs38.positional("directory", {
|
|
3974
4033
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3975
4034
|
type: "string"
|
|
3976
4035
|
}).option("what-if", {
|
|
@@ -4057,10 +4116,10 @@ var EntryRemoveModule = {
|
|
|
4057
4116
|
command: "remove <id>",
|
|
4058
4117
|
aliases: ["delete", "rm"],
|
|
4059
4118
|
describe: "Delete an entry",
|
|
4060
|
-
builder: (
|
|
4119
|
+
builder: (yargs38) => withConfiguration(
|
|
4061
4120
|
withApiOptions(
|
|
4062
4121
|
withProjectOptions(
|
|
4063
|
-
|
|
4122
|
+
yargs38.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
4064
4123
|
)
|
|
4065
4124
|
)
|
|
4066
4125
|
),
|
|
@@ -4077,10 +4136,10 @@ import { diffJson as diffJson3 } from "diff";
|
|
|
4077
4136
|
var EntryUnpublishModule = {
|
|
4078
4137
|
command: "unpublish [ids]",
|
|
4079
4138
|
describe: "Unpublish an entry(ies)",
|
|
4080
|
-
builder: (
|
|
4139
|
+
builder: (yargs38) => withConfiguration(
|
|
4081
4140
|
withApiOptions(
|
|
4082
4141
|
withProjectOptions(
|
|
4083
|
-
|
|
4142
|
+
yargs38.positional("ids", {
|
|
4084
4143
|
describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4085
4144
|
type: "string"
|
|
4086
4145
|
}).option("all", {
|
|
@@ -4153,11 +4212,11 @@ var EntryUpdateModule = {
|
|
|
4153
4212
|
command: "update <filename>",
|
|
4154
4213
|
aliases: ["put"],
|
|
4155
4214
|
describe: "Insert or update an entry",
|
|
4156
|
-
builder: (
|
|
4215
|
+
builder: (yargs38) => withConfiguration(
|
|
4157
4216
|
withApiOptions(
|
|
4158
4217
|
withProjectOptions(
|
|
4159
4218
|
withStateOptions(
|
|
4160
|
-
|
|
4219
|
+
yargs38.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
4161
4220
|
)
|
|
4162
4221
|
)
|
|
4163
4222
|
)
|
|
@@ -4174,7 +4233,7 @@ var EntryUpdateModule = {
|
|
|
4174
4233
|
var EntryModule = {
|
|
4175
4234
|
command: "entry <command>",
|
|
4176
4235
|
describe: "Commands for Entries",
|
|
4177
|
-
builder: (
|
|
4236
|
+
builder: (yargs38) => yargs38.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
|
|
4178
4237
|
handler: () => {
|
|
4179
4238
|
yargs10.help();
|
|
4180
4239
|
}
|
|
@@ -4188,12 +4247,12 @@ import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
|
|
|
4188
4247
|
var EntryPatternGetModule = {
|
|
4189
4248
|
command: "get <id>",
|
|
4190
4249
|
describe: "Get an entry pattern",
|
|
4191
|
-
builder: (
|
|
4250
|
+
builder: (yargs38) => withConfiguration(
|
|
4192
4251
|
withFormatOptions(
|
|
4193
4252
|
withApiOptions(
|
|
4194
4253
|
withProjectOptions(
|
|
4195
4254
|
withStateOptions(
|
|
4196
|
-
|
|
4255
|
+
yargs38.positional("id", {
|
|
4197
4256
|
demandOption: true,
|
|
4198
4257
|
describe: "Entry pattern public ID to fetch"
|
|
4199
4258
|
}),
|
|
@@ -4228,8 +4287,8 @@ import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
|
|
|
4228
4287
|
var EntryPatternListModule = {
|
|
4229
4288
|
command: "list",
|
|
4230
4289
|
describe: "List entry patterns",
|
|
4231
|
-
builder: (
|
|
4232
|
-
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(
|
|
4290
|
+
builder: (yargs38) => withConfiguration(
|
|
4291
|
+
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs38, "published"))))
|
|
4233
4292
|
),
|
|
4234
4293
|
handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
|
|
4235
4294
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4252,11 +4311,11 @@ import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
|
|
|
4252
4311
|
var EntryPatternPublishModule = {
|
|
4253
4312
|
command: "publish [ids]",
|
|
4254
4313
|
describe: "Publishes entry pattern(s)",
|
|
4255
|
-
builder: (
|
|
4314
|
+
builder: (yargs38) => withConfiguration(
|
|
4256
4315
|
withApiOptions(
|
|
4257
4316
|
withProjectOptions(
|
|
4258
4317
|
withDiffOptions(
|
|
4259
|
-
|
|
4318
|
+
yargs38.positional("ids", {
|
|
4260
4319
|
describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4261
4320
|
type: "string"
|
|
4262
4321
|
}).option("all", {
|
|
@@ -4311,12 +4370,12 @@ import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
|
|
|
4311
4370
|
var EntryPatternPullModule = {
|
|
4312
4371
|
command: "pull <directory>",
|
|
4313
4372
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
4314
|
-
builder: (
|
|
4373
|
+
builder: (yargs38) => withConfiguration(
|
|
4315
4374
|
withApiOptions(
|
|
4316
4375
|
withProjectOptions(
|
|
4317
4376
|
withStateOptions(
|
|
4318
4377
|
withDiffOptions(
|
|
4319
|
-
|
|
4378
|
+
yargs38.positional("directory", {
|
|
4320
4379
|
describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4321
4380
|
type: "string"
|
|
4322
4381
|
}).option("format", {
|
|
@@ -4416,12 +4475,12 @@ import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
|
|
|
4416
4475
|
var EntryPatternPushModule = {
|
|
4417
4476
|
command: "push <directory>",
|
|
4418
4477
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
4419
|
-
builder: (
|
|
4478
|
+
builder: (yargs38) => withConfiguration(
|
|
4420
4479
|
withApiOptions(
|
|
4421
4480
|
withProjectOptions(
|
|
4422
4481
|
withStateOptions(
|
|
4423
4482
|
withDiffOptions(
|
|
4424
|
-
|
|
4483
|
+
yargs38.positional("directory", {
|
|
4425
4484
|
describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
|
|
4426
4485
|
type: "string"
|
|
4427
4486
|
}).option("what-if", {
|
|
@@ -4508,10 +4567,10 @@ var EntryPatternRemoveModule = {
|
|
|
4508
4567
|
command: "remove <id>",
|
|
4509
4568
|
aliases: ["delete", "rm"],
|
|
4510
4569
|
describe: "Delete an entry pattern",
|
|
4511
|
-
builder: (
|
|
4570
|
+
builder: (yargs38) => withConfiguration(
|
|
4512
4571
|
withApiOptions(
|
|
4513
4572
|
withProjectOptions(
|
|
4514
|
-
|
|
4573
|
+
yargs38.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
|
|
4515
4574
|
)
|
|
4516
4575
|
)
|
|
4517
4576
|
),
|
|
@@ -4528,10 +4587,10 @@ import { diffJson as diffJson4 } from "diff";
|
|
|
4528
4587
|
var EntryPatternUnpublishModule = {
|
|
4529
4588
|
command: "unpublish [ids]",
|
|
4530
4589
|
describe: "Unpublish an entry patterns",
|
|
4531
|
-
builder: (
|
|
4590
|
+
builder: (yargs38) => withConfiguration(
|
|
4532
4591
|
withApiOptions(
|
|
4533
4592
|
withProjectOptions(
|
|
4534
|
-
|
|
4593
|
+
yargs38.positional("ids", {
|
|
4535
4594
|
describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4536
4595
|
type: "string"
|
|
4537
4596
|
}).option("all", {
|
|
@@ -4604,11 +4663,11 @@ var EntryPatternUpdateModule = {
|
|
|
4604
4663
|
command: "update <filename>",
|
|
4605
4664
|
aliases: ["put"],
|
|
4606
4665
|
describe: "Insert or update an entry pattern",
|
|
4607
|
-
builder: (
|
|
4666
|
+
builder: (yargs38) => withConfiguration(
|
|
4608
4667
|
withApiOptions(
|
|
4609
4668
|
withProjectOptions(
|
|
4610
4669
|
withStateOptions(
|
|
4611
|
-
|
|
4670
|
+
yargs38.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
|
|
4612
4671
|
)
|
|
4613
4672
|
)
|
|
4614
4673
|
)
|
|
@@ -4625,7 +4684,7 @@ var EntryPatternUpdateModule = {
|
|
|
4625
4684
|
var EntryPatternModule = {
|
|
4626
4685
|
command: "entry-pattern <command>",
|
|
4627
4686
|
describe: "Commands for Entry patterns",
|
|
4628
|
-
builder: (
|
|
4687
|
+
builder: (yargs38) => yargs38.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
|
|
4629
4688
|
handler: () => {
|
|
4630
4689
|
yargs11.help();
|
|
4631
4690
|
}
|
|
@@ -4671,11 +4730,11 @@ function createLocaleEngineDataSource({
|
|
|
4671
4730
|
var LocalePullModule = {
|
|
4672
4731
|
command: "pull <directory>",
|
|
4673
4732
|
describe: "Pulls all locales to local files in a directory",
|
|
4674
|
-
builder: (
|
|
4733
|
+
builder: (yargs38) => withConfiguration(
|
|
4675
4734
|
withApiOptions(
|
|
4676
4735
|
withProjectOptions(
|
|
4677
4736
|
withDiffOptions(
|
|
4678
|
-
|
|
4737
|
+
yargs38.positional("directory", {
|
|
4679
4738
|
describe: "Directory to save the locales to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4680
4739
|
type: "string"
|
|
4681
4740
|
}).option("format", {
|
|
@@ -4759,11 +4818,11 @@ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
|
4759
4818
|
var LocalePushModule = {
|
|
4760
4819
|
command: "push <directory>",
|
|
4761
4820
|
describe: "Pushes all locales from files in a directory to Uniform",
|
|
4762
|
-
builder: (
|
|
4821
|
+
builder: (yargs38) => withConfiguration(
|
|
4763
4822
|
withApiOptions(
|
|
4764
4823
|
withProjectOptions(
|
|
4765
4824
|
withDiffOptions(
|
|
4766
|
-
|
|
4825
|
+
yargs38.positional("directory", {
|
|
4767
4826
|
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
4768
4827
|
type: "string"
|
|
4769
4828
|
}).option("what-if", {
|
|
@@ -4834,7 +4893,7 @@ var LocalePushModule = {
|
|
|
4834
4893
|
var LocaleModule = {
|
|
4835
4894
|
command: "locale <command>",
|
|
4836
4895
|
describe: "Commands for locale definitions",
|
|
4837
|
-
builder: (
|
|
4896
|
+
builder: (yargs38) => yargs38.command(LocalePullModule).command(LocalePushModule),
|
|
4838
4897
|
handler: () => {
|
|
4839
4898
|
yargs12.help();
|
|
4840
4899
|
}
|
|
@@ -4853,12 +4912,12 @@ var PatternGetModule = {
|
|
|
4853
4912
|
var PatternListModule = {
|
|
4854
4913
|
...CompositionListModule,
|
|
4855
4914
|
describe: "List patterns",
|
|
4856
|
-
builder: (
|
|
4915
|
+
builder: (yargs38) => withFormatOptions(
|
|
4857
4916
|
withConfiguration(
|
|
4858
4917
|
withApiOptions(
|
|
4859
4918
|
withProjectOptions(
|
|
4860
4919
|
withStateOptions(
|
|
4861
|
-
|
|
4920
|
+
yargs38.options({
|
|
4862
4921
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
4863
4922
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
4864
4923
|
resolvePatterns: {
|
|
@@ -4896,11 +4955,11 @@ var PatternListModule = {
|
|
|
4896
4955
|
var PatternPublishModule = {
|
|
4897
4956
|
...CompositionPublishModule,
|
|
4898
4957
|
describe: "Publishes pattern(s)",
|
|
4899
|
-
builder: (
|
|
4958
|
+
builder: (yargs38) => withConfiguration(
|
|
4900
4959
|
withApiOptions(
|
|
4901
4960
|
withProjectOptions(
|
|
4902
4961
|
withDiffOptions(
|
|
4903
|
-
|
|
4962
|
+
yargs38.positional("ids", {
|
|
4904
4963
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4905
4964
|
type: "string"
|
|
4906
4965
|
}).option("all", {
|
|
@@ -4938,12 +4997,12 @@ var PatternPublishModule = {
|
|
|
4938
4997
|
var PatternPullModule = {
|
|
4939
4998
|
...CompositionPullModule,
|
|
4940
4999
|
describe: "Pulls all patterns to local files in a directory",
|
|
4941
|
-
builder: (
|
|
5000
|
+
builder: (yargs38) => withConfiguration(
|
|
4942
5001
|
withApiOptions(
|
|
4943
5002
|
withProjectOptions(
|
|
4944
5003
|
withStateOptions(
|
|
4945
5004
|
withDiffOptions(
|
|
4946
|
-
|
|
5005
|
+
yargs38.positional("directory", {
|
|
4947
5006
|
describe: "Directory to save the definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4948
5007
|
type: "string"
|
|
4949
5008
|
}).option("format", {
|
|
@@ -4981,12 +5040,12 @@ var PatternPullModule = {
|
|
|
4981
5040
|
var PatternPushModule = {
|
|
4982
5041
|
...CompositionPushModule,
|
|
4983
5042
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
4984
|
-
builder: (
|
|
5043
|
+
builder: (yargs38) => withConfiguration(
|
|
4985
5044
|
withApiOptions(
|
|
4986
5045
|
withProjectOptions(
|
|
4987
5046
|
withStateOptions(
|
|
4988
5047
|
withDiffOptions(
|
|
4989
|
-
|
|
5048
|
+
yargs38.positional("directory", {
|
|
4990
5049
|
describe: "Directory to read the patterns from. If a filename is used, a package will be read instead.",
|
|
4991
5050
|
type: "string"
|
|
4992
5051
|
}).option("what-if", {
|
|
@@ -5028,10 +5087,10 @@ var PatternRemoveModule = {
|
|
|
5028
5087
|
var PatternUnpublishModule = {
|
|
5029
5088
|
command: "unpublish [ids]",
|
|
5030
5089
|
describe: "Unpublish a pattern(s)",
|
|
5031
|
-
builder: (
|
|
5090
|
+
builder: (yargs38) => withConfiguration(
|
|
5032
5091
|
withApiOptions(
|
|
5033
5092
|
withProjectOptions(
|
|
5034
|
-
|
|
5093
|
+
yargs38.positional("ids", {
|
|
5035
5094
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
5036
5095
|
type: "string"
|
|
5037
5096
|
}).option("all", {
|
|
@@ -5066,31 +5125,597 @@ var PatternUpdateModule = {
|
|
|
5066
5125
|
describe: "Insert or update a pattern"
|
|
5067
5126
|
};
|
|
5068
5127
|
|
|
5069
|
-
// src/commands/canvas/commands/pattern.ts
|
|
5070
|
-
var PatternModule = {
|
|
5071
|
-
command: "pattern <command>",
|
|
5072
|
-
describe: "Commands for Canvas patterns",
|
|
5073
|
-
deprecated: 'will be removed in a future major release. Use "component-pattern" and "composition-pattern" instead.',
|
|
5074
|
-
builder: (
|
|
5128
|
+
// src/commands/canvas/commands/pattern.ts
|
|
5129
|
+
var PatternModule = {
|
|
5130
|
+
command: "pattern <command>",
|
|
5131
|
+
describe: "Commands for Canvas patterns",
|
|
5132
|
+
deprecated: 'will be removed in a future major release. Use "component-pattern" and "composition-pattern" instead.',
|
|
5133
|
+
builder: (yargs38) => yargs38.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
5134
|
+
handler: () => {
|
|
5135
|
+
yargs13.help();
|
|
5136
|
+
}
|
|
5137
|
+
};
|
|
5138
|
+
|
|
5139
|
+
// src/commands/canvas/commands/previewUrl.ts
|
|
5140
|
+
import yargs14 from "yargs";
|
|
5141
|
+
|
|
5142
|
+
// src/commands/canvas/commands/previewUrl/get.ts
|
|
5143
|
+
import { PreviewClient } from "@uniformdev/canvas";
|
|
5144
|
+
var PreviewUrlGetModule = {
|
|
5145
|
+
command: "get <id>",
|
|
5146
|
+
describe: "Fetch a preview URL",
|
|
5147
|
+
builder: (yargs38) => withConfiguration(
|
|
5148
|
+
withFormatOptions(
|
|
5149
|
+
withApiOptions(
|
|
5150
|
+
withProjectOptions(
|
|
5151
|
+
yargs38.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
|
|
5152
|
+
)
|
|
5153
|
+
)
|
|
5154
|
+
)
|
|
5155
|
+
),
|
|
5156
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
5157
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5158
|
+
const client = new PreviewClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5159
|
+
const previewUrl = await client.getPreviewUrl({ id });
|
|
5160
|
+
if (!previewUrl) {
|
|
5161
|
+
console.error("Preview URL did not exist");
|
|
5162
|
+
process.exit(1);
|
|
5163
|
+
} else {
|
|
5164
|
+
emitWithFormat(previewUrl, format, filename);
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5167
|
+
};
|
|
5168
|
+
|
|
5169
|
+
// src/commands/canvas/commands/previewUrl/list.ts
|
|
5170
|
+
import { PreviewClient as PreviewClient2 } from "@uniformdev/canvas";
|
|
5171
|
+
var PreviewUrlListModule = {
|
|
5172
|
+
command: "list",
|
|
5173
|
+
describe: "List preview URLs",
|
|
5174
|
+
aliases: ["ls"],
|
|
5175
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38.options({}))))),
|
|
5176
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5177
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5178
|
+
const client = new PreviewClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5179
|
+
const res = await client.getPreviewUrls();
|
|
5180
|
+
emitWithFormat(res.previewUrls, format, filename);
|
|
5181
|
+
}
|
|
5182
|
+
};
|
|
5183
|
+
|
|
5184
|
+
// src/commands/canvas/commands/previewUrl/pull.ts
|
|
5185
|
+
import { PreviewClient as PreviewClient3 } from "@uniformdev/canvas";
|
|
5186
|
+
|
|
5187
|
+
// src/commands/canvas/commands/previewUrl/_util.ts
|
|
5188
|
+
var selectIdentifier5 = (previewUrl) => previewUrl.id;
|
|
5189
|
+
var selectDisplayName5 = (previewUrl) => `${previewUrl.name} (pid: ${previewUrl.id})`;
|
|
5190
|
+
|
|
5191
|
+
// src/commands/canvas/previewUrlEngineDataSource.ts
|
|
5192
|
+
function createPreviewUrlEngineDataSource({
|
|
5193
|
+
client
|
|
5194
|
+
}) {
|
|
5195
|
+
async function* getObjects() {
|
|
5196
|
+
const previewUrls = (await client.getPreviewUrls()).previewUrls;
|
|
5197
|
+
for await (const previewUrl of previewUrls) {
|
|
5198
|
+
const result = {
|
|
5199
|
+
id: selectIdentifier5(previewUrl),
|
|
5200
|
+
displayName: selectDisplayName5(previewUrl),
|
|
5201
|
+
providerId: previewUrl.id,
|
|
5202
|
+
object: previewUrl
|
|
5203
|
+
};
|
|
5204
|
+
yield result;
|
|
5205
|
+
}
|
|
5206
|
+
}
|
|
5207
|
+
return {
|
|
5208
|
+
name: "Uniform API",
|
|
5209
|
+
objects: getObjects(),
|
|
5210
|
+
deleteObject: async (providerId) => {
|
|
5211
|
+
await client.deletePreviewUrl({ id: providerId });
|
|
5212
|
+
},
|
|
5213
|
+
writeObject: async (object) => {
|
|
5214
|
+
await client.upsertPreviewUrl(object.object);
|
|
5215
|
+
}
|
|
5216
|
+
};
|
|
5217
|
+
}
|
|
5218
|
+
|
|
5219
|
+
// src/commands/canvas/commands/previewUrl/pull.ts
|
|
5220
|
+
var PreviewUrlPullModule = {
|
|
5221
|
+
command: "pull <directory>",
|
|
5222
|
+
describe: "Pulls all preview urls to local files in a directory",
|
|
5223
|
+
builder: (yargs38) => withConfiguration(
|
|
5224
|
+
withApiOptions(
|
|
5225
|
+
withProjectOptions(
|
|
5226
|
+
withDiffOptions(
|
|
5227
|
+
yargs38.positional("directory", {
|
|
5228
|
+
describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5229
|
+
type: "string"
|
|
5230
|
+
}).option("format", {
|
|
5231
|
+
alias: ["f"],
|
|
5232
|
+
describe: "Output format",
|
|
5233
|
+
default: "yaml",
|
|
5234
|
+
choices: ["yaml", "json"],
|
|
5235
|
+
type: "string"
|
|
5236
|
+
}).option("what-if", {
|
|
5237
|
+
alias: ["w"],
|
|
5238
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5239
|
+
default: false,
|
|
5240
|
+
type: "boolean"
|
|
5241
|
+
}).option("mode", {
|
|
5242
|
+
alias: ["m"],
|
|
5243
|
+
describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
|
|
5244
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5245
|
+
default: "mirror",
|
|
5246
|
+
type: "string"
|
|
5247
|
+
})
|
|
5248
|
+
)
|
|
5249
|
+
)
|
|
5250
|
+
)
|
|
5251
|
+
),
|
|
5252
|
+
handler: async ({
|
|
5253
|
+
apiHost,
|
|
5254
|
+
apiKey,
|
|
5255
|
+
proxy,
|
|
5256
|
+
directory,
|
|
5257
|
+
format,
|
|
5258
|
+
mode,
|
|
5259
|
+
whatIf,
|
|
5260
|
+
project: projectId,
|
|
5261
|
+
diff: diffMode,
|
|
5262
|
+
allowEmptySource
|
|
5263
|
+
}) => {
|
|
5264
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5265
|
+
const client = new PreviewClient3({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5266
|
+
const source = createPreviewUrlEngineDataSource({ client });
|
|
5267
|
+
let target;
|
|
5268
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5269
|
+
if (isPackage) {
|
|
5270
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
5271
|
+
target = await createArraySyncEngineDataSource({
|
|
5272
|
+
name: `Package file ${directory}`,
|
|
5273
|
+
objects: packageContents.previewUrls ?? [],
|
|
5274
|
+
selectIdentifier: selectIdentifier5,
|
|
5275
|
+
selectDisplayName: selectDisplayName5,
|
|
5276
|
+
onSyncComplete: async (_, synced) => {
|
|
5277
|
+
packageContents.previewUrls = synced;
|
|
5278
|
+
writeCanvasPackage(directory, packageContents);
|
|
5279
|
+
}
|
|
5280
|
+
});
|
|
5281
|
+
} else {
|
|
5282
|
+
target = await createFileSyncEngineDataSource({
|
|
5283
|
+
directory,
|
|
5284
|
+
selectIdentifier: selectIdentifier5,
|
|
5285
|
+
selectDisplayName: selectDisplayName5,
|
|
5286
|
+
format
|
|
5287
|
+
});
|
|
5288
|
+
}
|
|
5289
|
+
await syncEngine({
|
|
5290
|
+
source,
|
|
5291
|
+
target,
|
|
5292
|
+
mode,
|
|
5293
|
+
whatIf,
|
|
5294
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
5295
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
5298
|
+
};
|
|
5299
|
+
|
|
5300
|
+
// src/commands/canvas/commands/previewUrl/push.ts
|
|
5301
|
+
import { PreviewClient as PreviewClient4 } from "@uniformdev/canvas";
|
|
5302
|
+
var PreviewUrlPushModule = {
|
|
5303
|
+
command: "push <directory>",
|
|
5304
|
+
describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
|
|
5305
|
+
builder: (yargs38) => withConfiguration(
|
|
5306
|
+
withApiOptions(
|
|
5307
|
+
withProjectOptions(
|
|
5308
|
+
withDiffOptions(
|
|
5309
|
+
yargs38.positional("directory", {
|
|
5310
|
+
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
5311
|
+
type: "string"
|
|
5312
|
+
}).option("what-if", {
|
|
5313
|
+
alias: ["w"],
|
|
5314
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5315
|
+
default: false,
|
|
5316
|
+
type: "boolean"
|
|
5317
|
+
}).option("mode", {
|
|
5318
|
+
alias: ["m"],
|
|
5319
|
+
describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
|
|
5320
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5321
|
+
default: "mirror",
|
|
5322
|
+
type: "string"
|
|
5323
|
+
})
|
|
5324
|
+
)
|
|
5325
|
+
)
|
|
5326
|
+
)
|
|
5327
|
+
),
|
|
5328
|
+
handler: async ({
|
|
5329
|
+
apiHost,
|
|
5330
|
+
apiKey,
|
|
5331
|
+
proxy,
|
|
5332
|
+
directory,
|
|
5333
|
+
mode,
|
|
5334
|
+
whatIf,
|
|
5335
|
+
project: projectId,
|
|
5336
|
+
diff: diffMode,
|
|
5337
|
+
allowEmptySource
|
|
5338
|
+
}) => {
|
|
5339
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5340
|
+
const client = new PreviewClient4({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5341
|
+
let source;
|
|
5342
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5343
|
+
if (isPackage) {
|
|
5344
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
5345
|
+
source = await createArraySyncEngineDataSource({
|
|
5346
|
+
name: `Package file ${directory}`,
|
|
5347
|
+
objects: packageContents.previewUrls ?? [],
|
|
5348
|
+
selectIdentifier: selectIdentifier5,
|
|
5349
|
+
selectDisplayName: selectDisplayName5
|
|
5350
|
+
});
|
|
5351
|
+
} else {
|
|
5352
|
+
source = await createFileSyncEngineDataSource({
|
|
5353
|
+
directory,
|
|
5354
|
+
selectIdentifier: selectIdentifier5,
|
|
5355
|
+
selectDisplayName: selectDisplayName5
|
|
5356
|
+
});
|
|
5357
|
+
}
|
|
5358
|
+
const target = createPreviewUrlEngineDataSource({ client });
|
|
5359
|
+
await syncEngine({
|
|
5360
|
+
source,
|
|
5361
|
+
target,
|
|
5362
|
+
mode,
|
|
5363
|
+
whatIf,
|
|
5364
|
+
allowEmptySource,
|
|
5365
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5366
|
+
});
|
|
5367
|
+
}
|
|
5368
|
+
};
|
|
5369
|
+
|
|
5370
|
+
// src/commands/canvas/commands/previewUrl/remove.ts
|
|
5371
|
+
import { PreviewClient as PreviewClient5 } from "@uniformdev/canvas";
|
|
5372
|
+
var PreviewUrlRemoveModule = {
|
|
5373
|
+
command: "remove <id>",
|
|
5374
|
+
aliases: ["delete", "rm"],
|
|
5375
|
+
describe: "Delete a preview URL",
|
|
5376
|
+
builder: (yargs38) => withConfiguration(
|
|
5377
|
+
withApiOptions(
|
|
5378
|
+
withProjectOptions(
|
|
5379
|
+
yargs38.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
|
|
5380
|
+
)
|
|
5381
|
+
)
|
|
5382
|
+
),
|
|
5383
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
5384
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5385
|
+
const client = new PreviewClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5386
|
+
await client.deletePreviewUrl({ id });
|
|
5387
|
+
}
|
|
5388
|
+
};
|
|
5389
|
+
|
|
5390
|
+
// src/commands/canvas/commands/previewUrl/update.ts
|
|
5391
|
+
import { PreviewClient as PreviewClient6 } from "@uniformdev/canvas";
|
|
5392
|
+
var PreviewUrlUpdateModule = {
|
|
5393
|
+
command: "update <filename>",
|
|
5394
|
+
aliases: ["put"],
|
|
5395
|
+
describe: "Insert or update a preview URL",
|
|
5396
|
+
builder: (yargs38) => withConfiguration(
|
|
5397
|
+
withApiOptions(
|
|
5398
|
+
withProjectOptions(
|
|
5399
|
+
yargs38.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
5400
|
+
)
|
|
5401
|
+
)
|
|
5402
|
+
),
|
|
5403
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
5404
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5405
|
+
const client = new PreviewClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5406
|
+
const file = readFileToObject(filename);
|
|
5407
|
+
await client.upsertPreviewUrl(file);
|
|
5408
|
+
}
|
|
5409
|
+
};
|
|
5410
|
+
|
|
5411
|
+
// src/commands/canvas/commands/previewUrl.ts
|
|
5412
|
+
var PreviewUrlModule = {
|
|
5413
|
+
command: "preview-url <command>",
|
|
5414
|
+
aliases: ["pu"],
|
|
5415
|
+
describe: "Commands for Canvas preview urls",
|
|
5416
|
+
builder: (yargs38) => yargs38.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
|
|
5417
|
+
handler: () => {
|
|
5418
|
+
yargs14.help();
|
|
5419
|
+
}
|
|
5420
|
+
};
|
|
5421
|
+
|
|
5422
|
+
// src/commands/canvas/commands/previewViewport.ts
|
|
5423
|
+
import yargs15 from "yargs";
|
|
5424
|
+
|
|
5425
|
+
// src/commands/canvas/commands/previewViewport/get.ts
|
|
5426
|
+
import { PreviewClient as PreviewClient7 } from "@uniformdev/canvas";
|
|
5427
|
+
var PreviewViewportGetModule = {
|
|
5428
|
+
command: "get <id>",
|
|
5429
|
+
describe: "Fetch a preview viewport",
|
|
5430
|
+
builder: (yargs38) => withConfiguration(
|
|
5431
|
+
withFormatOptions(
|
|
5432
|
+
withApiOptions(
|
|
5433
|
+
withProjectOptions(
|
|
5434
|
+
yargs38.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
|
|
5435
|
+
)
|
|
5436
|
+
)
|
|
5437
|
+
)
|
|
5438
|
+
),
|
|
5439
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
5440
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5441
|
+
const client = new PreviewClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5442
|
+
const previewViewport = await client.getPreviewViewport({ id });
|
|
5443
|
+
if (!previewViewport) {
|
|
5444
|
+
console.error("Preview viewport did not exist");
|
|
5445
|
+
process.exit(1);
|
|
5446
|
+
} else {
|
|
5447
|
+
emitWithFormat(previewViewport, format, filename);
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
};
|
|
5451
|
+
|
|
5452
|
+
// src/commands/canvas/commands/previewViewport/list.ts
|
|
5453
|
+
import { PreviewClient as PreviewClient8 } from "@uniformdev/canvas";
|
|
5454
|
+
var PreviewViewportListModule = {
|
|
5455
|
+
command: "list",
|
|
5456
|
+
describe: "List preview viewports",
|
|
5457
|
+
aliases: ["ls"],
|
|
5458
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38.options({}))))),
|
|
5459
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5460
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5461
|
+
const client = new PreviewClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5462
|
+
const res = await client.getPreviewViewports();
|
|
5463
|
+
emitWithFormat(res.previewViewports, format, filename);
|
|
5464
|
+
}
|
|
5465
|
+
};
|
|
5466
|
+
|
|
5467
|
+
// src/commands/canvas/commands/previewViewport/pull.ts
|
|
5468
|
+
import { PreviewClient as PreviewClient9 } from "@uniformdev/canvas";
|
|
5469
|
+
|
|
5470
|
+
// src/commands/canvas/commands/previewViewport/_util.ts
|
|
5471
|
+
var selectIdentifier6 = (previewViewport) => previewViewport.id;
|
|
5472
|
+
var selectDisplayName6 = (previewViewport) => `${previewViewport.name} (pid: ${previewViewport.id})`;
|
|
5473
|
+
|
|
5474
|
+
// src/commands/canvas/previewViewportEngineDataSource.ts
|
|
5475
|
+
function createPreviewViewportEngineDataSource({
|
|
5476
|
+
client
|
|
5477
|
+
}) {
|
|
5478
|
+
async function* getObjects() {
|
|
5479
|
+
const previewViewports = (await client.getPreviewViewports()).previewViewports;
|
|
5480
|
+
for await (const previewViewport of previewViewports) {
|
|
5481
|
+
const result = {
|
|
5482
|
+
id: selectIdentifier6(previewViewport),
|
|
5483
|
+
displayName: selectDisplayName6(previewViewport),
|
|
5484
|
+
providerId: previewViewport.id,
|
|
5485
|
+
object: previewViewport
|
|
5486
|
+
};
|
|
5487
|
+
yield result;
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
return {
|
|
5491
|
+
name: "Uniform API",
|
|
5492
|
+
objects: getObjects(),
|
|
5493
|
+
deleteObject: async (providerId) => {
|
|
5494
|
+
await client.deletePreviewViewport({ id: providerId });
|
|
5495
|
+
},
|
|
5496
|
+
writeObject: async (object) => {
|
|
5497
|
+
await client.upsertPreviewViewport(object.object);
|
|
5498
|
+
}
|
|
5499
|
+
};
|
|
5500
|
+
}
|
|
5501
|
+
|
|
5502
|
+
// src/commands/canvas/commands/previewViewport/pull.ts
|
|
5503
|
+
var PreviewViewportPullModule = {
|
|
5504
|
+
command: "pull <directory>",
|
|
5505
|
+
describe: "Pulls all preview viewports to local files in a directory",
|
|
5506
|
+
builder: (yargs38) => withConfiguration(
|
|
5507
|
+
withApiOptions(
|
|
5508
|
+
withProjectOptions(
|
|
5509
|
+
withDiffOptions(
|
|
5510
|
+
yargs38.positional("directory", {
|
|
5511
|
+
describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5512
|
+
type: "string"
|
|
5513
|
+
}).option("format", {
|
|
5514
|
+
alias: ["f"],
|
|
5515
|
+
describe: "Output format",
|
|
5516
|
+
default: "yaml",
|
|
5517
|
+
choices: ["yaml", "json"],
|
|
5518
|
+
type: "string"
|
|
5519
|
+
}).option("what-if", {
|
|
5520
|
+
alias: ["w"],
|
|
5521
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5522
|
+
default: false,
|
|
5523
|
+
type: "boolean"
|
|
5524
|
+
}).option("mode", {
|
|
5525
|
+
alias: ["m"],
|
|
5526
|
+
describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
|
|
5527
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5528
|
+
default: "mirror",
|
|
5529
|
+
type: "string"
|
|
5530
|
+
})
|
|
5531
|
+
)
|
|
5532
|
+
)
|
|
5533
|
+
)
|
|
5534
|
+
),
|
|
5535
|
+
handler: async ({
|
|
5536
|
+
apiHost,
|
|
5537
|
+
apiKey,
|
|
5538
|
+
proxy,
|
|
5539
|
+
directory,
|
|
5540
|
+
format,
|
|
5541
|
+
mode,
|
|
5542
|
+
whatIf,
|
|
5543
|
+
project: projectId,
|
|
5544
|
+
diff: diffMode,
|
|
5545
|
+
allowEmptySource
|
|
5546
|
+
}) => {
|
|
5547
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5548
|
+
const client = new PreviewClient9({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5549
|
+
const source = createPreviewViewportEngineDataSource({ client });
|
|
5550
|
+
let target;
|
|
5551
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5552
|
+
if (isPackage) {
|
|
5553
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
5554
|
+
target = await createArraySyncEngineDataSource({
|
|
5555
|
+
name: `Package file ${directory}`,
|
|
5556
|
+
objects: packageContents.previewViewports ?? [],
|
|
5557
|
+
selectIdentifier: selectIdentifier6,
|
|
5558
|
+
selectDisplayName: selectDisplayName6,
|
|
5559
|
+
onSyncComplete: async (_, synced) => {
|
|
5560
|
+
packageContents.previewViewports = synced;
|
|
5561
|
+
writeCanvasPackage(directory, packageContents);
|
|
5562
|
+
}
|
|
5563
|
+
});
|
|
5564
|
+
} else {
|
|
5565
|
+
target = await createFileSyncEngineDataSource({
|
|
5566
|
+
directory,
|
|
5567
|
+
selectIdentifier: selectIdentifier6,
|
|
5568
|
+
selectDisplayName: selectDisplayName6,
|
|
5569
|
+
format
|
|
5570
|
+
});
|
|
5571
|
+
}
|
|
5572
|
+
await syncEngine({
|
|
5573
|
+
source,
|
|
5574
|
+
target,
|
|
5575
|
+
mode,
|
|
5576
|
+
whatIf,
|
|
5577
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
5578
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5579
|
+
});
|
|
5580
|
+
}
|
|
5581
|
+
};
|
|
5582
|
+
|
|
5583
|
+
// src/commands/canvas/commands/previewViewport/push.ts
|
|
5584
|
+
import { PreviewClient as PreviewClient10 } from "@uniformdev/canvas";
|
|
5585
|
+
var PreviewViewportPushModule = {
|
|
5586
|
+
command: "push <directory>",
|
|
5587
|
+
describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
|
|
5588
|
+
builder: (yargs38) => withConfiguration(
|
|
5589
|
+
withApiOptions(
|
|
5590
|
+
withProjectOptions(
|
|
5591
|
+
withDiffOptions(
|
|
5592
|
+
yargs38.positional("directory", {
|
|
5593
|
+
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
5594
|
+
type: "string"
|
|
5595
|
+
}).option("what-if", {
|
|
5596
|
+
alias: ["w"],
|
|
5597
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5598
|
+
default: false,
|
|
5599
|
+
type: "boolean"
|
|
5600
|
+
}).option("mode", {
|
|
5601
|
+
alias: ["m"],
|
|
5602
|
+
describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
|
|
5603
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5604
|
+
default: "mirror",
|
|
5605
|
+
type: "string"
|
|
5606
|
+
})
|
|
5607
|
+
)
|
|
5608
|
+
)
|
|
5609
|
+
)
|
|
5610
|
+
),
|
|
5611
|
+
handler: async ({
|
|
5612
|
+
apiHost,
|
|
5613
|
+
apiKey,
|
|
5614
|
+
proxy,
|
|
5615
|
+
directory,
|
|
5616
|
+
mode,
|
|
5617
|
+
whatIf,
|
|
5618
|
+
project: projectId,
|
|
5619
|
+
diff: diffMode,
|
|
5620
|
+
allowEmptySource
|
|
5621
|
+
}) => {
|
|
5622
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5623
|
+
const client = new PreviewClient10({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5624
|
+
let source;
|
|
5625
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5626
|
+
if (isPackage) {
|
|
5627
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
5628
|
+
source = await createArraySyncEngineDataSource({
|
|
5629
|
+
name: `Package file ${directory}`,
|
|
5630
|
+
objects: packageContents.previewViewports ?? [],
|
|
5631
|
+
selectIdentifier: selectIdentifier6,
|
|
5632
|
+
selectDisplayName: selectDisplayName6
|
|
5633
|
+
});
|
|
5634
|
+
} else {
|
|
5635
|
+
source = await createFileSyncEngineDataSource({
|
|
5636
|
+
directory,
|
|
5637
|
+
selectIdentifier: selectIdentifier6,
|
|
5638
|
+
selectDisplayName: selectDisplayName6
|
|
5639
|
+
});
|
|
5640
|
+
}
|
|
5641
|
+
const target = createPreviewViewportEngineDataSource({ client });
|
|
5642
|
+
await syncEngine({
|
|
5643
|
+
source,
|
|
5644
|
+
target,
|
|
5645
|
+
mode,
|
|
5646
|
+
whatIf,
|
|
5647
|
+
allowEmptySource,
|
|
5648
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5649
|
+
});
|
|
5650
|
+
}
|
|
5651
|
+
};
|
|
5652
|
+
|
|
5653
|
+
// src/commands/canvas/commands/previewViewport/remove.ts
|
|
5654
|
+
import { PreviewClient as PreviewClient11 } from "@uniformdev/canvas";
|
|
5655
|
+
var PreviewViewportRemoveModule = {
|
|
5656
|
+
command: "remove <id>",
|
|
5657
|
+
aliases: ["delete", "rm"],
|
|
5658
|
+
describe: "Delete a preview viewport",
|
|
5659
|
+
builder: (yargs38) => withConfiguration(
|
|
5660
|
+
withApiOptions(
|
|
5661
|
+
withProjectOptions(
|
|
5662
|
+
yargs38.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
|
|
5663
|
+
)
|
|
5664
|
+
)
|
|
5665
|
+
),
|
|
5666
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
5667
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5668
|
+
const client = new PreviewClient11({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5669
|
+
await client.deletePreviewViewport({ id });
|
|
5670
|
+
}
|
|
5671
|
+
};
|
|
5672
|
+
|
|
5673
|
+
// src/commands/canvas/commands/previewViewport/update.ts
|
|
5674
|
+
import { PreviewClient as PreviewClient12 } from "@uniformdev/canvas";
|
|
5675
|
+
var PreviewViewportUpdateModule = {
|
|
5676
|
+
command: "update <filename>",
|
|
5677
|
+
aliases: ["put"],
|
|
5678
|
+
describe: "Insert or update a preview viewport",
|
|
5679
|
+
builder: (yargs38) => withConfiguration(
|
|
5680
|
+
withApiOptions(
|
|
5681
|
+
withProjectOptions(
|
|
5682
|
+
yargs38.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
|
|
5683
|
+
)
|
|
5684
|
+
)
|
|
5685
|
+
),
|
|
5686
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
5687
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5688
|
+
const client = new PreviewClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5689
|
+
const file = readFileToObject(filename);
|
|
5690
|
+
await client.upsertPreviewViewport(file);
|
|
5691
|
+
}
|
|
5692
|
+
};
|
|
5693
|
+
|
|
5694
|
+
// src/commands/canvas/commands/previewViewport.ts
|
|
5695
|
+
var PreviewViewportModule = {
|
|
5696
|
+
command: "preview-viewport <command>",
|
|
5697
|
+
aliases: ["pv"],
|
|
5698
|
+
describe: "Commands for Canvas preview viewports",
|
|
5699
|
+
builder: (yargs38) => yargs38.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
|
|
5075
5700
|
handler: () => {
|
|
5076
|
-
|
|
5701
|
+
yargs15.help();
|
|
5077
5702
|
}
|
|
5078
5703
|
};
|
|
5079
5704
|
|
|
5080
5705
|
// src/commands/canvas/commands/prompts.ts
|
|
5081
|
-
import
|
|
5706
|
+
import yargs16 from "yargs";
|
|
5082
5707
|
|
|
5083
5708
|
// src/commands/canvas/commands/prompts/get.ts
|
|
5084
5709
|
import { PromptClient } from "@uniformdev/canvas";
|
|
5085
5710
|
var PromptGetModule = {
|
|
5086
5711
|
command: "get <id>",
|
|
5087
5712
|
describe: "Get a prompt",
|
|
5088
|
-
builder: (
|
|
5713
|
+
builder: (yargs38) => withConfiguration(
|
|
5089
5714
|
withFormatOptions(
|
|
5090
5715
|
withApiOptions(
|
|
5091
5716
|
withProjectOptions(
|
|
5092
5717
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5093
|
-
|
|
5718
|
+
yargs38.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
5094
5719
|
)
|
|
5095
5720
|
)
|
|
5096
5721
|
)
|
|
@@ -5111,7 +5736,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
5111
5736
|
var PromptListModule = {
|
|
5112
5737
|
command: "list",
|
|
5113
5738
|
describe: "List prompts",
|
|
5114
|
-
builder: (
|
|
5739
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
5115
5740
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5116
5741
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5117
5742
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -5159,12 +5784,12 @@ function createPromptEngineDataSource({
|
|
|
5159
5784
|
var PromptPullModule = {
|
|
5160
5785
|
command: "pull <directory>",
|
|
5161
5786
|
describe: "Pulls all prompts to local files in a directory",
|
|
5162
|
-
builder: (
|
|
5787
|
+
builder: (yargs38) => withConfiguration(
|
|
5163
5788
|
withApiOptions(
|
|
5164
5789
|
withProjectOptions(
|
|
5165
5790
|
withStateOptions(
|
|
5166
5791
|
withDiffOptions(
|
|
5167
|
-
|
|
5792
|
+
yargs38.positional("directory", {
|
|
5168
5793
|
describe: "Directory to save the prompts to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5169
5794
|
type: "string"
|
|
5170
5795
|
}).option("format", {
|
|
@@ -5249,12 +5874,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
5249
5874
|
var PromptPushModule = {
|
|
5250
5875
|
command: "push <directory>",
|
|
5251
5876
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
5252
|
-
builder: (
|
|
5877
|
+
builder: (yargs38) => withConfiguration(
|
|
5253
5878
|
withApiOptions(
|
|
5254
5879
|
withProjectOptions(
|
|
5255
5880
|
withStateOptions(
|
|
5256
5881
|
withDiffOptions(
|
|
5257
|
-
|
|
5882
|
+
yargs38.positional("directory", {
|
|
5258
5883
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
5259
5884
|
type: "string"
|
|
5260
5885
|
}).option("what-if", {
|
|
@@ -5328,9 +5953,9 @@ var PromptRemoveModule = {
|
|
|
5328
5953
|
command: "remove <id>",
|
|
5329
5954
|
aliases: ["delete", "rm"],
|
|
5330
5955
|
describe: "Delete a prompt",
|
|
5331
|
-
builder: (
|
|
5956
|
+
builder: (yargs38) => withConfiguration(
|
|
5332
5957
|
withApiOptions(
|
|
5333
|
-
withProjectOptions(
|
|
5958
|
+
withProjectOptions(yargs38.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
5334
5959
|
)
|
|
5335
5960
|
),
|
|
5336
5961
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -5346,10 +5971,10 @@ var PromptUpdateModule = {
|
|
|
5346
5971
|
command: "update <filename>",
|
|
5347
5972
|
aliases: ["put"],
|
|
5348
5973
|
describe: "Insert or update a prompt",
|
|
5349
|
-
builder: (
|
|
5974
|
+
builder: (yargs38) => withConfiguration(
|
|
5350
5975
|
withApiOptions(
|
|
5351
5976
|
withProjectOptions(
|
|
5352
|
-
|
|
5977
|
+
yargs38.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
5353
5978
|
)
|
|
5354
5979
|
)
|
|
5355
5980
|
),
|
|
@@ -5366,21 +5991,21 @@ var PromptModule = {
|
|
|
5366
5991
|
command: "prompt <command>",
|
|
5367
5992
|
aliases: ["dt"],
|
|
5368
5993
|
describe: "Commands for AI Prompt definitions",
|
|
5369
|
-
builder: (
|
|
5994
|
+
builder: (yargs38) => yargs38.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
5370
5995
|
handler: () => {
|
|
5371
|
-
|
|
5996
|
+
yargs16.help();
|
|
5372
5997
|
}
|
|
5373
5998
|
};
|
|
5374
5999
|
|
|
5375
6000
|
// src/commands/canvas/commands/workflow.ts
|
|
5376
|
-
import
|
|
6001
|
+
import yargs17 from "yargs";
|
|
5377
6002
|
|
|
5378
6003
|
// src/commands/canvas/commands/workflow/pull.ts
|
|
5379
6004
|
import { WorkflowClient } from "@uniformdev/canvas";
|
|
5380
6005
|
|
|
5381
6006
|
// src/commands/canvas/commands/workflow/_util.ts
|
|
5382
|
-
var
|
|
5383
|
-
var
|
|
6007
|
+
var selectIdentifier7 = (workflow) => workflow.id;
|
|
6008
|
+
var selectDisplayName7 = (workflow) => `${workflow.name} (pid: ${workflow.id})`;
|
|
5384
6009
|
|
|
5385
6010
|
// src/commands/canvas/workflowEngineDataSource.ts
|
|
5386
6011
|
function createWorkflowEngineDataSource({
|
|
@@ -5393,8 +6018,8 @@ function createWorkflowEngineDataSource({
|
|
|
5393
6018
|
for await (const workflow of workflows) {
|
|
5394
6019
|
const { modified, modifiedBy, created, createdBy, ...workflowWithoutStatistics } = workflow;
|
|
5395
6020
|
const result = {
|
|
5396
|
-
id:
|
|
5397
|
-
displayName:
|
|
6021
|
+
id: selectIdentifier7(workflow),
|
|
6022
|
+
displayName: selectDisplayName7(workflow),
|
|
5398
6023
|
providerId: workflow.id,
|
|
5399
6024
|
object: workflowWithoutStatistics
|
|
5400
6025
|
};
|
|
@@ -5417,11 +6042,11 @@ function createWorkflowEngineDataSource({
|
|
|
5417
6042
|
var WorkflowPullModule = {
|
|
5418
6043
|
command: "pull <directory>",
|
|
5419
6044
|
describe: "Pulls all workflows to local files in a directory",
|
|
5420
|
-
builder: (
|
|
6045
|
+
builder: (yargs38) => withConfiguration(
|
|
5421
6046
|
withApiOptions(
|
|
5422
6047
|
withProjectOptions(
|
|
5423
6048
|
withDiffOptions(
|
|
5424
|
-
|
|
6049
|
+
yargs38.positional("directory", {
|
|
5425
6050
|
describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5426
6051
|
type: "string"
|
|
5427
6052
|
}).option("format", {
|
|
@@ -5468,8 +6093,8 @@ var WorkflowPullModule = {
|
|
|
5468
6093
|
target = await createArraySyncEngineDataSource({
|
|
5469
6094
|
name: `Package file ${directory}`,
|
|
5470
6095
|
objects: packageContents.workflows ?? [],
|
|
5471
|
-
selectIdentifier:
|
|
5472
|
-
selectDisplayName:
|
|
6096
|
+
selectIdentifier: selectIdentifier7,
|
|
6097
|
+
selectDisplayName: selectDisplayName7,
|
|
5473
6098
|
onSyncComplete: async (_, synced) => {
|
|
5474
6099
|
packageContents.workflows = synced;
|
|
5475
6100
|
writeCanvasPackage(directory, packageContents);
|
|
@@ -5478,8 +6103,8 @@ var WorkflowPullModule = {
|
|
|
5478
6103
|
} else {
|
|
5479
6104
|
target = await createFileSyncEngineDataSource({
|
|
5480
6105
|
directory,
|
|
5481
|
-
selectIdentifier:
|
|
5482
|
-
selectDisplayName:
|
|
6106
|
+
selectIdentifier: selectIdentifier7,
|
|
6107
|
+
selectDisplayName: selectDisplayName7,
|
|
5483
6108
|
format
|
|
5484
6109
|
});
|
|
5485
6110
|
}
|
|
@@ -5499,11 +6124,11 @@ import { WorkflowClient as WorkflowClient2 } from "@uniformdev/canvas";
|
|
|
5499
6124
|
var WorkflowPushModule = {
|
|
5500
6125
|
command: "push <directory>",
|
|
5501
6126
|
describe: "Pushes all workflows from files in a directory to Uniform Canvas",
|
|
5502
|
-
builder: (
|
|
6127
|
+
builder: (yargs38) => withConfiguration(
|
|
5503
6128
|
withApiOptions(
|
|
5504
6129
|
withProjectOptions(
|
|
5505
6130
|
withDiffOptions(
|
|
5506
|
-
|
|
6131
|
+
yargs38.positional("directory", {
|
|
5507
6132
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
5508
6133
|
type: "string"
|
|
5509
6134
|
}).option("what-if", {
|
|
@@ -5542,14 +6167,14 @@ var WorkflowPushModule = {
|
|
|
5542
6167
|
source = await createArraySyncEngineDataSource({
|
|
5543
6168
|
name: `Package file ${directory}`,
|
|
5544
6169
|
objects: packageContents.workflows ?? [],
|
|
5545
|
-
selectIdentifier:
|
|
5546
|
-
selectDisplayName:
|
|
6170
|
+
selectIdentifier: selectIdentifier7,
|
|
6171
|
+
selectDisplayName: selectDisplayName7
|
|
5547
6172
|
});
|
|
5548
6173
|
} else {
|
|
5549
6174
|
source = await createFileSyncEngineDataSource({
|
|
5550
6175
|
directory,
|
|
5551
|
-
selectIdentifier:
|
|
5552
|
-
selectDisplayName:
|
|
6176
|
+
selectIdentifier: selectIdentifier7,
|
|
6177
|
+
selectDisplayName: selectDisplayName7
|
|
5553
6178
|
});
|
|
5554
6179
|
}
|
|
5555
6180
|
const target = createWorkflowEngineDataSource({ client });
|
|
@@ -5569,9 +6194,9 @@ var WorkflowModule = {
|
|
|
5569
6194
|
command: "workflow <command>",
|
|
5570
6195
|
aliases: ["wf"],
|
|
5571
6196
|
describe: "Commands for Canvas workflows",
|
|
5572
|
-
builder: (
|
|
6197
|
+
builder: (yargs38) => yargs38.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
|
|
5573
6198
|
handler: () => {
|
|
5574
|
-
|
|
6199
|
+
yargs17.help();
|
|
5575
6200
|
}
|
|
5576
6201
|
};
|
|
5577
6202
|
|
|
@@ -5580,28 +6205,28 @@ var CanvasCommand = {
|
|
|
5580
6205
|
command: "canvas <command>",
|
|
5581
6206
|
aliases: ["cv", "pm", "presentation"],
|
|
5582
6207
|
describe: "Uniform Canvas commands",
|
|
5583
|
-
builder: (
|
|
6208
|
+
builder: (yargs38) => yargs38.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(PatternModule).command(ComponentPatternModule).command(CompositionPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LocaleModule).command(WorkflowModule).command(PreviewUrlModule).command(PreviewViewportModule).demandCommand(),
|
|
5584
6209
|
handler: () => {
|
|
5585
|
-
|
|
6210
|
+
yargs18.showHelp();
|
|
5586
6211
|
}
|
|
5587
6212
|
};
|
|
5588
6213
|
|
|
5589
6214
|
// src/commands/context/index.ts
|
|
5590
|
-
import
|
|
6215
|
+
import yargs25 from "yargs";
|
|
5591
6216
|
|
|
5592
6217
|
// src/commands/context/commands/aggregate.ts
|
|
5593
|
-
import
|
|
6218
|
+
import yargs19 from "yargs";
|
|
5594
6219
|
|
|
5595
6220
|
// src/commands/context/commands/aggregate/get.ts
|
|
5596
6221
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
5597
6222
|
var AggregateGetModule = {
|
|
5598
6223
|
command: "get <id>",
|
|
5599
6224
|
describe: "Fetch an aggregate",
|
|
5600
|
-
builder: (
|
|
6225
|
+
builder: (yargs38) => withConfiguration(
|
|
5601
6226
|
withFormatOptions(
|
|
5602
6227
|
withApiOptions(
|
|
5603
6228
|
withProjectOptions(
|
|
5604
|
-
|
|
6229
|
+
yargs38.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
5605
6230
|
)
|
|
5606
6231
|
)
|
|
5607
6232
|
)
|
|
@@ -5625,7 +6250,7 @@ var AggregateListModule = {
|
|
|
5625
6250
|
command: "list",
|
|
5626
6251
|
describe: "List aggregates",
|
|
5627
6252
|
aliases: ["ls"],
|
|
5628
|
-
builder: (
|
|
6253
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
5629
6254
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5630
6255
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5631
6256
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5638,8 +6263,8 @@ var AggregateListModule = {
|
|
|
5638
6263
|
import { UncachedAggregateClient as UncachedAggregateClient3 } from "@uniformdev/context/api";
|
|
5639
6264
|
|
|
5640
6265
|
// src/commands/context/commands/aggregate/_util.ts
|
|
5641
|
-
var
|
|
5642
|
-
var
|
|
6266
|
+
var selectIdentifier8 = (source) => source.id;
|
|
6267
|
+
var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5643
6268
|
|
|
5644
6269
|
// src/commands/context/aggregateEngineDataSource.ts
|
|
5645
6270
|
function createAggregateEngineDataSource({
|
|
@@ -5650,8 +6275,8 @@ function createAggregateEngineDataSource({
|
|
|
5650
6275
|
const aggregates = (await client.get({ type })).aggregates;
|
|
5651
6276
|
for await (const def of aggregates) {
|
|
5652
6277
|
const result = {
|
|
5653
|
-
id:
|
|
5654
|
-
displayName:
|
|
6278
|
+
id: selectIdentifier8(def),
|
|
6279
|
+
displayName: selectDisplayName8(def),
|
|
5655
6280
|
providerId: def.id,
|
|
5656
6281
|
object: def
|
|
5657
6282
|
};
|
|
@@ -5692,11 +6317,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
5692
6317
|
var AggregatePullModule = {
|
|
5693
6318
|
command: "pull <directory>",
|
|
5694
6319
|
describe: "Pulls all aggregates to local files in a directory",
|
|
5695
|
-
builder: (
|
|
6320
|
+
builder: (yargs38) => withConfiguration(
|
|
5696
6321
|
withApiOptions(
|
|
5697
6322
|
withProjectOptions(
|
|
5698
6323
|
withDiffOptions(
|
|
5699
|
-
|
|
6324
|
+
yargs38.positional("directory", {
|
|
5700
6325
|
describe: "Directory to save the aggregates to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5701
6326
|
type: "string"
|
|
5702
6327
|
}).option("format", {
|
|
@@ -5743,8 +6368,8 @@ var AggregatePullModule = {
|
|
|
5743
6368
|
target = await createArraySyncEngineDataSource({
|
|
5744
6369
|
name: `Package file ${directory}`,
|
|
5745
6370
|
objects: packageContents.aggregates ?? [],
|
|
5746
|
-
selectIdentifier:
|
|
5747
|
-
selectDisplayName:
|
|
6371
|
+
selectIdentifier: selectIdentifier8,
|
|
6372
|
+
selectDisplayName: selectDisplayName8,
|
|
5748
6373
|
onSyncComplete: async (_, synced) => {
|
|
5749
6374
|
packageContents.aggregates = synced;
|
|
5750
6375
|
writeContextPackage(directory, packageContents);
|
|
@@ -5753,8 +6378,8 @@ var AggregatePullModule = {
|
|
|
5753
6378
|
} else {
|
|
5754
6379
|
target = await createFileSyncEngineDataSource({
|
|
5755
6380
|
directory,
|
|
5756
|
-
selectIdentifier:
|
|
5757
|
-
selectDisplayName:
|
|
6381
|
+
selectIdentifier: selectIdentifier8,
|
|
6382
|
+
selectDisplayName: selectDisplayName8,
|
|
5758
6383
|
format
|
|
5759
6384
|
});
|
|
5760
6385
|
}
|
|
@@ -5774,11 +6399,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
5774
6399
|
var AggregatePushModule = {
|
|
5775
6400
|
command: "push <directory>",
|
|
5776
6401
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
5777
|
-
builder: (
|
|
6402
|
+
builder: (yargs38) => withConfiguration(
|
|
5778
6403
|
withApiOptions(
|
|
5779
6404
|
withProjectOptions(
|
|
5780
6405
|
withDiffOptions(
|
|
5781
|
-
|
|
6406
|
+
yargs38.positional("directory", {
|
|
5782
6407
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
5783
6408
|
type: "string"
|
|
5784
6409
|
}).option("what-if", {
|
|
@@ -5817,14 +6442,14 @@ var AggregatePushModule = {
|
|
|
5817
6442
|
source = await createArraySyncEngineDataSource({
|
|
5818
6443
|
name: `Package file ${directory}`,
|
|
5819
6444
|
objects: packageContents.aggregates ?? [],
|
|
5820
|
-
selectIdentifier:
|
|
5821
|
-
selectDisplayName:
|
|
6445
|
+
selectIdentifier: selectIdentifier8,
|
|
6446
|
+
selectDisplayName: selectDisplayName8
|
|
5822
6447
|
});
|
|
5823
6448
|
} else {
|
|
5824
6449
|
source = await createFileSyncEngineDataSource({
|
|
5825
6450
|
directory,
|
|
5826
|
-
selectIdentifier:
|
|
5827
|
-
selectDisplayName:
|
|
6451
|
+
selectIdentifier: selectIdentifier8,
|
|
6452
|
+
selectDisplayName: selectDisplayName8
|
|
5828
6453
|
});
|
|
5829
6454
|
}
|
|
5830
6455
|
const target = createAggregateEngineDataSource({ client });
|
|
@@ -5846,10 +6471,10 @@ var AggregateRemoveModule = {
|
|
|
5846
6471
|
command: "remove <id>",
|
|
5847
6472
|
aliases: ["delete", "rm"],
|
|
5848
6473
|
describe: "Delete an aggregate",
|
|
5849
|
-
builder: (
|
|
6474
|
+
builder: (yargs38) => withConfiguration(
|
|
5850
6475
|
withApiOptions(
|
|
5851
6476
|
withProjectOptions(
|
|
5852
|
-
|
|
6477
|
+
yargs38.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
5853
6478
|
)
|
|
5854
6479
|
)
|
|
5855
6480
|
),
|
|
@@ -5866,10 +6491,10 @@ var AggregateUpdateModule = {
|
|
|
5866
6491
|
command: "update <filename>",
|
|
5867
6492
|
aliases: ["put"],
|
|
5868
6493
|
describe: "Insert or update an aggregate",
|
|
5869
|
-
builder: (
|
|
6494
|
+
builder: (yargs38) => withConfiguration(
|
|
5870
6495
|
withApiOptions(
|
|
5871
6496
|
withProjectOptions(
|
|
5872
|
-
|
|
6497
|
+
yargs38.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
5873
6498
|
)
|
|
5874
6499
|
)
|
|
5875
6500
|
),
|
|
@@ -5886,25 +6511,25 @@ var AggregateModule = {
|
|
|
5886
6511
|
command: "aggregate <command>",
|
|
5887
6512
|
aliases: ["agg", "intent", "audience"],
|
|
5888
6513
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
5889
|
-
builder: (
|
|
6514
|
+
builder: (yargs38) => yargs38.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
5890
6515
|
handler: () => {
|
|
5891
|
-
|
|
6516
|
+
yargs19.help();
|
|
5892
6517
|
}
|
|
5893
6518
|
};
|
|
5894
6519
|
|
|
5895
6520
|
// src/commands/context/commands/enrichment.ts
|
|
5896
|
-
import
|
|
6521
|
+
import yargs20 from "yargs";
|
|
5897
6522
|
|
|
5898
6523
|
// src/commands/context/commands/enrichment/get.ts
|
|
5899
6524
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
5900
6525
|
var EnrichmentGetModule = {
|
|
5901
6526
|
command: "get <id>",
|
|
5902
6527
|
describe: "Fetch an enrichment category and its values",
|
|
5903
|
-
builder: (
|
|
6528
|
+
builder: (yargs38) => withFormatOptions(
|
|
5904
6529
|
withConfiguration(
|
|
5905
6530
|
withApiOptions(
|
|
5906
6531
|
withProjectOptions(
|
|
5907
|
-
|
|
6532
|
+
yargs38.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
5908
6533
|
)
|
|
5909
6534
|
)
|
|
5910
6535
|
)
|
|
@@ -5928,7 +6553,7 @@ var EnrichmentListModule = {
|
|
|
5928
6553
|
command: "list",
|
|
5929
6554
|
describe: "List enrichments",
|
|
5930
6555
|
aliases: ["ls"],
|
|
5931
|
-
builder: (
|
|
6556
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
5932
6557
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5933
6558
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5934
6559
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5941,8 +6566,8 @@ var EnrichmentListModule = {
|
|
|
5941
6566
|
import { UncachedEnrichmentClient as UncachedEnrichmentClient3 } from "@uniformdev/context/api";
|
|
5942
6567
|
|
|
5943
6568
|
// src/commands/context/commands/enrichment/_util.ts
|
|
5944
|
-
var
|
|
5945
|
-
var
|
|
6569
|
+
var selectIdentifier9 = (source) => source.id;
|
|
6570
|
+
var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5946
6571
|
|
|
5947
6572
|
// src/commands/context/enrichmentEngineDataSource.ts
|
|
5948
6573
|
function createEnrichmentEngineDataSource({
|
|
@@ -5952,8 +6577,8 @@ function createEnrichmentEngineDataSource({
|
|
|
5952
6577
|
const enrichments = (await client.get()).enrichments;
|
|
5953
6578
|
for await (const def of enrichments) {
|
|
5954
6579
|
const result = {
|
|
5955
|
-
id:
|
|
5956
|
-
displayName:
|
|
6580
|
+
id: selectIdentifier9(def),
|
|
6581
|
+
displayName: selectDisplayName9(def),
|
|
5957
6582
|
providerId: def.id,
|
|
5958
6583
|
object: def
|
|
5959
6584
|
};
|
|
@@ -6030,11 +6655,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
6030
6655
|
var EnrichmentPullModule = {
|
|
6031
6656
|
command: "pull <directory>",
|
|
6032
6657
|
describe: "Pulls all enrichments to local files in a directory",
|
|
6033
|
-
builder: (
|
|
6658
|
+
builder: (yargs38) => withConfiguration(
|
|
6034
6659
|
withApiOptions(
|
|
6035
6660
|
withProjectOptions(
|
|
6036
6661
|
withDiffOptions(
|
|
6037
|
-
|
|
6662
|
+
yargs38.positional("directory", {
|
|
6038
6663
|
describe: "Directory to save the enrichments to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
6039
6664
|
type: "string"
|
|
6040
6665
|
}).option("format", {
|
|
@@ -6081,8 +6706,8 @@ var EnrichmentPullModule = {
|
|
|
6081
6706
|
target = await createArraySyncEngineDataSource({
|
|
6082
6707
|
name: `Package file ${directory}`,
|
|
6083
6708
|
objects: packageContents.enrichments ?? [],
|
|
6084
|
-
selectIdentifier:
|
|
6085
|
-
selectDisplayName:
|
|
6709
|
+
selectIdentifier: selectIdentifier9,
|
|
6710
|
+
selectDisplayName: selectDisplayName9,
|
|
6086
6711
|
onSyncComplete: async (_, synced) => {
|
|
6087
6712
|
packageContents.enrichments = synced;
|
|
6088
6713
|
writeContextPackage(directory, packageContents);
|
|
@@ -6091,8 +6716,8 @@ var EnrichmentPullModule = {
|
|
|
6091
6716
|
} else {
|
|
6092
6717
|
target = await createFileSyncEngineDataSource({
|
|
6093
6718
|
directory,
|
|
6094
|
-
selectIdentifier:
|
|
6095
|
-
selectDisplayName:
|
|
6719
|
+
selectIdentifier: selectIdentifier9,
|
|
6720
|
+
selectDisplayName: selectDisplayName9,
|
|
6096
6721
|
format
|
|
6097
6722
|
});
|
|
6098
6723
|
}
|
|
@@ -6112,11 +6737,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
6112
6737
|
var EnrichmentPushModule = {
|
|
6113
6738
|
command: "push <directory>",
|
|
6114
6739
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
6115
|
-
builder: (
|
|
6740
|
+
builder: (yargs38) => withConfiguration(
|
|
6116
6741
|
withApiOptions(
|
|
6117
6742
|
withProjectOptions(
|
|
6118
6743
|
withDiffOptions(
|
|
6119
|
-
|
|
6744
|
+
yargs38.positional("directory", {
|
|
6120
6745
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
6121
6746
|
type: "string"
|
|
6122
6747
|
}).option("what-if", {
|
|
@@ -6155,14 +6780,14 @@ var EnrichmentPushModule = {
|
|
|
6155
6780
|
source = await createArraySyncEngineDataSource({
|
|
6156
6781
|
name: `Package file ${directory}`,
|
|
6157
6782
|
objects: packageContents.enrichments ?? [],
|
|
6158
|
-
selectIdentifier:
|
|
6159
|
-
selectDisplayName:
|
|
6783
|
+
selectIdentifier: selectIdentifier9,
|
|
6784
|
+
selectDisplayName: selectDisplayName9
|
|
6160
6785
|
});
|
|
6161
6786
|
} else {
|
|
6162
6787
|
source = await createFileSyncEngineDataSource({
|
|
6163
6788
|
directory,
|
|
6164
|
-
selectIdentifier:
|
|
6165
|
-
selectDisplayName:
|
|
6789
|
+
selectIdentifier: selectIdentifier9,
|
|
6790
|
+
selectDisplayName: selectDisplayName9
|
|
6166
6791
|
});
|
|
6167
6792
|
}
|
|
6168
6793
|
const target = createEnrichmentEngineDataSource({ client });
|
|
@@ -6183,10 +6808,10 @@ var EnrichmentRemoveModule = {
|
|
|
6183
6808
|
command: "remove <id>",
|
|
6184
6809
|
aliases: ["delete", "rm"],
|
|
6185
6810
|
describe: "Delete an enrichment category and its values",
|
|
6186
|
-
builder: (
|
|
6811
|
+
builder: (yargs38) => withConfiguration(
|
|
6187
6812
|
withApiOptions(
|
|
6188
6813
|
withProjectOptions(
|
|
6189
|
-
|
|
6814
|
+
yargs38.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
6190
6815
|
)
|
|
6191
6816
|
)
|
|
6192
6817
|
),
|
|
@@ -6202,17 +6827,17 @@ var EnrichmentModule = {
|
|
|
6202
6827
|
command: "enrichment <command>",
|
|
6203
6828
|
aliases: ["enr"],
|
|
6204
6829
|
describe: "Commands for Context enrichments",
|
|
6205
|
-
builder: (
|
|
6830
|
+
builder: (yargs38) => yargs38.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
6206
6831
|
handler: () => {
|
|
6207
|
-
|
|
6832
|
+
yargs20.help();
|
|
6208
6833
|
}
|
|
6209
6834
|
};
|
|
6210
6835
|
|
|
6211
6836
|
// src/commands/context/commands/manifest.ts
|
|
6212
|
-
import
|
|
6837
|
+
import yargs21 from "yargs";
|
|
6213
6838
|
|
|
6214
6839
|
// src/commands/context/commands/manifest/get.ts
|
|
6215
|
-
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
6840
|
+
import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
|
|
6216
6841
|
import { gray as gray2, green as green2, red as red3 } from "colorette";
|
|
6217
6842
|
import { writeFile } from "fs";
|
|
6218
6843
|
import { exit } from "process";
|
|
@@ -6220,10 +6845,10 @@ var ManifestGetModule = {
|
|
|
6220
6845
|
command: "get [output]",
|
|
6221
6846
|
aliases: ["dl", "download"],
|
|
6222
6847
|
describe: "Download the Uniform Context manifest for a project",
|
|
6223
|
-
builder: (
|
|
6848
|
+
builder: (yargs38) => withConfiguration(
|
|
6224
6849
|
withApiOptions(
|
|
6225
6850
|
withProjectOptions(
|
|
6226
|
-
|
|
6851
|
+
yargs38.option("preview", {
|
|
6227
6852
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
6228
6853
|
default: false,
|
|
6229
6854
|
type: "boolean",
|
|
@@ -6263,7 +6888,7 @@ var ManifestGetModule = {
|
|
|
6263
6888
|
}
|
|
6264
6889
|
} catch (e) {
|
|
6265
6890
|
let message;
|
|
6266
|
-
if (e instanceof
|
|
6891
|
+
if (e instanceof ApiClientError2) {
|
|
6267
6892
|
if (e.statusCode === 403) {
|
|
6268
6893
|
message = `The API key ${apiKey} did not have permissions to fetch the manifest. Ensure ${preview ? "Uniform Context > Read Drafts" : "Uniform Context > Manifest > Read"} permissions are granted.`;
|
|
6269
6894
|
}
|
|
@@ -6279,13 +6904,13 @@ var ManifestGetModule = {
|
|
|
6279
6904
|
};
|
|
6280
6905
|
|
|
6281
6906
|
// src/commands/context/commands/manifest/publish.ts
|
|
6282
|
-
import { ApiClientError as
|
|
6907
|
+
import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
|
|
6283
6908
|
import { gray as gray3, red as red4 } from "colorette";
|
|
6284
6909
|
import { exit as exit2 } from "process";
|
|
6285
6910
|
var ManifestPublishModule = {
|
|
6286
6911
|
command: "publish",
|
|
6287
6912
|
describe: "Publish the Uniform Context manifest for a project",
|
|
6288
|
-
builder: (
|
|
6913
|
+
builder: (yargs38) => withConfiguration(withApiOptions(withProjectOptions(yargs38))),
|
|
6289
6914
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
6290
6915
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6291
6916
|
try {
|
|
@@ -6298,7 +6923,7 @@ var ManifestPublishModule = {
|
|
|
6298
6923
|
await client.publish();
|
|
6299
6924
|
} catch (e) {
|
|
6300
6925
|
let message;
|
|
6301
|
-
if (e instanceof
|
|
6926
|
+
if (e instanceof ApiClientError3) {
|
|
6302
6927
|
if (e.statusCode === 403) {
|
|
6303
6928
|
message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
|
|
6304
6929
|
}
|
|
@@ -6318,25 +6943,25 @@ var ManifestModule = {
|
|
|
6318
6943
|
command: "manifest <command>",
|
|
6319
6944
|
describe: "Commands for context manifests",
|
|
6320
6945
|
aliases: ["man"],
|
|
6321
|
-
builder: (
|
|
6946
|
+
builder: (yargs38) => yargs38.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
6322
6947
|
handler: () => {
|
|
6323
|
-
|
|
6948
|
+
yargs21.help();
|
|
6324
6949
|
}
|
|
6325
6950
|
};
|
|
6326
6951
|
|
|
6327
6952
|
// src/commands/context/commands/quirk.ts
|
|
6328
|
-
import
|
|
6953
|
+
import yargs22 from "yargs";
|
|
6329
6954
|
|
|
6330
6955
|
// src/commands/context/commands/quirk/get.ts
|
|
6331
6956
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
6332
6957
|
var QuirkGetModule = {
|
|
6333
6958
|
command: "get <id>",
|
|
6334
6959
|
describe: "Fetch a quirk",
|
|
6335
|
-
builder: (
|
|
6960
|
+
builder: (yargs38) => withConfiguration(
|
|
6336
6961
|
withFormatOptions(
|
|
6337
6962
|
withApiOptions(
|
|
6338
6963
|
withProjectOptions(
|
|
6339
|
-
|
|
6964
|
+
yargs38.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
6340
6965
|
)
|
|
6341
6966
|
)
|
|
6342
6967
|
)
|
|
@@ -6360,11 +6985,11 @@ var QuirkListModule = {
|
|
|
6360
6985
|
command: "list",
|
|
6361
6986
|
describe: "List quirks",
|
|
6362
6987
|
aliases: ["ls"],
|
|
6363
|
-
builder: (
|
|
6988
|
+
builder: (yargs38) => withConfiguration(
|
|
6364
6989
|
withFormatOptions(
|
|
6365
6990
|
withApiOptions(
|
|
6366
6991
|
withProjectOptions(
|
|
6367
|
-
|
|
6992
|
+
yargs38.option("withIntegrations", {
|
|
6368
6993
|
alias: ["i"],
|
|
6369
6994
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
6370
6995
|
type: "boolean"
|
|
@@ -6385,8 +7010,8 @@ var QuirkListModule = {
|
|
|
6385
7010
|
import { UncachedQuirkClient as UncachedQuirkClient3 } from "@uniformdev/context/api";
|
|
6386
7011
|
|
|
6387
7012
|
// src/commands/context/commands/quirk/_util.ts
|
|
6388
|
-
var
|
|
6389
|
-
var
|
|
7013
|
+
var selectIdentifier10 = (source) => source.id;
|
|
7014
|
+
var selectDisplayName10 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6390
7015
|
|
|
6391
7016
|
// src/commands/context/quirkEngineDataSource.ts
|
|
6392
7017
|
function createQuirkEngineDataSource({
|
|
@@ -6396,8 +7021,8 @@ function createQuirkEngineDataSource({
|
|
|
6396
7021
|
const quirks = (await client.get({ withIntegrations: false })).quirks;
|
|
6397
7022
|
for await (const def of quirks) {
|
|
6398
7023
|
const result = {
|
|
6399
|
-
id:
|
|
6400
|
-
displayName:
|
|
7024
|
+
id: selectIdentifier10(def),
|
|
7025
|
+
displayName: selectDisplayName10(def),
|
|
6401
7026
|
providerId: def.id,
|
|
6402
7027
|
object: def
|
|
6403
7028
|
};
|
|
@@ -6422,11 +7047,11 @@ function createQuirkEngineDataSource({
|
|
|
6422
7047
|
var QuirkPullModule = {
|
|
6423
7048
|
command: "pull <directory>",
|
|
6424
7049
|
describe: "Pulls all quirks to local files in a directory",
|
|
6425
|
-
builder: (
|
|
7050
|
+
builder: (yargs38) => withConfiguration(
|
|
6426
7051
|
withApiOptions(
|
|
6427
7052
|
withProjectOptions(
|
|
6428
7053
|
withDiffOptions(
|
|
6429
|
-
|
|
7054
|
+
yargs38.positional("directory", {
|
|
6430
7055
|
describe: "Directory to save the quirks to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
6431
7056
|
type: "string"
|
|
6432
7057
|
}).option("format", {
|
|
@@ -6473,8 +7098,8 @@ var QuirkPullModule = {
|
|
|
6473
7098
|
target = await createArraySyncEngineDataSource({
|
|
6474
7099
|
name: `Package file ${directory}`,
|
|
6475
7100
|
objects: packageContents.quirks ?? [],
|
|
6476
|
-
selectIdentifier:
|
|
6477
|
-
selectDisplayName:
|
|
7101
|
+
selectIdentifier: selectIdentifier10,
|
|
7102
|
+
selectDisplayName: selectDisplayName10,
|
|
6478
7103
|
onSyncComplete: async (_, synced) => {
|
|
6479
7104
|
packageContents.quirks = synced;
|
|
6480
7105
|
writeContextPackage(directory, packageContents);
|
|
@@ -6483,8 +7108,8 @@ var QuirkPullModule = {
|
|
|
6483
7108
|
} else {
|
|
6484
7109
|
target = await createFileSyncEngineDataSource({
|
|
6485
7110
|
directory,
|
|
6486
|
-
selectIdentifier:
|
|
6487
|
-
selectDisplayName:
|
|
7111
|
+
selectIdentifier: selectIdentifier10,
|
|
7112
|
+
selectDisplayName: selectDisplayName10,
|
|
6488
7113
|
format
|
|
6489
7114
|
});
|
|
6490
7115
|
}
|
|
@@ -6504,11 +7129,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
6504
7129
|
var QuirkPushModule = {
|
|
6505
7130
|
command: "push <directory>",
|
|
6506
7131
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
6507
|
-
builder: (
|
|
7132
|
+
builder: (yargs38) => withConfiguration(
|
|
6508
7133
|
withApiOptions(
|
|
6509
7134
|
withProjectOptions(
|
|
6510
7135
|
withDiffOptions(
|
|
6511
|
-
|
|
7136
|
+
yargs38.positional("directory", {
|
|
6512
7137
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
6513
7138
|
type: "string"
|
|
6514
7139
|
}).option("what-if", {
|
|
@@ -6547,14 +7172,14 @@ var QuirkPushModule = {
|
|
|
6547
7172
|
source = await createArraySyncEngineDataSource({
|
|
6548
7173
|
name: `Package file ${directory}`,
|
|
6549
7174
|
objects: packageContents.quirks ?? [],
|
|
6550
|
-
selectIdentifier:
|
|
6551
|
-
selectDisplayName:
|
|
7175
|
+
selectIdentifier: selectIdentifier10,
|
|
7176
|
+
selectDisplayName: selectDisplayName10
|
|
6552
7177
|
});
|
|
6553
7178
|
} else {
|
|
6554
7179
|
source = await createFileSyncEngineDataSource({
|
|
6555
7180
|
directory,
|
|
6556
|
-
selectIdentifier:
|
|
6557
|
-
selectDisplayName:
|
|
7181
|
+
selectIdentifier: selectIdentifier10,
|
|
7182
|
+
selectDisplayName: selectDisplayName10
|
|
6558
7183
|
});
|
|
6559
7184
|
}
|
|
6560
7185
|
const target = createQuirkEngineDataSource({ client });
|
|
@@ -6575,10 +7200,10 @@ var QuirkRemoveModule = {
|
|
|
6575
7200
|
command: "remove <id>",
|
|
6576
7201
|
aliases: ["delete", "rm"],
|
|
6577
7202
|
describe: "Delete a quirk",
|
|
6578
|
-
builder: (
|
|
7203
|
+
builder: (yargs38) => withConfiguration(
|
|
6579
7204
|
withApiOptions(
|
|
6580
7205
|
withProjectOptions(
|
|
6581
|
-
|
|
7206
|
+
yargs38.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
6582
7207
|
)
|
|
6583
7208
|
)
|
|
6584
7209
|
),
|
|
@@ -6595,10 +7220,10 @@ var QuirkUpdateModule = {
|
|
|
6595
7220
|
command: "update <filename>",
|
|
6596
7221
|
aliases: ["put"],
|
|
6597
7222
|
describe: "Insert or update a quirk",
|
|
6598
|
-
builder: (
|
|
7223
|
+
builder: (yargs38) => withConfiguration(
|
|
6599
7224
|
withApiOptions(
|
|
6600
7225
|
withProjectOptions(
|
|
6601
|
-
|
|
7226
|
+
yargs38.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
6602
7227
|
)
|
|
6603
7228
|
)
|
|
6604
7229
|
),
|
|
@@ -6615,25 +7240,25 @@ var QuirkModule = {
|
|
|
6615
7240
|
command: "quirk <command>",
|
|
6616
7241
|
aliases: ["qk"],
|
|
6617
7242
|
describe: "Commands for Context quirks",
|
|
6618
|
-
builder: (
|
|
7243
|
+
builder: (yargs38) => yargs38.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
6619
7244
|
handler: () => {
|
|
6620
|
-
|
|
7245
|
+
yargs22.help();
|
|
6621
7246
|
}
|
|
6622
7247
|
};
|
|
6623
7248
|
|
|
6624
7249
|
// src/commands/context/commands/signal.ts
|
|
6625
|
-
import
|
|
7250
|
+
import yargs23 from "yargs";
|
|
6626
7251
|
|
|
6627
7252
|
// src/commands/context/commands/signal/get.ts
|
|
6628
7253
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
6629
7254
|
var SignalGetModule = {
|
|
6630
7255
|
command: "get <id>",
|
|
6631
7256
|
describe: "Fetch a signal",
|
|
6632
|
-
builder: (
|
|
7257
|
+
builder: (yargs38) => withConfiguration(
|
|
6633
7258
|
withFormatOptions(
|
|
6634
7259
|
withApiOptions(
|
|
6635
7260
|
withProjectOptions(
|
|
6636
|
-
|
|
7261
|
+
yargs38.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
6637
7262
|
)
|
|
6638
7263
|
)
|
|
6639
7264
|
)
|
|
@@ -6657,7 +7282,7 @@ var SignalListModule = {
|
|
|
6657
7282
|
command: "list",
|
|
6658
7283
|
describe: "List signals",
|
|
6659
7284
|
aliases: ["ls"],
|
|
6660
|
-
builder: (
|
|
7285
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
6661
7286
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6662
7287
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6663
7288
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6670,8 +7295,8 @@ var SignalListModule = {
|
|
|
6670
7295
|
import { UncachedSignalClient as UncachedSignalClient3 } from "@uniformdev/context/api";
|
|
6671
7296
|
|
|
6672
7297
|
// src/commands/context/commands/signal/_util.ts
|
|
6673
|
-
var
|
|
6674
|
-
var
|
|
7298
|
+
var selectIdentifier11 = (source) => source.id;
|
|
7299
|
+
var selectDisplayName11 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6675
7300
|
|
|
6676
7301
|
// src/commands/context/signalEngineDataSource.ts
|
|
6677
7302
|
function createSignalEngineDataSource({
|
|
@@ -6681,8 +7306,8 @@ function createSignalEngineDataSource({
|
|
|
6681
7306
|
const signals = (await client.get()).signals;
|
|
6682
7307
|
for await (const def of signals) {
|
|
6683
7308
|
const result = {
|
|
6684
|
-
id:
|
|
6685
|
-
displayName:
|
|
7309
|
+
id: selectIdentifier11(def),
|
|
7310
|
+
displayName: selectDisplayName11(def),
|
|
6686
7311
|
providerId: def.id,
|
|
6687
7312
|
object: def
|
|
6688
7313
|
};
|
|
@@ -6707,11 +7332,11 @@ function createSignalEngineDataSource({
|
|
|
6707
7332
|
var SignalPullModule = {
|
|
6708
7333
|
command: "pull <directory>",
|
|
6709
7334
|
describe: "Pulls all signals to local files in a directory",
|
|
6710
|
-
builder: (
|
|
7335
|
+
builder: (yargs38) => withConfiguration(
|
|
6711
7336
|
withApiOptions(
|
|
6712
7337
|
withProjectOptions(
|
|
6713
7338
|
withDiffOptions(
|
|
6714
|
-
|
|
7339
|
+
yargs38.positional("directory", {
|
|
6715
7340
|
describe: "Directory to save the signals to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
6716
7341
|
type: "string"
|
|
6717
7342
|
}).option("format", {
|
|
@@ -6758,8 +7383,8 @@ var SignalPullModule = {
|
|
|
6758
7383
|
target = await createArraySyncEngineDataSource({
|
|
6759
7384
|
name: `Package file ${directory}`,
|
|
6760
7385
|
objects: packageContents.signals ?? [],
|
|
6761
|
-
selectIdentifier:
|
|
6762
|
-
selectDisplayName:
|
|
7386
|
+
selectIdentifier: selectIdentifier11,
|
|
7387
|
+
selectDisplayName: selectDisplayName11,
|
|
6763
7388
|
onSyncComplete: async (_, synced) => {
|
|
6764
7389
|
packageContents.signals = synced;
|
|
6765
7390
|
writeContextPackage(directory, packageContents);
|
|
@@ -6768,8 +7393,8 @@ var SignalPullModule = {
|
|
|
6768
7393
|
} else {
|
|
6769
7394
|
target = await createFileSyncEngineDataSource({
|
|
6770
7395
|
directory,
|
|
6771
|
-
selectIdentifier:
|
|
6772
|
-
selectDisplayName:
|
|
7396
|
+
selectIdentifier: selectIdentifier11,
|
|
7397
|
+
selectDisplayName: selectDisplayName11,
|
|
6773
7398
|
format
|
|
6774
7399
|
});
|
|
6775
7400
|
}
|
|
@@ -6789,11 +7414,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
6789
7414
|
var SignalPushModule = {
|
|
6790
7415
|
command: "push <directory>",
|
|
6791
7416
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
6792
|
-
builder: (
|
|
7417
|
+
builder: (yargs38) => withConfiguration(
|
|
6793
7418
|
withApiOptions(
|
|
6794
7419
|
withProjectOptions(
|
|
6795
7420
|
withDiffOptions(
|
|
6796
|
-
|
|
7421
|
+
yargs38.positional("directory", {
|
|
6797
7422
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
6798
7423
|
type: "string"
|
|
6799
7424
|
}).option("what-if", {
|
|
@@ -6832,14 +7457,14 @@ var SignalPushModule = {
|
|
|
6832
7457
|
source = await createArraySyncEngineDataSource({
|
|
6833
7458
|
name: `Package file ${directory}`,
|
|
6834
7459
|
objects: packageContents.signals ?? [],
|
|
6835
|
-
selectIdentifier:
|
|
6836
|
-
selectDisplayName:
|
|
7460
|
+
selectIdentifier: selectIdentifier11,
|
|
7461
|
+
selectDisplayName: selectDisplayName11
|
|
6837
7462
|
});
|
|
6838
7463
|
} else {
|
|
6839
7464
|
source = await createFileSyncEngineDataSource({
|
|
6840
7465
|
directory,
|
|
6841
|
-
selectIdentifier:
|
|
6842
|
-
selectDisplayName:
|
|
7466
|
+
selectIdentifier: selectIdentifier11,
|
|
7467
|
+
selectDisplayName: selectDisplayName11
|
|
6843
7468
|
});
|
|
6844
7469
|
}
|
|
6845
7470
|
const target = createSignalEngineDataSource({ client });
|
|
@@ -6860,10 +7485,10 @@ var SignalRemoveModule = {
|
|
|
6860
7485
|
command: "remove <id>",
|
|
6861
7486
|
aliases: ["delete", "rm"],
|
|
6862
7487
|
describe: "Delete a signal",
|
|
6863
|
-
builder: (
|
|
7488
|
+
builder: (yargs38) => withConfiguration(
|
|
6864
7489
|
withApiOptions(
|
|
6865
7490
|
withProjectOptions(
|
|
6866
|
-
|
|
7491
|
+
yargs38.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
6867
7492
|
)
|
|
6868
7493
|
)
|
|
6869
7494
|
),
|
|
@@ -6880,10 +7505,10 @@ var SignalUpdateModule = {
|
|
|
6880
7505
|
command: "update <filename>",
|
|
6881
7506
|
aliases: ["put"],
|
|
6882
7507
|
describe: "Insert or update a signal",
|
|
6883
|
-
builder: (
|
|
7508
|
+
builder: (yargs38) => withConfiguration(
|
|
6884
7509
|
withApiOptions(
|
|
6885
7510
|
withProjectOptions(
|
|
6886
|
-
|
|
7511
|
+
yargs38.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
6887
7512
|
)
|
|
6888
7513
|
)
|
|
6889
7514
|
),
|
|
@@ -6900,25 +7525,25 @@ var SignalModule = {
|
|
|
6900
7525
|
command: "signal <command>",
|
|
6901
7526
|
aliases: ["sig"],
|
|
6902
7527
|
describe: "Commands for Context signals",
|
|
6903
|
-
builder: (
|
|
7528
|
+
builder: (yargs38) => yargs38.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
6904
7529
|
handler: () => {
|
|
6905
|
-
|
|
7530
|
+
yargs23.help();
|
|
6906
7531
|
}
|
|
6907
7532
|
};
|
|
6908
7533
|
|
|
6909
7534
|
// src/commands/context/commands/test.ts
|
|
6910
|
-
import
|
|
7535
|
+
import yargs24 from "yargs";
|
|
6911
7536
|
|
|
6912
7537
|
// src/commands/context/commands/test/get.ts
|
|
6913
7538
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
6914
7539
|
var TestGetModule = {
|
|
6915
7540
|
command: "get <id>",
|
|
6916
7541
|
describe: "Fetch a test",
|
|
6917
|
-
builder: (
|
|
7542
|
+
builder: (yargs38) => withConfiguration(
|
|
6918
7543
|
withFormatOptions(
|
|
6919
7544
|
withApiOptions(
|
|
6920
7545
|
withProjectOptions(
|
|
6921
|
-
|
|
7546
|
+
yargs38.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
6922
7547
|
)
|
|
6923
7548
|
)
|
|
6924
7549
|
)
|
|
@@ -6942,7 +7567,7 @@ var TestListModule = {
|
|
|
6942
7567
|
command: "list",
|
|
6943
7568
|
describe: "List tests",
|
|
6944
7569
|
aliases: ["ls"],
|
|
6945
|
-
builder: (
|
|
7570
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
6946
7571
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6947
7572
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6948
7573
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6955,8 +7580,8 @@ var TestListModule = {
|
|
|
6955
7580
|
import { UncachedTestClient as UncachedTestClient3 } from "@uniformdev/context/api";
|
|
6956
7581
|
|
|
6957
7582
|
// src/commands/context/commands/test/_util.ts
|
|
6958
|
-
var
|
|
6959
|
-
var
|
|
7583
|
+
var selectIdentifier12 = (source) => source.id;
|
|
7584
|
+
var selectDisplayName12 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6960
7585
|
|
|
6961
7586
|
// src/commands/context/testEngineDataSource.ts
|
|
6962
7587
|
function createTestEngineDataSource({
|
|
@@ -6966,8 +7591,8 @@ function createTestEngineDataSource({
|
|
|
6966
7591
|
const tests = (await client.get()).tests;
|
|
6967
7592
|
for await (const def of tests) {
|
|
6968
7593
|
const result = {
|
|
6969
|
-
id:
|
|
6970
|
-
displayName:
|
|
7594
|
+
id: selectIdentifier12(def),
|
|
7595
|
+
displayName: selectDisplayName12(def),
|
|
6971
7596
|
providerId: def.id,
|
|
6972
7597
|
object: def
|
|
6973
7598
|
};
|
|
@@ -6992,11 +7617,11 @@ function createTestEngineDataSource({
|
|
|
6992
7617
|
var TestPullModule = {
|
|
6993
7618
|
command: "pull <directory>",
|
|
6994
7619
|
describe: "Pulls all tests to local files in a directory",
|
|
6995
|
-
builder: (
|
|
7620
|
+
builder: (yargs38) => withConfiguration(
|
|
6996
7621
|
withApiOptions(
|
|
6997
7622
|
withProjectOptions(
|
|
6998
7623
|
withDiffOptions(
|
|
6999
|
-
|
|
7624
|
+
yargs38.positional("directory", {
|
|
7000
7625
|
describe: "Directory to save the tests to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
7001
7626
|
type: "string"
|
|
7002
7627
|
}).option("format", {
|
|
@@ -7043,8 +7668,8 @@ var TestPullModule = {
|
|
|
7043
7668
|
target = await createArraySyncEngineDataSource({
|
|
7044
7669
|
name: `Package file ${directory}`,
|
|
7045
7670
|
objects: packageContents.tests ?? [],
|
|
7046
|
-
selectIdentifier:
|
|
7047
|
-
selectDisplayName:
|
|
7671
|
+
selectIdentifier: selectIdentifier12,
|
|
7672
|
+
selectDisplayName: selectDisplayName12,
|
|
7048
7673
|
onSyncComplete: async (_, synced) => {
|
|
7049
7674
|
packageContents.tests = synced;
|
|
7050
7675
|
writeContextPackage(directory, packageContents);
|
|
@@ -7053,8 +7678,8 @@ var TestPullModule = {
|
|
|
7053
7678
|
} else {
|
|
7054
7679
|
target = await createFileSyncEngineDataSource({
|
|
7055
7680
|
directory,
|
|
7056
|
-
selectIdentifier:
|
|
7057
|
-
selectDisplayName:
|
|
7681
|
+
selectIdentifier: selectIdentifier12,
|
|
7682
|
+
selectDisplayName: selectDisplayName12,
|
|
7058
7683
|
format
|
|
7059
7684
|
});
|
|
7060
7685
|
}
|
|
@@ -7074,11 +7699,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
7074
7699
|
var TestPushModule = {
|
|
7075
7700
|
command: "push <directory>",
|
|
7076
7701
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
7077
|
-
builder: (
|
|
7702
|
+
builder: (yargs38) => withConfiguration(
|
|
7078
7703
|
withApiOptions(
|
|
7079
7704
|
withProjectOptions(
|
|
7080
7705
|
withDiffOptions(
|
|
7081
|
-
|
|
7706
|
+
yargs38.positional("directory", {
|
|
7082
7707
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
7083
7708
|
type: "string"
|
|
7084
7709
|
}).option("what-if", {
|
|
@@ -7117,14 +7742,14 @@ var TestPushModule = {
|
|
|
7117
7742
|
source = await createArraySyncEngineDataSource({
|
|
7118
7743
|
name: `Package file ${directory}`,
|
|
7119
7744
|
objects: packageContents.tests ?? [],
|
|
7120
|
-
selectIdentifier:
|
|
7121
|
-
selectDisplayName:
|
|
7745
|
+
selectIdentifier: selectIdentifier12,
|
|
7746
|
+
selectDisplayName: selectDisplayName12
|
|
7122
7747
|
});
|
|
7123
7748
|
} else {
|
|
7124
7749
|
source = await createFileSyncEngineDataSource({
|
|
7125
7750
|
directory,
|
|
7126
|
-
selectIdentifier:
|
|
7127
|
-
selectDisplayName:
|
|
7751
|
+
selectIdentifier: selectIdentifier12,
|
|
7752
|
+
selectDisplayName: selectDisplayName12
|
|
7128
7753
|
});
|
|
7129
7754
|
}
|
|
7130
7755
|
const target = createTestEngineDataSource({ client });
|
|
@@ -7145,10 +7770,10 @@ var TestRemoveModule = {
|
|
|
7145
7770
|
command: "remove <id>",
|
|
7146
7771
|
aliases: ["delete", "rm"],
|
|
7147
7772
|
describe: "Delete a test",
|
|
7148
|
-
builder: (
|
|
7773
|
+
builder: (yargs38) => withConfiguration(
|
|
7149
7774
|
withApiOptions(
|
|
7150
7775
|
withProjectOptions(
|
|
7151
|
-
|
|
7776
|
+
yargs38.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
7152
7777
|
)
|
|
7153
7778
|
)
|
|
7154
7779
|
),
|
|
@@ -7165,9 +7790,9 @@ var TestUpdateModule = {
|
|
|
7165
7790
|
command: "update <filename>",
|
|
7166
7791
|
aliases: ["put"],
|
|
7167
7792
|
describe: "Insert or update a test",
|
|
7168
|
-
builder: (
|
|
7793
|
+
builder: (yargs38) => withConfiguration(
|
|
7169
7794
|
withApiOptions(
|
|
7170
|
-
withProjectOptions(
|
|
7795
|
+
withProjectOptions(yargs38.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
7171
7796
|
)
|
|
7172
7797
|
),
|
|
7173
7798
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -7182,9 +7807,9 @@ var TestUpdateModule = {
|
|
|
7182
7807
|
var TestModule = {
|
|
7183
7808
|
command: "test <command>",
|
|
7184
7809
|
describe: "Commands for Context A/B tests",
|
|
7185
|
-
builder: (
|
|
7810
|
+
builder: (yargs38) => yargs38.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
7186
7811
|
handler: () => {
|
|
7187
|
-
|
|
7812
|
+
yargs24.help();
|
|
7188
7813
|
}
|
|
7189
7814
|
};
|
|
7190
7815
|
|
|
@@ -7193,20 +7818,20 @@ var ContextCommand = {
|
|
|
7193
7818
|
command: "context <command>",
|
|
7194
7819
|
aliases: ["ctx"],
|
|
7195
7820
|
describe: "Uniform Context commands",
|
|
7196
|
-
builder: (
|
|
7821
|
+
builder: (yargs38) => yargs38.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
7197
7822
|
handler: () => {
|
|
7198
|
-
|
|
7823
|
+
yargs25.showHelp();
|
|
7199
7824
|
}
|
|
7200
7825
|
};
|
|
7201
7826
|
|
|
7202
7827
|
// src/commands/integration/index.ts
|
|
7203
|
-
import
|
|
7828
|
+
import yargs28 from "yargs";
|
|
7204
7829
|
|
|
7205
7830
|
// src/commands/integration/commands/definition.ts
|
|
7206
|
-
import
|
|
7831
|
+
import yargs27 from "yargs";
|
|
7207
7832
|
|
|
7208
7833
|
// src/commands/integration/commands/definition/edgehancer/edgehancer.ts
|
|
7209
|
-
import
|
|
7834
|
+
import yargs26 from "yargs";
|
|
7210
7835
|
|
|
7211
7836
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
7212
7837
|
import { readFileSync } from "fs";
|
|
@@ -7244,8 +7869,8 @@ var EdgehancerClient = class extends ApiClient {
|
|
|
7244
7869
|
};
|
|
7245
7870
|
|
|
7246
7871
|
// src/commands/integration/commands/definition/edgehancer/util.ts
|
|
7247
|
-
function withEdgehancerIdOptions(
|
|
7248
|
-
return
|
|
7872
|
+
function withEdgehancerIdOptions(yargs38) {
|
|
7873
|
+
return yargs38.option("connectorType", {
|
|
7249
7874
|
describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
|
|
7250
7875
|
demandOption: true,
|
|
7251
7876
|
type: "string"
|
|
@@ -7265,11 +7890,11 @@ function withEdgehancerIdOptions(yargs36) {
|
|
|
7265
7890
|
var IntegrationEdgehancerDeployModule = {
|
|
7266
7891
|
command: "deploy <filename>",
|
|
7267
7892
|
describe: "Deploys a custom edgehancer hook to run when a data resource of a specific archetype is fetched. The API key used must have team admin permissions.",
|
|
7268
|
-
builder: (
|
|
7893
|
+
builder: (yargs38) => withConfiguration(
|
|
7269
7894
|
withApiOptions(
|
|
7270
7895
|
withTeamOptions(
|
|
7271
7896
|
withEdgehancerIdOptions(
|
|
7272
|
-
|
|
7897
|
+
yargs38.positional("filename", {
|
|
7273
7898
|
demandOption: true,
|
|
7274
7899
|
describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
|
|
7275
7900
|
})
|
|
@@ -7289,7 +7914,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
7289
7914
|
var IntegrationEdgehancerRemoveModule = {
|
|
7290
7915
|
command: "remove",
|
|
7291
7916
|
describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
|
|
7292
|
-
builder: (
|
|
7917
|
+
builder: (yargs38) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs38)))),
|
|
7293
7918
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
|
|
7294
7919
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7295
7920
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
@@ -7301,9 +7926,9 @@ var IntegrationEdgehancerRemoveModule = {
|
|
|
7301
7926
|
var IntegrationEdgehancerModule = {
|
|
7302
7927
|
command: "edgehancer <command>",
|
|
7303
7928
|
describe: "Commands for managing custom integration edgehancers at the team level.",
|
|
7304
|
-
builder: (
|
|
7929
|
+
builder: (yargs38) => yargs38.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
|
|
7305
7930
|
handler: () => {
|
|
7306
|
-
|
|
7931
|
+
yargs26.help();
|
|
7307
7932
|
}
|
|
7308
7933
|
};
|
|
7309
7934
|
|
|
@@ -7343,10 +7968,10 @@ var DefinitionClient = class extends ApiClient2 {
|
|
|
7343
7968
|
var IntegrationDefinitionRegisterModule = {
|
|
7344
7969
|
command: "register <filename>",
|
|
7345
7970
|
describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
|
|
7346
|
-
builder: (
|
|
7971
|
+
builder: (yargs38) => withConfiguration(
|
|
7347
7972
|
withApiOptions(
|
|
7348
7973
|
withTeamOptions(
|
|
7349
|
-
|
|
7974
|
+
yargs38.positional("filename", {
|
|
7350
7975
|
demandOption: true,
|
|
7351
7976
|
describe: "Integration definition manifest to register"
|
|
7352
7977
|
})
|
|
@@ -7365,10 +7990,10 @@ var IntegrationDefinitionRegisterModule = {
|
|
|
7365
7990
|
var IntegrationDefinitionRemoveModule = {
|
|
7366
7991
|
command: "remove <type>",
|
|
7367
7992
|
describe: "Deletes a custom integration definition from a team. This will uninstall it on any active projects. Existing usages of the integration may break. The API key used must have team admin permissions.",
|
|
7368
|
-
builder: (
|
|
7993
|
+
builder: (yargs38) => withConfiguration(
|
|
7369
7994
|
withApiOptions(
|
|
7370
7995
|
withTeamOptions(
|
|
7371
|
-
|
|
7996
|
+
yargs38.positional("type", {
|
|
7372
7997
|
demandOption: true,
|
|
7373
7998
|
describe: "Integration type (from its manifest) to remove."
|
|
7374
7999
|
})
|
|
@@ -7386,9 +8011,9 @@ var IntegrationDefinitionRemoveModule = {
|
|
|
7386
8011
|
var IntegrationDefinitionModule = {
|
|
7387
8012
|
command: "definition <command>",
|
|
7388
8013
|
describe: "Commands for managing custom integration definitions at the team level.",
|
|
7389
|
-
builder: (
|
|
8014
|
+
builder: (yargs38) => yargs38.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).demandCommand(),
|
|
7390
8015
|
handler: () => {
|
|
7391
|
-
|
|
8016
|
+
yargs27.help();
|
|
7392
8017
|
}
|
|
7393
8018
|
};
|
|
7394
8019
|
|
|
@@ -7428,10 +8053,10 @@ var InstallClient = class extends ApiClient3 {
|
|
|
7428
8053
|
var IntegrationInstallModule = {
|
|
7429
8054
|
command: "install <type>",
|
|
7430
8055
|
describe: "Installs an integration to a project. The integration may be built-in or custom. Custom integrations must be registered to the parent team first.",
|
|
7431
|
-
builder: (
|
|
8056
|
+
builder: (yargs38) => withConfiguration(
|
|
7432
8057
|
withApiOptions(
|
|
7433
8058
|
withProjectOptions(
|
|
7434
|
-
|
|
8059
|
+
yargs38.positional("type", {
|
|
7435
8060
|
demandOption: true,
|
|
7436
8061
|
describe: "Integration type to install (as defined in its manifest)"
|
|
7437
8062
|
}).option("configuration", {
|
|
@@ -7453,10 +8078,10 @@ var IntegrationInstallModule = {
|
|
|
7453
8078
|
var IntegrationUninstallModule = {
|
|
7454
8079
|
command: "uninstall <type>",
|
|
7455
8080
|
describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
|
|
7456
|
-
builder: (
|
|
8081
|
+
builder: (yargs38) => withConfiguration(
|
|
7457
8082
|
withApiOptions(
|
|
7458
8083
|
withProjectOptions(
|
|
7459
|
-
|
|
8084
|
+
yargs38.positional("type", {
|
|
7460
8085
|
demandOption: true,
|
|
7461
8086
|
describe: "Integration type to uninstall (as defined in its manifest)"
|
|
7462
8087
|
})
|
|
@@ -7474,9 +8099,9 @@ var IntegrationUninstallModule = {
|
|
|
7474
8099
|
var IntegrationCommand = {
|
|
7475
8100
|
command: "integration <command>",
|
|
7476
8101
|
describe: "Integration management commands",
|
|
7477
|
-
builder: (
|
|
8102
|
+
builder: (yargs38) => yargs38.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
|
|
7478
8103
|
handler: () => {
|
|
7479
|
-
|
|
8104
|
+
yargs28.showHelp();
|
|
7480
8105
|
}
|
|
7481
8106
|
};
|
|
7482
8107
|
|
|
@@ -7504,7 +8129,7 @@ import { PostHog } from "posthog-node";
|
|
|
7504
8129
|
// package.json
|
|
7505
8130
|
var package_default = {
|
|
7506
8131
|
name: "@uniformdev/cli",
|
|
7507
|
-
version: "19.
|
|
8132
|
+
version: "19.200.0",
|
|
7508
8133
|
description: "Uniform command line interface tool",
|
|
7509
8134
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
7510
8135
|
main: "./cli.js",
|
|
@@ -8520,10 +9145,10 @@ var NewMeshCmd = {
|
|
|
8520
9145
|
};
|
|
8521
9146
|
|
|
8522
9147
|
// src/commands/optimize/index.ts
|
|
8523
|
-
import
|
|
9148
|
+
import yargs30 from "yargs";
|
|
8524
9149
|
|
|
8525
9150
|
// src/commands/optimize/manifest.ts
|
|
8526
|
-
import
|
|
9151
|
+
import yargs29 from "yargs";
|
|
8527
9152
|
|
|
8528
9153
|
// src/commands/optimize/manifest/download.ts
|
|
8529
9154
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -8538,7 +9163,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
8538
9163
|
var module = {
|
|
8539
9164
|
command: "download [output]",
|
|
8540
9165
|
describe: "Download intent manifest",
|
|
8541
|
-
builder: (
|
|
9166
|
+
builder: (yargs38) => yargs38.option("apiKey", {
|
|
8542
9167
|
alias: "k",
|
|
8543
9168
|
demandOption: true,
|
|
8544
9169
|
string: true,
|
|
@@ -8639,10 +9264,10 @@ var module2 = {
|
|
|
8639
9264
|
command: "manifest <command>",
|
|
8640
9265
|
describe: "Intent manifest commands",
|
|
8641
9266
|
builder: () => {
|
|
8642
|
-
return
|
|
9267
|
+
return yargs29.command(download_default);
|
|
8643
9268
|
},
|
|
8644
9269
|
handler: () => {
|
|
8645
|
-
|
|
9270
|
+
yargs29.showHelp();
|
|
8646
9271
|
}
|
|
8647
9272
|
};
|
|
8648
9273
|
var manifest_default = module2;
|
|
@@ -8653,29 +9278,29 @@ var OptimizeCommand = {
|
|
|
8653
9278
|
aliases: ["opt"],
|
|
8654
9279
|
describe: "Uniform Optimize commands",
|
|
8655
9280
|
builder: () => {
|
|
8656
|
-
return
|
|
9281
|
+
return yargs30.command(manifest_default);
|
|
8657
9282
|
},
|
|
8658
9283
|
handler: () => {
|
|
8659
|
-
|
|
9284
|
+
yargs30.showHelp();
|
|
8660
9285
|
}
|
|
8661
9286
|
};
|
|
8662
9287
|
|
|
8663
9288
|
// src/commands/project-map/index.ts
|
|
8664
|
-
import
|
|
9289
|
+
import yargs33 from "yargs";
|
|
8665
9290
|
|
|
8666
9291
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
8667
|
-
import
|
|
9292
|
+
import yargs31 from "yargs";
|
|
8668
9293
|
|
|
8669
9294
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
8670
9295
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
8671
9296
|
var ProjectMapDefinitionGetModule = {
|
|
8672
9297
|
command: "get <id>",
|
|
8673
9298
|
describe: "Fetch a project map",
|
|
8674
|
-
builder: (
|
|
9299
|
+
builder: (yargs38) => withFormatOptions(
|
|
8675
9300
|
withConfiguration(
|
|
8676
9301
|
withApiOptions(
|
|
8677
9302
|
withProjectOptions(
|
|
8678
|
-
|
|
9303
|
+
yargs38.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
8679
9304
|
)
|
|
8680
9305
|
)
|
|
8681
9306
|
)
|
|
@@ -8699,7 +9324,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
8699
9324
|
command: "list",
|
|
8700
9325
|
describe: "List of project maps",
|
|
8701
9326
|
aliases: ["ls"],
|
|
8702
|
-
builder: (
|
|
9327
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
8703
9328
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8704
9329
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8705
9330
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8720,8 +9345,8 @@ function writeContextPackage2(filename, packageContents) {
|
|
|
8720
9345
|
}
|
|
8721
9346
|
|
|
8722
9347
|
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
8723
|
-
var
|
|
8724
|
-
var
|
|
9348
|
+
var selectIdentifier13 = (source) => source.id;
|
|
9349
|
+
var selectDisplayName13 = (source) => `${source.name} (pid: ${source.id})`;
|
|
8725
9350
|
|
|
8726
9351
|
// src/commands/project-map/ProjectMapDefinitionEngineDataSource.ts
|
|
8727
9352
|
function createProjectMapDefinitionEngineDataSource({
|
|
@@ -8731,9 +9356,9 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8731
9356
|
const projectMaps = (await client.getProjectMapDefinitions()).projectMaps;
|
|
8732
9357
|
for await (const def of projectMaps) {
|
|
8733
9358
|
const result = {
|
|
8734
|
-
id:
|
|
8735
|
-
displayName:
|
|
8736
|
-
providerId:
|
|
9359
|
+
id: selectIdentifier13(def),
|
|
9360
|
+
displayName: selectDisplayName13(def),
|
|
9361
|
+
providerId: selectIdentifier13(def),
|
|
8737
9362
|
object: def
|
|
8738
9363
|
};
|
|
8739
9364
|
yield result;
|
|
@@ -8757,11 +9382,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8757
9382
|
var ProjectMapDefinitionPullModule = {
|
|
8758
9383
|
command: "pull <directory>",
|
|
8759
9384
|
describe: "Pulls all project maps to local files in a directory",
|
|
8760
|
-
builder: (
|
|
9385
|
+
builder: (yargs38) => withConfiguration(
|
|
8761
9386
|
withApiOptions(
|
|
8762
9387
|
withProjectOptions(
|
|
8763
9388
|
withDiffOptions(
|
|
8764
|
-
|
|
9389
|
+
yargs38.positional("directory", {
|
|
8765
9390
|
describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
8766
9391
|
type: "string"
|
|
8767
9392
|
}).option("format", {
|
|
@@ -8808,8 +9433,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
8808
9433
|
target = await createArraySyncEngineDataSource({
|
|
8809
9434
|
name: `Package file ${directory}`,
|
|
8810
9435
|
objects: packageContents.projectMaps ?? [],
|
|
8811
|
-
selectIdentifier:
|
|
8812
|
-
selectDisplayName:
|
|
9436
|
+
selectIdentifier: selectIdentifier13,
|
|
9437
|
+
selectDisplayName: selectDisplayName13,
|
|
8813
9438
|
onSyncComplete: async (_, synced) => {
|
|
8814
9439
|
packageContents.projectMaps = synced;
|
|
8815
9440
|
writeContextPackage2(directory, packageContents);
|
|
@@ -8818,8 +9443,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
8818
9443
|
} else {
|
|
8819
9444
|
target = await createFileSyncEngineDataSource({
|
|
8820
9445
|
directory,
|
|
8821
|
-
selectIdentifier:
|
|
8822
|
-
selectDisplayName:
|
|
9446
|
+
selectIdentifier: selectIdentifier13,
|
|
9447
|
+
selectDisplayName: selectDisplayName13,
|
|
8823
9448
|
format
|
|
8824
9449
|
});
|
|
8825
9450
|
}
|
|
@@ -8839,11 +9464,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
8839
9464
|
var ProjectMapDefinitionPushModule = {
|
|
8840
9465
|
command: "push <directory>",
|
|
8841
9466
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
8842
|
-
builder: (
|
|
9467
|
+
builder: (yargs38) => withConfiguration(
|
|
8843
9468
|
withApiOptions(
|
|
8844
9469
|
withProjectOptions(
|
|
8845
9470
|
withDiffOptions(
|
|
8846
|
-
|
|
9471
|
+
yargs38.positional("directory", {
|
|
8847
9472
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8848
9473
|
type: "string"
|
|
8849
9474
|
}).option("what-if", {
|
|
@@ -8882,14 +9507,14 @@ var ProjectMapDefinitionPushModule = {
|
|
|
8882
9507
|
source = await createArraySyncEngineDataSource({
|
|
8883
9508
|
name: `Package file ${directory}`,
|
|
8884
9509
|
objects: packageContents.projectMaps ?? [],
|
|
8885
|
-
selectIdentifier:
|
|
8886
|
-
selectDisplayName:
|
|
9510
|
+
selectIdentifier: selectIdentifier13,
|
|
9511
|
+
selectDisplayName: selectDisplayName13
|
|
8887
9512
|
});
|
|
8888
9513
|
} else {
|
|
8889
9514
|
source = await createFileSyncEngineDataSource({
|
|
8890
9515
|
directory,
|
|
8891
|
-
selectIdentifier:
|
|
8892
|
-
selectDisplayName:
|
|
9516
|
+
selectIdentifier: selectIdentifier13,
|
|
9517
|
+
selectDisplayName: selectDisplayName13
|
|
8893
9518
|
});
|
|
8894
9519
|
}
|
|
8895
9520
|
const target = createProjectMapDefinitionEngineDataSource({ client });
|
|
@@ -8910,9 +9535,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
8910
9535
|
command: "remove <id>",
|
|
8911
9536
|
aliases: ["delete", "rm"],
|
|
8912
9537
|
describe: "Delete a project map",
|
|
8913
|
-
builder: (
|
|
9538
|
+
builder: (yargs38) => withConfiguration(
|
|
8914
9539
|
withApiOptions(
|
|
8915
|
-
withProjectOptions(
|
|
9540
|
+
withProjectOptions(yargs38.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8916
9541
|
)
|
|
8917
9542
|
),
|
|
8918
9543
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8928,10 +9553,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8928
9553
|
command: "update <filename>",
|
|
8929
9554
|
aliases: ["put"],
|
|
8930
9555
|
describe: "Insert or update a project map",
|
|
8931
|
-
builder: (
|
|
9556
|
+
builder: (yargs38) => withConfiguration(
|
|
8932
9557
|
withApiOptions(
|
|
8933
9558
|
withProjectOptions(
|
|
8934
|
-
|
|
9559
|
+
yargs38.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
8935
9560
|
)
|
|
8936
9561
|
)
|
|
8937
9562
|
),
|
|
@@ -8947,25 +9572,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8947
9572
|
var ProjectMapDefinitionModule = {
|
|
8948
9573
|
command: "definition <command>",
|
|
8949
9574
|
describe: "Commands for ProjectMap Definitions",
|
|
8950
|
-
builder: (
|
|
9575
|
+
builder: (yargs38) => yargs38.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
8951
9576
|
handler: () => {
|
|
8952
|
-
|
|
9577
|
+
yargs31.help();
|
|
8953
9578
|
}
|
|
8954
9579
|
};
|
|
8955
9580
|
|
|
8956
9581
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
8957
|
-
import
|
|
9582
|
+
import yargs32 from "yargs";
|
|
8958
9583
|
|
|
8959
9584
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
8960
9585
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
8961
9586
|
var ProjectMapNodeGetModule = {
|
|
8962
9587
|
command: "get <id> <projectMapId>",
|
|
8963
9588
|
describe: "Fetch a project map node",
|
|
8964
|
-
builder: (
|
|
9589
|
+
builder: (yargs38) => withConfiguration(
|
|
8965
9590
|
withFormatOptions(
|
|
8966
9591
|
withApiOptions(
|
|
8967
9592
|
withProjectOptions(
|
|
8968
|
-
|
|
9593
|
+
yargs38.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
8969
9594
|
)
|
|
8970
9595
|
)
|
|
8971
9596
|
)
|
|
@@ -8990,12 +9615,12 @@ var ProjectMapNodeListModule = {
|
|
|
8990
9615
|
command: "list <projectMapId>",
|
|
8991
9616
|
describe: "List project map nodes",
|
|
8992
9617
|
aliases: ["ls"],
|
|
8993
|
-
builder: (
|
|
9618
|
+
builder: (yargs38) => withConfiguration(
|
|
8994
9619
|
withFormatOptions(
|
|
8995
9620
|
withApiOptions(
|
|
8996
9621
|
withProjectOptions(
|
|
8997
9622
|
withStateOptions(
|
|
8998
|
-
|
|
9623
|
+
yargs38.positional("projectMapId", {
|
|
8999
9624
|
demandOption: true,
|
|
9000
9625
|
describe: "ProjectMap UUID to fetch from"
|
|
9001
9626
|
})
|
|
@@ -9016,12 +9641,12 @@ var ProjectMapNodeListModule = {
|
|
|
9016
9641
|
import { UncachedProjectMapClient as UncachedProjectMapClient9 } from "@uniformdev/project-map";
|
|
9017
9642
|
|
|
9018
9643
|
// src/commands/project-map/commands/ProjectMapNode/_util.ts
|
|
9019
|
-
var
|
|
9644
|
+
var selectIdentifier14 = (source, projectId) => [
|
|
9020
9645
|
projectId + source.projectMapId + source.id,
|
|
9021
9646
|
projectId + source.projectMapId + source.path
|
|
9022
9647
|
];
|
|
9023
9648
|
var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
|
|
9024
|
-
var
|
|
9649
|
+
var selectDisplayName14 = (source) => `${source.name} (pid: ${source.id})`;
|
|
9025
9650
|
|
|
9026
9651
|
// src/commands/project-map/ProjectMapNodeEngineDataSource.ts
|
|
9027
9652
|
function createProjectMapNodeEngineDataSource({
|
|
@@ -9035,9 +9660,9 @@ function createProjectMapNodeEngineDataSource({
|
|
|
9035
9660
|
for await (const node of nodes ?? []) {
|
|
9036
9661
|
if (node) {
|
|
9037
9662
|
const result = {
|
|
9038
|
-
id:
|
|
9039
|
-
displayName:
|
|
9040
|
-
providerId:
|
|
9663
|
+
id: selectIdentifier14({ ...node, projectMapId: projectMap.id }, projectId),
|
|
9664
|
+
displayName: selectDisplayName14(node),
|
|
9665
|
+
providerId: selectIdentifier14({ ...node, projectMapId: projectMap.id }, projectId)[0],
|
|
9041
9666
|
object: { ...node, projectMapId: projectMap.id }
|
|
9042
9667
|
};
|
|
9043
9668
|
yield result;
|
|
@@ -9068,11 +9693,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
9068
9693
|
var ProjectMapNodePullModule = {
|
|
9069
9694
|
command: "pull <directory>",
|
|
9070
9695
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
9071
|
-
builder: (
|
|
9696
|
+
builder: (yargs38) => withConfiguration(
|
|
9072
9697
|
withApiOptions(
|
|
9073
9698
|
withProjectOptions(
|
|
9074
9699
|
withDiffOptions(
|
|
9075
|
-
|
|
9700
|
+
yargs38.positional("directory", {
|
|
9076
9701
|
describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
9077
9702
|
type: "string"
|
|
9078
9703
|
}).option("format", {
|
|
@@ -9115,7 +9740,7 @@ var ProjectMapNodePullModule = {
|
|
|
9115
9740
|
let target;
|
|
9116
9741
|
const isPackage = isPathAPackageFile(directory);
|
|
9117
9742
|
const expandedSelectIdentifier = (object) => {
|
|
9118
|
-
return
|
|
9743
|
+
return selectIdentifier14(object, projectId);
|
|
9119
9744
|
};
|
|
9120
9745
|
if (isPackage) {
|
|
9121
9746
|
const packageContents = readContextPackage2(directory, false);
|
|
@@ -9123,7 +9748,7 @@ var ProjectMapNodePullModule = {
|
|
|
9123
9748
|
name: `Package file ${directory}`,
|
|
9124
9749
|
objects: packageContents.projectMapNodes ?? [],
|
|
9125
9750
|
selectIdentifier: expandedSelectIdentifier,
|
|
9126
|
-
selectDisplayName:
|
|
9751
|
+
selectDisplayName: selectDisplayName14,
|
|
9127
9752
|
onSyncComplete: async (_, synced) => {
|
|
9128
9753
|
packageContents.projectMapNodes = synced;
|
|
9129
9754
|
writeContextPackage2(directory, packageContents);
|
|
@@ -9133,7 +9758,7 @@ var ProjectMapNodePullModule = {
|
|
|
9133
9758
|
target = await createFileSyncEngineDataSource({
|
|
9134
9759
|
directory,
|
|
9135
9760
|
selectIdentifier: expandedSelectIdentifier,
|
|
9136
|
-
selectDisplayName:
|
|
9761
|
+
selectDisplayName: selectDisplayName14,
|
|
9137
9762
|
format,
|
|
9138
9763
|
selectFilename
|
|
9139
9764
|
});
|
|
@@ -9157,11 +9782,11 @@ import {
|
|
|
9157
9782
|
var ProjectMapNodePushModule = {
|
|
9158
9783
|
command: "push <directory>",
|
|
9159
9784
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
9160
|
-
builder: (
|
|
9785
|
+
builder: (yargs38) => withConfiguration(
|
|
9161
9786
|
withApiOptions(
|
|
9162
9787
|
withProjectOptions(
|
|
9163
9788
|
withDiffOptions(
|
|
9164
|
-
|
|
9789
|
+
yargs38.positional("directory", {
|
|
9165
9790
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
9166
9791
|
type: "string"
|
|
9167
9792
|
}).option("what-if", {
|
|
@@ -9201,7 +9826,7 @@ var ProjectMapNodePushModule = {
|
|
|
9201
9826
|
let source;
|
|
9202
9827
|
const isPackage = isPathAPackageFile(directory);
|
|
9203
9828
|
const expandedSelectIdentifier = (object) => {
|
|
9204
|
-
return
|
|
9829
|
+
return selectIdentifier14(object, projectId);
|
|
9205
9830
|
};
|
|
9206
9831
|
if (isPackage) {
|
|
9207
9832
|
const packageContents = readContextPackage2(directory, true);
|
|
@@ -9211,13 +9836,13 @@ var ProjectMapNodePushModule = {
|
|
|
9211
9836
|
return a.path.length - b.path.length;
|
|
9212
9837
|
}) ?? [],
|
|
9213
9838
|
selectIdentifier: expandedSelectIdentifier,
|
|
9214
|
-
selectDisplayName:
|
|
9839
|
+
selectDisplayName: selectDisplayName14
|
|
9215
9840
|
});
|
|
9216
9841
|
} else {
|
|
9217
9842
|
source = await createFileSyncEngineDataSource({
|
|
9218
9843
|
directory,
|
|
9219
9844
|
selectIdentifier: expandedSelectIdentifier,
|
|
9220
|
-
selectDisplayName:
|
|
9845
|
+
selectDisplayName: selectDisplayName14,
|
|
9221
9846
|
selectFilename
|
|
9222
9847
|
});
|
|
9223
9848
|
}
|
|
@@ -9248,7 +9873,7 @@ var ProjectMapNodePushModule = {
|
|
|
9248
9873
|
name: `Nodes re-push from ${directory}`,
|
|
9249
9874
|
objects: Array.from(nodesFailedDueToMissingParent),
|
|
9250
9875
|
selectIdentifier: expandedSelectIdentifier,
|
|
9251
|
-
selectDisplayName:
|
|
9876
|
+
selectDisplayName: selectDisplayName14
|
|
9252
9877
|
});
|
|
9253
9878
|
await attemptSync();
|
|
9254
9879
|
} else {
|
|
@@ -9266,10 +9891,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
9266
9891
|
command: "remove <id> <projectMapId>",
|
|
9267
9892
|
aliases: ["delete", "rm"],
|
|
9268
9893
|
describe: "Delete a project map node",
|
|
9269
|
-
builder: (
|
|
9894
|
+
builder: (yargs38) => withConfiguration(
|
|
9270
9895
|
withApiOptions(
|
|
9271
9896
|
withProjectOptions(
|
|
9272
|
-
|
|
9897
|
+
yargs38.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
9273
9898
|
)
|
|
9274
9899
|
)
|
|
9275
9900
|
),
|
|
@@ -9286,10 +9911,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
9286
9911
|
command: "update <filename> <projectMapId>",
|
|
9287
9912
|
aliases: ["put"],
|
|
9288
9913
|
describe: "Insert or update a project map node",
|
|
9289
|
-
builder: (
|
|
9914
|
+
builder: (yargs38) => withConfiguration(
|
|
9290
9915
|
withApiOptions(
|
|
9291
9916
|
withProjectOptions(
|
|
9292
|
-
|
|
9917
|
+
yargs38.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
9293
9918
|
)
|
|
9294
9919
|
)
|
|
9295
9920
|
),
|
|
@@ -9305,9 +9930,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
9305
9930
|
var ProjectMapNodeModule = {
|
|
9306
9931
|
command: "node <command>",
|
|
9307
9932
|
describe: "Commands for ProjectMap Nodes",
|
|
9308
|
-
builder: (
|
|
9933
|
+
builder: (yargs38) => yargs38.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
9309
9934
|
handler: () => {
|
|
9310
|
-
|
|
9935
|
+
yargs32.help();
|
|
9311
9936
|
}
|
|
9312
9937
|
};
|
|
9313
9938
|
|
|
@@ -9316,28 +9941,28 @@ var ProjectMapCommand = {
|
|
|
9316
9941
|
command: "project-map <command>",
|
|
9317
9942
|
aliases: ["prm"],
|
|
9318
9943
|
describe: "Uniform ProjectMap commands",
|
|
9319
|
-
builder: (
|
|
9944
|
+
builder: (yargs38) => yargs38.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
9320
9945
|
handler: () => {
|
|
9321
|
-
|
|
9946
|
+
yargs33.showHelp();
|
|
9322
9947
|
}
|
|
9323
9948
|
};
|
|
9324
9949
|
|
|
9325
9950
|
// src/commands/redirect/index.ts
|
|
9326
|
-
import
|
|
9951
|
+
import yargs35 from "yargs";
|
|
9327
9952
|
|
|
9328
9953
|
// src/commands/redirect/commands/redirect.ts
|
|
9329
|
-
import
|
|
9954
|
+
import yargs34 from "yargs";
|
|
9330
9955
|
|
|
9331
9956
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
9332
9957
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
9333
9958
|
var RedirectDefinitionGetModule = {
|
|
9334
9959
|
command: "get <id>",
|
|
9335
9960
|
describe: "Fetch a redirect",
|
|
9336
|
-
builder: (
|
|
9961
|
+
builder: (yargs38) => withConfiguration(
|
|
9337
9962
|
withFormatOptions(
|
|
9338
9963
|
withApiOptions(
|
|
9339
9964
|
withProjectOptions(
|
|
9340
|
-
|
|
9965
|
+
yargs38.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
9341
9966
|
)
|
|
9342
9967
|
)
|
|
9343
9968
|
)
|
|
@@ -9361,7 +9986,7 @@ var RedirectDefinitionListModule = {
|
|
|
9361
9986
|
command: "list",
|
|
9362
9987
|
describe: "List of redirects",
|
|
9363
9988
|
aliases: ["ls"],
|
|
9364
|
-
builder: (
|
|
9989
|
+
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
9365
9990
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
9366
9991
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9367
9992
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -9382,12 +10007,12 @@ function writeContextPackage3(filename, packageContents) {
|
|
|
9382
10007
|
}
|
|
9383
10008
|
|
|
9384
10009
|
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
9385
|
-
var
|
|
10010
|
+
var selectIdentifier15 = (source) => source.id;
|
|
9386
10011
|
var selectFilename2 = (source) => {
|
|
9387
10012
|
const index = source.sourceUrl.lastIndexOf("/");
|
|
9388
10013
|
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
9389
10014
|
};
|
|
9390
|
-
var
|
|
10015
|
+
var selectDisplayName15 = (source) => {
|
|
9391
10016
|
let pathName = source.sourceUrl;
|
|
9392
10017
|
if (pathName.length > 30) {
|
|
9393
10018
|
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
@@ -9404,9 +10029,9 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
9404
10029
|
const redirects = client.getAllRedirects();
|
|
9405
10030
|
for await (const redirect of redirects) {
|
|
9406
10031
|
const result = {
|
|
9407
|
-
id:
|
|
9408
|
-
displayName:
|
|
9409
|
-
providerId:
|
|
10032
|
+
id: selectIdentifier15(redirect.redirect),
|
|
10033
|
+
displayName: selectDisplayName15(redirect.redirect),
|
|
10034
|
+
providerId: selectIdentifier15(redirect.redirect),
|
|
9410
10035
|
object: redirect.redirect
|
|
9411
10036
|
};
|
|
9412
10037
|
yield result;
|
|
@@ -9428,11 +10053,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
9428
10053
|
var RedirectDefinitionPullModule = {
|
|
9429
10054
|
command: "pull <directory>",
|
|
9430
10055
|
describe: "Pulls all redirects to local files in a directory",
|
|
9431
|
-
builder: (
|
|
10056
|
+
builder: (yargs38) => withConfiguration(
|
|
9432
10057
|
withApiOptions(
|
|
9433
10058
|
withProjectOptions(
|
|
9434
10059
|
withDiffOptions(
|
|
9435
|
-
|
|
10060
|
+
yargs38.positional("directory", {
|
|
9436
10061
|
describe: "Directory to save redirects to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
9437
10062
|
type: "string"
|
|
9438
10063
|
}).option("format", {
|
|
@@ -9479,8 +10104,8 @@ var RedirectDefinitionPullModule = {
|
|
|
9479
10104
|
target = await createArraySyncEngineDataSource({
|
|
9480
10105
|
name: `Package file ${directory}`,
|
|
9481
10106
|
objects: packageContents.redirects ?? [],
|
|
9482
|
-
selectIdentifier:
|
|
9483
|
-
selectDisplayName:
|
|
10107
|
+
selectIdentifier: selectIdentifier15,
|
|
10108
|
+
selectDisplayName: selectDisplayName15,
|
|
9484
10109
|
onSyncComplete: async (_, synced) => {
|
|
9485
10110
|
packageContents.redirects = synced;
|
|
9486
10111
|
writeContextPackage3(directory, packageContents);
|
|
@@ -9490,8 +10115,8 @@ var RedirectDefinitionPullModule = {
|
|
|
9490
10115
|
target = await createFileSyncEngineDataSource({
|
|
9491
10116
|
directory,
|
|
9492
10117
|
selectFilename: selectFilename2,
|
|
9493
|
-
selectIdentifier:
|
|
9494
|
-
selectDisplayName:
|
|
10118
|
+
selectIdentifier: selectIdentifier15,
|
|
10119
|
+
selectDisplayName: selectDisplayName15,
|
|
9495
10120
|
format
|
|
9496
10121
|
});
|
|
9497
10122
|
}
|
|
@@ -9511,11 +10136,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
9511
10136
|
var RedirectDefinitionPushModule = {
|
|
9512
10137
|
command: "push <directory>",
|
|
9513
10138
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
9514
|
-
builder: (
|
|
10139
|
+
builder: (yargs38) => withConfiguration(
|
|
9515
10140
|
withApiOptions(
|
|
9516
10141
|
withProjectOptions(
|
|
9517
10142
|
withDiffOptions(
|
|
9518
|
-
|
|
10143
|
+
yargs38.positional("directory", {
|
|
9519
10144
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
9520
10145
|
type: "string"
|
|
9521
10146
|
}).option("what-if", {
|
|
@@ -9554,14 +10179,14 @@ var RedirectDefinitionPushModule = {
|
|
|
9554
10179
|
source = await createArraySyncEngineDataSource({
|
|
9555
10180
|
name: `Package file ${directory}`,
|
|
9556
10181
|
objects: packageContents.redirects ?? [],
|
|
9557
|
-
selectIdentifier:
|
|
9558
|
-
selectDisplayName:
|
|
10182
|
+
selectIdentifier: selectIdentifier15,
|
|
10183
|
+
selectDisplayName: selectDisplayName15
|
|
9559
10184
|
});
|
|
9560
10185
|
} else {
|
|
9561
10186
|
source = await createFileSyncEngineDataSource({
|
|
9562
10187
|
directory,
|
|
9563
|
-
selectIdentifier:
|
|
9564
|
-
selectDisplayName:
|
|
10188
|
+
selectIdentifier: selectIdentifier15,
|
|
10189
|
+
selectDisplayName: selectDisplayName15
|
|
9565
10190
|
});
|
|
9566
10191
|
}
|
|
9567
10192
|
const target = createRedirectDefinitionEngineDataSource({ client });
|
|
@@ -9582,9 +10207,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
9582
10207
|
command: "remove <id>",
|
|
9583
10208
|
aliases: ["delete", "rm"],
|
|
9584
10209
|
describe: "Delete a redirect",
|
|
9585
|
-
builder: (
|
|
10210
|
+
builder: (yargs38) => withConfiguration(
|
|
9586
10211
|
withApiOptions(
|
|
9587
|
-
withProjectOptions(
|
|
10212
|
+
withProjectOptions(yargs38.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
9588
10213
|
)
|
|
9589
10214
|
),
|
|
9590
10215
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -9600,10 +10225,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
9600
10225
|
command: "update <filename>",
|
|
9601
10226
|
aliases: ["put"],
|
|
9602
10227
|
describe: "Insert or update a redirect",
|
|
9603
|
-
builder: (
|
|
10228
|
+
builder: (yargs38) => withConfiguration(
|
|
9604
10229
|
withApiOptions(
|
|
9605
10230
|
withProjectOptions(
|
|
9606
|
-
|
|
10231
|
+
yargs38.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
9607
10232
|
)
|
|
9608
10233
|
)
|
|
9609
10234
|
),
|
|
@@ -9619,9 +10244,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
9619
10244
|
var RedirectDefinitionModule = {
|
|
9620
10245
|
command: "definition <command>",
|
|
9621
10246
|
describe: "Commands for Redirect Definitions",
|
|
9622
|
-
builder: (
|
|
10247
|
+
builder: (yargs38) => yargs38.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
9623
10248
|
handler: () => {
|
|
9624
|
-
|
|
10249
|
+
yargs34.help();
|
|
9625
10250
|
}
|
|
9626
10251
|
};
|
|
9627
10252
|
|
|
@@ -9630,14 +10255,14 @@ var RedirectCommand = {
|
|
|
9630
10255
|
command: "redirect <command>",
|
|
9631
10256
|
aliases: ["red"],
|
|
9632
10257
|
describe: "Uniform Redirect commands",
|
|
9633
|
-
builder: (
|
|
10258
|
+
builder: (yargs38) => yargs38.command(RedirectDefinitionModule).demandCommand(),
|
|
9634
10259
|
handler: () => {
|
|
9635
|
-
|
|
10260
|
+
yargs35.showHelp();
|
|
9636
10261
|
}
|
|
9637
10262
|
};
|
|
9638
10263
|
|
|
9639
10264
|
// src/commands/sync/index.ts
|
|
9640
|
-
import
|
|
10265
|
+
import yargs36 from "yargs";
|
|
9641
10266
|
|
|
9642
10267
|
// src/commands/sync/commands/util.ts
|
|
9643
10268
|
import ora2 from "ora";
|
|
@@ -9697,16 +10322,18 @@ function patchConsole(fn, ora3, replay = []) {
|
|
|
9697
10322
|
var SyncPullModule = {
|
|
9698
10323
|
command: "pull",
|
|
9699
10324
|
describe: "Pulls whole project to local files in a directory",
|
|
9700
|
-
builder: (
|
|
10325
|
+
builder: (yargs38) => withConfiguration(
|
|
9701
10326
|
withApiOptions(
|
|
9702
10327
|
withProjectOptions(
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
10328
|
+
withDebugOptions(
|
|
10329
|
+
withDiffOptions(
|
|
10330
|
+
yargs38.option("what-if", {
|
|
10331
|
+
alias: ["w"],
|
|
10332
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
10333
|
+
default: false,
|
|
10334
|
+
type: "boolean"
|
|
10335
|
+
})
|
|
10336
|
+
)
|
|
9710
10337
|
)
|
|
9711
10338
|
)
|
|
9712
10339
|
)
|
|
@@ -9735,7 +10362,9 @@ var SyncPullModule = {
|
|
|
9735
10362
|
redirect: RedirectDefinitionPullModule,
|
|
9736
10363
|
entry: EntryPullModule,
|
|
9737
10364
|
entryPattern: EntryPatternPullModule,
|
|
9738
|
-
contentType: ContentTypePullModule
|
|
10365
|
+
contentType: ContentTypePullModule,
|
|
10366
|
+
previewUrl: PreviewUrlPullModule,
|
|
10367
|
+
previewViewport: PreviewViewportPullModule
|
|
9739
10368
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9740
10369
|
}).filter(([entityType]) => {
|
|
9741
10370
|
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.pull?.disabled !== true;
|
|
@@ -9807,20 +10436,7 @@ var getFormat = (entityType, config2) => {
|
|
|
9807
10436
|
var SyncPushModule = {
|
|
9808
10437
|
command: "push",
|
|
9809
10438
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
9810
|
-
builder: (
|
|
9811
|
-
withApiOptions(
|
|
9812
|
-
withProjectOptions(
|
|
9813
|
-
withDiffOptions(
|
|
9814
|
-
yargs36.option("what-if", {
|
|
9815
|
-
alias: ["w"],
|
|
9816
|
-
describe: "What-if mode reports what would be done but changes nothing",
|
|
9817
|
-
default: false,
|
|
9818
|
-
type: "boolean"
|
|
9819
|
-
})
|
|
9820
|
-
)
|
|
9821
|
-
)
|
|
9822
|
-
)
|
|
9823
|
-
),
|
|
10439
|
+
builder: (yargs38) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs38))))),
|
|
9824
10440
|
handler: async ({ serialization, ...otherParams }) => {
|
|
9825
10441
|
const config2 = serialization;
|
|
9826
10442
|
const enabledEntities = Object.entries({
|
|
@@ -9845,7 +10461,9 @@ var SyncPushModule = {
|
|
|
9845
10461
|
redirect: RedirectDefinitionPushModule,
|
|
9846
10462
|
contentType: ContentTypePushModule,
|
|
9847
10463
|
entry: EntryPushModule,
|
|
9848
|
-
entryPattern: EntryPatternPushModule
|
|
10464
|
+
entryPattern: EntryPatternPushModule,
|
|
10465
|
+
previewUrl: PreviewUrlPushModule,
|
|
10466
|
+
previewViewport: PreviewViewportPushModule
|
|
9849
10467
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9850
10468
|
}).filter(([entityType]) => {
|
|
9851
10469
|
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.push?.disabled !== true;
|
|
@@ -9928,9 +10546,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
9928
10546
|
var SyncCommand = {
|
|
9929
10547
|
command: "sync <command>",
|
|
9930
10548
|
describe: "Uniform Sync commands",
|
|
9931
|
-
builder: (
|
|
10549
|
+
builder: (yargs38) => yargs38.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
9932
10550
|
handler: () => {
|
|
9933
|
-
|
|
10551
|
+
yargs36.showHelp();
|
|
9934
10552
|
}
|
|
9935
10553
|
};
|
|
9936
10554
|
|
|
@@ -10065,7 +10683,7 @@ var getMostRecent = async ({ full, scope }, distTag, timeout) => {
|
|
|
10065
10683
|
var defaultConfig = {
|
|
10066
10684
|
interval: 36e5,
|
|
10067
10685
|
distTag: "latest",
|
|
10068
|
-
timeout:
|
|
10686
|
+
timeout: 5e3
|
|
10069
10687
|
};
|
|
10070
10688
|
var getDetails = (name) => {
|
|
10071
10689
|
const spec = {
|
|
@@ -10096,6 +10714,13 @@ async function updateCheck_default(pkg, config2 = {}) {
|
|
|
10096
10714
|
({ shouldCheck, latest } = await evaluateCache(file, time, interval));
|
|
10097
10715
|
if (shouldCheck) {
|
|
10098
10716
|
latest = await getMostRecent(details, distTag, timeout);
|
|
10717
|
+
if (config2.verbose) {
|
|
10718
|
+
console.log("CLI package latest version check", {
|
|
10719
|
+
latest,
|
|
10720
|
+
current: pkg.version,
|
|
10721
|
+
tempFileWithLastUpdateCheck: file
|
|
10722
|
+
});
|
|
10723
|
+
}
|
|
10099
10724
|
await updateCache(file, latest, time);
|
|
10100
10725
|
}
|
|
10101
10726
|
const comparision = compareVersions(pkg.version, latest);
|
|
@@ -10109,19 +10734,19 @@ async function updateCheck_default(pkg, config2 = {}) {
|
|
|
10109
10734
|
}
|
|
10110
10735
|
|
|
10111
10736
|
// src/middleware/checkForUpdateMiddleware.ts
|
|
10112
|
-
async
|
|
10737
|
+
var checkForUpdateMiddleware = async ({ verbose }) => {
|
|
10113
10738
|
try {
|
|
10114
10739
|
if (process.env.NO_UPDATE_CHECK || process.env.CI) {
|
|
10115
10740
|
return;
|
|
10116
10741
|
}
|
|
10117
|
-
const update = await updateCheck_default(package_default);
|
|
10742
|
+
const update = await updateCheck_default(package_default, { verbose });
|
|
10118
10743
|
if (update) {
|
|
10119
10744
|
logCallout(`${bold("Update Available:")} ${gray5(package_default.version)} \u226B ${green4(update.latest)}`);
|
|
10120
10745
|
}
|
|
10121
10746
|
} catch (e) {
|
|
10122
10747
|
console.error(`There was an error checking for updates`, e);
|
|
10123
10748
|
}
|
|
10124
|
-
}
|
|
10749
|
+
};
|
|
10125
10750
|
|
|
10126
10751
|
// src/middleware/checkLocalDepsVersionsMiddleware.ts
|
|
10127
10752
|
import { magenta, red as red6 } from "colorette";
|
|
@@ -10195,7 +10820,7 @@ First found was: v${firstVersion}`;
|
|
|
10195
10820
|
|
|
10196
10821
|
// src/index.ts
|
|
10197
10822
|
dotenv.config();
|
|
10198
|
-
var yarggery =
|
|
10823
|
+
var yarggery = yargs37(hideBin(process.argv));
|
|
10199
10824
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
10200
10825
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
10201
10826
|
yarggery.option("verbose", {
|