@uniformdev/cli 19.135.1-alpha.10 → 19.135.1-alpha.11
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-VMUNHMVI.mjs +266 -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 +1348 -994
- package/package.json +22 -12
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-VMUNHMVI.mjs";
|
|
16
19
|
|
|
17
20
|
// src/index.ts
|
|
18
21
|
import * as dotenv from "dotenv";
|
|
19
|
-
import
|
|
22
|
+
import yargs35 from "yargs";
|
|
20
23
|
import { hideBin } from "yargs/helpers";
|
|
21
24
|
|
|
22
25
|
// src/commands/canvas/index.ts
|
|
23
|
-
import
|
|
26
|
+
import yargs16 from "yargs";
|
|
24
27
|
|
|
25
28
|
// src/commands/canvas/commands/asset.ts
|
|
26
29
|
import yargs from "yargs";
|
|
@@ -59,8 +62,7 @@ async function createArraySyncEngineDataSource({
|
|
|
59
62
|
);
|
|
60
63
|
async function* getObjects() {
|
|
61
64
|
for (const item of Object.values(objectIndex)) {
|
|
62
|
-
if (typeof item === "object")
|
|
63
|
-
yield item;
|
|
65
|
+
if (typeof item === "object") yield item;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
function extractCurrent() {
|
|
@@ -90,9 +92,9 @@ async function createArraySyncEngineDataSource({
|
|
|
90
92
|
|
|
91
93
|
// src/sync/fileSyncEngineDataSource.ts
|
|
92
94
|
import { red } from "colorette";
|
|
93
|
-
import { existsSync, mkdirSync
|
|
95
|
+
import { existsSync, mkdirSync } from "fs";
|
|
94
96
|
import { readdir, unlink } from "fs/promises";
|
|
95
|
-
import { extname
|
|
97
|
+
import { extname, join } from "path";
|
|
96
98
|
|
|
97
99
|
// src/util.ts
|
|
98
100
|
import { cosmiconfigSync } from "cosmiconfig";
|
|
@@ -121,254 +123,16 @@ var loadConfig = (configPath) => {
|
|
|
121
123
|
throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
|
|
122
124
|
}
|
|
123
125
|
const configFile = syncCosmicExplorer.load(configPath);
|
|
124
|
-
if (!
|
|
126
|
+
if (!configFile?.config.serialization) {
|
|
125
127
|
throw new Error(
|
|
126
128
|
`Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
|
|
127
129
|
);
|
|
128
130
|
}
|
|
129
|
-
return applyDefaultSyncConfiguration(
|
|
131
|
+
return applyDefaultSyncConfiguration(configFile?.config ?? {});
|
|
130
132
|
} else {
|
|
131
133
|
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];
|
|
348
|
-
}
|
|
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;
|
|
134
|
+
return applyDefaultSyncConfiguration(searchedForm?.config ?? {});
|
|
370
135
|
}
|
|
371
|
-
return `${config2.directory}/${defaultEntityFolderName}`;
|
|
372
136
|
};
|
|
373
137
|
|
|
374
138
|
// src/sync/fileSyncEngineDataSource.ts
|
|
@@ -383,12 +147,12 @@ async function createFileSyncEngineDataSource({
|
|
|
383
147
|
}) {
|
|
384
148
|
const dirExists = existsSync(directory);
|
|
385
149
|
if (!dirExists) {
|
|
386
|
-
|
|
150
|
+
mkdirSync(directory, { recursive: true });
|
|
387
151
|
}
|
|
388
152
|
const rawFilenames = await readdir(directory, "utf-8");
|
|
389
153
|
const filenames = new Set(
|
|
390
154
|
rawFilenames.filter((filename) => {
|
|
391
|
-
const ext =
|
|
155
|
+
const ext = extname(filename);
|
|
392
156
|
return ext === `.json` || ext === `.yaml` || ext === `.yml`;
|
|
393
157
|
})
|
|
394
158
|
);
|
|
@@ -408,7 +172,7 @@ async function createFileSyncEngineDataSource({
|
|
|
408
172
|
yield object;
|
|
409
173
|
} catch (e) {
|
|
410
174
|
console.error(red(`Failed to read ${fullFilename}, data is likely invalid.
|
|
411
|
-
${e
|
|
175
|
+
${e?.message}`));
|
|
412
176
|
throw e;
|
|
413
177
|
}
|
|
414
178
|
}
|
|
@@ -472,30 +236,33 @@ async function syncEngine({
|
|
|
472
236
|
log = () => {
|
|
473
237
|
},
|
|
474
238
|
onBeforeCompareObjects,
|
|
475
|
-
onBeforeWriteObject
|
|
239
|
+
onBeforeWriteObject,
|
|
240
|
+
onError
|
|
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) => {
|
|
481
|
-
if (deleteTracker.has(object))
|
|
482
|
-
return;
|
|
245
|
+
if (deleteTracker.has(object)) return;
|
|
483
246
|
deleteTracker.add(object);
|
|
484
247
|
if (!whatIf) {
|
|
485
248
|
try {
|
|
486
249
|
await target.deleteObject(object.providerId, object);
|
|
250
|
+
log({
|
|
251
|
+
action: "delete",
|
|
252
|
+
id: object.id[0],
|
|
253
|
+
providerId: object.providerId,
|
|
254
|
+
displayName: object.displayName ?? object.providerId,
|
|
255
|
+
whatIf,
|
|
256
|
+
diff: diffLines(JSON.stringify(object.object, null, 2), "")
|
|
257
|
+
});
|
|
487
258
|
} catch (e) {
|
|
488
|
-
|
|
259
|
+
if (onError) {
|
|
260
|
+
onError(e, object);
|
|
261
|
+
} else {
|
|
262
|
+
throw new SyncEngineError(e, object);
|
|
263
|
+
}
|
|
489
264
|
}
|
|
490
265
|
}
|
|
491
|
-
log({
|
|
492
|
-
action: "delete",
|
|
493
|
-
id: object.id[0],
|
|
494
|
-
providerId: object.providerId,
|
|
495
|
-
displayName: object.displayName ?? object.providerId,
|
|
496
|
-
whatIf,
|
|
497
|
-
diff: diffLines(JSON.stringify(object.object, null, 2), "")
|
|
498
|
-
});
|
|
499
266
|
};
|
|
500
267
|
for await (const obj of target.objects) {
|
|
501
268
|
if (Array.isArray(obj.id)) {
|
|
@@ -510,7 +277,7 @@ async function syncEngine({
|
|
|
510
277
|
sourceHasItems = true;
|
|
511
278
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
512
279
|
const targetObject = targetItems.get(ids[0]);
|
|
513
|
-
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) =>
|
|
280
|
+
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o?.object !== targetObject?.object);
|
|
514
281
|
if (targetObject && invalidTargetObjects.length == 0) {
|
|
515
282
|
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
516
283
|
if (!compareContents(sourceObject, targetObject)) {
|
|
@@ -520,18 +287,22 @@ async function syncEngine({
|
|
|
520
287
|
try {
|
|
521
288
|
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
522
289
|
await target.writeObject(finalSourceObject, targetObject2);
|
|
290
|
+
log({
|
|
291
|
+
action: "update",
|
|
292
|
+
id: ids[0],
|
|
293
|
+
providerId: sourceObject2.providerId,
|
|
294
|
+
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
295
|
+
whatIf,
|
|
296
|
+
diff: diffJson(targetObject2.object, sourceObject2.object)
|
|
297
|
+
});
|
|
523
298
|
} catch (e) {
|
|
524
|
-
|
|
299
|
+
if (onError) {
|
|
300
|
+
onError(e, sourceObject2);
|
|
301
|
+
} else {
|
|
302
|
+
throw new SyncEngineError(e, sourceObject2);
|
|
303
|
+
}
|
|
525
304
|
}
|
|
526
305
|
}
|
|
527
|
-
log({
|
|
528
|
-
action: "update",
|
|
529
|
-
id: ids[0],
|
|
530
|
-
providerId: sourceObject2.providerId,
|
|
531
|
-
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
532
|
-
whatIf,
|
|
533
|
-
diff: diffJson(targetObject2.object, sourceObject2.object)
|
|
534
|
-
});
|
|
535
306
|
};
|
|
536
307
|
actions.push(process2(sourceObject, targetObject));
|
|
537
308
|
}
|
|
@@ -543,23 +314,26 @@ async function syncEngine({
|
|
|
543
314
|
try {
|
|
544
315
|
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
|
|
545
316
|
await target.writeObject(finalSourceObject);
|
|
317
|
+
log({
|
|
318
|
+
action: "create",
|
|
319
|
+
id,
|
|
320
|
+
providerId: id,
|
|
321
|
+
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
322
|
+
whatIf,
|
|
323
|
+
diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
|
|
324
|
+
});
|
|
546
325
|
} catch (e) {
|
|
547
|
-
|
|
326
|
+
if (onError) {
|
|
327
|
+
onError(e, sourceObject2);
|
|
328
|
+
} else {
|
|
329
|
+
throw new SyncEngineError(e, sourceObject2);
|
|
330
|
+
}
|
|
548
331
|
}
|
|
549
332
|
}
|
|
550
|
-
log({
|
|
551
|
-
action: "create",
|
|
552
|
-
id,
|
|
553
|
-
providerId: id,
|
|
554
|
-
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
555
|
-
whatIf,
|
|
556
|
-
diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
|
|
557
|
-
});
|
|
558
333
|
};
|
|
559
334
|
if (invalidTargetObjects.length > 0) {
|
|
560
335
|
[...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));
|
|
336
|
+
(Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
|
|
563
337
|
});
|
|
564
338
|
const deletes = invalidTargetObjects.filter((io) => typeof io !== "undefined").map(async (io) => {
|
|
565
339
|
await processDelete(io);
|
|
@@ -586,7 +360,7 @@ async function syncEngine({
|
|
|
586
360
|
});
|
|
587
361
|
await Promise.all(deletes);
|
|
588
362
|
}
|
|
589
|
-
await Promise.all([
|
|
363
|
+
await Promise.all([source.onSyncComplete?.(false), target.onSyncComplete?.(true)]);
|
|
590
364
|
}
|
|
591
365
|
var SyncEngineError = class _SyncEngineError extends Error {
|
|
592
366
|
constructor(innerError, sourceObject) {
|
|
@@ -645,12 +419,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
645
419
|
var AssetGetModule = {
|
|
646
420
|
command: "get <id>",
|
|
647
421
|
describe: "Get an asset",
|
|
648
|
-
builder: (
|
|
422
|
+
builder: (yargs36) => withConfiguration(
|
|
649
423
|
withFormatOptions(
|
|
650
424
|
withApiOptions(
|
|
651
425
|
withProjectOptions(
|
|
652
426
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
653
|
-
|
|
427
|
+
yargs36.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
654
428
|
)
|
|
655
429
|
)
|
|
656
430
|
)
|
|
@@ -671,7 +445,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
|
|
|
671
445
|
var AssetListModule = {
|
|
672
446
|
command: "list",
|
|
673
447
|
describe: "List assets",
|
|
674
|
-
builder: (
|
|
448
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
675
449
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
676
450
|
const fetch3 = nodeFetchProxy(proxy);
|
|
677
451
|
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -691,7 +465,7 @@ import { createHash } from "crypto";
|
|
|
691
465
|
import fsj from "fs-jetpack";
|
|
692
466
|
import sizeOf from "image-size";
|
|
693
467
|
import PQueue from "p-queue";
|
|
694
|
-
import { dirname
|
|
468
|
+
import { dirname, join as join2 } from "path";
|
|
695
469
|
var FILES_DIRECTORY_NAME = "files";
|
|
696
470
|
var escapeRegExp = (string) => {
|
|
697
471
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -735,7 +509,7 @@ var urlToFileName = (url, hash) => {
|
|
|
735
509
|
};
|
|
736
510
|
var getFilesDirectory = (directory) => {
|
|
737
511
|
const isPackage = isPathAPackageFile(directory);
|
|
738
|
-
return isPackage ?
|
|
512
|
+
return isPackage ? dirname(directory) : (
|
|
739
513
|
// If we are syncing to a directory, we want to write all files into a
|
|
740
514
|
// top-lvl folder. That way any entities that contain files will sync to the
|
|
741
515
|
// same directory, so there is no duplication
|
|
@@ -809,7 +583,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
809
583
|
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
810
584
|
const writeDirectory = getFilesDirectory(options.directory);
|
|
811
585
|
const isPackage = isPathAPackageFile(options.directory);
|
|
812
|
-
const legacyWriteDirectory = isPackage ?
|
|
586
|
+
const legacyWriteDirectory = isPackage ? dirname(options.directory) : options.directory;
|
|
813
587
|
if (uniformFileUrlMatches) {
|
|
814
588
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
815
589
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -886,7 +660,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
886
660
|
}
|
|
887
661
|
const file2 = await options.fileClient.get({ id });
|
|
888
662
|
if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
|
|
889
|
-
await new Promise((
|
|
663
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
890
664
|
return checkForFile();
|
|
891
665
|
}
|
|
892
666
|
return file2.url;
|
|
@@ -975,11 +749,10 @@ var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, op
|
|
|
975
749
|
return JSON.parse(sourceObjectAsString);
|
|
976
750
|
};
|
|
977
751
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
978
|
-
var _a;
|
|
979
752
|
if (!asset.asset.fields) {
|
|
980
753
|
return asset;
|
|
981
754
|
}
|
|
982
|
-
const fileUrl =
|
|
755
|
+
const fileUrl = asset.asset.fields.url?.value;
|
|
983
756
|
if (!fileUrl) {
|
|
984
757
|
return asset;
|
|
985
758
|
}
|
|
@@ -1009,10 +782,7 @@ import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
|
1009
782
|
|
|
1010
783
|
// src/commands/canvas/commands/asset/_util.ts
|
|
1011
784
|
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
|
-
};
|
|
785
|
+
var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
1016
786
|
|
|
1017
787
|
// src/commands/canvas/util.ts
|
|
1018
788
|
import {
|
|
@@ -1027,8 +797,8 @@ function prepCompositionForDisk(composition) {
|
|
|
1027
797
|
delete prepped.state;
|
|
1028
798
|
return prepped;
|
|
1029
799
|
}
|
|
1030
|
-
function withStateOptions(
|
|
1031
|
-
return
|
|
800
|
+
function withStateOptions(yargs36, defaultState = "preview") {
|
|
801
|
+
return yargs36.option("state", {
|
|
1032
802
|
type: "string",
|
|
1033
803
|
describe: `State to fetch.`,
|
|
1034
804
|
choices: ["preview", "published"],
|
|
@@ -1095,11 +865,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
1095
865
|
var AssetPullModule = {
|
|
1096
866
|
command: "pull <directory>",
|
|
1097
867
|
describe: "Pulls all assets to local files in a directory",
|
|
1098
|
-
builder: (
|
|
868
|
+
builder: (yargs36) => withConfiguration(
|
|
1099
869
|
withApiOptions(
|
|
1100
870
|
withProjectOptions(
|
|
1101
871
|
withDiffOptions(
|
|
1102
|
-
|
|
872
|
+
yargs36.positional("directory", {
|
|
1103
873
|
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
874
|
type: "string"
|
|
1105
875
|
}).option("format", {
|
|
@@ -1148,9 +918,8 @@ var AssetPullModule = {
|
|
|
1148
918
|
let target;
|
|
1149
919
|
const isPackage = isPathAPackageFile(directory);
|
|
1150
920
|
const onBeforeDeleteObject = async (id, object) => {
|
|
1151
|
-
var _a, _b;
|
|
1152
921
|
const asset = object.object;
|
|
1153
|
-
if (!
|
|
922
|
+
if (!asset.asset.fields?.url?.value) {
|
|
1154
923
|
return;
|
|
1155
924
|
}
|
|
1156
925
|
await deleteDownloadedFileByUrl(asset.asset.fields.url.value, {
|
|
@@ -1187,7 +956,6 @@ var AssetPullModule = {
|
|
|
1187
956
|
allowEmptySource: allowEmptySource ?? true,
|
|
1188
957
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1189
958
|
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1190
|
-
var _a, _b;
|
|
1191
959
|
delete sourceObject.object.asset._author;
|
|
1192
960
|
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
1193
961
|
sourceObject,
|
|
@@ -1197,7 +965,7 @@ var AssetPullModule = {
|
|
|
1197
965
|
fileClient
|
|
1198
966
|
}
|
|
1199
967
|
);
|
|
1200
|
-
if (
|
|
968
|
+
if (sourceObjectWithPotentiallySwappedUrl.object.asset.fields?.url && targetObject.object.asset.fields?.url && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
|
|
1201
969
|
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1202
970
|
}
|
|
1203
971
|
return sourceObjectWithPotentiallySwappedUrl;
|
|
@@ -1219,11 +987,11 @@ import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
|
1219
987
|
var AssetPushModule = {
|
|
1220
988
|
command: "push <directory>",
|
|
1221
989
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1222
|
-
builder: (
|
|
990
|
+
builder: (yargs36) => withConfiguration(
|
|
1223
991
|
withApiOptions(
|
|
1224
992
|
withProjectOptions(
|
|
1225
993
|
withDiffOptions(
|
|
1226
|
-
|
|
994
|
+
yargs36.positional("directory", {
|
|
1227
995
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1228
996
|
type: "string"
|
|
1229
997
|
}).option("what-if", {
|
|
@@ -1324,9 +1092,9 @@ var AssetRemoveModule = {
|
|
|
1324
1092
|
command: "remove <id>",
|
|
1325
1093
|
aliases: ["delete", "rm"],
|
|
1326
1094
|
describe: "Delete an asset",
|
|
1327
|
-
builder: (
|
|
1095
|
+
builder: (yargs36) => withConfiguration(
|
|
1328
1096
|
withApiOptions(
|
|
1329
|
-
withProjectOptions(
|
|
1097
|
+
withProjectOptions(yargs36.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1330
1098
|
)
|
|
1331
1099
|
),
|
|
1332
1100
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1342,10 +1110,10 @@ var AssetUpdateModule = {
|
|
|
1342
1110
|
command: "update <filename>",
|
|
1343
1111
|
aliases: ["put"],
|
|
1344
1112
|
describe: "Insert or update an asset",
|
|
1345
|
-
builder: (
|
|
1113
|
+
builder: (yargs36) => withConfiguration(
|
|
1346
1114
|
withApiOptions(
|
|
1347
1115
|
withProjectOptions(
|
|
1348
|
-
|
|
1116
|
+
yargs36.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1349
1117
|
)
|
|
1350
1118
|
)
|
|
1351
1119
|
),
|
|
@@ -1361,7 +1129,7 @@ var AssetUpdateModule = {
|
|
|
1361
1129
|
var AssetModule = {
|
|
1362
1130
|
command: "asset <command>",
|
|
1363
1131
|
describe: "Commands for Assets",
|
|
1364
|
-
builder: (
|
|
1132
|
+
builder: (yargs36) => yargs36.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1365
1133
|
handler: () => {
|
|
1366
1134
|
yargs.help();
|
|
1367
1135
|
}
|
|
@@ -1375,11 +1143,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1375
1143
|
var CategoryGetModule = {
|
|
1376
1144
|
command: "get <id>",
|
|
1377
1145
|
describe: "Fetch a category",
|
|
1378
|
-
builder: (
|
|
1146
|
+
builder: (yargs36) => withConfiguration(
|
|
1379
1147
|
withFormatOptions(
|
|
1380
1148
|
withApiOptions(
|
|
1381
1149
|
withProjectOptions(
|
|
1382
|
-
|
|
1150
|
+
yargs36.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1383
1151
|
)
|
|
1384
1152
|
)
|
|
1385
1153
|
)
|
|
@@ -1404,7 +1172,7 @@ var CategoryListModule = {
|
|
|
1404
1172
|
command: "list",
|
|
1405
1173
|
describe: "List categories",
|
|
1406
1174
|
aliases: ["ls"],
|
|
1407
|
-
builder: (
|
|
1175
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36.options({}))))),
|
|
1408
1176
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1409
1177
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1410
1178
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1454,11 +1222,11 @@ function createCategoriesEngineDataSource({
|
|
|
1454
1222
|
var CategoryPullModule = {
|
|
1455
1223
|
command: "pull <directory>",
|
|
1456
1224
|
describe: "Pulls all categories to local files in a directory",
|
|
1457
|
-
builder: (
|
|
1225
|
+
builder: (yargs36) => withConfiguration(
|
|
1458
1226
|
withApiOptions(
|
|
1459
1227
|
withProjectOptions(
|
|
1460
1228
|
withDiffOptions(
|
|
1461
|
-
|
|
1229
|
+
yargs36.positional("directory", {
|
|
1462
1230
|
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
1231
|
type: "string"
|
|
1464
1232
|
}).option("format", {
|
|
@@ -1536,11 +1304,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1536
1304
|
var CategoryPushModule = {
|
|
1537
1305
|
command: "push <directory>",
|
|
1538
1306
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1539
|
-
builder: (
|
|
1307
|
+
builder: (yargs36) => withConfiguration(
|
|
1540
1308
|
withApiOptions(
|
|
1541
1309
|
withProjectOptions(
|
|
1542
1310
|
withDiffOptions(
|
|
1543
|
-
|
|
1311
|
+
yargs36.positional("directory", {
|
|
1544
1312
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1545
1313
|
type: "string"
|
|
1546
1314
|
}).option("what-if", {
|
|
@@ -1607,10 +1375,10 @@ var CategoryRemoveModule = {
|
|
|
1607
1375
|
command: "remove <id>",
|
|
1608
1376
|
aliases: ["delete", "rm"],
|
|
1609
1377
|
describe: "Delete a category",
|
|
1610
|
-
builder: (
|
|
1378
|
+
builder: (yargs36) => withConfiguration(
|
|
1611
1379
|
withApiOptions(
|
|
1612
1380
|
withProjectOptions(
|
|
1613
|
-
|
|
1381
|
+
yargs36.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1614
1382
|
)
|
|
1615
1383
|
)
|
|
1616
1384
|
),
|
|
@@ -1627,10 +1395,10 @@ var CategoryUpdateModule = {
|
|
|
1627
1395
|
command: "update <filename>",
|
|
1628
1396
|
aliases: ["put"],
|
|
1629
1397
|
describe: "Insert or update a category",
|
|
1630
|
-
builder: (
|
|
1398
|
+
builder: (yargs36) => withConfiguration(
|
|
1631
1399
|
withApiOptions(
|
|
1632
1400
|
withProjectOptions(
|
|
1633
|
-
|
|
1401
|
+
yargs36.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1634
1402
|
)
|
|
1635
1403
|
)
|
|
1636
1404
|
),
|
|
@@ -1647,7 +1415,7 @@ var CategoryModule = {
|
|
|
1647
1415
|
command: "category <command>",
|
|
1648
1416
|
aliases: ["cat"],
|
|
1649
1417
|
describe: "Commands for Canvas categories",
|
|
1650
|
-
builder: (
|
|
1418
|
+
builder: (yargs36) => yargs36.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1651
1419
|
handler: () => {
|
|
1652
1420
|
yargs2.help();
|
|
1653
1421
|
}
|
|
@@ -1668,11 +1436,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1668
1436
|
var ComponentGetModule = {
|
|
1669
1437
|
command: "get <id>",
|
|
1670
1438
|
describe: "Fetch a component definition",
|
|
1671
|
-
builder: (
|
|
1439
|
+
builder: (yargs36) => withConfiguration(
|
|
1672
1440
|
withFormatOptions(
|
|
1673
1441
|
withApiOptions(
|
|
1674
1442
|
withProjectOptions(
|
|
1675
|
-
|
|
1443
|
+
yargs36.positional("id", {
|
|
1676
1444
|
demandOption: true,
|
|
1677
1445
|
describe: "Component definition public ID to fetch"
|
|
1678
1446
|
})
|
|
@@ -1706,11 +1474,11 @@ var ComponentListModule = {
|
|
|
1706
1474
|
command: "list",
|
|
1707
1475
|
describe: "List component definitions",
|
|
1708
1476
|
aliases: ["ls"],
|
|
1709
|
-
builder: (
|
|
1477
|
+
builder: (yargs36) => withConfiguration(
|
|
1710
1478
|
withFormatOptions(
|
|
1711
1479
|
withApiOptions(
|
|
1712
1480
|
withProjectOptions(
|
|
1713
|
-
|
|
1481
|
+
yargs36.options({
|
|
1714
1482
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1715
1483
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1716
1484
|
})
|
|
@@ -1766,11 +1534,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1766
1534
|
var ComponentPullModule = {
|
|
1767
1535
|
command: "pull <directory>",
|
|
1768
1536
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1769
|
-
builder: (
|
|
1537
|
+
builder: (yargs36) => withConfiguration(
|
|
1770
1538
|
withApiOptions(
|
|
1771
1539
|
withProjectOptions(
|
|
1772
1540
|
withDiffOptions(
|
|
1773
|
-
|
|
1541
|
+
yargs36.positional("directory", {
|
|
1774
1542
|
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
1543
|
type: "string"
|
|
1776
1544
|
}).option("format", {
|
|
@@ -1849,11 +1617,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1849
1617
|
var ComponentPushModule = {
|
|
1850
1618
|
command: "push <directory>",
|
|
1851
1619
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1852
|
-
builder: (
|
|
1620
|
+
builder: (yargs36) => withConfiguration(
|
|
1853
1621
|
withApiOptions(
|
|
1854
1622
|
withProjectOptions(
|
|
1855
1623
|
withDiffOptions(
|
|
1856
|
-
|
|
1624
|
+
yargs36.positional("directory", {
|
|
1857
1625
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1858
1626
|
type: "string"
|
|
1859
1627
|
}).option("what-if", {
|
|
@@ -1921,10 +1689,10 @@ var ComponentRemoveModule = {
|
|
|
1921
1689
|
command: "remove <id>",
|
|
1922
1690
|
aliases: ["delete", "rm"],
|
|
1923
1691
|
describe: "Delete a component definition",
|
|
1924
|
-
builder: (
|
|
1692
|
+
builder: (yargs36) => withConfiguration(
|
|
1925
1693
|
withApiOptions(
|
|
1926
1694
|
withProjectOptions(
|
|
1927
|
-
|
|
1695
|
+
yargs36.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1928
1696
|
)
|
|
1929
1697
|
)
|
|
1930
1698
|
),
|
|
@@ -1941,10 +1709,10 @@ var ComponentUpdateModule = {
|
|
|
1941
1709
|
command: "update <filename>",
|
|
1942
1710
|
aliases: ["put"],
|
|
1943
1711
|
describe: "Insert or update a component definition",
|
|
1944
|
-
builder: (
|
|
1712
|
+
builder: (yargs36) => withConfiguration(
|
|
1945
1713
|
withApiOptions(
|
|
1946
1714
|
withProjectOptions(
|
|
1947
|
-
|
|
1715
|
+
yargs36.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1948
1716
|
)
|
|
1949
1717
|
)
|
|
1950
1718
|
),
|
|
@@ -1961,7 +1729,7 @@ var ComponentModule = {
|
|
|
1961
1729
|
command: "component <command>",
|
|
1962
1730
|
aliases: ["def"],
|
|
1963
1731
|
describe: "Commands for Canvas component definitions",
|
|
1964
|
-
builder: (
|
|
1732
|
+
builder: (yargs36) => yargs36.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1965
1733
|
handler: () => {
|
|
1966
1734
|
yargs3.help();
|
|
1967
1735
|
}
|
|
@@ -1975,12 +1743,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1975
1743
|
var CompositionGetModule = {
|
|
1976
1744
|
command: "get <id>",
|
|
1977
1745
|
describe: "Fetch a composition",
|
|
1978
|
-
builder: (
|
|
1746
|
+
builder: (yargs36) => withFormatOptions(
|
|
1979
1747
|
withConfiguration(
|
|
1980
1748
|
withApiOptions(
|
|
1981
1749
|
withProjectOptions(
|
|
1982
1750
|
withStateOptions(
|
|
1983
|
-
|
|
1751
|
+
yargs36.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1984
1752
|
resolvePatterns: {
|
|
1985
1753
|
type: "boolean",
|
|
1986
1754
|
default: false,
|
|
@@ -2005,6 +1773,11 @@ var CompositionGetModule = {
|
|
|
2005
1773
|
type: "boolean",
|
|
2006
1774
|
default: false,
|
|
2007
1775
|
describe: "Include diagnostics information when resolving data"
|
|
1776
|
+
},
|
|
1777
|
+
resolutionDepth: {
|
|
1778
|
+
type: "number",
|
|
1779
|
+
default: 1,
|
|
1780
|
+
describe: "Controls how many levels deep content references should be resolved"
|
|
2008
1781
|
}
|
|
2009
1782
|
})
|
|
2010
1783
|
)
|
|
@@ -2026,7 +1799,8 @@ var CompositionGetModule = {
|
|
|
2026
1799
|
resolveOverrides,
|
|
2027
1800
|
componentIDs,
|
|
2028
1801
|
resolveData,
|
|
2029
|
-
diagnostics
|
|
1802
|
+
diagnostics,
|
|
1803
|
+
resolutionDepth
|
|
2030
1804
|
}) => {
|
|
2031
1805
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2032
1806
|
const client = new UncachedCanvasClient7({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
|
|
@@ -2038,7 +1812,8 @@ var CompositionGetModule = {
|
|
|
2038
1812
|
skipOverridesResolution: !resolveOverrides,
|
|
2039
1813
|
withComponentIDs: componentIDs,
|
|
2040
1814
|
skipDataResolution: !resolveData,
|
|
2041
|
-
diagnostics
|
|
1815
|
+
diagnostics: resolveData ? diagnostics : void 0,
|
|
1816
|
+
resolutionDepth: resolveData ? resolutionDepth : void 0
|
|
2042
1817
|
})
|
|
2043
1818
|
);
|
|
2044
1819
|
emitWithFormat(res, format, filename);
|
|
@@ -2057,12 +1832,12 @@ var CompositionListModule = {
|
|
|
2057
1832
|
command: "list",
|
|
2058
1833
|
describe: "List compositions",
|
|
2059
1834
|
aliases: ["ls"],
|
|
2060
|
-
builder: (
|
|
1835
|
+
builder: (yargs36) => withFormatOptions(
|
|
2061
1836
|
withConfiguration(
|
|
2062
1837
|
withApiOptions(
|
|
2063
1838
|
withProjectOptions(
|
|
2064
1839
|
withStateOptions(
|
|
2065
|
-
|
|
1840
|
+
yargs36.options({
|
|
2066
1841
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2067
1842
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2068
1843
|
search: { describe: "Search query", type: "string", default: "" },
|
|
@@ -2109,6 +1884,7 @@ var CompositionListModule = {
|
|
|
2109
1884
|
filename,
|
|
2110
1885
|
onlyCompositions,
|
|
2111
1886
|
onlyPatterns,
|
|
1887
|
+
patternType,
|
|
2112
1888
|
project: projectId,
|
|
2113
1889
|
state,
|
|
2114
1890
|
resolvePatterns,
|
|
@@ -2120,8 +1896,9 @@ var CompositionListModule = {
|
|
|
2120
1896
|
const res = await client.getCompositionList({
|
|
2121
1897
|
limit,
|
|
2122
1898
|
offset,
|
|
2123
|
-
search: search.length > 0 ? search : void 0,
|
|
1899
|
+
search: search && search.length > 0 ? search : void 0,
|
|
2124
1900
|
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
1901
|
+
patternType,
|
|
2125
1902
|
state: convertStateOption(state),
|
|
2126
1903
|
skipPatternResolution: !resolvePatterns,
|
|
2127
1904
|
withComponentIDs: componentIDs,
|
|
@@ -2135,12 +1912,12 @@ var CompositionListModule = {
|
|
|
2135
1912
|
var ComponentPatternListModule = {
|
|
2136
1913
|
...CompositionListModule,
|
|
2137
1914
|
describe: "List component patterns",
|
|
2138
|
-
builder: (
|
|
1915
|
+
builder: (yargs36) => withFormatOptions(
|
|
2139
1916
|
withConfiguration(
|
|
2140
1917
|
withApiOptions(
|
|
2141
1918
|
withProjectOptions(
|
|
2142
1919
|
withStateOptions(
|
|
2143
|
-
|
|
1920
|
+
yargs36.options({
|
|
2144
1921
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2145
1922
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2146
1923
|
resolvePatterns: {
|
|
@@ -2160,6 +1937,11 @@ var ComponentPatternListModule = {
|
|
|
2160
1937
|
type: "boolean",
|
|
2161
1938
|
hidden: true
|
|
2162
1939
|
},
|
|
1940
|
+
patternType: {
|
|
1941
|
+
default: "component",
|
|
1942
|
+
choices: ["all", "component", "composition"],
|
|
1943
|
+
hidden: true
|
|
1944
|
+
},
|
|
2163
1945
|
componentIDs: {
|
|
2164
1946
|
alias: ["componentIDs"],
|
|
2165
1947
|
type: "boolean",
|
|
@@ -2187,6 +1969,7 @@ function createComponentInstanceEngineDataSource({
|
|
|
2187
1969
|
state,
|
|
2188
1970
|
onlyCompositions,
|
|
2189
1971
|
onlyPatterns,
|
|
1972
|
+
patternType,
|
|
2190
1973
|
...clientOptions
|
|
2191
1974
|
}) {
|
|
2192
1975
|
const stateId = convertStateOption(state);
|
|
@@ -2200,7 +1983,8 @@ function createComponentInstanceEngineDataSource({
|
|
|
2200
1983
|
state: stateId,
|
|
2201
1984
|
skipPatternResolution: true,
|
|
2202
1985
|
skipOverridesResolution: true,
|
|
2203
|
-
withComponentIDs: true
|
|
1986
|
+
withComponentIDs: true,
|
|
1987
|
+
patternType
|
|
2204
1988
|
})).compositions,
|
|
2205
1989
|
{ pageSize: 100 }
|
|
2206
1990
|
);
|
|
@@ -2230,11 +2014,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2230
2014
|
var CompositionPublishModule = {
|
|
2231
2015
|
command: "publish [ids]",
|
|
2232
2016
|
describe: "Publishes composition(s)",
|
|
2233
|
-
builder: (
|
|
2017
|
+
builder: (yargs36) => withConfiguration(
|
|
2234
2018
|
withApiOptions(
|
|
2235
2019
|
withProjectOptions(
|
|
2236
2020
|
withDiffOptions(
|
|
2237
|
-
|
|
2021
|
+
yargs36.positional("ids", {
|
|
2238
2022
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2239
2023
|
type: "string"
|
|
2240
2024
|
}).option("all", {
|
|
@@ -2270,7 +2054,8 @@ var CompositionPublishModule = {
|
|
|
2270
2054
|
whatIf,
|
|
2271
2055
|
project: projectId,
|
|
2272
2056
|
onlyCompositions,
|
|
2273
|
-
onlyPatterns
|
|
2057
|
+
onlyPatterns,
|
|
2058
|
+
patternType
|
|
2274
2059
|
}) => {
|
|
2275
2060
|
if (!all && !ids || all && ids) {
|
|
2276
2061
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
@@ -2284,14 +2069,16 @@ var CompositionPublishModule = {
|
|
|
2284
2069
|
state: "preview",
|
|
2285
2070
|
compositionIDs: compositionIDsArray,
|
|
2286
2071
|
onlyCompositions,
|
|
2287
|
-
onlyPatterns
|
|
2072
|
+
onlyPatterns,
|
|
2073
|
+
patternType
|
|
2288
2074
|
});
|
|
2289
2075
|
const target = createComponentInstanceEngineDataSource({
|
|
2290
2076
|
client,
|
|
2291
2077
|
state: "published",
|
|
2292
2078
|
compositionIDs: compositionIDsArray,
|
|
2293
2079
|
onlyCompositions,
|
|
2294
|
-
onlyPatterns
|
|
2080
|
+
onlyPatterns,
|
|
2081
|
+
patternType
|
|
2295
2082
|
});
|
|
2296
2083
|
await syncEngine({
|
|
2297
2084
|
source,
|
|
@@ -2308,11 +2095,11 @@ var CompositionPublishModule = {
|
|
|
2308
2095
|
var ComponentPatternPublishModule = {
|
|
2309
2096
|
...CompositionPublishModule,
|
|
2310
2097
|
describe: "Publishes component pattern(s)",
|
|
2311
|
-
builder: (
|
|
2098
|
+
builder: (yargs36) => withConfiguration(
|
|
2312
2099
|
withApiOptions(
|
|
2313
2100
|
withProjectOptions(
|
|
2314
2101
|
withDiffOptions(
|
|
2315
|
-
|
|
2102
|
+
yargs36.positional("ids", {
|
|
2316
2103
|
describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2317
2104
|
type: "string"
|
|
2318
2105
|
}).option("all", {
|
|
@@ -2339,6 +2126,10 @@ var ComponentPatternPublishModule = {
|
|
|
2339
2126
|
default: true,
|
|
2340
2127
|
type: "boolean",
|
|
2341
2128
|
hidden: true
|
|
2129
|
+
}).option("patternType", {
|
|
2130
|
+
default: "component",
|
|
2131
|
+
choices: ["all", "component", "composition"],
|
|
2132
|
+
hidden: true
|
|
2342
2133
|
})
|
|
2343
2134
|
)
|
|
2344
2135
|
)
|
|
@@ -2352,12 +2143,12 @@ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
|
2352
2143
|
var CompositionPullModule = {
|
|
2353
2144
|
command: "pull <directory>",
|
|
2354
2145
|
describe: "Pulls all compositions to local files in a directory",
|
|
2355
|
-
builder: (
|
|
2146
|
+
builder: (yargs36) => withConfiguration(
|
|
2356
2147
|
withApiOptions(
|
|
2357
2148
|
withProjectOptions(
|
|
2358
2149
|
withStateOptions(
|
|
2359
2150
|
withDiffOptions(
|
|
2360
|
-
|
|
2151
|
+
yargs36.positional("directory", {
|
|
2361
2152
|
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
2153
|
type: "string"
|
|
2363
2154
|
}).option("format", {
|
|
@@ -2400,6 +2191,7 @@ var CompositionPullModule = {
|
|
|
2400
2191
|
format,
|
|
2401
2192
|
onlyCompositions,
|
|
2402
2193
|
onlyPatterns,
|
|
2194
|
+
patternType = "all",
|
|
2403
2195
|
mode,
|
|
2404
2196
|
whatIf,
|
|
2405
2197
|
state,
|
|
@@ -2410,14 +2202,20 @@ var CompositionPullModule = {
|
|
|
2410
2202
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2411
2203
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2412
2204
|
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2413
|
-
const source = createComponentInstanceEngineDataSource({
|
|
2205
|
+
const source = createComponentInstanceEngineDataSource({
|
|
2206
|
+
client,
|
|
2207
|
+
state,
|
|
2208
|
+
onlyCompositions,
|
|
2209
|
+
onlyPatterns,
|
|
2210
|
+
patternType
|
|
2211
|
+
});
|
|
2414
2212
|
const isPackage = isPathAPackageFile(directory);
|
|
2415
2213
|
let target;
|
|
2416
2214
|
if (isPackage) {
|
|
2417
2215
|
const packageContents = readCanvasPackage(directory, false);
|
|
2418
2216
|
target = await createArraySyncEngineDataSource({
|
|
2419
2217
|
name: `Package file ${directory}`,
|
|
2420
|
-
objects:
|
|
2218
|
+
objects: packageContents?.compositions ?? [],
|
|
2421
2219
|
selectIdentifier: selectIdentifier3,
|
|
2422
2220
|
selectDisplayName: selectDisplayName3,
|
|
2423
2221
|
onSyncComplete: async (_, synced) => {
|
|
@@ -2460,12 +2258,12 @@ var CompositionPullModule = {
|
|
|
2460
2258
|
var ComponentPatternPullModule = {
|
|
2461
2259
|
...CompositionPullModule,
|
|
2462
2260
|
describe: "Pulls all component patterns to local files in a directory",
|
|
2463
|
-
builder: (
|
|
2261
|
+
builder: (yargs36) => withConfiguration(
|
|
2464
2262
|
withApiOptions(
|
|
2465
2263
|
withProjectOptions(
|
|
2466
2264
|
withStateOptions(
|
|
2467
2265
|
withDiffOptions(
|
|
2468
|
-
|
|
2266
|
+
yargs36.positional("directory", {
|
|
2469
2267
|
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
2268
|
type: "string"
|
|
2471
2269
|
}).option("format", {
|
|
@@ -2480,6 +2278,10 @@ var ComponentPatternPullModule = {
|
|
|
2480
2278
|
default: true,
|
|
2481
2279
|
type: "boolean",
|
|
2482
2280
|
hidden: true
|
|
2281
|
+
}).option("patternType", {
|
|
2282
|
+
default: "component",
|
|
2283
|
+
choices: ["all", "component", "composition"],
|
|
2284
|
+
hidden: true
|
|
2483
2285
|
}).option("what-if", {
|
|
2484
2286
|
alias: ["w"],
|
|
2485
2287
|
describe: "What-if mode reports what would be done but changes no files",
|
|
@@ -2505,12 +2307,12 @@ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
|
2505
2307
|
var CompositionPushModule = {
|
|
2506
2308
|
command: "push <directory>",
|
|
2507
2309
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2508
|
-
builder: (
|
|
2310
|
+
builder: (yargs36) => withConfiguration(
|
|
2509
2311
|
withApiOptions(
|
|
2510
2312
|
withProjectOptions(
|
|
2511
2313
|
withStateOptions(
|
|
2512
2314
|
withDiffOptions(
|
|
2513
|
-
|
|
2315
|
+
yargs36.positional("directory", {
|
|
2514
2316
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2515
2317
|
type: "string"
|
|
2516
2318
|
}).option("what-if", {
|
|
@@ -2550,6 +2352,7 @@ var CompositionPushModule = {
|
|
|
2550
2352
|
project: projectId,
|
|
2551
2353
|
onlyCompositions,
|
|
2552
2354
|
onlyPatterns,
|
|
2355
|
+
patternType,
|
|
2553
2356
|
diff: diffMode,
|
|
2554
2357
|
allowEmptySource
|
|
2555
2358
|
}) => {
|
|
@@ -2572,7 +2375,13 @@ var CompositionPushModule = {
|
|
|
2572
2375
|
selectDisplayName: selectDisplayName3
|
|
2573
2376
|
});
|
|
2574
2377
|
}
|
|
2575
|
-
const target = createComponentInstanceEngineDataSource({
|
|
2378
|
+
const target = createComponentInstanceEngineDataSource({
|
|
2379
|
+
client,
|
|
2380
|
+
state,
|
|
2381
|
+
onlyCompositions,
|
|
2382
|
+
onlyPatterns,
|
|
2383
|
+
patternType
|
|
2384
|
+
});
|
|
2576
2385
|
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2577
2386
|
await syncEngine({
|
|
2578
2387
|
source,
|
|
@@ -2600,12 +2409,12 @@ var CompositionPushModule = {
|
|
|
2600
2409
|
var ComponentPatternPushModule = {
|
|
2601
2410
|
...CompositionPushModule,
|
|
2602
2411
|
describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
|
|
2603
|
-
builder: (
|
|
2412
|
+
builder: (yargs36) => withConfiguration(
|
|
2604
2413
|
withApiOptions(
|
|
2605
2414
|
withProjectOptions(
|
|
2606
2415
|
withStateOptions(
|
|
2607
2416
|
withDiffOptions(
|
|
2608
|
-
|
|
2417
|
+
yargs36.positional("directory", {
|
|
2609
2418
|
describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
|
|
2610
2419
|
type: "string"
|
|
2611
2420
|
}).option("what-if", {
|
|
@@ -2625,6 +2434,10 @@ var ComponentPatternPushModule = {
|
|
|
2625
2434
|
default: true,
|
|
2626
2435
|
type: "boolean",
|
|
2627
2436
|
hidden: true
|
|
2437
|
+
}).option("patternType", {
|
|
2438
|
+
default: "component",
|
|
2439
|
+
choices: ["all", "component", "composition"],
|
|
2440
|
+
hidden: true
|
|
2628
2441
|
})
|
|
2629
2442
|
)
|
|
2630
2443
|
)
|
|
@@ -2639,10 +2452,10 @@ var CompositionRemoveModule = {
|
|
|
2639
2452
|
command: "remove <id>",
|
|
2640
2453
|
aliases: ["delete", "rm"],
|
|
2641
2454
|
describe: "Delete a composition",
|
|
2642
|
-
builder: (
|
|
2455
|
+
builder: (yargs36) => withConfiguration(
|
|
2643
2456
|
withApiOptions(
|
|
2644
2457
|
withProjectOptions(
|
|
2645
|
-
|
|
2458
|
+
yargs36.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2646
2459
|
)
|
|
2647
2460
|
)
|
|
2648
2461
|
),
|
|
@@ -2660,15 +2473,18 @@ var ComponentPatternRemoveModule = {
|
|
|
2660
2473
|
};
|
|
2661
2474
|
|
|
2662
2475
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
2663
|
-
import {
|
|
2476
|
+
import {
|
|
2477
|
+
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2,
|
|
2478
|
+
UncachedCanvasClient as UncachedCanvasClient13
|
|
2479
|
+
} from "@uniformdev/canvas";
|
|
2664
2480
|
import { diffJson as diffJson2 } from "diff";
|
|
2665
2481
|
var CompositionUnpublishModule = {
|
|
2666
2482
|
command: "unpublish [ids]",
|
|
2667
2483
|
describe: "Unpublish a composition(s)",
|
|
2668
|
-
builder: (
|
|
2484
|
+
builder: (yargs36) => withConfiguration(
|
|
2669
2485
|
withApiOptions(
|
|
2670
2486
|
withProjectOptions(
|
|
2671
|
-
|
|
2487
|
+
yargs36.positional("ids", {
|
|
2672
2488
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2673
2489
|
type: "string"
|
|
2674
2490
|
}).option("all", {
|
|
@@ -2702,6 +2518,7 @@ var CompositionUnpublishModule = {
|
|
|
2702
2518
|
all,
|
|
2703
2519
|
onlyCompositions,
|
|
2704
2520
|
onlyPatterns,
|
|
2521
|
+
patternType,
|
|
2705
2522
|
project: projectId,
|
|
2706
2523
|
whatIf
|
|
2707
2524
|
}) => {
|
|
@@ -2718,14 +2535,16 @@ var CompositionUnpublishModule = {
|
|
|
2718
2535
|
state: "published",
|
|
2719
2536
|
compositionIDs: compositionIDsArray,
|
|
2720
2537
|
onlyCompositions,
|
|
2721
|
-
onlyPatterns
|
|
2538
|
+
onlyPatterns,
|
|
2539
|
+
patternType
|
|
2722
2540
|
});
|
|
2723
2541
|
const target = createComponentInstanceEngineDataSource({
|
|
2724
2542
|
client,
|
|
2725
2543
|
state: "preview",
|
|
2726
2544
|
compositionIDs: compositionIDsArray,
|
|
2727
2545
|
onlyCompositions,
|
|
2728
|
-
onlyPatterns
|
|
2546
|
+
onlyPatterns,
|
|
2547
|
+
patternType
|
|
2729
2548
|
});
|
|
2730
2549
|
const actions = [];
|
|
2731
2550
|
const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
@@ -2760,15 +2579,15 @@ var CompositionUnpublishModule = {
|
|
|
2760
2579
|
var ComponentPatternUnpublishModule = {
|
|
2761
2580
|
command: "unpublish [ids]",
|
|
2762
2581
|
describe: "Unpublish a component pattern(s)",
|
|
2763
|
-
builder: (
|
|
2582
|
+
builder: (yargs36) => withConfiguration(
|
|
2764
2583
|
withApiOptions(
|
|
2765
2584
|
withProjectOptions(
|
|
2766
|
-
|
|
2585
|
+
yargs36.positional("ids", {
|
|
2767
2586
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2768
2587
|
type: "string"
|
|
2769
2588
|
}).option("all", {
|
|
2770
2589
|
alias: ["a"],
|
|
2771
|
-
describe: "Un-
|
|
2590
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
2772
2591
|
default: false,
|
|
2773
2592
|
type: "boolean"
|
|
2774
2593
|
}).option("what-if", {
|
|
@@ -2777,14 +2596,18 @@ var ComponentPatternUnpublishModule = {
|
|
|
2777
2596
|
default: false,
|
|
2778
2597
|
type: "boolean"
|
|
2779
2598
|
}).option("onlyCompositions", {
|
|
2780
|
-
describe: "Only publishing compositions and not component patterns",
|
|
2599
|
+
describe: "Only un-publishing compositions and not component patterns",
|
|
2781
2600
|
default: false,
|
|
2782
2601
|
type: "boolean"
|
|
2783
2602
|
}).option("onlyPatterns", {
|
|
2784
|
-
describe: "Only
|
|
2603
|
+
describe: "Only un-publishing component patterns and not compositions",
|
|
2785
2604
|
default: true,
|
|
2786
2605
|
type: "boolean",
|
|
2787
2606
|
hidden: true
|
|
2607
|
+
}).option("patternType", {
|
|
2608
|
+
default: "component",
|
|
2609
|
+
choices: ["all", "component", "composition"],
|
|
2610
|
+
hidden: true
|
|
2788
2611
|
})
|
|
2789
2612
|
)
|
|
2790
2613
|
)
|
|
@@ -2798,11 +2621,11 @@ var CompositionUpdateModule = {
|
|
|
2798
2621
|
command: "update <filename>",
|
|
2799
2622
|
aliases: ["put"],
|
|
2800
2623
|
describe: "Insert or update a composition",
|
|
2801
|
-
builder: (
|
|
2624
|
+
builder: (yargs36) => withConfiguration(
|
|
2802
2625
|
withApiOptions(
|
|
2803
2626
|
withProjectOptions(
|
|
2804
2627
|
withStateOptions(
|
|
2805
|
-
|
|
2628
|
+
yargs36.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2806
2629
|
)
|
|
2807
2630
|
)
|
|
2808
2631
|
)
|
|
@@ -2824,9 +2647,8 @@ var ComponentPatternUpdateModule = {
|
|
|
2824
2647
|
// src/commands/canvas/commands/componentPattern.ts
|
|
2825
2648
|
var ComponentPatternModule = {
|
|
2826
2649
|
command: "component-pattern <command>",
|
|
2827
|
-
aliases: ["pattern"],
|
|
2828
2650
|
describe: "Commands for Canvas component patterns",
|
|
2829
|
-
builder: (
|
|
2651
|
+
builder: (yargs36) => yargs36.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
|
|
2830
2652
|
handler: () => {
|
|
2831
2653
|
yargs4.help();
|
|
2832
2654
|
}
|
|
@@ -2838,133 +2660,384 @@ var CompositionModule = {
|
|
|
2838
2660
|
command: "composition <command>",
|
|
2839
2661
|
describe: "Commands for Canvas compositions",
|
|
2840
2662
|
aliases: ["comp"],
|
|
2841
|
-
builder: (
|
|
2663
|
+
builder: (yargs36) => yargs36.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2842
2664
|
handler: () => {
|
|
2843
2665
|
yargs5.help();
|
|
2844
2666
|
}
|
|
2845
2667
|
};
|
|
2846
2668
|
|
|
2847
|
-
// src/commands/canvas/commands/
|
|
2669
|
+
// src/commands/canvas/commands/compositionPattern.ts
|
|
2848
2670
|
import yargs6 from "yargs";
|
|
2849
2671
|
|
|
2850
|
-
// src/commands/canvas/commands/
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2672
|
+
// src/commands/canvas/commands/compositionPattern/get.ts
|
|
2673
|
+
var CompositionPatternGetModule = {
|
|
2674
|
+
...CompositionGetModule,
|
|
2675
|
+
describe: "Fetch a composition pattern"
|
|
2676
|
+
};
|
|
2677
|
+
|
|
2678
|
+
// src/commands/canvas/commands/compositionPattern/list.ts
|
|
2679
|
+
var CompositionPatternListModule = {
|
|
2680
|
+
...CompositionListModule,
|
|
2681
|
+
describe: "List composition patterns",
|
|
2682
|
+
builder: (yargs36) => withFormatOptions(
|
|
2683
|
+
withConfiguration(
|
|
2857
2684
|
withApiOptions(
|
|
2858
2685
|
withProjectOptions(
|
|
2859
|
-
|
|
2860
|
-
|
|
2686
|
+
withStateOptions(
|
|
2687
|
+
yargs36.options({
|
|
2688
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2689
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2690
|
+
resolvePatterns: {
|
|
2691
|
+
type: "boolean",
|
|
2692
|
+
default: false,
|
|
2693
|
+
describe: "Resolve composition pattern references in the composition"
|
|
2694
|
+
},
|
|
2695
|
+
resolveOverrides: {
|
|
2696
|
+
type: "boolean",
|
|
2697
|
+
default: false,
|
|
2698
|
+
describe: "Resolves composition pattern overrides in the composition and removes override definition data"
|
|
2699
|
+
},
|
|
2700
|
+
onlyPatterns: {
|
|
2701
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2702
|
+
// This default differentiate this list command from composition list command
|
|
2703
|
+
default: true,
|
|
2704
|
+
type: "boolean",
|
|
2705
|
+
hidden: true
|
|
2706
|
+
},
|
|
2707
|
+
patternType: {
|
|
2708
|
+
default: "composition",
|
|
2709
|
+
choices: ["all", "component", "composition"],
|
|
2710
|
+
hidden: true
|
|
2711
|
+
},
|
|
2712
|
+
componentIDs: {
|
|
2713
|
+
alias: ["componentIDs"],
|
|
2714
|
+
type: "boolean",
|
|
2715
|
+
default: false,
|
|
2716
|
+
describe: "Include individual composition pattern UIDs"
|
|
2717
|
+
}
|
|
2718
|
+
})
|
|
2719
|
+
)
|
|
2861
2720
|
)
|
|
2862
2721
|
)
|
|
2863
2722
|
)
|
|
2864
|
-
)
|
|
2865
|
-
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
2866
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
2867
|
-
const client = new ContentClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2868
|
-
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2869
|
-
const found = res.contentTypes.find((f) => f.id === id);
|
|
2870
|
-
if (!found) {
|
|
2871
|
-
throw new Error(`Content type with ID ${id} not found`);
|
|
2872
|
-
}
|
|
2873
|
-
emitWithFormat(found, format, filename);
|
|
2874
|
-
}
|
|
2875
|
-
};
|
|
2876
|
-
|
|
2877
|
-
// src/commands/canvas/commands/contentType/list.ts
|
|
2878
|
-
import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
2879
|
-
var ContentTypeListModule = {
|
|
2880
|
-
command: "list",
|
|
2881
|
-
describe: "List content types",
|
|
2882
|
-
builder: (yargs34) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs34)))),
|
|
2883
|
-
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2884
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
2885
|
-
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2886
|
-
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2887
|
-
emitWithFormat(res.contentTypes, format, filename);
|
|
2888
|
-
}
|
|
2723
|
+
)
|
|
2889
2724
|
};
|
|
2890
2725
|
|
|
2891
|
-
// src/commands/canvas/commands/
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
|
|
2897
|
-
|
|
2898
|
-
// src/commands/canvas/contentTypeEngineDataSource.ts
|
|
2899
|
-
function createContentTypeEngineDataSource({
|
|
2900
|
-
client
|
|
2901
|
-
}) {
|
|
2902
|
-
async function* getObjects() {
|
|
2903
|
-
const { contentTypes } = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2904
|
-
for await (const ct of contentTypes) {
|
|
2905
|
-
const result = {
|
|
2906
|
-
id: selectContentTypeIdentifier(ct),
|
|
2907
|
-
displayName: selectContentTypeDisplayName(ct),
|
|
2908
|
-
providerId: ct.id,
|
|
2909
|
-
object: ct
|
|
2910
|
-
};
|
|
2911
|
-
yield result;
|
|
2912
|
-
}
|
|
2913
|
-
}
|
|
2914
|
-
return {
|
|
2915
|
-
name: "Uniform API",
|
|
2916
|
-
objects: getObjects(),
|
|
2917
|
-
deleteObject: async (providerId) => {
|
|
2918
|
-
await client.deleteContentType({ contentTypeId: providerId });
|
|
2919
|
-
},
|
|
2920
|
-
writeObject: async ({ object }) => {
|
|
2921
|
-
await client.upsertContentType({ contentType: object });
|
|
2922
|
-
}
|
|
2923
|
-
};
|
|
2924
|
-
}
|
|
2925
|
-
|
|
2926
|
-
// src/commands/canvas/commands/contentType/pull.ts
|
|
2927
|
-
var ContentTypePullModule = {
|
|
2928
|
-
command: "pull <directory>",
|
|
2929
|
-
describe: "Pulls all content types to local files in a directory",
|
|
2930
|
-
builder: (yargs34) => withConfiguration(
|
|
2726
|
+
// src/commands/canvas/commands/compositionPattern/publish.ts
|
|
2727
|
+
var CompositionPatternPublishModule = {
|
|
2728
|
+
...CompositionPublishModule,
|
|
2729
|
+
describe: "Publishes composition pattern(s)",
|
|
2730
|
+
builder: (yargs36) => withConfiguration(
|
|
2931
2731
|
withApiOptions(
|
|
2932
2732
|
withProjectOptions(
|
|
2933
2733
|
withDiffOptions(
|
|
2934
|
-
|
|
2935
|
-
describe: "
|
|
2936
|
-
type: "string"
|
|
2937
|
-
}).option("format", {
|
|
2938
|
-
alias: ["f"],
|
|
2939
|
-
describe: "Output format",
|
|
2940
|
-
default: "yaml",
|
|
2941
|
-
choices: ["yaml", "json"],
|
|
2734
|
+
yargs36.positional("ids", {
|
|
2735
|
+
describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2942
2736
|
type: "string"
|
|
2737
|
+
}).option("all", {
|
|
2738
|
+
alias: ["a"],
|
|
2739
|
+
describe: "Publishes all composition patterns. Use compositionId to publish one instead.",
|
|
2740
|
+
default: false,
|
|
2741
|
+
type: "boolean"
|
|
2943
2742
|
}).option("what-if", {
|
|
2944
2743
|
alias: ["w"],
|
|
2945
|
-
describe: "What-if mode reports what would be done but
|
|
2744
|
+
describe: "What-if mode reports what would be done but does not perform any un-publishing",
|
|
2946
2745
|
default: false,
|
|
2947
2746
|
type: "boolean"
|
|
2948
|
-
}).option("
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2747
|
+
}).option("publishingState", {
|
|
2748
|
+
describe: 'Publishing state to update to. Can be "published" or "preview".',
|
|
2749
|
+
default: "published",
|
|
2750
|
+
type: "string",
|
|
2751
|
+
hidden: true
|
|
2752
|
+
}).option("onlyCompositions", {
|
|
2753
|
+
describe: "Only publishing compositions and not composition patterns",
|
|
2754
|
+
default: false,
|
|
2755
|
+
type: "boolean",
|
|
2756
|
+
hidden: true
|
|
2757
|
+
}).option("patternType", {
|
|
2758
|
+
default: "composition",
|
|
2759
|
+
choices: ["all", "component", "composition"],
|
|
2760
|
+
hidden: true
|
|
2761
|
+
}).option("onlyPatterns", {
|
|
2762
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2763
|
+
default: true,
|
|
2764
|
+
type: "boolean",
|
|
2765
|
+
hidden: true
|
|
2954
2766
|
})
|
|
2955
2767
|
)
|
|
2956
2768
|
)
|
|
2957
2769
|
)
|
|
2958
|
-
)
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2770
|
+
)
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2773
|
+
// src/commands/canvas/commands/compositionPattern/pull.ts
|
|
2774
|
+
var CompositionPatternPullModule = {
|
|
2775
|
+
...CompositionPullModule,
|
|
2776
|
+
describe: "Pulls all composition patterns to local files in a directory",
|
|
2777
|
+
builder: (yargs36) => withConfiguration(
|
|
2778
|
+
withApiOptions(
|
|
2779
|
+
withProjectOptions(
|
|
2780
|
+
withStateOptions(
|
|
2781
|
+
withDiffOptions(
|
|
2782
|
+
yargs36.positional("directory", {
|
|
2783
|
+
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.",
|
|
2784
|
+
type: "string"
|
|
2785
|
+
}).option("format", {
|
|
2786
|
+
alias: ["f"],
|
|
2787
|
+
describe: "Output format",
|
|
2788
|
+
default: "yaml",
|
|
2789
|
+
choices: ["yaml", "json"],
|
|
2790
|
+
type: "string"
|
|
2791
|
+
}).option("onlyPatterns", {
|
|
2792
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2793
|
+
// This default differentiates this list command from composition list command
|
|
2794
|
+
default: true,
|
|
2795
|
+
type: "boolean",
|
|
2796
|
+
hidden: true
|
|
2797
|
+
}).option("patternType", {
|
|
2798
|
+
default: "composition",
|
|
2799
|
+
choices: ["all", "component", "composition"],
|
|
2800
|
+
hidden: true
|
|
2801
|
+
}).option("what-if", {
|
|
2802
|
+
alias: ["w"],
|
|
2803
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
2804
|
+
default: false,
|
|
2805
|
+
type: "boolean"
|
|
2806
|
+
}).option("mode", {
|
|
2807
|
+
alias: ["m"],
|
|
2808
|
+
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',
|
|
2809
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2810
|
+
default: "mirror",
|
|
2811
|
+
type: "string"
|
|
2812
|
+
})
|
|
2813
|
+
)
|
|
2814
|
+
)
|
|
2815
|
+
)
|
|
2816
|
+
)
|
|
2817
|
+
)
|
|
2818
|
+
};
|
|
2819
|
+
|
|
2820
|
+
// src/commands/canvas/commands/compositionPattern/push.ts
|
|
2821
|
+
var CompositionPatternPushModule = {
|
|
2822
|
+
...CompositionPushModule,
|
|
2823
|
+
describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
|
|
2824
|
+
builder: (yargs36) => withConfiguration(
|
|
2825
|
+
withApiOptions(
|
|
2826
|
+
withProjectOptions(
|
|
2827
|
+
withStateOptions(
|
|
2828
|
+
withDiffOptions(
|
|
2829
|
+
yargs36.positional("directory", {
|
|
2830
|
+
describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
|
|
2831
|
+
type: "string"
|
|
2832
|
+
}).option("what-if", {
|
|
2833
|
+
alias: ["w"],
|
|
2834
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
2835
|
+
default: false,
|
|
2836
|
+
type: "boolean"
|
|
2837
|
+
}).option("mode", {
|
|
2838
|
+
alias: ["m"],
|
|
2839
|
+
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',
|
|
2840
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
2841
|
+
default: "mirror",
|
|
2842
|
+
type: "string"
|
|
2843
|
+
}).option("onlyPatterns", {
|
|
2844
|
+
describe: "Only pulling composition patterns and not compositions",
|
|
2845
|
+
// This default differentiate this list command from composition list command
|
|
2846
|
+
default: true,
|
|
2847
|
+
type: "boolean",
|
|
2848
|
+
hidden: true
|
|
2849
|
+
}).option("patternType", {
|
|
2850
|
+
default: "composition",
|
|
2851
|
+
choices: ["all", "component", "composition"],
|
|
2852
|
+
hidden: true
|
|
2853
|
+
})
|
|
2854
|
+
)
|
|
2855
|
+
)
|
|
2856
|
+
)
|
|
2857
|
+
)
|
|
2858
|
+
)
|
|
2859
|
+
};
|
|
2860
|
+
|
|
2861
|
+
// src/commands/canvas/commands/compositionPattern/remove.ts
|
|
2862
|
+
var CompositionPatternRemoveModule = {
|
|
2863
|
+
...CompositionRemoveModule,
|
|
2864
|
+
describe: "Delete a composition pattern"
|
|
2865
|
+
};
|
|
2866
|
+
|
|
2867
|
+
// src/commands/canvas/commands/compositionPattern/unpublish.ts
|
|
2868
|
+
var CompositionPatternUnpublishModule = {
|
|
2869
|
+
command: "unpublish [ids]",
|
|
2870
|
+
describe: "Unpublish a composition pattern(s)",
|
|
2871
|
+
builder: (yargs36) => withConfiguration(
|
|
2872
|
+
withApiOptions(
|
|
2873
|
+
withProjectOptions(
|
|
2874
|
+
yargs36.positional("ids", {
|
|
2875
|
+
describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2876
|
+
type: "string"
|
|
2877
|
+
}).option("all", {
|
|
2878
|
+
alias: ["a"],
|
|
2879
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
2880
|
+
default: false,
|
|
2881
|
+
type: "boolean"
|
|
2882
|
+
}).option("what-if", {
|
|
2883
|
+
alias: ["w"],
|
|
2884
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
2885
|
+
default: false,
|
|
2886
|
+
type: "boolean"
|
|
2887
|
+
}).option("onlyCompositions", {
|
|
2888
|
+
describe: "Only un-publishing compositions and not composition patterns",
|
|
2889
|
+
default: false,
|
|
2890
|
+
type: "boolean",
|
|
2891
|
+
hidden: true
|
|
2892
|
+
}).option("onlyPatterns", {
|
|
2893
|
+
describe: "Only un-publishing composition patterns and not compositions",
|
|
2894
|
+
default: true,
|
|
2895
|
+
type: "boolean",
|
|
2896
|
+
hidden: true
|
|
2897
|
+
})
|
|
2898
|
+
)
|
|
2899
|
+
)
|
|
2900
|
+
),
|
|
2901
|
+
handler: CompositionUnpublishModule.handler
|
|
2902
|
+
};
|
|
2903
|
+
|
|
2904
|
+
// src/commands/canvas/commands/compositionPattern/update.ts
|
|
2905
|
+
var CompositionPatternUpdateModule = {
|
|
2906
|
+
...CompositionUpdateModule,
|
|
2907
|
+
describe: "Insert or update a composition pattern"
|
|
2908
|
+
};
|
|
2909
|
+
|
|
2910
|
+
// src/commands/canvas/commands/compositionPattern.ts
|
|
2911
|
+
var CompositionPatternModule = {
|
|
2912
|
+
command: "composition-pattern <command>",
|
|
2913
|
+
describe: "Commands for Canvas composition patterns",
|
|
2914
|
+
builder: (yargs36) => yargs36.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
|
|
2915
|
+
handler: () => {
|
|
2916
|
+
yargs6.help();
|
|
2917
|
+
}
|
|
2918
|
+
};
|
|
2919
|
+
|
|
2920
|
+
// src/commands/canvas/commands/contentType.ts
|
|
2921
|
+
import yargs7 from "yargs";
|
|
2922
|
+
|
|
2923
|
+
// src/commands/canvas/commands/contentType/get.ts
|
|
2924
|
+
import { ContentClient } from "@uniformdev/canvas";
|
|
2925
|
+
var ContentTypeGetModule = {
|
|
2926
|
+
command: "get <id>",
|
|
2927
|
+
describe: "Get a content type",
|
|
2928
|
+
builder: (yargs36) => withConfiguration(
|
|
2929
|
+
withFormatOptions(
|
|
2930
|
+
withApiOptions(
|
|
2931
|
+
withProjectOptions(
|
|
2932
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2933
|
+
yargs36.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2934
|
+
)
|
|
2935
|
+
)
|
|
2936
|
+
)
|
|
2937
|
+
),
|
|
2938
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
2939
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2940
|
+
const client = new ContentClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2941
|
+
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2942
|
+
const found = res.contentTypes.find((f) => f.id === id);
|
|
2943
|
+
if (!found) {
|
|
2944
|
+
throw new Error(`Content type with ID ${id} not found`);
|
|
2945
|
+
}
|
|
2946
|
+
emitWithFormat(found, format, filename);
|
|
2947
|
+
}
|
|
2948
|
+
};
|
|
2949
|
+
|
|
2950
|
+
// src/commands/canvas/commands/contentType/list.ts
|
|
2951
|
+
import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
2952
|
+
var ContentTypeListModule = {
|
|
2953
|
+
command: "list",
|
|
2954
|
+
describe: "List content types",
|
|
2955
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
2956
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2957
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
2958
|
+
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
2959
|
+
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2960
|
+
emitWithFormat(res.contentTypes, format, filename);
|
|
2961
|
+
}
|
|
2962
|
+
};
|
|
2963
|
+
|
|
2964
|
+
// src/commands/canvas/commands/contentType/pull.ts
|
|
2965
|
+
import { ContentClient as ContentClient3 } from "@uniformdev/canvas";
|
|
2966
|
+
|
|
2967
|
+
// src/commands/canvas/commands/contentType/_util.ts
|
|
2968
|
+
var selectContentTypeIdentifier = (ct) => ct.id;
|
|
2969
|
+
var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
|
|
2970
|
+
|
|
2971
|
+
// src/commands/canvas/contentTypeEngineDataSource.ts
|
|
2972
|
+
function createContentTypeEngineDataSource({
|
|
2973
|
+
client
|
|
2974
|
+
}) {
|
|
2975
|
+
async function* getObjects() {
|
|
2976
|
+
const { contentTypes } = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
2977
|
+
for await (const ct of contentTypes) {
|
|
2978
|
+
const result = {
|
|
2979
|
+
id: selectContentTypeIdentifier(ct),
|
|
2980
|
+
displayName: selectContentTypeDisplayName(ct),
|
|
2981
|
+
providerId: ct.id,
|
|
2982
|
+
object: ct
|
|
2983
|
+
};
|
|
2984
|
+
yield result;
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
return {
|
|
2988
|
+
name: "Uniform API",
|
|
2989
|
+
objects: getObjects(),
|
|
2990
|
+
deleteObject: async (providerId) => {
|
|
2991
|
+
await client.deleteContentType({ contentTypeId: providerId });
|
|
2992
|
+
},
|
|
2993
|
+
writeObject: async ({ object }) => {
|
|
2994
|
+
await client.upsertContentType({ contentType: object });
|
|
2995
|
+
}
|
|
2996
|
+
};
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
// src/commands/canvas/commands/contentType/pull.ts
|
|
3000
|
+
var ContentTypePullModule = {
|
|
3001
|
+
command: "pull <directory>",
|
|
3002
|
+
describe: "Pulls all content types to local files in a directory",
|
|
3003
|
+
builder: (yargs36) => withConfiguration(
|
|
3004
|
+
withApiOptions(
|
|
3005
|
+
withProjectOptions(
|
|
3006
|
+
withDiffOptions(
|
|
3007
|
+
yargs36.positional("directory", {
|
|
3008
|
+
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.",
|
|
3009
|
+
type: "string"
|
|
3010
|
+
}).option("format", {
|
|
3011
|
+
alias: ["f"],
|
|
3012
|
+
describe: "Output format",
|
|
3013
|
+
default: "yaml",
|
|
3014
|
+
choices: ["yaml", "json"],
|
|
3015
|
+
type: "string"
|
|
3016
|
+
}).option("what-if", {
|
|
3017
|
+
alias: ["w"],
|
|
3018
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3019
|
+
default: false,
|
|
3020
|
+
type: "boolean"
|
|
3021
|
+
}).option("mode", {
|
|
3022
|
+
alias: ["m"],
|
|
3023
|
+
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',
|
|
3024
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3025
|
+
default: "mirror",
|
|
3026
|
+
type: "string"
|
|
3027
|
+
})
|
|
3028
|
+
)
|
|
3029
|
+
)
|
|
3030
|
+
)
|
|
3031
|
+
),
|
|
3032
|
+
handler: async ({
|
|
3033
|
+
apiHost,
|
|
3034
|
+
apiKey,
|
|
3035
|
+
proxy,
|
|
3036
|
+
directory,
|
|
3037
|
+
format,
|
|
3038
|
+
mode,
|
|
3039
|
+
whatIf,
|
|
3040
|
+
project: projectId,
|
|
2968
3041
|
diff: diffMode,
|
|
2969
3042
|
allowEmptySource
|
|
2970
3043
|
}) => {
|
|
@@ -3015,11 +3088,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
3015
3088
|
var ContentTypePushModule = {
|
|
3016
3089
|
command: "push <directory>",
|
|
3017
3090
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
3018
|
-
builder: (
|
|
3091
|
+
builder: (yargs36) => withConfiguration(
|
|
3019
3092
|
withApiOptions(
|
|
3020
3093
|
withProjectOptions(
|
|
3021
3094
|
withDiffOptions(
|
|
3022
|
-
|
|
3095
|
+
yargs36.positional("directory", {
|
|
3023
3096
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
3024
3097
|
type: "string"
|
|
3025
3098
|
}).option("what-if", {
|
|
@@ -3092,10 +3165,10 @@ var ContentTypeRemoveModule = {
|
|
|
3092
3165
|
command: "remove <id>",
|
|
3093
3166
|
aliases: ["delete", "rm"],
|
|
3094
3167
|
describe: "Delete a content type",
|
|
3095
|
-
builder: (
|
|
3168
|
+
builder: (yargs36) => withConfiguration(
|
|
3096
3169
|
withApiOptions(
|
|
3097
3170
|
withProjectOptions(
|
|
3098
|
-
|
|
3171
|
+
yargs36.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
3099
3172
|
)
|
|
3100
3173
|
)
|
|
3101
3174
|
),
|
|
@@ -3112,10 +3185,10 @@ var ContentTypeUpdateModule = {
|
|
|
3112
3185
|
command: "update <filename>",
|
|
3113
3186
|
aliases: ["put"],
|
|
3114
3187
|
describe: "Insert or update a content type",
|
|
3115
|
-
builder: (
|
|
3188
|
+
builder: (yargs36) => withConfiguration(
|
|
3116
3189
|
withApiOptions(
|
|
3117
3190
|
withProjectOptions(
|
|
3118
|
-
|
|
3191
|
+
yargs36.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
3119
3192
|
)
|
|
3120
3193
|
)
|
|
3121
3194
|
),
|
|
@@ -3132,25 +3205,25 @@ var ContentTypeModule = {
|
|
|
3132
3205
|
command: "contenttype <command>",
|
|
3133
3206
|
aliases: ["ct"],
|
|
3134
3207
|
describe: "Commands for Content Types",
|
|
3135
|
-
builder: (
|
|
3208
|
+
builder: (yargs36) => yargs36.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
3136
3209
|
handler: () => {
|
|
3137
|
-
|
|
3210
|
+
yargs7.help();
|
|
3138
3211
|
}
|
|
3139
3212
|
};
|
|
3140
3213
|
|
|
3141
3214
|
// src/commands/canvas/commands/dataSource.ts
|
|
3142
|
-
import
|
|
3215
|
+
import yargs8 from "yargs";
|
|
3143
3216
|
|
|
3144
3217
|
// src/commands/canvas/commands/dataSource/get.ts
|
|
3145
3218
|
import { DataSourceClient } from "@uniformdev/canvas";
|
|
3146
3219
|
var DataSourceGetModule = {
|
|
3147
3220
|
command: "get <id>",
|
|
3148
3221
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
3149
|
-
builder: (
|
|
3222
|
+
builder: (yargs36) => withConfiguration(
|
|
3150
3223
|
withApiOptions(
|
|
3151
3224
|
withProjectOptions(
|
|
3152
3225
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3153
|
-
|
|
3226
|
+
yargs36.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
3154
3227
|
)
|
|
3155
3228
|
)
|
|
3156
3229
|
),
|
|
@@ -3168,10 +3241,10 @@ var DataSourceRemoveModule = {
|
|
|
3168
3241
|
command: "remove <id>",
|
|
3169
3242
|
aliases: ["delete", "rm"],
|
|
3170
3243
|
describe: "Delete a data source",
|
|
3171
|
-
builder: (
|
|
3244
|
+
builder: (yargs36) => withConfiguration(
|
|
3172
3245
|
withApiOptions(
|
|
3173
3246
|
withProjectOptions(
|
|
3174
|
-
|
|
3247
|
+
yargs36.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
|
|
3175
3248
|
)
|
|
3176
3249
|
)
|
|
3177
3250
|
),
|
|
@@ -3188,10 +3261,10 @@ var DataSourceUpdateModule = {
|
|
|
3188
3261
|
command: "update <dataSource>",
|
|
3189
3262
|
aliases: ["put"],
|
|
3190
3263
|
describe: "Insert or update a data source",
|
|
3191
|
-
builder: (
|
|
3264
|
+
builder: (yargs36) => withConfiguration(
|
|
3192
3265
|
withApiOptions(
|
|
3193
3266
|
withProjectOptions(
|
|
3194
|
-
|
|
3267
|
+
yargs36.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
|
|
3195
3268
|
describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
|
|
3196
3269
|
type: "string",
|
|
3197
3270
|
demandOption: true
|
|
@@ -3211,14 +3284,14 @@ var DataSourceModule = {
|
|
|
3211
3284
|
command: "datasource <command>",
|
|
3212
3285
|
aliases: ["ds"],
|
|
3213
3286
|
describe: "Commands for Data Source definitions",
|
|
3214
|
-
builder: (
|
|
3287
|
+
builder: (yargs36) => yargs36.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
|
|
3215
3288
|
handler: () => {
|
|
3216
|
-
|
|
3289
|
+
yargs8.help();
|
|
3217
3290
|
}
|
|
3218
3291
|
};
|
|
3219
3292
|
|
|
3220
3293
|
// src/commands/canvas/commands/dataType.ts
|
|
3221
|
-
import
|
|
3294
|
+
import yargs9 from "yargs";
|
|
3222
3295
|
|
|
3223
3296
|
// src/commands/canvas/commands/dataType/get.ts
|
|
3224
3297
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
@@ -3226,12 +3299,12 @@ var DataTypeGetModule = {
|
|
|
3226
3299
|
command: "get <id>",
|
|
3227
3300
|
describe: "Get a data type",
|
|
3228
3301
|
aliases: ["ls"],
|
|
3229
|
-
builder: (
|
|
3302
|
+
builder: (yargs36) => withConfiguration(
|
|
3230
3303
|
withFormatOptions(
|
|
3231
3304
|
withApiOptions(
|
|
3232
3305
|
withProjectOptions(
|
|
3233
3306
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3234
|
-
|
|
3307
|
+
yargs36.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
3235
3308
|
)
|
|
3236
3309
|
)
|
|
3237
3310
|
)
|
|
@@ -3254,7 +3327,7 @@ var DataTypeListModule = {
|
|
|
3254
3327
|
command: "list",
|
|
3255
3328
|
describe: "List data types",
|
|
3256
3329
|
aliases: ["ls"],
|
|
3257
|
-
builder: (
|
|
3330
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
3258
3331
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3259
3332
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3260
3333
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3304,11 +3377,11 @@ function createDataTypeEngineDataSource({
|
|
|
3304
3377
|
var DataTypePullModule = {
|
|
3305
3378
|
command: "pull <directory>",
|
|
3306
3379
|
describe: "Pulls all data types to local files in a directory",
|
|
3307
|
-
builder: (
|
|
3380
|
+
builder: (yargs36) => withConfiguration(
|
|
3308
3381
|
withApiOptions(
|
|
3309
3382
|
withProjectOptions(
|
|
3310
3383
|
withDiffOptions(
|
|
3311
|
-
|
|
3384
|
+
yargs36.positional("directory", {
|
|
3312
3385
|
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
3386
|
type: "string"
|
|
3314
3387
|
}).option("format", {
|
|
@@ -3392,11 +3465,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
3392
3465
|
var DataTypePushModule = {
|
|
3393
3466
|
command: "push <directory>",
|
|
3394
3467
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
3395
|
-
builder: (
|
|
3468
|
+
builder: (yargs36) => withConfiguration(
|
|
3396
3469
|
withApiOptions(
|
|
3397
3470
|
withProjectOptions(
|
|
3398
3471
|
withDiffOptions(
|
|
3399
|
-
|
|
3472
|
+
yargs36.positional("directory", {
|
|
3400
3473
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
3401
3474
|
type: "string"
|
|
3402
3475
|
}).option("what-if", {
|
|
@@ -3469,10 +3542,10 @@ var DataTypeRemoveModule = {
|
|
|
3469
3542
|
command: "remove <id>",
|
|
3470
3543
|
aliases: ["delete", "rm"],
|
|
3471
3544
|
describe: "Delete a data type",
|
|
3472
|
-
builder: (
|
|
3545
|
+
builder: (yargs36) => withConfiguration(
|
|
3473
3546
|
withApiOptions(
|
|
3474
3547
|
withProjectOptions(
|
|
3475
|
-
|
|
3548
|
+
yargs36.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
3476
3549
|
)
|
|
3477
3550
|
)
|
|
3478
3551
|
),
|
|
@@ -3489,10 +3562,10 @@ var DataTypeUpdateModule = {
|
|
|
3489
3562
|
command: "update <filename>",
|
|
3490
3563
|
aliases: ["put"],
|
|
3491
3564
|
describe: "Insert or update a data type",
|
|
3492
|
-
builder: (
|
|
3565
|
+
builder: (yargs36) => withConfiguration(
|
|
3493
3566
|
withApiOptions(
|
|
3494
3567
|
withProjectOptions(
|
|
3495
|
-
|
|
3568
|
+
yargs36.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
3496
3569
|
)
|
|
3497
3570
|
)
|
|
3498
3571
|
),
|
|
@@ -3509,27 +3582,42 @@ var DataTypeModule = {
|
|
|
3509
3582
|
command: "datatype <command>",
|
|
3510
3583
|
aliases: ["dt"],
|
|
3511
3584
|
describe: "Commands for Data Type definitions",
|
|
3512
|
-
builder: (
|
|
3585
|
+
builder: (yargs36) => yargs36.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3513
3586
|
handler: () => {
|
|
3514
|
-
|
|
3587
|
+
yargs9.help();
|
|
3515
3588
|
}
|
|
3516
3589
|
};
|
|
3517
3590
|
|
|
3518
3591
|
// src/commands/canvas/commands/entry.ts
|
|
3519
|
-
import
|
|
3592
|
+
import yargs10 from "yargs";
|
|
3520
3593
|
|
|
3521
3594
|
// src/commands/canvas/commands/entry/get.ts
|
|
3522
3595
|
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
3523
3596
|
var EntryGetModule = {
|
|
3524
3597
|
command: "get <id>",
|
|
3525
3598
|
describe: "Get an entry",
|
|
3526
|
-
builder: (
|
|
3599
|
+
builder: (yargs36) => withConfiguration(
|
|
3527
3600
|
withFormatOptions(
|
|
3528
3601
|
withApiOptions(
|
|
3529
3602
|
withProjectOptions(
|
|
3530
3603
|
withStateOptions(
|
|
3531
|
-
|
|
3532
|
-
|
|
3604
|
+
yargs36.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
|
|
3605
|
+
resolveData: {
|
|
3606
|
+
type: "boolean",
|
|
3607
|
+
default: false,
|
|
3608
|
+
describe: "Resolve all data resources used by the entry"
|
|
3609
|
+
},
|
|
3610
|
+
diagnostics: {
|
|
3611
|
+
type: "boolean",
|
|
3612
|
+
default: false,
|
|
3613
|
+
describe: "Include diagnostics information when resolving data"
|
|
3614
|
+
},
|
|
3615
|
+
resolutionDepth: {
|
|
3616
|
+
type: "number",
|
|
3617
|
+
default: 1,
|
|
3618
|
+
describe: "Controls how many levels deep content references should be resolved"
|
|
3619
|
+
}
|
|
3620
|
+
}),
|
|
3533
3621
|
// for backwards compatibility, we default to the "published" state, unlike compositions
|
|
3534
3622
|
"published"
|
|
3535
3623
|
)
|
|
@@ -3546,7 +3634,10 @@ var EntryGetModule = {
|
|
|
3546
3634
|
format,
|
|
3547
3635
|
filename,
|
|
3548
3636
|
project: projectId,
|
|
3549
|
-
state
|
|
3637
|
+
state,
|
|
3638
|
+
resolveData,
|
|
3639
|
+
diagnostics,
|
|
3640
|
+
resolutionDepth
|
|
3550
3641
|
}) => {
|
|
3551
3642
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3552
3643
|
const client = new ContentClient7({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3557,7 +3648,9 @@ var EntryGetModule = {
|
|
|
3557
3648
|
state: convertStateOption(state),
|
|
3558
3649
|
skipOverridesResolution: true,
|
|
3559
3650
|
skipPatternResolution: true,
|
|
3560
|
-
skipDataResolution:
|
|
3651
|
+
skipDataResolution: !resolveData,
|
|
3652
|
+
diagnostics: resolveData ? diagnostics : void 0,
|
|
3653
|
+
resolutionDepth: resolveData ? resolutionDepth : void 0
|
|
3561
3654
|
});
|
|
3562
3655
|
if (res.entries.length !== 1) {
|
|
3563
3656
|
throw new Error(`Entry with ID ${id} not found`);
|
|
@@ -3572,12 +3665,12 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
|
3572
3665
|
var EntryListModule = {
|
|
3573
3666
|
command: "list",
|
|
3574
3667
|
describe: "List entries",
|
|
3575
|
-
builder: (
|
|
3668
|
+
builder: (yargs36) => withConfiguration(
|
|
3576
3669
|
withFormatOptions(
|
|
3577
3670
|
withApiOptions(
|
|
3578
3671
|
withProjectOptions(
|
|
3579
3672
|
withStateOptions(
|
|
3580
|
-
|
|
3673
|
+
yargs36.options({
|
|
3581
3674
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3582
3675
|
limit: { describe: "Number of rows to fetch", type: "number", default: LEGACY_DEFAULT_LIMIT },
|
|
3583
3676
|
search: { describe: "Search query", type: "string", default: "" }
|
|
@@ -3678,11 +3771,11 @@ function createEntryEngineDataSource({
|
|
|
3678
3771
|
var EntryPublishModule = {
|
|
3679
3772
|
command: "publish [ids]",
|
|
3680
3773
|
describe: "Publishes entry(ies)",
|
|
3681
|
-
builder: (
|
|
3774
|
+
builder: (yargs36) => withConfiguration(
|
|
3682
3775
|
withApiOptions(
|
|
3683
3776
|
withProjectOptions(
|
|
3684
3777
|
withDiffOptions(
|
|
3685
|
-
|
|
3778
|
+
yargs36.positional("ids", {
|
|
3686
3779
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3687
3780
|
type: "string"
|
|
3688
3781
|
}).option("all", {
|
|
@@ -3737,12 +3830,12 @@ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
|
3737
3830
|
var EntryPullModule = {
|
|
3738
3831
|
command: "pull <directory>",
|
|
3739
3832
|
describe: "Pulls all entries to local files in a directory",
|
|
3740
|
-
builder: (
|
|
3833
|
+
builder: (yargs36) => withConfiguration(
|
|
3741
3834
|
withApiOptions(
|
|
3742
3835
|
withProjectOptions(
|
|
3743
3836
|
withStateOptions(
|
|
3744
3837
|
withDiffOptions(
|
|
3745
|
-
|
|
3838
|
+
yargs36.positional("directory", {
|
|
3746
3839
|
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
3840
|
type: "string"
|
|
3748
3841
|
}).option("format", {
|
|
@@ -3842,12 +3935,12 @@ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
|
3842
3935
|
var EntryPushModule = {
|
|
3843
3936
|
command: "push <directory>",
|
|
3844
3937
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3845
|
-
builder: (
|
|
3938
|
+
builder: (yargs36) => withConfiguration(
|
|
3846
3939
|
withApiOptions(
|
|
3847
3940
|
withProjectOptions(
|
|
3848
3941
|
withStateOptions(
|
|
3849
3942
|
withDiffOptions(
|
|
3850
|
-
|
|
3943
|
+
yargs36.positional("directory", {
|
|
3851
3944
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3852
3945
|
type: "string"
|
|
3853
3946
|
}).option("what-if", {
|
|
@@ -3934,10 +4027,10 @@ var EntryRemoveModule = {
|
|
|
3934
4027
|
command: "remove <id>",
|
|
3935
4028
|
aliases: ["delete", "rm"],
|
|
3936
4029
|
describe: "Delete an entry",
|
|
3937
|
-
builder: (
|
|
4030
|
+
builder: (yargs36) => withConfiguration(
|
|
3938
4031
|
withApiOptions(
|
|
3939
4032
|
withProjectOptions(
|
|
3940
|
-
|
|
4033
|
+
yargs36.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3941
4034
|
)
|
|
3942
4035
|
)
|
|
3943
4036
|
),
|
|
@@ -3954,10 +4047,10 @@ import { diffJson as diffJson3 } from "diff";
|
|
|
3954
4047
|
var EntryUnpublishModule = {
|
|
3955
4048
|
command: "unpublish [ids]",
|
|
3956
4049
|
describe: "Unpublish an entry(ies)",
|
|
3957
|
-
builder: (
|
|
4050
|
+
builder: (yargs36) => withConfiguration(
|
|
3958
4051
|
withApiOptions(
|
|
3959
4052
|
withProjectOptions(
|
|
3960
|
-
|
|
4053
|
+
yargs36.positional("ids", {
|
|
3961
4054
|
describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3962
4055
|
type: "string"
|
|
3963
4056
|
}).option("all", {
|
|
@@ -4030,11 +4123,11 @@ var EntryUpdateModule = {
|
|
|
4030
4123
|
command: "update <filename>",
|
|
4031
4124
|
aliases: ["put"],
|
|
4032
4125
|
describe: "Insert or update an entry",
|
|
4033
|
-
builder: (
|
|
4126
|
+
builder: (yargs36) => withConfiguration(
|
|
4034
4127
|
withApiOptions(
|
|
4035
4128
|
withProjectOptions(
|
|
4036
4129
|
withStateOptions(
|
|
4037
|
-
|
|
4130
|
+
yargs36.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
4038
4131
|
)
|
|
4039
4132
|
)
|
|
4040
4133
|
)
|
|
@@ -4051,27 +4144,26 @@ var EntryUpdateModule = {
|
|
|
4051
4144
|
var EntryModule = {
|
|
4052
4145
|
command: "entry <command>",
|
|
4053
4146
|
describe: "Commands for Entries",
|
|
4054
|
-
builder: (
|
|
4147
|
+
builder: (yargs36) => yargs36.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
|
|
4055
4148
|
handler: () => {
|
|
4056
|
-
|
|
4149
|
+
yargs10.help();
|
|
4057
4150
|
}
|
|
4058
4151
|
};
|
|
4059
4152
|
|
|
4060
4153
|
// src/commands/canvas/commands/entryPattern.ts
|
|
4061
|
-
import
|
|
4154
|
+
import yargs11 from "yargs";
|
|
4062
4155
|
|
|
4063
4156
|
// src/commands/canvas/commands/entryPattern/get.ts
|
|
4064
4157
|
import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
|
|
4065
4158
|
var EntryPatternGetModule = {
|
|
4066
4159
|
command: "get <id>",
|
|
4067
4160
|
describe: "Get an entry pattern",
|
|
4068
|
-
builder: (
|
|
4161
|
+
builder: (yargs36) => withConfiguration(
|
|
4069
4162
|
withFormatOptions(
|
|
4070
4163
|
withApiOptions(
|
|
4071
4164
|
withProjectOptions(
|
|
4072
4165
|
withStateOptions(
|
|
4073
|
-
|
|
4074
|
-
yargs34.positional("id", {
|
|
4166
|
+
yargs36.positional("id", {
|
|
4075
4167
|
demandOption: true,
|
|
4076
4168
|
describe: "Entry pattern public ID to fetch"
|
|
4077
4169
|
}),
|
|
@@ -4106,8 +4198,8 @@ import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
|
|
|
4106
4198
|
var EntryPatternListModule = {
|
|
4107
4199
|
command: "list",
|
|
4108
4200
|
describe: "List entry patterns",
|
|
4109
|
-
builder: (
|
|
4110
|
-
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(
|
|
4201
|
+
builder: (yargs36) => withConfiguration(
|
|
4202
|
+
withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs36, "published"))))
|
|
4111
4203
|
),
|
|
4112
4204
|
handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
|
|
4113
4205
|
const fetch3 = nodeFetchProxy(proxy);
|
|
@@ -4130,11 +4222,11 @@ import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
|
|
|
4130
4222
|
var EntryPatternPublishModule = {
|
|
4131
4223
|
command: "publish [ids]",
|
|
4132
4224
|
describe: "Publishes entry pattern(s)",
|
|
4133
|
-
builder: (
|
|
4225
|
+
builder: (yargs36) => withConfiguration(
|
|
4134
4226
|
withApiOptions(
|
|
4135
4227
|
withProjectOptions(
|
|
4136
4228
|
withDiffOptions(
|
|
4137
|
-
|
|
4229
|
+
yargs36.positional("ids", {
|
|
4138
4230
|
describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4139
4231
|
type: "string"
|
|
4140
4232
|
}).option("all", {
|
|
@@ -4189,12 +4281,12 @@ import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
|
|
|
4189
4281
|
var EntryPatternPullModule = {
|
|
4190
4282
|
command: "pull <directory>",
|
|
4191
4283
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
4192
|
-
builder: (
|
|
4284
|
+
builder: (yargs36) => withConfiguration(
|
|
4193
4285
|
withApiOptions(
|
|
4194
4286
|
withProjectOptions(
|
|
4195
4287
|
withStateOptions(
|
|
4196
4288
|
withDiffOptions(
|
|
4197
|
-
|
|
4289
|
+
yargs36.positional("directory", {
|
|
4198
4290
|
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
4291
|
type: "string"
|
|
4200
4292
|
}).option("format", {
|
|
@@ -4294,12 +4386,12 @@ import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
|
|
|
4294
4386
|
var EntryPatternPushModule = {
|
|
4295
4387
|
command: "push <directory>",
|
|
4296
4388
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
4297
|
-
builder: (
|
|
4389
|
+
builder: (yargs36) => withConfiguration(
|
|
4298
4390
|
withApiOptions(
|
|
4299
4391
|
withProjectOptions(
|
|
4300
4392
|
withStateOptions(
|
|
4301
4393
|
withDiffOptions(
|
|
4302
|
-
|
|
4394
|
+
yargs36.positional("directory", {
|
|
4303
4395
|
describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
|
|
4304
4396
|
type: "string"
|
|
4305
4397
|
}).option("what-if", {
|
|
@@ -4386,10 +4478,10 @@ var EntryPatternRemoveModule = {
|
|
|
4386
4478
|
command: "remove <id>",
|
|
4387
4479
|
aliases: ["delete", "rm"],
|
|
4388
4480
|
describe: "Delete an entry pattern",
|
|
4389
|
-
builder: (
|
|
4481
|
+
builder: (yargs36) => withConfiguration(
|
|
4390
4482
|
withApiOptions(
|
|
4391
4483
|
withProjectOptions(
|
|
4392
|
-
|
|
4484
|
+
yargs36.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
|
|
4393
4485
|
)
|
|
4394
4486
|
)
|
|
4395
4487
|
),
|
|
@@ -4406,10 +4498,10 @@ import { diffJson as diffJson4 } from "diff";
|
|
|
4406
4498
|
var EntryPatternUnpublishModule = {
|
|
4407
4499
|
command: "unpublish [ids]",
|
|
4408
4500
|
describe: "Unpublish an entry patterns",
|
|
4409
|
-
builder: (
|
|
4501
|
+
builder: (yargs36) => withConfiguration(
|
|
4410
4502
|
withApiOptions(
|
|
4411
4503
|
withProjectOptions(
|
|
4412
|
-
|
|
4504
|
+
yargs36.positional("ids", {
|
|
4413
4505
|
describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4414
4506
|
type: "string"
|
|
4415
4507
|
}).option("all", {
|
|
@@ -4482,11 +4574,11 @@ var EntryPatternUpdateModule = {
|
|
|
4482
4574
|
command: "update <filename>",
|
|
4483
4575
|
aliases: ["put"],
|
|
4484
4576
|
describe: "Insert or update an entry pattern",
|
|
4485
|
-
builder: (
|
|
4577
|
+
builder: (yargs36) => withConfiguration(
|
|
4486
4578
|
withApiOptions(
|
|
4487
4579
|
withProjectOptions(
|
|
4488
4580
|
withStateOptions(
|
|
4489
|
-
|
|
4581
|
+
yargs36.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
|
|
4490
4582
|
)
|
|
4491
4583
|
)
|
|
4492
4584
|
)
|
|
@@ -4503,14 +4595,14 @@ var EntryPatternUpdateModule = {
|
|
|
4503
4595
|
var EntryPatternModule = {
|
|
4504
4596
|
command: "entry-pattern <command>",
|
|
4505
4597
|
describe: "Commands for Entry patterns",
|
|
4506
|
-
builder: (
|
|
4598
|
+
builder: (yargs36) => yargs36.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
|
|
4507
4599
|
handler: () => {
|
|
4508
|
-
|
|
4600
|
+
yargs11.help();
|
|
4509
4601
|
}
|
|
4510
4602
|
};
|
|
4511
4603
|
|
|
4512
4604
|
// src/commands/canvas/commands/locale.ts
|
|
4513
|
-
import
|
|
4605
|
+
import yargs12 from "yargs";
|
|
4514
4606
|
|
|
4515
4607
|
// src/commands/canvas/commands/locale/pull.ts
|
|
4516
4608
|
import { LocaleClient } from "@uniformdev/canvas";
|
|
@@ -4549,11 +4641,11 @@ function createLocaleEngineDataSource({
|
|
|
4549
4641
|
var LocalePullModule = {
|
|
4550
4642
|
command: "pull <directory>",
|
|
4551
4643
|
describe: "Pulls all locales to local files in a directory",
|
|
4552
|
-
builder: (
|
|
4644
|
+
builder: (yargs36) => withConfiguration(
|
|
4553
4645
|
withApiOptions(
|
|
4554
4646
|
withProjectOptions(
|
|
4555
4647
|
withDiffOptions(
|
|
4556
|
-
|
|
4648
|
+
yargs36.positional("directory", {
|
|
4557
4649
|
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
4650
|
type: "string"
|
|
4559
4651
|
}).option("format", {
|
|
@@ -4577,161 +4669,398 @@ var LocalePullModule = {
|
|
|
4577
4669
|
)
|
|
4578
4670
|
)
|
|
4579
4671
|
)
|
|
4580
|
-
),
|
|
4581
|
-
handler: async ({
|
|
4582
|
-
apiHost,
|
|
4583
|
-
apiKey,
|
|
4584
|
-
proxy,
|
|
4585
|
-
directory,
|
|
4586
|
-
format,
|
|
4587
|
-
mode,
|
|
4588
|
-
whatIf,
|
|
4589
|
-
project: projectId,
|
|
4590
|
-
diff: diffMode,
|
|
4591
|
-
allowEmptySource
|
|
4592
|
-
}) => {
|
|
4593
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
4594
|
-
const client = new LocaleClient({
|
|
4595
|
-
apiKey,
|
|
4596
|
-
apiHost,
|
|
4597
|
-
fetch: fetch3,
|
|
4598
|
-
projectId,
|
|
4599
|
-
bypassCache: true
|
|
4600
|
-
});
|
|
4601
|
-
const source = createLocaleEngineDataSource({ client });
|
|
4602
|
-
let target;
|
|
4603
|
-
const isPackage = isPathAPackageFile(directory);
|
|
4604
|
-
if (isPackage) {
|
|
4605
|
-
const packageContents = readCanvasPackage(directory, false);
|
|
4606
|
-
target = await createArraySyncEngineDataSource({
|
|
4607
|
-
name: `Package file ${directory}`,
|
|
4608
|
-
objects: packageContents.locales ?? [],
|
|
4609
|
-
selectIdentifier: (i) => i.locale,
|
|
4610
|
-
selectDisplayName: (i) => i.displayName,
|
|
4611
|
-
onSyncComplete: async (_, synced) => {
|
|
4612
|
-
packageContents.locales = synced;
|
|
4613
|
-
writeCanvasPackage(directory, packageContents);
|
|
4614
|
-
}
|
|
4615
|
-
});
|
|
4616
|
-
} else {
|
|
4617
|
-
target = await createFileSyncEngineDataSource({
|
|
4618
|
-
directory,
|
|
4619
|
-
selectIdentifier: (i) => i.locale,
|
|
4620
|
-
selectDisplayName: (i) => i.displayName,
|
|
4621
|
-
format
|
|
4622
|
-
});
|
|
4623
|
-
}
|
|
4624
|
-
await syncEngine({
|
|
4625
|
-
source,
|
|
4626
|
-
target,
|
|
4627
|
-
mode,
|
|
4628
|
-
whatIf,
|
|
4629
|
-
allowEmptySource: allowEmptySource ?? true,
|
|
4630
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4631
|
-
});
|
|
4632
|
-
}
|
|
4672
|
+
),
|
|
4673
|
+
handler: async ({
|
|
4674
|
+
apiHost,
|
|
4675
|
+
apiKey,
|
|
4676
|
+
proxy,
|
|
4677
|
+
directory,
|
|
4678
|
+
format,
|
|
4679
|
+
mode,
|
|
4680
|
+
whatIf,
|
|
4681
|
+
project: projectId,
|
|
4682
|
+
diff: diffMode,
|
|
4683
|
+
allowEmptySource
|
|
4684
|
+
}) => {
|
|
4685
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
4686
|
+
const client = new LocaleClient({
|
|
4687
|
+
apiKey,
|
|
4688
|
+
apiHost,
|
|
4689
|
+
fetch: fetch3,
|
|
4690
|
+
projectId,
|
|
4691
|
+
bypassCache: true
|
|
4692
|
+
});
|
|
4693
|
+
const source = createLocaleEngineDataSource({ client });
|
|
4694
|
+
let target;
|
|
4695
|
+
const isPackage = isPathAPackageFile(directory);
|
|
4696
|
+
if (isPackage) {
|
|
4697
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
4698
|
+
target = await createArraySyncEngineDataSource({
|
|
4699
|
+
name: `Package file ${directory}`,
|
|
4700
|
+
objects: packageContents.locales ?? [],
|
|
4701
|
+
selectIdentifier: (i) => i.locale,
|
|
4702
|
+
selectDisplayName: (i) => i.displayName,
|
|
4703
|
+
onSyncComplete: async (_, synced) => {
|
|
4704
|
+
packageContents.locales = synced;
|
|
4705
|
+
writeCanvasPackage(directory, packageContents);
|
|
4706
|
+
}
|
|
4707
|
+
});
|
|
4708
|
+
} else {
|
|
4709
|
+
target = await createFileSyncEngineDataSource({
|
|
4710
|
+
directory,
|
|
4711
|
+
selectIdentifier: (i) => i.locale,
|
|
4712
|
+
selectDisplayName: (i) => i.displayName,
|
|
4713
|
+
format
|
|
4714
|
+
});
|
|
4715
|
+
}
|
|
4716
|
+
await syncEngine({
|
|
4717
|
+
source,
|
|
4718
|
+
target,
|
|
4719
|
+
mode,
|
|
4720
|
+
whatIf,
|
|
4721
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
4722
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4723
|
+
});
|
|
4724
|
+
}
|
|
4725
|
+
};
|
|
4726
|
+
|
|
4727
|
+
// src/commands/canvas/commands/locale/push.ts
|
|
4728
|
+
import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
4729
|
+
var LocalePushModule = {
|
|
4730
|
+
command: "push <directory>",
|
|
4731
|
+
describe: "Pushes all locales from files in a directory to Uniform",
|
|
4732
|
+
builder: (yargs36) => withConfiguration(
|
|
4733
|
+
withApiOptions(
|
|
4734
|
+
withProjectOptions(
|
|
4735
|
+
withDiffOptions(
|
|
4736
|
+
yargs36.positional("directory", {
|
|
4737
|
+
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
4738
|
+
type: "string"
|
|
4739
|
+
}).option("what-if", {
|
|
4740
|
+
alias: ["w"],
|
|
4741
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
4742
|
+
default: false,
|
|
4743
|
+
type: "boolean"
|
|
4744
|
+
}).option("mode", {
|
|
4745
|
+
alias: ["m"],
|
|
4746
|
+
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',
|
|
4747
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4748
|
+
default: "mirror",
|
|
4749
|
+
type: "string"
|
|
4750
|
+
})
|
|
4751
|
+
)
|
|
4752
|
+
)
|
|
4753
|
+
)
|
|
4754
|
+
),
|
|
4755
|
+
handler: async ({
|
|
4756
|
+
apiHost,
|
|
4757
|
+
apiKey,
|
|
4758
|
+
proxy,
|
|
4759
|
+
directory,
|
|
4760
|
+
mode,
|
|
4761
|
+
whatIf,
|
|
4762
|
+
project: projectId,
|
|
4763
|
+
diff: diffMode,
|
|
4764
|
+
allowEmptySource
|
|
4765
|
+
}) => {
|
|
4766
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
4767
|
+
const client = new LocaleClient2({
|
|
4768
|
+
apiKey,
|
|
4769
|
+
apiHost,
|
|
4770
|
+
fetch: fetch3,
|
|
4771
|
+
projectId,
|
|
4772
|
+
bypassCache: true
|
|
4773
|
+
});
|
|
4774
|
+
let source;
|
|
4775
|
+
const isPackage = isPathAPackageFile(directory);
|
|
4776
|
+
if (isPackage) {
|
|
4777
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
4778
|
+
source = await createArraySyncEngineDataSource({
|
|
4779
|
+
name: `Package file ${directory}`,
|
|
4780
|
+
objects: packageContents.locales ?? [],
|
|
4781
|
+
selectIdentifier: (locale) => locale.locale,
|
|
4782
|
+
selectDisplayName: (locale) => locale.displayName
|
|
4783
|
+
});
|
|
4784
|
+
} else {
|
|
4785
|
+
source = await createFileSyncEngineDataSource({
|
|
4786
|
+
directory,
|
|
4787
|
+
selectIdentifier: (locale) => locale.locale,
|
|
4788
|
+
selectDisplayName: (locale) => locale.displayName
|
|
4789
|
+
});
|
|
4790
|
+
}
|
|
4791
|
+
const target = createLocaleEngineDataSource({ client });
|
|
4792
|
+
await syncEngine({
|
|
4793
|
+
source,
|
|
4794
|
+
target,
|
|
4795
|
+
mode,
|
|
4796
|
+
whatIf,
|
|
4797
|
+
allowEmptySource,
|
|
4798
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4799
|
+
});
|
|
4800
|
+
}
|
|
4801
|
+
};
|
|
4802
|
+
|
|
4803
|
+
// src/commands/canvas/commands/locale.ts
|
|
4804
|
+
var LocaleModule = {
|
|
4805
|
+
command: "locale <command>",
|
|
4806
|
+
describe: "Commands for locale definitions",
|
|
4807
|
+
builder: (yargs36) => yargs36.command(LocalePullModule).command(LocalePushModule),
|
|
4808
|
+
handler: () => {
|
|
4809
|
+
yargs12.help();
|
|
4810
|
+
}
|
|
4811
|
+
};
|
|
4812
|
+
|
|
4813
|
+
// src/commands/canvas/commands/pattern.ts
|
|
4814
|
+
import yargs13 from "yargs";
|
|
4815
|
+
|
|
4816
|
+
// src/commands/canvas/commands/pattern/get.ts
|
|
4817
|
+
var PatternGetModule = {
|
|
4818
|
+
...CompositionGetModule,
|
|
4819
|
+
describe: "Fetch a pattern"
|
|
4820
|
+
};
|
|
4821
|
+
|
|
4822
|
+
// src/commands/canvas/commands/pattern/list.ts
|
|
4823
|
+
var PatternListModule = {
|
|
4824
|
+
...CompositionListModule,
|
|
4825
|
+
describe: "List patterns",
|
|
4826
|
+
builder: (yargs36) => withFormatOptions(
|
|
4827
|
+
withConfiguration(
|
|
4828
|
+
withApiOptions(
|
|
4829
|
+
withProjectOptions(
|
|
4830
|
+
withStateOptions(
|
|
4831
|
+
yargs36.options({
|
|
4832
|
+
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
4833
|
+
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
4834
|
+
resolvePatterns: {
|
|
4835
|
+
type: "boolean",
|
|
4836
|
+
default: false,
|
|
4837
|
+
describe: "Resolve pattern references in the composition"
|
|
4838
|
+
},
|
|
4839
|
+
resolveOverrides: {
|
|
4840
|
+
type: "boolean",
|
|
4841
|
+
default: false,
|
|
4842
|
+
describe: "Resolves pattern overrides in the pattern and removes override definition data"
|
|
4843
|
+
},
|
|
4844
|
+
onlyPatterns: {
|
|
4845
|
+
describe: "Only pulling patterns and not compositions",
|
|
4846
|
+
// This default differentiate this list command from composition list command
|
|
4847
|
+
default: true,
|
|
4848
|
+
type: "boolean",
|
|
4849
|
+
hidden: true
|
|
4850
|
+
},
|
|
4851
|
+
componentIDs: {
|
|
4852
|
+
alias: ["componentIDs"],
|
|
4853
|
+
type: "boolean",
|
|
4854
|
+
default: false,
|
|
4855
|
+
describe: "Include individual component UIDs"
|
|
4856
|
+
}
|
|
4857
|
+
})
|
|
4858
|
+
)
|
|
4859
|
+
)
|
|
4860
|
+
)
|
|
4861
|
+
)
|
|
4862
|
+
)
|
|
4863
|
+
};
|
|
4864
|
+
|
|
4865
|
+
// src/commands/canvas/commands/pattern/publish.ts
|
|
4866
|
+
var PatternPublishModule = {
|
|
4867
|
+
...CompositionPublishModule,
|
|
4868
|
+
describe: "Publishes pattern(s)",
|
|
4869
|
+
builder: (yargs36) => withConfiguration(
|
|
4870
|
+
withApiOptions(
|
|
4871
|
+
withProjectOptions(
|
|
4872
|
+
withDiffOptions(
|
|
4873
|
+
yargs36.positional("ids", {
|
|
4874
|
+
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4875
|
+
type: "string"
|
|
4876
|
+
}).option("all", {
|
|
4877
|
+
alias: ["a"],
|
|
4878
|
+
describe: "Publishes all patterns. Use compositionId to publish one instead.",
|
|
4879
|
+
default: false,
|
|
4880
|
+
type: "boolean"
|
|
4881
|
+
}).option("what-if", {
|
|
4882
|
+
alias: ["w"],
|
|
4883
|
+
describe: "What-if mode reports what would be done but does not perform any un-publishing",
|
|
4884
|
+
default: false,
|
|
4885
|
+
type: "boolean"
|
|
4886
|
+
}).option("publishingState", {
|
|
4887
|
+
describe: 'Publishing state to update to. Can be "published" or "preview".',
|
|
4888
|
+
default: "published",
|
|
4889
|
+
type: "string",
|
|
4890
|
+
hidden: true
|
|
4891
|
+
}).option("onlyCompositions", {
|
|
4892
|
+
describe: "Only publishing compositions and not patterns",
|
|
4893
|
+
default: false,
|
|
4894
|
+
type: "boolean"
|
|
4895
|
+
}).option("onlyPatterns", {
|
|
4896
|
+
describe: "Only pulling patterns and not compositions",
|
|
4897
|
+
default: true,
|
|
4898
|
+
type: "boolean",
|
|
4899
|
+
hidden: true
|
|
4900
|
+
})
|
|
4901
|
+
)
|
|
4902
|
+
)
|
|
4903
|
+
)
|
|
4904
|
+
)
|
|
4905
|
+
};
|
|
4906
|
+
|
|
4907
|
+
// src/commands/canvas/commands/pattern/pull.ts
|
|
4908
|
+
var PatternPullModule = {
|
|
4909
|
+
...CompositionPullModule,
|
|
4910
|
+
describe: "Pulls all patterns to local files in a directory",
|
|
4911
|
+
builder: (yargs36) => withConfiguration(
|
|
4912
|
+
withApiOptions(
|
|
4913
|
+
withProjectOptions(
|
|
4914
|
+
withStateOptions(
|
|
4915
|
+
withDiffOptions(
|
|
4916
|
+
yargs36.positional("directory", {
|
|
4917
|
+
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.",
|
|
4918
|
+
type: "string"
|
|
4919
|
+
}).option("format", {
|
|
4920
|
+
alias: ["f"],
|
|
4921
|
+
describe: "Output format",
|
|
4922
|
+
default: "yaml",
|
|
4923
|
+
choices: ["yaml", "json"],
|
|
4924
|
+
type: "string"
|
|
4925
|
+
}).option("onlyPatterns", {
|
|
4926
|
+
describe: "Only pulling patterns and not compositions",
|
|
4927
|
+
// This default differentiate this list command from composition list command
|
|
4928
|
+
default: true,
|
|
4929
|
+
type: "boolean",
|
|
4930
|
+
hidden: true
|
|
4931
|
+
}).option("what-if", {
|
|
4932
|
+
alias: ["w"],
|
|
4933
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
4934
|
+
default: false,
|
|
4935
|
+
type: "boolean"
|
|
4936
|
+
}).option("mode", {
|
|
4937
|
+
alias: ["m"],
|
|
4938
|
+
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',
|
|
4939
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4940
|
+
default: "mirror",
|
|
4941
|
+
type: "string"
|
|
4942
|
+
})
|
|
4943
|
+
)
|
|
4944
|
+
)
|
|
4945
|
+
)
|
|
4946
|
+
)
|
|
4947
|
+
)
|
|
4948
|
+
};
|
|
4949
|
+
|
|
4950
|
+
// src/commands/canvas/commands/pattern/push.ts
|
|
4951
|
+
var PatternPushModule = {
|
|
4952
|
+
...CompositionPushModule,
|
|
4953
|
+
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
4954
|
+
builder: (yargs36) => withConfiguration(
|
|
4955
|
+
withApiOptions(
|
|
4956
|
+
withProjectOptions(
|
|
4957
|
+
withStateOptions(
|
|
4958
|
+
withDiffOptions(
|
|
4959
|
+
yargs36.positional("directory", {
|
|
4960
|
+
describe: "Directory to read the patterns from. If a filename is used, a package will be read instead.",
|
|
4961
|
+
type: "string"
|
|
4962
|
+
}).option("what-if", {
|
|
4963
|
+
alias: ["w"],
|
|
4964
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
4965
|
+
default: false,
|
|
4966
|
+
type: "boolean"
|
|
4967
|
+
}).option("mode", {
|
|
4968
|
+
alias: ["m"],
|
|
4969
|
+
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',
|
|
4970
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
4971
|
+
default: "mirror",
|
|
4972
|
+
type: "string"
|
|
4973
|
+
}).option("onlyPatterns", {
|
|
4974
|
+
describe: "Only pulling patterns and not compositions",
|
|
4975
|
+
// This default differentiate this list command from composition list command
|
|
4976
|
+
default: true,
|
|
4977
|
+
type: "boolean",
|
|
4978
|
+
hidden: true
|
|
4979
|
+
}).option("patternType", {
|
|
4980
|
+
default: "all",
|
|
4981
|
+
choices: ["all", "component", "composition"],
|
|
4982
|
+
hidden: true
|
|
4983
|
+
})
|
|
4984
|
+
)
|
|
4985
|
+
)
|
|
4986
|
+
)
|
|
4987
|
+
)
|
|
4988
|
+
)
|
|
4633
4989
|
};
|
|
4634
4990
|
|
|
4635
|
-
// src/commands/canvas/commands/
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4991
|
+
// src/commands/canvas/commands/pattern/remove.ts
|
|
4992
|
+
var PatternRemoveModule = {
|
|
4993
|
+
...CompositionRemoveModule,
|
|
4994
|
+
describe: "Delete a pattern"
|
|
4995
|
+
};
|
|
4996
|
+
|
|
4997
|
+
// src/commands/canvas/commands/pattern/unpublish.ts
|
|
4998
|
+
var PatternUnpublishModule = {
|
|
4999
|
+
command: "unpublish [ids]",
|
|
5000
|
+
describe: "Unpublish a pattern(s)",
|
|
5001
|
+
builder: (yargs36) => withConfiguration(
|
|
4641
5002
|
withApiOptions(
|
|
4642
5003
|
withProjectOptions(
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
5004
|
+
yargs36.positional("ids", {
|
|
5005
|
+
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
5006
|
+
type: "string"
|
|
5007
|
+
}).option("all", {
|
|
5008
|
+
alias: ["a"],
|
|
5009
|
+
describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
|
|
5010
|
+
default: false,
|
|
5011
|
+
type: "boolean"
|
|
5012
|
+
}).option("what-if", {
|
|
5013
|
+
alias: ["w"],
|
|
5014
|
+
describe: "What-if mode reports what would be done but does not perform any publishing",
|
|
5015
|
+
default: false,
|
|
5016
|
+
type: "boolean"
|
|
5017
|
+
}).option("onlyCompositions", {
|
|
5018
|
+
describe: "Only un-publishing compositions and not patterns",
|
|
5019
|
+
default: false,
|
|
5020
|
+
type: "boolean"
|
|
5021
|
+
}).option("onlyPatterns", {
|
|
5022
|
+
describe: "Only un-publishing patterns and not compositions",
|
|
5023
|
+
default: true,
|
|
5024
|
+
type: "boolean",
|
|
5025
|
+
hidden: true
|
|
5026
|
+
})
|
|
4660
5027
|
)
|
|
4661
5028
|
)
|
|
4662
5029
|
),
|
|
4663
|
-
handler:
|
|
4664
|
-
apiHost,
|
|
4665
|
-
apiKey,
|
|
4666
|
-
proxy,
|
|
4667
|
-
directory,
|
|
4668
|
-
mode,
|
|
4669
|
-
whatIf,
|
|
4670
|
-
project: projectId,
|
|
4671
|
-
diff: diffMode,
|
|
4672
|
-
allowEmptySource
|
|
4673
|
-
}) => {
|
|
4674
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
4675
|
-
const client = new LocaleClient2({
|
|
4676
|
-
apiKey,
|
|
4677
|
-
apiHost,
|
|
4678
|
-
fetch: fetch3,
|
|
4679
|
-
projectId,
|
|
4680
|
-
bypassCache: true
|
|
4681
|
-
});
|
|
4682
|
-
let source;
|
|
4683
|
-
const isPackage = isPathAPackageFile(directory);
|
|
4684
|
-
if (isPackage) {
|
|
4685
|
-
const packageContents = readCanvasPackage(directory, true);
|
|
4686
|
-
source = await createArraySyncEngineDataSource({
|
|
4687
|
-
name: `Package file ${directory}`,
|
|
4688
|
-
objects: packageContents.locales ?? [],
|
|
4689
|
-
selectIdentifier: (locale) => locale.locale,
|
|
4690
|
-
selectDisplayName: (locale) => locale.displayName
|
|
4691
|
-
});
|
|
4692
|
-
} else {
|
|
4693
|
-
source = await createFileSyncEngineDataSource({
|
|
4694
|
-
directory,
|
|
4695
|
-
selectIdentifier: (locale) => locale.locale,
|
|
4696
|
-
selectDisplayName: (locale) => locale.displayName
|
|
4697
|
-
});
|
|
4698
|
-
}
|
|
4699
|
-
const target = createLocaleEngineDataSource({ client });
|
|
4700
|
-
await syncEngine({
|
|
4701
|
-
source,
|
|
4702
|
-
target,
|
|
4703
|
-
mode,
|
|
4704
|
-
whatIf,
|
|
4705
|
-
allowEmptySource,
|
|
4706
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4707
|
-
});
|
|
4708
|
-
}
|
|
5030
|
+
handler: CompositionUnpublishModule.handler
|
|
4709
5031
|
};
|
|
4710
5032
|
|
|
4711
|
-
// src/commands/canvas/commands/
|
|
4712
|
-
var
|
|
4713
|
-
|
|
4714
|
-
describe: "
|
|
4715
|
-
|
|
5033
|
+
// src/commands/canvas/commands/pattern/update.ts
|
|
5034
|
+
var PatternUpdateModule = {
|
|
5035
|
+
...CompositionUpdateModule,
|
|
5036
|
+
describe: "Insert or update a pattern"
|
|
5037
|
+
};
|
|
5038
|
+
|
|
5039
|
+
// src/commands/canvas/commands/pattern.ts
|
|
5040
|
+
var PatternModule = {
|
|
5041
|
+
command: "pattern <command>",
|
|
5042
|
+
describe: "Commands for Canvas patterns",
|
|
5043
|
+
deprecated: 'will be removed in a future major release. Use "component-pattern" and "composition-pattern" instead.',
|
|
5044
|
+
builder: (yargs36) => yargs36.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
4716
5045
|
handler: () => {
|
|
4717
|
-
|
|
5046
|
+
yargs13.help();
|
|
4718
5047
|
}
|
|
4719
5048
|
};
|
|
4720
5049
|
|
|
4721
5050
|
// src/commands/canvas/commands/prompts.ts
|
|
4722
|
-
import
|
|
5051
|
+
import yargs14 from "yargs";
|
|
4723
5052
|
|
|
4724
5053
|
// src/commands/canvas/commands/prompts/get.ts
|
|
4725
5054
|
import { PromptClient } from "@uniformdev/canvas";
|
|
4726
5055
|
var PromptGetModule = {
|
|
4727
5056
|
command: "get <id>",
|
|
4728
5057
|
describe: "Get a prompt",
|
|
4729
|
-
builder: (
|
|
5058
|
+
builder: (yargs36) => withConfiguration(
|
|
4730
5059
|
withFormatOptions(
|
|
4731
5060
|
withApiOptions(
|
|
4732
5061
|
withProjectOptions(
|
|
4733
5062
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4734
|
-
|
|
5063
|
+
yargs36.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
4735
5064
|
)
|
|
4736
5065
|
)
|
|
4737
5066
|
)
|
|
@@ -4752,7 +5081,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
4752
5081
|
var PromptListModule = {
|
|
4753
5082
|
command: "list",
|
|
4754
5083
|
describe: "List prompts",
|
|
4755
|
-
builder: (
|
|
5084
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
4756
5085
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4757
5086
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4758
5087
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -4800,12 +5129,12 @@ function createPromptEngineDataSource({
|
|
|
4800
5129
|
var PromptPullModule = {
|
|
4801
5130
|
command: "pull <directory>",
|
|
4802
5131
|
describe: "Pulls all prompts to local files in a directory",
|
|
4803
|
-
builder: (
|
|
5132
|
+
builder: (yargs36) => withConfiguration(
|
|
4804
5133
|
withApiOptions(
|
|
4805
5134
|
withProjectOptions(
|
|
4806
5135
|
withStateOptions(
|
|
4807
5136
|
withDiffOptions(
|
|
4808
|
-
|
|
5137
|
+
yargs36.positional("directory", {
|
|
4809
5138
|
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
5139
|
type: "string"
|
|
4811
5140
|
}).option("format", {
|
|
@@ -4890,12 +5219,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
4890
5219
|
var PromptPushModule = {
|
|
4891
5220
|
command: "push <directory>",
|
|
4892
5221
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
4893
|
-
builder: (
|
|
5222
|
+
builder: (yargs36) => withConfiguration(
|
|
4894
5223
|
withApiOptions(
|
|
4895
5224
|
withProjectOptions(
|
|
4896
5225
|
withStateOptions(
|
|
4897
5226
|
withDiffOptions(
|
|
4898
|
-
|
|
5227
|
+
yargs36.positional("directory", {
|
|
4899
5228
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
4900
5229
|
type: "string"
|
|
4901
5230
|
}).option("what-if", {
|
|
@@ -4969,9 +5298,9 @@ var PromptRemoveModule = {
|
|
|
4969
5298
|
command: "remove <id>",
|
|
4970
5299
|
aliases: ["delete", "rm"],
|
|
4971
5300
|
describe: "Delete a prompt",
|
|
4972
|
-
builder: (
|
|
5301
|
+
builder: (yargs36) => withConfiguration(
|
|
4973
5302
|
withApiOptions(
|
|
4974
|
-
withProjectOptions(
|
|
5303
|
+
withProjectOptions(yargs36.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
4975
5304
|
)
|
|
4976
5305
|
),
|
|
4977
5306
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -4987,10 +5316,10 @@ var PromptUpdateModule = {
|
|
|
4987
5316
|
command: "update <filename>",
|
|
4988
5317
|
aliases: ["put"],
|
|
4989
5318
|
describe: "Insert or update a prompt",
|
|
4990
|
-
builder: (
|
|
5319
|
+
builder: (yargs36) => withConfiguration(
|
|
4991
5320
|
withApiOptions(
|
|
4992
5321
|
withProjectOptions(
|
|
4993
|
-
|
|
5322
|
+
yargs36.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
4994
5323
|
)
|
|
4995
5324
|
)
|
|
4996
5325
|
),
|
|
@@ -5007,14 +5336,14 @@ var PromptModule = {
|
|
|
5007
5336
|
command: "prompt <command>",
|
|
5008
5337
|
aliases: ["dt"],
|
|
5009
5338
|
describe: "Commands for AI Prompt definitions",
|
|
5010
|
-
builder: (
|
|
5339
|
+
builder: (yargs36) => yargs36.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
5011
5340
|
handler: () => {
|
|
5012
|
-
|
|
5341
|
+
yargs14.help();
|
|
5013
5342
|
}
|
|
5014
5343
|
};
|
|
5015
5344
|
|
|
5016
5345
|
// src/commands/canvas/commands/workflow.ts
|
|
5017
|
-
import
|
|
5346
|
+
import yargs15 from "yargs";
|
|
5018
5347
|
|
|
5019
5348
|
// src/commands/canvas/commands/workflow/pull.ts
|
|
5020
5349
|
import { WorkflowClient } from "@uniformdev/canvas";
|
|
@@ -5058,11 +5387,11 @@ function createWorkflowEngineDataSource({
|
|
|
5058
5387
|
var WorkflowPullModule = {
|
|
5059
5388
|
command: "pull <directory>",
|
|
5060
5389
|
describe: "Pulls all workflows to local files in a directory",
|
|
5061
|
-
builder: (
|
|
5390
|
+
builder: (yargs36) => withConfiguration(
|
|
5062
5391
|
withApiOptions(
|
|
5063
5392
|
withProjectOptions(
|
|
5064
5393
|
withDiffOptions(
|
|
5065
|
-
|
|
5394
|
+
yargs36.positional("directory", {
|
|
5066
5395
|
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
5396
|
type: "string"
|
|
5068
5397
|
}).option("format", {
|
|
@@ -5140,11 +5469,11 @@ import { WorkflowClient as WorkflowClient2 } from "@uniformdev/canvas";
|
|
|
5140
5469
|
var WorkflowPushModule = {
|
|
5141
5470
|
command: "push <directory>",
|
|
5142
5471
|
describe: "Pushes all workflows from files in a directory to Uniform Canvas",
|
|
5143
|
-
builder: (
|
|
5472
|
+
builder: (yargs36) => withConfiguration(
|
|
5144
5473
|
withApiOptions(
|
|
5145
5474
|
withProjectOptions(
|
|
5146
5475
|
withDiffOptions(
|
|
5147
|
-
|
|
5476
|
+
yargs36.positional("directory", {
|
|
5148
5477
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
5149
5478
|
type: "string"
|
|
5150
5479
|
}).option("what-if", {
|
|
@@ -5210,9 +5539,9 @@ var WorkflowModule = {
|
|
|
5210
5539
|
command: "workflow <command>",
|
|
5211
5540
|
aliases: ["wf"],
|
|
5212
5541
|
describe: "Commands for Canvas workflows",
|
|
5213
|
-
builder: (
|
|
5542
|
+
builder: (yargs36) => yargs36.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
|
|
5214
5543
|
handler: () => {
|
|
5215
|
-
|
|
5544
|
+
yargs15.help();
|
|
5216
5545
|
}
|
|
5217
5546
|
};
|
|
5218
5547
|
|
|
@@ -5221,28 +5550,28 @@ var CanvasCommand = {
|
|
|
5221
5550
|
command: "canvas <command>",
|
|
5222
5551
|
aliases: ["cv", "pm", "presentation"],
|
|
5223
5552
|
describe: "Uniform Canvas commands",
|
|
5224
|
-
builder: (
|
|
5553
|
+
builder: (yargs36) => yargs36.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(PatternModule).command(ComponentPatternModule).command(CompositionPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LocaleModule).command(WorkflowModule).demandCommand(),
|
|
5225
5554
|
handler: () => {
|
|
5226
|
-
|
|
5555
|
+
yargs16.showHelp();
|
|
5227
5556
|
}
|
|
5228
5557
|
};
|
|
5229
5558
|
|
|
5230
5559
|
// src/commands/context/index.ts
|
|
5231
|
-
import
|
|
5560
|
+
import yargs23 from "yargs";
|
|
5232
5561
|
|
|
5233
5562
|
// src/commands/context/commands/aggregate.ts
|
|
5234
|
-
import
|
|
5563
|
+
import yargs17 from "yargs";
|
|
5235
5564
|
|
|
5236
5565
|
// src/commands/context/commands/aggregate/get.ts
|
|
5237
5566
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
5238
5567
|
var AggregateGetModule = {
|
|
5239
5568
|
command: "get <id>",
|
|
5240
5569
|
describe: "Fetch an aggregate",
|
|
5241
|
-
builder: (
|
|
5570
|
+
builder: (yargs36) => withConfiguration(
|
|
5242
5571
|
withFormatOptions(
|
|
5243
5572
|
withApiOptions(
|
|
5244
5573
|
withProjectOptions(
|
|
5245
|
-
|
|
5574
|
+
yargs36.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
5246
5575
|
)
|
|
5247
5576
|
)
|
|
5248
5577
|
)
|
|
@@ -5266,7 +5595,7 @@ var AggregateListModule = {
|
|
|
5266
5595
|
command: "list",
|
|
5267
5596
|
describe: "List aggregates",
|
|
5268
5597
|
aliases: ["ls"],
|
|
5269
|
-
builder: (
|
|
5598
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
5270
5599
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5271
5600
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5272
5601
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5333,11 +5662,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
5333
5662
|
var AggregatePullModule = {
|
|
5334
5663
|
command: "pull <directory>",
|
|
5335
5664
|
describe: "Pulls all aggregates to local files in a directory",
|
|
5336
|
-
builder: (
|
|
5665
|
+
builder: (yargs36) => withConfiguration(
|
|
5337
5666
|
withApiOptions(
|
|
5338
5667
|
withProjectOptions(
|
|
5339
5668
|
withDiffOptions(
|
|
5340
|
-
|
|
5669
|
+
yargs36.positional("directory", {
|
|
5341
5670
|
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
5671
|
type: "string"
|
|
5343
5672
|
}).option("format", {
|
|
@@ -5415,11 +5744,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
5415
5744
|
var AggregatePushModule = {
|
|
5416
5745
|
command: "push <directory>",
|
|
5417
5746
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
5418
|
-
builder: (
|
|
5747
|
+
builder: (yargs36) => withConfiguration(
|
|
5419
5748
|
withApiOptions(
|
|
5420
5749
|
withProjectOptions(
|
|
5421
5750
|
withDiffOptions(
|
|
5422
|
-
|
|
5751
|
+
yargs36.positional("directory", {
|
|
5423
5752
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
5424
5753
|
type: "string"
|
|
5425
5754
|
}).option("what-if", {
|
|
@@ -5487,10 +5816,10 @@ var AggregateRemoveModule = {
|
|
|
5487
5816
|
command: "remove <id>",
|
|
5488
5817
|
aliases: ["delete", "rm"],
|
|
5489
5818
|
describe: "Delete an aggregate",
|
|
5490
|
-
builder: (
|
|
5819
|
+
builder: (yargs36) => withConfiguration(
|
|
5491
5820
|
withApiOptions(
|
|
5492
5821
|
withProjectOptions(
|
|
5493
|
-
|
|
5822
|
+
yargs36.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
5494
5823
|
)
|
|
5495
5824
|
)
|
|
5496
5825
|
),
|
|
@@ -5507,10 +5836,10 @@ var AggregateUpdateModule = {
|
|
|
5507
5836
|
command: "update <filename>",
|
|
5508
5837
|
aliases: ["put"],
|
|
5509
5838
|
describe: "Insert or update an aggregate",
|
|
5510
|
-
builder: (
|
|
5839
|
+
builder: (yargs36) => withConfiguration(
|
|
5511
5840
|
withApiOptions(
|
|
5512
5841
|
withProjectOptions(
|
|
5513
|
-
|
|
5842
|
+
yargs36.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
5514
5843
|
)
|
|
5515
5844
|
)
|
|
5516
5845
|
),
|
|
@@ -5527,34 +5856,33 @@ var AggregateModule = {
|
|
|
5527
5856
|
command: "aggregate <command>",
|
|
5528
5857
|
aliases: ["agg", "intent", "audience"],
|
|
5529
5858
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
5530
|
-
builder: (
|
|
5859
|
+
builder: (yargs36) => yargs36.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
5531
5860
|
handler: () => {
|
|
5532
|
-
|
|
5861
|
+
yargs17.help();
|
|
5533
5862
|
}
|
|
5534
5863
|
};
|
|
5535
5864
|
|
|
5536
5865
|
// src/commands/context/commands/enrichment.ts
|
|
5537
|
-
import
|
|
5866
|
+
import yargs18 from "yargs";
|
|
5538
5867
|
|
|
5539
5868
|
// src/commands/context/commands/enrichment/get.ts
|
|
5540
5869
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
5541
5870
|
var EnrichmentGetModule = {
|
|
5542
5871
|
command: "get <id>",
|
|
5543
5872
|
describe: "Fetch an enrichment category and its values",
|
|
5544
|
-
builder: (
|
|
5873
|
+
builder: (yargs36) => withFormatOptions(
|
|
5545
5874
|
withConfiguration(
|
|
5546
5875
|
withApiOptions(
|
|
5547
5876
|
withProjectOptions(
|
|
5548
|
-
|
|
5877
|
+
yargs36.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
5549
5878
|
)
|
|
5550
5879
|
)
|
|
5551
5880
|
)
|
|
5552
5881
|
),
|
|
5553
5882
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
5554
|
-
var _a, _b;
|
|
5555
5883
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5556
5884
|
const client = new UncachedEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5557
|
-
const res = (
|
|
5885
|
+
const res = (await client.get())?.enrichments?.filter((enr) => enr.id === id);
|
|
5558
5886
|
if (res.length === 0) {
|
|
5559
5887
|
console.error("Enrichment did not exist");
|
|
5560
5888
|
process.exit(1);
|
|
@@ -5570,7 +5898,7 @@ var EnrichmentListModule = {
|
|
|
5570
5898
|
command: "list",
|
|
5571
5899
|
describe: "List enrichments",
|
|
5572
5900
|
aliases: ["ls"],
|
|
5573
|
-
builder: (
|
|
5901
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
5574
5902
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5575
5903
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5576
5904
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5609,7 +5937,6 @@ function createEnrichmentEngineDataSource({
|
|
|
5609
5937
|
await client.removeCategory({ enrichmentId: providerId });
|
|
5610
5938
|
},
|
|
5611
5939
|
writeObject: async (object, existingObject) => {
|
|
5612
|
-
var _a;
|
|
5613
5940
|
await client.upsertCategory({
|
|
5614
5941
|
enrichment: object.object
|
|
5615
5942
|
});
|
|
@@ -5619,7 +5946,7 @@ function createEnrichmentEngineDataSource({
|
|
|
5619
5946
|
});
|
|
5620
5947
|
const target = createEnrichmentValueEngineDataSource({
|
|
5621
5948
|
categoryId: object.object.id,
|
|
5622
|
-
values:
|
|
5949
|
+
values: existingObject?.object?.values ?? [],
|
|
5623
5950
|
client
|
|
5624
5951
|
});
|
|
5625
5952
|
await syncEngine({
|
|
@@ -5673,11 +6000,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
5673
6000
|
var EnrichmentPullModule = {
|
|
5674
6001
|
command: "pull <directory>",
|
|
5675
6002
|
describe: "Pulls all enrichments to local files in a directory",
|
|
5676
|
-
builder: (
|
|
6003
|
+
builder: (yargs36) => withConfiguration(
|
|
5677
6004
|
withApiOptions(
|
|
5678
6005
|
withProjectOptions(
|
|
5679
6006
|
withDiffOptions(
|
|
5680
|
-
|
|
6007
|
+
yargs36.positional("directory", {
|
|
5681
6008
|
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
6009
|
type: "string"
|
|
5683
6010
|
}).option("format", {
|
|
@@ -5755,11 +6082,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
5755
6082
|
var EnrichmentPushModule = {
|
|
5756
6083
|
command: "push <directory>",
|
|
5757
6084
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
5758
|
-
builder: (
|
|
6085
|
+
builder: (yargs36) => withConfiguration(
|
|
5759
6086
|
withApiOptions(
|
|
5760
6087
|
withProjectOptions(
|
|
5761
6088
|
withDiffOptions(
|
|
5762
|
-
|
|
6089
|
+
yargs36.positional("directory", {
|
|
5763
6090
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
5764
6091
|
type: "string"
|
|
5765
6092
|
}).option("what-if", {
|
|
@@ -5826,10 +6153,10 @@ var EnrichmentRemoveModule = {
|
|
|
5826
6153
|
command: "remove <id>",
|
|
5827
6154
|
aliases: ["delete", "rm"],
|
|
5828
6155
|
describe: "Delete an enrichment category and its values",
|
|
5829
|
-
builder: (
|
|
6156
|
+
builder: (yargs36) => withConfiguration(
|
|
5830
6157
|
withApiOptions(
|
|
5831
6158
|
withProjectOptions(
|
|
5832
|
-
|
|
6159
|
+
yargs36.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
5833
6160
|
)
|
|
5834
6161
|
)
|
|
5835
6162
|
),
|
|
@@ -5845,14 +6172,14 @@ var EnrichmentModule = {
|
|
|
5845
6172
|
command: "enrichment <command>",
|
|
5846
6173
|
aliases: ["enr"],
|
|
5847
6174
|
describe: "Commands for Context enrichments",
|
|
5848
|
-
builder: (
|
|
6175
|
+
builder: (yargs36) => yargs36.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
5849
6176
|
handler: () => {
|
|
5850
|
-
|
|
6177
|
+
yargs18.help();
|
|
5851
6178
|
}
|
|
5852
6179
|
};
|
|
5853
6180
|
|
|
5854
6181
|
// src/commands/context/commands/manifest.ts
|
|
5855
|
-
import
|
|
6182
|
+
import yargs19 from "yargs";
|
|
5856
6183
|
|
|
5857
6184
|
// src/commands/context/commands/manifest/get.ts
|
|
5858
6185
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -5863,10 +6190,10 @@ var ManifestGetModule = {
|
|
|
5863
6190
|
command: "get [output]",
|
|
5864
6191
|
aliases: ["dl", "download"],
|
|
5865
6192
|
describe: "Download the Uniform Context manifest for a project",
|
|
5866
|
-
builder: (
|
|
6193
|
+
builder: (yargs36) => withConfiguration(
|
|
5867
6194
|
withApiOptions(
|
|
5868
6195
|
withProjectOptions(
|
|
5869
|
-
|
|
6196
|
+
yargs36.option("preview", {
|
|
5870
6197
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
5871
6198
|
default: false,
|
|
5872
6199
|
type: "boolean",
|
|
@@ -5928,7 +6255,7 @@ import { exit as exit2 } from "process";
|
|
|
5928
6255
|
var ManifestPublishModule = {
|
|
5929
6256
|
command: "publish",
|
|
5930
6257
|
describe: "Publish the Uniform Context manifest for a project",
|
|
5931
|
-
builder: (
|
|
6258
|
+
builder: (yargs36) => withConfiguration(withApiOptions(withProjectOptions(yargs36))),
|
|
5932
6259
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
5933
6260
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5934
6261
|
try {
|
|
@@ -5961,25 +6288,25 @@ var ManifestModule = {
|
|
|
5961
6288
|
command: "manifest <command>",
|
|
5962
6289
|
describe: "Commands for context manifests",
|
|
5963
6290
|
aliases: ["man"],
|
|
5964
|
-
builder: (
|
|
6291
|
+
builder: (yargs36) => yargs36.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
5965
6292
|
handler: () => {
|
|
5966
|
-
|
|
6293
|
+
yargs19.help();
|
|
5967
6294
|
}
|
|
5968
6295
|
};
|
|
5969
6296
|
|
|
5970
6297
|
// src/commands/context/commands/quirk.ts
|
|
5971
|
-
import
|
|
6298
|
+
import yargs20 from "yargs";
|
|
5972
6299
|
|
|
5973
6300
|
// src/commands/context/commands/quirk/get.ts
|
|
5974
6301
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
5975
6302
|
var QuirkGetModule = {
|
|
5976
6303
|
command: "get <id>",
|
|
5977
6304
|
describe: "Fetch a quirk",
|
|
5978
|
-
builder: (
|
|
6305
|
+
builder: (yargs36) => withConfiguration(
|
|
5979
6306
|
withFormatOptions(
|
|
5980
6307
|
withApiOptions(
|
|
5981
6308
|
withProjectOptions(
|
|
5982
|
-
|
|
6309
|
+
yargs36.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
5983
6310
|
)
|
|
5984
6311
|
)
|
|
5985
6312
|
)
|
|
@@ -6003,11 +6330,11 @@ var QuirkListModule = {
|
|
|
6003
6330
|
command: "list",
|
|
6004
6331
|
describe: "List quirks",
|
|
6005
6332
|
aliases: ["ls"],
|
|
6006
|
-
builder: (
|
|
6333
|
+
builder: (yargs36) => withConfiguration(
|
|
6007
6334
|
withFormatOptions(
|
|
6008
6335
|
withApiOptions(
|
|
6009
6336
|
withProjectOptions(
|
|
6010
|
-
|
|
6337
|
+
yargs36.option("withIntegrations", {
|
|
6011
6338
|
alias: ["i"],
|
|
6012
6339
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
6013
6340
|
type: "boolean"
|
|
@@ -6065,11 +6392,11 @@ function createQuirkEngineDataSource({
|
|
|
6065
6392
|
var QuirkPullModule = {
|
|
6066
6393
|
command: "pull <directory>",
|
|
6067
6394
|
describe: "Pulls all quirks to local files in a directory",
|
|
6068
|
-
builder: (
|
|
6395
|
+
builder: (yargs36) => withConfiguration(
|
|
6069
6396
|
withApiOptions(
|
|
6070
6397
|
withProjectOptions(
|
|
6071
6398
|
withDiffOptions(
|
|
6072
|
-
|
|
6399
|
+
yargs36.positional("directory", {
|
|
6073
6400
|
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
6401
|
type: "string"
|
|
6075
6402
|
}).option("format", {
|
|
@@ -6147,11 +6474,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
6147
6474
|
var QuirkPushModule = {
|
|
6148
6475
|
command: "push <directory>",
|
|
6149
6476
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
6150
|
-
builder: (
|
|
6477
|
+
builder: (yargs36) => withConfiguration(
|
|
6151
6478
|
withApiOptions(
|
|
6152
6479
|
withProjectOptions(
|
|
6153
6480
|
withDiffOptions(
|
|
6154
|
-
|
|
6481
|
+
yargs36.positional("directory", {
|
|
6155
6482
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
6156
6483
|
type: "string"
|
|
6157
6484
|
}).option("what-if", {
|
|
@@ -6218,10 +6545,10 @@ var QuirkRemoveModule = {
|
|
|
6218
6545
|
command: "remove <id>",
|
|
6219
6546
|
aliases: ["delete", "rm"],
|
|
6220
6547
|
describe: "Delete a quirk",
|
|
6221
|
-
builder: (
|
|
6548
|
+
builder: (yargs36) => withConfiguration(
|
|
6222
6549
|
withApiOptions(
|
|
6223
6550
|
withProjectOptions(
|
|
6224
|
-
|
|
6551
|
+
yargs36.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
6225
6552
|
)
|
|
6226
6553
|
)
|
|
6227
6554
|
),
|
|
@@ -6238,10 +6565,10 @@ var QuirkUpdateModule = {
|
|
|
6238
6565
|
command: "update <filename>",
|
|
6239
6566
|
aliases: ["put"],
|
|
6240
6567
|
describe: "Insert or update a quirk",
|
|
6241
|
-
builder: (
|
|
6568
|
+
builder: (yargs36) => withConfiguration(
|
|
6242
6569
|
withApiOptions(
|
|
6243
6570
|
withProjectOptions(
|
|
6244
|
-
|
|
6571
|
+
yargs36.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
6245
6572
|
)
|
|
6246
6573
|
)
|
|
6247
6574
|
),
|
|
@@ -6258,25 +6585,25 @@ var QuirkModule = {
|
|
|
6258
6585
|
command: "quirk <command>",
|
|
6259
6586
|
aliases: ["qk"],
|
|
6260
6587
|
describe: "Commands for Context quirks",
|
|
6261
|
-
builder: (
|
|
6588
|
+
builder: (yargs36) => yargs36.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
6262
6589
|
handler: () => {
|
|
6263
|
-
|
|
6590
|
+
yargs20.help();
|
|
6264
6591
|
}
|
|
6265
6592
|
};
|
|
6266
6593
|
|
|
6267
6594
|
// src/commands/context/commands/signal.ts
|
|
6268
|
-
import
|
|
6595
|
+
import yargs21 from "yargs";
|
|
6269
6596
|
|
|
6270
6597
|
// src/commands/context/commands/signal/get.ts
|
|
6271
6598
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
6272
6599
|
var SignalGetModule = {
|
|
6273
6600
|
command: "get <id>",
|
|
6274
6601
|
describe: "Fetch a signal",
|
|
6275
|
-
builder: (
|
|
6602
|
+
builder: (yargs36) => withConfiguration(
|
|
6276
6603
|
withFormatOptions(
|
|
6277
6604
|
withApiOptions(
|
|
6278
6605
|
withProjectOptions(
|
|
6279
|
-
|
|
6606
|
+
yargs36.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
6280
6607
|
)
|
|
6281
6608
|
)
|
|
6282
6609
|
)
|
|
@@ -6300,7 +6627,7 @@ var SignalListModule = {
|
|
|
6300
6627
|
command: "list",
|
|
6301
6628
|
describe: "List signals",
|
|
6302
6629
|
aliases: ["ls"],
|
|
6303
|
-
builder: (
|
|
6630
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
6304
6631
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6305
6632
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6306
6633
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6350,11 +6677,11 @@ function createSignalEngineDataSource({
|
|
|
6350
6677
|
var SignalPullModule = {
|
|
6351
6678
|
command: "pull <directory>",
|
|
6352
6679
|
describe: "Pulls all signals to local files in a directory",
|
|
6353
|
-
builder: (
|
|
6680
|
+
builder: (yargs36) => withConfiguration(
|
|
6354
6681
|
withApiOptions(
|
|
6355
6682
|
withProjectOptions(
|
|
6356
6683
|
withDiffOptions(
|
|
6357
|
-
|
|
6684
|
+
yargs36.positional("directory", {
|
|
6358
6685
|
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
6686
|
type: "string"
|
|
6360
6687
|
}).option("format", {
|
|
@@ -6432,11 +6759,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
6432
6759
|
var SignalPushModule = {
|
|
6433
6760
|
command: "push <directory>",
|
|
6434
6761
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
6435
|
-
builder: (
|
|
6762
|
+
builder: (yargs36) => withConfiguration(
|
|
6436
6763
|
withApiOptions(
|
|
6437
6764
|
withProjectOptions(
|
|
6438
6765
|
withDiffOptions(
|
|
6439
|
-
|
|
6766
|
+
yargs36.positional("directory", {
|
|
6440
6767
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
6441
6768
|
type: "string"
|
|
6442
6769
|
}).option("what-if", {
|
|
@@ -6503,10 +6830,10 @@ var SignalRemoveModule = {
|
|
|
6503
6830
|
command: "remove <id>",
|
|
6504
6831
|
aliases: ["delete", "rm"],
|
|
6505
6832
|
describe: "Delete a signal",
|
|
6506
|
-
builder: (
|
|
6833
|
+
builder: (yargs36) => withConfiguration(
|
|
6507
6834
|
withApiOptions(
|
|
6508
6835
|
withProjectOptions(
|
|
6509
|
-
|
|
6836
|
+
yargs36.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
6510
6837
|
)
|
|
6511
6838
|
)
|
|
6512
6839
|
),
|
|
@@ -6523,10 +6850,10 @@ var SignalUpdateModule = {
|
|
|
6523
6850
|
command: "update <filename>",
|
|
6524
6851
|
aliases: ["put"],
|
|
6525
6852
|
describe: "Insert or update a signal",
|
|
6526
|
-
builder: (
|
|
6853
|
+
builder: (yargs36) => withConfiguration(
|
|
6527
6854
|
withApiOptions(
|
|
6528
6855
|
withProjectOptions(
|
|
6529
|
-
|
|
6856
|
+
yargs36.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
6530
6857
|
)
|
|
6531
6858
|
)
|
|
6532
6859
|
),
|
|
@@ -6543,25 +6870,25 @@ var SignalModule = {
|
|
|
6543
6870
|
command: "signal <command>",
|
|
6544
6871
|
aliases: ["sig"],
|
|
6545
6872
|
describe: "Commands for Context signals",
|
|
6546
|
-
builder: (
|
|
6873
|
+
builder: (yargs36) => yargs36.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
6547
6874
|
handler: () => {
|
|
6548
|
-
|
|
6875
|
+
yargs21.help();
|
|
6549
6876
|
}
|
|
6550
6877
|
};
|
|
6551
6878
|
|
|
6552
6879
|
// src/commands/context/commands/test.ts
|
|
6553
|
-
import
|
|
6880
|
+
import yargs22 from "yargs";
|
|
6554
6881
|
|
|
6555
6882
|
// src/commands/context/commands/test/get.ts
|
|
6556
6883
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
6557
6884
|
var TestGetModule = {
|
|
6558
6885
|
command: "get <id>",
|
|
6559
6886
|
describe: "Fetch a test",
|
|
6560
|
-
builder: (
|
|
6887
|
+
builder: (yargs36) => withConfiguration(
|
|
6561
6888
|
withFormatOptions(
|
|
6562
6889
|
withApiOptions(
|
|
6563
6890
|
withProjectOptions(
|
|
6564
|
-
|
|
6891
|
+
yargs36.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
6565
6892
|
)
|
|
6566
6893
|
)
|
|
6567
6894
|
)
|
|
@@ -6585,7 +6912,7 @@ var TestListModule = {
|
|
|
6585
6912
|
command: "list",
|
|
6586
6913
|
describe: "List tests",
|
|
6587
6914
|
aliases: ["ls"],
|
|
6588
|
-
builder: (
|
|
6915
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
6589
6916
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6590
6917
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6591
6918
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6635,11 +6962,11 @@ function createTestEngineDataSource({
|
|
|
6635
6962
|
var TestPullModule = {
|
|
6636
6963
|
command: "pull <directory>",
|
|
6637
6964
|
describe: "Pulls all tests to local files in a directory",
|
|
6638
|
-
builder: (
|
|
6965
|
+
builder: (yargs36) => withConfiguration(
|
|
6639
6966
|
withApiOptions(
|
|
6640
6967
|
withProjectOptions(
|
|
6641
6968
|
withDiffOptions(
|
|
6642
|
-
|
|
6969
|
+
yargs36.positional("directory", {
|
|
6643
6970
|
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
6971
|
type: "string"
|
|
6645
6972
|
}).option("format", {
|
|
@@ -6717,11 +7044,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
6717
7044
|
var TestPushModule = {
|
|
6718
7045
|
command: "push <directory>",
|
|
6719
7046
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
6720
|
-
builder: (
|
|
7047
|
+
builder: (yargs36) => withConfiguration(
|
|
6721
7048
|
withApiOptions(
|
|
6722
7049
|
withProjectOptions(
|
|
6723
7050
|
withDiffOptions(
|
|
6724
|
-
|
|
7051
|
+
yargs36.positional("directory", {
|
|
6725
7052
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
6726
7053
|
type: "string"
|
|
6727
7054
|
}).option("what-if", {
|
|
@@ -6788,10 +7115,10 @@ var TestRemoveModule = {
|
|
|
6788
7115
|
command: "remove <id>",
|
|
6789
7116
|
aliases: ["delete", "rm"],
|
|
6790
7117
|
describe: "Delete a test",
|
|
6791
|
-
builder: (
|
|
7118
|
+
builder: (yargs36) => withConfiguration(
|
|
6792
7119
|
withApiOptions(
|
|
6793
7120
|
withProjectOptions(
|
|
6794
|
-
|
|
7121
|
+
yargs36.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
6795
7122
|
)
|
|
6796
7123
|
)
|
|
6797
7124
|
),
|
|
@@ -6808,9 +7135,9 @@ var TestUpdateModule = {
|
|
|
6808
7135
|
command: "update <filename>",
|
|
6809
7136
|
aliases: ["put"],
|
|
6810
7137
|
describe: "Insert or update a test",
|
|
6811
|
-
builder: (
|
|
7138
|
+
builder: (yargs36) => withConfiguration(
|
|
6812
7139
|
withApiOptions(
|
|
6813
|
-
withProjectOptions(
|
|
7140
|
+
withProjectOptions(yargs36.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
6814
7141
|
)
|
|
6815
7142
|
),
|
|
6816
7143
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -6825,9 +7152,9 @@ var TestUpdateModule = {
|
|
|
6825
7152
|
var TestModule = {
|
|
6826
7153
|
command: "test <command>",
|
|
6827
7154
|
describe: "Commands for Context A/B tests",
|
|
6828
|
-
builder: (
|
|
7155
|
+
builder: (yargs36) => yargs36.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
6829
7156
|
handler: () => {
|
|
6830
|
-
|
|
7157
|
+
yargs22.help();
|
|
6831
7158
|
}
|
|
6832
7159
|
};
|
|
6833
7160
|
|
|
@@ -6836,23 +7163,23 @@ var ContextCommand = {
|
|
|
6836
7163
|
command: "context <command>",
|
|
6837
7164
|
aliases: ["ctx"],
|
|
6838
7165
|
describe: "Uniform Context commands",
|
|
6839
|
-
builder: (
|
|
7166
|
+
builder: (yargs36) => yargs36.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
6840
7167
|
handler: () => {
|
|
6841
|
-
|
|
7168
|
+
yargs23.showHelp();
|
|
6842
7169
|
}
|
|
6843
7170
|
};
|
|
6844
7171
|
|
|
6845
7172
|
// src/commands/integration/index.ts
|
|
6846
|
-
import
|
|
7173
|
+
import yargs26 from "yargs";
|
|
6847
7174
|
|
|
6848
7175
|
// src/commands/integration/commands/definition.ts
|
|
6849
|
-
import
|
|
7176
|
+
import yargs25 from "yargs";
|
|
6850
7177
|
|
|
6851
7178
|
// src/commands/integration/commands/definition/edgehancer/edgehancer.ts
|
|
6852
|
-
import
|
|
7179
|
+
import yargs24 from "yargs";
|
|
6853
7180
|
|
|
6854
7181
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
6855
|
-
import { readFileSync
|
|
7182
|
+
import { readFileSync } from "fs";
|
|
6856
7183
|
|
|
6857
7184
|
// src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
|
|
6858
7185
|
import { createLimitPolicy } from "@uniformdev/canvas";
|
|
@@ -6887,8 +7214,8 @@ var EdgehancerClient = class extends ApiClient {
|
|
|
6887
7214
|
};
|
|
6888
7215
|
|
|
6889
7216
|
// src/commands/integration/commands/definition/edgehancer/util.ts
|
|
6890
|
-
function withEdgehancerIdOptions(
|
|
6891
|
-
return
|
|
7217
|
+
function withEdgehancerIdOptions(yargs36) {
|
|
7218
|
+
return yargs36.option("connectorType", {
|
|
6892
7219
|
describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
|
|
6893
7220
|
demandOption: true,
|
|
6894
7221
|
type: "string"
|
|
@@ -6908,11 +7235,11 @@ function withEdgehancerIdOptions(yargs34) {
|
|
|
6908
7235
|
var IntegrationEdgehancerDeployModule = {
|
|
6909
7236
|
command: "deploy <filename>",
|
|
6910
7237
|
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: (
|
|
7238
|
+
builder: (yargs36) => withConfiguration(
|
|
6912
7239
|
withApiOptions(
|
|
6913
7240
|
withTeamOptions(
|
|
6914
7241
|
withEdgehancerIdOptions(
|
|
6915
|
-
|
|
7242
|
+
yargs36.positional("filename", {
|
|
6916
7243
|
demandOption: true,
|
|
6917
7244
|
describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
|
|
6918
7245
|
})
|
|
@@ -6923,7 +7250,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6923
7250
|
handler: async ({ apiHost, apiKey, proxy, filename, team: teamId, archetype, connectorType, hook }) => {
|
|
6924
7251
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6925
7252
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
6926
|
-
const code =
|
|
7253
|
+
const code = readFileSync(filename, "utf8");
|
|
6927
7254
|
await client.deploy({ archetype, code, connectorType, hook });
|
|
6928
7255
|
}
|
|
6929
7256
|
};
|
|
@@ -6932,7 +7259,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6932
7259
|
var IntegrationEdgehancerRemoveModule = {
|
|
6933
7260
|
command: "remove",
|
|
6934
7261
|
describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
|
|
6935
|
-
builder: (
|
|
7262
|
+
builder: (yargs36) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs36)))),
|
|
6936
7263
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
|
|
6937
7264
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6938
7265
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
@@ -6944,9 +7271,9 @@ var IntegrationEdgehancerRemoveModule = {
|
|
|
6944
7271
|
var IntegrationEdgehancerModule = {
|
|
6945
7272
|
command: "edgehancer <command>",
|
|
6946
7273
|
describe: "Commands for managing custom integration edgehancers at the team level.",
|
|
6947
|
-
builder: (
|
|
7274
|
+
builder: (yargs36) => yargs36.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
|
|
6948
7275
|
handler: () => {
|
|
6949
|
-
|
|
7276
|
+
yargs24.help();
|
|
6950
7277
|
}
|
|
6951
7278
|
};
|
|
6952
7279
|
|
|
@@ -6986,10 +7313,10 @@ var DefinitionClient = class extends ApiClient2 {
|
|
|
6986
7313
|
var IntegrationDefinitionRegisterModule = {
|
|
6987
7314
|
command: "register <filename>",
|
|
6988
7315
|
describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
|
|
6989
|
-
builder: (
|
|
7316
|
+
builder: (yargs36) => withConfiguration(
|
|
6990
7317
|
withApiOptions(
|
|
6991
7318
|
withTeamOptions(
|
|
6992
|
-
|
|
7319
|
+
yargs36.positional("filename", {
|
|
6993
7320
|
demandOption: true,
|
|
6994
7321
|
describe: "Integration definition manifest to register"
|
|
6995
7322
|
})
|
|
@@ -7008,10 +7335,10 @@ var IntegrationDefinitionRegisterModule = {
|
|
|
7008
7335
|
var IntegrationDefinitionRemoveModule = {
|
|
7009
7336
|
command: "remove <type>",
|
|
7010
7337
|
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: (
|
|
7338
|
+
builder: (yargs36) => withConfiguration(
|
|
7012
7339
|
withApiOptions(
|
|
7013
7340
|
withTeamOptions(
|
|
7014
|
-
|
|
7341
|
+
yargs36.positional("type", {
|
|
7015
7342
|
demandOption: true,
|
|
7016
7343
|
describe: "Integration type (from its manifest) to remove."
|
|
7017
7344
|
})
|
|
@@ -7029,9 +7356,9 @@ var IntegrationDefinitionRemoveModule = {
|
|
|
7029
7356
|
var IntegrationDefinitionModule = {
|
|
7030
7357
|
command: "definition <command>",
|
|
7031
7358
|
describe: "Commands for managing custom integration definitions at the team level.",
|
|
7032
|
-
builder: (
|
|
7359
|
+
builder: (yargs36) => yargs36.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).demandCommand(),
|
|
7033
7360
|
handler: () => {
|
|
7034
|
-
|
|
7361
|
+
yargs25.help();
|
|
7035
7362
|
}
|
|
7036
7363
|
};
|
|
7037
7364
|
|
|
@@ -7071,10 +7398,10 @@ var InstallClient = class extends ApiClient3 {
|
|
|
7071
7398
|
var IntegrationInstallModule = {
|
|
7072
7399
|
command: "install <type>",
|
|
7073
7400
|
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: (
|
|
7401
|
+
builder: (yargs36) => withConfiguration(
|
|
7075
7402
|
withApiOptions(
|
|
7076
7403
|
withProjectOptions(
|
|
7077
|
-
|
|
7404
|
+
yargs36.positional("type", {
|
|
7078
7405
|
demandOption: true,
|
|
7079
7406
|
describe: "Integration type to install (as defined in its manifest)"
|
|
7080
7407
|
}).option("configuration", {
|
|
@@ -7096,10 +7423,10 @@ var IntegrationInstallModule = {
|
|
|
7096
7423
|
var IntegrationUninstallModule = {
|
|
7097
7424
|
command: "uninstall <type>",
|
|
7098
7425
|
describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
|
|
7099
|
-
builder: (
|
|
7426
|
+
builder: (yargs36) => withConfiguration(
|
|
7100
7427
|
withApiOptions(
|
|
7101
7428
|
withProjectOptions(
|
|
7102
|
-
|
|
7429
|
+
yargs36.positional("type", {
|
|
7103
7430
|
demandOption: true,
|
|
7104
7431
|
describe: "Integration type to uninstall (as defined in its manifest)"
|
|
7105
7432
|
})
|
|
@@ -7117,9 +7444,9 @@ var IntegrationUninstallModule = {
|
|
|
7117
7444
|
var IntegrationCommand = {
|
|
7118
7445
|
command: "integration <command>",
|
|
7119
7446
|
describe: "Integration management commands",
|
|
7120
|
-
builder: (
|
|
7447
|
+
builder: (yargs36) => yargs36.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
|
|
7121
7448
|
handler: () => {
|
|
7122
|
-
|
|
7449
|
+
yargs26.showHelp();
|
|
7123
7450
|
}
|
|
7124
7451
|
};
|
|
7125
7452
|
|
|
@@ -7131,7 +7458,7 @@ var makeSpinner = () => {
|
|
|
7131
7458
|
const spin = async (text) => {
|
|
7132
7459
|
const spinner = ora(text).start();
|
|
7133
7460
|
spinners.push(spinner);
|
|
7134
|
-
const minWait = new Promise((
|
|
7461
|
+
const minWait = new Promise((resolve) => setTimeout(resolve, 500));
|
|
7135
7462
|
return async () => {
|
|
7136
7463
|
await minWait;
|
|
7137
7464
|
spinner.stop();
|
|
@@ -7147,10 +7474,20 @@ import { PostHog } from "posthog-node";
|
|
|
7147
7474
|
// package.json
|
|
7148
7475
|
var package_default = {
|
|
7149
7476
|
name: "@uniformdev/cli",
|
|
7150
|
-
version: "19.
|
|
7477
|
+
version: "19.185.0",
|
|
7151
7478
|
description: "Uniform command line interface tool",
|
|
7152
7479
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
7153
7480
|
main: "./cli.js",
|
|
7481
|
+
exports: {
|
|
7482
|
+
".": {
|
|
7483
|
+
types: "./dist/index.d.mts",
|
|
7484
|
+
default: "./cli.js"
|
|
7485
|
+
},
|
|
7486
|
+
"./config": {
|
|
7487
|
+
types: "./dist/defaultConfig.d.mts",
|
|
7488
|
+
default: "./dist/defaultConfig.mjs"
|
|
7489
|
+
}
|
|
7490
|
+
},
|
|
7154
7491
|
types: "./dist/index.d.mts",
|
|
7155
7492
|
sideEffects: false,
|
|
7156
7493
|
scripts: {
|
|
@@ -7172,13 +7509,13 @@ var package_default = {
|
|
|
7172
7509
|
"@uniformdev/redirect": "workspace:*",
|
|
7173
7510
|
"call-bind": "^1.0.2",
|
|
7174
7511
|
colorette: "2.0.20",
|
|
7175
|
-
cosmiconfig: "
|
|
7512
|
+
cosmiconfig: "9.0.0",
|
|
7176
7513
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
7177
7514
|
diff: "^5.0.0",
|
|
7178
7515
|
dotenv: "^16.0.3",
|
|
7179
7516
|
execa: "5.1.1",
|
|
7180
7517
|
"fs-jetpack": "5.1.0",
|
|
7181
|
-
graphql: "16.
|
|
7518
|
+
graphql: "16.9.0",
|
|
7182
7519
|
"graphql-request": "6.1.0",
|
|
7183
7520
|
"image-size": "^1.0.2",
|
|
7184
7521
|
inquirer: "9.2.17",
|
|
@@ -7186,7 +7523,7 @@ var package_default = {
|
|
|
7186
7523
|
"js-yaml": "^4.1.0",
|
|
7187
7524
|
jsonwebtoken: "9.0.2",
|
|
7188
7525
|
"lodash.isequalwith": "^4.4.0",
|
|
7189
|
-
open: "
|
|
7526
|
+
open: "10.1.0",
|
|
7190
7527
|
ora: "8.0.1",
|
|
7191
7528
|
"p-queue": "7.3.4",
|
|
7192
7529
|
"posthog-node": "4.0.1",
|
|
@@ -7195,7 +7532,7 @@ var package_default = {
|
|
|
7195
7532
|
slugify: "1.6.6",
|
|
7196
7533
|
undici: "^6.10.1",
|
|
7197
7534
|
yargs: "^17.6.2",
|
|
7198
|
-
zod: "3.
|
|
7535
|
+
zod: "3.23.8"
|
|
7199
7536
|
},
|
|
7200
7537
|
devDependencies: {
|
|
7201
7538
|
"@types/diff": "5.0.9",
|
|
@@ -7249,8 +7586,7 @@ var Telemetry = class {
|
|
|
7249
7586
|
this.send("logged in");
|
|
7250
7587
|
}
|
|
7251
7588
|
send(event, properties = {}) {
|
|
7252
|
-
|
|
7253
|
-
(_a = this.posthog) == null ? void 0 : _a.capture({
|
|
7589
|
+
this.posthog?.capture({
|
|
7254
7590
|
distinctId: this.distinctId,
|
|
7255
7591
|
event: [this.prefix, event].join(" "),
|
|
7256
7592
|
properties: {
|
|
@@ -7260,9 +7596,8 @@ var Telemetry = class {
|
|
|
7260
7596
|
});
|
|
7261
7597
|
}
|
|
7262
7598
|
shutdown() {
|
|
7263
|
-
var _a;
|
|
7264
7599
|
this.send("exited", { exitCode: process.exitCode });
|
|
7265
|
-
return
|
|
7600
|
+
return this.posthog?.shutdown();
|
|
7266
7601
|
}
|
|
7267
7602
|
};
|
|
7268
7603
|
|
|
@@ -7275,7 +7610,7 @@ import jwt from "jsonwebtoken";
|
|
|
7275
7610
|
import open from "open";
|
|
7276
7611
|
|
|
7277
7612
|
// src/url.ts
|
|
7278
|
-
var makeUrl = (baseUrl,
|
|
7613
|
+
var makeUrl = (baseUrl, path4) => [baseUrl.trim().replace(/\/+$/, ""), path4.trim().replace(/^\/+/, "")].join("/");
|
|
7279
7614
|
|
|
7280
7615
|
// src/auth/getBearerToken.ts
|
|
7281
7616
|
async function getBearerToken(baseUrl) {
|
|
@@ -7380,8 +7715,8 @@ var getLimitsSchema = z.object({
|
|
|
7380
7715
|
})
|
|
7381
7716
|
});
|
|
7382
7717
|
var createClient = (baseUrl, authToken) => {
|
|
7383
|
-
const request2 = async (
|
|
7384
|
-
const res = await fetch(makeUrl(baseUrl,
|
|
7718
|
+
const request2 = async (path4, opts, allowedNon2xxStatusCodes = []) => {
|
|
7719
|
+
const res = await fetch(makeUrl(baseUrl, path4), {
|
|
7385
7720
|
...opts,
|
|
7386
7721
|
headers: { Authorization: `Bearer ${authToken}` }
|
|
7387
7722
|
});
|
|
@@ -7389,18 +7724,18 @@ var createClient = (baseUrl, authToken) => {
|
|
|
7389
7724
|
return res;
|
|
7390
7725
|
} else {
|
|
7391
7726
|
throw new Error(
|
|
7392
|
-
`Non-2xx API response: ${opts.method} ${
|
|
7727
|
+
`Non-2xx API response: ${opts.method} ${path4} responded with ${res.status} ${res.statusText}`
|
|
7393
7728
|
);
|
|
7394
7729
|
}
|
|
7395
7730
|
};
|
|
7396
|
-
const requestJson = async (
|
|
7397
|
-
const res = await request2(
|
|
7731
|
+
const requestJson = async (path4, opts, schema2, allowedNon2xxStatusCodes = []) => {
|
|
7732
|
+
const res = await request2(path4, opts, allowedNon2xxStatusCodes);
|
|
7398
7733
|
const data = await res.json();
|
|
7399
7734
|
const parseResult = schema2.safeParse(data);
|
|
7400
7735
|
if (parseResult.success) {
|
|
7401
7736
|
return parseResult.data;
|
|
7402
7737
|
} else {
|
|
7403
|
-
throw new Error(`Invalid ${opts.method} ${
|
|
7738
|
+
throw new Error(`Invalid ${opts.method} ${path4} response: ${parseResult.error.message}`);
|
|
7404
7739
|
}
|
|
7405
7740
|
};
|
|
7406
7741
|
return {
|
|
@@ -7522,7 +7857,7 @@ var runNpm = async (workDir, args, { inherit, env } = {}) => {
|
|
|
7522
7857
|
${err.message}`);
|
|
7523
7858
|
}
|
|
7524
7859
|
if (result.exitCode !== 0) {
|
|
7525
|
-
throw new Error(`Command npm ${args.join(" ")} exitted with code ${result
|
|
7860
|
+
throw new Error(`Command npm ${args.join(" ")} exitted with code ${result?.exitCode}}: ${result.stderr}`);
|
|
7526
7861
|
}
|
|
7527
7862
|
return result.stdout;
|
|
7528
7863
|
};
|
|
@@ -7534,7 +7869,7 @@ import fsj2 from "fs-jetpack";
|
|
|
7534
7869
|
import * as git from "isomorphic-git";
|
|
7535
7870
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
7536
7871
|
import os from "os";
|
|
7537
|
-
import
|
|
7872
|
+
import path from "path";
|
|
7538
7873
|
async function cloneStarter({
|
|
7539
7874
|
spin,
|
|
7540
7875
|
githubPath,
|
|
@@ -7542,7 +7877,7 @@ async function cloneStarter({
|
|
|
7542
7877
|
dotEnvFile
|
|
7543
7878
|
}) {
|
|
7544
7879
|
const done = await spin("Fetching starter code...");
|
|
7545
|
-
const cloneDir =
|
|
7880
|
+
const cloneDir = path.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
7546
7881
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
7547
7882
|
try {
|
|
7548
7883
|
await git.clone({
|
|
@@ -7560,10 +7895,10 @@ async function cloneStarter({
|
|
|
7560
7895
|
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
7561
7896
|
throw new Error(`"${targetDir}" is not empty`);
|
|
7562
7897
|
}
|
|
7563
|
-
const starterDir =
|
|
7898
|
+
const starterDir = path.join(cloneDir, ...pathSegments);
|
|
7564
7899
|
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
7565
7900
|
if (dotEnvFile) {
|
|
7566
|
-
fs3.writeFileSync(
|
|
7901
|
+
fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
7567
7902
|
}
|
|
7568
7903
|
console.log(`
|
|
7569
7904
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -7579,9 +7914,9 @@ Installing project dependencies...
|
|
|
7579
7914
|
}
|
|
7580
7915
|
|
|
7581
7916
|
// src/projects/getOrCreateProject.ts
|
|
7582
|
-
import fs4, { existsSync as existsSync2, mkdirSync as
|
|
7917
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
7583
7918
|
import inquirer2 from "inquirer";
|
|
7584
|
-
import
|
|
7919
|
+
import path2 from "path";
|
|
7585
7920
|
import slugify from "slugify";
|
|
7586
7921
|
var newProjectId = "$new";
|
|
7587
7922
|
async function getOrCreateProject({
|
|
@@ -7676,8 +8011,7 @@ async function chooseExistingProject({
|
|
|
7676
8011
|
teamId,
|
|
7677
8012
|
user
|
|
7678
8013
|
}) {
|
|
7679
|
-
|
|
7680
|
-
const projects = (((_a = user.teams.find((t) => t.team.id === teamId)) == null ? void 0 : _a.team.sites) ?? []).map((t) => ({
|
|
8014
|
+
const projects = (user.teams.find((t) => t.team.id === teamId)?.team.sites ?? []).map((t) => ({
|
|
7681
8015
|
name: t.name,
|
|
7682
8016
|
value: t.id
|
|
7683
8017
|
}));
|
|
@@ -7692,7 +8026,7 @@ async function chooseExistingProject({
|
|
|
7692
8026
|
]);
|
|
7693
8027
|
return {
|
|
7694
8028
|
projectId: result.projectId,
|
|
7695
|
-
projectName:
|
|
8029
|
+
projectName: projects.find((p) => p.value === result.projectId)?.name
|
|
7696
8030
|
};
|
|
7697
8031
|
}
|
|
7698
8032
|
function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
@@ -7704,10 +8038,10 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
7704
8038
|
if (checkTargetDir) {
|
|
7705
8039
|
let targetDir = explicitTargetDir ?? process.cwd();
|
|
7706
8040
|
if (!existsSync2(targetDir)) {
|
|
7707
|
-
|
|
8041
|
+
mkdirSync2(targetDir, { recursive: true });
|
|
7708
8042
|
}
|
|
7709
8043
|
if (fs4.readdirSync(targetDir).length > 0) {
|
|
7710
|
-
targetDir =
|
|
8044
|
+
targetDir = path2.resolve(targetDir, projectNameSlug);
|
|
7711
8045
|
if (fs4.existsSync(targetDir)) {
|
|
7712
8046
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
7713
8047
|
}
|
|
@@ -7961,9 +8295,9 @@ npm run dev
|
|
|
7961
8295
|
}
|
|
7962
8296
|
|
|
7963
8297
|
// src/commands/new/commands/new-mesh-integration.ts
|
|
7964
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
8298
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
7965
8299
|
import inquirer5 from "inquirer";
|
|
7966
|
-
import
|
|
8300
|
+
import path3 from "path";
|
|
7967
8301
|
import slugify2 from "slugify";
|
|
7968
8302
|
async function newMeshIntegrationHandler({
|
|
7969
8303
|
spin,
|
|
@@ -8004,19 +8338,19 @@ async function newMeshIntegrationHandler({
|
|
|
8004
8338
|
targetDir
|
|
8005
8339
|
});
|
|
8006
8340
|
let done = await spin("Registering integration to team...");
|
|
8007
|
-
const pathToManifest =
|
|
8341
|
+
const pathToManifest = path3.resolve(targetDir, "mesh-manifest.json");
|
|
8008
8342
|
if (!existsSync3(pathToManifest)) {
|
|
8009
8343
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
8010
8344
|
}
|
|
8011
|
-
const manifestContents =
|
|
8345
|
+
const manifestContents = readFileSync2(pathToManifest, "utf-8");
|
|
8012
8346
|
const manifestJson = JSON.parse(manifestContents);
|
|
8013
8347
|
manifestJson.type = typeSlug;
|
|
8014
8348
|
manifestJson.displayName = name;
|
|
8015
|
-
|
|
8016
|
-
const packageJsonPath =
|
|
8017
|
-
const packageJson = JSON.parse(
|
|
8349
|
+
writeFileSync(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
|
|
8350
|
+
const packageJsonPath = path3.resolve(targetDir, "package.json");
|
|
8351
|
+
const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
|
|
8018
8352
|
packageJson.name = typeSlug;
|
|
8019
|
-
|
|
8353
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
8020
8354
|
const fullMeshAppKey = await uniformClient.registerMeshIntegration({ teamId, manifest: manifestJson });
|
|
8021
8355
|
await done();
|
|
8022
8356
|
await runNpmInstall();
|
|
@@ -8060,10 +8394,10 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
|
|
|
8060
8394
|
}
|
|
8061
8395
|
let targetDir = explicitOutputPath ?? process.cwd();
|
|
8062
8396
|
if (!existsSync3(targetDir)) {
|
|
8063
|
-
|
|
8397
|
+
mkdirSync3(targetDir, { recursive: true });
|
|
8064
8398
|
}
|
|
8065
8399
|
if (readdirSync(targetDir).length > 0) {
|
|
8066
|
-
targetDir =
|
|
8400
|
+
targetDir = path3.resolve(targetDir, typeSlug);
|
|
8067
8401
|
if (existsSync3(targetDir)) {
|
|
8068
8402
|
throw new Error(`${targetDir} directory already exists, choose a different name.`);
|
|
8069
8403
|
}
|
|
@@ -8156,10 +8490,10 @@ var NewMeshCmd = {
|
|
|
8156
8490
|
};
|
|
8157
8491
|
|
|
8158
8492
|
// src/commands/optimize/index.ts
|
|
8159
|
-
import
|
|
8493
|
+
import yargs28 from "yargs";
|
|
8160
8494
|
|
|
8161
8495
|
// src/commands/optimize/manifest.ts
|
|
8162
|
-
import
|
|
8496
|
+
import yargs27 from "yargs";
|
|
8163
8497
|
|
|
8164
8498
|
// src/commands/optimize/manifest/download.ts
|
|
8165
8499
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -8174,7 +8508,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
8174
8508
|
var module = {
|
|
8175
8509
|
command: "download [output]",
|
|
8176
8510
|
describe: "Download intent manifest",
|
|
8177
|
-
builder: (
|
|
8511
|
+
builder: (yargs36) => yargs36.option("apiKey", {
|
|
8178
8512
|
alias: "k",
|
|
8179
8513
|
demandOption: true,
|
|
8180
8514
|
string: true,
|
|
@@ -8275,10 +8609,10 @@ var module2 = {
|
|
|
8275
8609
|
command: "manifest <command>",
|
|
8276
8610
|
describe: "Intent manifest commands",
|
|
8277
8611
|
builder: () => {
|
|
8278
|
-
return
|
|
8612
|
+
return yargs27.command(download_default);
|
|
8279
8613
|
},
|
|
8280
8614
|
handler: () => {
|
|
8281
|
-
|
|
8615
|
+
yargs27.showHelp();
|
|
8282
8616
|
}
|
|
8283
8617
|
};
|
|
8284
8618
|
var manifest_default = module2;
|
|
@@ -8289,29 +8623,29 @@ var OptimizeCommand = {
|
|
|
8289
8623
|
aliases: ["opt"],
|
|
8290
8624
|
describe: "Uniform Optimize commands",
|
|
8291
8625
|
builder: () => {
|
|
8292
|
-
return
|
|
8626
|
+
return yargs28.command(manifest_default);
|
|
8293
8627
|
},
|
|
8294
8628
|
handler: () => {
|
|
8295
|
-
|
|
8629
|
+
yargs28.showHelp();
|
|
8296
8630
|
}
|
|
8297
8631
|
};
|
|
8298
8632
|
|
|
8299
8633
|
// src/commands/project-map/index.ts
|
|
8300
|
-
import
|
|
8634
|
+
import yargs31 from "yargs";
|
|
8301
8635
|
|
|
8302
8636
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
8303
|
-
import
|
|
8637
|
+
import yargs29 from "yargs";
|
|
8304
8638
|
|
|
8305
8639
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
8306
8640
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
8307
8641
|
var ProjectMapDefinitionGetModule = {
|
|
8308
8642
|
command: "get <id>",
|
|
8309
8643
|
describe: "Fetch a project map",
|
|
8310
|
-
builder: (
|
|
8644
|
+
builder: (yargs36) => withFormatOptions(
|
|
8311
8645
|
withConfiguration(
|
|
8312
8646
|
withApiOptions(
|
|
8313
8647
|
withProjectOptions(
|
|
8314
|
-
|
|
8648
|
+
yargs36.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
8315
8649
|
)
|
|
8316
8650
|
)
|
|
8317
8651
|
)
|
|
@@ -8335,7 +8669,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
8335
8669
|
command: "list",
|
|
8336
8670
|
describe: "List of project maps",
|
|
8337
8671
|
aliases: ["ls"],
|
|
8338
|
-
builder: (
|
|
8672
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
8339
8673
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8340
8674
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8341
8675
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -8393,11 +8727,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
8393
8727
|
var ProjectMapDefinitionPullModule = {
|
|
8394
8728
|
command: "pull <directory>",
|
|
8395
8729
|
describe: "Pulls all project maps to local files in a directory",
|
|
8396
|
-
builder: (
|
|
8730
|
+
builder: (yargs36) => withConfiguration(
|
|
8397
8731
|
withApiOptions(
|
|
8398
8732
|
withProjectOptions(
|
|
8399
8733
|
withDiffOptions(
|
|
8400
|
-
|
|
8734
|
+
yargs36.positional("directory", {
|
|
8401
8735
|
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
8736
|
type: "string"
|
|
8403
8737
|
}).option("format", {
|
|
@@ -8475,11 +8809,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
8475
8809
|
var ProjectMapDefinitionPushModule = {
|
|
8476
8810
|
command: "push <directory>",
|
|
8477
8811
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
8478
|
-
builder: (
|
|
8812
|
+
builder: (yargs36) => withConfiguration(
|
|
8479
8813
|
withApiOptions(
|
|
8480
8814
|
withProjectOptions(
|
|
8481
8815
|
withDiffOptions(
|
|
8482
|
-
|
|
8816
|
+
yargs36.positional("directory", {
|
|
8483
8817
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8484
8818
|
type: "string"
|
|
8485
8819
|
}).option("what-if", {
|
|
@@ -8546,9 +8880,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
8546
8880
|
command: "remove <id>",
|
|
8547
8881
|
aliases: ["delete", "rm"],
|
|
8548
8882
|
describe: "Delete a project map",
|
|
8549
|
-
builder: (
|
|
8883
|
+
builder: (yargs36) => withConfiguration(
|
|
8550
8884
|
withApiOptions(
|
|
8551
|
-
withProjectOptions(
|
|
8885
|
+
withProjectOptions(yargs36.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
8552
8886
|
)
|
|
8553
8887
|
),
|
|
8554
8888
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -8564,10 +8898,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8564
8898
|
command: "update <filename>",
|
|
8565
8899
|
aliases: ["put"],
|
|
8566
8900
|
describe: "Insert or update a project map",
|
|
8567
|
-
builder: (
|
|
8901
|
+
builder: (yargs36) => withConfiguration(
|
|
8568
8902
|
withApiOptions(
|
|
8569
8903
|
withProjectOptions(
|
|
8570
|
-
|
|
8904
|
+
yargs36.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
8571
8905
|
)
|
|
8572
8906
|
)
|
|
8573
8907
|
),
|
|
@@ -8583,36 +8917,35 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
8583
8917
|
var ProjectMapDefinitionModule = {
|
|
8584
8918
|
command: "definition <command>",
|
|
8585
8919
|
describe: "Commands for ProjectMap Definitions",
|
|
8586
|
-
builder: (
|
|
8920
|
+
builder: (yargs36) => yargs36.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
8587
8921
|
handler: () => {
|
|
8588
|
-
|
|
8922
|
+
yargs29.help();
|
|
8589
8923
|
}
|
|
8590
8924
|
};
|
|
8591
8925
|
|
|
8592
8926
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
8593
|
-
import
|
|
8927
|
+
import yargs30 from "yargs";
|
|
8594
8928
|
|
|
8595
8929
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
8596
8930
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
8597
8931
|
var ProjectMapNodeGetModule = {
|
|
8598
8932
|
command: "get <id> <projectMapId>",
|
|
8599
8933
|
describe: "Fetch a project map node",
|
|
8600
|
-
builder: (
|
|
8934
|
+
builder: (yargs36) => withConfiguration(
|
|
8601
8935
|
withFormatOptions(
|
|
8602
8936
|
withApiOptions(
|
|
8603
8937
|
withProjectOptions(
|
|
8604
|
-
|
|
8938
|
+
yargs36.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
8605
8939
|
)
|
|
8606
8940
|
)
|
|
8607
8941
|
)
|
|
8608
8942
|
),
|
|
8609
8943
|
handler: async ({ apiHost, apiKey, proxy, id, projectMapId, format, project: projectId, filename }) => {
|
|
8610
|
-
var _a;
|
|
8611
8944
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8612
8945
|
const client = new UncachedProjectMapClient7({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
8613
8946
|
console.log("Debugging params for node get", { projectMapId, id, projectId });
|
|
8614
8947
|
const res = await client.getNodes({ projectMapId, id });
|
|
8615
|
-
if (
|
|
8948
|
+
if (res.nodes?.length === 0) {
|
|
8616
8949
|
console.error("Project map node does not exist");
|
|
8617
8950
|
process.exit(1);
|
|
8618
8951
|
} else {
|
|
@@ -8627,12 +8960,12 @@ var ProjectMapNodeListModule = {
|
|
|
8627
8960
|
command: "list <projectMapId>",
|
|
8628
8961
|
describe: "List project map nodes",
|
|
8629
8962
|
aliases: ["ls"],
|
|
8630
|
-
builder: (
|
|
8963
|
+
builder: (yargs36) => withConfiguration(
|
|
8631
8964
|
withFormatOptions(
|
|
8632
8965
|
withApiOptions(
|
|
8633
8966
|
withProjectOptions(
|
|
8634
8967
|
withStateOptions(
|
|
8635
|
-
|
|
8968
|
+
yargs36.positional("projectMapId", {
|
|
8636
8969
|
demandOption: true,
|
|
8637
8970
|
describe: "ProjectMap UUID to fetch from"
|
|
8638
8971
|
})
|
|
@@ -8705,11 +9038,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
8705
9038
|
var ProjectMapNodePullModule = {
|
|
8706
9039
|
command: "pull <directory>",
|
|
8707
9040
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
8708
|
-
builder: (
|
|
9041
|
+
builder: (yargs36) => withConfiguration(
|
|
8709
9042
|
withApiOptions(
|
|
8710
9043
|
withProjectOptions(
|
|
8711
9044
|
withDiffOptions(
|
|
8712
|
-
|
|
9045
|
+
yargs36.positional("directory", {
|
|
8713
9046
|
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
9047
|
type: "string"
|
|
8715
9048
|
}).option("format", {
|
|
@@ -8787,15 +9120,18 @@ var ProjectMapNodePullModule = {
|
|
|
8787
9120
|
};
|
|
8788
9121
|
|
|
8789
9122
|
// src/commands/project-map/commands/ProjectMapNode/push.ts
|
|
8790
|
-
import {
|
|
9123
|
+
import {
|
|
9124
|
+
__INTERNAL_MISSING_PARENT_NODE_ERROR,
|
|
9125
|
+
UncachedProjectMapClient as UncachedProjectMapClient10
|
|
9126
|
+
} from "@uniformdev/project-map";
|
|
8791
9127
|
var ProjectMapNodePushModule = {
|
|
8792
9128
|
command: "push <directory>",
|
|
8793
9129
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
8794
|
-
builder: (
|
|
9130
|
+
builder: (yargs36) => withConfiguration(
|
|
8795
9131
|
withApiOptions(
|
|
8796
9132
|
withProjectOptions(
|
|
8797
9133
|
withDiffOptions(
|
|
8798
|
-
|
|
9134
|
+
yargs36.positional("directory", {
|
|
8799
9135
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
8800
9136
|
type: "string"
|
|
8801
9137
|
}).option("what-if", {
|
|
@@ -8841,7 +9177,9 @@ var ProjectMapNodePushModule = {
|
|
|
8841
9177
|
const packageContents = readContextPackage2(directory, true);
|
|
8842
9178
|
source = await createArraySyncEngineDataSource({
|
|
8843
9179
|
name: `Package file ${directory}`,
|
|
8844
|
-
objects: packageContents.projectMapNodes
|
|
9180
|
+
objects: packageContents.projectMapNodes.sort((a, b) => {
|
|
9181
|
+
return a.path.length - b.path.length;
|
|
9182
|
+
}) ?? [],
|
|
8845
9183
|
selectIdentifier: expandedSelectIdentifier,
|
|
8846
9184
|
selectDisplayName: selectDisplayName12
|
|
8847
9185
|
});
|
|
@@ -8854,14 +9192,41 @@ var ProjectMapNodePushModule = {
|
|
|
8854
9192
|
});
|
|
8855
9193
|
}
|
|
8856
9194
|
const target = createProjectMapNodeEngineDataSource({ client, projectId });
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
9195
|
+
const nodesFailedDueToMissingParent = /* @__PURE__ */ new Set();
|
|
9196
|
+
const attemptSync = async () => {
|
|
9197
|
+
const lastFailedNodesCount = nodesFailedDueToMissingParent.size;
|
|
9198
|
+
nodesFailedDueToMissingParent.clear();
|
|
9199
|
+
await syncEngine({
|
|
9200
|
+
source,
|
|
9201
|
+
target,
|
|
9202
|
+
mode,
|
|
9203
|
+
whatIf,
|
|
9204
|
+
allowEmptySource,
|
|
9205
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
9206
|
+
onError: (error, object) => {
|
|
9207
|
+
if (error.message.includes(__INTERNAL_MISSING_PARENT_NODE_ERROR)) {
|
|
9208
|
+
nodesFailedDueToMissingParent.add(object.object);
|
|
9209
|
+
} else {
|
|
9210
|
+
throw error;
|
|
9211
|
+
}
|
|
9212
|
+
}
|
|
9213
|
+
});
|
|
9214
|
+
if (nodesFailedDueToMissingParent.size !== 0) {
|
|
9215
|
+
const newFailedNodesCount = nodesFailedDueToMissingParent.size;
|
|
9216
|
+
if (newFailedNodesCount !== lastFailedNodesCount) {
|
|
9217
|
+
source = await createArraySyncEngineDataSource({
|
|
9218
|
+
name: `Nodes re-push from ${directory}`,
|
|
9219
|
+
objects: Array.from(nodesFailedDueToMissingParent),
|
|
9220
|
+
selectIdentifier: expandedSelectIdentifier,
|
|
9221
|
+
selectDisplayName: selectDisplayName12
|
|
9222
|
+
});
|
|
9223
|
+
await attemptSync();
|
|
9224
|
+
} else {
|
|
9225
|
+
throw new Error("Failed to push nodes due to missing parent nodes");
|
|
9226
|
+
}
|
|
9227
|
+
}
|
|
9228
|
+
};
|
|
9229
|
+
await attemptSync();
|
|
8865
9230
|
}
|
|
8866
9231
|
};
|
|
8867
9232
|
|
|
@@ -8871,10 +9236,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
8871
9236
|
command: "remove <id> <projectMapId>",
|
|
8872
9237
|
aliases: ["delete", "rm"],
|
|
8873
9238
|
describe: "Delete a project map node",
|
|
8874
|
-
builder: (
|
|
9239
|
+
builder: (yargs36) => withConfiguration(
|
|
8875
9240
|
withApiOptions(
|
|
8876
9241
|
withProjectOptions(
|
|
8877
|
-
|
|
9242
|
+
yargs36.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
8878
9243
|
)
|
|
8879
9244
|
)
|
|
8880
9245
|
),
|
|
@@ -8891,10 +9256,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8891
9256
|
command: "update <filename> <projectMapId>",
|
|
8892
9257
|
aliases: ["put"],
|
|
8893
9258
|
describe: "Insert or update a project map node",
|
|
8894
|
-
builder: (
|
|
9259
|
+
builder: (yargs36) => withConfiguration(
|
|
8895
9260
|
withApiOptions(
|
|
8896
9261
|
withProjectOptions(
|
|
8897
|
-
|
|
9262
|
+
yargs36.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
8898
9263
|
)
|
|
8899
9264
|
)
|
|
8900
9265
|
),
|
|
@@ -8910,9 +9275,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
8910
9275
|
var ProjectMapNodeModule = {
|
|
8911
9276
|
command: "node <command>",
|
|
8912
9277
|
describe: "Commands for ProjectMap Nodes",
|
|
8913
|
-
builder: (
|
|
9278
|
+
builder: (yargs36) => yargs36.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
8914
9279
|
handler: () => {
|
|
8915
|
-
|
|
9280
|
+
yargs30.help();
|
|
8916
9281
|
}
|
|
8917
9282
|
};
|
|
8918
9283
|
|
|
@@ -8921,28 +9286,28 @@ var ProjectMapCommand = {
|
|
|
8921
9286
|
command: "project-map <command>",
|
|
8922
9287
|
aliases: ["prm"],
|
|
8923
9288
|
describe: "Uniform ProjectMap commands",
|
|
8924
|
-
builder: (
|
|
9289
|
+
builder: (yargs36) => yargs36.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
8925
9290
|
handler: () => {
|
|
8926
|
-
|
|
9291
|
+
yargs31.showHelp();
|
|
8927
9292
|
}
|
|
8928
9293
|
};
|
|
8929
9294
|
|
|
8930
9295
|
// src/commands/redirect/index.ts
|
|
8931
|
-
import
|
|
9296
|
+
import yargs33 from "yargs";
|
|
8932
9297
|
|
|
8933
9298
|
// src/commands/redirect/commands/redirect.ts
|
|
8934
|
-
import
|
|
9299
|
+
import yargs32 from "yargs";
|
|
8935
9300
|
|
|
8936
9301
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
8937
9302
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
8938
9303
|
var RedirectDefinitionGetModule = {
|
|
8939
9304
|
command: "get <id>",
|
|
8940
9305
|
describe: "Fetch a redirect",
|
|
8941
|
-
builder: (
|
|
9306
|
+
builder: (yargs36) => withConfiguration(
|
|
8942
9307
|
withFormatOptions(
|
|
8943
9308
|
withApiOptions(
|
|
8944
9309
|
withProjectOptions(
|
|
8945
|
-
|
|
9310
|
+
yargs36.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
8946
9311
|
)
|
|
8947
9312
|
)
|
|
8948
9313
|
)
|
|
@@ -8966,7 +9331,7 @@ var RedirectDefinitionListModule = {
|
|
|
8966
9331
|
command: "list",
|
|
8967
9332
|
describe: "List of redirects",
|
|
8968
9333
|
aliases: ["ls"],
|
|
8969
|
-
builder: (
|
|
9334
|
+
builder: (yargs36) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs36)))),
|
|
8970
9335
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8971
9336
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8972
9337
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -9033,11 +9398,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
9033
9398
|
var RedirectDefinitionPullModule = {
|
|
9034
9399
|
command: "pull <directory>",
|
|
9035
9400
|
describe: "Pulls all redirects to local files in a directory",
|
|
9036
|
-
builder: (
|
|
9401
|
+
builder: (yargs36) => withConfiguration(
|
|
9037
9402
|
withApiOptions(
|
|
9038
9403
|
withProjectOptions(
|
|
9039
9404
|
withDiffOptions(
|
|
9040
|
-
|
|
9405
|
+
yargs36.positional("directory", {
|
|
9041
9406
|
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
9407
|
type: "string"
|
|
9043
9408
|
}).option("format", {
|
|
@@ -9116,11 +9481,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
9116
9481
|
var RedirectDefinitionPushModule = {
|
|
9117
9482
|
command: "push <directory>",
|
|
9118
9483
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
9119
|
-
builder: (
|
|
9484
|
+
builder: (yargs36) => withConfiguration(
|
|
9120
9485
|
withApiOptions(
|
|
9121
9486
|
withProjectOptions(
|
|
9122
9487
|
withDiffOptions(
|
|
9123
|
-
|
|
9488
|
+
yargs36.positional("directory", {
|
|
9124
9489
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
9125
9490
|
type: "string"
|
|
9126
9491
|
}).option("what-if", {
|
|
@@ -9187,9 +9552,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
9187
9552
|
command: "remove <id>",
|
|
9188
9553
|
aliases: ["delete", "rm"],
|
|
9189
9554
|
describe: "Delete a redirect",
|
|
9190
|
-
builder: (
|
|
9555
|
+
builder: (yargs36) => withConfiguration(
|
|
9191
9556
|
withApiOptions(
|
|
9192
|
-
withProjectOptions(
|
|
9557
|
+
withProjectOptions(yargs36.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
9193
9558
|
)
|
|
9194
9559
|
),
|
|
9195
9560
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -9205,10 +9570,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
9205
9570
|
command: "update <filename>",
|
|
9206
9571
|
aliases: ["put"],
|
|
9207
9572
|
describe: "Insert or update a redirect",
|
|
9208
|
-
builder: (
|
|
9573
|
+
builder: (yargs36) => withConfiguration(
|
|
9209
9574
|
withApiOptions(
|
|
9210
9575
|
withProjectOptions(
|
|
9211
|
-
|
|
9576
|
+
yargs36.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
9212
9577
|
)
|
|
9213
9578
|
)
|
|
9214
9579
|
),
|
|
@@ -9224,9 +9589,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
9224
9589
|
var RedirectDefinitionModule = {
|
|
9225
9590
|
command: "definition <command>",
|
|
9226
9591
|
describe: "Commands for Redirect Definitions",
|
|
9227
|
-
builder: (
|
|
9592
|
+
builder: (yargs36) => yargs36.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
9228
9593
|
handler: () => {
|
|
9229
|
-
|
|
9594
|
+
yargs32.help();
|
|
9230
9595
|
}
|
|
9231
9596
|
};
|
|
9232
9597
|
|
|
@@ -9235,14 +9600,14 @@ var RedirectCommand = {
|
|
|
9235
9600
|
command: "redirect <command>",
|
|
9236
9601
|
aliases: ["red"],
|
|
9237
9602
|
describe: "Uniform Redirect commands",
|
|
9238
|
-
builder: (
|
|
9603
|
+
builder: (yargs36) => yargs36.command(RedirectDefinitionModule).demandCommand(),
|
|
9239
9604
|
handler: () => {
|
|
9240
|
-
|
|
9605
|
+
yargs33.showHelp();
|
|
9241
9606
|
}
|
|
9242
9607
|
};
|
|
9243
9608
|
|
|
9244
9609
|
// src/commands/sync/index.ts
|
|
9245
|
-
import
|
|
9610
|
+
import yargs34 from "yargs";
|
|
9246
9611
|
|
|
9247
9612
|
// src/commands/sync/commands/util.ts
|
|
9248
9613
|
import ora2 from "ora";
|
|
@@ -9302,11 +9667,11 @@ function patchConsole(fn, ora3, replay = []) {
|
|
|
9302
9667
|
var SyncPullModule = {
|
|
9303
9668
|
command: "pull",
|
|
9304
9669
|
describe: "Pulls whole project to local files in a directory",
|
|
9305
|
-
builder: (
|
|
9670
|
+
builder: (yargs36) => withConfiguration(
|
|
9306
9671
|
withApiOptions(
|
|
9307
9672
|
withProjectOptions(
|
|
9308
9673
|
withDiffOptions(
|
|
9309
|
-
|
|
9674
|
+
yargs36.option("what-if", {
|
|
9310
9675
|
alias: ["w"],
|
|
9311
9676
|
describe: "What-if mode reports what would be done but changes no files",
|
|
9312
9677
|
default: false,
|
|
@@ -9317,13 +9682,7 @@ var SyncPullModule = {
|
|
|
9317
9682
|
)
|
|
9318
9683
|
),
|
|
9319
9684
|
handler: async ({ serialization, ...otherParams }) => {
|
|
9320
|
-
var _a, _b;
|
|
9321
9685
|
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
9686
|
const enabledEntities = Object.entries({
|
|
9328
9687
|
locale: LocalePullModule,
|
|
9329
9688
|
asset: AssetPullModule,
|
|
@@ -9337,7 +9696,9 @@ var SyncPullModule = {
|
|
|
9337
9696
|
enrichment: EnrichmentPullModule,
|
|
9338
9697
|
aggregate: AggregatePullModule,
|
|
9339
9698
|
component: ComponentPullModule,
|
|
9699
|
+
pattern: PatternPullModule,
|
|
9340
9700
|
componentPattern: ComponentPatternPullModule,
|
|
9701
|
+
compositionPattern: CompositionPatternPullModule,
|
|
9341
9702
|
composition: CompositionPullModule,
|
|
9342
9703
|
projectMapDefinition: ProjectMapDefinitionPullModule,
|
|
9343
9704
|
projectMapNode: ProjectMapNodePullModule,
|
|
@@ -9347,8 +9708,7 @@ var SyncPullModule = {
|
|
|
9347
9708
|
contentType: ContentTypePullModule
|
|
9348
9709
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9349
9710
|
}).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;
|
|
9711
|
+
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.pull?.disabled !== true;
|
|
9352
9712
|
});
|
|
9353
9713
|
if (enabledEntities.length === 0) {
|
|
9354
9714
|
throw new Error(
|
|
@@ -9359,7 +9719,7 @@ var SyncPullModule = {
|
|
|
9359
9719
|
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
9360
9720
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
9361
9721
|
};
|
|
9362
|
-
const entityConfig =
|
|
9722
|
+
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
9363
9723
|
try {
|
|
9364
9724
|
await spinPromise(
|
|
9365
9725
|
module3.handler({
|
|
@@ -9367,9 +9727,10 @@ var SyncPullModule = {
|
|
|
9367
9727
|
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
9368
9728
|
format: getFormat(entityType, config2),
|
|
9369
9729
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
9370
|
-
onlyPatterns:
|
|
9730
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
9731
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
9371
9732
|
mode: getPullMode(entityType, config2),
|
|
9372
|
-
directory: getPullFilename(entityType, config2
|
|
9733
|
+
directory: getPullFilename(entityType, config2),
|
|
9373
9734
|
allowEmptySource: config2.allowEmptySource
|
|
9374
9735
|
}),
|
|
9375
9736
|
{
|
|
@@ -9378,7 +9739,7 @@ var SyncPullModule = {
|
|
|
9378
9739
|
failText(error) {
|
|
9379
9740
|
return `${entityType}
|
|
9380
9741
|
|
|
9381
|
-
${error.stack}`;
|
|
9742
|
+
${error.stack ?? error.message}`;
|
|
9382
9743
|
}
|
|
9383
9744
|
}
|
|
9384
9745
|
);
|
|
@@ -9396,13 +9757,11 @@ var getPullMode = (entityType, config2) => {
|
|
|
9396
9757
|
entityType
|
|
9397
9758
|
});
|
|
9398
9759
|
};
|
|
9399
|
-
var getPullFilename = (entityType, config2
|
|
9760
|
+
var getPullFilename = (entityType, config2) => {
|
|
9400
9761
|
return getDirectoryOrFilename({
|
|
9401
9762
|
operation: "pull",
|
|
9402
9763
|
config: config2,
|
|
9403
|
-
entityType
|
|
9404
|
-
// This fallback can be removed when publishing a major release
|
|
9405
|
-
defaultEntityFolderName: isUsingDeprecatedPatternConfig && entityType === "componentPattern" ? "pattern" : void 0
|
|
9764
|
+
entityType
|
|
9406
9765
|
});
|
|
9407
9766
|
};
|
|
9408
9767
|
var getFormat = (entityType, config2) => {
|
|
@@ -9418,11 +9777,11 @@ var getFormat = (entityType, config2) => {
|
|
|
9418
9777
|
var SyncPushModule = {
|
|
9419
9778
|
command: "push",
|
|
9420
9779
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
9421
|
-
builder: (
|
|
9780
|
+
builder: (yargs36) => withConfiguration(
|
|
9422
9781
|
withApiOptions(
|
|
9423
9782
|
withProjectOptions(
|
|
9424
9783
|
withDiffOptions(
|
|
9425
|
-
|
|
9784
|
+
yargs36.option("what-if", {
|
|
9426
9785
|
alias: ["w"],
|
|
9427
9786
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
9428
9787
|
default: false,
|
|
@@ -9433,13 +9792,7 @@ var SyncPushModule = {
|
|
|
9433
9792
|
)
|
|
9434
9793
|
),
|
|
9435
9794
|
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
9795
|
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
9796
|
const enabledEntities = Object.entries({
|
|
9444
9797
|
locale: LocalePushModule,
|
|
9445
9798
|
asset: AssetPushModule,
|
|
@@ -9453,7 +9806,9 @@ var SyncPushModule = {
|
|
|
9453
9806
|
enrichment: EnrichmentPushModule,
|
|
9454
9807
|
aggregate: AggregatePushModule,
|
|
9455
9808
|
component: ComponentPushModule,
|
|
9809
|
+
pattern: PatternPushModule,
|
|
9456
9810
|
componentPattern: ComponentPatternPushModule,
|
|
9811
|
+
compositionPattern: CompositionPatternPushModule,
|
|
9457
9812
|
composition: CompositionPushModule,
|
|
9458
9813
|
projectMapDefinition: ProjectMapDefinitionPushModule,
|
|
9459
9814
|
projectMapNode: ProjectMapNodePushModule,
|
|
@@ -9463,8 +9818,7 @@ var SyncPushModule = {
|
|
|
9463
9818
|
entryPattern: EntryPatternPushModule
|
|
9464
9819
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9465
9820
|
}).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;
|
|
9821
|
+
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.push?.disabled !== true;
|
|
9468
9822
|
});
|
|
9469
9823
|
if (enabledEntities.length === 0) {
|
|
9470
9824
|
throw new Error(
|
|
@@ -9479,9 +9833,10 @@ var SyncPushModule = {
|
|
|
9479
9833
|
state: 0,
|
|
9480
9834
|
format: getFormat2(entityType, config2),
|
|
9481
9835
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
9482
|
-
onlyPatterns:
|
|
9836
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
9837
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
9483
9838
|
mode: getPushMode(entityType, config2),
|
|
9484
|
-
directory: getPushFilename(entityType, config2
|
|
9839
|
+
directory: getPushFilename(entityType, config2),
|
|
9485
9840
|
allowEmptySource: config2.allowEmptySource
|
|
9486
9841
|
}),
|
|
9487
9842
|
{
|
|
@@ -9490,7 +9845,7 @@ var SyncPushModule = {
|
|
|
9490
9845
|
failText(error) {
|
|
9491
9846
|
return `${entityType}
|
|
9492
9847
|
|
|
9493
|
-
${error.stack}`;
|
|
9848
|
+
${error.stack ?? error.message}`;
|
|
9494
9849
|
}
|
|
9495
9850
|
}
|
|
9496
9851
|
);
|
|
@@ -9498,16 +9853,19 @@ var SyncPushModule = {
|
|
|
9498
9853
|
process.exit(1);
|
|
9499
9854
|
}
|
|
9500
9855
|
}
|
|
9501
|
-
if (
|
|
9856
|
+
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
9502
9857
|
await ComponentPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9503
9858
|
}
|
|
9504
|
-
if (
|
|
9859
|
+
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
9860
|
+
await CompositionPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9861
|
+
}
|
|
9862
|
+
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
9505
9863
|
await CompositionPublishModule.handler({ ...otherParams, all: true });
|
|
9506
9864
|
}
|
|
9507
|
-
if (
|
|
9865
|
+
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
9508
9866
|
await EntryPublishModule.handler({ ...otherParams, all: true });
|
|
9509
9867
|
}
|
|
9510
|
-
if (
|
|
9868
|
+
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
9511
9869
|
await EntryPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9512
9870
|
}
|
|
9513
9871
|
}
|
|
@@ -9520,13 +9878,11 @@ var getPushMode = (entityType, config2) => {
|
|
|
9520
9878
|
entityType
|
|
9521
9879
|
});
|
|
9522
9880
|
};
|
|
9523
|
-
var getPushFilename = (entityType, config2
|
|
9881
|
+
var getPushFilename = (entityType, config2) => {
|
|
9524
9882
|
return getDirectoryOrFilename({
|
|
9525
9883
|
operation: "push",
|
|
9526
9884
|
config: config2,
|
|
9527
|
-
entityType
|
|
9528
|
-
// This fallback can be removed when publishing a major release
|
|
9529
|
-
defaultEntityFolderName: isUsingDeprecatedPatternConfig && entityType === "componentPattern" ? "pattern" : void 0
|
|
9885
|
+
entityType
|
|
9530
9886
|
});
|
|
9531
9887
|
};
|
|
9532
9888
|
var getFormat2 = (entityType, config2) => {
|
|
@@ -9542,9 +9898,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
9542
9898
|
var SyncCommand = {
|
|
9543
9899
|
command: "sync <command>",
|
|
9544
9900
|
describe: "Uniform Sync commands",
|
|
9545
|
-
builder: (
|
|
9901
|
+
builder: (yargs36) => yargs36.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
9546
9902
|
handler: () => {
|
|
9547
|
-
|
|
9903
|
+
yargs34.showHelp();
|
|
9548
9904
|
}
|
|
9549
9905
|
};
|
|
9550
9906
|
|
|
@@ -9617,7 +9973,7 @@ var updateCache = async (file, latest, lastUpdate) => {
|
|
|
9617
9973
|
});
|
|
9618
9974
|
await fs5.writeFile(file, content, "utf8");
|
|
9619
9975
|
};
|
|
9620
|
-
var loadPackage = ({ url, timeout }, authInfo) => new Promise((
|
|
9976
|
+
var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve, reject) => {
|
|
9621
9977
|
const options = {
|
|
9622
9978
|
host: url.hostname,
|
|
9623
9979
|
path: url.pathname,
|
|
@@ -9648,7 +10004,7 @@ var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve2, reject)
|
|
|
9648
10004
|
response.on("end", () => {
|
|
9649
10005
|
try {
|
|
9650
10006
|
const parsedData = JSON.parse(rawData);
|
|
9651
|
-
|
|
10007
|
+
resolve(parsedData);
|
|
9652
10008
|
} catch (e) {
|
|
9653
10009
|
reject(e);
|
|
9654
10010
|
}
|
|
@@ -9662,7 +10018,7 @@ var getMostRecent = async ({ full, scope }, distTag, timeout) => {
|
|
|
9662
10018
|
try {
|
|
9663
10019
|
spec = await loadPackage({ url, timeout });
|
|
9664
10020
|
} catch (err) {
|
|
9665
|
-
if (
|
|
10021
|
+
if (err?.code && String(err.code).startsWith("4")) {
|
|
9666
10022
|
const registryAuthToken = __require("registry-auth-token");
|
|
9667
10023
|
const authInfo = registryAuthToken(regURL, { recursive: true });
|
|
9668
10024
|
spec = await loadPackage({ url, timeout }, authInfo);
|
|
@@ -9743,14 +10099,14 @@ import { join as join4 } from "path";
|
|
|
9743
10099
|
|
|
9744
10100
|
// src/fs.ts
|
|
9745
10101
|
import { promises as fs6 } from "fs";
|
|
9746
|
-
async function readJSON(
|
|
9747
|
-
const fileContents = await fs6.readFile(
|
|
10102
|
+
async function readJSON(path4) {
|
|
10103
|
+
const fileContents = await fs6.readFile(path4, "utf-8");
|
|
9748
10104
|
return JSON.parse(fileContents);
|
|
9749
10105
|
}
|
|
9750
|
-
async function tryReadJSON(
|
|
10106
|
+
async function tryReadJSON(path4, missingValue = null) {
|
|
9751
10107
|
try {
|
|
9752
|
-
const stat = await fs6.stat(
|
|
9753
|
-
return stat.isFile() ? await readJSON(
|
|
10108
|
+
const stat = await fs6.stat(path4);
|
|
10109
|
+
return stat.isFile() ? await readJSON(path4) : missingValue;
|
|
9754
10110
|
} catch (e) {
|
|
9755
10111
|
return missingValue;
|
|
9756
10112
|
}
|
|
@@ -9779,12 +10135,11 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
9779
10135
|
let isOutside = false;
|
|
9780
10136
|
let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
|
|
9781
10137
|
const localPackages = await tryReadJSON(join4(process.cwd(), "package.json"));
|
|
9782
|
-
if (!localPackages)
|
|
9783
|
-
return;
|
|
10138
|
+
if (!localPackages) return;
|
|
9784
10139
|
let firstVersion;
|
|
9785
10140
|
const allDependencies = {
|
|
9786
|
-
...
|
|
9787
|
-
...
|
|
10141
|
+
...localPackages?.dependencies ?? {},
|
|
10142
|
+
...localPackages?.devDependencies ?? {}
|
|
9788
10143
|
};
|
|
9789
10144
|
for (const [p, version] of Object.entries(allDependencies)) {
|
|
9790
10145
|
if (uniformStrictVersions.includes(p)) {
|
|
@@ -9800,8 +10155,7 @@ First found was: v${firstVersion}`;
|
|
|
9800
10155
|
}
|
|
9801
10156
|
}
|
|
9802
10157
|
}
|
|
9803
|
-
if (isOutside)
|
|
9804
|
-
logCallout(warning);
|
|
10158
|
+
if (isOutside) logCallout(warning);
|
|
9805
10159
|
} catch (e) {
|
|
9806
10160
|
if (args.verbose) {
|
|
9807
10161
|
console.warn(`There was an error validating the local project dependencies`, e);
|
|
@@ -9811,7 +10165,7 @@ First found was: v${firstVersion}`;
|
|
|
9811
10165
|
|
|
9812
10166
|
// src/index.ts
|
|
9813
10167
|
dotenv.config();
|
|
9814
|
-
var yarggery =
|
|
10168
|
+
var yarggery = yargs35(hideBin(process.argv));
|
|
9815
10169
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
9816
10170
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
9817
10171
|
yarggery.option("verbose", {
|