@uniformdev/cli 19.1.1-alpha.1 → 19.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +460 -161
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
28
28
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
import * as dotenv from "dotenv";
|
|
31
|
-
import
|
|
31
|
+
import yargs19 from "yargs";
|
|
32
32
|
import { hideBin } from "yargs/helpers";
|
|
33
33
|
|
|
34
34
|
// src/commands/canvas/index.ts
|
|
@@ -43,12 +43,12 @@ import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
|
43
43
|
// src/sync/arraySyncEngineDataSource.ts
|
|
44
44
|
async function createArraySyncEngineDataSource({
|
|
45
45
|
objects,
|
|
46
|
-
selectIdentifier:
|
|
47
|
-
selectDisplayName:
|
|
46
|
+
selectIdentifier: selectIdentifier12,
|
|
47
|
+
selectDisplayName: selectDisplayName12 = selectIdentifier12,
|
|
48
48
|
onSyncComplete
|
|
49
49
|
}) {
|
|
50
50
|
const objectIndex = objects.reduce((result, current) => {
|
|
51
|
-
const rawIdentifiers =
|
|
51
|
+
const rawIdentifiers = selectIdentifier12(current);
|
|
52
52
|
const identifiers = Array.isArray(rawIdentifiers) ? rawIdentifiers : [rawIdentifiers];
|
|
53
53
|
while (identifiers.length > 0) {
|
|
54
54
|
const identifier = identifiers.pop();
|
|
@@ -61,7 +61,7 @@ async function createArraySyncEngineDataSource({
|
|
|
61
61
|
id: identifier,
|
|
62
62
|
object: current,
|
|
63
63
|
providerId: identifier,
|
|
64
|
-
displayName:
|
|
64
|
+
displayName: selectDisplayName12(current)[0]
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
return result;
|
|
@@ -80,7 +80,7 @@ async function createArraySyncEngineDataSource({
|
|
|
80
80
|
delete objectIndex[providerId];
|
|
81
81
|
},
|
|
82
82
|
writeObject: async (objectToWrite) => {
|
|
83
|
-
const id =
|
|
83
|
+
const id = selectIdentifier12(objectToWrite.object);
|
|
84
84
|
if (Array.isArray(id)) {
|
|
85
85
|
id.forEach((i) => objectIndex[i] = objectToWrite);
|
|
86
86
|
} else {
|
|
@@ -113,8 +113,8 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
113
113
|
import unfetch from "isomorphic-unfetch";
|
|
114
114
|
import { dump, load } from "js-yaml";
|
|
115
115
|
import { extname } from "path";
|
|
116
|
-
function withApiOptions(
|
|
117
|
-
return
|
|
116
|
+
function withApiOptions(yargs20) {
|
|
117
|
+
return yargs20.option("apiKey", {
|
|
118
118
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
119
119
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
120
120
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -153,8 +153,8 @@ function nodeFetchProxy(proxy) {
|
|
|
153
153
|
};
|
|
154
154
|
return wrappedFetch;
|
|
155
155
|
}
|
|
156
|
-
function withProjectOptions(
|
|
157
|
-
return
|
|
156
|
+
function withProjectOptions(yargs20) {
|
|
157
|
+
return yargs20.option("project", {
|
|
158
158
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
159
159
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
160
160
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -164,8 +164,8 @@ function withProjectOptions(yargs18) {
|
|
|
164
164
|
alias: ["p"]
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
function withFormatOptions(
|
|
168
|
-
return
|
|
167
|
+
function withFormatOptions(yargs20) {
|
|
168
|
+
return yargs20.option("format", {
|
|
169
169
|
alias: ["f"],
|
|
170
170
|
describe: "Output format",
|
|
171
171
|
default: "yaml",
|
|
@@ -177,8 +177,8 @@ function withFormatOptions(yargs18) {
|
|
|
177
177
|
type: "string"
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
function withDiffOptions(
|
|
181
|
-
return
|
|
180
|
+
function withDiffOptions(yargs20) {
|
|
181
|
+
return yargs20.option("diff", {
|
|
182
182
|
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.",
|
|
183
183
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
184
184
|
type: "string",
|
|
@@ -243,8 +243,8 @@ async function* paginateAsync(fetchPage, options) {
|
|
|
243
243
|
async function createFileSyncEngineDataSource({
|
|
244
244
|
directory,
|
|
245
245
|
format = "yaml",
|
|
246
|
-
selectIdentifier:
|
|
247
|
-
selectDisplayName:
|
|
246
|
+
selectIdentifier: selectIdentifier12,
|
|
247
|
+
selectDisplayName: selectDisplayName12 = selectIdentifier12,
|
|
248
248
|
selectFilename: selectFilename2,
|
|
249
249
|
selectSchemaUrl: selectSchemaUrl2
|
|
250
250
|
}) {
|
|
@@ -266,8 +266,8 @@ async function createFileSyncEngineDataSource({
|
|
|
266
266
|
try {
|
|
267
267
|
const contents = await readFileToObject(fullFilename);
|
|
268
268
|
const object = {
|
|
269
|
-
id:
|
|
270
|
-
displayName:
|
|
269
|
+
id: selectIdentifier12(contents),
|
|
270
|
+
displayName: selectDisplayName12(contents)[0],
|
|
271
271
|
providerId: fullFilename,
|
|
272
272
|
object: omit(contents, ["$schema"])
|
|
273
273
|
};
|
|
@@ -502,10 +502,10 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
502
502
|
var ComponentGetModule = {
|
|
503
503
|
command: "get <id>",
|
|
504
504
|
describe: "Fetch a component definition",
|
|
505
|
-
builder: (
|
|
505
|
+
builder: (yargs20) => withFormatOptions(
|
|
506
506
|
withApiOptions(
|
|
507
507
|
withProjectOptions(
|
|
508
|
-
|
|
508
|
+
yargs20.positional("id", { demandOption: true, describe: "Component definition public ID to fetch" })
|
|
509
509
|
)
|
|
510
510
|
)
|
|
511
511
|
),
|
|
@@ -535,10 +535,10 @@ var ComponentListModule = {
|
|
|
535
535
|
command: "list",
|
|
536
536
|
describe: "List component definitions",
|
|
537
537
|
aliases: ["ls"],
|
|
538
|
-
builder: (
|
|
538
|
+
builder: (yargs20) => withFormatOptions(
|
|
539
539
|
withApiOptions(
|
|
540
540
|
withProjectOptions(
|
|
541
|
-
|
|
541
|
+
yargs20.options({
|
|
542
542
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
543
543
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
544
544
|
})
|
|
@@ -715,8 +715,8 @@ function prepCompositionForDisk(composition) {
|
|
|
715
715
|
delete prepped.state;
|
|
716
716
|
return prepped;
|
|
717
717
|
}
|
|
718
|
-
function withStateOptions(
|
|
719
|
-
return
|
|
718
|
+
function withStateOptions(yargs20) {
|
|
719
|
+
return yargs20.option("state", {
|
|
720
720
|
type: "string",
|
|
721
721
|
describe: `Composition state to fetch.`,
|
|
722
722
|
choices: ["preview", "published"],
|
|
@@ -742,10 +742,10 @@ var limitPolicy = pLimit(8);
|
|
|
742
742
|
var ComponentPullModule = {
|
|
743
743
|
command: "pull <directory>",
|
|
744
744
|
describe: "Pulls all component definitions to local files in a directory",
|
|
745
|
-
builder: (
|
|
745
|
+
builder: (yargs20) => withApiOptions(
|
|
746
746
|
withProjectOptions(
|
|
747
747
|
withDiffOptions(
|
|
748
|
-
|
|
748
|
+
yargs20.positional("directory", {
|
|
749
749
|
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.",
|
|
750
750
|
type: "string"
|
|
751
751
|
}).option("format", {
|
|
@@ -820,10 +820,10 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
820
820
|
var ComponentPushModule = {
|
|
821
821
|
command: "push <directory>",
|
|
822
822
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
823
|
-
builder: (
|
|
823
|
+
builder: (yargs20) => withApiOptions(
|
|
824
824
|
withProjectOptions(
|
|
825
825
|
withDiffOptions(
|
|
826
|
-
|
|
826
|
+
yargs20.positional("directory", {
|
|
827
827
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
828
828
|
type: "string"
|
|
829
829
|
}).option("what-if", {
|
|
@@ -887,9 +887,9 @@ var ComponentRemoveModule = {
|
|
|
887
887
|
command: "remove <id>",
|
|
888
888
|
aliases: ["delete", "rm"],
|
|
889
889
|
describe: "Delete a component definition",
|
|
890
|
-
builder: (
|
|
890
|
+
builder: (yargs20) => withApiOptions(
|
|
891
891
|
withProjectOptions(
|
|
892
|
-
|
|
892
|
+
yargs20.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
893
893
|
)
|
|
894
894
|
),
|
|
895
895
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -905,9 +905,9 @@ var ComponentUpdateModule = {
|
|
|
905
905
|
command: "update <filename>",
|
|
906
906
|
aliases: ["put"],
|
|
907
907
|
describe: "Insert or update a component definition",
|
|
908
|
-
builder: (
|
|
908
|
+
builder: (yargs20) => withApiOptions(
|
|
909
909
|
withProjectOptions(
|
|
910
|
-
|
|
910
|
+
yargs20.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
911
911
|
)
|
|
912
912
|
),
|
|
913
913
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -923,7 +923,7 @@ var ComponentModule = {
|
|
|
923
923
|
command: "component <command>",
|
|
924
924
|
aliases: ["def"],
|
|
925
925
|
describe: "Commands for Canvas component definitions",
|
|
926
|
-
builder: (
|
|
926
|
+
builder: (yargs20) => yargs20.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
927
927
|
handler: () => {
|
|
928
928
|
yargs.help();
|
|
929
929
|
}
|
|
@@ -937,11 +937,11 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
937
937
|
var CompositionGetModule = {
|
|
938
938
|
command: "get <id>",
|
|
939
939
|
describe: "Fetch a composition",
|
|
940
|
-
builder: (
|
|
940
|
+
builder: (yargs20) => withFormatOptions(
|
|
941
941
|
withApiOptions(
|
|
942
942
|
withProjectOptions(
|
|
943
943
|
withStateOptions(
|
|
944
|
-
|
|
944
|
+
yargs20.positional("id", { demandOption: true, describe: "Composition public ID to fetch" }).option({
|
|
945
945
|
resolvePatterns: {
|
|
946
946
|
type: "boolean",
|
|
947
947
|
default: false,
|
|
@@ -1011,11 +1011,11 @@ var CompositionListModule = {
|
|
|
1011
1011
|
command: "list",
|
|
1012
1012
|
describe: "List compositions",
|
|
1013
1013
|
aliases: ["ls"],
|
|
1014
|
-
builder: (
|
|
1014
|
+
builder: (yargs20) => withFormatOptions(
|
|
1015
1015
|
withApiOptions(
|
|
1016
1016
|
withProjectOptions(
|
|
1017
1017
|
withStateOptions(
|
|
1018
|
-
|
|
1018
|
+
yargs20.options({
|
|
1019
1019
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1020
1020
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1021
1021
|
resolvePatterns: {
|
|
@@ -1119,10 +1119,10 @@ function createComponentInstanceEngineDataSource({
|
|
|
1119
1119
|
var CompositionPublishModule = {
|
|
1120
1120
|
command: "publish [compositionIDs]",
|
|
1121
1121
|
describe: "Publishes compositions",
|
|
1122
|
-
builder: (
|
|
1122
|
+
builder: (yargs20) => withApiOptions(
|
|
1123
1123
|
withProjectOptions(
|
|
1124
1124
|
withDiffOptions(
|
|
1125
|
-
|
|
1125
|
+
yargs20.positional("compositionIDs", {
|
|
1126
1126
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1127
1127
|
type: "string"
|
|
1128
1128
|
}).option("all", {
|
|
@@ -1181,11 +1181,11 @@ import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canv
|
|
|
1181
1181
|
var CompositionPullModule = {
|
|
1182
1182
|
command: "pull <directory>",
|
|
1183
1183
|
describe: "Pulls all compositions to local files in a directory",
|
|
1184
|
-
builder: (
|
|
1184
|
+
builder: (yargs20) => withApiOptions(
|
|
1185
1185
|
withProjectOptions(
|
|
1186
1186
|
withStateOptions(
|
|
1187
1187
|
withDiffOptions(
|
|
1188
|
-
|
|
1188
|
+
yargs20.positional("directory", {
|
|
1189
1189
|
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.",
|
|
1190
1190
|
type: "string"
|
|
1191
1191
|
}).option("format", {
|
|
@@ -1261,11 +1261,11 @@ import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canv
|
|
|
1261
1261
|
var CompositionPushModule = {
|
|
1262
1262
|
command: "push <directory>",
|
|
1263
1263
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
1264
|
-
builder: (
|
|
1264
|
+
builder: (yargs20) => withApiOptions(
|
|
1265
1265
|
withProjectOptions(
|
|
1266
1266
|
withStateOptions(
|
|
1267
1267
|
withDiffOptions(
|
|
1268
|
-
|
|
1268
|
+
yargs20.positional("directory", {
|
|
1269
1269
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1270
1270
|
type: "string"
|
|
1271
1271
|
}).option("what-if", {
|
|
@@ -1330,9 +1330,9 @@ var CompositionRemoveModule = {
|
|
|
1330
1330
|
command: "remove <id>",
|
|
1331
1331
|
aliases: ["delete", "rm"],
|
|
1332
1332
|
describe: "Delete a composition",
|
|
1333
|
-
builder: (
|
|
1333
|
+
builder: (yargs20) => withApiOptions(
|
|
1334
1334
|
withProjectOptions(
|
|
1335
|
-
|
|
1335
|
+
yargs20.positional("id", { demandOption: true, describe: "Composition public ID to delete" })
|
|
1336
1336
|
)
|
|
1337
1337
|
),
|
|
1338
1338
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1347,9 +1347,9 @@ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient
|
|
|
1347
1347
|
var CompositionUnpublishModule = {
|
|
1348
1348
|
command: "unpublish <id>",
|
|
1349
1349
|
describe: "Unpublish a composition",
|
|
1350
|
-
builder: (
|
|
1350
|
+
builder: (yargs20) => withApiOptions(
|
|
1351
1351
|
withProjectOptions(
|
|
1352
|
-
|
|
1352
|
+
yargs20.positional("id", { demandOption: true, describe: "Composition public ID to unpublish" })
|
|
1353
1353
|
)
|
|
1354
1354
|
),
|
|
1355
1355
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1365,10 +1365,10 @@ var CompositionUpdateModule = {
|
|
|
1365
1365
|
command: "update <filename>",
|
|
1366
1366
|
aliases: ["put"],
|
|
1367
1367
|
describe: "Insert or update a composition",
|
|
1368
|
-
builder: (
|
|
1368
|
+
builder: (yargs20) => withApiOptions(
|
|
1369
1369
|
withProjectOptions(
|
|
1370
1370
|
withStateOptions(
|
|
1371
|
-
|
|
1371
|
+
yargs20.positional("filename", { demandOption: true, describe: "Composition file to put" })
|
|
1372
1372
|
)
|
|
1373
1373
|
)
|
|
1374
1374
|
),
|
|
@@ -1385,7 +1385,7 @@ var CompositionModule = {
|
|
|
1385
1385
|
command: "composition <command>",
|
|
1386
1386
|
describe: "Commands for Canvas compositions",
|
|
1387
1387
|
aliases: ["comp"],
|
|
1388
|
-
builder: (
|
|
1388
|
+
builder: (yargs20) => yargs20.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
1389
1389
|
handler: () => {
|
|
1390
1390
|
yargs2.help();
|
|
1391
1391
|
}
|
|
@@ -1400,11 +1400,11 @@ var DataTypeGetModule = {
|
|
|
1400
1400
|
command: "get <id>",
|
|
1401
1401
|
describe: "Get a data type",
|
|
1402
1402
|
aliases: ["ls"],
|
|
1403
|
-
builder: (
|
|
1403
|
+
builder: (yargs20) => withFormatOptions(
|
|
1404
1404
|
withApiOptions(
|
|
1405
1405
|
withProjectOptions(
|
|
1406
1406
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1407
|
-
|
|
1407
|
+
yargs20.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
1408
1408
|
)
|
|
1409
1409
|
)
|
|
1410
1410
|
),
|
|
@@ -1426,7 +1426,7 @@ var DataTypeListModule = {
|
|
|
1426
1426
|
command: "list",
|
|
1427
1427
|
describe: "List data types",
|
|
1428
1428
|
aliases: ["ls"],
|
|
1429
|
-
builder: (
|
|
1429
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
1430
1430
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1431
1431
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1432
1432
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -1475,10 +1475,10 @@ function createDataTypeEngineDataSource({
|
|
|
1475
1475
|
var DataTypePullModule = {
|
|
1476
1476
|
command: "pull <directory>",
|
|
1477
1477
|
describe: "Pulls all data types to local files in a directory",
|
|
1478
|
-
builder: (
|
|
1478
|
+
builder: (yargs20) => withApiOptions(
|
|
1479
1479
|
withProjectOptions(
|
|
1480
1480
|
withDiffOptions(
|
|
1481
|
-
|
|
1481
|
+
yargs20.positional("directory", {
|
|
1482
1482
|
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.",
|
|
1483
1483
|
type: "string"
|
|
1484
1484
|
}).option("format", {
|
|
@@ -1559,10 +1559,10 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
1559
1559
|
var DataTypePushModule = {
|
|
1560
1560
|
command: "push <directory>",
|
|
1561
1561
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
1562
|
-
builder: (
|
|
1562
|
+
builder: (yargs20) => withApiOptions(
|
|
1563
1563
|
withProjectOptions(
|
|
1564
1564
|
withDiffOptions(
|
|
1565
|
-
|
|
1565
|
+
yargs20.positional("directory", {
|
|
1566
1566
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
1567
1567
|
type: "string"
|
|
1568
1568
|
}).option("what-if", {
|
|
@@ -1632,9 +1632,9 @@ var DataTypeRemoveModule = {
|
|
|
1632
1632
|
command: "remove <id>",
|
|
1633
1633
|
aliases: ["delete", "rm"],
|
|
1634
1634
|
describe: "Delete a data type",
|
|
1635
|
-
builder: (
|
|
1635
|
+
builder: (yargs20) => withApiOptions(
|
|
1636
1636
|
withProjectOptions(
|
|
1637
|
-
|
|
1637
|
+
yargs20.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
1638
1638
|
)
|
|
1639
1639
|
),
|
|
1640
1640
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1650,9 +1650,9 @@ var DataTypeUpdateModule = {
|
|
|
1650
1650
|
command: "update <filename>",
|
|
1651
1651
|
aliases: ["put"],
|
|
1652
1652
|
describe: "Insert or update a data type",
|
|
1653
|
-
builder: (
|
|
1653
|
+
builder: (yargs20) => withApiOptions(
|
|
1654
1654
|
withProjectOptions(
|
|
1655
|
-
|
|
1655
|
+
yargs20.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
1656
1656
|
)
|
|
1657
1657
|
),
|
|
1658
1658
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -1668,7 +1668,7 @@ var DataTypeModule = {
|
|
|
1668
1668
|
command: "datatype <command>",
|
|
1669
1669
|
aliases: ["dt"],
|
|
1670
1670
|
describe: "Commands for Data Type definitions",
|
|
1671
|
-
builder: (
|
|
1671
|
+
builder: (yargs20) => yargs20.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
1672
1672
|
handler: () => {
|
|
1673
1673
|
yargs3.help();
|
|
1674
1674
|
}
|
|
@@ -1679,7 +1679,7 @@ var CanvasCommand = {
|
|
|
1679
1679
|
command: "canvas <command>",
|
|
1680
1680
|
aliases: ["cv", "pm", "presentation"],
|
|
1681
1681
|
describe: "Uniform Canvas commands",
|
|
1682
|
-
builder: (
|
|
1682
|
+
builder: (yargs20) => yargs20.command(CompositionModule).command(ComponentModule).command(DataTypeModule).demandCommand(),
|
|
1683
1683
|
handler: () => {
|
|
1684
1684
|
yargs4.showHelp();
|
|
1685
1685
|
}
|
|
@@ -1696,10 +1696,10 @@ import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
|
1696
1696
|
var AggregateGetModule = {
|
|
1697
1697
|
command: "get <id>",
|
|
1698
1698
|
describe: "Fetch an aggregate",
|
|
1699
|
-
builder: (
|
|
1699
|
+
builder: (yargs20) => withFormatOptions(
|
|
1700
1700
|
withApiOptions(
|
|
1701
1701
|
withProjectOptions(
|
|
1702
|
-
|
|
1702
|
+
yargs20.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
1703
1703
|
)
|
|
1704
1704
|
)
|
|
1705
1705
|
),
|
|
@@ -1722,7 +1722,7 @@ var AggregateListModule = {
|
|
|
1722
1722
|
command: "list",
|
|
1723
1723
|
describe: "List aggregates",
|
|
1724
1724
|
aliases: ["ls"],
|
|
1725
|
-
builder: (
|
|
1725
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
1726
1726
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1727
1727
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1728
1728
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1791,10 +1791,10 @@ var limitPolicy2 = pLimit(8);
|
|
|
1791
1791
|
var AggregatePullModule = {
|
|
1792
1792
|
command: "pull <directory>",
|
|
1793
1793
|
describe: "Pulls all aggregates to local files in a directory",
|
|
1794
|
-
builder: (
|
|
1794
|
+
builder: (yargs20) => withApiOptions(
|
|
1795
1795
|
withProjectOptions(
|
|
1796
1796
|
withDiffOptions(
|
|
1797
|
-
|
|
1797
|
+
yargs20.positional("directory", {
|
|
1798
1798
|
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.",
|
|
1799
1799
|
type: "string"
|
|
1800
1800
|
}).option("format", {
|
|
@@ -1868,10 +1868,10 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
1868
1868
|
var AggregatePushModule = {
|
|
1869
1869
|
command: "push <directory>",
|
|
1870
1870
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
1871
|
-
builder: (
|
|
1871
|
+
builder: (yargs20) => withApiOptions(
|
|
1872
1872
|
withProjectOptions(
|
|
1873
1873
|
withDiffOptions(
|
|
1874
|
-
|
|
1874
|
+
yargs20.positional("directory", {
|
|
1875
1875
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
1876
1876
|
type: "string"
|
|
1877
1877
|
}).option("what-if", {
|
|
@@ -1935,9 +1935,9 @@ var AggregateRemoveModule = {
|
|
|
1935
1935
|
command: "remove <id>",
|
|
1936
1936
|
aliases: ["delete", "rm"],
|
|
1937
1937
|
describe: "Delete an aggregate",
|
|
1938
|
-
builder: (
|
|
1938
|
+
builder: (yargs20) => withApiOptions(
|
|
1939
1939
|
withProjectOptions(
|
|
1940
|
-
|
|
1940
|
+
yargs20.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
1941
1941
|
)
|
|
1942
1942
|
),
|
|
1943
1943
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1953,9 +1953,9 @@ var AggregateUpdateModule = {
|
|
|
1953
1953
|
command: "update <filename>",
|
|
1954
1954
|
aliases: ["put"],
|
|
1955
1955
|
describe: "Insert or update an aggregate",
|
|
1956
|
-
builder: (
|
|
1956
|
+
builder: (yargs20) => withApiOptions(
|
|
1957
1957
|
withProjectOptions(
|
|
1958
|
-
|
|
1958
|
+
yargs20.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
1959
1959
|
)
|
|
1960
1960
|
),
|
|
1961
1961
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -1971,7 +1971,7 @@ var AggregateModule = {
|
|
|
1971
1971
|
command: "aggregate <command>",
|
|
1972
1972
|
aliases: ["agg", "intent", "audience"],
|
|
1973
1973
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
1974
|
-
builder: (
|
|
1974
|
+
builder: (yargs20) => yargs20.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
1975
1975
|
handler: () => {
|
|
1976
1976
|
yargs5.help();
|
|
1977
1977
|
}
|
|
@@ -1985,10 +1985,10 @@ import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
|
1985
1985
|
var EnrichmentGetModule = {
|
|
1986
1986
|
command: "get <id>",
|
|
1987
1987
|
describe: "Fetch an enrichment category and its values",
|
|
1988
|
-
builder: (
|
|
1988
|
+
builder: (yargs20) => withFormatOptions(
|
|
1989
1989
|
withApiOptions(
|
|
1990
1990
|
withProjectOptions(
|
|
1991
|
-
|
|
1991
|
+
yargs20.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
1992
1992
|
)
|
|
1993
1993
|
)
|
|
1994
1994
|
),
|
|
@@ -2012,7 +2012,7 @@ var EnrichmentListModule = {
|
|
|
2012
2012
|
command: "list",
|
|
2013
2013
|
describe: "List enrichments",
|
|
2014
2014
|
aliases: ["ls"],
|
|
2015
|
-
builder: (
|
|
2015
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
2016
2016
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2017
2017
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2018
2018
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2113,10 +2113,10 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
2113
2113
|
var EnrichmentPullModule = {
|
|
2114
2114
|
command: "pull <directory>",
|
|
2115
2115
|
describe: "Pulls all enrichments to local files in a directory",
|
|
2116
|
-
builder: (
|
|
2116
|
+
builder: (yargs20) => withApiOptions(
|
|
2117
2117
|
withProjectOptions(
|
|
2118
2118
|
withDiffOptions(
|
|
2119
|
-
|
|
2119
|
+
yargs20.positional("directory", {
|
|
2120
2120
|
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.",
|
|
2121
2121
|
type: "string"
|
|
2122
2122
|
}).option("format", {
|
|
@@ -2190,10 +2190,10 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
2190
2190
|
var EnrichmentPushModule = {
|
|
2191
2191
|
command: "push <directory>",
|
|
2192
2192
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
2193
|
-
builder: (
|
|
2193
|
+
builder: (yargs20) => withApiOptions(
|
|
2194
2194
|
withProjectOptions(
|
|
2195
2195
|
withDiffOptions(
|
|
2196
|
-
|
|
2196
|
+
yargs20.positional("directory", {
|
|
2197
2197
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
2198
2198
|
type: "string"
|
|
2199
2199
|
}).option("what-if", {
|
|
@@ -2256,9 +2256,9 @@ var EnrichmentRemoveModule = {
|
|
|
2256
2256
|
command: "remove <id>",
|
|
2257
2257
|
aliases: ["delete", "rm"],
|
|
2258
2258
|
describe: "Delete an enrichment category and its values",
|
|
2259
|
-
builder: (
|
|
2259
|
+
builder: (yargs20) => withApiOptions(
|
|
2260
2260
|
withProjectOptions(
|
|
2261
|
-
|
|
2261
|
+
yargs20.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
2262
2262
|
)
|
|
2263
2263
|
),
|
|
2264
2264
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2273,7 +2273,7 @@ var EnrichmentModule = {
|
|
|
2273
2273
|
command: "enrichment <command>",
|
|
2274
2274
|
aliases: ["enr"],
|
|
2275
2275
|
describe: "Commands for Context enrichments",
|
|
2276
|
-
builder: (
|
|
2276
|
+
builder: (yargs20) => yargs20.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
2277
2277
|
handler: () => {
|
|
2278
2278
|
yargs6.help();
|
|
2279
2279
|
}
|
|
@@ -2291,9 +2291,9 @@ var ManifestGetModule = {
|
|
|
2291
2291
|
command: "get [output]",
|
|
2292
2292
|
aliases: ["dl", "download"],
|
|
2293
2293
|
describe: "Download the Uniform Context manifest for a project",
|
|
2294
|
-
builder: (
|
|
2294
|
+
builder: (yargs20) => withApiOptions(
|
|
2295
2295
|
withProjectOptions(
|
|
2296
|
-
|
|
2296
|
+
yargs20.option("preview", {
|
|
2297
2297
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
2298
2298
|
default: false,
|
|
2299
2299
|
type: "boolean",
|
|
@@ -2354,7 +2354,7 @@ import { exit as exit2 } from "process";
|
|
|
2354
2354
|
var ManifestPublishModule = {
|
|
2355
2355
|
command: "publish",
|
|
2356
2356
|
describe: "Publish the Uniform Context manifest for a project",
|
|
2357
|
-
builder: (
|
|
2357
|
+
builder: (yargs20) => withApiOptions(withProjectOptions(yargs20)),
|
|
2358
2358
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
2359
2359
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2360
2360
|
try {
|
|
@@ -2387,7 +2387,7 @@ var ManifestModule = {
|
|
|
2387
2387
|
command: "manifest <command>",
|
|
2388
2388
|
describe: "Commands for context manifests",
|
|
2389
2389
|
aliases: ["man"],
|
|
2390
|
-
builder: (
|
|
2390
|
+
builder: (yargs20) => yargs20.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
2391
2391
|
handler: () => {
|
|
2392
2392
|
yargs7.help();
|
|
2393
2393
|
}
|
|
@@ -2401,10 +2401,10 @@ import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
|
2401
2401
|
var QuirkGetModule = {
|
|
2402
2402
|
command: "get <id>",
|
|
2403
2403
|
describe: "Fetch a quirk",
|
|
2404
|
-
builder: (
|
|
2404
|
+
builder: (yargs20) => withFormatOptions(
|
|
2405
2405
|
withApiOptions(
|
|
2406
2406
|
withProjectOptions(
|
|
2407
|
-
|
|
2407
|
+
yargs20.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
2408
2408
|
)
|
|
2409
2409
|
)
|
|
2410
2410
|
),
|
|
@@ -2427,10 +2427,10 @@ var QuirkListModule = {
|
|
|
2427
2427
|
command: "list",
|
|
2428
2428
|
describe: "List quirks",
|
|
2429
2429
|
aliases: ["ls"],
|
|
2430
|
-
builder: (
|
|
2430
|
+
builder: (yargs20) => withFormatOptions(
|
|
2431
2431
|
withApiOptions(
|
|
2432
2432
|
withProjectOptions(
|
|
2433
|
-
|
|
2433
|
+
yargs20.option("withIntegrations", {
|
|
2434
2434
|
alias: ["i"],
|
|
2435
2435
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
2436
2436
|
type: "boolean"
|
|
@@ -2486,10 +2486,10 @@ function createQuirkEngineDataSource({
|
|
|
2486
2486
|
var QuirkPullModule = {
|
|
2487
2487
|
command: "pull <directory>",
|
|
2488
2488
|
describe: "Pulls all quirks to local files in a directory",
|
|
2489
|
-
builder: (
|
|
2489
|
+
builder: (yargs20) => withApiOptions(
|
|
2490
2490
|
withProjectOptions(
|
|
2491
2491
|
withDiffOptions(
|
|
2492
|
-
|
|
2492
|
+
yargs20.positional("directory", {
|
|
2493
2493
|
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.",
|
|
2494
2494
|
type: "string"
|
|
2495
2495
|
}).option("format", {
|
|
@@ -2563,10 +2563,10 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
2563
2563
|
var QuirkPushModule = {
|
|
2564
2564
|
command: "push <directory>",
|
|
2565
2565
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
2566
|
-
builder: (
|
|
2566
|
+
builder: (yargs20) => withApiOptions(
|
|
2567
2567
|
withProjectOptions(
|
|
2568
2568
|
withDiffOptions(
|
|
2569
|
-
|
|
2569
|
+
yargs20.positional("directory", {
|
|
2570
2570
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
2571
2571
|
type: "string"
|
|
2572
2572
|
}).option("what-if", {
|
|
@@ -2629,9 +2629,9 @@ var QuirkRemoveModule = {
|
|
|
2629
2629
|
command: "remove <id>",
|
|
2630
2630
|
aliases: ["delete", "rm"],
|
|
2631
2631
|
describe: "Delete a quirk",
|
|
2632
|
-
builder: (
|
|
2632
|
+
builder: (yargs20) => withApiOptions(
|
|
2633
2633
|
withProjectOptions(
|
|
2634
|
-
|
|
2634
|
+
yargs20.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
2635
2635
|
)
|
|
2636
2636
|
),
|
|
2637
2637
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2647,8 +2647,8 @@ var QuirkUpdateModule = {
|
|
|
2647
2647
|
command: "update <filename>",
|
|
2648
2648
|
aliases: ["put"],
|
|
2649
2649
|
describe: "Insert or update a quirk",
|
|
2650
|
-
builder: (
|
|
2651
|
-
withProjectOptions(
|
|
2650
|
+
builder: (yargs20) => withApiOptions(
|
|
2651
|
+
withProjectOptions(yargs20.positional("filename", { demandOption: true, describe: "Quirk file to put" }))
|
|
2652
2652
|
),
|
|
2653
2653
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2654
2654
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -2663,7 +2663,7 @@ var QuirkModule = {
|
|
|
2663
2663
|
command: "quirk <command>",
|
|
2664
2664
|
aliases: ["qk"],
|
|
2665
2665
|
describe: "Commands for Context quirks",
|
|
2666
|
-
builder: (
|
|
2666
|
+
builder: (yargs20) => yargs20.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
2667
2667
|
handler: () => {
|
|
2668
2668
|
yargs8.help();
|
|
2669
2669
|
}
|
|
@@ -2677,10 +2677,10 @@ import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
|
2677
2677
|
var SignalGetModule = {
|
|
2678
2678
|
command: "get <id>",
|
|
2679
2679
|
describe: "Fetch a signal",
|
|
2680
|
-
builder: (
|
|
2680
|
+
builder: (yargs20) => withFormatOptions(
|
|
2681
2681
|
withApiOptions(
|
|
2682
2682
|
withProjectOptions(
|
|
2683
|
-
|
|
2683
|
+
yargs20.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
2684
2684
|
)
|
|
2685
2685
|
)
|
|
2686
2686
|
),
|
|
@@ -2703,7 +2703,7 @@ var SignalListModule = {
|
|
|
2703
2703
|
command: "list",
|
|
2704
2704
|
describe: "List signals",
|
|
2705
2705
|
aliases: ["ls"],
|
|
2706
|
-
builder: (
|
|
2706
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
2707
2707
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2708
2708
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2709
2709
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2752,10 +2752,10 @@ function createSignalEngineDataSource({
|
|
|
2752
2752
|
var SignalPullModule = {
|
|
2753
2753
|
command: "pull <directory>",
|
|
2754
2754
|
describe: "Pulls all signals to local files in a directory",
|
|
2755
|
-
builder: (
|
|
2755
|
+
builder: (yargs20) => withApiOptions(
|
|
2756
2756
|
withProjectOptions(
|
|
2757
2757
|
withDiffOptions(
|
|
2758
|
-
|
|
2758
|
+
yargs20.positional("directory", {
|
|
2759
2759
|
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.",
|
|
2760
2760
|
type: "string"
|
|
2761
2761
|
}).option("format", {
|
|
@@ -2829,10 +2829,10 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
2829
2829
|
var SignalPushModule = {
|
|
2830
2830
|
command: "push <directory>",
|
|
2831
2831
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
2832
|
-
builder: (
|
|
2832
|
+
builder: (yargs20) => withApiOptions(
|
|
2833
2833
|
withProjectOptions(
|
|
2834
2834
|
withDiffOptions(
|
|
2835
|
-
|
|
2835
|
+
yargs20.positional("directory", {
|
|
2836
2836
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
2837
2837
|
type: "string"
|
|
2838
2838
|
}).option("what-if", {
|
|
@@ -2895,9 +2895,9 @@ var SignalRemoveModule = {
|
|
|
2895
2895
|
command: "remove <id>",
|
|
2896
2896
|
aliases: ["delete", "rm"],
|
|
2897
2897
|
describe: "Delete a signal",
|
|
2898
|
-
builder: (
|
|
2898
|
+
builder: (yargs20) => withApiOptions(
|
|
2899
2899
|
withProjectOptions(
|
|
2900
|
-
|
|
2900
|
+
yargs20.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
2901
2901
|
)
|
|
2902
2902
|
),
|
|
2903
2903
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2913,8 +2913,8 @@ var SignalUpdateModule = {
|
|
|
2913
2913
|
command: "update <filename>",
|
|
2914
2914
|
aliases: ["put"],
|
|
2915
2915
|
describe: "Insert or update a signal",
|
|
2916
|
-
builder: (
|
|
2917
|
-
withProjectOptions(
|
|
2916
|
+
builder: (yargs20) => withApiOptions(
|
|
2917
|
+
withProjectOptions(yargs20.positional("filename", { demandOption: true, describe: "Signal file to put" }))
|
|
2918
2918
|
),
|
|
2919
2919
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2920
2920
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -2929,7 +2929,7 @@ var SignalModule = {
|
|
|
2929
2929
|
command: "signal <command>",
|
|
2930
2930
|
aliases: ["sig"],
|
|
2931
2931
|
describe: "Commands for Context signals",
|
|
2932
|
-
builder: (
|
|
2932
|
+
builder: (yargs20) => yargs20.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
2933
2933
|
handler: () => {
|
|
2934
2934
|
yargs9.help();
|
|
2935
2935
|
}
|
|
@@ -2943,10 +2943,10 @@ import { UncachedTestClient } from "@uniformdev/context/api";
|
|
|
2943
2943
|
var TestGetModule = {
|
|
2944
2944
|
command: "get <id>",
|
|
2945
2945
|
describe: "Fetch a test",
|
|
2946
|
-
builder: (
|
|
2946
|
+
builder: (yargs20) => withFormatOptions(
|
|
2947
2947
|
withApiOptions(
|
|
2948
2948
|
withProjectOptions(
|
|
2949
|
-
|
|
2949
|
+
yargs20.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
2950
2950
|
)
|
|
2951
2951
|
)
|
|
2952
2952
|
),
|
|
@@ -2969,7 +2969,7 @@ var TestListModule = {
|
|
|
2969
2969
|
command: "list",
|
|
2970
2970
|
describe: "List tests",
|
|
2971
2971
|
aliases: ["ls"],
|
|
2972
|
-
builder: (
|
|
2972
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
2973
2973
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2974
2974
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2975
2975
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3018,10 +3018,10 @@ function createTestEngineDataSource({
|
|
|
3018
3018
|
var TestPullModule = {
|
|
3019
3019
|
command: "pull <directory>",
|
|
3020
3020
|
describe: "Pulls all tests to local files in a directory",
|
|
3021
|
-
builder: (
|
|
3021
|
+
builder: (yargs20) => withApiOptions(
|
|
3022
3022
|
withProjectOptions(
|
|
3023
3023
|
withDiffOptions(
|
|
3024
|
-
|
|
3024
|
+
yargs20.positional("directory", {
|
|
3025
3025
|
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.",
|
|
3026
3026
|
type: "string"
|
|
3027
3027
|
}).option("format", {
|
|
@@ -3095,10 +3095,10 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
3095
3095
|
var TestPushModule = {
|
|
3096
3096
|
command: "push <directory>",
|
|
3097
3097
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
3098
|
-
builder: (
|
|
3098
|
+
builder: (yargs20) => withApiOptions(
|
|
3099
3099
|
withProjectOptions(
|
|
3100
3100
|
withDiffOptions(
|
|
3101
|
-
|
|
3101
|
+
yargs20.positional("directory", {
|
|
3102
3102
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
3103
3103
|
type: "string"
|
|
3104
3104
|
}).option("what-if", {
|
|
@@ -3161,8 +3161,8 @@ var TestRemoveModule = {
|
|
|
3161
3161
|
command: "remove <id>",
|
|
3162
3162
|
aliases: ["delete", "rm"],
|
|
3163
3163
|
describe: "Delete a test",
|
|
3164
|
-
builder: (
|
|
3165
|
-
withProjectOptions(
|
|
3164
|
+
builder: (yargs20) => withApiOptions(
|
|
3165
|
+
withProjectOptions(yargs20.positional("id", { demandOption: true, describe: "Test public ID to delete" }))
|
|
3166
3166
|
),
|
|
3167
3167
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
3168
3168
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3177,8 +3177,8 @@ var TestUpdateModule = {
|
|
|
3177
3177
|
command: "update <filename>",
|
|
3178
3178
|
aliases: ["put"],
|
|
3179
3179
|
describe: "Insert or update a test",
|
|
3180
|
-
builder: (
|
|
3181
|
-
withProjectOptions(
|
|
3180
|
+
builder: (yargs20) => withApiOptions(
|
|
3181
|
+
withProjectOptions(yargs20.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
3182
3182
|
),
|
|
3183
3183
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
3184
3184
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3192,7 +3192,7 @@ var TestUpdateModule = {
|
|
|
3192
3192
|
var TestModule = {
|
|
3193
3193
|
command: "test <command>",
|
|
3194
3194
|
describe: "Commands for Context A/B tests",
|
|
3195
|
-
builder: (
|
|
3195
|
+
builder: (yargs20) => yargs20.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
3196
3196
|
handler: () => {
|
|
3197
3197
|
yargs10.help();
|
|
3198
3198
|
}
|
|
@@ -3203,7 +3203,7 @@ var ContextCommand = {
|
|
|
3203
3203
|
command: "context <command>",
|
|
3204
3204
|
aliases: ["ctx"],
|
|
3205
3205
|
describe: "Uniform Context commands",
|
|
3206
|
-
builder: (
|
|
3206
|
+
builder: (yargs20) => yargs20.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
3207
3207
|
handler: () => {
|
|
3208
3208
|
yargs11.showHelp();
|
|
3209
3209
|
}
|
|
@@ -3233,7 +3233,7 @@ import { PostHog } from "posthog-node";
|
|
|
3233
3233
|
// package.json
|
|
3234
3234
|
var package_default = {
|
|
3235
3235
|
name: "@uniformdev/cli",
|
|
3236
|
-
version: "19.
|
|
3236
|
+
version: "19.3.0",
|
|
3237
3237
|
description: "Uniform command line interface tool",
|
|
3238
3238
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
3239
3239
|
main: "./cli.js",
|
|
@@ -3261,7 +3261,7 @@ var package_default = {
|
|
|
3261
3261
|
graphql: "16.6.0",
|
|
3262
3262
|
"graphql-request": "6.0.0",
|
|
3263
3263
|
"https-proxy-agent": "^5.0.1",
|
|
3264
|
-
inquirer: "9.
|
|
3264
|
+
inquirer: "9.2.0",
|
|
3265
3265
|
"isomorphic-git": "1.21.0",
|
|
3266
3266
|
"isomorphic-unfetch": "^3.1.0",
|
|
3267
3267
|
"js-yaml": "^4.1.0",
|
|
@@ -3269,7 +3269,7 @@ var package_default = {
|
|
|
3269
3269
|
"lodash.isequalwith": "^4.4.0",
|
|
3270
3270
|
open: "9.1.0",
|
|
3271
3271
|
ora: "6.3.0",
|
|
3272
|
-
"posthog-node": "
|
|
3272
|
+
"posthog-node": "3.1.1",
|
|
3273
3273
|
slugify: "1.6.6",
|
|
3274
3274
|
yargs: "^17.6.2",
|
|
3275
3275
|
zod: "3.21.4"
|
|
@@ -3278,9 +3278,9 @@ var package_default = {
|
|
|
3278
3278
|
"@types/diff": "5.0.3",
|
|
3279
3279
|
"@types/inquirer": "9.0.3",
|
|
3280
3280
|
"@types/js-yaml": "4.0.5",
|
|
3281
|
-
"@types/jsonwebtoken": "9.0.
|
|
3281
|
+
"@types/jsonwebtoken": "9.0.2",
|
|
3282
3282
|
"@types/lodash.isequalwith": "4.4.7",
|
|
3283
|
-
"@types/node": "18.
|
|
3283
|
+
"@types/node": "18.16.1",
|
|
3284
3284
|
"@types/yargs": "17.0.24",
|
|
3285
3285
|
"p-limit": "4.0.0"
|
|
3286
3286
|
},
|
|
@@ -3937,6 +3937,15 @@ async function newHandler({
|
|
|
3937
3937
|
installEnv: []
|
|
3938
3938
|
}
|
|
3939
3939
|
},
|
|
3940
|
+
csk: {
|
|
3941
|
+
name: "Component Starter Kit *New*",
|
|
3942
|
+
value: {
|
|
3943
|
+
githubUri: "uniformdev/uniform-component-starter-kit",
|
|
3944
|
+
serverUrl: "http://localhost:3000",
|
|
3945
|
+
previewPath: "/api/preview?secret=hello-world",
|
|
3946
|
+
installEnv: [["UNIFORM_PREVIEW_SECRET", "hello-world"]]
|
|
3947
|
+
}
|
|
3948
|
+
},
|
|
3940
3949
|
uniformconf: {
|
|
3941
3950
|
name: "Marketing Site Starter",
|
|
3942
3951
|
value: {
|
|
@@ -4278,7 +4287,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
4278
4287
|
var module = {
|
|
4279
4288
|
command: "download [output]",
|
|
4280
4289
|
describe: "Download intent manifest",
|
|
4281
|
-
builder: (
|
|
4290
|
+
builder: (yargs20) => yargs20.option("apiKey", {
|
|
4282
4291
|
alias: "k",
|
|
4283
4292
|
demandOption: true,
|
|
4284
4293
|
string: true,
|
|
@@ -4411,10 +4420,10 @@ import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
|
4411
4420
|
var ProjectMapDefinitionGetModule = {
|
|
4412
4421
|
command: "get <id>",
|
|
4413
4422
|
describe: "Fetch a project map",
|
|
4414
|
-
builder: (
|
|
4423
|
+
builder: (yargs20) => withFormatOptions(
|
|
4415
4424
|
withApiOptions(
|
|
4416
4425
|
withProjectOptions(
|
|
4417
|
-
|
|
4426
|
+
yargs20.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
4418
4427
|
)
|
|
4419
4428
|
)
|
|
4420
4429
|
),
|
|
@@ -4437,7 +4446,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
4437
4446
|
command: "list",
|
|
4438
4447
|
describe: "List of project maps",
|
|
4439
4448
|
aliases: ["ls"],
|
|
4440
|
-
builder: (
|
|
4449
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
4441
4450
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4442
4451
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4443
4452
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4494,10 +4503,10 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
4494
4503
|
var ProjectMapDefinitionPullModule = {
|
|
4495
4504
|
command: "pull <directory>",
|
|
4496
4505
|
describe: "Pulls all project maps to local files in a directory",
|
|
4497
|
-
builder: (
|
|
4506
|
+
builder: (yargs20) => withApiOptions(
|
|
4498
4507
|
withProjectOptions(
|
|
4499
4508
|
withDiffOptions(
|
|
4500
|
-
|
|
4509
|
+
yargs20.positional("directory", {
|
|
4501
4510
|
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.",
|
|
4502
4511
|
type: "string"
|
|
4503
4512
|
}).option("format", {
|
|
@@ -4571,10 +4580,10 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
4571
4580
|
var ProjectMapDefinitionPushModule = {
|
|
4572
4581
|
command: "push <directory>",
|
|
4573
4582
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
4574
|
-
builder: (
|
|
4583
|
+
builder: (yargs20) => withApiOptions(
|
|
4575
4584
|
withProjectOptions(
|
|
4576
4585
|
withDiffOptions(
|
|
4577
|
-
|
|
4586
|
+
yargs20.positional("directory", {
|
|
4578
4587
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
4579
4588
|
type: "string"
|
|
4580
4589
|
}).option("what-if", {
|
|
@@ -4637,8 +4646,8 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
4637
4646
|
command: "remove <id>",
|
|
4638
4647
|
aliases: ["delete", "rm"],
|
|
4639
4648
|
describe: "Delete a project map",
|
|
4640
|
-
builder: (
|
|
4641
|
-
withProjectOptions(
|
|
4649
|
+
builder: (yargs20) => withApiOptions(
|
|
4650
|
+
withProjectOptions(yargs20.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
4642
4651
|
),
|
|
4643
4652
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
4644
4653
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4653,9 +4662,9 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4653
4662
|
command: "update <filename>",
|
|
4654
4663
|
aliases: ["put"],
|
|
4655
4664
|
describe: "Insert or update a project map",
|
|
4656
|
-
builder: (
|
|
4665
|
+
builder: (yargs20) => withApiOptions(
|
|
4657
4666
|
withProjectOptions(
|
|
4658
|
-
|
|
4667
|
+
yargs20.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
4659
4668
|
)
|
|
4660
4669
|
),
|
|
4661
4670
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -4670,7 +4679,7 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4670
4679
|
var ProjectMapDefinitionModule = {
|
|
4671
4680
|
command: "definition <command>",
|
|
4672
4681
|
describe: "Commands for ProjectMap Definitions",
|
|
4673
|
-
builder: (
|
|
4682
|
+
builder: (yargs20) => yargs20.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
4674
4683
|
handler: () => {
|
|
4675
4684
|
yargs14.help();
|
|
4676
4685
|
}
|
|
@@ -4684,10 +4693,10 @@ import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformd
|
|
|
4684
4693
|
var ProjectMapNodeGetModule = {
|
|
4685
4694
|
command: "get <id> <projectMapId>",
|
|
4686
4695
|
describe: "Fetch a project map node",
|
|
4687
|
-
builder: (
|
|
4696
|
+
builder: (yargs20) => withFormatOptions(
|
|
4688
4697
|
withApiOptions(
|
|
4689
4698
|
withProjectOptions(
|
|
4690
|
-
|
|
4699
|
+
yargs20.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
4691
4700
|
)
|
|
4692
4701
|
)
|
|
4693
4702
|
),
|
|
@@ -4712,10 +4721,10 @@ var ProjectMapNodeListModule = {
|
|
|
4712
4721
|
command: "list <projectMapId>",
|
|
4713
4722
|
describe: "List project map nodes",
|
|
4714
4723
|
aliases: ["ls"],
|
|
4715
|
-
builder: (
|
|
4724
|
+
builder: (yargs20) => withFormatOptions(
|
|
4716
4725
|
withApiOptions(
|
|
4717
4726
|
withProjectOptions(
|
|
4718
|
-
|
|
4727
|
+
yargs20.positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
4719
4728
|
)
|
|
4720
4729
|
)
|
|
4721
4730
|
),
|
|
@@ -4782,10 +4791,10 @@ function createProjectMapNodeEngineDataSource({
|
|
|
4782
4791
|
var ProjectMapNodePullModule = {
|
|
4783
4792
|
command: "pull <directory>",
|
|
4784
4793
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
4785
|
-
builder: (
|
|
4794
|
+
builder: (yargs20) => withApiOptions(
|
|
4786
4795
|
withProjectOptions(
|
|
4787
4796
|
withDiffOptions(
|
|
4788
|
-
|
|
4797
|
+
yargs20.positional("directory", {
|
|
4789
4798
|
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.",
|
|
4790
4799
|
type: "string"
|
|
4791
4800
|
}).option("format", {
|
|
@@ -4863,10 +4872,10 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
4863
4872
|
var ProjectMapNodePushModule = {
|
|
4864
4873
|
command: "push <directory>",
|
|
4865
4874
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
4866
|
-
builder: (
|
|
4875
|
+
builder: (yargs20) => withApiOptions(
|
|
4867
4876
|
withProjectOptions(
|
|
4868
4877
|
withDiffOptions(
|
|
4869
|
-
|
|
4878
|
+
yargs20.positional("directory", {
|
|
4870
4879
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
4871
4880
|
type: "string"
|
|
4872
4881
|
}).option("what-if", {
|
|
@@ -4938,9 +4947,9 @@ var ProjectMapNodeRemoveModule = {
|
|
|
4938
4947
|
command: "remove <id> <projectMapId>",
|
|
4939
4948
|
aliases: ["delete", "rm"],
|
|
4940
4949
|
describe: "Delete a project map node",
|
|
4941
|
-
builder: (
|
|
4950
|
+
builder: (yargs20) => withApiOptions(
|
|
4942
4951
|
withProjectOptions(
|
|
4943
|
-
|
|
4952
|
+
yargs20.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
4944
4953
|
)
|
|
4945
4954
|
),
|
|
4946
4955
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, id, project: projectId }) => {
|
|
@@ -4956,9 +4965,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
4956
4965
|
command: "update <filename> <projectMapId>",
|
|
4957
4966
|
aliases: ["put"],
|
|
4958
4967
|
describe: "Insert or update a project map node",
|
|
4959
|
-
builder: (
|
|
4968
|
+
builder: (yargs20) => withApiOptions(
|
|
4960
4969
|
withProjectOptions(
|
|
4961
|
-
|
|
4970
|
+
yargs20.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
4962
4971
|
)
|
|
4963
4972
|
),
|
|
4964
4973
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, filename, project: projectId }) => {
|
|
@@ -4973,7 +4982,7 @@ var ProjectMapNodeUpdateModule = {
|
|
|
4973
4982
|
var ProjectMapNodeModule = {
|
|
4974
4983
|
command: "node <command>",
|
|
4975
4984
|
describe: "Commands for ProjectMap Nodes",
|
|
4976
|
-
builder: (
|
|
4985
|
+
builder: (yargs20) => yargs20.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
4977
4986
|
handler: () => {
|
|
4978
4987
|
yargs15.help();
|
|
4979
4988
|
}
|
|
@@ -4984,13 +4993,303 @@ var ProjectMapCommand = {
|
|
|
4984
4993
|
command: "project-map <command>",
|
|
4985
4994
|
aliases: ["prm"],
|
|
4986
4995
|
describe: "Uniform ProjectMap commands",
|
|
4987
|
-
builder: (
|
|
4996
|
+
builder: (yargs20) => yargs20.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
4988
4997
|
handler: () => {
|
|
4989
4998
|
yargs16.showHelp();
|
|
4990
4999
|
}
|
|
4991
5000
|
};
|
|
4992
5001
|
|
|
5002
|
+
// src/commands/redirect/index.ts
|
|
5003
|
+
import yargs18 from "yargs";
|
|
5004
|
+
|
|
5005
|
+
// src/commands/redirect/commands/redirect.ts
|
|
5006
|
+
import yargs17 from "yargs";
|
|
5007
|
+
|
|
5008
|
+
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
5009
|
+
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
5010
|
+
var RedirectDefinitionGetModule = {
|
|
5011
|
+
command: "get <id>",
|
|
5012
|
+
describe: "Fetch a redirect",
|
|
5013
|
+
builder: (yargs20) => withFormatOptions(
|
|
5014
|
+
withApiOptions(
|
|
5015
|
+
withProjectOptions(yargs20.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" }))
|
|
5016
|
+
)
|
|
5017
|
+
),
|
|
5018
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
5019
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5020
|
+
const client = new UncachedRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5021
|
+
const res = await client.getRedirect(id);
|
|
5022
|
+
if (res) {
|
|
5023
|
+
console.error("Redirect does not exist");
|
|
5024
|
+
process.exit(1);
|
|
5025
|
+
} else {
|
|
5026
|
+
emitWithFormat(res, format, filename);
|
|
5027
|
+
}
|
|
5028
|
+
}
|
|
5029
|
+
};
|
|
5030
|
+
|
|
5031
|
+
// src/commands/redirect/commands/RedirectDefinition/list.ts
|
|
5032
|
+
import { UncachedRedirectClient as UncachedRedirectClient2 } from "@uniformdev/redirect";
|
|
5033
|
+
var RedirectDefinitionListModule = {
|
|
5034
|
+
command: "list",
|
|
5035
|
+
describe: "List of redirects",
|
|
5036
|
+
aliases: ["ls"],
|
|
5037
|
+
builder: (yargs20) => withFormatOptions(withApiOptions(withProjectOptions(yargs20))),
|
|
5038
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5039
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5040
|
+
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5041
|
+
const res = await client.getRedirects({});
|
|
5042
|
+
emitWithFormat(res, format, filename);
|
|
5043
|
+
}
|
|
5044
|
+
};
|
|
5045
|
+
|
|
5046
|
+
// src/commands/redirect/commands/RedirectDefinition/pull.ts
|
|
5047
|
+
import { UncachedRedirectClient as UncachedRedirectClient3 } from "@uniformdev/redirect";
|
|
5048
|
+
|
|
5049
|
+
// src/commands/redirect/package.ts
|
|
5050
|
+
function readContextPackage3(filename, assertExists) {
|
|
5051
|
+
return readUniformPackage(filename, assertExists);
|
|
5052
|
+
}
|
|
5053
|
+
function writeContextPackage3(filename, packageContents) {
|
|
5054
|
+
writeUniformPackage(filename, packageContents);
|
|
5055
|
+
}
|
|
5056
|
+
|
|
5057
|
+
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
5058
|
+
var selectIdentifier11 = (source) => source.redirect.id;
|
|
5059
|
+
var selectDisplayName11 = (source) => {
|
|
5060
|
+
console.log(JSON.stringify(source, void 0, " "));
|
|
5061
|
+
console.log(`${source.redirect.sourceUrl} (pid: ${source.redirect.id})`);
|
|
5062
|
+
return `${source.redirect.sourceUrl} (pid: ${source.redirect.id})`;
|
|
5063
|
+
};
|
|
5064
|
+
|
|
5065
|
+
// src/commands/redirect/RedirectEngineDataSource.ts
|
|
5066
|
+
function createRedirectDefinitionEngineDataSource({
|
|
5067
|
+
client
|
|
5068
|
+
}) {
|
|
5069
|
+
async function* getObjects() {
|
|
5070
|
+
const { redirects } = await client.getRedirects();
|
|
5071
|
+
for await (const def of redirects) {
|
|
5072
|
+
const result = {
|
|
5073
|
+
id: selectIdentifier11(def),
|
|
5074
|
+
displayName: selectDisplayName11(def),
|
|
5075
|
+
providerId: selectIdentifier11(def),
|
|
5076
|
+
object: def
|
|
5077
|
+
};
|
|
5078
|
+
yield result;
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
return {
|
|
5082
|
+
objects: getObjects(),
|
|
5083
|
+
deleteObject: async (providerId) => {
|
|
5084
|
+
await client.deleteRedirect(providerId);
|
|
5085
|
+
},
|
|
5086
|
+
writeObject: async (object) => {
|
|
5087
|
+
await client.upsertRedirect(object.object.redirect);
|
|
5088
|
+
}
|
|
5089
|
+
};
|
|
5090
|
+
}
|
|
5091
|
+
|
|
5092
|
+
// src/commands/redirect/commands/RedirectDefinition/pull.ts
|
|
5093
|
+
var RedirectDefinitionPullModule = {
|
|
5094
|
+
command: "pull <directory>",
|
|
5095
|
+
describe: "Pulls all redirects to local files in a directory",
|
|
5096
|
+
builder: (yargs20) => withApiOptions(
|
|
5097
|
+
withProjectOptions(
|
|
5098
|
+
withDiffOptions(
|
|
5099
|
+
yargs20.positional("directory", {
|
|
5100
|
+
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.",
|
|
5101
|
+
type: "string"
|
|
5102
|
+
}).option("format", {
|
|
5103
|
+
alias: ["f"],
|
|
5104
|
+
describe: "Output format",
|
|
5105
|
+
default: "yaml",
|
|
5106
|
+
choices: ["yaml", "json"],
|
|
5107
|
+
type: "string"
|
|
5108
|
+
}).option("what-if", {
|
|
5109
|
+
alias: ["w"],
|
|
5110
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5111
|
+
default: false,
|
|
5112
|
+
type: "boolean"
|
|
5113
|
+
}).option("mode", {
|
|
5114
|
+
alias: ["m"],
|
|
5115
|
+
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',
|
|
5116
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5117
|
+
default: "mirror",
|
|
5118
|
+
type: "string"
|
|
5119
|
+
})
|
|
5120
|
+
)
|
|
5121
|
+
)
|
|
5122
|
+
),
|
|
5123
|
+
handler: async ({
|
|
5124
|
+
apiHost,
|
|
5125
|
+
apiKey,
|
|
5126
|
+
proxy,
|
|
5127
|
+
directory,
|
|
5128
|
+
format,
|
|
5129
|
+
mode,
|
|
5130
|
+
whatIf,
|
|
5131
|
+
project: projectId,
|
|
5132
|
+
diff: diffMode
|
|
5133
|
+
}) => {
|
|
5134
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5135
|
+
const client = new UncachedRedirectClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5136
|
+
const source = createRedirectDefinitionEngineDataSource({ client });
|
|
5137
|
+
let target;
|
|
5138
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5139
|
+
if (isPackage) {
|
|
5140
|
+
const packageContents = readContextPackage3(directory, false);
|
|
5141
|
+
target = await createArraySyncEngineDataSource({
|
|
5142
|
+
objects: packageContents ?? [],
|
|
5143
|
+
selectIdentifier: selectIdentifier11,
|
|
5144
|
+
selectDisplayName: selectDisplayName11,
|
|
5145
|
+
onSyncComplete: async (_, synced) => {
|
|
5146
|
+
packageContents.redirects = synced;
|
|
5147
|
+
writeContextPackage3(directory, packageContents);
|
|
5148
|
+
}
|
|
5149
|
+
});
|
|
5150
|
+
} else {
|
|
5151
|
+
target = await createFileSyncEngineDataSource({
|
|
5152
|
+
directory,
|
|
5153
|
+
selectFilename: (o) => {
|
|
5154
|
+
return o.redirect.sourceUrl.replace(/[/<>$+%>!`&*'|{}?"=:\\@]/g, "-");
|
|
5155
|
+
},
|
|
5156
|
+
selectIdentifier: selectIdentifier11,
|
|
5157
|
+
selectDisplayName: selectDisplayName11,
|
|
5158
|
+
format
|
|
5159
|
+
});
|
|
5160
|
+
}
|
|
5161
|
+
await syncEngine({
|
|
5162
|
+
source,
|
|
5163
|
+
target,
|
|
5164
|
+
mode,
|
|
5165
|
+
whatIf,
|
|
5166
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5167
|
+
});
|
|
5168
|
+
}
|
|
5169
|
+
};
|
|
5170
|
+
|
|
5171
|
+
// src/commands/redirect/commands/RedirectDefinition/push.ts
|
|
5172
|
+
import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/redirect";
|
|
5173
|
+
var RedirectDefinitionPushModule = {
|
|
5174
|
+
command: "push <directory>",
|
|
5175
|
+
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
5176
|
+
builder: (yargs20) => withApiOptions(
|
|
5177
|
+
withProjectOptions(
|
|
5178
|
+
withDiffOptions(
|
|
5179
|
+
yargs20.positional("directory", {
|
|
5180
|
+
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
5181
|
+
type: "string"
|
|
5182
|
+
}).option("what-if", {
|
|
5183
|
+
alias: ["w"],
|
|
5184
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5185
|
+
default: false,
|
|
5186
|
+
type: "boolean"
|
|
5187
|
+
}).option("mode", {
|
|
5188
|
+
alias: ["m"],
|
|
5189
|
+
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',
|
|
5190
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5191
|
+
default: "mirror",
|
|
5192
|
+
type: "string"
|
|
5193
|
+
})
|
|
5194
|
+
)
|
|
5195
|
+
)
|
|
5196
|
+
),
|
|
5197
|
+
handler: async ({
|
|
5198
|
+
apiHost,
|
|
5199
|
+
apiKey,
|
|
5200
|
+
proxy,
|
|
5201
|
+
directory,
|
|
5202
|
+
mode,
|
|
5203
|
+
whatIf,
|
|
5204
|
+
project: projectId,
|
|
5205
|
+
diff: diffMode
|
|
5206
|
+
}) => {
|
|
5207
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5208
|
+
const client = new UncachedRedirectClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5209
|
+
let source;
|
|
5210
|
+
const isPackage = isPathAPackageFile(directory);
|
|
5211
|
+
if (isPackage) {
|
|
5212
|
+
const packageContents = readContextPackage3(directory, true);
|
|
5213
|
+
source = await createArraySyncEngineDataSource({
|
|
5214
|
+
objects: packageContents ?? [],
|
|
5215
|
+
selectIdentifier: selectIdentifier11,
|
|
5216
|
+
selectDisplayName: selectDisplayName11
|
|
5217
|
+
});
|
|
5218
|
+
} else {
|
|
5219
|
+
source = await createFileSyncEngineDataSource({
|
|
5220
|
+
directory,
|
|
5221
|
+
selectIdentifier: selectIdentifier11,
|
|
5222
|
+
selectDisplayName: selectDisplayName11
|
|
5223
|
+
});
|
|
5224
|
+
}
|
|
5225
|
+
const target = createRedirectDefinitionEngineDataSource({ client });
|
|
5226
|
+
await syncEngine({
|
|
5227
|
+
source,
|
|
5228
|
+
target,
|
|
5229
|
+
mode,
|
|
5230
|
+
whatIf,
|
|
5231
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5232
|
+
});
|
|
5233
|
+
}
|
|
5234
|
+
};
|
|
5235
|
+
|
|
5236
|
+
// src/commands/redirect/commands/RedirectDefinition/remove.ts
|
|
5237
|
+
import { UncachedRedirectClient as UncachedRedirectClient5 } from "@uniformdev/redirect";
|
|
5238
|
+
var RedirectDefinitionRemoveModule = {
|
|
5239
|
+
command: "remove <id>",
|
|
5240
|
+
aliases: ["delete", "rm"],
|
|
5241
|
+
describe: "Delete a redirect",
|
|
5242
|
+
builder: (yargs20) => withApiOptions(
|
|
5243
|
+
withProjectOptions(yargs20.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
5244
|
+
),
|
|
5245
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
5246
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5247
|
+
const client = new UncachedRedirectClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5248
|
+
await client.deleteRedirect(id);
|
|
5249
|
+
}
|
|
5250
|
+
};
|
|
5251
|
+
|
|
5252
|
+
// src/commands/redirect/commands/RedirectDefinition/update.ts
|
|
5253
|
+
import { UncachedRedirectClient as UncachedRedirectClient6 } from "@uniformdev/redirect";
|
|
5254
|
+
var RedirectDefinitionUpdateModule = {
|
|
5255
|
+
command: "update <filename>",
|
|
5256
|
+
aliases: ["put"],
|
|
5257
|
+
describe: "Insert or update a redirect",
|
|
5258
|
+
builder: (yargs20) => withApiOptions(
|
|
5259
|
+
withProjectOptions(
|
|
5260
|
+
yargs20.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
5261
|
+
)
|
|
5262
|
+
),
|
|
5263
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
5264
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
5265
|
+
const client = new UncachedRedirectClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5266
|
+
const file = readFileToObject(filename);
|
|
5267
|
+
await client.upsertRedirect(file);
|
|
5268
|
+
}
|
|
5269
|
+
};
|
|
5270
|
+
|
|
5271
|
+
// src/commands/redirect/commands/redirect.ts
|
|
5272
|
+
var RedirectDefinitionModule = {
|
|
5273
|
+
command: "definition <command>",
|
|
5274
|
+
describe: "Commands for Redirect Definitions",
|
|
5275
|
+
builder: (yargs20) => yargs20.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
5276
|
+
handler: () => {
|
|
5277
|
+
yargs17.help();
|
|
5278
|
+
}
|
|
5279
|
+
};
|
|
5280
|
+
|
|
5281
|
+
// src/commands/redirect/index.ts
|
|
5282
|
+
var RedirectCommand = {
|
|
5283
|
+
command: "redirect <command>",
|
|
5284
|
+
aliases: ["red"],
|
|
5285
|
+
describe: "Uniform Redirect commands",
|
|
5286
|
+
builder: (yargs20) => yargs20.command(RedirectDefinitionModule).demandCommand(),
|
|
5287
|
+
handler: () => {
|
|
5288
|
+
yargs18.showHelp();
|
|
5289
|
+
}
|
|
5290
|
+
};
|
|
5291
|
+
|
|
4993
5292
|
// src/index.ts
|
|
4994
5293
|
dotenv.config();
|
|
4995
|
-
var yarggery =
|
|
4996
|
-
yarggery.command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().argv;
|
|
5294
|
+
var yarggery = yargs19(hideBin(process.argv));
|
|
5295
|
+
yarggery.command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().argv;
|