@uniformdev/cli 19.41.0 → 19.42.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +34 -0
- package/dist/index.mjs +1645 -863
- package/package.json +13 -8
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import * as dotenv from "dotenv";
|
|
5
|
-
import
|
|
5
|
+
import yargs22 from "yargs";
|
|
6
6
|
import { hideBin } from "yargs/helpers";
|
|
7
7
|
|
|
8
8
|
// src/commands/canvas/index.ts
|
|
9
|
-
import
|
|
9
|
+
import yargs6 from "yargs";
|
|
10
10
|
|
|
11
11
|
// src/commands/canvas/commands/category.ts
|
|
12
12
|
import yargs from "yargs";
|
|
@@ -75,6 +75,9 @@ import { readdir, unlink } from "fs/promises";
|
|
|
75
75
|
import { extname as extname2, join } from "path";
|
|
76
76
|
|
|
77
77
|
// src/util.ts
|
|
78
|
+
import { cosmiconfigSync } from "cosmiconfig";
|
|
79
|
+
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
80
|
+
import fs from "fs";
|
|
78
81
|
var omit = (object, keys) => {
|
|
79
82
|
const result = keys.reduce((current, key) => {
|
|
80
83
|
const { [key]: _, ...rest } = current;
|
|
@@ -85,6 +88,30 @@ var omit = (object, keys) => {
|
|
|
85
88
|
var cleanFileName = (proposedFileName) => {
|
|
86
89
|
return proposedFileName.replace(/[/<>$+%>!`&*'|{}?"=:\\@]/g, "-");
|
|
87
90
|
};
|
|
91
|
+
var loadConfig = (configPath) => {
|
|
92
|
+
const moduleName = "uniform";
|
|
93
|
+
const syncCosmicExplorer = cosmiconfigSync("uniform", {
|
|
94
|
+
searchPlaces: [`${moduleName}.config.js`, `${moduleName}.config.ts`, `${moduleName}.config.json`],
|
|
95
|
+
loaders: {
|
|
96
|
+
".ts": TypeScriptLoader()
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
if (configPath) {
|
|
100
|
+
if (!fs.existsSync(configPath)) {
|
|
101
|
+
throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
|
|
102
|
+
}
|
|
103
|
+
const configFile = syncCosmicExplorer.load(configPath);
|
|
104
|
+
if (!(configFile == null ? void 0 : configFile.config.serialization)) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return applyDefaultSyncConfiguration((configFile == null ? void 0 : configFile.config) ?? {});
|
|
110
|
+
} else {
|
|
111
|
+
const searchedForm = syncCosmicExplorer.search();
|
|
112
|
+
return applyDefaultSyncConfiguration((searchedForm == null ? void 0 : searchedForm.config) ?? {});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
88
115
|
|
|
89
116
|
// src/sync/util.ts
|
|
90
117
|
import { readFileSync, writeFileSync } from "fs";
|
|
@@ -92,8 +119,14 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
92
119
|
import unfetch from "isomorphic-unfetch";
|
|
93
120
|
import { dump, load } from "js-yaml";
|
|
94
121
|
import { extname } from "path";
|
|
95
|
-
function
|
|
96
|
-
return
|
|
122
|
+
function withConfiguration(yargs23) {
|
|
123
|
+
return yargs23.option("serialization", {
|
|
124
|
+
skipValidation: true,
|
|
125
|
+
hidden: true
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function withApiOptions(yargs23) {
|
|
129
|
+
return yargs23.option("apiKey", {
|
|
97
130
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
98
131
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
99
132
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -132,8 +165,8 @@ function nodeFetchProxy(proxy) {
|
|
|
132
165
|
};
|
|
133
166
|
return wrappedFetch;
|
|
134
167
|
}
|
|
135
|
-
function withProjectOptions(
|
|
136
|
-
return
|
|
168
|
+
function withProjectOptions(yargs23) {
|
|
169
|
+
return yargs23.option("project", {
|
|
137
170
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
138
171
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
139
172
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -143,8 +176,8 @@ function withProjectOptions(yargs21) {
|
|
|
143
176
|
alias: ["p"]
|
|
144
177
|
});
|
|
145
178
|
}
|
|
146
|
-
function withFormatOptions(
|
|
147
|
-
return
|
|
179
|
+
function withFormatOptions(yargs23) {
|
|
180
|
+
return yargs23.option("format", {
|
|
148
181
|
alias: ["f"],
|
|
149
182
|
describe: "Output format",
|
|
150
183
|
default: "yaml",
|
|
@@ -156,8 +189,8 @@ function withFormatOptions(yargs21) {
|
|
|
156
189
|
type: "string"
|
|
157
190
|
});
|
|
158
191
|
}
|
|
159
|
-
function withDiffOptions(
|
|
160
|
-
return
|
|
192
|
+
function withDiffOptions(yargs23) {
|
|
193
|
+
return yargs23.option("diff", {
|
|
161
194
|
describe: "Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",
|
|
162
195
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
163
196
|
type: "string",
|
|
@@ -217,6 +250,72 @@ async function* paginateAsync(fetchPage, options) {
|
|
|
217
250
|
offset += perPage;
|
|
218
251
|
} while (pageData.length === perPage);
|
|
219
252
|
}
|
|
253
|
+
var defaultSyncConfiguration = {
|
|
254
|
+
entitiesConfig: {},
|
|
255
|
+
directory: "uniform-data",
|
|
256
|
+
format: "yaml",
|
|
257
|
+
mode: "mirror"
|
|
258
|
+
};
|
|
259
|
+
var applyDefaultSyncConfiguration = (config2) => {
|
|
260
|
+
var _a;
|
|
261
|
+
const mergedConfig = {
|
|
262
|
+
serialization: {
|
|
263
|
+
...defaultSyncConfiguration,
|
|
264
|
+
...(config2 == null ? void 0 : config2.serialization) ?? {},
|
|
265
|
+
entitiesConfig: {
|
|
266
|
+
...defaultSyncConfiguration.entitiesConfig,
|
|
267
|
+
...((_a = config2 == null ? void 0 : config2.serialization) == null ? void 0 : _a.entitiesConfig) ?? {}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
for (const entityType in mergedConfig.serialization.entitiesConfig) {
|
|
272
|
+
const entityTypeCasted = entityType;
|
|
273
|
+
const entityConfig = mergedConfig.serialization.entitiesConfig[entityTypeCasted];
|
|
274
|
+
if (Object.keys(entityConfig).length === 0) {
|
|
275
|
+
const separator = mergedConfig.serialization.directory[mergedConfig.serialization.directory.length - 1] === "/" ? "" : "/";
|
|
276
|
+
mergedConfig.serialization.entitiesConfig[entityTypeCasted].directory = isPathAPackageFile(
|
|
277
|
+
mergedConfig.serialization.directory
|
|
278
|
+
) ? mergedConfig.serialization.directory : `${mergedConfig.serialization.directory}${separator}${entityTypeCasted}`;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return mergedConfig;
|
|
282
|
+
};
|
|
283
|
+
var getEntityOption = ({
|
|
284
|
+
optionName,
|
|
285
|
+
config: config2,
|
|
286
|
+
entityType,
|
|
287
|
+
operation
|
|
288
|
+
}) => {
|
|
289
|
+
var _a, _b, _c, _d, _e, _f;
|
|
290
|
+
if ((_b = (_a = config2.entitiesConfig[entityType]) == null ? void 0 : _a[operation]) == null ? void 0 : _b[optionName]) {
|
|
291
|
+
return (_d = (_c = config2.entitiesConfig[entityType]) == null ? void 0 : _c[operation]) == null ? void 0 : _d[optionName];
|
|
292
|
+
}
|
|
293
|
+
if ((_e = config2.entitiesConfig[entityType]) == null ? void 0 : _e[optionName]) {
|
|
294
|
+
return (_f = config2.entitiesConfig[entityType]) == null ? void 0 : _f[optionName];
|
|
295
|
+
}
|
|
296
|
+
if (config2[optionName]) {
|
|
297
|
+
return config2[optionName];
|
|
298
|
+
}
|
|
299
|
+
throw `No ${optionName} option specified for ${entityType} ${operation}`;
|
|
300
|
+
};
|
|
301
|
+
var getDirectoryOrFilename = ({
|
|
302
|
+
config: config2,
|
|
303
|
+
entityType,
|
|
304
|
+
operation
|
|
305
|
+
}) => {
|
|
306
|
+
var _a, _b, _c, _d, _e, _f;
|
|
307
|
+
if ((_b = (_a = config2.entitiesConfig[entityType]) == null ? void 0 : _a[operation]) == null ? void 0 : _b.directory) {
|
|
308
|
+
return (_d = (_c = config2.entitiesConfig[entityType]) == null ? void 0 : _c[operation]) == null ? void 0 : _d.directory;
|
|
309
|
+
}
|
|
310
|
+
if ((_e = config2.entitiesConfig[entityType]) == null ? void 0 : _e.directory) {
|
|
311
|
+
return (_f = config2.entitiesConfig[entityType]) == null ? void 0 : _f.directory;
|
|
312
|
+
}
|
|
313
|
+
const isPackage = isPathAPackageFile(config2.directory);
|
|
314
|
+
if (isPackage) {
|
|
315
|
+
return config2.directory;
|
|
316
|
+
}
|
|
317
|
+
return `${config2.directory}/${entityType}`;
|
|
318
|
+
};
|
|
220
319
|
|
|
221
320
|
// src/sync/fileSyncEngineDataSource.ts
|
|
222
321
|
async function createFileSyncEngineDataSource({
|
|
@@ -279,9 +378,9 @@ ${e == null ? void 0 : e.message}`));
|
|
|
279
378
|
}
|
|
280
379
|
|
|
281
380
|
// src/sync/package.ts
|
|
282
|
-
import
|
|
381
|
+
import fs2 from "fs";
|
|
283
382
|
function readUniformPackage(filename, assertExists) {
|
|
284
|
-
if (!assertExists && !
|
|
383
|
+
if (!assertExists && !fs2.existsSync(filename)) {
|
|
285
384
|
return {};
|
|
286
385
|
}
|
|
287
386
|
const packageContents = readFileToObject(filename);
|
|
@@ -312,7 +411,8 @@ async function syncEngine({
|
|
|
312
411
|
whatIf = false,
|
|
313
412
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
314
413
|
log = () => {
|
|
315
|
-
}
|
|
414
|
+
},
|
|
415
|
+
onBeforeWriteObject
|
|
316
416
|
}) {
|
|
317
417
|
var _a, _b;
|
|
318
418
|
const targetItems = /* @__PURE__ */ new Map();
|
|
@@ -357,7 +457,8 @@ async function syncEngine({
|
|
|
357
457
|
const process2 = async (sourceObject2, targetObject2) => {
|
|
358
458
|
if (!whatIf) {
|
|
359
459
|
try {
|
|
360
|
-
await
|
|
460
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
461
|
+
await target.writeObject(finalSourceObject, targetObject2);
|
|
361
462
|
} catch (e) {
|
|
362
463
|
throw new SyncEngineError(e, sourceObject2);
|
|
363
464
|
}
|
|
@@ -379,7 +480,8 @@ async function syncEngine({
|
|
|
379
480
|
const process2 = async (sourceObject2, id) => {
|
|
380
481
|
if (!whatIf) {
|
|
381
482
|
try {
|
|
382
|
-
await
|
|
483
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
|
|
484
|
+
await target.writeObject(finalSourceObject);
|
|
383
485
|
} catch (e) {
|
|
384
486
|
throw new SyncEngineError(e, sourceObject2);
|
|
385
487
|
}
|
|
@@ -475,9 +577,13 @@ function createSyncEngineConsoleLogger(options) {
|
|
|
475
577
|
var CategoryGetModule = {
|
|
476
578
|
command: "get <id>",
|
|
477
579
|
describe: "Fetch a category",
|
|
478
|
-
builder: (
|
|
479
|
-
|
|
480
|
-
|
|
580
|
+
builder: (yargs23) => withConfiguration(
|
|
581
|
+
withFormatOptions(
|
|
582
|
+
withApiOptions(
|
|
583
|
+
withProjectOptions(
|
|
584
|
+
yargs23.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
585
|
+
)
|
|
586
|
+
)
|
|
481
587
|
)
|
|
482
588
|
),
|
|
483
589
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
@@ -500,7 +606,7 @@ var CategoryListModule = {
|
|
|
500
606
|
command: "list",
|
|
501
607
|
describe: "List categories",
|
|
502
608
|
aliases: ["ls"],
|
|
503
|
-
builder: (
|
|
609
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23.options({}))))),
|
|
504
610
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
505
611
|
const fetch3 = nodeFetchProxy(proxy);
|
|
506
612
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -557,30 +663,32 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
557
663
|
var CategoryPullModule = {
|
|
558
664
|
command: "pull <directory>",
|
|
559
665
|
describe: "Pulls all categories to local files in a directory",
|
|
560
|
-
builder: (
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
666
|
+
builder: (yargs23) => withConfiguration(
|
|
667
|
+
withApiOptions(
|
|
668
|
+
withProjectOptions(
|
|
669
|
+
withDiffOptions(
|
|
670
|
+
yargs23.positional("directory", {
|
|
671
|
+
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.",
|
|
672
|
+
type: "string"
|
|
673
|
+
}).option("format", {
|
|
674
|
+
alias: ["f"],
|
|
675
|
+
describe: "Output format",
|
|
676
|
+
default: "yaml",
|
|
677
|
+
choices: ["yaml", "json"],
|
|
678
|
+
type: "string"
|
|
679
|
+
}).option("what-if", {
|
|
680
|
+
alias: ["w"],
|
|
681
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
682
|
+
default: false,
|
|
683
|
+
type: "boolean"
|
|
684
|
+
}).option("mode", {
|
|
685
|
+
alias: ["m"],
|
|
686
|
+
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',
|
|
687
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
688
|
+
default: "mirror",
|
|
689
|
+
type: "string"
|
|
690
|
+
})
|
|
691
|
+
)
|
|
584
692
|
)
|
|
585
693
|
)
|
|
586
694
|
),
|
|
@@ -634,24 +742,26 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
634
742
|
var CategoryPushModule = {
|
|
635
743
|
command: "push <directory>",
|
|
636
744
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
637
|
-
builder: (
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
745
|
+
builder: (yargs23) => withConfiguration(
|
|
746
|
+
withApiOptions(
|
|
747
|
+
withProjectOptions(
|
|
748
|
+
withDiffOptions(
|
|
749
|
+
yargs23.positional("directory", {
|
|
750
|
+
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
751
|
+
type: "string"
|
|
752
|
+
}).option("what-if", {
|
|
753
|
+
alias: ["w"],
|
|
754
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
755
|
+
default: false,
|
|
756
|
+
type: "boolean"
|
|
757
|
+
}).option("mode", {
|
|
758
|
+
alias: ["m"],
|
|
759
|
+
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',
|
|
760
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
761
|
+
default: "mirror",
|
|
762
|
+
type: "string"
|
|
763
|
+
})
|
|
764
|
+
)
|
|
655
765
|
)
|
|
656
766
|
)
|
|
657
767
|
),
|
|
@@ -700,8 +810,12 @@ var CategoryRemoveModule = {
|
|
|
700
810
|
command: "remove <id>",
|
|
701
811
|
aliases: ["delete", "rm"],
|
|
702
812
|
describe: "Delete a category",
|
|
703
|
-
builder: (
|
|
704
|
-
|
|
813
|
+
builder: (yargs23) => withConfiguration(
|
|
814
|
+
withApiOptions(
|
|
815
|
+
withProjectOptions(
|
|
816
|
+
yargs23.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
817
|
+
)
|
|
818
|
+
)
|
|
705
819
|
),
|
|
706
820
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
707
821
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -716,9 +830,11 @@ var CategoryUpdateModule = {
|
|
|
716
830
|
command: "update <filename>",
|
|
717
831
|
aliases: ["put"],
|
|
718
832
|
describe: "Insert or update a category",
|
|
719
|
-
builder: (
|
|
720
|
-
|
|
721
|
-
|
|
833
|
+
builder: (yargs23) => withConfiguration(
|
|
834
|
+
withApiOptions(
|
|
835
|
+
withProjectOptions(
|
|
836
|
+
yargs23.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
837
|
+
)
|
|
722
838
|
)
|
|
723
839
|
),
|
|
724
840
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -734,7 +850,7 @@ var CategoryModule = {
|
|
|
734
850
|
command: "category <command>",
|
|
735
851
|
aliases: ["cat"],
|
|
736
852
|
describe: "Commands for Canvas categories",
|
|
737
|
-
builder: (
|
|
853
|
+
builder: (yargs23) => yargs23.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
738
854
|
handler: () => {
|
|
739
855
|
yargs.help();
|
|
740
856
|
}
|
|
@@ -755,10 +871,15 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
755
871
|
var ComponentGetModule = {
|
|
756
872
|
command: "get <id>",
|
|
757
873
|
describe: "Fetch a component definition",
|
|
758
|
-
builder: (
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
874
|
+
builder: (yargs23) => withConfiguration(
|
|
875
|
+
withFormatOptions(
|
|
876
|
+
withApiOptions(
|
|
877
|
+
withProjectOptions(
|
|
878
|
+
yargs23.positional("id", {
|
|
879
|
+
demandOption: true,
|
|
880
|
+
describe: "Component definition public ID to fetch"
|
|
881
|
+
})
|
|
882
|
+
)
|
|
762
883
|
)
|
|
763
884
|
)
|
|
764
885
|
),
|
|
@@ -788,13 +909,15 @@ var ComponentListModule = {
|
|
|
788
909
|
command: "list",
|
|
789
910
|
describe: "List component definitions",
|
|
790
911
|
aliases: ["ls"],
|
|
791
|
-
builder: (
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
912
|
+
builder: (yargs23) => withConfiguration(
|
|
913
|
+
withFormatOptions(
|
|
914
|
+
withApiOptions(
|
|
915
|
+
withProjectOptions(
|
|
916
|
+
yargs23.options({
|
|
917
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
918
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
919
|
+
})
|
|
920
|
+
)
|
|
798
921
|
)
|
|
799
922
|
)
|
|
800
923
|
),
|
|
@@ -845,30 +968,32 @@ function createComponentDefinitionEngineDataSource({
|
|
|
845
968
|
var ComponentPullModule = {
|
|
846
969
|
command: "pull <directory>",
|
|
847
970
|
describe: "Pulls all component definitions to local files in a directory",
|
|
848
|
-
builder: (
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
971
|
+
builder: (yargs23) => withConfiguration(
|
|
972
|
+
withApiOptions(
|
|
973
|
+
withProjectOptions(
|
|
974
|
+
withDiffOptions(
|
|
975
|
+
yargs23.positional("directory", {
|
|
976
|
+
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.",
|
|
977
|
+
type: "string"
|
|
978
|
+
}).option("format", {
|
|
979
|
+
alias: ["f"],
|
|
980
|
+
describe: "Output format",
|
|
981
|
+
default: "yaml",
|
|
982
|
+
choices: ["yaml", "json"],
|
|
983
|
+
type: "string"
|
|
984
|
+
}).option("what-if", {
|
|
985
|
+
alias: ["w"],
|
|
986
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
987
|
+
default: false,
|
|
988
|
+
type: "boolean"
|
|
989
|
+
}).option("mode", {
|
|
990
|
+
alias: ["m"],
|
|
991
|
+
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',
|
|
992
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
993
|
+
default: "mirror",
|
|
994
|
+
type: "string"
|
|
995
|
+
})
|
|
996
|
+
)
|
|
872
997
|
)
|
|
873
998
|
)
|
|
874
999
|
),
|
|
@@ -923,24 +1048,26 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
923
1048
|
var ComponentPushModule = {
|
|
924
1049
|
command: "push <directory>",
|
|
925
1050
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
926
|
-
builder: (
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1051
|
+
builder: (yargs23) => withConfiguration(
|
|
1052
|
+
withApiOptions(
|
|
1053
|
+
withProjectOptions(
|
|
1054
|
+
withDiffOptions(
|
|
1055
|
+
yargs23.positional("directory", {
|
|
1056
|
+
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1057
|
+
type: "string"
|
|
1058
|
+
}).option("what-if", {
|
|
1059
|
+
alias: ["w"],
|
|
1060
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1061
|
+
default: false,
|
|
1062
|
+
type: "boolean"
|
|
1063
|
+
}).option("mode", {
|
|
1064
|
+
alias: ["m"],
|
|
1065
|
+
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',
|
|
1066
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1067
|
+
default: "mirror",
|
|
1068
|
+
type: "string"
|
|
1069
|
+
})
|
|
1070
|
+
)
|
|
944
1071
|
)
|
|
945
1072
|
)
|
|
946
1073
|
),
|
|
@@ -990,9 +1117,11 @@ var ComponentRemoveModule = {
|
|
|
990
1117
|
command: "remove <id>",
|
|
991
1118
|
aliases: ["delete", "rm"],
|
|
992
1119
|
describe: "Delete a component definition",
|
|
993
|
-
builder: (
|
|
994
|
-
|
|
995
|
-
|
|
1120
|
+
builder: (yargs23) => withConfiguration(
|
|
1121
|
+
withApiOptions(
|
|
1122
|
+
withProjectOptions(
|
|
1123
|
+
yargs23.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1124
|
+
)
|
|
996
1125
|
)
|
|
997
1126
|
),
|
|
998
1127
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1008,9 +1137,11 @@ var ComponentUpdateModule = {
|
|
|
1008
1137
|
command: "update <filename>",
|
|
1009
1138
|
aliases: ["put"],
|
|
1010
1139
|
describe: "Insert or update a component definition",
|
|
1011
|
-
builder: (
|
|
1012
|
-
|
|
1013
|
-
|
|
1140
|
+
builder: (yargs23) => withConfiguration(
|
|
1141
|
+
withApiOptions(
|
|
1142
|
+
withProjectOptions(
|
|
1143
|
+
yargs23.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1144
|
+
)
|
|
1014
1145
|
)
|
|
1015
1146
|
),
|
|
1016
1147
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -1026,7 +1157,7 @@ var ComponentModule = {
|
|
|
1026
1157
|
command: "component <command>",
|
|
1027
1158
|
aliases: ["def"],
|
|
1028
1159
|
describe: "Commands for Canvas component definitions",
|
|
1029
|
-
builder: (
|
|
1160
|
+
builder: (yargs23) => yargs23.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1030
1161
|
handler: () => {
|
|
1031
1162
|
yargs2.help();
|
|
1032
1163
|
}
|
|
@@ -1048,8 +1179,8 @@ function prepCompositionForDisk(composition) {
|
|
|
1048
1179
|
delete prepped.state;
|
|
1049
1180
|
return prepped;
|
|
1050
1181
|
}
|
|
1051
|
-
function withStateOptions(
|
|
1052
|
-
return
|
|
1182
|
+
function withStateOptions(yargs23) {
|
|
1183
|
+
return yargs23.option("state", {
|
|
1053
1184
|
type: "string",
|
|
1054
1185
|
describe: `Composition state to fetch.`,
|
|
1055
1186
|
choices: ["preview", "published"],
|
|
@@ -1074,37 +1205,39 @@ function convertCompositionState(state) {
|
|
|
1074
1205
|
var CompositionGetModule = {
|
|
1075
1206
|
command: "get <id>",
|
|
1076
1207
|
describe: "Fetch a composition",
|
|
1077
|
-
builder: (
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1208
|
+
builder: (yargs23) => withFormatOptions(
|
|
1209
|
+
withConfiguration(
|
|
1210
|
+
withApiOptions(
|
|
1211
|
+
withProjectOptions(
|
|
1212
|
+
withStateOptions(
|
|
1213
|
+
yargs23.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1214
|
+
resolvePatterns: {
|
|
1215
|
+
type: "boolean",
|
|
1216
|
+
default: false,
|
|
1217
|
+
describe: "Resolve pattern references in the composition"
|
|
1218
|
+
},
|
|
1219
|
+
resolveOverrides: {
|
|
1220
|
+
type: "boolean",
|
|
1221
|
+
default: false,
|
|
1222
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
1223
|
+
},
|
|
1224
|
+
componentIDs: {
|
|
1225
|
+
type: "boolean",
|
|
1226
|
+
default: false,
|
|
1227
|
+
describe: "Include individual component UIDs"
|
|
1228
|
+
},
|
|
1229
|
+
resolveData: {
|
|
1230
|
+
type: "boolean",
|
|
1231
|
+
default: false,
|
|
1232
|
+
describe: "Resolve all data resources used by the composition/pattern"
|
|
1233
|
+
},
|
|
1234
|
+
diagnostics: {
|
|
1235
|
+
type: "boolean",
|
|
1236
|
+
default: false,
|
|
1237
|
+
describe: "Include diagnostics information when resolving data"
|
|
1238
|
+
}
|
|
1239
|
+
})
|
|
1240
|
+
)
|
|
1108
1241
|
)
|
|
1109
1242
|
)
|
|
1110
1243
|
)
|
|
@@ -1148,29 +1281,42 @@ var CompositionListModule = {
|
|
|
1148
1281
|
command: "list",
|
|
1149
1282
|
describe: "List compositions",
|
|
1150
1283
|
aliases: ["ls"],
|
|
1151
|
-
builder: (
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1284
|
+
builder: (yargs23) => withFormatOptions(
|
|
1285
|
+
withConfiguration(
|
|
1286
|
+
withApiOptions(
|
|
1287
|
+
withProjectOptions(
|
|
1288
|
+
withStateOptions(
|
|
1289
|
+
yargs23.options({
|
|
1290
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1291
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1292
|
+
resolvePatterns: {
|
|
1293
|
+
type: "boolean",
|
|
1294
|
+
default: false,
|
|
1295
|
+
describe: "Resolve pattern references in the composition"
|
|
1296
|
+
},
|
|
1297
|
+
resolveOverrides: {
|
|
1298
|
+
type: "boolean",
|
|
1299
|
+
default: false,
|
|
1300
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
1301
|
+
},
|
|
1302
|
+
onlyCompositions: {
|
|
1303
|
+
describe: "Only pulling compositions and not patterns",
|
|
1304
|
+
default: false,
|
|
1305
|
+
type: "boolean"
|
|
1306
|
+
},
|
|
1307
|
+
onlyPatterns: {
|
|
1308
|
+
describe: "Only pulling patterns and not compositions",
|
|
1309
|
+
default: false,
|
|
1310
|
+
type: "boolean",
|
|
1311
|
+
hidden: true
|
|
1312
|
+
},
|
|
1313
|
+
componentIDs: {
|
|
1314
|
+
type: "boolean",
|
|
1315
|
+
default: false,
|
|
1316
|
+
describe: "Include individual component UIDs"
|
|
1317
|
+
}
|
|
1318
|
+
})
|
|
1319
|
+
)
|
|
1174
1320
|
)
|
|
1175
1321
|
)
|
|
1176
1322
|
)
|
|
@@ -1183,6 +1329,8 @@ var CompositionListModule = {
|
|
|
1183
1329
|
offset,
|
|
1184
1330
|
format,
|
|
1185
1331
|
filename,
|
|
1332
|
+
onlyCompositions,
|
|
1333
|
+
onlyPatterns,
|
|
1186
1334
|
project: projectId,
|
|
1187
1335
|
state,
|
|
1188
1336
|
resolvePatterns,
|
|
@@ -1194,6 +1342,7 @@ var CompositionListModule = {
|
|
|
1194
1342
|
const res = await client.getCompositionList({
|
|
1195
1343
|
limit,
|
|
1196
1344
|
offset,
|
|
1345
|
+
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
1197
1346
|
state: convertCompositionState(state),
|
|
1198
1347
|
skipPatternResolution: !resolvePatterns,
|
|
1199
1348
|
withComponentIDs: componentIDs,
|
|
@@ -1214,6 +1363,8 @@ var selectDisplayName3 = (component) => `${component.composition._name ?? compon
|
|
|
1214
1363
|
function createComponentInstanceEngineDataSource({
|
|
1215
1364
|
client,
|
|
1216
1365
|
state,
|
|
1366
|
+
onlyCompositions,
|
|
1367
|
+
onlyPatterns,
|
|
1217
1368
|
...clientOptions
|
|
1218
1369
|
}) {
|
|
1219
1370
|
const stateId = convertCompositionState(state);
|
|
@@ -1223,6 +1374,7 @@ function createComponentInstanceEngineDataSource({
|
|
|
1223
1374
|
...clientOptions,
|
|
1224
1375
|
limit,
|
|
1225
1376
|
offset,
|
|
1377
|
+
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
1226
1378
|
state: stateId,
|
|
1227
1379
|
skipPatternResolution: true,
|
|
1228
1380
|
skipOverridesResolution: true,
|
|
@@ -1253,43 +1405,36 @@ function createComponentInstanceEngineDataSource({
|
|
|
1253
1405
|
|
|
1254
1406
|
// src/commands/canvas/commands/composition/publish.ts
|
|
1255
1407
|
var CompositionPublishModule = {
|
|
1256
|
-
command: "publish [
|
|
1408
|
+
command: "publish [ids]",
|
|
1257
1409
|
describe: "Publishes compositions",
|
|
1258
|
-
builder: (
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1410
|
+
builder: (yargs23) => withConfiguration(
|
|
1411
|
+
withApiOptions(
|
|
1412
|
+
withProjectOptions(
|
|
1413
|
+
withDiffOptions(
|
|
1414
|
+
yargs23.positional("ids", {
|
|
1415
|
+
describe: "Publishes composition/pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1416
|
+
type: "string"
|
|
1417
|
+
}).option("all", {
|
|
1418
|
+
alias: ["a"],
|
|
1419
|
+
describe: "Publishes all compositions. Use compositionId to publish one instead.",
|
|
1420
|
+
default: false,
|
|
1421
|
+
type: "boolean"
|
|
1422
|
+
}).option("what-if", {
|
|
1423
|
+
alias: ["w"],
|
|
1424
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
1425
|
+
default: false,
|
|
1426
|
+
type: "boolean"
|
|
1427
|
+
})
|
|
1428
|
+
)
|
|
1275
1429
|
)
|
|
1276
1430
|
)
|
|
1277
1431
|
),
|
|
1278
|
-
handler: async ({
|
|
1279
|
-
|
|
1280
|
-
apiKey,
|
|
1281
|
-
proxy,
|
|
1282
|
-
compositionIDs,
|
|
1283
|
-
all,
|
|
1284
|
-
whatIf,
|
|
1285
|
-
project: projectId,
|
|
1286
|
-
diff: diffMode
|
|
1287
|
-
}) => {
|
|
1288
|
-
if (!all && !compositionIDs || all && compositionIDs) {
|
|
1432
|
+
handler: async ({ apiHost, apiKey, proxy, ids, all, whatIf, project: projectId, diff: diffMode }) => {
|
|
1433
|
+
if (!all && !ids || all && ids) {
|
|
1289
1434
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
1290
1435
|
process.exit(1);
|
|
1291
1436
|
}
|
|
1292
|
-
const compositionIDsArray =
|
|
1437
|
+
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
1293
1438
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1294
1439
|
const client = new UncachedCanvasClient9({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1295
1440
|
const source = createComponentInstanceEngineDataSource({
|
|
@@ -1314,34 +1459,180 @@ var CompositionPublishModule = {
|
|
|
1314
1459
|
|
|
1315
1460
|
// src/commands/canvas/commands/composition/pull.ts
|
|
1316
1461
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
1462
|
+
|
|
1463
|
+
// src/files/index.ts
|
|
1464
|
+
import { preferredType } from "@thi.ng/mime";
|
|
1465
|
+
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files-sdk";
|
|
1466
|
+
import { createHash } from "crypto";
|
|
1467
|
+
import fsj from "fs-jetpack";
|
|
1468
|
+
import sizeOf from "image-size";
|
|
1469
|
+
import PQueue from "p-queue";
|
|
1470
|
+
import { join as join2 } from "path";
|
|
1471
|
+
var FILES_DIRECTORY_NAME = "files";
|
|
1472
|
+
var urlToFileName = (url) => {
|
|
1473
|
+
const hash = createHash("sha256");
|
|
1474
|
+
hash.update(url);
|
|
1475
|
+
const fileName = hash.digest("hex");
|
|
1476
|
+
const fileExtension = url.split(".").pop();
|
|
1477
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
1478
|
+
};
|
|
1479
|
+
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
1480
|
+
const objectAsString = JSON.stringify(object);
|
|
1481
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1482
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1483
|
+
);
|
|
1484
|
+
if (uniformFileUrlMatches) {
|
|
1485
|
+
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
1486
|
+
for (const match of uniformFileUrlMatches) {
|
|
1487
|
+
const url = match[1];
|
|
1488
|
+
fileDownloadQueue.add(async () => {
|
|
1489
|
+
try {
|
|
1490
|
+
const fileName = urlToFileName(url);
|
|
1491
|
+
const fileAlreadyExists = await fsj.existsAsync(
|
|
1492
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
1493
|
+
);
|
|
1494
|
+
if (fileAlreadyExists) {
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
const response = await fetch(url);
|
|
1498
|
+
if (!response.ok) {
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
const fileBuffer = await response.arrayBuffer();
|
|
1502
|
+
await fsj.writeAsync(
|
|
1503
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
1504
|
+
Buffer.from(fileBuffer)
|
|
1505
|
+
);
|
|
1506
|
+
} catch {
|
|
1507
|
+
console.warn(`Failed to download file ${url}`);
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
await fileDownloadQueue.onIdle();
|
|
1512
|
+
}
|
|
1513
|
+
return object;
|
|
1514
|
+
};
|
|
1515
|
+
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
1516
|
+
let objectAsString = JSON.stringify(object);
|
|
1517
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1518
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1519
|
+
);
|
|
1520
|
+
if (uniformFileUrlMatches) {
|
|
1521
|
+
const fileUploadQueue = new PQueue({ concurrency: 5 });
|
|
1522
|
+
for (const match of uniformFileUrlMatches) {
|
|
1523
|
+
const url = match[1];
|
|
1524
|
+
fileUploadQueue.add(async () => {
|
|
1525
|
+
try {
|
|
1526
|
+
const fileAlreadyExists = await options.fileClient.getFile({ url }).catch(() => null);
|
|
1527
|
+
if (fileAlreadyExists) {
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
const localFileName = urlToFileName(url);
|
|
1531
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
1532
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
1533
|
+
);
|
|
1534
|
+
if (!fileExistsLocally) {
|
|
1535
|
+
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1538
|
+
const fileBuffer = await fsj.readAsync(
|
|
1539
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
1540
|
+
"buffer"
|
|
1541
|
+
);
|
|
1542
|
+
if (!fileBuffer) {
|
|
1543
|
+
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
const fileName = getFileNameFromUrl(url);
|
|
1547
|
+
const { width, height } = (() => {
|
|
1548
|
+
try {
|
|
1549
|
+
return sizeOf(fileBuffer);
|
|
1550
|
+
} catch {
|
|
1551
|
+
return {
|
|
1552
|
+
width: void 0,
|
|
1553
|
+
height: void 0
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
})();
|
|
1557
|
+
const { id, method, uploadUrl } = await options.fileClient.createNewProjectFile({
|
|
1558
|
+
name: fileName,
|
|
1559
|
+
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
1560
|
+
size: fileBuffer.length,
|
|
1561
|
+
width,
|
|
1562
|
+
height
|
|
1563
|
+
});
|
|
1564
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
1565
|
+
method,
|
|
1566
|
+
body: fileBuffer
|
|
1567
|
+
});
|
|
1568
|
+
if (!uploadResponse.ok) {
|
|
1569
|
+
console.warn(`Failed to upload file ${url}`);
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
const checkForFile = async () => {
|
|
1573
|
+
const file = await options.fileClient.getFile({ id });
|
|
1574
|
+
if (!file || file.state !== FILE_READY_STATE) {
|
|
1575
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
1576
|
+
return checkForFile();
|
|
1577
|
+
}
|
|
1578
|
+
return file.url;
|
|
1579
|
+
};
|
|
1580
|
+
const abortTimeout = setTimeout(() => {
|
|
1581
|
+
throw new Error(`Failed to upload file ${url}`);
|
|
1582
|
+
}, 1e4);
|
|
1583
|
+
const uploadedFileUrl = await checkForFile();
|
|
1584
|
+
clearTimeout(abortTimeout);
|
|
1585
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
1586
|
+
} catch {
|
|
1587
|
+
console.warn(`Failed to upload file ${url}`);
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
await fileUploadQueue.onIdle();
|
|
1592
|
+
}
|
|
1593
|
+
return JSON.parse(objectAsString);
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
// src/commands/canvas/commands/composition/pull.ts
|
|
1317
1597
|
var CompositionPullModule = {
|
|
1318
1598
|
command: "pull <directory>",
|
|
1319
1599
|
describe: "Pulls all compositions to local files in a directory",
|
|
1320
|
-
builder: (
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1600
|
+
builder: (yargs23) => withConfiguration(
|
|
1601
|
+
withApiOptions(
|
|
1602
|
+
withProjectOptions(
|
|
1603
|
+
withStateOptions(
|
|
1604
|
+
withDiffOptions(
|
|
1605
|
+
yargs23.positional("directory", {
|
|
1606
|
+
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.",
|
|
1607
|
+
type: "string"
|
|
1608
|
+
}).option("format", {
|
|
1609
|
+
alias: ["f"],
|
|
1610
|
+
describe: "Output format",
|
|
1611
|
+
default: "yaml",
|
|
1612
|
+
choices: ["yaml", "json"],
|
|
1613
|
+
type: "string"
|
|
1614
|
+
}).option("onlyCompositions", {
|
|
1615
|
+
describe: "Only pulling compositions and not patterns",
|
|
1616
|
+
default: false,
|
|
1617
|
+
type: "boolean"
|
|
1618
|
+
}).option("onlyPatterns", {
|
|
1619
|
+
describe: "Only pulling patterns and not compositions",
|
|
1620
|
+
default: false,
|
|
1621
|
+
type: "boolean",
|
|
1622
|
+
hidden: true
|
|
1623
|
+
}).option("what-if", {
|
|
1624
|
+
alias: ["w"],
|
|
1625
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
1626
|
+
default: false,
|
|
1627
|
+
type: "boolean"
|
|
1628
|
+
}).option("mode", {
|
|
1629
|
+
alias: ["m"],
|
|
1630
|
+
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',
|
|
1631
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1632
|
+
default: "mirror",
|
|
1633
|
+
type: "string"
|
|
1634
|
+
})
|
|
1635
|
+
)
|
|
1345
1636
|
)
|
|
1346
1637
|
)
|
|
1347
1638
|
)
|
|
@@ -1352,6 +1643,8 @@ var CompositionPullModule = {
|
|
|
1352
1643
|
proxy,
|
|
1353
1644
|
directory,
|
|
1354
1645
|
format,
|
|
1646
|
+
onlyCompositions,
|
|
1647
|
+
onlyPatterns,
|
|
1355
1648
|
mode,
|
|
1356
1649
|
whatIf,
|
|
1357
1650
|
state,
|
|
@@ -1360,7 +1653,7 @@ var CompositionPullModule = {
|
|
|
1360
1653
|
}) => {
|
|
1361
1654
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1362
1655
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1363
|
-
const source = createComponentInstanceEngineDataSource({ client, state });
|
|
1656
|
+
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1364
1657
|
const isPackage = isPathAPackageFile(directory);
|
|
1365
1658
|
let target;
|
|
1366
1659
|
if (isPackage) {
|
|
@@ -1387,35 +1680,52 @@ var CompositionPullModule = {
|
|
|
1387
1680
|
target,
|
|
1388
1681
|
mode,
|
|
1389
1682
|
whatIf,
|
|
1390
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1683
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1684
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1685
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1686
|
+
directory
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1391
1689
|
});
|
|
1392
1690
|
}
|
|
1393
1691
|
};
|
|
1394
1692
|
|
|
1395
1693
|
// src/commands/canvas/commands/composition/push.ts
|
|
1396
1694
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
1695
|
+
import { FileClient as FileClient2 } from "@uniformdev/files-sdk";
|
|
1397
1696
|
var CompositionPushModule = {
|
|
1398
1697
|
command: "push <directory>",
|
|
1399
1698
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
1400
|
-
builder: (
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1699
|
+
builder: (yargs23) => withConfiguration(
|
|
1700
|
+
withApiOptions(
|
|
1701
|
+
withProjectOptions(
|
|
1702
|
+
withStateOptions(
|
|
1703
|
+
withDiffOptions(
|
|
1704
|
+
yargs23.positional("directory", {
|
|
1705
|
+
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
1706
|
+
type: "string"
|
|
1707
|
+
}).option("what-if", {
|
|
1708
|
+
alias: ["w"],
|
|
1709
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1710
|
+
default: false,
|
|
1711
|
+
type: "boolean"
|
|
1712
|
+
}).option("mode", {
|
|
1713
|
+
alias: ["m"],
|
|
1714
|
+
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',
|
|
1715
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1716
|
+
default: "mirror",
|
|
1717
|
+
type: "string"
|
|
1718
|
+
}).option("onlyCompositions", {
|
|
1719
|
+
describe: "Only pulling compositions and not patterns",
|
|
1720
|
+
default: false,
|
|
1721
|
+
type: "boolean"
|
|
1722
|
+
}).option("onlyPatterns", {
|
|
1723
|
+
describe: "Only pulling patterns and not compositions",
|
|
1724
|
+
default: false,
|
|
1725
|
+
type: "boolean",
|
|
1726
|
+
hidden: true
|
|
1727
|
+
})
|
|
1728
|
+
)
|
|
1419
1729
|
)
|
|
1420
1730
|
)
|
|
1421
1731
|
)
|
|
@@ -1429,6 +1739,8 @@ var CompositionPushModule = {
|
|
|
1429
1739
|
whatIf,
|
|
1430
1740
|
state,
|
|
1431
1741
|
project: projectId,
|
|
1742
|
+
onlyCompositions,
|
|
1743
|
+
onlyPatterns,
|
|
1432
1744
|
diff: diffMode
|
|
1433
1745
|
}) => {
|
|
1434
1746
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -1449,13 +1761,20 @@ var CompositionPushModule = {
|
|
|
1449
1761
|
selectDisplayName: selectDisplayName3
|
|
1450
1762
|
});
|
|
1451
1763
|
}
|
|
1452
|
-
const target = createComponentInstanceEngineDataSource({ client, state });
|
|
1764
|
+
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1765
|
+
const fileClient = new FileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1453
1766
|
await syncEngine({
|
|
1454
1767
|
source,
|
|
1455
1768
|
target,
|
|
1456
1769
|
mode,
|
|
1457
1770
|
whatIf,
|
|
1458
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1771
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1772
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1773
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1774
|
+
directory,
|
|
1775
|
+
fileClient
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1459
1778
|
});
|
|
1460
1779
|
}
|
|
1461
1780
|
};
|
|
@@ -1466,9 +1785,11 @@ var CompositionRemoveModule = {
|
|
|
1466
1785
|
command: "remove <id>",
|
|
1467
1786
|
aliases: ["delete", "rm"],
|
|
1468
1787
|
describe: "Delete a composition",
|
|
1469
|
-
builder: (
|
|
1470
|
-
|
|
1471
|
-
|
|
1788
|
+
builder: (yargs23) => withConfiguration(
|
|
1789
|
+
withApiOptions(
|
|
1790
|
+
withProjectOptions(
|
|
1791
|
+
yargs23.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
1792
|
+
)
|
|
1472
1793
|
)
|
|
1473
1794
|
),
|
|
1474
1795
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1483,9 +1804,14 @@ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient
|
|
|
1483
1804
|
var CompositionUnpublishModule = {
|
|
1484
1805
|
command: "unpublish <id>",
|
|
1485
1806
|
describe: "Unpublish a composition",
|
|
1486
|
-
builder: (
|
|
1487
|
-
|
|
1488
|
-
|
|
1807
|
+
builder: (yargs23) => withConfiguration(
|
|
1808
|
+
withApiOptions(
|
|
1809
|
+
withProjectOptions(
|
|
1810
|
+
yargs23.positional("id", {
|
|
1811
|
+
demandOption: true,
|
|
1812
|
+
describe: "Composition/pattern public ID to unpublish"
|
|
1813
|
+
})
|
|
1814
|
+
)
|
|
1489
1815
|
)
|
|
1490
1816
|
),
|
|
1491
1817
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1501,10 +1827,12 @@ var CompositionUpdateModule = {
|
|
|
1501
1827
|
command: "update <filename>",
|
|
1502
1828
|
aliases: ["put"],
|
|
1503
1829
|
describe: "Insert or update a composition",
|
|
1504
|
-
builder: (
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1830
|
+
builder: (yargs23) => withConfiguration(
|
|
1831
|
+
withApiOptions(
|
|
1832
|
+
withProjectOptions(
|
|
1833
|
+
withStateOptions(
|
|
1834
|
+
yargs23.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
1835
|
+
)
|
|
1508
1836
|
)
|
|
1509
1837
|
)
|
|
1510
1838
|
),
|
|
@@ -1521,7 +1849,7 @@ var CompositionModule = {
|
|
|
1521
1849
|
command: "composition <command>",
|
|
1522
1850
|
describe: "Commands for Canvas compositions",
|
|
1523
1851
|
aliases: ["comp"],
|
|
1524
|
-
builder: (
|
|
1852
|
+
builder: (yargs23) => yargs23.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
1525
1853
|
handler: () => {
|
|
1526
1854
|
yargs3.help();
|
|
1527
1855
|
}
|
|
@@ -1536,11 +1864,13 @@ var DataTypeGetModule = {
|
|
|
1536
1864
|
command: "get <id>",
|
|
1537
1865
|
describe: "Get a data type",
|
|
1538
1866
|
aliases: ["ls"],
|
|
1539
|
-
builder: (
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1867
|
+
builder: (yargs23) => withConfiguration(
|
|
1868
|
+
withFormatOptions(
|
|
1869
|
+
withApiOptions(
|
|
1870
|
+
withProjectOptions(
|
|
1871
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1872
|
+
yargs23.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
1873
|
+
)
|
|
1544
1874
|
)
|
|
1545
1875
|
)
|
|
1546
1876
|
),
|
|
@@ -1562,7 +1892,7 @@ var DataTypeListModule = {
|
|
|
1562
1892
|
command: "list",
|
|
1563
1893
|
describe: "List data types",
|
|
1564
1894
|
aliases: ["ls"],
|
|
1565
|
-
builder: (
|
|
1895
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
1566
1896
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1567
1897
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1568
1898
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -1611,30 +1941,32 @@ function createDataTypeEngineDataSource({
|
|
|
1611
1941
|
var DataTypePullModule = {
|
|
1612
1942
|
command: "pull <directory>",
|
|
1613
1943
|
describe: "Pulls all data types to local files in a directory",
|
|
1614
|
-
builder: (
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1944
|
+
builder: (yargs23) => withConfiguration(
|
|
1945
|
+
withApiOptions(
|
|
1946
|
+
withProjectOptions(
|
|
1947
|
+
withDiffOptions(
|
|
1948
|
+
yargs23.positional("directory", {
|
|
1949
|
+
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.",
|
|
1950
|
+
type: "string"
|
|
1951
|
+
}).option("format", {
|
|
1952
|
+
alias: ["f"],
|
|
1953
|
+
describe: "Output format",
|
|
1954
|
+
default: "yaml",
|
|
1955
|
+
choices: ["yaml", "json"],
|
|
1956
|
+
type: "string"
|
|
1957
|
+
}).option("what-if", {
|
|
1958
|
+
alias: ["w"],
|
|
1959
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
1960
|
+
default: false,
|
|
1961
|
+
type: "boolean"
|
|
1962
|
+
}).option("mode", {
|
|
1963
|
+
alias: ["m"],
|
|
1964
|
+
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',
|
|
1965
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1966
|
+
default: "mirror",
|
|
1967
|
+
type: "string"
|
|
1968
|
+
})
|
|
1969
|
+
)
|
|
1638
1970
|
)
|
|
1639
1971
|
)
|
|
1640
1972
|
),
|
|
@@ -1694,24 +2026,26 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
1694
2026
|
var DataTypePushModule = {
|
|
1695
2027
|
command: "push <directory>",
|
|
1696
2028
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
1697
|
-
builder: (
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
2029
|
+
builder: (yargs23) => withConfiguration(
|
|
2030
|
+
withApiOptions(
|
|
2031
|
+
withProjectOptions(
|
|
2032
|
+
withDiffOptions(
|
|
2033
|
+
yargs23.positional("directory", {
|
|
2034
|
+
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2035
|
+
type: "string"
|
|
2036
|
+
}).option("what-if", {
|
|
2037
|
+
alias: ["w"],
|
|
2038
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2039
|
+
default: false,
|
|
2040
|
+
type: "boolean"
|
|
2041
|
+
}).option("mode", {
|
|
2042
|
+
alias: ["m"],
|
|
2043
|
+
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',
|
|
2044
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2045
|
+
default: "mirror",
|
|
2046
|
+
type: "string"
|
|
2047
|
+
})
|
|
2048
|
+
)
|
|
1715
2049
|
)
|
|
1716
2050
|
)
|
|
1717
2051
|
),
|
|
@@ -1766,9 +2100,11 @@ var DataTypeRemoveModule = {
|
|
|
1766
2100
|
command: "remove <id>",
|
|
1767
2101
|
aliases: ["delete", "rm"],
|
|
1768
2102
|
describe: "Delete a data type",
|
|
1769
|
-
builder: (
|
|
1770
|
-
|
|
1771
|
-
|
|
2103
|
+
builder: (yargs23) => withConfiguration(
|
|
2104
|
+
withApiOptions(
|
|
2105
|
+
withProjectOptions(
|
|
2106
|
+
yargs23.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2107
|
+
)
|
|
1772
2108
|
)
|
|
1773
2109
|
),
|
|
1774
2110
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1784,9 +2120,11 @@ var DataTypeUpdateModule = {
|
|
|
1784
2120
|
command: "update <filename>",
|
|
1785
2121
|
aliases: ["put"],
|
|
1786
2122
|
describe: "Insert or update a data type",
|
|
1787
|
-
builder: (
|
|
1788
|
-
|
|
1789
|
-
|
|
2123
|
+
builder: (yargs23) => withConfiguration(
|
|
2124
|
+
withApiOptions(
|
|
2125
|
+
withProjectOptions(
|
|
2126
|
+
yargs23.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2127
|
+
)
|
|
1790
2128
|
)
|
|
1791
2129
|
),
|
|
1792
2130
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -1802,38 +2140,206 @@ var DataTypeModule = {
|
|
|
1802
2140
|
command: "datatype <command>",
|
|
1803
2141
|
aliases: ["dt"],
|
|
1804
2142
|
describe: "Commands for Data Type definitions",
|
|
1805
|
-
builder: (
|
|
2143
|
+
builder: (yargs23) => yargs23.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
1806
2144
|
handler: () => {
|
|
1807
2145
|
yargs4.help();
|
|
1808
2146
|
}
|
|
1809
2147
|
};
|
|
1810
2148
|
|
|
2149
|
+
// src/commands/canvas/commands/pattern.ts
|
|
2150
|
+
import yargs5 from "yargs";
|
|
2151
|
+
|
|
2152
|
+
// src/commands/canvas/commands/pattern/get.ts
|
|
2153
|
+
var PatternGetModule = {
|
|
2154
|
+
...CompositionGetModule,
|
|
2155
|
+
describe: "Fetch a pattern"
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
// src/commands/canvas/commands/pattern/list.ts
|
|
2159
|
+
var PatternListModule = {
|
|
2160
|
+
...CompositionListModule,
|
|
2161
|
+
describe: "List patterns",
|
|
2162
|
+
builder: (yargs23) => withFormatOptions(
|
|
2163
|
+
withConfiguration(
|
|
2164
|
+
withApiOptions(
|
|
2165
|
+
withProjectOptions(
|
|
2166
|
+
withStateOptions(
|
|
2167
|
+
yargs23.options({
|
|
2168
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2169
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2170
|
+
resolvePatterns: {
|
|
2171
|
+
type: "boolean",
|
|
2172
|
+
default: false,
|
|
2173
|
+
describe: "Resolve pattern references in the composition"
|
|
2174
|
+
},
|
|
2175
|
+
resolveOverrides: {
|
|
2176
|
+
type: "boolean",
|
|
2177
|
+
default: false,
|
|
2178
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
2179
|
+
},
|
|
2180
|
+
onlyPatterns: {
|
|
2181
|
+
describe: "Only pulling patterns and not compositions",
|
|
2182
|
+
// This default differentiate this list command from composition list command
|
|
2183
|
+
default: true,
|
|
2184
|
+
type: "boolean",
|
|
2185
|
+
hidden: true
|
|
2186
|
+
},
|
|
2187
|
+
componentIDs: {
|
|
2188
|
+
alias: ["componentIDs"],
|
|
2189
|
+
type: "boolean",
|
|
2190
|
+
default: false,
|
|
2191
|
+
describe: "Include individual component UIDs"
|
|
2192
|
+
}
|
|
2193
|
+
})
|
|
2194
|
+
)
|
|
2195
|
+
)
|
|
2196
|
+
)
|
|
2197
|
+
)
|
|
2198
|
+
)
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
// src/commands/canvas/commands/pattern/publish.ts
|
|
2202
|
+
var PatternPublishModule = {
|
|
2203
|
+
...CompositionPublishModule,
|
|
2204
|
+
describe: "Publishes patterns"
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
// src/commands/canvas/commands/pattern/pull.ts
|
|
2208
|
+
var PatternPullModule = {
|
|
2209
|
+
...CompositionPullModule,
|
|
2210
|
+
describe: "Pulls all patterns to local files in a directory",
|
|
2211
|
+
builder: (yargs23) => withConfiguration(
|
|
2212
|
+
withApiOptions(
|
|
2213
|
+
withProjectOptions(
|
|
2214
|
+
withStateOptions(
|
|
2215
|
+
withDiffOptions(
|
|
2216
|
+
yargs23.positional("directory", {
|
|
2217
|
+
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.",
|
|
2218
|
+
type: "string"
|
|
2219
|
+
}).option("format", {
|
|
2220
|
+
alias: ["f"],
|
|
2221
|
+
describe: "Output format",
|
|
2222
|
+
default: "yaml",
|
|
2223
|
+
choices: ["yaml", "json"],
|
|
2224
|
+
type: "string"
|
|
2225
|
+
}).option("onlyPatterns", {
|
|
2226
|
+
describe: "Only pulling patterns and not compositions",
|
|
2227
|
+
// This default differentiate this list command from composition list command
|
|
2228
|
+
default: true,
|
|
2229
|
+
type: "boolean",
|
|
2230
|
+
hidden: true
|
|
2231
|
+
}).option("what-if", {
|
|
2232
|
+
alias: ["w"],
|
|
2233
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2234
|
+
default: false,
|
|
2235
|
+
type: "boolean"
|
|
2236
|
+
}).option("mode", {
|
|
2237
|
+
alias: ["m"],
|
|
2238
|
+
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',
|
|
2239
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2240
|
+
default: "mirror",
|
|
2241
|
+
type: "string"
|
|
2242
|
+
})
|
|
2243
|
+
)
|
|
2244
|
+
)
|
|
2245
|
+
)
|
|
2246
|
+
)
|
|
2247
|
+
)
|
|
2248
|
+
};
|
|
2249
|
+
|
|
2250
|
+
// src/commands/canvas/commands/pattern/push.ts
|
|
2251
|
+
var PatternPushModule = {
|
|
2252
|
+
...CompositionPushModule,
|
|
2253
|
+
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
2254
|
+
builder: (yargs23) => withConfiguration(
|
|
2255
|
+
withApiOptions(
|
|
2256
|
+
withProjectOptions(
|
|
2257
|
+
withStateOptions(
|
|
2258
|
+
withDiffOptions(
|
|
2259
|
+
yargs23.positional("directory", {
|
|
2260
|
+
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2261
|
+
type: "string"
|
|
2262
|
+
}).option("what-if", {
|
|
2263
|
+
alias: ["w"],
|
|
2264
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2265
|
+
default: false,
|
|
2266
|
+
type: "boolean"
|
|
2267
|
+
}).option("mode", {
|
|
2268
|
+
alias: ["m"],
|
|
2269
|
+
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',
|
|
2270
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2271
|
+
default: "mirror",
|
|
2272
|
+
type: "string"
|
|
2273
|
+
}).option("onlyPatterns", {
|
|
2274
|
+
describe: "Only pulling patterns and not compositions",
|
|
2275
|
+
// This default differentiate this list command from composition list command
|
|
2276
|
+
default: true,
|
|
2277
|
+
type: "boolean",
|
|
2278
|
+
hidden: true
|
|
2279
|
+
})
|
|
2280
|
+
)
|
|
2281
|
+
)
|
|
2282
|
+
)
|
|
2283
|
+
)
|
|
2284
|
+
)
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2287
|
+
// src/commands/canvas/commands/pattern/remove.ts
|
|
2288
|
+
var PatternRemoveModule = {
|
|
2289
|
+
...CompositionRemoveModule,
|
|
2290
|
+
describe: "Delete a pattern"
|
|
2291
|
+
};
|
|
2292
|
+
|
|
2293
|
+
// src/commands/canvas/commands/pattern/unpublish.ts
|
|
2294
|
+
var PatternUnpublishModule = {
|
|
2295
|
+
...CompositionUnpublishModule,
|
|
2296
|
+
describe: "Unpublish a pattern"
|
|
2297
|
+
};
|
|
2298
|
+
|
|
2299
|
+
// src/commands/canvas/commands/pattern/update.ts
|
|
2300
|
+
var PatternUpdateModule = {
|
|
2301
|
+
...CompositionUpdateModule,
|
|
2302
|
+
describe: "Insert or update a pattern"
|
|
2303
|
+
};
|
|
2304
|
+
|
|
2305
|
+
// src/commands/canvas/commands/pattern.ts
|
|
2306
|
+
var PatternModule = {
|
|
2307
|
+
command: "pattern <command>",
|
|
2308
|
+
describe: "Commands for Canvas patterns",
|
|
2309
|
+
builder: (yargs23) => yargs23.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
2310
|
+
handler: () => {
|
|
2311
|
+
yargs5.help();
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
|
|
1811
2315
|
// src/commands/canvas/index.ts
|
|
1812
2316
|
var CanvasCommand = {
|
|
1813
2317
|
command: "canvas <command>",
|
|
1814
2318
|
aliases: ["cv", "pm", "presentation"],
|
|
1815
2319
|
describe: "Uniform Canvas commands",
|
|
1816
|
-
builder: (
|
|
2320
|
+
builder: (yargs23) => yargs23.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).demandCommand(),
|
|
1817
2321
|
handler: () => {
|
|
1818
|
-
|
|
2322
|
+
yargs6.showHelp();
|
|
1819
2323
|
}
|
|
1820
2324
|
};
|
|
1821
2325
|
|
|
1822
2326
|
// src/commands/context/index.ts
|
|
1823
|
-
import
|
|
2327
|
+
import yargs13 from "yargs";
|
|
1824
2328
|
|
|
1825
2329
|
// src/commands/context/commands/aggregate.ts
|
|
1826
|
-
import
|
|
2330
|
+
import yargs7 from "yargs";
|
|
1827
2331
|
|
|
1828
2332
|
// src/commands/context/commands/aggregate/get.ts
|
|
1829
2333
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
1830
2334
|
var AggregateGetModule = {
|
|
1831
2335
|
command: "get <id>",
|
|
1832
2336
|
describe: "Fetch an aggregate",
|
|
1833
|
-
builder: (
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
2337
|
+
builder: (yargs23) => withConfiguration(
|
|
2338
|
+
withFormatOptions(
|
|
2339
|
+
withApiOptions(
|
|
2340
|
+
withProjectOptions(
|
|
2341
|
+
yargs23.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
2342
|
+
)
|
|
1837
2343
|
)
|
|
1838
2344
|
)
|
|
1839
2345
|
),
|
|
@@ -1856,7 +2362,7 @@ var AggregateListModule = {
|
|
|
1856
2362
|
command: "list",
|
|
1857
2363
|
describe: "List aggregates",
|
|
1858
2364
|
aliases: ["ls"],
|
|
1859
|
-
builder: (
|
|
2365
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
1860
2366
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1861
2367
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1862
2368
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1922,30 +2428,32 @@ function writeContextPackage(filename, packageContents) {
|
|
|
1922
2428
|
var AggregatePullModule = {
|
|
1923
2429
|
command: "pull <directory>",
|
|
1924
2430
|
describe: "Pulls all aggregates to local files in a directory",
|
|
1925
|
-
builder: (
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
2431
|
+
builder: (yargs23) => withConfiguration(
|
|
2432
|
+
withApiOptions(
|
|
2433
|
+
withProjectOptions(
|
|
2434
|
+
withDiffOptions(
|
|
2435
|
+
yargs23.positional("directory", {
|
|
2436
|
+
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.",
|
|
2437
|
+
type: "string"
|
|
2438
|
+
}).option("format", {
|
|
2439
|
+
alias: ["f"],
|
|
2440
|
+
describe: "Output format",
|
|
2441
|
+
default: "yaml",
|
|
2442
|
+
choices: ["yaml", "json"],
|
|
2443
|
+
type: "string"
|
|
2444
|
+
}).option("what-if", {
|
|
2445
|
+
alias: ["w"],
|
|
2446
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2447
|
+
default: false,
|
|
2448
|
+
type: "boolean"
|
|
2449
|
+
}).option("mode", {
|
|
2450
|
+
alias: ["m"],
|
|
2451
|
+
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',
|
|
2452
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2453
|
+
default: "mirror",
|
|
2454
|
+
type: "string"
|
|
2455
|
+
})
|
|
2456
|
+
)
|
|
1949
2457
|
)
|
|
1950
2458
|
)
|
|
1951
2459
|
),
|
|
@@ -1999,24 +2507,26 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
1999
2507
|
var AggregatePushModule = {
|
|
2000
2508
|
command: "push <directory>",
|
|
2001
2509
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
2002
|
-
builder: (
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2510
|
+
builder: (yargs23) => withConfiguration(
|
|
2511
|
+
withApiOptions(
|
|
2512
|
+
withProjectOptions(
|
|
2513
|
+
withDiffOptions(
|
|
2514
|
+
yargs23.positional("directory", {
|
|
2515
|
+
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
2516
|
+
type: "string"
|
|
2517
|
+
}).option("what-if", {
|
|
2518
|
+
alias: ["w"],
|
|
2519
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2520
|
+
default: false,
|
|
2521
|
+
type: "boolean"
|
|
2522
|
+
}).option("mode", {
|
|
2523
|
+
alias: ["m"],
|
|
2524
|
+
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',
|
|
2525
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2526
|
+
default: "mirror",
|
|
2527
|
+
type: "string"
|
|
2528
|
+
})
|
|
2529
|
+
)
|
|
2020
2530
|
)
|
|
2021
2531
|
)
|
|
2022
2532
|
),
|
|
@@ -2066,9 +2576,11 @@ var AggregateRemoveModule = {
|
|
|
2066
2576
|
command: "remove <id>",
|
|
2067
2577
|
aliases: ["delete", "rm"],
|
|
2068
2578
|
describe: "Delete an aggregate",
|
|
2069
|
-
builder: (
|
|
2070
|
-
|
|
2071
|
-
|
|
2579
|
+
builder: (yargs23) => withConfiguration(
|
|
2580
|
+
withApiOptions(
|
|
2581
|
+
withProjectOptions(
|
|
2582
|
+
yargs23.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
2583
|
+
)
|
|
2072
2584
|
)
|
|
2073
2585
|
),
|
|
2074
2586
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2084,9 +2596,11 @@ var AggregateUpdateModule = {
|
|
|
2084
2596
|
command: "update <filename>",
|
|
2085
2597
|
aliases: ["put"],
|
|
2086
2598
|
describe: "Insert or update an aggregate",
|
|
2087
|
-
builder: (
|
|
2088
|
-
|
|
2089
|
-
|
|
2599
|
+
builder: (yargs23) => withConfiguration(
|
|
2600
|
+
withApiOptions(
|
|
2601
|
+
withProjectOptions(
|
|
2602
|
+
yargs23.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
2603
|
+
)
|
|
2090
2604
|
)
|
|
2091
2605
|
),
|
|
2092
2606
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -2102,24 +2616,26 @@ var AggregateModule = {
|
|
|
2102
2616
|
command: "aggregate <command>",
|
|
2103
2617
|
aliases: ["agg", "intent", "audience"],
|
|
2104
2618
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
2105
|
-
builder: (
|
|
2619
|
+
builder: (yargs23) => yargs23.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
2106
2620
|
handler: () => {
|
|
2107
|
-
|
|
2621
|
+
yargs7.help();
|
|
2108
2622
|
}
|
|
2109
2623
|
};
|
|
2110
2624
|
|
|
2111
2625
|
// src/commands/context/commands/enrichment.ts
|
|
2112
|
-
import
|
|
2626
|
+
import yargs8 from "yargs";
|
|
2113
2627
|
|
|
2114
2628
|
// src/commands/context/commands/enrichment/get.ts
|
|
2115
2629
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
2116
2630
|
var EnrichmentGetModule = {
|
|
2117
2631
|
command: "get <id>",
|
|
2118
2632
|
describe: "Fetch an enrichment category and its values",
|
|
2119
|
-
builder: (
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2633
|
+
builder: (yargs23) => withFormatOptions(
|
|
2634
|
+
withConfiguration(
|
|
2635
|
+
withApiOptions(
|
|
2636
|
+
withProjectOptions(
|
|
2637
|
+
yargs23.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
2638
|
+
)
|
|
2123
2639
|
)
|
|
2124
2640
|
)
|
|
2125
2641
|
),
|
|
@@ -2143,7 +2659,7 @@ var EnrichmentListModule = {
|
|
|
2143
2659
|
command: "list",
|
|
2144
2660
|
describe: "List enrichments",
|
|
2145
2661
|
aliases: ["ls"],
|
|
2146
|
-
builder: (
|
|
2662
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
2147
2663
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2148
2664
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2149
2665
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2244,30 +2760,32 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
2244
2760
|
var EnrichmentPullModule = {
|
|
2245
2761
|
command: "pull <directory>",
|
|
2246
2762
|
describe: "Pulls all enrichments to local files in a directory",
|
|
2247
|
-
builder: (
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2763
|
+
builder: (yargs23) => withConfiguration(
|
|
2764
|
+
withApiOptions(
|
|
2765
|
+
withProjectOptions(
|
|
2766
|
+
withDiffOptions(
|
|
2767
|
+
yargs23.positional("directory", {
|
|
2768
|
+
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.",
|
|
2769
|
+
type: "string"
|
|
2770
|
+
}).option("format", {
|
|
2771
|
+
alias: ["f"],
|
|
2772
|
+
describe: "Output format",
|
|
2773
|
+
default: "yaml",
|
|
2774
|
+
choices: ["yaml", "json"],
|
|
2775
|
+
type: "string"
|
|
2776
|
+
}).option("what-if", {
|
|
2777
|
+
alias: ["w"],
|
|
2778
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2779
|
+
default: false,
|
|
2780
|
+
type: "boolean"
|
|
2781
|
+
}).option("mode", {
|
|
2782
|
+
alias: ["m"],
|
|
2783
|
+
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',
|
|
2784
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2785
|
+
default: "mirror",
|
|
2786
|
+
type: "string"
|
|
2787
|
+
})
|
|
2788
|
+
)
|
|
2271
2789
|
)
|
|
2272
2790
|
)
|
|
2273
2791
|
),
|
|
@@ -2321,24 +2839,26 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
2321
2839
|
var EnrichmentPushModule = {
|
|
2322
2840
|
command: "push <directory>",
|
|
2323
2841
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
2324
|
-
builder: (
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2842
|
+
builder: (yargs23) => withConfiguration(
|
|
2843
|
+
withApiOptions(
|
|
2844
|
+
withProjectOptions(
|
|
2845
|
+
withDiffOptions(
|
|
2846
|
+
yargs23.positional("directory", {
|
|
2847
|
+
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
2848
|
+
type: "string"
|
|
2849
|
+
}).option("what-if", {
|
|
2850
|
+
alias: ["w"],
|
|
2851
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2852
|
+
default: false,
|
|
2853
|
+
type: "boolean"
|
|
2854
|
+
}).option("mode", {
|
|
2855
|
+
alias: ["m"],
|
|
2856
|
+
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',
|
|
2857
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2858
|
+
default: "mirror",
|
|
2859
|
+
type: "string"
|
|
2860
|
+
})
|
|
2861
|
+
)
|
|
2342
2862
|
)
|
|
2343
2863
|
)
|
|
2344
2864
|
),
|
|
@@ -2387,9 +2907,11 @@ var EnrichmentRemoveModule = {
|
|
|
2387
2907
|
command: "remove <id>",
|
|
2388
2908
|
aliases: ["delete", "rm"],
|
|
2389
2909
|
describe: "Delete an enrichment category and its values",
|
|
2390
|
-
builder: (
|
|
2391
|
-
|
|
2392
|
-
|
|
2910
|
+
builder: (yargs23) => withConfiguration(
|
|
2911
|
+
withApiOptions(
|
|
2912
|
+
withProjectOptions(
|
|
2913
|
+
yargs23.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
2914
|
+
)
|
|
2393
2915
|
)
|
|
2394
2916
|
),
|
|
2395
2917
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2404,14 +2926,14 @@ var EnrichmentModule = {
|
|
|
2404
2926
|
command: "enrichment <command>",
|
|
2405
2927
|
aliases: ["enr"],
|
|
2406
2928
|
describe: "Commands for Context enrichments",
|
|
2407
|
-
builder: (
|
|
2929
|
+
builder: (yargs23) => yargs23.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
2408
2930
|
handler: () => {
|
|
2409
|
-
|
|
2931
|
+
yargs8.help();
|
|
2410
2932
|
}
|
|
2411
2933
|
};
|
|
2412
2934
|
|
|
2413
2935
|
// src/commands/context/commands/manifest.ts
|
|
2414
|
-
import
|
|
2936
|
+
import yargs9 from "yargs";
|
|
2415
2937
|
|
|
2416
2938
|
// src/commands/context/commands/manifest/get.ts
|
|
2417
2939
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -2422,20 +2944,22 @@ var ManifestGetModule = {
|
|
|
2422
2944
|
command: "get [output]",
|
|
2423
2945
|
aliases: ["dl", "download"],
|
|
2424
2946
|
describe: "Download the Uniform Context manifest for a project",
|
|
2425
|
-
builder: (
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2947
|
+
builder: (yargs23) => withConfiguration(
|
|
2948
|
+
withApiOptions(
|
|
2949
|
+
withProjectOptions(
|
|
2950
|
+
yargs23.option("preview", {
|
|
2951
|
+
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
2952
|
+
default: false,
|
|
2953
|
+
type: "boolean",
|
|
2954
|
+
alias: ["d"]
|
|
2955
|
+
}).option("output", {
|
|
2956
|
+
string: true,
|
|
2957
|
+
alias: "o",
|
|
2958
|
+
default: process.env.UNIFORM_MANIFEST_PATH,
|
|
2959
|
+
describe: "Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set.",
|
|
2960
|
+
demandOption: true
|
|
2961
|
+
})
|
|
2962
|
+
)
|
|
2439
2963
|
)
|
|
2440
2964
|
),
|
|
2441
2965
|
handler: async ({ apiKey, apiHost, proxy, output, project, preview }) => {
|
|
@@ -2485,7 +3009,7 @@ import { exit as exit2 } from "process";
|
|
|
2485
3009
|
var ManifestPublishModule = {
|
|
2486
3010
|
command: "publish",
|
|
2487
3011
|
describe: "Publish the Uniform Context manifest for a project",
|
|
2488
|
-
builder: (
|
|
3012
|
+
builder: (yargs23) => withConfiguration(withApiOptions(withProjectOptions(yargs23))),
|
|
2489
3013
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
2490
3014
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2491
3015
|
try {
|
|
@@ -2518,24 +3042,26 @@ var ManifestModule = {
|
|
|
2518
3042
|
command: "manifest <command>",
|
|
2519
3043
|
describe: "Commands for context manifests",
|
|
2520
3044
|
aliases: ["man"],
|
|
2521
|
-
builder: (
|
|
3045
|
+
builder: (yargs23) => yargs23.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
2522
3046
|
handler: () => {
|
|
2523
|
-
|
|
3047
|
+
yargs9.help();
|
|
2524
3048
|
}
|
|
2525
3049
|
};
|
|
2526
3050
|
|
|
2527
3051
|
// src/commands/context/commands/quirk.ts
|
|
2528
|
-
import
|
|
3052
|
+
import yargs10 from "yargs";
|
|
2529
3053
|
|
|
2530
3054
|
// src/commands/context/commands/quirk/get.ts
|
|
2531
3055
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
2532
3056
|
var QuirkGetModule = {
|
|
2533
3057
|
command: "get <id>",
|
|
2534
3058
|
describe: "Fetch a quirk",
|
|
2535
|
-
builder: (
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
3059
|
+
builder: (yargs23) => withConfiguration(
|
|
3060
|
+
withFormatOptions(
|
|
3061
|
+
withApiOptions(
|
|
3062
|
+
withProjectOptions(
|
|
3063
|
+
yargs23.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
3064
|
+
)
|
|
2539
3065
|
)
|
|
2540
3066
|
)
|
|
2541
3067
|
),
|
|
@@ -2558,14 +3084,16 @@ var QuirkListModule = {
|
|
|
2558
3084
|
command: "list",
|
|
2559
3085
|
describe: "List quirks",
|
|
2560
3086
|
aliases: ["ls"],
|
|
2561
|
-
builder: (
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
3087
|
+
builder: (yargs23) => withConfiguration(
|
|
3088
|
+
withFormatOptions(
|
|
3089
|
+
withApiOptions(
|
|
3090
|
+
withProjectOptions(
|
|
3091
|
+
yargs23.option("withIntegrations", {
|
|
3092
|
+
alias: ["i"],
|
|
3093
|
+
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
3094
|
+
type: "boolean"
|
|
3095
|
+
})
|
|
3096
|
+
)
|
|
2569
3097
|
)
|
|
2570
3098
|
)
|
|
2571
3099
|
),
|
|
@@ -2617,30 +3145,32 @@ function createQuirkEngineDataSource({
|
|
|
2617
3145
|
var QuirkPullModule = {
|
|
2618
3146
|
command: "pull <directory>",
|
|
2619
3147
|
describe: "Pulls all quirks to local files in a directory",
|
|
2620
|
-
builder: (
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
3148
|
+
builder: (yargs23) => withConfiguration(
|
|
3149
|
+
withApiOptions(
|
|
3150
|
+
withProjectOptions(
|
|
3151
|
+
withDiffOptions(
|
|
3152
|
+
yargs23.positional("directory", {
|
|
3153
|
+
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.",
|
|
3154
|
+
type: "string"
|
|
3155
|
+
}).option("format", {
|
|
3156
|
+
alias: ["f"],
|
|
3157
|
+
describe: "Output format",
|
|
3158
|
+
default: "yaml",
|
|
3159
|
+
choices: ["yaml", "json"],
|
|
3160
|
+
type: "string"
|
|
3161
|
+
}).option("what-if", {
|
|
3162
|
+
alias: ["w"],
|
|
3163
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3164
|
+
default: false,
|
|
3165
|
+
type: "boolean"
|
|
3166
|
+
}).option("mode", {
|
|
3167
|
+
alias: ["m"],
|
|
3168
|
+
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',
|
|
3169
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3170
|
+
default: "mirror",
|
|
3171
|
+
type: "string"
|
|
3172
|
+
})
|
|
3173
|
+
)
|
|
2644
3174
|
)
|
|
2645
3175
|
)
|
|
2646
3176
|
),
|
|
@@ -2694,24 +3224,26 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
2694
3224
|
var QuirkPushModule = {
|
|
2695
3225
|
command: "push <directory>",
|
|
2696
3226
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
2697
|
-
builder: (
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
3227
|
+
builder: (yargs23) => withConfiguration(
|
|
3228
|
+
withApiOptions(
|
|
3229
|
+
withProjectOptions(
|
|
3230
|
+
withDiffOptions(
|
|
3231
|
+
yargs23.positional("directory", {
|
|
3232
|
+
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
3233
|
+
type: "string"
|
|
3234
|
+
}).option("what-if", {
|
|
3235
|
+
alias: ["w"],
|
|
3236
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3237
|
+
default: false,
|
|
3238
|
+
type: "boolean"
|
|
3239
|
+
}).option("mode", {
|
|
3240
|
+
alias: ["m"],
|
|
3241
|
+
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',
|
|
3242
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3243
|
+
default: "mirror",
|
|
3244
|
+
type: "string"
|
|
3245
|
+
})
|
|
3246
|
+
)
|
|
2715
3247
|
)
|
|
2716
3248
|
)
|
|
2717
3249
|
),
|
|
@@ -2760,9 +3292,11 @@ var QuirkRemoveModule = {
|
|
|
2760
3292
|
command: "remove <id>",
|
|
2761
3293
|
aliases: ["delete", "rm"],
|
|
2762
3294
|
describe: "Delete a quirk",
|
|
2763
|
-
builder: (
|
|
2764
|
-
|
|
2765
|
-
|
|
3295
|
+
builder: (yargs23) => withConfiguration(
|
|
3296
|
+
withApiOptions(
|
|
3297
|
+
withProjectOptions(
|
|
3298
|
+
yargs23.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
3299
|
+
)
|
|
2766
3300
|
)
|
|
2767
3301
|
),
|
|
2768
3302
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2778,8 +3312,12 @@ var QuirkUpdateModule = {
|
|
|
2778
3312
|
command: "update <filename>",
|
|
2779
3313
|
aliases: ["put"],
|
|
2780
3314
|
describe: "Insert or update a quirk",
|
|
2781
|
-
builder: (
|
|
2782
|
-
|
|
3315
|
+
builder: (yargs23) => withConfiguration(
|
|
3316
|
+
withApiOptions(
|
|
3317
|
+
withProjectOptions(
|
|
3318
|
+
yargs23.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
3319
|
+
)
|
|
3320
|
+
)
|
|
2783
3321
|
),
|
|
2784
3322
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2785
3323
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -2794,24 +3332,26 @@ var QuirkModule = {
|
|
|
2794
3332
|
command: "quirk <command>",
|
|
2795
3333
|
aliases: ["qk"],
|
|
2796
3334
|
describe: "Commands for Context quirks",
|
|
2797
|
-
builder: (
|
|
3335
|
+
builder: (yargs23) => yargs23.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
2798
3336
|
handler: () => {
|
|
2799
|
-
|
|
3337
|
+
yargs10.help();
|
|
2800
3338
|
}
|
|
2801
3339
|
};
|
|
2802
3340
|
|
|
2803
3341
|
// src/commands/context/commands/signal.ts
|
|
2804
|
-
import
|
|
3342
|
+
import yargs11 from "yargs";
|
|
2805
3343
|
|
|
2806
3344
|
// src/commands/context/commands/signal/get.ts
|
|
2807
3345
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
2808
3346
|
var SignalGetModule = {
|
|
2809
3347
|
command: "get <id>",
|
|
2810
3348
|
describe: "Fetch a signal",
|
|
2811
|
-
builder: (
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
3349
|
+
builder: (yargs23) => withConfiguration(
|
|
3350
|
+
withFormatOptions(
|
|
3351
|
+
withApiOptions(
|
|
3352
|
+
withProjectOptions(
|
|
3353
|
+
yargs23.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
3354
|
+
)
|
|
2815
3355
|
)
|
|
2816
3356
|
)
|
|
2817
3357
|
),
|
|
@@ -2834,7 +3374,7 @@ var SignalListModule = {
|
|
|
2834
3374
|
command: "list",
|
|
2835
3375
|
describe: "List signals",
|
|
2836
3376
|
aliases: ["ls"],
|
|
2837
|
-
builder: (
|
|
3377
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
2838
3378
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2839
3379
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2840
3380
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2883,30 +3423,32 @@ function createSignalEngineDataSource({
|
|
|
2883
3423
|
var SignalPullModule = {
|
|
2884
3424
|
command: "pull <directory>",
|
|
2885
3425
|
describe: "Pulls all signals to local files in a directory",
|
|
2886
|
-
builder: (
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3426
|
+
builder: (yargs23) => withConfiguration(
|
|
3427
|
+
withApiOptions(
|
|
3428
|
+
withProjectOptions(
|
|
3429
|
+
withDiffOptions(
|
|
3430
|
+
yargs23.positional("directory", {
|
|
3431
|
+
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.",
|
|
3432
|
+
type: "string"
|
|
3433
|
+
}).option("format", {
|
|
3434
|
+
alias: ["f"],
|
|
3435
|
+
describe: "Output format",
|
|
3436
|
+
default: "yaml",
|
|
3437
|
+
choices: ["yaml", "json"],
|
|
3438
|
+
type: "string"
|
|
3439
|
+
}).option("what-if", {
|
|
3440
|
+
alias: ["w"],
|
|
3441
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3442
|
+
default: false,
|
|
3443
|
+
type: "boolean"
|
|
3444
|
+
}).option("mode", {
|
|
3445
|
+
alias: ["m"],
|
|
3446
|
+
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',
|
|
3447
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3448
|
+
default: "mirror",
|
|
3449
|
+
type: "string"
|
|
3450
|
+
})
|
|
3451
|
+
)
|
|
2910
3452
|
)
|
|
2911
3453
|
)
|
|
2912
3454
|
),
|
|
@@ -2960,24 +3502,26 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
2960
3502
|
var SignalPushModule = {
|
|
2961
3503
|
command: "push <directory>",
|
|
2962
3504
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
2963
|
-
builder: (
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
3505
|
+
builder: (yargs23) => withConfiguration(
|
|
3506
|
+
withApiOptions(
|
|
3507
|
+
withProjectOptions(
|
|
3508
|
+
withDiffOptions(
|
|
3509
|
+
yargs23.positional("directory", {
|
|
3510
|
+
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
3511
|
+
type: "string"
|
|
3512
|
+
}).option("what-if", {
|
|
3513
|
+
alias: ["w"],
|
|
3514
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3515
|
+
default: false,
|
|
3516
|
+
type: "boolean"
|
|
3517
|
+
}).option("mode", {
|
|
3518
|
+
alias: ["m"],
|
|
3519
|
+
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',
|
|
3520
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3521
|
+
default: "mirror",
|
|
3522
|
+
type: "string"
|
|
3523
|
+
})
|
|
3524
|
+
)
|
|
2981
3525
|
)
|
|
2982
3526
|
)
|
|
2983
3527
|
),
|
|
@@ -3026,9 +3570,11 @@ var SignalRemoveModule = {
|
|
|
3026
3570
|
command: "remove <id>",
|
|
3027
3571
|
aliases: ["delete", "rm"],
|
|
3028
3572
|
describe: "Delete a signal",
|
|
3029
|
-
builder: (
|
|
3030
|
-
|
|
3031
|
-
|
|
3573
|
+
builder: (yargs23) => withConfiguration(
|
|
3574
|
+
withApiOptions(
|
|
3575
|
+
withProjectOptions(
|
|
3576
|
+
yargs23.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
3577
|
+
)
|
|
3032
3578
|
)
|
|
3033
3579
|
),
|
|
3034
3580
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -3044,8 +3590,12 @@ var SignalUpdateModule = {
|
|
|
3044
3590
|
command: "update <filename>",
|
|
3045
3591
|
aliases: ["put"],
|
|
3046
3592
|
describe: "Insert or update a signal",
|
|
3047
|
-
builder: (
|
|
3048
|
-
|
|
3593
|
+
builder: (yargs23) => withConfiguration(
|
|
3594
|
+
withApiOptions(
|
|
3595
|
+
withProjectOptions(
|
|
3596
|
+
yargs23.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
3597
|
+
)
|
|
3598
|
+
)
|
|
3049
3599
|
),
|
|
3050
3600
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
3051
3601
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3060,24 +3610,26 @@ var SignalModule = {
|
|
|
3060
3610
|
command: "signal <command>",
|
|
3061
3611
|
aliases: ["sig"],
|
|
3062
3612
|
describe: "Commands for Context signals",
|
|
3063
|
-
builder: (
|
|
3613
|
+
builder: (yargs23) => yargs23.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
3064
3614
|
handler: () => {
|
|
3065
|
-
|
|
3615
|
+
yargs11.help();
|
|
3066
3616
|
}
|
|
3067
3617
|
};
|
|
3068
3618
|
|
|
3069
3619
|
// src/commands/context/commands/test.ts
|
|
3070
|
-
import
|
|
3620
|
+
import yargs12 from "yargs";
|
|
3071
3621
|
|
|
3072
3622
|
// src/commands/context/commands/test/get.ts
|
|
3073
3623
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
3074
3624
|
var TestGetModule = {
|
|
3075
3625
|
command: "get <id>",
|
|
3076
3626
|
describe: "Fetch a test",
|
|
3077
|
-
builder: (
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3627
|
+
builder: (yargs23) => withConfiguration(
|
|
3628
|
+
withFormatOptions(
|
|
3629
|
+
withApiOptions(
|
|
3630
|
+
withProjectOptions(
|
|
3631
|
+
yargs23.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
3632
|
+
)
|
|
3081
3633
|
)
|
|
3082
3634
|
)
|
|
3083
3635
|
),
|
|
@@ -3100,7 +3652,7 @@ var TestListModule = {
|
|
|
3100
3652
|
command: "list",
|
|
3101
3653
|
describe: "List tests",
|
|
3102
3654
|
aliases: ["ls"],
|
|
3103
|
-
builder: (
|
|
3655
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
3104
3656
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3105
3657
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3106
3658
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3149,30 +3701,32 @@ function createTestEngineDataSource({
|
|
|
3149
3701
|
var TestPullModule = {
|
|
3150
3702
|
command: "pull <directory>",
|
|
3151
3703
|
describe: "Pulls all tests to local files in a directory",
|
|
3152
|
-
builder: (
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3704
|
+
builder: (yargs23) => withConfiguration(
|
|
3705
|
+
withApiOptions(
|
|
3706
|
+
withProjectOptions(
|
|
3707
|
+
withDiffOptions(
|
|
3708
|
+
yargs23.positional("directory", {
|
|
3709
|
+
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.",
|
|
3710
|
+
type: "string"
|
|
3711
|
+
}).option("format", {
|
|
3712
|
+
alias: ["f"],
|
|
3713
|
+
describe: "Output format",
|
|
3714
|
+
default: "yaml",
|
|
3715
|
+
choices: ["yaml", "json"],
|
|
3716
|
+
type: "string"
|
|
3717
|
+
}).option("what-if", {
|
|
3718
|
+
alias: ["w"],
|
|
3719
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3720
|
+
default: false,
|
|
3721
|
+
type: "boolean"
|
|
3722
|
+
}).option("mode", {
|
|
3723
|
+
alias: ["m"],
|
|
3724
|
+
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',
|
|
3725
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3726
|
+
default: "mirror",
|
|
3727
|
+
type: "string"
|
|
3728
|
+
})
|
|
3729
|
+
)
|
|
3176
3730
|
)
|
|
3177
3731
|
)
|
|
3178
3732
|
),
|
|
@@ -3226,24 +3780,26 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
3226
3780
|
var TestPushModule = {
|
|
3227
3781
|
command: "push <directory>",
|
|
3228
3782
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
3229
|
-
builder: (
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3783
|
+
builder: (yargs23) => withConfiguration(
|
|
3784
|
+
withApiOptions(
|
|
3785
|
+
withProjectOptions(
|
|
3786
|
+
withDiffOptions(
|
|
3787
|
+
yargs23.positional("directory", {
|
|
3788
|
+
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
3789
|
+
type: "string"
|
|
3790
|
+
}).option("what-if", {
|
|
3791
|
+
alias: ["w"],
|
|
3792
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3793
|
+
default: false,
|
|
3794
|
+
type: "boolean"
|
|
3795
|
+
}).option("mode", {
|
|
3796
|
+
alias: ["m"],
|
|
3797
|
+
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',
|
|
3798
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3799
|
+
default: "mirror",
|
|
3800
|
+
type: "string"
|
|
3801
|
+
})
|
|
3802
|
+
)
|
|
3247
3803
|
)
|
|
3248
3804
|
)
|
|
3249
3805
|
),
|
|
@@ -3292,8 +3848,12 @@ var TestRemoveModule = {
|
|
|
3292
3848
|
command: "remove <id>",
|
|
3293
3849
|
aliases: ["delete", "rm"],
|
|
3294
3850
|
describe: "Delete a test",
|
|
3295
|
-
builder: (
|
|
3296
|
-
|
|
3851
|
+
builder: (yargs23) => withConfiguration(
|
|
3852
|
+
withApiOptions(
|
|
3853
|
+
withProjectOptions(
|
|
3854
|
+
yargs23.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
3855
|
+
)
|
|
3856
|
+
)
|
|
3297
3857
|
),
|
|
3298
3858
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
3299
3859
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3308,8 +3868,10 @@ var TestUpdateModule = {
|
|
|
3308
3868
|
command: "update <filename>",
|
|
3309
3869
|
aliases: ["put"],
|
|
3310
3870
|
describe: "Insert or update a test",
|
|
3311
|
-
builder: (
|
|
3312
|
-
|
|
3871
|
+
builder: (yargs23) => withConfiguration(
|
|
3872
|
+
withApiOptions(
|
|
3873
|
+
withProjectOptions(yargs23.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
3874
|
+
)
|
|
3313
3875
|
),
|
|
3314
3876
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
3315
3877
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3323,9 +3885,9 @@ var TestUpdateModule = {
|
|
|
3323
3885
|
var TestModule = {
|
|
3324
3886
|
command: "test <command>",
|
|
3325
3887
|
describe: "Commands for Context A/B tests",
|
|
3326
|
-
builder: (
|
|
3888
|
+
builder: (yargs23) => yargs23.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
3327
3889
|
handler: () => {
|
|
3328
|
-
|
|
3890
|
+
yargs12.help();
|
|
3329
3891
|
}
|
|
3330
3892
|
};
|
|
3331
3893
|
|
|
@@ -3334,9 +3896,9 @@ var ContextCommand = {
|
|
|
3334
3896
|
command: "context <command>",
|
|
3335
3897
|
aliases: ["ctx"],
|
|
3336
3898
|
describe: "Uniform Context commands",
|
|
3337
|
-
builder: (
|
|
3899
|
+
builder: (yargs23) => yargs23.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
3338
3900
|
handler: () => {
|
|
3339
|
-
|
|
3901
|
+
yargs13.showHelp();
|
|
3340
3902
|
}
|
|
3341
3903
|
};
|
|
3342
3904
|
|
|
@@ -3364,11 +3926,11 @@ import { PostHog } from "posthog-node";
|
|
|
3364
3926
|
// package.json
|
|
3365
3927
|
var package_default = {
|
|
3366
3928
|
name: "@uniformdev/cli",
|
|
3367
|
-
version: "19.
|
|
3929
|
+
version: "19.42.0",
|
|
3368
3930
|
description: "Uniform command line interface tool",
|
|
3369
3931
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
3370
3932
|
main: "./cli.js",
|
|
3371
|
-
types: "./dist/index.d.
|
|
3933
|
+
types: "./dist/index.d.mts",
|
|
3372
3934
|
sideEffects: false,
|
|
3373
3935
|
scripts: {
|
|
3374
3936
|
uniform: "node ./cli.js",
|
|
@@ -3380,12 +3942,15 @@ var package_default = {
|
|
|
3380
3942
|
format: 'prettier --write "src/**/*.{js,ts,tsx}"'
|
|
3381
3943
|
},
|
|
3382
3944
|
dependencies: {
|
|
3945
|
+
"@thi.ng/mime": "^2.2.23",
|
|
3383
3946
|
"@uniformdev/canvas": "workspace:*",
|
|
3384
3947
|
"@uniformdev/context": "workspace:*",
|
|
3948
|
+
"@uniformdev/files-sdk": "workspace:*",
|
|
3385
3949
|
"@uniformdev/project-map": "workspace:*",
|
|
3386
3950
|
"@uniformdev/redirect": "workspace:*",
|
|
3387
3951
|
colorette: "2.0.20",
|
|
3388
|
-
cosmiconfig: "
|
|
3952
|
+
cosmiconfig: "8.2.0",
|
|
3953
|
+
"cosmiconfig-typescript-loader": "5.0.0",
|
|
3389
3954
|
diff: "^5.0.0",
|
|
3390
3955
|
dotenv: "^16.0.3",
|
|
3391
3956
|
execa: "5.1.1",
|
|
@@ -3393,6 +3958,7 @@ var package_default = {
|
|
|
3393
3958
|
graphql: "16.7.1",
|
|
3394
3959
|
"graphql-request": "6.1.0",
|
|
3395
3960
|
"https-proxy-agent": "^7.0.0",
|
|
3961
|
+
"image-size": "^1.0.2",
|
|
3396
3962
|
inquirer: "9.2.9",
|
|
3397
3963
|
"isomorphic-git": "1.24.5",
|
|
3398
3964
|
"isomorphic-unfetch": "^3.1.0",
|
|
@@ -3401,6 +3967,7 @@ var package_default = {
|
|
|
3401
3967
|
"lodash.isequalwith": "^4.4.0",
|
|
3402
3968
|
open: "9.1.0",
|
|
3403
3969
|
ora: "6.3.1",
|
|
3970
|
+
"p-queue": "7.3.4",
|
|
3404
3971
|
"posthog-node": "3.1.1",
|
|
3405
3972
|
slugify: "1.6.6",
|
|
3406
3973
|
"update-check": "^1.5.4",
|
|
@@ -3737,8 +4304,8 @@ ${err.message}`);
|
|
|
3737
4304
|
|
|
3738
4305
|
// src/projects/cloneStarter.ts
|
|
3739
4306
|
import crypto2 from "crypto";
|
|
3740
|
-
import
|
|
3741
|
-
import
|
|
4307
|
+
import fs3 from "fs";
|
|
4308
|
+
import fsj2 from "fs-jetpack";
|
|
3742
4309
|
import * as git from "isomorphic-git";
|
|
3743
4310
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
3744
4311
|
import os from "os";
|
|
@@ -3754,7 +4321,7 @@ async function cloneStarter({
|
|
|
3754
4321
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
3755
4322
|
try {
|
|
3756
4323
|
await git.clone({
|
|
3757
|
-
fs:
|
|
4324
|
+
fs: fs3,
|
|
3758
4325
|
http,
|
|
3759
4326
|
url: `https://github.com/${user}/${repo}`,
|
|
3760
4327
|
dir: cloneDir,
|
|
@@ -3765,13 +4332,13 @@ async function cloneStarter({
|
|
|
3765
4332
|
throw new Error(`Failed to fetch starter code: ${err.message}`);
|
|
3766
4333
|
}
|
|
3767
4334
|
await done();
|
|
3768
|
-
if (
|
|
4335
|
+
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
3769
4336
|
throw new Error(`"${targetDir}" is not empty`);
|
|
3770
4337
|
}
|
|
3771
4338
|
const starterDir = path.join(cloneDir, ...pathSegments);
|
|
3772
|
-
|
|
4339
|
+
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
3773
4340
|
if (dotEnvFile) {
|
|
3774
|
-
|
|
4341
|
+
fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
3775
4342
|
}
|
|
3776
4343
|
console.log(`
|
|
3777
4344
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -3787,7 +4354,7 @@ Installing project dependencies...
|
|
|
3787
4354
|
}
|
|
3788
4355
|
|
|
3789
4356
|
// src/projects/getOrCreateProject.ts
|
|
3790
|
-
import
|
|
4357
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
3791
4358
|
import inquirer2 from "inquirer";
|
|
3792
4359
|
import path2 from "path";
|
|
3793
4360
|
import slugify from "slugify";
|
|
@@ -3914,9 +4481,9 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
3914
4481
|
if (!existsSync2(targetDir)) {
|
|
3915
4482
|
mkdirSync2(targetDir, { recursive: true });
|
|
3916
4483
|
}
|
|
3917
|
-
if (
|
|
4484
|
+
if (fs4.readdirSync(targetDir).length > 0) {
|
|
3918
4485
|
targetDir = path2.resolve(targetDir, projectNameSlug);
|
|
3919
|
-
if (
|
|
4486
|
+
if (fs4.existsSync(targetDir)) {
|
|
3920
4487
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
3921
4488
|
}
|
|
3922
4489
|
}
|
|
@@ -4324,24 +4891,26 @@ var disableTelemetryDefault = !["", "0", "false", "no"].includes(
|
|
|
4324
4891
|
);
|
|
4325
4892
|
var NewCmd = {
|
|
4326
4893
|
command: "new [name]",
|
|
4327
|
-
builder: (y) =>
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4894
|
+
builder: (y) => withConfiguration(
|
|
4895
|
+
y.positional("name", {
|
|
4896
|
+
describe: "Name of a project",
|
|
4897
|
+
type: "string"
|
|
4898
|
+
}).option("apiHost", {
|
|
4899
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or ${stableApiHost}. Supports dotenv.`,
|
|
4900
|
+
default: apiHostDefault,
|
|
4901
|
+
demandOption: true,
|
|
4902
|
+
type: "string"
|
|
4903
|
+
}).option("outputPath", {
|
|
4904
|
+
alias: "o",
|
|
4905
|
+
description: "Specify where to store integration files. Defaults to cwd.",
|
|
4906
|
+
type: "string"
|
|
4907
|
+
}).option("disableTelemetry", {
|
|
4908
|
+
describe: "By default, usage information is sent to Uniform. Use this option or set UNIFORM_CLI_DISABLE_TELEMETRY to disable telemetry.",
|
|
4909
|
+
default: disableTelemetryDefault,
|
|
4910
|
+
demandOption: true,
|
|
4911
|
+
type: "boolean"
|
|
4912
|
+
})
|
|
4913
|
+
),
|
|
4345
4914
|
describe: "Start a new Uniform project",
|
|
4346
4915
|
handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
|
|
4347
4916
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
@@ -4362,21 +4931,23 @@ var NewCmd = {
|
|
|
4362
4931
|
};
|
|
4363
4932
|
var NewMeshCmd = {
|
|
4364
4933
|
command: "new-integration",
|
|
4365
|
-
builder: (y) =>
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4934
|
+
builder: (y) => withConfiguration(
|
|
4935
|
+
y.option("apiHost", {
|
|
4936
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or ${stableApiHost}. Supports dotenv.`,
|
|
4937
|
+
default: apiHostDefault,
|
|
4938
|
+
demandOption: true,
|
|
4939
|
+
type: "string"
|
|
4940
|
+
}).option("outputPath", {
|
|
4941
|
+
alias: "o",
|
|
4942
|
+
description: "Specify where to store integration files. Defaults to cwd.",
|
|
4943
|
+
type: "string"
|
|
4944
|
+
}).option("disableTelemetry", {
|
|
4945
|
+
describe: "By default, usage information is sent to Uniform. Use this option or set UNIFORM_CLI_DISABLE_TELEMETRY to disable telemetry.",
|
|
4946
|
+
default: disableTelemetryDefault,
|
|
4947
|
+
demandOption: true,
|
|
4948
|
+
type: "boolean"
|
|
4949
|
+
})
|
|
4950
|
+
),
|
|
4380
4951
|
describe: "Start a new Uniform project",
|
|
4381
4952
|
handler: async function({ apiHost, outputPath, disableTelemetry }) {
|
|
4382
4953
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
@@ -4397,10 +4968,10 @@ var NewMeshCmd = {
|
|
|
4397
4968
|
};
|
|
4398
4969
|
|
|
4399
4970
|
// src/commands/optimize/index.ts
|
|
4400
|
-
import
|
|
4971
|
+
import yargs15 from "yargs";
|
|
4401
4972
|
|
|
4402
4973
|
// src/commands/optimize/manifest.ts
|
|
4403
|
-
import
|
|
4974
|
+
import yargs14 from "yargs";
|
|
4404
4975
|
|
|
4405
4976
|
// src/commands/optimize/manifest/download.ts
|
|
4406
4977
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -4415,7 +4986,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
4415
4986
|
var module = {
|
|
4416
4987
|
command: "download [output]",
|
|
4417
4988
|
describe: "Download intent manifest",
|
|
4418
|
-
builder: (
|
|
4989
|
+
builder: (yargs23) => yargs23.option("apiKey", {
|
|
4419
4990
|
alias: "k",
|
|
4420
4991
|
demandOption: true,
|
|
4421
4992
|
string: true,
|
|
@@ -4516,10 +5087,10 @@ var module2 = {
|
|
|
4516
5087
|
command: "manifest <command>",
|
|
4517
5088
|
describe: "Intent manifest commands",
|
|
4518
5089
|
builder: () => {
|
|
4519
|
-
return
|
|
5090
|
+
return yargs14.command(download_default);
|
|
4520
5091
|
},
|
|
4521
5092
|
handler: () => {
|
|
4522
|
-
|
|
5093
|
+
yargs14.showHelp();
|
|
4523
5094
|
}
|
|
4524
5095
|
};
|
|
4525
5096
|
var manifest_default = module2;
|
|
@@ -4530,28 +5101,30 @@ var OptimizeCommand = {
|
|
|
4530
5101
|
aliases: ["opt"],
|
|
4531
5102
|
describe: "Uniform Optimize commands",
|
|
4532
5103
|
builder: () => {
|
|
4533
|
-
return
|
|
5104
|
+
return yargs15.command(manifest_default);
|
|
4534
5105
|
},
|
|
4535
5106
|
handler: () => {
|
|
4536
|
-
|
|
5107
|
+
yargs15.showHelp();
|
|
4537
5108
|
}
|
|
4538
5109
|
};
|
|
4539
5110
|
|
|
4540
5111
|
// src/commands/project-map/index.ts
|
|
4541
|
-
import
|
|
5112
|
+
import yargs18 from "yargs";
|
|
4542
5113
|
|
|
4543
5114
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
4544
|
-
import
|
|
5115
|
+
import yargs16 from "yargs";
|
|
4545
5116
|
|
|
4546
5117
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
4547
5118
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
4548
5119
|
var ProjectMapDefinitionGetModule = {
|
|
4549
5120
|
command: "get <id>",
|
|
4550
5121
|
describe: "Fetch a project map",
|
|
4551
|
-
builder: (
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
5122
|
+
builder: (yargs23) => withFormatOptions(
|
|
5123
|
+
withConfiguration(
|
|
5124
|
+
withApiOptions(
|
|
5125
|
+
withProjectOptions(
|
|
5126
|
+
yargs23.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
5127
|
+
)
|
|
4555
5128
|
)
|
|
4556
5129
|
)
|
|
4557
5130
|
),
|
|
@@ -4574,7 +5147,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
4574
5147
|
command: "list",
|
|
4575
5148
|
describe: "List of project maps",
|
|
4576
5149
|
aliases: ["ls"],
|
|
4577
|
-
builder: (
|
|
5150
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
4578
5151
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4579
5152
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4580
5153
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4631,30 +5204,32 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
4631
5204
|
var ProjectMapDefinitionPullModule = {
|
|
4632
5205
|
command: "pull <directory>",
|
|
4633
5206
|
describe: "Pulls all project maps to local files in a directory",
|
|
4634
|
-
builder: (
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
5207
|
+
builder: (yargs23) => withConfiguration(
|
|
5208
|
+
withApiOptions(
|
|
5209
|
+
withProjectOptions(
|
|
5210
|
+
withDiffOptions(
|
|
5211
|
+
yargs23.positional("directory", {
|
|
5212
|
+
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.",
|
|
5213
|
+
type: "string"
|
|
5214
|
+
}).option("format", {
|
|
5215
|
+
alias: ["f"],
|
|
5216
|
+
describe: "Output format",
|
|
5217
|
+
default: "yaml",
|
|
5218
|
+
choices: ["yaml", "json"],
|
|
5219
|
+
type: "string"
|
|
5220
|
+
}).option("what-if", {
|
|
5221
|
+
alias: ["w"],
|
|
5222
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5223
|
+
default: false,
|
|
5224
|
+
type: "boolean"
|
|
5225
|
+
}).option("mode", {
|
|
5226
|
+
alias: ["m"],
|
|
5227
|
+
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',
|
|
5228
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5229
|
+
default: "mirror",
|
|
5230
|
+
type: "string"
|
|
5231
|
+
})
|
|
5232
|
+
)
|
|
4658
5233
|
)
|
|
4659
5234
|
)
|
|
4660
5235
|
),
|
|
@@ -4708,24 +5283,26 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
4708
5283
|
var ProjectMapDefinitionPushModule = {
|
|
4709
5284
|
command: "push <directory>",
|
|
4710
5285
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
4711
|
-
builder: (
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
5286
|
+
builder: (yargs23) => withConfiguration(
|
|
5287
|
+
withApiOptions(
|
|
5288
|
+
withProjectOptions(
|
|
5289
|
+
withDiffOptions(
|
|
5290
|
+
yargs23.positional("directory", {
|
|
5291
|
+
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
5292
|
+
type: "string"
|
|
5293
|
+
}).option("what-if", {
|
|
5294
|
+
alias: ["w"],
|
|
5295
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5296
|
+
default: false,
|
|
5297
|
+
type: "boolean"
|
|
5298
|
+
}).option("mode", {
|
|
5299
|
+
alias: ["m"],
|
|
5300
|
+
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',
|
|
5301
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5302
|
+
default: "mirror",
|
|
5303
|
+
type: "string"
|
|
5304
|
+
})
|
|
5305
|
+
)
|
|
4729
5306
|
)
|
|
4730
5307
|
)
|
|
4731
5308
|
),
|
|
@@ -4774,8 +5351,10 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
4774
5351
|
command: "remove <id>",
|
|
4775
5352
|
aliases: ["delete", "rm"],
|
|
4776
5353
|
describe: "Delete a project map",
|
|
4777
|
-
builder: (
|
|
4778
|
-
|
|
5354
|
+
builder: (yargs23) => withConfiguration(
|
|
5355
|
+
withApiOptions(
|
|
5356
|
+
withProjectOptions(yargs23.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
5357
|
+
)
|
|
4779
5358
|
),
|
|
4780
5359
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
4781
5360
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4790,9 +5369,11 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4790
5369
|
command: "update <filename>",
|
|
4791
5370
|
aliases: ["put"],
|
|
4792
5371
|
describe: "Insert or update a project map",
|
|
4793
|
-
builder: (
|
|
4794
|
-
|
|
4795
|
-
|
|
5372
|
+
builder: (yargs23) => withConfiguration(
|
|
5373
|
+
withApiOptions(
|
|
5374
|
+
withProjectOptions(
|
|
5375
|
+
yargs23.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
5376
|
+
)
|
|
4796
5377
|
)
|
|
4797
5378
|
),
|
|
4798
5379
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -4807,24 +5388,26 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4807
5388
|
var ProjectMapDefinitionModule = {
|
|
4808
5389
|
command: "definition <command>",
|
|
4809
5390
|
describe: "Commands for ProjectMap Definitions",
|
|
4810
|
-
builder: (
|
|
5391
|
+
builder: (yargs23) => yargs23.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
4811
5392
|
handler: () => {
|
|
4812
|
-
|
|
5393
|
+
yargs16.help();
|
|
4813
5394
|
}
|
|
4814
5395
|
};
|
|
4815
5396
|
|
|
4816
5397
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
4817
|
-
import
|
|
5398
|
+
import yargs17 from "yargs";
|
|
4818
5399
|
|
|
4819
5400
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
4820
5401
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
4821
5402
|
var ProjectMapNodeGetModule = {
|
|
4822
5403
|
command: "get <id> <projectMapId>",
|
|
4823
5404
|
describe: "Fetch a project map node",
|
|
4824
|
-
builder: (
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
5405
|
+
builder: (yargs23) => withConfiguration(
|
|
5406
|
+
withFormatOptions(
|
|
5407
|
+
withApiOptions(
|
|
5408
|
+
withProjectOptions(
|
|
5409
|
+
yargs23.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
5410
|
+
)
|
|
4828
5411
|
)
|
|
4829
5412
|
)
|
|
4830
5413
|
),
|
|
@@ -4849,10 +5432,15 @@ var ProjectMapNodeListModule = {
|
|
|
4849
5432
|
command: "list <projectMapId>",
|
|
4850
5433
|
describe: "List project map nodes",
|
|
4851
5434
|
aliases: ["ls"],
|
|
4852
|
-
builder: (
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
5435
|
+
builder: (yargs23) => withConfiguration(
|
|
5436
|
+
withFormatOptions(
|
|
5437
|
+
withApiOptions(
|
|
5438
|
+
withProjectOptions(
|
|
5439
|
+
yargs23.positional("projectMapId", {
|
|
5440
|
+
demandOption: true,
|
|
5441
|
+
describe: "ProjectMap UUID to fetch from"
|
|
5442
|
+
})
|
|
5443
|
+
)
|
|
4856
5444
|
)
|
|
4857
5445
|
)
|
|
4858
5446
|
),
|
|
@@ -4919,30 +5507,32 @@ function createProjectMapNodeEngineDataSource({
|
|
|
4919
5507
|
var ProjectMapNodePullModule = {
|
|
4920
5508
|
command: "pull <directory>",
|
|
4921
5509
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
4922
|
-
builder: (
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
5510
|
+
builder: (yargs23) => withConfiguration(
|
|
5511
|
+
withApiOptions(
|
|
5512
|
+
withProjectOptions(
|
|
5513
|
+
withDiffOptions(
|
|
5514
|
+
yargs23.positional("directory", {
|
|
5515
|
+
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.",
|
|
5516
|
+
type: "string"
|
|
5517
|
+
}).option("format", {
|
|
5518
|
+
alias: ["f"],
|
|
5519
|
+
describe: "Output format",
|
|
5520
|
+
default: "yaml",
|
|
5521
|
+
choices: ["yaml", "json"],
|
|
5522
|
+
type: "string"
|
|
5523
|
+
}).option("what-if", {
|
|
5524
|
+
alias: ["w"],
|
|
5525
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5526
|
+
default: false,
|
|
5527
|
+
type: "boolean"
|
|
5528
|
+
}).option("mode", {
|
|
5529
|
+
alias: ["m"],
|
|
5530
|
+
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',
|
|
5531
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5532
|
+
default: "mirror",
|
|
5533
|
+
type: "string"
|
|
5534
|
+
})
|
|
5535
|
+
)
|
|
4946
5536
|
)
|
|
4947
5537
|
)
|
|
4948
5538
|
),
|
|
@@ -5000,24 +5590,26 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
5000
5590
|
var ProjectMapNodePushModule = {
|
|
5001
5591
|
command: "push <directory>",
|
|
5002
5592
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
5003
|
-
builder: (
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5593
|
+
builder: (yargs23) => withConfiguration(
|
|
5594
|
+
withApiOptions(
|
|
5595
|
+
withProjectOptions(
|
|
5596
|
+
withDiffOptions(
|
|
5597
|
+
yargs23.positional("directory", {
|
|
5598
|
+
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
5599
|
+
type: "string"
|
|
5600
|
+
}).option("what-if", {
|
|
5601
|
+
alias: ["w"],
|
|
5602
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5603
|
+
default: false,
|
|
5604
|
+
type: "boolean"
|
|
5605
|
+
}).option("mode", {
|
|
5606
|
+
alias: ["m"],
|
|
5607
|
+
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',
|
|
5608
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5609
|
+
default: "mirror",
|
|
5610
|
+
type: "string"
|
|
5611
|
+
})
|
|
5612
|
+
)
|
|
5021
5613
|
)
|
|
5022
5614
|
)
|
|
5023
5615
|
),
|
|
@@ -5075,9 +5667,11 @@ var ProjectMapNodeRemoveModule = {
|
|
|
5075
5667
|
command: "remove <id> <projectMapId>",
|
|
5076
5668
|
aliases: ["delete", "rm"],
|
|
5077
5669
|
describe: "Delete a project map node",
|
|
5078
|
-
builder: (
|
|
5079
|
-
|
|
5080
|
-
|
|
5670
|
+
builder: (yargs23) => withConfiguration(
|
|
5671
|
+
withApiOptions(
|
|
5672
|
+
withProjectOptions(
|
|
5673
|
+
yargs23.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
5674
|
+
)
|
|
5081
5675
|
)
|
|
5082
5676
|
),
|
|
5083
5677
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, id, project: projectId }) => {
|
|
@@ -5093,9 +5687,11 @@ var ProjectMapNodeUpdateModule = {
|
|
|
5093
5687
|
command: "update <filename> <projectMapId>",
|
|
5094
5688
|
aliases: ["put"],
|
|
5095
5689
|
describe: "Insert or update a project map node",
|
|
5096
|
-
builder: (
|
|
5097
|
-
|
|
5098
|
-
|
|
5690
|
+
builder: (yargs23) => withConfiguration(
|
|
5691
|
+
withApiOptions(
|
|
5692
|
+
withProjectOptions(
|
|
5693
|
+
yargs23.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
5694
|
+
)
|
|
5099
5695
|
)
|
|
5100
5696
|
),
|
|
5101
5697
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, filename, project: projectId }) => {
|
|
@@ -5110,9 +5706,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
5110
5706
|
var ProjectMapNodeModule = {
|
|
5111
5707
|
command: "node <command>",
|
|
5112
5708
|
describe: "Commands for ProjectMap Nodes",
|
|
5113
|
-
builder: (
|
|
5709
|
+
builder: (yargs23) => yargs23.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
5114
5710
|
handler: () => {
|
|
5115
|
-
|
|
5711
|
+
yargs17.help();
|
|
5116
5712
|
}
|
|
5117
5713
|
};
|
|
5118
5714
|
|
|
@@ -5121,26 +5717,30 @@ var ProjectMapCommand = {
|
|
|
5121
5717
|
command: "project-map <command>",
|
|
5122
5718
|
aliases: ["prm"],
|
|
5123
5719
|
describe: "Uniform ProjectMap commands",
|
|
5124
|
-
builder: (
|
|
5720
|
+
builder: (yargs23) => yargs23.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
5125
5721
|
handler: () => {
|
|
5126
|
-
|
|
5722
|
+
yargs18.showHelp();
|
|
5127
5723
|
}
|
|
5128
5724
|
};
|
|
5129
5725
|
|
|
5130
5726
|
// src/commands/redirect/index.ts
|
|
5131
|
-
import
|
|
5727
|
+
import yargs20 from "yargs";
|
|
5132
5728
|
|
|
5133
5729
|
// src/commands/redirect/commands/redirect.ts
|
|
5134
|
-
import
|
|
5730
|
+
import yargs19 from "yargs";
|
|
5135
5731
|
|
|
5136
5732
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
5137
5733
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
5138
5734
|
var RedirectDefinitionGetModule = {
|
|
5139
5735
|
command: "get <id>",
|
|
5140
5736
|
describe: "Fetch a redirect",
|
|
5141
|
-
builder: (
|
|
5142
|
-
|
|
5143
|
-
|
|
5737
|
+
builder: (yargs23) => withConfiguration(
|
|
5738
|
+
withFormatOptions(
|
|
5739
|
+
withApiOptions(
|
|
5740
|
+
withProjectOptions(
|
|
5741
|
+
yargs23.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
5742
|
+
)
|
|
5743
|
+
)
|
|
5144
5744
|
)
|
|
5145
5745
|
),
|
|
5146
5746
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
@@ -5162,7 +5762,7 @@ var RedirectDefinitionListModule = {
|
|
|
5162
5762
|
command: "list",
|
|
5163
5763
|
describe: "List of redirects",
|
|
5164
5764
|
aliases: ["ls"],
|
|
5165
|
-
builder: (
|
|
5765
|
+
builder: (yargs23) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs23)))),
|
|
5166
5766
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5167
5767
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5168
5768
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5228,30 +5828,32 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
5228
5828
|
var RedirectDefinitionPullModule = {
|
|
5229
5829
|
command: "pull <directory>",
|
|
5230
5830
|
describe: "Pulls all redirects to local files in a directory",
|
|
5231
|
-
builder: (
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5831
|
+
builder: (yargs23) => withConfiguration(
|
|
5832
|
+
withApiOptions(
|
|
5833
|
+
withProjectOptions(
|
|
5834
|
+
withDiffOptions(
|
|
5835
|
+
yargs23.positional("directory", {
|
|
5836
|
+
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.",
|
|
5837
|
+
type: "string"
|
|
5838
|
+
}).option("format", {
|
|
5839
|
+
alias: ["f"],
|
|
5840
|
+
describe: "Output format",
|
|
5841
|
+
default: "yaml",
|
|
5842
|
+
choices: ["yaml", "json"],
|
|
5843
|
+
type: "string"
|
|
5844
|
+
}).option("what-if", {
|
|
5845
|
+
alias: ["w"],
|
|
5846
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5847
|
+
default: false,
|
|
5848
|
+
type: "boolean"
|
|
5849
|
+
}).option("mode", {
|
|
5850
|
+
alias: ["m"],
|
|
5851
|
+
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',
|
|
5852
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5853
|
+
default: "mirror",
|
|
5854
|
+
type: "string"
|
|
5855
|
+
})
|
|
5856
|
+
)
|
|
5255
5857
|
)
|
|
5256
5858
|
)
|
|
5257
5859
|
),
|
|
@@ -5306,24 +5908,26 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
5306
5908
|
var RedirectDefinitionPushModule = {
|
|
5307
5909
|
command: "push <directory>",
|
|
5308
5910
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
5309
|
-
builder: (
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5911
|
+
builder: (yargs23) => withConfiguration(
|
|
5912
|
+
withApiOptions(
|
|
5913
|
+
withProjectOptions(
|
|
5914
|
+
withDiffOptions(
|
|
5915
|
+
yargs23.positional("directory", {
|
|
5916
|
+
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
5917
|
+
type: "string"
|
|
5918
|
+
}).option("what-if", {
|
|
5919
|
+
alias: ["w"],
|
|
5920
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
5921
|
+
default: false,
|
|
5922
|
+
type: "boolean"
|
|
5923
|
+
}).option("mode", {
|
|
5924
|
+
alias: ["m"],
|
|
5925
|
+
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',
|
|
5926
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5927
|
+
default: "mirror",
|
|
5928
|
+
type: "string"
|
|
5929
|
+
})
|
|
5930
|
+
)
|
|
5327
5931
|
)
|
|
5328
5932
|
)
|
|
5329
5933
|
),
|
|
@@ -5372,8 +5976,10 @@ var RedirectDefinitionRemoveModule = {
|
|
|
5372
5976
|
command: "remove <id>",
|
|
5373
5977
|
aliases: ["delete", "rm"],
|
|
5374
5978
|
describe: "Delete a redirect",
|
|
5375
|
-
builder: (
|
|
5376
|
-
|
|
5979
|
+
builder: (yargs23) => withConfiguration(
|
|
5980
|
+
withApiOptions(
|
|
5981
|
+
withProjectOptions(yargs23.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
5982
|
+
)
|
|
5377
5983
|
),
|
|
5378
5984
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
5379
5985
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -5388,9 +5994,11 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5388
5994
|
command: "update <filename>",
|
|
5389
5995
|
aliases: ["put"],
|
|
5390
5996
|
describe: "Insert or update a redirect",
|
|
5391
|
-
builder: (
|
|
5392
|
-
|
|
5393
|
-
|
|
5997
|
+
builder: (yargs23) => withConfiguration(
|
|
5998
|
+
withApiOptions(
|
|
5999
|
+
withProjectOptions(
|
|
6000
|
+
yargs23.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
6001
|
+
)
|
|
5394
6002
|
)
|
|
5395
6003
|
),
|
|
5396
6004
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5405,9 +6013,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5405
6013
|
var RedirectDefinitionModule = {
|
|
5406
6014
|
command: "definition <command>",
|
|
5407
6015
|
describe: "Commands for Redirect Definitions",
|
|
5408
|
-
builder: (
|
|
6016
|
+
builder: (yargs23) => yargs23.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
5409
6017
|
handler: () => {
|
|
5410
|
-
|
|
6018
|
+
yargs19.help();
|
|
5411
6019
|
}
|
|
5412
6020
|
};
|
|
5413
6021
|
|
|
@@ -5416,9 +6024,179 @@ var RedirectCommand = {
|
|
|
5416
6024
|
command: "redirect <command>",
|
|
5417
6025
|
aliases: ["red"],
|
|
5418
6026
|
describe: "Uniform Redirect commands",
|
|
5419
|
-
builder: (
|
|
6027
|
+
builder: (yargs23) => yargs23.command(RedirectDefinitionModule).demandCommand(),
|
|
6028
|
+
handler: () => {
|
|
6029
|
+
yargs20.showHelp();
|
|
6030
|
+
}
|
|
6031
|
+
};
|
|
6032
|
+
|
|
6033
|
+
// src/commands/sync/index.ts
|
|
6034
|
+
import yargs21 from "yargs";
|
|
6035
|
+
|
|
6036
|
+
// src/commands/sync/commands/pull.ts
|
|
6037
|
+
var SyncPullModule = {
|
|
6038
|
+
command: "pull",
|
|
6039
|
+
describe: "Pulls whole project to local files in a directory",
|
|
6040
|
+
builder: (yargs23) => withConfiguration(
|
|
6041
|
+
withApiOptions(
|
|
6042
|
+
withProjectOptions(
|
|
6043
|
+
withDiffOptions(
|
|
6044
|
+
yargs23.option("what-if", {
|
|
6045
|
+
alias: ["w"],
|
|
6046
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
6047
|
+
default: false,
|
|
6048
|
+
type: "boolean"
|
|
6049
|
+
})
|
|
6050
|
+
)
|
|
6051
|
+
)
|
|
6052
|
+
)
|
|
6053
|
+
),
|
|
6054
|
+
handler: async ({ serialization, ...otherParams }) => {
|
|
6055
|
+
const config2 = serialization;
|
|
6056
|
+
const enabledEntities = Object.entries({
|
|
6057
|
+
category: CategoryPullModule,
|
|
6058
|
+
dataType: DataTypePullModule,
|
|
6059
|
+
quirk: QuirkPullModule,
|
|
6060
|
+
test: TestPullModule,
|
|
6061
|
+
signal: SignalPullModule,
|
|
6062
|
+
enrichment: EnrichmentPullModule,
|
|
6063
|
+
aggregate: AggregatePullModule,
|
|
6064
|
+
component: ComponentPullModule,
|
|
6065
|
+
pattern: PatternPullModule,
|
|
6066
|
+
composition: CompositionPullModule,
|
|
6067
|
+
projectMapDefinition: ProjectMapDefinitionPullModule,
|
|
6068
|
+
projectMapNode: ProjectMapNodePullModule,
|
|
6069
|
+
redirect: RedirectDefinitionPullModule
|
|
6070
|
+
}).filter(([entityType]) => {
|
|
6071
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6072
|
+
return Boolean((_a = config2.entitiesConfig) == null ? void 0 : _a[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
6073
|
+
});
|
|
6074
|
+
for (const [entityType, module3] of enabledEntities) {
|
|
6075
|
+
await module3.handler({
|
|
6076
|
+
...otherParams,
|
|
6077
|
+
state: 0,
|
|
6078
|
+
format: getFormat(entityType, config2),
|
|
6079
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
6080
|
+
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
6081
|
+
mode: getPullMode(entityType, config2),
|
|
6082
|
+
directory: getPullFilename(entityType, config2)
|
|
6083
|
+
});
|
|
6084
|
+
}
|
|
6085
|
+
}
|
|
6086
|
+
};
|
|
6087
|
+
var getPullMode = (entityType, config2) => {
|
|
6088
|
+
return getEntityOption({
|
|
6089
|
+
optionName: "mode",
|
|
6090
|
+
operation: "pull",
|
|
6091
|
+
config: config2,
|
|
6092
|
+
entityType
|
|
6093
|
+
});
|
|
6094
|
+
};
|
|
6095
|
+
var getPullFilename = (entityType, config2) => {
|
|
6096
|
+
return getDirectoryOrFilename({
|
|
6097
|
+
operation: "pull",
|
|
6098
|
+
config: config2,
|
|
6099
|
+
entityType
|
|
6100
|
+
});
|
|
6101
|
+
};
|
|
6102
|
+
var getFormat = (entityType, config2) => {
|
|
6103
|
+
return getEntityOption({
|
|
6104
|
+
optionName: "format",
|
|
6105
|
+
operation: "pull",
|
|
6106
|
+
config: config2,
|
|
6107
|
+
entityType
|
|
6108
|
+
});
|
|
6109
|
+
};
|
|
6110
|
+
|
|
6111
|
+
// src/commands/sync/commands/push.ts
|
|
6112
|
+
var SyncPushModule = {
|
|
6113
|
+
command: "push",
|
|
6114
|
+
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
6115
|
+
builder: (yargs23) => withConfiguration(
|
|
6116
|
+
withApiOptions(
|
|
6117
|
+
withProjectOptions(
|
|
6118
|
+
withDiffOptions(
|
|
6119
|
+
yargs23.option("what-if", {
|
|
6120
|
+
alias: ["w"],
|
|
6121
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
6122
|
+
default: false,
|
|
6123
|
+
type: "boolean"
|
|
6124
|
+
})
|
|
6125
|
+
)
|
|
6126
|
+
)
|
|
6127
|
+
)
|
|
6128
|
+
),
|
|
6129
|
+
handler: async ({ serialization, ...otherParams }) => {
|
|
6130
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
6131
|
+
const config2 = serialization;
|
|
6132
|
+
const enabledEntities = Object.entries({
|
|
6133
|
+
category: CategoryPushModule,
|
|
6134
|
+
dataType: DataTypePushModule,
|
|
6135
|
+
quirk: QuirkPushModule,
|
|
6136
|
+
test: TestPushModule,
|
|
6137
|
+
signal: SignalPushModule,
|
|
6138
|
+
enrichment: EnrichmentPushModule,
|
|
6139
|
+
aggregate: AggregatePushModule,
|
|
6140
|
+
component: ComponentPushModule,
|
|
6141
|
+
pattern: PatternPushModule,
|
|
6142
|
+
composition: CompositionPushModule,
|
|
6143
|
+
projectMapDefinition: ProjectMapDefinitionPushModule,
|
|
6144
|
+
projectMapNode: ProjectMapNodePushModule,
|
|
6145
|
+
redirect: RedirectDefinitionPushModule
|
|
6146
|
+
}).filter(([entityType]) => {
|
|
6147
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
6148
|
+
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
|
|
6149
|
+
});
|
|
6150
|
+
for (const [entityType, module3] of enabledEntities) {
|
|
6151
|
+
await module3.handler({
|
|
6152
|
+
...otherParams,
|
|
6153
|
+
state: 0,
|
|
6154
|
+
format: getFormat2(entityType, config2),
|
|
6155
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
6156
|
+
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
6157
|
+
mode: getPushMode(entityType, config2),
|
|
6158
|
+
directory: getPushFilename(entityType, config2)
|
|
6159
|
+
});
|
|
6160
|
+
}
|
|
6161
|
+
if (((_a = config2.entitiesConfig) == null ? void 0 : _a.pattern) && ((_d = (_c = (_b = config2.entitiesConfig) == null ? void 0 : _b.pattern) == null ? void 0 : _c.push) == null ? void 0 : _d.disabled) !== true && ((_f = (_e = config2.entitiesConfig) == null ? void 0 : _e.pattern) == null ? void 0 : _f.publish)) {
|
|
6162
|
+
await PatternPublishModule.handler({ ...otherParams, all: true });
|
|
6163
|
+
}
|
|
6164
|
+
if (((_g = config2.entitiesConfig) == null ? void 0 : _g.composition) && ((_j = (_i = (_h = config2.entitiesConfig) == null ? void 0 : _h.composition) == null ? void 0 : _i.push) == null ? void 0 : _j.disabled) !== true && ((_l = (_k = config2.entitiesConfig) == null ? void 0 : _k.composition) == null ? void 0 : _l.publish)) {
|
|
6165
|
+
await CompositionPublishModule.handler({ ...otherParams, all: true });
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
};
|
|
6169
|
+
var getPushMode = (entityType, config2) => {
|
|
6170
|
+
return getEntityOption({
|
|
6171
|
+
optionName: "mode",
|
|
6172
|
+
operation: "push",
|
|
6173
|
+
config: config2,
|
|
6174
|
+
entityType
|
|
6175
|
+
});
|
|
6176
|
+
};
|
|
6177
|
+
var getPushFilename = (entityType, config2) => {
|
|
6178
|
+
return getDirectoryOrFilename({
|
|
6179
|
+
operation: "push",
|
|
6180
|
+
config: config2,
|
|
6181
|
+
entityType
|
|
6182
|
+
});
|
|
6183
|
+
};
|
|
6184
|
+
var getFormat2 = (entityType, config2) => {
|
|
6185
|
+
return getEntityOption({
|
|
6186
|
+
optionName: "format",
|
|
6187
|
+
operation: "push",
|
|
6188
|
+
config: config2,
|
|
6189
|
+
entityType
|
|
6190
|
+
});
|
|
6191
|
+
};
|
|
6192
|
+
|
|
6193
|
+
// src/commands/sync/index.ts
|
|
6194
|
+
var SyncCommand = {
|
|
6195
|
+
command: "sync <command>",
|
|
6196
|
+
describe: "Uniform Sync commands",
|
|
6197
|
+
builder: (yargs23) => yargs23.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
5420
6198
|
handler: () => {
|
|
5421
|
-
|
|
6199
|
+
yargs21.showHelp();
|
|
5422
6200
|
}
|
|
5423
6201
|
};
|
|
5424
6202
|
|
|
@@ -5462,17 +6240,17 @@ async function checkForUpdateMiddleware() {
|
|
|
5462
6240
|
|
|
5463
6241
|
// src/middleware/checkLocalDepsVersionsMiddleware.ts
|
|
5464
6242
|
import { magenta, red as red6 } from "colorette";
|
|
5465
|
-
import { join as
|
|
6243
|
+
import { join as join3 } from "path";
|
|
5466
6244
|
|
|
5467
6245
|
// src/fs.ts
|
|
5468
|
-
import { promises as
|
|
6246
|
+
import { promises as fs5 } from "fs";
|
|
5469
6247
|
async function readJSON(path4) {
|
|
5470
|
-
const fileContents = await
|
|
6248
|
+
const fileContents = await fs5.readFile(path4, "utf-8");
|
|
5471
6249
|
return JSON.parse(fileContents);
|
|
5472
6250
|
}
|
|
5473
6251
|
async function tryReadJSON(path4, missingValue = null) {
|
|
5474
6252
|
try {
|
|
5475
|
-
const stat = await
|
|
6253
|
+
const stat = await fs5.stat(path4);
|
|
5476
6254
|
return stat.isFile() ? await readJSON(path4) : missingValue;
|
|
5477
6255
|
} catch (e) {
|
|
5478
6256
|
return missingValue;
|
|
@@ -5501,7 +6279,7 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
5501
6279
|
try {
|
|
5502
6280
|
let isOutside = false;
|
|
5503
6281
|
let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
|
|
5504
|
-
const localPackages = await tryReadJSON(
|
|
6282
|
+
const localPackages = await tryReadJSON(join3(process.cwd(), "package.json"));
|
|
5505
6283
|
if (!localPackages)
|
|
5506
6284
|
return;
|
|
5507
6285
|
let firstVersion;
|
|
@@ -5534,9 +6312,13 @@ First found was: v${firstVersion}`;
|
|
|
5534
6312
|
|
|
5535
6313
|
// src/index.ts
|
|
5536
6314
|
dotenv.config();
|
|
5537
|
-
var yarggery =
|
|
6315
|
+
var yarggery = yargs22(hideBin(process.argv));
|
|
6316
|
+
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
6317
|
+
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
5538
6318
|
yarggery.option("verbose", {
|
|
5539
6319
|
describe: "Include verbose logging",
|
|
5540
6320
|
default: false,
|
|
5541
6321
|
type: "boolean"
|
|
5542
|
-
}).
|
|
6322
|
+
}).scriptName("uniform").config(configuration).config("config", function() {
|
|
6323
|
+
return {};
|
|
6324
|
+
}).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;
|