@uniformdev/cli 19.210.0 → 19.210.1-alpha.7
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-KAJUBJZI.mjs → chunk-3T7NQ5TX.mjs} +7 -2
- package/dist/defaultConfig.mjs +1 -1
- package/dist/index.mjs +572 -435
- package/package.json +9 -10
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
withFormatOptions,
|
|
17
17
|
withProjectOptions,
|
|
18
18
|
withTeamOptions
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3T7NQ5TX.mjs";
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
import * as dotenv from "dotenv";
|
|
@@ -29,9 +29,6 @@ import yargs18 from "yargs";
|
|
|
29
29
|
// src/commands/canvas/commands/asset.ts
|
|
30
30
|
import yargs from "yargs";
|
|
31
31
|
|
|
32
|
-
// src/commands/canvas/commands/asset/get.ts
|
|
33
|
-
import { UncachedAssetClient } from "@uniformdev/assets";
|
|
34
|
-
|
|
35
32
|
// src/sync/arraySyncEngineDataSource.ts
|
|
36
33
|
async function createArraySyncEngineDataSource({
|
|
37
34
|
name,
|
|
@@ -188,7 +185,7 @@ async function createFileSyncEngineDataSource({
|
|
|
188
185
|
for (const filename of filenames) {
|
|
189
186
|
const fullFilename = join(directory, filename);
|
|
190
187
|
try {
|
|
191
|
-
const contents =
|
|
188
|
+
const contents = readFileToObject(fullFilename);
|
|
192
189
|
const displayName = selectDisplayName16(contents);
|
|
193
190
|
const object = {
|
|
194
191
|
id: selectIdentifier16(contents),
|
|
@@ -251,27 +248,76 @@ function writeUniformPackage(filename, packageContents) {
|
|
|
251
248
|
|
|
252
249
|
// src/sync/syncEngine.ts
|
|
253
250
|
import { diffJson, diffLines } from "diff";
|
|
254
|
-
import
|
|
251
|
+
import mitt from "mitt";
|
|
252
|
+
|
|
253
|
+
// src/sync/serializedDequal.ts
|
|
254
|
+
var has = Object.prototype.hasOwnProperty;
|
|
255
|
+
var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated"]);
|
|
256
|
+
function serializedDequal(foo, bar) {
|
|
257
|
+
let ctor, len;
|
|
258
|
+
if (foo === bar) {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
|
|
262
|
+
if (ctor === Date) {
|
|
263
|
+
return foo.getTime() === bar.getTime();
|
|
264
|
+
}
|
|
265
|
+
if (ctor === RegExp) {
|
|
266
|
+
return foo.toString() === bar.toString();
|
|
267
|
+
}
|
|
268
|
+
if (ctor === Array) {
|
|
269
|
+
const fooArray = foo;
|
|
270
|
+
const barArray = bar;
|
|
271
|
+
if (fooArray.length === barArray.length) {
|
|
272
|
+
for (let i = 0; i < fooArray.length; i++) {
|
|
273
|
+
if (!serializedDequal(fooArray[i], barArray[i])) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
if (!ctor || typeof foo === "object") {
|
|
282
|
+
const fooObject = foo;
|
|
283
|
+
const barObject = bar;
|
|
284
|
+
len = 0;
|
|
285
|
+
for (const ctor2 in fooObject) {
|
|
286
|
+
const isIgnored = ignoredProperties.has(ctor2);
|
|
287
|
+
if (
|
|
288
|
+
// custom property name skips
|
|
289
|
+
!isIgnored && has.call(fooObject, ctor2) && ++len && !has.call(barObject, ctor2)
|
|
290
|
+
) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
if (!isIgnored && (!(ctor2 in barObject) || !serializedDequal(fooObject[ctor2], barObject[ctor2]))) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const areKeysEqual = Object.keys(barObject).filter((key) => !ignoredProperties.has(key)).length === len;
|
|
298
|
+
return areKeysEqual;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return foo !== foo && bar !== bar;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/sync/syncEngine.ts
|
|
305
|
+
var syncEngineEvents = mitt();
|
|
255
306
|
async function syncEngine({
|
|
256
307
|
source,
|
|
257
308
|
target,
|
|
258
|
-
compareContents = (
|
|
259
|
-
return isEqualWith(
|
|
260
|
-
source2.object,
|
|
261
|
-
target2.object,
|
|
262
|
-
(_a, _b, key) => key === "created" || key === "modified" || key === "updated" ? true : void 0
|
|
263
|
-
);
|
|
264
|
-
},
|
|
309
|
+
compareContents = (foo, bar) => serializedDequal(foo.object, bar.object),
|
|
265
310
|
mode,
|
|
266
311
|
allowEmptySource = false,
|
|
267
312
|
whatIf = false,
|
|
268
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
269
313
|
log: log2 = () => {
|
|
270
314
|
},
|
|
271
315
|
onBeforeCompareObjects,
|
|
272
316
|
onBeforeWriteObject,
|
|
273
317
|
onError
|
|
318
|
+
//verbose = false,
|
|
274
319
|
}) {
|
|
320
|
+
const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
|
|
275
321
|
const targetItems = /* @__PURE__ */ new Map();
|
|
276
322
|
const deleteTracker = /* @__PURE__ */ new Set();
|
|
277
323
|
const processDelete = async (object) => {
|
|
@@ -280,6 +326,7 @@ async function syncEngine({
|
|
|
280
326
|
try {
|
|
281
327
|
if (!whatIf) {
|
|
282
328
|
await target.deleteObject(object.providerId, object);
|
|
329
|
+
status.changesApplied++;
|
|
283
330
|
}
|
|
284
331
|
} catch (e) {
|
|
285
332
|
if (onError) {
|
|
@@ -294,11 +341,12 @@ async function syncEngine({
|
|
|
294
341
|
providerId: object.providerId,
|
|
295
342
|
displayName: object.displayName ?? object.providerId,
|
|
296
343
|
whatIf,
|
|
297
|
-
diff: diffLines(JSON.stringify(object.object, null, 2), "")
|
|
344
|
+
diff: () => diffLines(JSON.stringify(object.object, null, 2), "")
|
|
298
345
|
});
|
|
299
346
|
}
|
|
300
347
|
};
|
|
301
348
|
for await (const obj of target.objects) {
|
|
349
|
+
status.fetched++;
|
|
302
350
|
if (Array.isArray(obj.id)) {
|
|
303
351
|
obj.id.forEach((o) => targetItems.set(o, obj));
|
|
304
352
|
} else {
|
|
@@ -311,16 +359,20 @@ async function syncEngine({
|
|
|
311
359
|
sourceHasItems = true;
|
|
312
360
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
313
361
|
const targetObject = targetItems.get(ids[0]);
|
|
362
|
+
status.compared++;
|
|
314
363
|
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o?.object !== targetObject?.object);
|
|
315
|
-
if (targetObject && invalidTargetObjects.length
|
|
364
|
+
if (targetObject && invalidTargetObjects.length === 0) {
|
|
316
365
|
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
317
|
-
|
|
366
|
+
const compareResult = compareContents(sourceObject, targetObject);
|
|
367
|
+
if (!compareResult) {
|
|
318
368
|
if (mode === "createOrUpdate" || mode === "mirror") {
|
|
369
|
+
status.changeCount++;
|
|
319
370
|
const process2 = async (sourceObject2, targetObject2) => {
|
|
320
371
|
try {
|
|
321
372
|
if (!whatIf) {
|
|
322
373
|
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
323
374
|
await target.writeObject(finalSourceObject, targetObject2);
|
|
375
|
+
status.changesApplied++;
|
|
324
376
|
}
|
|
325
377
|
} catch (e) {
|
|
326
378
|
if (onError) {
|
|
@@ -335,7 +387,7 @@ async function syncEngine({
|
|
|
335
387
|
providerId: sourceObject2.providerId,
|
|
336
388
|
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
337
389
|
whatIf,
|
|
338
|
-
diff: diffJson(targetObject2.object, sourceObject2.object)
|
|
390
|
+
diff: () => diffJson(targetObject2.object, sourceObject2.object)
|
|
339
391
|
});
|
|
340
392
|
}
|
|
341
393
|
};
|
|
@@ -344,11 +396,13 @@ async function syncEngine({
|
|
|
344
396
|
}
|
|
345
397
|
ids.forEach((i) => targetItems.delete(i));
|
|
346
398
|
} else {
|
|
347
|
-
|
|
399
|
+
status.changeCount++;
|
|
400
|
+
const processUpsert = async (sourceObject2, id) => {
|
|
348
401
|
try {
|
|
349
402
|
if (!whatIf) {
|
|
350
403
|
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
|
|
351
404
|
await target.writeObject(finalSourceObject);
|
|
405
|
+
status.changesApplied++;
|
|
352
406
|
}
|
|
353
407
|
} catch (e) {
|
|
354
408
|
if (onError) {
|
|
@@ -363,7 +417,7 @@ async function syncEngine({
|
|
|
363
417
|
providerId: id,
|
|
364
418
|
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
365
419
|
whatIf,
|
|
366
|
-
diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
|
|
420
|
+
diff: () => diffLines("", JSON.stringify(sourceObject2.object, null, 2))
|
|
367
421
|
});
|
|
368
422
|
}
|
|
369
423
|
};
|
|
@@ -371,18 +425,19 @@ async function syncEngine({
|
|
|
371
425
|
[...invalidTargetObjects, targetObject].forEach((o) => {
|
|
372
426
|
(Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
|
|
373
427
|
});
|
|
374
|
-
const deletes = invalidTargetObjects.filter((
|
|
375
|
-
return () => processDelete(io);
|
|
376
|
-
});
|
|
428
|
+
const deletes = invalidTargetObjects.filter((invalidTargetObject) => typeof invalidTargetObject !== "undefined").map((invalidTargetObject) => () => processDelete(invalidTargetObject));
|
|
377
429
|
if (targetObject) {
|
|
378
430
|
deletes.push(() => processDelete(targetObject));
|
|
379
431
|
}
|
|
380
|
-
actions.push(
|
|
432
|
+
actions.push(
|
|
433
|
+
() => Promise.all(deletes.map((deleteFn) => deleteFn())).then(() => processUpsert(sourceObject, ids[0]))
|
|
434
|
+
);
|
|
381
435
|
} else {
|
|
382
|
-
actions.push(() =>
|
|
436
|
+
actions.push(() => processUpsert(sourceObject, ids[0]));
|
|
383
437
|
}
|
|
384
438
|
}
|
|
385
439
|
}
|
|
440
|
+
status.compared += targetItems.size;
|
|
386
441
|
if (mode === "mirror") {
|
|
387
442
|
if (!sourceHasItems && !allowEmptySource && targetItems.size > 0) {
|
|
388
443
|
throw new Error(
|
|
@@ -408,6 +463,51 @@ ${innerError}`
|
|
|
408
463
|
Object.setPrototypeOf(this, _SyncEngineError.prototype);
|
|
409
464
|
}
|
|
410
465
|
};
|
|
466
|
+
var ReactiveStatusUpdate = class {
|
|
467
|
+
constructor(onChange) {
|
|
468
|
+
this._fetched = 0;
|
|
469
|
+
this._compared = 0;
|
|
470
|
+
this._changeCount = 0;
|
|
471
|
+
this._changesApplied = 0;
|
|
472
|
+
this.onChange = onChange;
|
|
473
|
+
}
|
|
474
|
+
emitChange() {
|
|
475
|
+
this.onChange?.({
|
|
476
|
+
fetched: this._fetched,
|
|
477
|
+
compared: this._compared,
|
|
478
|
+
changeCount: this._changeCount,
|
|
479
|
+
changesApplied: this._changesApplied
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
get fetched() {
|
|
483
|
+
return this._fetched;
|
|
484
|
+
}
|
|
485
|
+
set fetched(value) {
|
|
486
|
+
this._fetched = value;
|
|
487
|
+
this.emitChange();
|
|
488
|
+
}
|
|
489
|
+
get compared() {
|
|
490
|
+
return this._compared;
|
|
491
|
+
}
|
|
492
|
+
set compared(value) {
|
|
493
|
+
this._compared = value;
|
|
494
|
+
this.emitChange();
|
|
495
|
+
}
|
|
496
|
+
get changeCount() {
|
|
497
|
+
return this._changeCount;
|
|
498
|
+
}
|
|
499
|
+
set changeCount(value) {
|
|
500
|
+
this._changeCount = value;
|
|
501
|
+
this.emitChange();
|
|
502
|
+
}
|
|
503
|
+
get changesApplied() {
|
|
504
|
+
return this._changesApplied;
|
|
505
|
+
}
|
|
506
|
+
set changesApplied(value) {
|
|
507
|
+
this._changesApplied = value;
|
|
508
|
+
this.emitChange();
|
|
509
|
+
}
|
|
510
|
+
};
|
|
411
511
|
|
|
412
512
|
// src/sync/syncEngineConsoleLogger.ts
|
|
413
513
|
import { gray, green, red as red2, white, yellow } from "colorette";
|
|
@@ -428,7 +528,8 @@ function createSyncEngineConsoleLogger(options) {
|
|
|
428
528
|
}
|
|
429
529
|
let diffString = "";
|
|
430
530
|
if (diffMode === "on" || diffMode === "update" && action === "update") {
|
|
431
|
-
|
|
531
|
+
const diffResult = diff();
|
|
532
|
+
diffString = "\n" + diffResult.map((change) => {
|
|
432
533
|
if (change.added) {
|
|
433
534
|
return green(change.value);
|
|
434
535
|
}
|
|
@@ -451,6 +552,29 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
451
552
|
};
|
|
452
553
|
}
|
|
453
554
|
|
|
555
|
+
// src/commands/canvas/commands/asset/_util.ts
|
|
556
|
+
import { UncachedAssetClient } from "@uniformdev/assets";
|
|
557
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
558
|
+
|
|
559
|
+
// src/cliLimitPolicy.ts
|
|
560
|
+
import { createLimitPolicy } from "@uniformdev/canvas";
|
|
561
|
+
var limit = process.env.UNIFORM_CLI_CONCURRENCY_LIMIT ? parseInt(process.env.UNIFORM_CLI_CONCURRENCY_LIMIT) : 10;
|
|
562
|
+
var cliLimitPolicy = createLimitPolicy({
|
|
563
|
+
throttle: { interval: 1e3, limit: 10 },
|
|
564
|
+
retry: { retries: 3, factor: 2 },
|
|
565
|
+
limit
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// src/commands/canvas/commands/asset/_util.ts
|
|
569
|
+
var selectAssetIdentifier = (e) => e.asset._id;
|
|
570
|
+
var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
571
|
+
function getAssetClient(options) {
|
|
572
|
+
return new UncachedAssetClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
573
|
+
}
|
|
574
|
+
function getFileClient(options) {
|
|
575
|
+
return new UncachedFileClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
576
|
+
}
|
|
577
|
+
|
|
454
578
|
// src/commands/canvas/commands/asset/get.ts
|
|
455
579
|
var AssetGetModule = {
|
|
456
580
|
command: "get <id>",
|
|
@@ -460,7 +584,6 @@ var AssetGetModule = {
|
|
|
460
584
|
withFormatOptions(
|
|
461
585
|
withApiOptions(
|
|
462
586
|
withProjectOptions(
|
|
463
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
464
587
|
yargs38.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
465
588
|
)
|
|
466
589
|
)
|
|
@@ -469,7 +592,7 @@ var AssetGetModule = {
|
|
|
469
592
|
),
|
|
470
593
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
|
|
471
594
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
472
|
-
const client =
|
|
595
|
+
const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
473
596
|
const res = await client.get({ offset: 0, limit: 1, assetId: id });
|
|
474
597
|
if (!res) {
|
|
475
598
|
throw new Error(`Asset with ID ${id} not found`);
|
|
@@ -479,23 +602,18 @@ var AssetGetModule = {
|
|
|
479
602
|
};
|
|
480
603
|
|
|
481
604
|
// src/commands/canvas/commands/asset/list.ts
|
|
482
|
-
import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets";
|
|
483
605
|
var AssetListModule = {
|
|
484
606
|
command: "list",
|
|
485
607
|
describe: "List assets",
|
|
486
608
|
builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
|
|
487
609
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
488
610
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
489
|
-
const client =
|
|
611
|
+
const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
490
612
|
const res = await client.get({ offset: 0, limit: 1e3 });
|
|
491
613
|
emitWithFormat(res.assets, format, filename);
|
|
492
614
|
}
|
|
493
615
|
};
|
|
494
616
|
|
|
495
|
-
// src/commands/canvas/commands/asset/pull.ts
|
|
496
|
-
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
497
|
-
import { UncachedFileClient } from "@uniformdev/files";
|
|
498
|
-
|
|
499
617
|
// src/files/index.ts
|
|
500
618
|
import { preferredType } from "@thi.ng/mime";
|
|
501
619
|
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
@@ -833,10 +951,6 @@ var legacyUrlToFileName = (url) => {
|
|
|
833
951
|
// src/commands/canvas/assetEngineDataSource.ts
|
|
834
952
|
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
835
953
|
|
|
836
|
-
// src/commands/canvas/commands/asset/_util.ts
|
|
837
|
-
var selectAssetIdentifier = (e) => e.asset._id;
|
|
838
|
-
var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
839
|
-
|
|
840
954
|
// src/commands/canvas/util.ts
|
|
841
955
|
import {
|
|
842
956
|
CANVAS_DRAFT_STATE,
|
|
@@ -879,16 +993,16 @@ function createAssetEngineDataSource({
|
|
|
879
993
|
}) {
|
|
880
994
|
async function* getObjects() {
|
|
881
995
|
const assets = paginateAsync(
|
|
882
|
-
async (offset,
|
|
996
|
+
async (offset, limit2) => {
|
|
883
997
|
if (verbose) {
|
|
884
|
-
console.log(`Fetching all assets from offset ${offset} with limit ${
|
|
998
|
+
console.log(`Fetching all assets from offset ${offset} with limit ${limit2}`);
|
|
885
999
|
}
|
|
886
1000
|
return (await client.get({
|
|
887
|
-
limit,
|
|
1001
|
+
limit: limit2,
|
|
888
1002
|
offset
|
|
889
1003
|
})).assets;
|
|
890
1004
|
},
|
|
891
|
-
{ pageSize:
|
|
1005
|
+
{ pageSize: 50 }
|
|
892
1006
|
);
|
|
893
1007
|
for await (const e of assets) {
|
|
894
1008
|
const result = {
|
|
@@ -973,13 +1087,13 @@ var AssetPullModule = {
|
|
|
973
1087
|
allowEmptySource
|
|
974
1088
|
}) => {
|
|
975
1089
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
976
|
-
const client =
|
|
1090
|
+
const client = getAssetClient({
|
|
977
1091
|
apiKey,
|
|
978
1092
|
apiHost,
|
|
979
1093
|
fetch: fetch3,
|
|
980
1094
|
projectId
|
|
981
1095
|
});
|
|
982
|
-
const fileClient =
|
|
1096
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
983
1097
|
const source = createAssetEngineDataSource({ client, verbose });
|
|
984
1098
|
let target;
|
|
985
1099
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1049,8 +1163,6 @@ var AssetPullModule = {
|
|
|
1049
1163
|
};
|
|
1050
1164
|
|
|
1051
1165
|
// src/commands/canvas/commands/asset/push.ts
|
|
1052
|
-
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1053
|
-
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1054
1166
|
var AssetPushModule = {
|
|
1055
1167
|
command: "push <directory>",
|
|
1056
1168
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
@@ -1087,7 +1199,7 @@ var AssetPushModule = {
|
|
|
1087
1199
|
verbose
|
|
1088
1200
|
}) => {
|
|
1089
1201
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1090
|
-
const client =
|
|
1202
|
+
const client = getAssetClient({
|
|
1091
1203
|
apiKey,
|
|
1092
1204
|
apiHost,
|
|
1093
1205
|
fetch: fetch3,
|
|
@@ -1112,7 +1224,7 @@ var AssetPushModule = {
|
|
|
1112
1224
|
});
|
|
1113
1225
|
}
|
|
1114
1226
|
const target = createAssetEngineDataSource({ client, verbose });
|
|
1115
|
-
const fileClient =
|
|
1227
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1116
1228
|
await syncEngine({
|
|
1117
1229
|
source,
|
|
1118
1230
|
target,
|
|
@@ -1152,9 +1264,6 @@ var AssetPushModule = {
|
|
|
1152
1264
|
}
|
|
1153
1265
|
};
|
|
1154
1266
|
|
|
1155
|
-
// src/commands/canvas/commands/asset/remove.ts
|
|
1156
|
-
import { UncachedAssetClient as UncachedAssetClient5 } from "@uniformdev/assets";
|
|
1157
|
-
|
|
1158
1267
|
// src/log.ts
|
|
1159
1268
|
import { reset } from "colorette";
|
|
1160
1269
|
function fillString(char, length) {
|
|
@@ -1179,7 +1288,7 @@ var whatIfSimpleLog = ({
|
|
|
1179
1288
|
id,
|
|
1180
1289
|
displayName,
|
|
1181
1290
|
action
|
|
1182
|
-
}) => log({ id, displayName, action, whatIf: true, providerId: "none", diff: [] });
|
|
1291
|
+
}) => log({ id, displayName, action, whatIf: true, providerId: "none", diff: () => [] });
|
|
1183
1292
|
|
|
1184
1293
|
// src/commands/canvas/commands/asset/remove.ts
|
|
1185
1294
|
var AssetRemoveModule = {
|
|
@@ -1195,7 +1304,7 @@ var AssetRemoveModule = {
|
|
|
1195
1304
|
),
|
|
1196
1305
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
1197
1306
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1198
|
-
const client =
|
|
1307
|
+
const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1199
1308
|
if (!whatIf) {
|
|
1200
1309
|
await client.delete({ assetId: id });
|
|
1201
1310
|
} else {
|
|
@@ -1205,7 +1314,7 @@ var AssetRemoveModule = {
|
|
|
1205
1314
|
};
|
|
1206
1315
|
|
|
1207
1316
|
// src/commands/canvas/commands/asset/update.ts
|
|
1208
|
-
import { convertAssetToPutAsset as convertAssetToPutAsset2
|
|
1317
|
+
import { convertAssetToPutAsset as convertAssetToPutAsset2 } from "@uniformdev/assets";
|
|
1209
1318
|
var AssetUpdateModule = {
|
|
1210
1319
|
command: "update <filename>",
|
|
1211
1320
|
aliases: ["put"],
|
|
@@ -1221,7 +1330,7 @@ var AssetUpdateModule = {
|
|
|
1221
1330
|
),
|
|
1222
1331
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
|
|
1223
1332
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1224
|
-
const client =
|
|
1333
|
+
const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1225
1334
|
const file = readFileToObject(filename);
|
|
1226
1335
|
const putAsset = convertAssetToPutAsset2(file);
|
|
1227
1336
|
if (!whatIf) {
|
|
@@ -1249,8 +1358,15 @@ var AssetModule = {
|
|
|
1249
1358
|
// src/commands/canvas/commands/category.ts
|
|
1250
1359
|
import yargs2 from "yargs";
|
|
1251
1360
|
|
|
1252
|
-
// src/commands/canvas/commands/category/
|
|
1361
|
+
// src/commands/canvas/commands/category/_util.ts
|
|
1253
1362
|
import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
1363
|
+
var selectIdentifier = (category) => category.id;
|
|
1364
|
+
var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
|
|
1365
|
+
function getCategoryClient(options) {
|
|
1366
|
+
return new UncachedCategoryClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
// src/commands/canvas/commands/category/get.ts
|
|
1254
1370
|
var CategoryGetModule = {
|
|
1255
1371
|
command: "get <id>",
|
|
1256
1372
|
describe: "Fetch a category",
|
|
@@ -1267,7 +1383,7 @@ var CategoryGetModule = {
|
|
|
1267
1383
|
),
|
|
1268
1384
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
|
|
1269
1385
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1270
|
-
const client =
|
|
1386
|
+
const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1271
1387
|
const res = await client.getCategories();
|
|
1272
1388
|
const category = res.categories.find((c) => c.id === id);
|
|
1273
1389
|
if (!category) {
|
|
@@ -1280,7 +1396,6 @@ var CategoryGetModule = {
|
|
|
1280
1396
|
};
|
|
1281
1397
|
|
|
1282
1398
|
// src/commands/canvas/commands/category/list.ts
|
|
1283
|
-
import { UncachedCategoryClient as UncachedCategoryClient2 } from "@uniformdev/canvas";
|
|
1284
1399
|
var CategoryListModule = {
|
|
1285
1400
|
command: "list",
|
|
1286
1401
|
describe: "List categories",
|
|
@@ -1290,28 +1405,21 @@ var CategoryListModule = {
|
|
|
1290
1405
|
),
|
|
1291
1406
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
1292
1407
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1293
|
-
const client =
|
|
1408
|
+
const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1294
1409
|
const res = await client.getCategories();
|
|
1295
1410
|
emitWithFormat(res.categories, format, filename);
|
|
1296
1411
|
}
|
|
1297
1412
|
};
|
|
1298
1413
|
|
|
1299
|
-
// src/commands/canvas/commands/category/pull.ts
|
|
1300
|
-
import { UncachedCategoryClient as UncachedCategoryClient3 } from "@uniformdev/canvas";
|
|
1301
|
-
|
|
1302
|
-
// src/commands/canvas/commands/category/_util.ts
|
|
1303
|
-
var selectIdentifier = (category) => category.id;
|
|
1304
|
-
var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
|
|
1305
|
-
|
|
1306
1414
|
// src/commands/canvas/categoriesEngineDataSource.ts
|
|
1307
1415
|
function createCategoriesEngineDataSource({
|
|
1308
1416
|
client
|
|
1309
1417
|
}) {
|
|
1310
1418
|
async function* getObjects() {
|
|
1311
|
-
const
|
|
1419
|
+
const categories = paginateAsync(async () => (await client.getCategories()).categories, {
|
|
1312
1420
|
pageSize: 100
|
|
1313
1421
|
});
|
|
1314
|
-
for await (const def of
|
|
1422
|
+
for await (const def of categories) {
|
|
1315
1423
|
const result = {
|
|
1316
1424
|
id: selectIdentifier(def),
|
|
1317
1425
|
displayName: selectDisplayName(def),
|
|
@@ -1377,7 +1485,7 @@ var CategoryPullModule = {
|
|
|
1377
1485
|
verbose
|
|
1378
1486
|
}) => {
|
|
1379
1487
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1380
|
-
const client =
|
|
1488
|
+
const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1381
1489
|
const source = createCategoriesEngineDataSource({ client });
|
|
1382
1490
|
let target;
|
|
1383
1491
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1414,7 +1522,6 @@ var CategoryPullModule = {
|
|
|
1414
1522
|
};
|
|
1415
1523
|
|
|
1416
1524
|
// src/commands/canvas/commands/category/push.ts
|
|
1417
|
-
import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/canvas";
|
|
1418
1525
|
var CategoryPushModule = {
|
|
1419
1526
|
command: "push <directory>",
|
|
1420
1527
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
@@ -1451,7 +1558,7 @@ var CategoryPushModule = {
|
|
|
1451
1558
|
verbose
|
|
1452
1559
|
}) => {
|
|
1453
1560
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1454
|
-
const client =
|
|
1561
|
+
const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1455
1562
|
let source;
|
|
1456
1563
|
const isPackage = isPathAPackageFile(directory);
|
|
1457
1564
|
if (isPackage) {
|
|
@@ -1483,7 +1590,6 @@ var CategoryPushModule = {
|
|
|
1483
1590
|
};
|
|
1484
1591
|
|
|
1485
1592
|
// src/commands/canvas/commands/category/remove.ts
|
|
1486
|
-
import { UncachedCategoryClient as UncachedCategoryClient5 } from "@uniformdev/canvas";
|
|
1487
1593
|
var CategoryRemoveModule = {
|
|
1488
1594
|
command: "remove <id>",
|
|
1489
1595
|
aliases: ["delete", "rm"],
|
|
@@ -1499,7 +1605,7 @@ var CategoryRemoveModule = {
|
|
|
1499
1605
|
),
|
|
1500
1606
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
1501
1607
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1502
|
-
const client =
|
|
1608
|
+
const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1503
1609
|
if (!whatIf) {
|
|
1504
1610
|
await client.removeCategory({ categoryId: id });
|
|
1505
1611
|
} else {
|
|
@@ -1509,7 +1615,6 @@ var CategoryRemoveModule = {
|
|
|
1509
1615
|
};
|
|
1510
1616
|
|
|
1511
1617
|
// src/commands/canvas/commands/category/update.ts
|
|
1512
|
-
import { UncachedCategoryClient as UncachedCategoryClient6 } from "@uniformdev/canvas";
|
|
1513
1618
|
var CategoryUpdateModule = {
|
|
1514
1619
|
command: "update <filename>",
|
|
1515
1620
|
aliases: ["put"],
|
|
@@ -1525,7 +1630,7 @@ var CategoryUpdateModule = {
|
|
|
1525
1630
|
),
|
|
1526
1631
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
|
|
1527
1632
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1528
|
-
const client =
|
|
1633
|
+
const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1529
1634
|
const file = readFileToObject(filename);
|
|
1530
1635
|
if (!whatIf) {
|
|
1531
1636
|
await client.upsertCategories([file]);
|
|
@@ -1549,13 +1654,14 @@ var CategoryModule = {
|
|
|
1549
1654
|
// src/commands/canvas/commands/component.ts
|
|
1550
1655
|
import yargs3 from "yargs";
|
|
1551
1656
|
|
|
1552
|
-
// src/commands/canvas/commands/component/get.ts
|
|
1553
|
-
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
1554
|
-
|
|
1555
1657
|
// src/commands/canvas/commands/component/_util.ts
|
|
1658
|
+
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
1556
1659
|
var selectIdentifier2 = (component) => component.id;
|
|
1557
1660
|
var selectDisplayName2 = (component) => `${component.name} (pid: ${component.id})`;
|
|
1558
1661
|
var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
1662
|
+
function getCanvasClient(options) {
|
|
1663
|
+
return new UncachedCanvasClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
1664
|
+
}
|
|
1559
1665
|
|
|
1560
1666
|
// src/commands/canvas/commands/component/get.ts
|
|
1561
1667
|
var ComponentGetModule = {
|
|
@@ -1577,7 +1683,7 @@ var ComponentGetModule = {
|
|
|
1577
1683
|
),
|
|
1578
1684
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
|
|
1579
1685
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1580
|
-
const client =
|
|
1686
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1581
1687
|
const res = await client.getComponentDefinitions({ componentId: id, limit: 1 });
|
|
1582
1688
|
if (res.componentDefinitions.length === 0) {
|
|
1583
1689
|
console.error("Component did not exist");
|
|
@@ -1596,7 +1702,6 @@ var ComponentGetModule = {
|
|
|
1596
1702
|
};
|
|
1597
1703
|
|
|
1598
1704
|
// src/commands/canvas/commands/component/list.ts
|
|
1599
|
-
import { UncachedCanvasClient as UncachedCanvasClient2 } from "@uniformdev/canvas";
|
|
1600
1705
|
var ComponentListModule = {
|
|
1601
1706
|
command: "list",
|
|
1602
1707
|
describe: "List component definitions",
|
|
@@ -1619,7 +1724,7 @@ var ComponentListModule = {
|
|
|
1619
1724
|
apiHost,
|
|
1620
1725
|
apiKey,
|
|
1621
1726
|
proxy,
|
|
1622
|
-
limit,
|
|
1727
|
+
limit: limit2,
|
|
1623
1728
|
offset,
|
|
1624
1729
|
format,
|
|
1625
1730
|
filename,
|
|
@@ -1627,23 +1732,20 @@ var ComponentListModule = {
|
|
|
1627
1732
|
verbose
|
|
1628
1733
|
}) => {
|
|
1629
1734
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1630
|
-
const client =
|
|
1631
|
-
const res = await client.getComponentDefinitions({ limit, offset });
|
|
1735
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1736
|
+
const res = await client.getComponentDefinitions({ limit: limit2, offset });
|
|
1632
1737
|
emitWithFormat(res.componentDefinitions, format, filename);
|
|
1633
1738
|
}
|
|
1634
1739
|
};
|
|
1635
1740
|
|
|
1636
|
-
// src/commands/canvas/commands/component/pull.ts
|
|
1637
|
-
import { UncachedCanvasClient as UncachedCanvasClient3 } from "@uniformdev/canvas";
|
|
1638
|
-
|
|
1639
1741
|
// src/commands/canvas/componentDefinitionEngineDataSource.ts
|
|
1640
1742
|
function createComponentDefinitionEngineDataSource({
|
|
1641
1743
|
client
|
|
1642
1744
|
}) {
|
|
1643
1745
|
async function* getObjects() {
|
|
1644
1746
|
const componentDefinitions = paginateAsync(
|
|
1645
|
-
async (offset,
|
|
1646
|
-
{ pageSize:
|
|
1747
|
+
async (offset, limit2) => (await client.getComponentDefinitions({ limit: limit2, offset })).componentDefinitions,
|
|
1748
|
+
{ pageSize: 200 }
|
|
1647
1749
|
);
|
|
1648
1750
|
for await (const def of componentDefinitions) {
|
|
1649
1751
|
const result = {
|
|
@@ -1713,7 +1815,7 @@ var ComponentPullModule = {
|
|
|
1713
1815
|
verbose
|
|
1714
1816
|
}) => {
|
|
1715
1817
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1716
|
-
const client =
|
|
1818
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1717
1819
|
const source = createComponentDefinitionEngineDataSource({ client });
|
|
1718
1820
|
let target;
|
|
1719
1821
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1751,7 +1853,6 @@ var ComponentPullModule = {
|
|
|
1751
1853
|
};
|
|
1752
1854
|
|
|
1753
1855
|
// src/commands/canvas/commands/component/push.ts
|
|
1754
|
-
import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canvas";
|
|
1755
1856
|
var ComponentPushModule = {
|
|
1756
1857
|
command: "push <directory>",
|
|
1757
1858
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
@@ -1788,7 +1889,7 @@ var ComponentPushModule = {
|
|
|
1788
1889
|
verbose
|
|
1789
1890
|
}) => {
|
|
1790
1891
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1791
|
-
const client =
|
|
1892
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1792
1893
|
let source;
|
|
1793
1894
|
const isPackage = isPathAPackageFile(directory);
|
|
1794
1895
|
if (isPackage) {
|
|
@@ -1821,7 +1922,6 @@ var ComponentPushModule = {
|
|
|
1821
1922
|
};
|
|
1822
1923
|
|
|
1823
1924
|
// src/commands/canvas/commands/component/remove.ts
|
|
1824
|
-
import { UncachedCanvasClient as UncachedCanvasClient5 } from "@uniformdev/canvas";
|
|
1825
1925
|
var ComponentRemoveModule = {
|
|
1826
1926
|
command: "remove <id>",
|
|
1827
1927
|
aliases: ["delete", "rm"],
|
|
@@ -1840,7 +1940,7 @@ var ComponentRemoveModule = {
|
|
|
1840
1940
|
),
|
|
1841
1941
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
1842
1942
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1843
|
-
const client =
|
|
1943
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1844
1944
|
if (!whatIf) {
|
|
1845
1945
|
await client.removeComponentDefinition({ componentId: id });
|
|
1846
1946
|
} else {
|
|
@@ -1850,7 +1950,6 @@ var ComponentRemoveModule = {
|
|
|
1850
1950
|
};
|
|
1851
1951
|
|
|
1852
1952
|
// src/commands/canvas/commands/component/update.ts
|
|
1853
|
-
import { UncachedCanvasClient as UncachedCanvasClient6 } from "@uniformdev/canvas";
|
|
1854
1953
|
var ComponentUpdateModule = {
|
|
1855
1954
|
command: "update <filename>",
|
|
1856
1955
|
aliases: ["put"],
|
|
@@ -1866,10 +1965,10 @@ var ComponentUpdateModule = {
|
|
|
1866
1965
|
),
|
|
1867
1966
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
|
|
1868
1967
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1869
|
-
const client =
|
|
1968
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1870
1969
|
const file = readFileToObject(filename);
|
|
1871
1970
|
if (!whatIf) {
|
|
1872
|
-
await client.updateComponentDefinition({ componentDefinition: file });
|
|
1971
|
+
await client.updateComponentDefinition({ componentDefinition: omit(file, ["$schema"]) });
|
|
1873
1972
|
} else {
|
|
1874
1973
|
whatIfSimpleLog({ id: file.id, displayName: `Component: ${file.name}`, action: "update" });
|
|
1875
1974
|
}
|
|
@@ -1891,7 +1990,6 @@ var ComponentModule = {
|
|
|
1891
1990
|
import yargs4 from "yargs";
|
|
1892
1991
|
|
|
1893
1992
|
// src/commands/canvas/commands/composition/get.ts
|
|
1894
|
-
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1895
1993
|
var CompositionGetModule = {
|
|
1896
1994
|
command: "get <id>",
|
|
1897
1995
|
describe: "Fetch a composition",
|
|
@@ -1974,7 +2072,7 @@ var CompositionGetModule = {
|
|
|
1974
2072
|
console.log(`\u{1F41B} get composition:`, parameters);
|
|
1975
2073
|
}
|
|
1976
2074
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
1977
|
-
const client =
|
|
2075
|
+
const client = getCanvasClient({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
|
|
1978
2076
|
const res = prepCompositionForDisk(await client.getCompositionById(parameters));
|
|
1979
2077
|
emitWithFormat(res, format, filename);
|
|
1980
2078
|
}
|
|
@@ -1987,7 +2085,6 @@ var ComponentPatternGetModule = {
|
|
|
1987
2085
|
};
|
|
1988
2086
|
|
|
1989
2087
|
// src/commands/canvas/commands/composition/list.ts
|
|
1990
|
-
import { UncachedCanvasClient as UncachedCanvasClient8 } from "@uniformdev/canvas";
|
|
1991
2088
|
var CompositionListModule = {
|
|
1992
2089
|
command: "list",
|
|
1993
2090
|
describe: "List compositions",
|
|
@@ -2039,7 +2136,7 @@ var CompositionListModule = {
|
|
|
2039
2136
|
apiHost,
|
|
2040
2137
|
apiKey,
|
|
2041
2138
|
proxy,
|
|
2042
|
-
limit,
|
|
2139
|
+
limit: limit2,
|
|
2043
2140
|
offset,
|
|
2044
2141
|
search,
|
|
2045
2142
|
format,
|
|
@@ -2055,7 +2152,7 @@ var CompositionListModule = {
|
|
|
2055
2152
|
verbose
|
|
2056
2153
|
}) => {
|
|
2057
2154
|
const parameters = {
|
|
2058
|
-
limit,
|
|
2155
|
+
limit: limit2,
|
|
2059
2156
|
offset,
|
|
2060
2157
|
search: search && search.length > 0 ? search : void 0,
|
|
2061
2158
|
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
@@ -2069,7 +2166,7 @@ var CompositionListModule = {
|
|
|
2069
2166
|
console.log(`\u{1F41B} list compositions:`, parameters);
|
|
2070
2167
|
}
|
|
2071
2168
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2072
|
-
const client =
|
|
2169
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2073
2170
|
const res = await client.getCompositionList(parameters);
|
|
2074
2171
|
emitWithFormat(res.compositions, format, filename);
|
|
2075
2172
|
}
|
|
@@ -2125,9 +2222,6 @@ var ComponentPatternListModule = {
|
|
|
2125
2222
|
)
|
|
2126
2223
|
};
|
|
2127
2224
|
|
|
2128
|
-
// src/commands/canvas/commands/composition/publish.ts
|
|
2129
|
-
import { UncachedCanvasClient as UncachedCanvasClient9 } from "@uniformdev/canvas";
|
|
2130
|
-
|
|
2131
2225
|
// src/commands/canvas/commands/composition/_util.ts
|
|
2132
2226
|
var selectIdentifier3 = (response) => {
|
|
2133
2227
|
let baseId = response.composition._id;
|
|
@@ -2159,10 +2253,10 @@ function createComponentInstanceEngineDataSource({
|
|
|
2159
2253
|
const stateId = convertStateOption(state);
|
|
2160
2254
|
async function* getObjects() {
|
|
2161
2255
|
const componentInstances = paginateAsync(
|
|
2162
|
-
async (offset,
|
|
2256
|
+
async (offset, limit2) => {
|
|
2163
2257
|
const parameters = {
|
|
2164
2258
|
...clientOptions,
|
|
2165
|
-
limit,
|
|
2259
|
+
limit: limit2,
|
|
2166
2260
|
offset,
|
|
2167
2261
|
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
2168
2262
|
state: stateId,
|
|
@@ -2258,7 +2352,7 @@ var CompositionPublishModule = {
|
|
|
2258
2352
|
}
|
|
2259
2353
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
2260
2354
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2261
|
-
const client =
|
|
2355
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2262
2356
|
const source = createComponentInstanceEngineDataSource({
|
|
2263
2357
|
client,
|
|
2264
2358
|
state: "preview",
|
|
@@ -2333,8 +2427,6 @@ var ComponentPatternPublishModule = {
|
|
|
2333
2427
|
};
|
|
2334
2428
|
|
|
2335
2429
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2336
|
-
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
2337
|
-
import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
2338
2430
|
var CompositionPullModule = {
|
|
2339
2431
|
command: "pull <directory>",
|
|
2340
2432
|
describe: "Pulls all compositions to local files in a directory",
|
|
@@ -2393,8 +2485,8 @@ var CompositionPullModule = {
|
|
|
2393
2485
|
verbose
|
|
2394
2486
|
}) => {
|
|
2395
2487
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2396
|
-
const client =
|
|
2397
|
-
const fileClient =
|
|
2488
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2489
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2398
2490
|
const source = createComponentInstanceEngineDataSource({
|
|
2399
2491
|
client,
|
|
2400
2492
|
state,
|
|
@@ -2499,8 +2591,6 @@ var ComponentPatternPullModule = {
|
|
|
2499
2591
|
};
|
|
2500
2592
|
|
|
2501
2593
|
// src/commands/canvas/commands/composition/push.ts
|
|
2502
|
-
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2503
|
-
import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
2504
2594
|
var CompositionPushModule = {
|
|
2505
2595
|
command: "push <directory>",
|
|
2506
2596
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
@@ -2552,7 +2642,7 @@ var CompositionPushModule = {
|
|
|
2552
2642
|
verbose
|
|
2553
2643
|
}) => {
|
|
2554
2644
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2555
|
-
const client =
|
|
2645
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2556
2646
|
let source;
|
|
2557
2647
|
const isPackage = isPathAPackageFile(directory);
|
|
2558
2648
|
if (isPackage) {
|
|
@@ -2579,7 +2669,7 @@ var CompositionPushModule = {
|
|
|
2579
2669
|
patternType,
|
|
2580
2670
|
verbose
|
|
2581
2671
|
});
|
|
2582
|
-
const fileClient =
|
|
2672
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2583
2673
|
await syncEngine({
|
|
2584
2674
|
source,
|
|
2585
2675
|
target,
|
|
@@ -2642,7 +2732,6 @@ var ComponentPatternPushModule = {
|
|
|
2642
2732
|
};
|
|
2643
2733
|
|
|
2644
2734
|
// src/commands/canvas/commands/composition/remove.ts
|
|
2645
|
-
import { UncachedCanvasClient as UncachedCanvasClient12 } from "@uniformdev/canvas";
|
|
2646
2735
|
var CompositionRemoveModule = {
|
|
2647
2736
|
command: "remove <id>",
|
|
2648
2737
|
aliases: ["delete", "rm"],
|
|
@@ -2664,7 +2753,7 @@ var CompositionRemoveModule = {
|
|
|
2664
2753
|
console.log(`\u{1F41B} remove composition: (id: ${id})`);
|
|
2665
2754
|
}
|
|
2666
2755
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2667
|
-
const client =
|
|
2756
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2668
2757
|
if (!whatIf) {
|
|
2669
2758
|
await client.removeComposition({ compositionId: id });
|
|
2670
2759
|
} else {
|
|
@@ -2680,10 +2769,7 @@ var ComponentPatternRemoveModule = {
|
|
|
2680
2769
|
};
|
|
2681
2770
|
|
|
2682
2771
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
2683
|
-
import {
|
|
2684
|
-
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2,
|
|
2685
|
-
UncachedCanvasClient as UncachedCanvasClient13
|
|
2686
|
-
} from "@uniformdev/canvas";
|
|
2772
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2 } from "@uniformdev/canvas";
|
|
2687
2773
|
import { diffJson as diffJson2 } from "diff";
|
|
2688
2774
|
var CompositionUnpublishModule = {
|
|
2689
2775
|
command: "unpublish [ids]",
|
|
@@ -2734,7 +2820,7 @@ var CompositionUnpublishModule = {
|
|
|
2734
2820
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
2735
2821
|
const targetItems = /* @__PURE__ */ new Map();
|
|
2736
2822
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2737
|
-
const client =
|
|
2823
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2738
2824
|
const source = createComponentInstanceEngineDataSource({
|
|
2739
2825
|
client,
|
|
2740
2826
|
state: "published",
|
|
@@ -2779,7 +2865,7 @@ var CompositionUnpublishModule = {
|
|
|
2779
2865
|
providerId: sourceObject.providerId,
|
|
2780
2866
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
2781
2867
|
whatIf,
|
|
2782
|
-
diff: diffJson2(targetObject.object, sourceObject.object)
|
|
2868
|
+
diff: () => diffJson2(targetObject.object, sourceObject.object)
|
|
2783
2869
|
});
|
|
2784
2870
|
}
|
|
2785
2871
|
}
|
|
@@ -2823,7 +2909,6 @@ var ComponentPatternUnpublishModule = {
|
|
|
2823
2909
|
};
|
|
2824
2910
|
|
|
2825
2911
|
// src/commands/canvas/commands/composition/update.ts
|
|
2826
|
-
import { UncachedCanvasClient as UncachedCanvasClient14 } from "@uniformdev/canvas";
|
|
2827
2912
|
var CompositionUpdateModule = {
|
|
2828
2913
|
command: "update <filename>",
|
|
2829
2914
|
aliases: ["put"],
|
|
@@ -2847,7 +2932,7 @@ var CompositionUpdateModule = {
|
|
|
2847
2932
|
console.log(`\u{1F41B} update composition: (filename: ${filename}, state: ${convertStateOption(state)})`);
|
|
2848
2933
|
}
|
|
2849
2934
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
2850
|
-
const client =
|
|
2935
|
+
const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2851
2936
|
const file = readFileToObject(filename);
|
|
2852
2937
|
if (!whatIf) {
|
|
2853
2938
|
await client.updateComposition({ ...file, state: convertStateOption(state) });
|
|
@@ -3133,8 +3218,15 @@ var CompositionPatternModule = {
|
|
|
3133
3218
|
// src/commands/canvas/commands/contentType.ts
|
|
3134
3219
|
import yargs7 from "yargs";
|
|
3135
3220
|
|
|
3136
|
-
// src/commands/canvas/commands/contentType/
|
|
3221
|
+
// src/commands/canvas/commands/contentType/_util.ts
|
|
3137
3222
|
import { ContentClient } from "@uniformdev/canvas";
|
|
3223
|
+
var selectContentTypeIdentifier = (ct) => ct.id;
|
|
3224
|
+
var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
|
|
3225
|
+
function getContentClient(options) {
|
|
3226
|
+
return new ContentClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
// src/commands/canvas/commands/contentType/get.ts
|
|
3138
3230
|
var ContentTypeGetModule = {
|
|
3139
3231
|
command: "get <id>",
|
|
3140
3232
|
describe: "Get a content type",
|
|
@@ -3154,7 +3246,7 @@ var ContentTypeGetModule = {
|
|
|
3154
3246
|
),
|
|
3155
3247
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
|
|
3156
3248
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3157
|
-
const client =
|
|
3249
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3158
3250
|
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
3159
3251
|
const found = res.contentTypes.find((f) => f.id === id);
|
|
3160
3252
|
if (!found) {
|
|
@@ -3165,26 +3257,18 @@ var ContentTypeGetModule = {
|
|
|
3165
3257
|
};
|
|
3166
3258
|
|
|
3167
3259
|
// src/commands/canvas/commands/contentType/list.ts
|
|
3168
|
-
import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
3169
3260
|
var ContentTypeListModule = {
|
|
3170
3261
|
command: "list",
|
|
3171
3262
|
describe: "List content types",
|
|
3172
3263
|
builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
|
|
3173
3264
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
3174
3265
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3175
|
-
const client =
|
|
3266
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3176
3267
|
const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
|
|
3177
3268
|
emitWithFormat(res.contentTypes, format, filename);
|
|
3178
3269
|
}
|
|
3179
3270
|
};
|
|
3180
3271
|
|
|
3181
|
-
// src/commands/canvas/commands/contentType/pull.ts
|
|
3182
|
-
import { ContentClient as ContentClient3 } from "@uniformdev/canvas";
|
|
3183
|
-
|
|
3184
|
-
// src/commands/canvas/commands/contentType/_util.ts
|
|
3185
|
-
var selectContentTypeIdentifier = (ct) => ct.id;
|
|
3186
|
-
var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
|
|
3187
|
-
|
|
3188
3272
|
// src/commands/canvas/contentTypeEngineDataSource.ts
|
|
3189
3273
|
function createContentTypeEngineDataSource({
|
|
3190
3274
|
client
|
|
@@ -3257,12 +3341,11 @@ var ContentTypePullModule = {
|
|
|
3257
3341
|
verbose
|
|
3258
3342
|
}) => {
|
|
3259
3343
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3260
|
-
const client =
|
|
3344
|
+
const client = getContentClient({
|
|
3261
3345
|
apiKey,
|
|
3262
3346
|
apiHost,
|
|
3263
3347
|
fetch: fetch3,
|
|
3264
|
-
projectId
|
|
3265
|
-
bypassCache: true
|
|
3348
|
+
projectId
|
|
3266
3349
|
});
|
|
3267
3350
|
const source = createContentTypeEngineDataSource({ client });
|
|
3268
3351
|
let target;
|
|
@@ -3300,7 +3383,6 @@ var ContentTypePullModule = {
|
|
|
3300
3383
|
};
|
|
3301
3384
|
|
|
3302
3385
|
// src/commands/canvas/commands/contentType/push.ts
|
|
3303
|
-
import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
3304
3386
|
var ContentTypePushModule = {
|
|
3305
3387
|
command: "push <directory>",
|
|
3306
3388
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
@@ -3342,12 +3424,11 @@ var ContentTypePushModule = {
|
|
|
3342
3424
|
verbose
|
|
3343
3425
|
}) => {
|
|
3344
3426
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3345
|
-
const client =
|
|
3427
|
+
const client = getContentClient({
|
|
3346
3428
|
apiKey,
|
|
3347
3429
|
apiHost,
|
|
3348
3430
|
fetch: fetch3,
|
|
3349
|
-
projectId
|
|
3350
|
-
bypassCache: true
|
|
3431
|
+
projectId
|
|
3351
3432
|
});
|
|
3352
3433
|
let source;
|
|
3353
3434
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3380,7 +3461,6 @@ var ContentTypePushModule = {
|
|
|
3380
3461
|
};
|
|
3381
3462
|
|
|
3382
3463
|
// src/commands/canvas/commands/contentType/remove.ts
|
|
3383
|
-
import { ContentClient as ContentClient5 } from "@uniformdev/canvas";
|
|
3384
3464
|
var ContentTypeRemoveModule = {
|
|
3385
3465
|
command: "remove <id>",
|
|
3386
3466
|
aliases: ["delete", "rm"],
|
|
@@ -3396,7 +3476,7 @@ var ContentTypeRemoveModule = {
|
|
|
3396
3476
|
),
|
|
3397
3477
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
3398
3478
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3399
|
-
const client =
|
|
3479
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3400
3480
|
if (!whatIf) {
|
|
3401
3481
|
await client.deleteContentType({ contentTypeId: id });
|
|
3402
3482
|
} else {
|
|
@@ -3406,7 +3486,6 @@ var ContentTypeRemoveModule = {
|
|
|
3406
3486
|
};
|
|
3407
3487
|
|
|
3408
3488
|
// src/commands/canvas/commands/contentType/update.ts
|
|
3409
|
-
import { ContentClient as ContentClient6 } from "@uniformdev/canvas";
|
|
3410
3489
|
var ContentTypeUpdateModule = {
|
|
3411
3490
|
command: "update <filename>",
|
|
3412
3491
|
aliases: ["put"],
|
|
@@ -3422,7 +3501,7 @@ var ContentTypeUpdateModule = {
|
|
|
3422
3501
|
),
|
|
3423
3502
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
|
|
3424
3503
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3425
|
-
const client =
|
|
3504
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3426
3505
|
const file = readFileToObject(filename);
|
|
3427
3506
|
if (!whatIf) {
|
|
3428
3507
|
await client.upsertContentType({ contentType: file });
|
|
@@ -3446,8 +3525,13 @@ var ContentTypeModule = {
|
|
|
3446
3525
|
// src/commands/canvas/commands/dataSource.ts
|
|
3447
3526
|
import yargs8 from "yargs";
|
|
3448
3527
|
|
|
3449
|
-
// src/commands/canvas/commands/dataSource/
|
|
3528
|
+
// src/commands/canvas/commands/dataSource/_util.ts
|
|
3450
3529
|
import { DataSourceClient } from "@uniformdev/canvas";
|
|
3530
|
+
function getDataSourceClient(options) {
|
|
3531
|
+
return new DataSourceClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
// src/commands/canvas/commands/dataSource/get.ts
|
|
3451
3535
|
var DataSourceGetModule = {
|
|
3452
3536
|
command: "get <id>",
|
|
3453
3537
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
@@ -3455,7 +3539,6 @@ var DataSourceGetModule = {
|
|
|
3455
3539
|
withApiOptions(
|
|
3456
3540
|
withDebugOptions(
|
|
3457
3541
|
withProjectOptions(
|
|
3458
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3459
3542
|
yargs38.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
3460
3543
|
)
|
|
3461
3544
|
)
|
|
@@ -3463,14 +3546,13 @@ var DataSourceGetModule = {
|
|
|
3463
3546
|
),
|
|
3464
3547
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose }) => {
|
|
3465
3548
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3466
|
-
const client =
|
|
3549
|
+
const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3467
3550
|
const res = await client.get({ dataSourceId: id });
|
|
3468
3551
|
emitWithFormat(res.result, "json", void 0);
|
|
3469
3552
|
}
|
|
3470
3553
|
};
|
|
3471
3554
|
|
|
3472
3555
|
// src/commands/canvas/commands/dataSource/remove.ts
|
|
3473
|
-
import { DataSourceClient as DataSourceClient2 } from "@uniformdev/canvas";
|
|
3474
3556
|
var DataSourceRemoveModule = {
|
|
3475
3557
|
command: "remove <id>",
|
|
3476
3558
|
aliases: ["delete", "rm"],
|
|
@@ -3486,7 +3568,7 @@ var DataSourceRemoveModule = {
|
|
|
3486
3568
|
),
|
|
3487
3569
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
3488
3570
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3489
|
-
const client =
|
|
3571
|
+
const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3490
3572
|
if (!whatIf) {
|
|
3491
3573
|
await client.remove({ dataSourceId: id });
|
|
3492
3574
|
} else {
|
|
@@ -3496,7 +3578,6 @@ var DataSourceRemoveModule = {
|
|
|
3496
3578
|
};
|
|
3497
3579
|
|
|
3498
3580
|
// src/commands/canvas/commands/dataSource/update.ts
|
|
3499
|
-
import { DataSourceClient as DataSourceClient3 } from "@uniformdev/canvas";
|
|
3500
3581
|
var DataSourceUpdateModule = {
|
|
3501
3582
|
command: "update <dataSource>",
|
|
3502
3583
|
aliases: ["put"],
|
|
@@ -3525,7 +3606,7 @@ var DataSourceUpdateModule = {
|
|
|
3525
3606
|
whatIf
|
|
3526
3607
|
}) => {
|
|
3527
3608
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3528
|
-
const client =
|
|
3609
|
+
const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3529
3610
|
const file = JSON.parse(dataSource);
|
|
3530
3611
|
if (!whatIf) {
|
|
3531
3612
|
await client.upsert({ data: file, integrationType });
|
|
@@ -3549,8 +3630,15 @@ var DataSourceModule = {
|
|
|
3549
3630
|
// src/commands/canvas/commands/dataType.ts
|
|
3550
3631
|
import yargs9 from "yargs";
|
|
3551
3632
|
|
|
3552
|
-
// src/commands/canvas/commands/dataType/
|
|
3633
|
+
// src/commands/canvas/commands/dataType/_util.ts
|
|
3553
3634
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
3635
|
+
var selectIdentifier4 = (dataType) => dataType.id;
|
|
3636
|
+
var selectDisplayName4 = (dataType) => `${dataType.displayName} (pid: ${dataType.id})`;
|
|
3637
|
+
function getDataTypeClient(options) {
|
|
3638
|
+
return new DataTypeClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
// src/commands/canvas/commands/dataType/get.ts
|
|
3554
3642
|
var DataTypeGetModule = {
|
|
3555
3643
|
command: "get <id>",
|
|
3556
3644
|
describe: "Get a data type",
|
|
@@ -3560,7 +3648,6 @@ var DataTypeGetModule = {
|
|
|
3560
3648
|
withDebugOptions(
|
|
3561
3649
|
withApiOptions(
|
|
3562
3650
|
withProjectOptions(
|
|
3563
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3564
3651
|
yargs38.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
3565
3652
|
)
|
|
3566
3653
|
)
|
|
@@ -3569,7 +3656,7 @@ var DataTypeGetModule = {
|
|
|
3569
3656
|
),
|
|
3570
3657
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
|
|
3571
3658
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3572
|
-
const client =
|
|
3659
|
+
const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3573
3660
|
const res = await client.get();
|
|
3574
3661
|
const found = res.results.find((f) => f.id === id);
|
|
3575
3662
|
if (!found) {
|
|
@@ -3580,7 +3667,6 @@ var DataTypeGetModule = {
|
|
|
3580
3667
|
};
|
|
3581
3668
|
|
|
3582
3669
|
// src/commands/canvas/commands/dataType/list.ts
|
|
3583
|
-
import { DataTypeClient as DataTypeClient2 } from "@uniformdev/canvas";
|
|
3584
3670
|
var DataTypeListModule = {
|
|
3585
3671
|
command: "list",
|
|
3586
3672
|
describe: "List data types",
|
|
@@ -3588,19 +3674,12 @@ var DataTypeListModule = {
|
|
|
3588
3674
|
builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
|
|
3589
3675
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
3590
3676
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3591
|
-
const client =
|
|
3677
|
+
const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3592
3678
|
const res = await client.get();
|
|
3593
3679
|
emitWithFormat(res.results, format, filename);
|
|
3594
3680
|
}
|
|
3595
3681
|
};
|
|
3596
3682
|
|
|
3597
|
-
// src/commands/canvas/commands/dataType/pull.ts
|
|
3598
|
-
import { DataTypeClient as DataTypeClient3 } from "@uniformdev/canvas";
|
|
3599
|
-
|
|
3600
|
-
// src/commands/canvas/commands/dataType/_util.ts
|
|
3601
|
-
var selectIdentifier4 = (dataType) => dataType.id;
|
|
3602
|
-
var selectDisplayName4 = (dataType) => `${dataType.displayName} (pid: ${dataType.id})`;
|
|
3603
|
-
|
|
3604
3683
|
// src/commands/canvas/dataTypeEngineDataSource.ts
|
|
3605
3684
|
function createDataTypeEngineDataSource({
|
|
3606
3685
|
client
|
|
@@ -3675,12 +3754,11 @@ var DataTypePullModule = {
|
|
|
3675
3754
|
verbose
|
|
3676
3755
|
}) => {
|
|
3677
3756
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3678
|
-
const client =
|
|
3757
|
+
const client = getDataTypeClient({
|
|
3679
3758
|
apiKey,
|
|
3680
3759
|
apiHost,
|
|
3681
3760
|
fetch: fetch3,
|
|
3682
|
-
projectId
|
|
3683
|
-
bypassCache: true
|
|
3761
|
+
projectId
|
|
3684
3762
|
});
|
|
3685
3763
|
const source = createDataTypeEngineDataSource({ client });
|
|
3686
3764
|
let target;
|
|
@@ -3718,7 +3796,6 @@ var DataTypePullModule = {
|
|
|
3718
3796
|
};
|
|
3719
3797
|
|
|
3720
3798
|
// src/commands/canvas/commands/dataType/push.ts
|
|
3721
|
-
import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
3722
3799
|
var DataTypePushModule = {
|
|
3723
3800
|
command: "push <directory>",
|
|
3724
3801
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
@@ -3755,12 +3832,11 @@ var DataTypePushModule = {
|
|
|
3755
3832
|
verbose
|
|
3756
3833
|
}) => {
|
|
3757
3834
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3758
|
-
const client =
|
|
3835
|
+
const client = getDataTypeClient({
|
|
3759
3836
|
apiKey,
|
|
3760
3837
|
apiHost,
|
|
3761
3838
|
fetch: fetch3,
|
|
3762
|
-
projectId
|
|
3763
|
-
bypassCache: true
|
|
3839
|
+
projectId
|
|
3764
3840
|
});
|
|
3765
3841
|
let source;
|
|
3766
3842
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3793,7 +3869,6 @@ var DataTypePushModule = {
|
|
|
3793
3869
|
};
|
|
3794
3870
|
|
|
3795
3871
|
// src/commands/canvas/commands/dataType/remove.ts
|
|
3796
|
-
import { DataTypeClient as DataTypeClient5 } from "@uniformdev/canvas";
|
|
3797
3872
|
var DataTypeRemoveModule = {
|
|
3798
3873
|
command: "remove <id>",
|
|
3799
3874
|
aliases: ["delete", "rm"],
|
|
@@ -3809,7 +3884,7 @@ var DataTypeRemoveModule = {
|
|
|
3809
3884
|
),
|
|
3810
3885
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, whatIf }) => {
|
|
3811
3886
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3812
|
-
const client =
|
|
3887
|
+
const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3813
3888
|
if (!whatIf) {
|
|
3814
3889
|
await client.remove({ typeId: id });
|
|
3815
3890
|
} else {
|
|
@@ -3819,7 +3894,6 @@ var DataTypeRemoveModule = {
|
|
|
3819
3894
|
};
|
|
3820
3895
|
|
|
3821
3896
|
// src/commands/canvas/commands/dataType/update.ts
|
|
3822
|
-
import { DataTypeClient as DataTypeClient6 } from "@uniformdev/canvas";
|
|
3823
3897
|
var DataTypeUpdateModule = {
|
|
3824
3898
|
command: "update <filename>",
|
|
3825
3899
|
aliases: ["put"],
|
|
@@ -3835,7 +3909,7 @@ var DataTypeUpdateModule = {
|
|
|
3835
3909
|
),
|
|
3836
3910
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
|
|
3837
3911
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3838
|
-
const client =
|
|
3912
|
+
const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3839
3913
|
const file = readFileToObject(filename);
|
|
3840
3914
|
if (!whatIf) {
|
|
3841
3915
|
await client.upsert({ data: file });
|
|
@@ -3860,7 +3934,6 @@ var DataTypeModule = {
|
|
|
3860
3934
|
import yargs10 from "yargs";
|
|
3861
3935
|
|
|
3862
3936
|
// src/commands/canvas/commands/entry/get.ts
|
|
3863
|
-
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
3864
3937
|
var EntryGetModule = {
|
|
3865
3938
|
command: "get <id>",
|
|
3866
3939
|
describe: "Get an entry",
|
|
@@ -3911,7 +3984,7 @@ var EntryGetModule = {
|
|
|
3911
3984
|
verbose
|
|
3912
3985
|
}) => {
|
|
3913
3986
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3914
|
-
const client =
|
|
3987
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
3915
3988
|
const res = await client.getEntries({
|
|
3916
3989
|
offset: 0,
|
|
3917
3990
|
limit: 1,
|
|
@@ -3931,7 +4004,6 @@ var EntryGetModule = {
|
|
|
3931
4004
|
};
|
|
3932
4005
|
|
|
3933
4006
|
// src/commands/canvas/commands/entry/list.ts
|
|
3934
|
-
import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
3935
4007
|
var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
3936
4008
|
var EntryListModule = {
|
|
3937
4009
|
command: "list",
|
|
@@ -3968,16 +4040,16 @@ var EntryListModule = {
|
|
|
3968
4040
|
filename,
|
|
3969
4041
|
project: projectId,
|
|
3970
4042
|
state,
|
|
3971
|
-
limit,
|
|
4043
|
+
limit: limit2,
|
|
3972
4044
|
offset,
|
|
3973
4045
|
search,
|
|
3974
4046
|
verbose
|
|
3975
4047
|
}) => {
|
|
3976
4048
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
3977
|
-
const client =
|
|
4049
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
3978
4050
|
const res = await client.getEntries({
|
|
3979
4051
|
offset,
|
|
3980
|
-
limit: search.length > 0 &&
|
|
4052
|
+
limit: search.length > 0 && limit2 === LEGACY_DEFAULT_LIMIT ? 100 : limit2,
|
|
3981
4053
|
// Search API requires a lower default limit (100)
|
|
3982
4054
|
search: search.length > 0 ? search : void 0,
|
|
3983
4055
|
state: convertStateOption(state),
|
|
@@ -3989,9 +4061,6 @@ var EntryListModule = {
|
|
|
3989
4061
|
}
|
|
3990
4062
|
};
|
|
3991
4063
|
|
|
3992
|
-
// src/commands/canvas/commands/entry/publish.ts
|
|
3993
|
-
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3994
|
-
|
|
3995
4064
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3996
4065
|
import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
3997
4066
|
|
|
@@ -4024,11 +4093,11 @@ function createEntryEngineDataSource({
|
|
|
4024
4093
|
const stateId = convertStateOption(state);
|
|
4025
4094
|
async function* getObjects() {
|
|
4026
4095
|
const entries = paginateAsync(
|
|
4027
|
-
async (offset,
|
|
4096
|
+
async (offset, limit2) => {
|
|
4028
4097
|
try {
|
|
4029
4098
|
return (await client.getEntries({
|
|
4030
4099
|
offset,
|
|
4031
|
-
limit,
|
|
4100
|
+
limit: limit2,
|
|
4032
4101
|
entryIDs,
|
|
4033
4102
|
pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
|
|
4034
4103
|
skipDataResolution: true,
|
|
@@ -4099,7 +4168,7 @@ var EntryPublishModule = {
|
|
|
4099
4168
|
}
|
|
4100
4169
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
4101
4170
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4102
|
-
const client =
|
|
4171
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
4103
4172
|
const source = createEntryEngineDataSource({
|
|
4104
4173
|
client,
|
|
4105
4174
|
state: "preview",
|
|
@@ -4124,8 +4193,6 @@ var EntryPublishModule = {
|
|
|
4124
4193
|
};
|
|
4125
4194
|
|
|
4126
4195
|
// src/commands/canvas/commands/entry/pull.ts
|
|
4127
|
-
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
4128
|
-
import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
4129
4196
|
var EntryPullModule = {
|
|
4130
4197
|
command: "pull <directory>",
|
|
4131
4198
|
describe: "Pulls all entries to local files in a directory",
|
|
@@ -4172,14 +4239,13 @@ var EntryPullModule = {
|
|
|
4172
4239
|
verbose
|
|
4173
4240
|
}) => {
|
|
4174
4241
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4175
|
-
const client =
|
|
4242
|
+
const client = getContentClient({
|
|
4176
4243
|
apiKey,
|
|
4177
4244
|
apiHost,
|
|
4178
4245
|
fetch: fetch3,
|
|
4179
|
-
projectId
|
|
4180
|
-
bypassCache: true
|
|
4246
|
+
projectId
|
|
4181
4247
|
});
|
|
4182
|
-
const fileClient =
|
|
4248
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4183
4249
|
const source = createEntryEngineDataSource({ client, state, onlyEntries: true });
|
|
4184
4250
|
let target;
|
|
4185
4251
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -4228,8 +4294,6 @@ var EntryPullModule = {
|
|
|
4228
4294
|
};
|
|
4229
4295
|
|
|
4230
4296
|
// src/commands/canvas/commands/entry/push.ts
|
|
4231
|
-
import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
|
|
4232
|
-
import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
4233
4297
|
var EntryPushModule = {
|
|
4234
4298
|
command: "push <directory>",
|
|
4235
4299
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
@@ -4269,12 +4333,11 @@ var EntryPushModule = {
|
|
|
4269
4333
|
verbose
|
|
4270
4334
|
}) => {
|
|
4271
4335
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4272
|
-
const client =
|
|
4336
|
+
const client = getContentClient({
|
|
4273
4337
|
apiKey,
|
|
4274
4338
|
apiHost,
|
|
4275
4339
|
fetch: fetch3,
|
|
4276
|
-
projectId
|
|
4277
|
-
bypassCache: true
|
|
4340
|
+
projectId
|
|
4278
4341
|
});
|
|
4279
4342
|
let source;
|
|
4280
4343
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -4295,7 +4358,7 @@ var EntryPushModule = {
|
|
|
4295
4358
|
});
|
|
4296
4359
|
}
|
|
4297
4360
|
const target = createEntryEngineDataSource({ client, state, onlyEntries: true });
|
|
4298
|
-
const fileClient =
|
|
4361
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4299
4362
|
await syncEngine({
|
|
4300
4363
|
source,
|
|
4301
4364
|
target,
|
|
@@ -4319,7 +4382,6 @@ var EntryPushModule = {
|
|
|
4319
4382
|
};
|
|
4320
4383
|
|
|
4321
4384
|
// src/commands/canvas/commands/entry/remove.ts
|
|
4322
|
-
import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
|
|
4323
4385
|
var EntryRemoveModule = {
|
|
4324
4386
|
command: "remove <id>",
|
|
4325
4387
|
aliases: ["delete", "rm"],
|
|
@@ -4335,7 +4397,7 @@ var EntryRemoveModule = {
|
|
|
4335
4397
|
),
|
|
4336
4398
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
4337
4399
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4338
|
-
const client =
|
|
4400
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4339
4401
|
if (!whatIf) {
|
|
4340
4402
|
await client.deleteEntry({ entryId: id });
|
|
4341
4403
|
} else {
|
|
@@ -4345,7 +4407,7 @@ var EntryRemoveModule = {
|
|
|
4345
4407
|
};
|
|
4346
4408
|
|
|
4347
4409
|
// src/commands/canvas/commands/entry/unpublish.ts
|
|
4348
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3
|
|
4410
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
|
|
4349
4411
|
import { diffJson as diffJson3 } from "diff";
|
|
4350
4412
|
var EntryUnpublishModule = {
|
|
4351
4413
|
command: "unpublish [ids]",
|
|
@@ -4375,7 +4437,7 @@ var EntryUnpublishModule = {
|
|
|
4375
4437
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
4376
4438
|
const targetItems = /* @__PURE__ */ new Map();
|
|
4377
4439
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4378
|
-
const client =
|
|
4440
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4379
4441
|
const source = createEntryEngineDataSource({
|
|
4380
4442
|
client,
|
|
4381
4443
|
state: "published",
|
|
@@ -4413,14 +4475,13 @@ var EntryUnpublishModule = {
|
|
|
4413
4475
|
providerId: sourceObject.providerId,
|
|
4414
4476
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
4415
4477
|
whatIf,
|
|
4416
|
-
diff: diffJson3(targetObject.object, sourceObject.object)
|
|
4478
|
+
diff: () => diffJson3(targetObject.object, sourceObject.object)
|
|
4417
4479
|
});
|
|
4418
4480
|
}
|
|
4419
4481
|
}
|
|
4420
4482
|
};
|
|
4421
4483
|
|
|
4422
4484
|
// src/commands/canvas/commands/entry/update.ts
|
|
4423
|
-
import { ContentClient as ContentClient15 } from "@uniformdev/canvas";
|
|
4424
4485
|
var EntryUpdateModule = {
|
|
4425
4486
|
command: "update <filename>",
|
|
4426
4487
|
aliases: ["put"],
|
|
@@ -4448,7 +4509,7 @@ var EntryUpdateModule = {
|
|
|
4448
4509
|
whatIf
|
|
4449
4510
|
}) => {
|
|
4450
4511
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4451
|
-
const client =
|
|
4512
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
4452
4513
|
const file = readFileToObject(filename);
|
|
4453
4514
|
if (!whatIf) {
|
|
4454
4515
|
await client.upsertEntry({ ...file, state: convertStateOption(state) });
|
|
@@ -4472,7 +4533,6 @@ var EntryModule = {
|
|
|
4472
4533
|
import yargs11 from "yargs";
|
|
4473
4534
|
|
|
4474
4535
|
// src/commands/canvas/commands/entryPattern/get.ts
|
|
4475
|
-
import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
|
|
4476
4536
|
var EntryPatternGetModule = {
|
|
4477
4537
|
command: "get <id>",
|
|
4478
4538
|
describe: "Get an entry pattern",
|
|
@@ -4495,7 +4555,7 @@ var EntryPatternGetModule = {
|
|
|
4495
4555
|
),
|
|
4496
4556
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, state, verbose }) => {
|
|
4497
4557
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4498
|
-
const client =
|
|
4558
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4499
4559
|
const res = await client.getEntries({
|
|
4500
4560
|
offset: 0,
|
|
4501
4561
|
limit: 1,
|
|
@@ -4514,7 +4574,6 @@ var EntryPatternGetModule = {
|
|
|
4514
4574
|
};
|
|
4515
4575
|
|
|
4516
4576
|
// src/commands/canvas/commands/entryPattern/list.ts
|
|
4517
|
-
import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
|
|
4518
4577
|
var EntryPatternListModule = {
|
|
4519
4578
|
command: "list",
|
|
4520
4579
|
describe: "List entry patterns",
|
|
@@ -4535,7 +4594,7 @@ var EntryPatternListModule = {
|
|
|
4535
4594
|
verbose
|
|
4536
4595
|
}) => {
|
|
4537
4596
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4538
|
-
const client =
|
|
4597
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
4539
4598
|
const res = await client.getEntries({
|
|
4540
4599
|
offset: 0,
|
|
4541
4600
|
limit: 1e3,
|
|
@@ -4550,7 +4609,6 @@ var EntryPatternListModule = {
|
|
|
4550
4609
|
};
|
|
4551
4610
|
|
|
4552
4611
|
// src/commands/canvas/commands/entryPattern/publish.ts
|
|
4553
|
-
import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
|
|
4554
4612
|
var EntryPatternPublishModule = {
|
|
4555
4613
|
command: "publish [ids]",
|
|
4556
4614
|
describe: "Publishes entry pattern(s)",
|
|
@@ -4580,7 +4638,7 @@ var EntryPatternPublishModule = {
|
|
|
4580
4638
|
}
|
|
4581
4639
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
4582
4640
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4583
|
-
const client =
|
|
4641
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
4584
4642
|
const source = createEntryEngineDataSource({
|
|
4585
4643
|
client,
|
|
4586
4644
|
state: "preview",
|
|
@@ -4605,8 +4663,6 @@ var EntryPatternPublishModule = {
|
|
|
4605
4663
|
};
|
|
4606
4664
|
|
|
4607
4665
|
// src/commands/canvas/commands/entryPattern/pull.ts
|
|
4608
|
-
import { ContentClient as ContentClient19 } from "@uniformdev/canvas";
|
|
4609
|
-
import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
|
|
4610
4666
|
var EntryPatternPullModule = {
|
|
4611
4667
|
command: "pull <directory>",
|
|
4612
4668
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
@@ -4653,14 +4709,13 @@ var EntryPatternPullModule = {
|
|
|
4653
4709
|
verbose
|
|
4654
4710
|
}) => {
|
|
4655
4711
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4656
|
-
const client =
|
|
4712
|
+
const client = getContentClient({
|
|
4657
4713
|
apiKey,
|
|
4658
4714
|
apiHost,
|
|
4659
4715
|
fetch: fetch3,
|
|
4660
|
-
projectId
|
|
4661
|
-
bypassCache: true
|
|
4716
|
+
projectId
|
|
4662
4717
|
});
|
|
4663
|
-
const fileClient =
|
|
4718
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4664
4719
|
const source = createEntryEngineDataSource({ client, state, onlyPatterns: true });
|
|
4665
4720
|
let target;
|
|
4666
4721
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -4709,8 +4764,6 @@ var EntryPatternPullModule = {
|
|
|
4709
4764
|
};
|
|
4710
4765
|
|
|
4711
4766
|
// src/commands/canvas/commands/entryPattern/push.ts
|
|
4712
|
-
import { ContentClient as ContentClient20 } from "@uniformdev/canvas";
|
|
4713
|
-
import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
|
|
4714
4767
|
var EntryPatternPushModule = {
|
|
4715
4768
|
command: "push <directory>",
|
|
4716
4769
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
@@ -4755,12 +4808,11 @@ var EntryPatternPushModule = {
|
|
|
4755
4808
|
verbose
|
|
4756
4809
|
}) => {
|
|
4757
4810
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4758
|
-
const client =
|
|
4811
|
+
const client = getContentClient({
|
|
4759
4812
|
apiKey,
|
|
4760
4813
|
apiHost,
|
|
4761
4814
|
fetch: fetch3,
|
|
4762
|
-
projectId
|
|
4763
|
-
bypassCache: true
|
|
4815
|
+
projectId
|
|
4764
4816
|
});
|
|
4765
4817
|
let source;
|
|
4766
4818
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -4781,7 +4833,7 @@ var EntryPatternPushModule = {
|
|
|
4781
4833
|
});
|
|
4782
4834
|
}
|
|
4783
4835
|
const target = createEntryEngineDataSource({ client, state, onlyPatterns: true });
|
|
4784
|
-
const fileClient =
|
|
4836
|
+
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4785
4837
|
await syncEngine({
|
|
4786
4838
|
source,
|
|
4787
4839
|
target,
|
|
@@ -4805,7 +4857,6 @@ var EntryPatternPushModule = {
|
|
|
4805
4857
|
};
|
|
4806
4858
|
|
|
4807
4859
|
// src/commands/canvas/commands/entryPattern/remove.ts
|
|
4808
|
-
import { ContentClient as ContentClient21 } from "@uniformdev/canvas";
|
|
4809
4860
|
var EntryPatternRemoveModule = {
|
|
4810
4861
|
command: "remove <id>",
|
|
4811
4862
|
aliases: ["delete", "rm"],
|
|
@@ -4821,7 +4872,7 @@ var EntryPatternRemoveModule = {
|
|
|
4821
4872
|
),
|
|
4822
4873
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
4823
4874
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4824
|
-
const client =
|
|
4875
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4825
4876
|
if (!whatIf) {
|
|
4826
4877
|
await client.deleteEntry({ entryId: id });
|
|
4827
4878
|
} else {
|
|
@@ -4831,7 +4882,7 @@ var EntryPatternRemoveModule = {
|
|
|
4831
4882
|
};
|
|
4832
4883
|
|
|
4833
4884
|
// src/commands/canvas/commands/entryPattern/unpublish.ts
|
|
4834
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4
|
|
4885
|
+
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
|
|
4835
4886
|
import { diffJson as diffJson4 } from "diff";
|
|
4836
4887
|
var EntryPatternUnpublishModule = {
|
|
4837
4888
|
command: "unpublish [ids]",
|
|
@@ -4861,7 +4912,7 @@ var EntryPatternUnpublishModule = {
|
|
|
4861
4912
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
4862
4913
|
const targetItems = /* @__PURE__ */ new Map();
|
|
4863
4914
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4864
|
-
const client =
|
|
4915
|
+
const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
4865
4916
|
const source = createEntryEngineDataSource({
|
|
4866
4917
|
client,
|
|
4867
4918
|
state: "published",
|
|
@@ -4899,14 +4950,13 @@ var EntryPatternUnpublishModule = {
|
|
|
4899
4950
|
providerId: sourceObject.providerId,
|
|
4900
4951
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
4901
4952
|
whatIf,
|
|
4902
|
-
diff: diffJson4(targetObject.object, sourceObject.object)
|
|
4953
|
+
diff: () => diffJson4(targetObject.object, sourceObject.object)
|
|
4903
4954
|
});
|
|
4904
4955
|
}
|
|
4905
4956
|
}
|
|
4906
4957
|
};
|
|
4907
4958
|
|
|
4908
4959
|
// src/commands/canvas/commands/entryPattern/update.ts
|
|
4909
|
-
import { ContentClient as ContentClient23 } from "@uniformdev/canvas";
|
|
4910
4960
|
var EntryPatternUpdateModule = {
|
|
4911
4961
|
command: "update <filename>",
|
|
4912
4962
|
aliases: ["put"],
|
|
@@ -4934,7 +4984,7 @@ var EntryPatternUpdateModule = {
|
|
|
4934
4984
|
whatIf
|
|
4935
4985
|
}) => {
|
|
4936
4986
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
4937
|
-
const client =
|
|
4987
|
+
const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
|
|
4938
4988
|
const file = readFileToObject(filename);
|
|
4939
4989
|
if (!whatIf) {
|
|
4940
4990
|
await client.upsertEntry({ ...file, state: convertStateOption(state) });
|
|
@@ -4961,9 +5011,6 @@ var EntryPatternModule = {
|
|
|
4961
5011
|
// src/commands/canvas/commands/locale.ts
|
|
4962
5012
|
import yargs12 from "yargs";
|
|
4963
5013
|
|
|
4964
|
-
// src/commands/canvas/commands/locale/pull.ts
|
|
4965
|
-
import { LocaleClient } from "@uniformdev/canvas";
|
|
4966
|
-
|
|
4967
5014
|
// src/commands/canvas/localesEngineDataSource.ts
|
|
4968
5015
|
function createLocaleEngineDataSource({
|
|
4969
5016
|
client
|
|
@@ -4994,6 +5041,12 @@ function createLocaleEngineDataSource({
|
|
|
4994
5041
|
};
|
|
4995
5042
|
}
|
|
4996
5043
|
|
|
5044
|
+
// src/commands/canvas/commands/locale/_util.ts
|
|
5045
|
+
import { LocaleClient } from "@uniformdev/canvas";
|
|
5046
|
+
function getLocaleClient(options) {
|
|
5047
|
+
return new LocaleClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
5048
|
+
}
|
|
5049
|
+
|
|
4997
5050
|
// src/commands/canvas/commands/locale/pull.ts
|
|
4998
5051
|
var LocalePullModule = {
|
|
4999
5052
|
command: "pull <directory>",
|
|
@@ -5038,12 +5091,11 @@ var LocalePullModule = {
|
|
|
5038
5091
|
verbose
|
|
5039
5092
|
}) => {
|
|
5040
5093
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5041
|
-
const client =
|
|
5094
|
+
const client = getLocaleClient({
|
|
5042
5095
|
apiKey,
|
|
5043
5096
|
apiHost,
|
|
5044
5097
|
fetch: fetch3,
|
|
5045
|
-
projectId
|
|
5046
|
-
bypassCache: true
|
|
5098
|
+
projectId
|
|
5047
5099
|
});
|
|
5048
5100
|
const source = createLocaleEngineDataSource({ client });
|
|
5049
5101
|
let target;
|
|
@@ -5081,7 +5133,6 @@ var LocalePullModule = {
|
|
|
5081
5133
|
};
|
|
5082
5134
|
|
|
5083
5135
|
// src/commands/canvas/commands/locale/push.ts
|
|
5084
|
-
import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
5085
5136
|
var LocalePushModule = {
|
|
5086
5137
|
command: "push <directory>",
|
|
5087
5138
|
describe: "Pushes all locales from files in a directory to Uniform",
|
|
@@ -5118,12 +5169,11 @@ var LocalePushModule = {
|
|
|
5118
5169
|
verbose
|
|
5119
5170
|
}) => {
|
|
5120
5171
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5121
|
-
const client =
|
|
5172
|
+
const client = getLocaleClient({
|
|
5122
5173
|
apiKey,
|
|
5123
5174
|
apiHost,
|
|
5124
5175
|
fetch: fetch3,
|
|
5125
|
-
projectId
|
|
5126
|
-
bypassCache: true
|
|
5176
|
+
projectId
|
|
5127
5177
|
});
|
|
5128
5178
|
let source;
|
|
5129
5179
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -5395,8 +5445,15 @@ var PatternModule = {
|
|
|
5395
5445
|
// src/commands/canvas/commands/previewUrl.ts
|
|
5396
5446
|
import yargs14 from "yargs";
|
|
5397
5447
|
|
|
5398
|
-
// src/commands/canvas/commands/previewUrl/
|
|
5448
|
+
// src/commands/canvas/commands/previewUrl/_util.ts
|
|
5399
5449
|
import { PreviewClient } from "@uniformdev/canvas";
|
|
5450
|
+
var selectIdentifier5 = (previewUrl) => previewUrl.id;
|
|
5451
|
+
var selectDisplayName5 = (previewUrl) => `${previewUrl.name} (pid: ${previewUrl.id})`;
|
|
5452
|
+
function getPreviewClient(options) {
|
|
5453
|
+
return new PreviewClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
5454
|
+
}
|
|
5455
|
+
|
|
5456
|
+
// src/commands/canvas/commands/previewUrl/get.ts
|
|
5400
5457
|
var PreviewUrlGetModule = {
|
|
5401
5458
|
command: "get <id>",
|
|
5402
5459
|
describe: "Fetch a preview URL",
|
|
@@ -5413,7 +5470,7 @@ var PreviewUrlGetModule = {
|
|
|
5413
5470
|
),
|
|
5414
5471
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
|
|
5415
5472
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5416
|
-
const client =
|
|
5473
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5417
5474
|
const previewUrl = await client.getPreviewUrl({ id });
|
|
5418
5475
|
if (!previewUrl) {
|
|
5419
5476
|
console.error("Preview URL did not exist");
|
|
@@ -5425,7 +5482,6 @@ var PreviewUrlGetModule = {
|
|
|
5425
5482
|
};
|
|
5426
5483
|
|
|
5427
5484
|
// src/commands/canvas/commands/previewUrl/list.ts
|
|
5428
|
-
import { PreviewClient as PreviewClient2 } from "@uniformdev/canvas";
|
|
5429
5485
|
var PreviewUrlListModule = {
|
|
5430
5486
|
command: "list",
|
|
5431
5487
|
describe: "List preview URLs",
|
|
@@ -5435,19 +5491,12 @@ var PreviewUrlListModule = {
|
|
|
5435
5491
|
),
|
|
5436
5492
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
5437
5493
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5438
|
-
const client =
|
|
5494
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5439
5495
|
const res = await client.getPreviewUrls();
|
|
5440
5496
|
emitWithFormat(res.previewUrls, format, filename);
|
|
5441
5497
|
}
|
|
5442
5498
|
};
|
|
5443
5499
|
|
|
5444
|
-
// src/commands/canvas/commands/previewUrl/pull.ts
|
|
5445
|
-
import { PreviewClient as PreviewClient3 } from "@uniformdev/canvas";
|
|
5446
|
-
|
|
5447
|
-
// src/commands/canvas/commands/previewUrl/_util.ts
|
|
5448
|
-
var selectIdentifier5 = (previewUrl) => previewUrl.id;
|
|
5449
|
-
var selectDisplayName5 = (previewUrl) => `${previewUrl.name} (pid: ${previewUrl.id})`;
|
|
5450
|
-
|
|
5451
5500
|
// src/commands/canvas/previewUrlEngineDataSource.ts
|
|
5452
5501
|
function createPreviewUrlEngineDataSource({
|
|
5453
5502
|
client
|
|
@@ -5520,7 +5569,7 @@ var PreviewUrlPullModule = {
|
|
|
5520
5569
|
verbose
|
|
5521
5570
|
}) => {
|
|
5522
5571
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5523
|
-
const client =
|
|
5572
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5524
5573
|
const source = createPreviewUrlEngineDataSource({ client });
|
|
5525
5574
|
let target;
|
|
5526
5575
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -5557,7 +5606,6 @@ var PreviewUrlPullModule = {
|
|
|
5557
5606
|
};
|
|
5558
5607
|
|
|
5559
5608
|
// src/commands/canvas/commands/previewUrl/push.ts
|
|
5560
|
-
import { PreviewClient as PreviewClient4 } from "@uniformdev/canvas";
|
|
5561
5609
|
var PreviewUrlPushModule = {
|
|
5562
5610
|
command: "push <directory>",
|
|
5563
5611
|
describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
|
|
@@ -5594,7 +5642,7 @@ var PreviewUrlPushModule = {
|
|
|
5594
5642
|
verbose
|
|
5595
5643
|
}) => {
|
|
5596
5644
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5597
|
-
const client =
|
|
5645
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5598
5646
|
let source;
|
|
5599
5647
|
const isPackage = isPathAPackageFile(directory);
|
|
5600
5648
|
if (isPackage) {
|
|
@@ -5626,7 +5674,6 @@ var PreviewUrlPushModule = {
|
|
|
5626
5674
|
};
|
|
5627
5675
|
|
|
5628
5676
|
// src/commands/canvas/commands/previewUrl/remove.ts
|
|
5629
|
-
import { PreviewClient as PreviewClient5 } from "@uniformdev/canvas";
|
|
5630
5677
|
var PreviewUrlRemoveModule = {
|
|
5631
5678
|
command: "remove <id>",
|
|
5632
5679
|
aliases: ["delete", "rm"],
|
|
@@ -5642,7 +5689,7 @@ var PreviewUrlRemoveModule = {
|
|
|
5642
5689
|
),
|
|
5643
5690
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
5644
5691
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5645
|
-
const client =
|
|
5692
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5646
5693
|
if (!whatIf) {
|
|
5647
5694
|
await client.deletePreviewUrl({ id });
|
|
5648
5695
|
} else {
|
|
@@ -5652,7 +5699,6 @@ var PreviewUrlRemoveModule = {
|
|
|
5652
5699
|
};
|
|
5653
5700
|
|
|
5654
5701
|
// src/commands/canvas/commands/previewUrl/update.ts
|
|
5655
|
-
import { PreviewClient as PreviewClient6 } from "@uniformdev/canvas";
|
|
5656
5702
|
var PreviewUrlUpdateModule = {
|
|
5657
5703
|
command: "update <filename>",
|
|
5658
5704
|
aliases: ["put"],
|
|
@@ -5668,7 +5714,7 @@ var PreviewUrlUpdateModule = {
|
|
|
5668
5714
|
),
|
|
5669
5715
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, whatIf, verbose }) => {
|
|
5670
5716
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5671
|
-
const client =
|
|
5717
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5672
5718
|
const file = readFileToObject(filename);
|
|
5673
5719
|
if (!whatIf) {
|
|
5674
5720
|
await client.upsertPreviewUrl(file);
|
|
@@ -5693,7 +5739,6 @@ var PreviewUrlModule = {
|
|
|
5693
5739
|
import yargs15 from "yargs";
|
|
5694
5740
|
|
|
5695
5741
|
// src/commands/canvas/commands/previewViewport/get.ts
|
|
5696
|
-
import { PreviewClient as PreviewClient7 } from "@uniformdev/canvas";
|
|
5697
5742
|
var PreviewViewportGetModule = {
|
|
5698
5743
|
command: "get <id>",
|
|
5699
5744
|
describe: "Fetch a preview viewport",
|
|
@@ -5710,7 +5755,7 @@ var PreviewViewportGetModule = {
|
|
|
5710
5755
|
),
|
|
5711
5756
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
|
|
5712
5757
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5713
|
-
const client =
|
|
5758
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5714
5759
|
const previewViewport = await client.getPreviewViewport({ id });
|
|
5715
5760
|
if (!previewViewport) {
|
|
5716
5761
|
console.error("Preview viewport did not exist");
|
|
@@ -5722,7 +5767,6 @@ var PreviewViewportGetModule = {
|
|
|
5722
5767
|
};
|
|
5723
5768
|
|
|
5724
5769
|
// src/commands/canvas/commands/previewViewport/list.ts
|
|
5725
|
-
import { PreviewClient as PreviewClient8 } from "@uniformdev/canvas";
|
|
5726
5770
|
var PreviewViewportListModule = {
|
|
5727
5771
|
command: "list",
|
|
5728
5772
|
describe: "List preview viewports",
|
|
@@ -5732,15 +5776,12 @@ var PreviewViewportListModule = {
|
|
|
5732
5776
|
),
|
|
5733
5777
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
5734
5778
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5735
|
-
const client =
|
|
5779
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5736
5780
|
const res = await client.getPreviewViewports();
|
|
5737
5781
|
emitWithFormat(res.previewViewports, format, filename);
|
|
5738
5782
|
}
|
|
5739
5783
|
};
|
|
5740
5784
|
|
|
5741
|
-
// src/commands/canvas/commands/previewViewport/pull.ts
|
|
5742
|
-
import { PreviewClient as PreviewClient9 } from "@uniformdev/canvas";
|
|
5743
|
-
|
|
5744
5785
|
// src/commands/canvas/commands/previewViewport/_util.ts
|
|
5745
5786
|
var selectIdentifier6 = (previewViewport) => previewViewport.id;
|
|
5746
5787
|
var selectDisplayName6 = (previewViewport) => `${previewViewport.name} (pid: ${previewViewport.id})`;
|
|
@@ -5817,7 +5858,7 @@ var PreviewViewportPullModule = {
|
|
|
5817
5858
|
verbose
|
|
5818
5859
|
}) => {
|
|
5819
5860
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5820
|
-
const client =
|
|
5861
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5821
5862
|
const source = createPreviewViewportEngineDataSource({ client });
|
|
5822
5863
|
let target;
|
|
5823
5864
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -5854,7 +5895,6 @@ var PreviewViewportPullModule = {
|
|
|
5854
5895
|
};
|
|
5855
5896
|
|
|
5856
5897
|
// src/commands/canvas/commands/previewViewport/push.ts
|
|
5857
|
-
import { PreviewClient as PreviewClient10 } from "@uniformdev/canvas";
|
|
5858
5898
|
var PreviewViewportPushModule = {
|
|
5859
5899
|
command: "push <directory>",
|
|
5860
5900
|
describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
|
|
@@ -5891,7 +5931,7 @@ var PreviewViewportPushModule = {
|
|
|
5891
5931
|
verbose
|
|
5892
5932
|
}) => {
|
|
5893
5933
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5894
|
-
const client =
|
|
5934
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5895
5935
|
let source;
|
|
5896
5936
|
const isPackage = isPathAPackageFile(directory);
|
|
5897
5937
|
if (isPackage) {
|
|
@@ -5923,7 +5963,6 @@ var PreviewViewportPushModule = {
|
|
|
5923
5963
|
};
|
|
5924
5964
|
|
|
5925
5965
|
// src/commands/canvas/commands/previewViewport/remove.ts
|
|
5926
|
-
import { PreviewClient as PreviewClient11 } from "@uniformdev/canvas";
|
|
5927
5966
|
var PreviewViewportRemoveModule = {
|
|
5928
5967
|
command: "remove <id>",
|
|
5929
5968
|
aliases: ["delete", "rm"],
|
|
@@ -5939,7 +5978,7 @@ var PreviewViewportRemoveModule = {
|
|
|
5939
5978
|
),
|
|
5940
5979
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
5941
5980
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5942
|
-
const client =
|
|
5981
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5943
5982
|
if (!whatIf) {
|
|
5944
5983
|
await client.deletePreviewViewport({ id });
|
|
5945
5984
|
} else {
|
|
@@ -5949,7 +5988,6 @@ var PreviewViewportRemoveModule = {
|
|
|
5949
5988
|
};
|
|
5950
5989
|
|
|
5951
5990
|
// src/commands/canvas/commands/previewViewport/update.ts
|
|
5952
|
-
import { PreviewClient as PreviewClient12 } from "@uniformdev/canvas";
|
|
5953
5991
|
var PreviewViewportUpdateModule = {
|
|
5954
5992
|
command: "update <filename>",
|
|
5955
5993
|
aliases: ["put"],
|
|
@@ -5965,7 +6003,7 @@ var PreviewViewportUpdateModule = {
|
|
|
5965
6003
|
),
|
|
5966
6004
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, whatIf, verbose }) => {
|
|
5967
6005
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
5968
|
-
const client =
|
|
6006
|
+
const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5969
6007
|
const file = readFileToObject(filename);
|
|
5970
6008
|
if (!whatIf) {
|
|
5971
6009
|
await client.upsertPreviewViewport(file);
|
|
@@ -5989,8 +6027,13 @@ var PreviewViewportModule = {
|
|
|
5989
6027
|
// src/commands/canvas/commands/prompts.ts
|
|
5990
6028
|
import yargs16 from "yargs";
|
|
5991
6029
|
|
|
5992
|
-
// src/commands/canvas/commands/prompts/
|
|
6030
|
+
// src/commands/canvas/commands/prompts/_util.ts
|
|
5993
6031
|
import { PromptClient } from "@uniformdev/canvas";
|
|
6032
|
+
var selectPromptIdentifier = (e) => e.id;
|
|
6033
|
+
var selectPromptDisplayName = (e) => `${e.name ?? "Untitled"} (pid: ${e.id})`;
|
|
6034
|
+
var getPromptClient = (options) => new PromptClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
6035
|
+
|
|
6036
|
+
// src/commands/canvas/commands/prompts/get.ts
|
|
5994
6037
|
var PromptGetModule = {
|
|
5995
6038
|
command: "get <id>",
|
|
5996
6039
|
describe: "Get a prompt",
|
|
@@ -5999,7 +6042,6 @@ var PromptGetModule = {
|
|
|
5999
6042
|
withFormatOptions(
|
|
6000
6043
|
withApiOptions(
|
|
6001
6044
|
withProjectOptions(
|
|
6002
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6003
6045
|
yargs38.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
6004
6046
|
)
|
|
6005
6047
|
)
|
|
@@ -6008,7 +6050,7 @@ var PromptGetModule = {
|
|
|
6008
6050
|
),
|
|
6009
6051
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
|
|
6010
6052
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6011
|
-
const client =
|
|
6053
|
+
const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6012
6054
|
const res = await client.get({ promptId: id });
|
|
6013
6055
|
if (!res) {
|
|
6014
6056
|
throw new Error(`Prompt with ID ${id} not found`);
|
|
@@ -6018,26 +6060,18 @@ var PromptGetModule = {
|
|
|
6018
6060
|
};
|
|
6019
6061
|
|
|
6020
6062
|
// src/commands/canvas/commands/prompts/list.ts
|
|
6021
|
-
import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
6022
6063
|
var PromptListModule = {
|
|
6023
6064
|
command: "list",
|
|
6024
6065
|
describe: "List prompts",
|
|
6025
6066
|
builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
|
|
6026
6067
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
6027
6068
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6028
|
-
const client =
|
|
6069
|
+
const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6029
6070
|
const res = await client.get();
|
|
6030
6071
|
emitWithFormat(res, format, filename);
|
|
6031
6072
|
}
|
|
6032
6073
|
};
|
|
6033
6074
|
|
|
6034
|
-
// src/commands/canvas/commands/prompts/pull.ts
|
|
6035
|
-
import { PromptClient as PromptClient3 } from "@uniformdev/canvas";
|
|
6036
|
-
|
|
6037
|
-
// src/commands/canvas/commands/prompts/_util.ts
|
|
6038
|
-
var selectPromptIdentifier = (e) => e.id;
|
|
6039
|
-
var selectPromptDisplayName = (e) => `${e.name ?? "Untitled"} (pid: ${e.id})`;
|
|
6040
|
-
|
|
6041
6075
|
// src/commands/canvas/promptEngineDataSource.ts
|
|
6042
6076
|
function createPromptEngineDataSource({
|
|
6043
6077
|
client
|
|
@@ -6112,12 +6146,11 @@ var PromptPullModule = {
|
|
|
6112
6146
|
verbose
|
|
6113
6147
|
}) => {
|
|
6114
6148
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6115
|
-
const client =
|
|
6149
|
+
const client = getPromptClient({
|
|
6116
6150
|
apiKey,
|
|
6117
6151
|
apiHost,
|
|
6118
6152
|
fetch: fetch3,
|
|
6119
|
-
projectId
|
|
6120
|
-
bypassCache: true
|
|
6153
|
+
projectId
|
|
6121
6154
|
});
|
|
6122
6155
|
const source = createPromptEngineDataSource({ client });
|
|
6123
6156
|
let target;
|
|
@@ -6155,7 +6188,6 @@ var PromptPullModule = {
|
|
|
6155
6188
|
};
|
|
6156
6189
|
|
|
6157
6190
|
// src/commands/canvas/commands/prompts/push.ts
|
|
6158
|
-
import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
6159
6191
|
var PromptPushModule = {
|
|
6160
6192
|
command: "push <directory>",
|
|
6161
6193
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
@@ -6192,12 +6224,11 @@ var PromptPushModule = {
|
|
|
6192
6224
|
verbose
|
|
6193
6225
|
}) => {
|
|
6194
6226
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6195
|
-
const client =
|
|
6227
|
+
const client = getPromptClient({
|
|
6196
6228
|
apiKey,
|
|
6197
6229
|
apiHost,
|
|
6198
6230
|
fetch: fetch3,
|
|
6199
|
-
projectId
|
|
6200
|
-
bypassCache: true
|
|
6231
|
+
projectId
|
|
6201
6232
|
});
|
|
6202
6233
|
let source;
|
|
6203
6234
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -6230,7 +6261,6 @@ var PromptPushModule = {
|
|
|
6230
6261
|
};
|
|
6231
6262
|
|
|
6232
6263
|
// src/commands/canvas/commands/prompts/remove.ts
|
|
6233
|
-
import { PromptClient as PromptClient5 } from "@uniformdev/canvas";
|
|
6234
6264
|
var PromptRemoveModule = {
|
|
6235
6265
|
command: "remove <id>",
|
|
6236
6266
|
aliases: ["delete", "rm"],
|
|
@@ -6244,7 +6274,7 @@ var PromptRemoveModule = {
|
|
|
6244
6274
|
),
|
|
6245
6275
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
|
|
6246
6276
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6247
|
-
const client =
|
|
6277
|
+
const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6248
6278
|
if (!whatIf) {
|
|
6249
6279
|
await client.remove({ promptId: id });
|
|
6250
6280
|
} else {
|
|
@@ -6254,7 +6284,6 @@ var PromptRemoveModule = {
|
|
|
6254
6284
|
};
|
|
6255
6285
|
|
|
6256
6286
|
// src/commands/canvas/commands/prompts/update.ts
|
|
6257
|
-
import { PromptClient as PromptClient6 } from "@uniformdev/canvas";
|
|
6258
6287
|
var PromptUpdateModule = {
|
|
6259
6288
|
command: "update <filename>",
|
|
6260
6289
|
aliases: ["put"],
|
|
@@ -6270,7 +6299,7 @@ var PromptUpdateModule = {
|
|
|
6270
6299
|
),
|
|
6271
6300
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
|
|
6272
6301
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6273
|
-
const client =
|
|
6302
|
+
const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6274
6303
|
const file = readFileToObject(filename);
|
|
6275
6304
|
if (!whatIf) {
|
|
6276
6305
|
await client.upsert({ data: file });
|
|
@@ -6294,12 +6323,11 @@ var PromptModule = {
|
|
|
6294
6323
|
// src/commands/canvas/commands/workflow.ts
|
|
6295
6324
|
import yargs17 from "yargs";
|
|
6296
6325
|
|
|
6297
|
-
// src/commands/canvas/commands/workflow/pull.ts
|
|
6298
|
-
import { WorkflowClient } from "@uniformdev/canvas";
|
|
6299
|
-
|
|
6300
6326
|
// src/commands/canvas/commands/workflow/_util.ts
|
|
6327
|
+
import { WorkflowClient } from "@uniformdev/canvas";
|
|
6301
6328
|
var selectIdentifier7 = (workflow) => workflow.id;
|
|
6302
6329
|
var selectDisplayName7 = (workflow) => `${workflow.name} (pid: ${workflow.id})`;
|
|
6330
|
+
var getWorkflowClient = (options) => new WorkflowClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
6303
6331
|
|
|
6304
6332
|
// src/commands/canvas/workflowEngineDataSource.ts
|
|
6305
6333
|
function createWorkflowEngineDataSource({
|
|
@@ -6376,7 +6404,7 @@ var WorkflowPullModule = {
|
|
|
6376
6404
|
verbose
|
|
6377
6405
|
}) => {
|
|
6378
6406
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6379
|
-
const client =
|
|
6407
|
+
const client = getWorkflowClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6380
6408
|
const source = createWorkflowEngineDataSource({ client });
|
|
6381
6409
|
let target;
|
|
6382
6410
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -6413,7 +6441,6 @@ var WorkflowPullModule = {
|
|
|
6413
6441
|
};
|
|
6414
6442
|
|
|
6415
6443
|
// src/commands/canvas/commands/workflow/push.ts
|
|
6416
|
-
import { WorkflowClient as WorkflowClient2 } from "@uniformdev/canvas";
|
|
6417
6444
|
var WorkflowPushModule = {
|
|
6418
6445
|
command: "push <directory>",
|
|
6419
6446
|
describe: "Pushes all workflows from files in a directory to Uniform Canvas",
|
|
@@ -6450,7 +6477,7 @@ var WorkflowPushModule = {
|
|
|
6450
6477
|
verbose
|
|
6451
6478
|
}) => {
|
|
6452
6479
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6453
|
-
const client =
|
|
6480
|
+
const client = getWorkflowClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6454
6481
|
let source;
|
|
6455
6482
|
const isPackage = isPathAPackageFile(directory);
|
|
6456
6483
|
if (isPackage) {
|
|
@@ -6509,8 +6536,13 @@ import yargs25 from "yargs";
|
|
|
6509
6536
|
// src/commands/context/commands/aggregate.ts
|
|
6510
6537
|
import yargs19 from "yargs";
|
|
6511
6538
|
|
|
6539
|
+
// src/commands/context/commands/aggregate/_util.ts
|
|
6540
|
+
import { AggregateClient } from "@uniformdev/context/api";
|
|
6541
|
+
var selectIdentifier8 = (source) => source.id;
|
|
6542
|
+
var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6543
|
+
var getAggregateClient = (options) => new AggregateClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
6544
|
+
|
|
6512
6545
|
// src/commands/context/commands/aggregate/get.ts
|
|
6513
|
-
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
6514
6546
|
var AggregateGetModule = {
|
|
6515
6547
|
command: "get <id>",
|
|
6516
6548
|
describe: "Fetch an aggregate",
|
|
@@ -6525,7 +6557,7 @@ var AggregateGetModule = {
|
|
|
6525
6557
|
),
|
|
6526
6558
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
6527
6559
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6528
|
-
const client =
|
|
6560
|
+
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6529
6561
|
const res = await client.get({ aggregateId: id });
|
|
6530
6562
|
if (res.aggregates.length === 0) {
|
|
6531
6563
|
console.error("Aggregate did not exist");
|
|
@@ -6537,7 +6569,6 @@ var AggregateGetModule = {
|
|
|
6537
6569
|
};
|
|
6538
6570
|
|
|
6539
6571
|
// src/commands/context/commands/aggregate/list.ts
|
|
6540
|
-
import { UncachedAggregateClient as UncachedAggregateClient2 } from "@uniformdev/context/api";
|
|
6541
6572
|
var AggregateListModule = {
|
|
6542
6573
|
command: "list",
|
|
6543
6574
|
describe: "List aggregates",
|
|
@@ -6545,19 +6576,12 @@ var AggregateListModule = {
|
|
|
6545
6576
|
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
6546
6577
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6547
6578
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6548
|
-
const client =
|
|
6579
|
+
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6549
6580
|
const res = await client.get({});
|
|
6550
6581
|
emitWithFormat(res.aggregates, format, filename);
|
|
6551
6582
|
}
|
|
6552
6583
|
};
|
|
6553
6584
|
|
|
6554
|
-
// src/commands/context/commands/aggregate/pull.ts
|
|
6555
|
-
import { UncachedAggregateClient as UncachedAggregateClient3 } from "@uniformdev/context/api";
|
|
6556
|
-
|
|
6557
|
-
// src/commands/context/commands/aggregate/_util.ts
|
|
6558
|
-
var selectIdentifier8 = (source) => source.id;
|
|
6559
|
-
var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6560
|
-
|
|
6561
6585
|
// src/commands/context/aggregateEngineDataSource.ts
|
|
6562
6586
|
function createAggregateEngineDataSource({
|
|
6563
6587
|
client,
|
|
@@ -6652,7 +6676,7 @@ var AggregatePullModule = {
|
|
|
6652
6676
|
verbose
|
|
6653
6677
|
}) => {
|
|
6654
6678
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6655
|
-
const client =
|
|
6679
|
+
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6656
6680
|
const source = createAggregateEngineDataSource({ client });
|
|
6657
6681
|
let target;
|
|
6658
6682
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -6689,7 +6713,6 @@ var AggregatePullModule = {
|
|
|
6689
6713
|
};
|
|
6690
6714
|
|
|
6691
6715
|
// src/commands/context/commands/aggregate/push.ts
|
|
6692
|
-
import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev/context/api";
|
|
6693
6716
|
var AggregatePushModule = {
|
|
6694
6717
|
command: "push <directory>",
|
|
6695
6718
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
@@ -6726,7 +6749,7 @@ var AggregatePushModule = {
|
|
|
6726
6749
|
verbose
|
|
6727
6750
|
}) => {
|
|
6728
6751
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6729
|
-
const client =
|
|
6752
|
+
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6730
6753
|
let source;
|
|
6731
6754
|
const isPackage = isPathAPackageFile(directory);
|
|
6732
6755
|
if (isPackage) {
|
|
@@ -6759,7 +6782,6 @@ var AggregatePushModule = {
|
|
|
6759
6782
|
};
|
|
6760
6783
|
|
|
6761
6784
|
// src/commands/context/commands/aggregate/remove.ts
|
|
6762
|
-
import { UncachedAggregateClient as UncachedAggregateClient5 } from "@uniformdev/context/api";
|
|
6763
6785
|
var AggregateRemoveModule = {
|
|
6764
6786
|
command: "remove <id>",
|
|
6765
6787
|
aliases: ["delete", "rm"],
|
|
@@ -6773,13 +6795,12 @@ var AggregateRemoveModule = {
|
|
|
6773
6795
|
),
|
|
6774
6796
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
6775
6797
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6776
|
-
const client =
|
|
6798
|
+
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6777
6799
|
await client.remove({ aggregateId: id });
|
|
6778
6800
|
}
|
|
6779
6801
|
};
|
|
6780
6802
|
|
|
6781
6803
|
// src/commands/context/commands/aggregate/update.ts
|
|
6782
|
-
import { UncachedAggregateClient as UncachedAggregateClient6 } from "@uniformdev/context/api";
|
|
6783
6804
|
var AggregateUpdateModule = {
|
|
6784
6805
|
command: "update <filename>",
|
|
6785
6806
|
aliases: ["put"],
|
|
@@ -6793,7 +6814,7 @@ var AggregateUpdateModule = {
|
|
|
6793
6814
|
),
|
|
6794
6815
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
6795
6816
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6796
|
-
const client =
|
|
6817
|
+
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6797
6818
|
const file = readFileToObject(filename);
|
|
6798
6819
|
await client.upsert({ aggregate: file });
|
|
6799
6820
|
}
|
|
@@ -6813,8 +6834,15 @@ var AggregateModule = {
|
|
|
6813
6834
|
// src/commands/context/commands/enrichment.ts
|
|
6814
6835
|
import yargs20 from "yargs";
|
|
6815
6836
|
|
|
6816
|
-
// src/commands/context/commands/enrichment/
|
|
6837
|
+
// src/commands/context/commands/enrichment/_util.ts
|
|
6817
6838
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
6839
|
+
var selectIdentifier9 = (source) => source.id;
|
|
6840
|
+
var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6841
|
+
function getEnrichmentClient(options) {
|
|
6842
|
+
return new UncachedEnrichmentClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
6843
|
+
}
|
|
6844
|
+
|
|
6845
|
+
// src/commands/context/commands/enrichment/get.ts
|
|
6818
6846
|
var EnrichmentGetModule = {
|
|
6819
6847
|
command: "get <id>",
|
|
6820
6848
|
describe: "Fetch an enrichment category and its values",
|
|
@@ -6829,7 +6857,7 @@ var EnrichmentGetModule = {
|
|
|
6829
6857
|
),
|
|
6830
6858
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
6831
6859
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6832
|
-
const client =
|
|
6860
|
+
const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6833
6861
|
const res = (await client.get())?.enrichments?.filter((enr) => enr.id === id);
|
|
6834
6862
|
if (res.length === 0) {
|
|
6835
6863
|
console.error("Enrichment did not exist");
|
|
@@ -6841,7 +6869,6 @@ var EnrichmentGetModule = {
|
|
|
6841
6869
|
};
|
|
6842
6870
|
|
|
6843
6871
|
// src/commands/context/commands/enrichment/list.ts
|
|
6844
|
-
import { UncachedEnrichmentClient as UncachedEnrichmentClient2 } from "@uniformdev/context/api";
|
|
6845
6872
|
var EnrichmentListModule = {
|
|
6846
6873
|
command: "list",
|
|
6847
6874
|
describe: "List enrichments",
|
|
@@ -6849,19 +6876,12 @@ var EnrichmentListModule = {
|
|
|
6849
6876
|
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
6850
6877
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6851
6878
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6852
|
-
const client =
|
|
6879
|
+
const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6853
6880
|
const res = await client.get();
|
|
6854
6881
|
emitWithFormat(res.enrichments, format, filename);
|
|
6855
6882
|
}
|
|
6856
6883
|
};
|
|
6857
6884
|
|
|
6858
|
-
// src/commands/context/commands/enrichment/pull.ts
|
|
6859
|
-
import { UncachedEnrichmentClient as UncachedEnrichmentClient3 } from "@uniformdev/context/api";
|
|
6860
|
-
|
|
6861
|
-
// src/commands/context/commands/enrichment/_util.ts
|
|
6862
|
-
var selectIdentifier9 = (source) => source.id;
|
|
6863
|
-
var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
|
|
6864
|
-
|
|
6865
6885
|
// src/commands/context/enrichmentEngineDataSource.ts
|
|
6866
6886
|
function createEnrichmentEngineDataSource({
|
|
6867
6887
|
client
|
|
@@ -6988,7 +7008,7 @@ var EnrichmentPullModule = {
|
|
|
6988
7008
|
verbose
|
|
6989
7009
|
}) => {
|
|
6990
7010
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
6991
|
-
const client =
|
|
7011
|
+
const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
6992
7012
|
const source = createEnrichmentEngineDataSource({ client });
|
|
6993
7013
|
let target;
|
|
6994
7014
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -7025,7 +7045,6 @@ var EnrichmentPullModule = {
|
|
|
7025
7045
|
};
|
|
7026
7046
|
|
|
7027
7047
|
// src/commands/context/commands/enrichment/push.ts
|
|
7028
|
-
import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformdev/context/api";
|
|
7029
7048
|
var EnrichmentPushModule = {
|
|
7030
7049
|
command: "push <directory>",
|
|
7031
7050
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
@@ -7060,7 +7079,7 @@ var EnrichmentPushModule = {
|
|
|
7060
7079
|
verbose
|
|
7061
7080
|
}) => {
|
|
7062
7081
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
7063
|
-
const client =
|
|
7082
|
+
const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
7064
7083
|
let source;
|
|
7065
7084
|
const isPackage = isPathAPackageFile(directory);
|
|
7066
7085
|
if (isPackage) {
|
|
@@ -7092,7 +7111,6 @@ var EnrichmentPushModule = {
|
|
|
7092
7111
|
};
|
|
7093
7112
|
|
|
7094
7113
|
// src/commands/context/commands/enrichment/remove.ts
|
|
7095
|
-
import { UncachedEnrichmentClient as UncachedEnrichmentClient5 } from "@uniformdev/context/api";
|
|
7096
7114
|
var EnrichmentRemoveModule = {
|
|
7097
7115
|
command: "remove <id>",
|
|
7098
7116
|
aliases: ["delete", "rm"],
|
|
@@ -7106,7 +7124,7 @@ var EnrichmentRemoveModule = {
|
|
|
7106
7124
|
),
|
|
7107
7125
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
7108
7126
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7109
|
-
const client =
|
|
7127
|
+
const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
7110
7128
|
await client.removeCategory({ enrichmentId: id });
|
|
7111
7129
|
}
|
|
7112
7130
|
};
|
|
@@ -8120,13 +8138,13 @@ import yargs26 from "yargs";
|
|
|
8120
8138
|
import { readFileSync } from "fs";
|
|
8121
8139
|
|
|
8122
8140
|
// src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
|
|
8123
|
-
import { createLimitPolicy } from "@uniformdev/canvas";
|
|
8141
|
+
import { createLimitPolicy as createLimitPolicy2 } from "@uniformdev/canvas";
|
|
8124
8142
|
import { ApiClient } from "@uniformdev/context/api";
|
|
8125
8143
|
var ENDPOINT = "/api/v1/integration-edgehancers";
|
|
8126
8144
|
var EdgehancerClient = class extends ApiClient {
|
|
8127
8145
|
constructor(options) {
|
|
8128
8146
|
if (!options.limitPolicy) {
|
|
8129
|
-
options.limitPolicy =
|
|
8147
|
+
options.limitPolicy = createLimitPolicy2({});
|
|
8130
8148
|
}
|
|
8131
8149
|
super(options);
|
|
8132
8150
|
this.options = options;
|
|
@@ -8216,13 +8234,13 @@ var IntegrationEdgehancerModule = {
|
|
|
8216
8234
|
};
|
|
8217
8235
|
|
|
8218
8236
|
// src/commands/integration/commands/definition/DefinitionClient.ts
|
|
8219
|
-
import { createLimitPolicy as
|
|
8237
|
+
import { createLimitPolicy as createLimitPolicy3 } from "@uniformdev/canvas";
|
|
8220
8238
|
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
|
8221
8239
|
var ENDPOINT2 = "/api/v1/integration-definitions";
|
|
8222
8240
|
var DefinitionClient = class extends ApiClient2 {
|
|
8223
8241
|
constructor(options) {
|
|
8224
8242
|
if (!options.limitPolicy) {
|
|
8225
|
-
options.limitPolicy =
|
|
8243
|
+
options.limitPolicy = createLimitPolicy3({});
|
|
8226
8244
|
}
|
|
8227
8245
|
super(options);
|
|
8228
8246
|
this.options = options;
|
|
@@ -8301,13 +8319,13 @@ var IntegrationDefinitionModule = {
|
|
|
8301
8319
|
};
|
|
8302
8320
|
|
|
8303
8321
|
// src/commands/integration/commands/InstallClient.ts
|
|
8304
|
-
import { createLimitPolicy as
|
|
8322
|
+
import { createLimitPolicy as createLimitPolicy4 } from "@uniformdev/canvas";
|
|
8305
8323
|
import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
|
|
8306
8324
|
var ENDPOINT3 = "/api/v1/integration-installations";
|
|
8307
8325
|
var InstallClient = class extends ApiClient3 {
|
|
8308
8326
|
constructor(options) {
|
|
8309
8327
|
if (!options.limitPolicy) {
|
|
8310
|
-
options.limitPolicy =
|
|
8328
|
+
options.limitPolicy = createLimitPolicy4({});
|
|
8311
8329
|
}
|
|
8312
8330
|
super(options);
|
|
8313
8331
|
this.options = options;
|
|
@@ -8349,10 +8367,10 @@ var IntegrationInstallModule = {
|
|
|
8349
8367
|
)
|
|
8350
8368
|
)
|
|
8351
8369
|
),
|
|
8352
|
-
handler: async ({ apiHost, apiKey, proxy, type, configuration
|
|
8370
|
+
handler: async ({ apiHost, apiKey, proxy, type, configuration, project: projectId }) => {
|
|
8353
8371
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8354
8372
|
const client = new InstallClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
8355
|
-
const data =
|
|
8373
|
+
const data = configuration ? JSON.parse(configuration) : void 0;
|
|
8356
8374
|
await client.install({ data, type });
|
|
8357
8375
|
}
|
|
8358
8376
|
};
|
|
@@ -8461,7 +8479,7 @@ var package_default = {
|
|
|
8461
8479
|
"isomorphic-git": "1.25.2",
|
|
8462
8480
|
"js-yaml": "^4.1.0",
|
|
8463
8481
|
jsonwebtoken: "9.0.2",
|
|
8464
|
-
|
|
8482
|
+
mitt: "^3.0.1",
|
|
8465
8483
|
open: "10.1.0",
|
|
8466
8484
|
ora: "8.0.1",
|
|
8467
8485
|
"p-queue": "7.3.4",
|
|
@@ -8478,7 +8496,6 @@ var package_default = {
|
|
|
8478
8496
|
"@types/inquirer": "9.0.7",
|
|
8479
8497
|
"@types/js-yaml": "4.0.9",
|
|
8480
8498
|
"@types/jsonwebtoken": "9.0.5",
|
|
8481
|
-
"@types/lodash.isequalwith": "4.4.9",
|
|
8482
8499
|
"@types/node": "22.7.8",
|
|
8483
8500
|
"@types/yargs": "17.0.32"
|
|
8484
8501
|
},
|
|
@@ -9574,8 +9591,15 @@ import yargs33 from "yargs";
|
|
|
9574
9591
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
9575
9592
|
import yargs31 from "yargs";
|
|
9576
9593
|
|
|
9577
|
-
// src/commands/project-map/commands/ProjectMapDefinition/
|
|
9594
|
+
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
9578
9595
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
9596
|
+
var selectIdentifier13 = (source) => source.id;
|
|
9597
|
+
var selectDisplayName13 = (source) => `${source.name} (pid: ${source.id})`;
|
|
9598
|
+
function getProjectMapClient(options) {
|
|
9599
|
+
return new UncachedProjectMapClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
9600
|
+
}
|
|
9601
|
+
|
|
9602
|
+
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
9579
9603
|
var ProjectMapDefinitionGetModule = {
|
|
9580
9604
|
command: "get <id>",
|
|
9581
9605
|
describe: "Fetch a project map",
|
|
@@ -9590,7 +9614,7 @@ var ProjectMapDefinitionGetModule = {
|
|
|
9590
9614
|
),
|
|
9591
9615
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
9592
9616
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9593
|
-
const client =
|
|
9617
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9594
9618
|
const res = await client.getProjectMapDefinition({ projectMapId: id });
|
|
9595
9619
|
if (res.projectMaps.length === 0) {
|
|
9596
9620
|
console.error("ProjectMap does not exist");
|
|
@@ -9602,7 +9626,6 @@ var ProjectMapDefinitionGetModule = {
|
|
|
9602
9626
|
};
|
|
9603
9627
|
|
|
9604
9628
|
// src/commands/project-map/commands/ProjectMapDefinition/list.ts
|
|
9605
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient2 } from "@uniformdev/project-map";
|
|
9606
9629
|
var ProjectMapDefinitionListModule = {
|
|
9607
9630
|
command: "list",
|
|
9608
9631
|
describe: "List of project maps",
|
|
@@ -9610,15 +9633,12 @@ var ProjectMapDefinitionListModule = {
|
|
|
9610
9633
|
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
9611
9634
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
9612
9635
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9613
|
-
const client =
|
|
9636
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9614
9637
|
const res = await client.getProjectMapDefinitions();
|
|
9615
9638
|
emitWithFormat(res.projectMaps, format, filename);
|
|
9616
9639
|
}
|
|
9617
9640
|
};
|
|
9618
9641
|
|
|
9619
|
-
// src/commands/project-map/commands/ProjectMapDefinition/pull.ts
|
|
9620
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient3 } from "@uniformdev/project-map";
|
|
9621
|
-
|
|
9622
9642
|
// src/commands/project-map/package.ts
|
|
9623
9643
|
function readContextPackage2(filename, assertExists, verbose) {
|
|
9624
9644
|
if (verbose) {
|
|
@@ -9630,10 +9650,6 @@ function writeContextPackage2(filename, packageContents) {
|
|
|
9630
9650
|
writeUniformPackage(filename, packageContents);
|
|
9631
9651
|
}
|
|
9632
9652
|
|
|
9633
|
-
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
9634
|
-
var selectIdentifier13 = (source) => source.id;
|
|
9635
|
-
var selectDisplayName13 = (source) => `${source.name} (pid: ${source.id})`;
|
|
9636
|
-
|
|
9637
9653
|
// src/commands/project-map/ProjectMapDefinitionEngineDataSource.ts
|
|
9638
9654
|
function createProjectMapDefinitionEngineDataSource({
|
|
9639
9655
|
client
|
|
@@ -9708,7 +9724,7 @@ var ProjectMapDefinitionPullModule = {
|
|
|
9708
9724
|
verbose
|
|
9709
9725
|
}) => {
|
|
9710
9726
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
9711
|
-
const client =
|
|
9727
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9712
9728
|
const source = createProjectMapDefinitionEngineDataSource({ client });
|
|
9713
9729
|
let target;
|
|
9714
9730
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -9745,7 +9761,6 @@ var ProjectMapDefinitionPullModule = {
|
|
|
9745
9761
|
};
|
|
9746
9762
|
|
|
9747
9763
|
// src/commands/project-map/commands/ProjectMapDefinition/push.ts
|
|
9748
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformdev/project-map";
|
|
9749
9764
|
var ProjectMapDefinitionPushModule = {
|
|
9750
9765
|
command: "push <directory>",
|
|
9751
9766
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
@@ -9782,7 +9797,7 @@ var ProjectMapDefinitionPushModule = {
|
|
|
9782
9797
|
verbose
|
|
9783
9798
|
}) => {
|
|
9784
9799
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
9785
|
-
const client =
|
|
9800
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9786
9801
|
let source;
|
|
9787
9802
|
const isPackage = isPathAPackageFile(directory);
|
|
9788
9803
|
if (isPackage) {
|
|
@@ -9814,7 +9829,6 @@ var ProjectMapDefinitionPushModule = {
|
|
|
9814
9829
|
};
|
|
9815
9830
|
|
|
9816
9831
|
// src/commands/project-map/commands/ProjectMapDefinition/remove.ts
|
|
9817
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient5 } from "@uniformdev/project-map";
|
|
9818
9832
|
var ProjectMapDefinitionRemoveModule = {
|
|
9819
9833
|
command: "remove <id>",
|
|
9820
9834
|
aliases: ["delete", "rm"],
|
|
@@ -9826,13 +9840,12 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
9826
9840
|
),
|
|
9827
9841
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
9828
9842
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9829
|
-
const client =
|
|
9843
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9830
9844
|
await client.deleteProjectMap({ projectMapId: id });
|
|
9831
9845
|
}
|
|
9832
9846
|
};
|
|
9833
9847
|
|
|
9834
9848
|
// src/commands/project-map/commands/ProjectMapDefinition/update.ts
|
|
9835
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient6 } from "@uniformdev/project-map";
|
|
9836
9849
|
var ProjectMapDefinitionUpdateModule = {
|
|
9837
9850
|
command: "update <filename>",
|
|
9838
9851
|
aliases: ["put"],
|
|
@@ -9846,7 +9859,7 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
9846
9859
|
),
|
|
9847
9860
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
9848
9861
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9849
|
-
const client =
|
|
9862
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9850
9863
|
const file = readFileToObject(filename);
|
|
9851
9864
|
await client.upsertProjectMap({ projectMap: file });
|
|
9852
9865
|
}
|
|
@@ -9866,7 +9879,6 @@ var ProjectMapDefinitionModule = {
|
|
|
9866
9879
|
import yargs32 from "yargs";
|
|
9867
9880
|
|
|
9868
9881
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
9869
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
9870
9882
|
var ProjectMapNodeGetModule = {
|
|
9871
9883
|
command: "get <id> <projectMapId>",
|
|
9872
9884
|
describe: "Fetch a project map node",
|
|
@@ -9881,7 +9893,7 @@ var ProjectMapNodeGetModule = {
|
|
|
9881
9893
|
),
|
|
9882
9894
|
handler: async ({ apiHost, apiKey, proxy, id, projectMapId, format, project: projectId, filename }) => {
|
|
9883
9895
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9884
|
-
const client =
|
|
9896
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9885
9897
|
console.log("Debugging params for node get", { projectMapId, id, projectId });
|
|
9886
9898
|
const res = await client.getNodes({ projectMapId, id });
|
|
9887
9899
|
if (res.nodes?.length === 0) {
|
|
@@ -9894,7 +9906,6 @@ var ProjectMapNodeGetModule = {
|
|
|
9894
9906
|
};
|
|
9895
9907
|
|
|
9896
9908
|
// src/commands/project-map/commands/ProjectMapNode/list.ts
|
|
9897
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient8 } from "@uniformdev/project-map";
|
|
9898
9909
|
var ProjectMapNodeListModule = {
|
|
9899
9910
|
command: "list <projectMapId>",
|
|
9900
9911
|
describe: "List project map nodes",
|
|
@@ -9915,15 +9926,12 @@ var ProjectMapNodeListModule = {
|
|
|
9915
9926
|
),
|
|
9916
9927
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, format, filename, project: projectId, state }) => {
|
|
9917
9928
|
const fetch3 = nodeFetchProxy(proxy);
|
|
9918
|
-
const client =
|
|
9929
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
9919
9930
|
const res = await client.getNodes({ projectMapId, state: convertStateOption(state) });
|
|
9920
9931
|
emitWithFormat({ nodes: res.nodes ?? [], projectMapId }, format, filename);
|
|
9921
9932
|
}
|
|
9922
9933
|
};
|
|
9923
9934
|
|
|
9924
|
-
// src/commands/project-map/commands/ProjectMapNode/pull.ts
|
|
9925
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient9 } from "@uniformdev/project-map";
|
|
9926
|
-
|
|
9927
9935
|
// src/commands/project-map/commands/ProjectMapNode/_util.ts
|
|
9928
9936
|
var selectIdentifier14 = (source, projectId) => [
|
|
9929
9937
|
projectId + source.projectMapId + source.id,
|
|
@@ -10017,7 +10025,7 @@ var ProjectMapNodePullModule = {
|
|
|
10017
10025
|
verbose
|
|
10018
10026
|
}) => {
|
|
10019
10027
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
10020
|
-
const client =
|
|
10028
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10021
10029
|
const source = createProjectMapNodeEngineDataSource({ client, projectId });
|
|
10022
10030
|
let target;
|
|
10023
10031
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -10059,8 +10067,7 @@ var ProjectMapNodePullModule = {
|
|
|
10059
10067
|
|
|
10060
10068
|
// src/commands/project-map/commands/ProjectMapNode/push.ts
|
|
10061
10069
|
import {
|
|
10062
|
-
__INTERNAL_MISSING_PARENT_NODE_ERROR
|
|
10063
|
-
UncachedProjectMapClient as UncachedProjectMapClient10
|
|
10070
|
+
__INTERNAL_MISSING_PARENT_NODE_ERROR
|
|
10064
10071
|
} from "@uniformdev/project-map";
|
|
10065
10072
|
var ProjectMapNodePushModule = {
|
|
10066
10073
|
command: "push <directory>",
|
|
@@ -10098,7 +10105,7 @@ var ProjectMapNodePushModule = {
|
|
|
10098
10105
|
verbose
|
|
10099
10106
|
}) => {
|
|
10100
10107
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
10101
|
-
const client =
|
|
10108
|
+
const client = getProjectMapClient({
|
|
10102
10109
|
apiKey,
|
|
10103
10110
|
apiHost,
|
|
10104
10111
|
fetch: fetch3,
|
|
@@ -10168,7 +10175,6 @@ var ProjectMapNodePushModule = {
|
|
|
10168
10175
|
};
|
|
10169
10176
|
|
|
10170
10177
|
// src/commands/project-map/commands/ProjectMapNode/remove.ts
|
|
10171
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient11 } from "@uniformdev/project-map";
|
|
10172
10178
|
var ProjectMapNodeRemoveModule = {
|
|
10173
10179
|
command: "remove <id> <projectMapId>",
|
|
10174
10180
|
aliases: ["delete", "rm"],
|
|
@@ -10182,13 +10188,12 @@ var ProjectMapNodeRemoveModule = {
|
|
|
10182
10188
|
),
|
|
10183
10189
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, id, project: projectId }) => {
|
|
10184
10190
|
const fetch3 = nodeFetchProxy(proxy);
|
|
10185
|
-
const client =
|
|
10191
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10186
10192
|
await client.deleteProjectMapNode({ projectMapId, nodeId: id });
|
|
10187
10193
|
}
|
|
10188
10194
|
};
|
|
10189
10195
|
|
|
10190
10196
|
// src/commands/project-map/commands/ProjectMapNode/update.ts
|
|
10191
|
-
import { UncachedProjectMapClient as UncachedProjectMapClient12 } from "@uniformdev/project-map";
|
|
10192
10197
|
var ProjectMapNodeUpdateModule = {
|
|
10193
10198
|
command: "update <filename> <projectMapId>",
|
|
10194
10199
|
aliases: ["put"],
|
|
@@ -10202,7 +10207,7 @@ var ProjectMapNodeUpdateModule = {
|
|
|
10202
10207
|
),
|
|
10203
10208
|
handler: async ({ apiHost, apiKey, proxy, projectMapId, filename, project: projectId }) => {
|
|
10204
10209
|
const fetch3 = nodeFetchProxy(proxy);
|
|
10205
|
-
const client =
|
|
10210
|
+
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10206
10211
|
const file = readFileToObject(filename);
|
|
10207
10212
|
await client.upsertProjectMapNodes({ nodes: [{ node: file }], projectMapId });
|
|
10208
10213
|
}
|
|
@@ -10235,8 +10240,26 @@ import yargs35 from "yargs";
|
|
|
10235
10240
|
// src/commands/redirect/commands/redirect.ts
|
|
10236
10241
|
import yargs34 from "yargs";
|
|
10237
10242
|
|
|
10238
|
-
// src/commands/redirect/commands/RedirectDefinition/
|
|
10243
|
+
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
10239
10244
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
10245
|
+
var selectIdentifier15 = (source) => source.id;
|
|
10246
|
+
var selectFilename2 = (source) => {
|
|
10247
|
+
const index = source.sourceUrl.lastIndexOf("/");
|
|
10248
|
+
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
10249
|
+
};
|
|
10250
|
+
var selectDisplayName15 = (source) => {
|
|
10251
|
+
let pathName = source.sourceUrl;
|
|
10252
|
+
if (pathName.length > 30) {
|
|
10253
|
+
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
10254
|
+
pathName = "..." + pathName.substring(slashIndex);
|
|
10255
|
+
}
|
|
10256
|
+
return `${pathName} (id: ${source.id})`;
|
|
10257
|
+
};
|
|
10258
|
+
function getRedirectClient(options) {
|
|
10259
|
+
return new UncachedRedirectClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
10260
|
+
}
|
|
10261
|
+
|
|
10262
|
+
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
10240
10263
|
var RedirectDefinitionGetModule = {
|
|
10241
10264
|
command: "get <id>",
|
|
10242
10265
|
describe: "Fetch a redirect",
|
|
@@ -10251,7 +10274,7 @@ var RedirectDefinitionGetModule = {
|
|
|
10251
10274
|
),
|
|
10252
10275
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
10253
10276
|
const fetch3 = nodeFetchProxy(proxy);
|
|
10254
|
-
const client =
|
|
10277
|
+
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10255
10278
|
const res = await client.getRedirect({ id });
|
|
10256
10279
|
if (!res) {
|
|
10257
10280
|
console.error("Redirect does not exist");
|
|
@@ -10263,7 +10286,6 @@ var RedirectDefinitionGetModule = {
|
|
|
10263
10286
|
};
|
|
10264
10287
|
|
|
10265
10288
|
// src/commands/redirect/commands/RedirectDefinition/list.ts
|
|
10266
|
-
import { UncachedRedirectClient as UncachedRedirectClient2 } from "@uniformdev/redirect";
|
|
10267
10289
|
var RedirectDefinitionListModule = {
|
|
10268
10290
|
command: "list",
|
|
10269
10291
|
describe: "List of redirects",
|
|
@@ -10271,15 +10293,12 @@ var RedirectDefinitionListModule = {
|
|
|
10271
10293
|
builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
|
|
10272
10294
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
10273
10295
|
const fetch3 = nodeFetchProxy(proxy);
|
|
10274
|
-
const client =
|
|
10296
|
+
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10275
10297
|
const res = await client.getRedirects({});
|
|
10276
10298
|
emitWithFormat(res, format, filename);
|
|
10277
10299
|
}
|
|
10278
10300
|
};
|
|
10279
10301
|
|
|
10280
|
-
// src/commands/redirect/commands/RedirectDefinition/pull.ts
|
|
10281
|
-
import { UncachedRedirectClient as UncachedRedirectClient3 } from "@uniformdev/redirect";
|
|
10282
|
-
|
|
10283
10302
|
// src/commands/redirect/package.ts
|
|
10284
10303
|
function readContextPackage3(filename, assertExists, verbose) {
|
|
10285
10304
|
if (verbose) {
|
|
@@ -10291,21 +10310,6 @@ function writeContextPackage3(filename, packageContents) {
|
|
|
10291
10310
|
writeUniformPackage(filename, packageContents);
|
|
10292
10311
|
}
|
|
10293
10312
|
|
|
10294
|
-
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
10295
|
-
var selectIdentifier15 = (source) => source.id;
|
|
10296
|
-
var selectFilename2 = (source) => {
|
|
10297
|
-
const index = source.sourceUrl.lastIndexOf("/");
|
|
10298
|
-
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
10299
|
-
};
|
|
10300
|
-
var selectDisplayName15 = (source) => {
|
|
10301
|
-
let pathName = source.sourceUrl;
|
|
10302
|
-
if (pathName.length > 30) {
|
|
10303
|
-
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
10304
|
-
pathName = "..." + pathName.substring(slashIndex);
|
|
10305
|
-
}
|
|
10306
|
-
return `${pathName} (id: ${source.id})`;
|
|
10307
|
-
};
|
|
10308
|
-
|
|
10309
10313
|
// src/commands/redirect/RedirectEngineDataSource.ts
|
|
10310
10314
|
function createRedirectDefinitionEngineDataSource({
|
|
10311
10315
|
client
|
|
@@ -10378,7 +10382,7 @@ var RedirectDefinitionPullModule = {
|
|
|
10378
10382
|
verbose
|
|
10379
10383
|
}) => {
|
|
10380
10384
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
10381
|
-
const client =
|
|
10385
|
+
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10382
10386
|
const source = createRedirectDefinitionEngineDataSource({ client });
|
|
10383
10387
|
let target;
|
|
10384
10388
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -10416,7 +10420,6 @@ var RedirectDefinitionPullModule = {
|
|
|
10416
10420
|
};
|
|
10417
10421
|
|
|
10418
10422
|
// src/commands/redirect/commands/RedirectDefinition/push.ts
|
|
10419
|
-
import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/redirect";
|
|
10420
10423
|
var RedirectDefinitionPushModule = {
|
|
10421
10424
|
command: "push <directory>",
|
|
10422
10425
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
@@ -10453,7 +10456,7 @@ var RedirectDefinitionPushModule = {
|
|
|
10453
10456
|
verbose
|
|
10454
10457
|
}) => {
|
|
10455
10458
|
const fetch3 = nodeFetchProxy(proxy, verbose);
|
|
10456
|
-
const client =
|
|
10459
|
+
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10457
10460
|
let source;
|
|
10458
10461
|
const isPackage = isPathAPackageFile(directory);
|
|
10459
10462
|
if (isPackage) {
|
|
@@ -10485,7 +10488,6 @@ var RedirectDefinitionPushModule = {
|
|
|
10485
10488
|
};
|
|
10486
10489
|
|
|
10487
10490
|
// src/commands/redirect/commands/RedirectDefinition/remove.ts
|
|
10488
|
-
import { UncachedRedirectClient as UncachedRedirectClient5 } from "@uniformdev/redirect";
|
|
10489
10491
|
var RedirectDefinitionRemoveModule = {
|
|
10490
10492
|
command: "remove <id>",
|
|
10491
10493
|
aliases: ["delete", "rm"],
|
|
@@ -10497,13 +10499,12 @@ var RedirectDefinitionRemoveModule = {
|
|
|
10497
10499
|
),
|
|
10498
10500
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
10499
10501
|
const fetch3 = nodeFetchProxy(proxy);
|
|
10500
|
-
const client =
|
|
10502
|
+
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10501
10503
|
await client.deleteRedirect(id);
|
|
10502
10504
|
}
|
|
10503
10505
|
};
|
|
10504
10506
|
|
|
10505
10507
|
// src/commands/redirect/commands/RedirectDefinition/update.ts
|
|
10506
|
-
import { UncachedRedirectClient as UncachedRedirectClient6 } from "@uniformdev/redirect";
|
|
10507
10508
|
var RedirectDefinitionUpdateModule = {
|
|
10508
10509
|
command: "update <filename>",
|
|
10509
10510
|
aliases: ["put"],
|
|
@@ -10517,7 +10518,7 @@ var RedirectDefinitionUpdateModule = {
|
|
|
10517
10518
|
),
|
|
10518
10519
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
10519
10520
|
const fetch3 = nodeFetchProxy(proxy);
|
|
10520
|
-
const client =
|
|
10521
|
+
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
10521
10522
|
const file = readFileToObject(filename);
|
|
10522
10523
|
await client.upsertRedirect(file);
|
|
10523
10524
|
}
|
|
@@ -10553,28 +10554,53 @@ async function spinPromise(action, options) {
|
|
|
10553
10554
|
const { successText, failText } = typeof options === "object" ? options : { successText: void 0, failText: void 0 };
|
|
10554
10555
|
const spinner = ora2(options).start();
|
|
10555
10556
|
const consoleReplay = [];
|
|
10556
|
-
const revertLog = patchConsole(
|
|
10557
|
-
|
|
10558
|
-
|
|
10557
|
+
const revertLog = patchConsole({
|
|
10558
|
+
fn: "log",
|
|
10559
|
+
ora: spinner,
|
|
10560
|
+
replay: consoleReplay,
|
|
10561
|
+
defaultText: options.text
|
|
10562
|
+
});
|
|
10563
|
+
const revertError = patchConsole({
|
|
10564
|
+
fn: "error",
|
|
10565
|
+
ora: spinner,
|
|
10566
|
+
replay: consoleReplay,
|
|
10567
|
+
defaultText: options.text
|
|
10568
|
+
});
|
|
10569
|
+
const revertWarning = patchConsole({
|
|
10570
|
+
fn: "warn",
|
|
10571
|
+
ora: spinner,
|
|
10572
|
+
replay: consoleReplay,
|
|
10573
|
+
defaultText: options.text
|
|
10574
|
+
});
|
|
10559
10575
|
const unpatchConsole = () => {
|
|
10560
10576
|
revertLog();
|
|
10561
10577
|
revertError();
|
|
10562
10578
|
revertWarning();
|
|
10563
10579
|
};
|
|
10564
10580
|
let thrownError = void 0;
|
|
10581
|
+
const executeReplay = () => {
|
|
10582
|
+
unpatchConsole();
|
|
10583
|
+
replayConsole(consoleReplay);
|
|
10584
|
+
};
|
|
10585
|
+
const executeReplayOnSigint = () => {
|
|
10586
|
+
executeReplay();
|
|
10587
|
+
process.exit(1);
|
|
10588
|
+
};
|
|
10589
|
+
process.on("SIGINT", executeReplayOnSigint);
|
|
10565
10590
|
try {
|
|
10566
10591
|
const result = await action;
|
|
10567
|
-
spinner.
|
|
10592
|
+
const finalStatusText = spinner.text.startsWith(options.text) && spinner.text.length > options.text.length ? spinner.text.slice(options.text.length).trim() : `\u2699\uFE0F compared: ${numPad(0)} changes: 0`;
|
|
10593
|
+
const padding = " ".repeat(Math.max(4, 40 - successText.length));
|
|
10594
|
+
spinner.succeed(successText + padding + finalStatusText);
|
|
10568
10595
|
return result;
|
|
10569
10596
|
} catch (error) {
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
spinner.fail(failText === void 0 ? void 0 : failText(error, capturedConsole));
|
|
10597
|
+
executeReplay();
|
|
10598
|
+
spinner.fail(failText?.(error));
|
|
10573
10599
|
thrownError = error;
|
|
10574
10600
|
} finally {
|
|
10575
|
-
|
|
10601
|
+
process.off("SIGINT", executeReplayOnSigint);
|
|
10576
10602
|
if (!thrownError) {
|
|
10577
|
-
|
|
10603
|
+
executeReplay();
|
|
10578
10604
|
}
|
|
10579
10605
|
}
|
|
10580
10606
|
if (thrownError) {
|
|
@@ -10586,20 +10612,51 @@ function replayConsole(replay) {
|
|
|
10586
10612
|
console[fn](...args);
|
|
10587
10613
|
}
|
|
10588
10614
|
}
|
|
10589
|
-
function patchConsole(
|
|
10615
|
+
function patchConsole({
|
|
10616
|
+
fn,
|
|
10617
|
+
ora: ora3,
|
|
10618
|
+
replay = [],
|
|
10619
|
+
defaultText
|
|
10620
|
+
}) {
|
|
10590
10621
|
const original = console[fn];
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10622
|
+
const handleSyncStatusUpdate = ({
|
|
10623
|
+
compared,
|
|
10624
|
+
changeCount,
|
|
10625
|
+
changesApplied,
|
|
10626
|
+
fetched
|
|
10627
|
+
}) => {
|
|
10628
|
+
if (compared === 0 && fetched === 0) {
|
|
10629
|
+
return;
|
|
10630
|
+
}
|
|
10631
|
+
const clauses = [];
|
|
10632
|
+
if (fetched > 0 && compared === 0) {
|
|
10633
|
+
clauses.push(`fetching: ${numPad(fetched)}`);
|
|
10634
|
+
}
|
|
10635
|
+
if (compared > 0) {
|
|
10636
|
+
clauses.push(`compared: ${numPad(compared)}`);
|
|
10637
|
+
}
|
|
10638
|
+
if (changesApplied === 0) {
|
|
10639
|
+
clauses.push(`changes: ${changeCount}`);
|
|
10594
10640
|
} else {
|
|
10595
|
-
|
|
10641
|
+
clauses.push(`applied: ${changesApplied}/${changeCount}`);
|
|
10596
10642
|
}
|
|
10643
|
+
const statusText = clauses.join(" ");
|
|
10644
|
+
const padding = " ".repeat(Math.max(4, 40 - defaultText.length));
|
|
10645
|
+
ora3.text = `${defaultText}${padding}\u2699\uFE0F ${statusText}`;
|
|
10646
|
+
};
|
|
10647
|
+
syncEngineEvents.on("statusUpdate", handleSyncStatusUpdate);
|
|
10648
|
+
console[fn] = (...text) => {
|
|
10597
10649
|
replay.push({ fn, args: text });
|
|
10598
10650
|
};
|
|
10599
10651
|
return () => {
|
|
10600
10652
|
console[fn] = original;
|
|
10653
|
+
syncEngineEvents.off("statusUpdate", handleSyncStatusUpdate);
|
|
10601
10654
|
};
|
|
10602
10655
|
}
|
|
10656
|
+
function numPad(num, spaces = 6) {
|
|
10657
|
+
const numbah = num.toString(10);
|
|
10658
|
+
return numbah + " ".repeat(Math.max(0, spaces - numbah.length));
|
|
10659
|
+
}
|
|
10603
10660
|
|
|
10604
10661
|
// src/commands/sync/commands/pull.ts
|
|
10605
10662
|
var SyncPullModule = {
|
|
@@ -10768,19 +10825,102 @@ var SyncPushModule = {
|
|
|
10768
10825
|
}
|
|
10769
10826
|
}
|
|
10770
10827
|
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
10771
|
-
|
|
10828
|
+
try {
|
|
10829
|
+
await spinPromise(
|
|
10830
|
+
ComponentPatternPublishModule.handler({
|
|
10831
|
+
...otherParams,
|
|
10832
|
+
patternType: "component",
|
|
10833
|
+
onlyPatterns: true,
|
|
10834
|
+
all: true
|
|
10835
|
+
}),
|
|
10836
|
+
{
|
|
10837
|
+
text: "publishing component patterns...",
|
|
10838
|
+
successText: "published component patterns",
|
|
10839
|
+
failText(error) {
|
|
10840
|
+
return `publishing component patterns
|
|
10841
|
+
|
|
10842
|
+
${error.stack ?? error.message}`;
|
|
10843
|
+
}
|
|
10844
|
+
}
|
|
10845
|
+
);
|
|
10846
|
+
} catch {
|
|
10847
|
+
process.exit(1);
|
|
10848
|
+
}
|
|
10772
10849
|
}
|
|
10773
10850
|
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
10774
|
-
|
|
10851
|
+
try {
|
|
10852
|
+
await spinPromise(
|
|
10853
|
+
CompositionPatternPublishModule.handler({
|
|
10854
|
+
...otherParams,
|
|
10855
|
+
all: true,
|
|
10856
|
+
onlyPatterns: true,
|
|
10857
|
+
patternType: "composition"
|
|
10858
|
+
}),
|
|
10859
|
+
{
|
|
10860
|
+
text: "publishing composition patterns...",
|
|
10861
|
+
successText: "published composition patterns",
|
|
10862
|
+
failText(error) {
|
|
10863
|
+
return `publishing composition patterns
|
|
10864
|
+
|
|
10865
|
+
${error.stack ?? error.message}`;
|
|
10866
|
+
}
|
|
10867
|
+
}
|
|
10868
|
+
);
|
|
10869
|
+
} catch {
|
|
10870
|
+
process.exit(1);
|
|
10871
|
+
}
|
|
10775
10872
|
}
|
|
10776
10873
|
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
10777
|
-
|
|
10874
|
+
try {
|
|
10875
|
+
await spinPromise(
|
|
10876
|
+
CompositionPublishModule.handler({
|
|
10877
|
+
...otherParams,
|
|
10878
|
+
all: true,
|
|
10879
|
+
onlyCompositions: true
|
|
10880
|
+
}),
|
|
10881
|
+
{
|
|
10882
|
+
text: "publishing compositions...",
|
|
10883
|
+
successText: "published compositions",
|
|
10884
|
+
failText(error) {
|
|
10885
|
+
return `publishing compositions
|
|
10886
|
+
|
|
10887
|
+
${error.stack ?? error.message}`;
|
|
10888
|
+
}
|
|
10889
|
+
}
|
|
10890
|
+
);
|
|
10891
|
+
} catch {
|
|
10892
|
+
process.exit(1);
|
|
10893
|
+
}
|
|
10778
10894
|
}
|
|
10779
10895
|
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
10780
|
-
|
|
10896
|
+
try {
|
|
10897
|
+
await spinPromise(EntryPublishModule.handler({ ...otherParams, all: true }), {
|
|
10898
|
+
text: "publishing entries...",
|
|
10899
|
+
successText: "published entries",
|
|
10900
|
+
failText(error) {
|
|
10901
|
+
return `publishing entries
|
|
10902
|
+
|
|
10903
|
+
${error.stack ?? error.message}`;
|
|
10904
|
+
}
|
|
10905
|
+
});
|
|
10906
|
+
} catch {
|
|
10907
|
+
process.exit(1);
|
|
10908
|
+
}
|
|
10781
10909
|
}
|
|
10782
10910
|
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
10783
|
-
|
|
10911
|
+
try {
|
|
10912
|
+
await spinPromise(EntryPatternPublishModule.handler({ ...otherParams, all: true }), {
|
|
10913
|
+
text: "publishing entry patterns...",
|
|
10914
|
+
successText: "published entry patterns",
|
|
10915
|
+
failText(error) {
|
|
10916
|
+
return `publishing entry patterns
|
|
10917
|
+
|
|
10918
|
+
${error.stack ?? error.message}`;
|
|
10919
|
+
}
|
|
10920
|
+
});
|
|
10921
|
+
} catch {
|
|
10922
|
+
process.exit(1);
|
|
10923
|
+
}
|
|
10784
10924
|
}
|
|
10785
10925
|
}
|
|
10786
10926
|
};
|
|
@@ -11067,12 +11207,9 @@ First found was: v${firstVersion}`;
|
|
|
11067
11207
|
// src/index.ts
|
|
11068
11208
|
dotenv.config();
|
|
11069
11209
|
var yarggery = yargs37(hideBin(process.argv));
|
|
11070
|
-
var
|
|
11071
|
-
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
11210
|
+
var defaultConfig2 = loadConfig(null);
|
|
11072
11211
|
yarggery.option("verbose", {
|
|
11073
11212
|
describe: "Include verbose logging",
|
|
11074
11213
|
default: false,
|
|
11075
11214
|
type: "boolean"
|
|
11076
|
-
}).scriptName("uniform").config(
|
|
11077
|
-
return {};
|
|
11078
|
-
}).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).command(IntegrationCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;
|
|
11215
|
+
}).scriptName("uniform").config(defaultConfig2).config("config", "Specify a custom Uniform CLI config file", (configPath) => loadConfig(configPath)).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).command(IntegrationCommand).recommendCommands().demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).parse();
|