@uniformdev/cli 19.45.0 → 19.45.2-alpha.6
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 +1169 -249
- package/package.json +10 -6
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import * as dotenv from "dotenv";
|
|
5
|
-
import
|
|
5
|
+
import yargs24 from "yargs";
|
|
6
6
|
import { hideBin } from "yargs/helpers";
|
|
7
7
|
|
|
8
8
|
// src/commands/canvas/index.ts
|
|
9
|
-
import
|
|
9
|
+
import yargs8 from "yargs";
|
|
10
10
|
|
|
11
11
|
// src/commands/canvas/commands/category.ts
|
|
12
12
|
import yargs from "yargs";
|
|
@@ -119,14 +119,14 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
119
119
|
import unfetch from "isomorphic-unfetch";
|
|
120
120
|
import { dump, load } from "js-yaml";
|
|
121
121
|
import { extname } from "path";
|
|
122
|
-
function withConfiguration(
|
|
123
|
-
return
|
|
122
|
+
function withConfiguration(yargs25) {
|
|
123
|
+
return yargs25.option("serialization", {
|
|
124
124
|
skipValidation: true,
|
|
125
125
|
hidden: true
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
function withApiOptions(
|
|
129
|
-
return
|
|
128
|
+
function withApiOptions(yargs25) {
|
|
129
|
+
return yargs25.option("apiKey", {
|
|
130
130
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
131
131
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
132
132
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -165,8 +165,8 @@ function nodeFetchProxy(proxy) {
|
|
|
165
165
|
};
|
|
166
166
|
return wrappedFetch;
|
|
167
167
|
}
|
|
168
|
-
function withProjectOptions(
|
|
169
|
-
return
|
|
168
|
+
function withProjectOptions(yargs25) {
|
|
169
|
+
return yargs25.option("project", {
|
|
170
170
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
171
171
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
172
172
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -176,8 +176,8 @@ function withProjectOptions(yargs23) {
|
|
|
176
176
|
alias: ["p"]
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
function withFormatOptions(
|
|
180
|
-
return
|
|
179
|
+
function withFormatOptions(yargs25) {
|
|
180
|
+
return yargs25.option("format", {
|
|
181
181
|
alias: ["f"],
|
|
182
182
|
describe: "Output format",
|
|
183
183
|
default: "yaml",
|
|
@@ -189,8 +189,8 @@ function withFormatOptions(yargs23) {
|
|
|
189
189
|
type: "string"
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
function withDiffOptions(
|
|
193
|
-
return
|
|
192
|
+
function withDiffOptions(yargs25) {
|
|
193
|
+
return yargs25.option("diff", {
|
|
194
194
|
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.",
|
|
195
195
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
196
196
|
type: "string",
|
|
@@ -411,7 +411,9 @@ async function syncEngine({
|
|
|
411
411
|
whatIf = false,
|
|
412
412
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
413
413
|
log = () => {
|
|
414
|
-
}
|
|
414
|
+
},
|
|
415
|
+
onBeforeCompareObjects,
|
|
416
|
+
onBeforeWriteObject
|
|
415
417
|
}) {
|
|
416
418
|
var _a, _b;
|
|
417
419
|
const targetItems = /* @__PURE__ */ new Map();
|
|
@@ -445,18 +447,20 @@ async function syncEngine({
|
|
|
445
447
|
}
|
|
446
448
|
const actions = [];
|
|
447
449
|
let sourceHasItems = false;
|
|
448
|
-
for await (
|
|
450
|
+
for await (let sourceObject of source.objects) {
|
|
449
451
|
sourceHasItems = true;
|
|
450
452
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
451
453
|
const targetObject = targetItems.get(ids[0]);
|
|
452
454
|
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => (o == null ? void 0 : o.object) !== (targetObject == null ? void 0 : targetObject.object));
|
|
453
455
|
if (targetObject && invalidTargetObjects.length == 0) {
|
|
456
|
+
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
454
457
|
if (!compareContents(sourceObject, targetObject)) {
|
|
455
458
|
if (mode === "createOrUpdate" || mode === "mirror") {
|
|
456
459
|
const process2 = async (sourceObject2, targetObject2) => {
|
|
457
460
|
if (!whatIf) {
|
|
458
461
|
try {
|
|
459
|
-
await
|
|
462
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
463
|
+
await target.writeObject(finalSourceObject, targetObject2);
|
|
460
464
|
} catch (e) {
|
|
461
465
|
throw new SyncEngineError(e, sourceObject2);
|
|
462
466
|
}
|
|
@@ -478,7 +482,8 @@ async function syncEngine({
|
|
|
478
482
|
const process2 = async (sourceObject2, id) => {
|
|
479
483
|
if (!whatIf) {
|
|
480
484
|
try {
|
|
481
|
-
await
|
|
485
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
|
|
486
|
+
await target.writeObject(finalSourceObject);
|
|
482
487
|
} catch (e) {
|
|
483
488
|
throw new SyncEngineError(e, sourceObject2);
|
|
484
489
|
}
|
|
@@ -574,11 +579,11 @@ function createSyncEngineConsoleLogger(options) {
|
|
|
574
579
|
var CategoryGetModule = {
|
|
575
580
|
command: "get <id>",
|
|
576
581
|
describe: "Fetch a category",
|
|
577
|
-
builder: (
|
|
582
|
+
builder: (yargs25) => withConfiguration(
|
|
578
583
|
withFormatOptions(
|
|
579
584
|
withApiOptions(
|
|
580
585
|
withProjectOptions(
|
|
581
|
-
|
|
586
|
+
yargs25.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
582
587
|
)
|
|
583
588
|
)
|
|
584
589
|
)
|
|
@@ -603,7 +608,7 @@ var CategoryListModule = {
|
|
|
603
608
|
command: "list",
|
|
604
609
|
describe: "List categories",
|
|
605
610
|
aliases: ["ls"],
|
|
606
|
-
builder: (
|
|
611
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25.options({}))))),
|
|
607
612
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
608
613
|
const fetch3 = nodeFetchProxy(proxy);
|
|
609
614
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -660,11 +665,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
660
665
|
var CategoryPullModule = {
|
|
661
666
|
command: "pull <directory>",
|
|
662
667
|
describe: "Pulls all categories to local files in a directory",
|
|
663
|
-
builder: (
|
|
668
|
+
builder: (yargs25) => withConfiguration(
|
|
664
669
|
withApiOptions(
|
|
665
670
|
withProjectOptions(
|
|
666
671
|
withDiffOptions(
|
|
667
|
-
|
|
672
|
+
yargs25.positional("directory", {
|
|
668
673
|
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.",
|
|
669
674
|
type: "string"
|
|
670
675
|
}).option("format", {
|
|
@@ -739,11 +744,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
739
744
|
var CategoryPushModule = {
|
|
740
745
|
command: "push <directory>",
|
|
741
746
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
742
|
-
builder: (
|
|
747
|
+
builder: (yargs25) => withConfiguration(
|
|
743
748
|
withApiOptions(
|
|
744
749
|
withProjectOptions(
|
|
745
750
|
withDiffOptions(
|
|
746
|
-
|
|
751
|
+
yargs25.positional("directory", {
|
|
747
752
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
748
753
|
type: "string"
|
|
749
754
|
}).option("what-if", {
|
|
@@ -807,10 +812,10 @@ var CategoryRemoveModule = {
|
|
|
807
812
|
command: "remove <id>",
|
|
808
813
|
aliases: ["delete", "rm"],
|
|
809
814
|
describe: "Delete a category",
|
|
810
|
-
builder: (
|
|
815
|
+
builder: (yargs25) => withConfiguration(
|
|
811
816
|
withApiOptions(
|
|
812
817
|
withProjectOptions(
|
|
813
|
-
|
|
818
|
+
yargs25.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
814
819
|
)
|
|
815
820
|
)
|
|
816
821
|
),
|
|
@@ -827,10 +832,10 @@ var CategoryUpdateModule = {
|
|
|
827
832
|
command: "update <filename>",
|
|
828
833
|
aliases: ["put"],
|
|
829
834
|
describe: "Insert or update a category",
|
|
830
|
-
builder: (
|
|
835
|
+
builder: (yargs25) => withConfiguration(
|
|
831
836
|
withApiOptions(
|
|
832
837
|
withProjectOptions(
|
|
833
|
-
|
|
838
|
+
yargs25.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
834
839
|
)
|
|
835
840
|
)
|
|
836
841
|
),
|
|
@@ -847,7 +852,7 @@ var CategoryModule = {
|
|
|
847
852
|
command: "category <command>",
|
|
848
853
|
aliases: ["cat"],
|
|
849
854
|
describe: "Commands for Canvas categories",
|
|
850
|
-
builder: (
|
|
855
|
+
builder: (yargs25) => yargs25.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
851
856
|
handler: () => {
|
|
852
857
|
yargs.help();
|
|
853
858
|
}
|
|
@@ -868,11 +873,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
868
873
|
var ComponentGetModule = {
|
|
869
874
|
command: "get <id>",
|
|
870
875
|
describe: "Fetch a component definition",
|
|
871
|
-
builder: (
|
|
876
|
+
builder: (yargs25) => withConfiguration(
|
|
872
877
|
withFormatOptions(
|
|
873
878
|
withApiOptions(
|
|
874
879
|
withProjectOptions(
|
|
875
|
-
|
|
880
|
+
yargs25.positional("id", {
|
|
876
881
|
demandOption: true,
|
|
877
882
|
describe: "Component definition public ID to fetch"
|
|
878
883
|
})
|
|
@@ -906,11 +911,11 @@ var ComponentListModule = {
|
|
|
906
911
|
command: "list",
|
|
907
912
|
describe: "List component definitions",
|
|
908
913
|
aliases: ["ls"],
|
|
909
|
-
builder: (
|
|
914
|
+
builder: (yargs25) => withConfiguration(
|
|
910
915
|
withFormatOptions(
|
|
911
916
|
withApiOptions(
|
|
912
917
|
withProjectOptions(
|
|
913
|
-
|
|
918
|
+
yargs25.options({
|
|
914
919
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
915
920
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
916
921
|
})
|
|
@@ -965,11 +970,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
965
970
|
var ComponentPullModule = {
|
|
966
971
|
command: "pull <directory>",
|
|
967
972
|
describe: "Pulls all component definitions to local files in a directory",
|
|
968
|
-
builder: (
|
|
973
|
+
builder: (yargs25) => withConfiguration(
|
|
969
974
|
withApiOptions(
|
|
970
975
|
withProjectOptions(
|
|
971
976
|
withDiffOptions(
|
|
972
|
-
|
|
977
|
+
yargs25.positional("directory", {
|
|
973
978
|
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.",
|
|
974
979
|
type: "string"
|
|
975
980
|
}).option("format", {
|
|
@@ -1045,11 +1050,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1045
1050
|
var ComponentPushModule = {
|
|
1046
1051
|
command: "push <directory>",
|
|
1047
1052
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1048
|
-
builder: (
|
|
1053
|
+
builder: (yargs25) => withConfiguration(
|
|
1049
1054
|
withApiOptions(
|
|
1050
1055
|
withProjectOptions(
|
|
1051
1056
|
withDiffOptions(
|
|
1052
|
-
|
|
1057
|
+
yargs25.positional("directory", {
|
|
1053
1058
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1054
1059
|
type: "string"
|
|
1055
1060
|
}).option("what-if", {
|
|
@@ -1114,10 +1119,10 @@ var ComponentRemoveModule = {
|
|
|
1114
1119
|
command: "remove <id>",
|
|
1115
1120
|
aliases: ["delete", "rm"],
|
|
1116
1121
|
describe: "Delete a component definition",
|
|
1117
|
-
builder: (
|
|
1122
|
+
builder: (yargs25) => withConfiguration(
|
|
1118
1123
|
withApiOptions(
|
|
1119
1124
|
withProjectOptions(
|
|
1120
|
-
|
|
1125
|
+
yargs25.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1121
1126
|
)
|
|
1122
1127
|
)
|
|
1123
1128
|
),
|
|
@@ -1134,10 +1139,10 @@ var ComponentUpdateModule = {
|
|
|
1134
1139
|
command: "update <filename>",
|
|
1135
1140
|
aliases: ["put"],
|
|
1136
1141
|
describe: "Insert or update a component definition",
|
|
1137
|
-
builder: (
|
|
1142
|
+
builder: (yargs25) => withConfiguration(
|
|
1138
1143
|
withApiOptions(
|
|
1139
1144
|
withProjectOptions(
|
|
1140
|
-
|
|
1145
|
+
yargs25.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1141
1146
|
)
|
|
1142
1147
|
)
|
|
1143
1148
|
),
|
|
@@ -1154,7 +1159,7 @@ var ComponentModule = {
|
|
|
1154
1159
|
command: "component <command>",
|
|
1155
1160
|
aliases: ["def"],
|
|
1156
1161
|
describe: "Commands for Canvas component definitions",
|
|
1157
|
-
builder: (
|
|
1162
|
+
builder: (yargs25) => yargs25.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1158
1163
|
handler: () => {
|
|
1159
1164
|
yargs2.help();
|
|
1160
1165
|
}
|
|
@@ -1176,8 +1181,8 @@ function prepCompositionForDisk(composition) {
|
|
|
1176
1181
|
delete prepped.state;
|
|
1177
1182
|
return prepped;
|
|
1178
1183
|
}
|
|
1179
|
-
function withStateOptions(
|
|
1180
|
-
return
|
|
1184
|
+
function withStateOptions(yargs25) {
|
|
1185
|
+
return yargs25.option("state", {
|
|
1181
1186
|
type: "string",
|
|
1182
1187
|
describe: `Composition state to fetch.`,
|
|
1183
1188
|
choices: ["preview", "published"],
|
|
@@ -1202,12 +1207,12 @@ function convertCompositionState(state) {
|
|
|
1202
1207
|
var CompositionGetModule = {
|
|
1203
1208
|
command: "get <id>",
|
|
1204
1209
|
describe: "Fetch a composition",
|
|
1205
|
-
builder: (
|
|
1210
|
+
builder: (yargs25) => withFormatOptions(
|
|
1206
1211
|
withConfiguration(
|
|
1207
1212
|
withApiOptions(
|
|
1208
1213
|
withProjectOptions(
|
|
1209
1214
|
withStateOptions(
|
|
1210
|
-
|
|
1215
|
+
yargs25.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1211
1216
|
resolvePatterns: {
|
|
1212
1217
|
type: "boolean",
|
|
1213
1218
|
default: false,
|
|
@@ -1278,12 +1283,12 @@ var CompositionListModule = {
|
|
|
1278
1283
|
command: "list",
|
|
1279
1284
|
describe: "List compositions",
|
|
1280
1285
|
aliases: ["ls"],
|
|
1281
|
-
builder: (
|
|
1286
|
+
builder: (yargs25) => withFormatOptions(
|
|
1282
1287
|
withConfiguration(
|
|
1283
1288
|
withApiOptions(
|
|
1284
1289
|
withProjectOptions(
|
|
1285
1290
|
withStateOptions(
|
|
1286
|
-
|
|
1291
|
+
yargs25.options({
|
|
1287
1292
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1288
1293
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1289
1294
|
resolvePatterns: {
|
|
@@ -1403,13 +1408,13 @@ function createComponentInstanceEngineDataSource({
|
|
|
1403
1408
|
// src/commands/canvas/commands/composition/publish.ts
|
|
1404
1409
|
var CompositionPublishModule = {
|
|
1405
1410
|
command: "publish [ids]",
|
|
1406
|
-
describe: "Publishes
|
|
1407
|
-
builder: (
|
|
1411
|
+
describe: "Publishes composition(s)",
|
|
1412
|
+
builder: (yargs25) => withConfiguration(
|
|
1408
1413
|
withApiOptions(
|
|
1409
1414
|
withProjectOptions(
|
|
1410
1415
|
withDiffOptions(
|
|
1411
|
-
|
|
1412
|
-
describe: "Publishes composition
|
|
1416
|
+
yargs25.positional("ids", {
|
|
1417
|
+
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1413
1418
|
type: "string"
|
|
1414
1419
|
}).option("all", {
|
|
1415
1420
|
alias: ["a"],
|
|
@@ -1421,12 +1426,32 @@ var CompositionPublishModule = {
|
|
|
1421
1426
|
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
1422
1427
|
default: false,
|
|
1423
1428
|
type: "boolean"
|
|
1429
|
+
}).option("onlyCompositions", {
|
|
1430
|
+
describe: "Only publishing compositions and not patterns",
|
|
1431
|
+
default: false,
|
|
1432
|
+
type: "boolean"
|
|
1433
|
+
}).option("onlyPatterns", {
|
|
1434
|
+
describe: "Only pulling patterns and not compositions",
|
|
1435
|
+
default: false,
|
|
1436
|
+
type: "boolean",
|
|
1437
|
+
hidden: true
|
|
1424
1438
|
})
|
|
1425
1439
|
)
|
|
1426
1440
|
)
|
|
1427
1441
|
)
|
|
1428
1442
|
),
|
|
1429
|
-
handler: async ({
|
|
1443
|
+
handler: async ({
|
|
1444
|
+
apiHost,
|
|
1445
|
+
apiKey,
|
|
1446
|
+
proxy,
|
|
1447
|
+
ids,
|
|
1448
|
+
all,
|
|
1449
|
+
whatIf,
|
|
1450
|
+
project: projectId,
|
|
1451
|
+
diff: diffMode,
|
|
1452
|
+
onlyCompositions,
|
|
1453
|
+
onlyPatterns
|
|
1454
|
+
}) => {
|
|
1430
1455
|
if (!all && !ids || all && ids) {
|
|
1431
1456
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
1432
1457
|
process.exit(1);
|
|
@@ -1437,17 +1462,22 @@ var CompositionPublishModule = {
|
|
|
1437
1462
|
const source = createComponentInstanceEngineDataSource({
|
|
1438
1463
|
client,
|
|
1439
1464
|
state: "preview",
|
|
1440
|
-
compositionIDs: compositionIDsArray
|
|
1465
|
+
compositionIDs: compositionIDsArray,
|
|
1466
|
+
onlyCompositions,
|
|
1467
|
+
onlyPatterns
|
|
1441
1468
|
});
|
|
1442
1469
|
const target = createComponentInstanceEngineDataSource({
|
|
1443
1470
|
client,
|
|
1444
1471
|
state: "published",
|
|
1445
|
-
compositionIDs: compositionIDsArray
|
|
1472
|
+
compositionIDs: compositionIDsArray,
|
|
1473
|
+
onlyCompositions,
|
|
1474
|
+
onlyPatterns
|
|
1446
1475
|
});
|
|
1447
1476
|
await syncEngine({
|
|
1448
1477
|
source,
|
|
1449
1478
|
target,
|
|
1450
|
-
|
|
1479
|
+
// Publishing is one-direction operation, so no need to support automatic un-publishing
|
|
1480
|
+
mode: "createOrUpdate",
|
|
1451
1481
|
whatIf,
|
|
1452
1482
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1453
1483
|
});
|
|
@@ -1456,15 +1486,189 @@ var CompositionPublishModule = {
|
|
|
1456
1486
|
|
|
1457
1487
|
// src/commands/canvas/commands/composition/pull.ts
|
|
1458
1488
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
1489
|
+
|
|
1490
|
+
// src/files/index.ts
|
|
1491
|
+
import { preferredType } from "@thi.ng/mime";
|
|
1492
|
+
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
1493
|
+
import { createHash } from "crypto";
|
|
1494
|
+
import fsj from "fs-jetpack";
|
|
1495
|
+
import sizeOf from "image-size";
|
|
1496
|
+
import PQueue from "p-queue";
|
|
1497
|
+
import { join as join2 } from "path";
|
|
1498
|
+
var FILES_DIRECTORY_NAME = "files";
|
|
1499
|
+
var urlToHash = (url) => {
|
|
1500
|
+
const hash = createHash("sha256");
|
|
1501
|
+
hash.update(url);
|
|
1502
|
+
return hash.digest("hex");
|
|
1503
|
+
};
|
|
1504
|
+
var urlToFileName = (url) => {
|
|
1505
|
+
const fileName = urlToHash(url);
|
|
1506
|
+
const fileNameChunks = url.split(".");
|
|
1507
|
+
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
1508
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
1509
|
+
};
|
|
1510
|
+
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
1511
|
+
const objectAsString = JSON.stringify(object);
|
|
1512
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1513
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1514
|
+
);
|
|
1515
|
+
if (uniformFileUrlMatches) {
|
|
1516
|
+
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
1517
|
+
for (const match of uniformFileUrlMatches) {
|
|
1518
|
+
const url = match[1];
|
|
1519
|
+
fileDownloadQueue.add(async () => {
|
|
1520
|
+
try {
|
|
1521
|
+
const fileName = urlToFileName(url);
|
|
1522
|
+
const fileAlreadyExists = await fsj.existsAsync(
|
|
1523
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
1524
|
+
);
|
|
1525
|
+
if (fileAlreadyExists) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
const response = await fetch(url);
|
|
1529
|
+
if (!response.ok) {
|
|
1530
|
+
return;
|
|
1531
|
+
}
|
|
1532
|
+
const fileBuffer = await response.arrayBuffer();
|
|
1533
|
+
await fsj.writeAsync(
|
|
1534
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
1535
|
+
Buffer.from(fileBuffer)
|
|
1536
|
+
);
|
|
1537
|
+
} catch {
|
|
1538
|
+
console.warn(`Failed to download file ${url}`);
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
await fileDownloadQueue.onIdle();
|
|
1543
|
+
}
|
|
1544
|
+
return object;
|
|
1545
|
+
};
|
|
1546
|
+
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
1547
|
+
let objectAsString = JSON.stringify(object);
|
|
1548
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1549
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1550
|
+
);
|
|
1551
|
+
if (uniformFileUrlMatches) {
|
|
1552
|
+
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
1553
|
+
for (const match of uniformFileUrlMatches) {
|
|
1554
|
+
const url = match[1];
|
|
1555
|
+
const hash = urlToHash(url);
|
|
1556
|
+
fileUploadQueue.add(async () => {
|
|
1557
|
+
try {
|
|
1558
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
1559
|
+
options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
|
|
1560
|
+
options.fileClient.getFile({ projectId: options.projectId, sourceId: hash }).catch(() => null)
|
|
1561
|
+
]);
|
|
1562
|
+
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
const localFileName = urlToFileName(url);
|
|
1566
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
1567
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
1568
|
+
);
|
|
1569
|
+
if (!fileExistsLocally) {
|
|
1570
|
+
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
const fileBuffer = await fsj.readAsync(
|
|
1574
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
1575
|
+
"buffer"
|
|
1576
|
+
);
|
|
1577
|
+
if (!fileBuffer) {
|
|
1578
|
+
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
const fileName = getFileNameFromUrl(url);
|
|
1582
|
+
const { width, height } = (() => {
|
|
1583
|
+
try {
|
|
1584
|
+
return sizeOf(fileBuffer);
|
|
1585
|
+
} catch {
|
|
1586
|
+
return {
|
|
1587
|
+
width: void 0,
|
|
1588
|
+
height: void 0
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
})();
|
|
1592
|
+
const { id, method, uploadUrl } = await options.fileClient.createNewProjectFile({
|
|
1593
|
+
name: fileName,
|
|
1594
|
+
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
1595
|
+
size: fileBuffer.length,
|
|
1596
|
+
width,
|
|
1597
|
+
height,
|
|
1598
|
+
projectId: options.projectId,
|
|
1599
|
+
sourceId: hash
|
|
1600
|
+
});
|
|
1601
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
1602
|
+
method,
|
|
1603
|
+
body: fileBuffer
|
|
1604
|
+
});
|
|
1605
|
+
if (!uploadResponse.ok) {
|
|
1606
|
+
console.warn(`Failed to upload file ${url}`);
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
const checkForFile = async () => {
|
|
1610
|
+
const file = await options.fileClient.getFile({ id });
|
|
1611
|
+
if (!file || file.state !== FILE_READY_STATE) {
|
|
1612
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
1613
|
+
return checkForFile();
|
|
1614
|
+
}
|
|
1615
|
+
return file.url;
|
|
1616
|
+
};
|
|
1617
|
+
const abortTimeout = setTimeout(() => {
|
|
1618
|
+
throw new Error(`Failed to upload file ${url}`);
|
|
1619
|
+
}, 1e4);
|
|
1620
|
+
const uploadedFileUrl = await checkForFile();
|
|
1621
|
+
clearTimeout(abortTimeout);
|
|
1622
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
1623
|
+
} catch {
|
|
1624
|
+
console.warn(`Failed to upload file ${url}`);
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
await fileUploadQueue.onIdle();
|
|
1629
|
+
}
|
|
1630
|
+
return JSON.parse(objectAsString);
|
|
1631
|
+
};
|
|
1632
|
+
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
1633
|
+
let objectAsString = JSON.stringify(object);
|
|
1634
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1635
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1636
|
+
);
|
|
1637
|
+
if (uniformFileUrlMatches) {
|
|
1638
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
1639
|
+
for (const match of uniformFileUrlMatches) {
|
|
1640
|
+
const url = match[1];
|
|
1641
|
+
const hash = urlToHash(url);
|
|
1642
|
+
fileUrlReplacementQueue.add(async () => {
|
|
1643
|
+
try {
|
|
1644
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
1645
|
+
options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
|
|
1646
|
+
options.fileClient.getFile({ projectId: options.projectId, sourceId: hash }).catch(() => null)
|
|
1647
|
+
]);
|
|
1648
|
+
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
1649
|
+
if (!file) {
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
1653
|
+
} catch {
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
await fileUrlReplacementQueue.onIdle();
|
|
1658
|
+
}
|
|
1659
|
+
return JSON.parse(objectAsString);
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1662
|
+
// src/commands/canvas/commands/composition/pull.ts
|
|
1459
1663
|
var CompositionPullModule = {
|
|
1460
1664
|
command: "pull <directory>",
|
|
1461
1665
|
describe: "Pulls all compositions to local files in a directory",
|
|
1462
|
-
builder: (
|
|
1666
|
+
builder: (yargs25) => withConfiguration(
|
|
1463
1667
|
withApiOptions(
|
|
1464
1668
|
withProjectOptions(
|
|
1465
1669
|
withStateOptions(
|
|
1466
1670
|
withDiffOptions(
|
|
1467
|
-
|
|
1671
|
+
yargs25.positional("directory", {
|
|
1468
1672
|
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.",
|
|
1469
1673
|
type: "string"
|
|
1470
1674
|
}).option("format", {
|
|
@@ -1542,22 +1746,28 @@ var CompositionPullModule = {
|
|
|
1542
1746
|
target,
|
|
1543
1747
|
mode,
|
|
1544
1748
|
whatIf,
|
|
1545
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1749
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1750
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1751
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1752
|
+
directory
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1546
1755
|
});
|
|
1547
1756
|
}
|
|
1548
1757
|
};
|
|
1549
1758
|
|
|
1550
1759
|
// src/commands/canvas/commands/composition/push.ts
|
|
1551
1760
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
1761
|
+
import { FileClient as FileClient2 } from "@uniformdev/files";
|
|
1552
1762
|
var CompositionPushModule = {
|
|
1553
1763
|
command: "push <directory>",
|
|
1554
1764
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
1555
|
-
builder: (
|
|
1765
|
+
builder: (yargs25) => withConfiguration(
|
|
1556
1766
|
withApiOptions(
|
|
1557
1767
|
withProjectOptions(
|
|
1558
1768
|
withStateOptions(
|
|
1559
1769
|
withDiffOptions(
|
|
1560
|
-
|
|
1770
|
+
yargs25.positional("directory", {
|
|
1561
1771
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
1562
1772
|
type: "string"
|
|
1563
1773
|
}).option("what-if", {
|
|
@@ -1618,12 +1828,26 @@ var CompositionPushModule = {
|
|
|
1618
1828
|
});
|
|
1619
1829
|
}
|
|
1620
1830
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1831
|
+
const fileClient = new FileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1621
1832
|
await syncEngine({
|
|
1622
1833
|
source,
|
|
1623
1834
|
target,
|
|
1624
1835
|
mode,
|
|
1625
1836
|
whatIf,
|
|
1626
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1837
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1838
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
1839
|
+
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
1840
|
+
fileClient,
|
|
1841
|
+
projectId
|
|
1842
|
+
});
|
|
1843
|
+
},
|
|
1844
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1845
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1846
|
+
directory,
|
|
1847
|
+
fileClient,
|
|
1848
|
+
projectId
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1627
1851
|
});
|
|
1628
1852
|
}
|
|
1629
1853
|
};
|
|
@@ -1634,10 +1858,10 @@ var CompositionRemoveModule = {
|
|
|
1634
1858
|
command: "remove <id>",
|
|
1635
1859
|
aliases: ["delete", "rm"],
|
|
1636
1860
|
describe: "Delete a composition",
|
|
1637
|
-
builder: (
|
|
1861
|
+
builder: (yargs25) => withConfiguration(
|
|
1638
1862
|
withApiOptions(
|
|
1639
1863
|
withProjectOptions(
|
|
1640
|
-
|
|
1864
|
+
yargs25.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
1641
1865
|
)
|
|
1642
1866
|
)
|
|
1643
1867
|
),
|
|
@@ -1650,23 +1874,99 @@ var CompositionRemoveModule = {
|
|
|
1650
1874
|
|
|
1651
1875
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
1652
1876
|
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient as UncachedCanvasClient13 } from "@uniformdev/canvas";
|
|
1877
|
+
import { diffJson as diffJson2 } from "diff";
|
|
1653
1878
|
var CompositionUnpublishModule = {
|
|
1654
|
-
command: "unpublish
|
|
1655
|
-
describe: "Unpublish a composition",
|
|
1656
|
-
builder: (
|
|
1879
|
+
command: "unpublish [ids]",
|
|
1880
|
+
describe: "Unpublish a composition(s)",
|
|
1881
|
+
builder: (yargs25) => withConfiguration(
|
|
1657
1882
|
withApiOptions(
|
|
1658
1883
|
withProjectOptions(
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1884
|
+
yargs25.positional("ids", {
|
|
1885
|
+
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
1886
|
+
type: "string"
|
|
1887
|
+
}).option("all", {
|
|
1888
|
+
alias: ["a"],
|
|
1889
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
1890
|
+
default: false,
|
|
1891
|
+
type: "boolean"
|
|
1892
|
+
}).option("what-if", {
|
|
1893
|
+
alias: ["w"],
|
|
1894
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
1895
|
+
default: false,
|
|
1896
|
+
type: "boolean"
|
|
1897
|
+
}).option("onlyCompositions", {
|
|
1898
|
+
describe: "Only publishing compositions and not patterns",
|
|
1899
|
+
default: false,
|
|
1900
|
+
type: "boolean"
|
|
1901
|
+
}).option("onlyPatterns", {
|
|
1902
|
+
describe: "Only pulling patterns and not compositions",
|
|
1903
|
+
default: false,
|
|
1904
|
+
type: "boolean",
|
|
1905
|
+
hidden: true
|
|
1662
1906
|
})
|
|
1663
1907
|
)
|
|
1664
1908
|
)
|
|
1665
1909
|
),
|
|
1666
|
-
handler: async ({
|
|
1910
|
+
handler: async ({
|
|
1911
|
+
apiHost,
|
|
1912
|
+
apiKey,
|
|
1913
|
+
proxy,
|
|
1914
|
+
ids,
|
|
1915
|
+
all,
|
|
1916
|
+
onlyCompositions,
|
|
1917
|
+
onlyPatterns,
|
|
1918
|
+
project: projectId,
|
|
1919
|
+
diff,
|
|
1920
|
+
whatIf
|
|
1921
|
+
}) => {
|
|
1922
|
+
if (!all && !ids || all && ids) {
|
|
1923
|
+
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
1924
|
+
process.exit(1);
|
|
1925
|
+
}
|
|
1926
|
+
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
1927
|
+
const targetItems = /* @__PURE__ */ new Map();
|
|
1667
1928
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1668
1929
|
const client = new UncachedCanvasClient13({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1669
|
-
|
|
1930
|
+
const source = createComponentInstanceEngineDataSource({
|
|
1931
|
+
client,
|
|
1932
|
+
state: "published",
|
|
1933
|
+
compositionIDs: compositionIDsArray,
|
|
1934
|
+
onlyCompositions,
|
|
1935
|
+
onlyPatterns
|
|
1936
|
+
});
|
|
1937
|
+
const target = createComponentInstanceEngineDataSource({
|
|
1938
|
+
client,
|
|
1939
|
+
state: "preview",
|
|
1940
|
+
compositionIDs: compositionIDsArray,
|
|
1941
|
+
onlyCompositions,
|
|
1942
|
+
onlyPatterns
|
|
1943
|
+
});
|
|
1944
|
+
const actions = [];
|
|
1945
|
+
const log = createSyncEngineConsoleLogger({ diffMode: diff });
|
|
1946
|
+
for await (const obj of target.objects) {
|
|
1947
|
+
if (Array.isArray(obj.id)) {
|
|
1948
|
+
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
1949
|
+
} else {
|
|
1950
|
+
targetItems.set(obj.id, obj);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
for await (const sourceObject of source.objects) {
|
|
1954
|
+
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
1955
|
+
const targetObject = targetItems.get(id);
|
|
1956
|
+
if (!targetObject) {
|
|
1957
|
+
console.log(`Composition ${id} was not found`);
|
|
1958
|
+
return;
|
|
1959
|
+
}
|
|
1960
|
+
actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
|
|
1961
|
+
log({
|
|
1962
|
+
action: "update",
|
|
1963
|
+
id,
|
|
1964
|
+
providerId: sourceObject.providerId,
|
|
1965
|
+
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
1966
|
+
whatIf,
|
|
1967
|
+
diff: diffJson2(targetObject.object, sourceObject.object)
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1670
1970
|
}
|
|
1671
1971
|
};
|
|
1672
1972
|
|
|
@@ -1676,11 +1976,11 @@ var CompositionUpdateModule = {
|
|
|
1676
1976
|
command: "update <filename>",
|
|
1677
1977
|
aliases: ["put"],
|
|
1678
1978
|
describe: "Insert or update a composition",
|
|
1679
|
-
builder: (
|
|
1979
|
+
builder: (yargs25) => withConfiguration(
|
|
1680
1980
|
withApiOptions(
|
|
1681
1981
|
withProjectOptions(
|
|
1682
1982
|
withStateOptions(
|
|
1683
|
-
|
|
1983
|
+
yargs25.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
1684
1984
|
)
|
|
1685
1985
|
)
|
|
1686
1986
|
)
|
|
@@ -1698,27 +1998,304 @@ var CompositionModule = {
|
|
|
1698
1998
|
command: "composition <command>",
|
|
1699
1999
|
describe: "Commands for Canvas compositions",
|
|
1700
2000
|
aliases: ["comp"],
|
|
1701
|
-
builder: (
|
|
2001
|
+
builder: (yargs25) => yargs25.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
1702
2002
|
handler: () => {
|
|
1703
2003
|
yargs3.help();
|
|
1704
2004
|
}
|
|
1705
2005
|
};
|
|
1706
2006
|
|
|
1707
|
-
// src/commands/canvas/commands/
|
|
2007
|
+
// src/commands/canvas/commands/contentType.ts
|
|
1708
2008
|
import yargs4 from "yargs";
|
|
1709
2009
|
|
|
2010
|
+
// src/commands/canvas/commands/contentType/get.ts
|
|
2011
|
+
import { ContentClient } from "@uniformdev/canvas";
|
|
2012
|
+
var ContentTypeGetModule = {
|
|
2013
|
+
command: "get <id>",
|
|
2014
|
+
describe: "Get a content type",
|
|
2015
|
+
builder: (yargs25) => withFormatOptions(
|
|
2016
|
+
withApiOptions(
|
|
2017
|
+
withProjectOptions(
|
|
2018
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2019
|
+
yargs25.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2020
|
+
)
|
|
2021
|
+
)
|
|
2022
|
+
),
|
|
2023
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
2024
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2025
|
+
const client = new ContentClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2026
|
+
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2027
|
+
const found = res.contentTypes.find((f) => f.id === id);
|
|
2028
|
+
if (!found) {
|
|
2029
|
+
throw new Error(`Content type with ID ${id} not found`);
|
|
2030
|
+
}
|
|
2031
|
+
emitWithFormat(found, format, filename);
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
|
|
2035
|
+
// src/commands/canvas/commands/contentType/list.ts
|
|
2036
|
+
import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
2037
|
+
var ContentTypeListModule = {
|
|
2038
|
+
command: "list",
|
|
2039
|
+
describe: "List content types",
|
|
2040
|
+
builder: (yargs25) => withFormatOptions(withApiOptions(withProjectOptions(yargs25))),
|
|
2041
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2042
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2043
|
+
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2044
|
+
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2045
|
+
emitWithFormat(res.contentTypes, format, filename);
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2049
|
+
// src/commands/canvas/commands/contentType/pull.ts
|
|
2050
|
+
import { ContentClient as ContentClient3 } from "@uniformdev/canvas";
|
|
2051
|
+
|
|
2052
|
+
// src/commands/canvas/commands/contentType/_util.ts
|
|
2053
|
+
var selectContentTypeIdentifier = (ct) => ct.id;
|
|
2054
|
+
var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
|
|
2055
|
+
|
|
2056
|
+
// src/commands/canvas/contentTypeEngineDataSource.ts
|
|
2057
|
+
function createContentTypeEngineDataSource({
|
|
2058
|
+
client
|
|
2059
|
+
}) {
|
|
2060
|
+
async function* getObjects() {
|
|
2061
|
+
const { contentTypes } = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2062
|
+
for await (const ct of contentTypes) {
|
|
2063
|
+
const result = {
|
|
2064
|
+
id: selectContentTypeIdentifier(ct),
|
|
2065
|
+
displayName: selectContentTypeDisplayName(ct),
|
|
2066
|
+
providerId: ct.id,
|
|
2067
|
+
object: ct
|
|
2068
|
+
};
|
|
2069
|
+
yield result;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
return {
|
|
2073
|
+
objects: getObjects(),
|
|
2074
|
+
deleteObject: async (providerId) => {
|
|
2075
|
+
await client.deleteContentType({ contentTypeId: providerId });
|
|
2076
|
+
},
|
|
2077
|
+
writeObject: async ({ object }) => {
|
|
2078
|
+
await client.upsertContentType({ contentType: object });
|
|
2079
|
+
}
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
// src/commands/canvas/commands/contentType/pull.ts
|
|
2084
|
+
var ContentTypePullModule = {
|
|
2085
|
+
command: "pull <directory>",
|
|
2086
|
+
describe: "Pulls all content types to local files in a directory",
|
|
2087
|
+
builder: (yargs25) => withApiOptions(
|
|
2088
|
+
withProjectOptions(
|
|
2089
|
+
withDiffOptions(
|
|
2090
|
+
yargs25.positional("directory", {
|
|
2091
|
+
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.",
|
|
2092
|
+
type: "string"
|
|
2093
|
+
}).option("format", {
|
|
2094
|
+
alias: ["f"],
|
|
2095
|
+
describe: "Output format",
|
|
2096
|
+
default: "yaml",
|
|
2097
|
+
choices: ["yaml", "json"],
|
|
2098
|
+
type: "string"
|
|
2099
|
+
}).option("what-if", {
|
|
2100
|
+
alias: ["w"],
|
|
2101
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2102
|
+
default: false,
|
|
2103
|
+
type: "boolean"
|
|
2104
|
+
}).option("mode", {
|
|
2105
|
+
alias: ["m"],
|
|
2106
|
+
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',
|
|
2107
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2108
|
+
default: "mirror",
|
|
2109
|
+
type: "string"
|
|
2110
|
+
})
|
|
2111
|
+
)
|
|
2112
|
+
)
|
|
2113
|
+
),
|
|
2114
|
+
handler: async ({
|
|
2115
|
+
apiHost,
|
|
2116
|
+
apiKey,
|
|
2117
|
+
proxy,
|
|
2118
|
+
directory,
|
|
2119
|
+
format,
|
|
2120
|
+
mode,
|
|
2121
|
+
whatIf,
|
|
2122
|
+
project: projectId,
|
|
2123
|
+
diff: diffMode
|
|
2124
|
+
}) => {
|
|
2125
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2126
|
+
const client = new ContentClient3({
|
|
2127
|
+
apiKey,
|
|
2128
|
+
apiHost,
|
|
2129
|
+
fetch: fetch3,
|
|
2130
|
+
projectId,
|
|
2131
|
+
bypassCache: true
|
|
2132
|
+
});
|
|
2133
|
+
const source = createContentTypeEngineDataSource({ client });
|
|
2134
|
+
let target;
|
|
2135
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2136
|
+
if (isPackage) {
|
|
2137
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
2138
|
+
target = await createArraySyncEngineDataSource({
|
|
2139
|
+
objects: packageContents.contentTypes ?? [],
|
|
2140
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2141
|
+
selectDisplayName: selectContentTypeDisplayName,
|
|
2142
|
+
onSyncComplete: async (_, synced) => {
|
|
2143
|
+
packageContents.contentTypes = synced;
|
|
2144
|
+
writeCanvasPackage(directory, packageContents);
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
} else {
|
|
2148
|
+
target = await createFileSyncEngineDataSource({
|
|
2149
|
+
directory,
|
|
2150
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2151
|
+
selectDisplayName: selectContentTypeDisplayName,
|
|
2152
|
+
format
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
await syncEngine({
|
|
2156
|
+
source,
|
|
2157
|
+
target,
|
|
2158
|
+
mode,
|
|
2159
|
+
whatIf,
|
|
2160
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
};
|
|
2164
|
+
|
|
2165
|
+
// src/commands/canvas/commands/contentType/push.ts
|
|
2166
|
+
import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
2167
|
+
var ContentTypePushModule = {
|
|
2168
|
+
command: "push <directory>",
|
|
2169
|
+
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2170
|
+
builder: (yargs25) => withApiOptions(
|
|
2171
|
+
withProjectOptions(
|
|
2172
|
+
withDiffOptions(
|
|
2173
|
+
yargs25.positional("directory", {
|
|
2174
|
+
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2175
|
+
type: "string"
|
|
2176
|
+
}).option("what-if", {
|
|
2177
|
+
alias: ["w"],
|
|
2178
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2179
|
+
default: false,
|
|
2180
|
+
type: "boolean"
|
|
2181
|
+
}).option("mode", {
|
|
2182
|
+
alias: ["m"],
|
|
2183
|
+
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',
|
|
2184
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2185
|
+
default: "mirror",
|
|
2186
|
+
type: "string"
|
|
2187
|
+
})
|
|
2188
|
+
)
|
|
2189
|
+
)
|
|
2190
|
+
),
|
|
2191
|
+
handler: async ({
|
|
2192
|
+
apiHost,
|
|
2193
|
+
apiKey,
|
|
2194
|
+
proxy,
|
|
2195
|
+
directory,
|
|
2196
|
+
mode,
|
|
2197
|
+
whatIf,
|
|
2198
|
+
project: projectId,
|
|
2199
|
+
diff: diffMode
|
|
2200
|
+
}) => {
|
|
2201
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2202
|
+
const client = new ContentClient4({
|
|
2203
|
+
apiKey,
|
|
2204
|
+
apiHost,
|
|
2205
|
+
fetch: fetch3,
|
|
2206
|
+
projectId,
|
|
2207
|
+
bypassCache: true
|
|
2208
|
+
});
|
|
2209
|
+
let source;
|
|
2210
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2211
|
+
if (isPackage) {
|
|
2212
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
2213
|
+
source = await createArraySyncEngineDataSource({
|
|
2214
|
+
objects: packageContents.contentTypes ?? [],
|
|
2215
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2216
|
+
selectDisplayName: selectContentTypeDisplayName
|
|
2217
|
+
});
|
|
2218
|
+
} else {
|
|
2219
|
+
source = await createFileSyncEngineDataSource({
|
|
2220
|
+
directory,
|
|
2221
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2222
|
+
selectDisplayName: selectContentTypeDisplayName
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
const target = createContentTypeEngineDataSource({ client });
|
|
2226
|
+
await syncEngine({
|
|
2227
|
+
source,
|
|
2228
|
+
target,
|
|
2229
|
+
mode,
|
|
2230
|
+
whatIf,
|
|
2231
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
};
|
|
2235
|
+
|
|
2236
|
+
// src/commands/canvas/commands/contentType/remove.ts
|
|
2237
|
+
import { ContentClient as ContentClient5 } from "@uniformdev/canvas";
|
|
2238
|
+
var ContentTypeRemoveModule = {
|
|
2239
|
+
command: "remove <id>",
|
|
2240
|
+
aliases: ["delete", "rm"],
|
|
2241
|
+
describe: "Delete a content type",
|
|
2242
|
+
builder: (yargs25) => withApiOptions(
|
|
2243
|
+
withProjectOptions(
|
|
2244
|
+
yargs25.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2245
|
+
)
|
|
2246
|
+
),
|
|
2247
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
2248
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2249
|
+
const client = new ContentClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2250
|
+
await client.deleteContentType({ contentTypeId: id });
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
// src/commands/canvas/commands/contentType/update.ts
|
|
2255
|
+
import { ContentClient as ContentClient6 } from "@uniformdev/canvas";
|
|
2256
|
+
var ContentTypeUpdateModule = {
|
|
2257
|
+
command: "update <filename>",
|
|
2258
|
+
aliases: ["put"],
|
|
2259
|
+
describe: "Insert or update a content type",
|
|
2260
|
+
builder: (yargs25) => withApiOptions(
|
|
2261
|
+
withProjectOptions(
|
|
2262
|
+
yargs25.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2263
|
+
)
|
|
2264
|
+
),
|
|
2265
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2266
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2267
|
+
const client = new ContentClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2268
|
+
const file = readFileToObject(filename);
|
|
2269
|
+
await client.upsertContentType({ contentType: file });
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
|
|
2273
|
+
// src/commands/canvas/commands/contentType.ts
|
|
2274
|
+
var ContentTypeModule = {
|
|
2275
|
+
command: "contenttype <command>",
|
|
2276
|
+
aliases: ["ct"],
|
|
2277
|
+
describe: "Commands for Content Types",
|
|
2278
|
+
builder: (yargs25) => yargs25.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2279
|
+
handler: () => {
|
|
2280
|
+
yargs4.help();
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
// src/commands/canvas/commands/dataType.ts
|
|
2285
|
+
import yargs5 from "yargs";
|
|
2286
|
+
|
|
1710
2287
|
// src/commands/canvas/commands/dataType/get.ts
|
|
1711
2288
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
1712
2289
|
var DataTypeGetModule = {
|
|
1713
2290
|
command: "get <id>",
|
|
1714
2291
|
describe: "Get a data type",
|
|
1715
2292
|
aliases: ["ls"],
|
|
1716
|
-
builder: (
|
|
2293
|
+
builder: (yargs25) => withConfiguration(
|
|
1717
2294
|
withFormatOptions(
|
|
1718
2295
|
withApiOptions(
|
|
1719
2296
|
withProjectOptions(
|
|
1720
2297
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1721
|
-
|
|
2298
|
+
yargs25.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
1722
2299
|
)
|
|
1723
2300
|
)
|
|
1724
2301
|
)
|
|
@@ -1741,7 +2318,7 @@ var DataTypeListModule = {
|
|
|
1741
2318
|
command: "list",
|
|
1742
2319
|
describe: "List data types",
|
|
1743
2320
|
aliases: ["ls"],
|
|
1744
|
-
builder: (
|
|
2321
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
1745
2322
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1746
2323
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1747
2324
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -1790,11 +2367,11 @@ function createDataTypeEngineDataSource({
|
|
|
1790
2367
|
var DataTypePullModule = {
|
|
1791
2368
|
command: "pull <directory>",
|
|
1792
2369
|
describe: "Pulls all data types to local files in a directory",
|
|
1793
|
-
builder: (
|
|
2370
|
+
builder: (yargs25) => withConfiguration(
|
|
1794
2371
|
withApiOptions(
|
|
1795
2372
|
withProjectOptions(
|
|
1796
2373
|
withDiffOptions(
|
|
1797
|
-
|
|
2374
|
+
yargs25.positional("directory", {
|
|
1798
2375
|
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.",
|
|
1799
2376
|
type: "string"
|
|
1800
2377
|
}).option("format", {
|
|
@@ -1875,11 +2452,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
1875
2452
|
var DataTypePushModule = {
|
|
1876
2453
|
command: "push <directory>",
|
|
1877
2454
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
1878
|
-
builder: (
|
|
2455
|
+
builder: (yargs25) => withConfiguration(
|
|
1879
2456
|
withApiOptions(
|
|
1880
2457
|
withProjectOptions(
|
|
1881
2458
|
withDiffOptions(
|
|
1882
|
-
|
|
2459
|
+
yargs25.positional("directory", {
|
|
1883
2460
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
1884
2461
|
type: "string"
|
|
1885
2462
|
}).option("what-if", {
|
|
@@ -1949,10 +2526,10 @@ var DataTypeRemoveModule = {
|
|
|
1949
2526
|
command: "remove <id>",
|
|
1950
2527
|
aliases: ["delete", "rm"],
|
|
1951
2528
|
describe: "Delete a data type",
|
|
1952
|
-
builder: (
|
|
2529
|
+
builder: (yargs25) => withConfiguration(
|
|
1953
2530
|
withApiOptions(
|
|
1954
2531
|
withProjectOptions(
|
|
1955
|
-
|
|
2532
|
+
yargs25.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
1956
2533
|
)
|
|
1957
2534
|
)
|
|
1958
2535
|
),
|
|
@@ -1969,10 +2546,10 @@ var DataTypeUpdateModule = {
|
|
|
1969
2546
|
command: "update <filename>",
|
|
1970
2547
|
aliases: ["put"],
|
|
1971
2548
|
describe: "Insert or update a data type",
|
|
1972
|
-
builder: (
|
|
2549
|
+
builder: (yargs25) => withConfiguration(
|
|
1973
2550
|
withApiOptions(
|
|
1974
2551
|
withProjectOptions(
|
|
1975
|
-
|
|
2552
|
+
yargs25.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
1976
2553
|
)
|
|
1977
2554
|
)
|
|
1978
2555
|
),
|
|
@@ -1989,14 +2566,287 @@ var DataTypeModule = {
|
|
|
1989
2566
|
command: "datatype <command>",
|
|
1990
2567
|
aliases: ["dt"],
|
|
1991
2568
|
describe: "Commands for Data Type definitions",
|
|
1992
|
-
builder: (
|
|
2569
|
+
builder: (yargs25) => yargs25.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
1993
2570
|
handler: () => {
|
|
1994
|
-
|
|
2571
|
+
yargs5.help();
|
|
2572
|
+
}
|
|
2573
|
+
};
|
|
2574
|
+
|
|
2575
|
+
// src/commands/canvas/commands/entry.ts
|
|
2576
|
+
import yargs6 from "yargs";
|
|
2577
|
+
|
|
2578
|
+
// src/commands/canvas/commands/entry/get.ts
|
|
2579
|
+
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
2580
|
+
var EntryGetModule = {
|
|
2581
|
+
command: "get <id>",
|
|
2582
|
+
describe: "Get an entry",
|
|
2583
|
+
builder: (yargs25) => withFormatOptions(
|
|
2584
|
+
withApiOptions(
|
|
2585
|
+
withProjectOptions(
|
|
2586
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2587
|
+
yargs25.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
2588
|
+
)
|
|
2589
|
+
)
|
|
2590
|
+
),
|
|
2591
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
2592
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2593
|
+
const client = new ContentClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2594
|
+
const res = await client.getEntries({ offset: 0, limit: 1, entryIDs: [id] });
|
|
2595
|
+
if (res.entries.length !== 1) {
|
|
2596
|
+
throw new Error(`Entry with ID ${id} not found`);
|
|
2597
|
+
}
|
|
2598
|
+
emitWithFormat(res.entries[0], format, filename);
|
|
2599
|
+
}
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2602
|
+
// src/commands/canvas/commands/entry/list.ts
|
|
2603
|
+
import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
2604
|
+
var EntryListModule = {
|
|
2605
|
+
command: "list",
|
|
2606
|
+
describe: "List entries",
|
|
2607
|
+
builder: (yargs25) => withFormatOptions(withApiOptions(withProjectOptions(yargs25))),
|
|
2608
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2609
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2610
|
+
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2611
|
+
const res = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
2612
|
+
emitWithFormat(res.entries, format, filename);
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2616
|
+
// src/commands/canvas/commands/entry/pull.ts
|
|
2617
|
+
import { ContentClient as ContentClient9 } from "@uniformdev/canvas";
|
|
2618
|
+
|
|
2619
|
+
// src/commands/canvas/commands/entry/_util.ts
|
|
2620
|
+
var selectEntryIdentifier = (e) => e.entry._id;
|
|
2621
|
+
var selectEntryDisplayName = (e) => `${e.entry._name ?? "Untitled"} (pid: ${e.entry._id})`;
|
|
2622
|
+
|
|
2623
|
+
// src/commands/canvas/entryEngineDataSource.ts
|
|
2624
|
+
function createEntryEngineDataSource({
|
|
2625
|
+
client
|
|
2626
|
+
}) {
|
|
2627
|
+
async function* getObjects() {
|
|
2628
|
+
const { entries } = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
2629
|
+
for await (const e of entries) {
|
|
2630
|
+
const result = {
|
|
2631
|
+
id: selectEntryIdentifier(e),
|
|
2632
|
+
displayName: selectEntryDisplayName(e),
|
|
2633
|
+
providerId: e.entry._id,
|
|
2634
|
+
object: e
|
|
2635
|
+
};
|
|
2636
|
+
yield result;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
return {
|
|
2640
|
+
objects: getObjects(),
|
|
2641
|
+
deleteObject: async (providerId) => {
|
|
2642
|
+
await client.deleteEntry({ entryId: providerId });
|
|
2643
|
+
},
|
|
2644
|
+
writeObject: async ({ object }) => {
|
|
2645
|
+
await client.upsertEntry(object);
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
// src/commands/canvas/commands/entry/pull.ts
|
|
2651
|
+
var EntryPullModule = {
|
|
2652
|
+
command: "pull <directory>",
|
|
2653
|
+
describe: "Pulls all entries to local files in a directory",
|
|
2654
|
+
builder: (yargs25) => withApiOptions(
|
|
2655
|
+
withProjectOptions(
|
|
2656
|
+
withDiffOptions(
|
|
2657
|
+
yargs25.positional("directory", {
|
|
2658
|
+
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.",
|
|
2659
|
+
type: "string"
|
|
2660
|
+
}).option("format", {
|
|
2661
|
+
alias: ["f"],
|
|
2662
|
+
describe: "Output format",
|
|
2663
|
+
default: "yaml",
|
|
2664
|
+
choices: ["yaml", "json"],
|
|
2665
|
+
type: "string"
|
|
2666
|
+
}).option("what-if", {
|
|
2667
|
+
alias: ["w"],
|
|
2668
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2669
|
+
default: false,
|
|
2670
|
+
type: "boolean"
|
|
2671
|
+
}).option("mode", {
|
|
2672
|
+
alias: ["m"],
|
|
2673
|
+
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',
|
|
2674
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2675
|
+
default: "mirror",
|
|
2676
|
+
type: "string"
|
|
2677
|
+
})
|
|
2678
|
+
)
|
|
2679
|
+
)
|
|
2680
|
+
),
|
|
2681
|
+
handler: async ({
|
|
2682
|
+
apiHost,
|
|
2683
|
+
apiKey,
|
|
2684
|
+
proxy,
|
|
2685
|
+
directory,
|
|
2686
|
+
format,
|
|
2687
|
+
mode,
|
|
2688
|
+
whatIf,
|
|
2689
|
+
project: projectId,
|
|
2690
|
+
diff: diffMode
|
|
2691
|
+
}) => {
|
|
2692
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2693
|
+
const client = new ContentClient9({
|
|
2694
|
+
apiKey,
|
|
2695
|
+
apiHost,
|
|
2696
|
+
fetch: fetch3,
|
|
2697
|
+
projectId,
|
|
2698
|
+
bypassCache: true
|
|
2699
|
+
});
|
|
2700
|
+
const source = createEntryEngineDataSource({ client });
|
|
2701
|
+
let target;
|
|
2702
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2703
|
+
if (isPackage) {
|
|
2704
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
2705
|
+
target = await createArraySyncEngineDataSource({
|
|
2706
|
+
objects: packageContents.entries ?? [],
|
|
2707
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2708
|
+
selectDisplayName: selectEntryDisplayName,
|
|
2709
|
+
onSyncComplete: async (_, synced) => {
|
|
2710
|
+
packageContents.entries = synced;
|
|
2711
|
+
writeCanvasPackage(directory, packageContents);
|
|
2712
|
+
}
|
|
2713
|
+
});
|
|
2714
|
+
} else {
|
|
2715
|
+
target = await createFileSyncEngineDataSource({
|
|
2716
|
+
directory,
|
|
2717
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2718
|
+
selectDisplayName: selectEntryDisplayName,
|
|
2719
|
+
format
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
await syncEngine({
|
|
2723
|
+
source,
|
|
2724
|
+
target,
|
|
2725
|
+
mode,
|
|
2726
|
+
whatIf,
|
|
2727
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
|
|
2732
|
+
// src/commands/canvas/commands/entry/push.ts
|
|
2733
|
+
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
2734
|
+
var EntryPushModule = {
|
|
2735
|
+
command: "push <directory>",
|
|
2736
|
+
describe: "Pushes all entries from files in a directory to Uniform",
|
|
2737
|
+
builder: (yargs25) => withApiOptions(
|
|
2738
|
+
withProjectOptions(
|
|
2739
|
+
withDiffOptions(
|
|
2740
|
+
yargs25.positional("directory", {
|
|
2741
|
+
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
2742
|
+
type: "string"
|
|
2743
|
+
}).option("what-if", {
|
|
2744
|
+
alias: ["w"],
|
|
2745
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2746
|
+
default: false,
|
|
2747
|
+
type: "boolean"
|
|
2748
|
+
}).option("mode", {
|
|
2749
|
+
alias: ["m"],
|
|
2750
|
+
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',
|
|
2751
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2752
|
+
default: "mirror",
|
|
2753
|
+
type: "string"
|
|
2754
|
+
})
|
|
2755
|
+
)
|
|
2756
|
+
)
|
|
2757
|
+
),
|
|
2758
|
+
handler: async ({
|
|
2759
|
+
apiHost,
|
|
2760
|
+
apiKey,
|
|
2761
|
+
proxy,
|
|
2762
|
+
directory,
|
|
2763
|
+
mode,
|
|
2764
|
+
whatIf,
|
|
2765
|
+
project: projectId,
|
|
2766
|
+
diff: diffMode
|
|
2767
|
+
}) => {
|
|
2768
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2769
|
+
const client = new ContentClient10({
|
|
2770
|
+
apiKey,
|
|
2771
|
+
apiHost,
|
|
2772
|
+
fetch: fetch3,
|
|
2773
|
+
projectId,
|
|
2774
|
+
bypassCache: true
|
|
2775
|
+
});
|
|
2776
|
+
let source;
|
|
2777
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2778
|
+
if (isPackage) {
|
|
2779
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
2780
|
+
source = await createArraySyncEngineDataSource({
|
|
2781
|
+
objects: packageContents.entries ?? [],
|
|
2782
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2783
|
+
selectDisplayName: selectEntryDisplayName
|
|
2784
|
+
});
|
|
2785
|
+
} else {
|
|
2786
|
+
source = await createFileSyncEngineDataSource({
|
|
2787
|
+
directory,
|
|
2788
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2789
|
+
selectDisplayName: selectEntryDisplayName
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2792
|
+
const target = createEntryEngineDataSource({ client });
|
|
2793
|
+
await syncEngine({
|
|
2794
|
+
source,
|
|
2795
|
+
target,
|
|
2796
|
+
mode,
|
|
2797
|
+
whatIf,
|
|
2798
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2799
|
+
});
|
|
2800
|
+
}
|
|
2801
|
+
};
|
|
2802
|
+
|
|
2803
|
+
// src/commands/canvas/commands/entry/remove.ts
|
|
2804
|
+
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
2805
|
+
var EntryRemoveModule = {
|
|
2806
|
+
command: "remove <id>",
|
|
2807
|
+
aliases: ["delete", "rm"],
|
|
2808
|
+
describe: "Delete an entry",
|
|
2809
|
+
builder: (yargs25) => withApiOptions(
|
|
2810
|
+
withProjectOptions(
|
|
2811
|
+
yargs25.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
2812
|
+
)
|
|
2813
|
+
),
|
|
2814
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
2815
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2816
|
+
const client = new ContentClient11({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2817
|
+
await client.deleteEntry({ entryId: id });
|
|
2818
|
+
}
|
|
2819
|
+
};
|
|
2820
|
+
|
|
2821
|
+
// src/commands/canvas/commands/entry/update.ts
|
|
2822
|
+
import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
|
|
2823
|
+
var EntryUpdateModule = {
|
|
2824
|
+
command: "update <filename>",
|
|
2825
|
+
aliases: ["put"],
|
|
2826
|
+
describe: "Insert or update an entry",
|
|
2827
|
+
builder: (yargs25) => withApiOptions(
|
|
2828
|
+
withProjectOptions(yargs25.positional("filename", { demandOption: true, describe: "Entry file to put" }))
|
|
2829
|
+
),
|
|
2830
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2831
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2832
|
+
const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2833
|
+
const file = readFileToObject(filename);
|
|
2834
|
+
await client.upsertEntry(file);
|
|
2835
|
+
}
|
|
2836
|
+
};
|
|
2837
|
+
|
|
2838
|
+
// src/commands/canvas/commands/entry.ts
|
|
2839
|
+
var EntryModule = {
|
|
2840
|
+
command: "entry <command>",
|
|
2841
|
+
describe: "Commands for Entries",
|
|
2842
|
+
builder: (yargs25) => yargs25.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
2843
|
+
handler: () => {
|
|
2844
|
+
yargs6.help();
|
|
1995
2845
|
}
|
|
1996
2846
|
};
|
|
1997
2847
|
|
|
1998
2848
|
// src/commands/canvas/commands/pattern.ts
|
|
1999
|
-
import
|
|
2849
|
+
import yargs7 from "yargs";
|
|
2000
2850
|
|
|
2001
2851
|
// src/commands/canvas/commands/pattern/get.ts
|
|
2002
2852
|
var PatternGetModule = {
|
|
@@ -2008,12 +2858,12 @@ var PatternGetModule = {
|
|
|
2008
2858
|
var PatternListModule = {
|
|
2009
2859
|
...CompositionListModule,
|
|
2010
2860
|
describe: "List patterns",
|
|
2011
|
-
builder: (
|
|
2861
|
+
builder: (yargs25) => withFormatOptions(
|
|
2012
2862
|
withConfiguration(
|
|
2013
2863
|
withApiOptions(
|
|
2014
2864
|
withProjectOptions(
|
|
2015
2865
|
withStateOptions(
|
|
2016
|
-
|
|
2866
|
+
yargs25.options({
|
|
2017
2867
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2018
2868
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2019
2869
|
resolvePatterns: {
|
|
@@ -2050,19 +2900,55 @@ var PatternListModule = {
|
|
|
2050
2900
|
// src/commands/canvas/commands/pattern/publish.ts
|
|
2051
2901
|
var PatternPublishModule = {
|
|
2052
2902
|
...CompositionPublishModule,
|
|
2053
|
-
describe: "Publishes
|
|
2903
|
+
describe: "Publishes pattern(s)",
|
|
2904
|
+
builder: (yargs25) => withConfiguration(
|
|
2905
|
+
withApiOptions(
|
|
2906
|
+
withProjectOptions(
|
|
2907
|
+
withDiffOptions(
|
|
2908
|
+
yargs25.positional("ids", {
|
|
2909
|
+
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2910
|
+
type: "string"
|
|
2911
|
+
}).option("all", {
|
|
2912
|
+
alias: ["a"],
|
|
2913
|
+
describe: "Publishes all patterns. Use compositionId to publish one instead.",
|
|
2914
|
+
default: false,
|
|
2915
|
+
type: "boolean"
|
|
2916
|
+
}).option("what-if", {
|
|
2917
|
+
alias: ["w"],
|
|
2918
|
+
describe: "What-if mode reports what would be done but does not perform any un-publishing",
|
|
2919
|
+
default: false,
|
|
2920
|
+
type: "boolean"
|
|
2921
|
+
}).option("publishingState", {
|
|
2922
|
+
describe: 'Publishing state to update to. Can be "published" or "preview".',
|
|
2923
|
+
default: "published",
|
|
2924
|
+
type: "string",
|
|
2925
|
+
hidden: true
|
|
2926
|
+
}).option("onlyCompositions", {
|
|
2927
|
+
describe: "Only publishing compositions and not patterns",
|
|
2928
|
+
default: false,
|
|
2929
|
+
type: "boolean"
|
|
2930
|
+
}).option("onlyPatterns", {
|
|
2931
|
+
describe: "Only pulling patterns and not compositions",
|
|
2932
|
+
default: true,
|
|
2933
|
+
type: "boolean",
|
|
2934
|
+
hidden: true
|
|
2935
|
+
})
|
|
2936
|
+
)
|
|
2937
|
+
)
|
|
2938
|
+
)
|
|
2939
|
+
)
|
|
2054
2940
|
};
|
|
2055
2941
|
|
|
2056
2942
|
// src/commands/canvas/commands/pattern/pull.ts
|
|
2057
2943
|
var PatternPullModule = {
|
|
2058
2944
|
...CompositionPullModule,
|
|
2059
2945
|
describe: "Pulls all patterns to local files in a directory",
|
|
2060
|
-
builder: (
|
|
2946
|
+
builder: (yargs25) => withConfiguration(
|
|
2061
2947
|
withApiOptions(
|
|
2062
2948
|
withProjectOptions(
|
|
2063
2949
|
withStateOptions(
|
|
2064
2950
|
withDiffOptions(
|
|
2065
|
-
|
|
2951
|
+
yargs25.positional("directory", {
|
|
2066
2952
|
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.",
|
|
2067
2953
|
type: "string"
|
|
2068
2954
|
}).option("format", {
|
|
@@ -2100,12 +2986,12 @@ var PatternPullModule = {
|
|
|
2100
2986
|
var PatternPushModule = {
|
|
2101
2987
|
...CompositionPushModule,
|
|
2102
2988
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
2103
|
-
builder: (
|
|
2989
|
+
builder: (yargs25) => withConfiguration(
|
|
2104
2990
|
withApiOptions(
|
|
2105
2991
|
withProjectOptions(
|
|
2106
2992
|
withStateOptions(
|
|
2107
2993
|
withDiffOptions(
|
|
2108
|
-
|
|
2994
|
+
yargs25.positional("directory", {
|
|
2109
2995
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2110
2996
|
type: "string"
|
|
2111
2997
|
}).option("what-if", {
|
|
@@ -2141,8 +3027,38 @@ var PatternRemoveModule = {
|
|
|
2141
3027
|
|
|
2142
3028
|
// src/commands/canvas/commands/pattern/unpublish.ts
|
|
2143
3029
|
var PatternUnpublishModule = {
|
|
2144
|
-
|
|
2145
|
-
describe: "Unpublish a pattern"
|
|
3030
|
+
command: "unpublish [ids]",
|
|
3031
|
+
describe: "Unpublish a pattern(s)",
|
|
3032
|
+
builder: (yargs25) => withConfiguration(
|
|
3033
|
+
withApiOptions(
|
|
3034
|
+
withProjectOptions(
|
|
3035
|
+
yargs25.positional("ids", {
|
|
3036
|
+
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3037
|
+
type: "string"
|
|
3038
|
+
}).option("all", {
|
|
3039
|
+
alias: ["a"],
|
|
3040
|
+
describe: "Un-pPublishes all compositions. Use compositionId to publish one instead.",
|
|
3041
|
+
default: false,
|
|
3042
|
+
type: "boolean"
|
|
3043
|
+
}).option("what-if", {
|
|
3044
|
+
alias: ["w"],
|
|
3045
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
3046
|
+
default: false,
|
|
3047
|
+
type: "boolean"
|
|
3048
|
+
}).option("onlyCompositions", {
|
|
3049
|
+
describe: "Only publishing compositions and not patterns",
|
|
3050
|
+
default: false,
|
|
3051
|
+
type: "boolean"
|
|
3052
|
+
}).option("onlyPatterns", {
|
|
3053
|
+
describe: "Only pulling patterns and not compositions",
|
|
3054
|
+
default: true,
|
|
3055
|
+
type: "boolean",
|
|
3056
|
+
hidden: true
|
|
3057
|
+
})
|
|
3058
|
+
)
|
|
3059
|
+
)
|
|
3060
|
+
),
|
|
3061
|
+
handler: CompositionUnpublishModule.handler
|
|
2146
3062
|
};
|
|
2147
3063
|
|
|
2148
3064
|
// src/commands/canvas/commands/pattern/update.ts
|
|
@@ -2155,9 +3071,9 @@ var PatternUpdateModule = {
|
|
|
2155
3071
|
var PatternModule = {
|
|
2156
3072
|
command: "pattern <command>",
|
|
2157
3073
|
describe: "Commands for Canvas patterns",
|
|
2158
|
-
builder: (
|
|
3074
|
+
builder: (yargs25) => yargs25.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
2159
3075
|
handler: () => {
|
|
2160
|
-
|
|
3076
|
+
yargs7.help();
|
|
2161
3077
|
}
|
|
2162
3078
|
};
|
|
2163
3079
|
|
|
@@ -2166,28 +3082,28 @@ var CanvasCommand = {
|
|
|
2166
3082
|
command: "canvas <command>",
|
|
2167
3083
|
aliases: ["cv", "pm", "presentation"],
|
|
2168
3084
|
describe: "Uniform Canvas commands",
|
|
2169
|
-
builder: (
|
|
3085
|
+
builder: (yargs25) => yargs25.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).demandCommand(),
|
|
2170
3086
|
handler: () => {
|
|
2171
|
-
|
|
3087
|
+
yargs8.showHelp();
|
|
2172
3088
|
}
|
|
2173
3089
|
};
|
|
2174
3090
|
|
|
2175
3091
|
// src/commands/context/index.ts
|
|
2176
|
-
import
|
|
3092
|
+
import yargs15 from "yargs";
|
|
2177
3093
|
|
|
2178
3094
|
// src/commands/context/commands/aggregate.ts
|
|
2179
|
-
import
|
|
3095
|
+
import yargs9 from "yargs";
|
|
2180
3096
|
|
|
2181
3097
|
// src/commands/context/commands/aggregate/get.ts
|
|
2182
3098
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
2183
3099
|
var AggregateGetModule = {
|
|
2184
3100
|
command: "get <id>",
|
|
2185
3101
|
describe: "Fetch an aggregate",
|
|
2186
|
-
builder: (
|
|
3102
|
+
builder: (yargs25) => withConfiguration(
|
|
2187
3103
|
withFormatOptions(
|
|
2188
3104
|
withApiOptions(
|
|
2189
3105
|
withProjectOptions(
|
|
2190
|
-
|
|
3106
|
+
yargs25.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
2191
3107
|
)
|
|
2192
3108
|
)
|
|
2193
3109
|
)
|
|
@@ -2211,7 +3127,7 @@ var AggregateListModule = {
|
|
|
2211
3127
|
command: "list",
|
|
2212
3128
|
describe: "List aggregates",
|
|
2213
3129
|
aliases: ["ls"],
|
|
2214
|
-
builder: (
|
|
3130
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2215
3131
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2216
3132
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2217
3133
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2277,11 +3193,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
2277
3193
|
var AggregatePullModule = {
|
|
2278
3194
|
command: "pull <directory>",
|
|
2279
3195
|
describe: "Pulls all aggregates to local files in a directory",
|
|
2280
|
-
builder: (
|
|
3196
|
+
builder: (yargs25) => withConfiguration(
|
|
2281
3197
|
withApiOptions(
|
|
2282
3198
|
withProjectOptions(
|
|
2283
3199
|
withDiffOptions(
|
|
2284
|
-
|
|
3200
|
+
yargs25.positional("directory", {
|
|
2285
3201
|
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.",
|
|
2286
3202
|
type: "string"
|
|
2287
3203
|
}).option("format", {
|
|
@@ -2356,11 +3272,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
2356
3272
|
var AggregatePushModule = {
|
|
2357
3273
|
command: "push <directory>",
|
|
2358
3274
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
2359
|
-
builder: (
|
|
3275
|
+
builder: (yargs25) => withConfiguration(
|
|
2360
3276
|
withApiOptions(
|
|
2361
3277
|
withProjectOptions(
|
|
2362
3278
|
withDiffOptions(
|
|
2363
|
-
|
|
3279
|
+
yargs25.positional("directory", {
|
|
2364
3280
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
2365
3281
|
type: "string"
|
|
2366
3282
|
}).option("what-if", {
|
|
@@ -2425,10 +3341,10 @@ var AggregateRemoveModule = {
|
|
|
2425
3341
|
command: "remove <id>",
|
|
2426
3342
|
aliases: ["delete", "rm"],
|
|
2427
3343
|
describe: "Delete an aggregate",
|
|
2428
|
-
builder: (
|
|
3344
|
+
builder: (yargs25) => withConfiguration(
|
|
2429
3345
|
withApiOptions(
|
|
2430
3346
|
withProjectOptions(
|
|
2431
|
-
|
|
3347
|
+
yargs25.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
2432
3348
|
)
|
|
2433
3349
|
)
|
|
2434
3350
|
),
|
|
@@ -2445,10 +3361,10 @@ var AggregateUpdateModule = {
|
|
|
2445
3361
|
command: "update <filename>",
|
|
2446
3362
|
aliases: ["put"],
|
|
2447
3363
|
describe: "Insert or update an aggregate",
|
|
2448
|
-
builder: (
|
|
3364
|
+
builder: (yargs25) => withConfiguration(
|
|
2449
3365
|
withApiOptions(
|
|
2450
3366
|
withProjectOptions(
|
|
2451
|
-
|
|
3367
|
+
yargs25.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
2452
3368
|
)
|
|
2453
3369
|
)
|
|
2454
3370
|
),
|
|
@@ -2465,25 +3381,25 @@ var AggregateModule = {
|
|
|
2465
3381
|
command: "aggregate <command>",
|
|
2466
3382
|
aliases: ["agg", "intent", "audience"],
|
|
2467
3383
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
2468
|
-
builder: (
|
|
3384
|
+
builder: (yargs25) => yargs25.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
2469
3385
|
handler: () => {
|
|
2470
|
-
|
|
3386
|
+
yargs9.help();
|
|
2471
3387
|
}
|
|
2472
3388
|
};
|
|
2473
3389
|
|
|
2474
3390
|
// src/commands/context/commands/enrichment.ts
|
|
2475
|
-
import
|
|
3391
|
+
import yargs10 from "yargs";
|
|
2476
3392
|
|
|
2477
3393
|
// src/commands/context/commands/enrichment/get.ts
|
|
2478
3394
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
2479
3395
|
var EnrichmentGetModule = {
|
|
2480
3396
|
command: "get <id>",
|
|
2481
3397
|
describe: "Fetch an enrichment category and its values",
|
|
2482
|
-
builder: (
|
|
3398
|
+
builder: (yargs25) => withFormatOptions(
|
|
2483
3399
|
withConfiguration(
|
|
2484
3400
|
withApiOptions(
|
|
2485
3401
|
withProjectOptions(
|
|
2486
|
-
|
|
3402
|
+
yargs25.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
2487
3403
|
)
|
|
2488
3404
|
)
|
|
2489
3405
|
)
|
|
@@ -2508,7 +3424,7 @@ var EnrichmentListModule = {
|
|
|
2508
3424
|
command: "list",
|
|
2509
3425
|
describe: "List enrichments",
|
|
2510
3426
|
aliases: ["ls"],
|
|
2511
|
-
builder: (
|
|
3427
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2512
3428
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2513
3429
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2514
3430
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2609,11 +3525,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
2609
3525
|
var EnrichmentPullModule = {
|
|
2610
3526
|
command: "pull <directory>",
|
|
2611
3527
|
describe: "Pulls all enrichments to local files in a directory",
|
|
2612
|
-
builder: (
|
|
3528
|
+
builder: (yargs25) => withConfiguration(
|
|
2613
3529
|
withApiOptions(
|
|
2614
3530
|
withProjectOptions(
|
|
2615
3531
|
withDiffOptions(
|
|
2616
|
-
|
|
3532
|
+
yargs25.positional("directory", {
|
|
2617
3533
|
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.",
|
|
2618
3534
|
type: "string"
|
|
2619
3535
|
}).option("format", {
|
|
@@ -2688,11 +3604,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
2688
3604
|
var EnrichmentPushModule = {
|
|
2689
3605
|
command: "push <directory>",
|
|
2690
3606
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
2691
|
-
builder: (
|
|
3607
|
+
builder: (yargs25) => withConfiguration(
|
|
2692
3608
|
withApiOptions(
|
|
2693
3609
|
withProjectOptions(
|
|
2694
3610
|
withDiffOptions(
|
|
2695
|
-
|
|
3611
|
+
yargs25.positional("directory", {
|
|
2696
3612
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
2697
3613
|
type: "string"
|
|
2698
3614
|
}).option("what-if", {
|
|
@@ -2756,10 +3672,10 @@ var EnrichmentRemoveModule = {
|
|
|
2756
3672
|
command: "remove <id>",
|
|
2757
3673
|
aliases: ["delete", "rm"],
|
|
2758
3674
|
describe: "Delete an enrichment category and its values",
|
|
2759
|
-
builder: (
|
|
3675
|
+
builder: (yargs25) => withConfiguration(
|
|
2760
3676
|
withApiOptions(
|
|
2761
3677
|
withProjectOptions(
|
|
2762
|
-
|
|
3678
|
+
yargs25.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
2763
3679
|
)
|
|
2764
3680
|
)
|
|
2765
3681
|
),
|
|
@@ -2775,14 +3691,14 @@ var EnrichmentModule = {
|
|
|
2775
3691
|
command: "enrichment <command>",
|
|
2776
3692
|
aliases: ["enr"],
|
|
2777
3693
|
describe: "Commands for Context enrichments",
|
|
2778
|
-
builder: (
|
|
3694
|
+
builder: (yargs25) => yargs25.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
2779
3695
|
handler: () => {
|
|
2780
|
-
|
|
3696
|
+
yargs10.help();
|
|
2781
3697
|
}
|
|
2782
3698
|
};
|
|
2783
3699
|
|
|
2784
3700
|
// src/commands/context/commands/manifest.ts
|
|
2785
|
-
import
|
|
3701
|
+
import yargs11 from "yargs";
|
|
2786
3702
|
|
|
2787
3703
|
// src/commands/context/commands/manifest/get.ts
|
|
2788
3704
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -2793,10 +3709,10 @@ var ManifestGetModule = {
|
|
|
2793
3709
|
command: "get [output]",
|
|
2794
3710
|
aliases: ["dl", "download"],
|
|
2795
3711
|
describe: "Download the Uniform Context manifest for a project",
|
|
2796
|
-
builder: (
|
|
3712
|
+
builder: (yargs25) => withConfiguration(
|
|
2797
3713
|
withApiOptions(
|
|
2798
3714
|
withProjectOptions(
|
|
2799
|
-
|
|
3715
|
+
yargs25.option("preview", {
|
|
2800
3716
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
2801
3717
|
default: false,
|
|
2802
3718
|
type: "boolean",
|
|
@@ -2858,7 +3774,7 @@ import { exit as exit2 } from "process";
|
|
|
2858
3774
|
var ManifestPublishModule = {
|
|
2859
3775
|
command: "publish",
|
|
2860
3776
|
describe: "Publish the Uniform Context manifest for a project",
|
|
2861
|
-
builder: (
|
|
3777
|
+
builder: (yargs25) => withConfiguration(withApiOptions(withProjectOptions(yargs25))),
|
|
2862
3778
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
2863
3779
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2864
3780
|
try {
|
|
@@ -2891,25 +3807,25 @@ var ManifestModule = {
|
|
|
2891
3807
|
command: "manifest <command>",
|
|
2892
3808
|
describe: "Commands for context manifests",
|
|
2893
3809
|
aliases: ["man"],
|
|
2894
|
-
builder: (
|
|
3810
|
+
builder: (yargs25) => yargs25.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
2895
3811
|
handler: () => {
|
|
2896
|
-
|
|
3812
|
+
yargs11.help();
|
|
2897
3813
|
}
|
|
2898
3814
|
};
|
|
2899
3815
|
|
|
2900
3816
|
// src/commands/context/commands/quirk.ts
|
|
2901
|
-
import
|
|
3817
|
+
import yargs12 from "yargs";
|
|
2902
3818
|
|
|
2903
3819
|
// src/commands/context/commands/quirk/get.ts
|
|
2904
3820
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
2905
3821
|
var QuirkGetModule = {
|
|
2906
3822
|
command: "get <id>",
|
|
2907
3823
|
describe: "Fetch a quirk",
|
|
2908
|
-
builder: (
|
|
3824
|
+
builder: (yargs25) => withConfiguration(
|
|
2909
3825
|
withFormatOptions(
|
|
2910
3826
|
withApiOptions(
|
|
2911
3827
|
withProjectOptions(
|
|
2912
|
-
|
|
3828
|
+
yargs25.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
2913
3829
|
)
|
|
2914
3830
|
)
|
|
2915
3831
|
)
|
|
@@ -2933,11 +3849,11 @@ var QuirkListModule = {
|
|
|
2933
3849
|
command: "list",
|
|
2934
3850
|
describe: "List quirks",
|
|
2935
3851
|
aliases: ["ls"],
|
|
2936
|
-
builder: (
|
|
3852
|
+
builder: (yargs25) => withConfiguration(
|
|
2937
3853
|
withFormatOptions(
|
|
2938
3854
|
withApiOptions(
|
|
2939
3855
|
withProjectOptions(
|
|
2940
|
-
|
|
3856
|
+
yargs25.option("withIntegrations", {
|
|
2941
3857
|
alias: ["i"],
|
|
2942
3858
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
2943
3859
|
type: "boolean"
|
|
@@ -2994,11 +3910,11 @@ function createQuirkEngineDataSource({
|
|
|
2994
3910
|
var QuirkPullModule = {
|
|
2995
3911
|
command: "pull <directory>",
|
|
2996
3912
|
describe: "Pulls all quirks to local files in a directory",
|
|
2997
|
-
builder: (
|
|
3913
|
+
builder: (yargs25) => withConfiguration(
|
|
2998
3914
|
withApiOptions(
|
|
2999
3915
|
withProjectOptions(
|
|
3000
3916
|
withDiffOptions(
|
|
3001
|
-
|
|
3917
|
+
yargs25.positional("directory", {
|
|
3002
3918
|
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.",
|
|
3003
3919
|
type: "string"
|
|
3004
3920
|
}).option("format", {
|
|
@@ -3073,11 +3989,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
3073
3989
|
var QuirkPushModule = {
|
|
3074
3990
|
command: "push <directory>",
|
|
3075
3991
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
3076
|
-
builder: (
|
|
3992
|
+
builder: (yargs25) => withConfiguration(
|
|
3077
3993
|
withApiOptions(
|
|
3078
3994
|
withProjectOptions(
|
|
3079
3995
|
withDiffOptions(
|
|
3080
|
-
|
|
3996
|
+
yargs25.positional("directory", {
|
|
3081
3997
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
3082
3998
|
type: "string"
|
|
3083
3999
|
}).option("what-if", {
|
|
@@ -3141,10 +4057,10 @@ var QuirkRemoveModule = {
|
|
|
3141
4057
|
command: "remove <id>",
|
|
3142
4058
|
aliases: ["delete", "rm"],
|
|
3143
4059
|
describe: "Delete a quirk",
|
|
3144
|
-
builder: (
|
|
4060
|
+
builder: (yargs25) => withConfiguration(
|
|
3145
4061
|
withApiOptions(
|
|
3146
4062
|
withProjectOptions(
|
|
3147
|
-
|
|
4063
|
+
yargs25.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
3148
4064
|
)
|
|
3149
4065
|
)
|
|
3150
4066
|
),
|
|
@@ -3161,10 +4077,10 @@ var QuirkUpdateModule = {
|
|
|
3161
4077
|
command: "update <filename>",
|
|
3162
4078
|
aliases: ["put"],
|
|
3163
4079
|
describe: "Insert or update a quirk",
|
|
3164
|
-
builder: (
|
|
4080
|
+
builder: (yargs25) => withConfiguration(
|
|
3165
4081
|
withApiOptions(
|
|
3166
4082
|
withProjectOptions(
|
|
3167
|
-
|
|
4083
|
+
yargs25.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
3168
4084
|
)
|
|
3169
4085
|
)
|
|
3170
4086
|
),
|
|
@@ -3181,25 +4097,25 @@ var QuirkModule = {
|
|
|
3181
4097
|
command: "quirk <command>",
|
|
3182
4098
|
aliases: ["qk"],
|
|
3183
4099
|
describe: "Commands for Context quirks",
|
|
3184
|
-
builder: (
|
|
4100
|
+
builder: (yargs25) => yargs25.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
3185
4101
|
handler: () => {
|
|
3186
|
-
|
|
4102
|
+
yargs12.help();
|
|
3187
4103
|
}
|
|
3188
4104
|
};
|
|
3189
4105
|
|
|
3190
4106
|
// src/commands/context/commands/signal.ts
|
|
3191
|
-
import
|
|
4107
|
+
import yargs13 from "yargs";
|
|
3192
4108
|
|
|
3193
4109
|
// src/commands/context/commands/signal/get.ts
|
|
3194
4110
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
3195
4111
|
var SignalGetModule = {
|
|
3196
4112
|
command: "get <id>",
|
|
3197
4113
|
describe: "Fetch a signal",
|
|
3198
|
-
builder: (
|
|
4114
|
+
builder: (yargs25) => withConfiguration(
|
|
3199
4115
|
withFormatOptions(
|
|
3200
4116
|
withApiOptions(
|
|
3201
4117
|
withProjectOptions(
|
|
3202
|
-
|
|
4118
|
+
yargs25.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
3203
4119
|
)
|
|
3204
4120
|
)
|
|
3205
4121
|
)
|
|
@@ -3223,7 +4139,7 @@ var SignalListModule = {
|
|
|
3223
4139
|
command: "list",
|
|
3224
4140
|
describe: "List signals",
|
|
3225
4141
|
aliases: ["ls"],
|
|
3226
|
-
builder: (
|
|
4142
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
3227
4143
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3228
4144
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3229
4145
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3272,11 +4188,11 @@ function createSignalEngineDataSource({
|
|
|
3272
4188
|
var SignalPullModule = {
|
|
3273
4189
|
command: "pull <directory>",
|
|
3274
4190
|
describe: "Pulls all signals to local files in a directory",
|
|
3275
|
-
builder: (
|
|
4191
|
+
builder: (yargs25) => withConfiguration(
|
|
3276
4192
|
withApiOptions(
|
|
3277
4193
|
withProjectOptions(
|
|
3278
4194
|
withDiffOptions(
|
|
3279
|
-
|
|
4195
|
+
yargs25.positional("directory", {
|
|
3280
4196
|
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.",
|
|
3281
4197
|
type: "string"
|
|
3282
4198
|
}).option("format", {
|
|
@@ -3351,11 +4267,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
3351
4267
|
var SignalPushModule = {
|
|
3352
4268
|
command: "push <directory>",
|
|
3353
4269
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
3354
|
-
builder: (
|
|
4270
|
+
builder: (yargs25) => withConfiguration(
|
|
3355
4271
|
withApiOptions(
|
|
3356
4272
|
withProjectOptions(
|
|
3357
4273
|
withDiffOptions(
|
|
3358
|
-
|
|
4274
|
+
yargs25.positional("directory", {
|
|
3359
4275
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
3360
4276
|
type: "string"
|
|
3361
4277
|
}).option("what-if", {
|
|
@@ -3419,10 +4335,10 @@ var SignalRemoveModule = {
|
|
|
3419
4335
|
command: "remove <id>",
|
|
3420
4336
|
aliases: ["delete", "rm"],
|
|
3421
4337
|
describe: "Delete a signal",
|
|
3422
|
-
builder: (
|
|
4338
|
+
builder: (yargs25) => withConfiguration(
|
|
3423
4339
|
withApiOptions(
|
|
3424
4340
|
withProjectOptions(
|
|
3425
|
-
|
|
4341
|
+
yargs25.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
3426
4342
|
)
|
|
3427
4343
|
)
|
|
3428
4344
|
),
|
|
@@ -3439,10 +4355,10 @@ var SignalUpdateModule = {
|
|
|
3439
4355
|
command: "update <filename>",
|
|
3440
4356
|
aliases: ["put"],
|
|
3441
4357
|
describe: "Insert or update a signal",
|
|
3442
|
-
builder: (
|
|
4358
|
+
builder: (yargs25) => withConfiguration(
|
|
3443
4359
|
withApiOptions(
|
|
3444
4360
|
withProjectOptions(
|
|
3445
|
-
|
|
4361
|
+
yargs25.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
3446
4362
|
)
|
|
3447
4363
|
)
|
|
3448
4364
|
),
|
|
@@ -3459,25 +4375,25 @@ var SignalModule = {
|
|
|
3459
4375
|
command: "signal <command>",
|
|
3460
4376
|
aliases: ["sig"],
|
|
3461
4377
|
describe: "Commands for Context signals",
|
|
3462
|
-
builder: (
|
|
4378
|
+
builder: (yargs25) => yargs25.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
3463
4379
|
handler: () => {
|
|
3464
|
-
|
|
4380
|
+
yargs13.help();
|
|
3465
4381
|
}
|
|
3466
4382
|
};
|
|
3467
4383
|
|
|
3468
4384
|
// src/commands/context/commands/test.ts
|
|
3469
|
-
import
|
|
4385
|
+
import yargs14 from "yargs";
|
|
3470
4386
|
|
|
3471
4387
|
// src/commands/context/commands/test/get.ts
|
|
3472
4388
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
3473
4389
|
var TestGetModule = {
|
|
3474
4390
|
command: "get <id>",
|
|
3475
4391
|
describe: "Fetch a test",
|
|
3476
|
-
builder: (
|
|
4392
|
+
builder: (yargs25) => withConfiguration(
|
|
3477
4393
|
withFormatOptions(
|
|
3478
4394
|
withApiOptions(
|
|
3479
4395
|
withProjectOptions(
|
|
3480
|
-
|
|
4396
|
+
yargs25.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
3481
4397
|
)
|
|
3482
4398
|
)
|
|
3483
4399
|
)
|
|
@@ -3501,7 +4417,7 @@ var TestListModule = {
|
|
|
3501
4417
|
command: "list",
|
|
3502
4418
|
describe: "List tests",
|
|
3503
4419
|
aliases: ["ls"],
|
|
3504
|
-
builder: (
|
|
4420
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
3505
4421
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3506
4422
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3507
4423
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3550,11 +4466,11 @@ function createTestEngineDataSource({
|
|
|
3550
4466
|
var TestPullModule = {
|
|
3551
4467
|
command: "pull <directory>",
|
|
3552
4468
|
describe: "Pulls all tests to local files in a directory",
|
|
3553
|
-
builder: (
|
|
4469
|
+
builder: (yargs25) => withConfiguration(
|
|
3554
4470
|
withApiOptions(
|
|
3555
4471
|
withProjectOptions(
|
|
3556
4472
|
withDiffOptions(
|
|
3557
|
-
|
|
4473
|
+
yargs25.positional("directory", {
|
|
3558
4474
|
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.",
|
|
3559
4475
|
type: "string"
|
|
3560
4476
|
}).option("format", {
|
|
@@ -3629,11 +4545,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
3629
4545
|
var TestPushModule = {
|
|
3630
4546
|
command: "push <directory>",
|
|
3631
4547
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
3632
|
-
builder: (
|
|
4548
|
+
builder: (yargs25) => withConfiguration(
|
|
3633
4549
|
withApiOptions(
|
|
3634
4550
|
withProjectOptions(
|
|
3635
4551
|
withDiffOptions(
|
|
3636
|
-
|
|
4552
|
+
yargs25.positional("directory", {
|
|
3637
4553
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
3638
4554
|
type: "string"
|
|
3639
4555
|
}).option("what-if", {
|
|
@@ -3697,10 +4613,10 @@ var TestRemoveModule = {
|
|
|
3697
4613
|
command: "remove <id>",
|
|
3698
4614
|
aliases: ["delete", "rm"],
|
|
3699
4615
|
describe: "Delete a test",
|
|
3700
|
-
builder: (
|
|
4616
|
+
builder: (yargs25) => withConfiguration(
|
|
3701
4617
|
withApiOptions(
|
|
3702
4618
|
withProjectOptions(
|
|
3703
|
-
|
|
4619
|
+
yargs25.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
3704
4620
|
)
|
|
3705
4621
|
)
|
|
3706
4622
|
),
|
|
@@ -3717,9 +4633,9 @@ var TestUpdateModule = {
|
|
|
3717
4633
|
command: "update <filename>",
|
|
3718
4634
|
aliases: ["put"],
|
|
3719
4635
|
describe: "Insert or update a test",
|
|
3720
|
-
builder: (
|
|
4636
|
+
builder: (yargs25) => withConfiguration(
|
|
3721
4637
|
withApiOptions(
|
|
3722
|
-
withProjectOptions(
|
|
4638
|
+
withProjectOptions(yargs25.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
3723
4639
|
)
|
|
3724
4640
|
),
|
|
3725
4641
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -3734,9 +4650,9 @@ var TestUpdateModule = {
|
|
|
3734
4650
|
var TestModule = {
|
|
3735
4651
|
command: "test <command>",
|
|
3736
4652
|
describe: "Commands for Context A/B tests",
|
|
3737
|
-
builder: (
|
|
4653
|
+
builder: (yargs25) => yargs25.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
3738
4654
|
handler: () => {
|
|
3739
|
-
|
|
4655
|
+
yargs14.help();
|
|
3740
4656
|
}
|
|
3741
4657
|
};
|
|
3742
4658
|
|
|
@@ -3745,9 +4661,9 @@ var ContextCommand = {
|
|
|
3745
4661
|
command: "context <command>",
|
|
3746
4662
|
aliases: ["ctx"],
|
|
3747
4663
|
describe: "Uniform Context commands",
|
|
3748
|
-
builder: (
|
|
4664
|
+
builder: (yargs25) => yargs25.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
3749
4665
|
handler: () => {
|
|
3750
|
-
|
|
4666
|
+
yargs15.showHelp();
|
|
3751
4667
|
}
|
|
3752
4668
|
};
|
|
3753
4669
|
|
|
@@ -3775,7 +4691,7 @@ import { PostHog } from "posthog-node";
|
|
|
3775
4691
|
// package.json
|
|
3776
4692
|
var package_default = {
|
|
3777
4693
|
name: "@uniformdev/cli",
|
|
3778
|
-
version: "19.45.
|
|
4694
|
+
version: "19.45.1",
|
|
3779
4695
|
description: "Uniform command line interface tool",
|
|
3780
4696
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
3781
4697
|
main: "./cli.js",
|
|
@@ -3791,8 +4707,10 @@ var package_default = {
|
|
|
3791
4707
|
format: 'prettier --write "src/**/*.{js,ts,tsx}"'
|
|
3792
4708
|
},
|
|
3793
4709
|
dependencies: {
|
|
4710
|
+
"@thi.ng/mime": "^2.2.23",
|
|
3794
4711
|
"@uniformdev/canvas": "workspace:*",
|
|
3795
4712
|
"@uniformdev/context": "workspace:*",
|
|
4713
|
+
"@uniformdev/files": "workspace:*",
|
|
3796
4714
|
"@uniformdev/project-map": "workspace:*",
|
|
3797
4715
|
"@uniformdev/redirect": "workspace:*",
|
|
3798
4716
|
colorette: "2.0.20",
|
|
@@ -3805,6 +4723,7 @@ var package_default = {
|
|
|
3805
4723
|
graphql: "16.7.1",
|
|
3806
4724
|
"graphql-request": "6.1.0",
|
|
3807
4725
|
"https-proxy-agent": "^7.0.0",
|
|
4726
|
+
"image-size": "^1.0.2",
|
|
3808
4727
|
inquirer: "9.2.10",
|
|
3809
4728
|
"isomorphic-git": "1.24.5",
|
|
3810
4729
|
"isomorphic-unfetch": "^3.1.0",
|
|
@@ -3813,6 +4732,7 @@ var package_default = {
|
|
|
3813
4732
|
"lodash.isequalwith": "^4.4.0",
|
|
3814
4733
|
open: "9.1.0",
|
|
3815
4734
|
ora: "6.3.1",
|
|
4735
|
+
"p-queue": "7.3.4",
|
|
3816
4736
|
"posthog-node": "3.1.1",
|
|
3817
4737
|
slugify: "1.6.6",
|
|
3818
4738
|
"update-check": "^1.5.4",
|
|
@@ -4150,7 +5070,7 @@ ${err.message}`);
|
|
|
4150
5070
|
// src/projects/cloneStarter.ts
|
|
4151
5071
|
import crypto2 from "crypto";
|
|
4152
5072
|
import fs3 from "fs";
|
|
4153
|
-
import
|
|
5073
|
+
import fsj2 from "fs-jetpack";
|
|
4154
5074
|
import * as git from "isomorphic-git";
|
|
4155
5075
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
4156
5076
|
import os from "os";
|
|
@@ -4181,7 +5101,7 @@ async function cloneStarter({
|
|
|
4181
5101
|
throw new Error(`"${targetDir}" is not empty`);
|
|
4182
5102
|
}
|
|
4183
5103
|
const starterDir = path.join(cloneDir, ...pathSegments);
|
|
4184
|
-
|
|
5104
|
+
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
4185
5105
|
if (dotEnvFile) {
|
|
4186
5106
|
fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
4187
5107
|
}
|
|
@@ -4813,10 +5733,10 @@ var NewMeshCmd = {
|
|
|
4813
5733
|
};
|
|
4814
5734
|
|
|
4815
5735
|
// src/commands/optimize/index.ts
|
|
4816
|
-
import
|
|
5736
|
+
import yargs17 from "yargs";
|
|
4817
5737
|
|
|
4818
5738
|
// src/commands/optimize/manifest.ts
|
|
4819
|
-
import
|
|
5739
|
+
import yargs16 from "yargs";
|
|
4820
5740
|
|
|
4821
5741
|
// src/commands/optimize/manifest/download.ts
|
|
4822
5742
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -4831,7 +5751,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
4831
5751
|
var module = {
|
|
4832
5752
|
command: "download [output]",
|
|
4833
5753
|
describe: "Download intent manifest",
|
|
4834
|
-
builder: (
|
|
5754
|
+
builder: (yargs25) => yargs25.option("apiKey", {
|
|
4835
5755
|
alias: "k",
|
|
4836
5756
|
demandOption: true,
|
|
4837
5757
|
string: true,
|
|
@@ -4932,10 +5852,10 @@ var module2 = {
|
|
|
4932
5852
|
command: "manifest <command>",
|
|
4933
5853
|
describe: "Intent manifest commands",
|
|
4934
5854
|
builder: () => {
|
|
4935
|
-
return
|
|
5855
|
+
return yargs16.command(download_default);
|
|
4936
5856
|
},
|
|
4937
5857
|
handler: () => {
|
|
4938
|
-
|
|
5858
|
+
yargs16.showHelp();
|
|
4939
5859
|
}
|
|
4940
5860
|
};
|
|
4941
5861
|
var manifest_default = module2;
|
|
@@ -4946,29 +5866,29 @@ var OptimizeCommand = {
|
|
|
4946
5866
|
aliases: ["opt"],
|
|
4947
5867
|
describe: "Uniform Optimize commands",
|
|
4948
5868
|
builder: () => {
|
|
4949
|
-
return
|
|
5869
|
+
return yargs17.command(manifest_default);
|
|
4950
5870
|
},
|
|
4951
5871
|
handler: () => {
|
|
4952
|
-
|
|
5872
|
+
yargs17.showHelp();
|
|
4953
5873
|
}
|
|
4954
5874
|
};
|
|
4955
5875
|
|
|
4956
5876
|
// src/commands/project-map/index.ts
|
|
4957
|
-
import
|
|
5877
|
+
import yargs20 from "yargs";
|
|
4958
5878
|
|
|
4959
5879
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
4960
|
-
import
|
|
5880
|
+
import yargs18 from "yargs";
|
|
4961
5881
|
|
|
4962
5882
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
4963
5883
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
4964
5884
|
var ProjectMapDefinitionGetModule = {
|
|
4965
5885
|
command: "get <id>",
|
|
4966
5886
|
describe: "Fetch a project map",
|
|
4967
|
-
builder: (
|
|
5887
|
+
builder: (yargs25) => withFormatOptions(
|
|
4968
5888
|
withConfiguration(
|
|
4969
5889
|
withApiOptions(
|
|
4970
5890
|
withProjectOptions(
|
|
4971
|
-
|
|
5891
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
4972
5892
|
)
|
|
4973
5893
|
)
|
|
4974
5894
|
)
|
|
@@ -4992,7 +5912,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
4992
5912
|
command: "list",
|
|
4993
5913
|
describe: "List of project maps",
|
|
4994
5914
|
aliases: ["ls"],
|
|
4995
|
-
builder: (
|
|
5915
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
4996
5916
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4997
5917
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4998
5918
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5049,11 +5969,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
5049
5969
|
var ProjectMapDefinitionPullModule = {
|
|
5050
5970
|
command: "pull <directory>",
|
|
5051
5971
|
describe: "Pulls all project maps to local files in a directory",
|
|
5052
|
-
builder: (
|
|
5972
|
+
builder: (yargs25) => withConfiguration(
|
|
5053
5973
|
withApiOptions(
|
|
5054
5974
|
withProjectOptions(
|
|
5055
5975
|
withDiffOptions(
|
|
5056
|
-
|
|
5976
|
+
yargs25.positional("directory", {
|
|
5057
5977
|
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.",
|
|
5058
5978
|
type: "string"
|
|
5059
5979
|
}).option("format", {
|
|
@@ -5128,11 +6048,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
5128
6048
|
var ProjectMapDefinitionPushModule = {
|
|
5129
6049
|
command: "push <directory>",
|
|
5130
6050
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
5131
|
-
builder: (
|
|
6051
|
+
builder: (yargs25) => withConfiguration(
|
|
5132
6052
|
withApiOptions(
|
|
5133
6053
|
withProjectOptions(
|
|
5134
6054
|
withDiffOptions(
|
|
5135
|
-
|
|
6055
|
+
yargs25.positional("directory", {
|
|
5136
6056
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
5137
6057
|
type: "string"
|
|
5138
6058
|
}).option("what-if", {
|
|
@@ -5196,9 +6116,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
5196
6116
|
command: "remove <id>",
|
|
5197
6117
|
aliases: ["delete", "rm"],
|
|
5198
6118
|
describe: "Delete a project map",
|
|
5199
|
-
builder: (
|
|
6119
|
+
builder: (yargs25) => withConfiguration(
|
|
5200
6120
|
withApiOptions(
|
|
5201
|
-
withProjectOptions(
|
|
6121
|
+
withProjectOptions(yargs25.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
5202
6122
|
)
|
|
5203
6123
|
),
|
|
5204
6124
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -5214,10 +6134,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
5214
6134
|
command: "update <filename>",
|
|
5215
6135
|
aliases: ["put"],
|
|
5216
6136
|
describe: "Insert or update a project map",
|
|
5217
|
-
builder: (
|
|
6137
|
+
builder: (yargs25) => withConfiguration(
|
|
5218
6138
|
withApiOptions(
|
|
5219
6139
|
withProjectOptions(
|
|
5220
|
-
|
|
6140
|
+
yargs25.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
5221
6141
|
)
|
|
5222
6142
|
)
|
|
5223
6143
|
),
|
|
@@ -5233,25 +6153,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
5233
6153
|
var ProjectMapDefinitionModule = {
|
|
5234
6154
|
command: "definition <command>",
|
|
5235
6155
|
describe: "Commands for ProjectMap Definitions",
|
|
5236
|
-
builder: (
|
|
6156
|
+
builder: (yargs25) => yargs25.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
5237
6157
|
handler: () => {
|
|
5238
|
-
|
|
6158
|
+
yargs18.help();
|
|
5239
6159
|
}
|
|
5240
6160
|
};
|
|
5241
6161
|
|
|
5242
6162
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
5243
|
-
import
|
|
6163
|
+
import yargs19 from "yargs";
|
|
5244
6164
|
|
|
5245
6165
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
5246
6166
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
5247
6167
|
var ProjectMapNodeGetModule = {
|
|
5248
6168
|
command: "get <id> <projectMapId>",
|
|
5249
6169
|
describe: "Fetch a project map node",
|
|
5250
|
-
builder: (
|
|
6170
|
+
builder: (yargs25) => withConfiguration(
|
|
5251
6171
|
withFormatOptions(
|
|
5252
6172
|
withApiOptions(
|
|
5253
6173
|
withProjectOptions(
|
|
5254
|
-
|
|
6174
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
5255
6175
|
)
|
|
5256
6176
|
)
|
|
5257
6177
|
)
|
|
@@ -5277,11 +6197,11 @@ var ProjectMapNodeListModule = {
|
|
|
5277
6197
|
command: "list <projectMapId>",
|
|
5278
6198
|
describe: "List project map nodes",
|
|
5279
6199
|
aliases: ["ls"],
|
|
5280
|
-
builder: (
|
|
6200
|
+
builder: (yargs25) => withConfiguration(
|
|
5281
6201
|
withFormatOptions(
|
|
5282
6202
|
withApiOptions(
|
|
5283
6203
|
withProjectOptions(
|
|
5284
|
-
|
|
6204
|
+
yargs25.positional("projectMapId", {
|
|
5285
6205
|
demandOption: true,
|
|
5286
6206
|
describe: "ProjectMap UUID to fetch from"
|
|
5287
6207
|
})
|
|
@@ -5352,11 +6272,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
5352
6272
|
var ProjectMapNodePullModule = {
|
|
5353
6273
|
command: "pull <directory>",
|
|
5354
6274
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
5355
|
-
builder: (
|
|
6275
|
+
builder: (yargs25) => withConfiguration(
|
|
5356
6276
|
withApiOptions(
|
|
5357
6277
|
withProjectOptions(
|
|
5358
6278
|
withDiffOptions(
|
|
5359
|
-
|
|
6279
|
+
yargs25.positional("directory", {
|
|
5360
6280
|
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.",
|
|
5361
6281
|
type: "string"
|
|
5362
6282
|
}).option("format", {
|
|
@@ -5435,11 +6355,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
5435
6355
|
var ProjectMapNodePushModule = {
|
|
5436
6356
|
command: "push <directory>",
|
|
5437
6357
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
5438
|
-
builder: (
|
|
6358
|
+
builder: (yargs25) => withConfiguration(
|
|
5439
6359
|
withApiOptions(
|
|
5440
6360
|
withProjectOptions(
|
|
5441
6361
|
withDiffOptions(
|
|
5442
|
-
|
|
6362
|
+
yargs25.positional("directory", {
|
|
5443
6363
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
5444
6364
|
type: "string"
|
|
5445
6365
|
}).option("what-if", {
|
|
@@ -5512,10 +6432,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
5512
6432
|
command: "remove <id> <projectMapId>",
|
|
5513
6433
|
aliases: ["delete", "rm"],
|
|
5514
6434
|
describe: "Delete a project map node",
|
|
5515
|
-
builder: (
|
|
6435
|
+
builder: (yargs25) => withConfiguration(
|
|
5516
6436
|
withApiOptions(
|
|
5517
6437
|
withProjectOptions(
|
|
5518
|
-
|
|
6438
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
5519
6439
|
)
|
|
5520
6440
|
)
|
|
5521
6441
|
),
|
|
@@ -5532,10 +6452,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
5532
6452
|
command: "update <filename> <projectMapId>",
|
|
5533
6453
|
aliases: ["put"],
|
|
5534
6454
|
describe: "Insert or update a project map node",
|
|
5535
|
-
builder: (
|
|
6455
|
+
builder: (yargs25) => withConfiguration(
|
|
5536
6456
|
withApiOptions(
|
|
5537
6457
|
withProjectOptions(
|
|
5538
|
-
|
|
6458
|
+
yargs25.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
5539
6459
|
)
|
|
5540
6460
|
)
|
|
5541
6461
|
),
|
|
@@ -5551,9 +6471,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
5551
6471
|
var ProjectMapNodeModule = {
|
|
5552
6472
|
command: "node <command>",
|
|
5553
6473
|
describe: "Commands for ProjectMap Nodes",
|
|
5554
|
-
builder: (
|
|
6474
|
+
builder: (yargs25) => yargs25.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
5555
6475
|
handler: () => {
|
|
5556
|
-
|
|
6476
|
+
yargs19.help();
|
|
5557
6477
|
}
|
|
5558
6478
|
};
|
|
5559
6479
|
|
|
@@ -5562,28 +6482,28 @@ var ProjectMapCommand = {
|
|
|
5562
6482
|
command: "project-map <command>",
|
|
5563
6483
|
aliases: ["prm"],
|
|
5564
6484
|
describe: "Uniform ProjectMap commands",
|
|
5565
|
-
builder: (
|
|
6485
|
+
builder: (yargs25) => yargs25.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
5566
6486
|
handler: () => {
|
|
5567
|
-
|
|
6487
|
+
yargs20.showHelp();
|
|
5568
6488
|
}
|
|
5569
6489
|
};
|
|
5570
6490
|
|
|
5571
6491
|
// src/commands/redirect/index.ts
|
|
5572
|
-
import
|
|
6492
|
+
import yargs22 from "yargs";
|
|
5573
6493
|
|
|
5574
6494
|
// src/commands/redirect/commands/redirect.ts
|
|
5575
|
-
import
|
|
6495
|
+
import yargs21 from "yargs";
|
|
5576
6496
|
|
|
5577
6497
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
5578
6498
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
5579
6499
|
var RedirectDefinitionGetModule = {
|
|
5580
6500
|
command: "get <id>",
|
|
5581
6501
|
describe: "Fetch a redirect",
|
|
5582
|
-
builder: (
|
|
6502
|
+
builder: (yargs25) => withConfiguration(
|
|
5583
6503
|
withFormatOptions(
|
|
5584
6504
|
withApiOptions(
|
|
5585
6505
|
withProjectOptions(
|
|
5586
|
-
|
|
6506
|
+
yargs25.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
5587
6507
|
)
|
|
5588
6508
|
)
|
|
5589
6509
|
)
|
|
@@ -5607,7 +6527,7 @@ var RedirectDefinitionListModule = {
|
|
|
5607
6527
|
command: "list",
|
|
5608
6528
|
describe: "List of redirects",
|
|
5609
6529
|
aliases: ["ls"],
|
|
5610
|
-
builder: (
|
|
6530
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
5611
6531
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5612
6532
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5613
6533
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5673,11 +6593,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
5673
6593
|
var RedirectDefinitionPullModule = {
|
|
5674
6594
|
command: "pull <directory>",
|
|
5675
6595
|
describe: "Pulls all redirects to local files in a directory",
|
|
5676
|
-
builder: (
|
|
6596
|
+
builder: (yargs25) => withConfiguration(
|
|
5677
6597
|
withApiOptions(
|
|
5678
6598
|
withProjectOptions(
|
|
5679
6599
|
withDiffOptions(
|
|
5680
|
-
|
|
6600
|
+
yargs25.positional("directory", {
|
|
5681
6601
|
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.",
|
|
5682
6602
|
type: "string"
|
|
5683
6603
|
}).option("format", {
|
|
@@ -5753,11 +6673,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
5753
6673
|
var RedirectDefinitionPushModule = {
|
|
5754
6674
|
command: "push <directory>",
|
|
5755
6675
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
5756
|
-
builder: (
|
|
6676
|
+
builder: (yargs25) => withConfiguration(
|
|
5757
6677
|
withApiOptions(
|
|
5758
6678
|
withProjectOptions(
|
|
5759
6679
|
withDiffOptions(
|
|
5760
|
-
|
|
6680
|
+
yargs25.positional("directory", {
|
|
5761
6681
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
5762
6682
|
type: "string"
|
|
5763
6683
|
}).option("what-if", {
|
|
@@ -5821,9 +6741,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
5821
6741
|
command: "remove <id>",
|
|
5822
6742
|
aliases: ["delete", "rm"],
|
|
5823
6743
|
describe: "Delete a redirect",
|
|
5824
|
-
builder: (
|
|
6744
|
+
builder: (yargs25) => withConfiguration(
|
|
5825
6745
|
withApiOptions(
|
|
5826
|
-
withProjectOptions(
|
|
6746
|
+
withProjectOptions(yargs25.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
5827
6747
|
)
|
|
5828
6748
|
),
|
|
5829
6749
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -5839,10 +6759,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5839
6759
|
command: "update <filename>",
|
|
5840
6760
|
aliases: ["put"],
|
|
5841
6761
|
describe: "Insert or update a redirect",
|
|
5842
|
-
builder: (
|
|
6762
|
+
builder: (yargs25) => withConfiguration(
|
|
5843
6763
|
withApiOptions(
|
|
5844
6764
|
withProjectOptions(
|
|
5845
|
-
|
|
6765
|
+
yargs25.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
5846
6766
|
)
|
|
5847
6767
|
)
|
|
5848
6768
|
),
|
|
@@ -5858,9 +6778,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5858
6778
|
var RedirectDefinitionModule = {
|
|
5859
6779
|
command: "definition <command>",
|
|
5860
6780
|
describe: "Commands for Redirect Definitions",
|
|
5861
|
-
builder: (
|
|
6781
|
+
builder: (yargs25) => yargs25.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
5862
6782
|
handler: () => {
|
|
5863
|
-
|
|
6783
|
+
yargs21.help();
|
|
5864
6784
|
}
|
|
5865
6785
|
};
|
|
5866
6786
|
|
|
@@ -5869,24 +6789,24 @@ var RedirectCommand = {
|
|
|
5869
6789
|
command: "redirect <command>",
|
|
5870
6790
|
aliases: ["red"],
|
|
5871
6791
|
describe: "Uniform Redirect commands",
|
|
5872
|
-
builder: (
|
|
6792
|
+
builder: (yargs25) => yargs25.command(RedirectDefinitionModule).demandCommand(),
|
|
5873
6793
|
handler: () => {
|
|
5874
|
-
|
|
6794
|
+
yargs22.showHelp();
|
|
5875
6795
|
}
|
|
5876
6796
|
};
|
|
5877
6797
|
|
|
5878
6798
|
// src/commands/sync/index.ts
|
|
5879
|
-
import
|
|
6799
|
+
import yargs23 from "yargs";
|
|
5880
6800
|
|
|
5881
6801
|
// src/commands/sync/commands/pull.ts
|
|
5882
6802
|
var SyncPullModule = {
|
|
5883
6803
|
command: "pull",
|
|
5884
6804
|
describe: "Pulls whole project to local files in a directory",
|
|
5885
|
-
builder: (
|
|
6805
|
+
builder: (yargs25) => withConfiguration(
|
|
5886
6806
|
withApiOptions(
|
|
5887
6807
|
withProjectOptions(
|
|
5888
6808
|
withDiffOptions(
|
|
5889
|
-
|
|
6809
|
+
yargs25.option("what-if", {
|
|
5890
6810
|
alias: ["w"],
|
|
5891
6811
|
describe: "What-if mode reports what would be done but changes no files",
|
|
5892
6812
|
default: false,
|
|
@@ -5957,11 +6877,11 @@ var getFormat = (entityType, config2) => {
|
|
|
5957
6877
|
var SyncPushModule = {
|
|
5958
6878
|
command: "push",
|
|
5959
6879
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
5960
|
-
builder: (
|
|
6880
|
+
builder: (yargs25) => withConfiguration(
|
|
5961
6881
|
withApiOptions(
|
|
5962
6882
|
withProjectOptions(
|
|
5963
6883
|
withDiffOptions(
|
|
5964
|
-
|
|
6884
|
+
yargs25.option("what-if", {
|
|
5965
6885
|
alias: ["w"],
|
|
5966
6886
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
5967
6887
|
default: false,
|
|
@@ -6039,9 +6959,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
6039
6959
|
var SyncCommand = {
|
|
6040
6960
|
command: "sync <command>",
|
|
6041
6961
|
describe: "Uniform Sync commands",
|
|
6042
|
-
builder: (
|
|
6962
|
+
builder: (yargs25) => yargs25.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
6043
6963
|
handler: () => {
|
|
6044
|
-
|
|
6964
|
+
yargs23.showHelp();
|
|
6045
6965
|
}
|
|
6046
6966
|
};
|
|
6047
6967
|
|
|
@@ -6085,7 +7005,7 @@ async function checkForUpdateMiddleware() {
|
|
|
6085
7005
|
|
|
6086
7006
|
// src/middleware/checkLocalDepsVersionsMiddleware.ts
|
|
6087
7007
|
import { magenta, red as red6 } from "colorette";
|
|
6088
|
-
import { join as
|
|
7008
|
+
import { join as join3 } from "path";
|
|
6089
7009
|
|
|
6090
7010
|
// src/fs.ts
|
|
6091
7011
|
import { promises as fs5 } from "fs";
|
|
@@ -6124,7 +7044,7 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
6124
7044
|
try {
|
|
6125
7045
|
let isOutside = false;
|
|
6126
7046
|
let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
|
|
6127
|
-
const localPackages = await tryReadJSON(
|
|
7047
|
+
const localPackages = await tryReadJSON(join3(process.cwd(), "package.json"));
|
|
6128
7048
|
if (!localPackages)
|
|
6129
7049
|
return;
|
|
6130
7050
|
let firstVersion;
|
|
@@ -6157,7 +7077,7 @@ First found was: v${firstVersion}`;
|
|
|
6157
7077
|
|
|
6158
7078
|
// src/index.ts
|
|
6159
7079
|
dotenv.config();
|
|
6160
|
-
var yarggery =
|
|
7080
|
+
var yarggery = yargs24(hideBin(process.argv));
|
|
6161
7081
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
6162
7082
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
6163
7083
|
yarggery.option("verbose", {
|