@uniformdev/cli 19.211.0 → 19.211.1-alpha.11

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