@uniformdev/cli 19.147.1-alpha.3 → 19.147.1-alpha.5
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 +840 -513
- 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,14 +2057,15 @@ 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 },
|
|
2068
|
+
search: { describe: "Search query", type: "string", default: "" },
|
|
2056
2069
|
resolvePatterns: {
|
|
2057
2070
|
type: "boolean",
|
|
2058
2071
|
default: false,
|
|
@@ -2091,6 +2104,7 @@ var CompositionListModule = {
|
|
|
2091
2104
|
proxy,
|
|
2092
2105
|
limit,
|
|
2093
2106
|
offset,
|
|
2107
|
+
search,
|
|
2094
2108
|
format,
|
|
2095
2109
|
filename,
|
|
2096
2110
|
onlyCompositions,
|
|
@@ -2106,6 +2120,7 @@ var CompositionListModule = {
|
|
|
2106
2120
|
const res = await client.getCompositionList({
|
|
2107
2121
|
limit,
|
|
2108
2122
|
offset,
|
|
2123
|
+
search: search.length > 0 ? search : void 0,
|
|
2109
2124
|
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
2110
2125
|
state: convertStateOption(state),
|
|
2111
2126
|
skipPatternResolution: !resolvePatterns,
|
|
@@ -2120,12 +2135,12 @@ var CompositionListModule = {
|
|
|
2120
2135
|
var ComponentPatternListModule = {
|
|
2121
2136
|
...CompositionListModule,
|
|
2122
2137
|
describe: "List component patterns",
|
|
2123
|
-
builder: (
|
|
2138
|
+
builder: (yargs34) => withFormatOptions(
|
|
2124
2139
|
withConfiguration(
|
|
2125
2140
|
withApiOptions(
|
|
2126
2141
|
withProjectOptions(
|
|
2127
2142
|
withStateOptions(
|
|
2128
|
-
|
|
2143
|
+
yargs34.options({
|
|
2129
2144
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2130
2145
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2131
2146
|
resolvePatterns: {
|
|
@@ -2200,6 +2215,7 @@ function createComponentInstanceEngineDataSource({
|
|
|
2200
2215
|
}
|
|
2201
2216
|
}
|
|
2202
2217
|
return {
|
|
2218
|
+
name: "Uniform API",
|
|
2203
2219
|
objects: getObjects(),
|
|
2204
2220
|
deleteObject: async (providerId) => {
|
|
2205
2221
|
await client.removeComposition({ compositionId: providerId });
|
|
@@ -2214,11 +2230,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2214
2230
|
var CompositionPublishModule = {
|
|
2215
2231
|
command: "publish [ids]",
|
|
2216
2232
|
describe: "Publishes composition(s)",
|
|
2217
|
-
builder: (
|
|
2233
|
+
builder: (yargs34) => withConfiguration(
|
|
2218
2234
|
withApiOptions(
|
|
2219
2235
|
withProjectOptions(
|
|
2220
2236
|
withDiffOptions(
|
|
2221
|
-
|
|
2237
|
+
yargs34.positional("ids", {
|
|
2222
2238
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2223
2239
|
type: "string"
|
|
2224
2240
|
}).option("all", {
|
|
@@ -2292,11 +2308,11 @@ var CompositionPublishModule = {
|
|
|
2292
2308
|
var ComponentPatternPublishModule = {
|
|
2293
2309
|
...CompositionPublishModule,
|
|
2294
2310
|
describe: "Publishes component pattern(s)",
|
|
2295
|
-
builder: (
|
|
2311
|
+
builder: (yargs34) => withConfiguration(
|
|
2296
2312
|
withApiOptions(
|
|
2297
2313
|
withProjectOptions(
|
|
2298
2314
|
withDiffOptions(
|
|
2299
|
-
|
|
2315
|
+
yargs34.positional("ids", {
|
|
2300
2316
|
describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2301
2317
|
type: "string"
|
|
2302
2318
|
}).option("all", {
|
|
@@ -2336,12 +2352,12 @@ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
|
2336
2352
|
var CompositionPullModule = {
|
|
2337
2353
|
command: "pull <directory>",
|
|
2338
2354
|
describe: "Pulls all compositions to local files in a directory",
|
|
2339
|
-
builder: (
|
|
2355
|
+
builder: (yargs34) => withConfiguration(
|
|
2340
2356
|
withApiOptions(
|
|
2341
2357
|
withProjectOptions(
|
|
2342
2358
|
withStateOptions(
|
|
2343
2359
|
withDiffOptions(
|
|
2344
|
-
|
|
2360
|
+
yargs34.positional("directory", {
|
|
2345
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.",
|
|
2346
2362
|
type: "string"
|
|
2347
2363
|
}).option("format", {
|
|
@@ -2400,6 +2416,7 @@ var CompositionPullModule = {
|
|
|
2400
2416
|
if (isPackage) {
|
|
2401
2417
|
const packageContents = readCanvasPackage(directory, false);
|
|
2402
2418
|
target = await createArraySyncEngineDataSource({
|
|
2419
|
+
name: `Package file ${directory}`,
|
|
2403
2420
|
objects: (packageContents == null ? void 0 : packageContents.compositions) ?? [],
|
|
2404
2421
|
selectIdentifier: selectIdentifier3,
|
|
2405
2422
|
selectDisplayName: selectDisplayName3,
|
|
@@ -2443,12 +2460,12 @@ var CompositionPullModule = {
|
|
|
2443
2460
|
var ComponentPatternPullModule = {
|
|
2444
2461
|
...CompositionPullModule,
|
|
2445
2462
|
describe: "Pulls all component patterns to local files in a directory",
|
|
2446
|
-
builder: (
|
|
2463
|
+
builder: (yargs34) => withConfiguration(
|
|
2447
2464
|
withApiOptions(
|
|
2448
2465
|
withProjectOptions(
|
|
2449
2466
|
withStateOptions(
|
|
2450
2467
|
withDiffOptions(
|
|
2451
|
-
|
|
2468
|
+
yargs34.positional("directory", {
|
|
2452
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.",
|
|
2453
2470
|
type: "string"
|
|
2454
2471
|
}).option("format", {
|
|
@@ -2488,12 +2505,12 @@ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
|
2488
2505
|
var CompositionPushModule = {
|
|
2489
2506
|
command: "push <directory>",
|
|
2490
2507
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2491
|
-
builder: (
|
|
2508
|
+
builder: (yargs34) => withConfiguration(
|
|
2492
2509
|
withApiOptions(
|
|
2493
2510
|
withProjectOptions(
|
|
2494
2511
|
withStateOptions(
|
|
2495
2512
|
withDiffOptions(
|
|
2496
|
-
|
|
2513
|
+
yargs34.positional("directory", {
|
|
2497
2514
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2498
2515
|
type: "string"
|
|
2499
2516
|
}).option("what-if", {
|
|
@@ -2543,6 +2560,7 @@ var CompositionPushModule = {
|
|
|
2543
2560
|
if (isPackage) {
|
|
2544
2561
|
const packageContents = readCanvasPackage(directory, true);
|
|
2545
2562
|
source = await createArraySyncEngineDataSource({
|
|
2563
|
+
name: `Package file ${directory}`,
|
|
2546
2564
|
objects: packageContents.compositions ?? [],
|
|
2547
2565
|
selectIdentifier: selectIdentifier3,
|
|
2548
2566
|
selectDisplayName: selectDisplayName3
|
|
@@ -2582,12 +2600,12 @@ var CompositionPushModule = {
|
|
|
2582
2600
|
var ComponentPatternPushModule = {
|
|
2583
2601
|
...CompositionPushModule,
|
|
2584
2602
|
describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
|
|
2585
|
-
builder: (
|
|
2603
|
+
builder: (yargs34) => withConfiguration(
|
|
2586
2604
|
withApiOptions(
|
|
2587
2605
|
withProjectOptions(
|
|
2588
2606
|
withStateOptions(
|
|
2589
2607
|
withDiffOptions(
|
|
2590
|
-
|
|
2608
|
+
yargs34.positional("directory", {
|
|
2591
2609
|
describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
|
|
2592
2610
|
type: "string"
|
|
2593
2611
|
}).option("what-if", {
|
|
@@ -2621,10 +2639,10 @@ var CompositionRemoveModule = {
|
|
|
2621
2639
|
command: "remove <id>",
|
|
2622
2640
|
aliases: ["delete", "rm"],
|
|
2623
2641
|
describe: "Delete a composition",
|
|
2624
|
-
builder: (
|
|
2642
|
+
builder: (yargs34) => withConfiguration(
|
|
2625
2643
|
withApiOptions(
|
|
2626
2644
|
withProjectOptions(
|
|
2627
|
-
|
|
2645
|
+
yargs34.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2628
2646
|
)
|
|
2629
2647
|
)
|
|
2630
2648
|
),
|
|
@@ -2647,10 +2665,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2647
2665
|
var CompositionUnpublishModule = {
|
|
2648
2666
|
command: "unpublish [ids]",
|
|
2649
2667
|
describe: "Unpublish a composition(s)",
|
|
2650
|
-
builder: (
|
|
2668
|
+
builder: (yargs34) => withConfiguration(
|
|
2651
2669
|
withApiOptions(
|
|
2652
2670
|
withProjectOptions(
|
|
2653
|
-
|
|
2671
|
+
yargs34.positional("ids", {
|
|
2654
2672
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2655
2673
|
type: "string"
|
|
2656
2674
|
}).option("all", {
|
|
@@ -2742,10 +2760,10 @@ var CompositionUnpublishModule = {
|
|
|
2742
2760
|
var ComponentPatternUnpublishModule = {
|
|
2743
2761
|
command: "unpublish [ids]",
|
|
2744
2762
|
describe: "Unpublish a component pattern(s)",
|
|
2745
|
-
builder: (
|
|
2763
|
+
builder: (yargs34) => withConfiguration(
|
|
2746
2764
|
withApiOptions(
|
|
2747
2765
|
withProjectOptions(
|
|
2748
|
-
|
|
2766
|
+
yargs34.positional("ids", {
|
|
2749
2767
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2750
2768
|
type: "string"
|
|
2751
2769
|
}).option("all", {
|
|
@@ -2780,11 +2798,11 @@ var CompositionUpdateModule = {
|
|
|
2780
2798
|
command: "update <filename>",
|
|
2781
2799
|
aliases: ["put"],
|
|
2782
2800
|
describe: "Insert or update a composition",
|
|
2783
|
-
builder: (
|
|
2801
|
+
builder: (yargs34) => withConfiguration(
|
|
2784
2802
|
withApiOptions(
|
|
2785
2803
|
withProjectOptions(
|
|
2786
2804
|
withStateOptions(
|
|
2787
|
-
|
|
2805
|
+
yargs34.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2788
2806
|
)
|
|
2789
2807
|
)
|
|
2790
2808
|
)
|
|
@@ -2808,7 +2826,7 @@ var ComponentPatternModule = {
|
|
|
2808
2826
|
command: "component-pattern <command>",
|
|
2809
2827
|
aliases: ["pattern"],
|
|
2810
2828
|
describe: "Commands for Canvas component patterns",
|
|
2811
|
-
builder: (
|
|
2829
|
+
builder: (yargs34) => yargs34.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
|
|
2812
2830
|
handler: () => {
|
|
2813
2831
|
yargs4.help();
|
|
2814
2832
|
}
|
|
@@ -2820,7 +2838,7 @@ var CompositionModule = {
|
|
|
2820
2838
|
command: "composition <command>",
|
|
2821
2839
|
describe: "Commands for Canvas compositions",
|
|
2822
2840
|
aliases: ["comp"],
|
|
2823
|
-
builder: (
|
|
2841
|
+
builder: (yargs34) => yargs34.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2824
2842
|
handler: () => {
|
|
2825
2843
|
yargs5.help();
|
|
2826
2844
|
}
|
|
@@ -2834,12 +2852,12 @@ import { ContentClient } from "@uniformdev/canvas";
|
|
|
2834
2852
|
var ContentTypeGetModule = {
|
|
2835
2853
|
command: "get <id>",
|
|
2836
2854
|
describe: "Get a content type",
|
|
2837
|
-
builder: (
|
|
2855
|
+
builder: (yargs34) => withConfiguration(
|
|
2838
2856
|
withFormatOptions(
|
|
2839
2857
|
withApiOptions(
|
|
2840
2858
|
withProjectOptions(
|
|
2841
2859
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2842
|
-
|
|
2860
|
+
yargs34.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2843
2861
|
)
|
|
2844
2862
|
)
|
|
2845
2863
|
)
|
|
@@ -2861,7 +2879,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2861
2879
|
var ContentTypeListModule = {
|
|
2862
2880
|
command: "list",
|
|
2863
2881
|
describe: "List content types",
|
|
2864
|
-
builder: (
|
|
2882
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
2865
2883
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2866
2884
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2867
2885
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2894,6 +2912,7 @@ function createContentTypeEngineDataSource({
|
|
|
2894
2912
|
}
|
|
2895
2913
|
}
|
|
2896
2914
|
return {
|
|
2915
|
+
name: "Uniform API",
|
|
2897
2916
|
objects: getObjects(),
|
|
2898
2917
|
deleteObject: async (providerId) => {
|
|
2899
2918
|
await client.deleteContentType({ contentTypeId: providerId });
|
|
@@ -2908,11 +2927,11 @@ function createContentTypeEngineDataSource({
|
|
|
2908
2927
|
var ContentTypePullModule = {
|
|
2909
2928
|
command: "pull <directory>",
|
|
2910
2929
|
describe: "Pulls all content types to local files in a directory",
|
|
2911
|
-
builder: (
|
|
2930
|
+
builder: (yargs34) => withConfiguration(
|
|
2912
2931
|
withApiOptions(
|
|
2913
2932
|
withProjectOptions(
|
|
2914
2933
|
withDiffOptions(
|
|
2915
|
-
|
|
2934
|
+
yargs34.positional("directory", {
|
|
2916
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.",
|
|
2917
2936
|
type: "string"
|
|
2918
2937
|
}).option("format", {
|
|
@@ -2963,6 +2982,7 @@ var ContentTypePullModule = {
|
|
|
2963
2982
|
if (isPackage) {
|
|
2964
2983
|
const packageContents = readCanvasPackage(directory, false);
|
|
2965
2984
|
target = await createArraySyncEngineDataSource({
|
|
2985
|
+
name: `Package file ${directory}`,
|
|
2966
2986
|
objects: packageContents.contentTypes ?? [],
|
|
2967
2987
|
selectIdentifier: selectContentTypeIdentifier,
|
|
2968
2988
|
selectDisplayName: selectContentTypeDisplayName,
|
|
@@ -2995,11 +3015,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2995
3015
|
var ContentTypePushModule = {
|
|
2996
3016
|
command: "push <directory>",
|
|
2997
3017
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2998
|
-
builder: (
|
|
3018
|
+
builder: (yargs34) => withConfiguration(
|
|
2999
3019
|
withApiOptions(
|
|
3000
3020
|
withProjectOptions(
|
|
3001
3021
|
withDiffOptions(
|
|
3002
|
-
|
|
3022
|
+
yargs34.positional("directory", {
|
|
3003
3023
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
3004
3024
|
type: "string"
|
|
3005
3025
|
}).option("what-if", {
|
|
@@ -3042,6 +3062,7 @@ var ContentTypePushModule = {
|
|
|
3042
3062
|
if (isPackage) {
|
|
3043
3063
|
const packageContents = readCanvasPackage(directory, true);
|
|
3044
3064
|
source = await createArraySyncEngineDataSource({
|
|
3065
|
+
name: `Package file ${directory}`,
|
|
3045
3066
|
objects: packageContents.contentTypes ?? [],
|
|
3046
3067
|
selectIdentifier: selectContentTypeIdentifier,
|
|
3047
3068
|
selectDisplayName: selectContentTypeDisplayName
|
|
@@ -3071,10 +3092,10 @@ var ContentTypeRemoveModule = {
|
|
|
3071
3092
|
command: "remove <id>",
|
|
3072
3093
|
aliases: ["delete", "rm"],
|
|
3073
3094
|
describe: "Delete a content type",
|
|
3074
|
-
builder: (
|
|
3095
|
+
builder: (yargs34) => withConfiguration(
|
|
3075
3096
|
withApiOptions(
|
|
3076
3097
|
withProjectOptions(
|
|
3077
|
-
|
|
3098
|
+
yargs34.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
3078
3099
|
)
|
|
3079
3100
|
)
|
|
3080
3101
|
),
|
|
@@ -3091,10 +3112,10 @@ var ContentTypeUpdateModule = {
|
|
|
3091
3112
|
command: "update <filename>",
|
|
3092
3113
|
aliases: ["put"],
|
|
3093
3114
|
describe: "Insert or update a content type",
|
|
3094
|
-
builder: (
|
|
3115
|
+
builder: (yargs34) => withConfiguration(
|
|
3095
3116
|
withApiOptions(
|
|
3096
3117
|
withProjectOptions(
|
|
3097
|
-
|
|
3118
|
+
yargs34.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
3098
3119
|
)
|
|
3099
3120
|
)
|
|
3100
3121
|
),
|
|
@@ -3111,7 +3132,7 @@ var ContentTypeModule = {
|
|
|
3111
3132
|
command: "contenttype <command>",
|
|
3112
3133
|
aliases: ["ct"],
|
|
3113
3134
|
describe: "Commands for Content Types",
|
|
3114
|
-
builder: (
|
|
3135
|
+
builder: (yargs34) => yargs34.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
3115
3136
|
handler: () => {
|
|
3116
3137
|
yargs6.help();
|
|
3117
3138
|
}
|
|
@@ -3125,11 +3146,11 @@ import { DataSourceClient } from "@uniformdev/canvas";
|
|
|
3125
3146
|
var DataSourceGetModule = {
|
|
3126
3147
|
command: "get <id>",
|
|
3127
3148
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
3128
|
-
builder: (
|
|
3149
|
+
builder: (yargs34) => withConfiguration(
|
|
3129
3150
|
withApiOptions(
|
|
3130
3151
|
withProjectOptions(
|
|
3131
3152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3132
|
-
|
|
3153
|
+
yargs34.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
3133
3154
|
)
|
|
3134
3155
|
)
|
|
3135
3156
|
),
|
|
@@ -3147,10 +3168,10 @@ var DataSourceRemoveModule = {
|
|
|
3147
3168
|
command: "remove <id>",
|
|
3148
3169
|
aliases: ["delete", "rm"],
|
|
3149
3170
|
describe: "Delete a data source",
|
|
3150
|
-
builder: (
|
|
3171
|
+
builder: (yargs34) => withConfiguration(
|
|
3151
3172
|
withApiOptions(
|
|
3152
3173
|
withProjectOptions(
|
|
3153
|
-
|
|
3174
|
+
yargs34.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
|
|
3154
3175
|
)
|
|
3155
3176
|
)
|
|
3156
3177
|
),
|
|
@@ -3167,10 +3188,10 @@ var DataSourceUpdateModule = {
|
|
|
3167
3188
|
command: "update <dataSource>",
|
|
3168
3189
|
aliases: ["put"],
|
|
3169
3190
|
describe: "Insert or update a data source",
|
|
3170
|
-
builder: (
|
|
3191
|
+
builder: (yargs34) => withConfiguration(
|
|
3171
3192
|
withApiOptions(
|
|
3172
3193
|
withProjectOptions(
|
|
3173
|
-
|
|
3194
|
+
yargs34.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
|
|
3174
3195
|
describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
|
|
3175
3196
|
type: "string",
|
|
3176
3197
|
demandOption: true
|
|
@@ -3190,7 +3211,7 @@ var DataSourceModule = {
|
|
|
3190
3211
|
command: "datasource <command>",
|
|
3191
3212
|
aliases: ["ds"],
|
|
3192
3213
|
describe: "Commands for Data Source definitions",
|
|
3193
|
-
builder: (
|
|
3214
|
+
builder: (yargs34) => yargs34.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
|
|
3194
3215
|
handler: () => {
|
|
3195
3216
|
yargs7.help();
|
|
3196
3217
|
}
|
|
@@ -3205,12 +3226,12 @@ var DataTypeGetModule = {
|
|
|
3205
3226
|
command: "get <id>",
|
|
3206
3227
|
describe: "Get a data type",
|
|
3207
3228
|
aliases: ["ls"],
|
|
3208
|
-
builder: (
|
|
3229
|
+
builder: (yargs34) => withConfiguration(
|
|
3209
3230
|
withFormatOptions(
|
|
3210
3231
|
withApiOptions(
|
|
3211
3232
|
withProjectOptions(
|
|
3212
3233
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3213
|
-
|
|
3234
|
+
yargs34.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
3214
3235
|
)
|
|
3215
3236
|
)
|
|
3216
3237
|
)
|
|
@@ -3233,7 +3254,7 @@ var DataTypeListModule = {
|
|
|
3233
3254
|
command: "list",
|
|
3234
3255
|
describe: "List data types",
|
|
3235
3256
|
aliases: ["ls"],
|
|
3236
|
-
builder: (
|
|
3257
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
3237
3258
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3238
3259
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3239
3260
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3266,6 +3287,7 @@ function createDataTypeEngineDataSource({
|
|
|
3266
3287
|
}
|
|
3267
3288
|
}
|
|
3268
3289
|
return {
|
|
3290
|
+
name: "Uniform API",
|
|
3269
3291
|
objects: getObjects(),
|
|
3270
3292
|
deleteObject: async (providerId) => {
|
|
3271
3293
|
await client.remove({ typeId: providerId });
|
|
@@ -3282,11 +3304,11 @@ function createDataTypeEngineDataSource({
|
|
|
3282
3304
|
var DataTypePullModule = {
|
|
3283
3305
|
command: "pull <directory>",
|
|
3284
3306
|
describe: "Pulls all data types to local files in a directory",
|
|
3285
|
-
builder: (
|
|
3307
|
+
builder: (yargs34) => withConfiguration(
|
|
3286
3308
|
withApiOptions(
|
|
3287
3309
|
withProjectOptions(
|
|
3288
3310
|
withDiffOptions(
|
|
3289
|
-
|
|
3311
|
+
yargs34.positional("directory", {
|
|
3290
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.",
|
|
3291
3313
|
type: "string"
|
|
3292
3314
|
}).option("format", {
|
|
@@ -3337,6 +3359,7 @@ var DataTypePullModule = {
|
|
|
3337
3359
|
if (isPackage) {
|
|
3338
3360
|
const packageContents = readCanvasPackage(directory, false);
|
|
3339
3361
|
target = await createArraySyncEngineDataSource({
|
|
3362
|
+
name: `Package file ${directory}`,
|
|
3340
3363
|
objects: packageContents.dataTypes ?? [],
|
|
3341
3364
|
selectIdentifier: selectIdentifier4,
|
|
3342
3365
|
selectDisplayName: selectDisplayName4,
|
|
@@ -3369,11 +3392,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
3369
3392
|
var DataTypePushModule = {
|
|
3370
3393
|
command: "push <directory>",
|
|
3371
3394
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
3372
|
-
builder: (
|
|
3395
|
+
builder: (yargs34) => withConfiguration(
|
|
3373
3396
|
withApiOptions(
|
|
3374
3397
|
withProjectOptions(
|
|
3375
3398
|
withDiffOptions(
|
|
3376
|
-
|
|
3399
|
+
yargs34.positional("directory", {
|
|
3377
3400
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
3378
3401
|
type: "string"
|
|
3379
3402
|
}).option("what-if", {
|
|
@@ -3416,6 +3439,7 @@ var DataTypePushModule = {
|
|
|
3416
3439
|
if (isPackage) {
|
|
3417
3440
|
const packageContents = readCanvasPackage(directory, true);
|
|
3418
3441
|
source = await createArraySyncEngineDataSource({
|
|
3442
|
+
name: `Package file ${directory}`,
|
|
3419
3443
|
objects: packageContents.dataTypes ?? [],
|
|
3420
3444
|
selectIdentifier: selectIdentifier4,
|
|
3421
3445
|
selectDisplayName: selectDisplayName4
|
|
@@ -3445,10 +3469,10 @@ var DataTypeRemoveModule = {
|
|
|
3445
3469
|
command: "remove <id>",
|
|
3446
3470
|
aliases: ["delete", "rm"],
|
|
3447
3471
|
describe: "Delete a data type",
|
|
3448
|
-
builder: (
|
|
3472
|
+
builder: (yargs34) => withConfiguration(
|
|
3449
3473
|
withApiOptions(
|
|
3450
3474
|
withProjectOptions(
|
|
3451
|
-
|
|
3475
|
+
yargs34.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
3452
3476
|
)
|
|
3453
3477
|
)
|
|
3454
3478
|
),
|
|
@@ -3465,10 +3489,10 @@ var DataTypeUpdateModule = {
|
|
|
3465
3489
|
command: "update <filename>",
|
|
3466
3490
|
aliases: ["put"],
|
|
3467
3491
|
describe: "Insert or update a data type",
|
|
3468
|
-
builder: (
|
|
3492
|
+
builder: (yargs34) => withConfiguration(
|
|
3469
3493
|
withApiOptions(
|
|
3470
3494
|
withProjectOptions(
|
|
3471
|
-
|
|
3495
|
+
yargs34.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
3472
3496
|
)
|
|
3473
3497
|
)
|
|
3474
3498
|
),
|
|
@@ -3485,7 +3509,7 @@ var DataTypeModule = {
|
|
|
3485
3509
|
command: "datatype <command>",
|
|
3486
3510
|
aliases: ["dt"],
|
|
3487
3511
|
describe: "Commands for Data Type definitions",
|
|
3488
|
-
builder: (
|
|
3512
|
+
builder: (yargs34) => yargs34.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3489
3513
|
handler: () => {
|
|
3490
3514
|
yargs8.help();
|
|
3491
3515
|
}
|
|
@@ -3499,13 +3523,13 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
|
3499
3523
|
var EntryGetModule = {
|
|
3500
3524
|
command: "get <id>",
|
|
3501
3525
|
describe: "Get an entry",
|
|
3502
|
-
builder: (
|
|
3526
|
+
builder: (yargs34) => withConfiguration(
|
|
3503
3527
|
withFormatOptions(
|
|
3504
3528
|
withApiOptions(
|
|
3505
3529
|
withProjectOptions(
|
|
3506
3530
|
withStateOptions(
|
|
3507
3531
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3508
|
-
|
|
3532
|
+
yargs34.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }),
|
|
3509
3533
|
// for backwards compatibility, we default to the "published" state, unlike compositions
|
|
3510
3534
|
"published"
|
|
3511
3535
|
)
|
|
@@ -3544,15 +3568,20 @@ var EntryGetModule = {
|
|
|
3544
3568
|
|
|
3545
3569
|
// src/commands/canvas/commands/entry/list.ts
|
|
3546
3570
|
import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
3571
|
+
var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
3547
3572
|
var EntryListModule = {
|
|
3548
3573
|
command: "list",
|
|
3549
3574
|
describe: "List entries",
|
|
3550
|
-
builder: (
|
|
3575
|
+
builder: (yargs34) => withConfiguration(
|
|
3551
3576
|
withFormatOptions(
|
|
3552
3577
|
withApiOptions(
|
|
3553
3578
|
withProjectOptions(
|
|
3554
3579
|
withStateOptions(
|
|
3555
|
-
|
|
3580
|
+
yargs34.options({
|
|
3581
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3582
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: LEGACY_DEFAULT_LIMIT },
|
|
3583
|
+
search: { describe: "Search query", type: "string", default: "" }
|
|
3584
|
+
}),
|
|
3556
3585
|
// for backwards compatibility, we default to the "published" state, unlike compositions
|
|
3557
3586
|
"published"
|
|
3558
3587
|
)
|
|
@@ -3560,12 +3589,26 @@ var EntryListModule = {
|
|
|
3560
3589
|
)
|
|
3561
3590
|
)
|
|
3562
3591
|
),
|
|
3563
|
-
handler: async ({
|
|
3592
|
+
handler: async ({
|
|
3593
|
+
apiHost,
|
|
3594
|
+
edgeApiHost,
|
|
3595
|
+
apiKey,
|
|
3596
|
+
proxy,
|
|
3597
|
+
format,
|
|
3598
|
+
filename,
|
|
3599
|
+
project: projectId,
|
|
3600
|
+
state,
|
|
3601
|
+
limit,
|
|
3602
|
+
offset,
|
|
3603
|
+
search
|
|
3604
|
+
}) => {
|
|
3564
3605
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3565
3606
|
const client = new ContentClient8({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
3566
3607
|
const res = await client.getEntries({
|
|
3567
|
-
offset
|
|
3568
|
-
limit:
|
|
3608
|
+
offset,
|
|
3609
|
+
limit: search.length > 0 && limit === LEGACY_DEFAULT_LIMIT ? 100 : limit,
|
|
3610
|
+
// Search API requires a lower default limit (100)
|
|
3611
|
+
search: search.length > 0 ? search : void 0,
|
|
3569
3612
|
state: convertStateOption(state),
|
|
3570
3613
|
skipOverridesResolution: true,
|
|
3571
3614
|
skipPatternResolution: true,
|
|
@@ -3620,6 +3663,7 @@ function createEntryEngineDataSource({
|
|
|
3620
3663
|
}
|
|
3621
3664
|
}
|
|
3622
3665
|
return {
|
|
3666
|
+
name: "Uniform API",
|
|
3623
3667
|
objects: getObjects(),
|
|
3624
3668
|
deleteObject: async (providerId) => {
|
|
3625
3669
|
await client.deleteEntry({ entryId: providerId });
|
|
@@ -3634,11 +3678,11 @@ function createEntryEngineDataSource({
|
|
|
3634
3678
|
var EntryPublishModule = {
|
|
3635
3679
|
command: "publish [ids]",
|
|
3636
3680
|
describe: "Publishes entry(ies)",
|
|
3637
|
-
builder: (
|
|
3681
|
+
builder: (yargs34) => withConfiguration(
|
|
3638
3682
|
withApiOptions(
|
|
3639
3683
|
withProjectOptions(
|
|
3640
3684
|
withDiffOptions(
|
|
3641
|
-
|
|
3685
|
+
yargs34.positional("ids", {
|
|
3642
3686
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3643
3687
|
type: "string"
|
|
3644
3688
|
}).option("all", {
|
|
@@ -3693,12 +3737,12 @@ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
|
3693
3737
|
var EntryPullModule = {
|
|
3694
3738
|
command: "pull <directory>",
|
|
3695
3739
|
describe: "Pulls all entries to local files in a directory",
|
|
3696
|
-
builder: (
|
|
3740
|
+
builder: (yargs34) => withConfiguration(
|
|
3697
3741
|
withApiOptions(
|
|
3698
3742
|
withProjectOptions(
|
|
3699
3743
|
withStateOptions(
|
|
3700
3744
|
withDiffOptions(
|
|
3701
|
-
|
|
3745
|
+
yargs34.positional("directory", {
|
|
3702
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.",
|
|
3703
3747
|
type: "string"
|
|
3704
3748
|
}).option("format", {
|
|
@@ -3752,6 +3796,7 @@ var EntryPullModule = {
|
|
|
3752
3796
|
if (isPackage) {
|
|
3753
3797
|
const packageContents = readCanvasPackage(directory, false);
|
|
3754
3798
|
target = await createArraySyncEngineDataSource({
|
|
3799
|
+
name: `Package file ${directory}`,
|
|
3755
3800
|
objects: packageContents.entries ?? [],
|
|
3756
3801
|
selectIdentifier: selectEntryIdentifier,
|
|
3757
3802
|
selectDisplayName: selectEntryDisplayName,
|
|
@@ -3797,12 +3842,12 @@ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
|
3797
3842
|
var EntryPushModule = {
|
|
3798
3843
|
command: "push <directory>",
|
|
3799
3844
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3800
|
-
builder: (
|
|
3845
|
+
builder: (yargs34) => withConfiguration(
|
|
3801
3846
|
withApiOptions(
|
|
3802
3847
|
withProjectOptions(
|
|
3803
3848
|
withStateOptions(
|
|
3804
3849
|
withDiffOptions(
|
|
3805
|
-
|
|
3850
|
+
yargs34.positional("directory", {
|
|
3806
3851
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3807
3852
|
type: "string"
|
|
3808
3853
|
}).option("what-if", {
|
|
@@ -3847,6 +3892,7 @@ var EntryPushModule = {
|
|
|
3847
3892
|
if (isPackage) {
|
|
3848
3893
|
const packageContents = readCanvasPackage(directory, true);
|
|
3849
3894
|
source = await createArraySyncEngineDataSource({
|
|
3895
|
+
name: `Package file ${directory}`,
|
|
3850
3896
|
objects: packageContents.entries ?? [],
|
|
3851
3897
|
selectIdentifier: selectEntryIdentifier,
|
|
3852
3898
|
selectDisplayName: selectEntryDisplayName
|
|
@@ -3888,10 +3934,10 @@ var EntryRemoveModule = {
|
|
|
3888
3934
|
command: "remove <id>",
|
|
3889
3935
|
aliases: ["delete", "rm"],
|
|
3890
3936
|
describe: "Delete an entry",
|
|
3891
|
-
builder: (
|
|
3937
|
+
builder: (yargs34) => withConfiguration(
|
|
3892
3938
|
withApiOptions(
|
|
3893
3939
|
withProjectOptions(
|
|
3894
|
-
|
|
3940
|
+
yargs34.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3895
3941
|
)
|
|
3896
3942
|
)
|
|
3897
3943
|
),
|
|
@@ -3908,10 +3954,10 @@ import { diffJson as diffJson3 } from "diff";
|
|
|
3908
3954
|
var EntryUnpublishModule = {
|
|
3909
3955
|
command: "unpublish [ids]",
|
|
3910
3956
|
describe: "Unpublish an entry(ies)",
|
|
3911
|
-
builder: (
|
|
3957
|
+
builder: (yargs34) => withConfiguration(
|
|
3912
3958
|
withApiOptions(
|
|
3913
3959
|
withProjectOptions(
|
|
3914
|
-
|
|
3960
|
+
yargs34.positional("ids", {
|
|
3915
3961
|
describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3916
3962
|
type: "string"
|
|
3917
3963
|
}).option("all", {
|
|
@@ -3984,11 +4030,11 @@ var EntryUpdateModule = {
|
|
|
3984
4030
|
command: "update <filename>",
|
|
3985
4031
|
aliases: ["put"],
|
|
3986
4032
|
describe: "Insert or update an entry",
|
|
3987
|
-
builder: (
|
|
4033
|
+
builder: (yargs34) => withConfiguration(
|
|
3988
4034
|
withApiOptions(
|
|
3989
4035
|
withProjectOptions(
|
|
3990
4036
|
withStateOptions(
|
|
3991
|
-
|
|
4037
|
+
yargs34.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
3992
4038
|
)
|
|
3993
4039
|
)
|
|
3994
4040
|
)
|
|
@@ -4005,7 +4051,7 @@ var EntryUpdateModule = {
|
|
|
4005
4051
|
var EntryModule = {
|
|
4006
4052
|
command: "entry <command>",
|
|
4007
4053
|
describe: "Commands for Entries",
|
|
4008
|
-
builder: (
|
|
4054
|
+
builder: (yargs34) => yargs34.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
|
|
4009
4055
|
handler: () => {
|
|
4010
4056
|
yargs9.help();
|
|
4011
4057
|
}
|
|
@@ -4019,13 +4065,13 @@ import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
|
|
|
4019
4065
|
var EntryPatternGetModule = {
|
|
4020
4066
|
command: "get <id>",
|
|
4021
4067
|
describe: "Get an entry pattern",
|
|
4022
|
-
builder: (
|
|
4068
|
+
builder: (yargs34) => withConfiguration(
|
|
4023
4069
|
withFormatOptions(
|
|
4024
4070
|
withApiOptions(
|
|
4025
4071
|
withProjectOptions(
|
|
4026
4072
|
withStateOptions(
|
|
4027
4073
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4028
|
-
|
|
4074
|
+
yargs34.positional("id", {
|
|
4029
4075
|
demandOption: true,
|
|
4030
4076
|
describe: "Entry pattern public ID to fetch"
|
|
4031
4077
|
}),
|
|
@@ -4060,8 +4106,8 @@ import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
|
|
|
4060
4106
|
var EntryPatternListModule = {
|
|
4061
4107
|
command: "list",
|
|
4062
4108
|
describe: "List entry patterns",
|
|
4063
|
-
builder: (
|
|
4064
|
-
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(
|
|
4109
|
+
builder: (yargs34) => withConfiguration(
|
|
4110
|
+
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs34, "published"))))
|
|
4065
4111
|
),
|
|
4066
4112
|
handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
|
|
4067
4113
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4084,11 +4130,11 @@ import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
|
|
|
4084
4130
|
var EntryPatternPublishModule = {
|
|
4085
4131
|
command: "publish [ids]",
|
|
4086
4132
|
describe: "Publishes entry pattern(s)",
|
|
4087
|
-
builder: (
|
|
4133
|
+
builder: (yargs34) => withConfiguration(
|
|
4088
4134
|
withApiOptions(
|
|
4089
4135
|
withProjectOptions(
|
|
4090
4136
|
withDiffOptions(
|
|
4091
|
-
|
|
4137
|
+
yargs34.positional("ids", {
|
|
4092
4138
|
describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4093
4139
|
type: "string"
|
|
4094
4140
|
}).option("all", {
|
|
@@ -4143,12 +4189,12 @@ import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
|
|
|
4143
4189
|
var EntryPatternPullModule = {
|
|
4144
4190
|
command: "pull <directory>",
|
|
4145
4191
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
4146
|
-
builder: (
|
|
4192
|
+
builder: (yargs34) => withConfiguration(
|
|
4147
4193
|
withApiOptions(
|
|
4148
4194
|
withProjectOptions(
|
|
4149
4195
|
withStateOptions(
|
|
4150
4196
|
withDiffOptions(
|
|
4151
|
-
|
|
4197
|
+
yargs34.positional("directory", {
|
|
4152
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.",
|
|
4153
4199
|
type: "string"
|
|
4154
4200
|
}).option("format", {
|
|
@@ -4202,6 +4248,7 @@ var EntryPatternPullModule = {
|
|
|
4202
4248
|
if (isPackage) {
|
|
4203
4249
|
const packageContents = readCanvasPackage(directory, false);
|
|
4204
4250
|
target = await createArraySyncEngineDataSource({
|
|
4251
|
+
name: `Package file ${directory}`,
|
|
4205
4252
|
objects: packageContents.entries ?? [],
|
|
4206
4253
|
selectIdentifier: selectEntryIdentifier,
|
|
4207
4254
|
selectDisplayName: selectEntryDisplayName,
|
|
@@ -4247,12 +4294,12 @@ import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
|
|
|
4247
4294
|
var EntryPatternPushModule = {
|
|
4248
4295
|
command: "push <directory>",
|
|
4249
4296
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
4250
|
-
builder: (
|
|
4297
|
+
builder: (yargs34) => withConfiguration(
|
|
4251
4298
|
withApiOptions(
|
|
4252
4299
|
withProjectOptions(
|
|
4253
4300
|
withStateOptions(
|
|
4254
4301
|
withDiffOptions(
|
|
4255
|
-
|
|
4302
|
+
yargs34.positional("directory", {
|
|
4256
4303
|
describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
|
|
4257
4304
|
type: "string"
|
|
4258
4305
|
}).option("what-if", {
|
|
@@ -4297,6 +4344,7 @@ var EntryPatternPushModule = {
|
|
|
4297
4344
|
if (isPackage) {
|
|
4298
4345
|
const packageContents = readCanvasPackage(directory, true);
|
|
4299
4346
|
source = await createArraySyncEngineDataSource({
|
|
4347
|
+
name: `Package file ${directory}`,
|
|
4300
4348
|
objects: packageContents.entries ?? [],
|
|
4301
4349
|
selectIdentifier: selectEntryIdentifier,
|
|
4302
4350
|
selectDisplayName: selectEntryDisplayName
|
|
@@ -4338,10 +4386,10 @@ var EntryPatternRemoveModule = {
|
|
|
4338
4386
|
command: "remove <id>",
|
|
4339
4387
|
aliases: ["delete", "rm"],
|
|
4340
4388
|
describe: "Delete an entry pattern",
|
|
4341
|
-
builder: (
|
|
4389
|
+
builder: (yargs34) => withConfiguration(
|
|
4342
4390
|
withApiOptions(
|
|
4343
4391
|
withProjectOptions(
|
|
4344
|
-
|
|
4392
|
+
yargs34.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
|
|
4345
4393
|
)
|
|
4346
4394
|
)
|
|
4347
4395
|
),
|
|
@@ -4358,10 +4406,10 @@ import { diffJson as diffJson4 } from "diff";
|
|
|
4358
4406
|
var EntryPatternUnpublishModule = {
|
|
4359
4407
|
command: "unpublish [ids]",
|
|
4360
4408
|
describe: "Unpublish an entry patterns",
|
|
4361
|
-
builder: (
|
|
4409
|
+
builder: (yargs34) => withConfiguration(
|
|
4362
4410
|
withApiOptions(
|
|
4363
4411
|
withProjectOptions(
|
|
4364
|
-
|
|
4412
|
+
yargs34.positional("ids", {
|
|
4365
4413
|
describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4366
4414
|
type: "string"
|
|
4367
4415
|
}).option("all", {
|
|
@@ -4434,11 +4482,11 @@ var EntryPatternUpdateModule = {
|
|
|
4434
4482
|
command: "update <filename>",
|
|
4435
4483
|
aliases: ["put"],
|
|
4436
4484
|
describe: "Insert or update an entry pattern",
|
|
4437
|
-
builder: (
|
|
4485
|
+
builder: (yargs34) => withConfiguration(
|
|
4438
4486
|
withApiOptions(
|
|
4439
4487
|
withProjectOptions(
|
|
4440
4488
|
withStateOptions(
|
|
4441
|
-
|
|
4489
|
+
yargs34.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
|
|
4442
4490
|
)
|
|
4443
4491
|
)
|
|
4444
4492
|
)
|
|
@@ -4455,7 +4503,7 @@ var EntryPatternUpdateModule = {
|
|
|
4455
4503
|
var EntryPatternModule = {
|
|
4456
4504
|
command: "entry-pattern <command>",
|
|
4457
4505
|
describe: "Commands for Entry patterns",
|
|
4458
|
-
builder: (
|
|
4506
|
+
builder: (yargs34) => yargs34.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
|
|
4459
4507
|
handler: () => {
|
|
4460
4508
|
yargs10.help();
|
|
4461
4509
|
}
|
|
@@ -4484,6 +4532,7 @@ function createLocaleEngineDataSource({
|
|
|
4484
4532
|
}
|
|
4485
4533
|
}
|
|
4486
4534
|
return {
|
|
4535
|
+
name: "Uniform API",
|
|
4487
4536
|
objects: getObjects(),
|
|
4488
4537
|
deleteObject: async (providerId) => {
|
|
4489
4538
|
await client.remove({ locale: providerId });
|
|
@@ -4500,11 +4549,11 @@ function createLocaleEngineDataSource({
|
|
|
4500
4549
|
var LocalePullModule = {
|
|
4501
4550
|
command: "pull <directory>",
|
|
4502
4551
|
describe: "Pulls all locales to local files in a directory",
|
|
4503
|
-
builder: (
|
|
4552
|
+
builder: (yargs34) => withConfiguration(
|
|
4504
4553
|
withApiOptions(
|
|
4505
4554
|
withProjectOptions(
|
|
4506
4555
|
withDiffOptions(
|
|
4507
|
-
|
|
4556
|
+
yargs34.positional("directory", {
|
|
4508
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.",
|
|
4509
4558
|
type: "string"
|
|
4510
4559
|
}).option("format", {
|
|
@@ -4555,6 +4604,7 @@ var LocalePullModule = {
|
|
|
4555
4604
|
if (isPackage) {
|
|
4556
4605
|
const packageContents = readCanvasPackage(directory, false);
|
|
4557
4606
|
target = await createArraySyncEngineDataSource({
|
|
4607
|
+
name: `Package file ${directory}`,
|
|
4558
4608
|
objects: packageContents.locales ?? [],
|
|
4559
4609
|
selectIdentifier: (i) => i.locale,
|
|
4560
4610
|
selectDisplayName: (i) => i.displayName,
|
|
@@ -4587,11 +4637,11 @@ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
|
4587
4637
|
var LocalePushModule = {
|
|
4588
4638
|
command: "push <directory>",
|
|
4589
4639
|
describe: "Pushes all locales from files in a directory to Uniform",
|
|
4590
|
-
builder: (
|
|
4640
|
+
builder: (yargs34) => withConfiguration(
|
|
4591
4641
|
withApiOptions(
|
|
4592
4642
|
withProjectOptions(
|
|
4593
4643
|
withDiffOptions(
|
|
4594
|
-
|
|
4644
|
+
yargs34.positional("directory", {
|
|
4595
4645
|
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
4596
4646
|
type: "string"
|
|
4597
4647
|
}).option("what-if", {
|
|
@@ -4634,6 +4684,7 @@ var LocalePushModule = {
|
|
|
4634
4684
|
if (isPackage) {
|
|
4635
4685
|
const packageContents = readCanvasPackage(directory, true);
|
|
4636
4686
|
source = await createArraySyncEngineDataSource({
|
|
4687
|
+
name: `Package file ${directory}`,
|
|
4637
4688
|
objects: packageContents.locales ?? [],
|
|
4638
4689
|
selectIdentifier: (locale) => locale.locale,
|
|
4639
4690
|
selectDisplayName: (locale) => locale.displayName
|
|
@@ -4661,7 +4712,7 @@ var LocalePushModule = {
|
|
|
4661
4712
|
var LocaleModule = {
|
|
4662
4713
|
command: "locale <command>",
|
|
4663
4714
|
describe: "Commands for locale definitions",
|
|
4664
|
-
builder: (
|
|
4715
|
+
builder: (yargs34) => yargs34.command(LocalePullModule).command(LocalePushModule),
|
|
4665
4716
|
handler: () => {
|
|
4666
4717
|
yargs11.help();
|
|
4667
4718
|
}
|
|
@@ -4675,12 +4726,12 @@ import { PromptClient } from "@uniformdev/canvas";
|
|
|
4675
4726
|
var PromptGetModule = {
|
|
4676
4727
|
command: "get <id>",
|
|
4677
4728
|
describe: "Get a prompt",
|
|
4678
|
-
builder: (
|
|
4729
|
+
builder: (yargs34) => withConfiguration(
|
|
4679
4730
|
withFormatOptions(
|
|
4680
4731
|
withApiOptions(
|
|
4681
4732
|
withProjectOptions(
|
|
4682
4733
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4683
|
-
|
|
4734
|
+
yargs34.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
4684
4735
|
)
|
|
4685
4736
|
)
|
|
4686
4737
|
)
|
|
@@ -4701,7 +4752,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
4701
4752
|
var PromptListModule = {
|
|
4702
4753
|
command: "list",
|
|
4703
4754
|
describe: "List prompts",
|
|
4704
|
-
builder: (
|
|
4755
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
4705
4756
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4706
4757
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4707
4758
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -4734,6 +4785,7 @@ function createPromptEngineDataSource({
|
|
|
4734
4785
|
}
|
|
4735
4786
|
}
|
|
4736
4787
|
return {
|
|
4788
|
+
name: "Uniform API",
|
|
4737
4789
|
objects: getObjects(),
|
|
4738
4790
|
deleteObject: async (providerId) => {
|
|
4739
4791
|
await client.remove({ promptId: providerId });
|
|
@@ -4748,12 +4800,12 @@ function createPromptEngineDataSource({
|
|
|
4748
4800
|
var PromptPullModule = {
|
|
4749
4801
|
command: "pull <directory>",
|
|
4750
4802
|
describe: "Pulls all prompts to local files in a directory",
|
|
4751
|
-
builder: (
|
|
4803
|
+
builder: (yargs34) => withConfiguration(
|
|
4752
4804
|
withApiOptions(
|
|
4753
4805
|
withProjectOptions(
|
|
4754
4806
|
withStateOptions(
|
|
4755
4807
|
withDiffOptions(
|
|
4756
|
-
|
|
4808
|
+
yargs34.positional("directory", {
|
|
4757
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.",
|
|
4758
4810
|
type: "string"
|
|
4759
4811
|
}).option("format", {
|
|
@@ -4805,6 +4857,7 @@ var PromptPullModule = {
|
|
|
4805
4857
|
if (isPackage) {
|
|
4806
4858
|
const packageContents = readCanvasPackage(directory, false);
|
|
4807
4859
|
target = await createArraySyncEngineDataSource({
|
|
4860
|
+
name: `Package file ${directory}`,
|
|
4808
4861
|
objects: packageContents.prompts ?? [],
|
|
4809
4862
|
selectIdentifier: selectPromptIdentifier,
|
|
4810
4863
|
selectDisplayName: selectPromptDisplayName,
|
|
@@ -4837,12 +4890,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
4837
4890
|
var PromptPushModule = {
|
|
4838
4891
|
command: "push <directory>",
|
|
4839
4892
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
4840
|
-
builder: (
|
|
4893
|
+
builder: (yargs34) => withConfiguration(
|
|
4841
4894
|
withApiOptions(
|
|
4842
4895
|
withProjectOptions(
|
|
4843
4896
|
withStateOptions(
|
|
4844
4897
|
withDiffOptions(
|
|
4845
|
-
|
|
4898
|
+
yargs34.positional("directory", {
|
|
4846
4899
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
4847
4900
|
type: "string"
|
|
4848
4901
|
}).option("what-if", {
|
|
@@ -4886,6 +4939,7 @@ var PromptPushModule = {
|
|
|
4886
4939
|
if (isPackage) {
|
|
4887
4940
|
const packageContents = readCanvasPackage(directory, true);
|
|
4888
4941
|
source = await createArraySyncEngineDataSource({
|
|
4942
|
+
name: `Package file ${directory}`,
|
|
4889
4943
|
objects: packageContents.prompts ?? [],
|
|
4890
4944
|
selectIdentifier: selectPromptIdentifier,
|
|
4891
4945
|
selectDisplayName: selectPromptDisplayName
|
|
@@ -4915,9 +4969,9 @@ var PromptRemoveModule = {
|
|
|
4915
4969
|
command: "remove <id>",
|
|
4916
4970
|
aliases: ["delete", "rm"],
|
|
4917
4971
|
describe: "Delete a prompt",
|
|
4918
|
-
builder: (
|
|
4972
|
+
builder: (yargs34) => withConfiguration(
|
|
4919
4973
|
withApiOptions(
|
|
4920
|
-
withProjectOptions(
|
|
4974
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
4921
4975
|
)
|
|
4922
4976
|
),
|
|
4923
4977
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -4933,10 +4987,10 @@ var PromptUpdateModule = {
|
|
|
4933
4987
|
command: "update <filename>",
|
|
4934
4988
|
aliases: ["put"],
|
|
4935
4989
|
describe: "Insert or update a prompt",
|
|
4936
|
-
builder: (
|
|
4990
|
+
builder: (yargs34) => withConfiguration(
|
|
4937
4991
|
withApiOptions(
|
|
4938
4992
|
withProjectOptions(
|
|
4939
|
-
|
|
4993
|
+
yargs34.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
4940
4994
|
)
|
|
4941
4995
|
)
|
|
4942
4996
|
),
|
|
@@ -4953,39 +5007,242 @@ var PromptModule = {
|
|
|
4953
5007
|
command: "prompt <command>",
|
|
4954
5008
|
aliases: ["dt"],
|
|
4955
5009
|
describe: "Commands for AI Prompt definitions",
|
|
4956
|
-
builder: (
|
|
5010
|
+
builder: (yargs34) => yargs34.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
4957
5011
|
handler: () => {
|
|
4958
5012
|
yargs12.help();
|
|
4959
5013
|
}
|
|
4960
5014
|
};
|
|
4961
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
|
+
|
|
4962
5219
|
// src/commands/canvas/index.ts
|
|
4963
5220
|
var CanvasCommand = {
|
|
4964
5221
|
command: "canvas <command>",
|
|
4965
5222
|
aliases: ["cv", "pm", "presentation"],
|
|
4966
5223
|
describe: "Uniform Canvas commands",
|
|
4967
|
-
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(),
|
|
4968
5225
|
handler: () => {
|
|
4969
|
-
|
|
5226
|
+
yargs14.showHelp();
|
|
4970
5227
|
}
|
|
4971
5228
|
};
|
|
4972
5229
|
|
|
4973
5230
|
// src/commands/context/index.ts
|
|
4974
|
-
import
|
|
5231
|
+
import yargs21 from "yargs";
|
|
4975
5232
|
|
|
4976
5233
|
// src/commands/context/commands/aggregate.ts
|
|
4977
|
-
import
|
|
5234
|
+
import yargs15 from "yargs";
|
|
4978
5235
|
|
|
4979
5236
|
// src/commands/context/commands/aggregate/get.ts
|
|
4980
5237
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
4981
5238
|
var AggregateGetModule = {
|
|
4982
5239
|
command: "get <id>",
|
|
4983
5240
|
describe: "Fetch an aggregate",
|
|
4984
|
-
builder: (
|
|
5241
|
+
builder: (yargs34) => withConfiguration(
|
|
4985
5242
|
withFormatOptions(
|
|
4986
5243
|
withApiOptions(
|
|
4987
5244
|
withProjectOptions(
|
|
4988
|
-
|
|
5245
|
+
yargs34.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
4989
5246
|
)
|
|
4990
5247
|
)
|
|
4991
5248
|
)
|
|
@@ -5009,7 +5266,7 @@ var AggregateListModule = {
|
|
|
5009
5266
|
command: "list",
|
|
5010
5267
|
describe: "List aggregates",
|
|
5011
5268
|
aliases: ["ls"],
|
|
5012
|
-
builder: (
|
|
5269
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
5013
5270
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5014
5271
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5015
5272
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5022,8 +5279,8 @@ var AggregateListModule = {
|
|
|
5022
5279
|
import { UncachedAggregateClient as UncachedAggregateClient3 } from "@uniformdev/context/api";
|
|
5023
5280
|
|
|
5024
5281
|
// src/commands/context/commands/aggregate/_util.ts
|
|
5025
|
-
var
|
|
5026
|
-
var
|
|
5282
|
+
var selectIdentifier6 = (source) => source.id;
|
|
5283
|
+
var selectDisplayName6 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5027
5284
|
|
|
5028
5285
|
// src/commands/context/aggregateEngineDataSource.ts
|
|
5029
5286
|
function createAggregateEngineDataSource({
|
|
@@ -5034,8 +5291,8 @@ function createAggregateEngineDataSource({
|
|
|
5034
5291
|
const aggregates = (await client.get({ type })).aggregates;
|
|
5035
5292
|
for await (const def of aggregates) {
|
|
5036
5293
|
const result = {
|
|
5037
|
-
id:
|
|
5038
|
-
displayName:
|
|
5294
|
+
id: selectIdentifier6(def),
|
|
5295
|
+
displayName: selectDisplayName6(def),
|
|
5039
5296
|
providerId: def.id,
|
|
5040
5297
|
object: def
|
|
5041
5298
|
};
|
|
@@ -5044,6 +5301,7 @@ function createAggregateEngineDataSource({
|
|
|
5044
5301
|
}
|
|
5045
5302
|
const writtenObjects = [];
|
|
5046
5303
|
return {
|
|
5304
|
+
name: "Uniform API",
|
|
5047
5305
|
objects: getObjects(),
|
|
5048
5306
|
deleteObject: async (providerId) => {
|
|
5049
5307
|
await client.remove({ aggregateId: providerId });
|
|
@@ -5075,11 +5333,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
5075
5333
|
var AggregatePullModule = {
|
|
5076
5334
|
command: "pull <directory>",
|
|
5077
5335
|
describe: "Pulls all aggregates to local files in a directory",
|
|
5078
|
-
builder: (
|
|
5336
|
+
builder: (yargs34) => withConfiguration(
|
|
5079
5337
|
withApiOptions(
|
|
5080
5338
|
withProjectOptions(
|
|
5081
5339
|
withDiffOptions(
|
|
5082
|
-
|
|
5340
|
+
yargs34.positional("directory", {
|
|
5083
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.",
|
|
5084
5342
|
type: "string"
|
|
5085
5343
|
}).option("format", {
|
|
@@ -5124,9 +5382,10 @@ var AggregatePullModule = {
|
|
|
5124
5382
|
if (isPackage) {
|
|
5125
5383
|
const packageContents = readContextPackage(directory, false);
|
|
5126
5384
|
target = await createArraySyncEngineDataSource({
|
|
5385
|
+
name: `Package file ${directory}`,
|
|
5127
5386
|
objects: packageContents.aggregates ?? [],
|
|
5128
|
-
selectIdentifier:
|
|
5129
|
-
selectDisplayName:
|
|
5387
|
+
selectIdentifier: selectIdentifier6,
|
|
5388
|
+
selectDisplayName: selectDisplayName6,
|
|
5130
5389
|
onSyncComplete: async (_, synced) => {
|
|
5131
5390
|
packageContents.aggregates = synced;
|
|
5132
5391
|
writeContextPackage(directory, packageContents);
|
|
@@ -5135,8 +5394,8 @@ var AggregatePullModule = {
|
|
|
5135
5394
|
} else {
|
|
5136
5395
|
target = await createFileSyncEngineDataSource({
|
|
5137
5396
|
directory,
|
|
5138
|
-
selectIdentifier:
|
|
5139
|
-
selectDisplayName:
|
|
5397
|
+
selectIdentifier: selectIdentifier6,
|
|
5398
|
+
selectDisplayName: selectDisplayName6,
|
|
5140
5399
|
format
|
|
5141
5400
|
});
|
|
5142
5401
|
}
|
|
@@ -5156,11 +5415,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
5156
5415
|
var AggregatePushModule = {
|
|
5157
5416
|
command: "push <directory>",
|
|
5158
5417
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
5159
|
-
builder: (
|
|
5418
|
+
builder: (yargs34) => withConfiguration(
|
|
5160
5419
|
withApiOptions(
|
|
5161
5420
|
withProjectOptions(
|
|
5162
5421
|
withDiffOptions(
|
|
5163
|
-
|
|
5422
|
+
yargs34.positional("directory", {
|
|
5164
5423
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
5165
5424
|
type: "string"
|
|
5166
5425
|
}).option("what-if", {
|
|
@@ -5197,15 +5456,16 @@ var AggregatePushModule = {
|
|
|
5197
5456
|
if (isPackage) {
|
|
5198
5457
|
const packageContents = readContextPackage(directory, true);
|
|
5199
5458
|
source = await createArraySyncEngineDataSource({
|
|
5459
|
+
name: `Package file ${directory}`,
|
|
5200
5460
|
objects: packageContents.aggregates ?? [],
|
|
5201
|
-
selectIdentifier:
|
|
5202
|
-
selectDisplayName:
|
|
5461
|
+
selectIdentifier: selectIdentifier6,
|
|
5462
|
+
selectDisplayName: selectDisplayName6
|
|
5203
5463
|
});
|
|
5204
5464
|
} else {
|
|
5205
5465
|
source = await createFileSyncEngineDataSource({
|
|
5206
5466
|
directory,
|
|
5207
|
-
selectIdentifier:
|
|
5208
|
-
selectDisplayName:
|
|
5467
|
+
selectIdentifier: selectIdentifier6,
|
|
5468
|
+
selectDisplayName: selectDisplayName6
|
|
5209
5469
|
});
|
|
5210
5470
|
}
|
|
5211
5471
|
const target = createAggregateEngineDataSource({ client });
|
|
@@ -5227,10 +5487,10 @@ var AggregateRemoveModule = {
|
|
|
5227
5487
|
command: "remove <id>",
|
|
5228
5488
|
aliases: ["delete", "rm"],
|
|
5229
5489
|
describe: "Delete an aggregate",
|
|
5230
|
-
builder: (
|
|
5490
|
+
builder: (yargs34) => withConfiguration(
|
|
5231
5491
|
withApiOptions(
|
|
5232
5492
|
withProjectOptions(
|
|
5233
|
-
|
|
5493
|
+
yargs34.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
5234
5494
|
)
|
|
5235
5495
|
)
|
|
5236
5496
|
),
|
|
@@ -5247,10 +5507,10 @@ var AggregateUpdateModule = {
|
|
|
5247
5507
|
command: "update <filename>",
|
|
5248
5508
|
aliases: ["put"],
|
|
5249
5509
|
describe: "Insert or update an aggregate",
|
|
5250
|
-
builder: (
|
|
5510
|
+
builder: (yargs34) => withConfiguration(
|
|
5251
5511
|
withApiOptions(
|
|
5252
5512
|
withProjectOptions(
|
|
5253
|
-
|
|
5513
|
+
yargs34.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
5254
5514
|
)
|
|
5255
5515
|
)
|
|
5256
5516
|
),
|
|
@@ -5267,25 +5527,25 @@ var AggregateModule = {
|
|
|
5267
5527
|
command: "aggregate <command>",
|
|
5268
5528
|
aliases: ["agg", "intent", "audience"],
|
|
5269
5529
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
5270
|
-
builder: (
|
|
5530
|
+
builder: (yargs34) => yargs34.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
5271
5531
|
handler: () => {
|
|
5272
|
-
|
|
5532
|
+
yargs15.help();
|
|
5273
5533
|
}
|
|
5274
5534
|
};
|
|
5275
5535
|
|
|
5276
5536
|
// src/commands/context/commands/enrichment.ts
|
|
5277
|
-
import
|
|
5537
|
+
import yargs16 from "yargs";
|
|
5278
5538
|
|
|
5279
5539
|
// src/commands/context/commands/enrichment/get.ts
|
|
5280
5540
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
5281
5541
|
var EnrichmentGetModule = {
|
|
5282
5542
|
command: "get <id>",
|
|
5283
5543
|
describe: "Fetch an enrichment category and its values",
|
|
5284
|
-
builder: (
|
|
5544
|
+
builder: (yargs34) => withFormatOptions(
|
|
5285
5545
|
withConfiguration(
|
|
5286
5546
|
withApiOptions(
|
|
5287
5547
|
withProjectOptions(
|
|
5288
|
-
|
|
5548
|
+
yargs34.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
5289
5549
|
)
|
|
5290
5550
|
)
|
|
5291
5551
|
)
|
|
@@ -5310,7 +5570,7 @@ var EnrichmentListModule = {
|
|
|
5310
5570
|
command: "list",
|
|
5311
5571
|
describe: "List enrichments",
|
|
5312
5572
|
aliases: ["ls"],
|
|
5313
|
-
builder: (
|
|
5573
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
5314
5574
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5315
5575
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5316
5576
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5323,8 +5583,8 @@ var EnrichmentListModule = {
|
|
|
5323
5583
|
import { UncachedEnrichmentClient as UncachedEnrichmentClient3 } from "@uniformdev/context/api";
|
|
5324
5584
|
|
|
5325
5585
|
// src/commands/context/commands/enrichment/_util.ts
|
|
5326
|
-
var
|
|
5327
|
-
var
|
|
5586
|
+
var selectIdentifier7 = (source) => source.id;
|
|
5587
|
+
var selectDisplayName7 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5328
5588
|
|
|
5329
5589
|
// src/commands/context/enrichmentEngineDataSource.ts
|
|
5330
5590
|
function createEnrichmentEngineDataSource({
|
|
@@ -5334,8 +5594,8 @@ function createEnrichmentEngineDataSource({
|
|
|
5334
5594
|
const enrichments = (await client.get()).enrichments;
|
|
5335
5595
|
for await (const def of enrichments) {
|
|
5336
5596
|
const result = {
|
|
5337
|
-
id:
|
|
5338
|
-
displayName:
|
|
5597
|
+
id: selectIdentifier7(def),
|
|
5598
|
+
displayName: selectDisplayName7(def),
|
|
5339
5599
|
providerId: def.id,
|
|
5340
5600
|
object: def
|
|
5341
5601
|
};
|
|
@@ -5343,6 +5603,7 @@ function createEnrichmentEngineDataSource({
|
|
|
5343
5603
|
}
|
|
5344
5604
|
}
|
|
5345
5605
|
return {
|
|
5606
|
+
name: "Uniform API",
|
|
5346
5607
|
objects: getObjects(),
|
|
5347
5608
|
deleteObject: async (providerId) => {
|
|
5348
5609
|
await client.removeCategory({ enrichmentId: providerId });
|
|
@@ -5391,6 +5652,7 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
5391
5652
|
}
|
|
5392
5653
|
};
|
|
5393
5654
|
return {
|
|
5655
|
+
name: "Uniform API",
|
|
5394
5656
|
objects: iterator(),
|
|
5395
5657
|
deleteObject: async (providerId) => {
|
|
5396
5658
|
if (!client) {
|
|
@@ -5411,11 +5673,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
5411
5673
|
var EnrichmentPullModule = {
|
|
5412
5674
|
command: "pull <directory>",
|
|
5413
5675
|
describe: "Pulls all enrichments to local files in a directory",
|
|
5414
|
-
builder: (
|
|
5676
|
+
builder: (yargs34) => withConfiguration(
|
|
5415
5677
|
withApiOptions(
|
|
5416
5678
|
withProjectOptions(
|
|
5417
5679
|
withDiffOptions(
|
|
5418
|
-
|
|
5680
|
+
yargs34.positional("directory", {
|
|
5419
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.",
|
|
5420
5682
|
type: "string"
|
|
5421
5683
|
}).option("format", {
|
|
@@ -5460,9 +5722,10 @@ var EnrichmentPullModule = {
|
|
|
5460
5722
|
if (isPackage) {
|
|
5461
5723
|
const packageContents = readContextPackage(directory, false);
|
|
5462
5724
|
target = await createArraySyncEngineDataSource({
|
|
5725
|
+
name: `Package file ${directory}`,
|
|
5463
5726
|
objects: packageContents.enrichments ?? [],
|
|
5464
|
-
selectIdentifier:
|
|
5465
|
-
selectDisplayName:
|
|
5727
|
+
selectIdentifier: selectIdentifier7,
|
|
5728
|
+
selectDisplayName: selectDisplayName7,
|
|
5466
5729
|
onSyncComplete: async (_, synced) => {
|
|
5467
5730
|
packageContents.enrichments = synced;
|
|
5468
5731
|
writeContextPackage(directory, packageContents);
|
|
@@ -5471,8 +5734,8 @@ var EnrichmentPullModule = {
|
|
|
5471
5734
|
} else {
|
|
5472
5735
|
target = await createFileSyncEngineDataSource({
|
|
5473
5736
|
directory,
|
|
5474
|
-
selectIdentifier:
|
|
5475
|
-
selectDisplayName:
|
|
5737
|
+
selectIdentifier: selectIdentifier7,
|
|
5738
|
+
selectDisplayName: selectDisplayName7,
|
|
5476
5739
|
format
|
|
5477
5740
|
});
|
|
5478
5741
|
}
|
|
@@ -5492,11 +5755,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
5492
5755
|
var EnrichmentPushModule = {
|
|
5493
5756
|
command: "push <directory>",
|
|
5494
5757
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
5495
|
-
builder: (
|
|
5758
|
+
builder: (yargs34) => withConfiguration(
|
|
5496
5759
|
withApiOptions(
|
|
5497
5760
|
withProjectOptions(
|
|
5498
5761
|
withDiffOptions(
|
|
5499
|
-
|
|
5762
|
+
yargs34.positional("directory", {
|
|
5500
5763
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
5501
5764
|
type: "string"
|
|
5502
5765
|
}).option("what-if", {
|
|
@@ -5533,15 +5796,16 @@ var EnrichmentPushModule = {
|
|
|
5533
5796
|
if (isPackage) {
|
|
5534
5797
|
const packageContents = readContextPackage(directory, true);
|
|
5535
5798
|
source = await createArraySyncEngineDataSource({
|
|
5799
|
+
name: `Package file ${directory}`,
|
|
5536
5800
|
objects: packageContents.enrichments ?? [],
|
|
5537
|
-
selectIdentifier:
|
|
5538
|
-
selectDisplayName:
|
|
5801
|
+
selectIdentifier: selectIdentifier7,
|
|
5802
|
+
selectDisplayName: selectDisplayName7
|
|
5539
5803
|
});
|
|
5540
5804
|
} else {
|
|
5541
5805
|
source = await createFileSyncEngineDataSource({
|
|
5542
5806
|
directory,
|
|
5543
|
-
selectIdentifier:
|
|
5544
|
-
selectDisplayName:
|
|
5807
|
+
selectIdentifier: selectIdentifier7,
|
|
5808
|
+
selectDisplayName: selectDisplayName7
|
|
5545
5809
|
});
|
|
5546
5810
|
}
|
|
5547
5811
|
const target = createEnrichmentEngineDataSource({ client });
|
|
@@ -5562,10 +5826,10 @@ var EnrichmentRemoveModule = {
|
|
|
5562
5826
|
command: "remove <id>",
|
|
5563
5827
|
aliases: ["delete", "rm"],
|
|
5564
5828
|
describe: "Delete an enrichment category and its values",
|
|
5565
|
-
builder: (
|
|
5829
|
+
builder: (yargs34) => withConfiguration(
|
|
5566
5830
|
withApiOptions(
|
|
5567
5831
|
withProjectOptions(
|
|
5568
|
-
|
|
5832
|
+
yargs34.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
5569
5833
|
)
|
|
5570
5834
|
)
|
|
5571
5835
|
),
|
|
@@ -5581,14 +5845,14 @@ var EnrichmentModule = {
|
|
|
5581
5845
|
command: "enrichment <command>",
|
|
5582
5846
|
aliases: ["enr"],
|
|
5583
5847
|
describe: "Commands for Context enrichments",
|
|
5584
|
-
builder: (
|
|
5848
|
+
builder: (yargs34) => yargs34.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
5585
5849
|
handler: () => {
|
|
5586
|
-
|
|
5850
|
+
yargs16.help();
|
|
5587
5851
|
}
|
|
5588
5852
|
};
|
|
5589
5853
|
|
|
5590
5854
|
// src/commands/context/commands/manifest.ts
|
|
5591
|
-
import
|
|
5855
|
+
import yargs17 from "yargs";
|
|
5592
5856
|
|
|
5593
5857
|
// src/commands/context/commands/manifest/get.ts
|
|
5594
5858
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -5599,10 +5863,10 @@ var ManifestGetModule = {
|
|
|
5599
5863
|
command: "get [output]",
|
|
5600
5864
|
aliases: ["dl", "download"],
|
|
5601
5865
|
describe: "Download the Uniform Context manifest for a project",
|
|
5602
|
-
builder: (
|
|
5866
|
+
builder: (yargs34) => withConfiguration(
|
|
5603
5867
|
withApiOptions(
|
|
5604
5868
|
withProjectOptions(
|
|
5605
|
-
|
|
5869
|
+
yargs34.option("preview", {
|
|
5606
5870
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
5607
5871
|
default: false,
|
|
5608
5872
|
type: "boolean",
|
|
@@ -5664,7 +5928,7 @@ import { exit as exit2 } from "process";
|
|
|
5664
5928
|
var ManifestPublishModule = {
|
|
5665
5929
|
command: "publish",
|
|
5666
5930
|
describe: "Publish the Uniform Context manifest for a project",
|
|
5667
|
-
builder: (
|
|
5931
|
+
builder: (yargs34) => withConfiguration(withApiOptions(withProjectOptions(yargs34))),
|
|
5668
5932
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
5669
5933
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5670
5934
|
try {
|
|
@@ -5697,25 +5961,25 @@ var ManifestModule = {
|
|
|
5697
5961
|
command: "manifest <command>",
|
|
5698
5962
|
describe: "Commands for context manifests",
|
|
5699
5963
|
aliases: ["man"],
|
|
5700
|
-
builder: (
|
|
5964
|
+
builder: (yargs34) => yargs34.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
5701
5965
|
handler: () => {
|
|
5702
|
-
|
|
5966
|
+
yargs17.help();
|
|
5703
5967
|
}
|
|
5704
5968
|
};
|
|
5705
5969
|
|
|
5706
5970
|
// src/commands/context/commands/quirk.ts
|
|
5707
|
-
import
|
|
5971
|
+
import yargs18 from "yargs";
|
|
5708
5972
|
|
|
5709
5973
|
// src/commands/context/commands/quirk/get.ts
|
|
5710
5974
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
5711
5975
|
var QuirkGetModule = {
|
|
5712
5976
|
command: "get <id>",
|
|
5713
5977
|
describe: "Fetch a quirk",
|
|
5714
|
-
builder: (
|
|
5978
|
+
builder: (yargs34) => withConfiguration(
|
|
5715
5979
|
withFormatOptions(
|
|
5716
5980
|
withApiOptions(
|
|
5717
5981
|
withProjectOptions(
|
|
5718
|
-
|
|
5982
|
+
yargs34.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
5719
5983
|
)
|
|
5720
5984
|
)
|
|
5721
5985
|
)
|
|
@@ -5739,11 +6003,11 @@ var QuirkListModule = {
|
|
|
5739
6003
|
command: "list",
|
|
5740
6004
|
describe: "List quirks",
|
|
5741
6005
|
aliases: ["ls"],
|
|
5742
|
-
builder: (
|
|
6006
|
+
builder: (yargs34) => withConfiguration(
|
|
5743
6007
|
withFormatOptions(
|
|
5744
6008
|
withApiOptions(
|
|
5745
6009
|
withProjectOptions(
|
|
5746
|
-
|
|
6010
|
+
yargs34.option("withIntegrations", {
|
|
5747
6011
|
alias: ["i"],
|
|
5748
6012
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
5749
6013
|
type: "boolean"
|
|
@@ -5764,8 +6028,8 @@ var QuirkListModule = {
|
|
|
5764
6028
|
import { UncachedQuirkClient as UncachedQuirkClient3 } from "@uniformdev/context/api";
|
|
5765
6029
|
|
|
5766
6030
|
// src/commands/context/commands/quirk/_util.ts
|
|
5767
|
-
var
|
|
5768
|
-
var
|
|
6031
|
+
var selectIdentifier8 = (source) => source.id;
|
|
6032
|
+
var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
|
|
5769
6033
|
|
|
5770
6034
|
// src/commands/context/quirkEngineDataSource.ts
|
|
5771
6035
|
function createQuirkEngineDataSource({
|
|
@@ -5775,8 +6039,8 @@ function createQuirkEngineDataSource({
|
|
|
5775
6039
|
const quirks = (await client.get({ withIntegrations: false })).quirks;
|
|
5776
6040
|
for await (const def of quirks) {
|
|
5777
6041
|
const result = {
|
|
5778
|
-
id:
|
|
5779
|
-
displayName:
|
|
6042
|
+
id: selectIdentifier8(def),
|
|
6043
|
+
displayName: selectDisplayName8(def),
|
|
5780
6044
|
providerId: def.id,
|
|
5781
6045
|
object: def
|
|
5782
6046
|
};
|
|
@@ -5784,6 +6048,7 @@ function createQuirkEngineDataSource({
|
|
|
5784
6048
|
}
|
|
5785
6049
|
}
|
|
5786
6050
|
return {
|
|
6051
|
+
name: "Uniform API",
|
|
5787
6052
|
objects: getObjects(),
|
|
5788
6053
|
deleteObject: async (providerId) => {
|
|
5789
6054
|
await client.remove({ quirkId: providerId });
|
|
@@ -5800,11 +6065,11 @@ function createQuirkEngineDataSource({
|
|
|
5800
6065
|
var QuirkPullModule = {
|
|
5801
6066
|
command: "pull <directory>",
|
|
5802
6067
|
describe: "Pulls all quirks to local files in a directory",
|
|
5803
|
-
builder: (
|
|
6068
|
+
builder: (yargs34) => withConfiguration(
|
|
5804
6069
|
withApiOptions(
|
|
5805
6070
|
withProjectOptions(
|
|
5806
6071
|
withDiffOptions(
|
|
5807
|
-
|
|
6072
|
+
yargs34.positional("directory", {
|
|
5808
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.",
|
|
5809
6074
|
type: "string"
|
|
5810
6075
|
}).option("format", {
|
|
@@ -5849,9 +6114,10 @@ var QuirkPullModule = {
|
|
|
5849
6114
|
if (isPackage) {
|
|
5850
6115
|
const packageContents = readContextPackage(directory, false);
|
|
5851
6116
|
target = await createArraySyncEngineDataSource({
|
|
6117
|
+
name: `Package file ${directory}`,
|
|
5852
6118
|
objects: packageContents.quirks ?? [],
|
|
5853
|
-
selectIdentifier:
|
|
5854
|
-
selectDisplayName:
|
|
6119
|
+
selectIdentifier: selectIdentifier8,
|
|
6120
|
+
selectDisplayName: selectDisplayName8,
|
|
5855
6121
|
onSyncComplete: async (_, synced) => {
|
|
5856
6122
|
packageContents.quirks = synced;
|
|
5857
6123
|
writeContextPackage(directory, packageContents);
|
|
@@ -5860,8 +6126,8 @@ var QuirkPullModule = {
|
|
|
5860
6126
|
} else {
|
|
5861
6127
|
target = await createFileSyncEngineDataSource({
|
|
5862
6128
|
directory,
|
|
5863
|
-
selectIdentifier:
|
|
5864
|
-
selectDisplayName:
|
|
6129
|
+
selectIdentifier: selectIdentifier8,
|
|
6130
|
+
selectDisplayName: selectDisplayName8,
|
|
5865
6131
|
format
|
|
5866
6132
|
});
|
|
5867
6133
|
}
|
|
@@ -5881,11 +6147,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
5881
6147
|
var QuirkPushModule = {
|
|
5882
6148
|
command: "push <directory>",
|
|
5883
6149
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
5884
|
-
builder: (
|
|
6150
|
+
builder: (yargs34) => withConfiguration(
|
|
5885
6151
|
withApiOptions(
|
|
5886
6152
|
withProjectOptions(
|
|
5887
6153
|
withDiffOptions(
|
|
5888
|
-
|
|
6154
|
+
yargs34.positional("directory", {
|
|
5889
6155
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
5890
6156
|
type: "string"
|
|
5891
6157
|
}).option("what-if", {
|
|
@@ -5922,15 +6188,16 @@ var QuirkPushModule = {
|
|
|
5922
6188
|
if (isPackage) {
|
|
5923
6189
|
const packageContents = readContextPackage(directory, true);
|
|
5924
6190
|
source = await createArraySyncEngineDataSource({
|
|
6191
|
+
name: `Package file ${directory}`,
|
|
5925
6192
|
objects: packageContents.quirks ?? [],
|
|
5926
|
-
selectIdentifier:
|
|
5927
|
-
selectDisplayName:
|
|
6193
|
+
selectIdentifier: selectIdentifier8,
|
|
6194
|
+
selectDisplayName: selectDisplayName8
|
|
5928
6195
|
});
|
|
5929
6196
|
} else {
|
|
5930
6197
|
source = await createFileSyncEngineDataSource({
|
|
5931
6198
|
directory,
|
|
5932
|
-
selectIdentifier:
|
|
5933
|
-
selectDisplayName:
|
|
6199
|
+
selectIdentifier: selectIdentifier8,
|
|
6200
|
+
selectDisplayName: selectDisplayName8
|
|
5934
6201
|
});
|
|
5935
6202
|
}
|
|
5936
6203
|
const target = createQuirkEngineDataSource({ client });
|
|
@@ -5951,10 +6218,10 @@ var QuirkRemoveModule = {
|
|
|
5951
6218
|
command: "remove <id>",
|
|
5952
6219
|
aliases: ["delete", "rm"],
|
|
5953
6220
|
describe: "Delete a quirk",
|
|
5954
|
-
builder: (
|
|
6221
|
+
builder: (yargs34) => withConfiguration(
|
|
5955
6222
|
withApiOptions(
|
|
5956
6223
|
withProjectOptions(
|
|
5957
|
-
|
|
6224
|
+
yargs34.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
5958
6225
|
)
|
|
5959
6226
|
)
|
|
5960
6227
|
),
|
|
@@ -5971,10 +6238,10 @@ var QuirkUpdateModule = {
|
|
|
5971
6238
|
command: "update <filename>",
|
|
5972
6239
|
aliases: ["put"],
|
|
5973
6240
|
describe: "Insert or update a quirk",
|
|
5974
|
-
builder: (
|
|
6241
|
+
builder: (yargs34) => withConfiguration(
|
|
5975
6242
|
withApiOptions(
|
|
5976
6243
|
withProjectOptions(
|
|
5977
|
-
|
|
6244
|
+
yargs34.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
5978
6245
|
)
|
|
5979
6246
|
)
|
|
5980
6247
|
),
|
|
@@ -5991,25 +6258,25 @@ var QuirkModule = {
|
|
|
5991
6258
|
command: "quirk <command>",
|
|
5992
6259
|
aliases: ["qk"],
|
|
5993
6260
|
describe: "Commands for Context quirks",
|
|
5994
|
-
builder: (
|
|
6261
|
+
builder: (yargs34) => yargs34.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
5995
6262
|
handler: () => {
|
|
5996
|
-
|
|
6263
|
+
yargs18.help();
|
|
5997
6264
|
}
|
|
5998
6265
|
};
|
|
5999
6266
|
|
|
6000
6267
|
// src/commands/context/commands/signal.ts
|
|
6001
|
-
import
|
|
6268
|
+
import yargs19 from "yargs";
|
|
6002
6269
|
|
|
6003
6270
|
// src/commands/context/commands/signal/get.ts
|
|
6004
6271
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
6005
6272
|
var SignalGetModule = {
|
|
6006
6273
|
command: "get <id>",
|
|
6007
6274
|
describe: "Fetch a signal",
|
|
6008
|
-
builder: (
|
|
6275
|
+
builder: (yargs34) => withConfiguration(
|
|
6009
6276
|
withFormatOptions(
|
|
6010
6277
|
withApiOptions(
|
|
6011
6278
|
withProjectOptions(
|
|
6012
|
-
|
|
6279
|
+
yargs34.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
6013
6280
|
)
|
|
6014
6281
|
)
|
|
6015
6282
|
)
|
|
@@ -6033,7 +6300,7 @@ var SignalListModule = {
|
|
|
6033
6300
|
command: "list",
|
|
6034
6301
|
describe: "List signals",
|
|
6035
6302
|
aliases: ["ls"],
|
|
6036
|
-
builder: (
|
|
6303
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
6037
6304
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6038
6305
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6039
6306
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6046,8 +6313,8 @@ var SignalListModule = {
|
|
|
6046
6313
|
import { UncachedSignalClient as UncachedSignalClient3 } from "@uniformdev/context/api";
|
|
6047
6314
|
|
|
6048
6315
|
// src/commands/context/commands/signal/_util.ts
|
|
6049
|
-
var
|
|
6050
|
-
var
|
|
6316
|
+
var selectIdentifier9 = (source) => source.id;
|
|
6317
|
+
var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6051
6318
|
|
|
6052
6319
|
// src/commands/context/signalEngineDataSource.ts
|
|
6053
6320
|
function createSignalEngineDataSource({
|
|
@@ -6057,8 +6324,8 @@ function createSignalEngineDataSource({
|
|
|
6057
6324
|
const signals = (await client.get()).signals;
|
|
6058
6325
|
for await (const def of signals) {
|
|
6059
6326
|
const result = {
|
|
6060
|
-
id:
|
|
6061
|
-
displayName:
|
|
6327
|
+
id: selectIdentifier9(def),
|
|
6328
|
+
displayName: selectDisplayName9(def),
|
|
6062
6329
|
providerId: def.id,
|
|
6063
6330
|
object: def
|
|
6064
6331
|
};
|
|
@@ -6066,6 +6333,7 @@ function createSignalEngineDataSource({
|
|
|
6066
6333
|
}
|
|
6067
6334
|
}
|
|
6068
6335
|
return {
|
|
6336
|
+
name: "Uniform API",
|
|
6069
6337
|
objects: getObjects(),
|
|
6070
6338
|
deleteObject: async (providerId) => {
|
|
6071
6339
|
await client.remove({ signalId: providerId });
|
|
@@ -6082,11 +6350,11 @@ function createSignalEngineDataSource({
|
|
|
6082
6350
|
var SignalPullModule = {
|
|
6083
6351
|
command: "pull <directory>",
|
|
6084
6352
|
describe: "Pulls all signals to local files in a directory",
|
|
6085
|
-
builder: (
|
|
6353
|
+
builder: (yargs34) => withConfiguration(
|
|
6086
6354
|
withApiOptions(
|
|
6087
6355
|
withProjectOptions(
|
|
6088
6356
|
withDiffOptions(
|
|
6089
|
-
|
|
6357
|
+
yargs34.positional("directory", {
|
|
6090
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.",
|
|
6091
6359
|
type: "string"
|
|
6092
6360
|
}).option("format", {
|
|
@@ -6131,9 +6399,10 @@ var SignalPullModule = {
|
|
|
6131
6399
|
if (isPackage) {
|
|
6132
6400
|
const packageContents = readContextPackage(directory, false);
|
|
6133
6401
|
target = await createArraySyncEngineDataSource({
|
|
6402
|
+
name: `Package file ${directory}`,
|
|
6134
6403
|
objects: packageContents.signals ?? [],
|
|
6135
|
-
selectIdentifier:
|
|
6136
|
-
selectDisplayName:
|
|
6404
|
+
selectIdentifier: selectIdentifier9,
|
|
6405
|
+
selectDisplayName: selectDisplayName9,
|
|
6137
6406
|
onSyncComplete: async (_, synced) => {
|
|
6138
6407
|
packageContents.signals = synced;
|
|
6139
6408
|
writeContextPackage(directory, packageContents);
|
|
@@ -6142,8 +6411,8 @@ var SignalPullModule = {
|
|
|
6142
6411
|
} else {
|
|
6143
6412
|
target = await createFileSyncEngineDataSource({
|
|
6144
6413
|
directory,
|
|
6145
|
-
selectIdentifier:
|
|
6146
|
-
selectDisplayName:
|
|
6414
|
+
selectIdentifier: selectIdentifier9,
|
|
6415
|
+
selectDisplayName: selectDisplayName9,
|
|
6147
6416
|
format
|
|
6148
6417
|
});
|
|
6149
6418
|
}
|
|
@@ -6163,11 +6432,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
6163
6432
|
var SignalPushModule = {
|
|
6164
6433
|
command: "push <directory>",
|
|
6165
6434
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
6166
|
-
builder: (
|
|
6435
|
+
builder: (yargs34) => withConfiguration(
|
|
6167
6436
|
withApiOptions(
|
|
6168
6437
|
withProjectOptions(
|
|
6169
6438
|
withDiffOptions(
|
|
6170
|
-
|
|
6439
|
+
yargs34.positional("directory", {
|
|
6171
6440
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
6172
6441
|
type: "string"
|
|
6173
6442
|
}).option("what-if", {
|
|
@@ -6204,15 +6473,16 @@ var SignalPushModule = {
|
|
|
6204
6473
|
if (isPackage) {
|
|
6205
6474
|
const packageContents = readContextPackage(directory, true);
|
|
6206
6475
|
source = await createArraySyncEngineDataSource({
|
|
6476
|
+
name: `Package file ${directory}`,
|
|
6207
6477
|
objects: packageContents.signals ?? [],
|
|
6208
|
-
selectIdentifier:
|
|
6209
|
-
selectDisplayName:
|
|
6478
|
+
selectIdentifier: selectIdentifier9,
|
|
6479
|
+
selectDisplayName: selectDisplayName9
|
|
6210
6480
|
});
|
|
6211
6481
|
} else {
|
|
6212
6482
|
source = await createFileSyncEngineDataSource({
|
|
6213
6483
|
directory,
|
|
6214
|
-
selectIdentifier:
|
|
6215
|
-
selectDisplayName:
|
|
6484
|
+
selectIdentifier: selectIdentifier9,
|
|
6485
|
+
selectDisplayName: selectDisplayName9
|
|
6216
6486
|
});
|
|
6217
6487
|
}
|
|
6218
6488
|
const target = createSignalEngineDataSource({ client });
|
|
@@ -6233,10 +6503,10 @@ var SignalRemoveModule = {
|
|
|
6233
6503
|
command: "remove <id>",
|
|
6234
6504
|
aliases: ["delete", "rm"],
|
|
6235
6505
|
describe: "Delete a signal",
|
|
6236
|
-
builder: (
|
|
6506
|
+
builder: (yargs34) => withConfiguration(
|
|
6237
6507
|
withApiOptions(
|
|
6238
6508
|
withProjectOptions(
|
|
6239
|
-
|
|
6509
|
+
yargs34.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
6240
6510
|
)
|
|
6241
6511
|
)
|
|
6242
6512
|
),
|
|
@@ -6253,10 +6523,10 @@ var SignalUpdateModule = {
|
|
|
6253
6523
|
command: "update <filename>",
|
|
6254
6524
|
aliases: ["put"],
|
|
6255
6525
|
describe: "Insert or update a signal",
|
|
6256
|
-
builder: (
|
|
6526
|
+
builder: (yargs34) => withConfiguration(
|
|
6257
6527
|
withApiOptions(
|
|
6258
6528
|
withProjectOptions(
|
|
6259
|
-
|
|
6529
|
+
yargs34.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
6260
6530
|
)
|
|
6261
6531
|
)
|
|
6262
6532
|
),
|
|
@@ -6273,25 +6543,25 @@ var SignalModule = {
|
|
|
6273
6543
|
command: "signal <command>",
|
|
6274
6544
|
aliases: ["sig"],
|
|
6275
6545
|
describe: "Commands for Context signals",
|
|
6276
|
-
builder: (
|
|
6546
|
+
builder: (yargs34) => yargs34.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
6277
6547
|
handler: () => {
|
|
6278
|
-
|
|
6548
|
+
yargs19.help();
|
|
6279
6549
|
}
|
|
6280
6550
|
};
|
|
6281
6551
|
|
|
6282
6552
|
// src/commands/context/commands/test.ts
|
|
6283
|
-
import
|
|
6553
|
+
import yargs20 from "yargs";
|
|
6284
6554
|
|
|
6285
6555
|
// src/commands/context/commands/test/get.ts
|
|
6286
6556
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
6287
6557
|
var TestGetModule = {
|
|
6288
6558
|
command: "get <id>",
|
|
6289
6559
|
describe: "Fetch a test",
|
|
6290
|
-
builder: (
|
|
6560
|
+
builder: (yargs34) => withConfiguration(
|
|
6291
6561
|
withFormatOptions(
|
|
6292
6562
|
withApiOptions(
|
|
6293
6563
|
withProjectOptions(
|
|
6294
|
-
|
|
6564
|
+
yargs34.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
6295
6565
|
)
|
|
6296
6566
|
)
|
|
6297
6567
|
)
|
|
@@ -6315,7 +6585,7 @@ var TestListModule = {
|
|
|
6315
6585
|
command: "list",
|
|
6316
6586
|
describe: "List tests",
|
|
6317
6587
|
aliases: ["ls"],
|
|
6318
|
-
builder: (
|
|
6588
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
6319
6589
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6320
6590
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6321
6591
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6328,8 +6598,8 @@ var TestListModule = {
|
|
|
6328
6598
|
import { UncachedTestClient as UncachedTestClient3 } from "@uniformdev/context/api";
|
|
6329
6599
|
|
|
6330
6600
|
// src/commands/context/commands/test/_util.ts
|
|
6331
|
-
var
|
|
6332
|
-
var
|
|
6601
|
+
var selectIdentifier10 = (source) => source.id;
|
|
6602
|
+
var selectDisplayName10 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6333
6603
|
|
|
6334
6604
|
// src/commands/context/testEngineDataSource.ts
|
|
6335
6605
|
function createTestEngineDataSource({
|
|
@@ -6339,8 +6609,8 @@ function createTestEngineDataSource({
|
|
|
6339
6609
|
const tests = (await client.get()).tests;
|
|
6340
6610
|
for await (const def of tests) {
|
|
6341
6611
|
const result = {
|
|
6342
|
-
id:
|
|
6343
|
-
displayName:
|
|
6612
|
+
id: selectIdentifier10(def),
|
|
6613
|
+
displayName: selectDisplayName10(def),
|
|
6344
6614
|
providerId: def.id,
|
|
6345
6615
|
object: def
|
|
6346
6616
|
};
|
|
@@ -6348,6 +6618,7 @@ function createTestEngineDataSource({
|
|
|
6348
6618
|
}
|
|
6349
6619
|
}
|
|
6350
6620
|
return {
|
|
6621
|
+
name: "Uniform API",
|
|
6351
6622
|
objects: getObjects(),
|
|
6352
6623
|
deleteObject: async (providerId) => {
|
|
6353
6624
|
await client.remove({ testId: providerId });
|
|
@@ -6364,11 +6635,11 @@ function createTestEngineDataSource({
|
|
|
6364
6635
|
var TestPullModule = {
|
|
6365
6636
|
command: "pull <directory>",
|
|
6366
6637
|
describe: "Pulls all tests to local files in a directory",
|
|
6367
|
-
builder: (
|
|
6638
|
+
builder: (yargs34) => withConfiguration(
|
|
6368
6639
|
withApiOptions(
|
|
6369
6640
|
withProjectOptions(
|
|
6370
6641
|
withDiffOptions(
|
|
6371
|
-
|
|
6642
|
+
yargs34.positional("directory", {
|
|
6372
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.",
|
|
6373
6644
|
type: "string"
|
|
6374
6645
|
}).option("format", {
|
|
@@ -6413,9 +6684,10 @@ var TestPullModule = {
|
|
|
6413
6684
|
if (isPackage) {
|
|
6414
6685
|
const packageContents = readContextPackage(directory, false);
|
|
6415
6686
|
target = await createArraySyncEngineDataSource({
|
|
6687
|
+
name: `Package file ${directory}`,
|
|
6416
6688
|
objects: packageContents.tests ?? [],
|
|
6417
|
-
selectIdentifier:
|
|
6418
|
-
selectDisplayName:
|
|
6689
|
+
selectIdentifier: selectIdentifier10,
|
|
6690
|
+
selectDisplayName: selectDisplayName10,
|
|
6419
6691
|
onSyncComplete: async (_, synced) => {
|
|
6420
6692
|
packageContents.tests = synced;
|
|
6421
6693
|
writeContextPackage(directory, packageContents);
|
|
@@ -6424,8 +6696,8 @@ var TestPullModule = {
|
|
|
6424
6696
|
} else {
|
|
6425
6697
|
target = await createFileSyncEngineDataSource({
|
|
6426
6698
|
directory,
|
|
6427
|
-
selectIdentifier:
|
|
6428
|
-
selectDisplayName:
|
|
6699
|
+
selectIdentifier: selectIdentifier10,
|
|
6700
|
+
selectDisplayName: selectDisplayName10,
|
|
6429
6701
|
format
|
|
6430
6702
|
});
|
|
6431
6703
|
}
|
|
@@ -6445,11 +6717,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
6445
6717
|
var TestPushModule = {
|
|
6446
6718
|
command: "push <directory>",
|
|
6447
6719
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
6448
|
-
builder: (
|
|
6720
|
+
builder: (yargs34) => withConfiguration(
|
|
6449
6721
|
withApiOptions(
|
|
6450
6722
|
withProjectOptions(
|
|
6451
6723
|
withDiffOptions(
|
|
6452
|
-
|
|
6724
|
+
yargs34.positional("directory", {
|
|
6453
6725
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
6454
6726
|
type: "string"
|
|
6455
6727
|
}).option("what-if", {
|
|
@@ -6486,15 +6758,16 @@ var TestPushModule = {
|
|
|
6486
6758
|
if (isPackage) {
|
|
6487
6759
|
const packageContents = readContextPackage(directory, true);
|
|
6488
6760
|
source = await createArraySyncEngineDataSource({
|
|
6761
|
+
name: `Package file ${directory}`,
|
|
6489
6762
|
objects: packageContents.tests ?? [],
|
|
6490
|
-
selectIdentifier:
|
|
6491
|
-
selectDisplayName:
|
|
6763
|
+
selectIdentifier: selectIdentifier10,
|
|
6764
|
+
selectDisplayName: selectDisplayName10
|
|
6492
6765
|
});
|
|
6493
6766
|
} else {
|
|
6494
6767
|
source = await createFileSyncEngineDataSource({
|
|
6495
6768
|
directory,
|
|
6496
|
-
selectIdentifier:
|
|
6497
|
-
selectDisplayName:
|
|
6769
|
+
selectIdentifier: selectIdentifier10,
|
|
6770
|
+
selectDisplayName: selectDisplayName10
|
|
6498
6771
|
});
|
|
6499
6772
|
}
|
|
6500
6773
|
const target = createTestEngineDataSource({ client });
|
|
@@ -6515,10 +6788,10 @@ var TestRemoveModule = {
|
|
|
6515
6788
|
command: "remove <id>",
|
|
6516
6789
|
aliases: ["delete", "rm"],
|
|
6517
6790
|
describe: "Delete a test",
|
|
6518
|
-
builder: (
|
|
6791
|
+
builder: (yargs34) => withConfiguration(
|
|
6519
6792
|
withApiOptions(
|
|
6520
6793
|
withProjectOptions(
|
|
6521
|
-
|
|
6794
|
+
yargs34.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
6522
6795
|
)
|
|
6523
6796
|
)
|
|
6524
6797
|
),
|
|
@@ -6535,9 +6808,9 @@ var TestUpdateModule = {
|
|
|
6535
6808
|
command: "update <filename>",
|
|
6536
6809
|
aliases: ["put"],
|
|
6537
6810
|
describe: "Insert or update a test",
|
|
6538
|
-
builder: (
|
|
6811
|
+
builder: (yargs34) => withConfiguration(
|
|
6539
6812
|
withApiOptions(
|
|
6540
|
-
withProjectOptions(
|
|
6813
|
+
withProjectOptions(yargs34.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
6541
6814
|
)
|
|
6542
6815
|
),
|
|
6543
6816
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -6552,9 +6825,9 @@ var TestUpdateModule = {
|
|
|
6552
6825
|
var TestModule = {
|
|
6553
6826
|
command: "test <command>",
|
|
6554
6827
|
describe: "Commands for Context A/B tests",
|
|
6555
|
-
builder: (
|
|
6828
|
+
builder: (yargs34) => yargs34.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
6556
6829
|
handler: () => {
|
|
6557
|
-
|
|
6830
|
+
yargs20.help();
|
|
6558
6831
|
}
|
|
6559
6832
|
};
|
|
6560
6833
|
|
|
@@ -6563,20 +6836,20 @@ var ContextCommand = {
|
|
|
6563
6836
|
command: "context <command>",
|
|
6564
6837
|
aliases: ["ctx"],
|
|
6565
6838
|
describe: "Uniform Context commands",
|
|
6566
|
-
builder: (
|
|
6839
|
+
builder: (yargs34) => yargs34.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
6567
6840
|
handler: () => {
|
|
6568
|
-
|
|
6841
|
+
yargs21.showHelp();
|
|
6569
6842
|
}
|
|
6570
6843
|
};
|
|
6571
6844
|
|
|
6572
6845
|
// src/commands/integration/index.ts
|
|
6573
|
-
import
|
|
6846
|
+
import yargs24 from "yargs";
|
|
6574
6847
|
|
|
6575
6848
|
// src/commands/integration/commands/definition.ts
|
|
6576
|
-
import
|
|
6849
|
+
import yargs23 from "yargs";
|
|
6577
6850
|
|
|
6578
6851
|
// src/commands/integration/commands/definition/edgehancer/edgehancer.ts
|
|
6579
|
-
import
|
|
6852
|
+
import yargs22 from "yargs";
|
|
6580
6853
|
|
|
6581
6854
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
6582
6855
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -6614,8 +6887,8 @@ var EdgehancerClient = class extends ApiClient {
|
|
|
6614
6887
|
};
|
|
6615
6888
|
|
|
6616
6889
|
// src/commands/integration/commands/definition/edgehancer/util.ts
|
|
6617
|
-
function withEdgehancerIdOptions(
|
|
6618
|
-
return
|
|
6890
|
+
function withEdgehancerIdOptions(yargs34) {
|
|
6891
|
+
return yargs34.option("connectorType", {
|
|
6619
6892
|
describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
|
|
6620
6893
|
demandOption: true,
|
|
6621
6894
|
type: "string"
|
|
@@ -6635,11 +6908,11 @@ function withEdgehancerIdOptions(yargs33) {
|
|
|
6635
6908
|
var IntegrationEdgehancerDeployModule = {
|
|
6636
6909
|
command: "deploy <filename>",
|
|
6637
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.",
|
|
6638
|
-
builder: (
|
|
6911
|
+
builder: (yargs34) => withConfiguration(
|
|
6639
6912
|
withApiOptions(
|
|
6640
6913
|
withTeamOptions(
|
|
6641
6914
|
withEdgehancerIdOptions(
|
|
6642
|
-
|
|
6915
|
+
yargs34.positional("filename", {
|
|
6643
6916
|
demandOption: true,
|
|
6644
6917
|
describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
|
|
6645
6918
|
})
|
|
@@ -6659,7 +6932,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6659
6932
|
var IntegrationEdgehancerRemoveModule = {
|
|
6660
6933
|
command: "remove",
|
|
6661
6934
|
describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
|
|
6662
|
-
builder: (
|
|
6935
|
+
builder: (yargs34) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs34)))),
|
|
6663
6936
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
|
|
6664
6937
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6665
6938
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
@@ -6671,9 +6944,9 @@ var IntegrationEdgehancerRemoveModule = {
|
|
|
6671
6944
|
var IntegrationEdgehancerModule = {
|
|
6672
6945
|
command: "edgehancer <command>",
|
|
6673
6946
|
describe: "Commands for managing custom integration edgehancers at the team level.",
|
|
6674
|
-
builder: (
|
|
6947
|
+
builder: (yargs34) => yargs34.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
|
|
6675
6948
|
handler: () => {
|
|
6676
|
-
|
|
6949
|
+
yargs22.help();
|
|
6677
6950
|
}
|
|
6678
6951
|
};
|
|
6679
6952
|
|
|
@@ -6713,10 +6986,10 @@ var DefinitionClient = class extends ApiClient2 {
|
|
|
6713
6986
|
var IntegrationDefinitionRegisterModule = {
|
|
6714
6987
|
command: "register <filename>",
|
|
6715
6988
|
describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
|
|
6716
|
-
builder: (
|
|
6989
|
+
builder: (yargs34) => withConfiguration(
|
|
6717
6990
|
withApiOptions(
|
|
6718
6991
|
withTeamOptions(
|
|
6719
|
-
|
|
6992
|
+
yargs34.positional("filename", {
|
|
6720
6993
|
demandOption: true,
|
|
6721
6994
|
describe: "Integration definition manifest to register"
|
|
6722
6995
|
})
|
|
@@ -6735,10 +7008,10 @@ var IntegrationDefinitionRegisterModule = {
|
|
|
6735
7008
|
var IntegrationDefinitionRemoveModule = {
|
|
6736
7009
|
command: "remove <type>",
|
|
6737
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.",
|
|
6738
|
-
builder: (
|
|
7011
|
+
builder: (yargs34) => withConfiguration(
|
|
6739
7012
|
withApiOptions(
|
|
6740
7013
|
withTeamOptions(
|
|
6741
|
-
|
|
7014
|
+
yargs34.positional("type", {
|
|
6742
7015
|
demandOption: true,
|
|
6743
7016
|
describe: "Integration type (from its manifest) to remove."
|
|
6744
7017
|
})
|
|
@@ -6756,9 +7029,9 @@ var IntegrationDefinitionRemoveModule = {
|
|
|
6756
7029
|
var IntegrationDefinitionModule = {
|
|
6757
7030
|
command: "definition <command>",
|
|
6758
7031
|
describe: "Commands for managing custom integration definitions at the team level.",
|
|
6759
|
-
builder: (
|
|
7032
|
+
builder: (yargs34) => yargs34.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).demandCommand(),
|
|
6760
7033
|
handler: () => {
|
|
6761
|
-
|
|
7034
|
+
yargs23.help();
|
|
6762
7035
|
}
|
|
6763
7036
|
};
|
|
6764
7037
|
|
|
@@ -6798,10 +7071,10 @@ var InstallClient = class extends ApiClient3 {
|
|
|
6798
7071
|
var IntegrationInstallModule = {
|
|
6799
7072
|
command: "install <type>",
|
|
6800
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.",
|
|
6801
|
-
builder: (
|
|
7074
|
+
builder: (yargs34) => withConfiguration(
|
|
6802
7075
|
withApiOptions(
|
|
6803
7076
|
withProjectOptions(
|
|
6804
|
-
|
|
7077
|
+
yargs34.positional("type", {
|
|
6805
7078
|
demandOption: true,
|
|
6806
7079
|
describe: "Integration type to install (as defined in its manifest)"
|
|
6807
7080
|
}).option("configuration", {
|
|
@@ -6823,10 +7096,10 @@ var IntegrationInstallModule = {
|
|
|
6823
7096
|
var IntegrationUninstallModule = {
|
|
6824
7097
|
command: "uninstall <type>",
|
|
6825
7098
|
describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
|
|
6826
|
-
builder: (
|
|
7099
|
+
builder: (yargs34) => withConfiguration(
|
|
6827
7100
|
withApiOptions(
|
|
6828
7101
|
withProjectOptions(
|
|
6829
|
-
|
|
7102
|
+
yargs34.positional("type", {
|
|
6830
7103
|
demandOption: true,
|
|
6831
7104
|
describe: "Integration type to uninstall (as defined in its manifest)"
|
|
6832
7105
|
})
|
|
@@ -6844,9 +7117,9 @@ var IntegrationUninstallModule = {
|
|
|
6844
7117
|
var IntegrationCommand = {
|
|
6845
7118
|
command: "integration <command>",
|
|
6846
7119
|
describe: "Integration management commands",
|
|
6847
|
-
builder: (
|
|
7120
|
+
builder: (yargs34) => yargs34.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
|
|
6848
7121
|
handler: () => {
|
|
6849
|
-
|
|
7122
|
+
yargs24.showHelp();
|
|
6850
7123
|
}
|
|
6851
7124
|
};
|
|
6852
7125
|
|
|
@@ -6855,7 +7128,7 @@ import ora from "ora";
|
|
|
6855
7128
|
var makeSpinner = () => {
|
|
6856
7129
|
const spinners = [];
|
|
6857
7130
|
const stopAllSpinners = () => spinners.forEach((spinner) => spinner.stop());
|
|
6858
|
-
const
|
|
7131
|
+
const spin = async (text) => {
|
|
6859
7132
|
const spinner = ora(text).start();
|
|
6860
7133
|
spinners.push(spinner);
|
|
6861
7134
|
const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
@@ -6864,7 +7137,7 @@ var makeSpinner = () => {
|
|
|
6864
7137
|
spinner.stop();
|
|
6865
7138
|
};
|
|
6866
7139
|
};
|
|
6867
|
-
return { stopAllSpinners, spin
|
|
7140
|
+
return { stopAllSpinners, spin };
|
|
6868
7141
|
};
|
|
6869
7142
|
|
|
6870
7143
|
// src/telemetry/telemetry.ts
|
|
@@ -6874,7 +7147,7 @@ import { PostHog } from "posthog-node";
|
|
|
6874
7147
|
// package.json
|
|
6875
7148
|
var package_default = {
|
|
6876
7149
|
name: "@uniformdev/cli",
|
|
6877
|
-
version: "19.
|
|
7150
|
+
version: "19.151.0",
|
|
6878
7151
|
description: "Uniform command line interface tool",
|
|
6879
7152
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6880
7153
|
main: "./cli.js",
|
|
@@ -7263,12 +7536,12 @@ import * as http from "isomorphic-git/http/node/index.js";
|
|
|
7263
7536
|
import os from "os";
|
|
7264
7537
|
import path2 from "path";
|
|
7265
7538
|
async function cloneStarter({
|
|
7266
|
-
spin
|
|
7539
|
+
spin,
|
|
7267
7540
|
githubPath,
|
|
7268
7541
|
targetDir,
|
|
7269
7542
|
dotEnvFile
|
|
7270
7543
|
}) {
|
|
7271
|
-
const done = await
|
|
7544
|
+
const done = await spin("Fetching starter code...");
|
|
7272
7545
|
const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
7273
7546
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
7274
7547
|
try {
|
|
@@ -7318,7 +7591,7 @@ async function getOrCreateProject({
|
|
|
7318
7591
|
user,
|
|
7319
7592
|
explicitName,
|
|
7320
7593
|
client,
|
|
7321
|
-
spin
|
|
7594
|
+
spin,
|
|
7322
7595
|
checkTargetDir,
|
|
7323
7596
|
explicitTargetDir,
|
|
7324
7597
|
previewUrl,
|
|
@@ -7348,7 +7621,7 @@ async function getOrCreateProject({
|
|
|
7348
7621
|
checkTargetDir,
|
|
7349
7622
|
explicitTargetDir
|
|
7350
7623
|
});
|
|
7351
|
-
const projectId = await createProject({ client, projectName, spin
|
|
7624
|
+
const projectId = await createProject({ client, projectName, spin, teamId, previewUrl });
|
|
7352
7625
|
telemetry.send("project created", { projectId, targetDir });
|
|
7353
7626
|
return {
|
|
7354
7627
|
projectId,
|
|
@@ -7389,11 +7662,11 @@ async function getNewProjectName({
|
|
|
7389
7662
|
async function createProject({
|
|
7390
7663
|
projectName,
|
|
7391
7664
|
teamId,
|
|
7392
|
-
spin
|
|
7665
|
+
spin,
|
|
7393
7666
|
client,
|
|
7394
7667
|
previewUrl
|
|
7395
7668
|
}) {
|
|
7396
|
-
const done = await
|
|
7669
|
+
const done = await spin("Creating your new project...");
|
|
7397
7670
|
const projectId = await client.createProject(teamId, projectName, previewUrl);
|
|
7398
7671
|
await done();
|
|
7399
7672
|
return projectId;
|
|
@@ -7522,11 +7795,11 @@ var getUserInfo = async (baseUrl, authToken, subject) => {
|
|
|
7522
7795
|
async function fetchUserAndEnsureFirstTeamExists({
|
|
7523
7796
|
baseUrl,
|
|
7524
7797
|
auth: { authToken, decoded },
|
|
7525
|
-
spin
|
|
7798
|
+
spin,
|
|
7526
7799
|
telemetry
|
|
7527
7800
|
}) {
|
|
7528
7801
|
const uniformClient = createClient(baseUrl, authToken);
|
|
7529
|
-
const done = await
|
|
7802
|
+
const done = await spin("Fetching user information...");
|
|
7530
7803
|
let user = await getUserInfo(baseUrl, authToken, decoded.sub);
|
|
7531
7804
|
if (user.teams.length < 1) {
|
|
7532
7805
|
await uniformClient.createTeam(`${user.name}'s team`);
|
|
@@ -7539,7 +7812,7 @@ async function fetchUserAndEnsureFirstTeamExists({
|
|
|
7539
7812
|
|
|
7540
7813
|
// src/commands/new/commands/new.ts
|
|
7541
7814
|
async function newHandler({
|
|
7542
|
-
spin
|
|
7815
|
+
spin,
|
|
7543
7816
|
projectName,
|
|
7544
7817
|
apiHost,
|
|
7545
7818
|
outputPath,
|
|
@@ -7551,7 +7824,7 @@ async function newHandler({
|
|
|
7551
7824
|
const auth = await getBearerToken(apiHost);
|
|
7552
7825
|
const { authToken } = auth;
|
|
7553
7826
|
const uniformClient = createClient(apiHost, authToken);
|
|
7554
|
-
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin
|
|
7827
|
+
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
|
|
7555
7828
|
const { teamId } = await chooseTeam(
|
|
7556
7829
|
user,
|
|
7557
7830
|
`Hey ${user.name}! Choose a Uniform team for your new project`,
|
|
@@ -7623,7 +7896,7 @@ async function newHandler({
|
|
|
7623
7896
|
client: uniformClient,
|
|
7624
7897
|
createNew: true,
|
|
7625
7898
|
chooseExisting: false,
|
|
7626
|
-
spin
|
|
7899
|
+
spin,
|
|
7627
7900
|
teamId,
|
|
7628
7901
|
user,
|
|
7629
7902
|
explicitName: projectName,
|
|
@@ -7632,7 +7905,7 @@ async function newHandler({
|
|
|
7632
7905
|
previewUrl: serverUrl + previewPath,
|
|
7633
7906
|
telemetry
|
|
7634
7907
|
});
|
|
7635
|
-
let done = await
|
|
7908
|
+
let done = await spin("Generating API keys...");
|
|
7636
7909
|
const { readApiKey, writeApiKey } = await uniformClient.createApiKeys(teamId, projectId);
|
|
7637
7910
|
await done();
|
|
7638
7911
|
const dotEnvFile = [
|
|
@@ -7650,7 +7923,7 @@ async function newHandler({
|
|
|
7650
7923
|
const cloneStartTimestamp = Date.now();
|
|
7651
7924
|
const { runNpmInstall } = await cloneStarter({
|
|
7652
7925
|
githubPath: githubUri,
|
|
7653
|
-
spin
|
|
7926
|
+
spin,
|
|
7654
7927
|
targetDir,
|
|
7655
7928
|
dotEnvFile
|
|
7656
7929
|
});
|
|
@@ -7658,7 +7931,7 @@ async function newHandler({
|
|
|
7658
7931
|
const installStartTimestamp = Date.now();
|
|
7659
7932
|
await runNpmInstall();
|
|
7660
7933
|
telemetry.send("deps installed", { duration: Date.now() - installStartTimestamp });
|
|
7661
|
-
done = await
|
|
7934
|
+
done = await spin("Creating components and compositions");
|
|
7662
7935
|
await runNpm(targetDir, ["run", "uniform:push"]);
|
|
7663
7936
|
await runNpm(targetDir, ["run", "uniform:publish"]);
|
|
7664
7937
|
await done();
|
|
@@ -7693,7 +7966,7 @@ import inquirer5 from "inquirer";
|
|
|
7693
7966
|
import path4 from "path";
|
|
7694
7967
|
import slugify2 from "slugify";
|
|
7695
7968
|
async function newMeshIntegrationHandler({
|
|
7696
|
-
spin
|
|
7969
|
+
spin,
|
|
7697
7970
|
apiHost,
|
|
7698
7971
|
outputPath,
|
|
7699
7972
|
telemetry
|
|
@@ -7702,7 +7975,7 @@ async function newMeshIntegrationHandler({
|
|
|
7702
7975
|
const auth = await getBearerToken(apiHost);
|
|
7703
7976
|
const { authToken } = auth;
|
|
7704
7977
|
const uniformClient = createClient(apiHost, authToken);
|
|
7705
|
-
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin
|
|
7978
|
+
const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
|
|
7706
7979
|
const { teamId } = await chooseTeam(
|
|
7707
7980
|
user,
|
|
7708
7981
|
`Hey ${user.name}! Choose a Uniform team to register your integration`,
|
|
@@ -7727,10 +8000,10 @@ async function newMeshIntegrationHandler({
|
|
|
7727
8000
|
const { targetDir, typeSlug } = validateIntegrationName(answer.name, outputPath);
|
|
7728
8001
|
const { runNpmInstall } = await cloneStarter({
|
|
7729
8002
|
githubPath: `uniformdev/examples/examples/mesh-integration`,
|
|
7730
|
-
spin
|
|
8003
|
+
spin,
|
|
7731
8004
|
targetDir
|
|
7732
8005
|
});
|
|
7733
|
-
let done = await
|
|
8006
|
+
let done = await spin("Registering integration to team...");
|
|
7734
8007
|
const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
|
|
7735
8008
|
if (!existsSync3(pathToManifest)) {
|
|
7736
8009
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
@@ -7752,13 +8025,13 @@ async function newMeshIntegrationHandler({
|
|
|
7752
8025
|
client: uniformClient,
|
|
7753
8026
|
createNew: true,
|
|
7754
8027
|
chooseExisting: true,
|
|
7755
|
-
spin
|
|
8028
|
+
spin,
|
|
7756
8029
|
teamId,
|
|
7757
8030
|
user,
|
|
7758
8031
|
checkTargetDir: false,
|
|
7759
8032
|
telemetry
|
|
7760
8033
|
});
|
|
7761
|
-
done = await
|
|
8034
|
+
done = await spin("Installing integration to project...");
|
|
7762
8035
|
await uniformClient.installIntegration({ projectId, type: typeSlug });
|
|
7763
8036
|
await done();
|
|
7764
8037
|
console.log(`
|
|
@@ -7828,10 +8101,10 @@ var NewCmd = {
|
|
|
7828
8101
|
),
|
|
7829
8102
|
describe: "Start a new Uniform project",
|
|
7830
8103
|
handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
|
|
7831
|
-
const { stopAllSpinners, spin
|
|
8104
|
+
const { stopAllSpinners, spin } = makeSpinner();
|
|
7832
8105
|
const telemetry = new Telemetry("cli new", disableTelemetry || apiHost !== stableApiHost);
|
|
7833
8106
|
try {
|
|
7834
|
-
await newHandler({ spin
|
|
8107
|
+
await newHandler({ spin, projectName: name, apiHost, outputPath, telemetry });
|
|
7835
8108
|
stopAllSpinners();
|
|
7836
8109
|
process.exit(0);
|
|
7837
8110
|
} catch (err) {
|
|
@@ -7865,10 +8138,10 @@ var NewMeshCmd = {
|
|
|
7865
8138
|
),
|
|
7866
8139
|
describe: "Start a new Uniform project",
|
|
7867
8140
|
handler: async function({ apiHost, outputPath, disableTelemetry }) {
|
|
7868
|
-
const { stopAllSpinners, spin
|
|
8141
|
+
const { stopAllSpinners, spin } = makeSpinner();
|
|
7869
8142
|
const telemetry = new Telemetry("cli new mesh", disableTelemetry || apiHost !== stableApiHost);
|
|
7870
8143
|
try {
|
|
7871
|
-
await newMeshIntegrationHandler({ spin
|
|
8144
|
+
await newMeshIntegrationHandler({ spin, apiHost, outputPath, telemetry });
|
|
7872
8145
|
stopAllSpinners();
|
|
7873
8146
|
process.exit(0);
|
|
7874
8147
|
} catch (err) {
|
|
@@ -7883,10 +8156,10 @@ var NewMeshCmd = {
|
|
|
7883
8156
|
};
|
|
7884
8157
|
|
|
7885
8158
|
// src/commands/optimize/index.ts
|
|
7886
|
-
import
|
|
8159
|
+
import yargs26 from "yargs";
|
|
7887
8160
|
|
|
7888
8161
|
// src/commands/optimize/manifest.ts
|
|
7889
|
-
import
|
|
8162
|
+
import yargs25 from "yargs";
|
|
7890
8163
|
|
|
7891
8164
|
// src/commands/optimize/manifest/download.ts
|
|
7892
8165
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -7901,7 +8174,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
7901
8174
|
var module = {
|
|
7902
8175
|
command: "download [output]",
|
|
7903
8176
|
describe: "Download intent manifest",
|
|
7904
|
-
builder: (
|
|
8177
|
+
builder: (yargs34) => yargs34.option("apiKey", {
|
|
7905
8178
|
alias: "k",
|
|
7906
8179
|
demandOption: true,
|
|
7907
8180
|
string: true,
|
|
@@ -8002,10 +8275,10 @@ var module2 = {
|
|
|
8002
8275
|
command: "manifest <command>",
|
|
8003
8276
|
describe: "Intent manifest commands",
|
|
8004
8277
|
builder: () => {
|
|
8005
|
-
return
|
|
8278
|
+
return yargs25.command(download_default);
|
|
8006
8279
|
},
|
|
8007
8280
|
handler: () => {
|
|
8008
|
-
|
|
8281
|
+
yargs25.showHelp();
|
|
8009
8282
|
}
|
|
8010
8283
|
};
|
|
8011
8284
|
var manifest_default = module2;
|
|
@@ -8016,29 +8289,29 @@ var OptimizeCommand = {
|
|
|
8016
8289
|
aliases: ["opt"],
|
|
8017
8290
|
describe: "Uniform Optimize commands",
|
|
8018
8291
|
builder: () => {
|
|
8019
|
-
return
|
|
8292
|
+
return yargs26.command(manifest_default);
|
|
8020
8293
|
},
|
|
8021
8294
|
handler: () => {
|
|
8022
|
-
|
|
8295
|
+
yargs26.showHelp();
|
|
8023
8296
|
}
|
|
8024
8297
|
};
|
|
8025
8298
|
|
|
8026
8299
|
// src/commands/project-map/index.ts
|
|
8027
|
-
import
|
|
8300
|
+
import yargs29 from "yargs";
|
|
8028
8301
|
|
|
8029
8302
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
8030
|
-
import
|
|
8303
|
+
import yargs27 from "yargs";
|
|
8031
8304
|
|
|
8032
8305
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
8033
8306
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
8034
8307
|
var ProjectMapDefinitionGetModule = {
|
|
8035
8308
|
command: "get <id>",
|
|
8036
8309
|
describe: "Fetch a project map",
|
|
8037
|
-
builder: (
|
|
8310
|
+
builder: (yargs34) => withFormatOptions(
|
|
8038
8311
|
withConfiguration(
|
|
8039
8312
|
withApiOptions(
|
|
8040
8313
|
withProjectOptions(
|
|
8041
|
-
|
|
8314
|
+
yargs34.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
8042
8315
|
)
|
|
8043
8316
|
)
|
|
8044
8317
|
)
|
|
@@ -8062,7 +8335,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
8062
8335
|
command: "list",
|
|
8063
8336
|
describe: "List of project maps",
|
|
8064
8337
|
aliases: ["ls"],
|
|
8065
|
-
builder: (
|
|
8338
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
8066
8339
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8067
8340
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8068
8341
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8083,8 +8356,8 @@ function writeContextPackage2(filename, packageContents) {
|
|
|
8083
8356
|
}
|
|
8084
8357
|
|
|
8085
8358
|
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
8086
|
-
var
|
|
8087
|
-
var
|
|
8359
|
+
var selectIdentifier11 = (source) => source.id;
|
|
8360
|
+
var selectDisplayName11 = (source) => `${source.name} (pid: ${source.id})`;
|
|
8088
8361
|
|
|
8089
8362
|
// src/commands/project-map/ProjectMapDefinitionEngineDataSource.ts
|
|
8090
8363
|
function createProjectMapDefinitionEngineDataSource({
|
|
@@ -8094,15 +8367,16 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8094
8367
|
const projectMaps = (await client.getProjectMapDefinitions()).projectMaps;
|
|
8095
8368
|
for await (const def of projectMaps) {
|
|
8096
8369
|
const result = {
|
|
8097
|
-
id:
|
|
8098
|
-
displayName:
|
|
8099
|
-
providerId:
|
|
8370
|
+
id: selectIdentifier11(def),
|
|
8371
|
+
displayName: selectDisplayName11(def),
|
|
8372
|
+
providerId: selectIdentifier11(def),
|
|
8100
8373
|
object: def
|
|
8101
8374
|
};
|
|
8102
8375
|
yield result;
|
|
8103
8376
|
}
|
|
8104
8377
|
}
|
|
8105
8378
|
return {
|
|
8379
|
+
name: "Uniform API",
|
|
8106
8380
|
objects: getObjects(),
|
|
8107
8381
|
deleteObject: async (providerId) => {
|
|
8108
8382
|
await client.deleteProjectMap({ projectMapId: providerId });
|
|
@@ -8119,11 +8393,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8119
8393
|
var ProjectMapDefinitionPullModule = {
|
|
8120
8394
|
command: "pull <directory>",
|
|
8121
8395
|
describe: "Pulls all project maps to local files in a directory",
|
|
8122
|
-
builder: (
|
|
8396
|
+
builder: (yargs34) => withConfiguration(
|
|
8123
8397
|
withApiOptions(
|
|
8124
8398
|
withProjectOptions(
|
|
8125
8399
|
withDiffOptions(
|
|
8126
|
-
|
|
8400
|
+
yargs34.positional("directory", {
|
|
8127
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.",
|
|
8128
8402
|
type: "string"
|
|
8129
8403
|
}).option("format", {
|
|
@@ -8168,9 +8442,10 @@ var ProjectMapDefinitionPullModule = {
|
|
|
8168
8442
|
if (isPackage) {
|
|
8169
8443
|
const packageContents = readContextPackage2(directory, false);
|
|
8170
8444
|
target = await createArraySyncEngineDataSource({
|
|
8445
|
+
name: `Package file ${directory}`,
|
|
8171
8446
|
objects: packageContents.projectMaps ?? [],
|
|
8172
|
-
selectIdentifier:
|
|
8173
|
-
selectDisplayName:
|
|
8447
|
+
selectIdentifier: selectIdentifier11,
|
|
8448
|
+
selectDisplayName: selectDisplayName11,
|
|
8174
8449
|
onSyncComplete: async (_, synced) => {
|
|
8175
8450
|
packageContents.projectMaps = synced;
|
|
8176
8451
|
writeContextPackage2(directory, packageContents);
|
|
@@ -8179,8 +8454,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
8179
8454
|
} else {
|
|
8180
8455
|
target = await createFileSyncEngineDataSource({
|
|
8181
8456
|
directory,
|
|
8182
|
-
selectIdentifier:
|
|
8183
|
-
selectDisplayName:
|
|
8457
|
+
selectIdentifier: selectIdentifier11,
|
|
8458
|
+
selectDisplayName: selectDisplayName11,
|
|
8184
8459
|
format
|
|
8185
8460
|
});
|
|
8186
8461
|
}
|
|
@@ -8200,11 +8475,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
8200
8475
|
var ProjectMapDefinitionPushModule = {
|
|
8201
8476
|
command: "push <directory>",
|
|
8202
8477
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
8203
|
-
builder: (
|
|
8478
|
+
builder: (yargs34) => withConfiguration(
|
|
8204
8479
|
withApiOptions(
|
|
8205
8480
|
withProjectOptions(
|
|
8206
8481
|
withDiffOptions(
|
|
8207
|
-
|
|
8482
|
+
yargs34.positional("directory", {
|
|
8208
8483
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8209
8484
|
type: "string"
|
|
8210
8485
|
}).option("what-if", {
|
|
@@ -8241,15 +8516,16 @@ var ProjectMapDefinitionPushModule = {
|
|
|
8241
8516
|
if (isPackage) {
|
|
8242
8517
|
const packageContents = readContextPackage2(directory, true);
|
|
8243
8518
|
source = await createArraySyncEngineDataSource({
|
|
8519
|
+
name: `Package file ${directory}`,
|
|
8244
8520
|
objects: packageContents.projectMaps ?? [],
|
|
8245
|
-
selectIdentifier:
|
|
8246
|
-
selectDisplayName:
|
|
8521
|
+
selectIdentifier: selectIdentifier11,
|
|
8522
|
+
selectDisplayName: selectDisplayName11
|
|
8247
8523
|
});
|
|
8248
8524
|
} else {
|
|
8249
8525
|
source = await createFileSyncEngineDataSource({
|
|
8250
8526
|
directory,
|
|
8251
|
-
selectIdentifier:
|
|
8252
|
-
selectDisplayName:
|
|
8527
|
+
selectIdentifier: selectIdentifier11,
|
|
8528
|
+
selectDisplayName: selectDisplayName11
|
|
8253
8529
|
});
|
|
8254
8530
|
}
|
|
8255
8531
|
const target = createProjectMapDefinitionEngineDataSource({ client });
|
|
@@ -8270,9 +8546,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
8270
8546
|
command: "remove <id>",
|
|
8271
8547
|
aliases: ["delete", "rm"],
|
|
8272
8548
|
describe: "Delete a project map",
|
|
8273
|
-
builder: (
|
|
8549
|
+
builder: (yargs34) => withConfiguration(
|
|
8274
8550
|
withApiOptions(
|
|
8275
|
-
withProjectOptions(
|
|
8551
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8276
8552
|
)
|
|
8277
8553
|
),
|
|
8278
8554
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8288,10 +8564,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8288
8564
|
command: "update <filename>",
|
|
8289
8565
|
aliases: ["put"],
|
|
8290
8566
|
describe: "Insert or update a project map",
|
|
8291
|
-
builder: (
|
|
8567
|
+
builder: (yargs34) => withConfiguration(
|
|
8292
8568
|
withApiOptions(
|
|
8293
8569
|
withProjectOptions(
|
|
8294
|
-
|
|
8570
|
+
yargs34.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
8295
8571
|
)
|
|
8296
8572
|
)
|
|
8297
8573
|
),
|
|
@@ -8307,25 +8583,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8307
8583
|
var ProjectMapDefinitionModule = {
|
|
8308
8584
|
command: "definition <command>",
|
|
8309
8585
|
describe: "Commands for ProjectMap Definitions",
|
|
8310
|
-
builder: (
|
|
8586
|
+
builder: (yargs34) => yargs34.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
8311
8587
|
handler: () => {
|
|
8312
|
-
|
|
8588
|
+
yargs27.help();
|
|
8313
8589
|
}
|
|
8314
8590
|
};
|
|
8315
8591
|
|
|
8316
8592
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
8317
|
-
import
|
|
8593
|
+
import yargs28 from "yargs";
|
|
8318
8594
|
|
|
8319
8595
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
8320
8596
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
8321
8597
|
var ProjectMapNodeGetModule = {
|
|
8322
8598
|
command: "get <id> <projectMapId>",
|
|
8323
8599
|
describe: "Fetch a project map node",
|
|
8324
|
-
builder: (
|
|
8600
|
+
builder: (yargs34) => withConfiguration(
|
|
8325
8601
|
withFormatOptions(
|
|
8326
8602
|
withApiOptions(
|
|
8327
8603
|
withProjectOptions(
|
|
8328
|
-
|
|
8604
|
+
yargs34.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
8329
8605
|
)
|
|
8330
8606
|
)
|
|
8331
8607
|
)
|
|
@@ -8351,12 +8627,12 @@ var ProjectMapNodeListModule = {
|
|
|
8351
8627
|
command: "list <projectMapId>",
|
|
8352
8628
|
describe: "List project map nodes",
|
|
8353
8629
|
aliases: ["ls"],
|
|
8354
|
-
builder: (
|
|
8630
|
+
builder: (yargs34) => withConfiguration(
|
|
8355
8631
|
withFormatOptions(
|
|
8356
8632
|
withApiOptions(
|
|
8357
8633
|
withProjectOptions(
|
|
8358
8634
|
withStateOptions(
|
|
8359
|
-
|
|
8635
|
+
yargs34.positional("projectMapId", {
|
|
8360
8636
|
demandOption: true,
|
|
8361
8637
|
describe: "ProjectMap UUID to fetch from"
|
|
8362
8638
|
})
|
|
@@ -8377,12 +8653,12 @@ var ProjectMapNodeListModule = {
|
|
|
8377
8653
|
import { UncachedProjectMapClient as UncachedProjectMapClient9 } from "@uniformdev/project-map";
|
|
8378
8654
|
|
|
8379
8655
|
// src/commands/project-map/commands/ProjectMapNode/_util.ts
|
|
8380
|
-
var
|
|
8656
|
+
var selectIdentifier12 = (source, projectId) => [
|
|
8381
8657
|
projectId + source.projectMapId + source.id,
|
|
8382
8658
|
projectId + source.projectMapId + source.path
|
|
8383
8659
|
];
|
|
8384
8660
|
var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
|
|
8385
|
-
var
|
|
8661
|
+
var selectDisplayName12 = (source) => `${source.name} (pid: ${source.id})`;
|
|
8386
8662
|
|
|
8387
8663
|
// src/commands/project-map/ProjectMapNodeEngineDataSource.ts
|
|
8388
8664
|
function createProjectMapNodeEngineDataSource({
|
|
@@ -8396,9 +8672,9 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8396
8672
|
for await (const node of nodes ?? []) {
|
|
8397
8673
|
if (node) {
|
|
8398
8674
|
const result = {
|
|
8399
|
-
id:
|
|
8400
|
-
displayName:
|
|
8401
|
-
providerId:
|
|
8675
|
+
id: selectIdentifier12({ ...node, projectMapId: projectMap.id }, projectId),
|
|
8676
|
+
displayName: selectDisplayName12(node),
|
|
8677
|
+
providerId: selectIdentifier12({ ...node, projectMapId: projectMap.id }, projectId)[0],
|
|
8402
8678
|
object: { ...node, projectMapId: projectMap.id }
|
|
8403
8679
|
};
|
|
8404
8680
|
yield result;
|
|
@@ -8407,6 +8683,7 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8407
8683
|
}
|
|
8408
8684
|
}
|
|
8409
8685
|
return {
|
|
8686
|
+
name: "Uniform API",
|
|
8410
8687
|
objects: getObjects(),
|
|
8411
8688
|
deleteObject: async (providerId, object) => {
|
|
8412
8689
|
await client.deleteProjectMapNode({
|
|
@@ -8428,11 +8705,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8428
8705
|
var ProjectMapNodePullModule = {
|
|
8429
8706
|
command: "pull <directory>",
|
|
8430
8707
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
8431
|
-
builder: (
|
|
8708
|
+
builder: (yargs34) => withConfiguration(
|
|
8432
8709
|
withApiOptions(
|
|
8433
8710
|
withProjectOptions(
|
|
8434
8711
|
withDiffOptions(
|
|
8435
|
-
|
|
8712
|
+
yargs34.positional("directory", {
|
|
8436
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.",
|
|
8437
8714
|
type: "string"
|
|
8438
8715
|
}).option("format", {
|
|
@@ -8475,14 +8752,15 @@ var ProjectMapNodePullModule = {
|
|
|
8475
8752
|
let target;
|
|
8476
8753
|
const isPackage = isPathAPackageFile(directory);
|
|
8477
8754
|
const expandedSelectIdentifier = (object) => {
|
|
8478
|
-
return
|
|
8755
|
+
return selectIdentifier12(object, projectId);
|
|
8479
8756
|
};
|
|
8480
8757
|
if (isPackage) {
|
|
8481
8758
|
const packageContents = readContextPackage2(directory, false);
|
|
8482
8759
|
target = await createArraySyncEngineDataSource({
|
|
8760
|
+
name: `Package file ${directory}`,
|
|
8483
8761
|
objects: packageContents.projectMapNodes ?? [],
|
|
8484
8762
|
selectIdentifier: expandedSelectIdentifier,
|
|
8485
|
-
selectDisplayName:
|
|
8763
|
+
selectDisplayName: selectDisplayName12,
|
|
8486
8764
|
onSyncComplete: async (_, synced) => {
|
|
8487
8765
|
packageContents.projectMapNodes = synced;
|
|
8488
8766
|
writeContextPackage2(directory, packageContents);
|
|
@@ -8492,7 +8770,7 @@ var ProjectMapNodePullModule = {
|
|
|
8492
8770
|
target = await createFileSyncEngineDataSource({
|
|
8493
8771
|
directory,
|
|
8494
8772
|
selectIdentifier: expandedSelectIdentifier,
|
|
8495
|
-
selectDisplayName:
|
|
8773
|
+
selectDisplayName: selectDisplayName12,
|
|
8496
8774
|
format,
|
|
8497
8775
|
selectFilename
|
|
8498
8776
|
});
|
|
@@ -8513,11 +8791,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
8513
8791
|
var ProjectMapNodePushModule = {
|
|
8514
8792
|
command: "push <directory>",
|
|
8515
8793
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
8516
|
-
builder: (
|
|
8794
|
+
builder: (yargs34) => withConfiguration(
|
|
8517
8795
|
withApiOptions(
|
|
8518
8796
|
withProjectOptions(
|
|
8519
8797
|
withDiffOptions(
|
|
8520
|
-
|
|
8798
|
+
yargs34.positional("directory", {
|
|
8521
8799
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8522
8800
|
type: "string"
|
|
8523
8801
|
}).option("what-if", {
|
|
@@ -8557,20 +8835,21 @@ var ProjectMapNodePushModule = {
|
|
|
8557
8835
|
let source;
|
|
8558
8836
|
const isPackage = isPathAPackageFile(directory);
|
|
8559
8837
|
const expandedSelectIdentifier = (object) => {
|
|
8560
|
-
return
|
|
8838
|
+
return selectIdentifier12(object, projectId);
|
|
8561
8839
|
};
|
|
8562
8840
|
if (isPackage) {
|
|
8563
8841
|
const packageContents = readContextPackage2(directory, true);
|
|
8564
8842
|
source = await createArraySyncEngineDataSource({
|
|
8843
|
+
name: `Package file ${directory}`,
|
|
8565
8844
|
objects: packageContents.projectMapNodes ?? [],
|
|
8566
8845
|
selectIdentifier: expandedSelectIdentifier,
|
|
8567
|
-
selectDisplayName:
|
|
8846
|
+
selectDisplayName: selectDisplayName12
|
|
8568
8847
|
});
|
|
8569
8848
|
} else {
|
|
8570
8849
|
source = await createFileSyncEngineDataSource({
|
|
8571
8850
|
directory,
|
|
8572
8851
|
selectIdentifier: expandedSelectIdentifier,
|
|
8573
|
-
selectDisplayName:
|
|
8852
|
+
selectDisplayName: selectDisplayName12,
|
|
8574
8853
|
selectFilename
|
|
8575
8854
|
});
|
|
8576
8855
|
}
|
|
@@ -8592,10 +8871,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
8592
8871
|
command: "remove <id> <projectMapId>",
|
|
8593
8872
|
aliases: ["delete", "rm"],
|
|
8594
8873
|
describe: "Delete a project map node",
|
|
8595
|
-
builder: (
|
|
8874
|
+
builder: (yargs34) => withConfiguration(
|
|
8596
8875
|
withApiOptions(
|
|
8597
8876
|
withProjectOptions(
|
|
8598
|
-
|
|
8877
|
+
yargs34.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
8599
8878
|
)
|
|
8600
8879
|
)
|
|
8601
8880
|
),
|
|
@@ -8612,10 +8891,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8612
8891
|
command: "update <filename> <projectMapId>",
|
|
8613
8892
|
aliases: ["put"],
|
|
8614
8893
|
describe: "Insert or update a project map node",
|
|
8615
|
-
builder: (
|
|
8894
|
+
builder: (yargs34) => withConfiguration(
|
|
8616
8895
|
withApiOptions(
|
|
8617
8896
|
withProjectOptions(
|
|
8618
|
-
|
|
8897
|
+
yargs34.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
8619
8898
|
)
|
|
8620
8899
|
)
|
|
8621
8900
|
),
|
|
@@ -8631,9 +8910,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8631
8910
|
var ProjectMapNodeModule = {
|
|
8632
8911
|
command: "node <command>",
|
|
8633
8912
|
describe: "Commands for ProjectMap Nodes",
|
|
8634
|
-
builder: (
|
|
8913
|
+
builder: (yargs34) => yargs34.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
8635
8914
|
handler: () => {
|
|
8636
|
-
|
|
8915
|
+
yargs28.help();
|
|
8637
8916
|
}
|
|
8638
8917
|
};
|
|
8639
8918
|
|
|
@@ -8642,28 +8921,28 @@ var ProjectMapCommand = {
|
|
|
8642
8921
|
command: "project-map <command>",
|
|
8643
8922
|
aliases: ["prm"],
|
|
8644
8923
|
describe: "Uniform ProjectMap commands",
|
|
8645
|
-
builder: (
|
|
8924
|
+
builder: (yargs34) => yargs34.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
8646
8925
|
handler: () => {
|
|
8647
|
-
|
|
8926
|
+
yargs29.showHelp();
|
|
8648
8927
|
}
|
|
8649
8928
|
};
|
|
8650
8929
|
|
|
8651
8930
|
// src/commands/redirect/index.ts
|
|
8652
|
-
import
|
|
8931
|
+
import yargs31 from "yargs";
|
|
8653
8932
|
|
|
8654
8933
|
// src/commands/redirect/commands/redirect.ts
|
|
8655
|
-
import
|
|
8934
|
+
import yargs30 from "yargs";
|
|
8656
8935
|
|
|
8657
8936
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
8658
8937
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
8659
8938
|
var RedirectDefinitionGetModule = {
|
|
8660
8939
|
command: "get <id>",
|
|
8661
8940
|
describe: "Fetch a redirect",
|
|
8662
|
-
builder: (
|
|
8941
|
+
builder: (yargs34) => withConfiguration(
|
|
8663
8942
|
withFormatOptions(
|
|
8664
8943
|
withApiOptions(
|
|
8665
8944
|
withProjectOptions(
|
|
8666
|
-
|
|
8945
|
+
yargs34.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
8667
8946
|
)
|
|
8668
8947
|
)
|
|
8669
8948
|
)
|
|
@@ -8687,7 +8966,7 @@ var RedirectDefinitionListModule = {
|
|
|
8687
8966
|
command: "list",
|
|
8688
8967
|
describe: "List of redirects",
|
|
8689
8968
|
aliases: ["ls"],
|
|
8690
|
-
builder: (
|
|
8969
|
+
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
8691
8970
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8692
8971
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8693
8972
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8708,12 +8987,12 @@ function writeContextPackage3(filename, packageContents) {
|
|
|
8708
8987
|
}
|
|
8709
8988
|
|
|
8710
8989
|
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
8711
|
-
var
|
|
8990
|
+
var selectIdentifier13 = (source) => source.id;
|
|
8712
8991
|
var selectFilename2 = (source) => {
|
|
8713
8992
|
const index = source.sourceUrl.lastIndexOf("/");
|
|
8714
8993
|
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
8715
8994
|
};
|
|
8716
|
-
var
|
|
8995
|
+
var selectDisplayName13 = (source) => {
|
|
8717
8996
|
let pathName = source.sourceUrl;
|
|
8718
8997
|
if (pathName.length > 30) {
|
|
8719
8998
|
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
@@ -8730,15 +9009,16 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
8730
9009
|
const redirects = client.getAllRedirects();
|
|
8731
9010
|
for await (const redirect of redirects) {
|
|
8732
9011
|
const result = {
|
|
8733
|
-
id:
|
|
8734
|
-
displayName:
|
|
8735
|
-
providerId:
|
|
9012
|
+
id: selectIdentifier13(redirect.redirect),
|
|
9013
|
+
displayName: selectDisplayName13(redirect.redirect),
|
|
9014
|
+
providerId: selectIdentifier13(redirect.redirect),
|
|
8736
9015
|
object: redirect.redirect
|
|
8737
9016
|
};
|
|
8738
9017
|
yield result;
|
|
8739
9018
|
}
|
|
8740
9019
|
}
|
|
8741
9020
|
return {
|
|
9021
|
+
name: "Uniform API",
|
|
8742
9022
|
objects: getObjects(),
|
|
8743
9023
|
deleteObject: async (providerId) => {
|
|
8744
9024
|
await client.deleteRedirect(providerId);
|
|
@@ -8753,11 +9033,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
8753
9033
|
var RedirectDefinitionPullModule = {
|
|
8754
9034
|
command: "pull <directory>",
|
|
8755
9035
|
describe: "Pulls all redirects to local files in a directory",
|
|
8756
|
-
builder: (
|
|
9036
|
+
builder: (yargs34) => withConfiguration(
|
|
8757
9037
|
withApiOptions(
|
|
8758
9038
|
withProjectOptions(
|
|
8759
9039
|
withDiffOptions(
|
|
8760
|
-
|
|
9040
|
+
yargs34.positional("directory", {
|
|
8761
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.",
|
|
8762
9042
|
type: "string"
|
|
8763
9043
|
}).option("format", {
|
|
@@ -8802,9 +9082,10 @@ var RedirectDefinitionPullModule = {
|
|
|
8802
9082
|
if (isPackage) {
|
|
8803
9083
|
const packageContents = readContextPackage3(directory, false);
|
|
8804
9084
|
target = await createArraySyncEngineDataSource({
|
|
9085
|
+
name: `Package file ${directory}`,
|
|
8805
9086
|
objects: packageContents.redirects ?? [],
|
|
8806
|
-
selectIdentifier:
|
|
8807
|
-
selectDisplayName:
|
|
9087
|
+
selectIdentifier: selectIdentifier13,
|
|
9088
|
+
selectDisplayName: selectDisplayName13,
|
|
8808
9089
|
onSyncComplete: async (_, synced) => {
|
|
8809
9090
|
packageContents.redirects = synced;
|
|
8810
9091
|
writeContextPackage3(directory, packageContents);
|
|
@@ -8814,8 +9095,8 @@ var RedirectDefinitionPullModule = {
|
|
|
8814
9095
|
target = await createFileSyncEngineDataSource({
|
|
8815
9096
|
directory,
|
|
8816
9097
|
selectFilename: selectFilename2,
|
|
8817
|
-
selectIdentifier:
|
|
8818
|
-
selectDisplayName:
|
|
9098
|
+
selectIdentifier: selectIdentifier13,
|
|
9099
|
+
selectDisplayName: selectDisplayName13,
|
|
8819
9100
|
format
|
|
8820
9101
|
});
|
|
8821
9102
|
}
|
|
@@ -8835,11 +9116,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
8835
9116
|
var RedirectDefinitionPushModule = {
|
|
8836
9117
|
command: "push <directory>",
|
|
8837
9118
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
8838
|
-
builder: (
|
|
9119
|
+
builder: (yargs34) => withConfiguration(
|
|
8839
9120
|
withApiOptions(
|
|
8840
9121
|
withProjectOptions(
|
|
8841
9122
|
withDiffOptions(
|
|
8842
|
-
|
|
9123
|
+
yargs34.positional("directory", {
|
|
8843
9124
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
8844
9125
|
type: "string"
|
|
8845
9126
|
}).option("what-if", {
|
|
@@ -8876,15 +9157,16 @@ var RedirectDefinitionPushModule = {
|
|
|
8876
9157
|
if (isPackage) {
|
|
8877
9158
|
const packageContents = readContextPackage3(directory, true);
|
|
8878
9159
|
source = await createArraySyncEngineDataSource({
|
|
9160
|
+
name: `Package file ${directory}`,
|
|
8879
9161
|
objects: packageContents.redirects ?? [],
|
|
8880
|
-
selectIdentifier:
|
|
8881
|
-
selectDisplayName:
|
|
9162
|
+
selectIdentifier: selectIdentifier13,
|
|
9163
|
+
selectDisplayName: selectDisplayName13
|
|
8882
9164
|
});
|
|
8883
9165
|
} else {
|
|
8884
9166
|
source = await createFileSyncEngineDataSource({
|
|
8885
9167
|
directory,
|
|
8886
|
-
selectIdentifier:
|
|
8887
|
-
selectDisplayName:
|
|
9168
|
+
selectIdentifier: selectIdentifier13,
|
|
9169
|
+
selectDisplayName: selectDisplayName13
|
|
8888
9170
|
});
|
|
8889
9171
|
}
|
|
8890
9172
|
const target = createRedirectDefinitionEngineDataSource({ client });
|
|
@@ -8905,9 +9187,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
8905
9187
|
command: "remove <id>",
|
|
8906
9188
|
aliases: ["delete", "rm"],
|
|
8907
9189
|
describe: "Delete a redirect",
|
|
8908
|
-
builder: (
|
|
9190
|
+
builder: (yargs34) => withConfiguration(
|
|
8909
9191
|
withApiOptions(
|
|
8910
|
-
withProjectOptions(
|
|
9192
|
+
withProjectOptions(yargs34.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8911
9193
|
)
|
|
8912
9194
|
),
|
|
8913
9195
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8923,10 +9205,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
8923
9205
|
command: "update <filename>",
|
|
8924
9206
|
aliases: ["put"],
|
|
8925
9207
|
describe: "Insert or update a redirect",
|
|
8926
|
-
builder: (
|
|
9208
|
+
builder: (yargs34) => withConfiguration(
|
|
8927
9209
|
withApiOptions(
|
|
8928
9210
|
withProjectOptions(
|
|
8929
|
-
|
|
9211
|
+
yargs34.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
8930
9212
|
)
|
|
8931
9213
|
)
|
|
8932
9214
|
),
|
|
@@ -8942,9 +9224,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
8942
9224
|
var RedirectDefinitionModule = {
|
|
8943
9225
|
command: "definition <command>",
|
|
8944
9226
|
describe: "Commands for Redirect Definitions",
|
|
8945
|
-
builder: (
|
|
9227
|
+
builder: (yargs34) => yargs34.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
8946
9228
|
handler: () => {
|
|
8947
|
-
|
|
9229
|
+
yargs30.help();
|
|
8948
9230
|
}
|
|
8949
9231
|
};
|
|
8950
9232
|
|
|
@@ -8953,39 +9235,66 @@ var RedirectCommand = {
|
|
|
8953
9235
|
command: "redirect <command>",
|
|
8954
9236
|
aliases: ["red"],
|
|
8955
9237
|
describe: "Uniform Redirect commands",
|
|
8956
|
-
builder: (
|
|
9238
|
+
builder: (yargs34) => yargs34.command(RedirectDefinitionModule).demandCommand(),
|
|
8957
9239
|
handler: () => {
|
|
8958
|
-
|
|
9240
|
+
yargs31.showHelp();
|
|
8959
9241
|
}
|
|
8960
9242
|
};
|
|
8961
9243
|
|
|
8962
9244
|
// src/commands/sync/index.ts
|
|
8963
|
-
import
|
|
9245
|
+
import yargs32 from "yargs";
|
|
8964
9246
|
|
|
8965
9247
|
// src/commands/sync/commands/util.ts
|
|
8966
9248
|
import ora2 from "ora";
|
|
8967
|
-
function
|
|
8968
|
-
const
|
|
8969
|
-
const
|
|
8970
|
-
|
|
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) => {
|
|
8971
9289
|
if (text.length === 1 && typeof text[0] === "string") {
|
|
8972
|
-
|
|
9290
|
+
ora3.text += "\n" + text;
|
|
8973
9291
|
} else {
|
|
8974
|
-
|
|
9292
|
+
original(...text);
|
|
8975
9293
|
}
|
|
9294
|
+
replay.push({ fn, args: text });
|
|
8976
9295
|
};
|
|
8977
|
-
return {
|
|
8978
|
-
|
|
8979
|
-
stop: () => {
|
|
8980
|
-
spinner.stop();
|
|
8981
|
-
console.log = consoleLog;
|
|
8982
|
-
return spinner;
|
|
8983
|
-
},
|
|
8984
|
-
succeed() {
|
|
8985
|
-
spinner.succeed();
|
|
8986
|
-
console.log = consoleLog;
|
|
8987
|
-
return spinner;
|
|
8988
|
-
}
|
|
9296
|
+
return () => {
|
|
9297
|
+
console[fn] = original;
|
|
8989
9298
|
};
|
|
8990
9299
|
}
|
|
8991
9300
|
|
|
@@ -8993,11 +9302,11 @@ function spin(entityType) {
|
|
|
8993
9302
|
var SyncPullModule = {
|
|
8994
9303
|
command: "pull",
|
|
8995
9304
|
describe: "Pulls whole project to local files in a directory",
|
|
8996
|
-
builder: (
|
|
9305
|
+
builder: (yargs34) => withConfiguration(
|
|
8997
9306
|
withApiOptions(
|
|
8998
9307
|
withProjectOptions(
|
|
8999
9308
|
withDiffOptions(
|
|
9000
|
-
|
|
9309
|
+
yargs34.option("what-if", {
|
|
9001
9310
|
alias: ["w"],
|
|
9002
9311
|
describe: "What-if mode reports what would be done but changes no files",
|
|
9003
9312
|
default: false,
|
|
@@ -9019,6 +9328,7 @@ var SyncPullModule = {
|
|
|
9019
9328
|
locale: LocalePullModule,
|
|
9020
9329
|
asset: AssetPullModule,
|
|
9021
9330
|
category: CategoryPullModule,
|
|
9331
|
+
workflow: WorkflowPullModule,
|
|
9022
9332
|
dataType: DataTypePullModule,
|
|
9023
9333
|
prompt: PromptPullModule,
|
|
9024
9334
|
quirk: QuirkPullModule,
|
|
@@ -9046,26 +9356,34 @@ var SyncPullModule = {
|
|
|
9046
9356
|
);
|
|
9047
9357
|
}
|
|
9048
9358
|
for (const [entityType, module3] of enabledEntities) {
|
|
9049
|
-
const spinner = spin(entityType);
|
|
9050
9359
|
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
9051
9360
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
9052
9361
|
};
|
|
9053
9362
|
const entityConfig = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType];
|
|
9054
9363
|
try {
|
|
9055
|
-
await
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
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
|
+
);
|
|
9066
9385
|
} catch (e) {
|
|
9067
|
-
|
|
9068
|
-
throw e;
|
|
9386
|
+
process.exit(1);
|
|
9069
9387
|
}
|
|
9070
9388
|
}
|
|
9071
9389
|
}
|
|
@@ -9100,11 +9418,11 @@ var getFormat = (entityType, config2) => {
|
|
|
9100
9418
|
var SyncPushModule = {
|
|
9101
9419
|
command: "push",
|
|
9102
9420
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
9103
|
-
builder: (
|
|
9421
|
+
builder: (yargs34) => withConfiguration(
|
|
9104
9422
|
withApiOptions(
|
|
9105
9423
|
withProjectOptions(
|
|
9106
9424
|
withDiffOptions(
|
|
9107
|
-
|
|
9425
|
+
yargs34.option("what-if", {
|
|
9108
9426
|
alias: ["w"],
|
|
9109
9427
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
9110
9428
|
default: false,
|
|
@@ -9126,6 +9444,7 @@ var SyncPushModule = {
|
|
|
9126
9444
|
locale: LocalePushModule,
|
|
9127
9445
|
asset: AssetPushModule,
|
|
9128
9446
|
category: CategoryPushModule,
|
|
9447
|
+
workflow: WorkflowPushModule,
|
|
9129
9448
|
dataType: DataTypePushModule,
|
|
9130
9449
|
prompt: PromptPushModule,
|
|
9131
9450
|
quirk: QuirkPushModule,
|
|
@@ -9153,22 +9472,30 @@ var SyncPushModule = {
|
|
|
9153
9472
|
);
|
|
9154
9473
|
}
|
|
9155
9474
|
for (const [entityType, module3] of enabledEntities) {
|
|
9156
|
-
const spinner = spin(entityType);
|
|
9157
9475
|
try {
|
|
9158
|
-
await
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
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
|
+
);
|
|
9169
9497
|
} catch (e) {
|
|
9170
|
-
|
|
9171
|
-
throw e;
|
|
9498
|
+
process.exit(1);
|
|
9172
9499
|
}
|
|
9173
9500
|
}
|
|
9174
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)) {
|
|
@@ -9215,9 +9542,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
9215
9542
|
var SyncCommand = {
|
|
9216
9543
|
command: "sync <command>",
|
|
9217
9544
|
describe: "Uniform Sync commands",
|
|
9218
|
-
builder: (
|
|
9545
|
+
builder: (yargs34) => yargs34.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
9219
9546
|
handler: () => {
|
|
9220
|
-
|
|
9547
|
+
yargs32.showHelp();
|
|
9221
9548
|
}
|
|
9222
9549
|
};
|
|
9223
9550
|
|
|
@@ -9484,7 +9811,7 @@ First found was: v${firstVersion}`;
|
|
|
9484
9811
|
|
|
9485
9812
|
// src/index.ts
|
|
9486
9813
|
dotenv.config();
|
|
9487
|
-
var yarggery =
|
|
9814
|
+
var yarggery = yargs33(hideBin(process.argv));
|
|
9488
9815
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
9489
9816
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
9490
9817
|
yarggery.option("verbose", {
|