@uniformdev/cli 19.35.2 → 19.35.3-alpha.82
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 +646 -378
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -2,34 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import * as dotenv from "dotenv";
|
|
5
|
-
import
|
|
5
|
+
import yargs20 from "yargs";
|
|
6
6
|
import { hideBin } from "yargs/helpers";
|
|
7
7
|
|
|
8
8
|
// src/commands/canvas/index.ts
|
|
9
|
-
import
|
|
9
|
+
import yargs5 from "yargs";
|
|
10
10
|
|
|
11
|
-
// src/commands/canvas/commands/
|
|
11
|
+
// src/commands/canvas/commands/category.ts
|
|
12
12
|
import yargs from "yargs";
|
|
13
13
|
|
|
14
|
-
// src/commands/canvas/commands/
|
|
15
|
-
import {
|
|
14
|
+
// src/commands/canvas/commands/category/get.ts
|
|
15
|
+
import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
16
16
|
|
|
17
17
|
// src/sync/arraySyncEngineDataSource.ts
|
|
18
18
|
async function createArraySyncEngineDataSource({
|
|
19
19
|
objects,
|
|
20
|
-
selectIdentifier:
|
|
21
|
-
selectDisplayName:
|
|
20
|
+
selectIdentifier: selectIdentifier13,
|
|
21
|
+
selectDisplayName: selectDisplayName13 = selectIdentifier13,
|
|
22
22
|
onSyncComplete
|
|
23
23
|
}) {
|
|
24
24
|
const objectIndex = objects.reduce(
|
|
25
25
|
(result, current) => {
|
|
26
|
-
const rawIdentifiers =
|
|
26
|
+
const rawIdentifiers = selectIdentifier13(current);
|
|
27
27
|
const identifiers = Array.isArray(rawIdentifiers) ? rawIdentifiers : [rawIdentifiers];
|
|
28
28
|
const existingResult = identifiers.find((id) => result[id]);
|
|
29
29
|
if (existingResult) {
|
|
30
30
|
throw new Error(`Identifier(s) ${identifiers} was not unique.`);
|
|
31
31
|
}
|
|
32
|
-
const displayName =
|
|
32
|
+
const displayName = selectDisplayName13(current);
|
|
33
33
|
result[identifiers[0]] = {
|
|
34
34
|
id: identifiers,
|
|
35
35
|
object: current,
|
|
@@ -56,7 +56,7 @@ async function createArraySyncEngineDataSource({
|
|
|
56
56
|
delete objectIndex[providerId];
|
|
57
57
|
},
|
|
58
58
|
writeObject: async (objectToWrite) => {
|
|
59
|
-
const id =
|
|
59
|
+
const id = selectIdentifier13(objectToWrite.object);
|
|
60
60
|
if (Array.isArray(id)) {
|
|
61
61
|
objectIndex[id[0]] = objectToWrite;
|
|
62
62
|
} else {
|
|
@@ -92,8 +92,8 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
92
92
|
import unfetch from "isomorphic-unfetch";
|
|
93
93
|
import { dump, load } from "js-yaml";
|
|
94
94
|
import { extname } from "path";
|
|
95
|
-
function withApiOptions(
|
|
96
|
-
return
|
|
95
|
+
function withApiOptions(yargs21) {
|
|
96
|
+
return yargs21.option("apiKey", {
|
|
97
97
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
98
98
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
99
99
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -132,8 +132,8 @@ function nodeFetchProxy(proxy) {
|
|
|
132
132
|
};
|
|
133
133
|
return wrappedFetch;
|
|
134
134
|
}
|
|
135
|
-
function withProjectOptions(
|
|
136
|
-
return
|
|
135
|
+
function withProjectOptions(yargs21) {
|
|
136
|
+
return yargs21.option("project", {
|
|
137
137
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
138
138
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
139
139
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -143,8 +143,8 @@ function withProjectOptions(yargs20) {
|
|
|
143
143
|
alias: ["p"]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function withFormatOptions(
|
|
147
|
-
return
|
|
146
|
+
function withFormatOptions(yargs21) {
|
|
147
|
+
return yargs21.option("format", {
|
|
148
148
|
alias: ["f"],
|
|
149
149
|
describe: "Output format",
|
|
150
150
|
default: "yaml",
|
|
@@ -156,8 +156,8 @@ function withFormatOptions(yargs20) {
|
|
|
156
156
|
type: "string"
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
function withDiffOptions(
|
|
160
|
-
return
|
|
159
|
+
function withDiffOptions(yargs21) {
|
|
160
|
+
return yargs21.option("diff", {
|
|
161
161
|
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.",
|
|
162
162
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
163
163
|
type: "string",
|
|
@@ -222,8 +222,8 @@ async function* paginateAsync(fetchPage, options) {
|
|
|
222
222
|
async function createFileSyncEngineDataSource({
|
|
223
223
|
directory,
|
|
224
224
|
format = "yaml",
|
|
225
|
-
selectIdentifier:
|
|
226
|
-
selectDisplayName:
|
|
225
|
+
selectIdentifier: selectIdentifier13,
|
|
226
|
+
selectDisplayName: selectDisplayName13 = selectIdentifier13,
|
|
227
227
|
selectFilename: selectFilename3,
|
|
228
228
|
selectSchemaUrl: selectSchemaUrl2
|
|
229
229
|
}) {
|
|
@@ -244,9 +244,9 @@ async function createFileSyncEngineDataSource({
|
|
|
244
244
|
const fullFilename = join(directory, filename);
|
|
245
245
|
try {
|
|
246
246
|
const contents = await readFileToObject(fullFilename);
|
|
247
|
-
const displayName =
|
|
247
|
+
const displayName = selectDisplayName13(contents);
|
|
248
248
|
const object = {
|
|
249
|
-
id:
|
|
249
|
+
id: selectIdentifier13(contents),
|
|
250
250
|
displayName: Array.isArray(displayName) ? displayName[0] : displayName,
|
|
251
251
|
providerId: fullFilename,
|
|
252
252
|
object: omit(contents, ["$schema"])
|
|
@@ -412,7 +412,7 @@ async function syncEngine({
|
|
|
412
412
|
}
|
|
413
413
|
await Promise.all(actions);
|
|
414
414
|
if (mode === "mirror") {
|
|
415
|
-
if (!sourceHasItems && !allowEmptySource) {
|
|
415
|
+
if (!sourceHasItems && !allowEmptySource && targetItems.size > 0) {
|
|
416
416
|
throw new Error(
|
|
417
417
|
"Source is empty and mode is mirror. This would cause deletion of everything in the target, and most likely indicates an error in source definition."
|
|
418
418
|
);
|
|
@@ -471,25 +471,300 @@ function createSyncEngineConsoleLogger(options) {
|
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
// src/commands/canvas/commands/category/get.ts
|
|
475
|
+
var CategoryGetModule = {
|
|
476
|
+
command: "get <id>",
|
|
477
|
+
describe: "Fetch a category",
|
|
478
|
+
builder: (yargs21) => withFormatOptions(
|
|
479
|
+
withApiOptions(
|
|
480
|
+
withProjectOptions(yargs21.positional("id", { demandOption: true, describe: "Category UUID to fetch" }))
|
|
481
|
+
)
|
|
482
|
+
),
|
|
483
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
484
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
485
|
+
const client = new UncachedCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
486
|
+
const res = await client.getCategories();
|
|
487
|
+
const category = res.categories.find((c) => c.id === id);
|
|
488
|
+
if (!category) {
|
|
489
|
+
console.error("Category did not exist");
|
|
490
|
+
process.exit(1);
|
|
491
|
+
} else {
|
|
492
|
+
emitWithFormat(category, format, filename);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
// src/commands/canvas/commands/category/list.ts
|
|
498
|
+
import { UncachedCategoryClient as UncachedCategoryClient2 } from "@uniformdev/canvas";
|
|
499
|
+
var CategoryListModule = {
|
|
500
|
+
command: "list",
|
|
501
|
+
describe: "List categories",
|
|
502
|
+
aliases: ["ls"],
|
|
503
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21.options({})))),
|
|
504
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
505
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
506
|
+
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
507
|
+
const res = await client.getCategories();
|
|
508
|
+
emitWithFormat(res.categories, format, filename);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
// src/commands/canvas/commands/category/pull.ts
|
|
513
|
+
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
514
|
+
|
|
515
|
+
// src/commands/canvas/commands/category/_util.ts
|
|
516
|
+
var selectIdentifier = (category) => category.id;
|
|
517
|
+
var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
|
|
518
|
+
|
|
519
|
+
// src/commands/canvas/categoriesEngineDataSource.ts
|
|
520
|
+
function createCategoriesEngineDataSource({
|
|
521
|
+
client
|
|
522
|
+
}) {
|
|
523
|
+
async function* getObjects() {
|
|
524
|
+
const componentDefinitions = paginateAsync(async () => (await client.getCategories()).categories, {
|
|
525
|
+
pageSize: 100
|
|
526
|
+
});
|
|
527
|
+
for await (const def of componentDefinitions) {
|
|
528
|
+
const result = {
|
|
529
|
+
id: selectIdentifier(def),
|
|
530
|
+
displayName: selectDisplayName(def),
|
|
531
|
+
providerId: def.id,
|
|
532
|
+
object: def
|
|
533
|
+
};
|
|
534
|
+
yield result;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return {
|
|
538
|
+
objects: getObjects(),
|
|
539
|
+
deleteObject: async (providerId) => {
|
|
540
|
+
await client.removeCategory({ categoryId: providerId });
|
|
541
|
+
},
|
|
542
|
+
writeObject: async (object) => {
|
|
543
|
+
await client.upsertCategories([object.object]);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// src/commands/canvas/package.ts
|
|
549
|
+
function readCanvasPackage(filename, assertExists) {
|
|
550
|
+
return readUniformPackage(filename, assertExists);
|
|
551
|
+
}
|
|
552
|
+
function writeCanvasPackage(filename, packageContents) {
|
|
553
|
+
writeUniformPackage(filename, packageContents);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// src/commands/canvas/commands/category/pull.ts
|
|
557
|
+
var CategoryPullModule = {
|
|
558
|
+
command: "pull <directory>",
|
|
559
|
+
describe: "Pulls all categories to local files in a directory",
|
|
560
|
+
builder: (yargs21) => withApiOptions(
|
|
561
|
+
withProjectOptions(
|
|
562
|
+
withDiffOptions(
|
|
563
|
+
yargs21.positional("directory", {
|
|
564
|
+
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.",
|
|
565
|
+
type: "string"
|
|
566
|
+
}).option("format", {
|
|
567
|
+
alias: ["f"],
|
|
568
|
+
describe: "Output format",
|
|
569
|
+
default: "yaml",
|
|
570
|
+
choices: ["yaml", "json"],
|
|
571
|
+
type: "string"
|
|
572
|
+
}).option("what-if", {
|
|
573
|
+
alias: ["w"],
|
|
574
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
575
|
+
default: false,
|
|
576
|
+
type: "boolean"
|
|
577
|
+
}).option("mode", {
|
|
578
|
+
alias: ["m"],
|
|
579
|
+
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',
|
|
580
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
581
|
+
default: "mirror",
|
|
582
|
+
type: "string"
|
|
583
|
+
})
|
|
584
|
+
)
|
|
585
|
+
)
|
|
586
|
+
),
|
|
587
|
+
handler: async ({
|
|
588
|
+
apiHost,
|
|
589
|
+
apiKey,
|
|
590
|
+
proxy,
|
|
591
|
+
directory,
|
|
592
|
+
format,
|
|
593
|
+
mode,
|
|
594
|
+
whatIf,
|
|
595
|
+
project: projectId,
|
|
596
|
+
diff: diffMode
|
|
597
|
+
}) => {
|
|
598
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
599
|
+
const client = new UncachedCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
600
|
+
const source = createCategoriesEngineDataSource({ client });
|
|
601
|
+
let target;
|
|
602
|
+
const isPackage = isPathAPackageFile(directory);
|
|
603
|
+
if (isPackage) {
|
|
604
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
605
|
+
target = await createArraySyncEngineDataSource({
|
|
606
|
+
objects: packageContents.categories ?? [],
|
|
607
|
+
selectIdentifier,
|
|
608
|
+
selectDisplayName,
|
|
609
|
+
onSyncComplete: async (_, synced) => {
|
|
610
|
+
packageContents.categories = synced;
|
|
611
|
+
writeCanvasPackage(directory, packageContents);
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
} else {
|
|
615
|
+
target = await createFileSyncEngineDataSource({
|
|
616
|
+
directory,
|
|
617
|
+
selectIdentifier,
|
|
618
|
+
selectDisplayName,
|
|
619
|
+
format
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
await syncEngine({
|
|
623
|
+
source,
|
|
624
|
+
target,
|
|
625
|
+
mode,
|
|
626
|
+
whatIf,
|
|
627
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
// src/commands/canvas/commands/category/push.ts
|
|
633
|
+
import { UncachedCanvasClient as UncachedCanvasClient2 } from "@uniformdev/canvas";
|
|
634
|
+
var CategoryPushModule = {
|
|
635
|
+
command: "push <directory>",
|
|
636
|
+
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
637
|
+
builder: (yargs21) => withApiOptions(
|
|
638
|
+
withProjectOptions(
|
|
639
|
+
withDiffOptions(
|
|
640
|
+
yargs21.positional("directory", {
|
|
641
|
+
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
642
|
+
type: "string"
|
|
643
|
+
}).option("what-if", {
|
|
644
|
+
alias: ["w"],
|
|
645
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
646
|
+
default: false,
|
|
647
|
+
type: "boolean"
|
|
648
|
+
}).option("mode", {
|
|
649
|
+
alias: ["m"],
|
|
650
|
+
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',
|
|
651
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
652
|
+
default: "mirror",
|
|
653
|
+
type: "string"
|
|
654
|
+
})
|
|
655
|
+
)
|
|
656
|
+
)
|
|
657
|
+
),
|
|
658
|
+
handler: async ({
|
|
659
|
+
apiHost,
|
|
660
|
+
apiKey,
|
|
661
|
+
proxy,
|
|
662
|
+
directory,
|
|
663
|
+
mode,
|
|
664
|
+
whatIf,
|
|
665
|
+
project: projectId,
|
|
666
|
+
diff: diffMode
|
|
667
|
+
}) => {
|
|
668
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
669
|
+
const client = new UncachedCanvasClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
670
|
+
let source;
|
|
671
|
+
const isPackage = isPathAPackageFile(directory);
|
|
672
|
+
if (isPackage) {
|
|
673
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
674
|
+
source = await createArraySyncEngineDataSource({
|
|
675
|
+
objects: packageContents.categories ?? [],
|
|
676
|
+
selectIdentifier,
|
|
677
|
+
selectDisplayName
|
|
678
|
+
});
|
|
679
|
+
} else {
|
|
680
|
+
source = await createFileSyncEngineDataSource({
|
|
681
|
+
directory,
|
|
682
|
+
selectIdentifier,
|
|
683
|
+
selectDisplayName
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
const target = createCategoriesEngineDataSource({ client });
|
|
687
|
+
await syncEngine({
|
|
688
|
+
source,
|
|
689
|
+
target,
|
|
690
|
+
mode,
|
|
691
|
+
whatIf,
|
|
692
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
// src/commands/canvas/commands/category/remove.ts
|
|
698
|
+
import { UncachedCanvasClient as UncachedCanvasClient3 } from "@uniformdev/canvas";
|
|
699
|
+
var CategoryRemoveModule = {
|
|
700
|
+
command: "remove <id>",
|
|
701
|
+
aliases: ["delete", "rm"],
|
|
702
|
+
describe: "Delete a category",
|
|
703
|
+
builder: (yargs21) => withApiOptions(
|
|
704
|
+
withProjectOptions(yargs21.positional("id", { demandOption: true, describe: "Category UUID to delete" }))
|
|
705
|
+
),
|
|
706
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
707
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
708
|
+
const client = new UncachedCanvasClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
709
|
+
await client.removeCategory({ categoryId: id });
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
// src/commands/canvas/commands/category/update.ts
|
|
714
|
+
import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canvas";
|
|
715
|
+
var CategoryUpdateModule = {
|
|
716
|
+
command: "update <filename>",
|
|
717
|
+
aliases: ["put"],
|
|
718
|
+
describe: "Insert or update a category",
|
|
719
|
+
builder: (yargs21) => withApiOptions(
|
|
720
|
+
withProjectOptions(
|
|
721
|
+
yargs21.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
722
|
+
)
|
|
723
|
+
),
|
|
724
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
725
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
726
|
+
const client = new UncachedCanvasClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
727
|
+
const file = readFileToObject(filename);
|
|
728
|
+
await client.upsertCategories([file]);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// src/commands/canvas/commands/category.ts
|
|
733
|
+
var CategoryModule = {
|
|
734
|
+
command: "category <command>",
|
|
735
|
+
aliases: ["cat"],
|
|
736
|
+
describe: "Commands for Canvas categories",
|
|
737
|
+
builder: (yargs21) => yargs21.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
738
|
+
handler: () => {
|
|
739
|
+
yargs.help();
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
// src/commands/canvas/commands/component.ts
|
|
744
|
+
import yargs2 from "yargs";
|
|
745
|
+
|
|
746
|
+
// src/commands/canvas/commands/component/get.ts
|
|
747
|
+
import { UncachedCanvasClient as UncachedCanvasClient5 } from "@uniformdev/canvas";
|
|
748
|
+
|
|
474
749
|
// src/commands/canvas/commands/component/_util.ts
|
|
475
|
-
var
|
|
476
|
-
var
|
|
750
|
+
var selectIdentifier2 = (component) => component.id;
|
|
751
|
+
var selectDisplayName2 = (component) => `${component.name} (pid: ${component.id})`;
|
|
477
752
|
var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
478
753
|
|
|
479
754
|
// src/commands/canvas/commands/component/get.ts
|
|
480
755
|
var ComponentGetModule = {
|
|
481
756
|
command: "get <id>",
|
|
482
757
|
describe: "Fetch a component definition",
|
|
483
|
-
builder: (
|
|
758
|
+
builder: (yargs21) => withFormatOptions(
|
|
484
759
|
withApiOptions(
|
|
485
760
|
withProjectOptions(
|
|
486
|
-
|
|
761
|
+
yargs21.positional("id", { demandOption: true, describe: "Component definition public ID to fetch" })
|
|
487
762
|
)
|
|
488
763
|
)
|
|
489
764
|
),
|
|
490
765
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
491
766
|
const fetch3 = nodeFetchProxy(proxy);
|
|
492
|
-
const client = new
|
|
767
|
+
const client = new UncachedCanvasClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
493
768
|
const res = await client.getComponentDefinitions({ componentId: id, limit: 1 });
|
|
494
769
|
if (res.componentDefinitions.length === 0) {
|
|
495
770
|
console.error("Component did not exist");
|
|
@@ -508,15 +783,15 @@ var ComponentGetModule = {
|
|
|
508
783
|
};
|
|
509
784
|
|
|
510
785
|
// src/commands/canvas/commands/component/list.ts
|
|
511
|
-
import { UncachedCanvasClient as
|
|
786
|
+
import { UncachedCanvasClient as UncachedCanvasClient6 } from "@uniformdev/canvas";
|
|
512
787
|
var ComponentListModule = {
|
|
513
788
|
command: "list",
|
|
514
789
|
describe: "List component definitions",
|
|
515
790
|
aliases: ["ls"],
|
|
516
|
-
builder: (
|
|
791
|
+
builder: (yargs21) => withFormatOptions(
|
|
517
792
|
withApiOptions(
|
|
518
793
|
withProjectOptions(
|
|
519
|
-
|
|
794
|
+
yargs21.options({
|
|
520
795
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
521
796
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
522
797
|
})
|
|
@@ -525,14 +800,14 @@ var ComponentListModule = {
|
|
|
525
800
|
),
|
|
526
801
|
handler: async ({ apiHost, apiKey, proxy, limit, offset, format, filename, project: projectId }) => {
|
|
527
802
|
const fetch3 = nodeFetchProxy(proxy);
|
|
528
|
-
const client = new
|
|
803
|
+
const client = new UncachedCanvasClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
529
804
|
const res = await client.getComponentDefinitions({ limit, offset });
|
|
530
805
|
emitWithFormat(res.componentDefinitions, format, filename);
|
|
531
806
|
}
|
|
532
807
|
};
|
|
533
808
|
|
|
534
809
|
// src/commands/canvas/commands/component/pull.ts
|
|
535
|
-
import { UncachedCanvasClient as
|
|
810
|
+
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
536
811
|
|
|
537
812
|
// src/commands/canvas/componentDefinitionEngineDataSource.ts
|
|
538
813
|
function createComponentDefinitionEngineDataSource({
|
|
@@ -545,8 +820,8 @@ function createComponentDefinitionEngineDataSource({
|
|
|
545
820
|
);
|
|
546
821
|
for await (const def of componentDefinitions) {
|
|
547
822
|
const result = {
|
|
548
|
-
id:
|
|
549
|
-
displayName:
|
|
823
|
+
id: selectIdentifier2(def),
|
|
824
|
+
displayName: selectDisplayName2(def),
|
|
550
825
|
providerId: def.id,
|
|
551
826
|
object: def
|
|
552
827
|
};
|
|
@@ -566,22 +841,14 @@ function createComponentDefinitionEngineDataSource({
|
|
|
566
841
|
};
|
|
567
842
|
}
|
|
568
843
|
|
|
569
|
-
// src/commands/canvas/package.ts
|
|
570
|
-
function readCanvasPackage(filename, assertExists) {
|
|
571
|
-
return readUniformPackage(filename, assertExists);
|
|
572
|
-
}
|
|
573
|
-
function writeCanvasPackage(filename, packageContents) {
|
|
574
|
-
writeUniformPackage(filename, packageContents);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
844
|
// src/commands/canvas/commands/component/pull.ts
|
|
578
845
|
var ComponentPullModule = {
|
|
579
846
|
command: "pull <directory>",
|
|
580
847
|
describe: "Pulls all component definitions to local files in a directory",
|
|
581
|
-
builder: (
|
|
848
|
+
builder: (yargs21) => withApiOptions(
|
|
582
849
|
withProjectOptions(
|
|
583
850
|
withDiffOptions(
|
|
584
|
-
|
|
851
|
+
yargs21.positional("directory", {
|
|
585
852
|
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.",
|
|
586
853
|
type: "string"
|
|
587
854
|
}).option("format", {
|
|
@@ -617,7 +884,7 @@ var ComponentPullModule = {
|
|
|
617
884
|
diff: diffMode
|
|
618
885
|
}) => {
|
|
619
886
|
const fetch3 = nodeFetchProxy(proxy);
|
|
620
|
-
const client = new
|
|
887
|
+
const client = new UncachedCanvasClient7({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
621
888
|
const source = createComponentDefinitionEngineDataSource({ client });
|
|
622
889
|
let target;
|
|
623
890
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -625,8 +892,8 @@ var ComponentPullModule = {
|
|
|
625
892
|
const packageContents = readCanvasPackage(directory, false);
|
|
626
893
|
target = await createArraySyncEngineDataSource({
|
|
627
894
|
objects: packageContents.components ?? [],
|
|
628
|
-
selectIdentifier,
|
|
629
|
-
selectDisplayName,
|
|
895
|
+
selectIdentifier: selectIdentifier2,
|
|
896
|
+
selectDisplayName: selectDisplayName2,
|
|
630
897
|
onSyncComplete: async (_, synced) => {
|
|
631
898
|
packageContents.components = synced;
|
|
632
899
|
writeCanvasPackage(directory, packageContents);
|
|
@@ -635,8 +902,8 @@ var ComponentPullModule = {
|
|
|
635
902
|
} else {
|
|
636
903
|
target = await createFileSyncEngineDataSource({
|
|
637
904
|
directory,
|
|
638
|
-
selectIdentifier,
|
|
639
|
-
selectDisplayName,
|
|
905
|
+
selectIdentifier: selectIdentifier2,
|
|
906
|
+
selectDisplayName: selectDisplayName2,
|
|
640
907
|
selectSchemaUrl: () => new URL(selectSchemaUrl(), apiHost).toString(),
|
|
641
908
|
format
|
|
642
909
|
});
|
|
@@ -652,14 +919,14 @@ var ComponentPullModule = {
|
|
|
652
919
|
};
|
|
653
920
|
|
|
654
921
|
// src/commands/canvas/commands/component/push.ts
|
|
655
|
-
import { UncachedCanvasClient as
|
|
922
|
+
import { UncachedCanvasClient as UncachedCanvasClient8 } from "@uniformdev/canvas";
|
|
656
923
|
var ComponentPushModule = {
|
|
657
924
|
command: "push <directory>",
|
|
658
925
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
659
|
-
builder: (
|
|
926
|
+
builder: (yargs21) => withApiOptions(
|
|
660
927
|
withProjectOptions(
|
|
661
928
|
withDiffOptions(
|
|
662
|
-
|
|
929
|
+
yargs21.positional("directory", {
|
|
663
930
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
664
931
|
type: "string"
|
|
665
932
|
}).option("what-if", {
|
|
@@ -688,21 +955,21 @@ var ComponentPushModule = {
|
|
|
688
955
|
diff: diffMode
|
|
689
956
|
}) => {
|
|
690
957
|
const fetch3 = nodeFetchProxy(proxy);
|
|
691
|
-
const client = new
|
|
958
|
+
const client = new UncachedCanvasClient8({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
692
959
|
let source;
|
|
693
960
|
const isPackage = isPathAPackageFile(directory);
|
|
694
961
|
if (isPackage) {
|
|
695
962
|
const packageContents = readCanvasPackage(directory, true);
|
|
696
963
|
source = await createArraySyncEngineDataSource({
|
|
697
964
|
objects: packageContents.components ?? [],
|
|
698
|
-
selectIdentifier,
|
|
699
|
-
selectDisplayName
|
|
965
|
+
selectIdentifier: selectIdentifier2,
|
|
966
|
+
selectDisplayName: selectDisplayName2
|
|
700
967
|
});
|
|
701
968
|
} else {
|
|
702
969
|
source = await createFileSyncEngineDataSource({
|
|
703
970
|
directory,
|
|
704
|
-
selectIdentifier,
|
|
705
|
-
selectDisplayName,
|
|
971
|
+
selectIdentifier: selectIdentifier2,
|
|
972
|
+
selectDisplayName: selectDisplayName2,
|
|
706
973
|
selectSchemaUrl
|
|
707
974
|
});
|
|
708
975
|
}
|
|
@@ -718,37 +985,37 @@ var ComponentPushModule = {
|
|
|
718
985
|
};
|
|
719
986
|
|
|
720
987
|
// src/commands/canvas/commands/component/remove.ts
|
|
721
|
-
import { UncachedCanvasClient as
|
|
988
|
+
import { UncachedCanvasClient as UncachedCanvasClient9 } from "@uniformdev/canvas";
|
|
722
989
|
var ComponentRemoveModule = {
|
|
723
990
|
command: "remove <id>",
|
|
724
991
|
aliases: ["delete", "rm"],
|
|
725
992
|
describe: "Delete a component definition",
|
|
726
|
-
builder: (
|
|
993
|
+
builder: (yargs21) => withApiOptions(
|
|
727
994
|
withProjectOptions(
|
|
728
|
-
|
|
995
|
+
yargs21.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
729
996
|
)
|
|
730
997
|
),
|
|
731
998
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
732
999
|
const fetch3 = nodeFetchProxy(proxy);
|
|
733
|
-
const client = new
|
|
1000
|
+
const client = new UncachedCanvasClient9({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
734
1001
|
await client.removeComponentDefinition({ componentId: id });
|
|
735
1002
|
}
|
|
736
1003
|
};
|
|
737
1004
|
|
|
738
1005
|
// src/commands/canvas/commands/component/update.ts
|
|
739
|
-
import { UncachedCanvasClient as
|
|
1006
|
+
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
740
1007
|
var ComponentUpdateModule = {
|
|
741
1008
|
command: "update <filename>",
|
|
742
1009
|
aliases: ["put"],
|
|
743
1010
|
describe: "Insert or update a component definition",
|
|
744
|
-
builder: (
|
|
1011
|
+
builder: (yargs21) => withApiOptions(
|
|
745
1012
|
withProjectOptions(
|
|
746
|
-
|
|
1013
|
+
yargs21.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
747
1014
|
)
|
|
748
1015
|
),
|
|
749
1016
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
750
1017
|
const fetch3 = nodeFetchProxy(proxy);
|
|
751
|
-
const client = new
|
|
1018
|
+
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
752
1019
|
const file = readFileToObject(filename);
|
|
753
1020
|
await client.updateComponentDefinition({ componentDefinition: file });
|
|
754
1021
|
}
|
|
@@ -759,17 +1026,17 @@ var ComponentModule = {
|
|
|
759
1026
|
command: "component <command>",
|
|
760
1027
|
aliases: ["def"],
|
|
761
1028
|
describe: "Commands for Canvas component definitions",
|
|
762
|
-
builder: (
|
|
1029
|
+
builder: (yargs21) => yargs21.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
763
1030
|
handler: () => {
|
|
764
|
-
|
|
1031
|
+
yargs2.help();
|
|
765
1032
|
}
|
|
766
1033
|
};
|
|
767
1034
|
|
|
768
1035
|
// src/commands/canvas/commands/composition.ts
|
|
769
|
-
import
|
|
1036
|
+
import yargs3 from "yargs";
|
|
770
1037
|
|
|
771
1038
|
// src/commands/canvas/commands/composition/get.ts
|
|
772
|
-
import { UncachedCanvasClient as
|
|
1039
|
+
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
773
1040
|
|
|
774
1041
|
// src/commands/canvas/util.ts
|
|
775
1042
|
import { CANVAS_DRAFT_STATE, CANVAS_PUBLISHED_STATE } from "@uniformdev/canvas";
|
|
@@ -781,8 +1048,8 @@ function prepCompositionForDisk(composition) {
|
|
|
781
1048
|
delete prepped.state;
|
|
782
1049
|
return prepped;
|
|
783
1050
|
}
|
|
784
|
-
function withStateOptions(
|
|
785
|
-
return
|
|
1051
|
+
function withStateOptions(yargs21) {
|
|
1052
|
+
return yargs21.option("state", {
|
|
786
1053
|
type: "string",
|
|
787
1054
|
describe: `Composition state to fetch.`,
|
|
788
1055
|
choices: ["preview", "published"],
|
|
@@ -807,11 +1074,11 @@ function convertCompositionState(state) {
|
|
|
807
1074
|
var CompositionGetModule = {
|
|
808
1075
|
command: "get <id>",
|
|
809
1076
|
describe: "Fetch a composition",
|
|
810
|
-
builder: (
|
|
1077
|
+
builder: (yargs21) => withFormatOptions(
|
|
811
1078
|
withApiOptions(
|
|
812
1079
|
withProjectOptions(
|
|
813
1080
|
withStateOptions(
|
|
814
|
-
|
|
1081
|
+
yargs21.positional("id", { demandOption: true, describe: "Composition public ID to fetch" }).option({
|
|
815
1082
|
resolvePatterns: {
|
|
816
1083
|
type: "boolean",
|
|
817
1084
|
default: false,
|
|
@@ -859,7 +1126,7 @@ var CompositionGetModule = {
|
|
|
859
1126
|
diagnostics
|
|
860
1127
|
}) => {
|
|
861
1128
|
const fetch3 = nodeFetchProxy(proxy);
|
|
862
|
-
const client = new
|
|
1129
|
+
const client = new UncachedCanvasClient11({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
|
|
863
1130
|
const res = prepCompositionForDisk(
|
|
864
1131
|
await client.getCompositionById({
|
|
865
1132
|
compositionId: id,
|
|
@@ -876,16 +1143,16 @@ var CompositionGetModule = {
|
|
|
876
1143
|
};
|
|
877
1144
|
|
|
878
1145
|
// src/commands/canvas/commands/composition/list.ts
|
|
879
|
-
import { UncachedCanvasClient as
|
|
1146
|
+
import { UncachedCanvasClient as UncachedCanvasClient12 } from "@uniformdev/canvas";
|
|
880
1147
|
var CompositionListModule = {
|
|
881
1148
|
command: "list",
|
|
882
1149
|
describe: "List compositions",
|
|
883
1150
|
aliases: ["ls"],
|
|
884
|
-
builder: (
|
|
1151
|
+
builder: (yargs21) => withFormatOptions(
|
|
885
1152
|
withApiOptions(
|
|
886
1153
|
withProjectOptions(
|
|
887
1154
|
withStateOptions(
|
|
888
|
-
|
|
1155
|
+
yargs21.options({
|
|
889
1156
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
890
1157
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
891
1158
|
resolvePatterns: {
|
|
@@ -923,7 +1190,7 @@ var CompositionListModule = {
|
|
|
923
1190
|
componentIDs
|
|
924
1191
|
}) => {
|
|
925
1192
|
const fetch3 = nodeFetchProxy(proxy);
|
|
926
|
-
const client = new
|
|
1193
|
+
const client = new UncachedCanvasClient12({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
927
1194
|
const res = await client.getCompositionList({
|
|
928
1195
|
limit,
|
|
929
1196
|
offset,
|
|
@@ -937,11 +1204,11 @@ var CompositionListModule = {
|
|
|
937
1204
|
};
|
|
938
1205
|
|
|
939
1206
|
// src/commands/canvas/commands/composition/publish.ts
|
|
940
|
-
import { UncachedCanvasClient as
|
|
1207
|
+
import { UncachedCanvasClient as UncachedCanvasClient13 } from "@uniformdev/canvas";
|
|
941
1208
|
|
|
942
1209
|
// src/commands/canvas/commands/composition/_util.ts
|
|
943
|
-
var
|
|
944
|
-
var
|
|
1210
|
+
var selectIdentifier3 = (component) => component.composition._id;
|
|
1211
|
+
var selectDisplayName3 = (component) => `${component.composition._name ?? component.composition._slug ?? component.composition._id} (pid: ${component.composition._id})`;
|
|
945
1212
|
|
|
946
1213
|
// src/commands/canvas/componentInstanceEngineDataSource.ts
|
|
947
1214
|
function createComponentInstanceEngineDataSource({
|
|
@@ -965,8 +1232,8 @@ function createComponentInstanceEngineDataSource({
|
|
|
965
1232
|
);
|
|
966
1233
|
for await (const compositionListItem of componentInstances) {
|
|
967
1234
|
const result = {
|
|
968
|
-
id:
|
|
969
|
-
displayName:
|
|
1235
|
+
id: selectIdentifier3(compositionListItem),
|
|
1236
|
+
displayName: selectDisplayName3(compositionListItem),
|
|
970
1237
|
providerId: compositionListItem.composition._id,
|
|
971
1238
|
object: prepCompositionForDisk(compositionListItem)
|
|
972
1239
|
};
|
|
@@ -988,10 +1255,10 @@ function createComponentInstanceEngineDataSource({
|
|
|
988
1255
|
var CompositionPublishModule = {
|
|
989
1256
|
command: "publish [compositionIDs]",
|
|
990
1257
|
describe: "Publishes compositions",
|
|
991
|
-
builder: (
|
|
1258
|
+
builder: (yargs21) => withApiOptions(
|
|
992
1259
|
withProjectOptions(
|
|
993
1260
|
withDiffOptions(
|
|
994
|
-
|
|
1261
|
+
yargs21.positional("compositionIDs", {
|
|
995
1262
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
996
1263
|
type: "string"
|
|
997
1264
|
}).option("all", {
|
|
@@ -1024,7 +1291,7 @@ var CompositionPublishModule = {
|
|
|
1024
1291
|
}
|
|
1025
1292
|
const compositionIDsArray = compositionIDs ? compositionIDs.split(",").map((id) => id.trim()) : void 0;
|
|
1026
1293
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1027
|
-
const client = new
|
|
1294
|
+
const client = new UncachedCanvasClient13({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1028
1295
|
const source = createComponentInstanceEngineDataSource({
|
|
1029
1296
|
client,
|
|
1030
1297
|
state: "preview",
|
|
@@ -1046,15 +1313,15 @@ var CompositionPublishModule = {
|
|
|
1046
1313
|
};
|
|
1047
1314
|
|
|
1048
1315
|
// src/commands/canvas/commands/composition/pull.ts
|
|
1049
|
-
import { UncachedCanvasClient as
|
|
1316
|
+
import { UncachedCanvasClient as UncachedCanvasClient14 } from "@uniformdev/canvas";
|
|
1050
1317
|
var CompositionPullModule = {
|
|
1051
1318
|
command: "pull <directory>",
|
|
1052
1319
|
describe: "Pulls all compositions to local files in a directory",
|
|
1053
|
-
builder: (
|
|
1320
|
+
builder: (yargs21) => withApiOptions(
|
|
1054
1321
|
withProjectOptions(
|
|
1055
1322
|
withStateOptions(
|
|
1056
1323
|
withDiffOptions(
|
|
1057
|
-
|
|
1324
|
+
yargs21.positional("directory", {
|
|
1058
1325
|
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.",
|
|
1059
1326
|
type: "string"
|
|
1060
1327
|
}).option("format", {
|
|
@@ -1092,7 +1359,7 @@ var CompositionPullModule = {
|
|
|
1092
1359
|
diff: diffMode
|
|
1093
1360
|
}) => {
|
|
1094
1361
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1095
|
-
const client = new
|
|
1362
|
+
const client = new UncachedCanvasClient14({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1096
1363
|
const source = createComponentInstanceEngineDataSource({ client, state });
|
|
1097
1364
|
const isPackage = isPathAPackageFile(directory);
|
|
1098
1365
|
let target;
|
|
@@ -1100,8 +1367,8 @@ var CompositionPullModule = {
|
|
|
1100
1367
|
const packageContents = readCanvasPackage(directory, false);
|
|
1101
1368
|
target = await createArraySyncEngineDataSource({
|
|
1102
1369
|
objects: (packageContents == null ? void 0 : packageContents.compositions) ?? [],
|
|
1103
|
-
selectIdentifier:
|
|
1104
|
-
selectDisplayName:
|
|
1370
|
+
selectIdentifier: selectIdentifier3,
|
|
1371
|
+
selectDisplayName: selectDisplayName3,
|
|
1105
1372
|
onSyncComplete: async (_, synced) => {
|
|
1106
1373
|
packageContents.compositions = synced;
|
|
1107
1374
|
writeCanvasPackage(directory, packageContents);
|
|
@@ -1110,8 +1377,8 @@ var CompositionPullModule = {
|
|
|
1110
1377
|
} else {
|
|
1111
1378
|
target = await createFileSyncEngineDataSource({
|
|
1112
1379
|
directory,
|
|
1113
|
-
selectIdentifier:
|
|
1114
|
-
selectDisplayName:
|
|
1380
|
+
selectIdentifier: selectIdentifier3,
|
|
1381
|
+
selectDisplayName: selectDisplayName3,
|
|
1115
1382
|
format
|
|
1116
1383
|
});
|
|
1117
1384
|
}
|
|
@@ -1126,15 +1393,15 @@ var CompositionPullModule = {
|
|
|
1126
1393
|
};
|
|
1127
1394
|
|
|
1128
1395
|
// src/commands/canvas/commands/composition/push.ts
|
|
1129
|
-
import { UncachedCanvasClient as
|
|
1396
|
+
import { UncachedCanvasClient as UncachedCanvasClient15 } from "@uniformdev/canvas";
|
|
1130
1397
|
var CompositionPushModule = {
|
|
1131
1398
|
command: "push <directory>",
|
|
1132
1399
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
1133
|
-
builder: (
|
|
1400
|
+
builder: (yargs21) => withApiOptions(
|
|
1134
1401
|
withProjectOptions(
|
|
1135
1402
|
withStateOptions(
|
|
1136
1403
|
withDiffOptions(
|
|
1137
|
-
|
|
1404
|
+
yargs21.positional("directory", {
|
|
1138
1405
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1139
1406
|
type: "string"
|
|
1140
1407
|
}).option("what-if", {
|
|
@@ -1165,21 +1432,21 @@ var CompositionPushModule = {
|
|
|
1165
1432
|
diff: diffMode
|
|
1166
1433
|
}) => {
|
|
1167
1434
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1168
|
-
const client = new
|
|
1435
|
+
const client = new UncachedCanvasClient15({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1169
1436
|
let source;
|
|
1170
1437
|
const isPackage = isPathAPackageFile(directory);
|
|
1171
1438
|
if (isPackage) {
|
|
1172
1439
|
const packageContents = readCanvasPackage(directory, true);
|
|
1173
1440
|
source = await createArraySyncEngineDataSource({
|
|
1174
1441
|
objects: packageContents.compositions ?? [],
|
|
1175
|
-
selectIdentifier:
|
|
1176
|
-
selectDisplayName:
|
|
1442
|
+
selectIdentifier: selectIdentifier3,
|
|
1443
|
+
selectDisplayName: selectDisplayName3
|
|
1177
1444
|
});
|
|
1178
1445
|
} else {
|
|
1179
1446
|
source = await createFileSyncEngineDataSource({
|
|
1180
1447
|
directory,
|
|
1181
|
-
selectIdentifier:
|
|
1182
|
-
selectDisplayName:
|
|
1448
|
+
selectIdentifier: selectIdentifier3,
|
|
1449
|
+
selectDisplayName: selectDisplayName3
|
|
1183
1450
|
});
|
|
1184
1451
|
}
|
|
1185
1452
|
const target = createComponentInstanceEngineDataSource({ client, state });
|
|
@@ -1194,56 +1461,56 @@ var CompositionPushModule = {
|
|
|
1194
1461
|
};
|
|
1195
1462
|
|
|
1196
1463
|
// src/commands/canvas/commands/composition/remove.ts
|
|
1197
|
-
import { UncachedCanvasClient as
|
|
1464
|
+
import { UncachedCanvasClient as UncachedCanvasClient16 } from "@uniformdev/canvas";
|
|
1198
1465
|
var CompositionRemoveModule = {
|
|
1199
1466
|
command: "remove <id>",
|
|
1200
1467
|
aliases: ["delete", "rm"],
|
|
1201
1468
|
describe: "Delete a composition",
|
|
1202
|
-
builder: (
|
|
1469
|
+
builder: (yargs21) => withApiOptions(
|
|
1203
1470
|
withProjectOptions(
|
|
1204
|
-
|
|
1471
|
+
yargs21.positional("id", { demandOption: true, describe: "Composition public ID to delete" })
|
|
1205
1472
|
)
|
|
1206
1473
|
),
|
|
1207
1474
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
1208
1475
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1209
|
-
const client = new
|
|
1476
|
+
const client = new UncachedCanvasClient16({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1210
1477
|
await client.removeComposition({ compositionId: id });
|
|
1211
1478
|
}
|
|
1212
1479
|
};
|
|
1213
1480
|
|
|
1214
1481
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
1215
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient as
|
|
1482
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient as UncachedCanvasClient17 } from "@uniformdev/canvas";
|
|
1216
1483
|
var CompositionUnpublishModule = {
|
|
1217
1484
|
command: "unpublish <id>",
|
|
1218
1485
|
describe: "Unpublish a composition",
|
|
1219
|
-
builder: (
|
|
1486
|
+
builder: (yargs21) => withApiOptions(
|
|
1220
1487
|
withProjectOptions(
|
|
1221
|
-
|
|
1488
|
+
yargs21.positional("id", { demandOption: true, describe: "Composition public ID to unpublish" })
|
|
1222
1489
|
)
|
|
1223
1490
|
),
|
|
1224
1491
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
1225
1492
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1226
|
-
const client = new
|
|
1493
|
+
const client = new UncachedCanvasClient17({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1227
1494
|
await client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 });
|
|
1228
1495
|
}
|
|
1229
1496
|
};
|
|
1230
1497
|
|
|
1231
1498
|
// src/commands/canvas/commands/composition/update.ts
|
|
1232
|
-
import { UncachedCanvasClient as
|
|
1499
|
+
import { UncachedCanvasClient as UncachedCanvasClient18 } from "@uniformdev/canvas";
|
|
1233
1500
|
var CompositionUpdateModule = {
|
|
1234
1501
|
command: "update <filename>",
|
|
1235
1502
|
aliases: ["put"],
|
|
1236
1503
|
describe: "Insert or update a composition",
|
|
1237
|
-
builder: (
|
|
1504
|
+
builder: (yargs21) => withApiOptions(
|
|
1238
1505
|
withProjectOptions(
|
|
1239
1506
|
withStateOptions(
|
|
1240
|
-
|
|
1507
|
+
yargs21.positional("filename", { demandOption: true, describe: "Composition file to put" })
|
|
1241
1508
|
)
|
|
1242
1509
|
)
|
|
1243
1510
|
),
|
|
1244
1511
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, state }) => {
|
|
1245
1512
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1246
|
-
const client = new
|
|
1513
|
+
const client = new UncachedCanvasClient18({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1247
1514
|
const file = readFileToObject(filename);
|
|
1248
1515
|
await client.updateComposition({ ...file, state: convertCompositionState(state) });
|
|
1249
1516
|
}
|
|
@@ -1254,14 +1521,14 @@ var CompositionModule = {
|
|
|
1254
1521
|
command: "composition <command>",
|
|
1255
1522
|
describe: "Commands for Canvas compositions",
|
|
1256
1523
|
aliases: ["comp"],
|
|
1257
|
-
builder: (
|
|
1524
|
+
builder: (yargs21) => yargs21.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
1258
1525
|
handler: () => {
|
|
1259
|
-
|
|
1526
|
+
yargs3.help();
|
|
1260
1527
|
}
|
|
1261
1528
|
};
|
|
1262
1529
|
|
|
1263
1530
|
// src/commands/canvas/commands/dataType.ts
|
|
1264
|
-
import
|
|
1531
|
+
import yargs4 from "yargs";
|
|
1265
1532
|
|
|
1266
1533
|
// src/commands/canvas/commands/dataType/get.ts
|
|
1267
1534
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
@@ -1269,11 +1536,11 @@ var DataTypeGetModule = {
|
|
|
1269
1536
|
command: "get <id>",
|
|
1270
1537
|
describe: "Get a data type",
|
|
1271
1538
|
aliases: ["ls"],
|
|
1272
|
-
builder: (
|
|
1539
|
+
builder: (yargs21) => withFormatOptions(
|
|
1273
1540
|
withApiOptions(
|
|
1274
1541
|
withProjectOptions(
|
|
1275
1542
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1276
|
-
|
|
1543
|
+
yargs21.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
1277
1544
|
)
|
|
1278
1545
|
)
|
|
1279
1546
|
),
|
|
@@ -1295,7 +1562,7 @@ var DataTypeListModule = {
|
|
|
1295
1562
|
command: "list",
|
|
1296
1563
|
describe: "List data types",
|
|
1297
1564
|
aliases: ["ls"],
|
|
1298
|
-
builder: (
|
|
1565
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
1299
1566
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1300
1567
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1301
1568
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -1308,8 +1575,8 @@ var DataTypeListModule = {
|
|
|
1308
1575
|
import { DataTypeClient as DataTypeClient3 } from "@uniformdev/canvas";
|
|
1309
1576
|
|
|
1310
1577
|
// src/commands/canvas/commands/dataType/_util.ts
|
|
1311
|
-
var
|
|
1312
|
-
var
|
|
1578
|
+
var selectIdentifier4 = (dataType) => dataType.id;
|
|
1579
|
+
var selectDisplayName4 = (dataType) => `${dataType.displayName} (pid: ${dataType.id})`;
|
|
1313
1580
|
|
|
1314
1581
|
// src/commands/canvas/dataTypeEngineDataSource.ts
|
|
1315
1582
|
function createDataTypeEngineDataSource({
|
|
@@ -1319,8 +1586,8 @@ function createDataTypeEngineDataSource({
|
|
|
1319
1586
|
const dataTypes = (await client.get()).results;
|
|
1320
1587
|
for await (const dataType of dataTypes) {
|
|
1321
1588
|
const result = {
|
|
1322
|
-
id:
|
|
1323
|
-
displayName:
|
|
1589
|
+
id: selectIdentifier4(dataType),
|
|
1590
|
+
displayName: selectDisplayName4(dataType),
|
|
1324
1591
|
providerId: dataType.id,
|
|
1325
1592
|
object: dataType
|
|
1326
1593
|
};
|
|
@@ -1344,10 +1611,10 @@ function createDataTypeEngineDataSource({
|
|
|
1344
1611
|
var DataTypePullModule = {
|
|
1345
1612
|
command: "pull <directory>",
|
|
1346
1613
|
describe: "Pulls all data types to local files in a directory",
|
|
1347
|
-
builder: (
|
|
1614
|
+
builder: (yargs21) => withApiOptions(
|
|
1348
1615
|
withProjectOptions(
|
|
1349
1616
|
withDiffOptions(
|
|
1350
|
-
|
|
1617
|
+
yargs21.positional("directory", {
|
|
1351
1618
|
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.",
|
|
1352
1619
|
type: "string"
|
|
1353
1620
|
}).option("format", {
|
|
@@ -1397,8 +1664,8 @@ var DataTypePullModule = {
|
|
|
1397
1664
|
const packageContents = readCanvasPackage(directory, false);
|
|
1398
1665
|
target = await createArraySyncEngineDataSource({
|
|
1399
1666
|
objects: packageContents.dataTypes ?? [],
|
|
1400
|
-
selectIdentifier:
|
|
1401
|
-
selectDisplayName:
|
|
1667
|
+
selectIdentifier: selectIdentifier4,
|
|
1668
|
+
selectDisplayName: selectDisplayName4,
|
|
1402
1669
|
onSyncComplete: async (_, synced) => {
|
|
1403
1670
|
packageContents.dataTypes = synced;
|
|
1404
1671
|
writeCanvasPackage(directory, packageContents);
|
|
@@ -1407,8 +1674,8 @@ var DataTypePullModule = {
|
|
|
1407
1674
|
} else {
|
|
1408
1675
|
target = await createFileSyncEngineDataSource({
|
|
1409
1676
|
directory,
|
|
1410
|
-
selectIdentifier:
|
|
1411
|
-
selectDisplayName:
|
|
1677
|
+
selectIdentifier: selectIdentifier4,
|
|
1678
|
+
selectDisplayName: selectDisplayName4,
|
|
1412
1679
|
format
|
|
1413
1680
|
});
|
|
1414
1681
|
}
|
|
@@ -1427,10 +1694,10 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
1427
1694
|
var DataTypePushModule = {
|
|
1428
1695
|
command: "push <directory>",
|
|
1429
1696
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
1430
|
-
builder: (
|
|
1697
|
+
builder: (yargs21) => withApiOptions(
|
|
1431
1698
|
withProjectOptions(
|
|
1432
1699
|
withDiffOptions(
|
|
1433
|
-
|
|
1700
|
+
yargs21.positional("directory", {
|
|
1434
1701
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
1435
1702
|
type: "string"
|
|
1436
1703
|
}).option("what-if", {
|
|
@@ -1472,14 +1739,14 @@ var DataTypePushModule = {
|
|
|
1472
1739
|
const packageContents = readCanvasPackage(directory, true);
|
|
1473
1740
|
source = await createArraySyncEngineDataSource({
|
|
1474
1741
|
objects: packageContents.dataTypes ?? [],
|
|
1475
|
-
selectIdentifier:
|
|
1476
|
-
selectDisplayName:
|
|
1742
|
+
selectIdentifier: selectIdentifier4,
|
|
1743
|
+
selectDisplayName: selectDisplayName4
|
|
1477
1744
|
});
|
|
1478
1745
|
} else {
|
|
1479
1746
|
source = await createFileSyncEngineDataSource({
|
|
1480
1747
|
directory,
|
|
1481
|
-
selectIdentifier:
|
|
1482
|
-
selectDisplayName:
|
|
1748
|
+
selectIdentifier: selectIdentifier4,
|
|
1749
|
+
selectDisplayName: selectDisplayName4
|
|
1483
1750
|
});
|
|
1484
1751
|
}
|
|
1485
1752
|
const target = createDataTypeEngineDataSource({ client });
|
|
@@ -1499,9 +1766,9 @@ var DataTypeRemoveModule = {
|
|
|
1499
1766
|
command: "remove <id>",
|
|
1500
1767
|
aliases: ["delete", "rm"],
|
|
1501
1768
|
describe: "Delete a data type",
|
|
1502
|
-
builder: (
|
|
1769
|
+
builder: (yargs21) => withApiOptions(
|
|
1503
1770
|
withProjectOptions(
|
|
1504
|
-
|
|
1771
|
+
yargs21.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
1505
1772
|
)
|
|
1506
1773
|
),
|
|
1507
1774
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1517,9 +1784,9 @@ var DataTypeUpdateModule = {
|
|
|
1517
1784
|
command: "update <filename>",
|
|
1518
1785
|
aliases: ["put"],
|
|
1519
1786
|
describe: "Insert or update a data type",
|
|
1520
|
-
builder: (
|
|
1787
|
+
builder: (yargs21) => withApiOptions(
|
|
1521
1788
|
withProjectOptions(
|
|
1522
|
-
|
|
1789
|
+
yargs21.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
1523
1790
|
)
|
|
1524
1791
|
),
|
|
1525
1792
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -1535,9 +1802,9 @@ var DataTypeModule = {
|
|
|
1535
1802
|
command: "datatype <command>",
|
|
1536
1803
|
aliases: ["dt"],
|
|
1537
1804
|
describe: "Commands for Data Type definitions",
|
|
1538
|
-
builder: (
|
|
1805
|
+
builder: (yargs21) => yargs21.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
1539
1806
|
handler: () => {
|
|
1540
|
-
|
|
1807
|
+
yargs4.help();
|
|
1541
1808
|
}
|
|
1542
1809
|
};
|
|
1543
1810
|
|
|
@@ -1546,27 +1813,27 @@ var CanvasCommand = {
|
|
|
1546
1813
|
command: "canvas <command>",
|
|
1547
1814
|
aliases: ["cv", "pm", "presentation"],
|
|
1548
1815
|
describe: "Uniform Canvas commands",
|
|
1549
|
-
builder: (
|
|
1816
|
+
builder: (yargs21) => yargs21.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).demandCommand(),
|
|
1550
1817
|
handler: () => {
|
|
1551
|
-
|
|
1818
|
+
yargs5.showHelp();
|
|
1552
1819
|
}
|
|
1553
1820
|
};
|
|
1554
1821
|
|
|
1555
1822
|
// src/commands/context/index.ts
|
|
1556
|
-
import
|
|
1823
|
+
import yargs12 from "yargs";
|
|
1557
1824
|
|
|
1558
1825
|
// src/commands/context/commands/aggregate.ts
|
|
1559
|
-
import
|
|
1826
|
+
import yargs6 from "yargs";
|
|
1560
1827
|
|
|
1561
1828
|
// src/commands/context/commands/aggregate/get.ts
|
|
1562
1829
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
1563
1830
|
var AggregateGetModule = {
|
|
1564
1831
|
command: "get <id>",
|
|
1565
1832
|
describe: "Fetch an aggregate",
|
|
1566
|
-
builder: (
|
|
1833
|
+
builder: (yargs21) => withFormatOptions(
|
|
1567
1834
|
withApiOptions(
|
|
1568
1835
|
withProjectOptions(
|
|
1569
|
-
|
|
1836
|
+
yargs21.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
1570
1837
|
)
|
|
1571
1838
|
)
|
|
1572
1839
|
),
|
|
@@ -1589,7 +1856,7 @@ var AggregateListModule = {
|
|
|
1589
1856
|
command: "list",
|
|
1590
1857
|
describe: "List aggregates",
|
|
1591
1858
|
aliases: ["ls"],
|
|
1592
|
-
builder: (
|
|
1859
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
1593
1860
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1594
1861
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1595
1862
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1602,8 +1869,8 @@ var AggregateListModule = {
|
|
|
1602
1869
|
import { UncachedAggregateClient as UncachedAggregateClient3 } from "@uniformdev/context/api";
|
|
1603
1870
|
|
|
1604
1871
|
// src/commands/context/commands/aggregate/_util.ts
|
|
1605
|
-
var
|
|
1606
|
-
var
|
|
1872
|
+
var selectIdentifier5 = (source) => source.id;
|
|
1873
|
+
var selectDisplayName5 = (source) => `${source.name} (pid: ${source.id})`;
|
|
1607
1874
|
|
|
1608
1875
|
// src/commands/context/aggregateEngineDataSource.ts
|
|
1609
1876
|
function createAggregateEngineDataSource({
|
|
@@ -1614,8 +1881,8 @@ function createAggregateEngineDataSource({
|
|
|
1614
1881
|
const aggregates = (await client.get({ type })).aggregates;
|
|
1615
1882
|
for await (const def of aggregates) {
|
|
1616
1883
|
const result = {
|
|
1617
|
-
id:
|
|
1618
|
-
displayName:
|
|
1884
|
+
id: selectIdentifier5(def),
|
|
1885
|
+
displayName: selectDisplayName5(def),
|
|
1619
1886
|
providerId: def.id,
|
|
1620
1887
|
object: def
|
|
1621
1888
|
};
|
|
@@ -1655,10 +1922,10 @@ function writeContextPackage(filename, packageContents) {
|
|
|
1655
1922
|
var AggregatePullModule = {
|
|
1656
1923
|
command: "pull <directory>",
|
|
1657
1924
|
describe: "Pulls all aggregates to local files in a directory",
|
|
1658
|
-
builder: (
|
|
1925
|
+
builder: (yargs21) => withApiOptions(
|
|
1659
1926
|
withProjectOptions(
|
|
1660
1927
|
withDiffOptions(
|
|
1661
|
-
|
|
1928
|
+
yargs21.positional("directory", {
|
|
1662
1929
|
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.",
|
|
1663
1930
|
type: "string"
|
|
1664
1931
|
}).option("format", {
|
|
@@ -1702,8 +1969,8 @@ var AggregatePullModule = {
|
|
|
1702
1969
|
const packageContents = readContextPackage(directory, false);
|
|
1703
1970
|
target = await createArraySyncEngineDataSource({
|
|
1704
1971
|
objects: packageContents.aggregates ?? [],
|
|
1705
|
-
selectIdentifier:
|
|
1706
|
-
selectDisplayName:
|
|
1972
|
+
selectIdentifier: selectIdentifier5,
|
|
1973
|
+
selectDisplayName: selectDisplayName5,
|
|
1707
1974
|
onSyncComplete: async (_, synced) => {
|
|
1708
1975
|
packageContents.aggregates = synced;
|
|
1709
1976
|
writeContextPackage(directory, packageContents);
|
|
@@ -1712,8 +1979,8 @@ var AggregatePullModule = {
|
|
|
1712
1979
|
} else {
|
|
1713
1980
|
target = await createFileSyncEngineDataSource({
|
|
1714
1981
|
directory,
|
|
1715
|
-
selectIdentifier:
|
|
1716
|
-
selectDisplayName:
|
|
1982
|
+
selectIdentifier: selectIdentifier5,
|
|
1983
|
+
selectDisplayName: selectDisplayName5,
|
|
1717
1984
|
format
|
|
1718
1985
|
});
|
|
1719
1986
|
}
|
|
@@ -1732,10 +1999,10 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
1732
1999
|
var AggregatePushModule = {
|
|
1733
2000
|
command: "push <directory>",
|
|
1734
2001
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
1735
|
-
builder: (
|
|
2002
|
+
builder: (yargs21) => withApiOptions(
|
|
1736
2003
|
withProjectOptions(
|
|
1737
2004
|
withDiffOptions(
|
|
1738
|
-
|
|
2005
|
+
yargs21.positional("directory", {
|
|
1739
2006
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
1740
2007
|
type: "string"
|
|
1741
2008
|
}).option("what-if", {
|
|
@@ -1771,14 +2038,14 @@ var AggregatePushModule = {
|
|
|
1771
2038
|
const packageContents = readContextPackage(directory, true);
|
|
1772
2039
|
source = await createArraySyncEngineDataSource({
|
|
1773
2040
|
objects: packageContents.aggregates ?? [],
|
|
1774
|
-
selectIdentifier:
|
|
1775
|
-
selectDisplayName:
|
|
2041
|
+
selectIdentifier: selectIdentifier5,
|
|
2042
|
+
selectDisplayName: selectDisplayName5
|
|
1776
2043
|
});
|
|
1777
2044
|
} else {
|
|
1778
2045
|
source = await createFileSyncEngineDataSource({
|
|
1779
2046
|
directory,
|
|
1780
|
-
selectIdentifier:
|
|
1781
|
-
selectDisplayName:
|
|
2047
|
+
selectIdentifier: selectIdentifier5,
|
|
2048
|
+
selectDisplayName: selectDisplayName5
|
|
1782
2049
|
});
|
|
1783
2050
|
}
|
|
1784
2051
|
const target = createAggregateEngineDataSource({ client });
|
|
@@ -1799,9 +2066,9 @@ var AggregateRemoveModule = {
|
|
|
1799
2066
|
command: "remove <id>",
|
|
1800
2067
|
aliases: ["delete", "rm"],
|
|
1801
2068
|
describe: "Delete an aggregate",
|
|
1802
|
-
builder: (
|
|
2069
|
+
builder: (yargs21) => withApiOptions(
|
|
1803
2070
|
withProjectOptions(
|
|
1804
|
-
|
|
2071
|
+
yargs21.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
1805
2072
|
)
|
|
1806
2073
|
),
|
|
1807
2074
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1817,9 +2084,9 @@ var AggregateUpdateModule = {
|
|
|
1817
2084
|
command: "update <filename>",
|
|
1818
2085
|
aliases: ["put"],
|
|
1819
2086
|
describe: "Insert or update an aggregate",
|
|
1820
|
-
builder: (
|
|
2087
|
+
builder: (yargs21) => withApiOptions(
|
|
1821
2088
|
withProjectOptions(
|
|
1822
|
-
|
|
2089
|
+
yargs21.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
1823
2090
|
)
|
|
1824
2091
|
),
|
|
1825
2092
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -1835,24 +2102,24 @@ var AggregateModule = {
|
|
|
1835
2102
|
command: "aggregate <command>",
|
|
1836
2103
|
aliases: ["agg", "intent", "audience"],
|
|
1837
2104
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
1838
|
-
builder: (
|
|
2105
|
+
builder: (yargs21) => yargs21.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
1839
2106
|
handler: () => {
|
|
1840
|
-
|
|
2107
|
+
yargs6.help();
|
|
1841
2108
|
}
|
|
1842
2109
|
};
|
|
1843
2110
|
|
|
1844
2111
|
// src/commands/context/commands/enrichment.ts
|
|
1845
|
-
import
|
|
2112
|
+
import yargs7 from "yargs";
|
|
1846
2113
|
|
|
1847
2114
|
// src/commands/context/commands/enrichment/get.ts
|
|
1848
2115
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
1849
2116
|
var EnrichmentGetModule = {
|
|
1850
2117
|
command: "get <id>",
|
|
1851
2118
|
describe: "Fetch an enrichment category and its values",
|
|
1852
|
-
builder: (
|
|
2119
|
+
builder: (yargs21) => withFormatOptions(
|
|
1853
2120
|
withApiOptions(
|
|
1854
2121
|
withProjectOptions(
|
|
1855
|
-
|
|
2122
|
+
yargs21.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
1856
2123
|
)
|
|
1857
2124
|
)
|
|
1858
2125
|
),
|
|
@@ -1876,7 +2143,7 @@ var EnrichmentListModule = {
|
|
|
1876
2143
|
command: "list",
|
|
1877
2144
|
describe: "List enrichments",
|
|
1878
2145
|
aliases: ["ls"],
|
|
1879
|
-
builder: (
|
|
2146
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
1880
2147
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1881
2148
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1882
2149
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1889,8 +2156,8 @@ var EnrichmentListModule = {
|
|
|
1889
2156
|
import { UncachedEnrichmentClient as UncachedEnrichmentClient3 } from "@uniformdev/context/api";
|
|
1890
2157
|
|
|
1891
2158
|
// src/commands/context/commands/enrichment/_util.ts
|
|
1892
|
-
var
|
|
1893
|
-
var
|
|
2159
|
+
var selectIdentifier6 = (source) => source.id;
|
|
2160
|
+
var selectDisplayName6 = (source) => `${source.name} (pid: ${source.id})`;
|
|
1894
2161
|
|
|
1895
2162
|
// src/commands/context/enrichmentEngineDataSource.ts
|
|
1896
2163
|
function createEnrichmentEngineDataSource({
|
|
@@ -1900,8 +2167,8 @@ function createEnrichmentEngineDataSource({
|
|
|
1900
2167
|
const enrichments = (await client.get()).enrichments;
|
|
1901
2168
|
for await (const def of enrichments) {
|
|
1902
2169
|
const result = {
|
|
1903
|
-
id:
|
|
1904
|
-
displayName:
|
|
2170
|
+
id: selectIdentifier6(def),
|
|
2171
|
+
displayName: selectDisplayName6(def),
|
|
1905
2172
|
providerId: def.id,
|
|
1906
2173
|
object: def
|
|
1907
2174
|
};
|
|
@@ -1977,10 +2244,10 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
1977
2244
|
var EnrichmentPullModule = {
|
|
1978
2245
|
command: "pull <directory>",
|
|
1979
2246
|
describe: "Pulls all enrichments to local files in a directory",
|
|
1980
|
-
builder: (
|
|
2247
|
+
builder: (yargs21) => withApiOptions(
|
|
1981
2248
|
withProjectOptions(
|
|
1982
2249
|
withDiffOptions(
|
|
1983
|
-
|
|
2250
|
+
yargs21.positional("directory", {
|
|
1984
2251
|
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.",
|
|
1985
2252
|
type: "string"
|
|
1986
2253
|
}).option("format", {
|
|
@@ -2024,8 +2291,8 @@ var EnrichmentPullModule = {
|
|
|
2024
2291
|
const packageContents = readContextPackage(directory, false);
|
|
2025
2292
|
target = await createArraySyncEngineDataSource({
|
|
2026
2293
|
objects: packageContents.enrichments ?? [],
|
|
2027
|
-
selectIdentifier:
|
|
2028
|
-
selectDisplayName:
|
|
2294
|
+
selectIdentifier: selectIdentifier6,
|
|
2295
|
+
selectDisplayName: selectDisplayName6,
|
|
2029
2296
|
onSyncComplete: async (_, synced) => {
|
|
2030
2297
|
packageContents.enrichments = synced;
|
|
2031
2298
|
writeContextPackage(directory, packageContents);
|
|
@@ -2034,8 +2301,8 @@ var EnrichmentPullModule = {
|
|
|
2034
2301
|
} else {
|
|
2035
2302
|
target = await createFileSyncEngineDataSource({
|
|
2036
2303
|
directory,
|
|
2037
|
-
selectIdentifier:
|
|
2038
|
-
selectDisplayName:
|
|
2304
|
+
selectIdentifier: selectIdentifier6,
|
|
2305
|
+
selectDisplayName: selectDisplayName6,
|
|
2039
2306
|
format
|
|
2040
2307
|
});
|
|
2041
2308
|
}
|
|
@@ -2054,10 +2321,10 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
2054
2321
|
var EnrichmentPushModule = {
|
|
2055
2322
|
command: "push <directory>",
|
|
2056
2323
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
2057
|
-
builder: (
|
|
2324
|
+
builder: (yargs21) => withApiOptions(
|
|
2058
2325
|
withProjectOptions(
|
|
2059
2326
|
withDiffOptions(
|
|
2060
|
-
|
|
2327
|
+
yargs21.positional("directory", {
|
|
2061
2328
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
2062
2329
|
type: "string"
|
|
2063
2330
|
}).option("what-if", {
|
|
@@ -2093,14 +2360,14 @@ var EnrichmentPushModule = {
|
|
|
2093
2360
|
const packageContents = readContextPackage(directory, true);
|
|
2094
2361
|
source = await createArraySyncEngineDataSource({
|
|
2095
2362
|
objects: packageContents.enrichments ?? [],
|
|
2096
|
-
selectIdentifier:
|
|
2097
|
-
selectDisplayName:
|
|
2363
|
+
selectIdentifier: selectIdentifier6,
|
|
2364
|
+
selectDisplayName: selectDisplayName6
|
|
2098
2365
|
});
|
|
2099
2366
|
} else {
|
|
2100
2367
|
source = await createFileSyncEngineDataSource({
|
|
2101
2368
|
directory,
|
|
2102
|
-
selectIdentifier:
|
|
2103
|
-
selectDisplayName:
|
|
2369
|
+
selectIdentifier: selectIdentifier6,
|
|
2370
|
+
selectDisplayName: selectDisplayName6
|
|
2104
2371
|
});
|
|
2105
2372
|
}
|
|
2106
2373
|
const target = createEnrichmentEngineDataSource({ client });
|
|
@@ -2120,9 +2387,9 @@ var EnrichmentRemoveModule = {
|
|
|
2120
2387
|
command: "remove <id>",
|
|
2121
2388
|
aliases: ["delete", "rm"],
|
|
2122
2389
|
describe: "Delete an enrichment category and its values",
|
|
2123
|
-
builder: (
|
|
2390
|
+
builder: (yargs21) => withApiOptions(
|
|
2124
2391
|
withProjectOptions(
|
|
2125
|
-
|
|
2392
|
+
yargs21.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
2126
2393
|
)
|
|
2127
2394
|
),
|
|
2128
2395
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2137,14 +2404,14 @@ var EnrichmentModule = {
|
|
|
2137
2404
|
command: "enrichment <command>",
|
|
2138
2405
|
aliases: ["enr"],
|
|
2139
2406
|
describe: "Commands for Context enrichments",
|
|
2140
|
-
builder: (
|
|
2407
|
+
builder: (yargs21) => yargs21.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
2141
2408
|
handler: () => {
|
|
2142
|
-
|
|
2409
|
+
yargs7.help();
|
|
2143
2410
|
}
|
|
2144
2411
|
};
|
|
2145
2412
|
|
|
2146
2413
|
// src/commands/context/commands/manifest.ts
|
|
2147
|
-
import
|
|
2414
|
+
import yargs8 from "yargs";
|
|
2148
2415
|
|
|
2149
2416
|
// src/commands/context/commands/manifest/get.ts
|
|
2150
2417
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -2155,9 +2422,9 @@ var ManifestGetModule = {
|
|
|
2155
2422
|
command: "get [output]",
|
|
2156
2423
|
aliases: ["dl", "download"],
|
|
2157
2424
|
describe: "Download the Uniform Context manifest for a project",
|
|
2158
|
-
builder: (
|
|
2425
|
+
builder: (yargs21) => withApiOptions(
|
|
2159
2426
|
withProjectOptions(
|
|
2160
|
-
|
|
2427
|
+
yargs21.option("preview", {
|
|
2161
2428
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
2162
2429
|
default: false,
|
|
2163
2430
|
type: "boolean",
|
|
@@ -2218,7 +2485,7 @@ import { exit as exit2 } from "process";
|
|
|
2218
2485
|
var ManifestPublishModule = {
|
|
2219
2486
|
command: "publish",
|
|
2220
2487
|
describe: "Publish the Uniform Context manifest for a project",
|
|
2221
|
-
builder: (
|
|
2488
|
+
builder: (yargs21) => withApiOptions(withProjectOptions(yargs21)),
|
|
2222
2489
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
2223
2490
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2224
2491
|
try {
|
|
@@ -2251,24 +2518,24 @@ var ManifestModule = {
|
|
|
2251
2518
|
command: "manifest <command>",
|
|
2252
2519
|
describe: "Commands for context manifests",
|
|
2253
2520
|
aliases: ["man"],
|
|
2254
|
-
builder: (
|
|
2521
|
+
builder: (yargs21) => yargs21.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
2255
2522
|
handler: () => {
|
|
2256
|
-
|
|
2523
|
+
yargs8.help();
|
|
2257
2524
|
}
|
|
2258
2525
|
};
|
|
2259
2526
|
|
|
2260
2527
|
// src/commands/context/commands/quirk.ts
|
|
2261
|
-
import
|
|
2528
|
+
import yargs9 from "yargs";
|
|
2262
2529
|
|
|
2263
2530
|
// src/commands/context/commands/quirk/get.ts
|
|
2264
2531
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
2265
2532
|
var QuirkGetModule = {
|
|
2266
2533
|
command: "get <id>",
|
|
2267
2534
|
describe: "Fetch a quirk",
|
|
2268
|
-
builder: (
|
|
2535
|
+
builder: (yargs21) => withFormatOptions(
|
|
2269
2536
|
withApiOptions(
|
|
2270
2537
|
withProjectOptions(
|
|
2271
|
-
|
|
2538
|
+
yargs21.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
2272
2539
|
)
|
|
2273
2540
|
)
|
|
2274
2541
|
),
|
|
@@ -2291,10 +2558,10 @@ var QuirkListModule = {
|
|
|
2291
2558
|
command: "list",
|
|
2292
2559
|
describe: "List quirks",
|
|
2293
2560
|
aliases: ["ls"],
|
|
2294
|
-
builder: (
|
|
2561
|
+
builder: (yargs21) => withFormatOptions(
|
|
2295
2562
|
withApiOptions(
|
|
2296
2563
|
withProjectOptions(
|
|
2297
|
-
|
|
2564
|
+
yargs21.option("withIntegrations", {
|
|
2298
2565
|
alias: ["i"],
|
|
2299
2566
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
2300
2567
|
type: "boolean"
|
|
@@ -2314,8 +2581,8 @@ var QuirkListModule = {
|
|
|
2314
2581
|
import { UncachedQuirkClient as UncachedQuirkClient3 } from "@uniformdev/context/api";
|
|
2315
2582
|
|
|
2316
2583
|
// src/commands/context/commands/quirk/_util.ts
|
|
2317
|
-
var
|
|
2318
|
-
var
|
|
2584
|
+
var selectIdentifier7 = (source) => source.id;
|
|
2585
|
+
var selectDisplayName7 = (source) => `${source.name} (pid: ${source.id})`;
|
|
2319
2586
|
|
|
2320
2587
|
// src/commands/context/quirkEngineDataSource.ts
|
|
2321
2588
|
function createQuirkEngineDataSource({
|
|
@@ -2325,8 +2592,8 @@ function createQuirkEngineDataSource({
|
|
|
2325
2592
|
const quirks = (await client.get({ withIntegrations: false })).quirks;
|
|
2326
2593
|
for await (const def of quirks) {
|
|
2327
2594
|
const result = {
|
|
2328
|
-
id:
|
|
2329
|
-
displayName:
|
|
2595
|
+
id: selectIdentifier7(def),
|
|
2596
|
+
displayName: selectDisplayName7(def),
|
|
2330
2597
|
providerId: def.id,
|
|
2331
2598
|
object: def
|
|
2332
2599
|
};
|
|
@@ -2350,10 +2617,10 @@ function createQuirkEngineDataSource({
|
|
|
2350
2617
|
var QuirkPullModule = {
|
|
2351
2618
|
command: "pull <directory>",
|
|
2352
2619
|
describe: "Pulls all quirks to local files in a directory",
|
|
2353
|
-
builder: (
|
|
2620
|
+
builder: (yargs21) => withApiOptions(
|
|
2354
2621
|
withProjectOptions(
|
|
2355
2622
|
withDiffOptions(
|
|
2356
|
-
|
|
2623
|
+
yargs21.positional("directory", {
|
|
2357
2624
|
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.",
|
|
2358
2625
|
type: "string"
|
|
2359
2626
|
}).option("format", {
|
|
@@ -2397,8 +2664,8 @@ var QuirkPullModule = {
|
|
|
2397
2664
|
const packageContents = readContextPackage(directory, false);
|
|
2398
2665
|
target = await createArraySyncEngineDataSource({
|
|
2399
2666
|
objects: packageContents.quirks ?? [],
|
|
2400
|
-
selectIdentifier:
|
|
2401
|
-
selectDisplayName:
|
|
2667
|
+
selectIdentifier: selectIdentifier7,
|
|
2668
|
+
selectDisplayName: selectDisplayName7,
|
|
2402
2669
|
onSyncComplete: async (_, synced) => {
|
|
2403
2670
|
packageContents.quirks = synced;
|
|
2404
2671
|
writeContextPackage(directory, packageContents);
|
|
@@ -2407,8 +2674,8 @@ var QuirkPullModule = {
|
|
|
2407
2674
|
} else {
|
|
2408
2675
|
target = await createFileSyncEngineDataSource({
|
|
2409
2676
|
directory,
|
|
2410
|
-
selectIdentifier:
|
|
2411
|
-
selectDisplayName:
|
|
2677
|
+
selectIdentifier: selectIdentifier7,
|
|
2678
|
+
selectDisplayName: selectDisplayName7,
|
|
2412
2679
|
format
|
|
2413
2680
|
});
|
|
2414
2681
|
}
|
|
@@ -2427,10 +2694,10 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
2427
2694
|
var QuirkPushModule = {
|
|
2428
2695
|
command: "push <directory>",
|
|
2429
2696
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
2430
|
-
builder: (
|
|
2697
|
+
builder: (yargs21) => withApiOptions(
|
|
2431
2698
|
withProjectOptions(
|
|
2432
2699
|
withDiffOptions(
|
|
2433
|
-
|
|
2700
|
+
yargs21.positional("directory", {
|
|
2434
2701
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
2435
2702
|
type: "string"
|
|
2436
2703
|
}).option("what-if", {
|
|
@@ -2466,14 +2733,14 @@ var QuirkPushModule = {
|
|
|
2466
2733
|
const packageContents = readContextPackage(directory, true);
|
|
2467
2734
|
source = await createArraySyncEngineDataSource({
|
|
2468
2735
|
objects: packageContents.quirks ?? [],
|
|
2469
|
-
selectIdentifier:
|
|
2470
|
-
selectDisplayName:
|
|
2736
|
+
selectIdentifier: selectIdentifier7,
|
|
2737
|
+
selectDisplayName: selectDisplayName7
|
|
2471
2738
|
});
|
|
2472
2739
|
} else {
|
|
2473
2740
|
source = await createFileSyncEngineDataSource({
|
|
2474
2741
|
directory,
|
|
2475
|
-
selectIdentifier:
|
|
2476
|
-
selectDisplayName:
|
|
2742
|
+
selectIdentifier: selectIdentifier7,
|
|
2743
|
+
selectDisplayName: selectDisplayName7
|
|
2477
2744
|
});
|
|
2478
2745
|
}
|
|
2479
2746
|
const target = createQuirkEngineDataSource({ client });
|
|
@@ -2493,9 +2760,9 @@ var QuirkRemoveModule = {
|
|
|
2493
2760
|
command: "remove <id>",
|
|
2494
2761
|
aliases: ["delete", "rm"],
|
|
2495
2762
|
describe: "Delete a quirk",
|
|
2496
|
-
builder: (
|
|
2763
|
+
builder: (yargs21) => withApiOptions(
|
|
2497
2764
|
withProjectOptions(
|
|
2498
|
-
|
|
2765
|
+
yargs21.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
2499
2766
|
)
|
|
2500
2767
|
),
|
|
2501
2768
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2511,8 +2778,8 @@ var QuirkUpdateModule = {
|
|
|
2511
2778
|
command: "update <filename>",
|
|
2512
2779
|
aliases: ["put"],
|
|
2513
2780
|
describe: "Insert or update a quirk",
|
|
2514
|
-
builder: (
|
|
2515
|
-
withProjectOptions(
|
|
2781
|
+
builder: (yargs21) => withApiOptions(
|
|
2782
|
+
withProjectOptions(yargs21.positional("filename", { demandOption: true, describe: "Quirk file to put" }))
|
|
2516
2783
|
),
|
|
2517
2784
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2518
2785
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -2527,24 +2794,24 @@ var QuirkModule = {
|
|
|
2527
2794
|
command: "quirk <command>",
|
|
2528
2795
|
aliases: ["qk"],
|
|
2529
2796
|
describe: "Commands for Context quirks",
|
|
2530
|
-
builder: (
|
|
2797
|
+
builder: (yargs21) => yargs21.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
2531
2798
|
handler: () => {
|
|
2532
|
-
|
|
2799
|
+
yargs9.help();
|
|
2533
2800
|
}
|
|
2534
2801
|
};
|
|
2535
2802
|
|
|
2536
2803
|
// src/commands/context/commands/signal.ts
|
|
2537
|
-
import
|
|
2804
|
+
import yargs10 from "yargs";
|
|
2538
2805
|
|
|
2539
2806
|
// src/commands/context/commands/signal/get.ts
|
|
2540
2807
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
2541
2808
|
var SignalGetModule = {
|
|
2542
2809
|
command: "get <id>",
|
|
2543
2810
|
describe: "Fetch a signal",
|
|
2544
|
-
builder: (
|
|
2811
|
+
builder: (yargs21) => withFormatOptions(
|
|
2545
2812
|
withApiOptions(
|
|
2546
2813
|
withProjectOptions(
|
|
2547
|
-
|
|
2814
|
+
yargs21.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
2548
2815
|
)
|
|
2549
2816
|
)
|
|
2550
2817
|
),
|
|
@@ -2567,7 +2834,7 @@ var SignalListModule = {
|
|
|
2567
2834
|
command: "list",
|
|
2568
2835
|
describe: "List signals",
|
|
2569
2836
|
aliases: ["ls"],
|
|
2570
|
-
builder: (
|
|
2837
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
2571
2838
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2572
2839
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2573
2840
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2580,8 +2847,8 @@ var SignalListModule = {
|
|
|
2580
2847
|
import { UncachedSignalClient as UncachedSignalClient3 } from "@uniformdev/context/api";
|
|
2581
2848
|
|
|
2582
2849
|
// src/commands/context/commands/signal/_util.ts
|
|
2583
|
-
var
|
|
2584
|
-
var
|
|
2850
|
+
var selectIdentifier8 = (source) => source.id;
|
|
2851
|
+
var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
|
|
2585
2852
|
|
|
2586
2853
|
// src/commands/context/signalEngineDataSource.ts
|
|
2587
2854
|
function createSignalEngineDataSource({
|
|
@@ -2591,8 +2858,8 @@ function createSignalEngineDataSource({
|
|
|
2591
2858
|
const signals = (await client.get()).signals;
|
|
2592
2859
|
for await (const def of signals) {
|
|
2593
2860
|
const result = {
|
|
2594
|
-
id:
|
|
2595
|
-
displayName:
|
|
2861
|
+
id: selectIdentifier8(def),
|
|
2862
|
+
displayName: selectDisplayName8(def),
|
|
2596
2863
|
providerId: def.id,
|
|
2597
2864
|
object: def
|
|
2598
2865
|
};
|
|
@@ -2616,10 +2883,10 @@ function createSignalEngineDataSource({
|
|
|
2616
2883
|
var SignalPullModule = {
|
|
2617
2884
|
command: "pull <directory>",
|
|
2618
2885
|
describe: "Pulls all signals to local files in a directory",
|
|
2619
|
-
builder: (
|
|
2886
|
+
builder: (yargs21) => withApiOptions(
|
|
2620
2887
|
withProjectOptions(
|
|
2621
2888
|
withDiffOptions(
|
|
2622
|
-
|
|
2889
|
+
yargs21.positional("directory", {
|
|
2623
2890
|
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.",
|
|
2624
2891
|
type: "string"
|
|
2625
2892
|
}).option("format", {
|
|
@@ -2663,8 +2930,8 @@ var SignalPullModule = {
|
|
|
2663
2930
|
const packageContents = readContextPackage(directory, false);
|
|
2664
2931
|
target = await createArraySyncEngineDataSource({
|
|
2665
2932
|
objects: packageContents.signals ?? [],
|
|
2666
|
-
selectIdentifier:
|
|
2667
|
-
selectDisplayName:
|
|
2933
|
+
selectIdentifier: selectIdentifier8,
|
|
2934
|
+
selectDisplayName: selectDisplayName8,
|
|
2668
2935
|
onSyncComplete: async (_, synced) => {
|
|
2669
2936
|
packageContents.signals = synced;
|
|
2670
2937
|
writeContextPackage(directory, packageContents);
|
|
@@ -2673,8 +2940,8 @@ var SignalPullModule = {
|
|
|
2673
2940
|
} else {
|
|
2674
2941
|
target = await createFileSyncEngineDataSource({
|
|
2675
2942
|
directory,
|
|
2676
|
-
selectIdentifier:
|
|
2677
|
-
selectDisplayName:
|
|
2943
|
+
selectIdentifier: selectIdentifier8,
|
|
2944
|
+
selectDisplayName: selectDisplayName8,
|
|
2678
2945
|
format
|
|
2679
2946
|
});
|
|
2680
2947
|
}
|
|
@@ -2693,10 +2960,10 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
2693
2960
|
var SignalPushModule = {
|
|
2694
2961
|
command: "push <directory>",
|
|
2695
2962
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
2696
|
-
builder: (
|
|
2963
|
+
builder: (yargs21) => withApiOptions(
|
|
2697
2964
|
withProjectOptions(
|
|
2698
2965
|
withDiffOptions(
|
|
2699
|
-
|
|
2966
|
+
yargs21.positional("directory", {
|
|
2700
2967
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
2701
2968
|
type: "string"
|
|
2702
2969
|
}).option("what-if", {
|
|
@@ -2732,14 +2999,14 @@ var SignalPushModule = {
|
|
|
2732
2999
|
const packageContents = readContextPackage(directory, true);
|
|
2733
3000
|
source = await createArraySyncEngineDataSource({
|
|
2734
3001
|
objects: packageContents.signals ?? [],
|
|
2735
|
-
selectIdentifier:
|
|
2736
|
-
selectDisplayName:
|
|
3002
|
+
selectIdentifier: selectIdentifier8,
|
|
3003
|
+
selectDisplayName: selectDisplayName8
|
|
2737
3004
|
});
|
|
2738
3005
|
} else {
|
|
2739
3006
|
source = await createFileSyncEngineDataSource({
|
|
2740
3007
|
directory,
|
|
2741
|
-
selectIdentifier:
|
|
2742
|
-
selectDisplayName:
|
|
3008
|
+
selectIdentifier: selectIdentifier8,
|
|
3009
|
+
selectDisplayName: selectDisplayName8
|
|
2743
3010
|
});
|
|
2744
3011
|
}
|
|
2745
3012
|
const target = createSignalEngineDataSource({ client });
|
|
@@ -2759,9 +3026,9 @@ var SignalRemoveModule = {
|
|
|
2759
3026
|
command: "remove <id>",
|
|
2760
3027
|
aliases: ["delete", "rm"],
|
|
2761
3028
|
describe: "Delete a signal",
|
|
2762
|
-
builder: (
|
|
3029
|
+
builder: (yargs21) => withApiOptions(
|
|
2763
3030
|
withProjectOptions(
|
|
2764
|
-
|
|
3031
|
+
yargs21.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
2765
3032
|
)
|
|
2766
3033
|
),
|
|
2767
3034
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2777,8 +3044,8 @@ var SignalUpdateModule = {
|
|
|
2777
3044
|
command: "update <filename>",
|
|
2778
3045
|
aliases: ["put"],
|
|
2779
3046
|
describe: "Insert or update a signal",
|
|
2780
|
-
builder: (
|
|
2781
|
-
withProjectOptions(
|
|
3047
|
+
builder: (yargs21) => withApiOptions(
|
|
3048
|
+
withProjectOptions(yargs21.positional("filename", { demandOption: true, describe: "Signal file to put" }))
|
|
2782
3049
|
),
|
|
2783
3050
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2784
3051
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -2793,24 +3060,24 @@ var SignalModule = {
|
|
|
2793
3060
|
command: "signal <command>",
|
|
2794
3061
|
aliases: ["sig"],
|
|
2795
3062
|
describe: "Commands for Context signals",
|
|
2796
|
-
builder: (
|
|
3063
|
+
builder: (yargs21) => yargs21.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
2797
3064
|
handler: () => {
|
|
2798
|
-
|
|
3065
|
+
yargs10.help();
|
|
2799
3066
|
}
|
|
2800
3067
|
};
|
|
2801
3068
|
|
|
2802
3069
|
// src/commands/context/commands/test.ts
|
|
2803
|
-
import
|
|
3070
|
+
import yargs11 from "yargs";
|
|
2804
3071
|
|
|
2805
3072
|
// src/commands/context/commands/test/get.ts
|
|
2806
3073
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
2807
3074
|
var TestGetModule = {
|
|
2808
3075
|
command: "get <id>",
|
|
2809
3076
|
describe: "Fetch a test",
|
|
2810
|
-
builder: (
|
|
3077
|
+
builder: (yargs21) => withFormatOptions(
|
|
2811
3078
|
withApiOptions(
|
|
2812
3079
|
withProjectOptions(
|
|
2813
|
-
|
|
3080
|
+
yargs21.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
2814
3081
|
)
|
|
2815
3082
|
)
|
|
2816
3083
|
),
|
|
@@ -2833,7 +3100,7 @@ var TestListModule = {
|
|
|
2833
3100
|
command: "list",
|
|
2834
3101
|
describe: "List tests",
|
|
2835
3102
|
aliases: ["ls"],
|
|
2836
|
-
builder: (
|
|
3103
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
2837
3104
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2838
3105
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2839
3106
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2846,8 +3113,8 @@ var TestListModule = {
|
|
|
2846
3113
|
import { UncachedTestClient as UncachedTestClient3 } from "@uniformdev/context/api";
|
|
2847
3114
|
|
|
2848
3115
|
// src/commands/context/commands/test/_util.ts
|
|
2849
|
-
var
|
|
2850
|
-
var
|
|
3116
|
+
var selectIdentifier9 = (source) => source.id;
|
|
3117
|
+
var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
|
|
2851
3118
|
|
|
2852
3119
|
// src/commands/context/testEngineDataSource.ts
|
|
2853
3120
|
function createTestEngineDataSource({
|
|
@@ -2857,8 +3124,8 @@ function createTestEngineDataSource({
|
|
|
2857
3124
|
const tests = (await client.get()).tests;
|
|
2858
3125
|
for await (const def of tests) {
|
|
2859
3126
|
const result = {
|
|
2860
|
-
id:
|
|
2861
|
-
displayName:
|
|
3127
|
+
id: selectIdentifier9(def),
|
|
3128
|
+
displayName: selectDisplayName9(def),
|
|
2862
3129
|
providerId: def.id,
|
|
2863
3130
|
object: def
|
|
2864
3131
|
};
|
|
@@ -2882,10 +3149,10 @@ function createTestEngineDataSource({
|
|
|
2882
3149
|
var TestPullModule = {
|
|
2883
3150
|
command: "pull <directory>",
|
|
2884
3151
|
describe: "Pulls all tests to local files in a directory",
|
|
2885
|
-
builder: (
|
|
3152
|
+
builder: (yargs21) => withApiOptions(
|
|
2886
3153
|
withProjectOptions(
|
|
2887
3154
|
withDiffOptions(
|
|
2888
|
-
|
|
3155
|
+
yargs21.positional("directory", {
|
|
2889
3156
|
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.",
|
|
2890
3157
|
type: "string"
|
|
2891
3158
|
}).option("format", {
|
|
@@ -2929,8 +3196,8 @@ var TestPullModule = {
|
|
|
2929
3196
|
const packageContents = readContextPackage(directory, false);
|
|
2930
3197
|
target = await createArraySyncEngineDataSource({
|
|
2931
3198
|
objects: packageContents.tests ?? [],
|
|
2932
|
-
selectIdentifier:
|
|
2933
|
-
selectDisplayName:
|
|
3199
|
+
selectIdentifier: selectIdentifier9,
|
|
3200
|
+
selectDisplayName: selectDisplayName9,
|
|
2934
3201
|
onSyncComplete: async (_, synced) => {
|
|
2935
3202
|
packageContents.tests = synced;
|
|
2936
3203
|
writeContextPackage(directory, packageContents);
|
|
@@ -2939,8 +3206,8 @@ var TestPullModule = {
|
|
|
2939
3206
|
} else {
|
|
2940
3207
|
target = await createFileSyncEngineDataSource({
|
|
2941
3208
|
directory,
|
|
2942
|
-
selectIdentifier:
|
|
2943
|
-
selectDisplayName:
|
|
3209
|
+
selectIdentifier: selectIdentifier9,
|
|
3210
|
+
selectDisplayName: selectDisplayName9,
|
|
2944
3211
|
format
|
|
2945
3212
|
});
|
|
2946
3213
|
}
|
|
@@ -2959,10 +3226,10 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
2959
3226
|
var TestPushModule = {
|
|
2960
3227
|
command: "push <directory>",
|
|
2961
3228
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
2962
|
-
builder: (
|
|
3229
|
+
builder: (yargs21) => withApiOptions(
|
|
2963
3230
|
withProjectOptions(
|
|
2964
3231
|
withDiffOptions(
|
|
2965
|
-
|
|
3232
|
+
yargs21.positional("directory", {
|
|
2966
3233
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
2967
3234
|
type: "string"
|
|
2968
3235
|
}).option("what-if", {
|
|
@@ -2998,14 +3265,14 @@ var TestPushModule = {
|
|
|
2998
3265
|
const packageContents = readContextPackage(directory, true);
|
|
2999
3266
|
source = await createArraySyncEngineDataSource({
|
|
3000
3267
|
objects: packageContents.tests ?? [],
|
|
3001
|
-
selectIdentifier:
|
|
3002
|
-
selectDisplayName:
|
|
3268
|
+
selectIdentifier: selectIdentifier9,
|
|
3269
|
+
selectDisplayName: selectDisplayName9
|
|
3003
3270
|
});
|
|
3004
3271
|
} else {
|
|
3005
3272
|
source = await createFileSyncEngineDataSource({
|
|
3006
3273
|
directory,
|
|
3007
|
-
selectIdentifier:
|
|
3008
|
-
selectDisplayName:
|
|
3274
|
+
selectIdentifier: selectIdentifier9,
|
|
3275
|
+
selectDisplayName: selectDisplayName9
|
|
3009
3276
|
});
|
|
3010
3277
|
}
|
|
3011
3278
|
const target = createTestEngineDataSource({ client });
|
|
@@ -3025,8 +3292,8 @@ var TestRemoveModule = {
|
|
|
3025
3292
|
command: "remove <id>",
|
|
3026
3293
|
aliases: ["delete", "rm"],
|
|
3027
3294
|
describe: "Delete a test",
|
|
3028
|
-
builder: (
|
|
3029
|
-
withProjectOptions(
|
|
3295
|
+
builder: (yargs21) => withApiOptions(
|
|
3296
|
+
withProjectOptions(yargs21.positional("id", { demandOption: true, describe: "Test public ID to delete" }))
|
|
3030
3297
|
),
|
|
3031
3298
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
3032
3299
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3041,8 +3308,8 @@ var TestUpdateModule = {
|
|
|
3041
3308
|
command: "update <filename>",
|
|
3042
3309
|
aliases: ["put"],
|
|
3043
3310
|
describe: "Insert or update a test",
|
|
3044
|
-
builder: (
|
|
3045
|
-
withProjectOptions(
|
|
3311
|
+
builder: (yargs21) => withApiOptions(
|
|
3312
|
+
withProjectOptions(yargs21.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
3046
3313
|
),
|
|
3047
3314
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
3048
3315
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3056,9 +3323,9 @@ var TestUpdateModule = {
|
|
|
3056
3323
|
var TestModule = {
|
|
3057
3324
|
command: "test <command>",
|
|
3058
3325
|
describe: "Commands for Context A/B tests",
|
|
3059
|
-
builder: (
|
|
3326
|
+
builder: (yargs21) => yargs21.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
3060
3327
|
handler: () => {
|
|
3061
|
-
|
|
3328
|
+
yargs11.help();
|
|
3062
3329
|
}
|
|
3063
3330
|
};
|
|
3064
3331
|
|
|
@@ -3067,9 +3334,9 @@ var ContextCommand = {
|
|
|
3067
3334
|
command: "context <command>",
|
|
3068
3335
|
aliases: ["ctx"],
|
|
3069
3336
|
describe: "Uniform Context commands",
|
|
3070
|
-
builder: (
|
|
3337
|
+
builder: (yargs21) => yargs21.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
3071
3338
|
handler: () => {
|
|
3072
|
-
|
|
3339
|
+
yargs12.showHelp();
|
|
3073
3340
|
}
|
|
3074
3341
|
};
|
|
3075
3342
|
|
|
@@ -3118,6 +3385,7 @@ var package_default = {
|
|
|
3118
3385
|
"@uniformdev/project-map": "workspace:*",
|
|
3119
3386
|
"@uniformdev/redirect": "workspace:*",
|
|
3120
3387
|
colorette: "2.0.20",
|
|
3388
|
+
cosmiconfig: "^8.2.0",
|
|
3121
3389
|
diff: "^5.0.0",
|
|
3122
3390
|
dotenv: "^16.0.3",
|
|
3123
3391
|
execa: "5.1.1",
|
|
@@ -3126,7 +3394,7 @@ var package_default = {
|
|
|
3126
3394
|
"graphql-request": "6.1.0",
|
|
3127
3395
|
"https-proxy-agent": "^7.0.0",
|
|
3128
3396
|
inquirer: "9.2.7",
|
|
3129
|
-
"isomorphic-git": "1.24.
|
|
3397
|
+
"isomorphic-git": "1.24.3",
|
|
3130
3398
|
"isomorphic-unfetch": "^3.1.0",
|
|
3131
3399
|
"js-yaml": "^4.1.0",
|
|
3132
3400
|
jsonwebtoken: "9.0.1",
|
|
@@ -4129,10 +4397,10 @@ var NewMeshCmd = {
|
|
|
4129
4397
|
};
|
|
4130
4398
|
|
|
4131
4399
|
// src/commands/optimize/index.ts
|
|
4132
|
-
import
|
|
4400
|
+
import yargs14 from "yargs";
|
|
4133
4401
|
|
|
4134
4402
|
// src/commands/optimize/manifest.ts
|
|
4135
|
-
import
|
|
4403
|
+
import yargs13 from "yargs";
|
|
4136
4404
|
|
|
4137
4405
|
// src/commands/optimize/manifest/download.ts
|
|
4138
4406
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -4147,7 +4415,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
4147
4415
|
var module = {
|
|
4148
4416
|
command: "download [output]",
|
|
4149
4417
|
describe: "Download intent manifest",
|
|
4150
|
-
builder: (
|
|
4418
|
+
builder: (yargs21) => yargs21.option("apiKey", {
|
|
4151
4419
|
alias: "k",
|
|
4152
4420
|
demandOption: true,
|
|
4153
4421
|
string: true,
|
|
@@ -4248,10 +4516,10 @@ var module2 = {
|
|
|
4248
4516
|
command: "manifest <command>",
|
|
4249
4517
|
describe: "Intent manifest commands",
|
|
4250
4518
|
builder: () => {
|
|
4251
|
-
return
|
|
4519
|
+
return yargs13.command(download_default);
|
|
4252
4520
|
},
|
|
4253
4521
|
handler: () => {
|
|
4254
|
-
|
|
4522
|
+
yargs13.showHelp();
|
|
4255
4523
|
}
|
|
4256
4524
|
};
|
|
4257
4525
|
var manifest_default = module2;
|
|
@@ -4262,28 +4530,28 @@ var OptimizeCommand = {
|
|
|
4262
4530
|
aliases: ["opt"],
|
|
4263
4531
|
describe: "Uniform Optimize commands",
|
|
4264
4532
|
builder: () => {
|
|
4265
|
-
return
|
|
4533
|
+
return yargs14.command(manifest_default);
|
|
4266
4534
|
},
|
|
4267
4535
|
handler: () => {
|
|
4268
|
-
|
|
4536
|
+
yargs14.showHelp();
|
|
4269
4537
|
}
|
|
4270
4538
|
};
|
|
4271
4539
|
|
|
4272
4540
|
// src/commands/project-map/index.ts
|
|
4273
|
-
import
|
|
4541
|
+
import yargs17 from "yargs";
|
|
4274
4542
|
|
|
4275
4543
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
4276
|
-
import
|
|
4544
|
+
import yargs15 from "yargs";
|
|
4277
4545
|
|
|
4278
4546
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
4279
4547
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
4280
4548
|
var ProjectMapDefinitionGetModule = {
|
|
4281
4549
|
command: "get <id>",
|
|
4282
4550
|
describe: "Fetch a project map",
|
|
4283
|
-
builder: (
|
|
4551
|
+
builder: (yargs21) => withFormatOptions(
|
|
4284
4552
|
withApiOptions(
|
|
4285
4553
|
withProjectOptions(
|
|
4286
|
-
|
|
4554
|
+
yargs21.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
4287
4555
|
)
|
|
4288
4556
|
)
|
|
4289
4557
|
),
|
|
@@ -4306,7 +4574,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
4306
4574
|
command: "list",
|
|
4307
4575
|
describe: "List of project maps",
|
|
4308
4576
|
aliases: ["ls"],
|
|
4309
|
-
builder: (
|
|
4577
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
4310
4578
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4311
4579
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4312
4580
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4327,8 +4595,8 @@ function writeContextPackage2(filename, packageContents) {
|
|
|
4327
4595
|
}
|
|
4328
4596
|
|
|
4329
4597
|
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
4330
|
-
var
|
|
4331
|
-
var
|
|
4598
|
+
var selectIdentifier10 = (source) => source.id;
|
|
4599
|
+
var selectDisplayName10 = (source) => `${source.name} (pid: ${source.id})`;
|
|
4332
4600
|
|
|
4333
4601
|
// src/commands/project-map/ProjectMapDefinitionEngineDataSource.ts
|
|
4334
4602
|
function createProjectMapDefinitionEngineDataSource({
|
|
@@ -4338,9 +4606,9 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
4338
4606
|
const projectMaps = (await client.getProjectMapDefinitions()).projectMaps;
|
|
4339
4607
|
for await (const def of projectMaps) {
|
|
4340
4608
|
const result = {
|
|
4341
|
-
id:
|
|
4342
|
-
displayName:
|
|
4343
|
-
providerId:
|
|
4609
|
+
id: selectIdentifier10(def),
|
|
4610
|
+
displayName: selectDisplayName10(def),
|
|
4611
|
+
providerId: selectIdentifier10(def),
|
|
4344
4612
|
object: def
|
|
4345
4613
|
};
|
|
4346
4614
|
yield result;
|
|
@@ -4363,10 +4631,10 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
4363
4631
|
var ProjectMapDefinitionPullModule = {
|
|
4364
4632
|
command: "pull <directory>",
|
|
4365
4633
|
describe: "Pulls all project maps to local files in a directory",
|
|
4366
|
-
builder: (
|
|
4634
|
+
builder: (yargs21) => withApiOptions(
|
|
4367
4635
|
withProjectOptions(
|
|
4368
4636
|
withDiffOptions(
|
|
4369
|
-
|
|
4637
|
+
yargs21.positional("directory", {
|
|
4370
4638
|
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.",
|
|
4371
4639
|
type: "string"
|
|
4372
4640
|
}).option("format", {
|
|
@@ -4410,8 +4678,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
4410
4678
|
const packageContents = readContextPackage2(directory, false);
|
|
4411
4679
|
target = await createArraySyncEngineDataSource({
|
|
4412
4680
|
objects: packageContents.projectMaps ?? [],
|
|
4413
|
-
selectIdentifier:
|
|
4414
|
-
selectDisplayName:
|
|
4681
|
+
selectIdentifier: selectIdentifier10,
|
|
4682
|
+
selectDisplayName: selectDisplayName10,
|
|
4415
4683
|
onSyncComplete: async (_, synced) => {
|
|
4416
4684
|
packageContents.projectMaps = synced;
|
|
4417
4685
|
writeContextPackage2(directory, packageContents);
|
|
@@ -4420,8 +4688,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
4420
4688
|
} else {
|
|
4421
4689
|
target = await createFileSyncEngineDataSource({
|
|
4422
4690
|
directory,
|
|
4423
|
-
selectIdentifier:
|
|
4424
|
-
selectDisplayName:
|
|
4691
|
+
selectIdentifier: selectIdentifier10,
|
|
4692
|
+
selectDisplayName: selectDisplayName10,
|
|
4425
4693
|
format
|
|
4426
4694
|
});
|
|
4427
4695
|
}
|
|
@@ -4440,10 +4708,10 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
4440
4708
|
var ProjectMapDefinitionPushModule = {
|
|
4441
4709
|
command: "push <directory>",
|
|
4442
4710
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
4443
|
-
builder: (
|
|
4711
|
+
builder: (yargs21) => withApiOptions(
|
|
4444
4712
|
withProjectOptions(
|
|
4445
4713
|
withDiffOptions(
|
|
4446
|
-
|
|
4714
|
+
yargs21.positional("directory", {
|
|
4447
4715
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
4448
4716
|
type: "string"
|
|
4449
4717
|
}).option("what-if", {
|
|
@@ -4479,14 +4747,14 @@ var ProjectMapDefinitionPushModule = {
|
|
|
4479
4747
|
const packageContents = readContextPackage2(directory, true);
|
|
4480
4748
|
source = await createArraySyncEngineDataSource({
|
|
4481
4749
|
objects: packageContents.projectMaps ?? [],
|
|
4482
|
-
selectIdentifier:
|
|
4483
|
-
selectDisplayName:
|
|
4750
|
+
selectIdentifier: selectIdentifier10,
|
|
4751
|
+
selectDisplayName: selectDisplayName10
|
|
4484
4752
|
});
|
|
4485
4753
|
} else {
|
|
4486
4754
|
source = await createFileSyncEngineDataSource({
|
|
4487
4755
|
directory,
|
|
4488
|
-
selectIdentifier:
|
|
4489
|
-
selectDisplayName:
|
|
4756
|
+
selectIdentifier: selectIdentifier10,
|
|
4757
|
+
selectDisplayName: selectDisplayName10
|
|
4490
4758
|
});
|
|
4491
4759
|
}
|
|
4492
4760
|
const target = createProjectMapDefinitionEngineDataSource({ client });
|
|
@@ -4506,8 +4774,8 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
4506
4774
|
command: "remove <id>",
|
|
4507
4775
|
aliases: ["delete", "rm"],
|
|
4508
4776
|
describe: "Delete a project map",
|
|
4509
|
-
builder: (
|
|
4510
|
-
withProjectOptions(
|
|
4777
|
+
builder: (yargs21) => withApiOptions(
|
|
4778
|
+
withProjectOptions(yargs21.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
4511
4779
|
),
|
|
4512
4780
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
4513
4781
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4522,9 +4790,9 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4522
4790
|
command: "update <filename>",
|
|
4523
4791
|
aliases: ["put"],
|
|
4524
4792
|
describe: "Insert or update a project map",
|
|
4525
|
-
builder: (
|
|
4793
|
+
builder: (yargs21) => withApiOptions(
|
|
4526
4794
|
withProjectOptions(
|
|
4527
|
-
|
|
4795
|
+
yargs21.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
4528
4796
|
)
|
|
4529
4797
|
),
|
|
4530
4798
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -4539,24 +4807,24 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4539
4807
|
var ProjectMapDefinitionModule = {
|
|
4540
4808
|
command: "definition <command>",
|
|
4541
4809
|
describe: "Commands for ProjectMap Definitions",
|
|
4542
|
-
builder: (
|
|
4810
|
+
builder: (yargs21) => yargs21.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
4543
4811
|
handler: () => {
|
|
4544
|
-
|
|
4812
|
+
yargs15.help();
|
|
4545
4813
|
}
|
|
4546
4814
|
};
|
|
4547
4815
|
|
|
4548
4816
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
4549
|
-
import
|
|
4817
|
+
import yargs16 from "yargs";
|
|
4550
4818
|
|
|
4551
4819
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
4552
4820
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
4553
4821
|
var ProjectMapNodeGetModule = {
|
|
4554
4822
|
command: "get <id> <projectMapId>",
|
|
4555
4823
|
describe: "Fetch a project map node",
|
|
4556
|
-
builder: (
|
|
4824
|
+
builder: (yargs21) => withFormatOptions(
|
|
4557
4825
|
withApiOptions(
|
|
4558
4826
|
withProjectOptions(
|
|
4559
|
-
|
|
4827
|
+
yargs21.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
4560
4828
|
)
|
|
4561
4829
|
)
|
|
4562
4830
|
),
|
|
@@ -4581,10 +4849,10 @@ var ProjectMapNodeListModule = {
|
|
|
4581
4849
|
command: "list <projectMapId>",
|
|
4582
4850
|
describe: "List project map nodes",
|
|
4583
4851
|
aliases: ["ls"],
|
|
4584
|
-
builder: (
|
|
4852
|
+
builder: (yargs21) => withFormatOptions(
|
|
4585
4853
|
withApiOptions(
|
|
4586
4854
|
withProjectOptions(
|
|
4587
|
-
|
|
4855
|
+
yargs21.positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
4588
4856
|
)
|
|
4589
4857
|
)
|
|
4590
4858
|
),
|
|
@@ -4600,12 +4868,12 @@ var ProjectMapNodeListModule = {
|
|
|
4600
4868
|
import { UncachedProjectMapClient as UncachedProjectMapClient9 } from "@uniformdev/project-map";
|
|
4601
4869
|
|
|
4602
4870
|
// src/commands/project-map/commands/ProjectMapNode/_util.ts
|
|
4603
|
-
var
|
|
4871
|
+
var selectIdentifier11 = (source, projectId) => [
|
|
4604
4872
|
projectId + source.projectMapId + source.id,
|
|
4605
4873
|
projectId + source.projectMapId + source.path
|
|
4606
4874
|
];
|
|
4607
4875
|
var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
|
|
4608
|
-
var
|
|
4876
|
+
var selectDisplayName11 = (source) => `${source.name} (pid: ${source.id})`;
|
|
4609
4877
|
|
|
4610
4878
|
// src/commands/project-map/ProjectMapNodeEngineDataSource.ts
|
|
4611
4879
|
function createProjectMapNodeEngineDataSource({
|
|
@@ -4619,9 +4887,9 @@ function createProjectMapNodeEngineDataSource({
|
|
|
4619
4887
|
for await (const def of nodes ?? []) {
|
|
4620
4888
|
if (def) {
|
|
4621
4889
|
const result = {
|
|
4622
|
-
id:
|
|
4623
|
-
displayName:
|
|
4624
|
-
providerId:
|
|
4890
|
+
id: selectIdentifier11({ ...def, projectMapId: projectMap.id }, projectId),
|
|
4891
|
+
displayName: selectDisplayName11(def),
|
|
4892
|
+
providerId: selectIdentifier11({ ...def, projectMapId: projectMap.id }, projectId)[0],
|
|
4625
4893
|
object: { ...def, projectMapId: projectMap.id }
|
|
4626
4894
|
};
|
|
4627
4895
|
yield result;
|
|
@@ -4651,10 +4919,10 @@ function createProjectMapNodeEngineDataSource({
|
|
|
4651
4919
|
var ProjectMapNodePullModule = {
|
|
4652
4920
|
command: "pull <directory>",
|
|
4653
4921
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
4654
|
-
builder: (
|
|
4922
|
+
builder: (yargs21) => withApiOptions(
|
|
4655
4923
|
withProjectOptions(
|
|
4656
4924
|
withDiffOptions(
|
|
4657
|
-
|
|
4925
|
+
yargs21.positional("directory", {
|
|
4658
4926
|
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.",
|
|
4659
4927
|
type: "string"
|
|
4660
4928
|
}).option("format", {
|
|
@@ -4695,14 +4963,14 @@ var ProjectMapNodePullModule = {
|
|
|
4695
4963
|
let target;
|
|
4696
4964
|
const isPackage = isPathAPackageFile(directory);
|
|
4697
4965
|
const expandedSelectIdentifier = (object) => {
|
|
4698
|
-
return
|
|
4966
|
+
return selectIdentifier11(object, projectId);
|
|
4699
4967
|
};
|
|
4700
4968
|
if (isPackage) {
|
|
4701
4969
|
const packageContents = readContextPackage2(directory, false);
|
|
4702
4970
|
target = await createArraySyncEngineDataSource({
|
|
4703
4971
|
objects: packageContents.projectMapNodes ?? [],
|
|
4704
4972
|
selectIdentifier: expandedSelectIdentifier,
|
|
4705
|
-
selectDisplayName:
|
|
4973
|
+
selectDisplayName: selectDisplayName11,
|
|
4706
4974
|
onSyncComplete: async (_, synced) => {
|
|
4707
4975
|
packageContents.projectMapNodes = synced;
|
|
4708
4976
|
writeContextPackage2(directory, packageContents);
|
|
@@ -4712,7 +4980,7 @@ var ProjectMapNodePullModule = {
|
|
|
4712
4980
|
target = await createFileSyncEngineDataSource({
|
|
4713
4981
|
directory,
|
|
4714
4982
|
selectIdentifier: expandedSelectIdentifier,
|
|
4715
|
-
selectDisplayName:
|
|
4983
|
+
selectDisplayName: selectDisplayName11,
|
|
4716
4984
|
format,
|
|
4717
4985
|
selectFilename
|
|
4718
4986
|
});
|
|
@@ -4732,10 +5000,10 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
4732
5000
|
var ProjectMapNodePushModule = {
|
|
4733
5001
|
command: "push <directory>",
|
|
4734
5002
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
4735
|
-
builder: (
|
|
5003
|
+
builder: (yargs21) => withApiOptions(
|
|
4736
5004
|
withProjectOptions(
|
|
4737
5005
|
withDiffOptions(
|
|
4738
|
-
|
|
5006
|
+
yargs21.positional("directory", {
|
|
4739
5007
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
4740
5008
|
type: "string"
|
|
4741
5009
|
}).option("what-if", {
|
|
@@ -4773,20 +5041,20 @@ var ProjectMapNodePushModule = {
|
|
|
4773
5041
|
let source;
|
|
4774
5042
|
const isPackage = isPathAPackageFile(directory);
|
|
4775
5043
|
const expandedSelectIdentifier = (object) => {
|
|
4776
|
-
return
|
|
5044
|
+
return selectIdentifier11(object, projectId);
|
|
4777
5045
|
};
|
|
4778
5046
|
if (isPackage) {
|
|
4779
5047
|
const packageContents = readContextPackage2(directory, true);
|
|
4780
5048
|
source = await createArraySyncEngineDataSource({
|
|
4781
5049
|
objects: packageContents.projectMapNodes ?? [],
|
|
4782
5050
|
selectIdentifier: expandedSelectIdentifier,
|
|
4783
|
-
selectDisplayName:
|
|
5051
|
+
selectDisplayName: selectDisplayName11
|
|
4784
5052
|
});
|
|
4785
5053
|
} else {
|
|
4786
5054
|
source = await createFileSyncEngineDataSource({
|
|
4787
5055
|
directory,
|
|
4788
5056
|
selectIdentifier: expandedSelectIdentifier,
|
|
4789
|
-
selectDisplayName:
|
|
5057
|
+
selectDisplayName: selectDisplayName11,
|
|
4790
5058
|
selectFilename
|
|
4791
5059
|
});
|
|
4792
5060
|
}
|
|
@@ -4807,9 +5075,9 @@ var ProjectMapNodeRemoveModule = {
|
|
|
4807
5075
|
command: "remove <id> <projectMapId>",
|
|
4808
5076
|
aliases: ["delete", "rm"],
|
|
4809
5077
|
describe: "Delete a project map node",
|
|
4810
|
-
builder: (
|
|
5078
|
+
builder: (yargs21) => withApiOptions(
|
|
4811
5079
|
withProjectOptions(
|
|
4812
|
-
|
|
5080
|
+
yargs21.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
4813
5081
|
)
|
|
4814
5082
|
),
|
|
4815
5083
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, id, project: projectId }) => {
|
|
@@ -4825,9 +5093,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
4825
5093
|
command: "update <filename> <projectMapId>",
|
|
4826
5094
|
aliases: ["put"],
|
|
4827
5095
|
describe: "Insert or update a project map node",
|
|
4828
|
-
builder: (
|
|
5096
|
+
builder: (yargs21) => withApiOptions(
|
|
4829
5097
|
withProjectOptions(
|
|
4830
|
-
|
|
5098
|
+
yargs21.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
4831
5099
|
)
|
|
4832
5100
|
),
|
|
4833
5101
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, filename, project: projectId }) => {
|
|
@@ -4842,9 +5110,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
4842
5110
|
var ProjectMapNodeModule = {
|
|
4843
5111
|
command: "node <command>",
|
|
4844
5112
|
describe: "Commands for ProjectMap Nodes",
|
|
4845
|
-
builder: (
|
|
5113
|
+
builder: (yargs21) => yargs21.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
4846
5114
|
handler: () => {
|
|
4847
|
-
|
|
5115
|
+
yargs16.help();
|
|
4848
5116
|
}
|
|
4849
5117
|
};
|
|
4850
5118
|
|
|
@@ -4853,26 +5121,26 @@ var ProjectMapCommand = {
|
|
|
4853
5121
|
command: "project-map <command>",
|
|
4854
5122
|
aliases: ["prm"],
|
|
4855
5123
|
describe: "Uniform ProjectMap commands",
|
|
4856
|
-
builder: (
|
|
5124
|
+
builder: (yargs21) => yargs21.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
4857
5125
|
handler: () => {
|
|
4858
|
-
|
|
5126
|
+
yargs17.showHelp();
|
|
4859
5127
|
}
|
|
4860
5128
|
};
|
|
4861
5129
|
|
|
4862
5130
|
// src/commands/redirect/index.ts
|
|
4863
|
-
import
|
|
5131
|
+
import yargs19 from "yargs";
|
|
4864
5132
|
|
|
4865
5133
|
// src/commands/redirect/commands/redirect.ts
|
|
4866
|
-
import
|
|
5134
|
+
import yargs18 from "yargs";
|
|
4867
5135
|
|
|
4868
5136
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
4869
5137
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
4870
5138
|
var RedirectDefinitionGetModule = {
|
|
4871
5139
|
command: "get <id>",
|
|
4872
5140
|
describe: "Fetch a redirect",
|
|
4873
|
-
builder: (
|
|
5141
|
+
builder: (yargs21) => withFormatOptions(
|
|
4874
5142
|
withApiOptions(
|
|
4875
|
-
withProjectOptions(
|
|
5143
|
+
withProjectOptions(yargs21.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" }))
|
|
4876
5144
|
)
|
|
4877
5145
|
),
|
|
4878
5146
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
@@ -4894,7 +5162,7 @@ var RedirectDefinitionListModule = {
|
|
|
4894
5162
|
command: "list",
|
|
4895
5163
|
describe: "List of redirects",
|
|
4896
5164
|
aliases: ["ls"],
|
|
4897
|
-
builder: (
|
|
5165
|
+
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
4898
5166
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4899
5167
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4900
5168
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4915,12 +5183,12 @@ function writeContextPackage3(filename, packageContents) {
|
|
|
4915
5183
|
}
|
|
4916
5184
|
|
|
4917
5185
|
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
4918
|
-
var
|
|
5186
|
+
var selectIdentifier12 = (source) => source.id;
|
|
4919
5187
|
var selectFilename2 = (source) => {
|
|
4920
5188
|
const index = source.sourceUrl.lastIndexOf("/");
|
|
4921
5189
|
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
4922
5190
|
};
|
|
4923
|
-
var
|
|
5191
|
+
var selectDisplayName12 = (source) => {
|
|
4924
5192
|
let pathName = source.sourceUrl;
|
|
4925
5193
|
if (pathName.length > 30) {
|
|
4926
5194
|
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
@@ -4937,9 +5205,9 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
4937
5205
|
const redirects = client.getAllRedirects();
|
|
4938
5206
|
for await (const redirect of redirects) {
|
|
4939
5207
|
const result = {
|
|
4940
|
-
id:
|
|
4941
|
-
displayName:
|
|
4942
|
-
providerId:
|
|
5208
|
+
id: selectIdentifier12(redirect.redirect),
|
|
5209
|
+
displayName: selectDisplayName12(redirect.redirect),
|
|
5210
|
+
providerId: selectIdentifier12(redirect.redirect),
|
|
4943
5211
|
object: redirect.redirect
|
|
4944
5212
|
};
|
|
4945
5213
|
yield result;
|
|
@@ -4960,10 +5228,10 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
4960
5228
|
var RedirectDefinitionPullModule = {
|
|
4961
5229
|
command: "pull <directory>",
|
|
4962
5230
|
describe: "Pulls all redirects to local files in a directory",
|
|
4963
|
-
builder: (
|
|
5231
|
+
builder: (yargs21) => withApiOptions(
|
|
4964
5232
|
withProjectOptions(
|
|
4965
5233
|
withDiffOptions(
|
|
4966
|
-
|
|
5234
|
+
yargs21.positional("directory", {
|
|
4967
5235
|
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.",
|
|
4968
5236
|
type: "string"
|
|
4969
5237
|
}).option("format", {
|
|
@@ -5007,8 +5275,8 @@ var RedirectDefinitionPullModule = {
|
|
|
5007
5275
|
const packageContents = readContextPackage3(directory, false);
|
|
5008
5276
|
target = await createArraySyncEngineDataSource({
|
|
5009
5277
|
objects: packageContents.redirects ?? [],
|
|
5010
|
-
selectIdentifier:
|
|
5011
|
-
selectDisplayName:
|
|
5278
|
+
selectIdentifier: selectIdentifier12,
|
|
5279
|
+
selectDisplayName: selectDisplayName12,
|
|
5012
5280
|
onSyncComplete: async (_, synced) => {
|
|
5013
5281
|
packageContents.redirects = synced;
|
|
5014
5282
|
writeContextPackage3(directory, packageContents);
|
|
@@ -5018,8 +5286,8 @@ var RedirectDefinitionPullModule = {
|
|
|
5018
5286
|
target = await createFileSyncEngineDataSource({
|
|
5019
5287
|
directory,
|
|
5020
5288
|
selectFilename: selectFilename2,
|
|
5021
|
-
selectIdentifier:
|
|
5022
|
-
selectDisplayName:
|
|
5289
|
+
selectIdentifier: selectIdentifier12,
|
|
5290
|
+
selectDisplayName: selectDisplayName12,
|
|
5023
5291
|
format
|
|
5024
5292
|
});
|
|
5025
5293
|
}
|
|
@@ -5038,10 +5306,10 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
5038
5306
|
var RedirectDefinitionPushModule = {
|
|
5039
5307
|
command: "push <directory>",
|
|
5040
5308
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
5041
|
-
builder: (
|
|
5309
|
+
builder: (yargs21) => withApiOptions(
|
|
5042
5310
|
withProjectOptions(
|
|
5043
5311
|
withDiffOptions(
|
|
5044
|
-
|
|
5312
|
+
yargs21.positional("directory", {
|
|
5045
5313
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
5046
5314
|
type: "string"
|
|
5047
5315
|
}).option("what-if", {
|
|
@@ -5077,14 +5345,14 @@ var RedirectDefinitionPushModule = {
|
|
|
5077
5345
|
const packageContents = readContextPackage3(directory, true);
|
|
5078
5346
|
source = await createArraySyncEngineDataSource({
|
|
5079
5347
|
objects: packageContents.redirects ?? [],
|
|
5080
|
-
selectIdentifier:
|
|
5081
|
-
selectDisplayName:
|
|
5348
|
+
selectIdentifier: selectIdentifier12,
|
|
5349
|
+
selectDisplayName: selectDisplayName12
|
|
5082
5350
|
});
|
|
5083
5351
|
} else {
|
|
5084
5352
|
source = await createFileSyncEngineDataSource({
|
|
5085
5353
|
directory,
|
|
5086
|
-
selectIdentifier:
|
|
5087
|
-
selectDisplayName:
|
|
5354
|
+
selectIdentifier: selectIdentifier12,
|
|
5355
|
+
selectDisplayName: selectDisplayName12
|
|
5088
5356
|
});
|
|
5089
5357
|
}
|
|
5090
5358
|
const target = createRedirectDefinitionEngineDataSource({ client });
|
|
@@ -5104,8 +5372,8 @@ var RedirectDefinitionRemoveModule = {
|
|
|
5104
5372
|
command: "remove <id>",
|
|
5105
5373
|
aliases: ["delete", "rm"],
|
|
5106
5374
|
describe: "Delete a redirect",
|
|
5107
|
-
builder: (
|
|
5108
|
-
withProjectOptions(
|
|
5375
|
+
builder: (yargs21) => withApiOptions(
|
|
5376
|
+
withProjectOptions(yargs21.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
5109
5377
|
),
|
|
5110
5378
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
5111
5379
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -5120,9 +5388,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5120
5388
|
command: "update <filename>",
|
|
5121
5389
|
aliases: ["put"],
|
|
5122
5390
|
describe: "Insert or update a redirect",
|
|
5123
|
-
builder: (
|
|
5391
|
+
builder: (yargs21) => withApiOptions(
|
|
5124
5392
|
withProjectOptions(
|
|
5125
|
-
|
|
5393
|
+
yargs21.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
5126
5394
|
)
|
|
5127
5395
|
),
|
|
5128
5396
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5137,9 +5405,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5137
5405
|
var RedirectDefinitionModule = {
|
|
5138
5406
|
command: "definition <command>",
|
|
5139
5407
|
describe: "Commands for Redirect Definitions",
|
|
5140
|
-
builder: (
|
|
5408
|
+
builder: (yargs21) => yargs21.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
5141
5409
|
handler: () => {
|
|
5142
|
-
|
|
5410
|
+
yargs18.help();
|
|
5143
5411
|
}
|
|
5144
5412
|
};
|
|
5145
5413
|
|
|
@@ -5148,9 +5416,9 @@ var RedirectCommand = {
|
|
|
5148
5416
|
command: "redirect <command>",
|
|
5149
5417
|
aliases: ["red"],
|
|
5150
5418
|
describe: "Uniform Redirect commands",
|
|
5151
|
-
builder: (
|
|
5419
|
+
builder: (yargs21) => yargs21.command(RedirectDefinitionModule).demandCommand(),
|
|
5152
5420
|
handler: () => {
|
|
5153
|
-
|
|
5421
|
+
yargs19.showHelp();
|
|
5154
5422
|
}
|
|
5155
5423
|
};
|
|
5156
5424
|
|
|
@@ -5266,7 +5534,7 @@ First found was: v${firstVersion}`;
|
|
|
5266
5534
|
|
|
5267
5535
|
// src/index.ts
|
|
5268
5536
|
dotenv.config();
|
|
5269
|
-
var yarggery =
|
|
5537
|
+
var yarggery = yargs20(hideBin(process.argv));
|
|
5270
5538
|
yarggery.option("verbose", {
|
|
5271
5539
|
describe: "Include verbose logging",
|
|
5272
5540
|
default: false,
|