@uniformdev/cli 19.38.2 → 19.38.3-alpha.78
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 +2510 -962
- package/package.json +17 -12
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import * as dotenv from "dotenv";
|
|
5
|
-
import
|
|
5
|
+
import yargs24 from "yargs";
|
|
6
6
|
import { hideBin } from "yargs/helpers";
|
|
7
7
|
|
|
8
8
|
// src/commands/canvas/index.ts
|
|
9
|
-
import
|
|
9
|
+
import yargs8 from "yargs";
|
|
10
10
|
|
|
11
11
|
// src/commands/canvas/commands/category.ts
|
|
12
12
|
import yargs from "yargs";
|
|
@@ -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(yargs25) {
|
|
123
|
+
return yargs25.option("serialization", {
|
|
124
|
+
skipValidation: true,
|
|
125
|
+
hidden: true
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function withApiOptions(yargs25) {
|
|
129
|
+
return yargs25.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(yargs25) {
|
|
169
|
+
return yargs25.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(yargs25) {
|
|
180
|
+
return yargs25.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(yargs25) {
|
|
193
|
+
return yargs25.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,9 @@ async function syncEngine({
|
|
|
312
411
|
whatIf = false,
|
|
313
412
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
314
413
|
log = () => {
|
|
315
|
-
}
|
|
414
|
+
},
|
|
415
|
+
onBeforeCompareObjects,
|
|
416
|
+
onBeforeWriteObject
|
|
316
417
|
}) {
|
|
317
418
|
var _a, _b;
|
|
318
419
|
const targetItems = /* @__PURE__ */ new Map();
|
|
@@ -346,18 +447,20 @@ async function syncEngine({
|
|
|
346
447
|
}
|
|
347
448
|
const actions = [];
|
|
348
449
|
let sourceHasItems = false;
|
|
349
|
-
for await (
|
|
450
|
+
for await (let sourceObject of source.objects) {
|
|
350
451
|
sourceHasItems = true;
|
|
351
452
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
352
453
|
const targetObject = targetItems.get(ids[0]);
|
|
353
454
|
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => (o == null ? void 0 : o.object) !== (targetObject == null ? void 0 : targetObject.object));
|
|
354
455
|
if (targetObject && invalidTargetObjects.length == 0) {
|
|
456
|
+
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
355
457
|
if (!compareContents(sourceObject, targetObject)) {
|
|
356
458
|
if (mode === "createOrUpdate" || mode === "mirror") {
|
|
357
459
|
const process2 = async (sourceObject2, targetObject2) => {
|
|
358
460
|
if (!whatIf) {
|
|
359
461
|
try {
|
|
360
|
-
await
|
|
462
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
463
|
+
await target.writeObject(finalSourceObject, targetObject2);
|
|
361
464
|
} catch (e) {
|
|
362
465
|
throw new SyncEngineError(e, sourceObject2);
|
|
363
466
|
}
|
|
@@ -379,7 +482,8 @@ async function syncEngine({
|
|
|
379
482
|
const process2 = async (sourceObject2, id) => {
|
|
380
483
|
if (!whatIf) {
|
|
381
484
|
try {
|
|
382
|
-
await
|
|
485
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
|
|
486
|
+
await target.writeObject(finalSourceObject);
|
|
383
487
|
} catch (e) {
|
|
384
488
|
throw new SyncEngineError(e, sourceObject2);
|
|
385
489
|
}
|
|
@@ -475,9 +579,13 @@ function createSyncEngineConsoleLogger(options) {
|
|
|
475
579
|
var CategoryGetModule = {
|
|
476
580
|
command: "get <id>",
|
|
477
581
|
describe: "Fetch a category",
|
|
478
|
-
builder: (
|
|
479
|
-
|
|
480
|
-
|
|
582
|
+
builder: (yargs25) => withConfiguration(
|
|
583
|
+
withFormatOptions(
|
|
584
|
+
withApiOptions(
|
|
585
|
+
withProjectOptions(
|
|
586
|
+
yargs25.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
587
|
+
)
|
|
588
|
+
)
|
|
481
589
|
)
|
|
482
590
|
),
|
|
483
591
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
@@ -500,7 +608,7 @@ var CategoryListModule = {
|
|
|
500
608
|
command: "list",
|
|
501
609
|
describe: "List categories",
|
|
502
610
|
aliases: ["ls"],
|
|
503
|
-
builder: (
|
|
611
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25.options({}))))),
|
|
504
612
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
505
613
|
const fetch3 = nodeFetchProxy(proxy);
|
|
506
614
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -510,7 +618,7 @@ var CategoryListModule = {
|
|
|
510
618
|
};
|
|
511
619
|
|
|
512
620
|
// src/commands/canvas/commands/category/pull.ts
|
|
513
|
-
import {
|
|
621
|
+
import { UncachedCategoryClient as UncachedCategoryClient3 } from "@uniformdev/canvas";
|
|
514
622
|
|
|
515
623
|
// src/commands/canvas/commands/category/_util.ts
|
|
516
624
|
var selectIdentifier = (category) => category.id;
|
|
@@ -557,30 +665,32 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
557
665
|
var CategoryPullModule = {
|
|
558
666
|
command: "pull <directory>",
|
|
559
667
|
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
|
-
|
|
668
|
+
builder: (yargs25) => withConfiguration(
|
|
669
|
+
withApiOptions(
|
|
670
|
+
withProjectOptions(
|
|
671
|
+
withDiffOptions(
|
|
672
|
+
yargs25.positional("directory", {
|
|
673
|
+
describe: "Directory to save the categories to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
674
|
+
type: "string"
|
|
675
|
+
}).option("format", {
|
|
676
|
+
alias: ["f"],
|
|
677
|
+
describe: "Output format",
|
|
678
|
+
default: "yaml",
|
|
679
|
+
choices: ["yaml", "json"],
|
|
680
|
+
type: "string"
|
|
681
|
+
}).option("what-if", {
|
|
682
|
+
alias: ["w"],
|
|
683
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
684
|
+
default: false,
|
|
685
|
+
type: "boolean"
|
|
686
|
+
}).option("mode", {
|
|
687
|
+
alias: ["m"],
|
|
688
|
+
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',
|
|
689
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
690
|
+
default: "mirror",
|
|
691
|
+
type: "string"
|
|
692
|
+
})
|
|
693
|
+
)
|
|
584
694
|
)
|
|
585
695
|
)
|
|
586
696
|
),
|
|
@@ -596,7 +706,7 @@ var CategoryPullModule = {
|
|
|
596
706
|
diff: diffMode
|
|
597
707
|
}) => {
|
|
598
708
|
const fetch3 = nodeFetchProxy(proxy);
|
|
599
|
-
const client = new
|
|
709
|
+
const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
600
710
|
const source = createCategoriesEngineDataSource({ client });
|
|
601
711
|
let target;
|
|
602
712
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -630,28 +740,30 @@ var CategoryPullModule = {
|
|
|
630
740
|
};
|
|
631
741
|
|
|
632
742
|
// src/commands/canvas/commands/category/push.ts
|
|
633
|
-
import {
|
|
743
|
+
import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/canvas";
|
|
634
744
|
var CategoryPushModule = {
|
|
635
745
|
command: "push <directory>",
|
|
636
746
|
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
|
-
|
|
747
|
+
builder: (yargs25) => withConfiguration(
|
|
748
|
+
withApiOptions(
|
|
749
|
+
withProjectOptions(
|
|
750
|
+
withDiffOptions(
|
|
751
|
+
yargs25.positional("directory", {
|
|
752
|
+
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
753
|
+
type: "string"
|
|
754
|
+
}).option("what-if", {
|
|
755
|
+
alias: ["w"],
|
|
756
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
757
|
+
default: false,
|
|
758
|
+
type: "boolean"
|
|
759
|
+
}).option("mode", {
|
|
760
|
+
alias: ["m"],
|
|
761
|
+
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',
|
|
762
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
763
|
+
default: "mirror",
|
|
764
|
+
type: "string"
|
|
765
|
+
})
|
|
766
|
+
)
|
|
655
767
|
)
|
|
656
768
|
)
|
|
657
769
|
),
|
|
@@ -666,7 +778,7 @@ var CategoryPushModule = {
|
|
|
666
778
|
diff: diffMode
|
|
667
779
|
}) => {
|
|
668
780
|
const fetch3 = nodeFetchProxy(proxy);
|
|
669
|
-
const client = new
|
|
781
|
+
const client = new UncachedCategoryClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
670
782
|
let source;
|
|
671
783
|
const isPackage = isPathAPackageFile(directory);
|
|
672
784
|
if (isPackage) {
|
|
@@ -695,35 +807,41 @@ var CategoryPushModule = {
|
|
|
695
807
|
};
|
|
696
808
|
|
|
697
809
|
// src/commands/canvas/commands/category/remove.ts
|
|
698
|
-
import {
|
|
810
|
+
import { UncachedCategoryClient as UncachedCategoryClient5 } from "@uniformdev/canvas";
|
|
699
811
|
var CategoryRemoveModule = {
|
|
700
812
|
command: "remove <id>",
|
|
701
813
|
aliases: ["delete", "rm"],
|
|
702
814
|
describe: "Delete a category",
|
|
703
|
-
builder: (
|
|
704
|
-
|
|
815
|
+
builder: (yargs25) => withConfiguration(
|
|
816
|
+
withApiOptions(
|
|
817
|
+
withProjectOptions(
|
|
818
|
+
yargs25.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
819
|
+
)
|
|
820
|
+
)
|
|
705
821
|
),
|
|
706
822
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
707
823
|
const fetch3 = nodeFetchProxy(proxy);
|
|
708
|
-
const client = new
|
|
824
|
+
const client = new UncachedCategoryClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
709
825
|
await client.removeCategory({ categoryId: id });
|
|
710
826
|
}
|
|
711
827
|
};
|
|
712
828
|
|
|
713
829
|
// src/commands/canvas/commands/category/update.ts
|
|
714
|
-
import {
|
|
830
|
+
import { UncachedCategoryClient as UncachedCategoryClient6 } from "@uniformdev/canvas";
|
|
715
831
|
var CategoryUpdateModule = {
|
|
716
832
|
command: "update <filename>",
|
|
717
833
|
aliases: ["put"],
|
|
718
834
|
describe: "Insert or update a category",
|
|
719
|
-
builder: (
|
|
720
|
-
|
|
721
|
-
|
|
835
|
+
builder: (yargs25) => withConfiguration(
|
|
836
|
+
withApiOptions(
|
|
837
|
+
withProjectOptions(
|
|
838
|
+
yargs25.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
839
|
+
)
|
|
722
840
|
)
|
|
723
841
|
),
|
|
724
842
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
725
843
|
const fetch3 = nodeFetchProxy(proxy);
|
|
726
|
-
const client = new
|
|
844
|
+
const client = new UncachedCategoryClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
727
845
|
const file = readFileToObject(filename);
|
|
728
846
|
await client.upsertCategories([file]);
|
|
729
847
|
}
|
|
@@ -734,7 +852,7 @@ var CategoryModule = {
|
|
|
734
852
|
command: "category <command>",
|
|
735
853
|
aliases: ["cat"],
|
|
736
854
|
describe: "Commands for Canvas categories",
|
|
737
|
-
builder: (
|
|
855
|
+
builder: (yargs25) => yargs25.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
738
856
|
handler: () => {
|
|
739
857
|
yargs.help();
|
|
740
858
|
}
|
|
@@ -744,7 +862,7 @@ var CategoryModule = {
|
|
|
744
862
|
import yargs2 from "yargs";
|
|
745
863
|
|
|
746
864
|
// src/commands/canvas/commands/component/get.ts
|
|
747
|
-
import { UncachedCanvasClient
|
|
865
|
+
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
748
866
|
|
|
749
867
|
// src/commands/canvas/commands/component/_util.ts
|
|
750
868
|
var selectIdentifier2 = (component) => component.id;
|
|
@@ -755,16 +873,21 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
755
873
|
var ComponentGetModule = {
|
|
756
874
|
command: "get <id>",
|
|
757
875
|
describe: "Fetch a component definition",
|
|
758
|
-
builder: (
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
876
|
+
builder: (yargs25) => withConfiguration(
|
|
877
|
+
withFormatOptions(
|
|
878
|
+
withApiOptions(
|
|
879
|
+
withProjectOptions(
|
|
880
|
+
yargs25.positional("id", {
|
|
881
|
+
demandOption: true,
|
|
882
|
+
describe: "Component definition public ID to fetch"
|
|
883
|
+
})
|
|
884
|
+
)
|
|
762
885
|
)
|
|
763
886
|
)
|
|
764
887
|
),
|
|
765
888
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
766
889
|
const fetch3 = nodeFetchProxy(proxy);
|
|
767
|
-
const client = new
|
|
890
|
+
const client = new UncachedCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
768
891
|
const res = await client.getComponentDefinitions({ componentId: id, limit: 1 });
|
|
769
892
|
if (res.componentDefinitions.length === 0) {
|
|
770
893
|
console.error("Component did not exist");
|
|
@@ -783,31 +906,33 @@ var ComponentGetModule = {
|
|
|
783
906
|
};
|
|
784
907
|
|
|
785
908
|
// src/commands/canvas/commands/component/list.ts
|
|
786
|
-
import { UncachedCanvasClient as
|
|
909
|
+
import { UncachedCanvasClient as UncachedCanvasClient2 } from "@uniformdev/canvas";
|
|
787
910
|
var ComponentListModule = {
|
|
788
911
|
command: "list",
|
|
789
912
|
describe: "List component definitions",
|
|
790
913
|
aliases: ["ls"],
|
|
791
|
-
builder: (
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
914
|
+
builder: (yargs25) => withConfiguration(
|
|
915
|
+
withFormatOptions(
|
|
916
|
+
withApiOptions(
|
|
917
|
+
withProjectOptions(
|
|
918
|
+
yargs25.options({
|
|
919
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
920
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
921
|
+
})
|
|
922
|
+
)
|
|
798
923
|
)
|
|
799
924
|
)
|
|
800
925
|
),
|
|
801
926
|
handler: async ({ apiHost, apiKey, proxy, limit, offset, format, filename, project: projectId }) => {
|
|
802
927
|
const fetch3 = nodeFetchProxy(proxy);
|
|
803
|
-
const client = new
|
|
928
|
+
const client = new UncachedCanvasClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
804
929
|
const res = await client.getComponentDefinitions({ limit, offset });
|
|
805
930
|
emitWithFormat(res.componentDefinitions, format, filename);
|
|
806
931
|
}
|
|
807
932
|
};
|
|
808
933
|
|
|
809
934
|
// src/commands/canvas/commands/component/pull.ts
|
|
810
|
-
import { UncachedCanvasClient as
|
|
935
|
+
import { UncachedCanvasClient as UncachedCanvasClient3 } from "@uniformdev/canvas";
|
|
811
936
|
|
|
812
937
|
// src/commands/canvas/componentDefinitionEngineDataSource.ts
|
|
813
938
|
function createComponentDefinitionEngineDataSource({
|
|
@@ -845,30 +970,32 @@ function createComponentDefinitionEngineDataSource({
|
|
|
845
970
|
var ComponentPullModule = {
|
|
846
971
|
command: "pull <directory>",
|
|
847
972
|
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
|
-
|
|
973
|
+
builder: (yargs25) => withConfiguration(
|
|
974
|
+
withApiOptions(
|
|
975
|
+
withProjectOptions(
|
|
976
|
+
withDiffOptions(
|
|
977
|
+
yargs25.positional("directory", {
|
|
978
|
+
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
979
|
+
type: "string"
|
|
980
|
+
}).option("format", {
|
|
981
|
+
alias: ["f"],
|
|
982
|
+
describe: "Output format",
|
|
983
|
+
default: "yaml",
|
|
984
|
+
choices: ["yaml", "json"],
|
|
985
|
+
type: "string"
|
|
986
|
+
}).option("what-if", {
|
|
987
|
+
alias: ["w"],
|
|
988
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
989
|
+
default: false,
|
|
990
|
+
type: "boolean"
|
|
991
|
+
}).option("mode", {
|
|
992
|
+
alias: ["m"],
|
|
993
|
+
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',
|
|
994
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
995
|
+
default: "mirror",
|
|
996
|
+
type: "string"
|
|
997
|
+
})
|
|
998
|
+
)
|
|
872
999
|
)
|
|
873
1000
|
)
|
|
874
1001
|
),
|
|
@@ -884,7 +1011,7 @@ var ComponentPullModule = {
|
|
|
884
1011
|
diff: diffMode
|
|
885
1012
|
}) => {
|
|
886
1013
|
const fetch3 = nodeFetchProxy(proxy);
|
|
887
|
-
const client = new
|
|
1014
|
+
const client = new UncachedCanvasClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
888
1015
|
const source = createComponentDefinitionEngineDataSource({ client });
|
|
889
1016
|
let target;
|
|
890
1017
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -919,28 +1046,30 @@ var ComponentPullModule = {
|
|
|
919
1046
|
};
|
|
920
1047
|
|
|
921
1048
|
// src/commands/canvas/commands/component/push.ts
|
|
922
|
-
import { UncachedCanvasClient as
|
|
1049
|
+
import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canvas";
|
|
923
1050
|
var ComponentPushModule = {
|
|
924
1051
|
command: "push <directory>",
|
|
925
1052
|
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
|
-
|
|
1053
|
+
builder: (yargs25) => withConfiguration(
|
|
1054
|
+
withApiOptions(
|
|
1055
|
+
withProjectOptions(
|
|
1056
|
+
withDiffOptions(
|
|
1057
|
+
yargs25.positional("directory", {
|
|
1058
|
+
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1059
|
+
type: "string"
|
|
1060
|
+
}).option("what-if", {
|
|
1061
|
+
alias: ["w"],
|
|
1062
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1063
|
+
default: false,
|
|
1064
|
+
type: "boolean"
|
|
1065
|
+
}).option("mode", {
|
|
1066
|
+
alias: ["m"],
|
|
1067
|
+
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',
|
|
1068
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1069
|
+
default: "mirror",
|
|
1070
|
+
type: "string"
|
|
1071
|
+
})
|
|
1072
|
+
)
|
|
944
1073
|
)
|
|
945
1074
|
)
|
|
946
1075
|
),
|
|
@@ -955,7 +1084,7 @@ var ComponentPushModule = {
|
|
|
955
1084
|
diff: diffMode
|
|
956
1085
|
}) => {
|
|
957
1086
|
const fetch3 = nodeFetchProxy(proxy);
|
|
958
|
-
const client = new
|
|
1087
|
+
const client = new UncachedCanvasClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
959
1088
|
let source;
|
|
960
1089
|
const isPackage = isPathAPackageFile(directory);
|
|
961
1090
|
if (isPackage) {
|
|
@@ -985,37 +1114,41 @@ var ComponentPushModule = {
|
|
|
985
1114
|
};
|
|
986
1115
|
|
|
987
1116
|
// src/commands/canvas/commands/component/remove.ts
|
|
988
|
-
import { UncachedCanvasClient as
|
|
1117
|
+
import { UncachedCanvasClient as UncachedCanvasClient5 } from "@uniformdev/canvas";
|
|
989
1118
|
var ComponentRemoveModule = {
|
|
990
1119
|
command: "remove <id>",
|
|
991
1120
|
aliases: ["delete", "rm"],
|
|
992
1121
|
describe: "Delete a component definition",
|
|
993
|
-
builder: (
|
|
994
|
-
|
|
995
|
-
|
|
1122
|
+
builder: (yargs25) => withConfiguration(
|
|
1123
|
+
withApiOptions(
|
|
1124
|
+
withProjectOptions(
|
|
1125
|
+
yargs25.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1126
|
+
)
|
|
996
1127
|
)
|
|
997
1128
|
),
|
|
998
1129
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
999
1130
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1000
|
-
const client = new
|
|
1131
|
+
const client = new UncachedCanvasClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1001
1132
|
await client.removeComponentDefinition({ componentId: id });
|
|
1002
1133
|
}
|
|
1003
1134
|
};
|
|
1004
1135
|
|
|
1005
1136
|
// src/commands/canvas/commands/component/update.ts
|
|
1006
|
-
import { UncachedCanvasClient as
|
|
1137
|
+
import { UncachedCanvasClient as UncachedCanvasClient6 } from "@uniformdev/canvas";
|
|
1007
1138
|
var ComponentUpdateModule = {
|
|
1008
1139
|
command: "update <filename>",
|
|
1009
1140
|
aliases: ["put"],
|
|
1010
1141
|
describe: "Insert or update a component definition",
|
|
1011
|
-
builder: (
|
|
1012
|
-
|
|
1013
|
-
|
|
1142
|
+
builder: (yargs25) => withConfiguration(
|
|
1143
|
+
withApiOptions(
|
|
1144
|
+
withProjectOptions(
|
|
1145
|
+
yargs25.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1146
|
+
)
|
|
1014
1147
|
)
|
|
1015
1148
|
),
|
|
1016
1149
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
1017
1150
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1018
|
-
const client = new
|
|
1151
|
+
const client = new UncachedCanvasClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1019
1152
|
const file = readFileToObject(filename);
|
|
1020
1153
|
await client.updateComponentDefinition({ componentDefinition: file });
|
|
1021
1154
|
}
|
|
@@ -1026,7 +1159,7 @@ var ComponentModule = {
|
|
|
1026
1159
|
command: "component <command>",
|
|
1027
1160
|
aliases: ["def"],
|
|
1028
1161
|
describe: "Commands for Canvas component definitions",
|
|
1029
|
-
builder: (
|
|
1162
|
+
builder: (yargs25) => yargs25.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1030
1163
|
handler: () => {
|
|
1031
1164
|
yargs2.help();
|
|
1032
1165
|
}
|
|
@@ -1036,7 +1169,7 @@ var ComponentModule = {
|
|
|
1036
1169
|
import yargs3 from "yargs";
|
|
1037
1170
|
|
|
1038
1171
|
// src/commands/canvas/commands/composition/get.ts
|
|
1039
|
-
import { UncachedCanvasClient as
|
|
1172
|
+
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1040
1173
|
|
|
1041
1174
|
// src/commands/canvas/util.ts
|
|
1042
1175
|
import { CANVAS_DRAFT_STATE, CANVAS_PUBLISHED_STATE } from "@uniformdev/canvas";
|
|
@@ -1048,8 +1181,8 @@ function prepCompositionForDisk(composition) {
|
|
|
1048
1181
|
delete prepped.state;
|
|
1049
1182
|
return prepped;
|
|
1050
1183
|
}
|
|
1051
|
-
function withStateOptions(
|
|
1052
|
-
return
|
|
1184
|
+
function withStateOptions(yargs25) {
|
|
1185
|
+
return yargs25.option("state", {
|
|
1053
1186
|
type: "string",
|
|
1054
1187
|
describe: `Composition state to fetch.`,
|
|
1055
1188
|
choices: ["preview", "published"],
|
|
@@ -1074,37 +1207,39 @@ function convertCompositionState(state) {
|
|
|
1074
1207
|
var CompositionGetModule = {
|
|
1075
1208
|
command: "get <id>",
|
|
1076
1209
|
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
|
-
|
|
1210
|
+
builder: (yargs25) => withFormatOptions(
|
|
1211
|
+
withConfiguration(
|
|
1212
|
+
withApiOptions(
|
|
1213
|
+
withProjectOptions(
|
|
1214
|
+
withStateOptions(
|
|
1215
|
+
yargs25.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1216
|
+
resolvePatterns: {
|
|
1217
|
+
type: "boolean",
|
|
1218
|
+
default: false,
|
|
1219
|
+
describe: "Resolve pattern references in the composition"
|
|
1220
|
+
},
|
|
1221
|
+
resolveOverrides: {
|
|
1222
|
+
type: "boolean",
|
|
1223
|
+
default: false,
|
|
1224
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
1225
|
+
},
|
|
1226
|
+
componentIDs: {
|
|
1227
|
+
type: "boolean",
|
|
1228
|
+
default: false,
|
|
1229
|
+
describe: "Include individual component UIDs"
|
|
1230
|
+
},
|
|
1231
|
+
resolveData: {
|
|
1232
|
+
type: "boolean",
|
|
1233
|
+
default: false,
|
|
1234
|
+
describe: "Resolve all data resources used by the composition/pattern"
|
|
1235
|
+
},
|
|
1236
|
+
diagnostics: {
|
|
1237
|
+
type: "boolean",
|
|
1238
|
+
default: false,
|
|
1239
|
+
describe: "Include diagnostics information when resolving data"
|
|
1240
|
+
}
|
|
1241
|
+
})
|
|
1242
|
+
)
|
|
1108
1243
|
)
|
|
1109
1244
|
)
|
|
1110
1245
|
)
|
|
@@ -1126,7 +1261,7 @@ var CompositionGetModule = {
|
|
|
1126
1261
|
diagnostics
|
|
1127
1262
|
}) => {
|
|
1128
1263
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1129
|
-
const client = new
|
|
1264
|
+
const client = new UncachedCanvasClient7({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
|
|
1130
1265
|
const res = prepCompositionForDisk(
|
|
1131
1266
|
await client.getCompositionById({
|
|
1132
1267
|
compositionId: id,
|
|
@@ -1143,34 +1278,47 @@ var CompositionGetModule = {
|
|
|
1143
1278
|
};
|
|
1144
1279
|
|
|
1145
1280
|
// src/commands/canvas/commands/composition/list.ts
|
|
1146
|
-
import { UncachedCanvasClient as
|
|
1281
|
+
import { UncachedCanvasClient as UncachedCanvasClient8 } from "@uniformdev/canvas";
|
|
1147
1282
|
var CompositionListModule = {
|
|
1148
1283
|
command: "list",
|
|
1149
1284
|
describe: "List compositions",
|
|
1150
1285
|
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
|
-
|
|
1286
|
+
builder: (yargs25) => withFormatOptions(
|
|
1287
|
+
withConfiguration(
|
|
1288
|
+
withApiOptions(
|
|
1289
|
+
withProjectOptions(
|
|
1290
|
+
withStateOptions(
|
|
1291
|
+
yargs25.options({
|
|
1292
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1293
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1294
|
+
resolvePatterns: {
|
|
1295
|
+
type: "boolean",
|
|
1296
|
+
default: false,
|
|
1297
|
+
describe: "Resolve pattern references in the composition"
|
|
1298
|
+
},
|
|
1299
|
+
resolveOverrides: {
|
|
1300
|
+
type: "boolean",
|
|
1301
|
+
default: false,
|
|
1302
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
1303
|
+
},
|
|
1304
|
+
onlyCompositions: {
|
|
1305
|
+
describe: "Only pulling compositions and not patterns",
|
|
1306
|
+
default: false,
|
|
1307
|
+
type: "boolean"
|
|
1308
|
+
},
|
|
1309
|
+
onlyPatterns: {
|
|
1310
|
+
describe: "Only pulling patterns and not compositions",
|
|
1311
|
+
default: false,
|
|
1312
|
+
type: "boolean",
|
|
1313
|
+
hidden: true
|
|
1314
|
+
},
|
|
1315
|
+
componentIDs: {
|
|
1316
|
+
type: "boolean",
|
|
1317
|
+
default: false,
|
|
1318
|
+
describe: "Include individual component UIDs"
|
|
1319
|
+
}
|
|
1320
|
+
})
|
|
1321
|
+
)
|
|
1174
1322
|
)
|
|
1175
1323
|
)
|
|
1176
1324
|
)
|
|
@@ -1183,6 +1331,8 @@ var CompositionListModule = {
|
|
|
1183
1331
|
offset,
|
|
1184
1332
|
format,
|
|
1185
1333
|
filename,
|
|
1334
|
+
onlyCompositions,
|
|
1335
|
+
onlyPatterns,
|
|
1186
1336
|
project: projectId,
|
|
1187
1337
|
state,
|
|
1188
1338
|
resolvePatterns,
|
|
@@ -1190,10 +1340,11 @@ var CompositionListModule = {
|
|
|
1190
1340
|
componentIDs
|
|
1191
1341
|
}) => {
|
|
1192
1342
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1193
|
-
const client = new
|
|
1343
|
+
const client = new UncachedCanvasClient8({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1194
1344
|
const res = await client.getCompositionList({
|
|
1195
1345
|
limit,
|
|
1196
1346
|
offset,
|
|
1347
|
+
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
1197
1348
|
state: convertCompositionState(state),
|
|
1198
1349
|
skipPatternResolution: !resolvePatterns,
|
|
1199
1350
|
withComponentIDs: componentIDs,
|
|
@@ -1204,7 +1355,7 @@ var CompositionListModule = {
|
|
|
1204
1355
|
};
|
|
1205
1356
|
|
|
1206
1357
|
// src/commands/canvas/commands/composition/publish.ts
|
|
1207
|
-
import { UncachedCanvasClient as
|
|
1358
|
+
import { UncachedCanvasClient as UncachedCanvasClient9 } from "@uniformdev/canvas";
|
|
1208
1359
|
|
|
1209
1360
|
// src/commands/canvas/commands/composition/_util.ts
|
|
1210
1361
|
var selectIdentifier3 = (component) => component.composition._id;
|
|
@@ -1214,6 +1365,8 @@ var selectDisplayName3 = (component) => `${component.composition._name ?? compon
|
|
|
1214
1365
|
function createComponentInstanceEngineDataSource({
|
|
1215
1366
|
client,
|
|
1216
1367
|
state,
|
|
1368
|
+
onlyCompositions,
|
|
1369
|
+
onlyPatterns,
|
|
1217
1370
|
...clientOptions
|
|
1218
1371
|
}) {
|
|
1219
1372
|
const stateId = convertCompositionState(state);
|
|
@@ -1223,6 +1376,7 @@ function createComponentInstanceEngineDataSource({
|
|
|
1223
1376
|
...clientOptions,
|
|
1224
1377
|
limit,
|
|
1225
1378
|
offset,
|
|
1379
|
+
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
1226
1380
|
state: stateId,
|
|
1227
1381
|
skipPatternResolution: true,
|
|
1228
1382
|
skipOverridesResolution: true,
|
|
@@ -1253,25 +1407,36 @@ function createComponentInstanceEngineDataSource({
|
|
|
1253
1407
|
|
|
1254
1408
|
// src/commands/canvas/commands/composition/publish.ts
|
|
1255
1409
|
var CompositionPublishModule = {
|
|
1256
|
-
command: "publish [
|
|
1257
|
-
describe: "Publishes
|
|
1258
|
-
builder: (
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1410
|
+
command: "publish [ids]",
|
|
1411
|
+
describe: "Publishes composition(s)",
|
|
1412
|
+
builder: (yargs25) => withConfiguration(
|
|
1413
|
+
withApiOptions(
|
|
1414
|
+
withProjectOptions(
|
|
1415
|
+
withDiffOptions(
|
|
1416
|
+
yargs25.positional("ids", {
|
|
1417
|
+
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1418
|
+
type: "string"
|
|
1419
|
+
}).option("all", {
|
|
1420
|
+
alias: ["a"],
|
|
1421
|
+
describe: "Publishes all compositions. Use compositionId to publish one instead.",
|
|
1422
|
+
default: false,
|
|
1423
|
+
type: "boolean"
|
|
1424
|
+
}).option("what-if", {
|
|
1425
|
+
alias: ["w"],
|
|
1426
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
1427
|
+
default: false,
|
|
1428
|
+
type: "boolean"
|
|
1429
|
+
}).option("onlyCompositions", {
|
|
1430
|
+
describe: "Only publishing compositions and not patterns",
|
|
1431
|
+
default: false,
|
|
1432
|
+
type: "boolean"
|
|
1433
|
+
}).option("onlyPatterns", {
|
|
1434
|
+
describe: "Only pulling patterns and not compositions",
|
|
1435
|
+
default: false,
|
|
1436
|
+
type: "boolean",
|
|
1437
|
+
hidden: true
|
|
1438
|
+
})
|
|
1439
|
+
)
|
|
1275
1440
|
)
|
|
1276
1441
|
)
|
|
1277
1442
|
),
|
|
@@ -1279,33 +1444,40 @@ var CompositionPublishModule = {
|
|
|
1279
1444
|
apiHost,
|
|
1280
1445
|
apiKey,
|
|
1281
1446
|
proxy,
|
|
1282
|
-
|
|
1447
|
+
ids,
|
|
1283
1448
|
all,
|
|
1284
1449
|
whatIf,
|
|
1285
1450
|
project: projectId,
|
|
1286
|
-
diff: diffMode
|
|
1451
|
+
diff: diffMode,
|
|
1452
|
+
onlyCompositions,
|
|
1453
|
+
onlyPatterns
|
|
1287
1454
|
}) => {
|
|
1288
|
-
if (!all && !
|
|
1455
|
+
if (!all && !ids || all && ids) {
|
|
1289
1456
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
1290
1457
|
process.exit(1);
|
|
1291
1458
|
}
|
|
1292
|
-
const compositionIDsArray =
|
|
1459
|
+
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
1293
1460
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1294
|
-
const client = new
|
|
1461
|
+
const client = new UncachedCanvasClient9({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1295
1462
|
const source = createComponentInstanceEngineDataSource({
|
|
1296
1463
|
client,
|
|
1297
1464
|
state: "preview",
|
|
1298
|
-
compositionIDs: compositionIDsArray
|
|
1465
|
+
compositionIDs: compositionIDsArray,
|
|
1466
|
+
onlyCompositions,
|
|
1467
|
+
onlyPatterns
|
|
1299
1468
|
});
|
|
1300
1469
|
const target = createComponentInstanceEngineDataSource({
|
|
1301
1470
|
client,
|
|
1302
1471
|
state: "published",
|
|
1303
|
-
compositionIDs: compositionIDsArray
|
|
1472
|
+
compositionIDs: compositionIDsArray,
|
|
1473
|
+
onlyCompositions,
|
|
1474
|
+
onlyPatterns
|
|
1304
1475
|
});
|
|
1305
1476
|
await syncEngine({
|
|
1306
1477
|
source,
|
|
1307
1478
|
target,
|
|
1308
|
-
|
|
1479
|
+
// Publishing is one-direction operation, so no need to support automatic un-publishing
|
|
1480
|
+
mode: "createOrUpdate",
|
|
1309
1481
|
whatIf,
|
|
1310
1482
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1311
1483
|
});
|
|
@@ -1313,35 +1485,221 @@ var CompositionPublishModule = {
|
|
|
1313
1485
|
};
|
|
1314
1486
|
|
|
1315
1487
|
// src/commands/canvas/commands/composition/pull.ts
|
|
1316
|
-
import { UncachedCanvasClient as
|
|
1488
|
+
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
1489
|
+
|
|
1490
|
+
// src/files/index.ts
|
|
1491
|
+
import { preferredType } from "@thi.ng/mime";
|
|
1492
|
+
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
1493
|
+
import { createHash } from "crypto";
|
|
1494
|
+
import fsj from "fs-jetpack";
|
|
1495
|
+
import sizeOf from "image-size";
|
|
1496
|
+
import PQueue from "p-queue";
|
|
1497
|
+
import { join as join2 } from "path";
|
|
1498
|
+
var FILES_DIRECTORY_NAME = "files";
|
|
1499
|
+
var urlToHash = (url) => {
|
|
1500
|
+
const hash = createHash("sha256");
|
|
1501
|
+
hash.update(url);
|
|
1502
|
+
return hash.digest("hex");
|
|
1503
|
+
};
|
|
1504
|
+
var urlToFileName = (url) => {
|
|
1505
|
+
const fileName = urlToHash(url);
|
|
1506
|
+
const fileNameChunks = url.split(".");
|
|
1507
|
+
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
1508
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
1509
|
+
};
|
|
1510
|
+
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
1511
|
+
const objectAsString = JSON.stringify(object);
|
|
1512
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1513
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1514
|
+
);
|
|
1515
|
+
if (uniformFileUrlMatches) {
|
|
1516
|
+
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
1517
|
+
for (const match of uniformFileUrlMatches) {
|
|
1518
|
+
const url = new URL(match[1]);
|
|
1519
|
+
fileDownloadQueue.add(async () => {
|
|
1520
|
+
try {
|
|
1521
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
1522
|
+
const fileName = urlToFileName(url.toString());
|
|
1523
|
+
const fileAlreadyExists = await fsj.existsAsync(
|
|
1524
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
1525
|
+
);
|
|
1526
|
+
if (fileAlreadyExists) {
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
const response = await fetch(fetchUrl);
|
|
1530
|
+
if (!response.ok) {
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
const fileBuffer = await response.arrayBuffer();
|
|
1534
|
+
await fsj.writeAsync(
|
|
1535
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
1536
|
+
Buffer.from(fileBuffer)
|
|
1537
|
+
);
|
|
1538
|
+
} catch {
|
|
1539
|
+
console.warn(`Failed to download file ${url}`);
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
await fileDownloadQueue.onIdle();
|
|
1544
|
+
}
|
|
1545
|
+
return object;
|
|
1546
|
+
};
|
|
1547
|
+
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
1548
|
+
let objectAsString = JSON.stringify(object);
|
|
1549
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1550
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1551
|
+
);
|
|
1552
|
+
if (uniformFileUrlMatches) {
|
|
1553
|
+
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
1554
|
+
for (const match of uniformFileUrlMatches) {
|
|
1555
|
+
const url = match[1];
|
|
1556
|
+
const hash = urlToHash(url);
|
|
1557
|
+
fileUploadQueue.add(async () => {
|
|
1558
|
+
try {
|
|
1559
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
1560
|
+
options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
|
|
1561
|
+
options.fileClient.getFile({ projectId: options.projectId, sourceId: hash }).catch(() => null)
|
|
1562
|
+
]);
|
|
1563
|
+
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
const localFileName = urlToFileName(url);
|
|
1567
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
1568
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
1569
|
+
);
|
|
1570
|
+
if (!fileExistsLocally) {
|
|
1571
|
+
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
const fileBuffer = await fsj.readAsync(
|
|
1575
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
1576
|
+
"buffer"
|
|
1577
|
+
);
|
|
1578
|
+
if (!fileBuffer) {
|
|
1579
|
+
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
1580
|
+
return;
|
|
1581
|
+
}
|
|
1582
|
+
const fileName = getFileNameFromUrl(url);
|
|
1583
|
+
const { width, height } = (() => {
|
|
1584
|
+
try {
|
|
1585
|
+
return sizeOf(fileBuffer);
|
|
1586
|
+
} catch {
|
|
1587
|
+
return {
|
|
1588
|
+
width: void 0,
|
|
1589
|
+
height: void 0
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
})();
|
|
1593
|
+
const { id, method, uploadUrl } = await options.fileClient.createNewProjectFile({
|
|
1594
|
+
name: fileName,
|
|
1595
|
+
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
1596
|
+
size: fileBuffer.length,
|
|
1597
|
+
width,
|
|
1598
|
+
height,
|
|
1599
|
+
projectId: options.projectId,
|
|
1600
|
+
sourceId: hash
|
|
1601
|
+
});
|
|
1602
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
1603
|
+
method,
|
|
1604
|
+
body: fileBuffer
|
|
1605
|
+
});
|
|
1606
|
+
if (!uploadResponse.ok) {
|
|
1607
|
+
console.warn(`Failed to upload file ${url}`);
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
const checkForFile = async () => {
|
|
1611
|
+
const file = await options.fileClient.getFile({ id });
|
|
1612
|
+
if (!file || file.state !== FILE_READY_STATE) {
|
|
1613
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
1614
|
+
return checkForFile();
|
|
1615
|
+
}
|
|
1616
|
+
return file.url;
|
|
1617
|
+
};
|
|
1618
|
+
const abortTimeout = setTimeout(() => {
|
|
1619
|
+
throw new Error(`Failed to upload file ${url}`);
|
|
1620
|
+
}, 1e4);
|
|
1621
|
+
const uploadedFileUrl = await checkForFile();
|
|
1622
|
+
clearTimeout(abortTimeout);
|
|
1623
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
1624
|
+
} catch {
|
|
1625
|
+
console.warn(`Failed to upload file ${url}`);
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
await fileUploadQueue.onIdle();
|
|
1630
|
+
}
|
|
1631
|
+
return JSON.parse(objectAsString);
|
|
1632
|
+
};
|
|
1633
|
+
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
1634
|
+
let objectAsString = JSON.stringify(object);
|
|
1635
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1636
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1637
|
+
);
|
|
1638
|
+
if (uniformFileUrlMatches) {
|
|
1639
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
1640
|
+
for (const match of uniformFileUrlMatches) {
|
|
1641
|
+
const url = match[1];
|
|
1642
|
+
const hash = urlToHash(url);
|
|
1643
|
+
fileUrlReplacementQueue.add(async () => {
|
|
1644
|
+
try {
|
|
1645
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
1646
|
+
options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
|
|
1647
|
+
options.fileClient.getFile({ projectId: options.projectId, sourceId: hash }).catch(() => null)
|
|
1648
|
+
]);
|
|
1649
|
+
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
1650
|
+
if (!file) {
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
1654
|
+
} catch {
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
await fileUrlReplacementQueue.onIdle();
|
|
1659
|
+
}
|
|
1660
|
+
return JSON.parse(objectAsString);
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
// src/commands/canvas/commands/composition/pull.ts
|
|
1317
1664
|
var CompositionPullModule = {
|
|
1318
1665
|
command: "pull <directory>",
|
|
1319
1666
|
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
|
-
|
|
1667
|
+
builder: (yargs25) => withConfiguration(
|
|
1668
|
+
withApiOptions(
|
|
1669
|
+
withProjectOptions(
|
|
1670
|
+
withStateOptions(
|
|
1671
|
+
withDiffOptions(
|
|
1672
|
+
yargs25.positional("directory", {
|
|
1673
|
+
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.",
|
|
1674
|
+
type: "string"
|
|
1675
|
+
}).option("format", {
|
|
1676
|
+
alias: ["f"],
|
|
1677
|
+
describe: "Output format",
|
|
1678
|
+
default: "yaml",
|
|
1679
|
+
choices: ["yaml", "json"],
|
|
1680
|
+
type: "string"
|
|
1681
|
+
}).option("onlyCompositions", {
|
|
1682
|
+
describe: "Only pulling compositions and not patterns",
|
|
1683
|
+
default: false,
|
|
1684
|
+
type: "boolean"
|
|
1685
|
+
}).option("onlyPatterns", {
|
|
1686
|
+
describe: "Only pulling patterns and not compositions",
|
|
1687
|
+
default: false,
|
|
1688
|
+
type: "boolean",
|
|
1689
|
+
hidden: true
|
|
1690
|
+
}).option("what-if", {
|
|
1691
|
+
alias: ["w"],
|
|
1692
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
1693
|
+
default: false,
|
|
1694
|
+
type: "boolean"
|
|
1695
|
+
}).option("mode", {
|
|
1696
|
+
alias: ["m"],
|
|
1697
|
+
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',
|
|
1698
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1699
|
+
default: "mirror",
|
|
1700
|
+
type: "string"
|
|
1701
|
+
})
|
|
1702
|
+
)
|
|
1345
1703
|
)
|
|
1346
1704
|
)
|
|
1347
1705
|
)
|
|
@@ -1352,6 +1710,8 @@ var CompositionPullModule = {
|
|
|
1352
1710
|
proxy,
|
|
1353
1711
|
directory,
|
|
1354
1712
|
format,
|
|
1713
|
+
onlyCompositions,
|
|
1714
|
+
onlyPatterns,
|
|
1355
1715
|
mode,
|
|
1356
1716
|
whatIf,
|
|
1357
1717
|
state,
|
|
@@ -1359,8 +1719,8 @@ var CompositionPullModule = {
|
|
|
1359
1719
|
diff: diffMode
|
|
1360
1720
|
}) => {
|
|
1361
1721
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1362
|
-
const client = new
|
|
1363
|
-
const source = createComponentInstanceEngineDataSource({ client, state });
|
|
1722
|
+
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1723
|
+
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1364
1724
|
const isPackage = isPathAPackageFile(directory);
|
|
1365
1725
|
let target;
|
|
1366
1726
|
if (isPackage) {
|
|
@@ -1387,35 +1747,52 @@ var CompositionPullModule = {
|
|
|
1387
1747
|
target,
|
|
1388
1748
|
mode,
|
|
1389
1749
|
whatIf,
|
|
1390
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1750
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1751
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1752
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1753
|
+
directory
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1391
1756
|
});
|
|
1392
1757
|
}
|
|
1393
1758
|
};
|
|
1394
1759
|
|
|
1395
1760
|
// src/commands/canvas/commands/composition/push.ts
|
|
1396
|
-
import { UncachedCanvasClient as
|
|
1761
|
+
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
1762
|
+
import { FileClient as FileClient2 } from "@uniformdev/files";
|
|
1397
1763
|
var CompositionPushModule = {
|
|
1398
1764
|
command: "push <directory>",
|
|
1399
1765
|
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
|
-
|
|
1766
|
+
builder: (yargs25) => withConfiguration(
|
|
1767
|
+
withApiOptions(
|
|
1768
|
+
withProjectOptions(
|
|
1769
|
+
withStateOptions(
|
|
1770
|
+
withDiffOptions(
|
|
1771
|
+
yargs25.positional("directory", {
|
|
1772
|
+
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
1773
|
+
type: "string"
|
|
1774
|
+
}).option("what-if", {
|
|
1775
|
+
alias: ["w"],
|
|
1776
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1777
|
+
default: false,
|
|
1778
|
+
type: "boolean"
|
|
1779
|
+
}).option("mode", {
|
|
1780
|
+
alias: ["m"],
|
|
1781
|
+
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',
|
|
1782
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1783
|
+
default: "mirror",
|
|
1784
|
+
type: "string"
|
|
1785
|
+
}).option("onlyCompositions", {
|
|
1786
|
+
describe: "Only pulling compositions and not patterns",
|
|
1787
|
+
default: false,
|
|
1788
|
+
type: "boolean"
|
|
1789
|
+
}).option("onlyPatterns", {
|
|
1790
|
+
describe: "Only pulling patterns and not compositions",
|
|
1791
|
+
default: false,
|
|
1792
|
+
type: "boolean",
|
|
1793
|
+
hidden: true
|
|
1794
|
+
})
|
|
1795
|
+
)
|
|
1419
1796
|
)
|
|
1420
1797
|
)
|
|
1421
1798
|
)
|
|
@@ -1429,10 +1806,12 @@ var CompositionPushModule = {
|
|
|
1429
1806
|
whatIf,
|
|
1430
1807
|
state,
|
|
1431
1808
|
project: projectId,
|
|
1809
|
+
onlyCompositions,
|
|
1810
|
+
onlyPatterns,
|
|
1432
1811
|
diff: diffMode
|
|
1433
1812
|
}) => {
|
|
1434
1813
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1435
|
-
const client = new
|
|
1814
|
+
const client = new UncachedCanvasClient11({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1436
1815
|
let source;
|
|
1437
1816
|
const isPackage = isPathAPackageFile(directory);
|
|
1438
1817
|
if (isPackage) {
|
|
@@ -1449,147 +1828,811 @@ var CompositionPushModule = {
|
|
|
1449
1828
|
selectDisplayName: selectDisplayName3
|
|
1450
1829
|
});
|
|
1451
1830
|
}
|
|
1452
|
-
const target = createComponentInstanceEngineDataSource({ client, state });
|
|
1831
|
+
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1832
|
+
const fileClient = new FileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1453
1833
|
await syncEngine({
|
|
1454
1834
|
source,
|
|
1455
1835
|
target,
|
|
1456
1836
|
mode,
|
|
1457
1837
|
whatIf,
|
|
1458
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1838
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1839
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
1840
|
+
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
1841
|
+
fileClient,
|
|
1842
|
+
projectId
|
|
1843
|
+
});
|
|
1844
|
+
},
|
|
1845
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1846
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1847
|
+
directory,
|
|
1848
|
+
fileClient,
|
|
1849
|
+
projectId
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1459
1852
|
});
|
|
1460
1853
|
}
|
|
1461
1854
|
};
|
|
1462
1855
|
|
|
1463
1856
|
// src/commands/canvas/commands/composition/remove.ts
|
|
1464
|
-
import { UncachedCanvasClient as
|
|
1857
|
+
import { UncachedCanvasClient as UncachedCanvasClient12 } from "@uniformdev/canvas";
|
|
1465
1858
|
var CompositionRemoveModule = {
|
|
1466
1859
|
command: "remove <id>",
|
|
1467
1860
|
aliases: ["delete", "rm"],
|
|
1468
1861
|
describe: "Delete a composition",
|
|
1469
|
-
builder: (
|
|
1470
|
-
|
|
1471
|
-
|
|
1862
|
+
builder: (yargs25) => withConfiguration(
|
|
1863
|
+
withApiOptions(
|
|
1864
|
+
withProjectOptions(
|
|
1865
|
+
yargs25.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
1866
|
+
)
|
|
1472
1867
|
)
|
|
1473
1868
|
),
|
|
1474
1869
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
1475
1870
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1476
|
-
const client = new
|
|
1871
|
+
const client = new UncachedCanvasClient12({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1477
1872
|
await client.removeComposition({ compositionId: id });
|
|
1478
1873
|
}
|
|
1479
1874
|
};
|
|
1480
1875
|
|
|
1481
1876
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
1482
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient as
|
|
1877
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient as UncachedCanvasClient13 } from "@uniformdev/canvas";
|
|
1878
|
+
import { diffJson as diffJson2 } from "diff";
|
|
1483
1879
|
var CompositionUnpublishModule = {
|
|
1484
|
-
command: "unpublish
|
|
1485
|
-
describe: "Unpublish a composition",
|
|
1486
|
-
builder: (
|
|
1487
|
-
|
|
1488
|
-
|
|
1880
|
+
command: "unpublish [ids]",
|
|
1881
|
+
describe: "Unpublish a composition(s)",
|
|
1882
|
+
builder: (yargs25) => withConfiguration(
|
|
1883
|
+
withApiOptions(
|
|
1884
|
+
withProjectOptions(
|
|
1885
|
+
yargs25.positional("ids", {
|
|
1886
|
+
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
1887
|
+
type: "string"
|
|
1888
|
+
}).option("all", {
|
|
1889
|
+
alias: ["a"],
|
|
1890
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
1891
|
+
default: false,
|
|
1892
|
+
type: "boolean"
|
|
1893
|
+
}).option("what-if", {
|
|
1894
|
+
alias: ["w"],
|
|
1895
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
1896
|
+
default: false,
|
|
1897
|
+
type: "boolean"
|
|
1898
|
+
}).option("onlyCompositions", {
|
|
1899
|
+
describe: "Only publishing compositions and not patterns",
|
|
1900
|
+
default: false,
|
|
1901
|
+
type: "boolean"
|
|
1902
|
+
}).option("onlyPatterns", {
|
|
1903
|
+
describe: "Only pulling patterns and not compositions",
|
|
1904
|
+
default: false,
|
|
1905
|
+
type: "boolean",
|
|
1906
|
+
hidden: true
|
|
1907
|
+
})
|
|
1908
|
+
)
|
|
1489
1909
|
)
|
|
1490
1910
|
),
|
|
1491
|
-
handler: async ({
|
|
1911
|
+
handler: async ({
|
|
1912
|
+
apiHost,
|
|
1913
|
+
apiKey,
|
|
1914
|
+
proxy,
|
|
1915
|
+
ids,
|
|
1916
|
+
all,
|
|
1917
|
+
onlyCompositions,
|
|
1918
|
+
onlyPatterns,
|
|
1919
|
+
project: projectId,
|
|
1920
|
+
diff,
|
|
1921
|
+
whatIf
|
|
1922
|
+
}) => {
|
|
1923
|
+
if (!all && !ids || all && ids) {
|
|
1924
|
+
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
1925
|
+
process.exit(1);
|
|
1926
|
+
}
|
|
1927
|
+
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
1928
|
+
const targetItems = /* @__PURE__ */ new Map();
|
|
1492
1929
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1493
|
-
const client = new
|
|
1494
|
-
|
|
1930
|
+
const client = new UncachedCanvasClient13({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1931
|
+
const source = createComponentInstanceEngineDataSource({
|
|
1932
|
+
client,
|
|
1933
|
+
state: "published",
|
|
1934
|
+
compositionIDs: compositionIDsArray,
|
|
1935
|
+
onlyCompositions,
|
|
1936
|
+
onlyPatterns
|
|
1937
|
+
});
|
|
1938
|
+
const target = createComponentInstanceEngineDataSource({
|
|
1939
|
+
client,
|
|
1940
|
+
state: "preview",
|
|
1941
|
+
compositionIDs: compositionIDsArray,
|
|
1942
|
+
onlyCompositions,
|
|
1943
|
+
onlyPatterns
|
|
1944
|
+
});
|
|
1945
|
+
const actions = [];
|
|
1946
|
+
const log = createSyncEngineConsoleLogger({ diffMode: diff });
|
|
1947
|
+
for await (const obj of target.objects) {
|
|
1948
|
+
if (Array.isArray(obj.id)) {
|
|
1949
|
+
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
1950
|
+
} else {
|
|
1951
|
+
targetItems.set(obj.id, obj);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
for await (const sourceObject of source.objects) {
|
|
1955
|
+
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
1956
|
+
const targetObject = targetItems.get(id);
|
|
1957
|
+
if (!targetObject) {
|
|
1958
|
+
console.log(`Composition ${id} was not found`);
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
|
|
1962
|
+
log({
|
|
1963
|
+
action: "update",
|
|
1964
|
+
id,
|
|
1965
|
+
providerId: sourceObject.providerId,
|
|
1966
|
+
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
1967
|
+
whatIf,
|
|
1968
|
+
diff: diffJson2(targetObject.object, sourceObject.object)
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1495
1971
|
}
|
|
1496
1972
|
};
|
|
1497
1973
|
|
|
1498
1974
|
// src/commands/canvas/commands/composition/update.ts
|
|
1499
|
-
import { UncachedCanvasClient as
|
|
1975
|
+
import { UncachedCanvasClient as UncachedCanvasClient14 } from "@uniformdev/canvas";
|
|
1500
1976
|
var CompositionUpdateModule = {
|
|
1501
1977
|
command: "update <filename>",
|
|
1502
1978
|
aliases: ["put"],
|
|
1503
|
-
describe: "Insert or update a composition",
|
|
1504
|
-
builder: (
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1979
|
+
describe: "Insert or update a composition",
|
|
1980
|
+
builder: (yargs25) => withConfiguration(
|
|
1981
|
+
withApiOptions(
|
|
1982
|
+
withProjectOptions(
|
|
1983
|
+
withStateOptions(
|
|
1984
|
+
yargs25.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
1985
|
+
)
|
|
1986
|
+
)
|
|
1987
|
+
)
|
|
1988
|
+
),
|
|
1989
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, state }) => {
|
|
1990
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1991
|
+
const client = new UncachedCanvasClient14({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1992
|
+
const file = readFileToObject(filename);
|
|
1993
|
+
await client.updateComposition({ ...file, state: convertCompositionState(state) });
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
|
|
1997
|
+
// src/commands/canvas/commands/composition.ts
|
|
1998
|
+
var CompositionModule = {
|
|
1999
|
+
command: "composition <command>",
|
|
2000
|
+
describe: "Commands for Canvas compositions",
|
|
2001
|
+
aliases: ["comp"],
|
|
2002
|
+
builder: (yargs25) => yargs25.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2003
|
+
handler: () => {
|
|
2004
|
+
yargs3.help();
|
|
2005
|
+
}
|
|
2006
|
+
};
|
|
2007
|
+
|
|
2008
|
+
// src/commands/canvas/commands/contentType.ts
|
|
2009
|
+
import yargs4 from "yargs";
|
|
2010
|
+
|
|
2011
|
+
// src/commands/canvas/commands/contentType/get.ts
|
|
2012
|
+
import { ContentClient } from "@uniformdev/canvas";
|
|
2013
|
+
var ContentTypeGetModule = {
|
|
2014
|
+
command: "get <id>",
|
|
2015
|
+
describe: "Get a content type",
|
|
2016
|
+
builder: (yargs25) => withFormatOptions(
|
|
2017
|
+
withApiOptions(
|
|
2018
|
+
withProjectOptions(
|
|
2019
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2020
|
+
yargs25.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2021
|
+
)
|
|
2022
|
+
)
|
|
2023
|
+
),
|
|
2024
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
2025
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2026
|
+
const client = new ContentClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2027
|
+
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2028
|
+
const found = res.contentTypes.find((f) => f.id === id);
|
|
2029
|
+
if (!found) {
|
|
2030
|
+
throw new Error(`Content type with ID ${id} not found`);
|
|
2031
|
+
}
|
|
2032
|
+
emitWithFormat(found, format, filename);
|
|
2033
|
+
}
|
|
2034
|
+
};
|
|
2035
|
+
|
|
2036
|
+
// src/commands/canvas/commands/contentType/list.ts
|
|
2037
|
+
import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
2038
|
+
var ContentTypeListModule = {
|
|
2039
|
+
command: "list",
|
|
2040
|
+
describe: "List content types",
|
|
2041
|
+
builder: (yargs25) => withFormatOptions(withApiOptions(withProjectOptions(yargs25))),
|
|
2042
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2043
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2044
|
+
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2045
|
+
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2046
|
+
emitWithFormat(res.contentTypes, format, filename);
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
// src/commands/canvas/commands/contentType/pull.ts
|
|
2051
|
+
import { ContentClient as ContentClient3 } from "@uniformdev/canvas";
|
|
2052
|
+
|
|
2053
|
+
// src/commands/canvas/commands/contentType/_util.ts
|
|
2054
|
+
var selectContentTypeIdentifier = (ct) => ct.id;
|
|
2055
|
+
var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
|
|
2056
|
+
|
|
2057
|
+
// src/commands/canvas/contentTypeEngineDataSource.ts
|
|
2058
|
+
function createContentTypeEngineDataSource({
|
|
2059
|
+
client
|
|
2060
|
+
}) {
|
|
2061
|
+
async function* getObjects() {
|
|
2062
|
+
const { contentTypes } = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2063
|
+
for await (const ct of contentTypes) {
|
|
2064
|
+
const result = {
|
|
2065
|
+
id: selectContentTypeIdentifier(ct),
|
|
2066
|
+
displayName: selectContentTypeDisplayName(ct),
|
|
2067
|
+
providerId: ct.id,
|
|
2068
|
+
object: ct
|
|
2069
|
+
};
|
|
2070
|
+
yield result;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
return {
|
|
2074
|
+
objects: getObjects(),
|
|
2075
|
+
deleteObject: async (providerId) => {
|
|
2076
|
+
await client.deleteContentType({ contentTypeId: providerId });
|
|
2077
|
+
},
|
|
2078
|
+
writeObject: async ({ object }) => {
|
|
2079
|
+
await client.upsertContentType({ contentType: object });
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
// src/commands/canvas/commands/contentType/pull.ts
|
|
2085
|
+
var ContentTypePullModule = {
|
|
2086
|
+
command: "pull <directory>",
|
|
2087
|
+
describe: "Pulls all content types to local files in a directory",
|
|
2088
|
+
builder: (yargs25) => withApiOptions(
|
|
2089
|
+
withProjectOptions(
|
|
2090
|
+
withDiffOptions(
|
|
2091
|
+
yargs25.positional("directory", {
|
|
2092
|
+
describe: "Directory to save the content types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2093
|
+
type: "string"
|
|
2094
|
+
}).option("format", {
|
|
2095
|
+
alias: ["f"],
|
|
2096
|
+
describe: "Output format",
|
|
2097
|
+
default: "yaml",
|
|
2098
|
+
choices: ["yaml", "json"],
|
|
2099
|
+
type: "string"
|
|
2100
|
+
}).option("what-if", {
|
|
2101
|
+
alias: ["w"],
|
|
2102
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2103
|
+
default: false,
|
|
2104
|
+
type: "boolean"
|
|
2105
|
+
}).option("mode", {
|
|
2106
|
+
alias: ["m"],
|
|
2107
|
+
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',
|
|
2108
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2109
|
+
default: "mirror",
|
|
2110
|
+
type: "string"
|
|
2111
|
+
})
|
|
2112
|
+
)
|
|
2113
|
+
)
|
|
2114
|
+
),
|
|
2115
|
+
handler: async ({
|
|
2116
|
+
apiHost,
|
|
2117
|
+
apiKey,
|
|
2118
|
+
proxy,
|
|
2119
|
+
directory,
|
|
2120
|
+
format,
|
|
2121
|
+
mode,
|
|
2122
|
+
whatIf,
|
|
2123
|
+
project: projectId,
|
|
2124
|
+
diff: diffMode
|
|
2125
|
+
}) => {
|
|
2126
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2127
|
+
const client = new ContentClient3({
|
|
2128
|
+
apiKey,
|
|
2129
|
+
apiHost,
|
|
2130
|
+
fetch: fetch3,
|
|
2131
|
+
projectId,
|
|
2132
|
+
bypassCache: true
|
|
2133
|
+
});
|
|
2134
|
+
const source = createContentTypeEngineDataSource({ client });
|
|
2135
|
+
let target;
|
|
2136
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2137
|
+
if (isPackage) {
|
|
2138
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
2139
|
+
target = await createArraySyncEngineDataSource({
|
|
2140
|
+
objects: packageContents.contentTypes ?? [],
|
|
2141
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2142
|
+
selectDisplayName: selectContentTypeDisplayName,
|
|
2143
|
+
onSyncComplete: async (_, synced) => {
|
|
2144
|
+
packageContents.contentTypes = synced;
|
|
2145
|
+
writeCanvasPackage(directory, packageContents);
|
|
2146
|
+
}
|
|
2147
|
+
});
|
|
2148
|
+
} else {
|
|
2149
|
+
target = await createFileSyncEngineDataSource({
|
|
2150
|
+
directory,
|
|
2151
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2152
|
+
selectDisplayName: selectContentTypeDisplayName,
|
|
2153
|
+
format
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
await syncEngine({
|
|
2157
|
+
source,
|
|
2158
|
+
target,
|
|
2159
|
+
mode,
|
|
2160
|
+
whatIf,
|
|
2161
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
// src/commands/canvas/commands/contentType/push.ts
|
|
2167
|
+
import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
2168
|
+
var ContentTypePushModule = {
|
|
2169
|
+
command: "push <directory>",
|
|
2170
|
+
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2171
|
+
builder: (yargs25) => withApiOptions(
|
|
2172
|
+
withProjectOptions(
|
|
2173
|
+
withDiffOptions(
|
|
2174
|
+
yargs25.positional("directory", {
|
|
2175
|
+
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2176
|
+
type: "string"
|
|
2177
|
+
}).option("what-if", {
|
|
2178
|
+
alias: ["w"],
|
|
2179
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2180
|
+
default: false,
|
|
2181
|
+
type: "boolean"
|
|
2182
|
+
}).option("mode", {
|
|
2183
|
+
alias: ["m"],
|
|
2184
|
+
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',
|
|
2185
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2186
|
+
default: "mirror",
|
|
2187
|
+
type: "string"
|
|
2188
|
+
})
|
|
2189
|
+
)
|
|
2190
|
+
)
|
|
2191
|
+
),
|
|
2192
|
+
handler: async ({
|
|
2193
|
+
apiHost,
|
|
2194
|
+
apiKey,
|
|
2195
|
+
proxy,
|
|
2196
|
+
directory,
|
|
2197
|
+
mode,
|
|
2198
|
+
whatIf,
|
|
2199
|
+
project: projectId,
|
|
2200
|
+
diff: diffMode
|
|
2201
|
+
}) => {
|
|
2202
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2203
|
+
const client = new ContentClient4({
|
|
2204
|
+
apiKey,
|
|
2205
|
+
apiHost,
|
|
2206
|
+
fetch: fetch3,
|
|
2207
|
+
projectId,
|
|
2208
|
+
bypassCache: true
|
|
2209
|
+
});
|
|
2210
|
+
let source;
|
|
2211
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2212
|
+
if (isPackage) {
|
|
2213
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
2214
|
+
source = await createArraySyncEngineDataSource({
|
|
2215
|
+
objects: packageContents.contentTypes ?? [],
|
|
2216
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2217
|
+
selectDisplayName: selectContentTypeDisplayName
|
|
2218
|
+
});
|
|
2219
|
+
} else {
|
|
2220
|
+
source = await createFileSyncEngineDataSource({
|
|
2221
|
+
directory,
|
|
2222
|
+
selectIdentifier: selectContentTypeIdentifier,
|
|
2223
|
+
selectDisplayName: selectContentTypeDisplayName
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2226
|
+
const target = createContentTypeEngineDataSource({ client });
|
|
2227
|
+
await syncEngine({
|
|
2228
|
+
source,
|
|
2229
|
+
target,
|
|
2230
|
+
mode,
|
|
2231
|
+
whatIf,
|
|
2232
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2237
|
+
// src/commands/canvas/commands/contentType/remove.ts
|
|
2238
|
+
import { ContentClient as ContentClient5 } from "@uniformdev/canvas";
|
|
2239
|
+
var ContentTypeRemoveModule = {
|
|
2240
|
+
command: "remove <id>",
|
|
2241
|
+
aliases: ["delete", "rm"],
|
|
2242
|
+
describe: "Delete a content type",
|
|
2243
|
+
builder: (yargs25) => withApiOptions(
|
|
2244
|
+
withProjectOptions(
|
|
2245
|
+
yargs25.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2246
|
+
)
|
|
2247
|
+
),
|
|
2248
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
2249
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2250
|
+
const client = new ContentClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2251
|
+
await client.deleteContentType({ contentTypeId: id });
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
// src/commands/canvas/commands/contentType/update.ts
|
|
2256
|
+
import { ContentClient as ContentClient6 } from "@uniformdev/canvas";
|
|
2257
|
+
var ContentTypeUpdateModule = {
|
|
2258
|
+
command: "update <filename>",
|
|
2259
|
+
aliases: ["put"],
|
|
2260
|
+
describe: "Insert or update a content type",
|
|
2261
|
+
builder: (yargs25) => withApiOptions(
|
|
2262
|
+
withProjectOptions(
|
|
2263
|
+
yargs25.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2264
|
+
)
|
|
2265
|
+
),
|
|
2266
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2267
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2268
|
+
const client = new ContentClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2269
|
+
const file = readFileToObject(filename);
|
|
2270
|
+
await client.upsertContentType({ contentType: file });
|
|
2271
|
+
}
|
|
2272
|
+
};
|
|
2273
|
+
|
|
2274
|
+
// src/commands/canvas/commands/contentType.ts
|
|
2275
|
+
var ContentTypeModule = {
|
|
2276
|
+
command: "contenttype <command>",
|
|
2277
|
+
aliases: ["ct"],
|
|
2278
|
+
describe: "Commands for Content Types",
|
|
2279
|
+
builder: (yargs25) => yargs25.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2280
|
+
handler: () => {
|
|
2281
|
+
yargs4.help();
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
// src/commands/canvas/commands/dataType.ts
|
|
2286
|
+
import yargs5 from "yargs";
|
|
2287
|
+
|
|
2288
|
+
// src/commands/canvas/commands/dataType/get.ts
|
|
2289
|
+
import { DataTypeClient } from "@uniformdev/canvas";
|
|
2290
|
+
var DataTypeGetModule = {
|
|
2291
|
+
command: "get <id>",
|
|
2292
|
+
describe: "Get a data type",
|
|
2293
|
+
aliases: ["ls"],
|
|
2294
|
+
builder: (yargs25) => withConfiguration(
|
|
2295
|
+
withFormatOptions(
|
|
2296
|
+
withApiOptions(
|
|
2297
|
+
withProjectOptions(
|
|
2298
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2299
|
+
yargs25.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2300
|
+
)
|
|
2301
|
+
)
|
|
2302
|
+
)
|
|
2303
|
+
),
|
|
2304
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
2305
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2306
|
+
const client = new DataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2307
|
+
const res = await client.get();
|
|
2308
|
+
const found = res.results.find((f) => f.id === id);
|
|
2309
|
+
if (!found) {
|
|
2310
|
+
throw new Error(`Data type with ID ${id} not found`);
|
|
2311
|
+
}
|
|
2312
|
+
emitWithFormat(found, format, filename);
|
|
2313
|
+
}
|
|
2314
|
+
};
|
|
2315
|
+
|
|
2316
|
+
// src/commands/canvas/commands/dataType/list.ts
|
|
2317
|
+
import { DataTypeClient as DataTypeClient2 } from "@uniformdev/canvas";
|
|
2318
|
+
var DataTypeListModule = {
|
|
2319
|
+
command: "list",
|
|
2320
|
+
describe: "List data types",
|
|
2321
|
+
aliases: ["ls"],
|
|
2322
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2323
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2324
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2325
|
+
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2326
|
+
const res = await client.get();
|
|
2327
|
+
emitWithFormat(res.results, format, filename);
|
|
2328
|
+
}
|
|
2329
|
+
};
|
|
2330
|
+
|
|
2331
|
+
// src/commands/canvas/commands/dataType/pull.ts
|
|
2332
|
+
import { DataTypeClient as DataTypeClient3 } from "@uniformdev/canvas";
|
|
2333
|
+
|
|
2334
|
+
// src/commands/canvas/commands/dataType/_util.ts
|
|
2335
|
+
var selectIdentifier4 = (dataType) => dataType.id;
|
|
2336
|
+
var selectDisplayName4 = (dataType) => `${dataType.displayName} (pid: ${dataType.id})`;
|
|
2337
|
+
|
|
2338
|
+
// src/commands/canvas/dataTypeEngineDataSource.ts
|
|
2339
|
+
function createDataTypeEngineDataSource({
|
|
2340
|
+
client
|
|
2341
|
+
}) {
|
|
2342
|
+
async function* getObjects() {
|
|
2343
|
+
const dataTypes = (await client.get()).results;
|
|
2344
|
+
for await (const dataType of dataTypes) {
|
|
2345
|
+
const result = {
|
|
2346
|
+
id: selectIdentifier4(dataType),
|
|
2347
|
+
displayName: selectDisplayName4(dataType),
|
|
2348
|
+
providerId: dataType.id,
|
|
2349
|
+
object: dataType
|
|
2350
|
+
};
|
|
2351
|
+
yield result;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
return {
|
|
2355
|
+
objects: getObjects(),
|
|
2356
|
+
deleteObject: async (providerId) => {
|
|
2357
|
+
await client.remove({ typeId: providerId });
|
|
2358
|
+
},
|
|
2359
|
+
writeObject: async (object) => {
|
|
2360
|
+
await client.upsert({
|
|
2361
|
+
data: object.object
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
// src/commands/canvas/commands/dataType/pull.ts
|
|
2368
|
+
var DataTypePullModule = {
|
|
2369
|
+
command: "pull <directory>",
|
|
2370
|
+
describe: "Pulls all data types to local files in a directory",
|
|
2371
|
+
builder: (yargs25) => withConfiguration(
|
|
2372
|
+
withApiOptions(
|
|
2373
|
+
withProjectOptions(
|
|
2374
|
+
withDiffOptions(
|
|
2375
|
+
yargs25.positional("directory", {
|
|
2376
|
+
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.",
|
|
2377
|
+
type: "string"
|
|
2378
|
+
}).option("format", {
|
|
2379
|
+
alias: ["f"],
|
|
2380
|
+
describe: "Output format",
|
|
2381
|
+
default: "yaml",
|
|
2382
|
+
choices: ["yaml", "json"],
|
|
2383
|
+
type: "string"
|
|
2384
|
+
}).option("what-if", {
|
|
2385
|
+
alias: ["w"],
|
|
2386
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2387
|
+
default: false,
|
|
2388
|
+
type: "boolean"
|
|
2389
|
+
}).option("mode", {
|
|
2390
|
+
alias: ["m"],
|
|
2391
|
+
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',
|
|
2392
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2393
|
+
default: "mirror",
|
|
2394
|
+
type: "string"
|
|
2395
|
+
})
|
|
2396
|
+
)
|
|
2397
|
+
)
|
|
2398
|
+
)
|
|
2399
|
+
),
|
|
2400
|
+
handler: async ({
|
|
2401
|
+
apiHost,
|
|
2402
|
+
apiKey,
|
|
2403
|
+
proxy,
|
|
2404
|
+
directory,
|
|
2405
|
+
format,
|
|
2406
|
+
mode,
|
|
2407
|
+
whatIf,
|
|
2408
|
+
project: projectId,
|
|
2409
|
+
diff: diffMode
|
|
2410
|
+
}) => {
|
|
2411
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2412
|
+
const client = new DataTypeClient3({
|
|
2413
|
+
apiKey,
|
|
2414
|
+
apiHost,
|
|
2415
|
+
fetch: fetch3,
|
|
2416
|
+
projectId,
|
|
2417
|
+
bypassCache: true
|
|
2418
|
+
});
|
|
2419
|
+
const source = createDataTypeEngineDataSource({ client });
|
|
2420
|
+
let target;
|
|
2421
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2422
|
+
if (isPackage) {
|
|
2423
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
2424
|
+
target = await createArraySyncEngineDataSource({
|
|
2425
|
+
objects: packageContents.dataTypes ?? [],
|
|
2426
|
+
selectIdentifier: selectIdentifier4,
|
|
2427
|
+
selectDisplayName: selectDisplayName4,
|
|
2428
|
+
onSyncComplete: async (_, synced) => {
|
|
2429
|
+
packageContents.dataTypes = synced;
|
|
2430
|
+
writeCanvasPackage(directory, packageContents);
|
|
2431
|
+
}
|
|
2432
|
+
});
|
|
2433
|
+
} else {
|
|
2434
|
+
target = await createFileSyncEngineDataSource({
|
|
2435
|
+
directory,
|
|
2436
|
+
selectIdentifier: selectIdentifier4,
|
|
2437
|
+
selectDisplayName: selectDisplayName4,
|
|
2438
|
+
format
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
await syncEngine({
|
|
2442
|
+
source,
|
|
2443
|
+
target,
|
|
2444
|
+
mode,
|
|
2445
|
+
whatIf,
|
|
2446
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
|
|
2451
|
+
// src/commands/canvas/commands/dataType/push.ts
|
|
2452
|
+
import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
2453
|
+
var DataTypePushModule = {
|
|
2454
|
+
command: "push <directory>",
|
|
2455
|
+
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2456
|
+
builder: (yargs25) => withConfiguration(
|
|
2457
|
+
withApiOptions(
|
|
2458
|
+
withProjectOptions(
|
|
2459
|
+
withDiffOptions(
|
|
2460
|
+
yargs25.positional("directory", {
|
|
2461
|
+
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2462
|
+
type: "string"
|
|
2463
|
+
}).option("what-if", {
|
|
2464
|
+
alias: ["w"],
|
|
2465
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2466
|
+
default: false,
|
|
2467
|
+
type: "boolean"
|
|
2468
|
+
}).option("mode", {
|
|
2469
|
+
alias: ["m"],
|
|
2470
|
+
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',
|
|
2471
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2472
|
+
default: "mirror",
|
|
2473
|
+
type: "string"
|
|
2474
|
+
})
|
|
2475
|
+
)
|
|
2476
|
+
)
|
|
2477
|
+
)
|
|
2478
|
+
),
|
|
2479
|
+
handler: async ({
|
|
2480
|
+
apiHost,
|
|
2481
|
+
apiKey,
|
|
2482
|
+
proxy,
|
|
2483
|
+
directory,
|
|
2484
|
+
mode,
|
|
2485
|
+
whatIf,
|
|
2486
|
+
project: projectId,
|
|
2487
|
+
diff: diffMode
|
|
2488
|
+
}) => {
|
|
2489
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2490
|
+
const client = new DataTypeClient4({
|
|
2491
|
+
apiKey,
|
|
2492
|
+
apiHost,
|
|
2493
|
+
fetch: fetch3,
|
|
2494
|
+
projectId,
|
|
2495
|
+
bypassCache: true
|
|
2496
|
+
});
|
|
2497
|
+
let source;
|
|
2498
|
+
const isPackage = isPathAPackageFile(directory);
|
|
2499
|
+
if (isPackage) {
|
|
2500
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
2501
|
+
source = await createArraySyncEngineDataSource({
|
|
2502
|
+
objects: packageContents.dataTypes ?? [],
|
|
2503
|
+
selectIdentifier: selectIdentifier4,
|
|
2504
|
+
selectDisplayName: selectDisplayName4
|
|
2505
|
+
});
|
|
2506
|
+
} else {
|
|
2507
|
+
source = await createFileSyncEngineDataSource({
|
|
2508
|
+
directory,
|
|
2509
|
+
selectIdentifier: selectIdentifier4,
|
|
2510
|
+
selectDisplayName: selectDisplayName4
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
const target = createDataTypeEngineDataSource({ client });
|
|
2514
|
+
await syncEngine({
|
|
2515
|
+
source,
|
|
2516
|
+
target,
|
|
2517
|
+
mode,
|
|
2518
|
+
whatIf,
|
|
2519
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
// src/commands/canvas/commands/dataType/remove.ts
|
|
2525
|
+
import { DataTypeClient as DataTypeClient5 } from "@uniformdev/canvas";
|
|
2526
|
+
var DataTypeRemoveModule = {
|
|
2527
|
+
command: "remove <id>",
|
|
2528
|
+
aliases: ["delete", "rm"],
|
|
2529
|
+
describe: "Delete a data type",
|
|
2530
|
+
builder: (yargs25) => withConfiguration(
|
|
2531
|
+
withApiOptions(
|
|
2532
|
+
withProjectOptions(
|
|
2533
|
+
yargs25.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2534
|
+
)
|
|
2535
|
+
)
|
|
2536
|
+
),
|
|
2537
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
2538
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2539
|
+
const client = new DataTypeClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2540
|
+
await client.remove({ typeId: id });
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2543
|
+
|
|
2544
|
+
// src/commands/canvas/commands/dataType/update.ts
|
|
2545
|
+
import { DataTypeClient as DataTypeClient6 } from "@uniformdev/canvas";
|
|
2546
|
+
var DataTypeUpdateModule = {
|
|
2547
|
+
command: "update <filename>",
|
|
2548
|
+
aliases: ["put"],
|
|
2549
|
+
describe: "Insert or update a data type",
|
|
2550
|
+
builder: (yargs25) => withConfiguration(
|
|
2551
|
+
withApiOptions(
|
|
2552
|
+
withProjectOptions(
|
|
2553
|
+
yargs25.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
1508
2554
|
)
|
|
1509
2555
|
)
|
|
1510
2556
|
),
|
|
1511
|
-
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId
|
|
2557
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
1512
2558
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1513
|
-
const client = new
|
|
2559
|
+
const client = new DataTypeClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
1514
2560
|
const file = readFileToObject(filename);
|
|
1515
|
-
await client.
|
|
2561
|
+
await client.upsert({ data: file });
|
|
1516
2562
|
}
|
|
1517
2563
|
};
|
|
1518
2564
|
|
|
1519
|
-
// src/commands/canvas/commands/
|
|
1520
|
-
var
|
|
1521
|
-
command: "
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
builder: (
|
|
2565
|
+
// src/commands/canvas/commands/dataType.ts
|
|
2566
|
+
var DataTypeModule = {
|
|
2567
|
+
command: "datatype <command>",
|
|
2568
|
+
aliases: ["dt"],
|
|
2569
|
+
describe: "Commands for Data Type definitions",
|
|
2570
|
+
builder: (yargs25) => yargs25.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
1525
2571
|
handler: () => {
|
|
1526
|
-
|
|
2572
|
+
yargs5.help();
|
|
1527
2573
|
}
|
|
1528
2574
|
};
|
|
1529
2575
|
|
|
1530
|
-
// src/commands/canvas/commands/
|
|
1531
|
-
import
|
|
2576
|
+
// src/commands/canvas/commands/entry.ts
|
|
2577
|
+
import yargs6 from "yargs";
|
|
1532
2578
|
|
|
1533
|
-
// src/commands/canvas/commands/
|
|
1534
|
-
import {
|
|
1535
|
-
var
|
|
2579
|
+
// src/commands/canvas/commands/entry/get.ts
|
|
2580
|
+
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
2581
|
+
var EntryGetModule = {
|
|
1536
2582
|
command: "get <id>",
|
|
1537
|
-
describe: "Get
|
|
1538
|
-
|
|
1539
|
-
builder: (yargs21) => withFormatOptions(
|
|
2583
|
+
describe: "Get an entry",
|
|
2584
|
+
builder: (yargs25) => withFormatOptions(
|
|
1540
2585
|
withApiOptions(
|
|
1541
2586
|
withProjectOptions(
|
|
1542
2587
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1543
|
-
|
|
2588
|
+
yargs25.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
1544
2589
|
)
|
|
1545
2590
|
)
|
|
1546
2591
|
),
|
|
1547
2592
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
1548
2593
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1549
|
-
const client = new
|
|
1550
|
-
const res = await client.
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
throw new Error(`Data type with ID ${id} not found`);
|
|
2594
|
+
const client = new ContentClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2595
|
+
const res = await client.getEntries({ offset: 0, limit: 1, entryIDs: [id] });
|
|
2596
|
+
if (res.entries.length !== 1) {
|
|
2597
|
+
throw new Error(`Entry with ID ${id} not found`);
|
|
1554
2598
|
}
|
|
1555
|
-
emitWithFormat(
|
|
2599
|
+
emitWithFormat(res.entries[0], format, filename);
|
|
1556
2600
|
}
|
|
1557
2601
|
};
|
|
1558
2602
|
|
|
1559
|
-
// src/commands/canvas/commands/
|
|
1560
|
-
import {
|
|
1561
|
-
var
|
|
2603
|
+
// src/commands/canvas/commands/entry/list.ts
|
|
2604
|
+
import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
2605
|
+
var EntryListModule = {
|
|
1562
2606
|
command: "list",
|
|
1563
|
-
describe: "List
|
|
1564
|
-
|
|
1565
|
-
builder: (yargs21) => withFormatOptions(withApiOptions(withProjectOptions(yargs21))),
|
|
2607
|
+
describe: "List entries",
|
|
2608
|
+
builder: (yargs25) => withFormatOptions(withApiOptions(withProjectOptions(yargs25))),
|
|
1566
2609
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1567
2610
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1568
|
-
const client = new
|
|
1569
|
-
const res = await client.
|
|
1570
|
-
emitWithFormat(res.
|
|
2611
|
+
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2612
|
+
const res = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
2613
|
+
emitWithFormat(res.entries, format, filename);
|
|
1571
2614
|
}
|
|
1572
2615
|
};
|
|
1573
2616
|
|
|
1574
|
-
// src/commands/canvas/commands/
|
|
1575
|
-
import {
|
|
2617
|
+
// src/commands/canvas/commands/entry/pull.ts
|
|
2618
|
+
import { ContentClient as ContentClient9 } from "@uniformdev/canvas";
|
|
1576
2619
|
|
|
1577
|
-
// src/commands/canvas/commands/
|
|
1578
|
-
var
|
|
1579
|
-
var
|
|
2620
|
+
// src/commands/canvas/commands/entry/_util.ts
|
|
2621
|
+
var selectEntryIdentifier = (e) => e.entry._id;
|
|
2622
|
+
var selectEntryDisplayName = (e) => `${e.entry._name ?? "Untitled"} (pid: ${e.entry._id})`;
|
|
1580
2623
|
|
|
1581
|
-
// src/commands/canvas/
|
|
1582
|
-
function
|
|
2624
|
+
// src/commands/canvas/entryEngineDataSource.ts
|
|
2625
|
+
function createEntryEngineDataSource({
|
|
1583
2626
|
client
|
|
1584
2627
|
}) {
|
|
1585
2628
|
async function* getObjects() {
|
|
1586
|
-
const
|
|
1587
|
-
for await (const
|
|
2629
|
+
const { entries } = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
2630
|
+
for await (const e of entries) {
|
|
1588
2631
|
const result = {
|
|
1589
|
-
id:
|
|
1590
|
-
displayName:
|
|
1591
|
-
providerId:
|
|
1592
|
-
object:
|
|
2632
|
+
id: selectEntryIdentifier(e),
|
|
2633
|
+
displayName: selectEntryDisplayName(e),
|
|
2634
|
+
providerId: e.entry._id,
|
|
2635
|
+
object: e
|
|
1593
2636
|
};
|
|
1594
2637
|
yield result;
|
|
1595
2638
|
}
|
|
@@ -1597,25 +2640,23 @@ function createDataTypeEngineDataSource({
|
|
|
1597
2640
|
return {
|
|
1598
2641
|
objects: getObjects(),
|
|
1599
2642
|
deleteObject: async (providerId) => {
|
|
1600
|
-
await client.
|
|
2643
|
+
await client.deleteEntry({ entryId: providerId });
|
|
1601
2644
|
},
|
|
1602
|
-
writeObject: async (object) => {
|
|
1603
|
-
await client.
|
|
1604
|
-
data: object.object
|
|
1605
|
-
});
|
|
2645
|
+
writeObject: async ({ object }) => {
|
|
2646
|
+
await client.upsertEntry(object);
|
|
1606
2647
|
}
|
|
1607
2648
|
};
|
|
1608
2649
|
}
|
|
1609
2650
|
|
|
1610
|
-
// src/commands/canvas/commands/
|
|
1611
|
-
var
|
|
2651
|
+
// src/commands/canvas/commands/entry/pull.ts
|
|
2652
|
+
var EntryPullModule = {
|
|
1612
2653
|
command: "pull <directory>",
|
|
1613
|
-
describe: "Pulls all
|
|
1614
|
-
builder: (
|
|
2654
|
+
describe: "Pulls all entries to local files in a directory",
|
|
2655
|
+
builder: (yargs25) => withApiOptions(
|
|
1615
2656
|
withProjectOptions(
|
|
1616
2657
|
withDiffOptions(
|
|
1617
|
-
|
|
1618
|
-
describe: "Directory to save the
|
|
2658
|
+
yargs25.positional("directory", {
|
|
2659
|
+
describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
1619
2660
|
type: "string"
|
|
1620
2661
|
}).option("format", {
|
|
1621
2662
|
alias: ["f"],
|
|
@@ -1650,32 +2691,32 @@ var DataTypePullModule = {
|
|
|
1650
2691
|
diff: diffMode
|
|
1651
2692
|
}) => {
|
|
1652
2693
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1653
|
-
const client = new
|
|
2694
|
+
const client = new ContentClient9({
|
|
1654
2695
|
apiKey,
|
|
1655
2696
|
apiHost,
|
|
1656
2697
|
fetch: fetch3,
|
|
1657
2698
|
projectId,
|
|
1658
2699
|
bypassCache: true
|
|
1659
2700
|
});
|
|
1660
|
-
const source =
|
|
2701
|
+
const source = createEntryEngineDataSource({ client });
|
|
1661
2702
|
let target;
|
|
1662
2703
|
const isPackage = isPathAPackageFile(directory);
|
|
1663
2704
|
if (isPackage) {
|
|
1664
2705
|
const packageContents = readCanvasPackage(directory, false);
|
|
1665
2706
|
target = await createArraySyncEngineDataSource({
|
|
1666
|
-
objects: packageContents.
|
|
1667
|
-
selectIdentifier:
|
|
1668
|
-
selectDisplayName:
|
|
2707
|
+
objects: packageContents.entries ?? [],
|
|
2708
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2709
|
+
selectDisplayName: selectEntryDisplayName,
|
|
1669
2710
|
onSyncComplete: async (_, synced) => {
|
|
1670
|
-
packageContents.
|
|
2711
|
+
packageContents.entries = synced;
|
|
1671
2712
|
writeCanvasPackage(directory, packageContents);
|
|
1672
2713
|
}
|
|
1673
2714
|
});
|
|
1674
2715
|
} else {
|
|
1675
2716
|
target = await createFileSyncEngineDataSource({
|
|
1676
2717
|
directory,
|
|
1677
|
-
selectIdentifier:
|
|
1678
|
-
selectDisplayName:
|
|
2718
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2719
|
+
selectDisplayName: selectEntryDisplayName,
|
|
1679
2720
|
format
|
|
1680
2721
|
});
|
|
1681
2722
|
}
|
|
@@ -1689,16 +2730,16 @@ var DataTypePullModule = {
|
|
|
1689
2730
|
}
|
|
1690
2731
|
};
|
|
1691
2732
|
|
|
1692
|
-
// src/commands/canvas/commands/
|
|
1693
|
-
import {
|
|
1694
|
-
var
|
|
2733
|
+
// src/commands/canvas/commands/entry/push.ts
|
|
2734
|
+
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
2735
|
+
var EntryPushModule = {
|
|
1695
2736
|
command: "push <directory>",
|
|
1696
|
-
describe: "Pushes all
|
|
1697
|
-
builder: (
|
|
2737
|
+
describe: "Pushes all entries from files in a directory to Uniform",
|
|
2738
|
+
builder: (yargs25) => withApiOptions(
|
|
1698
2739
|
withProjectOptions(
|
|
1699
2740
|
withDiffOptions(
|
|
1700
|
-
|
|
1701
|
-
describe: "Directory to read the
|
|
2741
|
+
yargs25.positional("directory", {
|
|
2742
|
+
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
1702
2743
|
type: "string"
|
|
1703
2744
|
}).option("what-if", {
|
|
1704
2745
|
alias: ["w"],
|
|
@@ -1726,7 +2767,7 @@ var DataTypePushModule = {
|
|
|
1726
2767
|
diff: diffMode
|
|
1727
2768
|
}) => {
|
|
1728
2769
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1729
|
-
const client = new
|
|
2770
|
+
const client = new ContentClient10({
|
|
1730
2771
|
apiKey,
|
|
1731
2772
|
apiHost,
|
|
1732
2773
|
fetch: fetch3,
|
|
@@ -1738,18 +2779,18 @@ var DataTypePushModule = {
|
|
|
1738
2779
|
if (isPackage) {
|
|
1739
2780
|
const packageContents = readCanvasPackage(directory, true);
|
|
1740
2781
|
source = await createArraySyncEngineDataSource({
|
|
1741
|
-
objects: packageContents.
|
|
1742
|
-
selectIdentifier:
|
|
1743
|
-
selectDisplayName:
|
|
2782
|
+
objects: packageContents.entries ?? [],
|
|
2783
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2784
|
+
selectDisplayName: selectEntryDisplayName
|
|
1744
2785
|
});
|
|
1745
2786
|
} else {
|
|
1746
2787
|
source = await createFileSyncEngineDataSource({
|
|
1747
2788
|
directory,
|
|
1748
|
-
selectIdentifier:
|
|
1749
|
-
selectDisplayName:
|
|
2789
|
+
selectIdentifier: selectEntryIdentifier,
|
|
2790
|
+
selectDisplayName: selectEntryDisplayName
|
|
1750
2791
|
});
|
|
1751
2792
|
}
|
|
1752
|
-
const target =
|
|
2793
|
+
const target = createEntryEngineDataSource({ client });
|
|
1753
2794
|
await syncEngine({
|
|
1754
2795
|
source,
|
|
1755
2796
|
target,
|
|
@@ -1760,51 +2801,280 @@ var DataTypePushModule = {
|
|
|
1760
2801
|
}
|
|
1761
2802
|
};
|
|
1762
2803
|
|
|
1763
|
-
// src/commands/canvas/commands/
|
|
1764
|
-
import {
|
|
1765
|
-
var
|
|
2804
|
+
// src/commands/canvas/commands/entry/remove.ts
|
|
2805
|
+
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
2806
|
+
var EntryRemoveModule = {
|
|
1766
2807
|
command: "remove <id>",
|
|
1767
2808
|
aliases: ["delete", "rm"],
|
|
1768
|
-
describe: "Delete
|
|
1769
|
-
builder: (
|
|
2809
|
+
describe: "Delete an entry",
|
|
2810
|
+
builder: (yargs25) => withApiOptions(
|
|
1770
2811
|
withProjectOptions(
|
|
1771
|
-
|
|
2812
|
+
yargs25.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
1772
2813
|
)
|
|
1773
2814
|
),
|
|
1774
2815
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
1775
2816
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1776
|
-
const client = new
|
|
1777
|
-
await client.
|
|
2817
|
+
const client = new ContentClient11({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2818
|
+
await client.deleteEntry({ entryId: id });
|
|
1778
2819
|
}
|
|
1779
2820
|
};
|
|
1780
2821
|
|
|
1781
|
-
// src/commands/canvas/commands/
|
|
1782
|
-
import {
|
|
1783
|
-
var
|
|
2822
|
+
// src/commands/canvas/commands/entry/update.ts
|
|
2823
|
+
import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
|
|
2824
|
+
var EntryUpdateModule = {
|
|
1784
2825
|
command: "update <filename>",
|
|
1785
2826
|
aliases: ["put"],
|
|
1786
|
-
describe: "Insert or update
|
|
1787
|
-
builder: (
|
|
1788
|
-
withProjectOptions(
|
|
1789
|
-
yargs21.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
1790
|
-
)
|
|
2827
|
+
describe: "Insert or update an entry",
|
|
2828
|
+
builder: (yargs25) => withApiOptions(
|
|
2829
|
+
withProjectOptions(yargs25.positional("filename", { demandOption: true, describe: "Entry file to put" }))
|
|
1791
2830
|
),
|
|
1792
2831
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
1793
2832
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1794
|
-
const client = new
|
|
2833
|
+
const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
1795
2834
|
const file = readFileToObject(filename);
|
|
1796
|
-
await client.
|
|
2835
|
+
await client.upsertEntry(file);
|
|
1797
2836
|
}
|
|
1798
2837
|
};
|
|
1799
2838
|
|
|
1800
|
-
// src/commands/canvas/commands/
|
|
1801
|
-
var
|
|
1802
|
-
command: "
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
builder: (yargs21) => yargs21.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
2839
|
+
// src/commands/canvas/commands/entry.ts
|
|
2840
|
+
var EntryModule = {
|
|
2841
|
+
command: "entry <command>",
|
|
2842
|
+
describe: "Commands for Entries",
|
|
2843
|
+
builder: (yargs25) => yargs25.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
1806
2844
|
handler: () => {
|
|
1807
|
-
|
|
2845
|
+
yargs6.help();
|
|
2846
|
+
}
|
|
2847
|
+
};
|
|
2848
|
+
|
|
2849
|
+
// src/commands/canvas/commands/pattern.ts
|
|
2850
|
+
import yargs7 from "yargs";
|
|
2851
|
+
|
|
2852
|
+
// src/commands/canvas/commands/pattern/get.ts
|
|
2853
|
+
var PatternGetModule = {
|
|
2854
|
+
...CompositionGetModule,
|
|
2855
|
+
describe: "Fetch a pattern"
|
|
2856
|
+
};
|
|
2857
|
+
|
|
2858
|
+
// src/commands/canvas/commands/pattern/list.ts
|
|
2859
|
+
var PatternListModule = {
|
|
2860
|
+
...CompositionListModule,
|
|
2861
|
+
describe: "List patterns",
|
|
2862
|
+
builder: (yargs25) => withFormatOptions(
|
|
2863
|
+
withConfiguration(
|
|
2864
|
+
withApiOptions(
|
|
2865
|
+
withProjectOptions(
|
|
2866
|
+
withStateOptions(
|
|
2867
|
+
yargs25.options({
|
|
2868
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2869
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2870
|
+
resolvePatterns: {
|
|
2871
|
+
type: "boolean",
|
|
2872
|
+
default: false,
|
|
2873
|
+
describe: "Resolve pattern references in the composition"
|
|
2874
|
+
},
|
|
2875
|
+
resolveOverrides: {
|
|
2876
|
+
type: "boolean",
|
|
2877
|
+
default: false,
|
|
2878
|
+
describe: "Resolves pattern overrides in the composition and removes override definition data"
|
|
2879
|
+
},
|
|
2880
|
+
onlyPatterns: {
|
|
2881
|
+
describe: "Only pulling patterns and not compositions",
|
|
2882
|
+
// This default differentiate this list command from composition list command
|
|
2883
|
+
default: true,
|
|
2884
|
+
type: "boolean",
|
|
2885
|
+
hidden: true
|
|
2886
|
+
},
|
|
2887
|
+
componentIDs: {
|
|
2888
|
+
alias: ["componentIDs"],
|
|
2889
|
+
type: "boolean",
|
|
2890
|
+
default: false,
|
|
2891
|
+
describe: "Include individual component UIDs"
|
|
2892
|
+
}
|
|
2893
|
+
})
|
|
2894
|
+
)
|
|
2895
|
+
)
|
|
2896
|
+
)
|
|
2897
|
+
)
|
|
2898
|
+
)
|
|
2899
|
+
};
|
|
2900
|
+
|
|
2901
|
+
// src/commands/canvas/commands/pattern/publish.ts
|
|
2902
|
+
var PatternPublishModule = {
|
|
2903
|
+
...CompositionPublishModule,
|
|
2904
|
+
describe: "Publishes pattern(s)",
|
|
2905
|
+
builder: (yargs25) => withConfiguration(
|
|
2906
|
+
withApiOptions(
|
|
2907
|
+
withProjectOptions(
|
|
2908
|
+
withDiffOptions(
|
|
2909
|
+
yargs25.positional("ids", {
|
|
2910
|
+
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2911
|
+
type: "string"
|
|
2912
|
+
}).option("all", {
|
|
2913
|
+
alias: ["a"],
|
|
2914
|
+
describe: "Publishes all patterns. Use compositionId to publish one instead.",
|
|
2915
|
+
default: false,
|
|
2916
|
+
type: "boolean"
|
|
2917
|
+
}).option("what-if", {
|
|
2918
|
+
alias: ["w"],
|
|
2919
|
+
describe: "What-if mode reports what would be done but does not perform any un-publishing",
|
|
2920
|
+
default: false,
|
|
2921
|
+
type: "boolean"
|
|
2922
|
+
}).option("publishingState", {
|
|
2923
|
+
describe: 'Publishing state to update to. Can be "published" or "preview".',
|
|
2924
|
+
default: "published",
|
|
2925
|
+
type: "string",
|
|
2926
|
+
hidden: true
|
|
2927
|
+
}).option("onlyCompositions", {
|
|
2928
|
+
describe: "Only publishing compositions and not patterns",
|
|
2929
|
+
default: false,
|
|
2930
|
+
type: "boolean"
|
|
2931
|
+
}).option("onlyPatterns", {
|
|
2932
|
+
describe: "Only pulling patterns and not compositions",
|
|
2933
|
+
default: true,
|
|
2934
|
+
type: "boolean",
|
|
2935
|
+
hidden: true
|
|
2936
|
+
})
|
|
2937
|
+
)
|
|
2938
|
+
)
|
|
2939
|
+
)
|
|
2940
|
+
)
|
|
2941
|
+
};
|
|
2942
|
+
|
|
2943
|
+
// src/commands/canvas/commands/pattern/pull.ts
|
|
2944
|
+
var PatternPullModule = {
|
|
2945
|
+
...CompositionPullModule,
|
|
2946
|
+
describe: "Pulls all patterns to local files in a directory",
|
|
2947
|
+
builder: (yargs25) => withConfiguration(
|
|
2948
|
+
withApiOptions(
|
|
2949
|
+
withProjectOptions(
|
|
2950
|
+
withStateOptions(
|
|
2951
|
+
withDiffOptions(
|
|
2952
|
+
yargs25.positional("directory", {
|
|
2953
|
+
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.",
|
|
2954
|
+
type: "string"
|
|
2955
|
+
}).option("format", {
|
|
2956
|
+
alias: ["f"],
|
|
2957
|
+
describe: "Output format",
|
|
2958
|
+
default: "yaml",
|
|
2959
|
+
choices: ["yaml", "json"],
|
|
2960
|
+
type: "string"
|
|
2961
|
+
}).option("onlyPatterns", {
|
|
2962
|
+
describe: "Only pulling patterns and not compositions",
|
|
2963
|
+
// This default differentiate this list command from composition list command
|
|
2964
|
+
default: true,
|
|
2965
|
+
type: "boolean",
|
|
2966
|
+
hidden: true
|
|
2967
|
+
}).option("what-if", {
|
|
2968
|
+
alias: ["w"],
|
|
2969
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2970
|
+
default: false,
|
|
2971
|
+
type: "boolean"
|
|
2972
|
+
}).option("mode", {
|
|
2973
|
+
alias: ["m"],
|
|
2974
|
+
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',
|
|
2975
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2976
|
+
default: "mirror",
|
|
2977
|
+
type: "string"
|
|
2978
|
+
})
|
|
2979
|
+
)
|
|
2980
|
+
)
|
|
2981
|
+
)
|
|
2982
|
+
)
|
|
2983
|
+
)
|
|
2984
|
+
};
|
|
2985
|
+
|
|
2986
|
+
// src/commands/canvas/commands/pattern/push.ts
|
|
2987
|
+
var PatternPushModule = {
|
|
2988
|
+
...CompositionPushModule,
|
|
2989
|
+
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
2990
|
+
builder: (yargs25) => withConfiguration(
|
|
2991
|
+
withApiOptions(
|
|
2992
|
+
withProjectOptions(
|
|
2993
|
+
withStateOptions(
|
|
2994
|
+
withDiffOptions(
|
|
2995
|
+
yargs25.positional("directory", {
|
|
2996
|
+
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2997
|
+
type: "string"
|
|
2998
|
+
}).option("what-if", {
|
|
2999
|
+
alias: ["w"],
|
|
3000
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3001
|
+
default: false,
|
|
3002
|
+
type: "boolean"
|
|
3003
|
+
}).option("mode", {
|
|
3004
|
+
alias: ["m"],
|
|
3005
|
+
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',
|
|
3006
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3007
|
+
default: "mirror",
|
|
3008
|
+
type: "string"
|
|
3009
|
+
}).option("onlyPatterns", {
|
|
3010
|
+
describe: "Only pulling patterns and not compositions",
|
|
3011
|
+
// This default differentiate this list command from composition list command
|
|
3012
|
+
default: true,
|
|
3013
|
+
type: "boolean",
|
|
3014
|
+
hidden: true
|
|
3015
|
+
})
|
|
3016
|
+
)
|
|
3017
|
+
)
|
|
3018
|
+
)
|
|
3019
|
+
)
|
|
3020
|
+
)
|
|
3021
|
+
};
|
|
3022
|
+
|
|
3023
|
+
// src/commands/canvas/commands/pattern/remove.ts
|
|
3024
|
+
var PatternRemoveModule = {
|
|
3025
|
+
...CompositionRemoveModule,
|
|
3026
|
+
describe: "Delete a pattern"
|
|
3027
|
+
};
|
|
3028
|
+
|
|
3029
|
+
// src/commands/canvas/commands/pattern/unpublish.ts
|
|
3030
|
+
var PatternUnpublishModule = {
|
|
3031
|
+
command: "unpublish [ids]",
|
|
3032
|
+
describe: "Unpublish a pattern(s)",
|
|
3033
|
+
builder: (yargs25) => withConfiguration(
|
|
3034
|
+
withApiOptions(
|
|
3035
|
+
withProjectOptions(
|
|
3036
|
+
yargs25.positional("ids", {
|
|
3037
|
+
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3038
|
+
type: "string"
|
|
3039
|
+
}).option("all", {
|
|
3040
|
+
alias: ["a"],
|
|
3041
|
+
describe: "Un-pPublishes all compositions. Use compositionId to publish one instead.",
|
|
3042
|
+
default: false,
|
|
3043
|
+
type: "boolean"
|
|
3044
|
+
}).option("what-if", {
|
|
3045
|
+
alias: ["w"],
|
|
3046
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
3047
|
+
default: false,
|
|
3048
|
+
type: "boolean"
|
|
3049
|
+
}).option("onlyCompositions", {
|
|
3050
|
+
describe: "Only publishing compositions and not patterns",
|
|
3051
|
+
default: false,
|
|
3052
|
+
type: "boolean"
|
|
3053
|
+
}).option("onlyPatterns", {
|
|
3054
|
+
describe: "Only pulling patterns and not compositions",
|
|
3055
|
+
default: true,
|
|
3056
|
+
type: "boolean",
|
|
3057
|
+
hidden: true
|
|
3058
|
+
})
|
|
3059
|
+
)
|
|
3060
|
+
)
|
|
3061
|
+
),
|
|
3062
|
+
handler: CompositionUnpublishModule.handler
|
|
3063
|
+
};
|
|
3064
|
+
|
|
3065
|
+
// src/commands/canvas/commands/pattern/update.ts
|
|
3066
|
+
var PatternUpdateModule = {
|
|
3067
|
+
...CompositionUpdateModule,
|
|
3068
|
+
describe: "Insert or update a pattern"
|
|
3069
|
+
};
|
|
3070
|
+
|
|
3071
|
+
// src/commands/canvas/commands/pattern.ts
|
|
3072
|
+
var PatternModule = {
|
|
3073
|
+
command: "pattern <command>",
|
|
3074
|
+
describe: "Commands for Canvas patterns",
|
|
3075
|
+
builder: (yargs25) => yargs25.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3076
|
+
handler: () => {
|
|
3077
|
+
yargs7.help();
|
|
1808
3078
|
}
|
|
1809
3079
|
};
|
|
1810
3080
|
|
|
@@ -1813,27 +3083,29 @@ var CanvasCommand = {
|
|
|
1813
3083
|
command: "canvas <command>",
|
|
1814
3084
|
aliases: ["cv", "pm", "presentation"],
|
|
1815
3085
|
describe: "Uniform Canvas commands",
|
|
1816
|
-
builder: (
|
|
3086
|
+
builder: (yargs25) => yargs25.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).demandCommand(),
|
|
1817
3087
|
handler: () => {
|
|
1818
|
-
|
|
3088
|
+
yargs8.showHelp();
|
|
1819
3089
|
}
|
|
1820
3090
|
};
|
|
1821
3091
|
|
|
1822
3092
|
// src/commands/context/index.ts
|
|
1823
|
-
import
|
|
3093
|
+
import yargs15 from "yargs";
|
|
1824
3094
|
|
|
1825
3095
|
// src/commands/context/commands/aggregate.ts
|
|
1826
|
-
import
|
|
3096
|
+
import yargs9 from "yargs";
|
|
1827
3097
|
|
|
1828
3098
|
// src/commands/context/commands/aggregate/get.ts
|
|
1829
3099
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
1830
3100
|
var AggregateGetModule = {
|
|
1831
3101
|
command: "get <id>",
|
|
1832
3102
|
describe: "Fetch an aggregate",
|
|
1833
|
-
builder: (
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
3103
|
+
builder: (yargs25) => withConfiguration(
|
|
3104
|
+
withFormatOptions(
|
|
3105
|
+
withApiOptions(
|
|
3106
|
+
withProjectOptions(
|
|
3107
|
+
yargs25.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3108
|
+
)
|
|
1837
3109
|
)
|
|
1838
3110
|
)
|
|
1839
3111
|
),
|
|
@@ -1856,7 +3128,7 @@ var AggregateListModule = {
|
|
|
1856
3128
|
command: "list",
|
|
1857
3129
|
describe: "List aggregates",
|
|
1858
3130
|
aliases: ["ls"],
|
|
1859
|
-
builder: (
|
|
3131
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
1860
3132
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1861
3133
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1862
3134
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1922,30 +3194,32 @@ function writeContextPackage(filename, packageContents) {
|
|
|
1922
3194
|
var AggregatePullModule = {
|
|
1923
3195
|
command: "pull <directory>",
|
|
1924
3196
|
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
|
-
|
|
3197
|
+
builder: (yargs25) => withConfiguration(
|
|
3198
|
+
withApiOptions(
|
|
3199
|
+
withProjectOptions(
|
|
3200
|
+
withDiffOptions(
|
|
3201
|
+
yargs25.positional("directory", {
|
|
3202
|
+
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.",
|
|
3203
|
+
type: "string"
|
|
3204
|
+
}).option("format", {
|
|
3205
|
+
alias: ["f"],
|
|
3206
|
+
describe: "Output format",
|
|
3207
|
+
default: "yaml",
|
|
3208
|
+
choices: ["yaml", "json"],
|
|
3209
|
+
type: "string"
|
|
3210
|
+
}).option("what-if", {
|
|
3211
|
+
alias: ["w"],
|
|
3212
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3213
|
+
default: false,
|
|
3214
|
+
type: "boolean"
|
|
3215
|
+
}).option("mode", {
|
|
3216
|
+
alias: ["m"],
|
|
3217
|
+
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',
|
|
3218
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3219
|
+
default: "mirror",
|
|
3220
|
+
type: "string"
|
|
3221
|
+
})
|
|
3222
|
+
)
|
|
1949
3223
|
)
|
|
1950
3224
|
)
|
|
1951
3225
|
),
|
|
@@ -1997,26 +3271,28 @@ var AggregatePullModule = {
|
|
|
1997
3271
|
// src/commands/context/commands/aggregate/push.ts
|
|
1998
3272
|
import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev/context/api";
|
|
1999
3273
|
var AggregatePushModule = {
|
|
2000
|
-
command: "push <directory>",
|
|
2001
|
-
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
|
-
|
|
3274
|
+
command: "push <directory>",
|
|
3275
|
+
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
3276
|
+
builder: (yargs25) => withConfiguration(
|
|
3277
|
+
withApiOptions(
|
|
3278
|
+
withProjectOptions(
|
|
3279
|
+
withDiffOptions(
|
|
3280
|
+
yargs25.positional("directory", {
|
|
3281
|
+
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
3282
|
+
type: "string"
|
|
3283
|
+
}).option("what-if", {
|
|
3284
|
+
alias: ["w"],
|
|
3285
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3286
|
+
default: false,
|
|
3287
|
+
type: "boolean"
|
|
3288
|
+
}).option("mode", {
|
|
3289
|
+
alias: ["m"],
|
|
3290
|
+
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',
|
|
3291
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3292
|
+
default: "mirror",
|
|
3293
|
+
type: "string"
|
|
3294
|
+
})
|
|
3295
|
+
)
|
|
2020
3296
|
)
|
|
2021
3297
|
)
|
|
2022
3298
|
),
|
|
@@ -2066,9 +3342,11 @@ var AggregateRemoveModule = {
|
|
|
2066
3342
|
command: "remove <id>",
|
|
2067
3343
|
aliases: ["delete", "rm"],
|
|
2068
3344
|
describe: "Delete an aggregate",
|
|
2069
|
-
builder: (
|
|
2070
|
-
|
|
2071
|
-
|
|
3345
|
+
builder: (yargs25) => withConfiguration(
|
|
3346
|
+
withApiOptions(
|
|
3347
|
+
withProjectOptions(
|
|
3348
|
+
yargs25.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
3349
|
+
)
|
|
2072
3350
|
)
|
|
2073
3351
|
),
|
|
2074
3352
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2084,9 +3362,11 @@ var AggregateUpdateModule = {
|
|
|
2084
3362
|
command: "update <filename>",
|
|
2085
3363
|
aliases: ["put"],
|
|
2086
3364
|
describe: "Insert or update an aggregate",
|
|
2087
|
-
builder: (
|
|
2088
|
-
|
|
2089
|
-
|
|
3365
|
+
builder: (yargs25) => withConfiguration(
|
|
3366
|
+
withApiOptions(
|
|
3367
|
+
withProjectOptions(
|
|
3368
|
+
yargs25.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
3369
|
+
)
|
|
2090
3370
|
)
|
|
2091
3371
|
),
|
|
2092
3372
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -2102,24 +3382,26 @@ var AggregateModule = {
|
|
|
2102
3382
|
command: "aggregate <command>",
|
|
2103
3383
|
aliases: ["agg", "intent", "audience"],
|
|
2104
3384
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
2105
|
-
builder: (
|
|
3385
|
+
builder: (yargs25) => yargs25.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
2106
3386
|
handler: () => {
|
|
2107
|
-
|
|
3387
|
+
yargs9.help();
|
|
2108
3388
|
}
|
|
2109
3389
|
};
|
|
2110
3390
|
|
|
2111
3391
|
// src/commands/context/commands/enrichment.ts
|
|
2112
|
-
import
|
|
3392
|
+
import yargs10 from "yargs";
|
|
2113
3393
|
|
|
2114
3394
|
// src/commands/context/commands/enrichment/get.ts
|
|
2115
3395
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
2116
3396
|
var EnrichmentGetModule = {
|
|
2117
3397
|
command: "get <id>",
|
|
2118
3398
|
describe: "Fetch an enrichment category and its values",
|
|
2119
|
-
builder: (
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
3399
|
+
builder: (yargs25) => withFormatOptions(
|
|
3400
|
+
withConfiguration(
|
|
3401
|
+
withApiOptions(
|
|
3402
|
+
withProjectOptions(
|
|
3403
|
+
yargs25.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
3404
|
+
)
|
|
2123
3405
|
)
|
|
2124
3406
|
)
|
|
2125
3407
|
),
|
|
@@ -2143,7 +3425,7 @@ var EnrichmentListModule = {
|
|
|
2143
3425
|
command: "list",
|
|
2144
3426
|
describe: "List enrichments",
|
|
2145
3427
|
aliases: ["ls"],
|
|
2146
|
-
builder: (
|
|
3428
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2147
3429
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2148
3430
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2149
3431
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2244,30 +3526,32 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
2244
3526
|
var EnrichmentPullModule = {
|
|
2245
3527
|
command: "pull <directory>",
|
|
2246
3528
|
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
|
-
|
|
3529
|
+
builder: (yargs25) => withConfiguration(
|
|
3530
|
+
withApiOptions(
|
|
3531
|
+
withProjectOptions(
|
|
3532
|
+
withDiffOptions(
|
|
3533
|
+
yargs25.positional("directory", {
|
|
3534
|
+
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.",
|
|
3535
|
+
type: "string"
|
|
3536
|
+
}).option("format", {
|
|
3537
|
+
alias: ["f"],
|
|
3538
|
+
describe: "Output format",
|
|
3539
|
+
default: "yaml",
|
|
3540
|
+
choices: ["yaml", "json"],
|
|
3541
|
+
type: "string"
|
|
3542
|
+
}).option("what-if", {
|
|
3543
|
+
alias: ["w"],
|
|
3544
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3545
|
+
default: false,
|
|
3546
|
+
type: "boolean"
|
|
3547
|
+
}).option("mode", {
|
|
3548
|
+
alias: ["m"],
|
|
3549
|
+
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',
|
|
3550
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3551
|
+
default: "mirror",
|
|
3552
|
+
type: "string"
|
|
3553
|
+
})
|
|
3554
|
+
)
|
|
2271
3555
|
)
|
|
2272
3556
|
)
|
|
2273
3557
|
),
|
|
@@ -2321,24 +3605,26 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
2321
3605
|
var EnrichmentPushModule = {
|
|
2322
3606
|
command: "push <directory>",
|
|
2323
3607
|
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
|
-
|
|
3608
|
+
builder: (yargs25) => withConfiguration(
|
|
3609
|
+
withApiOptions(
|
|
3610
|
+
withProjectOptions(
|
|
3611
|
+
withDiffOptions(
|
|
3612
|
+
yargs25.positional("directory", {
|
|
3613
|
+
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
3614
|
+
type: "string"
|
|
3615
|
+
}).option("what-if", {
|
|
3616
|
+
alias: ["w"],
|
|
3617
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3618
|
+
default: false,
|
|
3619
|
+
type: "boolean"
|
|
3620
|
+
}).option("mode", {
|
|
3621
|
+
alias: ["m"],
|
|
3622
|
+
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',
|
|
3623
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3624
|
+
default: "mirror",
|
|
3625
|
+
type: "string"
|
|
3626
|
+
})
|
|
3627
|
+
)
|
|
2342
3628
|
)
|
|
2343
3629
|
)
|
|
2344
3630
|
),
|
|
@@ -2387,9 +3673,11 @@ var EnrichmentRemoveModule = {
|
|
|
2387
3673
|
command: "remove <id>",
|
|
2388
3674
|
aliases: ["delete", "rm"],
|
|
2389
3675
|
describe: "Delete an enrichment category and its values",
|
|
2390
|
-
builder: (
|
|
2391
|
-
|
|
2392
|
-
|
|
3676
|
+
builder: (yargs25) => withConfiguration(
|
|
3677
|
+
withApiOptions(
|
|
3678
|
+
withProjectOptions(
|
|
3679
|
+
yargs25.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
3680
|
+
)
|
|
2393
3681
|
)
|
|
2394
3682
|
),
|
|
2395
3683
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2404,14 +3692,14 @@ var EnrichmentModule = {
|
|
|
2404
3692
|
command: "enrichment <command>",
|
|
2405
3693
|
aliases: ["enr"],
|
|
2406
3694
|
describe: "Commands for Context enrichments",
|
|
2407
|
-
builder: (
|
|
3695
|
+
builder: (yargs25) => yargs25.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
2408
3696
|
handler: () => {
|
|
2409
|
-
|
|
3697
|
+
yargs10.help();
|
|
2410
3698
|
}
|
|
2411
3699
|
};
|
|
2412
3700
|
|
|
2413
3701
|
// src/commands/context/commands/manifest.ts
|
|
2414
|
-
import
|
|
3702
|
+
import yargs11 from "yargs";
|
|
2415
3703
|
|
|
2416
3704
|
// src/commands/context/commands/manifest/get.ts
|
|
2417
3705
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -2422,20 +3710,22 @@ var ManifestGetModule = {
|
|
|
2422
3710
|
command: "get [output]",
|
|
2423
3711
|
aliases: ["dl", "download"],
|
|
2424
3712
|
describe: "Download the Uniform Context manifest for a project",
|
|
2425
|
-
builder: (
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
3713
|
+
builder: (yargs25) => withConfiguration(
|
|
3714
|
+
withApiOptions(
|
|
3715
|
+
withProjectOptions(
|
|
3716
|
+
yargs25.option("preview", {
|
|
3717
|
+
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
3718
|
+
default: false,
|
|
3719
|
+
type: "boolean",
|
|
3720
|
+
alias: ["d"]
|
|
3721
|
+
}).option("output", {
|
|
3722
|
+
string: true,
|
|
3723
|
+
alias: "o",
|
|
3724
|
+
default: process.env.UNIFORM_MANIFEST_PATH,
|
|
3725
|
+
describe: "Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set.",
|
|
3726
|
+
demandOption: true
|
|
3727
|
+
})
|
|
3728
|
+
)
|
|
2439
3729
|
)
|
|
2440
3730
|
),
|
|
2441
3731
|
handler: async ({ apiKey, apiHost, proxy, output, project, preview }) => {
|
|
@@ -2485,7 +3775,7 @@ import { exit as exit2 } from "process";
|
|
|
2485
3775
|
var ManifestPublishModule = {
|
|
2486
3776
|
command: "publish",
|
|
2487
3777
|
describe: "Publish the Uniform Context manifest for a project",
|
|
2488
|
-
builder: (
|
|
3778
|
+
builder: (yargs25) => withConfiguration(withApiOptions(withProjectOptions(yargs25))),
|
|
2489
3779
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
2490
3780
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2491
3781
|
try {
|
|
@@ -2518,24 +3808,26 @@ var ManifestModule = {
|
|
|
2518
3808
|
command: "manifest <command>",
|
|
2519
3809
|
describe: "Commands for context manifests",
|
|
2520
3810
|
aliases: ["man"],
|
|
2521
|
-
builder: (
|
|
3811
|
+
builder: (yargs25) => yargs25.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
2522
3812
|
handler: () => {
|
|
2523
|
-
|
|
3813
|
+
yargs11.help();
|
|
2524
3814
|
}
|
|
2525
3815
|
};
|
|
2526
3816
|
|
|
2527
3817
|
// src/commands/context/commands/quirk.ts
|
|
2528
|
-
import
|
|
3818
|
+
import yargs12 from "yargs";
|
|
2529
3819
|
|
|
2530
3820
|
// src/commands/context/commands/quirk/get.ts
|
|
2531
3821
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
2532
3822
|
var QuirkGetModule = {
|
|
2533
3823
|
command: "get <id>",
|
|
2534
3824
|
describe: "Fetch a quirk",
|
|
2535
|
-
builder: (
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
3825
|
+
builder: (yargs25) => withConfiguration(
|
|
3826
|
+
withFormatOptions(
|
|
3827
|
+
withApiOptions(
|
|
3828
|
+
withProjectOptions(
|
|
3829
|
+
yargs25.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
3830
|
+
)
|
|
2539
3831
|
)
|
|
2540
3832
|
)
|
|
2541
3833
|
),
|
|
@@ -2558,14 +3850,16 @@ var QuirkListModule = {
|
|
|
2558
3850
|
command: "list",
|
|
2559
3851
|
describe: "List quirks",
|
|
2560
3852
|
aliases: ["ls"],
|
|
2561
|
-
builder: (
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
3853
|
+
builder: (yargs25) => withConfiguration(
|
|
3854
|
+
withFormatOptions(
|
|
3855
|
+
withApiOptions(
|
|
3856
|
+
withProjectOptions(
|
|
3857
|
+
yargs25.option("withIntegrations", {
|
|
3858
|
+
alias: ["i"],
|
|
3859
|
+
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
3860
|
+
type: "boolean"
|
|
3861
|
+
})
|
|
3862
|
+
)
|
|
2569
3863
|
)
|
|
2570
3864
|
)
|
|
2571
3865
|
),
|
|
@@ -2617,30 +3911,32 @@ function createQuirkEngineDataSource({
|
|
|
2617
3911
|
var QuirkPullModule = {
|
|
2618
3912
|
command: "pull <directory>",
|
|
2619
3913
|
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
|
-
|
|
3914
|
+
builder: (yargs25) => withConfiguration(
|
|
3915
|
+
withApiOptions(
|
|
3916
|
+
withProjectOptions(
|
|
3917
|
+
withDiffOptions(
|
|
3918
|
+
yargs25.positional("directory", {
|
|
3919
|
+
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.",
|
|
3920
|
+
type: "string"
|
|
3921
|
+
}).option("format", {
|
|
3922
|
+
alias: ["f"],
|
|
3923
|
+
describe: "Output format",
|
|
3924
|
+
default: "yaml",
|
|
3925
|
+
choices: ["yaml", "json"],
|
|
3926
|
+
type: "string"
|
|
3927
|
+
}).option("what-if", {
|
|
3928
|
+
alias: ["w"],
|
|
3929
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3930
|
+
default: false,
|
|
3931
|
+
type: "boolean"
|
|
3932
|
+
}).option("mode", {
|
|
3933
|
+
alias: ["m"],
|
|
3934
|
+
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',
|
|
3935
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3936
|
+
default: "mirror",
|
|
3937
|
+
type: "string"
|
|
3938
|
+
})
|
|
3939
|
+
)
|
|
2644
3940
|
)
|
|
2645
3941
|
)
|
|
2646
3942
|
),
|
|
@@ -2694,24 +3990,26 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
2694
3990
|
var QuirkPushModule = {
|
|
2695
3991
|
command: "push <directory>",
|
|
2696
3992
|
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
|
-
|
|
3993
|
+
builder: (yargs25) => withConfiguration(
|
|
3994
|
+
withApiOptions(
|
|
3995
|
+
withProjectOptions(
|
|
3996
|
+
withDiffOptions(
|
|
3997
|
+
yargs25.positional("directory", {
|
|
3998
|
+
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
3999
|
+
type: "string"
|
|
4000
|
+
}).option("what-if", {
|
|
4001
|
+
alias: ["w"],
|
|
4002
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
4003
|
+
default: false,
|
|
4004
|
+
type: "boolean"
|
|
4005
|
+
}).option("mode", {
|
|
4006
|
+
alias: ["m"],
|
|
4007
|
+
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',
|
|
4008
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4009
|
+
default: "mirror",
|
|
4010
|
+
type: "string"
|
|
4011
|
+
})
|
|
4012
|
+
)
|
|
2715
4013
|
)
|
|
2716
4014
|
)
|
|
2717
4015
|
),
|
|
@@ -2760,9 +4058,11 @@ var QuirkRemoveModule = {
|
|
|
2760
4058
|
command: "remove <id>",
|
|
2761
4059
|
aliases: ["delete", "rm"],
|
|
2762
4060
|
describe: "Delete a quirk",
|
|
2763
|
-
builder: (
|
|
2764
|
-
|
|
2765
|
-
|
|
4061
|
+
builder: (yargs25) => withConfiguration(
|
|
4062
|
+
withApiOptions(
|
|
4063
|
+
withProjectOptions(
|
|
4064
|
+
yargs25.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4065
|
+
)
|
|
2766
4066
|
)
|
|
2767
4067
|
),
|
|
2768
4068
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -2778,8 +4078,12 @@ var QuirkUpdateModule = {
|
|
|
2778
4078
|
command: "update <filename>",
|
|
2779
4079
|
aliases: ["put"],
|
|
2780
4080
|
describe: "Insert or update a quirk",
|
|
2781
|
-
builder: (
|
|
2782
|
-
|
|
4081
|
+
builder: (yargs25) => withConfiguration(
|
|
4082
|
+
withApiOptions(
|
|
4083
|
+
withProjectOptions(
|
|
4084
|
+
yargs25.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4085
|
+
)
|
|
4086
|
+
)
|
|
2783
4087
|
),
|
|
2784
4088
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
2785
4089
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -2794,24 +4098,26 @@ var QuirkModule = {
|
|
|
2794
4098
|
command: "quirk <command>",
|
|
2795
4099
|
aliases: ["qk"],
|
|
2796
4100
|
describe: "Commands for Context quirks",
|
|
2797
|
-
builder: (
|
|
4101
|
+
builder: (yargs25) => yargs25.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
2798
4102
|
handler: () => {
|
|
2799
|
-
|
|
4103
|
+
yargs12.help();
|
|
2800
4104
|
}
|
|
2801
4105
|
};
|
|
2802
4106
|
|
|
2803
4107
|
// src/commands/context/commands/signal.ts
|
|
2804
|
-
import
|
|
4108
|
+
import yargs13 from "yargs";
|
|
2805
4109
|
|
|
2806
4110
|
// src/commands/context/commands/signal/get.ts
|
|
2807
4111
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
2808
4112
|
var SignalGetModule = {
|
|
2809
4113
|
command: "get <id>",
|
|
2810
4114
|
describe: "Fetch a signal",
|
|
2811
|
-
builder: (
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
4115
|
+
builder: (yargs25) => withConfiguration(
|
|
4116
|
+
withFormatOptions(
|
|
4117
|
+
withApiOptions(
|
|
4118
|
+
withProjectOptions(
|
|
4119
|
+
yargs25.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4120
|
+
)
|
|
2815
4121
|
)
|
|
2816
4122
|
)
|
|
2817
4123
|
),
|
|
@@ -2834,7 +4140,7 @@ var SignalListModule = {
|
|
|
2834
4140
|
command: "list",
|
|
2835
4141
|
describe: "List signals",
|
|
2836
4142
|
aliases: ["ls"],
|
|
2837
|
-
builder: (
|
|
4143
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2838
4144
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2839
4145
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2840
4146
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2876,37 +4182,39 @@ function createSignalEngineDataSource({
|
|
|
2876
4182
|
signal: object.object
|
|
2877
4183
|
});
|
|
2878
4184
|
}
|
|
2879
|
-
};
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
// src/commands/context/commands/signal/pull.ts
|
|
2883
|
-
var SignalPullModule = {
|
|
2884
|
-
command: "pull <directory>",
|
|
2885
|
-
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
|
-
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
// src/commands/context/commands/signal/pull.ts
|
|
4189
|
+
var SignalPullModule = {
|
|
4190
|
+
command: "pull <directory>",
|
|
4191
|
+
describe: "Pulls all signals to local files in a directory",
|
|
4192
|
+
builder: (yargs25) => withConfiguration(
|
|
4193
|
+
withApiOptions(
|
|
4194
|
+
withProjectOptions(
|
|
4195
|
+
withDiffOptions(
|
|
4196
|
+
yargs25.positional("directory", {
|
|
4197
|
+
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.",
|
|
4198
|
+
type: "string"
|
|
4199
|
+
}).option("format", {
|
|
4200
|
+
alias: ["f"],
|
|
4201
|
+
describe: "Output format",
|
|
4202
|
+
default: "yaml",
|
|
4203
|
+
choices: ["yaml", "json"],
|
|
4204
|
+
type: "string"
|
|
4205
|
+
}).option("what-if", {
|
|
4206
|
+
alias: ["w"],
|
|
4207
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
4208
|
+
default: false,
|
|
4209
|
+
type: "boolean"
|
|
4210
|
+
}).option("mode", {
|
|
4211
|
+
alias: ["m"],
|
|
4212
|
+
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',
|
|
4213
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4214
|
+
default: "mirror",
|
|
4215
|
+
type: "string"
|
|
4216
|
+
})
|
|
4217
|
+
)
|
|
2910
4218
|
)
|
|
2911
4219
|
)
|
|
2912
4220
|
),
|
|
@@ -2960,24 +4268,26 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
2960
4268
|
var SignalPushModule = {
|
|
2961
4269
|
command: "push <directory>",
|
|
2962
4270
|
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
|
-
|
|
4271
|
+
builder: (yargs25) => withConfiguration(
|
|
4272
|
+
withApiOptions(
|
|
4273
|
+
withProjectOptions(
|
|
4274
|
+
withDiffOptions(
|
|
4275
|
+
yargs25.positional("directory", {
|
|
4276
|
+
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
4277
|
+
type: "string"
|
|
4278
|
+
}).option("what-if", {
|
|
4279
|
+
alias: ["w"],
|
|
4280
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
4281
|
+
default: false,
|
|
4282
|
+
type: "boolean"
|
|
4283
|
+
}).option("mode", {
|
|
4284
|
+
alias: ["m"],
|
|
4285
|
+
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',
|
|
4286
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4287
|
+
default: "mirror",
|
|
4288
|
+
type: "string"
|
|
4289
|
+
})
|
|
4290
|
+
)
|
|
2981
4291
|
)
|
|
2982
4292
|
)
|
|
2983
4293
|
),
|
|
@@ -3026,9 +4336,11 @@ var SignalRemoveModule = {
|
|
|
3026
4336
|
command: "remove <id>",
|
|
3027
4337
|
aliases: ["delete", "rm"],
|
|
3028
4338
|
describe: "Delete a signal",
|
|
3029
|
-
builder: (
|
|
3030
|
-
|
|
3031
|
-
|
|
4339
|
+
builder: (yargs25) => withConfiguration(
|
|
4340
|
+
withApiOptions(
|
|
4341
|
+
withProjectOptions(
|
|
4342
|
+
yargs25.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
4343
|
+
)
|
|
3032
4344
|
)
|
|
3033
4345
|
),
|
|
3034
4346
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -3044,8 +4356,12 @@ var SignalUpdateModule = {
|
|
|
3044
4356
|
command: "update <filename>",
|
|
3045
4357
|
aliases: ["put"],
|
|
3046
4358
|
describe: "Insert or update a signal",
|
|
3047
|
-
builder: (
|
|
3048
|
-
|
|
4359
|
+
builder: (yargs25) => withConfiguration(
|
|
4360
|
+
withApiOptions(
|
|
4361
|
+
withProjectOptions(
|
|
4362
|
+
yargs25.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
4363
|
+
)
|
|
4364
|
+
)
|
|
3049
4365
|
),
|
|
3050
4366
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
3051
4367
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3060,24 +4376,26 @@ var SignalModule = {
|
|
|
3060
4376
|
command: "signal <command>",
|
|
3061
4377
|
aliases: ["sig"],
|
|
3062
4378
|
describe: "Commands for Context signals",
|
|
3063
|
-
builder: (
|
|
4379
|
+
builder: (yargs25) => yargs25.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
3064
4380
|
handler: () => {
|
|
3065
|
-
|
|
4381
|
+
yargs13.help();
|
|
3066
4382
|
}
|
|
3067
4383
|
};
|
|
3068
4384
|
|
|
3069
4385
|
// src/commands/context/commands/test.ts
|
|
3070
|
-
import
|
|
4386
|
+
import yargs14 from "yargs";
|
|
3071
4387
|
|
|
3072
4388
|
// src/commands/context/commands/test/get.ts
|
|
3073
4389
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
3074
4390
|
var TestGetModule = {
|
|
3075
4391
|
command: "get <id>",
|
|
3076
4392
|
describe: "Fetch a test",
|
|
3077
|
-
builder: (
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
4393
|
+
builder: (yargs25) => withConfiguration(
|
|
4394
|
+
withFormatOptions(
|
|
4395
|
+
withApiOptions(
|
|
4396
|
+
withProjectOptions(
|
|
4397
|
+
yargs25.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
4398
|
+
)
|
|
3081
4399
|
)
|
|
3082
4400
|
)
|
|
3083
4401
|
),
|
|
@@ -3100,7 +4418,7 @@ var TestListModule = {
|
|
|
3100
4418
|
command: "list",
|
|
3101
4419
|
describe: "List tests",
|
|
3102
4420
|
aliases: ["ls"],
|
|
3103
|
-
builder: (
|
|
4421
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
3104
4422
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3105
4423
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3106
4424
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3149,30 +4467,32 @@ function createTestEngineDataSource({
|
|
|
3149
4467
|
var TestPullModule = {
|
|
3150
4468
|
command: "pull <directory>",
|
|
3151
4469
|
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
|
-
|
|
4470
|
+
builder: (yargs25) => withConfiguration(
|
|
4471
|
+
withApiOptions(
|
|
4472
|
+
withProjectOptions(
|
|
4473
|
+
withDiffOptions(
|
|
4474
|
+
yargs25.positional("directory", {
|
|
4475
|
+
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.",
|
|
4476
|
+
type: "string"
|
|
4477
|
+
}).option("format", {
|
|
4478
|
+
alias: ["f"],
|
|
4479
|
+
describe: "Output format",
|
|
4480
|
+
default: "yaml",
|
|
4481
|
+
choices: ["yaml", "json"],
|
|
4482
|
+
type: "string"
|
|
4483
|
+
}).option("what-if", {
|
|
4484
|
+
alias: ["w"],
|
|
4485
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
4486
|
+
default: false,
|
|
4487
|
+
type: "boolean"
|
|
4488
|
+
}).option("mode", {
|
|
4489
|
+
alias: ["m"],
|
|
4490
|
+
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',
|
|
4491
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4492
|
+
default: "mirror",
|
|
4493
|
+
type: "string"
|
|
4494
|
+
})
|
|
4495
|
+
)
|
|
3176
4496
|
)
|
|
3177
4497
|
)
|
|
3178
4498
|
),
|
|
@@ -3226,24 +4546,26 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
3226
4546
|
var TestPushModule = {
|
|
3227
4547
|
command: "push <directory>",
|
|
3228
4548
|
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
|
-
|
|
4549
|
+
builder: (yargs25) => withConfiguration(
|
|
4550
|
+
withApiOptions(
|
|
4551
|
+
withProjectOptions(
|
|
4552
|
+
withDiffOptions(
|
|
4553
|
+
yargs25.positional("directory", {
|
|
4554
|
+
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
4555
|
+
type: "string"
|
|
4556
|
+
}).option("what-if", {
|
|
4557
|
+
alias: ["w"],
|
|
4558
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
4559
|
+
default: false,
|
|
4560
|
+
type: "boolean"
|
|
4561
|
+
}).option("mode", {
|
|
4562
|
+
alias: ["m"],
|
|
4563
|
+
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',
|
|
4564
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4565
|
+
default: "mirror",
|
|
4566
|
+
type: "string"
|
|
4567
|
+
})
|
|
4568
|
+
)
|
|
3247
4569
|
)
|
|
3248
4570
|
)
|
|
3249
4571
|
),
|
|
@@ -3292,8 +4614,12 @@ var TestRemoveModule = {
|
|
|
3292
4614
|
command: "remove <id>",
|
|
3293
4615
|
aliases: ["delete", "rm"],
|
|
3294
4616
|
describe: "Delete a test",
|
|
3295
|
-
builder: (
|
|
3296
|
-
|
|
4617
|
+
builder: (yargs25) => withConfiguration(
|
|
4618
|
+
withApiOptions(
|
|
4619
|
+
withProjectOptions(
|
|
4620
|
+
yargs25.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
4621
|
+
)
|
|
4622
|
+
)
|
|
3297
4623
|
),
|
|
3298
4624
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
3299
4625
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3308,8 +4634,10 @@ var TestUpdateModule = {
|
|
|
3308
4634
|
command: "update <filename>",
|
|
3309
4635
|
aliases: ["put"],
|
|
3310
4636
|
describe: "Insert or update a test",
|
|
3311
|
-
builder: (
|
|
3312
|
-
|
|
4637
|
+
builder: (yargs25) => withConfiguration(
|
|
4638
|
+
withApiOptions(
|
|
4639
|
+
withProjectOptions(yargs25.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
4640
|
+
)
|
|
3313
4641
|
),
|
|
3314
4642
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
3315
4643
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -3323,9 +4651,9 @@ var TestUpdateModule = {
|
|
|
3323
4651
|
var TestModule = {
|
|
3324
4652
|
command: "test <command>",
|
|
3325
4653
|
describe: "Commands for Context A/B tests",
|
|
3326
|
-
builder: (
|
|
4654
|
+
builder: (yargs25) => yargs25.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
3327
4655
|
handler: () => {
|
|
3328
|
-
|
|
4656
|
+
yargs14.help();
|
|
3329
4657
|
}
|
|
3330
4658
|
};
|
|
3331
4659
|
|
|
@@ -3334,9 +4662,9 @@ var ContextCommand = {
|
|
|
3334
4662
|
command: "context <command>",
|
|
3335
4663
|
aliases: ["ctx"],
|
|
3336
4664
|
describe: "Uniform Context commands",
|
|
3337
|
-
builder: (
|
|
4665
|
+
builder: (yargs25) => yargs25.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
3338
4666
|
handler: () => {
|
|
3339
|
-
|
|
4667
|
+
yargs15.showHelp();
|
|
3340
4668
|
}
|
|
3341
4669
|
};
|
|
3342
4670
|
|
|
@@ -3364,15 +4692,15 @@ import { PostHog } from "posthog-node";
|
|
|
3364
4692
|
// package.json
|
|
3365
4693
|
var package_default = {
|
|
3366
4694
|
name: "@uniformdev/cli",
|
|
3367
|
-
version: "19.
|
|
4695
|
+
version: "19.46.0",
|
|
3368
4696
|
description: "Uniform command line interface tool",
|
|
3369
4697
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
3370
4698
|
main: "./cli.js",
|
|
3371
|
-
types: "./dist/index.d.
|
|
4699
|
+
types: "./dist/index.d.mts",
|
|
3372
4700
|
sideEffects: false,
|
|
3373
4701
|
scripts: {
|
|
3374
4702
|
uniform: "node ./cli.js",
|
|
3375
|
-
build: "tsup",
|
|
4703
|
+
build: "tsc --noEmit && tsup",
|
|
3376
4704
|
dev: "tsup --watch",
|
|
3377
4705
|
clean: "rimraf dist",
|
|
3378
4706
|
test: "jest --maxWorkers=1 --passWithNoTests",
|
|
@@ -3380,20 +4708,24 @@ var package_default = {
|
|
|
3380
4708
|
format: 'prettier --write "src/**/*.{js,ts,tsx}"'
|
|
3381
4709
|
},
|
|
3382
4710
|
dependencies: {
|
|
4711
|
+
"@thi.ng/mime": "^2.2.23",
|
|
3383
4712
|
"@uniformdev/canvas": "workspace:*",
|
|
3384
4713
|
"@uniformdev/context": "workspace:*",
|
|
4714
|
+
"@uniformdev/files": "workspace:*",
|
|
3385
4715
|
"@uniformdev/project-map": "workspace:*",
|
|
3386
4716
|
"@uniformdev/redirect": "workspace:*",
|
|
3387
4717
|
colorette: "2.0.20",
|
|
3388
|
-
cosmiconfig: "
|
|
4718
|
+
cosmiconfig: "8.2.0",
|
|
4719
|
+
"cosmiconfig-typescript-loader": "5.0.0",
|
|
3389
4720
|
diff: "^5.0.0",
|
|
3390
4721
|
dotenv: "^16.0.3",
|
|
3391
4722
|
execa: "5.1.1",
|
|
3392
4723
|
"fs-jetpack": "5.1.0",
|
|
3393
|
-
graphql: "16.
|
|
4724
|
+
graphql: "16.8.0",
|
|
3394
4725
|
"graphql-request": "6.1.0",
|
|
3395
4726
|
"https-proxy-agent": "^7.0.0",
|
|
3396
|
-
|
|
4727
|
+
"image-size": "^1.0.2",
|
|
4728
|
+
inquirer: "9.2.10",
|
|
3397
4729
|
"isomorphic-git": "1.24.5",
|
|
3398
4730
|
"isomorphic-unfetch": "^3.1.0",
|
|
3399
4731
|
"js-yaml": "^4.1.0",
|
|
@@ -3401,6 +4733,7 @@ var package_default = {
|
|
|
3401
4733
|
"lodash.isequalwith": "^4.4.0",
|
|
3402
4734
|
open: "9.1.0",
|
|
3403
4735
|
ora: "6.3.1",
|
|
4736
|
+
"p-queue": "7.3.4",
|
|
3404
4737
|
"posthog-node": "3.1.1",
|
|
3405
4738
|
slugify: "1.6.6",
|
|
3406
4739
|
"update-check": "^1.5.4",
|
|
@@ -3413,7 +4746,7 @@ var package_default = {
|
|
|
3413
4746
|
"@types/js-yaml": "4.0.5",
|
|
3414
4747
|
"@types/jsonwebtoken": "9.0.2",
|
|
3415
4748
|
"@types/lodash.isequalwith": "4.4.7",
|
|
3416
|
-
"@types/node": "18.17.
|
|
4749
|
+
"@types/node": "18.17.5",
|
|
3417
4750
|
"@types/yargs": "17.0.24"
|
|
3418
4751
|
},
|
|
3419
4752
|
bin: {
|
|
@@ -3737,8 +5070,8 @@ ${err.message}`);
|
|
|
3737
5070
|
|
|
3738
5071
|
// src/projects/cloneStarter.ts
|
|
3739
5072
|
import crypto2 from "crypto";
|
|
3740
|
-
import
|
|
3741
|
-
import
|
|
5073
|
+
import fs3 from "fs";
|
|
5074
|
+
import fsj2 from "fs-jetpack";
|
|
3742
5075
|
import * as git from "isomorphic-git";
|
|
3743
5076
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
3744
5077
|
import os from "os";
|
|
@@ -3754,7 +5087,7 @@ async function cloneStarter({
|
|
|
3754
5087
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
3755
5088
|
try {
|
|
3756
5089
|
await git.clone({
|
|
3757
|
-
fs:
|
|
5090
|
+
fs: fs3,
|
|
3758
5091
|
http,
|
|
3759
5092
|
url: `https://github.com/${user}/${repo}`,
|
|
3760
5093
|
dir: cloneDir,
|
|
@@ -3765,13 +5098,13 @@ async function cloneStarter({
|
|
|
3765
5098
|
throw new Error(`Failed to fetch starter code: ${err.message}`);
|
|
3766
5099
|
}
|
|
3767
5100
|
await done();
|
|
3768
|
-
if (
|
|
5101
|
+
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
3769
5102
|
throw new Error(`"${targetDir}" is not empty`);
|
|
3770
5103
|
}
|
|
3771
5104
|
const starterDir = path.join(cloneDir, ...pathSegments);
|
|
3772
|
-
|
|
5105
|
+
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
3773
5106
|
if (dotEnvFile) {
|
|
3774
|
-
|
|
5107
|
+
fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
3775
5108
|
}
|
|
3776
5109
|
console.log(`
|
|
3777
5110
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -3787,7 +5120,7 @@ Installing project dependencies...
|
|
|
3787
5120
|
}
|
|
3788
5121
|
|
|
3789
5122
|
// src/projects/getOrCreateProject.ts
|
|
3790
|
-
import
|
|
5123
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
3791
5124
|
import inquirer2 from "inquirer";
|
|
3792
5125
|
import path2 from "path";
|
|
3793
5126
|
import slugify from "slugify";
|
|
@@ -3914,9 +5247,9 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
3914
5247
|
if (!existsSync2(targetDir)) {
|
|
3915
5248
|
mkdirSync2(targetDir, { recursive: true });
|
|
3916
5249
|
}
|
|
3917
|
-
if (
|
|
5250
|
+
if (fs4.readdirSync(targetDir).length > 0) {
|
|
3918
5251
|
targetDir = path2.resolve(targetDir, projectNameSlug);
|
|
3919
|
-
if (
|
|
5252
|
+
if (fs4.existsSync(targetDir)) {
|
|
3920
5253
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
3921
5254
|
}
|
|
3922
5255
|
}
|
|
@@ -4324,24 +5657,26 @@ var disableTelemetryDefault = !["", "0", "false", "no"].includes(
|
|
|
4324
5657
|
);
|
|
4325
5658
|
var NewCmd = {
|
|
4326
5659
|
command: "new [name]",
|
|
4327
|
-
builder: (y) =>
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
5660
|
+
builder: (y) => withConfiguration(
|
|
5661
|
+
y.positional("name", {
|
|
5662
|
+
describe: "Name of a project",
|
|
5663
|
+
type: "string"
|
|
5664
|
+
}).option("apiHost", {
|
|
5665
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or ${stableApiHost}. Supports dotenv.`,
|
|
5666
|
+
default: apiHostDefault,
|
|
5667
|
+
demandOption: true,
|
|
5668
|
+
type: "string"
|
|
5669
|
+
}).option("outputPath", {
|
|
5670
|
+
alias: "o",
|
|
5671
|
+
description: "Specify where to store integration files. Defaults to cwd.",
|
|
5672
|
+
type: "string"
|
|
5673
|
+
}).option("disableTelemetry", {
|
|
5674
|
+
describe: "By default, usage information is sent to Uniform. Use this option or set UNIFORM_CLI_DISABLE_TELEMETRY to disable telemetry.",
|
|
5675
|
+
default: disableTelemetryDefault,
|
|
5676
|
+
demandOption: true,
|
|
5677
|
+
type: "boolean"
|
|
5678
|
+
})
|
|
5679
|
+
),
|
|
4345
5680
|
describe: "Start a new Uniform project",
|
|
4346
5681
|
handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
|
|
4347
5682
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
@@ -4362,21 +5697,23 @@ var NewCmd = {
|
|
|
4362
5697
|
};
|
|
4363
5698
|
var NewMeshCmd = {
|
|
4364
5699
|
command: "new-integration",
|
|
4365
|
-
builder: (y) =>
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
5700
|
+
builder: (y) => withConfiguration(
|
|
5701
|
+
y.option("apiHost", {
|
|
5702
|
+
describe: `Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or ${stableApiHost}. Supports dotenv.`,
|
|
5703
|
+
default: apiHostDefault,
|
|
5704
|
+
demandOption: true,
|
|
5705
|
+
type: "string"
|
|
5706
|
+
}).option("outputPath", {
|
|
5707
|
+
alias: "o",
|
|
5708
|
+
description: "Specify where to store integration files. Defaults to cwd.",
|
|
5709
|
+
type: "string"
|
|
5710
|
+
}).option("disableTelemetry", {
|
|
5711
|
+
describe: "By default, usage information is sent to Uniform. Use this option or set UNIFORM_CLI_DISABLE_TELEMETRY to disable telemetry.",
|
|
5712
|
+
default: disableTelemetryDefault,
|
|
5713
|
+
demandOption: true,
|
|
5714
|
+
type: "boolean"
|
|
5715
|
+
})
|
|
5716
|
+
),
|
|
4380
5717
|
describe: "Start a new Uniform project",
|
|
4381
5718
|
handler: async function({ apiHost, outputPath, disableTelemetry }) {
|
|
4382
5719
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
@@ -4397,10 +5734,10 @@ var NewMeshCmd = {
|
|
|
4397
5734
|
};
|
|
4398
5735
|
|
|
4399
5736
|
// src/commands/optimize/index.ts
|
|
4400
|
-
import
|
|
5737
|
+
import yargs17 from "yargs";
|
|
4401
5738
|
|
|
4402
5739
|
// src/commands/optimize/manifest.ts
|
|
4403
|
-
import
|
|
5740
|
+
import yargs16 from "yargs";
|
|
4404
5741
|
|
|
4405
5742
|
// src/commands/optimize/manifest/download.ts
|
|
4406
5743
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -4415,7 +5752,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
4415
5752
|
var module = {
|
|
4416
5753
|
command: "download [output]",
|
|
4417
5754
|
describe: "Download intent manifest",
|
|
4418
|
-
builder: (
|
|
5755
|
+
builder: (yargs25) => yargs25.option("apiKey", {
|
|
4419
5756
|
alias: "k",
|
|
4420
5757
|
demandOption: true,
|
|
4421
5758
|
string: true,
|
|
@@ -4516,10 +5853,10 @@ var module2 = {
|
|
|
4516
5853
|
command: "manifest <command>",
|
|
4517
5854
|
describe: "Intent manifest commands",
|
|
4518
5855
|
builder: () => {
|
|
4519
|
-
return
|
|
5856
|
+
return yargs16.command(download_default);
|
|
4520
5857
|
},
|
|
4521
5858
|
handler: () => {
|
|
4522
|
-
|
|
5859
|
+
yargs16.showHelp();
|
|
4523
5860
|
}
|
|
4524
5861
|
};
|
|
4525
5862
|
var manifest_default = module2;
|
|
@@ -4530,28 +5867,30 @@ var OptimizeCommand = {
|
|
|
4530
5867
|
aliases: ["opt"],
|
|
4531
5868
|
describe: "Uniform Optimize commands",
|
|
4532
5869
|
builder: () => {
|
|
4533
|
-
return
|
|
5870
|
+
return yargs17.command(manifest_default);
|
|
4534
5871
|
},
|
|
4535
5872
|
handler: () => {
|
|
4536
|
-
|
|
5873
|
+
yargs17.showHelp();
|
|
4537
5874
|
}
|
|
4538
5875
|
};
|
|
4539
5876
|
|
|
4540
5877
|
// src/commands/project-map/index.ts
|
|
4541
|
-
import
|
|
5878
|
+
import yargs20 from "yargs";
|
|
4542
5879
|
|
|
4543
5880
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
4544
|
-
import
|
|
5881
|
+
import yargs18 from "yargs";
|
|
4545
5882
|
|
|
4546
5883
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
4547
5884
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
4548
5885
|
var ProjectMapDefinitionGetModule = {
|
|
4549
5886
|
command: "get <id>",
|
|
4550
5887
|
describe: "Fetch a project map",
|
|
4551
|
-
builder: (
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
5888
|
+
builder: (yargs25) => withFormatOptions(
|
|
5889
|
+
withConfiguration(
|
|
5890
|
+
withApiOptions(
|
|
5891
|
+
withProjectOptions(
|
|
5892
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
5893
|
+
)
|
|
4555
5894
|
)
|
|
4556
5895
|
)
|
|
4557
5896
|
),
|
|
@@ -4574,7 +5913,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
4574
5913
|
command: "list",
|
|
4575
5914
|
describe: "List of project maps",
|
|
4576
5915
|
aliases: ["ls"],
|
|
4577
|
-
builder: (
|
|
5916
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
4578
5917
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4579
5918
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4580
5919
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4631,30 +5970,32 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
4631
5970
|
var ProjectMapDefinitionPullModule = {
|
|
4632
5971
|
command: "pull <directory>",
|
|
4633
5972
|
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
|
-
|
|
5973
|
+
builder: (yargs25) => withConfiguration(
|
|
5974
|
+
withApiOptions(
|
|
5975
|
+
withProjectOptions(
|
|
5976
|
+
withDiffOptions(
|
|
5977
|
+
yargs25.positional("directory", {
|
|
5978
|
+
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.",
|
|
5979
|
+
type: "string"
|
|
5980
|
+
}).option("format", {
|
|
5981
|
+
alias: ["f"],
|
|
5982
|
+
describe: "Output format",
|
|
5983
|
+
default: "yaml",
|
|
5984
|
+
choices: ["yaml", "json"],
|
|
5985
|
+
type: "string"
|
|
5986
|
+
}).option("what-if", {
|
|
5987
|
+
alias: ["w"],
|
|
5988
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
5989
|
+
default: false,
|
|
5990
|
+
type: "boolean"
|
|
5991
|
+
}).option("mode", {
|
|
5992
|
+
alias: ["m"],
|
|
5993
|
+
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',
|
|
5994
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
5995
|
+
default: "mirror",
|
|
5996
|
+
type: "string"
|
|
5997
|
+
})
|
|
5998
|
+
)
|
|
4658
5999
|
)
|
|
4659
6000
|
)
|
|
4660
6001
|
),
|
|
@@ -4708,24 +6049,26 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
4708
6049
|
var ProjectMapDefinitionPushModule = {
|
|
4709
6050
|
command: "push <directory>",
|
|
4710
6051
|
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
|
-
|
|
6052
|
+
builder: (yargs25) => withConfiguration(
|
|
6053
|
+
withApiOptions(
|
|
6054
|
+
withProjectOptions(
|
|
6055
|
+
withDiffOptions(
|
|
6056
|
+
yargs25.positional("directory", {
|
|
6057
|
+
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6058
|
+
type: "string"
|
|
6059
|
+
}).option("what-if", {
|
|
6060
|
+
alias: ["w"],
|
|
6061
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
6062
|
+
default: false,
|
|
6063
|
+
type: "boolean"
|
|
6064
|
+
}).option("mode", {
|
|
6065
|
+
alias: ["m"],
|
|
6066
|
+
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',
|
|
6067
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
6068
|
+
default: "mirror",
|
|
6069
|
+
type: "string"
|
|
6070
|
+
})
|
|
6071
|
+
)
|
|
4729
6072
|
)
|
|
4730
6073
|
)
|
|
4731
6074
|
),
|
|
@@ -4774,8 +6117,10 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
4774
6117
|
command: "remove <id>",
|
|
4775
6118
|
aliases: ["delete", "rm"],
|
|
4776
6119
|
describe: "Delete a project map",
|
|
4777
|
-
builder: (
|
|
4778
|
-
|
|
6120
|
+
builder: (yargs25) => withConfiguration(
|
|
6121
|
+
withApiOptions(
|
|
6122
|
+
withProjectOptions(yargs25.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6123
|
+
)
|
|
4779
6124
|
),
|
|
4780
6125
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
4781
6126
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4790,9 +6135,11 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4790
6135
|
command: "update <filename>",
|
|
4791
6136
|
aliases: ["put"],
|
|
4792
6137
|
describe: "Insert or update a project map",
|
|
4793
|
-
builder: (
|
|
4794
|
-
|
|
4795
|
-
|
|
6138
|
+
builder: (yargs25) => withConfiguration(
|
|
6139
|
+
withApiOptions(
|
|
6140
|
+
withProjectOptions(
|
|
6141
|
+
yargs25.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6142
|
+
)
|
|
4796
6143
|
)
|
|
4797
6144
|
),
|
|
4798
6145
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -4807,24 +6154,26 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
4807
6154
|
var ProjectMapDefinitionModule = {
|
|
4808
6155
|
command: "definition <command>",
|
|
4809
6156
|
describe: "Commands for ProjectMap Definitions",
|
|
4810
|
-
builder: (
|
|
6157
|
+
builder: (yargs25) => yargs25.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
4811
6158
|
handler: () => {
|
|
4812
|
-
|
|
6159
|
+
yargs18.help();
|
|
4813
6160
|
}
|
|
4814
6161
|
};
|
|
4815
6162
|
|
|
4816
6163
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
4817
|
-
import
|
|
6164
|
+
import yargs19 from "yargs";
|
|
4818
6165
|
|
|
4819
6166
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
4820
6167
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
4821
6168
|
var ProjectMapNodeGetModule = {
|
|
4822
6169
|
command: "get <id> <projectMapId>",
|
|
4823
6170
|
describe: "Fetch a project map node",
|
|
4824
|
-
builder: (
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
6171
|
+
builder: (yargs25) => withConfiguration(
|
|
6172
|
+
withFormatOptions(
|
|
6173
|
+
withApiOptions(
|
|
6174
|
+
withProjectOptions(
|
|
6175
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6176
|
+
)
|
|
4828
6177
|
)
|
|
4829
6178
|
)
|
|
4830
6179
|
),
|
|
@@ -4849,10 +6198,15 @@ var ProjectMapNodeListModule = {
|
|
|
4849
6198
|
command: "list <projectMapId>",
|
|
4850
6199
|
describe: "List project map nodes",
|
|
4851
6200
|
aliases: ["ls"],
|
|
4852
|
-
builder: (
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
6201
|
+
builder: (yargs25) => withConfiguration(
|
|
6202
|
+
withFormatOptions(
|
|
6203
|
+
withApiOptions(
|
|
6204
|
+
withProjectOptions(
|
|
6205
|
+
yargs25.positional("projectMapId", {
|
|
6206
|
+
demandOption: true,
|
|
6207
|
+
describe: "ProjectMap UUID to fetch from"
|
|
6208
|
+
})
|
|
6209
|
+
)
|
|
4856
6210
|
)
|
|
4857
6211
|
)
|
|
4858
6212
|
),
|
|
@@ -4919,30 +6273,32 @@ function createProjectMapNodeEngineDataSource({
|
|
|
4919
6273
|
var ProjectMapNodePullModule = {
|
|
4920
6274
|
command: "pull <directory>",
|
|
4921
6275
|
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
|
-
|
|
6276
|
+
builder: (yargs25) => withConfiguration(
|
|
6277
|
+
withApiOptions(
|
|
6278
|
+
withProjectOptions(
|
|
6279
|
+
withDiffOptions(
|
|
6280
|
+
yargs25.positional("directory", {
|
|
6281
|
+
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.",
|
|
6282
|
+
type: "string"
|
|
6283
|
+
}).option("format", {
|
|
6284
|
+
alias: ["f"],
|
|
6285
|
+
describe: "Output format",
|
|
6286
|
+
default: "yaml",
|
|
6287
|
+
choices: ["yaml", "json"],
|
|
6288
|
+
type: "string"
|
|
6289
|
+
}).option("what-if", {
|
|
6290
|
+
alias: ["w"],
|
|
6291
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
6292
|
+
default: false,
|
|
6293
|
+
type: "boolean"
|
|
6294
|
+
}).option("mode", {
|
|
6295
|
+
alias: ["m"],
|
|
6296
|
+
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',
|
|
6297
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
6298
|
+
default: "mirror",
|
|
6299
|
+
type: "string"
|
|
6300
|
+
})
|
|
6301
|
+
)
|
|
4946
6302
|
)
|
|
4947
6303
|
)
|
|
4948
6304
|
),
|
|
@@ -5000,24 +6356,26 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
5000
6356
|
var ProjectMapNodePushModule = {
|
|
5001
6357
|
command: "push <directory>",
|
|
5002
6358
|
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
|
-
|
|
6359
|
+
builder: (yargs25) => withConfiguration(
|
|
6360
|
+
withApiOptions(
|
|
6361
|
+
withProjectOptions(
|
|
6362
|
+
withDiffOptions(
|
|
6363
|
+
yargs25.positional("directory", {
|
|
6364
|
+
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6365
|
+
type: "string"
|
|
6366
|
+
}).option("what-if", {
|
|
6367
|
+
alias: ["w"],
|
|
6368
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
6369
|
+
default: false,
|
|
6370
|
+
type: "boolean"
|
|
6371
|
+
}).option("mode", {
|
|
6372
|
+
alias: ["m"],
|
|
6373
|
+
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',
|
|
6374
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
6375
|
+
default: "mirror",
|
|
6376
|
+
type: "string"
|
|
6377
|
+
})
|
|
6378
|
+
)
|
|
5021
6379
|
)
|
|
5022
6380
|
)
|
|
5023
6381
|
),
|
|
@@ -5075,9 +6433,11 @@ var ProjectMapNodeRemoveModule = {
|
|
|
5075
6433
|
command: "remove <id> <projectMapId>",
|
|
5076
6434
|
aliases: ["delete", "rm"],
|
|
5077
6435
|
describe: "Delete a project map node",
|
|
5078
|
-
builder: (
|
|
5079
|
-
|
|
5080
|
-
|
|
6436
|
+
builder: (yargs25) => withConfiguration(
|
|
6437
|
+
withApiOptions(
|
|
6438
|
+
withProjectOptions(
|
|
6439
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
6440
|
+
)
|
|
5081
6441
|
)
|
|
5082
6442
|
),
|
|
5083
6443
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, id, project: projectId }) => {
|
|
@@ -5093,9 +6453,11 @@ var ProjectMapNodeUpdateModule = {
|
|
|
5093
6453
|
command: "update <filename> <projectMapId>",
|
|
5094
6454
|
aliases: ["put"],
|
|
5095
6455
|
describe: "Insert or update a project map node",
|
|
5096
|
-
builder: (
|
|
5097
|
-
|
|
5098
|
-
|
|
6456
|
+
builder: (yargs25) => withConfiguration(
|
|
6457
|
+
withApiOptions(
|
|
6458
|
+
withProjectOptions(
|
|
6459
|
+
yargs25.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
6460
|
+
)
|
|
5099
6461
|
)
|
|
5100
6462
|
),
|
|
5101
6463
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, filename, project: projectId }) => {
|
|
@@ -5110,9 +6472,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
5110
6472
|
var ProjectMapNodeModule = {
|
|
5111
6473
|
command: "node <command>",
|
|
5112
6474
|
describe: "Commands for ProjectMap Nodes",
|
|
5113
|
-
builder: (
|
|
6475
|
+
builder: (yargs25) => yargs25.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
5114
6476
|
handler: () => {
|
|
5115
|
-
|
|
6477
|
+
yargs19.help();
|
|
5116
6478
|
}
|
|
5117
6479
|
};
|
|
5118
6480
|
|
|
@@ -5121,26 +6483,30 @@ var ProjectMapCommand = {
|
|
|
5121
6483
|
command: "project-map <command>",
|
|
5122
6484
|
aliases: ["prm"],
|
|
5123
6485
|
describe: "Uniform ProjectMap commands",
|
|
5124
|
-
builder: (
|
|
6486
|
+
builder: (yargs25) => yargs25.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
5125
6487
|
handler: () => {
|
|
5126
|
-
|
|
6488
|
+
yargs20.showHelp();
|
|
5127
6489
|
}
|
|
5128
6490
|
};
|
|
5129
6491
|
|
|
5130
6492
|
// src/commands/redirect/index.ts
|
|
5131
|
-
import
|
|
6493
|
+
import yargs22 from "yargs";
|
|
5132
6494
|
|
|
5133
6495
|
// src/commands/redirect/commands/redirect.ts
|
|
5134
|
-
import
|
|
6496
|
+
import yargs21 from "yargs";
|
|
5135
6497
|
|
|
5136
6498
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
5137
6499
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
5138
6500
|
var RedirectDefinitionGetModule = {
|
|
5139
6501
|
command: "get <id>",
|
|
5140
6502
|
describe: "Fetch a redirect",
|
|
5141
|
-
builder: (
|
|
5142
|
-
|
|
5143
|
-
|
|
6503
|
+
builder: (yargs25) => withConfiguration(
|
|
6504
|
+
withFormatOptions(
|
|
6505
|
+
withApiOptions(
|
|
6506
|
+
withProjectOptions(
|
|
6507
|
+
yargs25.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
6508
|
+
)
|
|
6509
|
+
)
|
|
5144
6510
|
)
|
|
5145
6511
|
),
|
|
5146
6512
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
@@ -5162,7 +6528,7 @@ var RedirectDefinitionListModule = {
|
|
|
5162
6528
|
command: "list",
|
|
5163
6529
|
describe: "List of redirects",
|
|
5164
6530
|
aliases: ["ls"],
|
|
5165
|
-
builder: (
|
|
6531
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
5166
6532
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5167
6533
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5168
6534
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5228,30 +6594,32 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
5228
6594
|
var RedirectDefinitionPullModule = {
|
|
5229
6595
|
command: "pull <directory>",
|
|
5230
6596
|
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
|
-
|
|
6597
|
+
builder: (yargs25) => withConfiguration(
|
|
6598
|
+
withApiOptions(
|
|
6599
|
+
withProjectOptions(
|
|
6600
|
+
withDiffOptions(
|
|
6601
|
+
yargs25.positional("directory", {
|
|
6602
|
+
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.",
|
|
6603
|
+
type: "string"
|
|
6604
|
+
}).option("format", {
|
|
6605
|
+
alias: ["f"],
|
|
6606
|
+
describe: "Output format",
|
|
6607
|
+
default: "yaml",
|
|
6608
|
+
choices: ["yaml", "json"],
|
|
6609
|
+
type: "string"
|
|
6610
|
+
}).option("what-if", {
|
|
6611
|
+
alias: ["w"],
|
|
6612
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
6613
|
+
default: false,
|
|
6614
|
+
type: "boolean"
|
|
6615
|
+
}).option("mode", {
|
|
6616
|
+
alias: ["m"],
|
|
6617
|
+
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',
|
|
6618
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
6619
|
+
default: "mirror",
|
|
6620
|
+
type: "string"
|
|
6621
|
+
})
|
|
6622
|
+
)
|
|
5255
6623
|
)
|
|
5256
6624
|
)
|
|
5257
6625
|
),
|
|
@@ -5306,24 +6674,26 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
5306
6674
|
var RedirectDefinitionPushModule = {
|
|
5307
6675
|
command: "push <directory>",
|
|
5308
6676
|
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
|
-
|
|
6677
|
+
builder: (yargs25) => withConfiguration(
|
|
6678
|
+
withApiOptions(
|
|
6679
|
+
withProjectOptions(
|
|
6680
|
+
withDiffOptions(
|
|
6681
|
+
yargs25.positional("directory", {
|
|
6682
|
+
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
6683
|
+
type: "string"
|
|
6684
|
+
}).option("what-if", {
|
|
6685
|
+
alias: ["w"],
|
|
6686
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
6687
|
+
default: false,
|
|
6688
|
+
type: "boolean"
|
|
6689
|
+
}).option("mode", {
|
|
6690
|
+
alias: ["m"],
|
|
6691
|
+
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',
|
|
6692
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
6693
|
+
default: "mirror",
|
|
6694
|
+
type: "string"
|
|
6695
|
+
})
|
|
6696
|
+
)
|
|
5327
6697
|
)
|
|
5328
6698
|
)
|
|
5329
6699
|
),
|
|
@@ -5372,8 +6742,10 @@ var RedirectDefinitionRemoveModule = {
|
|
|
5372
6742
|
command: "remove <id>",
|
|
5373
6743
|
aliases: ["delete", "rm"],
|
|
5374
6744
|
describe: "Delete a redirect",
|
|
5375
|
-
builder: (
|
|
5376
|
-
|
|
6745
|
+
builder: (yargs25) => withConfiguration(
|
|
6746
|
+
withApiOptions(
|
|
6747
|
+
withProjectOptions(yargs25.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6748
|
+
)
|
|
5377
6749
|
),
|
|
5378
6750
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
5379
6751
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -5388,9 +6760,11 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5388
6760
|
command: "update <filename>",
|
|
5389
6761
|
aliases: ["put"],
|
|
5390
6762
|
describe: "Insert or update a redirect",
|
|
5391
|
-
builder: (
|
|
5392
|
-
|
|
5393
|
-
|
|
6763
|
+
builder: (yargs25) => withConfiguration(
|
|
6764
|
+
withApiOptions(
|
|
6765
|
+
withProjectOptions(
|
|
6766
|
+
yargs25.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
6767
|
+
)
|
|
5394
6768
|
)
|
|
5395
6769
|
),
|
|
5396
6770
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5405,9 +6779,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
5405
6779
|
var RedirectDefinitionModule = {
|
|
5406
6780
|
command: "definition <command>",
|
|
5407
6781
|
describe: "Commands for Redirect Definitions",
|
|
5408
|
-
builder: (
|
|
6782
|
+
builder: (yargs25) => yargs25.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
5409
6783
|
handler: () => {
|
|
5410
|
-
|
|
6784
|
+
yargs21.help();
|
|
5411
6785
|
}
|
|
5412
6786
|
};
|
|
5413
6787
|
|
|
@@ -5416,9 +6790,179 @@ var RedirectCommand = {
|
|
|
5416
6790
|
command: "redirect <command>",
|
|
5417
6791
|
aliases: ["red"],
|
|
5418
6792
|
describe: "Uniform Redirect commands",
|
|
5419
|
-
builder: (
|
|
6793
|
+
builder: (yargs25) => yargs25.command(RedirectDefinitionModule).demandCommand(),
|
|
6794
|
+
handler: () => {
|
|
6795
|
+
yargs22.showHelp();
|
|
6796
|
+
}
|
|
6797
|
+
};
|
|
6798
|
+
|
|
6799
|
+
// src/commands/sync/index.ts
|
|
6800
|
+
import yargs23 from "yargs";
|
|
6801
|
+
|
|
6802
|
+
// src/commands/sync/commands/pull.ts
|
|
6803
|
+
var SyncPullModule = {
|
|
6804
|
+
command: "pull",
|
|
6805
|
+
describe: "Pulls whole project to local files in a directory",
|
|
6806
|
+
builder: (yargs25) => withConfiguration(
|
|
6807
|
+
withApiOptions(
|
|
6808
|
+
withProjectOptions(
|
|
6809
|
+
withDiffOptions(
|
|
6810
|
+
yargs25.option("what-if", {
|
|
6811
|
+
alias: ["w"],
|
|
6812
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
6813
|
+
default: false,
|
|
6814
|
+
type: "boolean"
|
|
6815
|
+
})
|
|
6816
|
+
)
|
|
6817
|
+
)
|
|
6818
|
+
)
|
|
6819
|
+
),
|
|
6820
|
+
handler: async ({ serialization, ...otherParams }) => {
|
|
6821
|
+
const config2 = serialization;
|
|
6822
|
+
const enabledEntities = Object.entries({
|
|
6823
|
+
category: CategoryPullModule,
|
|
6824
|
+
dataType: DataTypePullModule,
|
|
6825
|
+
quirk: QuirkPullModule,
|
|
6826
|
+
test: TestPullModule,
|
|
6827
|
+
signal: SignalPullModule,
|
|
6828
|
+
enrichment: EnrichmentPullModule,
|
|
6829
|
+
aggregate: AggregatePullModule,
|
|
6830
|
+
component: ComponentPullModule,
|
|
6831
|
+
pattern: PatternPullModule,
|
|
6832
|
+
composition: CompositionPullModule,
|
|
6833
|
+
projectMapDefinition: ProjectMapDefinitionPullModule,
|
|
6834
|
+
projectMapNode: ProjectMapNodePullModule,
|
|
6835
|
+
redirect: RedirectDefinitionPullModule
|
|
6836
|
+
}).filter(([entityType]) => {
|
|
6837
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6838
|
+
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;
|
|
6839
|
+
});
|
|
6840
|
+
for (const [entityType, module3] of enabledEntities) {
|
|
6841
|
+
await module3.handler({
|
|
6842
|
+
...otherParams,
|
|
6843
|
+
state: 0,
|
|
6844
|
+
format: getFormat(entityType, config2),
|
|
6845
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
6846
|
+
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
6847
|
+
mode: getPullMode(entityType, config2),
|
|
6848
|
+
directory: getPullFilename(entityType, config2)
|
|
6849
|
+
});
|
|
6850
|
+
}
|
|
6851
|
+
}
|
|
6852
|
+
};
|
|
6853
|
+
var getPullMode = (entityType, config2) => {
|
|
6854
|
+
return getEntityOption({
|
|
6855
|
+
optionName: "mode",
|
|
6856
|
+
operation: "pull",
|
|
6857
|
+
config: config2,
|
|
6858
|
+
entityType
|
|
6859
|
+
});
|
|
6860
|
+
};
|
|
6861
|
+
var getPullFilename = (entityType, config2) => {
|
|
6862
|
+
return getDirectoryOrFilename({
|
|
6863
|
+
operation: "pull",
|
|
6864
|
+
config: config2,
|
|
6865
|
+
entityType
|
|
6866
|
+
});
|
|
6867
|
+
};
|
|
6868
|
+
var getFormat = (entityType, config2) => {
|
|
6869
|
+
return getEntityOption({
|
|
6870
|
+
optionName: "format",
|
|
6871
|
+
operation: "pull",
|
|
6872
|
+
config: config2,
|
|
6873
|
+
entityType
|
|
6874
|
+
});
|
|
6875
|
+
};
|
|
6876
|
+
|
|
6877
|
+
// src/commands/sync/commands/push.ts
|
|
6878
|
+
var SyncPushModule = {
|
|
6879
|
+
command: "push",
|
|
6880
|
+
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
6881
|
+
builder: (yargs25) => withConfiguration(
|
|
6882
|
+
withApiOptions(
|
|
6883
|
+
withProjectOptions(
|
|
6884
|
+
withDiffOptions(
|
|
6885
|
+
yargs25.option("what-if", {
|
|
6886
|
+
alias: ["w"],
|
|
6887
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
6888
|
+
default: false,
|
|
6889
|
+
type: "boolean"
|
|
6890
|
+
})
|
|
6891
|
+
)
|
|
6892
|
+
)
|
|
6893
|
+
)
|
|
6894
|
+
),
|
|
6895
|
+
handler: async ({ serialization, ...otherParams }) => {
|
|
6896
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
6897
|
+
const config2 = serialization;
|
|
6898
|
+
const enabledEntities = Object.entries({
|
|
6899
|
+
category: CategoryPushModule,
|
|
6900
|
+
dataType: DataTypePushModule,
|
|
6901
|
+
quirk: QuirkPushModule,
|
|
6902
|
+
test: TestPushModule,
|
|
6903
|
+
signal: SignalPushModule,
|
|
6904
|
+
enrichment: EnrichmentPushModule,
|
|
6905
|
+
aggregate: AggregatePushModule,
|
|
6906
|
+
component: ComponentPushModule,
|
|
6907
|
+
pattern: PatternPushModule,
|
|
6908
|
+
composition: CompositionPushModule,
|
|
6909
|
+
projectMapDefinition: ProjectMapDefinitionPushModule,
|
|
6910
|
+
projectMapNode: ProjectMapNodePushModule,
|
|
6911
|
+
redirect: RedirectDefinitionPushModule
|
|
6912
|
+
}).filter(([entityType]) => {
|
|
6913
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
6914
|
+
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;
|
|
6915
|
+
});
|
|
6916
|
+
for (const [entityType, module3] of enabledEntities) {
|
|
6917
|
+
await module3.handler({
|
|
6918
|
+
...otherParams,
|
|
6919
|
+
state: 0,
|
|
6920
|
+
format: getFormat2(entityType, config2),
|
|
6921
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
6922
|
+
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
6923
|
+
mode: getPushMode(entityType, config2),
|
|
6924
|
+
directory: getPushFilename(entityType, config2)
|
|
6925
|
+
});
|
|
6926
|
+
}
|
|
6927
|
+
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)) {
|
|
6928
|
+
await PatternPublishModule.handler({ ...otherParams, all: true });
|
|
6929
|
+
}
|
|
6930
|
+
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)) {
|
|
6931
|
+
await CompositionPublishModule.handler({ ...otherParams, all: true });
|
|
6932
|
+
}
|
|
6933
|
+
}
|
|
6934
|
+
};
|
|
6935
|
+
var getPushMode = (entityType, config2) => {
|
|
6936
|
+
return getEntityOption({
|
|
6937
|
+
optionName: "mode",
|
|
6938
|
+
operation: "push",
|
|
6939
|
+
config: config2,
|
|
6940
|
+
entityType
|
|
6941
|
+
});
|
|
6942
|
+
};
|
|
6943
|
+
var getPushFilename = (entityType, config2) => {
|
|
6944
|
+
return getDirectoryOrFilename({
|
|
6945
|
+
operation: "push",
|
|
6946
|
+
config: config2,
|
|
6947
|
+
entityType
|
|
6948
|
+
});
|
|
6949
|
+
};
|
|
6950
|
+
var getFormat2 = (entityType, config2) => {
|
|
6951
|
+
return getEntityOption({
|
|
6952
|
+
optionName: "format",
|
|
6953
|
+
operation: "push",
|
|
6954
|
+
config: config2,
|
|
6955
|
+
entityType
|
|
6956
|
+
});
|
|
6957
|
+
};
|
|
6958
|
+
|
|
6959
|
+
// src/commands/sync/index.ts
|
|
6960
|
+
var SyncCommand = {
|
|
6961
|
+
command: "sync <command>",
|
|
6962
|
+
describe: "Uniform Sync commands",
|
|
6963
|
+
builder: (yargs25) => yargs25.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
5420
6964
|
handler: () => {
|
|
5421
|
-
|
|
6965
|
+
yargs23.showHelp();
|
|
5422
6966
|
}
|
|
5423
6967
|
};
|
|
5424
6968
|
|
|
@@ -5462,17 +7006,17 @@ async function checkForUpdateMiddleware() {
|
|
|
5462
7006
|
|
|
5463
7007
|
// src/middleware/checkLocalDepsVersionsMiddleware.ts
|
|
5464
7008
|
import { magenta, red as red6 } from "colorette";
|
|
5465
|
-
import { join as
|
|
7009
|
+
import { join as join3 } from "path";
|
|
5466
7010
|
|
|
5467
7011
|
// src/fs.ts
|
|
5468
|
-
import { promises as
|
|
7012
|
+
import { promises as fs5 } from "fs";
|
|
5469
7013
|
async function readJSON(path4) {
|
|
5470
|
-
const fileContents = await
|
|
7014
|
+
const fileContents = await fs5.readFile(path4, "utf-8");
|
|
5471
7015
|
return JSON.parse(fileContents);
|
|
5472
7016
|
}
|
|
5473
7017
|
async function tryReadJSON(path4, missingValue = null) {
|
|
5474
7018
|
try {
|
|
5475
|
-
const stat = await
|
|
7019
|
+
const stat = await fs5.stat(path4);
|
|
5476
7020
|
return stat.isFile() ? await readJSON(path4) : missingValue;
|
|
5477
7021
|
} catch (e) {
|
|
5478
7022
|
return missingValue;
|
|
@@ -5501,7 +7045,7 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
5501
7045
|
try {
|
|
5502
7046
|
let isOutside = false;
|
|
5503
7047
|
let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
|
|
5504
|
-
const localPackages = await tryReadJSON(
|
|
7048
|
+
const localPackages = await tryReadJSON(join3(process.cwd(), "package.json"));
|
|
5505
7049
|
if (!localPackages)
|
|
5506
7050
|
return;
|
|
5507
7051
|
let firstVersion;
|
|
@@ -5534,9 +7078,13 @@ First found was: v${firstVersion}`;
|
|
|
5534
7078
|
|
|
5535
7079
|
// src/index.ts
|
|
5536
7080
|
dotenv.config();
|
|
5537
|
-
var yarggery =
|
|
7081
|
+
var yarggery = yargs24(hideBin(process.argv));
|
|
7082
|
+
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
7083
|
+
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
5538
7084
|
yarggery.option("verbose", {
|
|
5539
7085
|
describe: "Include verbose logging",
|
|
5540
7086
|
default: false,
|
|
5541
7087
|
type: "boolean"
|
|
5542
|
-
}).
|
|
7088
|
+
}).scriptName("uniform").config(configuration).config("config", function() {
|
|
7089
|
+
return {};
|
|
7090
|
+
}).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;
|