@uniformdev/cli 19.158.0 → 19.159.1-alpha.16
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/chunk-2TESILZJ.mjs +267 -0
- package/dist/defaultConfig.d.mts +46 -0
- package/dist/defaultConfig.mjs +52 -0
- package/dist/index-CvG5Ery7.d.mts +48 -0
- package/dist/index.d.mts +1 -47
- package/dist/index.mjs +850 -720
- package/package.json +19 -9
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import {
|
|
3
|
+
__require,
|
|
4
|
+
applyDefaultSyncConfiguration,
|
|
5
|
+
emitWithFormat,
|
|
6
|
+
getDirectoryOrFilename,
|
|
7
|
+
getEntityOption,
|
|
8
|
+
isPathAPackageFile,
|
|
9
|
+
nodeFetchProxy,
|
|
10
|
+
paginateAsync,
|
|
11
|
+
readFileToObject,
|
|
12
|
+
withApiOptions,
|
|
13
|
+
withConfiguration,
|
|
14
|
+
withDiffOptions,
|
|
15
|
+
withFormatOptions,
|
|
16
|
+
withProjectOptions,
|
|
17
|
+
withTeamOptions
|
|
18
|
+
} from "./chunk-2TESILZJ.mjs";
|
|
16
19
|
|
|
17
20
|
// src/index.ts
|
|
18
21
|
import * as dotenv from "dotenv";
|
|
19
|
-
import
|
|
22
|
+
import yargs34 from "yargs";
|
|
20
23
|
import { hideBin } from "yargs/helpers";
|
|
21
24
|
|
|
22
25
|
// src/commands/canvas/index.ts
|
|
23
|
-
import
|
|
26
|
+
import yargs15 from "yargs";
|
|
24
27
|
|
|
25
28
|
// src/commands/canvas/commands/asset.ts
|
|
26
29
|
import yargs from "yargs";
|
|
@@ -90,9 +93,9 @@ async function createArraySyncEngineDataSource({
|
|
|
90
93
|
|
|
91
94
|
// src/sync/fileSyncEngineDataSource.ts
|
|
92
95
|
import { red } from "colorette";
|
|
93
|
-
import { existsSync, mkdirSync
|
|
96
|
+
import { existsSync, mkdirSync } from "fs";
|
|
94
97
|
import { readdir, unlink } from "fs/promises";
|
|
95
|
-
import { extname
|
|
98
|
+
import { extname, join } from "path";
|
|
96
99
|
|
|
97
100
|
// src/util.ts
|
|
98
101
|
import { cosmiconfigSync } from "cosmiconfig";
|
|
@@ -121,254 +124,16 @@ var loadConfig = (configPath) => {
|
|
|
121
124
|
throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
|
|
122
125
|
}
|
|
123
126
|
const configFile = syncCosmicExplorer.load(configPath);
|
|
124
|
-
if (!
|
|
127
|
+
if (!configFile?.config.serialization) {
|
|
125
128
|
throw new Error(
|
|
126
129
|
`Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
|
|
127
130
|
);
|
|
128
131
|
}
|
|
129
|
-
return applyDefaultSyncConfiguration(
|
|
132
|
+
return applyDefaultSyncConfiguration(configFile?.config ?? {});
|
|
130
133
|
} else {
|
|
131
134
|
const searchedForm = syncCosmicExplorer.search();
|
|
132
|
-
return applyDefaultSyncConfiguration(
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// src/sync/util.ts
|
|
137
|
-
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
138
|
-
import { dump, load } from "js-yaml";
|
|
139
|
-
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
140
|
-
import { fetch as undiciFetch, ProxyAgent } from "undici";
|
|
141
|
-
function withConfiguration(yargs34) {
|
|
142
|
-
return yargs34.option("serialization", {
|
|
143
|
-
skipValidation: true,
|
|
144
|
-
hidden: true
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function withApiOptions(yargs34) {
|
|
148
|
-
return yargs34.option("apiKey", {
|
|
149
|
-
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
150
|
-
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
151
|
-
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
152
|
-
process.env.UPM_CLI_API_KEY ?? process.env.UNIFORM_API_KEY,
|
|
153
|
-
demandOption: true,
|
|
154
|
-
type: "string"
|
|
155
|
-
}).option("apiHost", {
|
|
156
|
-
describe: "Uniform host. Defaults to UNIFORM_CLI_BASE_URL env var or https://uniform.app. Supports dotenv.",
|
|
157
|
-
default: process.env.UNIFORM_CLI_BASE_URL || "https://uniform.app",
|
|
158
|
-
demandOption: true,
|
|
159
|
-
type: "string"
|
|
160
|
-
}).option("edgeApiHost", {
|
|
161
|
-
describe: "Uniform edge host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env var or https://uniform.global. Supports dotenv.",
|
|
162
|
-
default: process.env.UNIFORM_CLI_BASE_EDGE_URL || "https://uniform.global",
|
|
163
|
-
demandOption: true,
|
|
164
|
-
type: "string"
|
|
165
|
-
}).option("proxy", {
|
|
166
|
-
describe: "HTTPS proxy to use for Uniform API calls. Defaults to HTTPS_PROXY, https_proxy, ALL_PROXY, or all_proxy env vars (in that order). Supports dotenv.",
|
|
167
|
-
default: process.env.HTTPS_PROXY || process.env.https_proxy || process.env.ALL_PROXY || process.env.all_proxy,
|
|
168
|
-
type: "string"
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
function nodeFetchProxy(proxy) {
|
|
172
|
-
if (proxy) {
|
|
173
|
-
console.log(`\u{1F991} Using proxy ${proxy}`);
|
|
174
|
-
}
|
|
175
|
-
const wrappedFetch = (input, init) => {
|
|
176
|
-
if (proxy) {
|
|
177
|
-
const wrappedInit = {
|
|
178
|
-
...init,
|
|
179
|
-
dispatcher: new ProxyAgent(proxy)
|
|
180
|
-
};
|
|
181
|
-
return undiciFetch(input, wrappedInit);
|
|
182
|
-
}
|
|
183
|
-
return undiciFetch(input, init);
|
|
184
|
-
};
|
|
185
|
-
return wrappedFetch;
|
|
186
|
-
}
|
|
187
|
-
function withProjectOptions(yargs34) {
|
|
188
|
-
return yargs34.option("project", {
|
|
189
|
-
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
190
|
-
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
191
|
-
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
192
|
-
process.env.UPM_CLI_PROJECT_ID ?? process.env.UNIFORM_PROJECT_ID,
|
|
193
|
-
demandOption: true,
|
|
194
|
-
type: "string",
|
|
195
|
-
alias: ["p"]
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
function withTeamOptions(yargs34) {
|
|
199
|
-
return yargs34.option("team", {
|
|
200
|
-
describe: "Uniform team ID. Defaults to UNIFORM_CLI_TEAM_ID or UNIFORM_TEAM_ID env. Supports dotenv.",
|
|
201
|
-
default: process.env.UNIFORM_CLI_TEAM_ID ?? process.env.UNIFORM_TEAM_ID,
|
|
202
|
-
demandOption: true,
|
|
203
|
-
type: "string",
|
|
204
|
-
alias: ["p"]
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
function withFormatOptions(yargs34) {
|
|
208
|
-
return yargs34.option("format", {
|
|
209
|
-
alias: ["f"],
|
|
210
|
-
describe: "Output format",
|
|
211
|
-
default: "yaml",
|
|
212
|
-
choices: ["yaml", "json"],
|
|
213
|
-
type: "string"
|
|
214
|
-
}).option("filename", {
|
|
215
|
-
alias: ["o"],
|
|
216
|
-
describe: "Output filename. If not specified, write to stdout.",
|
|
217
|
-
type: "string"
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
function withDiffOptions(yargs34) {
|
|
221
|
-
return yargs34.option("diff", {
|
|
222
|
-
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.",
|
|
223
|
-
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
224
|
-
type: "string",
|
|
225
|
-
choices: ["off", "update", "on"],
|
|
226
|
-
alias: ["d"]
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
function isPathAPackageFile(path5) {
|
|
230
|
-
const extension = extname(path5);
|
|
231
|
-
return extension === ".yaml" || extension === ".yml" || extension === ".json";
|
|
232
|
-
}
|
|
233
|
-
function emitWithFormat(object, format, filename) {
|
|
234
|
-
let content;
|
|
235
|
-
if (filename && !format) {
|
|
236
|
-
const extension = extname(filename);
|
|
237
|
-
if (extension === ".yaml" || extension === ".yml") {
|
|
238
|
-
format = "yaml";
|
|
239
|
-
} else if (extension === ".json") {
|
|
240
|
-
format = "json";
|
|
241
|
-
}
|
|
242
|
-
} else if (!format) {
|
|
243
|
-
throw new Error("Format must be specified when no filename is passed");
|
|
244
|
-
}
|
|
245
|
-
switch (format) {
|
|
246
|
-
case "json":
|
|
247
|
-
content = JSON.stringify(object, null, 2);
|
|
248
|
-
break;
|
|
249
|
-
case "yaml":
|
|
250
|
-
content = dump(object);
|
|
251
|
-
if ("$schema" in object) {
|
|
252
|
-
content = `# yaml-language-server: $schema=<${object["$schema"]}>
|
|
253
|
-
${content}`;
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
default:
|
|
257
|
-
throw new Error(`Unsupported format: ${format}`);
|
|
258
|
-
}
|
|
259
|
-
if (filename) {
|
|
260
|
-
const directory = dirname(filename);
|
|
261
|
-
mkDirByPathSync(directory);
|
|
262
|
-
writeFileSync(filename, content, "utf8");
|
|
263
|
-
} else {
|
|
264
|
-
console.log(content);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
|
|
268
|
-
const initDir = isAbsolute(targetDir) ? sep : "";
|
|
269
|
-
const baseDir = isRelativeToScript ? __dirname : ".";
|
|
270
|
-
return targetDir.split(sep).reduce((parentDir, childDir) => {
|
|
271
|
-
const curDir = resolve(baseDir, parentDir, childDir);
|
|
272
|
-
try {
|
|
273
|
-
mkdirSync(curDir);
|
|
274
|
-
} catch (err) {
|
|
275
|
-
if (err.code === "EEXIST") {
|
|
276
|
-
return curDir;
|
|
277
|
-
}
|
|
278
|
-
if (err.code === "ENOENT") {
|
|
279
|
-
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
|
|
280
|
-
}
|
|
281
|
-
const caughtErr = ["EACCES", "EPERM", "EISDIR"].indexOf(err.code) > -1;
|
|
282
|
-
if (!caughtErr || caughtErr && curDir === resolve(targetDir)) {
|
|
283
|
-
throw err;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return curDir;
|
|
287
|
-
}, initDir);
|
|
288
|
-
}
|
|
289
|
-
function readFileToObject(filename) {
|
|
290
|
-
const file = readFileSync(filename, "utf8");
|
|
291
|
-
return load(file, { filename, json: true });
|
|
292
|
-
}
|
|
293
|
-
async function* paginateAsync(fetchPage, options) {
|
|
294
|
-
const perPage = options.pageSize || 100;
|
|
295
|
-
let offset = 0;
|
|
296
|
-
let pageData = [];
|
|
297
|
-
do {
|
|
298
|
-
pageData = await fetchPage(offset, perPage);
|
|
299
|
-
for (const item of pageData) {
|
|
300
|
-
yield item;
|
|
301
|
-
}
|
|
302
|
-
offset += perPage;
|
|
303
|
-
} while (pageData.length === perPage);
|
|
304
|
-
}
|
|
305
|
-
var defaultSyncConfiguration = {
|
|
306
|
-
entitiesConfig: {},
|
|
307
|
-
directory: "uniform-data",
|
|
308
|
-
allowEmptySource: false,
|
|
309
|
-
format: "yaml",
|
|
310
|
-
mode: "mirror"
|
|
311
|
-
};
|
|
312
|
-
var applyDefaultSyncConfiguration = (config2) => {
|
|
313
|
-
var _a;
|
|
314
|
-
const mergedConfig = {
|
|
315
|
-
serialization: {
|
|
316
|
-
...defaultSyncConfiguration,
|
|
317
|
-
...(config2 == null ? void 0 : config2.serialization) ?? {},
|
|
318
|
-
entitiesConfig: {
|
|
319
|
-
...defaultSyncConfiguration.entitiesConfig,
|
|
320
|
-
...((_a = config2 == null ? void 0 : config2.serialization) == null ? void 0 : _a.entitiesConfig) ?? {}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
for (const entityType in mergedConfig.serialization.entitiesConfig) {
|
|
325
|
-
const entityTypeCasted = entityType;
|
|
326
|
-
const entityConfig = mergedConfig.serialization.entitiesConfig[entityTypeCasted];
|
|
327
|
-
if (Object.keys(entityConfig).length === 0) {
|
|
328
|
-
const separator = mergedConfig.serialization.directory[mergedConfig.serialization.directory.length - 1] === "/" ? "" : "/";
|
|
329
|
-
mergedConfig.serialization.entitiesConfig[entityTypeCasted].directory = isPathAPackageFile(
|
|
330
|
-
mergedConfig.serialization.directory
|
|
331
|
-
) ? mergedConfig.serialization.directory : `${mergedConfig.serialization.directory}${separator}${entityTypeCasted}`;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return mergedConfig;
|
|
335
|
-
};
|
|
336
|
-
var getEntityOption = ({
|
|
337
|
-
optionName,
|
|
338
|
-
config: config2,
|
|
339
|
-
entityType,
|
|
340
|
-
operation
|
|
341
|
-
}) => {
|
|
342
|
-
var _a, _b, _c, _d, _e, _f;
|
|
343
|
-
if ((_b = (_a = config2.entitiesConfig[entityType]) == null ? void 0 : _a[operation]) == null ? void 0 : _b[optionName]) {
|
|
344
|
-
return (_d = (_c = config2.entitiesConfig[entityType]) == null ? void 0 : _c[operation]) == null ? void 0 : _d[optionName];
|
|
345
|
-
}
|
|
346
|
-
if ((_e = config2.entitiesConfig[entityType]) == null ? void 0 : _e[optionName]) {
|
|
347
|
-
return (_f = config2.entitiesConfig[entityType]) == null ? void 0 : _f[optionName];
|
|
135
|
+
return applyDefaultSyncConfiguration(searchedForm?.config ?? {});
|
|
348
136
|
}
|
|
349
|
-
if (config2[optionName]) {
|
|
350
|
-
return config2[optionName];
|
|
351
|
-
}
|
|
352
|
-
throw `No ${optionName} option specified for ${entityType} ${operation}`;
|
|
353
|
-
};
|
|
354
|
-
var getDirectoryOrFilename = ({
|
|
355
|
-
config: config2,
|
|
356
|
-
entityType,
|
|
357
|
-
operation,
|
|
358
|
-
defaultEntityFolderName = entityType
|
|
359
|
-
}) => {
|
|
360
|
-
var _a, _b, _c, _d, _e, _f;
|
|
361
|
-
if ((_b = (_a = config2.entitiesConfig[entityType]) == null ? void 0 : _a[operation]) == null ? void 0 : _b.directory) {
|
|
362
|
-
return (_d = (_c = config2.entitiesConfig[entityType]) == null ? void 0 : _c[operation]) == null ? void 0 : _d.directory;
|
|
363
|
-
}
|
|
364
|
-
if ((_e = config2.entitiesConfig[entityType]) == null ? void 0 : _e.directory) {
|
|
365
|
-
return (_f = config2.entitiesConfig[entityType]) == null ? void 0 : _f.directory;
|
|
366
|
-
}
|
|
367
|
-
const isPackage = isPathAPackageFile(config2.directory);
|
|
368
|
-
if (isPackage) {
|
|
369
|
-
return config2.directory;
|
|
370
|
-
}
|
|
371
|
-
return `${config2.directory}/${defaultEntityFolderName}`;
|
|
372
137
|
};
|
|
373
138
|
|
|
374
139
|
// src/sync/fileSyncEngineDataSource.ts
|
|
@@ -383,12 +148,12 @@ async function createFileSyncEngineDataSource({
|
|
|
383
148
|
}) {
|
|
384
149
|
const dirExists = existsSync(directory);
|
|
385
150
|
if (!dirExists) {
|
|
386
|
-
|
|
151
|
+
mkdirSync(directory, { recursive: true });
|
|
387
152
|
}
|
|
388
153
|
const rawFilenames = await readdir(directory, "utf-8");
|
|
389
154
|
const filenames = new Set(
|
|
390
155
|
rawFilenames.filter((filename) => {
|
|
391
|
-
const ext =
|
|
156
|
+
const ext = extname(filename);
|
|
392
157
|
return ext === `.json` || ext === `.yaml` || ext === `.yml`;
|
|
393
158
|
})
|
|
394
159
|
);
|
|
@@ -408,7 +173,7 @@ async function createFileSyncEngineDataSource({
|
|
|
408
173
|
yield object;
|
|
409
174
|
} catch (e) {
|
|
410
175
|
console.error(red(`Failed to read ${fullFilename}, data is likely invalid.
|
|
411
|
-
${e
|
|
176
|
+
${e?.message}`));
|
|
412
177
|
throw e;
|
|
413
178
|
}
|
|
414
179
|
}
|
|
@@ -474,7 +239,6 @@ async function syncEngine({
|
|
|
474
239
|
onBeforeCompareObjects,
|
|
475
240
|
onBeforeWriteObject
|
|
476
241
|
}) {
|
|
477
|
-
var _a, _b;
|
|
478
242
|
const targetItems = /* @__PURE__ */ new Map();
|
|
479
243
|
const deleteTracker = /* @__PURE__ */ new Set();
|
|
480
244
|
const processDelete = async (object) => {
|
|
@@ -510,7 +274,7 @@ async function syncEngine({
|
|
|
510
274
|
sourceHasItems = true;
|
|
511
275
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
512
276
|
const targetObject = targetItems.get(ids[0]);
|
|
513
|
-
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) =>
|
|
277
|
+
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o?.object !== targetObject?.object);
|
|
514
278
|
if (targetObject && invalidTargetObjects.length == 0) {
|
|
515
279
|
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
516
280
|
if (!compareContents(sourceObject, targetObject)) {
|
|
@@ -558,8 +322,7 @@ async function syncEngine({
|
|
|
558
322
|
};
|
|
559
323
|
if (invalidTargetObjects.length > 0) {
|
|
560
324
|
[...invalidTargetObjects, targetObject].forEach((o) => {
|
|
561
|
-
|
|
562
|
-
(_a2 = Array.isArray(o == null ? void 0 : o.id) ? o == null ? void 0 : o.id : [o == null ? void 0 : o.id]) == null ? void 0 : _a2.forEach((i) => i && targetItems.delete(i));
|
|
325
|
+
(Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
|
|
563
326
|
});
|
|
564
327
|
const deletes = invalidTargetObjects.filter((io) => typeof io !== "undefined").map(async (io) => {
|
|
565
328
|
await processDelete(io);
|
|
@@ -586,7 +349,7 @@ async function syncEngine({
|
|
|
586
349
|
});
|
|
587
350
|
await Promise.all(deletes);
|
|
588
351
|
}
|
|
589
|
-
await Promise.all([
|
|
352
|
+
await Promise.all([source.onSyncComplete?.(false), target.onSyncComplete?.(true)]);
|
|
590
353
|
}
|
|
591
354
|
var SyncEngineError = class _SyncEngineError extends Error {
|
|
592
355
|
constructor(innerError, sourceObject) {
|
|
@@ -645,12 +408,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
645
408
|
var AssetGetModule = {
|
|
646
409
|
command: "get <id>",
|
|
647
410
|
describe: "Get an asset",
|
|
648
|
-
builder: (
|
|
411
|
+
builder: (yargs35) => withConfiguration(
|
|
649
412
|
withFormatOptions(
|
|
650
413
|
withApiOptions(
|
|
651
414
|
withProjectOptions(
|
|
652
415
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
653
|
-
|
|
416
|
+
yargs35.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
654
417
|
)
|
|
655
418
|
)
|
|
656
419
|
)
|
|
@@ -671,7 +434,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
|
|
|
671
434
|
var AssetListModule = {
|
|
672
435
|
command: "list",
|
|
673
436
|
describe: "List assets",
|
|
674
|
-
builder: (
|
|
437
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
675
438
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
676
439
|
const fetch3 = nodeFetchProxy(proxy);
|
|
677
440
|
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -691,7 +454,7 @@ import { createHash } from "crypto";
|
|
|
691
454
|
import fsj from "fs-jetpack";
|
|
692
455
|
import sizeOf from "image-size";
|
|
693
456
|
import PQueue from "p-queue";
|
|
694
|
-
import { dirname
|
|
457
|
+
import { dirname, join as join2 } from "path";
|
|
695
458
|
var FILES_DIRECTORY_NAME = "files";
|
|
696
459
|
var escapeRegExp = (string) => {
|
|
697
460
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -735,7 +498,7 @@ var urlToFileName = (url, hash) => {
|
|
|
735
498
|
};
|
|
736
499
|
var getFilesDirectory = (directory) => {
|
|
737
500
|
const isPackage = isPathAPackageFile(directory);
|
|
738
|
-
return isPackage ?
|
|
501
|
+
return isPackage ? dirname(directory) : (
|
|
739
502
|
// If we are syncing to a directory, we want to write all files into a
|
|
740
503
|
// top-lvl folder. That way any entities that contain files will sync to the
|
|
741
504
|
// same directory, so there is no duplication
|
|
@@ -809,7 +572,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
809
572
|
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
810
573
|
const writeDirectory = getFilesDirectory(options.directory);
|
|
811
574
|
const isPackage = isPathAPackageFile(options.directory);
|
|
812
|
-
const legacyWriteDirectory = isPackage ?
|
|
575
|
+
const legacyWriteDirectory = isPackage ? dirname(options.directory) : options.directory;
|
|
813
576
|
if (uniformFileUrlMatches) {
|
|
814
577
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
815
578
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -886,7 +649,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
886
649
|
}
|
|
887
650
|
const file2 = await options.fileClient.get({ id });
|
|
888
651
|
if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
|
|
889
|
-
await new Promise((
|
|
652
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
890
653
|
return checkForFile();
|
|
891
654
|
}
|
|
892
655
|
return file2.url;
|
|
@@ -975,11 +738,10 @@ var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, op
|
|
|
975
738
|
return JSON.parse(sourceObjectAsString);
|
|
976
739
|
};
|
|
977
740
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
978
|
-
var _a;
|
|
979
741
|
if (!asset.asset.fields) {
|
|
980
742
|
return asset;
|
|
981
743
|
}
|
|
982
|
-
const fileUrl =
|
|
744
|
+
const fileUrl = asset.asset.fields.url?.value;
|
|
983
745
|
if (!fileUrl) {
|
|
984
746
|
return asset;
|
|
985
747
|
}
|
|
@@ -1009,10 +771,7 @@ import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
|
1009
771
|
|
|
1010
772
|
// src/commands/canvas/commands/asset/_util.ts
|
|
1011
773
|
var selectAssetIdentifier = (e) => e.asset._id;
|
|
1012
|
-
var selectAssetDisplayName = (e) => {
|
|
1013
|
-
var _a, _b;
|
|
1014
|
-
return `${((_b = (_a = e.asset.fields) == null ? void 0 : _a.title) == null ? void 0 : _b.value) ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
1015
|
-
};
|
|
774
|
+
var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
1016
775
|
|
|
1017
776
|
// src/commands/canvas/util.ts
|
|
1018
777
|
import {
|
|
@@ -1027,8 +786,8 @@ function prepCompositionForDisk(composition) {
|
|
|
1027
786
|
delete prepped.state;
|
|
1028
787
|
return prepped;
|
|
1029
788
|
}
|
|
1030
|
-
function withStateOptions(
|
|
1031
|
-
return
|
|
789
|
+
function withStateOptions(yargs35, defaultState = "preview") {
|
|
790
|
+
return yargs35.option("state", {
|
|
1032
791
|
type: "string",
|
|
1033
792
|
describe: `State to fetch.`,
|
|
1034
793
|
choices: ["preview", "published"],
|
|
@@ -1095,11 +854,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
1095
854
|
var AssetPullModule = {
|
|
1096
855
|
command: "pull <directory>",
|
|
1097
856
|
describe: "Pulls all assets to local files in a directory",
|
|
1098
|
-
builder: (
|
|
857
|
+
builder: (yargs35) => withConfiguration(
|
|
1099
858
|
withApiOptions(
|
|
1100
859
|
withProjectOptions(
|
|
1101
860
|
withDiffOptions(
|
|
1102
|
-
|
|
861
|
+
yargs35.positional("directory", {
|
|
1103
862
|
describe: "Directory to save the assets to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
1104
863
|
type: "string"
|
|
1105
864
|
}).option("format", {
|
|
@@ -1148,9 +907,8 @@ var AssetPullModule = {
|
|
|
1148
907
|
let target;
|
|
1149
908
|
const isPackage = isPathAPackageFile(directory);
|
|
1150
909
|
const onBeforeDeleteObject = async (id, object) => {
|
|
1151
|
-
var _a, _b;
|
|
1152
910
|
const asset = object.object;
|
|
1153
|
-
if (!
|
|
911
|
+
if (!asset.asset.fields?.url?.value) {
|
|
1154
912
|
return;
|
|
1155
913
|
}
|
|
1156
914
|
await deleteDownloadedFileByUrl(asset.asset.fields.url.value, {
|
|
@@ -1187,7 +945,6 @@ var AssetPullModule = {
|
|
|
1187
945
|
allowEmptySource: allowEmptySource ?? true,
|
|
1188
946
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1189
947
|
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1190
|
-
var _a, _b;
|
|
1191
948
|
delete sourceObject.object.asset._author;
|
|
1192
949
|
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
1193
950
|
sourceObject,
|
|
@@ -1197,7 +954,7 @@ var AssetPullModule = {
|
|
|
1197
954
|
fileClient
|
|
1198
955
|
}
|
|
1199
956
|
);
|
|
1200
|
-
if (
|
|
957
|
+
if (sourceObjectWithPotentiallySwappedUrl.object.asset.fields?.url && targetObject.object.asset.fields?.url && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
|
|
1201
958
|
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1202
959
|
}
|
|
1203
960
|
return sourceObjectWithPotentiallySwappedUrl;
|
|
@@ -1219,11 +976,11 @@ import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
|
1219
976
|
var AssetPushModule = {
|
|
1220
977
|
command: "push <directory>",
|
|
1221
978
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1222
|
-
builder: (
|
|
979
|
+
builder: (yargs35) => withConfiguration(
|
|
1223
980
|
withApiOptions(
|
|
1224
981
|
withProjectOptions(
|
|
1225
982
|
withDiffOptions(
|
|
1226
|
-
|
|
983
|
+
yargs35.positional("directory", {
|
|
1227
984
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1228
985
|
type: "string"
|
|
1229
986
|
}).option("what-if", {
|
|
@@ -1324,9 +1081,9 @@ var AssetRemoveModule = {
|
|
|
1324
1081
|
command: "remove <id>",
|
|
1325
1082
|
aliases: ["delete", "rm"],
|
|
1326
1083
|
describe: "Delete an asset",
|
|
1327
|
-
builder: (
|
|
1084
|
+
builder: (yargs35) => withConfiguration(
|
|
1328
1085
|
withApiOptions(
|
|
1329
|
-
withProjectOptions(
|
|
1086
|
+
withProjectOptions(yargs35.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1330
1087
|
)
|
|
1331
1088
|
),
|
|
1332
1089
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1342,10 +1099,10 @@ var AssetUpdateModule = {
|
|
|
1342
1099
|
command: "update <filename>",
|
|
1343
1100
|
aliases: ["put"],
|
|
1344
1101
|
describe: "Insert or update an asset",
|
|
1345
|
-
builder: (
|
|
1102
|
+
builder: (yargs35) => withConfiguration(
|
|
1346
1103
|
withApiOptions(
|
|
1347
1104
|
withProjectOptions(
|
|
1348
|
-
|
|
1105
|
+
yargs35.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1349
1106
|
)
|
|
1350
1107
|
)
|
|
1351
1108
|
),
|
|
@@ -1361,7 +1118,7 @@ var AssetUpdateModule = {
|
|
|
1361
1118
|
var AssetModule = {
|
|
1362
1119
|
command: "asset <command>",
|
|
1363
1120
|
describe: "Commands for Assets",
|
|
1364
|
-
builder: (
|
|
1121
|
+
builder: (yargs35) => yargs35.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1365
1122
|
handler: () => {
|
|
1366
1123
|
yargs.help();
|
|
1367
1124
|
}
|
|
@@ -1375,11 +1132,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1375
1132
|
var CategoryGetModule = {
|
|
1376
1133
|
command: "get <id>",
|
|
1377
1134
|
describe: "Fetch a category",
|
|
1378
|
-
builder: (
|
|
1135
|
+
builder: (yargs35) => withConfiguration(
|
|
1379
1136
|
withFormatOptions(
|
|
1380
1137
|
withApiOptions(
|
|
1381
1138
|
withProjectOptions(
|
|
1382
|
-
|
|
1139
|
+
yargs35.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1383
1140
|
)
|
|
1384
1141
|
)
|
|
1385
1142
|
)
|
|
@@ -1404,7 +1161,7 @@ var CategoryListModule = {
|
|
|
1404
1161
|
command: "list",
|
|
1405
1162
|
describe: "List categories",
|
|
1406
1163
|
aliases: ["ls"],
|
|
1407
|
-
builder: (
|
|
1164
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35.options({}))))),
|
|
1408
1165
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1409
1166
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1410
1167
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1454,11 +1211,11 @@ function createCategoriesEngineDataSource({
|
|
|
1454
1211
|
var CategoryPullModule = {
|
|
1455
1212
|
command: "pull <directory>",
|
|
1456
1213
|
describe: "Pulls all categories to local files in a directory",
|
|
1457
|
-
builder: (
|
|
1214
|
+
builder: (yargs35) => withConfiguration(
|
|
1458
1215
|
withApiOptions(
|
|
1459
1216
|
withProjectOptions(
|
|
1460
1217
|
withDiffOptions(
|
|
1461
|
-
|
|
1218
|
+
yargs35.positional("directory", {
|
|
1462
1219
|
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.",
|
|
1463
1220
|
type: "string"
|
|
1464
1221
|
}).option("format", {
|
|
@@ -1536,11 +1293,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1536
1293
|
var CategoryPushModule = {
|
|
1537
1294
|
command: "push <directory>",
|
|
1538
1295
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1539
|
-
builder: (
|
|
1296
|
+
builder: (yargs35) => withConfiguration(
|
|
1540
1297
|
withApiOptions(
|
|
1541
1298
|
withProjectOptions(
|
|
1542
1299
|
withDiffOptions(
|
|
1543
|
-
|
|
1300
|
+
yargs35.positional("directory", {
|
|
1544
1301
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1545
1302
|
type: "string"
|
|
1546
1303
|
}).option("what-if", {
|
|
@@ -1607,10 +1364,10 @@ var CategoryRemoveModule = {
|
|
|
1607
1364
|
command: "remove <id>",
|
|
1608
1365
|
aliases: ["delete", "rm"],
|
|
1609
1366
|
describe: "Delete a category",
|
|
1610
|
-
builder: (
|
|
1367
|
+
builder: (yargs35) => withConfiguration(
|
|
1611
1368
|
withApiOptions(
|
|
1612
1369
|
withProjectOptions(
|
|
1613
|
-
|
|
1370
|
+
yargs35.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1614
1371
|
)
|
|
1615
1372
|
)
|
|
1616
1373
|
),
|
|
@@ -1627,10 +1384,10 @@ var CategoryUpdateModule = {
|
|
|
1627
1384
|
command: "update <filename>",
|
|
1628
1385
|
aliases: ["put"],
|
|
1629
1386
|
describe: "Insert or update a category",
|
|
1630
|
-
builder: (
|
|
1387
|
+
builder: (yargs35) => withConfiguration(
|
|
1631
1388
|
withApiOptions(
|
|
1632
1389
|
withProjectOptions(
|
|
1633
|
-
|
|
1390
|
+
yargs35.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1634
1391
|
)
|
|
1635
1392
|
)
|
|
1636
1393
|
),
|
|
@@ -1647,7 +1404,7 @@ var CategoryModule = {
|
|
|
1647
1404
|
command: "category <command>",
|
|
1648
1405
|
aliases: ["cat"],
|
|
1649
1406
|
describe: "Commands for Canvas categories",
|
|
1650
|
-
builder: (
|
|
1407
|
+
builder: (yargs35) => yargs35.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1651
1408
|
handler: () => {
|
|
1652
1409
|
yargs2.help();
|
|
1653
1410
|
}
|
|
@@ -1668,11 +1425,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1668
1425
|
var ComponentGetModule = {
|
|
1669
1426
|
command: "get <id>",
|
|
1670
1427
|
describe: "Fetch a component definition",
|
|
1671
|
-
builder: (
|
|
1428
|
+
builder: (yargs35) => withConfiguration(
|
|
1672
1429
|
withFormatOptions(
|
|
1673
1430
|
withApiOptions(
|
|
1674
1431
|
withProjectOptions(
|
|
1675
|
-
|
|
1432
|
+
yargs35.positional("id", {
|
|
1676
1433
|
demandOption: true,
|
|
1677
1434
|
describe: "Component definition public ID to fetch"
|
|
1678
1435
|
})
|
|
@@ -1706,11 +1463,11 @@ var ComponentListModule = {
|
|
|
1706
1463
|
command: "list",
|
|
1707
1464
|
describe: "List component definitions",
|
|
1708
1465
|
aliases: ["ls"],
|
|
1709
|
-
builder: (
|
|
1466
|
+
builder: (yargs35) => withConfiguration(
|
|
1710
1467
|
withFormatOptions(
|
|
1711
1468
|
withApiOptions(
|
|
1712
1469
|
withProjectOptions(
|
|
1713
|
-
|
|
1470
|
+
yargs35.options({
|
|
1714
1471
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1715
1472
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1716
1473
|
})
|
|
@@ -1766,11 +1523,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1766
1523
|
var ComponentPullModule = {
|
|
1767
1524
|
command: "pull <directory>",
|
|
1768
1525
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1769
|
-
builder: (
|
|
1526
|
+
builder: (yargs35) => withConfiguration(
|
|
1770
1527
|
withApiOptions(
|
|
1771
1528
|
withProjectOptions(
|
|
1772
1529
|
withDiffOptions(
|
|
1773
|
-
|
|
1530
|
+
yargs35.positional("directory", {
|
|
1774
1531
|
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.",
|
|
1775
1532
|
type: "string"
|
|
1776
1533
|
}).option("format", {
|
|
@@ -1849,11 +1606,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1849
1606
|
var ComponentPushModule = {
|
|
1850
1607
|
command: "push <directory>",
|
|
1851
1608
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1852
|
-
builder: (
|
|
1609
|
+
builder: (yargs35) => withConfiguration(
|
|
1853
1610
|
withApiOptions(
|
|
1854
1611
|
withProjectOptions(
|
|
1855
1612
|
withDiffOptions(
|
|
1856
|
-
|
|
1613
|
+
yargs35.positional("directory", {
|
|
1857
1614
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1858
1615
|
type: "string"
|
|
1859
1616
|
}).option("what-if", {
|
|
@@ -1921,10 +1678,10 @@ var ComponentRemoveModule = {
|
|
|
1921
1678
|
command: "remove <id>",
|
|
1922
1679
|
aliases: ["delete", "rm"],
|
|
1923
1680
|
describe: "Delete a component definition",
|
|
1924
|
-
builder: (
|
|
1681
|
+
builder: (yargs35) => withConfiguration(
|
|
1925
1682
|
withApiOptions(
|
|
1926
1683
|
withProjectOptions(
|
|
1927
|
-
|
|
1684
|
+
yargs35.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1928
1685
|
)
|
|
1929
1686
|
)
|
|
1930
1687
|
),
|
|
@@ -1941,10 +1698,10 @@ var ComponentUpdateModule = {
|
|
|
1941
1698
|
command: "update <filename>",
|
|
1942
1699
|
aliases: ["put"],
|
|
1943
1700
|
describe: "Insert or update a component definition",
|
|
1944
|
-
builder: (
|
|
1701
|
+
builder: (yargs35) => withConfiguration(
|
|
1945
1702
|
withApiOptions(
|
|
1946
1703
|
withProjectOptions(
|
|
1947
|
-
|
|
1704
|
+
yargs35.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1948
1705
|
)
|
|
1949
1706
|
)
|
|
1950
1707
|
),
|
|
@@ -1961,7 +1718,7 @@ var ComponentModule = {
|
|
|
1961
1718
|
command: "component <command>",
|
|
1962
1719
|
aliases: ["def"],
|
|
1963
1720
|
describe: "Commands for Canvas component definitions",
|
|
1964
|
-
builder: (
|
|
1721
|
+
builder: (yargs35) => yargs35.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1965
1722
|
handler: () => {
|
|
1966
1723
|
yargs3.help();
|
|
1967
1724
|
}
|
|
@@ -1975,12 +1732,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1975
1732
|
var CompositionGetModule = {
|
|
1976
1733
|
command: "get <id>",
|
|
1977
1734
|
describe: "Fetch a composition",
|
|
1978
|
-
builder: (
|
|
1735
|
+
builder: (yargs35) => withFormatOptions(
|
|
1979
1736
|
withConfiguration(
|
|
1980
1737
|
withApiOptions(
|
|
1981
1738
|
withProjectOptions(
|
|
1982
1739
|
withStateOptions(
|
|
1983
|
-
|
|
1740
|
+
yargs35.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1984
1741
|
resolvePatterns: {
|
|
1985
1742
|
type: "boolean",
|
|
1986
1743
|
default: false,
|
|
@@ -2057,12 +1814,12 @@ var CompositionListModule = {
|
|
|
2057
1814
|
command: "list",
|
|
2058
1815
|
describe: "List compositions",
|
|
2059
1816
|
aliases: ["ls"],
|
|
2060
|
-
builder: (
|
|
1817
|
+
builder: (yargs35) => withFormatOptions(
|
|
2061
1818
|
withConfiguration(
|
|
2062
1819
|
withApiOptions(
|
|
2063
1820
|
withProjectOptions(
|
|
2064
1821
|
withStateOptions(
|
|
2065
|
-
|
|
1822
|
+
yargs35.options({
|
|
2066
1823
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2067
1824
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2068
1825
|
search: { describe: "Search query", type: "string", default: "" },
|
|
@@ -2109,6 +1866,7 @@ var CompositionListModule = {
|
|
|
2109
1866
|
filename,
|
|
2110
1867
|
onlyCompositions,
|
|
2111
1868
|
onlyPatterns,
|
|
1869
|
+
patternType,
|
|
2112
1870
|
project: projectId,
|
|
2113
1871
|
state,
|
|
2114
1872
|
resolvePatterns,
|
|
@@ -2122,6 +1880,7 @@ var CompositionListModule = {
|
|
|
2122
1880
|
offset,
|
|
2123
1881
|
search: search.length > 0 ? search : void 0,
|
|
2124
1882
|
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
1883
|
+
patternType,
|
|
2125
1884
|
state: convertStateOption(state),
|
|
2126
1885
|
skipPatternResolution: !resolvePatterns,
|
|
2127
1886
|
withComponentIDs: componentIDs,
|
|
@@ -2135,12 +1894,12 @@ var CompositionListModule = {
|
|
|
2135
1894
|
var ComponentPatternListModule = {
|
|
2136
1895
|
...CompositionListModule,
|
|
2137
1896
|
describe: "List component patterns",
|
|
2138
|
-
builder: (
|
|
1897
|
+
builder: (yargs35) => withFormatOptions(
|
|
2139
1898
|
withConfiguration(
|
|
2140
1899
|
withApiOptions(
|
|
2141
1900
|
withProjectOptions(
|
|
2142
1901
|
withStateOptions(
|
|
2143
|
-
|
|
1902
|
+
yargs35.options({
|
|
2144
1903
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2145
1904
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2146
1905
|
resolvePatterns: {
|
|
@@ -2160,6 +1919,11 @@ var ComponentPatternListModule = {
|
|
|
2160
1919
|
type: "boolean",
|
|
2161
1920
|
hidden: true
|
|
2162
1921
|
},
|
|
1922
|
+
patternType: {
|
|
1923
|
+
default: "component",
|
|
1924
|
+
choices: ["all", "component", "composition"],
|
|
1925
|
+
hidden: true
|
|
1926
|
+
},
|
|
2163
1927
|
componentIDs: {
|
|
2164
1928
|
alias: ["componentIDs"],
|
|
2165
1929
|
type: "boolean",
|
|
@@ -2187,6 +1951,7 @@ function createComponentInstanceEngineDataSource({
|
|
|
2187
1951
|
state,
|
|
2188
1952
|
onlyCompositions,
|
|
2189
1953
|
onlyPatterns,
|
|
1954
|
+
patternType,
|
|
2190
1955
|
...clientOptions
|
|
2191
1956
|
}) {
|
|
2192
1957
|
const stateId = convertStateOption(state);
|
|
@@ -2200,7 +1965,8 @@ function createComponentInstanceEngineDataSource({
|
|
|
2200
1965
|
state: stateId,
|
|
2201
1966
|
skipPatternResolution: true,
|
|
2202
1967
|
skipOverridesResolution: true,
|
|
2203
|
-
withComponentIDs: true
|
|
1968
|
+
withComponentIDs: true,
|
|
1969
|
+
patternType
|
|
2204
1970
|
})).compositions,
|
|
2205
1971
|
{ pageSize: 100 }
|
|
2206
1972
|
);
|
|
@@ -2230,11 +1996,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2230
1996
|
var CompositionPublishModule = {
|
|
2231
1997
|
command: "publish [ids]",
|
|
2232
1998
|
describe: "Publishes composition(s)",
|
|
2233
|
-
builder: (
|
|
1999
|
+
builder: (yargs35) => withConfiguration(
|
|
2234
2000
|
withApiOptions(
|
|
2235
2001
|
withProjectOptions(
|
|
2236
2002
|
withDiffOptions(
|
|
2237
|
-
|
|
2003
|
+
yargs35.positional("ids", {
|
|
2238
2004
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2239
2005
|
type: "string"
|
|
2240
2006
|
}).option("all", {
|
|
@@ -2270,7 +2036,8 @@ var CompositionPublishModule = {
|
|
|
2270
2036
|
whatIf,
|
|
2271
2037
|
project: projectId,
|
|
2272
2038
|
onlyCompositions,
|
|
2273
|
-
onlyPatterns
|
|
2039
|
+
onlyPatterns,
|
|
2040
|
+
patternType
|
|
2274
2041
|
}) => {
|
|
2275
2042
|
if (!all && !ids || all && ids) {
|
|
2276
2043
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
@@ -2284,14 +2051,16 @@ var CompositionPublishModule = {
|
|
|
2284
2051
|
state: "preview",
|
|
2285
2052
|
compositionIDs: compositionIDsArray,
|
|
2286
2053
|
onlyCompositions,
|
|
2287
|
-
onlyPatterns
|
|
2054
|
+
onlyPatterns,
|
|
2055
|
+
patternType
|
|
2288
2056
|
});
|
|
2289
2057
|
const target = createComponentInstanceEngineDataSource({
|
|
2290
2058
|
client,
|
|
2291
2059
|
state: "published",
|
|
2292
2060
|
compositionIDs: compositionIDsArray,
|
|
2293
2061
|
onlyCompositions,
|
|
2294
|
-
onlyPatterns
|
|
2062
|
+
onlyPatterns,
|
|
2063
|
+
patternType
|
|
2295
2064
|
});
|
|
2296
2065
|
await syncEngine({
|
|
2297
2066
|
source,
|
|
@@ -2308,11 +2077,11 @@ var CompositionPublishModule = {
|
|
|
2308
2077
|
var ComponentPatternPublishModule = {
|
|
2309
2078
|
...CompositionPublishModule,
|
|
2310
2079
|
describe: "Publishes component pattern(s)",
|
|
2311
|
-
builder: (
|
|
2080
|
+
builder: (yargs35) => withConfiguration(
|
|
2312
2081
|
withApiOptions(
|
|
2313
2082
|
withProjectOptions(
|
|
2314
2083
|
withDiffOptions(
|
|
2315
|
-
|
|
2084
|
+
yargs35.positional("ids", {
|
|
2316
2085
|
describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2317
2086
|
type: "string"
|
|
2318
2087
|
}).option("all", {
|
|
@@ -2339,6 +2108,10 @@ var ComponentPatternPublishModule = {
|
|
|
2339
2108
|
default: true,
|
|
2340
2109
|
type: "boolean",
|
|
2341
2110
|
hidden: true
|
|
2111
|
+
}).option("patternType", {
|
|
2112
|
+
default: "component",
|
|
2113
|
+
choices: ["all", "component", "composition"],
|
|
2114
|
+
hidden: true
|
|
2342
2115
|
})
|
|
2343
2116
|
)
|
|
2344
2117
|
)
|
|
@@ -2352,12 +2125,12 @@ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
|
2352
2125
|
var CompositionPullModule = {
|
|
2353
2126
|
command: "pull <directory>",
|
|
2354
2127
|
describe: "Pulls all compositions to local files in a directory",
|
|
2355
|
-
builder: (
|
|
2128
|
+
builder: (yargs35) => withConfiguration(
|
|
2356
2129
|
withApiOptions(
|
|
2357
2130
|
withProjectOptions(
|
|
2358
2131
|
withStateOptions(
|
|
2359
2132
|
withDiffOptions(
|
|
2360
|
-
|
|
2133
|
+
yargs35.positional("directory", {
|
|
2361
2134
|
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.",
|
|
2362
2135
|
type: "string"
|
|
2363
2136
|
}).option("format", {
|
|
@@ -2400,6 +2173,7 @@ var CompositionPullModule = {
|
|
|
2400
2173
|
format,
|
|
2401
2174
|
onlyCompositions,
|
|
2402
2175
|
onlyPatterns,
|
|
2176
|
+
patternType = "all",
|
|
2403
2177
|
mode,
|
|
2404
2178
|
whatIf,
|
|
2405
2179
|
state,
|
|
@@ -2410,14 +2184,20 @@ var CompositionPullModule = {
|
|
|
2410
2184
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2411
2185
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2412
2186
|
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2413
|
-
const source = createComponentInstanceEngineDataSource({
|
|
2187
|
+
const source = createComponentInstanceEngineDataSource({
|
|
2188
|
+
client,
|
|
2189
|
+
state,
|
|
2190
|
+
onlyCompositions,
|
|
2191
|
+
onlyPatterns,
|
|
2192
|
+
patternType
|
|
2193
|
+
});
|
|
2414
2194
|
const isPackage = isPathAPackageFile(directory);
|
|
2415
2195
|
let target;
|
|
2416
2196
|
if (isPackage) {
|
|
2417
2197
|
const packageContents = readCanvasPackage(directory, false);
|
|
2418
2198
|
target = await createArraySyncEngineDataSource({
|
|
2419
2199
|
name: `Package file ${directory}`,
|
|
2420
|
-
objects:
|
|
2200
|
+
objects: packageContents?.compositions ?? [],
|
|
2421
2201
|
selectIdentifier: selectIdentifier3,
|
|
2422
2202
|
selectDisplayName: selectDisplayName3,
|
|
2423
2203
|
onSyncComplete: async (_, synced) => {
|
|
@@ -2460,12 +2240,12 @@ var CompositionPullModule = {
|
|
|
2460
2240
|
var ComponentPatternPullModule = {
|
|
2461
2241
|
...CompositionPullModule,
|
|
2462
2242
|
describe: "Pulls all component patterns to local files in a directory",
|
|
2463
|
-
builder: (
|
|
2243
|
+
builder: (yargs35) => withConfiguration(
|
|
2464
2244
|
withApiOptions(
|
|
2465
2245
|
withProjectOptions(
|
|
2466
2246
|
withStateOptions(
|
|
2467
2247
|
withDiffOptions(
|
|
2468
|
-
|
|
2248
|
+
yargs35.positional("directory", {
|
|
2469
2249
|
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.",
|
|
2470
2250
|
type: "string"
|
|
2471
2251
|
}).option("format", {
|
|
@@ -2480,6 +2260,10 @@ var ComponentPatternPullModule = {
|
|
|
2480
2260
|
default: true,
|
|
2481
2261
|
type: "boolean",
|
|
2482
2262
|
hidden: true
|
|
2263
|
+
}).option("patternType", {
|
|
2264
|
+
default: "component",
|
|
2265
|
+
choices: ["all", "component", "composition"],
|
|
2266
|
+
hidden: true
|
|
2483
2267
|
}).option("what-if", {
|
|
2484
2268
|
alias: ["w"],
|
|
2485
2269
|
describe: "What-if mode reports what would be done but changes no files",
|
|
@@ -2505,12 +2289,12 @@ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
|
2505
2289
|
var CompositionPushModule = {
|
|
2506
2290
|
command: "push <directory>",
|
|
2507
2291
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2508
|
-
builder: (
|
|
2292
|
+
builder: (yargs35) => withConfiguration(
|
|
2509
2293
|
withApiOptions(
|
|
2510
2294
|
withProjectOptions(
|
|
2511
2295
|
withStateOptions(
|
|
2512
2296
|
withDiffOptions(
|
|
2513
|
-
|
|
2297
|
+
yargs35.positional("directory", {
|
|
2514
2298
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2515
2299
|
type: "string"
|
|
2516
2300
|
}).option("what-if", {
|
|
@@ -2550,6 +2334,7 @@ var CompositionPushModule = {
|
|
|
2550
2334
|
project: projectId,
|
|
2551
2335
|
onlyCompositions,
|
|
2552
2336
|
onlyPatterns,
|
|
2337
|
+
patternType,
|
|
2553
2338
|
diff: diffMode,
|
|
2554
2339
|
allowEmptySource
|
|
2555
2340
|
}) => {
|
|
@@ -2572,7 +2357,13 @@ var CompositionPushModule = {
|
|
|
2572
2357
|
selectDisplayName: selectDisplayName3
|
|
2573
2358
|
});
|
|
2574
2359
|
}
|
|
2575
|
-
const target = createComponentInstanceEngineDataSource({
|
|
2360
|
+
const target = createComponentInstanceEngineDataSource({
|
|
2361
|
+
client,
|
|
2362
|
+
state,
|
|
2363
|
+
onlyCompositions,
|
|
2364
|
+
onlyPatterns,
|
|
2365
|
+
patternType
|
|
2366
|
+
});
|
|
2576
2367
|
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2577
2368
|
await syncEngine({
|
|
2578
2369
|
source,
|
|
@@ -2600,12 +2391,12 @@ var CompositionPushModule = {
|
|
|
2600
2391
|
var ComponentPatternPushModule = {
|
|
2601
2392
|
...CompositionPushModule,
|
|
2602
2393
|
describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
|
|
2603
|
-
builder: (
|
|
2394
|
+
builder: (yargs35) => withConfiguration(
|
|
2604
2395
|
withApiOptions(
|
|
2605
2396
|
withProjectOptions(
|
|
2606
2397
|
withStateOptions(
|
|
2607
2398
|
withDiffOptions(
|
|
2608
|
-
|
|
2399
|
+
yargs35.positional("directory", {
|
|
2609
2400
|
describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
|
|
2610
2401
|
type: "string"
|
|
2611
2402
|
}).option("what-if", {
|
|
@@ -2625,6 +2416,10 @@ var ComponentPatternPushModule = {
|
|
|
2625
2416
|
default: true,
|
|
2626
2417
|
type: "boolean",
|
|
2627
2418
|
hidden: true
|
|
2419
|
+
}).option("patternType", {
|
|
2420
|
+
default: "component",
|
|
2421
|
+
choices: ["all", "component", "composition"],
|
|
2422
|
+
hidden: true
|
|
2628
2423
|
})
|
|
2629
2424
|
)
|
|
2630
2425
|
)
|
|
@@ -2639,10 +2434,10 @@ var CompositionRemoveModule = {
|
|
|
2639
2434
|
command: "remove <id>",
|
|
2640
2435
|
aliases: ["delete", "rm"],
|
|
2641
2436
|
describe: "Delete a composition",
|
|
2642
|
-
builder: (
|
|
2437
|
+
builder: (yargs35) => withConfiguration(
|
|
2643
2438
|
withApiOptions(
|
|
2644
2439
|
withProjectOptions(
|
|
2645
|
-
|
|
2440
|
+
yargs35.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2646
2441
|
)
|
|
2647
2442
|
)
|
|
2648
2443
|
),
|
|
@@ -2660,15 +2455,18 @@ var ComponentPatternRemoveModule = {
|
|
|
2660
2455
|
};
|
|
2661
2456
|
|
|
2662
2457
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
2663
|
-
import {
|
|
2458
|
+
import {
|
|
2459
|
+
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2,
|
|
2460
|
+
UncachedCanvasClient as UncachedCanvasClient13
|
|
2461
|
+
} from "@uniformdev/canvas";
|
|
2664
2462
|
import { diffJson as diffJson2 } from "diff";
|
|
2665
2463
|
var CompositionUnpublishModule = {
|
|
2666
2464
|
command: "unpublish [ids]",
|
|
2667
2465
|
describe: "Unpublish a composition(s)",
|
|
2668
|
-
builder: (
|
|
2466
|
+
builder: (yargs35) => withConfiguration(
|
|
2669
2467
|
withApiOptions(
|
|
2670
2468
|
withProjectOptions(
|
|
2671
|
-
|
|
2469
|
+
yargs35.positional("ids", {
|
|
2672
2470
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2673
2471
|
type: "string"
|
|
2674
2472
|
}).option("all", {
|
|
@@ -2702,6 +2500,7 @@ var CompositionUnpublishModule = {
|
|
|
2702
2500
|
all,
|
|
2703
2501
|
onlyCompositions,
|
|
2704
2502
|
onlyPatterns,
|
|
2503
|
+
patternType,
|
|
2705
2504
|
project: projectId,
|
|
2706
2505
|
whatIf
|
|
2707
2506
|
}) => {
|
|
@@ -2718,14 +2517,16 @@ var CompositionUnpublishModule = {
|
|
|
2718
2517
|
state: "published",
|
|
2719
2518
|
compositionIDs: compositionIDsArray,
|
|
2720
2519
|
onlyCompositions,
|
|
2721
|
-
onlyPatterns
|
|
2520
|
+
onlyPatterns,
|
|
2521
|
+
patternType
|
|
2722
2522
|
});
|
|
2723
2523
|
const target = createComponentInstanceEngineDataSource({
|
|
2724
2524
|
client,
|
|
2725
2525
|
state: "preview",
|
|
2726
2526
|
compositionIDs: compositionIDsArray,
|
|
2727
2527
|
onlyCompositions,
|
|
2728
|
-
onlyPatterns
|
|
2528
|
+
onlyPatterns,
|
|
2529
|
+
patternType
|
|
2729
2530
|
});
|
|
2730
2531
|
const actions = [];
|
|
2731
2532
|
const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
@@ -2760,15 +2561,15 @@ var CompositionUnpublishModule = {
|
|
|
2760
2561
|
var ComponentPatternUnpublishModule = {
|
|
2761
2562
|
command: "unpublish [ids]",
|
|
2762
2563
|
describe: "Unpublish a component pattern(s)",
|
|
2763
|
-
builder: (
|
|
2564
|
+
builder: (yargs35) => withConfiguration(
|
|
2764
2565
|
withApiOptions(
|
|
2765
2566
|
withProjectOptions(
|
|
2766
|
-
|
|
2567
|
+
yargs35.positional("ids", {
|
|
2767
2568
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2768
2569
|
type: "string"
|
|
2769
2570
|
}).option("all", {
|
|
2770
2571
|
alias: ["a"],
|
|
2771
|
-
describe: "Un-
|
|
2572
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
2772
2573
|
default: false,
|
|
2773
2574
|
type: "boolean"
|
|
2774
2575
|
}).option("what-if", {
|
|
@@ -2777,14 +2578,18 @@ var ComponentPatternUnpublishModule = {
|
|
|
2777
2578
|
default: false,
|
|
2778
2579
|
type: "boolean"
|
|
2779
2580
|
}).option("onlyCompositions", {
|
|
2780
|
-
describe: "Only publishing compositions and not component patterns",
|
|
2581
|
+
describe: "Only un-publishing compositions and not component patterns",
|
|
2781
2582
|
default: false,
|
|
2782
2583
|
type: "boolean"
|
|
2783
2584
|
}).option("onlyPatterns", {
|
|
2784
|
-
describe: "Only
|
|
2585
|
+
describe: "Only un-publishing component patterns and not compositions",
|
|
2785
2586
|
default: true,
|
|
2786
2587
|
type: "boolean",
|
|
2787
2588
|
hidden: true
|
|
2589
|
+
}).option("patternType", {
|
|
2590
|
+
default: "component",
|
|
2591
|
+
choices: ["all", "component", "composition"],
|
|
2592
|
+
hidden: true
|
|
2788
2593
|
})
|
|
2789
2594
|
)
|
|
2790
2595
|
)
|
|
@@ -2798,11 +2603,11 @@ var CompositionUpdateModule = {
|
|
|
2798
2603
|
command: "update <filename>",
|
|
2799
2604
|
aliases: ["put"],
|
|
2800
2605
|
describe: "Insert or update a composition",
|
|
2801
|
-
builder: (
|
|
2606
|
+
builder: (yargs35) => withConfiguration(
|
|
2802
2607
|
withApiOptions(
|
|
2803
2608
|
withProjectOptions(
|
|
2804
2609
|
withStateOptions(
|
|
2805
|
-
|
|
2610
|
+
yargs35.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2806
2611
|
)
|
|
2807
2612
|
)
|
|
2808
2613
|
)
|
|
@@ -2824,9 +2629,8 @@ var ComponentPatternUpdateModule = {
|
|
|
2824
2629
|
// src/commands/canvas/commands/componentPattern.ts
|
|
2825
2630
|
var ComponentPatternModule = {
|
|
2826
2631
|
command: "component-pattern <command>",
|
|
2827
|
-
aliases: ["pattern"],
|
|
2828
2632
|
describe: "Commands for Canvas component patterns",
|
|
2829
|
-
builder: (
|
|
2633
|
+
builder: (yargs35) => yargs35.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
|
|
2830
2634
|
handler: () => {
|
|
2831
2635
|
yargs4.help();
|
|
2832
2636
|
}
|
|
@@ -2838,26 +2642,277 @@ var CompositionModule = {
|
|
|
2838
2642
|
command: "composition <command>",
|
|
2839
2643
|
describe: "Commands for Canvas compositions",
|
|
2840
2644
|
aliases: ["comp"],
|
|
2841
|
-
builder: (
|
|
2645
|
+
builder: (yargs35) => yargs35.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2842
2646
|
handler: () => {
|
|
2843
2647
|
yargs5.help();
|
|
2844
2648
|
}
|
|
2845
2649
|
};
|
|
2846
2650
|
|
|
2847
|
-
// src/commands/canvas/commands/
|
|
2651
|
+
// src/commands/canvas/commands/compositionPattern.ts
|
|
2848
2652
|
import yargs6 from "yargs";
|
|
2849
2653
|
|
|
2654
|
+
// src/commands/canvas/commands/compositionPattern/get.ts
|
|
2655
|
+
var CompositionPatternGetModule = {
|
|
2656
|
+
...CompositionGetModule,
|
|
2657
|
+
describe: "Fetch a composition pattern"
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
// src/commands/canvas/commands/compositionPattern/list.ts
|
|
2661
|
+
var CompositionPatternListModule = {
|
|
2662
|
+
...CompositionListModule,
|
|
2663
|
+
describe: "List composition patterns",
|
|
2664
|
+
builder: (yargs35) => withFormatOptions(
|
|
2665
|
+
withConfiguration(
|
|
2666
|
+
withApiOptions(
|
|
2667
|
+
withProjectOptions(
|
|
2668
|
+
withStateOptions(
|
|
2669
|
+
yargs35.options({
|
|
2670
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2671
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2672
|
+
resolvePatterns: {
|
|
2673
|
+
type: "boolean",
|
|
2674
|
+
default: false,
|
|
2675
|
+
describe: "Resolve composition pattern references in the composition"
|
|
2676
|
+
},
|
|
2677
|
+
resolveOverrides: {
|
|
2678
|
+
type: "boolean",
|
|
2679
|
+
default: false,
|
|
2680
|
+
describe: "Resolves composition pattern overrides in the composition and removes override definition data"
|
|
2681
|
+
},
|
|
2682
|
+
onlyPatterns: {
|
|
2683
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2684
|
+
// This default differentiate this list command from composition list command
|
|
2685
|
+
default: true,
|
|
2686
|
+
type: "boolean",
|
|
2687
|
+
hidden: true
|
|
2688
|
+
},
|
|
2689
|
+
patternType: {
|
|
2690
|
+
default: "composition",
|
|
2691
|
+
choices: ["all", "component", "composition"],
|
|
2692
|
+
hidden: true
|
|
2693
|
+
},
|
|
2694
|
+
componentIDs: {
|
|
2695
|
+
alias: ["componentIDs"],
|
|
2696
|
+
type: "boolean",
|
|
2697
|
+
default: false,
|
|
2698
|
+
describe: "Include individual composition pattern UIDs"
|
|
2699
|
+
}
|
|
2700
|
+
})
|
|
2701
|
+
)
|
|
2702
|
+
)
|
|
2703
|
+
)
|
|
2704
|
+
)
|
|
2705
|
+
)
|
|
2706
|
+
};
|
|
2707
|
+
|
|
2708
|
+
// src/commands/canvas/commands/compositionPattern/publish.ts
|
|
2709
|
+
var CompositionPatternPublishModule = {
|
|
2710
|
+
...CompositionPublishModule,
|
|
2711
|
+
describe: "Publishes composition pattern(s)",
|
|
2712
|
+
builder: (yargs35) => withConfiguration(
|
|
2713
|
+
withApiOptions(
|
|
2714
|
+
withProjectOptions(
|
|
2715
|
+
withDiffOptions(
|
|
2716
|
+
yargs35.positional("ids", {
|
|
2717
|
+
describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2718
|
+
type: "string"
|
|
2719
|
+
}).option("all", {
|
|
2720
|
+
alias: ["a"],
|
|
2721
|
+
describe: "Publishes all composition patterns. Use compositionId to publish one instead.",
|
|
2722
|
+
default: false,
|
|
2723
|
+
type: "boolean"
|
|
2724
|
+
}).option("what-if", {
|
|
2725
|
+
alias: ["w"],
|
|
2726
|
+
describe: "What-if mode reports what would be done but does not perform any un-publishing",
|
|
2727
|
+
default: false,
|
|
2728
|
+
type: "boolean"
|
|
2729
|
+
}).option("publishingState", {
|
|
2730
|
+
describe: 'Publishing state to update to. Can be "published" or "preview".',
|
|
2731
|
+
default: "published",
|
|
2732
|
+
type: "string",
|
|
2733
|
+
hidden: true
|
|
2734
|
+
}).option("onlyCompositions", {
|
|
2735
|
+
describe: "Only publishing compositions and not composition patterns",
|
|
2736
|
+
default: false,
|
|
2737
|
+
type: "boolean",
|
|
2738
|
+
hidden: true
|
|
2739
|
+
}).option("patternType", {
|
|
2740
|
+
default: "composition",
|
|
2741
|
+
choices: ["all", "component", "composition"],
|
|
2742
|
+
hidden: true
|
|
2743
|
+
}).option("onlyPatterns", {
|
|
2744
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2745
|
+
default: true,
|
|
2746
|
+
type: "boolean",
|
|
2747
|
+
hidden: true
|
|
2748
|
+
})
|
|
2749
|
+
)
|
|
2750
|
+
)
|
|
2751
|
+
)
|
|
2752
|
+
)
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
// src/commands/canvas/commands/compositionPattern/pull.ts
|
|
2756
|
+
var CompositionPatternPullModule = {
|
|
2757
|
+
...CompositionPullModule,
|
|
2758
|
+
describe: "Pulls all composition patterns to local files in a directory",
|
|
2759
|
+
builder: (yargs35) => withConfiguration(
|
|
2760
|
+
withApiOptions(
|
|
2761
|
+
withProjectOptions(
|
|
2762
|
+
withStateOptions(
|
|
2763
|
+
withDiffOptions(
|
|
2764
|
+
yargs35.positional("directory", {
|
|
2765
|
+
describe: "Directory to save the composition patterns to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2766
|
+
type: "string"
|
|
2767
|
+
}).option("format", {
|
|
2768
|
+
alias: ["f"],
|
|
2769
|
+
describe: "Output format",
|
|
2770
|
+
default: "yaml",
|
|
2771
|
+
choices: ["yaml", "json"],
|
|
2772
|
+
type: "string"
|
|
2773
|
+
}).option("onlyPatterns", {
|
|
2774
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2775
|
+
// This default differentiates this list command from composition list command
|
|
2776
|
+
default: true,
|
|
2777
|
+
type: "boolean",
|
|
2778
|
+
hidden: true
|
|
2779
|
+
}).option("patternType", {
|
|
2780
|
+
default: "composition",
|
|
2781
|
+
choices: ["all", "component", "composition"],
|
|
2782
|
+
hidden: true
|
|
2783
|
+
}).option("what-if", {
|
|
2784
|
+
alias: ["w"],
|
|
2785
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2786
|
+
default: false,
|
|
2787
|
+
type: "boolean"
|
|
2788
|
+
}).option("mode", {
|
|
2789
|
+
alias: ["m"],
|
|
2790
|
+
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',
|
|
2791
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2792
|
+
default: "mirror",
|
|
2793
|
+
type: "string"
|
|
2794
|
+
})
|
|
2795
|
+
)
|
|
2796
|
+
)
|
|
2797
|
+
)
|
|
2798
|
+
)
|
|
2799
|
+
)
|
|
2800
|
+
};
|
|
2801
|
+
|
|
2802
|
+
// src/commands/canvas/commands/compositionPattern/push.ts
|
|
2803
|
+
var CompositionPatternPushModule = {
|
|
2804
|
+
...CompositionPushModule,
|
|
2805
|
+
describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
|
|
2806
|
+
builder: (yargs35) => withConfiguration(
|
|
2807
|
+
withApiOptions(
|
|
2808
|
+
withProjectOptions(
|
|
2809
|
+
withStateOptions(
|
|
2810
|
+
withDiffOptions(
|
|
2811
|
+
yargs35.positional("directory", {
|
|
2812
|
+
describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
|
|
2813
|
+
type: "string"
|
|
2814
|
+
}).option("what-if", {
|
|
2815
|
+
alias: ["w"],
|
|
2816
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2817
|
+
default: false,
|
|
2818
|
+
type: "boolean"
|
|
2819
|
+
}).option("mode", {
|
|
2820
|
+
alias: ["m"],
|
|
2821
|
+
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',
|
|
2822
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2823
|
+
default: "mirror",
|
|
2824
|
+
type: "string"
|
|
2825
|
+
}).option("onlyPatterns", {
|
|
2826
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2827
|
+
// This default differentiate this list command from composition list command
|
|
2828
|
+
default: true,
|
|
2829
|
+
type: "boolean",
|
|
2830
|
+
hidden: true
|
|
2831
|
+
}).option("patternType", {
|
|
2832
|
+
default: "composition",
|
|
2833
|
+
choices: ["all", "component", "composition"],
|
|
2834
|
+
hidden: true
|
|
2835
|
+
})
|
|
2836
|
+
)
|
|
2837
|
+
)
|
|
2838
|
+
)
|
|
2839
|
+
)
|
|
2840
|
+
)
|
|
2841
|
+
};
|
|
2842
|
+
|
|
2843
|
+
// src/commands/canvas/commands/compositionPattern/remove.ts
|
|
2844
|
+
var CompositionPatternRemoveModule = {
|
|
2845
|
+
...CompositionRemoveModule,
|
|
2846
|
+
describe: "Delete a composition pattern"
|
|
2847
|
+
};
|
|
2848
|
+
|
|
2849
|
+
// src/commands/canvas/commands/compositionPattern/unpublish.ts
|
|
2850
|
+
var CompositionPatternUnpublishModule = {
|
|
2851
|
+
command: "unpublish [ids]",
|
|
2852
|
+
describe: "Unpublish a composition pattern(s)",
|
|
2853
|
+
builder: (yargs35) => withConfiguration(
|
|
2854
|
+
withApiOptions(
|
|
2855
|
+
withProjectOptions(
|
|
2856
|
+
yargs35.positional("ids", {
|
|
2857
|
+
describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2858
|
+
type: "string"
|
|
2859
|
+
}).option("all", {
|
|
2860
|
+
alias: ["a"],
|
|
2861
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
2862
|
+
default: false,
|
|
2863
|
+
type: "boolean"
|
|
2864
|
+
}).option("what-if", {
|
|
2865
|
+
alias: ["w"],
|
|
2866
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
2867
|
+
default: false,
|
|
2868
|
+
type: "boolean"
|
|
2869
|
+
}).option("onlyCompositions", {
|
|
2870
|
+
describe: "Only un-publishing compositions and not composition patterns",
|
|
2871
|
+
default: false,
|
|
2872
|
+
type: "boolean",
|
|
2873
|
+
hidden: true
|
|
2874
|
+
}).option("onlyPatterns", {
|
|
2875
|
+
describe: "Only un-publishing composition patterns and not compositions",
|
|
2876
|
+
default: true,
|
|
2877
|
+
type: "boolean",
|
|
2878
|
+
hidden: true
|
|
2879
|
+
})
|
|
2880
|
+
)
|
|
2881
|
+
)
|
|
2882
|
+
),
|
|
2883
|
+
handler: CompositionUnpublishModule.handler
|
|
2884
|
+
};
|
|
2885
|
+
|
|
2886
|
+
// src/commands/canvas/commands/compositionPattern/update.ts
|
|
2887
|
+
var CompositionPatternUpdateModule = {
|
|
2888
|
+
...CompositionUpdateModule,
|
|
2889
|
+
describe: "Insert or update a composition pattern"
|
|
2890
|
+
};
|
|
2891
|
+
|
|
2892
|
+
// src/commands/canvas/commands/compositionPattern.ts
|
|
2893
|
+
var CompositionPatternModule = {
|
|
2894
|
+
command: "composition-pattern <command>",
|
|
2895
|
+
describe: "Commands for Canvas composition patterns",
|
|
2896
|
+
builder: (yargs35) => yargs35.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
|
|
2897
|
+
handler: () => {
|
|
2898
|
+
yargs6.help();
|
|
2899
|
+
}
|
|
2900
|
+
};
|
|
2901
|
+
|
|
2902
|
+
// src/commands/canvas/commands/contentType.ts
|
|
2903
|
+
import yargs7 from "yargs";
|
|
2904
|
+
|
|
2850
2905
|
// src/commands/canvas/commands/contentType/get.ts
|
|
2851
2906
|
import { ContentClient } from "@uniformdev/canvas";
|
|
2852
2907
|
var ContentTypeGetModule = {
|
|
2853
2908
|
command: "get <id>",
|
|
2854
2909
|
describe: "Get a content type",
|
|
2855
|
-
builder: (
|
|
2910
|
+
builder: (yargs35) => withConfiguration(
|
|
2856
2911
|
withFormatOptions(
|
|
2857
2912
|
withApiOptions(
|
|
2858
2913
|
withProjectOptions(
|
|
2859
2914
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2860
|
-
|
|
2915
|
+
yargs35.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2861
2916
|
)
|
|
2862
2917
|
)
|
|
2863
2918
|
)
|
|
@@ -2879,7 +2934,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2879
2934
|
var ContentTypeListModule = {
|
|
2880
2935
|
command: "list",
|
|
2881
2936
|
describe: "List content types",
|
|
2882
|
-
builder: (
|
|
2937
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
2883
2938
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2884
2939
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2885
2940
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2927,11 +2982,11 @@ function createContentTypeEngineDataSource({
|
|
|
2927
2982
|
var ContentTypePullModule = {
|
|
2928
2983
|
command: "pull <directory>",
|
|
2929
2984
|
describe: "Pulls all content types to local files in a directory",
|
|
2930
|
-
builder: (
|
|
2985
|
+
builder: (yargs35) => withConfiguration(
|
|
2931
2986
|
withApiOptions(
|
|
2932
2987
|
withProjectOptions(
|
|
2933
2988
|
withDiffOptions(
|
|
2934
|
-
|
|
2989
|
+
yargs35.positional("directory", {
|
|
2935
2990
|
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.",
|
|
2936
2991
|
type: "string"
|
|
2937
2992
|
}).option("format", {
|
|
@@ -3015,11 +3070,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
3015
3070
|
var ContentTypePushModule = {
|
|
3016
3071
|
command: "push <directory>",
|
|
3017
3072
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
3018
|
-
builder: (
|
|
3073
|
+
builder: (yargs35) => withConfiguration(
|
|
3019
3074
|
withApiOptions(
|
|
3020
3075
|
withProjectOptions(
|
|
3021
3076
|
withDiffOptions(
|
|
3022
|
-
|
|
3077
|
+
yargs35.positional("directory", {
|
|
3023
3078
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
3024
3079
|
type: "string"
|
|
3025
3080
|
}).option("what-if", {
|
|
@@ -3092,10 +3147,10 @@ var ContentTypeRemoveModule = {
|
|
|
3092
3147
|
command: "remove <id>",
|
|
3093
3148
|
aliases: ["delete", "rm"],
|
|
3094
3149
|
describe: "Delete a content type",
|
|
3095
|
-
builder: (
|
|
3150
|
+
builder: (yargs35) => withConfiguration(
|
|
3096
3151
|
withApiOptions(
|
|
3097
3152
|
withProjectOptions(
|
|
3098
|
-
|
|
3153
|
+
yargs35.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
3099
3154
|
)
|
|
3100
3155
|
)
|
|
3101
3156
|
),
|
|
@@ -3112,10 +3167,10 @@ var ContentTypeUpdateModule = {
|
|
|
3112
3167
|
command: "update <filename>",
|
|
3113
3168
|
aliases: ["put"],
|
|
3114
3169
|
describe: "Insert or update a content type",
|
|
3115
|
-
builder: (
|
|
3170
|
+
builder: (yargs35) => withConfiguration(
|
|
3116
3171
|
withApiOptions(
|
|
3117
3172
|
withProjectOptions(
|
|
3118
|
-
|
|
3173
|
+
yargs35.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
3119
3174
|
)
|
|
3120
3175
|
)
|
|
3121
3176
|
),
|
|
@@ -3132,25 +3187,25 @@ var ContentTypeModule = {
|
|
|
3132
3187
|
command: "contenttype <command>",
|
|
3133
3188
|
aliases: ["ct"],
|
|
3134
3189
|
describe: "Commands for Content Types",
|
|
3135
|
-
builder: (
|
|
3190
|
+
builder: (yargs35) => yargs35.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
3136
3191
|
handler: () => {
|
|
3137
|
-
|
|
3192
|
+
yargs7.help();
|
|
3138
3193
|
}
|
|
3139
3194
|
};
|
|
3140
3195
|
|
|
3141
3196
|
// src/commands/canvas/commands/dataSource.ts
|
|
3142
|
-
import
|
|
3197
|
+
import yargs8 from "yargs";
|
|
3143
3198
|
|
|
3144
3199
|
// src/commands/canvas/commands/dataSource/get.ts
|
|
3145
3200
|
import { DataSourceClient } from "@uniformdev/canvas";
|
|
3146
3201
|
var DataSourceGetModule = {
|
|
3147
3202
|
command: "get <id>",
|
|
3148
3203
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
3149
|
-
builder: (
|
|
3204
|
+
builder: (yargs35) => withConfiguration(
|
|
3150
3205
|
withApiOptions(
|
|
3151
3206
|
withProjectOptions(
|
|
3152
3207
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3153
|
-
|
|
3208
|
+
yargs35.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
3154
3209
|
)
|
|
3155
3210
|
)
|
|
3156
3211
|
),
|
|
@@ -3168,10 +3223,10 @@ var DataSourceRemoveModule = {
|
|
|
3168
3223
|
command: "remove <id>",
|
|
3169
3224
|
aliases: ["delete", "rm"],
|
|
3170
3225
|
describe: "Delete a data source",
|
|
3171
|
-
builder: (
|
|
3226
|
+
builder: (yargs35) => withConfiguration(
|
|
3172
3227
|
withApiOptions(
|
|
3173
3228
|
withProjectOptions(
|
|
3174
|
-
|
|
3229
|
+
yargs35.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
|
|
3175
3230
|
)
|
|
3176
3231
|
)
|
|
3177
3232
|
),
|
|
@@ -3188,10 +3243,10 @@ var DataSourceUpdateModule = {
|
|
|
3188
3243
|
command: "update <dataSource>",
|
|
3189
3244
|
aliases: ["put"],
|
|
3190
3245
|
describe: "Insert or update a data source",
|
|
3191
|
-
builder: (
|
|
3246
|
+
builder: (yargs35) => withConfiguration(
|
|
3192
3247
|
withApiOptions(
|
|
3193
3248
|
withProjectOptions(
|
|
3194
|
-
|
|
3249
|
+
yargs35.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
|
|
3195
3250
|
describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
|
|
3196
3251
|
type: "string",
|
|
3197
3252
|
demandOption: true
|
|
@@ -3211,14 +3266,14 @@ var DataSourceModule = {
|
|
|
3211
3266
|
command: "datasource <command>",
|
|
3212
3267
|
aliases: ["ds"],
|
|
3213
3268
|
describe: "Commands for Data Source definitions",
|
|
3214
|
-
builder: (
|
|
3269
|
+
builder: (yargs35) => yargs35.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
|
|
3215
3270
|
handler: () => {
|
|
3216
|
-
|
|
3271
|
+
yargs8.help();
|
|
3217
3272
|
}
|
|
3218
3273
|
};
|
|
3219
3274
|
|
|
3220
3275
|
// src/commands/canvas/commands/dataType.ts
|
|
3221
|
-
import
|
|
3276
|
+
import yargs9 from "yargs";
|
|
3222
3277
|
|
|
3223
3278
|
// src/commands/canvas/commands/dataType/get.ts
|
|
3224
3279
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
@@ -3226,12 +3281,12 @@ var DataTypeGetModule = {
|
|
|
3226
3281
|
command: "get <id>",
|
|
3227
3282
|
describe: "Get a data type",
|
|
3228
3283
|
aliases: ["ls"],
|
|
3229
|
-
builder: (
|
|
3284
|
+
builder: (yargs35) => withConfiguration(
|
|
3230
3285
|
withFormatOptions(
|
|
3231
3286
|
withApiOptions(
|
|
3232
3287
|
withProjectOptions(
|
|
3233
3288
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3234
|
-
|
|
3289
|
+
yargs35.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
3235
3290
|
)
|
|
3236
3291
|
)
|
|
3237
3292
|
)
|
|
@@ -3254,7 +3309,7 @@ var DataTypeListModule = {
|
|
|
3254
3309
|
command: "list",
|
|
3255
3310
|
describe: "List data types",
|
|
3256
3311
|
aliases: ["ls"],
|
|
3257
|
-
builder: (
|
|
3312
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
3258
3313
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3259
3314
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3260
3315
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3304,11 +3359,11 @@ function createDataTypeEngineDataSource({
|
|
|
3304
3359
|
var DataTypePullModule = {
|
|
3305
3360
|
command: "pull <directory>",
|
|
3306
3361
|
describe: "Pulls all data types to local files in a directory",
|
|
3307
|
-
builder: (
|
|
3362
|
+
builder: (yargs35) => withConfiguration(
|
|
3308
3363
|
withApiOptions(
|
|
3309
3364
|
withProjectOptions(
|
|
3310
3365
|
withDiffOptions(
|
|
3311
|
-
|
|
3366
|
+
yargs35.positional("directory", {
|
|
3312
3367
|
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.",
|
|
3313
3368
|
type: "string"
|
|
3314
3369
|
}).option("format", {
|
|
@@ -3392,11 +3447,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
3392
3447
|
var DataTypePushModule = {
|
|
3393
3448
|
command: "push <directory>",
|
|
3394
3449
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
3395
|
-
builder: (
|
|
3450
|
+
builder: (yargs35) => withConfiguration(
|
|
3396
3451
|
withApiOptions(
|
|
3397
3452
|
withProjectOptions(
|
|
3398
3453
|
withDiffOptions(
|
|
3399
|
-
|
|
3454
|
+
yargs35.positional("directory", {
|
|
3400
3455
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
3401
3456
|
type: "string"
|
|
3402
3457
|
}).option("what-if", {
|
|
@@ -3469,10 +3524,10 @@ var DataTypeRemoveModule = {
|
|
|
3469
3524
|
command: "remove <id>",
|
|
3470
3525
|
aliases: ["delete", "rm"],
|
|
3471
3526
|
describe: "Delete a data type",
|
|
3472
|
-
builder: (
|
|
3527
|
+
builder: (yargs35) => withConfiguration(
|
|
3473
3528
|
withApiOptions(
|
|
3474
3529
|
withProjectOptions(
|
|
3475
|
-
|
|
3530
|
+
yargs35.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
3476
3531
|
)
|
|
3477
3532
|
)
|
|
3478
3533
|
),
|
|
@@ -3489,10 +3544,10 @@ var DataTypeUpdateModule = {
|
|
|
3489
3544
|
command: "update <filename>",
|
|
3490
3545
|
aliases: ["put"],
|
|
3491
3546
|
describe: "Insert or update a data type",
|
|
3492
|
-
builder: (
|
|
3547
|
+
builder: (yargs35) => withConfiguration(
|
|
3493
3548
|
withApiOptions(
|
|
3494
3549
|
withProjectOptions(
|
|
3495
|
-
|
|
3550
|
+
yargs35.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
3496
3551
|
)
|
|
3497
3552
|
)
|
|
3498
3553
|
),
|
|
@@ -3509,27 +3564,27 @@ var DataTypeModule = {
|
|
|
3509
3564
|
command: "datatype <command>",
|
|
3510
3565
|
aliases: ["dt"],
|
|
3511
3566
|
describe: "Commands for Data Type definitions",
|
|
3512
|
-
builder: (
|
|
3567
|
+
builder: (yargs35) => yargs35.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3513
3568
|
handler: () => {
|
|
3514
|
-
|
|
3569
|
+
yargs9.help();
|
|
3515
3570
|
}
|
|
3516
3571
|
};
|
|
3517
3572
|
|
|
3518
3573
|
// src/commands/canvas/commands/entry.ts
|
|
3519
|
-
import
|
|
3574
|
+
import yargs10 from "yargs";
|
|
3520
3575
|
|
|
3521
3576
|
// src/commands/canvas/commands/entry/get.ts
|
|
3522
3577
|
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
3523
3578
|
var EntryGetModule = {
|
|
3524
3579
|
command: "get <id>",
|
|
3525
3580
|
describe: "Get an entry",
|
|
3526
|
-
builder: (
|
|
3581
|
+
builder: (yargs35) => withConfiguration(
|
|
3527
3582
|
withFormatOptions(
|
|
3528
3583
|
withApiOptions(
|
|
3529
3584
|
withProjectOptions(
|
|
3530
3585
|
withStateOptions(
|
|
3531
3586
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3532
|
-
|
|
3587
|
+
yargs35.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }),
|
|
3533
3588
|
// for backwards compatibility, we default to the "published" state, unlike compositions
|
|
3534
3589
|
"published"
|
|
3535
3590
|
)
|
|
@@ -3572,12 +3627,12 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
|
3572
3627
|
var EntryListModule = {
|
|
3573
3628
|
command: "list",
|
|
3574
3629
|
describe: "List entries",
|
|
3575
|
-
builder: (
|
|
3630
|
+
builder: (yargs35) => withConfiguration(
|
|
3576
3631
|
withFormatOptions(
|
|
3577
3632
|
withApiOptions(
|
|
3578
3633
|
withProjectOptions(
|
|
3579
3634
|
withStateOptions(
|
|
3580
|
-
|
|
3635
|
+
yargs35.options({
|
|
3581
3636
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3582
3637
|
limit: { describe: "Number of rows to fetch", type: "number", default: LEGACY_DEFAULT_LIMIT },
|
|
3583
3638
|
search: { describe: "Search query", type: "string", default: "" }
|
|
@@ -3678,11 +3733,11 @@ function createEntryEngineDataSource({
|
|
|
3678
3733
|
var EntryPublishModule = {
|
|
3679
3734
|
command: "publish [ids]",
|
|
3680
3735
|
describe: "Publishes entry(ies)",
|
|
3681
|
-
builder: (
|
|
3736
|
+
builder: (yargs35) => withConfiguration(
|
|
3682
3737
|
withApiOptions(
|
|
3683
3738
|
withProjectOptions(
|
|
3684
3739
|
withDiffOptions(
|
|
3685
|
-
|
|
3740
|
+
yargs35.positional("ids", {
|
|
3686
3741
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3687
3742
|
type: "string"
|
|
3688
3743
|
}).option("all", {
|
|
@@ -3737,12 +3792,12 @@ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
|
3737
3792
|
var EntryPullModule = {
|
|
3738
3793
|
command: "pull <directory>",
|
|
3739
3794
|
describe: "Pulls all entries to local files in a directory",
|
|
3740
|
-
builder: (
|
|
3795
|
+
builder: (yargs35) => withConfiguration(
|
|
3741
3796
|
withApiOptions(
|
|
3742
3797
|
withProjectOptions(
|
|
3743
3798
|
withStateOptions(
|
|
3744
3799
|
withDiffOptions(
|
|
3745
|
-
|
|
3800
|
+
yargs35.positional("directory", {
|
|
3746
3801
|
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.",
|
|
3747
3802
|
type: "string"
|
|
3748
3803
|
}).option("format", {
|
|
@@ -3842,12 +3897,12 @@ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
|
3842
3897
|
var EntryPushModule = {
|
|
3843
3898
|
command: "push <directory>",
|
|
3844
3899
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3845
|
-
builder: (
|
|
3900
|
+
builder: (yargs35) => withConfiguration(
|
|
3846
3901
|
withApiOptions(
|
|
3847
3902
|
withProjectOptions(
|
|
3848
3903
|
withStateOptions(
|
|
3849
3904
|
withDiffOptions(
|
|
3850
|
-
|
|
3905
|
+
yargs35.positional("directory", {
|
|
3851
3906
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3852
3907
|
type: "string"
|
|
3853
3908
|
}).option("what-if", {
|
|
@@ -3934,10 +3989,10 @@ var EntryRemoveModule = {
|
|
|
3934
3989
|
command: "remove <id>",
|
|
3935
3990
|
aliases: ["delete", "rm"],
|
|
3936
3991
|
describe: "Delete an entry",
|
|
3937
|
-
builder: (
|
|
3992
|
+
builder: (yargs35) => withConfiguration(
|
|
3938
3993
|
withApiOptions(
|
|
3939
3994
|
withProjectOptions(
|
|
3940
|
-
|
|
3995
|
+
yargs35.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3941
3996
|
)
|
|
3942
3997
|
)
|
|
3943
3998
|
),
|
|
@@ -3954,10 +4009,10 @@ import { diffJson as diffJson3 } from "diff";
|
|
|
3954
4009
|
var EntryUnpublishModule = {
|
|
3955
4010
|
command: "unpublish [ids]",
|
|
3956
4011
|
describe: "Unpublish an entry(ies)",
|
|
3957
|
-
builder: (
|
|
4012
|
+
builder: (yargs35) => withConfiguration(
|
|
3958
4013
|
withApiOptions(
|
|
3959
4014
|
withProjectOptions(
|
|
3960
|
-
|
|
4015
|
+
yargs35.positional("ids", {
|
|
3961
4016
|
describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3962
4017
|
type: "string"
|
|
3963
4018
|
}).option("all", {
|
|
@@ -4030,11 +4085,11 @@ var EntryUpdateModule = {
|
|
|
4030
4085
|
command: "update <filename>",
|
|
4031
4086
|
aliases: ["put"],
|
|
4032
4087
|
describe: "Insert or update an entry",
|
|
4033
|
-
builder: (
|
|
4088
|
+
builder: (yargs35) => withConfiguration(
|
|
4034
4089
|
withApiOptions(
|
|
4035
4090
|
withProjectOptions(
|
|
4036
4091
|
withStateOptions(
|
|
4037
|
-
|
|
4092
|
+
yargs35.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
4038
4093
|
)
|
|
4039
4094
|
)
|
|
4040
4095
|
)
|
|
@@ -4051,27 +4106,27 @@ var EntryUpdateModule = {
|
|
|
4051
4106
|
var EntryModule = {
|
|
4052
4107
|
command: "entry <command>",
|
|
4053
4108
|
describe: "Commands for Entries",
|
|
4054
|
-
builder: (
|
|
4109
|
+
builder: (yargs35) => yargs35.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
|
|
4055
4110
|
handler: () => {
|
|
4056
|
-
|
|
4111
|
+
yargs10.help();
|
|
4057
4112
|
}
|
|
4058
4113
|
};
|
|
4059
4114
|
|
|
4060
4115
|
// src/commands/canvas/commands/entryPattern.ts
|
|
4061
|
-
import
|
|
4116
|
+
import yargs11 from "yargs";
|
|
4062
4117
|
|
|
4063
4118
|
// src/commands/canvas/commands/entryPattern/get.ts
|
|
4064
4119
|
import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
|
|
4065
4120
|
var EntryPatternGetModule = {
|
|
4066
4121
|
command: "get <id>",
|
|
4067
4122
|
describe: "Get an entry pattern",
|
|
4068
|
-
builder: (
|
|
4123
|
+
builder: (yargs35) => withConfiguration(
|
|
4069
4124
|
withFormatOptions(
|
|
4070
4125
|
withApiOptions(
|
|
4071
4126
|
withProjectOptions(
|
|
4072
4127
|
withStateOptions(
|
|
4073
4128
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4074
|
-
|
|
4129
|
+
yargs35.positional("id", {
|
|
4075
4130
|
demandOption: true,
|
|
4076
4131
|
describe: "Entry pattern public ID to fetch"
|
|
4077
4132
|
}),
|
|
@@ -4106,8 +4161,8 @@ import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
|
|
|
4106
4161
|
var EntryPatternListModule = {
|
|
4107
4162
|
command: "list",
|
|
4108
4163
|
describe: "List entry patterns",
|
|
4109
|
-
builder: (
|
|
4110
|
-
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(
|
|
4164
|
+
builder: (yargs35) => withConfiguration(
|
|
4165
|
+
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs35, "published"))))
|
|
4111
4166
|
),
|
|
4112
4167
|
handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
|
|
4113
4168
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4130,11 +4185,11 @@ import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
|
|
|
4130
4185
|
var EntryPatternPublishModule = {
|
|
4131
4186
|
command: "publish [ids]",
|
|
4132
4187
|
describe: "Publishes entry pattern(s)",
|
|
4133
|
-
builder: (
|
|
4188
|
+
builder: (yargs35) => withConfiguration(
|
|
4134
4189
|
withApiOptions(
|
|
4135
4190
|
withProjectOptions(
|
|
4136
4191
|
withDiffOptions(
|
|
4137
|
-
|
|
4192
|
+
yargs35.positional("ids", {
|
|
4138
4193
|
describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4139
4194
|
type: "string"
|
|
4140
4195
|
}).option("all", {
|
|
@@ -4189,12 +4244,12 @@ import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
|
|
|
4189
4244
|
var EntryPatternPullModule = {
|
|
4190
4245
|
command: "pull <directory>",
|
|
4191
4246
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
4192
|
-
builder: (
|
|
4247
|
+
builder: (yargs35) => withConfiguration(
|
|
4193
4248
|
withApiOptions(
|
|
4194
4249
|
withProjectOptions(
|
|
4195
4250
|
withStateOptions(
|
|
4196
4251
|
withDiffOptions(
|
|
4197
|
-
|
|
4252
|
+
yargs35.positional("directory", {
|
|
4198
4253
|
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.",
|
|
4199
4254
|
type: "string"
|
|
4200
4255
|
}).option("format", {
|
|
@@ -4294,12 +4349,12 @@ import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
|
|
|
4294
4349
|
var EntryPatternPushModule = {
|
|
4295
4350
|
command: "push <directory>",
|
|
4296
4351
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
4297
|
-
builder: (
|
|
4352
|
+
builder: (yargs35) => withConfiguration(
|
|
4298
4353
|
withApiOptions(
|
|
4299
4354
|
withProjectOptions(
|
|
4300
4355
|
withStateOptions(
|
|
4301
4356
|
withDiffOptions(
|
|
4302
|
-
|
|
4357
|
+
yargs35.positional("directory", {
|
|
4303
4358
|
describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
|
|
4304
4359
|
type: "string"
|
|
4305
4360
|
}).option("what-if", {
|
|
@@ -4386,10 +4441,10 @@ var EntryPatternRemoveModule = {
|
|
|
4386
4441
|
command: "remove <id>",
|
|
4387
4442
|
aliases: ["delete", "rm"],
|
|
4388
4443
|
describe: "Delete an entry pattern",
|
|
4389
|
-
builder: (
|
|
4444
|
+
builder: (yargs35) => withConfiguration(
|
|
4390
4445
|
withApiOptions(
|
|
4391
4446
|
withProjectOptions(
|
|
4392
|
-
|
|
4447
|
+
yargs35.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
|
|
4393
4448
|
)
|
|
4394
4449
|
)
|
|
4395
4450
|
),
|
|
@@ -4406,10 +4461,10 @@ import { diffJson as diffJson4 } from "diff";
|
|
|
4406
4461
|
var EntryPatternUnpublishModule = {
|
|
4407
4462
|
command: "unpublish [ids]",
|
|
4408
4463
|
describe: "Unpublish an entry patterns",
|
|
4409
|
-
builder: (
|
|
4464
|
+
builder: (yargs35) => withConfiguration(
|
|
4410
4465
|
withApiOptions(
|
|
4411
4466
|
withProjectOptions(
|
|
4412
|
-
|
|
4467
|
+
yargs35.positional("ids", {
|
|
4413
4468
|
describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4414
4469
|
type: "string"
|
|
4415
4470
|
}).option("all", {
|
|
@@ -4482,11 +4537,11 @@ var EntryPatternUpdateModule = {
|
|
|
4482
4537
|
command: "update <filename>",
|
|
4483
4538
|
aliases: ["put"],
|
|
4484
4539
|
describe: "Insert or update an entry pattern",
|
|
4485
|
-
builder: (
|
|
4540
|
+
builder: (yargs35) => withConfiguration(
|
|
4486
4541
|
withApiOptions(
|
|
4487
4542
|
withProjectOptions(
|
|
4488
4543
|
withStateOptions(
|
|
4489
|
-
|
|
4544
|
+
yargs35.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
|
|
4490
4545
|
)
|
|
4491
4546
|
)
|
|
4492
4547
|
)
|
|
@@ -4503,14 +4558,14 @@ var EntryPatternUpdateModule = {
|
|
|
4503
4558
|
var EntryPatternModule = {
|
|
4504
4559
|
command: "entry-pattern <command>",
|
|
4505
4560
|
describe: "Commands for Entry patterns",
|
|
4506
|
-
builder: (
|
|
4561
|
+
builder: (yargs35) => yargs35.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
|
|
4507
4562
|
handler: () => {
|
|
4508
|
-
|
|
4563
|
+
yargs11.help();
|
|
4509
4564
|
}
|
|
4510
4565
|
};
|
|
4511
4566
|
|
|
4512
4567
|
// src/commands/canvas/commands/locale.ts
|
|
4513
|
-
import
|
|
4568
|
+
import yargs12 from "yargs";
|
|
4514
4569
|
|
|
4515
4570
|
// src/commands/canvas/commands/locale/pull.ts
|
|
4516
4571
|
import { LocaleClient } from "@uniformdev/canvas";
|
|
@@ -4549,11 +4604,11 @@ function createLocaleEngineDataSource({
|
|
|
4549
4604
|
var LocalePullModule = {
|
|
4550
4605
|
command: "pull <directory>",
|
|
4551
4606
|
describe: "Pulls all locales to local files in a directory",
|
|
4552
|
-
builder: (
|
|
4607
|
+
builder: (yargs35) => withConfiguration(
|
|
4553
4608
|
withApiOptions(
|
|
4554
4609
|
withProjectOptions(
|
|
4555
4610
|
withDiffOptions(
|
|
4556
|
-
|
|
4611
|
+
yargs35.positional("directory", {
|
|
4557
4612
|
describe: "Directory to save the locales to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4558
4613
|
type: "string"
|
|
4559
4614
|
}).option("format", {
|
|
@@ -4637,11 +4692,11 @@ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
|
4637
4692
|
var LocalePushModule = {
|
|
4638
4693
|
command: "push <directory>",
|
|
4639
4694
|
describe: "Pushes all locales from files in a directory to Uniform",
|
|
4640
|
-
builder: (
|
|
4695
|
+
builder: (yargs35) => withConfiguration(
|
|
4641
4696
|
withApiOptions(
|
|
4642
4697
|
withProjectOptions(
|
|
4643
4698
|
withDiffOptions(
|
|
4644
|
-
|
|
4699
|
+
yargs35.positional("directory", {
|
|
4645
4700
|
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
4646
4701
|
type: "string"
|
|
4647
4702
|
}).option("what-if", {
|
|
@@ -4712,26 +4767,26 @@ var LocalePushModule = {
|
|
|
4712
4767
|
var LocaleModule = {
|
|
4713
4768
|
command: "locale <command>",
|
|
4714
4769
|
describe: "Commands for locale definitions",
|
|
4715
|
-
builder: (
|
|
4770
|
+
builder: (yargs35) => yargs35.command(LocalePullModule).command(LocalePushModule),
|
|
4716
4771
|
handler: () => {
|
|
4717
|
-
|
|
4772
|
+
yargs12.help();
|
|
4718
4773
|
}
|
|
4719
4774
|
};
|
|
4720
4775
|
|
|
4721
4776
|
// src/commands/canvas/commands/prompts.ts
|
|
4722
|
-
import
|
|
4777
|
+
import yargs13 from "yargs";
|
|
4723
4778
|
|
|
4724
4779
|
// src/commands/canvas/commands/prompts/get.ts
|
|
4725
4780
|
import { PromptClient } from "@uniformdev/canvas";
|
|
4726
4781
|
var PromptGetModule = {
|
|
4727
4782
|
command: "get <id>",
|
|
4728
4783
|
describe: "Get a prompt",
|
|
4729
|
-
builder: (
|
|
4784
|
+
builder: (yargs35) => withConfiguration(
|
|
4730
4785
|
withFormatOptions(
|
|
4731
4786
|
withApiOptions(
|
|
4732
4787
|
withProjectOptions(
|
|
4733
4788
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4734
|
-
|
|
4789
|
+
yargs35.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
4735
4790
|
)
|
|
4736
4791
|
)
|
|
4737
4792
|
)
|
|
@@ -4752,7 +4807,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
4752
4807
|
var PromptListModule = {
|
|
4753
4808
|
command: "list",
|
|
4754
4809
|
describe: "List prompts",
|
|
4755
|
-
builder: (
|
|
4810
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
4756
4811
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4757
4812
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4758
4813
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -4800,12 +4855,12 @@ function createPromptEngineDataSource({
|
|
|
4800
4855
|
var PromptPullModule = {
|
|
4801
4856
|
command: "pull <directory>",
|
|
4802
4857
|
describe: "Pulls all prompts to local files in a directory",
|
|
4803
|
-
builder: (
|
|
4858
|
+
builder: (yargs35) => withConfiguration(
|
|
4804
4859
|
withApiOptions(
|
|
4805
4860
|
withProjectOptions(
|
|
4806
4861
|
withStateOptions(
|
|
4807
4862
|
withDiffOptions(
|
|
4808
|
-
|
|
4863
|
+
yargs35.positional("directory", {
|
|
4809
4864
|
describe: "Directory to save the prompts to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4810
4865
|
type: "string"
|
|
4811
4866
|
}).option("format", {
|
|
@@ -4890,12 +4945,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
4890
4945
|
var PromptPushModule = {
|
|
4891
4946
|
command: "push <directory>",
|
|
4892
4947
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
4893
|
-
builder: (
|
|
4948
|
+
builder: (yargs35) => withConfiguration(
|
|
4894
4949
|
withApiOptions(
|
|
4895
4950
|
withProjectOptions(
|
|
4896
4951
|
withStateOptions(
|
|
4897
4952
|
withDiffOptions(
|
|
4898
|
-
|
|
4953
|
+
yargs35.positional("directory", {
|
|
4899
4954
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
4900
4955
|
type: "string"
|
|
4901
4956
|
}).option("what-if", {
|
|
@@ -4969,9 +5024,9 @@ var PromptRemoveModule = {
|
|
|
4969
5024
|
command: "remove <id>",
|
|
4970
5025
|
aliases: ["delete", "rm"],
|
|
4971
5026
|
describe: "Delete a prompt",
|
|
4972
|
-
builder: (
|
|
5027
|
+
builder: (yargs35) => withConfiguration(
|
|
4973
5028
|
withApiOptions(
|
|
4974
|
-
withProjectOptions(
|
|
5029
|
+
withProjectOptions(yargs35.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
4975
5030
|
)
|
|
4976
5031
|
),
|
|
4977
5032
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -4987,10 +5042,10 @@ var PromptUpdateModule = {
|
|
|
4987
5042
|
command: "update <filename>",
|
|
4988
5043
|
aliases: ["put"],
|
|
4989
5044
|
describe: "Insert or update a prompt",
|
|
4990
|
-
builder: (
|
|
5045
|
+
builder: (yargs35) => withConfiguration(
|
|
4991
5046
|
withApiOptions(
|
|
4992
5047
|
withProjectOptions(
|
|
4993
|
-
|
|
5048
|
+
yargs35.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
4994
5049
|
)
|
|
4995
5050
|
)
|
|
4996
5051
|
),
|
|
@@ -5007,14 +5062,14 @@ var PromptModule = {
|
|
|
5007
5062
|
command: "prompt <command>",
|
|
5008
5063
|
aliases: ["dt"],
|
|
5009
5064
|
describe: "Commands for AI Prompt definitions",
|
|
5010
|
-
builder: (
|
|
5065
|
+
builder: (yargs35) => yargs35.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
5011
5066
|
handler: () => {
|
|
5012
|
-
|
|
5067
|
+
yargs13.help();
|
|
5013
5068
|
}
|
|
5014
5069
|
};
|
|
5015
5070
|
|
|
5016
5071
|
// src/commands/canvas/commands/workflow.ts
|
|
5017
|
-
import
|
|
5072
|
+
import yargs14 from "yargs";
|
|
5018
5073
|
|
|
5019
5074
|
// src/commands/canvas/commands/workflow/pull.ts
|
|
5020
5075
|
import { WorkflowClient } from "@uniformdev/canvas";
|
|
@@ -5058,11 +5113,11 @@ function createWorkflowEngineDataSource({
|
|
|
5058
5113
|
var WorkflowPullModule = {
|
|
5059
5114
|
command: "pull <directory>",
|
|
5060
5115
|
describe: "Pulls all workflows to local files in a directory",
|
|
5061
|
-
builder: (
|
|
5116
|
+
builder: (yargs35) => withConfiguration(
|
|
5062
5117
|
withApiOptions(
|
|
5063
5118
|
withProjectOptions(
|
|
5064
5119
|
withDiffOptions(
|
|
5065
|
-
|
|
5120
|
+
yargs35.positional("directory", {
|
|
5066
5121
|
describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5067
5122
|
type: "string"
|
|
5068
5123
|
}).option("format", {
|
|
@@ -5140,11 +5195,11 @@ import { WorkflowClient as WorkflowClient2 } from "@uniformdev/canvas";
|
|
|
5140
5195
|
var WorkflowPushModule = {
|
|
5141
5196
|
command: "push <directory>",
|
|
5142
5197
|
describe: "Pushes all workflows from files in a directory to Uniform Canvas",
|
|
5143
|
-
builder: (
|
|
5198
|
+
builder: (yargs35) => withConfiguration(
|
|
5144
5199
|
withApiOptions(
|
|
5145
5200
|
withProjectOptions(
|
|
5146
5201
|
withDiffOptions(
|
|
5147
|
-
|
|
5202
|
+
yargs35.positional("directory", {
|
|
5148
5203
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
5149
5204
|
type: "string"
|
|
5150
5205
|
}).option("what-if", {
|
|
@@ -5210,9 +5265,9 @@ var WorkflowModule = {
|
|
|
5210
5265
|
command: "workflow <command>",
|
|
5211
5266
|
aliases: ["wf"],
|
|
5212
5267
|
describe: "Commands for Canvas workflows",
|
|
5213
|
-
builder: (
|
|
5268
|
+
builder: (yargs35) => yargs35.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
|
|
5214
5269
|
handler: () => {
|
|
5215
|
-
|
|
5270
|
+
yargs14.help();
|
|
5216
5271
|
}
|
|
5217
5272
|
};
|
|
5218
5273
|
|
|
@@ -5221,28 +5276,28 @@ var CanvasCommand = {
|
|
|
5221
5276
|
command: "canvas <command>",
|
|
5222
5277
|
aliases: ["cv", "pm", "presentation"],
|
|
5223
5278
|
describe: "Uniform Canvas commands",
|
|
5224
|
-
builder: (
|
|
5279
|
+
builder: (yargs35) => yargs35.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(ComponentPatternModule).command(CompositionPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LocaleModule).command(WorkflowModule).demandCommand(),
|
|
5225
5280
|
handler: () => {
|
|
5226
|
-
|
|
5281
|
+
yargs15.showHelp();
|
|
5227
5282
|
}
|
|
5228
5283
|
};
|
|
5229
5284
|
|
|
5230
5285
|
// src/commands/context/index.ts
|
|
5231
|
-
import
|
|
5286
|
+
import yargs22 from "yargs";
|
|
5232
5287
|
|
|
5233
5288
|
// src/commands/context/commands/aggregate.ts
|
|
5234
|
-
import
|
|
5289
|
+
import yargs16 from "yargs";
|
|
5235
5290
|
|
|
5236
5291
|
// src/commands/context/commands/aggregate/get.ts
|
|
5237
5292
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
5238
5293
|
var AggregateGetModule = {
|
|
5239
5294
|
command: "get <id>",
|
|
5240
5295
|
describe: "Fetch an aggregate",
|
|
5241
|
-
builder: (
|
|
5296
|
+
builder: (yargs35) => withConfiguration(
|
|
5242
5297
|
withFormatOptions(
|
|
5243
5298
|
withApiOptions(
|
|
5244
5299
|
withProjectOptions(
|
|
5245
|
-
|
|
5300
|
+
yargs35.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
5246
5301
|
)
|
|
5247
5302
|
)
|
|
5248
5303
|
)
|
|
@@ -5266,7 +5321,7 @@ var AggregateListModule = {
|
|
|
5266
5321
|
command: "list",
|
|
5267
5322
|
describe: "List aggregates",
|
|
5268
5323
|
aliases: ["ls"],
|
|
5269
|
-
builder: (
|
|
5324
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
5270
5325
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5271
5326
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5272
5327
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5333,11 +5388,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
5333
5388
|
var AggregatePullModule = {
|
|
5334
5389
|
command: "pull <directory>",
|
|
5335
5390
|
describe: "Pulls all aggregates to local files in a directory",
|
|
5336
|
-
builder: (
|
|
5391
|
+
builder: (yargs35) => withConfiguration(
|
|
5337
5392
|
withApiOptions(
|
|
5338
5393
|
withProjectOptions(
|
|
5339
5394
|
withDiffOptions(
|
|
5340
|
-
|
|
5395
|
+
yargs35.positional("directory", {
|
|
5341
5396
|
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.",
|
|
5342
5397
|
type: "string"
|
|
5343
5398
|
}).option("format", {
|
|
@@ -5415,11 +5470,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
5415
5470
|
var AggregatePushModule = {
|
|
5416
5471
|
command: "push <directory>",
|
|
5417
5472
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
5418
|
-
builder: (
|
|
5473
|
+
builder: (yargs35) => withConfiguration(
|
|
5419
5474
|
withApiOptions(
|
|
5420
5475
|
withProjectOptions(
|
|
5421
5476
|
withDiffOptions(
|
|
5422
|
-
|
|
5477
|
+
yargs35.positional("directory", {
|
|
5423
5478
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
5424
5479
|
type: "string"
|
|
5425
5480
|
}).option("what-if", {
|
|
@@ -5487,10 +5542,10 @@ var AggregateRemoveModule = {
|
|
|
5487
5542
|
command: "remove <id>",
|
|
5488
5543
|
aliases: ["delete", "rm"],
|
|
5489
5544
|
describe: "Delete an aggregate",
|
|
5490
|
-
builder: (
|
|
5545
|
+
builder: (yargs35) => withConfiguration(
|
|
5491
5546
|
withApiOptions(
|
|
5492
5547
|
withProjectOptions(
|
|
5493
|
-
|
|
5548
|
+
yargs35.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
5494
5549
|
)
|
|
5495
5550
|
)
|
|
5496
5551
|
),
|
|
@@ -5507,10 +5562,10 @@ var AggregateUpdateModule = {
|
|
|
5507
5562
|
command: "update <filename>",
|
|
5508
5563
|
aliases: ["put"],
|
|
5509
5564
|
describe: "Insert or update an aggregate",
|
|
5510
|
-
builder: (
|
|
5565
|
+
builder: (yargs35) => withConfiguration(
|
|
5511
5566
|
withApiOptions(
|
|
5512
5567
|
withProjectOptions(
|
|
5513
|
-
|
|
5568
|
+
yargs35.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
5514
5569
|
)
|
|
5515
5570
|
)
|
|
5516
5571
|
),
|
|
@@ -5527,34 +5582,33 @@ var AggregateModule = {
|
|
|
5527
5582
|
command: "aggregate <command>",
|
|
5528
5583
|
aliases: ["agg", "intent", "audience"],
|
|
5529
5584
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
5530
|
-
builder: (
|
|
5585
|
+
builder: (yargs35) => yargs35.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
5531
5586
|
handler: () => {
|
|
5532
|
-
|
|
5587
|
+
yargs16.help();
|
|
5533
5588
|
}
|
|
5534
5589
|
};
|
|
5535
5590
|
|
|
5536
5591
|
// src/commands/context/commands/enrichment.ts
|
|
5537
|
-
import
|
|
5592
|
+
import yargs17 from "yargs";
|
|
5538
5593
|
|
|
5539
5594
|
// src/commands/context/commands/enrichment/get.ts
|
|
5540
5595
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
5541
5596
|
var EnrichmentGetModule = {
|
|
5542
5597
|
command: "get <id>",
|
|
5543
5598
|
describe: "Fetch an enrichment category and its values",
|
|
5544
|
-
builder: (
|
|
5599
|
+
builder: (yargs35) => withFormatOptions(
|
|
5545
5600
|
withConfiguration(
|
|
5546
5601
|
withApiOptions(
|
|
5547
5602
|
withProjectOptions(
|
|
5548
|
-
|
|
5603
|
+
yargs35.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
5549
5604
|
)
|
|
5550
5605
|
)
|
|
5551
5606
|
)
|
|
5552
5607
|
),
|
|
5553
5608
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
5554
|
-
var _a, _b;
|
|
5555
5609
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5556
5610
|
const client = new UncachedEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5557
|
-
const res = (
|
|
5611
|
+
const res = (await client.get())?.enrichments?.filter((enr) => enr.id === id);
|
|
5558
5612
|
if (res.length === 0) {
|
|
5559
5613
|
console.error("Enrichment did not exist");
|
|
5560
5614
|
process.exit(1);
|
|
@@ -5570,7 +5624,7 @@ var EnrichmentListModule = {
|
|
|
5570
5624
|
command: "list",
|
|
5571
5625
|
describe: "List enrichments",
|
|
5572
5626
|
aliases: ["ls"],
|
|
5573
|
-
builder: (
|
|
5627
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
5574
5628
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5575
5629
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5576
5630
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5609,7 +5663,6 @@ function createEnrichmentEngineDataSource({
|
|
|
5609
5663
|
await client.removeCategory({ enrichmentId: providerId });
|
|
5610
5664
|
},
|
|
5611
5665
|
writeObject: async (object, existingObject) => {
|
|
5612
|
-
var _a;
|
|
5613
5666
|
await client.upsertCategory({
|
|
5614
5667
|
enrichment: object.object
|
|
5615
5668
|
});
|
|
@@ -5619,7 +5672,7 @@ function createEnrichmentEngineDataSource({
|
|
|
5619
5672
|
});
|
|
5620
5673
|
const target = createEnrichmentValueEngineDataSource({
|
|
5621
5674
|
categoryId: object.object.id,
|
|
5622
|
-
values:
|
|
5675
|
+
values: existingObject?.object?.values ?? [],
|
|
5623
5676
|
client
|
|
5624
5677
|
});
|
|
5625
5678
|
await syncEngine({
|
|
@@ -5673,11 +5726,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
5673
5726
|
var EnrichmentPullModule = {
|
|
5674
5727
|
command: "pull <directory>",
|
|
5675
5728
|
describe: "Pulls all enrichments to local files in a directory",
|
|
5676
|
-
builder: (
|
|
5729
|
+
builder: (yargs35) => withConfiguration(
|
|
5677
5730
|
withApiOptions(
|
|
5678
5731
|
withProjectOptions(
|
|
5679
5732
|
withDiffOptions(
|
|
5680
|
-
|
|
5733
|
+
yargs35.positional("directory", {
|
|
5681
5734
|
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.",
|
|
5682
5735
|
type: "string"
|
|
5683
5736
|
}).option("format", {
|
|
@@ -5755,11 +5808,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
5755
5808
|
var EnrichmentPushModule = {
|
|
5756
5809
|
command: "push <directory>",
|
|
5757
5810
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
5758
|
-
builder: (
|
|
5811
|
+
builder: (yargs35) => withConfiguration(
|
|
5759
5812
|
withApiOptions(
|
|
5760
5813
|
withProjectOptions(
|
|
5761
5814
|
withDiffOptions(
|
|
5762
|
-
|
|
5815
|
+
yargs35.positional("directory", {
|
|
5763
5816
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
5764
5817
|
type: "string"
|
|
5765
5818
|
}).option("what-if", {
|
|
@@ -5826,10 +5879,10 @@ var EnrichmentRemoveModule = {
|
|
|
5826
5879
|
command: "remove <id>",
|
|
5827
5880
|
aliases: ["delete", "rm"],
|
|
5828
5881
|
describe: "Delete an enrichment category and its values",
|
|
5829
|
-
builder: (
|
|
5882
|
+
builder: (yargs35) => withConfiguration(
|
|
5830
5883
|
withApiOptions(
|
|
5831
5884
|
withProjectOptions(
|
|
5832
|
-
|
|
5885
|
+
yargs35.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
5833
5886
|
)
|
|
5834
5887
|
)
|
|
5835
5888
|
),
|
|
@@ -5845,14 +5898,14 @@ var EnrichmentModule = {
|
|
|
5845
5898
|
command: "enrichment <command>",
|
|
5846
5899
|
aliases: ["enr"],
|
|
5847
5900
|
describe: "Commands for Context enrichments",
|
|
5848
|
-
builder: (
|
|
5901
|
+
builder: (yargs35) => yargs35.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
5849
5902
|
handler: () => {
|
|
5850
|
-
|
|
5903
|
+
yargs17.help();
|
|
5851
5904
|
}
|
|
5852
5905
|
};
|
|
5853
5906
|
|
|
5854
5907
|
// src/commands/context/commands/manifest.ts
|
|
5855
|
-
import
|
|
5908
|
+
import yargs18 from "yargs";
|
|
5856
5909
|
|
|
5857
5910
|
// src/commands/context/commands/manifest/get.ts
|
|
5858
5911
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -5863,10 +5916,10 @@ var ManifestGetModule = {
|
|
|
5863
5916
|
command: "get [output]",
|
|
5864
5917
|
aliases: ["dl", "download"],
|
|
5865
5918
|
describe: "Download the Uniform Context manifest for a project",
|
|
5866
|
-
builder: (
|
|
5919
|
+
builder: (yargs35) => withConfiguration(
|
|
5867
5920
|
withApiOptions(
|
|
5868
5921
|
withProjectOptions(
|
|
5869
|
-
|
|
5922
|
+
yargs35.option("preview", {
|
|
5870
5923
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
5871
5924
|
default: false,
|
|
5872
5925
|
type: "boolean",
|
|
@@ -5928,7 +5981,7 @@ import { exit as exit2 } from "process";
|
|
|
5928
5981
|
var ManifestPublishModule = {
|
|
5929
5982
|
command: "publish",
|
|
5930
5983
|
describe: "Publish the Uniform Context manifest for a project",
|
|
5931
|
-
builder: (
|
|
5984
|
+
builder: (yargs35) => withConfiguration(withApiOptions(withProjectOptions(yargs35))),
|
|
5932
5985
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
5933
5986
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5934
5987
|
try {
|
|
@@ -5961,25 +6014,25 @@ var ManifestModule = {
|
|
|
5961
6014
|
command: "manifest <command>",
|
|
5962
6015
|
describe: "Commands for context manifests",
|
|
5963
6016
|
aliases: ["man"],
|
|
5964
|
-
builder: (
|
|
6017
|
+
builder: (yargs35) => yargs35.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
5965
6018
|
handler: () => {
|
|
5966
|
-
|
|
6019
|
+
yargs18.help();
|
|
5967
6020
|
}
|
|
5968
6021
|
};
|
|
5969
6022
|
|
|
5970
6023
|
// src/commands/context/commands/quirk.ts
|
|
5971
|
-
import
|
|
6024
|
+
import yargs19 from "yargs";
|
|
5972
6025
|
|
|
5973
6026
|
// src/commands/context/commands/quirk/get.ts
|
|
5974
6027
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
5975
6028
|
var QuirkGetModule = {
|
|
5976
6029
|
command: "get <id>",
|
|
5977
6030
|
describe: "Fetch a quirk",
|
|
5978
|
-
builder: (
|
|
6031
|
+
builder: (yargs35) => withConfiguration(
|
|
5979
6032
|
withFormatOptions(
|
|
5980
6033
|
withApiOptions(
|
|
5981
6034
|
withProjectOptions(
|
|
5982
|
-
|
|
6035
|
+
yargs35.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
5983
6036
|
)
|
|
5984
6037
|
)
|
|
5985
6038
|
)
|
|
@@ -6003,11 +6056,11 @@ var QuirkListModule = {
|
|
|
6003
6056
|
command: "list",
|
|
6004
6057
|
describe: "List quirks",
|
|
6005
6058
|
aliases: ["ls"],
|
|
6006
|
-
builder: (
|
|
6059
|
+
builder: (yargs35) => withConfiguration(
|
|
6007
6060
|
withFormatOptions(
|
|
6008
6061
|
withApiOptions(
|
|
6009
6062
|
withProjectOptions(
|
|
6010
|
-
|
|
6063
|
+
yargs35.option("withIntegrations", {
|
|
6011
6064
|
alias: ["i"],
|
|
6012
6065
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
6013
6066
|
type: "boolean"
|
|
@@ -6065,11 +6118,11 @@ function createQuirkEngineDataSource({
|
|
|
6065
6118
|
var QuirkPullModule = {
|
|
6066
6119
|
command: "pull <directory>",
|
|
6067
6120
|
describe: "Pulls all quirks to local files in a directory",
|
|
6068
|
-
builder: (
|
|
6121
|
+
builder: (yargs35) => withConfiguration(
|
|
6069
6122
|
withApiOptions(
|
|
6070
6123
|
withProjectOptions(
|
|
6071
6124
|
withDiffOptions(
|
|
6072
|
-
|
|
6125
|
+
yargs35.positional("directory", {
|
|
6073
6126
|
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.",
|
|
6074
6127
|
type: "string"
|
|
6075
6128
|
}).option("format", {
|
|
@@ -6147,11 +6200,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
6147
6200
|
var QuirkPushModule = {
|
|
6148
6201
|
command: "push <directory>",
|
|
6149
6202
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
6150
|
-
builder: (
|
|
6203
|
+
builder: (yargs35) => withConfiguration(
|
|
6151
6204
|
withApiOptions(
|
|
6152
6205
|
withProjectOptions(
|
|
6153
6206
|
withDiffOptions(
|
|
6154
|
-
|
|
6207
|
+
yargs35.positional("directory", {
|
|
6155
6208
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
6156
6209
|
type: "string"
|
|
6157
6210
|
}).option("what-if", {
|
|
@@ -6218,10 +6271,10 @@ var QuirkRemoveModule = {
|
|
|
6218
6271
|
command: "remove <id>",
|
|
6219
6272
|
aliases: ["delete", "rm"],
|
|
6220
6273
|
describe: "Delete a quirk",
|
|
6221
|
-
builder: (
|
|
6274
|
+
builder: (yargs35) => withConfiguration(
|
|
6222
6275
|
withApiOptions(
|
|
6223
6276
|
withProjectOptions(
|
|
6224
|
-
|
|
6277
|
+
yargs35.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
6225
6278
|
)
|
|
6226
6279
|
)
|
|
6227
6280
|
),
|
|
@@ -6238,10 +6291,10 @@ var QuirkUpdateModule = {
|
|
|
6238
6291
|
command: "update <filename>",
|
|
6239
6292
|
aliases: ["put"],
|
|
6240
6293
|
describe: "Insert or update a quirk",
|
|
6241
|
-
builder: (
|
|
6294
|
+
builder: (yargs35) => withConfiguration(
|
|
6242
6295
|
withApiOptions(
|
|
6243
6296
|
withProjectOptions(
|
|
6244
|
-
|
|
6297
|
+
yargs35.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
6245
6298
|
)
|
|
6246
6299
|
)
|
|
6247
6300
|
),
|
|
@@ -6258,25 +6311,25 @@ var QuirkModule = {
|
|
|
6258
6311
|
command: "quirk <command>",
|
|
6259
6312
|
aliases: ["qk"],
|
|
6260
6313
|
describe: "Commands for Context quirks",
|
|
6261
|
-
builder: (
|
|
6314
|
+
builder: (yargs35) => yargs35.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
6262
6315
|
handler: () => {
|
|
6263
|
-
|
|
6316
|
+
yargs19.help();
|
|
6264
6317
|
}
|
|
6265
6318
|
};
|
|
6266
6319
|
|
|
6267
6320
|
// src/commands/context/commands/signal.ts
|
|
6268
|
-
import
|
|
6321
|
+
import yargs20 from "yargs";
|
|
6269
6322
|
|
|
6270
6323
|
// src/commands/context/commands/signal/get.ts
|
|
6271
6324
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
6272
6325
|
var SignalGetModule = {
|
|
6273
6326
|
command: "get <id>",
|
|
6274
6327
|
describe: "Fetch a signal",
|
|
6275
|
-
builder: (
|
|
6328
|
+
builder: (yargs35) => withConfiguration(
|
|
6276
6329
|
withFormatOptions(
|
|
6277
6330
|
withApiOptions(
|
|
6278
6331
|
withProjectOptions(
|
|
6279
|
-
|
|
6332
|
+
yargs35.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
6280
6333
|
)
|
|
6281
6334
|
)
|
|
6282
6335
|
)
|
|
@@ -6300,7 +6353,7 @@ var SignalListModule = {
|
|
|
6300
6353
|
command: "list",
|
|
6301
6354
|
describe: "List signals",
|
|
6302
6355
|
aliases: ["ls"],
|
|
6303
|
-
builder: (
|
|
6356
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
6304
6357
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6305
6358
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6306
6359
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6350,11 +6403,11 @@ function createSignalEngineDataSource({
|
|
|
6350
6403
|
var SignalPullModule = {
|
|
6351
6404
|
command: "pull <directory>",
|
|
6352
6405
|
describe: "Pulls all signals to local files in a directory",
|
|
6353
|
-
builder: (
|
|
6406
|
+
builder: (yargs35) => withConfiguration(
|
|
6354
6407
|
withApiOptions(
|
|
6355
6408
|
withProjectOptions(
|
|
6356
6409
|
withDiffOptions(
|
|
6357
|
-
|
|
6410
|
+
yargs35.positional("directory", {
|
|
6358
6411
|
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.",
|
|
6359
6412
|
type: "string"
|
|
6360
6413
|
}).option("format", {
|
|
@@ -6432,11 +6485,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
6432
6485
|
var SignalPushModule = {
|
|
6433
6486
|
command: "push <directory>",
|
|
6434
6487
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
6435
|
-
builder: (
|
|
6488
|
+
builder: (yargs35) => withConfiguration(
|
|
6436
6489
|
withApiOptions(
|
|
6437
6490
|
withProjectOptions(
|
|
6438
6491
|
withDiffOptions(
|
|
6439
|
-
|
|
6492
|
+
yargs35.positional("directory", {
|
|
6440
6493
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
6441
6494
|
type: "string"
|
|
6442
6495
|
}).option("what-if", {
|
|
@@ -6503,10 +6556,10 @@ var SignalRemoveModule = {
|
|
|
6503
6556
|
command: "remove <id>",
|
|
6504
6557
|
aliases: ["delete", "rm"],
|
|
6505
6558
|
describe: "Delete a signal",
|
|
6506
|
-
builder: (
|
|
6559
|
+
builder: (yargs35) => withConfiguration(
|
|
6507
6560
|
withApiOptions(
|
|
6508
6561
|
withProjectOptions(
|
|
6509
|
-
|
|
6562
|
+
yargs35.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
6510
6563
|
)
|
|
6511
6564
|
)
|
|
6512
6565
|
),
|
|
@@ -6523,10 +6576,10 @@ var SignalUpdateModule = {
|
|
|
6523
6576
|
command: "update <filename>",
|
|
6524
6577
|
aliases: ["put"],
|
|
6525
6578
|
describe: "Insert or update a signal",
|
|
6526
|
-
builder: (
|
|
6579
|
+
builder: (yargs35) => withConfiguration(
|
|
6527
6580
|
withApiOptions(
|
|
6528
6581
|
withProjectOptions(
|
|
6529
|
-
|
|
6582
|
+
yargs35.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
6530
6583
|
)
|
|
6531
6584
|
)
|
|
6532
6585
|
),
|
|
@@ -6543,25 +6596,25 @@ var SignalModule = {
|
|
|
6543
6596
|
command: "signal <command>",
|
|
6544
6597
|
aliases: ["sig"],
|
|
6545
6598
|
describe: "Commands for Context signals",
|
|
6546
|
-
builder: (
|
|
6599
|
+
builder: (yargs35) => yargs35.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
6547
6600
|
handler: () => {
|
|
6548
|
-
|
|
6601
|
+
yargs20.help();
|
|
6549
6602
|
}
|
|
6550
6603
|
};
|
|
6551
6604
|
|
|
6552
6605
|
// src/commands/context/commands/test.ts
|
|
6553
|
-
import
|
|
6606
|
+
import yargs21 from "yargs";
|
|
6554
6607
|
|
|
6555
6608
|
// src/commands/context/commands/test/get.ts
|
|
6556
6609
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
6557
6610
|
var TestGetModule = {
|
|
6558
6611
|
command: "get <id>",
|
|
6559
6612
|
describe: "Fetch a test",
|
|
6560
|
-
builder: (
|
|
6613
|
+
builder: (yargs35) => withConfiguration(
|
|
6561
6614
|
withFormatOptions(
|
|
6562
6615
|
withApiOptions(
|
|
6563
6616
|
withProjectOptions(
|
|
6564
|
-
|
|
6617
|
+
yargs35.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
6565
6618
|
)
|
|
6566
6619
|
)
|
|
6567
6620
|
)
|
|
@@ -6585,7 +6638,7 @@ var TestListModule = {
|
|
|
6585
6638
|
command: "list",
|
|
6586
6639
|
describe: "List tests",
|
|
6587
6640
|
aliases: ["ls"],
|
|
6588
|
-
builder: (
|
|
6641
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
6589
6642
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6590
6643
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6591
6644
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6635,11 +6688,11 @@ function createTestEngineDataSource({
|
|
|
6635
6688
|
var TestPullModule = {
|
|
6636
6689
|
command: "pull <directory>",
|
|
6637
6690
|
describe: "Pulls all tests to local files in a directory",
|
|
6638
|
-
builder: (
|
|
6691
|
+
builder: (yargs35) => withConfiguration(
|
|
6639
6692
|
withApiOptions(
|
|
6640
6693
|
withProjectOptions(
|
|
6641
6694
|
withDiffOptions(
|
|
6642
|
-
|
|
6695
|
+
yargs35.positional("directory", {
|
|
6643
6696
|
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.",
|
|
6644
6697
|
type: "string"
|
|
6645
6698
|
}).option("format", {
|
|
@@ -6717,11 +6770,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
6717
6770
|
var TestPushModule = {
|
|
6718
6771
|
command: "push <directory>",
|
|
6719
6772
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
6720
|
-
builder: (
|
|
6773
|
+
builder: (yargs35) => withConfiguration(
|
|
6721
6774
|
withApiOptions(
|
|
6722
6775
|
withProjectOptions(
|
|
6723
6776
|
withDiffOptions(
|
|
6724
|
-
|
|
6777
|
+
yargs35.positional("directory", {
|
|
6725
6778
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
6726
6779
|
type: "string"
|
|
6727
6780
|
}).option("what-if", {
|
|
@@ -6788,10 +6841,10 @@ var TestRemoveModule = {
|
|
|
6788
6841
|
command: "remove <id>",
|
|
6789
6842
|
aliases: ["delete", "rm"],
|
|
6790
6843
|
describe: "Delete a test",
|
|
6791
|
-
builder: (
|
|
6844
|
+
builder: (yargs35) => withConfiguration(
|
|
6792
6845
|
withApiOptions(
|
|
6793
6846
|
withProjectOptions(
|
|
6794
|
-
|
|
6847
|
+
yargs35.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
6795
6848
|
)
|
|
6796
6849
|
)
|
|
6797
6850
|
),
|
|
@@ -6808,9 +6861,9 @@ var TestUpdateModule = {
|
|
|
6808
6861
|
command: "update <filename>",
|
|
6809
6862
|
aliases: ["put"],
|
|
6810
6863
|
describe: "Insert or update a test",
|
|
6811
|
-
builder: (
|
|
6864
|
+
builder: (yargs35) => withConfiguration(
|
|
6812
6865
|
withApiOptions(
|
|
6813
|
-
withProjectOptions(
|
|
6866
|
+
withProjectOptions(yargs35.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
6814
6867
|
)
|
|
6815
6868
|
),
|
|
6816
6869
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -6825,9 +6878,9 @@ var TestUpdateModule = {
|
|
|
6825
6878
|
var TestModule = {
|
|
6826
6879
|
command: "test <command>",
|
|
6827
6880
|
describe: "Commands for Context A/B tests",
|
|
6828
|
-
builder: (
|
|
6881
|
+
builder: (yargs35) => yargs35.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
6829
6882
|
handler: () => {
|
|
6830
|
-
|
|
6883
|
+
yargs21.help();
|
|
6831
6884
|
}
|
|
6832
6885
|
};
|
|
6833
6886
|
|
|
@@ -6836,23 +6889,23 @@ var ContextCommand = {
|
|
|
6836
6889
|
command: "context <command>",
|
|
6837
6890
|
aliases: ["ctx"],
|
|
6838
6891
|
describe: "Uniform Context commands",
|
|
6839
|
-
builder: (
|
|
6892
|
+
builder: (yargs35) => yargs35.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
6840
6893
|
handler: () => {
|
|
6841
|
-
|
|
6894
|
+
yargs22.showHelp();
|
|
6842
6895
|
}
|
|
6843
6896
|
};
|
|
6844
6897
|
|
|
6845
6898
|
// src/commands/integration/index.ts
|
|
6846
|
-
import
|
|
6899
|
+
import yargs25 from "yargs";
|
|
6847
6900
|
|
|
6848
6901
|
// src/commands/integration/commands/definition.ts
|
|
6849
|
-
import
|
|
6902
|
+
import yargs24 from "yargs";
|
|
6850
6903
|
|
|
6851
6904
|
// src/commands/integration/commands/definition/edgehancer/edgehancer.ts
|
|
6852
|
-
import
|
|
6905
|
+
import yargs23 from "yargs";
|
|
6853
6906
|
|
|
6854
6907
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
6855
|
-
import { readFileSync
|
|
6908
|
+
import { readFileSync } from "fs";
|
|
6856
6909
|
|
|
6857
6910
|
// src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
|
|
6858
6911
|
import { createLimitPolicy } from "@uniformdev/canvas";
|
|
@@ -6887,8 +6940,8 @@ var EdgehancerClient = class extends ApiClient {
|
|
|
6887
6940
|
};
|
|
6888
6941
|
|
|
6889
6942
|
// src/commands/integration/commands/definition/edgehancer/util.ts
|
|
6890
|
-
function withEdgehancerIdOptions(
|
|
6891
|
-
return
|
|
6943
|
+
function withEdgehancerIdOptions(yargs35) {
|
|
6944
|
+
return yargs35.option("connectorType", {
|
|
6892
6945
|
describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
|
|
6893
6946
|
demandOption: true,
|
|
6894
6947
|
type: "string"
|
|
@@ -6908,11 +6961,11 @@ function withEdgehancerIdOptions(yargs34) {
|
|
|
6908
6961
|
var IntegrationEdgehancerDeployModule = {
|
|
6909
6962
|
command: "deploy <filename>",
|
|
6910
6963
|
describe: "Deploys a custom edgehancer hook to run when a data resource of a specific archetype is fetched. The API key used must have team admin permissions.",
|
|
6911
|
-
builder: (
|
|
6964
|
+
builder: (yargs35) => withConfiguration(
|
|
6912
6965
|
withApiOptions(
|
|
6913
6966
|
withTeamOptions(
|
|
6914
6967
|
withEdgehancerIdOptions(
|
|
6915
|
-
|
|
6968
|
+
yargs35.positional("filename", {
|
|
6916
6969
|
demandOption: true,
|
|
6917
6970
|
describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
|
|
6918
6971
|
})
|
|
@@ -6923,7 +6976,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6923
6976
|
handler: async ({ apiHost, apiKey, proxy, filename, team: teamId, archetype, connectorType, hook }) => {
|
|
6924
6977
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6925
6978
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
6926
|
-
const code =
|
|
6979
|
+
const code = readFileSync(filename, "utf8");
|
|
6927
6980
|
await client.deploy({ archetype, code, connectorType, hook });
|
|
6928
6981
|
}
|
|
6929
6982
|
};
|
|
@@ -6932,7 +6985,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6932
6985
|
var IntegrationEdgehancerRemoveModule = {
|
|
6933
6986
|
command: "remove",
|
|
6934
6987
|
describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
|
|
6935
|
-
builder: (
|
|
6988
|
+
builder: (yargs35) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs35)))),
|
|
6936
6989
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
|
|
6937
6990
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6938
6991
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
@@ -6944,9 +6997,9 @@ var IntegrationEdgehancerRemoveModule = {
|
|
|
6944
6997
|
var IntegrationEdgehancerModule = {
|
|
6945
6998
|
command: "edgehancer <command>",
|
|
6946
6999
|
describe: "Commands for managing custom integration edgehancers at the team level.",
|
|
6947
|
-
builder: (
|
|
7000
|
+
builder: (yargs35) => yargs35.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
|
|
6948
7001
|
handler: () => {
|
|
6949
|
-
|
|
7002
|
+
yargs23.help();
|
|
6950
7003
|
}
|
|
6951
7004
|
};
|
|
6952
7005
|
|
|
@@ -6986,10 +7039,10 @@ var DefinitionClient = class extends ApiClient2 {
|
|
|
6986
7039
|
var IntegrationDefinitionRegisterModule = {
|
|
6987
7040
|
command: "register <filename>",
|
|
6988
7041
|
describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
|
|
6989
|
-
builder: (
|
|
7042
|
+
builder: (yargs35) => withConfiguration(
|
|
6990
7043
|
withApiOptions(
|
|
6991
7044
|
withTeamOptions(
|
|
6992
|
-
|
|
7045
|
+
yargs35.positional("filename", {
|
|
6993
7046
|
demandOption: true,
|
|
6994
7047
|
describe: "Integration definition manifest to register"
|
|
6995
7048
|
})
|
|
@@ -7008,10 +7061,10 @@ var IntegrationDefinitionRegisterModule = {
|
|
|
7008
7061
|
var IntegrationDefinitionRemoveModule = {
|
|
7009
7062
|
command: "remove <type>",
|
|
7010
7063
|
describe: "Deletes a custom integration definition from a team. This will uninstall it on any active projects. Existing usages of the integration may break. The API key used must have team admin permissions.",
|
|
7011
|
-
builder: (
|
|
7064
|
+
builder: (yargs35) => withConfiguration(
|
|
7012
7065
|
withApiOptions(
|
|
7013
7066
|
withTeamOptions(
|
|
7014
|
-
|
|
7067
|
+
yargs35.positional("type", {
|
|
7015
7068
|
demandOption: true,
|
|
7016
7069
|
describe: "Integration type (from its manifest) to remove."
|
|
7017
7070
|
})
|
|
@@ -7029,9 +7082,9 @@ var IntegrationDefinitionRemoveModule = {
|
|
|
7029
7082
|
var IntegrationDefinitionModule = {
|
|
7030
7083
|
command: "definition <command>",
|
|
7031
7084
|
describe: "Commands for managing custom integration definitions at the team level.",
|
|
7032
|
-
builder: (
|
|
7085
|
+
builder: (yargs35) => yargs35.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).demandCommand(),
|
|
7033
7086
|
handler: () => {
|
|
7034
|
-
|
|
7087
|
+
yargs24.help();
|
|
7035
7088
|
}
|
|
7036
7089
|
};
|
|
7037
7090
|
|
|
@@ -7071,10 +7124,10 @@ var InstallClient = class extends ApiClient3 {
|
|
|
7071
7124
|
var IntegrationInstallModule = {
|
|
7072
7125
|
command: "install <type>",
|
|
7073
7126
|
describe: "Installs an integration to a project. The integration may be built-in or custom. Custom integrations must be registered to the parent team first.",
|
|
7074
|
-
builder: (
|
|
7127
|
+
builder: (yargs35) => withConfiguration(
|
|
7075
7128
|
withApiOptions(
|
|
7076
7129
|
withProjectOptions(
|
|
7077
|
-
|
|
7130
|
+
yargs35.positional("type", {
|
|
7078
7131
|
demandOption: true,
|
|
7079
7132
|
describe: "Integration type to install (as defined in its manifest)"
|
|
7080
7133
|
}).option("configuration", {
|
|
@@ -7096,10 +7149,10 @@ var IntegrationInstallModule = {
|
|
|
7096
7149
|
var IntegrationUninstallModule = {
|
|
7097
7150
|
command: "uninstall <type>",
|
|
7098
7151
|
describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
|
|
7099
|
-
builder: (
|
|
7152
|
+
builder: (yargs35) => withConfiguration(
|
|
7100
7153
|
withApiOptions(
|
|
7101
7154
|
withProjectOptions(
|
|
7102
|
-
|
|
7155
|
+
yargs35.positional("type", {
|
|
7103
7156
|
demandOption: true,
|
|
7104
7157
|
describe: "Integration type to uninstall (as defined in its manifest)"
|
|
7105
7158
|
})
|
|
@@ -7117,9 +7170,9 @@ var IntegrationUninstallModule = {
|
|
|
7117
7170
|
var IntegrationCommand = {
|
|
7118
7171
|
command: "integration <command>",
|
|
7119
7172
|
describe: "Integration management commands",
|
|
7120
|
-
builder: (
|
|
7173
|
+
builder: (yargs35) => yargs35.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
|
|
7121
7174
|
handler: () => {
|
|
7122
|
-
|
|
7175
|
+
yargs25.showHelp();
|
|
7123
7176
|
}
|
|
7124
7177
|
};
|
|
7125
7178
|
|
|
@@ -7131,7 +7184,7 @@ var makeSpinner = () => {
|
|
|
7131
7184
|
const spin = async (text) => {
|
|
7132
7185
|
const spinner = ora(text).start();
|
|
7133
7186
|
spinners.push(spinner);
|
|
7134
|
-
const minWait = new Promise((
|
|
7187
|
+
const minWait = new Promise((resolve) => setTimeout(resolve, 500));
|
|
7135
7188
|
return async () => {
|
|
7136
7189
|
await minWait;
|
|
7137
7190
|
spinner.stop();
|
|
@@ -7147,10 +7200,20 @@ import { PostHog } from "posthog-node";
|
|
|
7147
7200
|
// package.json
|
|
7148
7201
|
var package_default = {
|
|
7149
7202
|
name: "@uniformdev/cli",
|
|
7150
|
-
version: "19.
|
|
7203
|
+
version: "19.164.0",
|
|
7151
7204
|
description: "Uniform command line interface tool",
|
|
7152
7205
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
7153
7206
|
main: "./cli.js",
|
|
7207
|
+
exports: {
|
|
7208
|
+
".": {
|
|
7209
|
+
types: "./dist/index.d.mts",
|
|
7210
|
+
default: "./cli.js"
|
|
7211
|
+
},
|
|
7212
|
+
"./config": {
|
|
7213
|
+
types: "./dist/defaultConfig.d.mts",
|
|
7214
|
+
default: "./dist/defaultConfig.mjs"
|
|
7215
|
+
}
|
|
7216
|
+
},
|
|
7154
7217
|
types: "./dist/index.d.mts",
|
|
7155
7218
|
sideEffects: false,
|
|
7156
7219
|
scripts: {
|
|
@@ -7172,7 +7235,7 @@ var package_default = {
|
|
|
7172
7235
|
"@uniformdev/redirect": "workspace:*",
|
|
7173
7236
|
"call-bind": "^1.0.2",
|
|
7174
7237
|
colorette: "2.0.20",
|
|
7175
|
-
cosmiconfig: "
|
|
7238
|
+
cosmiconfig: "9.0.0",
|
|
7176
7239
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
7177
7240
|
diff: "^5.0.0",
|
|
7178
7241
|
dotenv: "^16.0.3",
|
|
@@ -7249,8 +7312,7 @@ var Telemetry = class {
|
|
|
7249
7312
|
this.send("logged in");
|
|
7250
7313
|
}
|
|
7251
7314
|
send(event, properties = {}) {
|
|
7252
|
-
|
|
7253
|
-
(_a = this.posthog) == null ? void 0 : _a.capture({
|
|
7315
|
+
this.posthog?.capture({
|
|
7254
7316
|
distinctId: this.distinctId,
|
|
7255
7317
|
event: [this.prefix, event].join(" "),
|
|
7256
7318
|
properties: {
|
|
@@ -7260,9 +7322,8 @@ var Telemetry = class {
|
|
|
7260
7322
|
});
|
|
7261
7323
|
}
|
|
7262
7324
|
shutdown() {
|
|
7263
|
-
var _a;
|
|
7264
7325
|
this.send("exited", { exitCode: process.exitCode });
|
|
7265
|
-
return
|
|
7326
|
+
return this.posthog?.shutdown();
|
|
7266
7327
|
}
|
|
7267
7328
|
};
|
|
7268
7329
|
|
|
@@ -7275,7 +7336,7 @@ import jwt from "jsonwebtoken";
|
|
|
7275
7336
|
import open from "open";
|
|
7276
7337
|
|
|
7277
7338
|
// src/url.ts
|
|
7278
|
-
var makeUrl = (baseUrl,
|
|
7339
|
+
var makeUrl = (baseUrl, path4) => [baseUrl.trim().replace(/\/+$/, ""), path4.trim().replace(/^\/+/, "")].join("/");
|
|
7279
7340
|
|
|
7280
7341
|
// src/auth/getBearerToken.ts
|
|
7281
7342
|
async function getBearerToken(baseUrl) {
|
|
@@ -7380,8 +7441,8 @@ var getLimitsSchema = z.object({
|
|
|
7380
7441
|
})
|
|
7381
7442
|
});
|
|
7382
7443
|
var createClient = (baseUrl, authToken) => {
|
|
7383
|
-
const request2 = async (
|
|
7384
|
-
const res = await fetch(makeUrl(baseUrl,
|
|
7444
|
+
const request2 = async (path4, opts, allowedNon2xxStatusCodes = []) => {
|
|
7445
|
+
const res = await fetch(makeUrl(baseUrl, path4), {
|
|
7385
7446
|
...opts,
|
|
7386
7447
|
headers: { Authorization: `Bearer ${authToken}` }
|
|
7387
7448
|
});
|
|
@@ -7389,18 +7450,18 @@ var createClient = (baseUrl, authToken) => {
|
|
|
7389
7450
|
return res;
|
|
7390
7451
|
} else {
|
|
7391
7452
|
throw new Error(
|
|
7392
|
-
`Non-2xx API response: ${opts.method} ${
|
|
7453
|
+
`Non-2xx API response: ${opts.method} ${path4} responded with ${res.status} ${res.statusText}`
|
|
7393
7454
|
);
|
|
7394
7455
|
}
|
|
7395
7456
|
};
|
|
7396
|
-
const requestJson = async (
|
|
7397
|
-
const res = await request2(
|
|
7457
|
+
const requestJson = async (path4, opts, schema2, allowedNon2xxStatusCodes = []) => {
|
|
7458
|
+
const res = await request2(path4, opts, allowedNon2xxStatusCodes);
|
|
7398
7459
|
const data = await res.json();
|
|
7399
7460
|
const parseResult = schema2.safeParse(data);
|
|
7400
7461
|
if (parseResult.success) {
|
|
7401
7462
|
return parseResult.data;
|
|
7402
7463
|
} else {
|
|
7403
|
-
throw new Error(`Invalid ${opts.method} ${
|
|
7464
|
+
throw new Error(`Invalid ${opts.method} ${path4} response: ${parseResult.error.message}`);
|
|
7404
7465
|
}
|
|
7405
7466
|
};
|
|
7406
7467
|
return {
|
|
@@ -7522,7 +7583,7 @@ var runNpm = async (workDir, args, { inherit, env } = {}) => {
|
|
|
7522
7583
|
${err.message}`);
|
|
7523
7584
|
}
|
|
7524
7585
|
if (result.exitCode !== 0) {
|
|
7525
|
-
throw new Error(`Command npm ${args.join(" ")} exitted with code ${result
|
|
7586
|
+
throw new Error(`Command npm ${args.join(" ")} exitted with code ${result?.exitCode}}: ${result.stderr}`);
|
|
7526
7587
|
}
|
|
7527
7588
|
return result.stdout;
|
|
7528
7589
|
};
|
|
@@ -7534,7 +7595,7 @@ import fsj2 from "fs-jetpack";
|
|
|
7534
7595
|
import * as git from "isomorphic-git";
|
|
7535
7596
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
7536
7597
|
import os from "os";
|
|
7537
|
-
import
|
|
7598
|
+
import path from "path";
|
|
7538
7599
|
async function cloneStarter({
|
|
7539
7600
|
spin,
|
|
7540
7601
|
githubPath,
|
|
@@ -7542,7 +7603,7 @@ async function cloneStarter({
|
|
|
7542
7603
|
dotEnvFile
|
|
7543
7604
|
}) {
|
|
7544
7605
|
const done = await spin("Fetching starter code...");
|
|
7545
|
-
const cloneDir =
|
|
7606
|
+
const cloneDir = path.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
7546
7607
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
7547
7608
|
try {
|
|
7548
7609
|
await git.clone({
|
|
@@ -7560,10 +7621,10 @@ async function cloneStarter({
|
|
|
7560
7621
|
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
7561
7622
|
throw new Error(`"${targetDir}" is not empty`);
|
|
7562
7623
|
}
|
|
7563
|
-
const starterDir =
|
|
7624
|
+
const starterDir = path.join(cloneDir, ...pathSegments);
|
|
7564
7625
|
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
7565
7626
|
if (dotEnvFile) {
|
|
7566
|
-
fs3.writeFileSync(
|
|
7627
|
+
fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
7567
7628
|
}
|
|
7568
7629
|
console.log(`
|
|
7569
7630
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -7579,9 +7640,9 @@ Installing project dependencies...
|
|
|
7579
7640
|
}
|
|
7580
7641
|
|
|
7581
7642
|
// src/projects/getOrCreateProject.ts
|
|
7582
|
-
import fs4, { existsSync as existsSync2, mkdirSync as
|
|
7643
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
7583
7644
|
import inquirer2 from "inquirer";
|
|
7584
|
-
import
|
|
7645
|
+
import path2 from "path";
|
|
7585
7646
|
import slugify from "slugify";
|
|
7586
7647
|
var newProjectId = "$new";
|
|
7587
7648
|
async function getOrCreateProject({
|
|
@@ -7676,8 +7737,7 @@ async function chooseExistingProject({
|
|
|
7676
7737
|
teamId,
|
|
7677
7738
|
user
|
|
7678
7739
|
}) {
|
|
7679
|
-
|
|
7680
|
-
const projects = (((_a = user.teams.find((t) => t.team.id === teamId)) == null ? void 0 : _a.team.sites) ?? []).map((t) => ({
|
|
7740
|
+
const projects = (user.teams.find((t) => t.team.id === teamId)?.team.sites ?? []).map((t) => ({
|
|
7681
7741
|
name: t.name,
|
|
7682
7742
|
value: t.id
|
|
7683
7743
|
}));
|
|
@@ -7692,7 +7752,7 @@ async function chooseExistingProject({
|
|
|
7692
7752
|
]);
|
|
7693
7753
|
return {
|
|
7694
7754
|
projectId: result.projectId,
|
|
7695
|
-
projectName:
|
|
7755
|
+
projectName: projects.find((p) => p.value === result.projectId)?.name
|
|
7696
7756
|
};
|
|
7697
7757
|
}
|
|
7698
7758
|
function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
@@ -7704,10 +7764,10 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
7704
7764
|
if (checkTargetDir) {
|
|
7705
7765
|
let targetDir = explicitTargetDir ?? process.cwd();
|
|
7706
7766
|
if (!existsSync2(targetDir)) {
|
|
7707
|
-
|
|
7767
|
+
mkdirSync2(targetDir, { recursive: true });
|
|
7708
7768
|
}
|
|
7709
7769
|
if (fs4.readdirSync(targetDir).length > 0) {
|
|
7710
|
-
targetDir =
|
|
7770
|
+
targetDir = path2.resolve(targetDir, projectNameSlug);
|
|
7711
7771
|
if (fs4.existsSync(targetDir)) {
|
|
7712
7772
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
7713
7773
|
}
|
|
@@ -7961,9 +8021,9 @@ npm run dev
|
|
|
7961
8021
|
}
|
|
7962
8022
|
|
|
7963
8023
|
// src/commands/new/commands/new-mesh-integration.ts
|
|
7964
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
8024
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
7965
8025
|
import inquirer5 from "inquirer";
|
|
7966
|
-
import
|
|
8026
|
+
import path3 from "path";
|
|
7967
8027
|
import slugify2 from "slugify";
|
|
7968
8028
|
async function newMeshIntegrationHandler({
|
|
7969
8029
|
spin,
|
|
@@ -8004,19 +8064,19 @@ async function newMeshIntegrationHandler({
|
|
|
8004
8064
|
targetDir
|
|
8005
8065
|
});
|
|
8006
8066
|
let done = await spin("Registering integration to team...");
|
|
8007
|
-
const pathToManifest =
|
|
8067
|
+
const pathToManifest = path3.resolve(targetDir, "mesh-manifest.json");
|
|
8008
8068
|
if (!existsSync3(pathToManifest)) {
|
|
8009
8069
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
8010
8070
|
}
|
|
8011
|
-
const manifestContents =
|
|
8071
|
+
const manifestContents = readFileSync2(pathToManifest, "utf-8");
|
|
8012
8072
|
const manifestJson = JSON.parse(manifestContents);
|
|
8013
8073
|
manifestJson.type = typeSlug;
|
|
8014
8074
|
manifestJson.displayName = name;
|
|
8015
|
-
|
|
8016
|
-
const packageJsonPath =
|
|
8017
|
-
const packageJson = JSON.parse(
|
|
8075
|
+
writeFileSync(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
|
|
8076
|
+
const packageJsonPath = path3.resolve(targetDir, "package.json");
|
|
8077
|
+
const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
|
|
8018
8078
|
packageJson.name = typeSlug;
|
|
8019
|
-
|
|
8079
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
8020
8080
|
const fullMeshAppKey = await uniformClient.registerMeshIntegration({ teamId, manifest: manifestJson });
|
|
8021
8081
|
await done();
|
|
8022
8082
|
await runNpmInstall();
|
|
@@ -8060,10 +8120,10 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
|
|
|
8060
8120
|
}
|
|
8061
8121
|
let targetDir = explicitOutputPath ?? process.cwd();
|
|
8062
8122
|
if (!existsSync3(targetDir)) {
|
|
8063
|
-
|
|
8123
|
+
mkdirSync3(targetDir, { recursive: true });
|
|
8064
8124
|
}
|
|
8065
8125
|
if (readdirSync(targetDir).length > 0) {
|
|
8066
|
-
targetDir =
|
|
8126
|
+
targetDir = path3.resolve(targetDir, typeSlug);
|
|
8067
8127
|
if (existsSync3(targetDir)) {
|
|
8068
8128
|
throw new Error(`${targetDir} directory already exists, choose a different name.`);
|
|
8069
8129
|
}
|
|
@@ -8156,10 +8216,10 @@ var NewMeshCmd = {
|
|
|
8156
8216
|
};
|
|
8157
8217
|
|
|
8158
8218
|
// src/commands/optimize/index.ts
|
|
8159
|
-
import
|
|
8219
|
+
import yargs27 from "yargs";
|
|
8160
8220
|
|
|
8161
8221
|
// src/commands/optimize/manifest.ts
|
|
8162
|
-
import
|
|
8222
|
+
import yargs26 from "yargs";
|
|
8163
8223
|
|
|
8164
8224
|
// src/commands/optimize/manifest/download.ts
|
|
8165
8225
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -8174,7 +8234,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
8174
8234
|
var module = {
|
|
8175
8235
|
command: "download [output]",
|
|
8176
8236
|
describe: "Download intent manifest",
|
|
8177
|
-
builder: (
|
|
8237
|
+
builder: (yargs35) => yargs35.option("apiKey", {
|
|
8178
8238
|
alias: "k",
|
|
8179
8239
|
demandOption: true,
|
|
8180
8240
|
string: true,
|
|
@@ -8275,10 +8335,10 @@ var module2 = {
|
|
|
8275
8335
|
command: "manifest <command>",
|
|
8276
8336
|
describe: "Intent manifest commands",
|
|
8277
8337
|
builder: () => {
|
|
8278
|
-
return
|
|
8338
|
+
return yargs26.command(download_default);
|
|
8279
8339
|
},
|
|
8280
8340
|
handler: () => {
|
|
8281
|
-
|
|
8341
|
+
yargs26.showHelp();
|
|
8282
8342
|
}
|
|
8283
8343
|
};
|
|
8284
8344
|
var manifest_default = module2;
|
|
@@ -8289,29 +8349,29 @@ var OptimizeCommand = {
|
|
|
8289
8349
|
aliases: ["opt"],
|
|
8290
8350
|
describe: "Uniform Optimize commands",
|
|
8291
8351
|
builder: () => {
|
|
8292
|
-
return
|
|
8352
|
+
return yargs27.command(manifest_default);
|
|
8293
8353
|
},
|
|
8294
8354
|
handler: () => {
|
|
8295
|
-
|
|
8355
|
+
yargs27.showHelp();
|
|
8296
8356
|
}
|
|
8297
8357
|
};
|
|
8298
8358
|
|
|
8299
8359
|
// src/commands/project-map/index.ts
|
|
8300
|
-
import
|
|
8360
|
+
import yargs30 from "yargs";
|
|
8301
8361
|
|
|
8302
8362
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
8303
|
-
import
|
|
8363
|
+
import yargs28 from "yargs";
|
|
8304
8364
|
|
|
8305
8365
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
8306
8366
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
8307
8367
|
var ProjectMapDefinitionGetModule = {
|
|
8308
8368
|
command: "get <id>",
|
|
8309
8369
|
describe: "Fetch a project map",
|
|
8310
|
-
builder: (
|
|
8370
|
+
builder: (yargs35) => withFormatOptions(
|
|
8311
8371
|
withConfiguration(
|
|
8312
8372
|
withApiOptions(
|
|
8313
8373
|
withProjectOptions(
|
|
8314
|
-
|
|
8374
|
+
yargs35.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
8315
8375
|
)
|
|
8316
8376
|
)
|
|
8317
8377
|
)
|
|
@@ -8335,7 +8395,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
8335
8395
|
command: "list",
|
|
8336
8396
|
describe: "List of project maps",
|
|
8337
8397
|
aliases: ["ls"],
|
|
8338
|
-
builder: (
|
|
8398
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
8339
8399
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8340
8400
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8341
8401
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8393,11 +8453,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8393
8453
|
var ProjectMapDefinitionPullModule = {
|
|
8394
8454
|
command: "pull <directory>",
|
|
8395
8455
|
describe: "Pulls all project maps to local files in a directory",
|
|
8396
|
-
builder: (
|
|
8456
|
+
builder: (yargs35) => withConfiguration(
|
|
8397
8457
|
withApiOptions(
|
|
8398
8458
|
withProjectOptions(
|
|
8399
8459
|
withDiffOptions(
|
|
8400
|
-
|
|
8460
|
+
yargs35.positional("directory", {
|
|
8401
8461
|
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.",
|
|
8402
8462
|
type: "string"
|
|
8403
8463
|
}).option("format", {
|
|
@@ -8475,11 +8535,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
8475
8535
|
var ProjectMapDefinitionPushModule = {
|
|
8476
8536
|
command: "push <directory>",
|
|
8477
8537
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
8478
|
-
builder: (
|
|
8538
|
+
builder: (yargs35) => withConfiguration(
|
|
8479
8539
|
withApiOptions(
|
|
8480
8540
|
withProjectOptions(
|
|
8481
8541
|
withDiffOptions(
|
|
8482
|
-
|
|
8542
|
+
yargs35.positional("directory", {
|
|
8483
8543
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8484
8544
|
type: "string"
|
|
8485
8545
|
}).option("what-if", {
|
|
@@ -8546,9 +8606,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
8546
8606
|
command: "remove <id>",
|
|
8547
8607
|
aliases: ["delete", "rm"],
|
|
8548
8608
|
describe: "Delete a project map",
|
|
8549
|
-
builder: (
|
|
8609
|
+
builder: (yargs35) => withConfiguration(
|
|
8550
8610
|
withApiOptions(
|
|
8551
|
-
withProjectOptions(
|
|
8611
|
+
withProjectOptions(yargs35.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8552
8612
|
)
|
|
8553
8613
|
),
|
|
8554
8614
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8564,10 +8624,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8564
8624
|
command: "update <filename>",
|
|
8565
8625
|
aliases: ["put"],
|
|
8566
8626
|
describe: "Insert or update a project map",
|
|
8567
|
-
builder: (
|
|
8627
|
+
builder: (yargs35) => withConfiguration(
|
|
8568
8628
|
withApiOptions(
|
|
8569
8629
|
withProjectOptions(
|
|
8570
|
-
|
|
8630
|
+
yargs35.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
8571
8631
|
)
|
|
8572
8632
|
)
|
|
8573
8633
|
),
|
|
@@ -8583,36 +8643,35 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8583
8643
|
var ProjectMapDefinitionModule = {
|
|
8584
8644
|
command: "definition <command>",
|
|
8585
8645
|
describe: "Commands for ProjectMap Definitions",
|
|
8586
|
-
builder: (
|
|
8646
|
+
builder: (yargs35) => yargs35.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
8587
8647
|
handler: () => {
|
|
8588
|
-
|
|
8648
|
+
yargs28.help();
|
|
8589
8649
|
}
|
|
8590
8650
|
};
|
|
8591
8651
|
|
|
8592
8652
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
8593
|
-
import
|
|
8653
|
+
import yargs29 from "yargs";
|
|
8594
8654
|
|
|
8595
8655
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
8596
8656
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
8597
8657
|
var ProjectMapNodeGetModule = {
|
|
8598
8658
|
command: "get <id> <projectMapId>",
|
|
8599
8659
|
describe: "Fetch a project map node",
|
|
8600
|
-
builder: (
|
|
8660
|
+
builder: (yargs35) => withConfiguration(
|
|
8601
8661
|
withFormatOptions(
|
|
8602
8662
|
withApiOptions(
|
|
8603
8663
|
withProjectOptions(
|
|
8604
|
-
|
|
8664
|
+
yargs35.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
8605
8665
|
)
|
|
8606
8666
|
)
|
|
8607
8667
|
)
|
|
8608
8668
|
),
|
|
8609
8669
|
handler: async ({ apiHost, apiKey, proxy, id, projectMapId, format, project: projectId, filename }) => {
|
|
8610
|
-
var _a;
|
|
8611
8670
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8612
8671
|
const client = new UncachedProjectMapClient7({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
8613
8672
|
console.log("Debugging params for node get", { projectMapId, id, projectId });
|
|
8614
8673
|
const res = await client.getNodes({ projectMapId, id });
|
|
8615
|
-
if (
|
|
8674
|
+
if (res.nodes?.length === 0) {
|
|
8616
8675
|
console.error("Project map node does not exist");
|
|
8617
8676
|
process.exit(1);
|
|
8618
8677
|
} else {
|
|
@@ -8627,12 +8686,12 @@ var ProjectMapNodeListModule = {
|
|
|
8627
8686
|
command: "list <projectMapId>",
|
|
8628
8687
|
describe: "List project map nodes",
|
|
8629
8688
|
aliases: ["ls"],
|
|
8630
|
-
builder: (
|
|
8689
|
+
builder: (yargs35) => withConfiguration(
|
|
8631
8690
|
withFormatOptions(
|
|
8632
8691
|
withApiOptions(
|
|
8633
8692
|
withProjectOptions(
|
|
8634
8693
|
withStateOptions(
|
|
8635
|
-
|
|
8694
|
+
yargs35.positional("projectMapId", {
|
|
8636
8695
|
demandOption: true,
|
|
8637
8696
|
describe: "ProjectMap UUID to fetch from"
|
|
8638
8697
|
})
|
|
@@ -8705,11 +8764,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8705
8764
|
var ProjectMapNodePullModule = {
|
|
8706
8765
|
command: "pull <directory>",
|
|
8707
8766
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
8708
|
-
builder: (
|
|
8767
|
+
builder: (yargs35) => withConfiguration(
|
|
8709
8768
|
withApiOptions(
|
|
8710
8769
|
withProjectOptions(
|
|
8711
8770
|
withDiffOptions(
|
|
8712
|
-
|
|
8771
|
+
yargs35.positional("directory", {
|
|
8713
8772
|
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.",
|
|
8714
8773
|
type: "string"
|
|
8715
8774
|
}).option("format", {
|
|
@@ -8791,11 +8850,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
8791
8850
|
var ProjectMapNodePushModule = {
|
|
8792
8851
|
command: "push <directory>",
|
|
8793
8852
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
8794
|
-
builder: (
|
|
8853
|
+
builder: (yargs35) => withConfiguration(
|
|
8795
8854
|
withApiOptions(
|
|
8796
8855
|
withProjectOptions(
|
|
8797
8856
|
withDiffOptions(
|
|
8798
|
-
|
|
8857
|
+
yargs35.positional("directory", {
|
|
8799
8858
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8800
8859
|
type: "string"
|
|
8801
8860
|
}).option("what-if", {
|
|
@@ -8871,10 +8930,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
8871
8930
|
command: "remove <id> <projectMapId>",
|
|
8872
8931
|
aliases: ["delete", "rm"],
|
|
8873
8932
|
describe: "Delete a project map node",
|
|
8874
|
-
builder: (
|
|
8933
|
+
builder: (yargs35) => withConfiguration(
|
|
8875
8934
|
withApiOptions(
|
|
8876
8935
|
withProjectOptions(
|
|
8877
|
-
|
|
8936
|
+
yargs35.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
8878
8937
|
)
|
|
8879
8938
|
)
|
|
8880
8939
|
),
|
|
@@ -8891,10 +8950,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8891
8950
|
command: "update <filename> <projectMapId>",
|
|
8892
8951
|
aliases: ["put"],
|
|
8893
8952
|
describe: "Insert or update a project map node",
|
|
8894
|
-
builder: (
|
|
8953
|
+
builder: (yargs35) => withConfiguration(
|
|
8895
8954
|
withApiOptions(
|
|
8896
8955
|
withProjectOptions(
|
|
8897
|
-
|
|
8956
|
+
yargs35.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
8898
8957
|
)
|
|
8899
8958
|
)
|
|
8900
8959
|
),
|
|
@@ -8910,9 +8969,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8910
8969
|
var ProjectMapNodeModule = {
|
|
8911
8970
|
command: "node <command>",
|
|
8912
8971
|
describe: "Commands for ProjectMap Nodes",
|
|
8913
|
-
builder: (
|
|
8972
|
+
builder: (yargs35) => yargs35.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
8914
8973
|
handler: () => {
|
|
8915
|
-
|
|
8974
|
+
yargs29.help();
|
|
8916
8975
|
}
|
|
8917
8976
|
};
|
|
8918
8977
|
|
|
@@ -8921,28 +8980,28 @@ var ProjectMapCommand = {
|
|
|
8921
8980
|
command: "project-map <command>",
|
|
8922
8981
|
aliases: ["prm"],
|
|
8923
8982
|
describe: "Uniform ProjectMap commands",
|
|
8924
|
-
builder: (
|
|
8983
|
+
builder: (yargs35) => yargs35.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
8925
8984
|
handler: () => {
|
|
8926
|
-
|
|
8985
|
+
yargs30.showHelp();
|
|
8927
8986
|
}
|
|
8928
8987
|
};
|
|
8929
8988
|
|
|
8930
8989
|
// src/commands/redirect/index.ts
|
|
8931
|
-
import
|
|
8990
|
+
import yargs32 from "yargs";
|
|
8932
8991
|
|
|
8933
8992
|
// src/commands/redirect/commands/redirect.ts
|
|
8934
|
-
import
|
|
8993
|
+
import yargs31 from "yargs";
|
|
8935
8994
|
|
|
8936
8995
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
8937
8996
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
8938
8997
|
var RedirectDefinitionGetModule = {
|
|
8939
8998
|
command: "get <id>",
|
|
8940
8999
|
describe: "Fetch a redirect",
|
|
8941
|
-
builder: (
|
|
9000
|
+
builder: (yargs35) => withConfiguration(
|
|
8942
9001
|
withFormatOptions(
|
|
8943
9002
|
withApiOptions(
|
|
8944
9003
|
withProjectOptions(
|
|
8945
|
-
|
|
9004
|
+
yargs35.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
8946
9005
|
)
|
|
8947
9006
|
)
|
|
8948
9007
|
)
|
|
@@ -8966,7 +9025,7 @@ var RedirectDefinitionListModule = {
|
|
|
8966
9025
|
command: "list",
|
|
8967
9026
|
describe: "List of redirects",
|
|
8968
9027
|
aliases: ["ls"],
|
|
8969
|
-
builder: (
|
|
9028
|
+
builder: (yargs35) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs35)))),
|
|
8970
9029
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8971
9030
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8972
9031
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -9033,11 +9092,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
9033
9092
|
var RedirectDefinitionPullModule = {
|
|
9034
9093
|
command: "pull <directory>",
|
|
9035
9094
|
describe: "Pulls all redirects to local files in a directory",
|
|
9036
|
-
builder: (
|
|
9095
|
+
builder: (yargs35) => withConfiguration(
|
|
9037
9096
|
withApiOptions(
|
|
9038
9097
|
withProjectOptions(
|
|
9039
9098
|
withDiffOptions(
|
|
9040
|
-
|
|
9099
|
+
yargs35.positional("directory", {
|
|
9041
9100
|
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.",
|
|
9042
9101
|
type: "string"
|
|
9043
9102
|
}).option("format", {
|
|
@@ -9116,11 +9175,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
9116
9175
|
var RedirectDefinitionPushModule = {
|
|
9117
9176
|
command: "push <directory>",
|
|
9118
9177
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
9119
|
-
builder: (
|
|
9178
|
+
builder: (yargs35) => withConfiguration(
|
|
9120
9179
|
withApiOptions(
|
|
9121
9180
|
withProjectOptions(
|
|
9122
9181
|
withDiffOptions(
|
|
9123
|
-
|
|
9182
|
+
yargs35.positional("directory", {
|
|
9124
9183
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
9125
9184
|
type: "string"
|
|
9126
9185
|
}).option("what-if", {
|
|
@@ -9187,9 +9246,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
9187
9246
|
command: "remove <id>",
|
|
9188
9247
|
aliases: ["delete", "rm"],
|
|
9189
9248
|
describe: "Delete a redirect",
|
|
9190
|
-
builder: (
|
|
9249
|
+
builder: (yargs35) => withConfiguration(
|
|
9191
9250
|
withApiOptions(
|
|
9192
|
-
withProjectOptions(
|
|
9251
|
+
withProjectOptions(yargs35.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
9193
9252
|
)
|
|
9194
9253
|
),
|
|
9195
9254
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -9205,10 +9264,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
9205
9264
|
command: "update <filename>",
|
|
9206
9265
|
aliases: ["put"],
|
|
9207
9266
|
describe: "Insert or update a redirect",
|
|
9208
|
-
builder: (
|
|
9267
|
+
builder: (yargs35) => withConfiguration(
|
|
9209
9268
|
withApiOptions(
|
|
9210
9269
|
withProjectOptions(
|
|
9211
|
-
|
|
9270
|
+
yargs35.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
9212
9271
|
)
|
|
9213
9272
|
)
|
|
9214
9273
|
),
|
|
@@ -9224,9 +9283,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
9224
9283
|
var RedirectDefinitionModule = {
|
|
9225
9284
|
command: "definition <command>",
|
|
9226
9285
|
describe: "Commands for Redirect Definitions",
|
|
9227
|
-
builder: (
|
|
9286
|
+
builder: (yargs35) => yargs35.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
9228
9287
|
handler: () => {
|
|
9229
|
-
|
|
9288
|
+
yargs31.help();
|
|
9230
9289
|
}
|
|
9231
9290
|
};
|
|
9232
9291
|
|
|
@@ -9235,14 +9294,57 @@ var RedirectCommand = {
|
|
|
9235
9294
|
command: "redirect <command>",
|
|
9236
9295
|
aliases: ["red"],
|
|
9237
9296
|
describe: "Uniform Redirect commands",
|
|
9238
|
-
builder: (
|
|
9297
|
+
builder: (yargs35) => yargs35.command(RedirectDefinitionModule).demandCommand(),
|
|
9239
9298
|
handler: () => {
|
|
9240
|
-
|
|
9299
|
+
yargs32.showHelp();
|
|
9241
9300
|
}
|
|
9242
9301
|
};
|
|
9243
9302
|
|
|
9244
9303
|
// src/commands/sync/index.ts
|
|
9245
|
-
import
|
|
9304
|
+
import yargs33 from "yargs";
|
|
9305
|
+
|
|
9306
|
+
// src/commands/canvas/commands/pattern/pull.ts
|
|
9307
|
+
var PatternPullModule = {
|
|
9308
|
+
...CompositionPullModule,
|
|
9309
|
+
describe: "Pulls all patterns to local files in a directory",
|
|
9310
|
+
builder: (yargs35) => withConfiguration(
|
|
9311
|
+
withApiOptions(
|
|
9312
|
+
withProjectOptions(
|
|
9313
|
+
withStateOptions(
|
|
9314
|
+
withDiffOptions(
|
|
9315
|
+
yargs35.positional("directory", {
|
|
9316
|
+
describe: "Directory to save the definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
9317
|
+
type: "string"
|
|
9318
|
+
}).option("format", {
|
|
9319
|
+
alias: ["f"],
|
|
9320
|
+
describe: "Output format",
|
|
9321
|
+
default: "yaml",
|
|
9322
|
+
choices: ["yaml", "json"],
|
|
9323
|
+
type: "string"
|
|
9324
|
+
}).option("onlyPatterns", {
|
|
9325
|
+
describe: "Only pulling patterns and not compositions",
|
|
9326
|
+
// This default differentiate this list command from composition list command
|
|
9327
|
+
default: true,
|
|
9328
|
+
type: "boolean",
|
|
9329
|
+
hidden: true
|
|
9330
|
+
}).option("what-if", {
|
|
9331
|
+
alias: ["w"],
|
|
9332
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
9333
|
+
default: false,
|
|
9334
|
+
type: "boolean"
|
|
9335
|
+
}).option("mode", {
|
|
9336
|
+
alias: ["m"],
|
|
9337
|
+
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',
|
|
9338
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
9339
|
+
default: "mirror",
|
|
9340
|
+
type: "string"
|
|
9341
|
+
})
|
|
9342
|
+
)
|
|
9343
|
+
)
|
|
9344
|
+
)
|
|
9345
|
+
)
|
|
9346
|
+
)
|
|
9347
|
+
};
|
|
9246
9348
|
|
|
9247
9349
|
// src/commands/sync/commands/util.ts
|
|
9248
9350
|
import ora2 from "ora";
|
|
@@ -9302,11 +9404,11 @@ function patchConsole(fn, ora3, replay = []) {
|
|
|
9302
9404
|
var SyncPullModule = {
|
|
9303
9405
|
command: "pull",
|
|
9304
9406
|
describe: "Pulls whole project to local files in a directory",
|
|
9305
|
-
builder: (
|
|
9407
|
+
builder: (yargs35) => withConfiguration(
|
|
9306
9408
|
withApiOptions(
|
|
9307
9409
|
withProjectOptions(
|
|
9308
9410
|
withDiffOptions(
|
|
9309
|
-
|
|
9411
|
+
yargs35.option("what-if", {
|
|
9310
9412
|
alias: ["w"],
|
|
9311
9413
|
describe: "What-if mode reports what would be done but changes no files",
|
|
9312
9414
|
default: false,
|
|
@@ -9317,13 +9419,7 @@ var SyncPullModule = {
|
|
|
9317
9419
|
)
|
|
9318
9420
|
),
|
|
9319
9421
|
handler: async ({ serialization, ...otherParams }) => {
|
|
9320
|
-
var _a, _b;
|
|
9321
9422
|
const config2 = serialization;
|
|
9322
|
-
let isUsingDeprecatedPatternConfig = false;
|
|
9323
|
-
if (config2.entitiesConfig.pattern) {
|
|
9324
|
-
isUsingDeprecatedPatternConfig = true;
|
|
9325
|
-
(_a = config2.entitiesConfig).componentPattern ?? (_a.componentPattern = config2.entitiesConfig.pattern);
|
|
9326
|
-
}
|
|
9327
9423
|
const enabledEntities = Object.entries({
|
|
9328
9424
|
locale: LocalePullModule,
|
|
9329
9425
|
asset: AssetPullModule,
|
|
@@ -9337,7 +9433,9 @@ var SyncPullModule = {
|
|
|
9337
9433
|
enrichment: EnrichmentPullModule,
|
|
9338
9434
|
aggregate: AggregatePullModule,
|
|
9339
9435
|
component: ComponentPullModule,
|
|
9436
|
+
pattern: PatternPullModule,
|
|
9340
9437
|
componentPattern: ComponentPatternPullModule,
|
|
9438
|
+
compositionPattern: CompositionPatternPullModule,
|
|
9341
9439
|
composition: CompositionPullModule,
|
|
9342
9440
|
projectMapDefinition: ProjectMapDefinitionPullModule,
|
|
9343
9441
|
projectMapNode: ProjectMapNodePullModule,
|
|
@@ -9347,8 +9445,7 @@ var SyncPullModule = {
|
|
|
9347
9445
|
contentType: ContentTypePullModule
|
|
9348
9446
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9349
9447
|
}).filter(([entityType]) => {
|
|
9350
|
-
|
|
9351
|
-
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[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;
|
|
9448
|
+
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.pull?.disabled !== true;
|
|
9352
9449
|
});
|
|
9353
9450
|
if (enabledEntities.length === 0) {
|
|
9354
9451
|
throw new Error(
|
|
@@ -9359,7 +9456,7 @@ var SyncPullModule = {
|
|
|
9359
9456
|
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
9360
9457
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
9361
9458
|
};
|
|
9362
|
-
const entityConfig =
|
|
9459
|
+
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
9363
9460
|
try {
|
|
9364
9461
|
await spinPromise(
|
|
9365
9462
|
module3.handler({
|
|
@@ -9367,9 +9464,10 @@ var SyncPullModule = {
|
|
|
9367
9464
|
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
9368
9465
|
format: getFormat(entityType, config2),
|
|
9369
9466
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
9370
|
-
onlyPatterns:
|
|
9467
|
+
onlyPatterns: ["componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
9468
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
9371
9469
|
mode: getPullMode(entityType, config2),
|
|
9372
|
-
directory: getPullFilename(entityType, config2
|
|
9470
|
+
directory: getPullFilename(entityType, config2),
|
|
9373
9471
|
allowEmptySource: config2.allowEmptySource
|
|
9374
9472
|
}),
|
|
9375
9473
|
{
|
|
@@ -9378,7 +9476,7 @@ var SyncPullModule = {
|
|
|
9378
9476
|
failText(error) {
|
|
9379
9477
|
return `${entityType}
|
|
9380
9478
|
|
|
9381
|
-
${error.stack}`;
|
|
9479
|
+
${error.stack ?? error.message}`;
|
|
9382
9480
|
}
|
|
9383
9481
|
}
|
|
9384
9482
|
);
|
|
@@ -9396,13 +9494,11 @@ var getPullMode = (entityType, config2) => {
|
|
|
9396
9494
|
entityType
|
|
9397
9495
|
});
|
|
9398
9496
|
};
|
|
9399
|
-
var getPullFilename = (entityType, config2
|
|
9497
|
+
var getPullFilename = (entityType, config2) => {
|
|
9400
9498
|
return getDirectoryOrFilename({
|
|
9401
9499
|
operation: "pull",
|
|
9402
9500
|
config: config2,
|
|
9403
|
-
entityType
|
|
9404
|
-
// This fallback can be removed when publishing a major release
|
|
9405
|
-
defaultEntityFolderName: isUsingDeprecatedPatternConfig && entityType === "componentPattern" ? "pattern" : void 0
|
|
9501
|
+
entityType
|
|
9406
9502
|
});
|
|
9407
9503
|
};
|
|
9408
9504
|
var getFormat = (entityType, config2) => {
|
|
@@ -9414,15 +9510,52 @@ var getFormat = (entityType, config2) => {
|
|
|
9414
9510
|
});
|
|
9415
9511
|
};
|
|
9416
9512
|
|
|
9513
|
+
// src/commands/canvas/commands/pattern/push.ts
|
|
9514
|
+
var PatternPushModule = {
|
|
9515
|
+
...CompositionPushModule,
|
|
9516
|
+
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
9517
|
+
builder: (yargs35) => withConfiguration(
|
|
9518
|
+
withApiOptions(
|
|
9519
|
+
withProjectOptions(
|
|
9520
|
+
withStateOptions(
|
|
9521
|
+
withDiffOptions(
|
|
9522
|
+
yargs35.positional("directory", {
|
|
9523
|
+
describe: "Directory to read the patterns from. If a filename is used, a package will be read instead.",
|
|
9524
|
+
type: "string"
|
|
9525
|
+
}).option("what-if", {
|
|
9526
|
+
alias: ["w"],
|
|
9527
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
9528
|
+
default: false,
|
|
9529
|
+
type: "boolean"
|
|
9530
|
+
}).option("mode", {
|
|
9531
|
+
alias: ["m"],
|
|
9532
|
+
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',
|
|
9533
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
9534
|
+
default: "mirror",
|
|
9535
|
+
type: "string"
|
|
9536
|
+
}).option("onlyPatterns", {
|
|
9537
|
+
describe: "Only pulling patterns and not compositions",
|
|
9538
|
+
// This default differentiate this list command from composition list command
|
|
9539
|
+
default: true,
|
|
9540
|
+
type: "boolean",
|
|
9541
|
+
hidden: true
|
|
9542
|
+
})
|
|
9543
|
+
)
|
|
9544
|
+
)
|
|
9545
|
+
)
|
|
9546
|
+
)
|
|
9547
|
+
)
|
|
9548
|
+
};
|
|
9549
|
+
|
|
9417
9550
|
// src/commands/sync/commands/push.ts
|
|
9418
9551
|
var SyncPushModule = {
|
|
9419
9552
|
command: "push",
|
|
9420
9553
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
9421
|
-
builder: (
|
|
9554
|
+
builder: (yargs35) => withConfiguration(
|
|
9422
9555
|
withApiOptions(
|
|
9423
9556
|
withProjectOptions(
|
|
9424
9557
|
withDiffOptions(
|
|
9425
|
-
|
|
9558
|
+
yargs35.option("what-if", {
|
|
9426
9559
|
alias: ["w"],
|
|
9427
9560
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
9428
9561
|
default: false,
|
|
@@ -9433,13 +9566,7 @@ var SyncPushModule = {
|
|
|
9433
9566
|
)
|
|
9434
9567
|
),
|
|
9435
9568
|
handler: async ({ serialization, ...otherParams }) => {
|
|
9436
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
9437
9569
|
const config2 = serialization;
|
|
9438
|
-
let isUsingDeprecatedPatternConfig = false;
|
|
9439
|
-
if (config2.entitiesConfig.pattern) {
|
|
9440
|
-
isUsingDeprecatedPatternConfig = true;
|
|
9441
|
-
(_a = config2.entitiesConfig).componentPattern ?? (_a.componentPattern = config2.entitiesConfig.pattern);
|
|
9442
|
-
}
|
|
9443
9570
|
const enabledEntities = Object.entries({
|
|
9444
9571
|
locale: LocalePushModule,
|
|
9445
9572
|
asset: AssetPushModule,
|
|
@@ -9453,7 +9580,9 @@ var SyncPushModule = {
|
|
|
9453
9580
|
enrichment: EnrichmentPushModule,
|
|
9454
9581
|
aggregate: AggregatePushModule,
|
|
9455
9582
|
component: ComponentPushModule,
|
|
9583
|
+
pattern: PatternPushModule,
|
|
9456
9584
|
componentPattern: ComponentPatternPushModule,
|
|
9585
|
+
compositionPattern: CompositionPatternPushModule,
|
|
9457
9586
|
composition: CompositionPushModule,
|
|
9458
9587
|
projectMapDefinition: ProjectMapDefinitionPushModule,
|
|
9459
9588
|
projectMapNode: ProjectMapNodePushModule,
|
|
@@ -9463,8 +9592,7 @@ var SyncPushModule = {
|
|
|
9463
9592
|
entryPattern: EntryPatternPushModule
|
|
9464
9593
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9465
9594
|
}).filter(([entityType]) => {
|
|
9466
|
-
|
|
9467
|
-
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;
|
|
9595
|
+
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.push?.disabled !== true;
|
|
9468
9596
|
});
|
|
9469
9597
|
if (enabledEntities.length === 0) {
|
|
9470
9598
|
throw new Error(
|
|
@@ -9479,9 +9607,10 @@ var SyncPushModule = {
|
|
|
9479
9607
|
state: 0,
|
|
9480
9608
|
format: getFormat2(entityType, config2),
|
|
9481
9609
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
9482
|
-
onlyPatterns:
|
|
9610
|
+
onlyPatterns: ["componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
9611
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
9483
9612
|
mode: getPushMode(entityType, config2),
|
|
9484
|
-
directory: getPushFilename(entityType, config2
|
|
9613
|
+
directory: getPushFilename(entityType, config2),
|
|
9485
9614
|
allowEmptySource: config2.allowEmptySource
|
|
9486
9615
|
}),
|
|
9487
9616
|
{
|
|
@@ -9490,7 +9619,7 @@ var SyncPushModule = {
|
|
|
9490
9619
|
failText(error) {
|
|
9491
9620
|
return `${entityType}
|
|
9492
9621
|
|
|
9493
|
-
${error.stack}`;
|
|
9622
|
+
${error.stack ?? error.message}`;
|
|
9494
9623
|
}
|
|
9495
9624
|
}
|
|
9496
9625
|
);
|
|
@@ -9498,16 +9627,19 @@ var SyncPushModule = {
|
|
|
9498
9627
|
process.exit(1);
|
|
9499
9628
|
}
|
|
9500
9629
|
}
|
|
9501
|
-
if (
|
|
9630
|
+
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
9502
9631
|
await ComponentPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9503
9632
|
}
|
|
9504
|
-
if (
|
|
9633
|
+
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
9634
|
+
await CompositionPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9635
|
+
}
|
|
9636
|
+
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
9505
9637
|
await CompositionPublishModule.handler({ ...otherParams, all: true });
|
|
9506
9638
|
}
|
|
9507
|
-
if (
|
|
9639
|
+
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
9508
9640
|
await EntryPublishModule.handler({ ...otherParams, all: true });
|
|
9509
9641
|
}
|
|
9510
|
-
if (
|
|
9642
|
+
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
9511
9643
|
await EntryPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9512
9644
|
}
|
|
9513
9645
|
}
|
|
@@ -9520,13 +9652,11 @@ var getPushMode = (entityType, config2) => {
|
|
|
9520
9652
|
entityType
|
|
9521
9653
|
});
|
|
9522
9654
|
};
|
|
9523
|
-
var getPushFilename = (entityType, config2
|
|
9655
|
+
var getPushFilename = (entityType, config2) => {
|
|
9524
9656
|
return getDirectoryOrFilename({
|
|
9525
9657
|
operation: "push",
|
|
9526
9658
|
config: config2,
|
|
9527
|
-
entityType
|
|
9528
|
-
// This fallback can be removed when publishing a major release
|
|
9529
|
-
defaultEntityFolderName: isUsingDeprecatedPatternConfig && entityType === "componentPattern" ? "pattern" : void 0
|
|
9659
|
+
entityType
|
|
9530
9660
|
});
|
|
9531
9661
|
};
|
|
9532
9662
|
var getFormat2 = (entityType, config2) => {
|
|
@@ -9542,9 +9672,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
9542
9672
|
var SyncCommand = {
|
|
9543
9673
|
command: "sync <command>",
|
|
9544
9674
|
describe: "Uniform Sync commands",
|
|
9545
|
-
builder: (
|
|
9675
|
+
builder: (yargs35) => yargs35.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
9546
9676
|
handler: () => {
|
|
9547
|
-
|
|
9677
|
+
yargs33.showHelp();
|
|
9548
9678
|
}
|
|
9549
9679
|
};
|
|
9550
9680
|
|
|
@@ -9617,7 +9747,7 @@ var updateCache = async (file, latest, lastUpdate) => {
|
|
|
9617
9747
|
});
|
|
9618
9748
|
await fs5.writeFile(file, content, "utf8");
|
|
9619
9749
|
};
|
|
9620
|
-
var loadPackage = ({ url, timeout }, authInfo) => new Promise((
|
|
9750
|
+
var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve, reject) => {
|
|
9621
9751
|
const options = {
|
|
9622
9752
|
host: url.hostname,
|
|
9623
9753
|
path: url.pathname,
|
|
@@ -9648,7 +9778,7 @@ var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve2, reject)
|
|
|
9648
9778
|
response.on("end", () => {
|
|
9649
9779
|
try {
|
|
9650
9780
|
const parsedData = JSON.parse(rawData);
|
|
9651
|
-
|
|
9781
|
+
resolve(parsedData);
|
|
9652
9782
|
} catch (e) {
|
|
9653
9783
|
reject(e);
|
|
9654
9784
|
}
|
|
@@ -9662,7 +9792,7 @@ var getMostRecent = async ({ full, scope }, distTag, timeout) => {
|
|
|
9662
9792
|
try {
|
|
9663
9793
|
spec = await loadPackage({ url, timeout });
|
|
9664
9794
|
} catch (err) {
|
|
9665
|
-
if (
|
|
9795
|
+
if (err?.code && String(err.code).startsWith("4")) {
|
|
9666
9796
|
const registryAuthToken = __require("registry-auth-token");
|
|
9667
9797
|
const authInfo = registryAuthToken(regURL, { recursive: true });
|
|
9668
9798
|
spec = await loadPackage({ url, timeout }, authInfo);
|
|
@@ -9743,14 +9873,14 @@ import { join as join4 } from "path";
|
|
|
9743
9873
|
|
|
9744
9874
|
// src/fs.ts
|
|
9745
9875
|
import { promises as fs6 } from "fs";
|
|
9746
|
-
async function readJSON(
|
|
9747
|
-
const fileContents = await fs6.readFile(
|
|
9876
|
+
async function readJSON(path4) {
|
|
9877
|
+
const fileContents = await fs6.readFile(path4, "utf-8");
|
|
9748
9878
|
return JSON.parse(fileContents);
|
|
9749
9879
|
}
|
|
9750
|
-
async function tryReadJSON(
|
|
9880
|
+
async function tryReadJSON(path4, missingValue = null) {
|
|
9751
9881
|
try {
|
|
9752
|
-
const stat = await fs6.stat(
|
|
9753
|
-
return stat.isFile() ? await readJSON(
|
|
9882
|
+
const stat = await fs6.stat(path4);
|
|
9883
|
+
return stat.isFile() ? await readJSON(path4) : missingValue;
|
|
9754
9884
|
} catch (e) {
|
|
9755
9885
|
return missingValue;
|
|
9756
9886
|
}
|
|
@@ -9783,8 +9913,8 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
9783
9913
|
return;
|
|
9784
9914
|
let firstVersion;
|
|
9785
9915
|
const allDependencies = {
|
|
9786
|
-
...
|
|
9787
|
-
...
|
|
9916
|
+
...localPackages?.dependencies ?? {},
|
|
9917
|
+
...localPackages?.devDependencies ?? {}
|
|
9788
9918
|
};
|
|
9789
9919
|
for (const [p, version] of Object.entries(allDependencies)) {
|
|
9790
9920
|
if (uniformStrictVersions.includes(p)) {
|
|
@@ -9811,7 +9941,7 @@ First found was: v${firstVersion}`;
|
|
|
9811
9941
|
|
|
9812
9942
|
// src/index.ts
|
|
9813
9943
|
dotenv.config();
|
|
9814
|
-
var yarggery =
|
|
9944
|
+
var yarggery = yargs34(hideBin(process.argv));
|
|
9815
9945
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
9816
9946
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
9817
9947
|
yarggery.option("verbose", {
|