@uniformdev/cli 19.150.0 → 19.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +815 -510
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.
|
|
10
|
+
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.2_postcss@8.4.38_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
import path from "path";
|
|
13
13
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -16,11 +16,11 @@ var __dirname = /* @__PURE__ */ getDirname();
|
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
import * as dotenv from "dotenv";
|
|
19
|
-
import
|
|
19
|
+
import yargs33 from "yargs";
|
|
20
20
|
import { hideBin } from "yargs/helpers";
|
|
21
21
|
|
|
22
22
|
// src/commands/canvas/index.ts
|
|
23
|
-
import
|
|
23
|
+
import yargs14 from "yargs";
|
|
24
24
|
|
|
25
25
|
// src/commands/canvas/commands/asset.ts
|
|
26
26
|
import yargs from "yargs";
|
|
@@ -30,21 +30,22 @@ import { UncachedAssetClient } from "@uniformdev/assets";
|
|
|
30
30
|
|
|
31
31
|
// src/sync/arraySyncEngineDataSource.ts
|
|
32
32
|
async function createArraySyncEngineDataSource({
|
|
33
|
+
name,
|
|
33
34
|
objects,
|
|
34
|
-
selectIdentifier:
|
|
35
|
-
selectDisplayName:
|
|
35
|
+
selectIdentifier: selectIdentifier14,
|
|
36
|
+
selectDisplayName: selectDisplayName14 = selectIdentifier14,
|
|
36
37
|
onSyncComplete,
|
|
37
38
|
onBeforeDeleteObject
|
|
38
39
|
}) {
|
|
39
40
|
const objectIndex = objects.reduce(
|
|
40
41
|
(result, current) => {
|
|
41
|
-
const rawIdentifiers =
|
|
42
|
+
const rawIdentifiers = selectIdentifier14(current);
|
|
42
43
|
const identifiers = Array.isArray(rawIdentifiers) ? rawIdentifiers : [rawIdentifiers];
|
|
43
44
|
const existingResult = identifiers.find((id) => result[id]);
|
|
44
45
|
if (existingResult) {
|
|
45
46
|
throw new Error(`Identifier(s) ${identifiers} was not unique.`);
|
|
46
47
|
}
|
|
47
|
-
const displayName =
|
|
48
|
+
const displayName = selectDisplayName14(current);
|
|
48
49
|
result[identifiers[0]] = {
|
|
49
50
|
id: identifiers,
|
|
50
51
|
object: current,
|
|
@@ -66,6 +67,7 @@ async function createArraySyncEngineDataSource({
|
|
|
66
67
|
return Object.entries(objectIndex).filter((entry) => typeof entry[1] === "object").sort((a, b) => a[0].localeCompare(b[0])).map((entry) => entry[1].object);
|
|
67
68
|
}
|
|
68
69
|
return {
|
|
70
|
+
name,
|
|
69
71
|
objects: getObjects(),
|
|
70
72
|
deleteObject: async (providerId, object) => {
|
|
71
73
|
if (onBeforeDeleteObject) {
|
|
@@ -74,7 +76,7 @@ async function createArraySyncEngineDataSource({
|
|
|
74
76
|
delete objectIndex[providerId];
|
|
75
77
|
},
|
|
76
78
|
writeObject: async (objectToWrite) => {
|
|
77
|
-
const id =
|
|
79
|
+
const id = selectIdentifier14(objectToWrite.object);
|
|
78
80
|
if (Array.isArray(id)) {
|
|
79
81
|
objectIndex[id[0]] = objectToWrite;
|
|
80
82
|
} else {
|
|
@@ -136,14 +138,14 @@ import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
136
138
|
import { dump, load } from "js-yaml";
|
|
137
139
|
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
138
140
|
import { fetch as undiciFetch, ProxyAgent } from "undici";
|
|
139
|
-
function withConfiguration(
|
|
140
|
-
return
|
|
141
|
+
function withConfiguration(yargs34) {
|
|
142
|
+
return yargs34.option("serialization", {
|
|
141
143
|
skipValidation: true,
|
|
142
144
|
hidden: true
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
|
-
function withApiOptions(
|
|
146
|
-
return
|
|
147
|
+
function withApiOptions(yargs34) {
|
|
148
|
+
return yargs34.option("apiKey", {
|
|
147
149
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
148
150
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
149
151
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -182,8 +184,8 @@ function nodeFetchProxy(proxy) {
|
|
|
182
184
|
};
|
|
183
185
|
return wrappedFetch;
|
|
184
186
|
}
|
|
185
|
-
function withProjectOptions(
|
|
186
|
-
return
|
|
187
|
+
function withProjectOptions(yargs34) {
|
|
188
|
+
return yargs34.option("project", {
|
|
187
189
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
188
190
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
189
191
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -193,8 +195,8 @@ function withProjectOptions(yargs33) {
|
|
|
193
195
|
alias: ["p"]
|
|
194
196
|
});
|
|
195
197
|
}
|
|
196
|
-
function withTeamOptions(
|
|
197
|
-
return
|
|
198
|
+
function withTeamOptions(yargs34) {
|
|
199
|
+
return yargs34.option("team", {
|
|
198
200
|
describe: "Uniform team ID. Defaults to UNIFORM_CLI_TEAM_ID or UNIFORM_TEAM_ID env. Supports dotenv.",
|
|
199
201
|
default: process.env.UNIFORM_CLI_TEAM_ID ?? process.env.UNIFORM_TEAM_ID,
|
|
200
202
|
demandOption: true,
|
|
@@ -202,8 +204,8 @@ function withTeamOptions(yargs33) {
|
|
|
202
204
|
alias: ["p"]
|
|
203
205
|
});
|
|
204
206
|
}
|
|
205
|
-
function withFormatOptions(
|
|
206
|
-
return
|
|
207
|
+
function withFormatOptions(yargs34) {
|
|
208
|
+
return yargs34.option("format", {
|
|
207
209
|
alias: ["f"],
|
|
208
210
|
describe: "Output format",
|
|
209
211
|
default: "yaml",
|
|
@@ -215,8 +217,8 @@ function withFormatOptions(yargs33) {
|
|
|
215
217
|
type: "string"
|
|
216
218
|
});
|
|
217
219
|
}
|
|
218
|
-
function withDiffOptions(
|
|
219
|
-
return
|
|
220
|
+
function withDiffOptions(yargs34) {
|
|
221
|
+
return yargs34.option("diff", {
|
|
220
222
|
describe: "Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",
|
|
221
223
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
222
224
|
type: "string",
|
|
@@ -373,8 +375,8 @@ var getDirectoryOrFilename = ({
|
|
|
373
375
|
async function createFileSyncEngineDataSource({
|
|
374
376
|
directory,
|
|
375
377
|
format = "yaml",
|
|
376
|
-
selectIdentifier:
|
|
377
|
-
selectDisplayName:
|
|
378
|
+
selectIdentifier: selectIdentifier14,
|
|
379
|
+
selectDisplayName: selectDisplayName14 = selectIdentifier14,
|
|
378
380
|
selectFilename: selectFilename3,
|
|
379
381
|
selectSchemaUrl: selectSchemaUrl2,
|
|
380
382
|
onBeforeDeleteObject
|
|
@@ -396,9 +398,9 @@ async function createFileSyncEngineDataSource({
|
|
|
396
398
|
const fullFilename = join(directory, filename);
|
|
397
399
|
try {
|
|
398
400
|
const contents = await readFileToObject(fullFilename);
|
|
399
|
-
const displayName =
|
|
401
|
+
const displayName = selectDisplayName14(contents);
|
|
400
402
|
const object = {
|
|
401
|
-
id:
|
|
403
|
+
id: selectIdentifier14(contents),
|
|
402
404
|
displayName: Array.isArray(displayName) ? displayName[0] : displayName,
|
|
403
405
|
providerId: fullFilename,
|
|
404
406
|
object: omit(contents, ["$schema"])
|
|
@@ -412,6 +414,7 @@ ${e == null ? void 0 : e.message}`));
|
|
|
412
414
|
}
|
|
413
415
|
}
|
|
414
416
|
return {
|
|
417
|
+
name: `files in ${directory}`,
|
|
415
418
|
objects: getObjects(),
|
|
416
419
|
deleteObject: async (providerId, object) => {
|
|
417
420
|
if (onBeforeDeleteObject) {
|
|
@@ -574,7 +577,7 @@ async function syncEngine({
|
|
|
574
577
|
if (mode === "mirror") {
|
|
575
578
|
if (!sourceHasItems && !allowEmptySource && targetItems.size > 0) {
|
|
576
579
|
throw new Error(
|
|
577
|
-
|
|
580
|
+
`Sync source (${source.name}) is empty and mode is mirror. This would cause deletion of everything in the target (${target.name}), and most likely indicates an error in source definition.`
|
|
578
581
|
);
|
|
579
582
|
}
|
|
580
583
|
const deletes = [];
|
|
@@ -642,12 +645,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
642
645
|
var AssetGetModule = {
|
|
643
646
|
command: "get <id>",
|
|
644
647
|
describe: "Get an asset",
|
|
645
|
-
builder: (
|
|
648
|
+
builder: (yargs34) => withConfiguration(
|
|
646
649
|
withFormatOptions(
|
|
647
650
|
withApiOptions(
|
|
648
651
|
withProjectOptions(
|
|
649
652
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
650
|
-
|
|
653
|
+
yargs34.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
651
654
|
)
|
|
652
655
|
)
|
|
653
656
|
)
|
|
@@ -668,7 +671,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
|
|
|
668
671
|
var AssetListModule = {
|
|
669
672
|
command: "list",
|
|
670
673
|
describe: "List assets",
|
|
671
|
-
builder: (
|
|
674
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
672
675
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
673
676
|
const fetch3 = nodeFetchProxy(proxy);
|
|
674
677
|
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1024,8 +1027,8 @@ function prepCompositionForDisk(composition) {
|
|
|
1024
1027
|
delete prepped.state;
|
|
1025
1028
|
return prepped;
|
|
1026
1029
|
}
|
|
1027
|
-
function withStateOptions(
|
|
1028
|
-
return
|
|
1030
|
+
function withStateOptions(yargs34, defaultState = "preview") {
|
|
1031
|
+
return yargs34.option("state", {
|
|
1029
1032
|
type: "string",
|
|
1030
1033
|
describe: `State to fetch.`,
|
|
1031
1034
|
choices: ["preview", "published"],
|
|
@@ -1069,6 +1072,7 @@ function createAssetEngineDataSource({
|
|
|
1069
1072
|
}
|
|
1070
1073
|
}
|
|
1071
1074
|
return {
|
|
1075
|
+
name: "Uniform API",
|
|
1072
1076
|
objects: getObjects(),
|
|
1073
1077
|
deleteObject: async (providerId) => {
|
|
1074
1078
|
await client.delete({ assetId: providerId });
|
|
@@ -1091,11 +1095,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
1091
1095
|
var AssetPullModule = {
|
|
1092
1096
|
command: "pull <directory>",
|
|
1093
1097
|
describe: "Pulls all assets to local files in a directory",
|
|
1094
|
-
builder: (
|
|
1098
|
+
builder: (yargs34) => withConfiguration(
|
|
1095
1099
|
withApiOptions(
|
|
1096
1100
|
withProjectOptions(
|
|
1097
1101
|
withDiffOptions(
|
|
1098
|
-
|
|
1102
|
+
yargs34.positional("directory", {
|
|
1099
1103
|
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.",
|
|
1100
1104
|
type: "string"
|
|
1101
1105
|
}).option("format", {
|
|
@@ -1156,6 +1160,7 @@ var AssetPullModule = {
|
|
|
1156
1160
|
if (isPackage) {
|
|
1157
1161
|
const packageContents = readCanvasPackage(directory, false);
|
|
1158
1162
|
target = await createArraySyncEngineDataSource({
|
|
1163
|
+
name: `Package file ${directory}`,
|
|
1159
1164
|
objects: packageContents.assets ?? [],
|
|
1160
1165
|
selectIdentifier: selectAssetIdentifier,
|
|
1161
1166
|
selectDisplayName: selectAssetDisplayName,
|
|
@@ -1214,11 +1219,11 @@ import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
|
1214
1219
|
var AssetPushModule = {
|
|
1215
1220
|
command: "push <directory>",
|
|
1216
1221
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1217
|
-
builder: (
|
|
1222
|
+
builder: (yargs34) => withConfiguration(
|
|
1218
1223
|
withApiOptions(
|
|
1219
1224
|
withProjectOptions(
|
|
1220
1225
|
withDiffOptions(
|
|
1221
|
-
|
|
1226
|
+
yargs34.positional("directory", {
|
|
1222
1227
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1223
1228
|
type: "string"
|
|
1224
1229
|
}).option("what-if", {
|
|
@@ -1260,6 +1265,7 @@ var AssetPushModule = {
|
|
|
1260
1265
|
if (isPackage) {
|
|
1261
1266
|
const packageContents = readCanvasPackage(directory, true);
|
|
1262
1267
|
source = await createArraySyncEngineDataSource({
|
|
1268
|
+
name: `Package file ${directory}`,
|
|
1263
1269
|
objects: packageContents.assets ?? [],
|
|
1264
1270
|
selectIdentifier: selectAssetIdentifier,
|
|
1265
1271
|
selectDisplayName: selectAssetDisplayName
|
|
@@ -1318,9 +1324,9 @@ var AssetRemoveModule = {
|
|
|
1318
1324
|
command: "remove <id>",
|
|
1319
1325
|
aliases: ["delete", "rm"],
|
|
1320
1326
|
describe: "Delete an asset",
|
|
1321
|
-
builder: (
|
|
1327
|
+
builder: (yargs34) => withConfiguration(
|
|
1322
1328
|
withApiOptions(
|
|
1323
|
-
withProjectOptions(
|
|
1329
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1324
1330
|
)
|
|
1325
1331
|
),
|
|
1326
1332
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1336,10 +1342,10 @@ var AssetUpdateModule = {
|
|
|
1336
1342
|
command: "update <filename>",
|
|
1337
1343
|
aliases: ["put"],
|
|
1338
1344
|
describe: "Insert or update an asset",
|
|
1339
|
-
builder: (
|
|
1345
|
+
builder: (yargs34) => withConfiguration(
|
|
1340
1346
|
withApiOptions(
|
|
1341
1347
|
withProjectOptions(
|
|
1342
|
-
|
|
1348
|
+
yargs34.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1343
1349
|
)
|
|
1344
1350
|
)
|
|
1345
1351
|
),
|
|
@@ -1355,7 +1361,7 @@ var AssetUpdateModule = {
|
|
|
1355
1361
|
var AssetModule = {
|
|
1356
1362
|
command: "asset <command>",
|
|
1357
1363
|
describe: "Commands for Assets",
|
|
1358
|
-
builder: (
|
|
1364
|
+
builder: (yargs34) => yargs34.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1359
1365
|
handler: () => {
|
|
1360
1366
|
yargs.help();
|
|
1361
1367
|
}
|
|
@@ -1369,11 +1375,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1369
1375
|
var CategoryGetModule = {
|
|
1370
1376
|
command: "get <id>",
|
|
1371
1377
|
describe: "Fetch a category",
|
|
1372
|
-
builder: (
|
|
1378
|
+
builder: (yargs34) => withConfiguration(
|
|
1373
1379
|
withFormatOptions(
|
|
1374
1380
|
withApiOptions(
|
|
1375
1381
|
withProjectOptions(
|
|
1376
|
-
|
|
1382
|
+
yargs34.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1377
1383
|
)
|
|
1378
1384
|
)
|
|
1379
1385
|
)
|
|
@@ -1398,7 +1404,7 @@ var CategoryListModule = {
|
|
|
1398
1404
|
command: "list",
|
|
1399
1405
|
describe: "List categories",
|
|
1400
1406
|
aliases: ["ls"],
|
|
1401
|
-
builder: (
|
|
1407
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34.options({}))))),
|
|
1402
1408
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1403
1409
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1404
1410
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1433,6 +1439,7 @@ function createCategoriesEngineDataSource({
|
|
|
1433
1439
|
}
|
|
1434
1440
|
}
|
|
1435
1441
|
return {
|
|
1442
|
+
name: "Uniform API",
|
|
1436
1443
|
objects: getObjects(),
|
|
1437
1444
|
deleteObject: async (providerId) => {
|
|
1438
1445
|
await client.removeCategory({ categoryId: providerId });
|
|
@@ -1447,11 +1454,11 @@ function createCategoriesEngineDataSource({
|
|
|
1447
1454
|
var CategoryPullModule = {
|
|
1448
1455
|
command: "pull <directory>",
|
|
1449
1456
|
describe: "Pulls all categories to local files in a directory",
|
|
1450
|
-
builder: (
|
|
1457
|
+
builder: (yargs34) => withConfiguration(
|
|
1451
1458
|
withApiOptions(
|
|
1452
1459
|
withProjectOptions(
|
|
1453
1460
|
withDiffOptions(
|
|
1454
|
-
|
|
1461
|
+
yargs34.positional("directory", {
|
|
1455
1462
|
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.",
|
|
1456
1463
|
type: "string"
|
|
1457
1464
|
}).option("format", {
|
|
@@ -1496,6 +1503,7 @@ var CategoryPullModule = {
|
|
|
1496
1503
|
if (isPackage) {
|
|
1497
1504
|
const packageContents = readCanvasPackage(directory, false);
|
|
1498
1505
|
target = await createArraySyncEngineDataSource({
|
|
1506
|
+
name: `Package file ${directory}`,
|
|
1499
1507
|
objects: packageContents.categories ?? [],
|
|
1500
1508
|
selectIdentifier,
|
|
1501
1509
|
selectDisplayName,
|
|
@@ -1528,11 +1536,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1528
1536
|
var CategoryPushModule = {
|
|
1529
1537
|
command: "push <directory>",
|
|
1530
1538
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1531
|
-
builder: (
|
|
1539
|
+
builder: (yargs34) => withConfiguration(
|
|
1532
1540
|
withApiOptions(
|
|
1533
1541
|
withProjectOptions(
|
|
1534
1542
|
withDiffOptions(
|
|
1535
|
-
|
|
1543
|
+
yargs34.positional("directory", {
|
|
1536
1544
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1537
1545
|
type: "string"
|
|
1538
1546
|
}).option("what-if", {
|
|
@@ -1569,6 +1577,7 @@ var CategoryPushModule = {
|
|
|
1569
1577
|
if (isPackage) {
|
|
1570
1578
|
const packageContents = readCanvasPackage(directory, true);
|
|
1571
1579
|
source = await createArraySyncEngineDataSource({
|
|
1580
|
+
name: `Package file ${directory}`,
|
|
1572
1581
|
objects: packageContents.categories ?? [],
|
|
1573
1582
|
selectIdentifier,
|
|
1574
1583
|
selectDisplayName
|
|
@@ -1598,10 +1607,10 @@ var CategoryRemoveModule = {
|
|
|
1598
1607
|
command: "remove <id>",
|
|
1599
1608
|
aliases: ["delete", "rm"],
|
|
1600
1609
|
describe: "Delete a category",
|
|
1601
|
-
builder: (
|
|
1610
|
+
builder: (yargs34) => withConfiguration(
|
|
1602
1611
|
withApiOptions(
|
|
1603
1612
|
withProjectOptions(
|
|
1604
|
-
|
|
1613
|
+
yargs34.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1605
1614
|
)
|
|
1606
1615
|
)
|
|
1607
1616
|
),
|
|
@@ -1618,10 +1627,10 @@ var CategoryUpdateModule = {
|
|
|
1618
1627
|
command: "update <filename>",
|
|
1619
1628
|
aliases: ["put"],
|
|
1620
1629
|
describe: "Insert or update a category",
|
|
1621
|
-
builder: (
|
|
1630
|
+
builder: (yargs34) => withConfiguration(
|
|
1622
1631
|
withApiOptions(
|
|
1623
1632
|
withProjectOptions(
|
|
1624
|
-
|
|
1633
|
+
yargs34.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1625
1634
|
)
|
|
1626
1635
|
)
|
|
1627
1636
|
),
|
|
@@ -1638,7 +1647,7 @@ var CategoryModule = {
|
|
|
1638
1647
|
command: "category <command>",
|
|
1639
1648
|
aliases: ["cat"],
|
|
1640
1649
|
describe: "Commands for Canvas categories",
|
|
1641
|
-
builder: (
|
|
1650
|
+
builder: (yargs34) => yargs34.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1642
1651
|
handler: () => {
|
|
1643
1652
|
yargs2.help();
|
|
1644
1653
|
}
|
|
@@ -1659,11 +1668,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1659
1668
|
var ComponentGetModule = {
|
|
1660
1669
|
command: "get <id>",
|
|
1661
1670
|
describe: "Fetch a component definition",
|
|
1662
|
-
builder: (
|
|
1671
|
+
builder: (yargs34) => withConfiguration(
|
|
1663
1672
|
withFormatOptions(
|
|
1664
1673
|
withApiOptions(
|
|
1665
1674
|
withProjectOptions(
|
|
1666
|
-
|
|
1675
|
+
yargs34.positional("id", {
|
|
1667
1676
|
demandOption: true,
|
|
1668
1677
|
describe: "Component definition public ID to fetch"
|
|
1669
1678
|
})
|
|
@@ -1697,11 +1706,11 @@ var ComponentListModule = {
|
|
|
1697
1706
|
command: "list",
|
|
1698
1707
|
describe: "List component definitions",
|
|
1699
1708
|
aliases: ["ls"],
|
|
1700
|
-
builder: (
|
|
1709
|
+
builder: (yargs34) => withConfiguration(
|
|
1701
1710
|
withFormatOptions(
|
|
1702
1711
|
withApiOptions(
|
|
1703
1712
|
withProjectOptions(
|
|
1704
|
-
|
|
1713
|
+
yargs34.options({
|
|
1705
1714
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1706
1715
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1707
1716
|
})
|
|
@@ -1740,6 +1749,7 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1740
1749
|
}
|
|
1741
1750
|
}
|
|
1742
1751
|
return {
|
|
1752
|
+
name: "Uniform API",
|
|
1743
1753
|
objects: getObjects(),
|
|
1744
1754
|
deleteObject: async (providerId) => {
|
|
1745
1755
|
await client.removeComponentDefinition({ componentId: providerId });
|
|
@@ -1756,11 +1766,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1756
1766
|
var ComponentPullModule = {
|
|
1757
1767
|
command: "pull <directory>",
|
|
1758
1768
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1759
|
-
builder: (
|
|
1769
|
+
builder: (yargs34) => withConfiguration(
|
|
1760
1770
|
withApiOptions(
|
|
1761
1771
|
withProjectOptions(
|
|
1762
1772
|
withDiffOptions(
|
|
1763
|
-
|
|
1773
|
+
yargs34.positional("directory", {
|
|
1764
1774
|
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.",
|
|
1765
1775
|
type: "string"
|
|
1766
1776
|
}).option("format", {
|
|
@@ -1805,6 +1815,7 @@ var ComponentPullModule = {
|
|
|
1805
1815
|
if (isPackage) {
|
|
1806
1816
|
const packageContents = readCanvasPackage(directory, false);
|
|
1807
1817
|
target = await createArraySyncEngineDataSource({
|
|
1818
|
+
name: `Package file ${directory}`,
|
|
1808
1819
|
objects: packageContents.components ?? [],
|
|
1809
1820
|
selectIdentifier: selectIdentifier2,
|
|
1810
1821
|
selectDisplayName: selectDisplayName2,
|
|
@@ -1838,11 +1849,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1838
1849
|
var ComponentPushModule = {
|
|
1839
1850
|
command: "push <directory>",
|
|
1840
1851
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1841
|
-
builder: (
|
|
1852
|
+
builder: (yargs34) => withConfiguration(
|
|
1842
1853
|
withApiOptions(
|
|
1843
1854
|
withProjectOptions(
|
|
1844
1855
|
withDiffOptions(
|
|
1845
|
-
|
|
1856
|
+
yargs34.positional("directory", {
|
|
1846
1857
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1847
1858
|
type: "string"
|
|
1848
1859
|
}).option("what-if", {
|
|
@@ -1879,6 +1890,7 @@ var ComponentPushModule = {
|
|
|
1879
1890
|
if (isPackage) {
|
|
1880
1891
|
const packageContents = readCanvasPackage(directory, true);
|
|
1881
1892
|
source = await createArraySyncEngineDataSource({
|
|
1893
|
+
name: `Package file ${directory}`,
|
|
1882
1894
|
objects: packageContents.components ?? [],
|
|
1883
1895
|
selectIdentifier: selectIdentifier2,
|
|
1884
1896
|
selectDisplayName: selectDisplayName2
|
|
@@ -1909,10 +1921,10 @@ var ComponentRemoveModule = {
|
|
|
1909
1921
|
command: "remove <id>",
|
|
1910
1922
|
aliases: ["delete", "rm"],
|
|
1911
1923
|
describe: "Delete a component definition",
|
|
1912
|
-
builder: (
|
|
1924
|
+
builder: (yargs34) => withConfiguration(
|
|
1913
1925
|
withApiOptions(
|
|
1914
1926
|
withProjectOptions(
|
|
1915
|
-
|
|
1927
|
+
yargs34.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1916
1928
|
)
|
|
1917
1929
|
)
|
|
1918
1930
|
),
|
|
@@ -1929,10 +1941,10 @@ var ComponentUpdateModule = {
|
|
|
1929
1941
|
command: "update <filename>",
|
|
1930
1942
|
aliases: ["put"],
|
|
1931
1943
|
describe: "Insert or update a component definition",
|
|
1932
|
-
builder: (
|
|
1944
|
+
builder: (yargs34) => withConfiguration(
|
|
1933
1945
|
withApiOptions(
|
|
1934
1946
|
withProjectOptions(
|
|
1935
|
-
|
|
1947
|
+
yargs34.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1936
1948
|
)
|
|
1937
1949
|
)
|
|
1938
1950
|
),
|
|
@@ -1949,7 +1961,7 @@ var ComponentModule = {
|
|
|
1949
1961
|
command: "component <command>",
|
|
1950
1962
|
aliases: ["def"],
|
|
1951
1963
|
describe: "Commands for Canvas component definitions",
|
|
1952
|
-
builder: (
|
|
1964
|
+
builder: (yargs34) => yargs34.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1953
1965
|
handler: () => {
|
|
1954
1966
|
yargs3.help();
|
|
1955
1967
|
}
|
|
@@ -1963,12 +1975,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1963
1975
|
var CompositionGetModule = {
|
|
1964
1976
|
command: "get <id>",
|
|
1965
1977
|
describe: "Fetch a composition",
|
|
1966
|
-
builder: (
|
|
1978
|
+
builder: (yargs34) => withFormatOptions(
|
|
1967
1979
|
withConfiguration(
|
|
1968
1980
|
withApiOptions(
|
|
1969
1981
|
withProjectOptions(
|
|
1970
1982
|
withStateOptions(
|
|
1971
|
-
|
|
1983
|
+
yargs34.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1972
1984
|
resolvePatterns: {
|
|
1973
1985
|
type: "boolean",
|
|
1974
1986
|
default: false,
|
|
@@ -2045,12 +2057,12 @@ var CompositionListModule = {
|
|
|
2045
2057
|
command: "list",
|
|
2046
2058
|
describe: "List compositions",
|
|
2047
2059
|
aliases: ["ls"],
|
|
2048
|
-
builder: (
|
|
2060
|
+
builder: (yargs34) => withFormatOptions(
|
|
2049
2061
|
withConfiguration(
|
|
2050
2062
|
withApiOptions(
|
|
2051
2063
|
withProjectOptions(
|
|
2052
2064
|
withStateOptions(
|
|
2053
|
-
|
|
2065
|
+
yargs34.options({
|
|
2054
2066
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2055
2067
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2056
2068
|
search: { describe: "Search query", type: "string", default: "" },
|
|
@@ -2123,12 +2135,12 @@ var CompositionListModule = {
|
|
|
2123
2135
|
var ComponentPatternListModule = {
|
|
2124
2136
|
...CompositionListModule,
|
|
2125
2137
|
describe: "List component patterns",
|
|
2126
|
-
builder: (
|
|
2138
|
+
builder: (yargs34) => withFormatOptions(
|
|
2127
2139
|
withConfiguration(
|
|
2128
2140
|
withApiOptions(
|
|
2129
2141
|
withProjectOptions(
|
|
2130
2142
|
withStateOptions(
|
|
2131
|
-
|
|
2143
|
+
yargs34.options({
|
|
2132
2144
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2133
2145
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2134
2146
|
resolvePatterns: {
|
|
@@ -2203,6 +2215,7 @@ function createComponentInstanceEngineDataSource({
|
|
|
2203
2215
|
}
|
|
2204
2216
|
}
|
|
2205
2217
|
return {
|
|
2218
|
+
name: "Uniform API",
|
|
2206
2219
|
objects: getObjects(),
|
|
2207
2220
|
deleteObject: async (providerId) => {
|
|
2208
2221
|
await client.removeComposition({ compositionId: providerId });
|
|
@@ -2217,11 +2230,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2217
2230
|
var CompositionPublishModule = {
|
|
2218
2231
|
command: "publish [ids]",
|
|
2219
2232
|
describe: "Publishes composition(s)",
|
|
2220
|
-
builder: (
|
|
2233
|
+
builder: (yargs34) => withConfiguration(
|
|
2221
2234
|
withApiOptions(
|
|
2222
2235
|
withProjectOptions(
|
|
2223
2236
|
withDiffOptions(
|
|
2224
|
-
|
|
2237
|
+
yargs34.positional("ids", {
|
|
2225
2238
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2226
2239
|
type: "string"
|
|
2227
2240
|
}).option("all", {
|
|
@@ -2295,11 +2308,11 @@ var CompositionPublishModule = {
|
|
|
2295
2308
|
var ComponentPatternPublishModule = {
|
|
2296
2309
|
...CompositionPublishModule,
|
|
2297
2310
|
describe: "Publishes component pattern(s)",
|
|
2298
|
-
builder: (
|
|
2311
|
+
builder: (yargs34) => withConfiguration(
|
|
2299
2312
|
withApiOptions(
|
|
2300
2313
|
withProjectOptions(
|
|
2301
2314
|
withDiffOptions(
|
|
2302
|
-
|
|
2315
|
+
yargs34.positional("ids", {
|
|
2303
2316
|
describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2304
2317
|
type: "string"
|
|
2305
2318
|
}).option("all", {
|
|
@@ -2339,12 +2352,12 @@ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
|
2339
2352
|
var CompositionPullModule = {
|
|
2340
2353
|
command: "pull <directory>",
|
|
2341
2354
|
describe: "Pulls all compositions to local files in a directory",
|
|
2342
|
-
builder: (
|
|
2355
|
+
builder: (yargs34) => withConfiguration(
|
|
2343
2356
|
withApiOptions(
|
|
2344
2357
|
withProjectOptions(
|
|
2345
2358
|
withStateOptions(
|
|
2346
2359
|
withDiffOptions(
|
|
2347
|
-
|
|
2360
|
+
yargs34.positional("directory", {
|
|
2348
2361
|
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.",
|
|
2349
2362
|
type: "string"
|
|
2350
2363
|
}).option("format", {
|
|
@@ -2403,6 +2416,7 @@ var CompositionPullModule = {
|
|
|
2403
2416
|
if (isPackage) {
|
|
2404
2417
|
const packageContents = readCanvasPackage(directory, false);
|
|
2405
2418
|
target = await createArraySyncEngineDataSource({
|
|
2419
|
+
name: `Package file ${directory}`,
|
|
2406
2420
|
objects: (packageContents == null ? void 0 : packageContents.compositions) ?? [],
|
|
2407
2421
|
selectIdentifier: selectIdentifier3,
|
|
2408
2422
|
selectDisplayName: selectDisplayName3,
|
|
@@ -2446,12 +2460,12 @@ var CompositionPullModule = {
|
|
|
2446
2460
|
var ComponentPatternPullModule = {
|
|
2447
2461
|
...CompositionPullModule,
|
|
2448
2462
|
describe: "Pulls all component patterns to local files in a directory",
|
|
2449
|
-
builder: (
|
|
2463
|
+
builder: (yargs34) => withConfiguration(
|
|
2450
2464
|
withApiOptions(
|
|
2451
2465
|
withProjectOptions(
|
|
2452
2466
|
withStateOptions(
|
|
2453
2467
|
withDiffOptions(
|
|
2454
|
-
|
|
2468
|
+
yargs34.positional("directory", {
|
|
2455
2469
|
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.",
|
|
2456
2470
|
type: "string"
|
|
2457
2471
|
}).option("format", {
|
|
@@ -2491,12 +2505,12 @@ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
|
2491
2505
|
var CompositionPushModule = {
|
|
2492
2506
|
command: "push <directory>",
|
|
2493
2507
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2494
|
-
builder: (
|
|
2508
|
+
builder: (yargs34) => withConfiguration(
|
|
2495
2509
|
withApiOptions(
|
|
2496
2510
|
withProjectOptions(
|
|
2497
2511
|
withStateOptions(
|
|
2498
2512
|
withDiffOptions(
|
|
2499
|
-
|
|
2513
|
+
yargs34.positional("directory", {
|
|
2500
2514
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2501
2515
|
type: "string"
|
|
2502
2516
|
}).option("what-if", {
|
|
@@ -2546,6 +2560,7 @@ var CompositionPushModule = {
|
|
|
2546
2560
|
if (isPackage) {
|
|
2547
2561
|
const packageContents = readCanvasPackage(directory, true);
|
|
2548
2562
|
source = await createArraySyncEngineDataSource({
|
|
2563
|
+
name: `Package file ${directory}`,
|
|
2549
2564
|
objects: packageContents.compositions ?? [],
|
|
2550
2565
|
selectIdentifier: selectIdentifier3,
|
|
2551
2566
|
selectDisplayName: selectDisplayName3
|
|
@@ -2585,12 +2600,12 @@ var CompositionPushModule = {
|
|
|
2585
2600
|
var ComponentPatternPushModule = {
|
|
2586
2601
|
...CompositionPushModule,
|
|
2587
2602
|
describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
|
|
2588
|
-
builder: (
|
|
2603
|
+
builder: (yargs34) => withConfiguration(
|
|
2589
2604
|
withApiOptions(
|
|
2590
2605
|
withProjectOptions(
|
|
2591
2606
|
withStateOptions(
|
|
2592
2607
|
withDiffOptions(
|
|
2593
|
-
|
|
2608
|
+
yargs34.positional("directory", {
|
|
2594
2609
|
describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
|
|
2595
2610
|
type: "string"
|
|
2596
2611
|
}).option("what-if", {
|
|
@@ -2624,10 +2639,10 @@ var CompositionRemoveModule = {
|
|
|
2624
2639
|
command: "remove <id>",
|
|
2625
2640
|
aliases: ["delete", "rm"],
|
|
2626
2641
|
describe: "Delete a composition",
|
|
2627
|
-
builder: (
|
|
2642
|
+
builder: (yargs34) => withConfiguration(
|
|
2628
2643
|
withApiOptions(
|
|
2629
2644
|
withProjectOptions(
|
|
2630
|
-
|
|
2645
|
+
yargs34.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2631
2646
|
)
|
|
2632
2647
|
)
|
|
2633
2648
|
),
|
|
@@ -2650,10 +2665,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2650
2665
|
var CompositionUnpublishModule = {
|
|
2651
2666
|
command: "unpublish [ids]",
|
|
2652
2667
|
describe: "Unpublish a composition(s)",
|
|
2653
|
-
builder: (
|
|
2668
|
+
builder: (yargs34) => withConfiguration(
|
|
2654
2669
|
withApiOptions(
|
|
2655
2670
|
withProjectOptions(
|
|
2656
|
-
|
|
2671
|
+
yargs34.positional("ids", {
|
|
2657
2672
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2658
2673
|
type: "string"
|
|
2659
2674
|
}).option("all", {
|
|
@@ -2745,10 +2760,10 @@ var CompositionUnpublishModule = {
|
|
|
2745
2760
|
var ComponentPatternUnpublishModule = {
|
|
2746
2761
|
command: "unpublish [ids]",
|
|
2747
2762
|
describe: "Unpublish a component pattern(s)",
|
|
2748
|
-
builder: (
|
|
2763
|
+
builder: (yargs34) => withConfiguration(
|
|
2749
2764
|
withApiOptions(
|
|
2750
2765
|
withProjectOptions(
|
|
2751
|
-
|
|
2766
|
+
yargs34.positional("ids", {
|
|
2752
2767
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2753
2768
|
type: "string"
|
|
2754
2769
|
}).option("all", {
|
|
@@ -2783,11 +2798,11 @@ var CompositionUpdateModule = {
|
|
|
2783
2798
|
command: "update <filename>",
|
|
2784
2799
|
aliases: ["put"],
|
|
2785
2800
|
describe: "Insert or update a composition",
|
|
2786
|
-
builder: (
|
|
2801
|
+
builder: (yargs34) => withConfiguration(
|
|
2787
2802
|
withApiOptions(
|
|
2788
2803
|
withProjectOptions(
|
|
2789
2804
|
withStateOptions(
|
|
2790
|
-
|
|
2805
|
+
yargs34.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2791
2806
|
)
|
|
2792
2807
|
)
|
|
2793
2808
|
)
|
|
@@ -2811,7 +2826,7 @@ var ComponentPatternModule = {
|
|
|
2811
2826
|
command: "component-pattern <command>",
|
|
2812
2827
|
aliases: ["pattern"],
|
|
2813
2828
|
describe: "Commands for Canvas component patterns",
|
|
2814
|
-
builder: (
|
|
2829
|
+
builder: (yargs34) => yargs34.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
|
|
2815
2830
|
handler: () => {
|
|
2816
2831
|
yargs4.help();
|
|
2817
2832
|
}
|
|
@@ -2823,7 +2838,7 @@ var CompositionModule = {
|
|
|
2823
2838
|
command: "composition <command>",
|
|
2824
2839
|
describe: "Commands for Canvas compositions",
|
|
2825
2840
|
aliases: ["comp"],
|
|
2826
|
-
builder: (
|
|
2841
|
+
builder: (yargs34) => yargs34.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2827
2842
|
handler: () => {
|
|
2828
2843
|
yargs5.help();
|
|
2829
2844
|
}
|
|
@@ -2837,12 +2852,12 @@ import { ContentClient } from "@uniformdev/canvas";
|
|
|
2837
2852
|
var ContentTypeGetModule = {
|
|
2838
2853
|
command: "get <id>",
|
|
2839
2854
|
describe: "Get a content type",
|
|
2840
|
-
builder: (
|
|
2855
|
+
builder: (yargs34) => withConfiguration(
|
|
2841
2856
|
withFormatOptions(
|
|
2842
2857
|
withApiOptions(
|
|
2843
2858
|
withProjectOptions(
|
|
2844
2859
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2845
|
-
|
|
2860
|
+
yargs34.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2846
2861
|
)
|
|
2847
2862
|
)
|
|
2848
2863
|
)
|
|
@@ -2864,7 +2879,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2864
2879
|
var ContentTypeListModule = {
|
|
2865
2880
|
command: "list",
|
|
2866
2881
|
describe: "List content types",
|
|
2867
|
-
builder: (
|
|
2882
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
2868
2883
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2869
2884
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2870
2885
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2897,6 +2912,7 @@ function createContentTypeEngineDataSource({
|
|
|
2897
2912
|
}
|
|
2898
2913
|
}
|
|
2899
2914
|
return {
|
|
2915
|
+
name: "Uniform API",
|
|
2900
2916
|
objects: getObjects(),
|
|
2901
2917
|
deleteObject: async (providerId) => {
|
|
2902
2918
|
await client.deleteContentType({ contentTypeId: providerId });
|
|
@@ -2911,11 +2927,11 @@ function createContentTypeEngineDataSource({
|
|
|
2911
2927
|
var ContentTypePullModule = {
|
|
2912
2928
|
command: "pull <directory>",
|
|
2913
2929
|
describe: "Pulls all content types to local files in a directory",
|
|
2914
|
-
builder: (
|
|
2930
|
+
builder: (yargs34) => withConfiguration(
|
|
2915
2931
|
withApiOptions(
|
|
2916
2932
|
withProjectOptions(
|
|
2917
2933
|
withDiffOptions(
|
|
2918
|
-
|
|
2934
|
+
yargs34.positional("directory", {
|
|
2919
2935
|
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.",
|
|
2920
2936
|
type: "string"
|
|
2921
2937
|
}).option("format", {
|
|
@@ -2966,6 +2982,7 @@ var ContentTypePullModule = {
|
|
|
2966
2982
|
if (isPackage) {
|
|
2967
2983
|
const packageContents = readCanvasPackage(directory, false);
|
|
2968
2984
|
target = await createArraySyncEngineDataSource({
|
|
2985
|
+
name: `Package file ${directory}`,
|
|
2969
2986
|
objects: packageContents.contentTypes ?? [],
|
|
2970
2987
|
selectIdentifier: selectContentTypeIdentifier,
|
|
2971
2988
|
selectDisplayName: selectContentTypeDisplayName,
|
|
@@ -2998,11 +3015,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2998
3015
|
var ContentTypePushModule = {
|
|
2999
3016
|
command: "push <directory>",
|
|
3000
3017
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
3001
|
-
builder: (
|
|
3018
|
+
builder: (yargs34) => withConfiguration(
|
|
3002
3019
|
withApiOptions(
|
|
3003
3020
|
withProjectOptions(
|
|
3004
3021
|
withDiffOptions(
|
|
3005
|
-
|
|
3022
|
+
yargs34.positional("directory", {
|
|
3006
3023
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
3007
3024
|
type: "string"
|
|
3008
3025
|
}).option("what-if", {
|
|
@@ -3045,6 +3062,7 @@ var ContentTypePushModule = {
|
|
|
3045
3062
|
if (isPackage) {
|
|
3046
3063
|
const packageContents = readCanvasPackage(directory, true);
|
|
3047
3064
|
source = await createArraySyncEngineDataSource({
|
|
3065
|
+
name: `Package file ${directory}`,
|
|
3048
3066
|
objects: packageContents.contentTypes ?? [],
|
|
3049
3067
|
selectIdentifier: selectContentTypeIdentifier,
|
|
3050
3068
|
selectDisplayName: selectContentTypeDisplayName
|
|
@@ -3074,10 +3092,10 @@ var ContentTypeRemoveModule = {
|
|
|
3074
3092
|
command: "remove <id>",
|
|
3075
3093
|
aliases: ["delete", "rm"],
|
|
3076
3094
|
describe: "Delete a content type",
|
|
3077
|
-
builder: (
|
|
3095
|
+
builder: (yargs34) => withConfiguration(
|
|
3078
3096
|
withApiOptions(
|
|
3079
3097
|
withProjectOptions(
|
|
3080
|
-
|
|
3098
|
+
yargs34.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
3081
3099
|
)
|
|
3082
3100
|
)
|
|
3083
3101
|
),
|
|
@@ -3094,10 +3112,10 @@ var ContentTypeUpdateModule = {
|
|
|
3094
3112
|
command: "update <filename>",
|
|
3095
3113
|
aliases: ["put"],
|
|
3096
3114
|
describe: "Insert or update a content type",
|
|
3097
|
-
builder: (
|
|
3115
|
+
builder: (yargs34) => withConfiguration(
|
|
3098
3116
|
withApiOptions(
|
|
3099
3117
|
withProjectOptions(
|
|
3100
|
-
|
|
3118
|
+
yargs34.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
3101
3119
|
)
|
|
3102
3120
|
)
|
|
3103
3121
|
),
|
|
@@ -3114,7 +3132,7 @@ var ContentTypeModule = {
|
|
|
3114
3132
|
command: "contenttype <command>",
|
|
3115
3133
|
aliases: ["ct"],
|
|
3116
3134
|
describe: "Commands for Content Types",
|
|
3117
|
-
builder: (
|
|
3135
|
+
builder: (yargs34) => yargs34.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
3118
3136
|
handler: () => {
|
|
3119
3137
|
yargs6.help();
|
|
3120
3138
|
}
|
|
@@ -3128,11 +3146,11 @@ import { DataSourceClient } from "@uniformdev/canvas";
|
|
|
3128
3146
|
var DataSourceGetModule = {
|
|
3129
3147
|
command: "get <id>",
|
|
3130
3148
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
3131
|
-
builder: (
|
|
3149
|
+
builder: (yargs34) => withConfiguration(
|
|
3132
3150
|
withApiOptions(
|
|
3133
3151
|
withProjectOptions(
|
|
3134
3152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3135
|
-
|
|
3153
|
+
yargs34.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
3136
3154
|
)
|
|
3137
3155
|
)
|
|
3138
3156
|
),
|
|
@@ -3150,10 +3168,10 @@ var DataSourceRemoveModule = {
|
|
|
3150
3168
|
command: "remove <id>",
|
|
3151
3169
|
aliases: ["delete", "rm"],
|
|
3152
3170
|
describe: "Delete a data source",
|
|
3153
|
-
builder: (
|
|
3171
|
+
builder: (yargs34) => withConfiguration(
|
|
3154
3172
|
withApiOptions(
|
|
3155
3173
|
withProjectOptions(
|
|
3156
|
-
|
|
3174
|
+
yargs34.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
|
|
3157
3175
|
)
|
|
3158
3176
|
)
|
|
3159
3177
|
),
|
|
@@ -3170,10 +3188,10 @@ var DataSourceUpdateModule = {
|
|
|
3170
3188
|
command: "update <dataSource>",
|
|
3171
3189
|
aliases: ["put"],
|
|
3172
3190
|
describe: "Insert or update a data source",
|
|
3173
|
-
builder: (
|
|
3191
|
+
builder: (yargs34) => withConfiguration(
|
|
3174
3192
|
withApiOptions(
|
|
3175
3193
|
withProjectOptions(
|
|
3176
|
-
|
|
3194
|
+
yargs34.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
|
|
3177
3195
|
describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
|
|
3178
3196
|
type: "string",
|
|
3179
3197
|
demandOption: true
|
|
@@ -3193,7 +3211,7 @@ var DataSourceModule = {
|
|
|
3193
3211
|
command: "datasource <command>",
|
|
3194
3212
|
aliases: ["ds"],
|
|
3195
3213
|
describe: "Commands for Data Source definitions",
|
|
3196
|
-
builder: (
|
|
3214
|
+
builder: (yargs34) => yargs34.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
|
|
3197
3215
|
handler: () => {
|
|
3198
3216
|
yargs7.help();
|
|
3199
3217
|
}
|
|
@@ -3208,12 +3226,12 @@ var DataTypeGetModule = {
|
|
|
3208
3226
|
command: "get <id>",
|
|
3209
3227
|
describe: "Get a data type",
|
|
3210
3228
|
aliases: ["ls"],
|
|
3211
|
-
builder: (
|
|
3229
|
+
builder: (yargs34) => withConfiguration(
|
|
3212
3230
|
withFormatOptions(
|
|
3213
3231
|
withApiOptions(
|
|
3214
3232
|
withProjectOptions(
|
|
3215
3233
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3216
|
-
|
|
3234
|
+
yargs34.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
3217
3235
|
)
|
|
3218
3236
|
)
|
|
3219
3237
|
)
|
|
@@ -3236,7 +3254,7 @@ var DataTypeListModule = {
|
|
|
3236
3254
|
command: "list",
|
|
3237
3255
|
describe: "List data types",
|
|
3238
3256
|
aliases: ["ls"],
|
|
3239
|
-
builder: (
|
|
3257
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
3240
3258
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3241
3259
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3242
3260
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3269,6 +3287,7 @@ function createDataTypeEngineDataSource({
|
|
|
3269
3287
|
}
|
|
3270
3288
|
}
|
|
3271
3289
|
return {
|
|
3290
|
+
name: "Uniform API",
|
|
3272
3291
|
objects: getObjects(),
|
|
3273
3292
|
deleteObject: async (providerId) => {
|
|
3274
3293
|
await client.remove({ typeId: providerId });
|
|
@@ -3285,11 +3304,11 @@ function createDataTypeEngineDataSource({
|
|
|
3285
3304
|
var DataTypePullModule = {
|
|
3286
3305
|
command: "pull <directory>",
|
|
3287
3306
|
describe: "Pulls all data types to local files in a directory",
|
|
3288
|
-
builder: (
|
|
3307
|
+
builder: (yargs34) => withConfiguration(
|
|
3289
3308
|
withApiOptions(
|
|
3290
3309
|
withProjectOptions(
|
|
3291
3310
|
withDiffOptions(
|
|
3292
|
-
|
|
3311
|
+
yargs34.positional("directory", {
|
|
3293
3312
|
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.",
|
|
3294
3313
|
type: "string"
|
|
3295
3314
|
}).option("format", {
|
|
@@ -3340,6 +3359,7 @@ var DataTypePullModule = {
|
|
|
3340
3359
|
if (isPackage) {
|
|
3341
3360
|
const packageContents = readCanvasPackage(directory, false);
|
|
3342
3361
|
target = await createArraySyncEngineDataSource({
|
|
3362
|
+
name: `Package file ${directory}`,
|
|
3343
3363
|
objects: packageContents.dataTypes ?? [],
|
|
3344
3364
|
selectIdentifier: selectIdentifier4,
|
|
3345
3365
|
selectDisplayName: selectDisplayName4,
|
|
@@ -3372,11 +3392,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
3372
3392
|
var DataTypePushModule = {
|
|
3373
3393
|
command: "push <directory>",
|
|
3374
3394
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
3375
|
-
builder: (
|
|
3395
|
+
builder: (yargs34) => withConfiguration(
|
|
3376
3396
|
withApiOptions(
|
|
3377
3397
|
withProjectOptions(
|
|
3378
3398
|
withDiffOptions(
|
|
3379
|
-
|
|
3399
|
+
yargs34.positional("directory", {
|
|
3380
3400
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
3381
3401
|
type: "string"
|
|
3382
3402
|
}).option("what-if", {
|
|
@@ -3419,6 +3439,7 @@ var DataTypePushModule = {
|
|
|
3419
3439
|
if (isPackage) {
|
|
3420
3440
|
const packageContents = readCanvasPackage(directory, true);
|
|
3421
3441
|
source = await createArraySyncEngineDataSource({
|
|
3442
|
+
name: `Package file ${directory}`,
|
|
3422
3443
|
objects: packageContents.dataTypes ?? [],
|
|
3423
3444
|
selectIdentifier: selectIdentifier4,
|
|
3424
3445
|
selectDisplayName: selectDisplayName4
|
|
@@ -3448,10 +3469,10 @@ var DataTypeRemoveModule = {
|
|
|
3448
3469
|
command: "remove <id>",
|
|
3449
3470
|
aliases: ["delete", "rm"],
|
|
3450
3471
|
describe: "Delete a data type",
|
|
3451
|
-
builder: (
|
|
3472
|
+
builder: (yargs34) => withConfiguration(
|
|
3452
3473
|
withApiOptions(
|
|
3453
3474
|
withProjectOptions(
|
|
3454
|
-
|
|
3475
|
+
yargs34.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
3455
3476
|
)
|
|
3456
3477
|
)
|
|
3457
3478
|
),
|
|
@@ -3468,10 +3489,10 @@ var DataTypeUpdateModule = {
|
|
|
3468
3489
|
command: "update <filename>",
|
|
3469
3490
|
aliases: ["put"],
|
|
3470
3491
|
describe: "Insert or update a data type",
|
|
3471
|
-
builder: (
|
|
3492
|
+
builder: (yargs34) => withConfiguration(
|
|
3472
3493
|
withApiOptions(
|
|
3473
3494
|
withProjectOptions(
|
|
3474
|
-
|
|
3495
|
+
yargs34.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
3475
3496
|
)
|
|
3476
3497
|
)
|
|
3477
3498
|
),
|
|
@@ -3488,7 +3509,7 @@ var DataTypeModule = {
|
|
|
3488
3509
|
command: "datatype <command>",
|
|
3489
3510
|
aliases: ["dt"],
|
|
3490
3511
|
describe: "Commands for Data Type definitions",
|
|
3491
|
-
builder: (
|
|
3512
|
+
builder: (yargs34) => yargs34.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3492
3513
|
handler: () => {
|
|
3493
3514
|
yargs8.help();
|
|
3494
3515
|
}
|
|
@@ -3502,13 +3523,13 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
|
3502
3523
|
var EntryGetModule = {
|
|
3503
3524
|
command: "get <id>",
|
|
3504
3525
|
describe: "Get an entry",
|
|
3505
|
-
builder: (
|
|
3526
|
+
builder: (yargs34) => withConfiguration(
|
|
3506
3527
|
withFormatOptions(
|
|
3507
3528
|
withApiOptions(
|
|
3508
3529
|
withProjectOptions(
|
|
3509
3530
|
withStateOptions(
|
|
3510
3531
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3511
|
-
|
|
3532
|
+
yargs34.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }),
|
|
3512
3533
|
// for backwards compatibility, we default to the "published" state, unlike compositions
|
|
3513
3534
|
"published"
|
|
3514
3535
|
)
|
|
@@ -3551,12 +3572,12 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
|
3551
3572
|
var EntryListModule = {
|
|
3552
3573
|
command: "list",
|
|
3553
3574
|
describe: "List entries",
|
|
3554
|
-
builder: (
|
|
3575
|
+
builder: (yargs34) => withConfiguration(
|
|
3555
3576
|
withFormatOptions(
|
|
3556
3577
|
withApiOptions(
|
|
3557
3578
|
withProjectOptions(
|
|
3558
3579
|
withStateOptions(
|
|
3559
|
-
|
|
3580
|
+
yargs34.options({
|
|
3560
3581
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3561
3582
|
limit: { describe: "Number of rows to fetch", type: "number", default: LEGACY_DEFAULT_LIMIT },
|
|
3562
3583
|
search: { describe: "Search query", type: "string", default: "" }
|
|
@@ -3642,6 +3663,7 @@ function createEntryEngineDataSource({
|
|
|
3642
3663
|
}
|
|
3643
3664
|
}
|
|
3644
3665
|
return {
|
|
3666
|
+
name: "Uniform API",
|
|
3645
3667
|
objects: getObjects(),
|
|
3646
3668
|
deleteObject: async (providerId) => {
|
|
3647
3669
|
await client.deleteEntry({ entryId: providerId });
|
|
@@ -3656,11 +3678,11 @@ function createEntryEngineDataSource({
|
|
|
3656
3678
|
var EntryPublishModule = {
|
|
3657
3679
|
command: "publish [ids]",
|
|
3658
3680
|
describe: "Publishes entry(ies)",
|
|
3659
|
-
builder: (
|
|
3681
|
+
builder: (yargs34) => withConfiguration(
|
|
3660
3682
|
withApiOptions(
|
|
3661
3683
|
withProjectOptions(
|
|
3662
3684
|
withDiffOptions(
|
|
3663
|
-
|
|
3685
|
+
yargs34.positional("ids", {
|
|
3664
3686
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3665
3687
|
type: "string"
|
|
3666
3688
|
}).option("all", {
|
|
@@ -3715,12 +3737,12 @@ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
|
3715
3737
|
var EntryPullModule = {
|
|
3716
3738
|
command: "pull <directory>",
|
|
3717
3739
|
describe: "Pulls all entries to local files in a directory",
|
|
3718
|
-
builder: (
|
|
3740
|
+
builder: (yargs34) => withConfiguration(
|
|
3719
3741
|
withApiOptions(
|
|
3720
3742
|
withProjectOptions(
|
|
3721
3743
|
withStateOptions(
|
|
3722
3744
|
withDiffOptions(
|
|
3723
|
-
|
|
3745
|
+
yargs34.positional("directory", {
|
|
3724
3746
|
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.",
|
|
3725
3747
|
type: "string"
|
|
3726
3748
|
}).option("format", {
|
|
@@ -3774,6 +3796,7 @@ var EntryPullModule = {
|
|
|
3774
3796
|
if (isPackage) {
|
|
3775
3797
|
const packageContents = readCanvasPackage(directory, false);
|
|
3776
3798
|
target = await createArraySyncEngineDataSource({
|
|
3799
|
+
name: `Package file ${directory}`,
|
|
3777
3800
|
objects: packageContents.entries ?? [],
|
|
3778
3801
|
selectIdentifier: selectEntryIdentifier,
|
|
3779
3802
|
selectDisplayName: selectEntryDisplayName,
|
|
@@ -3819,12 +3842,12 @@ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
|
3819
3842
|
var EntryPushModule = {
|
|
3820
3843
|
command: "push <directory>",
|
|
3821
3844
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3822
|
-
builder: (
|
|
3845
|
+
builder: (yargs34) => withConfiguration(
|
|
3823
3846
|
withApiOptions(
|
|
3824
3847
|
withProjectOptions(
|
|
3825
3848
|
withStateOptions(
|
|
3826
3849
|
withDiffOptions(
|
|
3827
|
-
|
|
3850
|
+
yargs34.positional("directory", {
|
|
3828
3851
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3829
3852
|
type: "string"
|
|
3830
3853
|
}).option("what-if", {
|
|
@@ -3869,6 +3892,7 @@ var EntryPushModule = {
|
|
|
3869
3892
|
if (isPackage) {
|
|
3870
3893
|
const packageContents = readCanvasPackage(directory, true);
|
|
3871
3894
|
source = await createArraySyncEngineDataSource({
|
|
3895
|
+
name: `Package file ${directory}`,
|
|
3872
3896
|
objects: packageContents.entries ?? [],
|
|
3873
3897
|
selectIdentifier: selectEntryIdentifier,
|
|
3874
3898
|
selectDisplayName: selectEntryDisplayName
|
|
@@ -3910,10 +3934,10 @@ var EntryRemoveModule = {
|
|
|
3910
3934
|
command: "remove <id>",
|
|
3911
3935
|
aliases: ["delete", "rm"],
|
|
3912
3936
|
describe: "Delete an entry",
|
|
3913
|
-
builder: (
|
|
3937
|
+
builder: (yargs34) => withConfiguration(
|
|
3914
3938
|
withApiOptions(
|
|
3915
3939
|
withProjectOptions(
|
|
3916
|
-
|
|
3940
|
+
yargs34.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3917
3941
|
)
|
|
3918
3942
|
)
|
|
3919
3943
|
),
|
|
@@ -3930,10 +3954,10 @@ import { diffJson as diffJson3 } from "diff";
|
|
|
3930
3954
|
var EntryUnpublishModule = {
|
|
3931
3955
|
command: "unpublish [ids]",
|
|
3932
3956
|
describe: "Unpublish an entry(ies)",
|
|
3933
|
-
builder: (
|
|
3957
|
+
builder: (yargs34) => withConfiguration(
|
|
3934
3958
|
withApiOptions(
|
|
3935
3959
|
withProjectOptions(
|
|
3936
|
-
|
|
3960
|
+
yargs34.positional("ids", {
|
|
3937
3961
|
describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3938
3962
|
type: "string"
|
|
3939
3963
|
}).option("all", {
|
|
@@ -4006,11 +4030,11 @@ var EntryUpdateModule = {
|
|
|
4006
4030
|
command: "update <filename>",
|
|
4007
4031
|
aliases: ["put"],
|
|
4008
4032
|
describe: "Insert or update an entry",
|
|
4009
|
-
builder: (
|
|
4033
|
+
builder: (yargs34) => withConfiguration(
|
|
4010
4034
|
withApiOptions(
|
|
4011
4035
|
withProjectOptions(
|
|
4012
4036
|
withStateOptions(
|
|
4013
|
-
|
|
4037
|
+
yargs34.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
4014
4038
|
)
|
|
4015
4039
|
)
|
|
4016
4040
|
)
|
|
@@ -4027,7 +4051,7 @@ var EntryUpdateModule = {
|
|
|
4027
4051
|
var EntryModule = {
|
|
4028
4052
|
command: "entry <command>",
|
|
4029
4053
|
describe: "Commands for Entries",
|
|
4030
|
-
builder: (
|
|
4054
|
+
builder: (yargs34) => yargs34.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
|
|
4031
4055
|
handler: () => {
|
|
4032
4056
|
yargs9.help();
|
|
4033
4057
|
}
|
|
@@ -4041,13 +4065,13 @@ import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
|
|
|
4041
4065
|
var EntryPatternGetModule = {
|
|
4042
4066
|
command: "get <id>",
|
|
4043
4067
|
describe: "Get an entry pattern",
|
|
4044
|
-
builder: (
|
|
4068
|
+
builder: (yargs34) => withConfiguration(
|
|
4045
4069
|
withFormatOptions(
|
|
4046
4070
|
withApiOptions(
|
|
4047
4071
|
withProjectOptions(
|
|
4048
4072
|
withStateOptions(
|
|
4049
4073
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4050
|
-
|
|
4074
|
+
yargs34.positional("id", {
|
|
4051
4075
|
demandOption: true,
|
|
4052
4076
|
describe: "Entry pattern public ID to fetch"
|
|
4053
4077
|
}),
|
|
@@ -4082,8 +4106,8 @@ import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
|
|
|
4082
4106
|
var EntryPatternListModule = {
|
|
4083
4107
|
command: "list",
|
|
4084
4108
|
describe: "List entry patterns",
|
|
4085
|
-
builder: (
|
|
4086
|
-
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(
|
|
4109
|
+
builder: (yargs34) => withConfiguration(
|
|
4110
|
+
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs34, "published"))))
|
|
4087
4111
|
),
|
|
4088
4112
|
handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
|
|
4089
4113
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4106,11 +4130,11 @@ import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
|
|
|
4106
4130
|
var EntryPatternPublishModule = {
|
|
4107
4131
|
command: "publish [ids]",
|
|
4108
4132
|
describe: "Publishes entry pattern(s)",
|
|
4109
|
-
builder: (
|
|
4133
|
+
builder: (yargs34) => withConfiguration(
|
|
4110
4134
|
withApiOptions(
|
|
4111
4135
|
withProjectOptions(
|
|
4112
4136
|
withDiffOptions(
|
|
4113
|
-
|
|
4137
|
+
yargs34.positional("ids", {
|
|
4114
4138
|
describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4115
4139
|
type: "string"
|
|
4116
4140
|
}).option("all", {
|
|
@@ -4165,12 +4189,12 @@ import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
|
|
|
4165
4189
|
var EntryPatternPullModule = {
|
|
4166
4190
|
command: "pull <directory>",
|
|
4167
4191
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
4168
|
-
builder: (
|
|
4192
|
+
builder: (yargs34) => withConfiguration(
|
|
4169
4193
|
withApiOptions(
|
|
4170
4194
|
withProjectOptions(
|
|
4171
4195
|
withStateOptions(
|
|
4172
4196
|
withDiffOptions(
|
|
4173
|
-
|
|
4197
|
+
yargs34.positional("directory", {
|
|
4174
4198
|
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.",
|
|
4175
4199
|
type: "string"
|
|
4176
4200
|
}).option("format", {
|
|
@@ -4224,6 +4248,7 @@ var EntryPatternPullModule = {
|
|
|
4224
4248
|
if (isPackage) {
|
|
4225
4249
|
const packageContents = readCanvasPackage(directory, false);
|
|
4226
4250
|
target = await createArraySyncEngineDataSource({
|
|
4251
|
+
name: `Package file ${directory}`,
|
|
4227
4252
|
objects: packageContents.entries ?? [],
|
|
4228
4253
|
selectIdentifier: selectEntryIdentifier,
|
|
4229
4254
|
selectDisplayName: selectEntryDisplayName,
|
|
@@ -4269,12 +4294,12 @@ import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
|
|
|
4269
4294
|
var EntryPatternPushModule = {
|
|
4270
4295
|
command: "push <directory>",
|
|
4271
4296
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
4272
|
-
builder: (
|
|
4297
|
+
builder: (yargs34) => withConfiguration(
|
|
4273
4298
|
withApiOptions(
|
|
4274
4299
|
withProjectOptions(
|
|
4275
4300
|
withStateOptions(
|
|
4276
4301
|
withDiffOptions(
|
|
4277
|
-
|
|
4302
|
+
yargs34.positional("directory", {
|
|
4278
4303
|
describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
|
|
4279
4304
|
type: "string"
|
|
4280
4305
|
}).option("what-if", {
|
|
@@ -4319,6 +4344,7 @@ var EntryPatternPushModule = {
|
|
|
4319
4344
|
if (isPackage) {
|
|
4320
4345
|
const packageContents = readCanvasPackage(directory, true);
|
|
4321
4346
|
source = await createArraySyncEngineDataSource({
|
|
4347
|
+
name: `Package file ${directory}`,
|
|
4322
4348
|
objects: packageContents.entries ?? [],
|
|
4323
4349
|
selectIdentifier: selectEntryIdentifier,
|
|
4324
4350
|
selectDisplayName: selectEntryDisplayName
|
|
@@ -4360,10 +4386,10 @@ var EntryPatternRemoveModule = {
|
|
|
4360
4386
|
command: "remove <id>",
|
|
4361
4387
|
aliases: ["delete", "rm"],
|
|
4362
4388
|
describe: "Delete an entry pattern",
|
|
4363
|
-
builder: (
|
|
4389
|
+
builder: (yargs34) => withConfiguration(
|
|
4364
4390
|
withApiOptions(
|
|
4365
4391
|
withProjectOptions(
|
|
4366
|
-
|
|
4392
|
+
yargs34.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
|
|
4367
4393
|
)
|
|
4368
4394
|
)
|
|
4369
4395
|
),
|
|
@@ -4380,10 +4406,10 @@ import { diffJson as diffJson4 } from "diff";
|
|
|
4380
4406
|
var EntryPatternUnpublishModule = {
|
|
4381
4407
|
command: "unpublish [ids]",
|
|
4382
4408
|
describe: "Unpublish an entry patterns",
|
|
4383
|
-
builder: (
|
|
4409
|
+
builder: (yargs34) => withConfiguration(
|
|
4384
4410
|
withApiOptions(
|
|
4385
4411
|
withProjectOptions(
|
|
4386
|
-
|
|
4412
|
+
yargs34.positional("ids", {
|
|
4387
4413
|
describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4388
4414
|
type: "string"
|
|
4389
4415
|
}).option("all", {
|
|
@@ -4456,11 +4482,11 @@ var EntryPatternUpdateModule = {
|
|
|
4456
4482
|
command: "update <filename>",
|
|
4457
4483
|
aliases: ["put"],
|
|
4458
4484
|
describe: "Insert or update an entry pattern",
|
|
4459
|
-
builder: (
|
|
4485
|
+
builder: (yargs34) => withConfiguration(
|
|
4460
4486
|
withApiOptions(
|
|
4461
4487
|
withProjectOptions(
|
|
4462
4488
|
withStateOptions(
|
|
4463
|
-
|
|
4489
|
+
yargs34.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
|
|
4464
4490
|
)
|
|
4465
4491
|
)
|
|
4466
4492
|
)
|
|
@@ -4477,7 +4503,7 @@ var EntryPatternUpdateModule = {
|
|
|
4477
4503
|
var EntryPatternModule = {
|
|
4478
4504
|
command: "entry-pattern <command>",
|
|
4479
4505
|
describe: "Commands for Entry patterns",
|
|
4480
|
-
builder: (
|
|
4506
|
+
builder: (yargs34) => yargs34.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
|
|
4481
4507
|
handler: () => {
|
|
4482
4508
|
yargs10.help();
|
|
4483
4509
|
}
|
|
@@ -4506,6 +4532,7 @@ function createLocaleEngineDataSource({
|
|
|
4506
4532
|
}
|
|
4507
4533
|
}
|
|
4508
4534
|
return {
|
|
4535
|
+
name: "Uniform API",
|
|
4509
4536
|
objects: getObjects(),
|
|
4510
4537
|
deleteObject: async (providerId) => {
|
|
4511
4538
|
await client.remove({ locale: providerId });
|
|
@@ -4522,11 +4549,11 @@ function createLocaleEngineDataSource({
|
|
|
4522
4549
|
var LocalePullModule = {
|
|
4523
4550
|
command: "pull <directory>",
|
|
4524
4551
|
describe: "Pulls all locales to local files in a directory",
|
|
4525
|
-
builder: (
|
|
4552
|
+
builder: (yargs34) => withConfiguration(
|
|
4526
4553
|
withApiOptions(
|
|
4527
4554
|
withProjectOptions(
|
|
4528
4555
|
withDiffOptions(
|
|
4529
|
-
|
|
4556
|
+
yargs34.positional("directory", {
|
|
4530
4557
|
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.",
|
|
4531
4558
|
type: "string"
|
|
4532
4559
|
}).option("format", {
|
|
@@ -4577,6 +4604,7 @@ var LocalePullModule = {
|
|
|
4577
4604
|
if (isPackage) {
|
|
4578
4605
|
const packageContents = readCanvasPackage(directory, false);
|
|
4579
4606
|
target = await createArraySyncEngineDataSource({
|
|
4607
|
+
name: `Package file ${directory}`,
|
|
4580
4608
|
objects: packageContents.locales ?? [],
|
|
4581
4609
|
selectIdentifier: (i) => i.locale,
|
|
4582
4610
|
selectDisplayName: (i) => i.displayName,
|
|
@@ -4609,11 +4637,11 @@ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
|
4609
4637
|
var LocalePushModule = {
|
|
4610
4638
|
command: "push <directory>",
|
|
4611
4639
|
describe: "Pushes all locales from files in a directory to Uniform",
|
|
4612
|
-
builder: (
|
|
4640
|
+
builder: (yargs34) => withConfiguration(
|
|
4613
4641
|
withApiOptions(
|
|
4614
4642
|
withProjectOptions(
|
|
4615
4643
|
withDiffOptions(
|
|
4616
|
-
|
|
4644
|
+
yargs34.positional("directory", {
|
|
4617
4645
|
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
4618
4646
|
type: "string"
|
|
4619
4647
|
}).option("what-if", {
|
|
@@ -4656,6 +4684,7 @@ var LocalePushModule = {
|
|
|
4656
4684
|
if (isPackage) {
|
|
4657
4685
|
const packageContents = readCanvasPackage(directory, true);
|
|
4658
4686
|
source = await createArraySyncEngineDataSource({
|
|
4687
|
+
name: `Package file ${directory}`,
|
|
4659
4688
|
objects: packageContents.locales ?? [],
|
|
4660
4689
|
selectIdentifier: (locale) => locale.locale,
|
|
4661
4690
|
selectDisplayName: (locale) => locale.displayName
|
|
@@ -4683,7 +4712,7 @@ var LocalePushModule = {
|
|
|
4683
4712
|
var LocaleModule = {
|
|
4684
4713
|
command: "locale <command>",
|
|
4685
4714
|
describe: "Commands for locale definitions",
|
|
4686
|
-
builder: (
|
|
4715
|
+
builder: (yargs34) => yargs34.command(LocalePullModule).command(LocalePushModule),
|
|
4687
4716
|
handler: () => {
|
|
4688
4717
|
yargs11.help();
|
|
4689
4718
|
}
|
|
@@ -4697,12 +4726,12 @@ import { PromptClient } from "@uniformdev/canvas";
|
|
|
4697
4726
|
var PromptGetModule = {
|
|
4698
4727
|
command: "get <id>",
|
|
4699
4728
|
describe: "Get a prompt",
|
|
4700
|
-
builder: (
|
|
4729
|
+
builder: (yargs34) => withConfiguration(
|
|
4701
4730
|
withFormatOptions(
|
|
4702
4731
|
withApiOptions(
|
|
4703
4732
|
withProjectOptions(
|
|
4704
4733
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4705
|
-
|
|
4734
|
+
yargs34.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
4706
4735
|
)
|
|
4707
4736
|
)
|
|
4708
4737
|
)
|
|
@@ -4723,7 +4752,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
4723
4752
|
var PromptListModule = {
|
|
4724
4753
|
command: "list",
|
|
4725
4754
|
describe: "List prompts",
|
|
4726
|
-
builder: (
|
|
4755
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
4727
4756
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4728
4757
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4729
4758
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -4756,6 +4785,7 @@ function createPromptEngineDataSource({
|
|
|
4756
4785
|
}
|
|
4757
4786
|
}
|
|
4758
4787
|
return {
|
|
4788
|
+
name: "Uniform API",
|
|
4759
4789
|
objects: getObjects(),
|
|
4760
4790
|
deleteObject: async (providerId) => {
|
|
4761
4791
|
await client.remove({ promptId: providerId });
|
|
@@ -4770,12 +4800,12 @@ function createPromptEngineDataSource({
|
|
|
4770
4800
|
var PromptPullModule = {
|
|
4771
4801
|
command: "pull <directory>",
|
|
4772
4802
|
describe: "Pulls all prompts to local files in a directory",
|
|
4773
|
-
builder: (
|
|
4803
|
+
builder: (yargs34) => withConfiguration(
|
|
4774
4804
|
withApiOptions(
|
|
4775
4805
|
withProjectOptions(
|
|
4776
4806
|
withStateOptions(
|
|
4777
4807
|
withDiffOptions(
|
|
4778
|
-
|
|
4808
|
+
yargs34.positional("directory", {
|
|
4779
4809
|
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.",
|
|
4780
4810
|
type: "string"
|
|
4781
4811
|
}).option("format", {
|
|
@@ -4827,6 +4857,7 @@ var PromptPullModule = {
|
|
|
4827
4857
|
if (isPackage) {
|
|
4828
4858
|
const packageContents = readCanvasPackage(directory, false);
|
|
4829
4859
|
target = await createArraySyncEngineDataSource({
|
|
4860
|
+
name: `Package file ${directory}`,
|
|
4830
4861
|
objects: packageContents.prompts ?? [],
|
|
4831
4862
|
selectIdentifier: selectPromptIdentifier,
|
|
4832
4863
|
selectDisplayName: selectPromptDisplayName,
|
|
@@ -4859,12 +4890,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
4859
4890
|
var PromptPushModule = {
|
|
4860
4891
|
command: "push <directory>",
|
|
4861
4892
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
4862
|
-
builder: (
|
|
4893
|
+
builder: (yargs34) => withConfiguration(
|
|
4863
4894
|
withApiOptions(
|
|
4864
4895
|
withProjectOptions(
|
|
4865
4896
|
withStateOptions(
|
|
4866
4897
|
withDiffOptions(
|
|
4867
|
-
|
|
4898
|
+
yargs34.positional("directory", {
|
|
4868
4899
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
4869
4900
|
type: "string"
|
|
4870
4901
|
}).option("what-if", {
|
|
@@ -4908,6 +4939,7 @@ var PromptPushModule = {
|
|
|
4908
4939
|
if (isPackage) {
|
|
4909
4940
|
const packageContents = readCanvasPackage(directory, true);
|
|
4910
4941
|
source = await createArraySyncEngineDataSource({
|
|
4942
|
+
name: `Package file ${directory}`,
|
|
4911
4943
|
objects: packageContents.prompts ?? [],
|
|
4912
4944
|
selectIdentifier: selectPromptIdentifier,
|
|
4913
4945
|
selectDisplayName: selectPromptDisplayName
|
|
@@ -4937,9 +4969,9 @@ var PromptRemoveModule = {
|
|
|
4937
4969
|
command: "remove <id>",
|
|
4938
4970
|
aliases: ["delete", "rm"],
|
|
4939
4971
|
describe: "Delete a prompt",
|
|
4940
|
-
builder: (
|
|
4972
|
+
builder: (yargs34) => withConfiguration(
|
|
4941
4973
|
withApiOptions(
|
|
4942
|
-
withProjectOptions(
|
|
4974
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
4943
4975
|
)
|
|
4944
4976
|
),
|
|
4945
4977
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -4955,10 +4987,10 @@ var PromptUpdateModule = {
|
|
|
4955
4987
|
command: "update <filename>",
|
|
4956
4988
|
aliases: ["put"],
|
|
4957
4989
|
describe: "Insert or update a prompt",
|
|
4958
|
-
builder: (
|
|
4990
|
+
builder: (yargs34) => withConfiguration(
|
|
4959
4991
|
withApiOptions(
|
|
4960
4992
|
withProjectOptions(
|
|
4961
|
-
|
|
4993
|
+
yargs34.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
4962
4994
|
)
|
|
4963
4995
|
)
|
|
4964
4996
|
),
|
|
@@ -4975,39 +5007,242 @@ var PromptModule = {
|
|
|
4975
5007
|
command: "prompt <command>",
|
|
4976
5008
|
aliases: ["dt"],
|
|
4977
5009
|
describe: "Commands for AI Prompt definitions",
|
|
4978
|
-
builder: (
|
|
5010
|
+
builder: (yargs34) => yargs34.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
4979
5011
|
handler: () => {
|
|
4980
5012
|
yargs12.help();
|
|
4981
5013
|
}
|
|
4982
5014
|
};
|
|
4983
5015
|
|
|
5016
|
+
// src/commands/canvas/commands/workflow.ts
|
|
5017
|
+
import yargs13 from "yargs";
|
|
5018
|
+
|
|
5019
|
+
// src/commands/canvas/commands/workflow/pull.ts
|
|
5020
|
+
import { WorkflowClient } from "@uniformdev/canvas";
|
|
5021
|
+
|
|
5022
|
+
// src/commands/canvas/commands/workflow/_util.ts
|
|
5023
|
+
var selectIdentifier5 = (workflow) => workflow.id;
|
|
5024
|
+
var selectDisplayName5 = (workflow) => `${workflow.name} (pid: ${workflow.id})`;
|
|
5025
|
+
|
|
5026
|
+
// src/commands/canvas/workflowEngineDataSource.ts
|
|
5027
|
+
function createWorkflowEngineDataSource({
|
|
5028
|
+
client
|
|
5029
|
+
}) {
|
|
5030
|
+
async function* getObjects() {
|
|
5031
|
+
const workflows = paginateAsync(async () => (await client.get()).results, {
|
|
5032
|
+
pageSize: 100
|
|
5033
|
+
});
|
|
5034
|
+
for await (const workflow of workflows) {
|
|
5035
|
+
const { modified, modifiedBy, created, createdBy, ...workflowWithoutStatistics } = workflow;
|
|
5036
|
+
const result = {
|
|
5037
|
+
id: selectIdentifier5(workflow),
|
|
5038
|
+
displayName: selectDisplayName5(workflow),
|
|
5039
|
+
providerId: workflow.id,
|
|
5040
|
+
object: workflowWithoutStatistics
|
|
5041
|
+
};
|
|
5042
|
+
yield result;
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
5045
|
+
return {
|
|
5046
|
+
name: "Uniform API",
|
|
5047
|
+
objects: getObjects(),
|
|
5048
|
+
deleteObject: async (providerId) => {
|
|
5049
|
+
await client.remove({ workflowId: providerId });
|
|
5050
|
+
},
|
|
5051
|
+
writeObject: async (object) => {
|
|
5052
|
+
await client.upsert({ workflow: object.object });
|
|
5053
|
+
}
|
|
5054
|
+
};
|
|
5055
|
+
}
|
|
5056
|
+
|
|
5057
|
+
// src/commands/canvas/commands/workflow/pull.ts
|
|
5058
|
+
var WorkflowPullModule = {
|
|
5059
|
+
command: "pull <directory>",
|
|
5060
|
+
describe: "Pulls all workflows to local files in a directory",
|
|
5061
|
+
builder: (yargs34) => withConfiguration(
|
|
5062
|
+
withApiOptions(
|
|
5063
|
+
withProjectOptions(
|
|
5064
|
+
withDiffOptions(
|
|
5065
|
+
yargs34.positional("directory", {
|
|
5066
|
+
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.",
|
|
5067
|
+
type: "string"
|
|
5068
|
+
}).option("format", {
|
|
5069
|
+
alias: ["f"],
|
|
5070
|
+
describe: "Output format",
|
|
5071
|
+
default: "yaml",
|
|
5072
|
+
choices: ["yaml", "json"],
|
|
5073
|
+
type: "string"
|
|
5074
|
+
}).option("what-if", {
|
|
5075
|
+
alias: ["w"],
|
|
5076
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5077
|
+
default: false,
|
|
5078
|
+
type: "boolean"
|
|
5079
|
+
}).option("mode", {
|
|
5080
|
+
alias: ["m"],
|
|
5081
|
+
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',
|
|
5082
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5083
|
+
default: "mirror",
|
|
5084
|
+
type: "string"
|
|
5085
|
+
})
|
|
5086
|
+
)
|
|
5087
|
+
)
|
|
5088
|
+
)
|
|
5089
|
+
),
|
|
5090
|
+
handler: async ({
|
|
5091
|
+
apiHost,
|
|
5092
|
+
apiKey,
|
|
5093
|
+
proxy,
|
|
5094
|
+
directory,
|
|
5095
|
+
format,
|
|
5096
|
+
mode,
|
|
5097
|
+
whatIf,
|
|
5098
|
+
project: projectId,
|
|
5099
|
+
diff: diffMode,
|
|
5100
|
+
allowEmptySource
|
|
5101
|
+
}) => {
|
|
5102
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5103
|
+
const client = new WorkflowClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5104
|
+
const source = createWorkflowEngineDataSource({ client });
|
|
5105
|
+
let target;
|
|
5106
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5107
|
+
if (isPackage) {
|
|
5108
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
5109
|
+
target = await createArraySyncEngineDataSource({
|
|
5110
|
+
name: `Package file ${directory}`,
|
|
5111
|
+
objects: packageContents.workflows ?? [],
|
|
5112
|
+
selectIdentifier: selectIdentifier5,
|
|
5113
|
+
selectDisplayName: selectDisplayName5,
|
|
5114
|
+
onSyncComplete: async (_, synced) => {
|
|
5115
|
+
packageContents.workflows = synced;
|
|
5116
|
+
writeCanvasPackage(directory, packageContents);
|
|
5117
|
+
}
|
|
5118
|
+
});
|
|
5119
|
+
} else {
|
|
5120
|
+
target = await createFileSyncEngineDataSource({
|
|
5121
|
+
directory,
|
|
5122
|
+
selectIdentifier: selectIdentifier5,
|
|
5123
|
+
selectDisplayName: selectDisplayName5,
|
|
5124
|
+
format
|
|
5125
|
+
});
|
|
5126
|
+
}
|
|
5127
|
+
await syncEngine({
|
|
5128
|
+
source,
|
|
5129
|
+
target,
|
|
5130
|
+
mode,
|
|
5131
|
+
whatIf,
|
|
5132
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
5133
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5134
|
+
});
|
|
5135
|
+
}
|
|
5136
|
+
};
|
|
5137
|
+
|
|
5138
|
+
// src/commands/canvas/commands/workflow/push.ts
|
|
5139
|
+
import { WorkflowClient as WorkflowClient2 } from "@uniformdev/canvas";
|
|
5140
|
+
var WorkflowPushModule = {
|
|
5141
|
+
command: "push <directory>",
|
|
5142
|
+
describe: "Pushes all workflows from files in a directory to Uniform Canvas",
|
|
5143
|
+
builder: (yargs34) => withConfiguration(
|
|
5144
|
+
withApiOptions(
|
|
5145
|
+
withProjectOptions(
|
|
5146
|
+
withDiffOptions(
|
|
5147
|
+
yargs34.positional("directory", {
|
|
5148
|
+
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
5149
|
+
type: "string"
|
|
5150
|
+
}).option("what-if", {
|
|
5151
|
+
alias: ["w"],
|
|
5152
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5153
|
+
default: false,
|
|
5154
|
+
type: "boolean"
|
|
5155
|
+
}).option("mode", {
|
|
5156
|
+
alias: ["m"],
|
|
5157
|
+
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',
|
|
5158
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5159
|
+
default: "mirror",
|
|
5160
|
+
type: "string"
|
|
5161
|
+
})
|
|
5162
|
+
)
|
|
5163
|
+
)
|
|
5164
|
+
)
|
|
5165
|
+
),
|
|
5166
|
+
handler: async ({
|
|
5167
|
+
apiHost,
|
|
5168
|
+
apiKey,
|
|
5169
|
+
proxy,
|
|
5170
|
+
directory,
|
|
5171
|
+
mode,
|
|
5172
|
+
whatIf,
|
|
5173
|
+
project: projectId,
|
|
5174
|
+
diff: diffMode,
|
|
5175
|
+
allowEmptySource
|
|
5176
|
+
}) => {
|
|
5177
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5178
|
+
const client = new WorkflowClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
5179
|
+
let source;
|
|
5180
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5181
|
+
if (isPackage) {
|
|
5182
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
5183
|
+
source = await createArraySyncEngineDataSource({
|
|
5184
|
+
name: `Package file ${directory}`,
|
|
5185
|
+
objects: packageContents.workflows ?? [],
|
|
5186
|
+
selectIdentifier: selectIdentifier5,
|
|
5187
|
+
selectDisplayName: selectDisplayName5
|
|
5188
|
+
});
|
|
5189
|
+
} else {
|
|
5190
|
+
source = await createFileSyncEngineDataSource({
|
|
5191
|
+
directory,
|
|
5192
|
+
selectIdentifier: selectIdentifier5,
|
|
5193
|
+
selectDisplayName: selectDisplayName5
|
|
5194
|
+
});
|
|
5195
|
+
}
|
|
5196
|
+
const target = createWorkflowEngineDataSource({ client });
|
|
5197
|
+
await syncEngine({
|
|
5198
|
+
source,
|
|
5199
|
+
target,
|
|
5200
|
+
mode,
|
|
5201
|
+
whatIf,
|
|
5202
|
+
allowEmptySource,
|
|
5203
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5204
|
+
});
|
|
5205
|
+
}
|
|
5206
|
+
};
|
|
5207
|
+
|
|
5208
|
+
// src/commands/canvas/commands/workflow.ts
|
|
5209
|
+
var WorkflowModule = {
|
|
5210
|
+
command: "workflow <command>",
|
|
5211
|
+
aliases: ["wf"],
|
|
5212
|
+
describe: "Commands for Canvas workflows",
|
|
5213
|
+
builder: (yargs34) => yargs34.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
|
|
5214
|
+
handler: () => {
|
|
5215
|
+
yargs13.help();
|
|
5216
|
+
}
|
|
5217
|
+
};
|
|
5218
|
+
|
|
4984
5219
|
// src/commands/canvas/index.ts
|
|
4985
5220
|
var CanvasCommand = {
|
|
4986
5221
|
command: "canvas <command>",
|
|
4987
5222
|
aliases: ["cv", "pm", "presentation"],
|
|
4988
5223
|
describe: "Uniform Canvas commands",
|
|
4989
|
-
builder: (
|
|
5224
|
+
builder: (yargs34) => yargs34.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(ComponentPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LocaleModule).command(WorkflowModule).demandCommand(),
|
|
4990
5225
|
handler: () => {
|
|
4991
|
-
|
|
5226
|
+
yargs14.showHelp();
|
|
4992
5227
|
}
|
|
4993
5228
|
};
|
|
4994
5229
|
|
|
4995
5230
|
// src/commands/context/index.ts
|
|
4996
|
-
import
|
|
5231
|
+
import yargs21 from "yargs";
|
|
4997
5232
|
|
|
4998
5233
|
// src/commands/context/commands/aggregate.ts
|
|
4999
|
-
import
|
|
5234
|
+
import yargs15 from "yargs";
|
|
5000
5235
|
|
|
5001
5236
|
// src/commands/context/commands/aggregate/get.ts
|
|
5002
5237
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
5003
5238
|
var AggregateGetModule = {
|
|
5004
5239
|
command: "get <id>",
|
|
5005
5240
|
describe: "Fetch an aggregate",
|
|
5006
|
-
builder: (
|
|
5241
|
+
builder: (yargs34) => withConfiguration(
|
|
5007
5242
|
withFormatOptions(
|
|
5008
5243
|
withApiOptions(
|
|
5009
5244
|
withProjectOptions(
|
|
5010
|
-
|
|
5245
|
+
yargs34.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
5011
5246
|
)
|
|
5012
5247
|
)
|
|
5013
5248
|
)
|
|
@@ -5031,7 +5266,7 @@ var AggregateListModule = {
|
|
|
5031
5266
|
command: "list",
|
|
5032
5267
|
describe: "List aggregates",
|
|
5033
5268
|
aliases: ["ls"],
|
|
5034
|
-
builder: (
|
|
5269
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
5035
5270
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5036
5271
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5037
5272
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5044,8 +5279,8 @@ var AggregateListModule = {
|
|
|
5044
5279
|
import { UncachedAggregateClient as UncachedAggregateClient3 } from "@uniformdev/context/api";
|
|
5045
5280
|
|
|
5046
5281
|
// src/commands/context/commands/aggregate/_util.ts
|
|
5047
|
-
var
|
|
5048
|
-
var
|
|
5282
|
+
var selectIdentifier6 = (source) => source.id;
|
|
5283
|
+
var selectDisplayName6 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5049
5284
|
|
|
5050
5285
|
// src/commands/context/aggregateEngineDataSource.ts
|
|
5051
5286
|
function createAggregateEngineDataSource({
|
|
@@ -5056,8 +5291,8 @@ function createAggregateEngineDataSource({
|
|
|
5056
5291
|
const aggregates = (await client.get({ type })).aggregates;
|
|
5057
5292
|
for await (const def of aggregates) {
|
|
5058
5293
|
const result = {
|
|
5059
|
-
id:
|
|
5060
|
-
displayName:
|
|
5294
|
+
id: selectIdentifier6(def),
|
|
5295
|
+
displayName: selectDisplayName6(def),
|
|
5061
5296
|
providerId: def.id,
|
|
5062
5297
|
object: def
|
|
5063
5298
|
};
|
|
@@ -5066,6 +5301,7 @@ function createAggregateEngineDataSource({
|
|
|
5066
5301
|
}
|
|
5067
5302
|
const writtenObjects = [];
|
|
5068
5303
|
return {
|
|
5304
|
+
name: "Uniform API",
|
|
5069
5305
|
objects: getObjects(),
|
|
5070
5306
|
deleteObject: async (providerId) => {
|
|
5071
5307
|
await client.remove({ aggregateId: providerId });
|
|
@@ -5097,11 +5333,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
5097
5333
|
var AggregatePullModule = {
|
|
5098
5334
|
command: "pull <directory>",
|
|
5099
5335
|
describe: "Pulls all aggregates to local files in a directory",
|
|
5100
|
-
builder: (
|
|
5336
|
+
builder: (yargs34) => withConfiguration(
|
|
5101
5337
|
withApiOptions(
|
|
5102
5338
|
withProjectOptions(
|
|
5103
5339
|
withDiffOptions(
|
|
5104
|
-
|
|
5340
|
+
yargs34.positional("directory", {
|
|
5105
5341
|
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.",
|
|
5106
5342
|
type: "string"
|
|
5107
5343
|
}).option("format", {
|
|
@@ -5146,9 +5382,10 @@ var AggregatePullModule = {
|
|
|
5146
5382
|
if (isPackage) {
|
|
5147
5383
|
const packageContents = readContextPackage(directory, false);
|
|
5148
5384
|
target = await createArraySyncEngineDataSource({
|
|
5385
|
+
name: `Package file ${directory}`,
|
|
5149
5386
|
objects: packageContents.aggregates ?? [],
|
|
5150
|
-
selectIdentifier:
|
|
5151
|
-
selectDisplayName:
|
|
5387
|
+
selectIdentifier: selectIdentifier6,
|
|
5388
|
+
selectDisplayName: selectDisplayName6,
|
|
5152
5389
|
onSyncComplete: async (_, synced) => {
|
|
5153
5390
|
packageContents.aggregates = synced;
|
|
5154
5391
|
writeContextPackage(directory, packageContents);
|
|
@@ -5157,8 +5394,8 @@ var AggregatePullModule = {
|
|
|
5157
5394
|
} else {
|
|
5158
5395
|
target = await createFileSyncEngineDataSource({
|
|
5159
5396
|
directory,
|
|
5160
|
-
selectIdentifier:
|
|
5161
|
-
selectDisplayName:
|
|
5397
|
+
selectIdentifier: selectIdentifier6,
|
|
5398
|
+
selectDisplayName: selectDisplayName6,
|
|
5162
5399
|
format
|
|
5163
5400
|
});
|
|
5164
5401
|
}
|
|
@@ -5178,11 +5415,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
5178
5415
|
var AggregatePushModule = {
|
|
5179
5416
|
command: "push <directory>",
|
|
5180
5417
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
5181
|
-
builder: (
|
|
5418
|
+
builder: (yargs34) => withConfiguration(
|
|
5182
5419
|
withApiOptions(
|
|
5183
5420
|
withProjectOptions(
|
|
5184
5421
|
withDiffOptions(
|
|
5185
|
-
|
|
5422
|
+
yargs34.positional("directory", {
|
|
5186
5423
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
5187
5424
|
type: "string"
|
|
5188
5425
|
}).option("what-if", {
|
|
@@ -5219,15 +5456,16 @@ var AggregatePushModule = {
|
|
|
5219
5456
|
if (isPackage) {
|
|
5220
5457
|
const packageContents = readContextPackage(directory, true);
|
|
5221
5458
|
source = await createArraySyncEngineDataSource({
|
|
5459
|
+
name: `Package file ${directory}`,
|
|
5222
5460
|
objects: packageContents.aggregates ?? [],
|
|
5223
|
-
selectIdentifier:
|
|
5224
|
-
selectDisplayName:
|
|
5461
|
+
selectIdentifier: selectIdentifier6,
|
|
5462
|
+
selectDisplayName: selectDisplayName6
|
|
5225
5463
|
});
|
|
5226
5464
|
} else {
|
|
5227
5465
|
source = await createFileSyncEngineDataSource({
|
|
5228
5466
|
directory,
|
|
5229
|
-
selectIdentifier:
|
|
5230
|
-
selectDisplayName:
|
|
5467
|
+
selectIdentifier: selectIdentifier6,
|
|
5468
|
+
selectDisplayName: selectDisplayName6
|
|
5231
5469
|
});
|
|
5232
5470
|
}
|
|
5233
5471
|
const target = createAggregateEngineDataSource({ client });
|
|
@@ -5249,10 +5487,10 @@ var AggregateRemoveModule = {
|
|
|
5249
5487
|
command: "remove <id>",
|
|
5250
5488
|
aliases: ["delete", "rm"],
|
|
5251
5489
|
describe: "Delete an aggregate",
|
|
5252
|
-
builder: (
|
|
5490
|
+
builder: (yargs34) => withConfiguration(
|
|
5253
5491
|
withApiOptions(
|
|
5254
5492
|
withProjectOptions(
|
|
5255
|
-
|
|
5493
|
+
yargs34.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
5256
5494
|
)
|
|
5257
5495
|
)
|
|
5258
5496
|
),
|
|
@@ -5269,10 +5507,10 @@ var AggregateUpdateModule = {
|
|
|
5269
5507
|
command: "update <filename>",
|
|
5270
5508
|
aliases: ["put"],
|
|
5271
5509
|
describe: "Insert or update an aggregate",
|
|
5272
|
-
builder: (
|
|
5510
|
+
builder: (yargs34) => withConfiguration(
|
|
5273
5511
|
withApiOptions(
|
|
5274
5512
|
withProjectOptions(
|
|
5275
|
-
|
|
5513
|
+
yargs34.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
5276
5514
|
)
|
|
5277
5515
|
)
|
|
5278
5516
|
),
|
|
@@ -5289,25 +5527,25 @@ var AggregateModule = {
|
|
|
5289
5527
|
command: "aggregate <command>",
|
|
5290
5528
|
aliases: ["agg", "intent", "audience"],
|
|
5291
5529
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
5292
|
-
builder: (
|
|
5530
|
+
builder: (yargs34) => yargs34.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
5293
5531
|
handler: () => {
|
|
5294
|
-
|
|
5532
|
+
yargs15.help();
|
|
5295
5533
|
}
|
|
5296
5534
|
};
|
|
5297
5535
|
|
|
5298
5536
|
// src/commands/context/commands/enrichment.ts
|
|
5299
|
-
import
|
|
5537
|
+
import yargs16 from "yargs";
|
|
5300
5538
|
|
|
5301
5539
|
// src/commands/context/commands/enrichment/get.ts
|
|
5302
5540
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
5303
5541
|
var EnrichmentGetModule = {
|
|
5304
5542
|
command: "get <id>",
|
|
5305
5543
|
describe: "Fetch an enrichment category and its values",
|
|
5306
|
-
builder: (
|
|
5544
|
+
builder: (yargs34) => withFormatOptions(
|
|
5307
5545
|
withConfiguration(
|
|
5308
5546
|
withApiOptions(
|
|
5309
5547
|
withProjectOptions(
|
|
5310
|
-
|
|
5548
|
+
yargs34.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
5311
5549
|
)
|
|
5312
5550
|
)
|
|
5313
5551
|
)
|
|
@@ -5332,7 +5570,7 @@ var EnrichmentListModule = {
|
|
|
5332
5570
|
command: "list",
|
|
5333
5571
|
describe: "List enrichments",
|
|
5334
5572
|
aliases: ["ls"],
|
|
5335
|
-
builder: (
|
|
5573
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
5336
5574
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5337
5575
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5338
5576
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5345,8 +5583,8 @@ var EnrichmentListModule = {
|
|
|
5345
5583
|
import { UncachedEnrichmentClient as UncachedEnrichmentClient3 } from "@uniformdev/context/api";
|
|
5346
5584
|
|
|
5347
5585
|
// src/commands/context/commands/enrichment/_util.ts
|
|
5348
|
-
var
|
|
5349
|
-
var
|
|
5586
|
+
var selectIdentifier7 = (source) => source.id;
|
|
5587
|
+
var selectDisplayName7 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5350
5588
|
|
|
5351
5589
|
// src/commands/context/enrichmentEngineDataSource.ts
|
|
5352
5590
|
function createEnrichmentEngineDataSource({
|
|
@@ -5356,8 +5594,8 @@ function createEnrichmentEngineDataSource({
|
|
|
5356
5594
|
const enrichments = (await client.get()).enrichments;
|
|
5357
5595
|
for await (const def of enrichments) {
|
|
5358
5596
|
const result = {
|
|
5359
|
-
id:
|
|
5360
|
-
displayName:
|
|
5597
|
+
id: selectIdentifier7(def),
|
|
5598
|
+
displayName: selectDisplayName7(def),
|
|
5361
5599
|
providerId: def.id,
|
|
5362
5600
|
object: def
|
|
5363
5601
|
};
|
|
@@ -5365,6 +5603,7 @@ function createEnrichmentEngineDataSource({
|
|
|
5365
5603
|
}
|
|
5366
5604
|
}
|
|
5367
5605
|
return {
|
|
5606
|
+
name: "Uniform API",
|
|
5368
5607
|
objects: getObjects(),
|
|
5369
5608
|
deleteObject: async (providerId) => {
|
|
5370
5609
|
await client.removeCategory({ enrichmentId: providerId });
|
|
@@ -5413,6 +5652,7 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
5413
5652
|
}
|
|
5414
5653
|
};
|
|
5415
5654
|
return {
|
|
5655
|
+
name: "Uniform API",
|
|
5416
5656
|
objects: iterator(),
|
|
5417
5657
|
deleteObject: async (providerId) => {
|
|
5418
5658
|
if (!client) {
|
|
@@ -5433,11 +5673,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
5433
5673
|
var EnrichmentPullModule = {
|
|
5434
5674
|
command: "pull <directory>",
|
|
5435
5675
|
describe: "Pulls all enrichments to local files in a directory",
|
|
5436
|
-
builder: (
|
|
5676
|
+
builder: (yargs34) => withConfiguration(
|
|
5437
5677
|
withApiOptions(
|
|
5438
5678
|
withProjectOptions(
|
|
5439
5679
|
withDiffOptions(
|
|
5440
|
-
|
|
5680
|
+
yargs34.positional("directory", {
|
|
5441
5681
|
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.",
|
|
5442
5682
|
type: "string"
|
|
5443
5683
|
}).option("format", {
|
|
@@ -5482,9 +5722,10 @@ var EnrichmentPullModule = {
|
|
|
5482
5722
|
if (isPackage) {
|
|
5483
5723
|
const packageContents = readContextPackage(directory, false);
|
|
5484
5724
|
target = await createArraySyncEngineDataSource({
|
|
5725
|
+
name: `Package file ${directory}`,
|
|
5485
5726
|
objects: packageContents.enrichments ?? [],
|
|
5486
|
-
selectIdentifier:
|
|
5487
|
-
selectDisplayName:
|
|
5727
|
+
selectIdentifier: selectIdentifier7,
|
|
5728
|
+
selectDisplayName: selectDisplayName7,
|
|
5488
5729
|
onSyncComplete: async (_, synced) => {
|
|
5489
5730
|
packageContents.enrichments = synced;
|
|
5490
5731
|
writeContextPackage(directory, packageContents);
|
|
@@ -5493,8 +5734,8 @@ var EnrichmentPullModule = {
|
|
|
5493
5734
|
} else {
|
|
5494
5735
|
target = await createFileSyncEngineDataSource({
|
|
5495
5736
|
directory,
|
|
5496
|
-
selectIdentifier:
|
|
5497
|
-
selectDisplayName:
|
|
5737
|
+
selectIdentifier: selectIdentifier7,
|
|
5738
|
+
selectDisplayName: selectDisplayName7,
|
|
5498
5739
|
format
|
|
5499
5740
|
});
|
|
5500
5741
|
}
|
|
@@ -5514,11 +5755,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
5514
5755
|
var EnrichmentPushModule = {
|
|
5515
5756
|
command: "push <directory>",
|
|
5516
5757
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
5517
|
-
builder: (
|
|
5758
|
+
builder: (yargs34) => withConfiguration(
|
|
5518
5759
|
withApiOptions(
|
|
5519
5760
|
withProjectOptions(
|
|
5520
5761
|
withDiffOptions(
|
|
5521
|
-
|
|
5762
|
+
yargs34.positional("directory", {
|
|
5522
5763
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
5523
5764
|
type: "string"
|
|
5524
5765
|
}).option("what-if", {
|
|
@@ -5555,15 +5796,16 @@ var EnrichmentPushModule = {
|
|
|
5555
5796
|
if (isPackage) {
|
|
5556
5797
|
const packageContents = readContextPackage(directory, true);
|
|
5557
5798
|
source = await createArraySyncEngineDataSource({
|
|
5799
|
+
name: `Package file ${directory}`,
|
|
5558
5800
|
objects: packageContents.enrichments ?? [],
|
|
5559
|
-
selectIdentifier:
|
|
5560
|
-
selectDisplayName:
|
|
5801
|
+
selectIdentifier: selectIdentifier7,
|
|
5802
|
+
selectDisplayName: selectDisplayName7
|
|
5561
5803
|
});
|
|
5562
5804
|
} else {
|
|
5563
5805
|
source = await createFileSyncEngineDataSource({
|
|
5564
5806
|
directory,
|
|
5565
|
-
selectIdentifier:
|
|
5566
|
-
selectDisplayName:
|
|
5807
|
+
selectIdentifier: selectIdentifier7,
|
|
5808
|
+
selectDisplayName: selectDisplayName7
|
|
5567
5809
|
});
|
|
5568
5810
|
}
|
|
5569
5811
|
const target = createEnrichmentEngineDataSource({ client });
|
|
@@ -5584,10 +5826,10 @@ var EnrichmentRemoveModule = {
|
|
|
5584
5826
|
command: "remove <id>",
|
|
5585
5827
|
aliases: ["delete", "rm"],
|
|
5586
5828
|
describe: "Delete an enrichment category and its values",
|
|
5587
|
-
builder: (
|
|
5829
|
+
builder: (yargs34) => withConfiguration(
|
|
5588
5830
|
withApiOptions(
|
|
5589
5831
|
withProjectOptions(
|
|
5590
|
-
|
|
5832
|
+
yargs34.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
5591
5833
|
)
|
|
5592
5834
|
)
|
|
5593
5835
|
),
|
|
@@ -5603,14 +5845,14 @@ var EnrichmentModule = {
|
|
|
5603
5845
|
command: "enrichment <command>",
|
|
5604
5846
|
aliases: ["enr"],
|
|
5605
5847
|
describe: "Commands for Context enrichments",
|
|
5606
|
-
builder: (
|
|
5848
|
+
builder: (yargs34) => yargs34.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
5607
5849
|
handler: () => {
|
|
5608
|
-
|
|
5850
|
+
yargs16.help();
|
|
5609
5851
|
}
|
|
5610
5852
|
};
|
|
5611
5853
|
|
|
5612
5854
|
// src/commands/context/commands/manifest.ts
|
|
5613
|
-
import
|
|
5855
|
+
import yargs17 from "yargs";
|
|
5614
5856
|
|
|
5615
5857
|
// src/commands/context/commands/manifest/get.ts
|
|
5616
5858
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -5621,10 +5863,10 @@ var ManifestGetModule = {
|
|
|
5621
5863
|
command: "get [output]",
|
|
5622
5864
|
aliases: ["dl", "download"],
|
|
5623
5865
|
describe: "Download the Uniform Context manifest for a project",
|
|
5624
|
-
builder: (
|
|
5866
|
+
builder: (yargs34) => withConfiguration(
|
|
5625
5867
|
withApiOptions(
|
|
5626
5868
|
withProjectOptions(
|
|
5627
|
-
|
|
5869
|
+
yargs34.option("preview", {
|
|
5628
5870
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
5629
5871
|
default: false,
|
|
5630
5872
|
type: "boolean",
|
|
@@ -5686,7 +5928,7 @@ import { exit as exit2 } from "process";
|
|
|
5686
5928
|
var ManifestPublishModule = {
|
|
5687
5929
|
command: "publish",
|
|
5688
5930
|
describe: "Publish the Uniform Context manifest for a project",
|
|
5689
|
-
builder: (
|
|
5931
|
+
builder: (yargs34) => withConfiguration(withApiOptions(withProjectOptions(yargs34))),
|
|
5690
5932
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
5691
5933
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5692
5934
|
try {
|
|
@@ -5719,25 +5961,25 @@ var ManifestModule = {
|
|
|
5719
5961
|
command: "manifest <command>",
|
|
5720
5962
|
describe: "Commands for context manifests",
|
|
5721
5963
|
aliases: ["man"],
|
|
5722
|
-
builder: (
|
|
5964
|
+
builder: (yargs34) => yargs34.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
5723
5965
|
handler: () => {
|
|
5724
|
-
|
|
5966
|
+
yargs17.help();
|
|
5725
5967
|
}
|
|
5726
5968
|
};
|
|
5727
5969
|
|
|
5728
5970
|
// src/commands/context/commands/quirk.ts
|
|
5729
|
-
import
|
|
5971
|
+
import yargs18 from "yargs";
|
|
5730
5972
|
|
|
5731
5973
|
// src/commands/context/commands/quirk/get.ts
|
|
5732
5974
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
5733
5975
|
var QuirkGetModule = {
|
|
5734
5976
|
command: "get <id>",
|
|
5735
5977
|
describe: "Fetch a quirk",
|
|
5736
|
-
builder: (
|
|
5978
|
+
builder: (yargs34) => withConfiguration(
|
|
5737
5979
|
withFormatOptions(
|
|
5738
5980
|
withApiOptions(
|
|
5739
5981
|
withProjectOptions(
|
|
5740
|
-
|
|
5982
|
+
yargs34.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
5741
5983
|
)
|
|
5742
5984
|
)
|
|
5743
5985
|
)
|
|
@@ -5761,11 +6003,11 @@ var QuirkListModule = {
|
|
|
5761
6003
|
command: "list",
|
|
5762
6004
|
describe: "List quirks",
|
|
5763
6005
|
aliases: ["ls"],
|
|
5764
|
-
builder: (
|
|
6006
|
+
builder: (yargs34) => withConfiguration(
|
|
5765
6007
|
withFormatOptions(
|
|
5766
6008
|
withApiOptions(
|
|
5767
6009
|
withProjectOptions(
|
|
5768
|
-
|
|
6010
|
+
yargs34.option("withIntegrations", {
|
|
5769
6011
|
alias: ["i"],
|
|
5770
6012
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
5771
6013
|
type: "boolean"
|
|
@@ -5786,8 +6028,8 @@ var QuirkListModule = {
|
|
|
5786
6028
|
import { UncachedQuirkClient as UncachedQuirkClient3 } from "@uniformdev/context/api";
|
|
5787
6029
|
|
|
5788
6030
|
// src/commands/context/commands/quirk/_util.ts
|
|
5789
|
-
var
|
|
5790
|
-
var
|
|
6031
|
+
var selectIdentifier8 = (source) => source.id;
|
|
6032
|
+
var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5791
6033
|
|
|
5792
6034
|
// src/commands/context/quirkEngineDataSource.ts
|
|
5793
6035
|
function createQuirkEngineDataSource({
|
|
@@ -5797,8 +6039,8 @@ function createQuirkEngineDataSource({
|
|
|
5797
6039
|
const quirks = (await client.get({ withIntegrations: false })).quirks;
|
|
5798
6040
|
for await (const def of quirks) {
|
|
5799
6041
|
const result = {
|
|
5800
|
-
id:
|
|
5801
|
-
displayName:
|
|
6042
|
+
id: selectIdentifier8(def),
|
|
6043
|
+
displayName: selectDisplayName8(def),
|
|
5802
6044
|
providerId: def.id,
|
|
5803
6045
|
object: def
|
|
5804
6046
|
};
|
|
@@ -5806,6 +6048,7 @@ function createQuirkEngineDataSource({
|
|
|
5806
6048
|
}
|
|
5807
6049
|
}
|
|
5808
6050
|
return {
|
|
6051
|
+
name: "Uniform API",
|
|
5809
6052
|
objects: getObjects(),
|
|
5810
6053
|
deleteObject: async (providerId) => {
|
|
5811
6054
|
await client.remove({ quirkId: providerId });
|
|
@@ -5822,11 +6065,11 @@ function createQuirkEngineDataSource({
|
|
|
5822
6065
|
var QuirkPullModule = {
|
|
5823
6066
|
command: "pull <directory>",
|
|
5824
6067
|
describe: "Pulls all quirks to local files in a directory",
|
|
5825
|
-
builder: (
|
|
6068
|
+
builder: (yargs34) => withConfiguration(
|
|
5826
6069
|
withApiOptions(
|
|
5827
6070
|
withProjectOptions(
|
|
5828
6071
|
withDiffOptions(
|
|
5829
|
-
|
|
6072
|
+
yargs34.positional("directory", {
|
|
5830
6073
|
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.",
|
|
5831
6074
|
type: "string"
|
|
5832
6075
|
}).option("format", {
|
|
@@ -5871,9 +6114,10 @@ var QuirkPullModule = {
|
|
|
5871
6114
|
if (isPackage) {
|
|
5872
6115
|
const packageContents = readContextPackage(directory, false);
|
|
5873
6116
|
target = await createArraySyncEngineDataSource({
|
|
6117
|
+
name: `Package file ${directory}`,
|
|
5874
6118
|
objects: packageContents.quirks ?? [],
|
|
5875
|
-
selectIdentifier:
|
|
5876
|
-
selectDisplayName:
|
|
6119
|
+
selectIdentifier: selectIdentifier8,
|
|
6120
|
+
selectDisplayName: selectDisplayName8,
|
|
5877
6121
|
onSyncComplete: async (_, synced) => {
|
|
5878
6122
|
packageContents.quirks = synced;
|
|
5879
6123
|
writeContextPackage(directory, packageContents);
|
|
@@ -5882,8 +6126,8 @@ var QuirkPullModule = {
|
|
|
5882
6126
|
} else {
|
|
5883
6127
|
target = await createFileSyncEngineDataSource({
|
|
5884
6128
|
directory,
|
|
5885
|
-
selectIdentifier:
|
|
5886
|
-
selectDisplayName:
|
|
6129
|
+
selectIdentifier: selectIdentifier8,
|
|
6130
|
+
selectDisplayName: selectDisplayName8,
|
|
5887
6131
|
format
|
|
5888
6132
|
});
|
|
5889
6133
|
}
|
|
@@ -5903,11 +6147,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
5903
6147
|
var QuirkPushModule = {
|
|
5904
6148
|
command: "push <directory>",
|
|
5905
6149
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
5906
|
-
builder: (
|
|
6150
|
+
builder: (yargs34) => withConfiguration(
|
|
5907
6151
|
withApiOptions(
|
|
5908
6152
|
withProjectOptions(
|
|
5909
6153
|
withDiffOptions(
|
|
5910
|
-
|
|
6154
|
+
yargs34.positional("directory", {
|
|
5911
6155
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
5912
6156
|
type: "string"
|
|
5913
6157
|
}).option("what-if", {
|
|
@@ -5944,15 +6188,16 @@ var QuirkPushModule = {
|
|
|
5944
6188
|
if (isPackage) {
|
|
5945
6189
|
const packageContents = readContextPackage(directory, true);
|
|
5946
6190
|
source = await createArraySyncEngineDataSource({
|
|
6191
|
+
name: `Package file ${directory}`,
|
|
5947
6192
|
objects: packageContents.quirks ?? [],
|
|
5948
|
-
selectIdentifier:
|
|
5949
|
-
selectDisplayName:
|
|
6193
|
+
selectIdentifier: selectIdentifier8,
|
|
6194
|
+
selectDisplayName: selectDisplayName8
|
|
5950
6195
|
});
|
|
5951
6196
|
} else {
|
|
5952
6197
|
source = await createFileSyncEngineDataSource({
|
|
5953
6198
|
directory,
|
|
5954
|
-
selectIdentifier:
|
|
5955
|
-
selectDisplayName:
|
|
6199
|
+
selectIdentifier: selectIdentifier8,
|
|
6200
|
+
selectDisplayName: selectDisplayName8
|
|
5956
6201
|
});
|
|
5957
6202
|
}
|
|
5958
6203
|
const target = createQuirkEngineDataSource({ client });
|
|
@@ -5973,10 +6218,10 @@ var QuirkRemoveModule = {
|
|
|
5973
6218
|
command: "remove <id>",
|
|
5974
6219
|
aliases: ["delete", "rm"],
|
|
5975
6220
|
describe: "Delete a quirk",
|
|
5976
|
-
builder: (
|
|
6221
|
+
builder: (yargs34) => withConfiguration(
|
|
5977
6222
|
withApiOptions(
|
|
5978
6223
|
withProjectOptions(
|
|
5979
|
-
|
|
6224
|
+
yargs34.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
5980
6225
|
)
|
|
5981
6226
|
)
|
|
5982
6227
|
),
|
|
@@ -5993,10 +6238,10 @@ var QuirkUpdateModule = {
|
|
|
5993
6238
|
command: "update <filename>",
|
|
5994
6239
|
aliases: ["put"],
|
|
5995
6240
|
describe: "Insert or update a quirk",
|
|
5996
|
-
builder: (
|
|
6241
|
+
builder: (yargs34) => withConfiguration(
|
|
5997
6242
|
withApiOptions(
|
|
5998
6243
|
withProjectOptions(
|
|
5999
|
-
|
|
6244
|
+
yargs34.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
6000
6245
|
)
|
|
6001
6246
|
)
|
|
6002
6247
|
),
|
|
@@ -6013,25 +6258,25 @@ var QuirkModule = {
|
|
|
6013
6258
|
command: "quirk <command>",
|
|
6014
6259
|
aliases: ["qk"],
|
|
6015
6260
|
describe: "Commands for Context quirks",
|
|
6016
|
-
builder: (
|
|
6261
|
+
builder: (yargs34) => yargs34.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
6017
6262
|
handler: () => {
|
|
6018
|
-
|
|
6263
|
+
yargs18.help();
|
|
6019
6264
|
}
|
|
6020
6265
|
};
|
|
6021
6266
|
|
|
6022
6267
|
// src/commands/context/commands/signal.ts
|
|
6023
|
-
import
|
|
6268
|
+
import yargs19 from "yargs";
|
|
6024
6269
|
|
|
6025
6270
|
// src/commands/context/commands/signal/get.ts
|
|
6026
6271
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
6027
6272
|
var SignalGetModule = {
|
|
6028
6273
|
command: "get <id>",
|
|
6029
6274
|
describe: "Fetch a signal",
|
|
6030
|
-
builder: (
|
|
6275
|
+
builder: (yargs34) => withConfiguration(
|
|
6031
6276
|
withFormatOptions(
|
|
6032
6277
|
withApiOptions(
|
|
6033
6278
|
withProjectOptions(
|
|
6034
|
-
|
|
6279
|
+
yargs34.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
6035
6280
|
)
|
|
6036
6281
|
)
|
|
6037
6282
|
)
|
|
@@ -6055,7 +6300,7 @@ var SignalListModule = {
|
|
|
6055
6300
|
command: "list",
|
|
6056
6301
|
describe: "List signals",
|
|
6057
6302
|
aliases: ["ls"],
|
|
6058
|
-
builder: (
|
|
6303
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
6059
6304
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6060
6305
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6061
6306
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6068,8 +6313,8 @@ var SignalListModule = {
|
|
|
6068
6313
|
import { UncachedSignalClient as UncachedSignalClient3 } from "@uniformdev/context/api";
|
|
6069
6314
|
|
|
6070
6315
|
// src/commands/context/commands/signal/_util.ts
|
|
6071
|
-
var
|
|
6072
|
-
var
|
|
6316
|
+
var selectIdentifier9 = (source) => source.id;
|
|
6317
|
+
var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6073
6318
|
|
|
6074
6319
|
// src/commands/context/signalEngineDataSource.ts
|
|
6075
6320
|
function createSignalEngineDataSource({
|
|
@@ -6079,8 +6324,8 @@ function createSignalEngineDataSource({
|
|
|
6079
6324
|
const signals = (await client.get()).signals;
|
|
6080
6325
|
for await (const def of signals) {
|
|
6081
6326
|
const result = {
|
|
6082
|
-
id:
|
|
6083
|
-
displayName:
|
|
6327
|
+
id: selectIdentifier9(def),
|
|
6328
|
+
displayName: selectDisplayName9(def),
|
|
6084
6329
|
providerId: def.id,
|
|
6085
6330
|
object: def
|
|
6086
6331
|
};
|
|
@@ -6088,6 +6333,7 @@ function createSignalEngineDataSource({
|
|
|
6088
6333
|
}
|
|
6089
6334
|
}
|
|
6090
6335
|
return {
|
|
6336
|
+
name: "Uniform API",
|
|
6091
6337
|
objects: getObjects(),
|
|
6092
6338
|
deleteObject: async (providerId) => {
|
|
6093
6339
|
await client.remove({ signalId: providerId });
|
|
@@ -6104,11 +6350,11 @@ function createSignalEngineDataSource({
|
|
|
6104
6350
|
var SignalPullModule = {
|
|
6105
6351
|
command: "pull <directory>",
|
|
6106
6352
|
describe: "Pulls all signals to local files in a directory",
|
|
6107
|
-
builder: (
|
|
6353
|
+
builder: (yargs34) => withConfiguration(
|
|
6108
6354
|
withApiOptions(
|
|
6109
6355
|
withProjectOptions(
|
|
6110
6356
|
withDiffOptions(
|
|
6111
|
-
|
|
6357
|
+
yargs34.positional("directory", {
|
|
6112
6358
|
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.",
|
|
6113
6359
|
type: "string"
|
|
6114
6360
|
}).option("format", {
|
|
@@ -6153,9 +6399,10 @@ var SignalPullModule = {
|
|
|
6153
6399
|
if (isPackage) {
|
|
6154
6400
|
const packageContents = readContextPackage(directory, false);
|
|
6155
6401
|
target = await createArraySyncEngineDataSource({
|
|
6402
|
+
name: `Package file ${directory}`,
|
|
6156
6403
|
objects: packageContents.signals ?? [],
|
|
6157
|
-
selectIdentifier:
|
|
6158
|
-
selectDisplayName:
|
|
6404
|
+
selectIdentifier: selectIdentifier9,
|
|
6405
|
+
selectDisplayName: selectDisplayName9,
|
|
6159
6406
|
onSyncComplete: async (_, synced) => {
|
|
6160
6407
|
packageContents.signals = synced;
|
|
6161
6408
|
writeContextPackage(directory, packageContents);
|
|
@@ -6164,8 +6411,8 @@ var SignalPullModule = {
|
|
|
6164
6411
|
} else {
|
|
6165
6412
|
target = await createFileSyncEngineDataSource({
|
|
6166
6413
|
directory,
|
|
6167
|
-
selectIdentifier:
|
|
6168
|
-
selectDisplayName:
|
|
6414
|
+
selectIdentifier: selectIdentifier9,
|
|
6415
|
+
selectDisplayName: selectDisplayName9,
|
|
6169
6416
|
format
|
|
6170
6417
|
});
|
|
6171
6418
|
}
|
|
@@ -6185,11 +6432,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
6185
6432
|
var SignalPushModule = {
|
|
6186
6433
|
command: "push <directory>",
|
|
6187
6434
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
6188
|
-
builder: (
|
|
6435
|
+
builder: (yargs34) => withConfiguration(
|
|
6189
6436
|
withApiOptions(
|
|
6190
6437
|
withProjectOptions(
|
|
6191
6438
|
withDiffOptions(
|
|
6192
|
-
|
|
6439
|
+
yargs34.positional("directory", {
|
|
6193
6440
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
6194
6441
|
type: "string"
|
|
6195
6442
|
}).option("what-if", {
|
|
@@ -6226,15 +6473,16 @@ var SignalPushModule = {
|
|
|
6226
6473
|
if (isPackage) {
|
|
6227
6474
|
const packageContents = readContextPackage(directory, true);
|
|
6228
6475
|
source = await createArraySyncEngineDataSource({
|
|
6476
|
+
name: `Package file ${directory}`,
|
|
6229
6477
|
objects: packageContents.signals ?? [],
|
|
6230
|
-
selectIdentifier:
|
|
6231
|
-
selectDisplayName:
|
|
6478
|
+
selectIdentifier: selectIdentifier9,
|
|
6479
|
+
selectDisplayName: selectDisplayName9
|
|
6232
6480
|
});
|
|
6233
6481
|
} else {
|
|
6234
6482
|
source = await createFileSyncEngineDataSource({
|
|
6235
6483
|
directory,
|
|
6236
|
-
selectIdentifier:
|
|
6237
|
-
selectDisplayName:
|
|
6484
|
+
selectIdentifier: selectIdentifier9,
|
|
6485
|
+
selectDisplayName: selectDisplayName9
|
|
6238
6486
|
});
|
|
6239
6487
|
}
|
|
6240
6488
|
const target = createSignalEngineDataSource({ client });
|
|
@@ -6255,10 +6503,10 @@ var SignalRemoveModule = {
|
|
|
6255
6503
|
command: "remove <id>",
|
|
6256
6504
|
aliases: ["delete", "rm"],
|
|
6257
6505
|
describe: "Delete a signal",
|
|
6258
|
-
builder: (
|
|
6506
|
+
builder: (yargs34) => withConfiguration(
|
|
6259
6507
|
withApiOptions(
|
|
6260
6508
|
withProjectOptions(
|
|
6261
|
-
|
|
6509
|
+
yargs34.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
6262
6510
|
)
|
|
6263
6511
|
)
|
|
6264
6512
|
),
|
|
@@ -6275,10 +6523,10 @@ var SignalUpdateModule = {
|
|
|
6275
6523
|
command: "update <filename>",
|
|
6276
6524
|
aliases: ["put"],
|
|
6277
6525
|
describe: "Insert or update a signal",
|
|
6278
|
-
builder: (
|
|
6526
|
+
builder: (yargs34) => withConfiguration(
|
|
6279
6527
|
withApiOptions(
|
|
6280
6528
|
withProjectOptions(
|
|
6281
|
-
|
|
6529
|
+
yargs34.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
6282
6530
|
)
|
|
6283
6531
|
)
|
|
6284
6532
|
),
|
|
@@ -6295,25 +6543,25 @@ var SignalModule = {
|
|
|
6295
6543
|
command: "signal <command>",
|
|
6296
6544
|
aliases: ["sig"],
|
|
6297
6545
|
describe: "Commands for Context signals",
|
|
6298
|
-
builder: (
|
|
6546
|
+
builder: (yargs34) => yargs34.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
6299
6547
|
handler: () => {
|
|
6300
|
-
|
|
6548
|
+
yargs19.help();
|
|
6301
6549
|
}
|
|
6302
6550
|
};
|
|
6303
6551
|
|
|
6304
6552
|
// src/commands/context/commands/test.ts
|
|
6305
|
-
import
|
|
6553
|
+
import yargs20 from "yargs";
|
|
6306
6554
|
|
|
6307
6555
|
// src/commands/context/commands/test/get.ts
|
|
6308
6556
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
6309
6557
|
var TestGetModule = {
|
|
6310
6558
|
command: "get <id>",
|
|
6311
6559
|
describe: "Fetch a test",
|
|
6312
|
-
builder: (
|
|
6560
|
+
builder: (yargs34) => withConfiguration(
|
|
6313
6561
|
withFormatOptions(
|
|
6314
6562
|
withApiOptions(
|
|
6315
6563
|
withProjectOptions(
|
|
6316
|
-
|
|
6564
|
+
yargs34.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
6317
6565
|
)
|
|
6318
6566
|
)
|
|
6319
6567
|
)
|
|
@@ -6337,7 +6585,7 @@ var TestListModule = {
|
|
|
6337
6585
|
command: "list",
|
|
6338
6586
|
describe: "List tests",
|
|
6339
6587
|
aliases: ["ls"],
|
|
6340
|
-
builder: (
|
|
6588
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
6341
6589
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6342
6590
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6343
6591
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6350,8 +6598,8 @@ var TestListModule = {
|
|
|
6350
6598
|
import { UncachedTestClient as UncachedTestClient3 } from "@uniformdev/context/api";
|
|
6351
6599
|
|
|
6352
6600
|
// src/commands/context/commands/test/_util.ts
|
|
6353
|
-
var
|
|
6354
|
-
var
|
|
6601
|
+
var selectIdentifier10 = (source) => source.id;
|
|
6602
|
+
var selectDisplayName10 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6355
6603
|
|
|
6356
6604
|
// src/commands/context/testEngineDataSource.ts
|
|
6357
6605
|
function createTestEngineDataSource({
|
|
@@ -6361,8 +6609,8 @@ function createTestEngineDataSource({
|
|
|
6361
6609
|
const tests = (await client.get()).tests;
|
|
6362
6610
|
for await (const def of tests) {
|
|
6363
6611
|
const result = {
|
|
6364
|
-
id:
|
|
6365
|
-
displayName:
|
|
6612
|
+
id: selectIdentifier10(def),
|
|
6613
|
+
displayName: selectDisplayName10(def),
|
|
6366
6614
|
providerId: def.id,
|
|
6367
6615
|
object: def
|
|
6368
6616
|
};
|
|
@@ -6370,6 +6618,7 @@ function createTestEngineDataSource({
|
|
|
6370
6618
|
}
|
|
6371
6619
|
}
|
|
6372
6620
|
return {
|
|
6621
|
+
name: "Uniform API",
|
|
6373
6622
|
objects: getObjects(),
|
|
6374
6623
|
deleteObject: async (providerId) => {
|
|
6375
6624
|
await client.remove({ testId: providerId });
|
|
@@ -6386,11 +6635,11 @@ function createTestEngineDataSource({
|
|
|
6386
6635
|
var TestPullModule = {
|
|
6387
6636
|
command: "pull <directory>",
|
|
6388
6637
|
describe: "Pulls all tests to local files in a directory",
|
|
6389
|
-
builder: (
|
|
6638
|
+
builder: (yargs34) => withConfiguration(
|
|
6390
6639
|
withApiOptions(
|
|
6391
6640
|
withProjectOptions(
|
|
6392
6641
|
withDiffOptions(
|
|
6393
|
-
|
|
6642
|
+
yargs34.positional("directory", {
|
|
6394
6643
|
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.",
|
|
6395
6644
|
type: "string"
|
|
6396
6645
|
}).option("format", {
|
|
@@ -6435,9 +6684,10 @@ var TestPullModule = {
|
|
|
6435
6684
|
if (isPackage) {
|
|
6436
6685
|
const packageContents = readContextPackage(directory, false);
|
|
6437
6686
|
target = await createArraySyncEngineDataSource({
|
|
6687
|
+
name: `Package file ${directory}`,
|
|
6438
6688
|
objects: packageContents.tests ?? [],
|
|
6439
|
-
selectIdentifier:
|
|
6440
|
-
selectDisplayName:
|
|
6689
|
+
selectIdentifier: selectIdentifier10,
|
|
6690
|
+
selectDisplayName: selectDisplayName10,
|
|
6441
6691
|
onSyncComplete: async (_, synced) => {
|
|
6442
6692
|
packageContents.tests = synced;
|
|
6443
6693
|
writeContextPackage(directory, packageContents);
|
|
@@ -6446,8 +6696,8 @@ var TestPullModule = {
|
|
|
6446
6696
|
} else {
|
|
6447
6697
|
target = await createFileSyncEngineDataSource({
|
|
6448
6698
|
directory,
|
|
6449
|
-
selectIdentifier:
|
|
6450
|
-
selectDisplayName:
|
|
6699
|
+
selectIdentifier: selectIdentifier10,
|
|
6700
|
+
selectDisplayName: selectDisplayName10,
|
|
6451
6701
|
format
|
|
6452
6702
|
});
|
|
6453
6703
|
}
|
|
@@ -6467,11 +6717,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
6467
6717
|
var TestPushModule = {
|
|
6468
6718
|
command: "push <directory>",
|
|
6469
6719
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
6470
|
-
builder: (
|
|
6720
|
+
builder: (yargs34) => withConfiguration(
|
|
6471
6721
|
withApiOptions(
|
|
6472
6722
|
withProjectOptions(
|
|
6473
6723
|
withDiffOptions(
|
|
6474
|
-
|
|
6724
|
+
yargs34.positional("directory", {
|
|
6475
6725
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
6476
6726
|
type: "string"
|
|
6477
6727
|
}).option("what-if", {
|
|
@@ -6508,15 +6758,16 @@ var TestPushModule = {
|
|
|
6508
6758
|
if (isPackage) {
|
|
6509
6759
|
const packageContents = readContextPackage(directory, true);
|
|
6510
6760
|
source = await createArraySyncEngineDataSource({
|
|
6761
|
+
name: `Package file ${directory}`,
|
|
6511
6762
|
objects: packageContents.tests ?? [],
|
|
6512
|
-
selectIdentifier:
|
|
6513
|
-
selectDisplayName:
|
|
6763
|
+
selectIdentifier: selectIdentifier10,
|
|
6764
|
+
selectDisplayName: selectDisplayName10
|
|
6514
6765
|
});
|
|
6515
6766
|
} else {
|
|
6516
6767
|
source = await createFileSyncEngineDataSource({
|
|
6517
6768
|
directory,
|
|
6518
|
-
selectIdentifier:
|
|
6519
|
-
selectDisplayName:
|
|
6769
|
+
selectIdentifier: selectIdentifier10,
|
|
6770
|
+
selectDisplayName: selectDisplayName10
|
|
6520
6771
|
});
|
|
6521
6772
|
}
|
|
6522
6773
|
const target = createTestEngineDataSource({ client });
|
|
@@ -6537,10 +6788,10 @@ var TestRemoveModule = {
|
|
|
6537
6788
|
command: "remove <id>",
|
|
6538
6789
|
aliases: ["delete", "rm"],
|
|
6539
6790
|
describe: "Delete a test",
|
|
6540
|
-
builder: (
|
|
6791
|
+
builder: (yargs34) => withConfiguration(
|
|
6541
6792
|
withApiOptions(
|
|
6542
6793
|
withProjectOptions(
|
|
6543
|
-
|
|
6794
|
+
yargs34.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
6544
6795
|
)
|
|
6545
6796
|
)
|
|
6546
6797
|
),
|
|
@@ -6557,9 +6808,9 @@ var TestUpdateModule = {
|
|
|
6557
6808
|
command: "update <filename>",
|
|
6558
6809
|
aliases: ["put"],
|
|
6559
6810
|
describe: "Insert or update a test",
|
|
6560
|
-
builder: (
|
|
6811
|
+
builder: (yargs34) => withConfiguration(
|
|
6561
6812
|
withApiOptions(
|
|
6562
|
-
withProjectOptions(
|
|
6813
|
+
withProjectOptions(yargs34.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
6563
6814
|
)
|
|
6564
6815
|
),
|
|
6565
6816
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -6574,9 +6825,9 @@ var TestUpdateModule = {
|
|
|
6574
6825
|
var TestModule = {
|
|
6575
6826
|
command: "test <command>",
|
|
6576
6827
|
describe: "Commands for Context A/B tests",
|
|
6577
|
-
builder: (
|
|
6828
|
+
builder: (yargs34) => yargs34.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
6578
6829
|
handler: () => {
|
|
6579
|
-
|
|
6830
|
+
yargs20.help();
|
|
6580
6831
|
}
|
|
6581
6832
|
};
|
|
6582
6833
|
|
|
@@ -6585,20 +6836,20 @@ var ContextCommand = {
|
|
|
6585
6836
|
command: "context <command>",
|
|
6586
6837
|
aliases: ["ctx"],
|
|
6587
6838
|
describe: "Uniform Context commands",
|
|
6588
|
-
builder: (
|
|
6839
|
+
builder: (yargs34) => yargs34.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
6589
6840
|
handler: () => {
|
|
6590
|
-
|
|
6841
|
+
yargs21.showHelp();
|
|
6591
6842
|
}
|
|
6592
6843
|
};
|
|
6593
6844
|
|
|
6594
6845
|
// src/commands/integration/index.ts
|
|
6595
|
-
import
|
|
6846
|
+
import yargs24 from "yargs";
|
|
6596
6847
|
|
|
6597
6848
|
// src/commands/integration/commands/definition.ts
|
|
6598
|
-
import
|
|
6849
|
+
import yargs23 from "yargs";
|
|
6599
6850
|
|
|
6600
6851
|
// src/commands/integration/commands/definition/edgehancer/edgehancer.ts
|
|
6601
|
-
import
|
|
6852
|
+
import yargs22 from "yargs";
|
|
6602
6853
|
|
|
6603
6854
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
6604
6855
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -6636,8 +6887,8 @@ var EdgehancerClient = class extends ApiClient {
|
|
|
6636
6887
|
};
|
|
6637
6888
|
|
|
6638
6889
|
// src/commands/integration/commands/definition/edgehancer/util.ts
|
|
6639
|
-
function withEdgehancerIdOptions(
|
|
6640
|
-
return
|
|
6890
|
+
function withEdgehancerIdOptions(yargs34) {
|
|
6891
|
+
return yargs34.option("connectorType", {
|
|
6641
6892
|
describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
|
|
6642
6893
|
demandOption: true,
|
|
6643
6894
|
type: "string"
|
|
@@ -6657,11 +6908,11 @@ function withEdgehancerIdOptions(yargs33) {
|
|
|
6657
6908
|
var IntegrationEdgehancerDeployModule = {
|
|
6658
6909
|
command: "deploy <filename>",
|
|
6659
6910
|
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.",
|
|
6660
|
-
builder: (
|
|
6911
|
+
builder: (yargs34) => withConfiguration(
|
|
6661
6912
|
withApiOptions(
|
|
6662
6913
|
withTeamOptions(
|
|
6663
6914
|
withEdgehancerIdOptions(
|
|
6664
|
-
|
|
6915
|
+
yargs34.positional("filename", {
|
|
6665
6916
|
demandOption: true,
|
|
6666
6917
|
describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
|
|
6667
6918
|
})
|
|
@@ -6681,7 +6932,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6681
6932
|
var IntegrationEdgehancerRemoveModule = {
|
|
6682
6933
|
command: "remove",
|
|
6683
6934
|
describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
|
|
6684
|
-
builder: (
|
|
6935
|
+
builder: (yargs34) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs34)))),
|
|
6685
6936
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
|
|
6686
6937
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6687
6938
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
@@ -6693,9 +6944,9 @@ var IntegrationEdgehancerRemoveModule = {
|
|
|
6693
6944
|
var IntegrationEdgehancerModule = {
|
|
6694
6945
|
command: "edgehancer <command>",
|
|
6695
6946
|
describe: "Commands for managing custom integration edgehancers at the team level.",
|
|
6696
|
-
builder: (
|
|
6947
|
+
builder: (yargs34) => yargs34.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
|
|
6697
6948
|
handler: () => {
|
|
6698
|
-
|
|
6949
|
+
yargs22.help();
|
|
6699
6950
|
}
|
|
6700
6951
|
};
|
|
6701
6952
|
|
|
@@ -6735,10 +6986,10 @@ var DefinitionClient = class extends ApiClient2 {
|
|
|
6735
6986
|
var IntegrationDefinitionRegisterModule = {
|
|
6736
6987
|
command: "register <filename>",
|
|
6737
6988
|
describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
|
|
6738
|
-
builder: (
|
|
6989
|
+
builder: (yargs34) => withConfiguration(
|
|
6739
6990
|
withApiOptions(
|
|
6740
6991
|
withTeamOptions(
|
|
6741
|
-
|
|
6992
|
+
yargs34.positional("filename", {
|
|
6742
6993
|
demandOption: true,
|
|
6743
6994
|
describe: "Integration definition manifest to register"
|
|
6744
6995
|
})
|
|
@@ -6757,10 +7008,10 @@ var IntegrationDefinitionRegisterModule = {
|
|
|
6757
7008
|
var IntegrationDefinitionRemoveModule = {
|
|
6758
7009
|
command: "remove <type>",
|
|
6759
7010
|
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.",
|
|
6760
|
-
builder: (
|
|
7011
|
+
builder: (yargs34) => withConfiguration(
|
|
6761
7012
|
withApiOptions(
|
|
6762
7013
|
withTeamOptions(
|
|
6763
|
-
|
|
7014
|
+
yargs34.positional("type", {
|
|
6764
7015
|
demandOption: true,
|
|
6765
7016
|
describe: "Integration type (from its manifest) to remove."
|
|
6766
7017
|
})
|
|
@@ -6778,9 +7029,9 @@ var IntegrationDefinitionRemoveModule = {
|
|
|
6778
7029
|
var IntegrationDefinitionModule = {
|
|
6779
7030
|
command: "definition <command>",
|
|
6780
7031
|
describe: "Commands for managing custom integration definitions at the team level.",
|
|
6781
|
-
builder: (
|
|
7032
|
+
builder: (yargs34) => yargs34.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).demandCommand(),
|
|
6782
7033
|
handler: () => {
|
|
6783
|
-
|
|
7034
|
+
yargs23.help();
|
|
6784
7035
|
}
|
|
6785
7036
|
};
|
|
6786
7037
|
|
|
@@ -6820,10 +7071,10 @@ var InstallClient = class extends ApiClient3 {
|
|
|
6820
7071
|
var IntegrationInstallModule = {
|
|
6821
7072
|
command: "install <type>",
|
|
6822
7073
|
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.",
|
|
6823
|
-
builder: (
|
|
7074
|
+
builder: (yargs34) => withConfiguration(
|
|
6824
7075
|
withApiOptions(
|
|
6825
7076
|
withProjectOptions(
|
|
6826
|
-
|
|
7077
|
+
yargs34.positional("type", {
|
|
6827
7078
|
demandOption: true,
|
|
6828
7079
|
describe: "Integration type to install (as defined in its manifest)"
|
|
6829
7080
|
}).option("configuration", {
|
|
@@ -6845,10 +7096,10 @@ var IntegrationInstallModule = {
|
|
|
6845
7096
|
var IntegrationUninstallModule = {
|
|
6846
7097
|
command: "uninstall <type>",
|
|
6847
7098
|
describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
|
|
6848
|
-
builder: (
|
|
7099
|
+
builder: (yargs34) => withConfiguration(
|
|
6849
7100
|
withApiOptions(
|
|
6850
7101
|
withProjectOptions(
|
|
6851
|
-
|
|
7102
|
+
yargs34.positional("type", {
|
|
6852
7103
|
demandOption: true,
|
|
6853
7104
|
describe: "Integration type to uninstall (as defined in its manifest)"
|
|
6854
7105
|
})
|
|
@@ -6866,9 +7117,9 @@ var IntegrationUninstallModule = {
|
|
|
6866
7117
|
var IntegrationCommand = {
|
|
6867
7118
|
command: "integration <command>",
|
|
6868
7119
|
describe: "Integration management commands",
|
|
6869
|
-
builder: (
|
|
7120
|
+
builder: (yargs34) => yargs34.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
|
|
6870
7121
|
handler: () => {
|
|
6871
|
-
|
|
7122
|
+
yargs24.showHelp();
|
|
6872
7123
|
}
|
|
6873
7124
|
};
|
|
6874
7125
|
|
|
@@ -6877,7 +7128,7 @@ import ora from "ora";
|
|
|
6877
7128
|
var makeSpinner = () => {
|
|
6878
7129
|
const spinners = [];
|
|
6879
7130
|
const stopAllSpinners = () => spinners.forEach((spinner) => spinner.stop());
|
|
6880
|
-
const
|
|
7131
|
+
const spin = async (text) => {
|
|
6881
7132
|
const spinner = ora(text).start();
|
|
6882
7133
|
spinners.push(spinner);
|
|
6883
7134
|
const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
@@ -6886,7 +7137,7 @@ var makeSpinner = () => {
|
|
|
6886
7137
|
spinner.stop();
|
|
6887
7138
|
};
|
|
6888
7139
|
};
|
|
6889
|
-
return { stopAllSpinners, spin
|
|
7140
|
+
return { stopAllSpinners, spin };
|
|
6890
7141
|
};
|
|
6891
7142
|
|
|
6892
7143
|
// src/telemetry/telemetry.ts
|
|
@@ -6896,7 +7147,7 @@ import { PostHog } from "posthog-node";
|
|
|
6896
7147
|
// package.json
|
|
6897
7148
|
var package_default = {
|
|
6898
7149
|
name: "@uniformdev/cli",
|
|
6899
|
-
version: "19.
|
|
7150
|
+
version: "19.151.0",
|
|
6900
7151
|
description: "Uniform command line interface tool",
|
|
6901
7152
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6902
7153
|
main: "./cli.js",
|
|
@@ -7285,12 +7536,12 @@ import * as http from "isomorphic-git/http/node/index.js";
|
|
|
7285
7536
|
import os from "os";
|
|
7286
7537
|
import path2 from "path";
|
|
7287
7538
|
async function cloneStarter({
|
|
7288
|
-
spin
|
|
7539
|
+
spin,
|
|
7289
7540
|
githubPath,
|
|
7290
7541
|
targetDir,
|
|
7291
7542
|
dotEnvFile
|
|
7292
7543
|
}) {
|
|
7293
|
-
const done = await
|
|
7544
|
+
const done = await spin("Fetching starter code...");
|
|
7294
7545
|
const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
7295
7546
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
7296
7547
|
try {
|
|
@@ -7340,7 +7591,7 @@ async function getOrCreateProject({
|
|
|
7340
7591
|
user,
|
|
7341
7592
|
explicitName,
|
|
7342
7593
|
client,
|
|
7343
|
-
spin
|
|
7594
|
+
spin,
|
|
7344
7595
|
checkTargetDir,
|
|
7345
7596
|
explicitTargetDir,
|
|
7346
7597
|
previewUrl,
|
|
@@ -7370,7 +7621,7 @@ async function getOrCreateProject({
|
|
|
7370
7621
|
checkTargetDir,
|
|
7371
7622
|
explicitTargetDir
|
|
7372
7623
|
});
|
|
7373
|
-
const projectId = await createProject({ client, projectName, spin
|
|
7624
|
+
const projectId = await createProject({ client, projectName, spin, teamId, previewUrl });
|
|
7374
7625
|
telemetry.send("project created", { projectId, targetDir });
|
|
7375
7626
|
return {
|
|
7376
7627
|
projectId,
|
|
@@ -7411,11 +7662,11 @@ async function getNewProjectName({
|
|
|
7411
7662
|
async function createProject({
|
|
7412
7663
|
projectName,
|
|
7413
7664
|
teamId,
|
|
7414
|
-
spin
|
|
7665
|
+
spin,
|
|
7415
7666
|
client,
|
|
7416
7667
|
previewUrl
|
|
7417
7668
|
}) {
|
|
7418
|
-
const done = await
|
|
7669
|
+
const done = await spin("Creating your new project...");
|
|
7419
7670
|
const projectId = await client.createProject(teamId, projectName, previewUrl);
|
|
7420
7671
|
await done();
|
|
7421
7672
|
return projectId;
|
|
@@ -7544,11 +7795,11 @@ var getUserInfo = async (baseUrl, authToken, subject) => {
|
|
|
7544
7795
|
async function fetchUserAndEnsureFirstTeamExists({
|
|
7545
7796
|
baseUrl,
|
|
7546
7797
|
auth: { authToken, decoded },
|
|
7547
|
-
spin
|
|
7798
|
+
spin,
|
|
7548
7799
|
telemetry
|
|
7549
7800
|
}) {
|
|
7550
7801
|
const uniformClient = createClient(baseUrl, authToken);
|
|
7551
|
-
const done = await
|
|
7802
|
+
const done = await spin("Fetching user information...");
|
|
7552
7803
|
let user = await getUserInfo(baseUrl, authToken, decoded.sub);
|
|
7553
7804
|
if (user.teams.length < 1) {
|
|
7554
7805
|
await uniformClient.createTeam(`${user.name}'s team`);
|
|
@@ -7561,7 +7812,7 @@ async function fetchUserAndEnsureFirstTeamExists({
|
|
|
7561
7812
|
|
|
7562
7813
|
// src/commands/new/commands/new.ts
|
|
7563
7814
|
async function newHandler({
|
|
7564
|
-
spin
|
|
7815
|
+
spin,
|
|
7565
7816
|
projectName,
|
|
7566
7817
|
apiHost,
|
|
7567
7818
|
outputPath,
|
|
@@ -7573,7 +7824,7 @@ async function newHandler({
|
|
|
7573
7824
|
const auth = await getBearerToken(apiHost);
|
|
7574
7825
|
const { authToken } = auth;
|
|
7575
7826
|
const uniformClient = createClient(apiHost, authToken);
|
|
7576
|
-
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin
|
|
7827
|
+
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
|
|
7577
7828
|
const { teamId } = await chooseTeam(
|
|
7578
7829
|
user,
|
|
7579
7830
|
`Hey ${user.name}! Choose a Uniform team for your new project`,
|
|
@@ -7645,7 +7896,7 @@ async function newHandler({
|
|
|
7645
7896
|
client: uniformClient,
|
|
7646
7897
|
createNew: true,
|
|
7647
7898
|
chooseExisting: false,
|
|
7648
|
-
spin
|
|
7899
|
+
spin,
|
|
7649
7900
|
teamId,
|
|
7650
7901
|
user,
|
|
7651
7902
|
explicitName: projectName,
|
|
@@ -7654,7 +7905,7 @@ async function newHandler({
|
|
|
7654
7905
|
previewUrl: serverUrl + previewPath,
|
|
7655
7906
|
telemetry
|
|
7656
7907
|
});
|
|
7657
|
-
let done = await
|
|
7908
|
+
let done = await spin("Generating API keys...");
|
|
7658
7909
|
const { readApiKey, writeApiKey } = await uniformClient.createApiKeys(teamId, projectId);
|
|
7659
7910
|
await done();
|
|
7660
7911
|
const dotEnvFile = [
|
|
@@ -7672,7 +7923,7 @@ async function newHandler({
|
|
|
7672
7923
|
const cloneStartTimestamp = Date.now();
|
|
7673
7924
|
const { runNpmInstall } = await cloneStarter({
|
|
7674
7925
|
githubPath: githubUri,
|
|
7675
|
-
spin
|
|
7926
|
+
spin,
|
|
7676
7927
|
targetDir,
|
|
7677
7928
|
dotEnvFile
|
|
7678
7929
|
});
|
|
@@ -7680,7 +7931,7 @@ async function newHandler({
|
|
|
7680
7931
|
const installStartTimestamp = Date.now();
|
|
7681
7932
|
await runNpmInstall();
|
|
7682
7933
|
telemetry.send("deps installed", { duration: Date.now() - installStartTimestamp });
|
|
7683
|
-
done = await
|
|
7934
|
+
done = await spin("Creating components and compositions");
|
|
7684
7935
|
await runNpm(targetDir, ["run", "uniform:push"]);
|
|
7685
7936
|
await runNpm(targetDir, ["run", "uniform:publish"]);
|
|
7686
7937
|
await done();
|
|
@@ -7715,7 +7966,7 @@ import inquirer5 from "inquirer";
|
|
|
7715
7966
|
import path4 from "path";
|
|
7716
7967
|
import slugify2 from "slugify";
|
|
7717
7968
|
async function newMeshIntegrationHandler({
|
|
7718
|
-
spin
|
|
7969
|
+
spin,
|
|
7719
7970
|
apiHost,
|
|
7720
7971
|
outputPath,
|
|
7721
7972
|
telemetry
|
|
@@ -7724,7 +7975,7 @@ async function newMeshIntegrationHandler({
|
|
|
7724
7975
|
const auth = await getBearerToken(apiHost);
|
|
7725
7976
|
const { authToken } = auth;
|
|
7726
7977
|
const uniformClient = createClient(apiHost, authToken);
|
|
7727
|
-
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin
|
|
7978
|
+
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
|
|
7728
7979
|
const { teamId } = await chooseTeam(
|
|
7729
7980
|
user,
|
|
7730
7981
|
`Hey ${user.name}! Choose a Uniform team to register your integration`,
|
|
@@ -7749,10 +8000,10 @@ async function newMeshIntegrationHandler({
|
|
|
7749
8000
|
const { targetDir, typeSlug } = validateIntegrationName(answer.name, outputPath);
|
|
7750
8001
|
const { runNpmInstall } = await cloneStarter({
|
|
7751
8002
|
githubPath: `uniformdev/examples/examples/mesh-integration`,
|
|
7752
|
-
spin
|
|
8003
|
+
spin,
|
|
7753
8004
|
targetDir
|
|
7754
8005
|
});
|
|
7755
|
-
let done = await
|
|
8006
|
+
let done = await spin("Registering integration to team...");
|
|
7756
8007
|
const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
|
|
7757
8008
|
if (!existsSync3(pathToManifest)) {
|
|
7758
8009
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
@@ -7774,13 +8025,13 @@ async function newMeshIntegrationHandler({
|
|
|
7774
8025
|
client: uniformClient,
|
|
7775
8026
|
createNew: true,
|
|
7776
8027
|
chooseExisting: true,
|
|
7777
|
-
spin
|
|
8028
|
+
spin,
|
|
7778
8029
|
teamId,
|
|
7779
8030
|
user,
|
|
7780
8031
|
checkTargetDir: false,
|
|
7781
8032
|
telemetry
|
|
7782
8033
|
});
|
|
7783
|
-
done = await
|
|
8034
|
+
done = await spin("Installing integration to project...");
|
|
7784
8035
|
await uniformClient.installIntegration({ projectId, type: typeSlug });
|
|
7785
8036
|
await done();
|
|
7786
8037
|
console.log(`
|
|
@@ -7850,10 +8101,10 @@ var NewCmd = {
|
|
|
7850
8101
|
),
|
|
7851
8102
|
describe: "Start a new Uniform project",
|
|
7852
8103
|
handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
|
|
7853
|
-
const { stopAllSpinners, spin
|
|
8104
|
+
const { stopAllSpinners, spin } = makeSpinner();
|
|
7854
8105
|
const telemetry = new Telemetry("cli new", disableTelemetry || apiHost !== stableApiHost);
|
|
7855
8106
|
try {
|
|
7856
|
-
await newHandler({ spin
|
|
8107
|
+
await newHandler({ spin, projectName: name, apiHost, outputPath, telemetry });
|
|
7857
8108
|
stopAllSpinners();
|
|
7858
8109
|
process.exit(0);
|
|
7859
8110
|
} catch (err) {
|
|
@@ -7887,10 +8138,10 @@ var NewMeshCmd = {
|
|
|
7887
8138
|
),
|
|
7888
8139
|
describe: "Start a new Uniform project",
|
|
7889
8140
|
handler: async function({ apiHost, outputPath, disableTelemetry }) {
|
|
7890
|
-
const { stopAllSpinners, spin
|
|
8141
|
+
const { stopAllSpinners, spin } = makeSpinner();
|
|
7891
8142
|
const telemetry = new Telemetry("cli new mesh", disableTelemetry || apiHost !== stableApiHost);
|
|
7892
8143
|
try {
|
|
7893
|
-
await newMeshIntegrationHandler({ spin
|
|
8144
|
+
await newMeshIntegrationHandler({ spin, apiHost, outputPath, telemetry });
|
|
7894
8145
|
stopAllSpinners();
|
|
7895
8146
|
process.exit(0);
|
|
7896
8147
|
} catch (err) {
|
|
@@ -7905,10 +8156,10 @@ var NewMeshCmd = {
|
|
|
7905
8156
|
};
|
|
7906
8157
|
|
|
7907
8158
|
// src/commands/optimize/index.ts
|
|
7908
|
-
import
|
|
8159
|
+
import yargs26 from "yargs";
|
|
7909
8160
|
|
|
7910
8161
|
// src/commands/optimize/manifest.ts
|
|
7911
|
-
import
|
|
8162
|
+
import yargs25 from "yargs";
|
|
7912
8163
|
|
|
7913
8164
|
// src/commands/optimize/manifest/download.ts
|
|
7914
8165
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -7923,7 +8174,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
7923
8174
|
var module = {
|
|
7924
8175
|
command: "download [output]",
|
|
7925
8176
|
describe: "Download intent manifest",
|
|
7926
|
-
builder: (
|
|
8177
|
+
builder: (yargs34) => yargs34.option("apiKey", {
|
|
7927
8178
|
alias: "k",
|
|
7928
8179
|
demandOption: true,
|
|
7929
8180
|
string: true,
|
|
@@ -8024,10 +8275,10 @@ var module2 = {
|
|
|
8024
8275
|
command: "manifest <command>",
|
|
8025
8276
|
describe: "Intent manifest commands",
|
|
8026
8277
|
builder: () => {
|
|
8027
|
-
return
|
|
8278
|
+
return yargs25.command(download_default);
|
|
8028
8279
|
},
|
|
8029
8280
|
handler: () => {
|
|
8030
|
-
|
|
8281
|
+
yargs25.showHelp();
|
|
8031
8282
|
}
|
|
8032
8283
|
};
|
|
8033
8284
|
var manifest_default = module2;
|
|
@@ -8038,29 +8289,29 @@ var OptimizeCommand = {
|
|
|
8038
8289
|
aliases: ["opt"],
|
|
8039
8290
|
describe: "Uniform Optimize commands",
|
|
8040
8291
|
builder: () => {
|
|
8041
|
-
return
|
|
8292
|
+
return yargs26.command(manifest_default);
|
|
8042
8293
|
},
|
|
8043
8294
|
handler: () => {
|
|
8044
|
-
|
|
8295
|
+
yargs26.showHelp();
|
|
8045
8296
|
}
|
|
8046
8297
|
};
|
|
8047
8298
|
|
|
8048
8299
|
// src/commands/project-map/index.ts
|
|
8049
|
-
import
|
|
8300
|
+
import yargs29 from "yargs";
|
|
8050
8301
|
|
|
8051
8302
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
8052
|
-
import
|
|
8303
|
+
import yargs27 from "yargs";
|
|
8053
8304
|
|
|
8054
8305
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
8055
8306
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
8056
8307
|
var ProjectMapDefinitionGetModule = {
|
|
8057
8308
|
command: "get <id>",
|
|
8058
8309
|
describe: "Fetch a project map",
|
|
8059
|
-
builder: (
|
|
8310
|
+
builder: (yargs34) => withFormatOptions(
|
|
8060
8311
|
withConfiguration(
|
|
8061
8312
|
withApiOptions(
|
|
8062
8313
|
withProjectOptions(
|
|
8063
|
-
|
|
8314
|
+
yargs34.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
8064
8315
|
)
|
|
8065
8316
|
)
|
|
8066
8317
|
)
|
|
@@ -8084,7 +8335,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
8084
8335
|
command: "list",
|
|
8085
8336
|
describe: "List of project maps",
|
|
8086
8337
|
aliases: ["ls"],
|
|
8087
|
-
builder: (
|
|
8338
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
8088
8339
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8089
8340
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8090
8341
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8105,8 +8356,8 @@ function writeContextPackage2(filename, packageContents) {
|
|
|
8105
8356
|
}
|
|
8106
8357
|
|
|
8107
8358
|
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
8108
|
-
var
|
|
8109
|
-
var
|
|
8359
|
+
var selectIdentifier11 = (source) => source.id;
|
|
8360
|
+
var selectDisplayName11 = (source) => `${source.name} (pid: ${source.id})`;
|
|
8110
8361
|
|
|
8111
8362
|
// src/commands/project-map/ProjectMapDefinitionEngineDataSource.ts
|
|
8112
8363
|
function createProjectMapDefinitionEngineDataSource({
|
|
@@ -8116,15 +8367,16 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8116
8367
|
const projectMaps = (await client.getProjectMapDefinitions()).projectMaps;
|
|
8117
8368
|
for await (const def of projectMaps) {
|
|
8118
8369
|
const result = {
|
|
8119
|
-
id:
|
|
8120
|
-
displayName:
|
|
8121
|
-
providerId:
|
|
8370
|
+
id: selectIdentifier11(def),
|
|
8371
|
+
displayName: selectDisplayName11(def),
|
|
8372
|
+
providerId: selectIdentifier11(def),
|
|
8122
8373
|
object: def
|
|
8123
8374
|
};
|
|
8124
8375
|
yield result;
|
|
8125
8376
|
}
|
|
8126
8377
|
}
|
|
8127
8378
|
return {
|
|
8379
|
+
name: "Uniform API",
|
|
8128
8380
|
objects: getObjects(),
|
|
8129
8381
|
deleteObject: async (providerId) => {
|
|
8130
8382
|
await client.deleteProjectMap({ projectMapId: providerId });
|
|
@@ -8141,11 +8393,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8141
8393
|
var ProjectMapDefinitionPullModule = {
|
|
8142
8394
|
command: "pull <directory>",
|
|
8143
8395
|
describe: "Pulls all project maps to local files in a directory",
|
|
8144
|
-
builder: (
|
|
8396
|
+
builder: (yargs34) => withConfiguration(
|
|
8145
8397
|
withApiOptions(
|
|
8146
8398
|
withProjectOptions(
|
|
8147
8399
|
withDiffOptions(
|
|
8148
|
-
|
|
8400
|
+
yargs34.positional("directory", {
|
|
8149
8401
|
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.",
|
|
8150
8402
|
type: "string"
|
|
8151
8403
|
}).option("format", {
|
|
@@ -8190,9 +8442,10 @@ var ProjectMapDefinitionPullModule = {
|
|
|
8190
8442
|
if (isPackage) {
|
|
8191
8443
|
const packageContents = readContextPackage2(directory, false);
|
|
8192
8444
|
target = await createArraySyncEngineDataSource({
|
|
8445
|
+
name: `Package file ${directory}`,
|
|
8193
8446
|
objects: packageContents.projectMaps ?? [],
|
|
8194
|
-
selectIdentifier:
|
|
8195
|
-
selectDisplayName:
|
|
8447
|
+
selectIdentifier: selectIdentifier11,
|
|
8448
|
+
selectDisplayName: selectDisplayName11,
|
|
8196
8449
|
onSyncComplete: async (_, synced) => {
|
|
8197
8450
|
packageContents.projectMaps = synced;
|
|
8198
8451
|
writeContextPackage2(directory, packageContents);
|
|
@@ -8201,8 +8454,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
8201
8454
|
} else {
|
|
8202
8455
|
target = await createFileSyncEngineDataSource({
|
|
8203
8456
|
directory,
|
|
8204
|
-
selectIdentifier:
|
|
8205
|
-
selectDisplayName:
|
|
8457
|
+
selectIdentifier: selectIdentifier11,
|
|
8458
|
+
selectDisplayName: selectDisplayName11,
|
|
8206
8459
|
format
|
|
8207
8460
|
});
|
|
8208
8461
|
}
|
|
@@ -8222,11 +8475,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
8222
8475
|
var ProjectMapDefinitionPushModule = {
|
|
8223
8476
|
command: "push <directory>",
|
|
8224
8477
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
8225
|
-
builder: (
|
|
8478
|
+
builder: (yargs34) => withConfiguration(
|
|
8226
8479
|
withApiOptions(
|
|
8227
8480
|
withProjectOptions(
|
|
8228
8481
|
withDiffOptions(
|
|
8229
|
-
|
|
8482
|
+
yargs34.positional("directory", {
|
|
8230
8483
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8231
8484
|
type: "string"
|
|
8232
8485
|
}).option("what-if", {
|
|
@@ -8263,15 +8516,16 @@ var ProjectMapDefinitionPushModule = {
|
|
|
8263
8516
|
if (isPackage) {
|
|
8264
8517
|
const packageContents = readContextPackage2(directory, true);
|
|
8265
8518
|
source = await createArraySyncEngineDataSource({
|
|
8519
|
+
name: `Package file ${directory}`,
|
|
8266
8520
|
objects: packageContents.projectMaps ?? [],
|
|
8267
|
-
selectIdentifier:
|
|
8268
|
-
selectDisplayName:
|
|
8521
|
+
selectIdentifier: selectIdentifier11,
|
|
8522
|
+
selectDisplayName: selectDisplayName11
|
|
8269
8523
|
});
|
|
8270
8524
|
} else {
|
|
8271
8525
|
source = await createFileSyncEngineDataSource({
|
|
8272
8526
|
directory,
|
|
8273
|
-
selectIdentifier:
|
|
8274
|
-
selectDisplayName:
|
|
8527
|
+
selectIdentifier: selectIdentifier11,
|
|
8528
|
+
selectDisplayName: selectDisplayName11
|
|
8275
8529
|
});
|
|
8276
8530
|
}
|
|
8277
8531
|
const target = createProjectMapDefinitionEngineDataSource({ client });
|
|
@@ -8292,9 +8546,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
8292
8546
|
command: "remove <id>",
|
|
8293
8547
|
aliases: ["delete", "rm"],
|
|
8294
8548
|
describe: "Delete a project map",
|
|
8295
|
-
builder: (
|
|
8549
|
+
builder: (yargs34) => withConfiguration(
|
|
8296
8550
|
withApiOptions(
|
|
8297
|
-
withProjectOptions(
|
|
8551
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8298
8552
|
)
|
|
8299
8553
|
),
|
|
8300
8554
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8310,10 +8564,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8310
8564
|
command: "update <filename>",
|
|
8311
8565
|
aliases: ["put"],
|
|
8312
8566
|
describe: "Insert or update a project map",
|
|
8313
|
-
builder: (
|
|
8567
|
+
builder: (yargs34) => withConfiguration(
|
|
8314
8568
|
withApiOptions(
|
|
8315
8569
|
withProjectOptions(
|
|
8316
|
-
|
|
8570
|
+
yargs34.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
8317
8571
|
)
|
|
8318
8572
|
)
|
|
8319
8573
|
),
|
|
@@ -8329,25 +8583,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8329
8583
|
var ProjectMapDefinitionModule = {
|
|
8330
8584
|
command: "definition <command>",
|
|
8331
8585
|
describe: "Commands for ProjectMap Definitions",
|
|
8332
|
-
builder: (
|
|
8586
|
+
builder: (yargs34) => yargs34.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
8333
8587
|
handler: () => {
|
|
8334
|
-
|
|
8588
|
+
yargs27.help();
|
|
8335
8589
|
}
|
|
8336
8590
|
};
|
|
8337
8591
|
|
|
8338
8592
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
8339
|
-
import
|
|
8593
|
+
import yargs28 from "yargs";
|
|
8340
8594
|
|
|
8341
8595
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
8342
8596
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
8343
8597
|
var ProjectMapNodeGetModule = {
|
|
8344
8598
|
command: "get <id> <projectMapId>",
|
|
8345
8599
|
describe: "Fetch a project map node",
|
|
8346
|
-
builder: (
|
|
8600
|
+
builder: (yargs34) => withConfiguration(
|
|
8347
8601
|
withFormatOptions(
|
|
8348
8602
|
withApiOptions(
|
|
8349
8603
|
withProjectOptions(
|
|
8350
|
-
|
|
8604
|
+
yargs34.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
8351
8605
|
)
|
|
8352
8606
|
)
|
|
8353
8607
|
)
|
|
@@ -8373,12 +8627,12 @@ var ProjectMapNodeListModule = {
|
|
|
8373
8627
|
command: "list <projectMapId>",
|
|
8374
8628
|
describe: "List project map nodes",
|
|
8375
8629
|
aliases: ["ls"],
|
|
8376
|
-
builder: (
|
|
8630
|
+
builder: (yargs34) => withConfiguration(
|
|
8377
8631
|
withFormatOptions(
|
|
8378
8632
|
withApiOptions(
|
|
8379
8633
|
withProjectOptions(
|
|
8380
8634
|
withStateOptions(
|
|
8381
|
-
|
|
8635
|
+
yargs34.positional("projectMapId", {
|
|
8382
8636
|
demandOption: true,
|
|
8383
8637
|
describe: "ProjectMap UUID to fetch from"
|
|
8384
8638
|
})
|
|
@@ -8399,12 +8653,12 @@ var ProjectMapNodeListModule = {
|
|
|
8399
8653
|
import { UncachedProjectMapClient as UncachedProjectMapClient9 } from "@uniformdev/project-map";
|
|
8400
8654
|
|
|
8401
8655
|
// src/commands/project-map/commands/ProjectMapNode/_util.ts
|
|
8402
|
-
var
|
|
8656
|
+
var selectIdentifier12 = (source, projectId) => [
|
|
8403
8657
|
projectId + source.projectMapId + source.id,
|
|
8404
8658
|
projectId + source.projectMapId + source.path
|
|
8405
8659
|
];
|
|
8406
8660
|
var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
|
|
8407
|
-
var
|
|
8661
|
+
var selectDisplayName12 = (source) => `${source.name} (pid: ${source.id})`;
|
|
8408
8662
|
|
|
8409
8663
|
// src/commands/project-map/ProjectMapNodeEngineDataSource.ts
|
|
8410
8664
|
function createProjectMapNodeEngineDataSource({
|
|
@@ -8418,9 +8672,9 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8418
8672
|
for await (const node of nodes ?? []) {
|
|
8419
8673
|
if (node) {
|
|
8420
8674
|
const result = {
|
|
8421
|
-
id:
|
|
8422
|
-
displayName:
|
|
8423
|
-
providerId:
|
|
8675
|
+
id: selectIdentifier12({ ...node, projectMapId: projectMap.id }, projectId),
|
|
8676
|
+
displayName: selectDisplayName12(node),
|
|
8677
|
+
providerId: selectIdentifier12({ ...node, projectMapId: projectMap.id }, projectId)[0],
|
|
8424
8678
|
object: { ...node, projectMapId: projectMap.id }
|
|
8425
8679
|
};
|
|
8426
8680
|
yield result;
|
|
@@ -8429,6 +8683,7 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8429
8683
|
}
|
|
8430
8684
|
}
|
|
8431
8685
|
return {
|
|
8686
|
+
name: "Uniform API",
|
|
8432
8687
|
objects: getObjects(),
|
|
8433
8688
|
deleteObject: async (providerId, object) => {
|
|
8434
8689
|
await client.deleteProjectMapNode({
|
|
@@ -8450,11 +8705,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8450
8705
|
var ProjectMapNodePullModule = {
|
|
8451
8706
|
command: "pull <directory>",
|
|
8452
8707
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
8453
|
-
builder: (
|
|
8708
|
+
builder: (yargs34) => withConfiguration(
|
|
8454
8709
|
withApiOptions(
|
|
8455
8710
|
withProjectOptions(
|
|
8456
8711
|
withDiffOptions(
|
|
8457
|
-
|
|
8712
|
+
yargs34.positional("directory", {
|
|
8458
8713
|
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.",
|
|
8459
8714
|
type: "string"
|
|
8460
8715
|
}).option("format", {
|
|
@@ -8497,14 +8752,15 @@ var ProjectMapNodePullModule = {
|
|
|
8497
8752
|
let target;
|
|
8498
8753
|
const isPackage = isPathAPackageFile(directory);
|
|
8499
8754
|
const expandedSelectIdentifier = (object) => {
|
|
8500
|
-
return
|
|
8755
|
+
return selectIdentifier12(object, projectId);
|
|
8501
8756
|
};
|
|
8502
8757
|
if (isPackage) {
|
|
8503
8758
|
const packageContents = readContextPackage2(directory, false);
|
|
8504
8759
|
target = await createArraySyncEngineDataSource({
|
|
8760
|
+
name: `Package file ${directory}`,
|
|
8505
8761
|
objects: packageContents.projectMapNodes ?? [],
|
|
8506
8762
|
selectIdentifier: expandedSelectIdentifier,
|
|
8507
|
-
selectDisplayName:
|
|
8763
|
+
selectDisplayName: selectDisplayName12,
|
|
8508
8764
|
onSyncComplete: async (_, synced) => {
|
|
8509
8765
|
packageContents.projectMapNodes = synced;
|
|
8510
8766
|
writeContextPackage2(directory, packageContents);
|
|
@@ -8514,7 +8770,7 @@ var ProjectMapNodePullModule = {
|
|
|
8514
8770
|
target = await createFileSyncEngineDataSource({
|
|
8515
8771
|
directory,
|
|
8516
8772
|
selectIdentifier: expandedSelectIdentifier,
|
|
8517
|
-
selectDisplayName:
|
|
8773
|
+
selectDisplayName: selectDisplayName12,
|
|
8518
8774
|
format,
|
|
8519
8775
|
selectFilename
|
|
8520
8776
|
});
|
|
@@ -8535,11 +8791,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
8535
8791
|
var ProjectMapNodePushModule = {
|
|
8536
8792
|
command: "push <directory>",
|
|
8537
8793
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
8538
|
-
builder: (
|
|
8794
|
+
builder: (yargs34) => withConfiguration(
|
|
8539
8795
|
withApiOptions(
|
|
8540
8796
|
withProjectOptions(
|
|
8541
8797
|
withDiffOptions(
|
|
8542
|
-
|
|
8798
|
+
yargs34.positional("directory", {
|
|
8543
8799
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8544
8800
|
type: "string"
|
|
8545
8801
|
}).option("what-if", {
|
|
@@ -8579,20 +8835,21 @@ var ProjectMapNodePushModule = {
|
|
|
8579
8835
|
let source;
|
|
8580
8836
|
const isPackage = isPathAPackageFile(directory);
|
|
8581
8837
|
const expandedSelectIdentifier = (object) => {
|
|
8582
|
-
return
|
|
8838
|
+
return selectIdentifier12(object, projectId);
|
|
8583
8839
|
};
|
|
8584
8840
|
if (isPackage) {
|
|
8585
8841
|
const packageContents = readContextPackage2(directory, true);
|
|
8586
8842
|
source = await createArraySyncEngineDataSource({
|
|
8843
|
+
name: `Package file ${directory}`,
|
|
8587
8844
|
objects: packageContents.projectMapNodes ?? [],
|
|
8588
8845
|
selectIdentifier: expandedSelectIdentifier,
|
|
8589
|
-
selectDisplayName:
|
|
8846
|
+
selectDisplayName: selectDisplayName12
|
|
8590
8847
|
});
|
|
8591
8848
|
} else {
|
|
8592
8849
|
source = await createFileSyncEngineDataSource({
|
|
8593
8850
|
directory,
|
|
8594
8851
|
selectIdentifier: expandedSelectIdentifier,
|
|
8595
|
-
selectDisplayName:
|
|
8852
|
+
selectDisplayName: selectDisplayName12,
|
|
8596
8853
|
selectFilename
|
|
8597
8854
|
});
|
|
8598
8855
|
}
|
|
@@ -8614,10 +8871,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
8614
8871
|
command: "remove <id> <projectMapId>",
|
|
8615
8872
|
aliases: ["delete", "rm"],
|
|
8616
8873
|
describe: "Delete a project map node",
|
|
8617
|
-
builder: (
|
|
8874
|
+
builder: (yargs34) => withConfiguration(
|
|
8618
8875
|
withApiOptions(
|
|
8619
8876
|
withProjectOptions(
|
|
8620
|
-
|
|
8877
|
+
yargs34.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
8621
8878
|
)
|
|
8622
8879
|
)
|
|
8623
8880
|
),
|
|
@@ -8634,10 +8891,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8634
8891
|
command: "update <filename> <projectMapId>",
|
|
8635
8892
|
aliases: ["put"],
|
|
8636
8893
|
describe: "Insert or update a project map node",
|
|
8637
|
-
builder: (
|
|
8894
|
+
builder: (yargs34) => withConfiguration(
|
|
8638
8895
|
withApiOptions(
|
|
8639
8896
|
withProjectOptions(
|
|
8640
|
-
|
|
8897
|
+
yargs34.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
8641
8898
|
)
|
|
8642
8899
|
)
|
|
8643
8900
|
),
|
|
@@ -8653,9 +8910,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8653
8910
|
var ProjectMapNodeModule = {
|
|
8654
8911
|
command: "node <command>",
|
|
8655
8912
|
describe: "Commands for ProjectMap Nodes",
|
|
8656
|
-
builder: (
|
|
8913
|
+
builder: (yargs34) => yargs34.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
8657
8914
|
handler: () => {
|
|
8658
|
-
|
|
8915
|
+
yargs28.help();
|
|
8659
8916
|
}
|
|
8660
8917
|
};
|
|
8661
8918
|
|
|
@@ -8664,28 +8921,28 @@ var ProjectMapCommand = {
|
|
|
8664
8921
|
command: "project-map <command>",
|
|
8665
8922
|
aliases: ["prm"],
|
|
8666
8923
|
describe: "Uniform ProjectMap commands",
|
|
8667
|
-
builder: (
|
|
8924
|
+
builder: (yargs34) => yargs34.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
8668
8925
|
handler: () => {
|
|
8669
|
-
|
|
8926
|
+
yargs29.showHelp();
|
|
8670
8927
|
}
|
|
8671
8928
|
};
|
|
8672
8929
|
|
|
8673
8930
|
// src/commands/redirect/index.ts
|
|
8674
|
-
import
|
|
8931
|
+
import yargs31 from "yargs";
|
|
8675
8932
|
|
|
8676
8933
|
// src/commands/redirect/commands/redirect.ts
|
|
8677
|
-
import
|
|
8934
|
+
import yargs30 from "yargs";
|
|
8678
8935
|
|
|
8679
8936
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
8680
8937
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
8681
8938
|
var RedirectDefinitionGetModule = {
|
|
8682
8939
|
command: "get <id>",
|
|
8683
8940
|
describe: "Fetch a redirect",
|
|
8684
|
-
builder: (
|
|
8941
|
+
builder: (yargs34) => withConfiguration(
|
|
8685
8942
|
withFormatOptions(
|
|
8686
8943
|
withApiOptions(
|
|
8687
8944
|
withProjectOptions(
|
|
8688
|
-
|
|
8945
|
+
yargs34.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
8689
8946
|
)
|
|
8690
8947
|
)
|
|
8691
8948
|
)
|
|
@@ -8709,7 +8966,7 @@ var RedirectDefinitionListModule = {
|
|
|
8709
8966
|
command: "list",
|
|
8710
8967
|
describe: "List of redirects",
|
|
8711
8968
|
aliases: ["ls"],
|
|
8712
|
-
builder: (
|
|
8969
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
8713
8970
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8714
8971
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8715
8972
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8730,12 +8987,12 @@ function writeContextPackage3(filename, packageContents) {
|
|
|
8730
8987
|
}
|
|
8731
8988
|
|
|
8732
8989
|
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
8733
|
-
var
|
|
8990
|
+
var selectIdentifier13 = (source) => source.id;
|
|
8734
8991
|
var selectFilename2 = (source) => {
|
|
8735
8992
|
const index = source.sourceUrl.lastIndexOf("/");
|
|
8736
8993
|
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
8737
8994
|
};
|
|
8738
|
-
var
|
|
8995
|
+
var selectDisplayName13 = (source) => {
|
|
8739
8996
|
let pathName = source.sourceUrl;
|
|
8740
8997
|
if (pathName.length > 30) {
|
|
8741
8998
|
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
@@ -8752,15 +9009,16 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
8752
9009
|
const redirects = client.getAllRedirects();
|
|
8753
9010
|
for await (const redirect of redirects) {
|
|
8754
9011
|
const result = {
|
|
8755
|
-
id:
|
|
8756
|
-
displayName:
|
|
8757
|
-
providerId:
|
|
9012
|
+
id: selectIdentifier13(redirect.redirect),
|
|
9013
|
+
displayName: selectDisplayName13(redirect.redirect),
|
|
9014
|
+
providerId: selectIdentifier13(redirect.redirect),
|
|
8758
9015
|
object: redirect.redirect
|
|
8759
9016
|
};
|
|
8760
9017
|
yield result;
|
|
8761
9018
|
}
|
|
8762
9019
|
}
|
|
8763
9020
|
return {
|
|
9021
|
+
name: "Uniform API",
|
|
8764
9022
|
objects: getObjects(),
|
|
8765
9023
|
deleteObject: async (providerId) => {
|
|
8766
9024
|
await client.deleteRedirect(providerId);
|
|
@@ -8775,11 +9033,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
8775
9033
|
var RedirectDefinitionPullModule = {
|
|
8776
9034
|
command: "pull <directory>",
|
|
8777
9035
|
describe: "Pulls all redirects to local files in a directory",
|
|
8778
|
-
builder: (
|
|
9036
|
+
builder: (yargs34) => withConfiguration(
|
|
8779
9037
|
withApiOptions(
|
|
8780
9038
|
withProjectOptions(
|
|
8781
9039
|
withDiffOptions(
|
|
8782
|
-
|
|
9040
|
+
yargs34.positional("directory", {
|
|
8783
9041
|
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.",
|
|
8784
9042
|
type: "string"
|
|
8785
9043
|
}).option("format", {
|
|
@@ -8824,9 +9082,10 @@ var RedirectDefinitionPullModule = {
|
|
|
8824
9082
|
if (isPackage) {
|
|
8825
9083
|
const packageContents = readContextPackage3(directory, false);
|
|
8826
9084
|
target = await createArraySyncEngineDataSource({
|
|
9085
|
+
name: `Package file ${directory}`,
|
|
8827
9086
|
objects: packageContents.redirects ?? [],
|
|
8828
|
-
selectIdentifier:
|
|
8829
|
-
selectDisplayName:
|
|
9087
|
+
selectIdentifier: selectIdentifier13,
|
|
9088
|
+
selectDisplayName: selectDisplayName13,
|
|
8830
9089
|
onSyncComplete: async (_, synced) => {
|
|
8831
9090
|
packageContents.redirects = synced;
|
|
8832
9091
|
writeContextPackage3(directory, packageContents);
|
|
@@ -8836,8 +9095,8 @@ var RedirectDefinitionPullModule = {
|
|
|
8836
9095
|
target = await createFileSyncEngineDataSource({
|
|
8837
9096
|
directory,
|
|
8838
9097
|
selectFilename: selectFilename2,
|
|
8839
|
-
selectIdentifier:
|
|
8840
|
-
selectDisplayName:
|
|
9098
|
+
selectIdentifier: selectIdentifier13,
|
|
9099
|
+
selectDisplayName: selectDisplayName13,
|
|
8841
9100
|
format
|
|
8842
9101
|
});
|
|
8843
9102
|
}
|
|
@@ -8857,11 +9116,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
8857
9116
|
var RedirectDefinitionPushModule = {
|
|
8858
9117
|
command: "push <directory>",
|
|
8859
9118
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
8860
|
-
builder: (
|
|
9119
|
+
builder: (yargs34) => withConfiguration(
|
|
8861
9120
|
withApiOptions(
|
|
8862
9121
|
withProjectOptions(
|
|
8863
9122
|
withDiffOptions(
|
|
8864
|
-
|
|
9123
|
+
yargs34.positional("directory", {
|
|
8865
9124
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
8866
9125
|
type: "string"
|
|
8867
9126
|
}).option("what-if", {
|
|
@@ -8898,15 +9157,16 @@ var RedirectDefinitionPushModule = {
|
|
|
8898
9157
|
if (isPackage) {
|
|
8899
9158
|
const packageContents = readContextPackage3(directory, true);
|
|
8900
9159
|
source = await createArraySyncEngineDataSource({
|
|
9160
|
+
name: `Package file ${directory}`,
|
|
8901
9161
|
objects: packageContents.redirects ?? [],
|
|
8902
|
-
selectIdentifier:
|
|
8903
|
-
selectDisplayName:
|
|
9162
|
+
selectIdentifier: selectIdentifier13,
|
|
9163
|
+
selectDisplayName: selectDisplayName13
|
|
8904
9164
|
});
|
|
8905
9165
|
} else {
|
|
8906
9166
|
source = await createFileSyncEngineDataSource({
|
|
8907
9167
|
directory,
|
|
8908
|
-
selectIdentifier:
|
|
8909
|
-
selectDisplayName:
|
|
9168
|
+
selectIdentifier: selectIdentifier13,
|
|
9169
|
+
selectDisplayName: selectDisplayName13
|
|
8910
9170
|
});
|
|
8911
9171
|
}
|
|
8912
9172
|
const target = createRedirectDefinitionEngineDataSource({ client });
|
|
@@ -8927,9 +9187,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
8927
9187
|
command: "remove <id>",
|
|
8928
9188
|
aliases: ["delete", "rm"],
|
|
8929
9189
|
describe: "Delete a redirect",
|
|
8930
|
-
builder: (
|
|
9190
|
+
builder: (yargs34) => withConfiguration(
|
|
8931
9191
|
withApiOptions(
|
|
8932
|
-
withProjectOptions(
|
|
9192
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8933
9193
|
)
|
|
8934
9194
|
),
|
|
8935
9195
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8945,10 +9205,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
8945
9205
|
command: "update <filename>",
|
|
8946
9206
|
aliases: ["put"],
|
|
8947
9207
|
describe: "Insert or update a redirect",
|
|
8948
|
-
builder: (
|
|
9208
|
+
builder: (yargs34) => withConfiguration(
|
|
8949
9209
|
withApiOptions(
|
|
8950
9210
|
withProjectOptions(
|
|
8951
|
-
|
|
9211
|
+
yargs34.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
8952
9212
|
)
|
|
8953
9213
|
)
|
|
8954
9214
|
),
|
|
@@ -8964,9 +9224,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
8964
9224
|
var RedirectDefinitionModule = {
|
|
8965
9225
|
command: "definition <command>",
|
|
8966
9226
|
describe: "Commands for Redirect Definitions",
|
|
8967
|
-
builder: (
|
|
9227
|
+
builder: (yargs34) => yargs34.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
8968
9228
|
handler: () => {
|
|
8969
|
-
|
|
9229
|
+
yargs30.help();
|
|
8970
9230
|
}
|
|
8971
9231
|
};
|
|
8972
9232
|
|
|
@@ -8975,39 +9235,66 @@ var RedirectCommand = {
|
|
|
8975
9235
|
command: "redirect <command>",
|
|
8976
9236
|
aliases: ["red"],
|
|
8977
9237
|
describe: "Uniform Redirect commands",
|
|
8978
|
-
builder: (
|
|
9238
|
+
builder: (yargs34) => yargs34.command(RedirectDefinitionModule).demandCommand(),
|
|
8979
9239
|
handler: () => {
|
|
8980
|
-
|
|
9240
|
+
yargs31.showHelp();
|
|
8981
9241
|
}
|
|
8982
9242
|
};
|
|
8983
9243
|
|
|
8984
9244
|
// src/commands/sync/index.ts
|
|
8985
|
-
import
|
|
9245
|
+
import yargs32 from "yargs";
|
|
8986
9246
|
|
|
8987
9247
|
// src/commands/sync/commands/util.ts
|
|
8988
9248
|
import ora2 from "ora";
|
|
8989
|
-
function
|
|
8990
|
-
const
|
|
8991
|
-
const
|
|
8992
|
-
|
|
9249
|
+
async function spinPromise(action, options) {
|
|
9250
|
+
const { successText, failText } = typeof options === "object" ? options : { successText: void 0, failText: void 0 };
|
|
9251
|
+
const spinner = ora2(options).start();
|
|
9252
|
+
const consoleReplay = [];
|
|
9253
|
+
const revertLog = patchConsole("log", spinner, consoleReplay);
|
|
9254
|
+
const revertError = patchConsole("error", spinner, consoleReplay);
|
|
9255
|
+
const revertWarning = patchConsole("warn", spinner, consoleReplay);
|
|
9256
|
+
const unpatchConsole = () => {
|
|
9257
|
+
revertLog();
|
|
9258
|
+
revertError();
|
|
9259
|
+
revertWarning();
|
|
9260
|
+
};
|
|
9261
|
+
let thrownError = void 0;
|
|
9262
|
+
try {
|
|
9263
|
+
const result = await action;
|
|
9264
|
+
spinner.succeed(successText);
|
|
9265
|
+
return result;
|
|
9266
|
+
} catch (error) {
|
|
9267
|
+
const indexOfConsoleMessages = spinner.text.indexOf("\n");
|
|
9268
|
+
const capturedConsole = indexOfConsoleMessages > -1 ? spinner.text.slice(0, indexOfConsoleMessages) : "";
|
|
9269
|
+
spinner.fail(failText === void 0 ? void 0 : failText(error, capturedConsole));
|
|
9270
|
+
thrownError = error;
|
|
9271
|
+
} finally {
|
|
9272
|
+
unpatchConsole();
|
|
9273
|
+
if (!thrownError) {
|
|
9274
|
+
replayConsole(consoleReplay);
|
|
9275
|
+
}
|
|
9276
|
+
}
|
|
9277
|
+
if (thrownError) {
|
|
9278
|
+
throw thrownError;
|
|
9279
|
+
}
|
|
9280
|
+
}
|
|
9281
|
+
function replayConsole(replay) {
|
|
9282
|
+
for (const { fn, args } of replay) {
|
|
9283
|
+
console[fn](...args);
|
|
9284
|
+
}
|
|
9285
|
+
}
|
|
9286
|
+
function patchConsole(fn, ora3, replay = []) {
|
|
9287
|
+
const original = console[fn];
|
|
9288
|
+
console[fn] = (...text) => {
|
|
8993
9289
|
if (text.length === 1 && typeof text[0] === "string") {
|
|
8994
|
-
|
|
9290
|
+
ora3.text += "\n" + text;
|
|
8995
9291
|
} else {
|
|
8996
|
-
|
|
9292
|
+
original(...text);
|
|
8997
9293
|
}
|
|
9294
|
+
replay.push({ fn, args: text });
|
|
8998
9295
|
};
|
|
8999
|
-
return {
|
|
9000
|
-
|
|
9001
|
-
stop: () => {
|
|
9002
|
-
spinner.stop();
|
|
9003
|
-
console.log = consoleLog;
|
|
9004
|
-
return spinner;
|
|
9005
|
-
},
|
|
9006
|
-
succeed() {
|
|
9007
|
-
spinner.succeed();
|
|
9008
|
-
console.log = consoleLog;
|
|
9009
|
-
return spinner;
|
|
9010
|
-
}
|
|
9296
|
+
return () => {
|
|
9297
|
+
console[fn] = original;
|
|
9011
9298
|
};
|
|
9012
9299
|
}
|
|
9013
9300
|
|
|
@@ -9015,11 +9302,11 @@ function spin(entityType) {
|
|
|
9015
9302
|
var SyncPullModule = {
|
|
9016
9303
|
command: "pull",
|
|
9017
9304
|
describe: "Pulls whole project to local files in a directory",
|
|
9018
|
-
builder: (
|
|
9305
|
+
builder: (yargs34) => withConfiguration(
|
|
9019
9306
|
withApiOptions(
|
|
9020
9307
|
withProjectOptions(
|
|
9021
9308
|
withDiffOptions(
|
|
9022
|
-
|
|
9309
|
+
yargs34.option("what-if", {
|
|
9023
9310
|
alias: ["w"],
|
|
9024
9311
|
describe: "What-if mode reports what would be done but changes no files",
|
|
9025
9312
|
default: false,
|
|
@@ -9041,6 +9328,7 @@ var SyncPullModule = {
|
|
|
9041
9328
|
locale: LocalePullModule,
|
|
9042
9329
|
asset: AssetPullModule,
|
|
9043
9330
|
category: CategoryPullModule,
|
|
9331
|
+
workflow: WorkflowPullModule,
|
|
9044
9332
|
dataType: DataTypePullModule,
|
|
9045
9333
|
prompt: PromptPullModule,
|
|
9046
9334
|
quirk: QuirkPullModule,
|
|
@@ -9068,26 +9356,34 @@ var SyncPullModule = {
|
|
|
9068
9356
|
);
|
|
9069
9357
|
}
|
|
9070
9358
|
for (const [entityType, module3] of enabledEntities) {
|
|
9071
|
-
const spinner = spin(entityType);
|
|
9072
9359
|
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
9073
9360
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
9074
9361
|
};
|
|
9075
9362
|
const entityConfig = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType];
|
|
9076
9363
|
try {
|
|
9077
|
-
await
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9364
|
+
await spinPromise(
|
|
9365
|
+
module3.handler({
|
|
9366
|
+
...otherParams,
|
|
9367
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
9368
|
+
format: getFormat(entityType, config2),
|
|
9369
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
9370
|
+
onlyPatterns: entityType === "componentPattern" ? true : void 0,
|
|
9371
|
+
mode: getPullMode(entityType, config2),
|
|
9372
|
+
directory: getPullFilename(entityType, config2, { isUsingDeprecatedPatternConfig }),
|
|
9373
|
+
allowEmptySource: config2.allowEmptySource
|
|
9374
|
+
}),
|
|
9375
|
+
{
|
|
9376
|
+
text: `${entityType}\u2026`,
|
|
9377
|
+
successText: entityType,
|
|
9378
|
+
failText(error) {
|
|
9379
|
+
return `${entityType}
|
|
9380
|
+
|
|
9381
|
+
${error.stack}`;
|
|
9382
|
+
}
|
|
9383
|
+
}
|
|
9384
|
+
);
|
|
9088
9385
|
} catch (e) {
|
|
9089
|
-
|
|
9090
|
-
throw e;
|
|
9386
|
+
process.exit(1);
|
|
9091
9387
|
}
|
|
9092
9388
|
}
|
|
9093
9389
|
}
|
|
@@ -9122,11 +9418,11 @@ var getFormat = (entityType, config2) => {
|
|
|
9122
9418
|
var SyncPushModule = {
|
|
9123
9419
|
command: "push",
|
|
9124
9420
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
9125
|
-
builder: (
|
|
9421
|
+
builder: (yargs34) => withConfiguration(
|
|
9126
9422
|
withApiOptions(
|
|
9127
9423
|
withProjectOptions(
|
|
9128
9424
|
withDiffOptions(
|
|
9129
|
-
|
|
9425
|
+
yargs34.option("what-if", {
|
|
9130
9426
|
alias: ["w"],
|
|
9131
9427
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
9132
9428
|
default: false,
|
|
@@ -9148,6 +9444,7 @@ var SyncPushModule = {
|
|
|
9148
9444
|
locale: LocalePushModule,
|
|
9149
9445
|
asset: AssetPushModule,
|
|
9150
9446
|
category: CategoryPushModule,
|
|
9447
|
+
workflow: WorkflowPushModule,
|
|
9151
9448
|
dataType: DataTypePushModule,
|
|
9152
9449
|
prompt: PromptPushModule,
|
|
9153
9450
|
quirk: QuirkPushModule,
|
|
@@ -9175,22 +9472,30 @@ var SyncPushModule = {
|
|
|
9175
9472
|
);
|
|
9176
9473
|
}
|
|
9177
9474
|
for (const [entityType, module3] of enabledEntities) {
|
|
9178
|
-
const spinner = spin(entityType);
|
|
9179
9475
|
try {
|
|
9180
|
-
await
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9476
|
+
await spinPromise(
|
|
9477
|
+
module3.handler({
|
|
9478
|
+
...otherParams,
|
|
9479
|
+
state: 0,
|
|
9480
|
+
format: getFormat2(entityType, config2),
|
|
9481
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
9482
|
+
onlyPatterns: entityType === "componentPattern" ? true : void 0,
|
|
9483
|
+
mode: getPushMode(entityType, config2),
|
|
9484
|
+
directory: getPushFilename(entityType, config2, { isUsingDeprecatedPatternConfig }),
|
|
9485
|
+
allowEmptySource: config2.allowEmptySource
|
|
9486
|
+
}),
|
|
9487
|
+
{
|
|
9488
|
+
text: `${entityType}...`,
|
|
9489
|
+
successText: entityType,
|
|
9490
|
+
failText(error) {
|
|
9491
|
+
return `${entityType}
|
|
9492
|
+
|
|
9493
|
+
${error.stack}`;
|
|
9494
|
+
}
|
|
9495
|
+
}
|
|
9496
|
+
);
|
|
9191
9497
|
} catch (e) {
|
|
9192
|
-
|
|
9193
|
-
throw e;
|
|
9498
|
+
process.exit(1);
|
|
9194
9499
|
}
|
|
9195
9500
|
}
|
|
9196
9501
|
if (((_b = config2.entitiesConfig) == null ? void 0 : _b.componentPattern) && ((_e = (_d = (_c = config2.entitiesConfig) == null ? void 0 : _c.componentPattern) == null ? void 0 : _d.push) == null ? void 0 : _e.disabled) !== true && ((_g = (_f = config2.entitiesConfig) == null ? void 0 : _f.componentPattern) == null ? void 0 : _g.publish)) {
|
|
@@ -9237,9 +9542,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
9237
9542
|
var SyncCommand = {
|
|
9238
9543
|
command: "sync <command>",
|
|
9239
9544
|
describe: "Uniform Sync commands",
|
|
9240
|
-
builder: (
|
|
9545
|
+
builder: (yargs34) => yargs34.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
9241
9546
|
handler: () => {
|
|
9242
|
-
|
|
9547
|
+
yargs32.showHelp();
|
|
9243
9548
|
}
|
|
9244
9549
|
};
|
|
9245
9550
|
|
|
@@ -9506,7 +9811,7 @@ First found was: v${firstVersion}`;
|
|
|
9506
9811
|
|
|
9507
9812
|
// src/index.ts
|
|
9508
9813
|
dotenv.config();
|
|
9509
|
-
var yarggery =
|
|
9814
|
+
var yarggery = yargs33(hideBin(process.argv));
|
|
9510
9815
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
9511
9816
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
9512
9817
|
yarggery.option("verbose", {
|