@uniformdev/cli 19.209.1 → 19.210.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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,
@@ -112,29 +109,48 @@ var cleanFileName = (proposedFileName) => {
112
109
  return proposedFileName.replace(/[/<>$+%>!`&*'|{}?"=:\\@]/g, "-");
113
110
  };
114
111
  var loadConfig = (configPath) => {
115
- const moduleName = "uniform";
116
- const syncCosmicExplorer = cosmiconfigSync("uniform", {
117
- searchPlaces: [`${moduleName}.config.js`, `${moduleName}.config.ts`, `${moduleName}.config.json`],
118
- loaders: {
119
- ".ts": TypeScriptLoader()
120
- }
121
- });
122
- if (configPath) {
123
- if (!fs.existsSync(configPath)) {
124
- throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
112
+ try {
113
+ const moduleName = "uniform";
114
+ const syncCosmicExplorer = cosmiconfigSync("uniform", {
115
+ searchPlaces: [`${moduleName}.config.js`, `${moduleName}.config.ts`, `${moduleName}.config.json`],
116
+ loaders: {
117
+ ".ts": TypeScriptLoader()
118
+ }
119
+ });
120
+ let loadedConfig;
121
+ if (configPath) {
122
+ if (!fs.existsSync(configPath)) {
123
+ throw new Error(
124
+ `Invalid --config file path: ${configPath}. File does not exist.
125
+
126
+ ${defaultConfigContents}`
127
+ );
128
+ }
129
+ loadedConfig = syncCosmicExplorer.load(configPath);
130
+ } else {
131
+ loadedConfig = syncCosmicExplorer.search();
125
132
  }
126
- const configFile = syncCosmicExplorer.load(configPath);
127
- if (!configFile?.config.serialization) {
133
+ if (loadedConfig && !loadedConfig.config.serialization) {
128
134
  throw new Error(
129
- `Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
135
+ `Invalid configuration file: ${loadedConfig?.filepath}. Missing serialization configuration.
136
+
137
+ ${defaultConfigContents}`
130
138
  );
131
139
  }
132
- return applyDefaultSyncConfiguration(configFile?.config ?? {});
133
- } else {
134
- const searchedForm = syncCosmicExplorer.search();
135
- return applyDefaultSyncConfiguration(searchedForm?.config ?? {});
140
+ return applyDefaultSyncConfiguration(loadedConfig?.config ?? {});
141
+ } catch (error) {
142
+ console.error(error.message);
143
+ process.exit(1);
136
144
  }
137
145
  };
146
+ var defaultConfigContents = `Here is an example uniform.config.ts for reference:
147
+
148
+ import { uniformConfig } from '@uniformdev/cli/config';
149
+
150
+ export default uniformConfig({
151
+ preset: 'all',
152
+ });
153
+ `;
138
154
 
139
155
  // src/sync/fileSyncEngineDataSource.ts
140
156
  async function createFileSyncEngineDataSource({
@@ -169,7 +185,7 @@ async function createFileSyncEngineDataSource({
169
185
  for (const filename of filenames) {
170
186
  const fullFilename = join(directory, filename);
171
187
  try {
172
- const contents = await readFileToObject(fullFilename);
188
+ const contents = readFileToObject(fullFilename);
173
189
  const displayName = selectDisplayName16(contents);
174
190
  const object = {
175
191
  id: selectIdentifier16(contents),
@@ -232,27 +248,76 @@ function writeUniformPackage(filename, packageContents) {
232
248
 
233
249
  // src/sync/syncEngine.ts
234
250
  import { diffJson, diffLines } from "diff";
235
- 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();
236
306
  async function syncEngine({
237
307
  source,
238
308
  target,
239
- compareContents = (source2, target2) => {
240
- return isEqualWith(
241
- source2.object,
242
- target2.object,
243
- (_a, _b, key) => key === "created" || key === "modified" || key === "updated" ? true : void 0
244
- );
245
- },
309
+ compareContents = (foo, bar) => serializedDequal(foo.object, bar.object),
246
310
  mode,
247
311
  allowEmptySource = false,
248
312
  whatIf = false,
249
- // eslint-disable-next-line @typescript-eslint/no-empty-function
250
313
  log: log2 = () => {
251
314
  },
252
315
  onBeforeCompareObjects,
253
316
  onBeforeWriteObject,
254
317
  onError
318
+ //verbose = false,
255
319
  }) {
320
+ const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
256
321
  const targetItems = /* @__PURE__ */ new Map();
257
322
  const deleteTracker = /* @__PURE__ */ new Set();
258
323
  const processDelete = async (object) => {
@@ -261,6 +326,7 @@ async function syncEngine({
261
326
  try {
262
327
  if (!whatIf) {
263
328
  await target.deleteObject(object.providerId, object);
329
+ status.changesApplied++;
264
330
  }
265
331
  } catch (e) {
266
332
  if (onError) {
@@ -275,11 +341,12 @@ async function syncEngine({
275
341
  providerId: object.providerId,
276
342
  displayName: object.displayName ?? object.providerId,
277
343
  whatIf,
278
- diff: diffLines(JSON.stringify(object.object, null, 2), "")
344
+ diff: () => diffLines(JSON.stringify(object.object, null, 2), "")
279
345
  });
280
346
  }
281
347
  };
282
348
  for await (const obj of target.objects) {
349
+ status.fetched++;
283
350
  if (Array.isArray(obj.id)) {
284
351
  obj.id.forEach((o) => targetItems.set(o, obj));
285
352
  } else {
@@ -292,16 +359,20 @@ async function syncEngine({
292
359
  sourceHasItems = true;
293
360
  const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
294
361
  const targetObject = targetItems.get(ids[0]);
362
+ status.compared++;
295
363
  const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o?.object !== targetObject?.object);
296
- if (targetObject && invalidTargetObjects.length == 0) {
364
+ if (targetObject && invalidTargetObjects.length === 0) {
297
365
  sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
298
- if (!compareContents(sourceObject, targetObject)) {
366
+ const compareResult = compareContents(sourceObject, targetObject);
367
+ if (!compareResult) {
299
368
  if (mode === "createOrUpdate" || mode === "mirror") {
369
+ status.changeCount++;
300
370
  const process2 = async (sourceObject2, targetObject2) => {
301
371
  try {
302
372
  if (!whatIf) {
303
373
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
304
374
  await target.writeObject(finalSourceObject, targetObject2);
375
+ status.changesApplied++;
305
376
  }
306
377
  } catch (e) {
307
378
  if (onError) {
@@ -316,7 +387,7 @@ async function syncEngine({
316
387
  providerId: sourceObject2.providerId,
317
388
  displayName: sourceObject2.displayName ?? sourceObject2.providerId,
318
389
  whatIf,
319
- diff: diffJson(targetObject2.object, sourceObject2.object)
390
+ diff: () => diffJson(targetObject2.object, sourceObject2.object)
320
391
  });
321
392
  }
322
393
  };
@@ -325,11 +396,13 @@ async function syncEngine({
325
396
  }
326
397
  ids.forEach((i) => targetItems.delete(i));
327
398
  } else {
328
- const process2 = async (sourceObject2, id) => {
399
+ status.changeCount++;
400
+ const processUpsert = async (sourceObject2, id) => {
329
401
  try {
330
402
  if (!whatIf) {
331
403
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
332
404
  await target.writeObject(finalSourceObject);
405
+ status.changesApplied++;
333
406
  }
334
407
  } catch (e) {
335
408
  if (onError) {
@@ -344,7 +417,7 @@ async function syncEngine({
344
417
  providerId: id,
345
418
  displayName: sourceObject2.displayName ?? sourceObject2.providerId,
346
419
  whatIf,
347
- diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
420
+ diff: () => diffLines("", JSON.stringify(sourceObject2.object, null, 2))
348
421
  });
349
422
  }
350
423
  };
@@ -352,18 +425,19 @@ async function syncEngine({
352
425
  [...invalidTargetObjects, targetObject].forEach((o) => {
353
426
  (Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
354
427
  });
355
- const deletes = invalidTargetObjects.filter((io) => typeof io !== "undefined").map((io) => {
356
- return () => processDelete(io);
357
- });
428
+ const deletes = invalidTargetObjects.filter((invalidTargetObject) => typeof invalidTargetObject !== "undefined").map((invalidTargetObject) => () => processDelete(invalidTargetObject));
358
429
  if (targetObject) {
359
430
  deletes.push(() => processDelete(targetObject));
360
431
  }
361
- 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
+ );
362
435
  } else {
363
- actions.push(() => process2(sourceObject, ids[0]));
436
+ actions.push(() => processUpsert(sourceObject, ids[0]));
364
437
  }
365
438
  }
366
439
  }
440
+ status.compared += targetItems.size;
367
441
  if (mode === "mirror") {
368
442
  if (!sourceHasItems && !allowEmptySource && targetItems.size > 0) {
369
443
  throw new Error(
@@ -389,6 +463,51 @@ ${innerError}`
389
463
  Object.setPrototypeOf(this, _SyncEngineError.prototype);
390
464
  }
391
465
  };
466
+ var ReactiveStatusUpdate = class {
467
+ constructor(onChange) {
468
+ this._fetched = 0;
469
+ this._compared = 0;
470
+ this._changeCount = 0;
471
+ this._changesApplied = 0;
472
+ this.onChange = onChange;
473
+ }
474
+ emitChange() {
475
+ this.onChange?.({
476
+ fetched: this._fetched,
477
+ compared: this._compared,
478
+ changeCount: this._changeCount,
479
+ changesApplied: this._changesApplied
480
+ });
481
+ }
482
+ get fetched() {
483
+ return this._fetched;
484
+ }
485
+ set fetched(value) {
486
+ this._fetched = value;
487
+ this.emitChange();
488
+ }
489
+ get compared() {
490
+ return this._compared;
491
+ }
492
+ set compared(value) {
493
+ this._compared = value;
494
+ this.emitChange();
495
+ }
496
+ get changeCount() {
497
+ return this._changeCount;
498
+ }
499
+ set changeCount(value) {
500
+ this._changeCount = value;
501
+ this.emitChange();
502
+ }
503
+ get changesApplied() {
504
+ return this._changesApplied;
505
+ }
506
+ set changesApplied(value) {
507
+ this._changesApplied = value;
508
+ this.emitChange();
509
+ }
510
+ };
392
511
 
393
512
  // src/sync/syncEngineConsoleLogger.ts
394
513
  import { gray, green, red as red2, white, yellow } from "colorette";
@@ -409,7 +528,8 @@ function createSyncEngineConsoleLogger(options) {
409
528
  }
410
529
  let diffString = "";
411
530
  if (diffMode === "on" || diffMode === "update" && action === "update") {
412
- diffString = "\n" + diff.map((change) => {
531
+ const diffResult = diff();
532
+ diffString = "\n" + diffResult.map((change) => {
413
533
  if (change.added) {
414
534
  return green(change.value);
415
535
  }
@@ -432,6 +552,29 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
432
552
  };
433
553
  }
434
554
 
555
+ // src/commands/canvas/commands/asset/_util.ts
556
+ import { UncachedAssetClient } from "@uniformdev/assets";
557
+ import { UncachedFileClient } from "@uniformdev/files";
558
+
559
+ // src/cliLimitPolicy.ts
560
+ import { createLimitPolicy } from "@uniformdev/canvas";
561
+ var limit = process.env.UNIFORM_CLI_CONCURRENCY_LIMIT ? parseInt(process.env.UNIFORM_CLI_CONCURRENCY_LIMIT) : 10;
562
+ var cliLimitPolicy = createLimitPolicy({
563
+ throttle: { interval: 1e3, limit: 10 },
564
+ retry: { retries: 3, factor: 2 },
565
+ limit
566
+ });
567
+
568
+ // src/commands/canvas/commands/asset/_util.ts
569
+ var selectAssetIdentifier = (e) => e.asset._id;
570
+ var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
571
+ function getAssetClient(options) {
572
+ return new UncachedAssetClient({ ...options, limitPolicy: cliLimitPolicy });
573
+ }
574
+ function getFileClient(options) {
575
+ return new UncachedFileClient({ ...options, limitPolicy: cliLimitPolicy });
576
+ }
577
+
435
578
  // src/commands/canvas/commands/asset/get.ts
436
579
  var AssetGetModule = {
437
580
  command: "get <id>",
@@ -441,7 +584,6 @@ var AssetGetModule = {
441
584
  withFormatOptions(
442
585
  withApiOptions(
443
586
  withProjectOptions(
444
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
445
587
  yargs38.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
446
588
  )
447
589
  )
@@ -450,7 +592,7 @@ var AssetGetModule = {
450
592
  ),
451
593
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
452
594
  const fetch3 = nodeFetchProxy(proxy, verbose);
453
- const client = new UncachedAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
595
+ const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
454
596
  const res = await client.get({ offset: 0, limit: 1, assetId: id });
455
597
  if (!res) {
456
598
  throw new Error(`Asset with ID ${id} not found`);
@@ -460,23 +602,18 @@ var AssetGetModule = {
460
602
  };
461
603
 
462
604
  // src/commands/canvas/commands/asset/list.ts
463
- import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets";
464
605
  var AssetListModule = {
465
606
  command: "list",
466
607
  describe: "List assets",
467
608
  builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
468
609
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
469
610
  const fetch3 = nodeFetchProxy(proxy, verbose);
470
- const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
611
+ const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
471
612
  const res = await client.get({ offset: 0, limit: 1e3 });
472
613
  emitWithFormat(res.assets, format, filename);
473
614
  }
474
615
  };
475
616
 
476
- // src/commands/canvas/commands/asset/pull.ts
477
- import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
478
- import { UncachedFileClient } from "@uniformdev/files";
479
-
480
617
  // src/files/index.ts
481
618
  import { preferredType } from "@thi.ng/mime";
482
619
  import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
@@ -814,10 +951,6 @@ var legacyUrlToFileName = (url) => {
814
951
  // src/commands/canvas/assetEngineDataSource.ts
815
952
  import { convertAssetToPutAsset } from "@uniformdev/assets";
816
953
 
817
- // src/commands/canvas/commands/asset/_util.ts
818
- var selectAssetIdentifier = (e) => e.asset._id;
819
- var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
820
-
821
954
  // src/commands/canvas/util.ts
822
955
  import {
823
956
  CANVAS_DRAFT_STATE,
@@ -860,16 +993,16 @@ function createAssetEngineDataSource({
860
993
  }) {
861
994
  async function* getObjects() {
862
995
  const assets = paginateAsync(
863
- async (offset, limit) => {
996
+ async (offset, limit2) => {
864
997
  if (verbose) {
865
- console.log(`Fetching all assets from offset ${offset} with limit ${limit}`);
998
+ console.log(`Fetching all assets from offset ${offset} with limit ${limit2}`);
866
999
  }
867
1000
  return (await client.get({
868
- limit,
1001
+ limit: limit2,
869
1002
  offset
870
1003
  })).assets;
871
1004
  },
872
- { pageSize: 100 }
1005
+ { pageSize: 50 }
873
1006
  );
874
1007
  for await (const e of assets) {
875
1008
  const result = {
@@ -954,13 +1087,13 @@ var AssetPullModule = {
954
1087
  allowEmptySource
955
1088
  }) => {
956
1089
  const fetch3 = nodeFetchProxy(proxy, verbose);
957
- const client = new UncachedAssetClient3({
1090
+ const client = getAssetClient({
958
1091
  apiKey,
959
1092
  apiHost,
960
1093
  fetch: fetch3,
961
1094
  projectId
962
1095
  });
963
- const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
1096
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
964
1097
  const source = createAssetEngineDataSource({ client, verbose });
965
1098
  let target;
966
1099
  const isPackage = isPathAPackageFile(directory);
@@ -1030,8 +1163,6 @@ var AssetPullModule = {
1030
1163
  };
1031
1164
 
1032
1165
  // src/commands/canvas/commands/asset/push.ts
1033
- import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
1034
- import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
1035
1166
  var AssetPushModule = {
1036
1167
  command: "push <directory>",
1037
1168
  describe: "Pushes all assets from files in a directory to Uniform",
@@ -1068,7 +1199,7 @@ var AssetPushModule = {
1068
1199
  verbose
1069
1200
  }) => {
1070
1201
  const fetch3 = nodeFetchProxy(proxy, verbose);
1071
- const client = new UncachedAssetClient4({
1202
+ const client = getAssetClient({
1072
1203
  apiKey,
1073
1204
  apiHost,
1074
1205
  fetch: fetch3,
@@ -1093,7 +1224,7 @@ var AssetPushModule = {
1093
1224
  });
1094
1225
  }
1095
1226
  const target = createAssetEngineDataSource({ client, verbose });
1096
- const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
1227
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
1097
1228
  await syncEngine({
1098
1229
  source,
1099
1230
  target,
@@ -1133,9 +1264,6 @@ var AssetPushModule = {
1133
1264
  }
1134
1265
  };
1135
1266
 
1136
- // src/commands/canvas/commands/asset/remove.ts
1137
- import { UncachedAssetClient as UncachedAssetClient5 } from "@uniformdev/assets";
1138
-
1139
1267
  // src/log.ts
1140
1268
  import { reset } from "colorette";
1141
1269
  function fillString(char, length) {
@@ -1160,7 +1288,7 @@ var whatIfSimpleLog = ({
1160
1288
  id,
1161
1289
  displayName,
1162
1290
  action
1163
- }) => log({ id, displayName, action, whatIf: true, providerId: "none", diff: [] });
1291
+ }) => log({ id, displayName, action, whatIf: true, providerId: "none", diff: () => [] });
1164
1292
 
1165
1293
  // src/commands/canvas/commands/asset/remove.ts
1166
1294
  var AssetRemoveModule = {
@@ -1176,7 +1304,7 @@ var AssetRemoveModule = {
1176
1304
  ),
1177
1305
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
1178
1306
  const fetch3 = nodeFetchProxy(proxy, verbose);
1179
- const client = new UncachedAssetClient5({ apiKey, apiHost, fetch: fetch3, projectId });
1307
+ const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
1180
1308
  if (!whatIf) {
1181
1309
  await client.delete({ assetId: id });
1182
1310
  } else {
@@ -1186,7 +1314,7 @@ var AssetRemoveModule = {
1186
1314
  };
1187
1315
 
1188
1316
  // src/commands/canvas/commands/asset/update.ts
1189
- import { convertAssetToPutAsset as convertAssetToPutAsset2, UncachedAssetClient as UncachedAssetClient6 } from "@uniformdev/assets";
1317
+ import { convertAssetToPutAsset as convertAssetToPutAsset2 } from "@uniformdev/assets";
1190
1318
  var AssetUpdateModule = {
1191
1319
  command: "update <filename>",
1192
1320
  aliases: ["put"],
@@ -1202,7 +1330,7 @@ var AssetUpdateModule = {
1202
1330
  ),
1203
1331
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
1204
1332
  const fetch3 = nodeFetchProxy(proxy, verbose);
1205
- const client = new UncachedAssetClient6({ apiKey, apiHost, fetch: fetch3, projectId });
1333
+ const client = getAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
1206
1334
  const file = readFileToObject(filename);
1207
1335
  const putAsset = convertAssetToPutAsset2(file);
1208
1336
  if (!whatIf) {
@@ -1230,8 +1358,15 @@ var AssetModule = {
1230
1358
  // src/commands/canvas/commands/category.ts
1231
1359
  import yargs2 from "yargs";
1232
1360
 
1233
- // src/commands/canvas/commands/category/get.ts
1361
+ // src/commands/canvas/commands/category/_util.ts
1234
1362
  import { UncachedCategoryClient } from "@uniformdev/canvas";
1363
+ var selectIdentifier = (category) => category.id;
1364
+ var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
1365
+ function getCategoryClient(options) {
1366
+ return new UncachedCategoryClient({ ...options, limitPolicy: cliLimitPolicy });
1367
+ }
1368
+
1369
+ // src/commands/canvas/commands/category/get.ts
1235
1370
  var CategoryGetModule = {
1236
1371
  command: "get <id>",
1237
1372
  describe: "Fetch a category",
@@ -1248,7 +1383,7 @@ var CategoryGetModule = {
1248
1383
  ),
1249
1384
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
1250
1385
  const fetch3 = nodeFetchProxy(proxy, verbose);
1251
- const client = new UncachedCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1386
+ const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1252
1387
  const res = await client.getCategories();
1253
1388
  const category = res.categories.find((c) => c.id === id);
1254
1389
  if (!category) {
@@ -1261,7 +1396,6 @@ var CategoryGetModule = {
1261
1396
  };
1262
1397
 
1263
1398
  // src/commands/canvas/commands/category/list.ts
1264
- import { UncachedCategoryClient as UncachedCategoryClient2 } from "@uniformdev/canvas";
1265
1399
  var CategoryListModule = {
1266
1400
  command: "list",
1267
1401
  describe: "List categories",
@@ -1271,28 +1405,21 @@ var CategoryListModule = {
1271
1405
  ),
1272
1406
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
1273
1407
  const fetch3 = nodeFetchProxy(proxy, verbose);
1274
- const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
1408
+ const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1275
1409
  const res = await client.getCategories();
1276
1410
  emitWithFormat(res.categories, format, filename);
1277
1411
  }
1278
1412
  };
1279
1413
 
1280
- // src/commands/canvas/commands/category/pull.ts
1281
- import { UncachedCategoryClient as UncachedCategoryClient3 } from "@uniformdev/canvas";
1282
-
1283
- // src/commands/canvas/commands/category/_util.ts
1284
- var selectIdentifier = (category) => category.id;
1285
- var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
1286
-
1287
1414
  // src/commands/canvas/categoriesEngineDataSource.ts
1288
1415
  function createCategoriesEngineDataSource({
1289
1416
  client
1290
1417
  }) {
1291
1418
  async function* getObjects() {
1292
- const componentDefinitions = paginateAsync(async () => (await client.getCategories()).categories, {
1419
+ const categories = paginateAsync(async () => (await client.getCategories()).categories, {
1293
1420
  pageSize: 100
1294
1421
  });
1295
- for await (const def of componentDefinitions) {
1422
+ for await (const def of categories) {
1296
1423
  const result = {
1297
1424
  id: selectIdentifier(def),
1298
1425
  displayName: selectDisplayName(def),
@@ -1358,7 +1485,7 @@ var CategoryPullModule = {
1358
1485
  verbose
1359
1486
  }) => {
1360
1487
  const fetch3 = nodeFetchProxy(proxy, verbose);
1361
- const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
1488
+ const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1362
1489
  const source = createCategoriesEngineDataSource({ client });
1363
1490
  let target;
1364
1491
  const isPackage = isPathAPackageFile(directory);
@@ -1395,7 +1522,6 @@ var CategoryPullModule = {
1395
1522
  };
1396
1523
 
1397
1524
  // src/commands/canvas/commands/category/push.ts
1398
- import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/canvas";
1399
1525
  var CategoryPushModule = {
1400
1526
  command: "push <directory>",
1401
1527
  describe: "Pushes all categories from files in a directory to Uniform Canvas",
@@ -1432,7 +1558,7 @@ var CategoryPushModule = {
1432
1558
  verbose
1433
1559
  }) => {
1434
1560
  const fetch3 = nodeFetchProxy(proxy, verbose);
1435
- const client = new UncachedCategoryClient4({ apiKey, apiHost, fetch: fetch3, projectId });
1561
+ const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1436
1562
  let source;
1437
1563
  const isPackage = isPathAPackageFile(directory);
1438
1564
  if (isPackage) {
@@ -1464,7 +1590,6 @@ var CategoryPushModule = {
1464
1590
  };
1465
1591
 
1466
1592
  // src/commands/canvas/commands/category/remove.ts
1467
- import { UncachedCategoryClient as UncachedCategoryClient5 } from "@uniformdev/canvas";
1468
1593
  var CategoryRemoveModule = {
1469
1594
  command: "remove <id>",
1470
1595
  aliases: ["delete", "rm"],
@@ -1480,7 +1605,7 @@ var CategoryRemoveModule = {
1480
1605
  ),
1481
1606
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
1482
1607
  const fetch3 = nodeFetchProxy(proxy, verbose);
1483
- const client = new UncachedCategoryClient5({ apiKey, apiHost, fetch: fetch3, projectId });
1608
+ const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1484
1609
  if (!whatIf) {
1485
1610
  await client.removeCategory({ categoryId: id });
1486
1611
  } else {
@@ -1490,7 +1615,6 @@ var CategoryRemoveModule = {
1490
1615
  };
1491
1616
 
1492
1617
  // src/commands/canvas/commands/category/update.ts
1493
- import { UncachedCategoryClient as UncachedCategoryClient6 } from "@uniformdev/canvas";
1494
1618
  var CategoryUpdateModule = {
1495
1619
  command: "update <filename>",
1496
1620
  aliases: ["put"],
@@ -1506,7 +1630,7 @@ var CategoryUpdateModule = {
1506
1630
  ),
1507
1631
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
1508
1632
  const fetch3 = nodeFetchProxy(proxy, verbose);
1509
- const client = new UncachedCategoryClient6({ apiKey, apiHost, fetch: fetch3, projectId });
1633
+ const client = getCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
1510
1634
  const file = readFileToObject(filename);
1511
1635
  if (!whatIf) {
1512
1636
  await client.upsertCategories([file]);
@@ -1530,13 +1654,14 @@ var CategoryModule = {
1530
1654
  // src/commands/canvas/commands/component.ts
1531
1655
  import yargs3 from "yargs";
1532
1656
 
1533
- // src/commands/canvas/commands/component/get.ts
1534
- import { UncachedCanvasClient } from "@uniformdev/canvas";
1535
-
1536
1657
  // src/commands/canvas/commands/component/_util.ts
1658
+ import { UncachedCanvasClient } from "@uniformdev/canvas";
1537
1659
  var selectIdentifier2 = (component) => component.id;
1538
1660
  var selectDisplayName2 = (component) => `${component.name} (pid: ${component.id})`;
1539
1661
  var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
1662
+ function getCanvasClient(options) {
1663
+ return new UncachedCanvasClient({ ...options, limitPolicy: cliLimitPolicy });
1664
+ }
1540
1665
 
1541
1666
  // src/commands/canvas/commands/component/get.ts
1542
1667
  var ComponentGetModule = {
@@ -1558,7 +1683,7 @@ var ComponentGetModule = {
1558
1683
  ),
1559
1684
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
1560
1685
  const fetch3 = nodeFetchProxy(proxy, verbose);
1561
- const client = new UncachedCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1686
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1562
1687
  const res = await client.getComponentDefinitions({ componentId: id, limit: 1 });
1563
1688
  if (res.componentDefinitions.length === 0) {
1564
1689
  console.error("Component did not exist");
@@ -1577,7 +1702,6 @@ var ComponentGetModule = {
1577
1702
  };
1578
1703
 
1579
1704
  // src/commands/canvas/commands/component/list.ts
1580
- import { UncachedCanvasClient as UncachedCanvasClient2 } from "@uniformdev/canvas";
1581
1705
  var ComponentListModule = {
1582
1706
  command: "list",
1583
1707
  describe: "List component definitions",
@@ -1600,7 +1724,7 @@ var ComponentListModule = {
1600
1724
  apiHost,
1601
1725
  apiKey,
1602
1726
  proxy,
1603
- limit,
1727
+ limit: limit2,
1604
1728
  offset,
1605
1729
  format,
1606
1730
  filename,
@@ -1608,23 +1732,20 @@ var ComponentListModule = {
1608
1732
  verbose
1609
1733
  }) => {
1610
1734
  const fetch3 = nodeFetchProxy(proxy, verbose);
1611
- const client = new UncachedCanvasClient2({ apiKey, apiHost, fetch: fetch3, projectId });
1612
- const res = await client.getComponentDefinitions({ limit, offset });
1735
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1736
+ const res = await client.getComponentDefinitions({ limit: limit2, offset });
1613
1737
  emitWithFormat(res.componentDefinitions, format, filename);
1614
1738
  }
1615
1739
  };
1616
1740
 
1617
- // src/commands/canvas/commands/component/pull.ts
1618
- import { UncachedCanvasClient as UncachedCanvasClient3 } from "@uniformdev/canvas";
1619
-
1620
1741
  // src/commands/canvas/componentDefinitionEngineDataSource.ts
1621
1742
  function createComponentDefinitionEngineDataSource({
1622
1743
  client
1623
1744
  }) {
1624
1745
  async function* getObjects() {
1625
1746
  const componentDefinitions = paginateAsync(
1626
- async (offset, limit) => (await client.getComponentDefinitions({ limit, offset })).componentDefinitions,
1627
- { pageSize: 100 }
1747
+ async (offset, limit2) => (await client.getComponentDefinitions({ limit: limit2, offset })).componentDefinitions,
1748
+ { pageSize: 200 }
1628
1749
  );
1629
1750
  for await (const def of componentDefinitions) {
1630
1751
  const result = {
@@ -1694,7 +1815,7 @@ var ComponentPullModule = {
1694
1815
  verbose
1695
1816
  }) => {
1696
1817
  const fetch3 = nodeFetchProxy(proxy, verbose);
1697
- const client = new UncachedCanvasClient3({ apiKey, apiHost, fetch: fetch3, projectId });
1818
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1698
1819
  const source = createComponentDefinitionEngineDataSource({ client });
1699
1820
  let target;
1700
1821
  const isPackage = isPathAPackageFile(directory);
@@ -1732,7 +1853,6 @@ var ComponentPullModule = {
1732
1853
  };
1733
1854
 
1734
1855
  // src/commands/canvas/commands/component/push.ts
1735
- import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canvas";
1736
1856
  var ComponentPushModule = {
1737
1857
  command: "push <directory>",
1738
1858
  describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
@@ -1769,7 +1889,7 @@ var ComponentPushModule = {
1769
1889
  verbose
1770
1890
  }) => {
1771
1891
  const fetch3 = nodeFetchProxy(proxy, verbose);
1772
- const client = new UncachedCanvasClient4({ apiKey, apiHost, fetch: fetch3, projectId });
1892
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1773
1893
  let source;
1774
1894
  const isPackage = isPathAPackageFile(directory);
1775
1895
  if (isPackage) {
@@ -1802,7 +1922,6 @@ var ComponentPushModule = {
1802
1922
  };
1803
1923
 
1804
1924
  // src/commands/canvas/commands/component/remove.ts
1805
- import { UncachedCanvasClient as UncachedCanvasClient5 } from "@uniformdev/canvas";
1806
1925
  var ComponentRemoveModule = {
1807
1926
  command: "remove <id>",
1808
1927
  aliases: ["delete", "rm"],
@@ -1821,7 +1940,7 @@ var ComponentRemoveModule = {
1821
1940
  ),
1822
1941
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
1823
1942
  const fetch3 = nodeFetchProxy(proxy, verbose);
1824
- const client = new UncachedCanvasClient5({ apiKey, apiHost, fetch: fetch3, projectId });
1943
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1825
1944
  if (!whatIf) {
1826
1945
  await client.removeComponentDefinition({ componentId: id });
1827
1946
  } else {
@@ -1831,7 +1950,6 @@ var ComponentRemoveModule = {
1831
1950
  };
1832
1951
 
1833
1952
  // src/commands/canvas/commands/component/update.ts
1834
- import { UncachedCanvasClient as UncachedCanvasClient6 } from "@uniformdev/canvas";
1835
1953
  var ComponentUpdateModule = {
1836
1954
  command: "update <filename>",
1837
1955
  aliases: ["put"],
@@ -1847,10 +1965,10 @@ var ComponentUpdateModule = {
1847
1965
  ),
1848
1966
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
1849
1967
  const fetch3 = nodeFetchProxy(proxy, verbose);
1850
- const client = new UncachedCanvasClient6({ apiKey, apiHost, fetch: fetch3, projectId });
1968
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
1851
1969
  const file = readFileToObject(filename);
1852
1970
  if (!whatIf) {
1853
- await client.updateComponentDefinition({ componentDefinition: file });
1971
+ await client.updateComponentDefinition({ componentDefinition: omit(file, ["$schema"]) });
1854
1972
  } else {
1855
1973
  whatIfSimpleLog({ id: file.id, displayName: `Component: ${file.name}`, action: "update" });
1856
1974
  }
@@ -1872,7 +1990,6 @@ var ComponentModule = {
1872
1990
  import yargs4 from "yargs";
1873
1991
 
1874
1992
  // src/commands/canvas/commands/composition/get.ts
1875
- import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
1876
1993
  var CompositionGetModule = {
1877
1994
  command: "get <id>",
1878
1995
  describe: "Fetch a composition",
@@ -1955,7 +2072,7 @@ var CompositionGetModule = {
1955
2072
  console.log(`\u{1F41B} get composition:`, parameters);
1956
2073
  }
1957
2074
  const fetch3 = nodeFetchProxy(proxy, verbose);
1958
- const client = new UncachedCanvasClient7({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
2075
+ const client = getCanvasClient({ apiKey, edgeApiHost, apiHost, fetch: fetch3, projectId });
1959
2076
  const res = prepCompositionForDisk(await client.getCompositionById(parameters));
1960
2077
  emitWithFormat(res, format, filename);
1961
2078
  }
@@ -1968,7 +2085,6 @@ var ComponentPatternGetModule = {
1968
2085
  };
1969
2086
 
1970
2087
  // src/commands/canvas/commands/composition/list.ts
1971
- import { UncachedCanvasClient as UncachedCanvasClient8 } from "@uniformdev/canvas";
1972
2088
  var CompositionListModule = {
1973
2089
  command: "list",
1974
2090
  describe: "List compositions",
@@ -2020,7 +2136,7 @@ var CompositionListModule = {
2020
2136
  apiHost,
2021
2137
  apiKey,
2022
2138
  proxy,
2023
- limit,
2139
+ limit: limit2,
2024
2140
  offset,
2025
2141
  search,
2026
2142
  format,
@@ -2036,7 +2152,7 @@ var CompositionListModule = {
2036
2152
  verbose
2037
2153
  }) => {
2038
2154
  const parameters = {
2039
- limit,
2155
+ limit: limit2,
2040
2156
  offset,
2041
2157
  search: search && search.length > 0 ? search : void 0,
2042
2158
  pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
@@ -2050,7 +2166,7 @@ var CompositionListModule = {
2050
2166
  console.log(`\u{1F41B} list compositions:`, parameters);
2051
2167
  }
2052
2168
  const fetch3 = nodeFetchProxy(proxy, verbose);
2053
- const client = new UncachedCanvasClient8({ apiKey, apiHost, fetch: fetch3, projectId });
2169
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2054
2170
  const res = await client.getCompositionList(parameters);
2055
2171
  emitWithFormat(res.compositions, format, filename);
2056
2172
  }
@@ -2106,9 +2222,6 @@ var ComponentPatternListModule = {
2106
2222
  )
2107
2223
  };
2108
2224
 
2109
- // src/commands/canvas/commands/composition/publish.ts
2110
- import { UncachedCanvasClient as UncachedCanvasClient9 } from "@uniformdev/canvas";
2111
-
2112
2225
  // src/commands/canvas/commands/composition/_util.ts
2113
2226
  var selectIdentifier3 = (response) => {
2114
2227
  let baseId = response.composition._id;
@@ -2140,10 +2253,10 @@ function createComponentInstanceEngineDataSource({
2140
2253
  const stateId = convertStateOption(state);
2141
2254
  async function* getObjects() {
2142
2255
  const componentInstances = paginateAsync(
2143
- async (offset, limit) => {
2256
+ async (offset, limit2) => {
2144
2257
  const parameters = {
2145
2258
  ...clientOptions,
2146
- limit,
2259
+ limit: limit2,
2147
2260
  offset,
2148
2261
  pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
2149
2262
  state: stateId,
@@ -2239,7 +2352,7 @@ var CompositionPublishModule = {
2239
2352
  }
2240
2353
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
2241
2354
  const fetch3 = nodeFetchProxy(proxy, verbose);
2242
- const client = new UncachedCanvasClient9({ apiKey, apiHost, fetch: fetch3, projectId });
2355
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2243
2356
  const source = createComponentInstanceEngineDataSource({
2244
2357
  client,
2245
2358
  state: "preview",
@@ -2314,8 +2427,6 @@ var ComponentPatternPublishModule = {
2314
2427
  };
2315
2428
 
2316
2429
  // src/commands/canvas/commands/composition/pull.ts
2317
- import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
2318
- import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
2319
2430
  var CompositionPullModule = {
2320
2431
  command: "pull <directory>",
2321
2432
  describe: "Pulls all compositions to local files in a directory",
@@ -2374,8 +2485,8 @@ var CompositionPullModule = {
2374
2485
  verbose
2375
2486
  }) => {
2376
2487
  const fetch3 = nodeFetchProxy(proxy, verbose);
2377
- const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
2378
- const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
2488
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2489
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
2379
2490
  const source = createComponentInstanceEngineDataSource({
2380
2491
  client,
2381
2492
  state,
@@ -2480,8 +2591,6 @@ var ComponentPatternPullModule = {
2480
2591
  };
2481
2592
 
2482
2593
  // src/commands/canvas/commands/composition/push.ts
2483
- import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
2484
- import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
2485
2594
  var CompositionPushModule = {
2486
2595
  command: "push <directory>",
2487
2596
  describe: "Pushes all compositions from files in a directory to Uniform Canvas",
@@ -2533,7 +2642,7 @@ var CompositionPushModule = {
2533
2642
  verbose
2534
2643
  }) => {
2535
2644
  const fetch3 = nodeFetchProxy(proxy, verbose);
2536
- const client = new UncachedCanvasClient11({ apiKey, apiHost, fetch: fetch3, projectId });
2645
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2537
2646
  let source;
2538
2647
  const isPackage = isPathAPackageFile(directory);
2539
2648
  if (isPackage) {
@@ -2560,7 +2669,7 @@ var CompositionPushModule = {
2560
2669
  patternType,
2561
2670
  verbose
2562
2671
  });
2563
- const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
2672
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
2564
2673
  await syncEngine({
2565
2674
  source,
2566
2675
  target,
@@ -2623,7 +2732,6 @@ var ComponentPatternPushModule = {
2623
2732
  };
2624
2733
 
2625
2734
  // src/commands/canvas/commands/composition/remove.ts
2626
- import { UncachedCanvasClient as UncachedCanvasClient12 } from "@uniformdev/canvas";
2627
2735
  var CompositionRemoveModule = {
2628
2736
  command: "remove <id>",
2629
2737
  aliases: ["delete", "rm"],
@@ -2645,7 +2753,7 @@ var CompositionRemoveModule = {
2645
2753
  console.log(`\u{1F41B} remove composition: (id: ${id})`);
2646
2754
  }
2647
2755
  const fetch3 = nodeFetchProxy(proxy, verbose);
2648
- const client = new UncachedCanvasClient12({ apiKey, apiHost, fetch: fetch3, projectId });
2756
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2649
2757
  if (!whatIf) {
2650
2758
  await client.removeComposition({ compositionId: id });
2651
2759
  } else {
@@ -2661,10 +2769,7 @@ var ComponentPatternRemoveModule = {
2661
2769
  };
2662
2770
 
2663
2771
  // src/commands/canvas/commands/composition/unpublish.ts
2664
- import {
2665
- CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2,
2666
- UncachedCanvasClient as UncachedCanvasClient13
2667
- } from "@uniformdev/canvas";
2772
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2 } from "@uniformdev/canvas";
2668
2773
  import { diffJson as diffJson2 } from "diff";
2669
2774
  var CompositionUnpublishModule = {
2670
2775
  command: "unpublish [ids]",
@@ -2715,7 +2820,7 @@ var CompositionUnpublishModule = {
2715
2820
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
2716
2821
  const targetItems = /* @__PURE__ */ new Map();
2717
2822
  const fetch3 = nodeFetchProxy(proxy, verbose);
2718
- const client = new UncachedCanvasClient13({ apiKey, apiHost, fetch: fetch3, projectId });
2823
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2719
2824
  const source = createComponentInstanceEngineDataSource({
2720
2825
  client,
2721
2826
  state: "published",
@@ -2760,7 +2865,7 @@ var CompositionUnpublishModule = {
2760
2865
  providerId: sourceObject.providerId,
2761
2866
  displayName: sourceObject.displayName ?? sourceObject.providerId,
2762
2867
  whatIf,
2763
- diff: diffJson2(targetObject.object, sourceObject.object)
2868
+ diff: () => diffJson2(targetObject.object, sourceObject.object)
2764
2869
  });
2765
2870
  }
2766
2871
  }
@@ -2804,7 +2909,6 @@ var ComponentPatternUnpublishModule = {
2804
2909
  };
2805
2910
 
2806
2911
  // src/commands/canvas/commands/composition/update.ts
2807
- import { UncachedCanvasClient as UncachedCanvasClient14 } from "@uniformdev/canvas";
2808
2912
  var CompositionUpdateModule = {
2809
2913
  command: "update <filename>",
2810
2914
  aliases: ["put"],
@@ -2828,7 +2932,7 @@ var CompositionUpdateModule = {
2828
2932
  console.log(`\u{1F41B} update composition: (filename: ${filename}, state: ${convertStateOption(state)})`);
2829
2933
  }
2830
2934
  const fetch3 = nodeFetchProxy(proxy, verbose);
2831
- const client = new UncachedCanvasClient14({ apiKey, apiHost, fetch: fetch3, projectId });
2935
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch3, projectId });
2832
2936
  const file = readFileToObject(filename);
2833
2937
  if (!whatIf) {
2834
2938
  await client.updateComposition({ ...file, state: convertStateOption(state) });
@@ -3114,8 +3218,15 @@ var CompositionPatternModule = {
3114
3218
  // src/commands/canvas/commands/contentType.ts
3115
3219
  import yargs7 from "yargs";
3116
3220
 
3117
- // src/commands/canvas/commands/contentType/get.ts
3221
+ // src/commands/canvas/commands/contentType/_util.ts
3118
3222
  import { ContentClient } from "@uniformdev/canvas";
3223
+ var selectContentTypeIdentifier = (ct) => ct.id;
3224
+ var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
3225
+ function getContentClient(options) {
3226
+ return new ContentClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
3227
+ }
3228
+
3229
+ // src/commands/canvas/commands/contentType/get.ts
3119
3230
  var ContentTypeGetModule = {
3120
3231
  command: "get <id>",
3121
3232
  describe: "Get a content type",
@@ -3135,7 +3246,7 @@ var ContentTypeGetModule = {
3135
3246
  ),
3136
3247
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
3137
3248
  const fetch3 = nodeFetchProxy(proxy, verbose);
3138
- const client = new ContentClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3249
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
3139
3250
  const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
3140
3251
  const found = res.contentTypes.find((f) => f.id === id);
3141
3252
  if (!found) {
@@ -3146,26 +3257,18 @@ var ContentTypeGetModule = {
3146
3257
  };
3147
3258
 
3148
3259
  // src/commands/canvas/commands/contentType/list.ts
3149
- import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
3150
3260
  var ContentTypeListModule = {
3151
3261
  command: "list",
3152
3262
  describe: "List content types",
3153
3263
  builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
3154
3264
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
3155
3265
  const fetch3 = nodeFetchProxy(proxy, verbose);
3156
- const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3266
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
3157
3267
  const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
3158
3268
  emitWithFormat(res.contentTypes, format, filename);
3159
3269
  }
3160
3270
  };
3161
3271
 
3162
- // src/commands/canvas/commands/contentType/pull.ts
3163
- import { ContentClient as ContentClient3 } from "@uniformdev/canvas";
3164
-
3165
- // src/commands/canvas/commands/contentType/_util.ts
3166
- var selectContentTypeIdentifier = (ct) => ct.id;
3167
- var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
3168
-
3169
3272
  // src/commands/canvas/contentTypeEngineDataSource.ts
3170
3273
  function createContentTypeEngineDataSource({
3171
3274
  client
@@ -3238,12 +3341,11 @@ var ContentTypePullModule = {
3238
3341
  verbose
3239
3342
  }) => {
3240
3343
  const fetch3 = nodeFetchProxy(proxy, verbose);
3241
- const client = new ContentClient3({
3344
+ const client = getContentClient({
3242
3345
  apiKey,
3243
3346
  apiHost,
3244
3347
  fetch: fetch3,
3245
- projectId,
3246
- bypassCache: true
3348
+ projectId
3247
3349
  });
3248
3350
  const source = createContentTypeEngineDataSource({ client });
3249
3351
  let target;
@@ -3281,7 +3383,6 @@ var ContentTypePullModule = {
3281
3383
  };
3282
3384
 
3283
3385
  // src/commands/canvas/commands/contentType/push.ts
3284
- import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
3285
3386
  var ContentTypePushModule = {
3286
3387
  command: "push <directory>",
3287
3388
  describe: "Pushes all content types from files in a directory to Uniform",
@@ -3323,12 +3424,11 @@ var ContentTypePushModule = {
3323
3424
  verbose
3324
3425
  }) => {
3325
3426
  const fetch3 = nodeFetchProxy(proxy, verbose);
3326
- const client = new ContentClient4({
3427
+ const client = getContentClient({
3327
3428
  apiKey,
3328
3429
  apiHost,
3329
3430
  fetch: fetch3,
3330
- projectId,
3331
- bypassCache: true
3431
+ projectId
3332
3432
  });
3333
3433
  let source;
3334
3434
  const isPackage = isPathAPackageFile(directory);
@@ -3361,7 +3461,6 @@ var ContentTypePushModule = {
3361
3461
  };
3362
3462
 
3363
3463
  // src/commands/canvas/commands/contentType/remove.ts
3364
- import { ContentClient as ContentClient5 } from "@uniformdev/canvas";
3365
3464
  var ContentTypeRemoveModule = {
3366
3465
  command: "remove <id>",
3367
3466
  aliases: ["delete", "rm"],
@@ -3377,7 +3476,7 @@ var ContentTypeRemoveModule = {
3377
3476
  ),
3378
3477
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
3379
3478
  const fetch3 = nodeFetchProxy(proxy, verbose);
3380
- const client = new ContentClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3479
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
3381
3480
  if (!whatIf) {
3382
3481
  await client.deleteContentType({ contentTypeId: id });
3383
3482
  } else {
@@ -3387,7 +3486,6 @@ var ContentTypeRemoveModule = {
3387
3486
  };
3388
3487
 
3389
3488
  // src/commands/canvas/commands/contentType/update.ts
3390
- import { ContentClient as ContentClient6 } from "@uniformdev/canvas";
3391
3489
  var ContentTypeUpdateModule = {
3392
3490
  command: "update <filename>",
3393
3491
  aliases: ["put"],
@@ -3403,7 +3501,7 @@ var ContentTypeUpdateModule = {
3403
3501
  ),
3404
3502
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
3405
3503
  const fetch3 = nodeFetchProxy(proxy, verbose);
3406
- const client = new ContentClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3504
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
3407
3505
  const file = readFileToObject(filename);
3408
3506
  if (!whatIf) {
3409
3507
  await client.upsertContentType({ contentType: file });
@@ -3427,8 +3525,13 @@ var ContentTypeModule = {
3427
3525
  // src/commands/canvas/commands/dataSource.ts
3428
3526
  import yargs8 from "yargs";
3429
3527
 
3430
- // src/commands/canvas/commands/dataSource/get.ts
3528
+ // src/commands/canvas/commands/dataSource/_util.ts
3431
3529
  import { DataSourceClient } from "@uniformdev/canvas";
3530
+ function getDataSourceClient(options) {
3531
+ return new DataSourceClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
3532
+ }
3533
+
3534
+ // src/commands/canvas/commands/dataSource/get.ts
3432
3535
  var DataSourceGetModule = {
3433
3536
  command: "get <id>",
3434
3537
  describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
@@ -3436,7 +3539,6 @@ var DataSourceGetModule = {
3436
3539
  withApiOptions(
3437
3540
  withDebugOptions(
3438
3541
  withProjectOptions(
3439
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3440
3542
  yargs38.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
3441
3543
  )
3442
3544
  )
@@ -3444,14 +3546,13 @@ var DataSourceGetModule = {
3444
3546
  ),
3445
3547
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose }) => {
3446
3548
  const fetch3 = nodeFetchProxy(proxy, verbose);
3447
- const client = new DataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3549
+ const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId });
3448
3550
  const res = await client.get({ dataSourceId: id });
3449
3551
  emitWithFormat(res.result, "json", void 0);
3450
3552
  }
3451
3553
  };
3452
3554
 
3453
3555
  // src/commands/canvas/commands/dataSource/remove.ts
3454
- import { DataSourceClient as DataSourceClient2 } from "@uniformdev/canvas";
3455
3556
  var DataSourceRemoveModule = {
3456
3557
  command: "remove <id>",
3457
3558
  aliases: ["delete", "rm"],
@@ -3467,7 +3568,7 @@ var DataSourceRemoveModule = {
3467
3568
  ),
3468
3569
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
3469
3570
  const fetch3 = nodeFetchProxy(proxy, verbose);
3470
- const client = new DataSourceClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3571
+ const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId });
3471
3572
  if (!whatIf) {
3472
3573
  await client.remove({ dataSourceId: id });
3473
3574
  } else {
@@ -3477,7 +3578,6 @@ var DataSourceRemoveModule = {
3477
3578
  };
3478
3579
 
3479
3580
  // src/commands/canvas/commands/dataSource/update.ts
3480
- import { DataSourceClient as DataSourceClient3 } from "@uniformdev/canvas";
3481
3581
  var DataSourceUpdateModule = {
3482
3582
  command: "update <dataSource>",
3483
3583
  aliases: ["put"],
@@ -3506,7 +3606,7 @@ var DataSourceUpdateModule = {
3506
3606
  whatIf
3507
3607
  }) => {
3508
3608
  const fetch3 = nodeFetchProxy(proxy, verbose);
3509
- const client = new DataSourceClient3({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3609
+ const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId });
3510
3610
  const file = JSON.parse(dataSource);
3511
3611
  if (!whatIf) {
3512
3612
  await client.upsert({ data: file, integrationType });
@@ -3530,8 +3630,15 @@ var DataSourceModule = {
3530
3630
  // src/commands/canvas/commands/dataType.ts
3531
3631
  import yargs9 from "yargs";
3532
3632
 
3533
- // src/commands/canvas/commands/dataType/get.ts
3633
+ // src/commands/canvas/commands/dataType/_util.ts
3534
3634
  import { DataTypeClient } from "@uniformdev/canvas";
3635
+ var selectIdentifier4 = (dataType) => dataType.id;
3636
+ var selectDisplayName4 = (dataType) => `${dataType.displayName} (pid: ${dataType.id})`;
3637
+ function getDataTypeClient(options) {
3638
+ return new DataTypeClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
3639
+ }
3640
+
3641
+ // src/commands/canvas/commands/dataType/get.ts
3535
3642
  var DataTypeGetModule = {
3536
3643
  command: "get <id>",
3537
3644
  describe: "Get a data type",
@@ -3541,7 +3648,6 @@ var DataTypeGetModule = {
3541
3648
  withDebugOptions(
3542
3649
  withApiOptions(
3543
3650
  withProjectOptions(
3544
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3545
3651
  yargs38.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
3546
3652
  )
3547
3653
  )
@@ -3550,7 +3656,7 @@ var DataTypeGetModule = {
3550
3656
  ),
3551
3657
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
3552
3658
  const fetch3 = nodeFetchProxy(proxy, verbose);
3553
- const client = new DataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3659
+ const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
3554
3660
  const res = await client.get();
3555
3661
  const found = res.results.find((f) => f.id === id);
3556
3662
  if (!found) {
@@ -3561,7 +3667,6 @@ var DataTypeGetModule = {
3561
3667
  };
3562
3668
 
3563
3669
  // src/commands/canvas/commands/dataType/list.ts
3564
- import { DataTypeClient as DataTypeClient2 } from "@uniformdev/canvas";
3565
3670
  var DataTypeListModule = {
3566
3671
  command: "list",
3567
3672
  describe: "List data types",
@@ -3569,19 +3674,12 @@ var DataTypeListModule = {
3569
3674
  builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
3570
3675
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
3571
3676
  const fetch3 = nodeFetchProxy(proxy, verbose);
3572
- const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3677
+ const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
3573
3678
  const res = await client.get();
3574
3679
  emitWithFormat(res.results, format, filename);
3575
3680
  }
3576
3681
  };
3577
3682
 
3578
- // src/commands/canvas/commands/dataType/pull.ts
3579
- import { DataTypeClient as DataTypeClient3 } from "@uniformdev/canvas";
3580
-
3581
- // src/commands/canvas/commands/dataType/_util.ts
3582
- var selectIdentifier4 = (dataType) => dataType.id;
3583
- var selectDisplayName4 = (dataType) => `${dataType.displayName} (pid: ${dataType.id})`;
3584
-
3585
3683
  // src/commands/canvas/dataTypeEngineDataSource.ts
3586
3684
  function createDataTypeEngineDataSource({
3587
3685
  client
@@ -3656,12 +3754,11 @@ var DataTypePullModule = {
3656
3754
  verbose
3657
3755
  }) => {
3658
3756
  const fetch3 = nodeFetchProxy(proxy, verbose);
3659
- const client = new DataTypeClient3({
3757
+ const client = getDataTypeClient({
3660
3758
  apiKey,
3661
3759
  apiHost,
3662
3760
  fetch: fetch3,
3663
- projectId,
3664
- bypassCache: true
3761
+ projectId
3665
3762
  });
3666
3763
  const source = createDataTypeEngineDataSource({ client });
3667
3764
  let target;
@@ -3699,7 +3796,6 @@ var DataTypePullModule = {
3699
3796
  };
3700
3797
 
3701
3798
  // src/commands/canvas/commands/dataType/push.ts
3702
- import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
3703
3799
  var DataTypePushModule = {
3704
3800
  command: "push <directory>",
3705
3801
  describe: "Pushes all data types from files in a directory to Uniform",
@@ -3736,12 +3832,11 @@ var DataTypePushModule = {
3736
3832
  verbose
3737
3833
  }) => {
3738
3834
  const fetch3 = nodeFetchProxy(proxy, verbose);
3739
- const client = new DataTypeClient4({
3835
+ const client = getDataTypeClient({
3740
3836
  apiKey,
3741
3837
  apiHost,
3742
3838
  fetch: fetch3,
3743
- projectId,
3744
- bypassCache: true
3839
+ projectId
3745
3840
  });
3746
3841
  let source;
3747
3842
  const isPackage = isPathAPackageFile(directory);
@@ -3774,7 +3869,6 @@ var DataTypePushModule = {
3774
3869
  };
3775
3870
 
3776
3871
  // src/commands/canvas/commands/dataType/remove.ts
3777
- import { DataTypeClient as DataTypeClient5 } from "@uniformdev/canvas";
3778
3872
  var DataTypeRemoveModule = {
3779
3873
  command: "remove <id>",
3780
3874
  aliases: ["delete", "rm"],
@@ -3790,7 +3884,7 @@ var DataTypeRemoveModule = {
3790
3884
  ),
3791
3885
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, whatIf }) => {
3792
3886
  const fetch3 = nodeFetchProxy(proxy);
3793
- const client = new DataTypeClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3887
+ const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
3794
3888
  if (!whatIf) {
3795
3889
  await client.remove({ typeId: id });
3796
3890
  } else {
@@ -3800,7 +3894,6 @@ var DataTypeRemoveModule = {
3800
3894
  };
3801
3895
 
3802
3896
  // src/commands/canvas/commands/dataType/update.ts
3803
- import { DataTypeClient as DataTypeClient6 } from "@uniformdev/canvas";
3804
3897
  var DataTypeUpdateModule = {
3805
3898
  command: "update <filename>",
3806
3899
  aliases: ["put"],
@@ -3816,7 +3909,7 @@ var DataTypeUpdateModule = {
3816
3909
  ),
3817
3910
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
3818
3911
  const fetch3 = nodeFetchProxy(proxy, verbose);
3819
- const client = new DataTypeClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3912
+ const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch3, projectId });
3820
3913
  const file = readFileToObject(filename);
3821
3914
  if (!whatIf) {
3822
3915
  await client.upsert({ data: file });
@@ -3841,7 +3934,6 @@ var DataTypeModule = {
3841
3934
  import yargs10 from "yargs";
3842
3935
 
3843
3936
  // src/commands/canvas/commands/entry/get.ts
3844
- import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
3845
3937
  var EntryGetModule = {
3846
3938
  command: "get <id>",
3847
3939
  describe: "Get an entry",
@@ -3892,7 +3984,7 @@ var EntryGetModule = {
3892
3984
  verbose
3893
3985
  }) => {
3894
3986
  const fetch3 = nodeFetchProxy(proxy, verbose);
3895
- const client = new ContentClient7({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
3987
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
3896
3988
  const res = await client.getEntries({
3897
3989
  offset: 0,
3898
3990
  limit: 1,
@@ -3912,7 +4004,6 @@ var EntryGetModule = {
3912
4004
  };
3913
4005
 
3914
4006
  // src/commands/canvas/commands/entry/list.ts
3915
- import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
3916
4007
  var LEGACY_DEFAULT_LIMIT = 1e3;
3917
4008
  var EntryListModule = {
3918
4009
  command: "list",
@@ -3949,16 +4040,16 @@ var EntryListModule = {
3949
4040
  filename,
3950
4041
  project: projectId,
3951
4042
  state,
3952
- limit,
4043
+ limit: limit2,
3953
4044
  offset,
3954
4045
  search,
3955
4046
  verbose
3956
4047
  }) => {
3957
4048
  const fetch3 = nodeFetchProxy(proxy, verbose);
3958
- const client = new ContentClient8({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4049
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
3959
4050
  const res = await client.getEntries({
3960
4051
  offset,
3961
- limit: search.length > 0 && limit === LEGACY_DEFAULT_LIMIT ? 100 : limit,
4052
+ limit: search.length > 0 && limit2 === LEGACY_DEFAULT_LIMIT ? 100 : limit2,
3962
4053
  // Search API requires a lower default limit (100)
3963
4054
  search: search.length > 0 ? search : void 0,
3964
4055
  state: convertStateOption(state),
@@ -3970,9 +4061,6 @@ var EntryListModule = {
3970
4061
  }
3971
4062
  };
3972
4063
 
3973
- // src/commands/canvas/commands/entry/publish.ts
3974
- import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
3975
-
3976
4064
  // src/commands/canvas/entryEngineDataSource.ts
3977
4065
  import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
3978
4066
 
@@ -4005,11 +4093,11 @@ function createEntryEngineDataSource({
4005
4093
  const stateId = convertStateOption(state);
4006
4094
  async function* getObjects() {
4007
4095
  const entries = paginateAsync(
4008
- async (offset, limit) => {
4096
+ async (offset, limit2) => {
4009
4097
  try {
4010
4098
  return (await client.getEntries({
4011
4099
  offset,
4012
- limit,
4100
+ limit: limit2,
4013
4101
  entryIDs,
4014
4102
  pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
4015
4103
  skipDataResolution: true,
@@ -4080,7 +4168,7 @@ var EntryPublishModule = {
4080
4168
  }
4081
4169
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
4082
4170
  const fetch3 = nodeFetchProxy(proxy, verbose);
4083
- const client = new ContentClient10({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4171
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
4084
4172
  const source = createEntryEngineDataSource({
4085
4173
  client,
4086
4174
  state: "preview",
@@ -4105,8 +4193,6 @@ var EntryPublishModule = {
4105
4193
  };
4106
4194
 
4107
4195
  // src/commands/canvas/commands/entry/pull.ts
4108
- import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
4109
- import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
4110
4196
  var EntryPullModule = {
4111
4197
  command: "pull <directory>",
4112
4198
  describe: "Pulls all entries to local files in a directory",
@@ -4153,14 +4239,13 @@ var EntryPullModule = {
4153
4239
  verbose
4154
4240
  }) => {
4155
4241
  const fetch3 = nodeFetchProxy(proxy, verbose);
4156
- const client = new ContentClient11({
4242
+ const client = getContentClient({
4157
4243
  apiKey,
4158
4244
  apiHost,
4159
4245
  fetch: fetch3,
4160
- projectId,
4161
- bypassCache: true
4246
+ projectId
4162
4247
  });
4163
- const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
4248
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
4164
4249
  const source = createEntryEngineDataSource({ client, state, onlyEntries: true });
4165
4250
  let target;
4166
4251
  const isPackage = isPathAPackageFile(directory);
@@ -4209,8 +4294,6 @@ var EntryPullModule = {
4209
4294
  };
4210
4295
 
4211
4296
  // src/commands/canvas/commands/entry/push.ts
4212
- import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
4213
- import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
4214
4297
  var EntryPushModule = {
4215
4298
  command: "push <directory>",
4216
4299
  describe: "Pushes all entries from files in a directory to Uniform",
@@ -4250,12 +4333,11 @@ var EntryPushModule = {
4250
4333
  verbose
4251
4334
  }) => {
4252
4335
  const fetch3 = nodeFetchProxy(proxy, verbose);
4253
- const client = new ContentClient12({
4336
+ const client = getContentClient({
4254
4337
  apiKey,
4255
4338
  apiHost,
4256
4339
  fetch: fetch3,
4257
- projectId,
4258
- bypassCache: true
4340
+ projectId
4259
4341
  });
4260
4342
  let source;
4261
4343
  const isPackage = isPathAPackageFile(directory);
@@ -4276,7 +4358,7 @@ var EntryPushModule = {
4276
4358
  });
4277
4359
  }
4278
4360
  const target = createEntryEngineDataSource({ client, state, onlyEntries: true });
4279
- const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
4361
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
4280
4362
  await syncEngine({
4281
4363
  source,
4282
4364
  target,
@@ -4300,7 +4382,6 @@ var EntryPushModule = {
4300
4382
  };
4301
4383
 
4302
4384
  // src/commands/canvas/commands/entry/remove.ts
4303
- import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
4304
4385
  var EntryRemoveModule = {
4305
4386
  command: "remove <id>",
4306
4387
  aliases: ["delete", "rm"],
@@ -4316,7 +4397,7 @@ var EntryRemoveModule = {
4316
4397
  ),
4317
4398
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
4318
4399
  const fetch3 = nodeFetchProxy(proxy, verbose);
4319
- const client = new ContentClient13({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4400
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
4320
4401
  if (!whatIf) {
4321
4402
  await client.deleteEntry({ entryId: id });
4322
4403
  } else {
@@ -4326,7 +4407,7 @@ var EntryRemoveModule = {
4326
4407
  };
4327
4408
 
4328
4409
  // src/commands/canvas/commands/entry/unpublish.ts
4329
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3, ContentClient as ContentClient14 } from "@uniformdev/canvas";
4410
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
4330
4411
  import { diffJson as diffJson3 } from "diff";
4331
4412
  var EntryUnpublishModule = {
4332
4413
  command: "unpublish [ids]",
@@ -4356,7 +4437,7 @@ var EntryUnpublishModule = {
4356
4437
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
4357
4438
  const targetItems = /* @__PURE__ */ new Map();
4358
4439
  const fetch3 = nodeFetchProxy(proxy, verbose);
4359
- const client = new ContentClient14({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4440
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
4360
4441
  const source = createEntryEngineDataSource({
4361
4442
  client,
4362
4443
  state: "published",
@@ -4394,14 +4475,13 @@ var EntryUnpublishModule = {
4394
4475
  providerId: sourceObject.providerId,
4395
4476
  displayName: sourceObject.displayName ?? sourceObject.providerId,
4396
4477
  whatIf,
4397
- diff: diffJson3(targetObject.object, sourceObject.object)
4478
+ diff: () => diffJson3(targetObject.object, sourceObject.object)
4398
4479
  });
4399
4480
  }
4400
4481
  }
4401
4482
  };
4402
4483
 
4403
4484
  // src/commands/canvas/commands/entry/update.ts
4404
- import { ContentClient as ContentClient15 } from "@uniformdev/canvas";
4405
4485
  var EntryUpdateModule = {
4406
4486
  command: "update <filename>",
4407
4487
  aliases: ["put"],
@@ -4429,7 +4509,7 @@ var EntryUpdateModule = {
4429
4509
  whatIf
4430
4510
  }) => {
4431
4511
  const fetch3 = nodeFetchProxy(proxy, verbose);
4432
- const client = new ContentClient15({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4512
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
4433
4513
  const file = readFileToObject(filename);
4434
4514
  if (!whatIf) {
4435
4515
  await client.upsertEntry({ ...file, state: convertStateOption(state) });
@@ -4453,7 +4533,6 @@ var EntryModule = {
4453
4533
  import yargs11 from "yargs";
4454
4534
 
4455
4535
  // src/commands/canvas/commands/entryPattern/get.ts
4456
- import { ContentClient as ContentClient16 } from "@uniformdev/canvas";
4457
4536
  var EntryPatternGetModule = {
4458
4537
  command: "get <id>",
4459
4538
  describe: "Get an entry pattern",
@@ -4476,7 +4555,7 @@ var EntryPatternGetModule = {
4476
4555
  ),
4477
4556
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, state, verbose }) => {
4478
4557
  const fetch3 = nodeFetchProxy(proxy, verbose);
4479
- const client = new ContentClient16({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4558
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
4480
4559
  const res = await client.getEntries({
4481
4560
  offset: 0,
4482
4561
  limit: 1,
@@ -4495,7 +4574,6 @@ var EntryPatternGetModule = {
4495
4574
  };
4496
4575
 
4497
4576
  // src/commands/canvas/commands/entryPattern/list.ts
4498
- import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
4499
4577
  var EntryPatternListModule = {
4500
4578
  command: "list",
4501
4579
  describe: "List entry patterns",
@@ -4516,7 +4594,7 @@ var EntryPatternListModule = {
4516
4594
  verbose
4517
4595
  }) => {
4518
4596
  const fetch3 = nodeFetchProxy(proxy, verbose);
4519
- const client = new ContentClient17({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4597
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
4520
4598
  const res = await client.getEntries({
4521
4599
  offset: 0,
4522
4600
  limit: 1e3,
@@ -4531,7 +4609,6 @@ var EntryPatternListModule = {
4531
4609
  };
4532
4610
 
4533
4611
  // src/commands/canvas/commands/entryPattern/publish.ts
4534
- import { ContentClient as ContentClient18 } from "@uniformdev/canvas";
4535
4612
  var EntryPatternPublishModule = {
4536
4613
  command: "publish [ids]",
4537
4614
  describe: "Publishes entry pattern(s)",
@@ -4561,7 +4638,7 @@ var EntryPatternPublishModule = {
4561
4638
  }
4562
4639
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
4563
4640
  const fetch3 = nodeFetchProxy(proxy, verbose);
4564
- const client = new ContentClient18({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4641
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
4565
4642
  const source = createEntryEngineDataSource({
4566
4643
  client,
4567
4644
  state: "preview",
@@ -4586,8 +4663,6 @@ var EntryPatternPublishModule = {
4586
4663
  };
4587
4664
 
4588
4665
  // src/commands/canvas/commands/entryPattern/pull.ts
4589
- import { ContentClient as ContentClient19 } from "@uniformdev/canvas";
4590
- import { UncachedFileClient as UncachedFileClient7 } from "@uniformdev/files";
4591
4666
  var EntryPatternPullModule = {
4592
4667
  command: "pull <directory>",
4593
4668
  describe: "Pulls all entry patterns to local files in a directory",
@@ -4634,14 +4709,13 @@ var EntryPatternPullModule = {
4634
4709
  verbose
4635
4710
  }) => {
4636
4711
  const fetch3 = nodeFetchProxy(proxy, verbose);
4637
- const client = new ContentClient19({
4712
+ const client = getContentClient({
4638
4713
  apiKey,
4639
4714
  apiHost,
4640
4715
  fetch: fetch3,
4641
- projectId,
4642
- bypassCache: true
4716
+ projectId
4643
4717
  });
4644
- const fileClient = new UncachedFileClient7({ apiKey, apiHost, fetch: fetch3, projectId });
4718
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
4645
4719
  const source = createEntryEngineDataSource({ client, state, onlyPatterns: true });
4646
4720
  let target;
4647
4721
  const isPackage = isPathAPackageFile(directory);
@@ -4690,8 +4764,6 @@ var EntryPatternPullModule = {
4690
4764
  };
4691
4765
 
4692
4766
  // src/commands/canvas/commands/entryPattern/push.ts
4693
- import { ContentClient as ContentClient20 } from "@uniformdev/canvas";
4694
- import { UncachedFileClient as UncachedFileClient8 } from "@uniformdev/files";
4695
4767
  var EntryPatternPushModule = {
4696
4768
  command: "push <directory>",
4697
4769
  describe: "Pushes all entry patterns from files in a directory to Uniform",
@@ -4736,12 +4808,11 @@ var EntryPatternPushModule = {
4736
4808
  verbose
4737
4809
  }) => {
4738
4810
  const fetch3 = nodeFetchProxy(proxy, verbose);
4739
- const client = new ContentClient20({
4811
+ const client = getContentClient({
4740
4812
  apiKey,
4741
4813
  apiHost,
4742
4814
  fetch: fetch3,
4743
- projectId,
4744
- bypassCache: true
4815
+ projectId
4745
4816
  });
4746
4817
  let source;
4747
4818
  const isPackage = isPathAPackageFile(directory);
@@ -4762,7 +4833,7 @@ var EntryPatternPushModule = {
4762
4833
  });
4763
4834
  }
4764
4835
  const target = createEntryEngineDataSource({ client, state, onlyPatterns: true });
4765
- const fileClient = new UncachedFileClient8({ apiKey, apiHost, fetch: fetch3, projectId });
4836
+ const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
4766
4837
  await syncEngine({
4767
4838
  source,
4768
4839
  target,
@@ -4786,7 +4857,6 @@ var EntryPatternPushModule = {
4786
4857
  };
4787
4858
 
4788
4859
  // src/commands/canvas/commands/entryPattern/remove.ts
4789
- import { ContentClient as ContentClient21 } from "@uniformdev/canvas";
4790
4860
  var EntryPatternRemoveModule = {
4791
4861
  command: "remove <id>",
4792
4862
  aliases: ["delete", "rm"],
@@ -4802,7 +4872,7 @@ var EntryPatternRemoveModule = {
4802
4872
  ),
4803
4873
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
4804
4874
  const fetch3 = nodeFetchProxy(proxy, verbose);
4805
- const client = new ContentClient21({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4875
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
4806
4876
  if (!whatIf) {
4807
4877
  await client.deleteEntry({ entryId: id });
4808
4878
  } else {
@@ -4812,7 +4882,7 @@ var EntryPatternRemoveModule = {
4812
4882
  };
4813
4883
 
4814
4884
  // src/commands/canvas/commands/entryPattern/unpublish.ts
4815
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4, ContentClient as ContentClient22 } from "@uniformdev/canvas";
4885
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
4816
4886
  import { diffJson as diffJson4 } from "diff";
4817
4887
  var EntryPatternUnpublishModule = {
4818
4888
  command: "unpublish [ids]",
@@ -4842,7 +4912,7 @@ var EntryPatternUnpublishModule = {
4842
4912
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
4843
4913
  const targetItems = /* @__PURE__ */ new Map();
4844
4914
  const fetch3 = nodeFetchProxy(proxy, verbose);
4845
- const client = new ContentClient22({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4915
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch3, projectId });
4846
4916
  const source = createEntryEngineDataSource({
4847
4917
  client,
4848
4918
  state: "published",
@@ -4880,14 +4950,13 @@ var EntryPatternUnpublishModule = {
4880
4950
  providerId: sourceObject.providerId,
4881
4951
  displayName: sourceObject.displayName ?? sourceObject.providerId,
4882
4952
  whatIf,
4883
- diff: diffJson4(targetObject.object, sourceObject.object)
4953
+ diff: () => diffJson4(targetObject.object, sourceObject.object)
4884
4954
  });
4885
4955
  }
4886
4956
  }
4887
4957
  };
4888
4958
 
4889
4959
  // src/commands/canvas/commands/entryPattern/update.ts
4890
- import { ContentClient as ContentClient23 } from "@uniformdev/canvas";
4891
4960
  var EntryPatternUpdateModule = {
4892
4961
  command: "update <filename>",
4893
4962
  aliases: ["put"],
@@ -4915,7 +4984,7 @@ var EntryPatternUpdateModule = {
4915
4984
  whatIf
4916
4985
  }) => {
4917
4986
  const fetch3 = nodeFetchProxy(proxy, verbose);
4918
- const client = new ContentClient23({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4987
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId });
4919
4988
  const file = readFileToObject(filename);
4920
4989
  if (!whatIf) {
4921
4990
  await client.upsertEntry({ ...file, state: convertStateOption(state) });
@@ -4942,9 +5011,6 @@ var EntryPatternModule = {
4942
5011
  // src/commands/canvas/commands/locale.ts
4943
5012
  import yargs12 from "yargs";
4944
5013
 
4945
- // src/commands/canvas/commands/locale/pull.ts
4946
- import { LocaleClient } from "@uniformdev/canvas";
4947
-
4948
5014
  // src/commands/canvas/localesEngineDataSource.ts
4949
5015
  function createLocaleEngineDataSource({
4950
5016
  client
@@ -4975,6 +5041,12 @@ function createLocaleEngineDataSource({
4975
5041
  };
4976
5042
  }
4977
5043
 
5044
+ // src/commands/canvas/commands/locale/_util.ts
5045
+ import { LocaleClient } from "@uniformdev/canvas";
5046
+ function getLocaleClient(options) {
5047
+ return new LocaleClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
5048
+ }
5049
+
4978
5050
  // src/commands/canvas/commands/locale/pull.ts
4979
5051
  var LocalePullModule = {
4980
5052
  command: "pull <directory>",
@@ -5019,12 +5091,11 @@ var LocalePullModule = {
5019
5091
  verbose
5020
5092
  }) => {
5021
5093
  const fetch3 = nodeFetchProxy(proxy, verbose);
5022
- const client = new LocaleClient({
5094
+ const client = getLocaleClient({
5023
5095
  apiKey,
5024
5096
  apiHost,
5025
5097
  fetch: fetch3,
5026
- projectId,
5027
- bypassCache: true
5098
+ projectId
5028
5099
  });
5029
5100
  const source = createLocaleEngineDataSource({ client });
5030
5101
  let target;
@@ -5062,7 +5133,6 @@ var LocalePullModule = {
5062
5133
  };
5063
5134
 
5064
5135
  // src/commands/canvas/commands/locale/push.ts
5065
- import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
5066
5136
  var LocalePushModule = {
5067
5137
  command: "push <directory>",
5068
5138
  describe: "Pushes all locales from files in a directory to Uniform",
@@ -5099,12 +5169,11 @@ var LocalePushModule = {
5099
5169
  verbose
5100
5170
  }) => {
5101
5171
  const fetch3 = nodeFetchProxy(proxy, verbose);
5102
- const client = new LocaleClient2({
5172
+ const client = getLocaleClient({
5103
5173
  apiKey,
5104
5174
  apiHost,
5105
5175
  fetch: fetch3,
5106
- projectId,
5107
- bypassCache: true
5176
+ projectId
5108
5177
  });
5109
5178
  let source;
5110
5179
  const isPackage = isPathAPackageFile(directory);
@@ -5376,8 +5445,15 @@ var PatternModule = {
5376
5445
  // src/commands/canvas/commands/previewUrl.ts
5377
5446
  import yargs14 from "yargs";
5378
5447
 
5379
- // src/commands/canvas/commands/previewUrl/get.ts
5448
+ // src/commands/canvas/commands/previewUrl/_util.ts
5380
5449
  import { PreviewClient } from "@uniformdev/canvas";
5450
+ var selectIdentifier5 = (previewUrl) => previewUrl.id;
5451
+ var selectDisplayName5 = (previewUrl) => `${previewUrl.name} (pid: ${previewUrl.id})`;
5452
+ function getPreviewClient(options) {
5453
+ return new PreviewClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
5454
+ }
5455
+
5456
+ // src/commands/canvas/commands/previewUrl/get.ts
5381
5457
  var PreviewUrlGetModule = {
5382
5458
  command: "get <id>",
5383
5459
  describe: "Fetch a preview URL",
@@ -5394,7 +5470,7 @@ var PreviewUrlGetModule = {
5394
5470
  ),
5395
5471
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
5396
5472
  const fetch3 = nodeFetchProxy(proxy, verbose);
5397
- const client = new PreviewClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5473
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5398
5474
  const previewUrl = await client.getPreviewUrl({ id });
5399
5475
  if (!previewUrl) {
5400
5476
  console.error("Preview URL did not exist");
@@ -5406,7 +5482,6 @@ var PreviewUrlGetModule = {
5406
5482
  };
5407
5483
 
5408
5484
  // src/commands/canvas/commands/previewUrl/list.ts
5409
- import { PreviewClient as PreviewClient2 } from "@uniformdev/canvas";
5410
5485
  var PreviewUrlListModule = {
5411
5486
  command: "list",
5412
5487
  describe: "List preview URLs",
@@ -5416,19 +5491,12 @@ var PreviewUrlListModule = {
5416
5491
  ),
5417
5492
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5418
5493
  const fetch3 = nodeFetchProxy(proxy, verbose);
5419
- const client = new PreviewClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5494
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5420
5495
  const res = await client.getPreviewUrls();
5421
5496
  emitWithFormat(res.previewUrls, format, filename);
5422
5497
  }
5423
5498
  };
5424
5499
 
5425
- // src/commands/canvas/commands/previewUrl/pull.ts
5426
- import { PreviewClient as PreviewClient3 } from "@uniformdev/canvas";
5427
-
5428
- // src/commands/canvas/commands/previewUrl/_util.ts
5429
- var selectIdentifier5 = (previewUrl) => previewUrl.id;
5430
- var selectDisplayName5 = (previewUrl) => `${previewUrl.name} (pid: ${previewUrl.id})`;
5431
-
5432
5500
  // src/commands/canvas/previewUrlEngineDataSource.ts
5433
5501
  function createPreviewUrlEngineDataSource({
5434
5502
  client
@@ -5501,7 +5569,7 @@ var PreviewUrlPullModule = {
5501
5569
  verbose
5502
5570
  }) => {
5503
5571
  const fetch3 = nodeFetchProxy(proxy, verbose);
5504
- const client = new PreviewClient3({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5572
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5505
5573
  const source = createPreviewUrlEngineDataSource({ client });
5506
5574
  let target;
5507
5575
  const isPackage = isPathAPackageFile(directory);
@@ -5538,7 +5606,6 @@ var PreviewUrlPullModule = {
5538
5606
  };
5539
5607
 
5540
5608
  // src/commands/canvas/commands/previewUrl/push.ts
5541
- import { PreviewClient as PreviewClient4 } from "@uniformdev/canvas";
5542
5609
  var PreviewUrlPushModule = {
5543
5610
  command: "push <directory>",
5544
5611
  describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
@@ -5575,7 +5642,7 @@ var PreviewUrlPushModule = {
5575
5642
  verbose
5576
5643
  }) => {
5577
5644
  const fetch3 = nodeFetchProxy(proxy, verbose);
5578
- const client = new PreviewClient4({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5645
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5579
5646
  let source;
5580
5647
  const isPackage = isPathAPackageFile(directory);
5581
5648
  if (isPackage) {
@@ -5607,7 +5674,6 @@ var PreviewUrlPushModule = {
5607
5674
  };
5608
5675
 
5609
5676
  // src/commands/canvas/commands/previewUrl/remove.ts
5610
- import { PreviewClient as PreviewClient5 } from "@uniformdev/canvas";
5611
5677
  var PreviewUrlRemoveModule = {
5612
5678
  command: "remove <id>",
5613
5679
  aliases: ["delete", "rm"],
@@ -5623,7 +5689,7 @@ var PreviewUrlRemoveModule = {
5623
5689
  ),
5624
5690
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
5625
5691
  const fetch3 = nodeFetchProxy(proxy, verbose);
5626
- const client = new PreviewClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5692
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5627
5693
  if (!whatIf) {
5628
5694
  await client.deletePreviewUrl({ id });
5629
5695
  } else {
@@ -5633,7 +5699,6 @@ var PreviewUrlRemoveModule = {
5633
5699
  };
5634
5700
 
5635
5701
  // src/commands/canvas/commands/previewUrl/update.ts
5636
- import { PreviewClient as PreviewClient6 } from "@uniformdev/canvas";
5637
5702
  var PreviewUrlUpdateModule = {
5638
5703
  command: "update <filename>",
5639
5704
  aliases: ["put"],
@@ -5649,7 +5714,7 @@ var PreviewUrlUpdateModule = {
5649
5714
  ),
5650
5715
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, whatIf, verbose }) => {
5651
5716
  const fetch3 = nodeFetchProxy(proxy, verbose);
5652
- const client = new PreviewClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5717
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5653
5718
  const file = readFileToObject(filename);
5654
5719
  if (!whatIf) {
5655
5720
  await client.upsertPreviewUrl(file);
@@ -5674,7 +5739,6 @@ var PreviewUrlModule = {
5674
5739
  import yargs15 from "yargs";
5675
5740
 
5676
5741
  // src/commands/canvas/commands/previewViewport/get.ts
5677
- import { PreviewClient as PreviewClient7 } from "@uniformdev/canvas";
5678
5742
  var PreviewViewportGetModule = {
5679
5743
  command: "get <id>",
5680
5744
  describe: "Fetch a preview viewport",
@@ -5691,7 +5755,7 @@ var PreviewViewportGetModule = {
5691
5755
  ),
5692
5756
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
5693
5757
  const fetch3 = nodeFetchProxy(proxy, verbose);
5694
- const client = new PreviewClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5758
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5695
5759
  const previewViewport = await client.getPreviewViewport({ id });
5696
5760
  if (!previewViewport) {
5697
5761
  console.error("Preview viewport did not exist");
@@ -5703,7 +5767,6 @@ var PreviewViewportGetModule = {
5703
5767
  };
5704
5768
 
5705
5769
  // src/commands/canvas/commands/previewViewport/list.ts
5706
- import { PreviewClient as PreviewClient8 } from "@uniformdev/canvas";
5707
5770
  var PreviewViewportListModule = {
5708
5771
  command: "list",
5709
5772
  describe: "List preview viewports",
@@ -5713,15 +5776,12 @@ var PreviewViewportListModule = {
5713
5776
  ),
5714
5777
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5715
5778
  const fetch3 = nodeFetchProxy(proxy, verbose);
5716
- const client = new PreviewClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5779
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5717
5780
  const res = await client.getPreviewViewports();
5718
5781
  emitWithFormat(res.previewViewports, format, filename);
5719
5782
  }
5720
5783
  };
5721
5784
 
5722
- // src/commands/canvas/commands/previewViewport/pull.ts
5723
- import { PreviewClient as PreviewClient9 } from "@uniformdev/canvas";
5724
-
5725
5785
  // src/commands/canvas/commands/previewViewport/_util.ts
5726
5786
  var selectIdentifier6 = (previewViewport) => previewViewport.id;
5727
5787
  var selectDisplayName6 = (previewViewport) => `${previewViewport.name} (pid: ${previewViewport.id})`;
@@ -5798,7 +5858,7 @@ var PreviewViewportPullModule = {
5798
5858
  verbose
5799
5859
  }) => {
5800
5860
  const fetch3 = nodeFetchProxy(proxy, verbose);
5801
- const client = new PreviewClient9({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5861
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5802
5862
  const source = createPreviewViewportEngineDataSource({ client });
5803
5863
  let target;
5804
5864
  const isPackage = isPathAPackageFile(directory);
@@ -5835,7 +5895,6 @@ var PreviewViewportPullModule = {
5835
5895
  };
5836
5896
 
5837
5897
  // src/commands/canvas/commands/previewViewport/push.ts
5838
- import { PreviewClient as PreviewClient10 } from "@uniformdev/canvas";
5839
5898
  var PreviewViewportPushModule = {
5840
5899
  command: "push <directory>",
5841
5900
  describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
@@ -5872,7 +5931,7 @@ var PreviewViewportPushModule = {
5872
5931
  verbose
5873
5932
  }) => {
5874
5933
  const fetch3 = nodeFetchProxy(proxy, verbose);
5875
- const client = new PreviewClient10({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5934
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5876
5935
  let source;
5877
5936
  const isPackage = isPathAPackageFile(directory);
5878
5937
  if (isPackage) {
@@ -5904,7 +5963,6 @@ var PreviewViewportPushModule = {
5904
5963
  };
5905
5964
 
5906
5965
  // src/commands/canvas/commands/previewViewport/remove.ts
5907
- import { PreviewClient as PreviewClient11 } from "@uniformdev/canvas";
5908
5966
  var PreviewViewportRemoveModule = {
5909
5967
  command: "remove <id>",
5910
5968
  aliases: ["delete", "rm"],
@@ -5920,7 +5978,7 @@ var PreviewViewportRemoveModule = {
5920
5978
  ),
5921
5979
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
5922
5980
  const fetch3 = nodeFetchProxy(proxy, verbose);
5923
- const client = new PreviewClient11({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
5981
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5924
5982
  if (!whatIf) {
5925
5983
  await client.deletePreviewViewport({ id });
5926
5984
  } else {
@@ -5930,7 +5988,6 @@ var PreviewViewportRemoveModule = {
5930
5988
  };
5931
5989
 
5932
5990
  // src/commands/canvas/commands/previewViewport/update.ts
5933
- import { PreviewClient as PreviewClient12 } from "@uniformdev/canvas";
5934
5991
  var PreviewViewportUpdateModule = {
5935
5992
  command: "update <filename>",
5936
5993
  aliases: ["put"],
@@ -5946,7 +6003,7 @@ var PreviewViewportUpdateModule = {
5946
6003
  ),
5947
6004
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, whatIf, verbose }) => {
5948
6005
  const fetch3 = nodeFetchProxy(proxy, verbose);
5949
- const client = new PreviewClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6006
+ const client = getPreviewClient({ apiKey, apiHost, fetch: fetch3, projectId });
5950
6007
  const file = readFileToObject(filename);
5951
6008
  if (!whatIf) {
5952
6009
  await client.upsertPreviewViewport(file);
@@ -5970,8 +6027,13 @@ var PreviewViewportModule = {
5970
6027
  // src/commands/canvas/commands/prompts.ts
5971
6028
  import yargs16 from "yargs";
5972
6029
 
5973
- // src/commands/canvas/commands/prompts/get.ts
6030
+ // src/commands/canvas/commands/prompts/_util.ts
5974
6031
  import { PromptClient } from "@uniformdev/canvas";
6032
+ var selectPromptIdentifier = (e) => e.id;
6033
+ var selectPromptDisplayName = (e) => `${e.name ?? "Untitled"} (pid: ${e.id})`;
6034
+ var getPromptClient = (options) => new PromptClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
6035
+
6036
+ // src/commands/canvas/commands/prompts/get.ts
5975
6037
  var PromptGetModule = {
5976
6038
  command: "get <id>",
5977
6039
  describe: "Get a prompt",
@@ -5980,7 +6042,6 @@ var PromptGetModule = {
5980
6042
  withFormatOptions(
5981
6043
  withApiOptions(
5982
6044
  withProjectOptions(
5983
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5984
6045
  yargs38.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
5985
6046
  )
5986
6047
  )
@@ -5989,7 +6050,7 @@ var PromptGetModule = {
5989
6050
  ),
5990
6051
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
5991
6052
  const fetch3 = nodeFetchProxy(proxy, verbose);
5992
- const client = new PromptClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6053
+ const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
5993
6054
  const res = await client.get({ promptId: id });
5994
6055
  if (!res) {
5995
6056
  throw new Error(`Prompt with ID ${id} not found`);
@@ -5999,26 +6060,18 @@ var PromptGetModule = {
5999
6060
  };
6000
6061
 
6001
6062
  // src/commands/canvas/commands/prompts/list.ts
6002
- import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
6003
6063
  var PromptListModule = {
6004
6064
  command: "list",
6005
6065
  describe: "List prompts",
6006
6066
  builder: (yargs38) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs38))))),
6007
6067
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
6008
6068
  const fetch3 = nodeFetchProxy(proxy, verbose);
6009
- const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6069
+ const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
6010
6070
  const res = await client.get();
6011
6071
  emitWithFormat(res, format, filename);
6012
6072
  }
6013
6073
  };
6014
6074
 
6015
- // src/commands/canvas/commands/prompts/pull.ts
6016
- import { PromptClient as PromptClient3 } from "@uniformdev/canvas";
6017
-
6018
- // src/commands/canvas/commands/prompts/_util.ts
6019
- var selectPromptIdentifier = (e) => e.id;
6020
- var selectPromptDisplayName = (e) => `${e.name ?? "Untitled"} (pid: ${e.id})`;
6021
-
6022
6075
  // src/commands/canvas/promptEngineDataSource.ts
6023
6076
  function createPromptEngineDataSource({
6024
6077
  client
@@ -6093,12 +6146,11 @@ var PromptPullModule = {
6093
6146
  verbose
6094
6147
  }) => {
6095
6148
  const fetch3 = nodeFetchProxy(proxy, verbose);
6096
- const client = new PromptClient3({
6149
+ const client = getPromptClient({
6097
6150
  apiKey,
6098
6151
  apiHost,
6099
6152
  fetch: fetch3,
6100
- projectId,
6101
- bypassCache: true
6153
+ projectId
6102
6154
  });
6103
6155
  const source = createPromptEngineDataSource({ client });
6104
6156
  let target;
@@ -6136,7 +6188,6 @@ var PromptPullModule = {
6136
6188
  };
6137
6189
 
6138
6190
  // src/commands/canvas/commands/prompts/push.ts
6139
- import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
6140
6191
  var PromptPushModule = {
6141
6192
  command: "push <directory>",
6142
6193
  describe: "Pushes all prompts from files in a directory to Uniform",
@@ -6173,12 +6224,11 @@ var PromptPushModule = {
6173
6224
  verbose
6174
6225
  }) => {
6175
6226
  const fetch3 = nodeFetchProxy(proxy, verbose);
6176
- const client = new PromptClient4({
6227
+ const client = getPromptClient({
6177
6228
  apiKey,
6178
6229
  apiHost,
6179
6230
  fetch: fetch3,
6180
- projectId,
6181
- bypassCache: true
6231
+ projectId
6182
6232
  });
6183
6233
  let source;
6184
6234
  const isPackage = isPathAPackageFile(directory);
@@ -6211,7 +6261,6 @@ var PromptPushModule = {
6211
6261
  };
6212
6262
 
6213
6263
  // src/commands/canvas/commands/prompts/remove.ts
6214
- import { PromptClient as PromptClient5 } from "@uniformdev/canvas";
6215
6264
  var PromptRemoveModule = {
6216
6265
  command: "remove <id>",
6217
6266
  aliases: ["delete", "rm"],
@@ -6225,7 +6274,7 @@ var PromptRemoveModule = {
6225
6274
  ),
6226
6275
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
6227
6276
  const fetch3 = nodeFetchProxy(proxy, verbose);
6228
- const client = new PromptClient5({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6277
+ const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
6229
6278
  if (!whatIf) {
6230
6279
  await client.remove({ promptId: id });
6231
6280
  } else {
@@ -6235,7 +6284,6 @@ var PromptRemoveModule = {
6235
6284
  };
6236
6285
 
6237
6286
  // src/commands/canvas/commands/prompts/update.ts
6238
- import { PromptClient as PromptClient6 } from "@uniformdev/canvas";
6239
6287
  var PromptUpdateModule = {
6240
6288
  command: "update <filename>",
6241
6289
  aliases: ["put"],
@@ -6251,7 +6299,7 @@ var PromptUpdateModule = {
6251
6299
  ),
6252
6300
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
6253
6301
  const fetch3 = nodeFetchProxy(proxy, verbose);
6254
- const client = new PromptClient6({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6302
+ const client = getPromptClient({ apiKey, apiHost, fetch: fetch3, projectId });
6255
6303
  const file = readFileToObject(filename);
6256
6304
  if (!whatIf) {
6257
6305
  await client.upsert({ data: file });
@@ -6275,12 +6323,11 @@ var PromptModule = {
6275
6323
  // src/commands/canvas/commands/workflow.ts
6276
6324
  import yargs17 from "yargs";
6277
6325
 
6278
- // src/commands/canvas/commands/workflow/pull.ts
6279
- import { WorkflowClient } from "@uniformdev/canvas";
6280
-
6281
6326
  // src/commands/canvas/commands/workflow/_util.ts
6327
+ import { WorkflowClient } from "@uniformdev/canvas";
6282
6328
  var selectIdentifier7 = (workflow) => workflow.id;
6283
6329
  var selectDisplayName7 = (workflow) => `${workflow.name} (pid: ${workflow.id})`;
6330
+ var getWorkflowClient = (options) => new WorkflowClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
6284
6331
 
6285
6332
  // src/commands/canvas/workflowEngineDataSource.ts
6286
6333
  function createWorkflowEngineDataSource({
@@ -6357,7 +6404,7 @@ var WorkflowPullModule = {
6357
6404
  verbose
6358
6405
  }) => {
6359
6406
  const fetch3 = nodeFetchProxy(proxy, verbose);
6360
- const client = new WorkflowClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6407
+ const client = getWorkflowClient({ apiKey, apiHost, fetch: fetch3, projectId });
6361
6408
  const source = createWorkflowEngineDataSource({ client });
6362
6409
  let target;
6363
6410
  const isPackage = isPathAPackageFile(directory);
@@ -6394,7 +6441,6 @@ var WorkflowPullModule = {
6394
6441
  };
6395
6442
 
6396
6443
  // src/commands/canvas/commands/workflow/push.ts
6397
- import { WorkflowClient as WorkflowClient2 } from "@uniformdev/canvas";
6398
6444
  var WorkflowPushModule = {
6399
6445
  command: "push <directory>",
6400
6446
  describe: "Pushes all workflows from files in a directory to Uniform Canvas",
@@ -6431,7 +6477,7 @@ var WorkflowPushModule = {
6431
6477
  verbose
6432
6478
  }) => {
6433
6479
  const fetch3 = nodeFetchProxy(proxy, verbose);
6434
- const client = new WorkflowClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
6480
+ const client = getWorkflowClient({ apiKey, apiHost, fetch: fetch3, projectId });
6435
6481
  let source;
6436
6482
  const isPackage = isPathAPackageFile(directory);
6437
6483
  if (isPackage) {
@@ -6490,8 +6536,13 @@ import yargs25 from "yargs";
6490
6536
  // src/commands/context/commands/aggregate.ts
6491
6537
  import yargs19 from "yargs";
6492
6538
 
6539
+ // src/commands/context/commands/aggregate/_util.ts
6540
+ import { AggregateClient } from "@uniformdev/context/api";
6541
+ var selectIdentifier8 = (source) => source.id;
6542
+ var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
6543
+ var getAggregateClient = (options) => new AggregateClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
6544
+
6493
6545
  // src/commands/context/commands/aggregate/get.ts
6494
- import { UncachedAggregateClient } from "@uniformdev/context/api";
6495
6546
  var AggregateGetModule = {
6496
6547
  command: "get <id>",
6497
6548
  describe: "Fetch an aggregate",
@@ -6506,7 +6557,7 @@ var AggregateGetModule = {
6506
6557
  ),
6507
6558
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
6508
6559
  const fetch3 = nodeFetchProxy(proxy);
6509
- const client = new UncachedAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6560
+ const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6510
6561
  const res = await client.get({ aggregateId: id });
6511
6562
  if (res.aggregates.length === 0) {
6512
6563
  console.error("Aggregate did not exist");
@@ -6518,7 +6569,6 @@ var AggregateGetModule = {
6518
6569
  };
6519
6570
 
6520
6571
  // src/commands/context/commands/aggregate/list.ts
6521
- import { UncachedAggregateClient as UncachedAggregateClient2 } from "@uniformdev/context/api";
6522
6572
  var AggregateListModule = {
6523
6573
  command: "list",
6524
6574
  describe: "List aggregates",
@@ -6526,19 +6576,12 @@ var AggregateListModule = {
6526
6576
  builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
6527
6577
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
6528
6578
  const fetch3 = nodeFetchProxy(proxy);
6529
- const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
6579
+ const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6530
6580
  const res = await client.get({});
6531
6581
  emitWithFormat(res.aggregates, format, filename);
6532
6582
  }
6533
6583
  };
6534
6584
 
6535
- // src/commands/context/commands/aggregate/pull.ts
6536
- import { UncachedAggregateClient as UncachedAggregateClient3 } from "@uniformdev/context/api";
6537
-
6538
- // src/commands/context/commands/aggregate/_util.ts
6539
- var selectIdentifier8 = (source) => source.id;
6540
- var selectDisplayName8 = (source) => `${source.name} (pid: ${source.id})`;
6541
-
6542
6585
  // src/commands/context/aggregateEngineDataSource.ts
6543
6586
  function createAggregateEngineDataSource({
6544
6587
  client,
@@ -6633,7 +6676,7 @@ var AggregatePullModule = {
6633
6676
  verbose
6634
6677
  }) => {
6635
6678
  const fetch3 = nodeFetchProxy(proxy, verbose);
6636
- const client = new UncachedAggregateClient3({ apiKey, apiHost, fetch: fetch3, projectId });
6679
+ const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6637
6680
  const source = createAggregateEngineDataSource({ client });
6638
6681
  let target;
6639
6682
  const isPackage = isPathAPackageFile(directory);
@@ -6670,7 +6713,6 @@ var AggregatePullModule = {
6670
6713
  };
6671
6714
 
6672
6715
  // src/commands/context/commands/aggregate/push.ts
6673
- import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev/context/api";
6674
6716
  var AggregatePushModule = {
6675
6717
  command: "push <directory>",
6676
6718
  describe: "Pushes all aggregates from files in a directory or package to Uniform",
@@ -6707,7 +6749,7 @@ var AggregatePushModule = {
6707
6749
  verbose
6708
6750
  }) => {
6709
6751
  const fetch3 = nodeFetchProxy(proxy, verbose);
6710
- const client = new UncachedAggregateClient4({ apiKey, apiHost, fetch: fetch3, projectId });
6752
+ const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6711
6753
  let source;
6712
6754
  const isPackage = isPathAPackageFile(directory);
6713
6755
  if (isPackage) {
@@ -6740,7 +6782,6 @@ var AggregatePushModule = {
6740
6782
  };
6741
6783
 
6742
6784
  // src/commands/context/commands/aggregate/remove.ts
6743
- import { UncachedAggregateClient as UncachedAggregateClient5 } from "@uniformdev/context/api";
6744
6785
  var AggregateRemoveModule = {
6745
6786
  command: "remove <id>",
6746
6787
  aliases: ["delete", "rm"],
@@ -6754,13 +6795,12 @@ var AggregateRemoveModule = {
6754
6795
  ),
6755
6796
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
6756
6797
  const fetch3 = nodeFetchProxy(proxy);
6757
- const client = new UncachedAggregateClient5({ apiKey, apiHost, fetch: fetch3, projectId });
6798
+ const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6758
6799
  await client.remove({ aggregateId: id });
6759
6800
  }
6760
6801
  };
6761
6802
 
6762
6803
  // src/commands/context/commands/aggregate/update.ts
6763
- import { UncachedAggregateClient as UncachedAggregateClient6 } from "@uniformdev/context/api";
6764
6804
  var AggregateUpdateModule = {
6765
6805
  command: "update <filename>",
6766
6806
  aliases: ["put"],
@@ -6774,7 +6814,7 @@ var AggregateUpdateModule = {
6774
6814
  ),
6775
6815
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
6776
6816
  const fetch3 = nodeFetchProxy(proxy);
6777
- const client = new UncachedAggregateClient6({ apiKey, apiHost, fetch: fetch3, projectId });
6817
+ const client = getAggregateClient({ apiKey, apiHost, fetch: fetch3, projectId });
6778
6818
  const file = readFileToObject(filename);
6779
6819
  await client.upsert({ aggregate: file });
6780
6820
  }
@@ -6794,8 +6834,15 @@ var AggregateModule = {
6794
6834
  // src/commands/context/commands/enrichment.ts
6795
6835
  import yargs20 from "yargs";
6796
6836
 
6797
- // src/commands/context/commands/enrichment/get.ts
6837
+ // src/commands/context/commands/enrichment/_util.ts
6798
6838
  import { UncachedEnrichmentClient } from "@uniformdev/context/api";
6839
+ var selectIdentifier9 = (source) => source.id;
6840
+ var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
6841
+ function getEnrichmentClient(options) {
6842
+ return new UncachedEnrichmentClient({ ...options, limitPolicy: cliLimitPolicy });
6843
+ }
6844
+
6845
+ // src/commands/context/commands/enrichment/get.ts
6799
6846
  var EnrichmentGetModule = {
6800
6847
  command: "get <id>",
6801
6848
  describe: "Fetch an enrichment category and its values",
@@ -6810,7 +6857,7 @@ var EnrichmentGetModule = {
6810
6857
  ),
6811
6858
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
6812
6859
  const fetch3 = nodeFetchProxy(proxy);
6813
- const client = new UncachedEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
6860
+ const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
6814
6861
  const res = (await client.get())?.enrichments?.filter((enr) => enr.id === id);
6815
6862
  if (res.length === 0) {
6816
6863
  console.error("Enrichment did not exist");
@@ -6822,7 +6869,6 @@ var EnrichmentGetModule = {
6822
6869
  };
6823
6870
 
6824
6871
  // src/commands/context/commands/enrichment/list.ts
6825
- import { UncachedEnrichmentClient as UncachedEnrichmentClient2 } from "@uniformdev/context/api";
6826
6872
  var EnrichmentListModule = {
6827
6873
  command: "list",
6828
6874
  describe: "List enrichments",
@@ -6830,19 +6876,12 @@ var EnrichmentListModule = {
6830
6876
  builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
6831
6877
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
6832
6878
  const fetch3 = nodeFetchProxy(proxy);
6833
- const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
6879
+ const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
6834
6880
  const res = await client.get();
6835
6881
  emitWithFormat(res.enrichments, format, filename);
6836
6882
  }
6837
6883
  };
6838
6884
 
6839
- // src/commands/context/commands/enrichment/pull.ts
6840
- import { UncachedEnrichmentClient as UncachedEnrichmentClient3 } from "@uniformdev/context/api";
6841
-
6842
- // src/commands/context/commands/enrichment/_util.ts
6843
- var selectIdentifier9 = (source) => source.id;
6844
- var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
6845
-
6846
6885
  // src/commands/context/enrichmentEngineDataSource.ts
6847
6886
  function createEnrichmentEngineDataSource({
6848
6887
  client
@@ -6969,7 +7008,7 @@ var EnrichmentPullModule = {
6969
7008
  verbose
6970
7009
  }) => {
6971
7010
  const fetch3 = nodeFetchProxy(proxy, verbose);
6972
- const client = new UncachedEnrichmentClient3({ apiKey, apiHost, fetch: fetch3, projectId });
7011
+ const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
6973
7012
  const source = createEnrichmentEngineDataSource({ client });
6974
7013
  let target;
6975
7014
  const isPackage = isPathAPackageFile(directory);
@@ -7006,7 +7045,6 @@ var EnrichmentPullModule = {
7006
7045
  };
7007
7046
 
7008
7047
  // src/commands/context/commands/enrichment/push.ts
7009
- import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformdev/context/api";
7010
7048
  var EnrichmentPushModule = {
7011
7049
  command: "push <directory>",
7012
7050
  describe: "Pushes all enrichments from files in a directory or package to Uniform",
@@ -7041,7 +7079,7 @@ var EnrichmentPushModule = {
7041
7079
  verbose
7042
7080
  }) => {
7043
7081
  const fetch3 = nodeFetchProxy(proxy, verbose);
7044
- const client = new UncachedEnrichmentClient4({ apiKey, apiHost, fetch: fetch3, projectId });
7082
+ const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
7045
7083
  let source;
7046
7084
  const isPackage = isPathAPackageFile(directory);
7047
7085
  if (isPackage) {
@@ -7073,7 +7111,6 @@ var EnrichmentPushModule = {
7073
7111
  };
7074
7112
 
7075
7113
  // src/commands/context/commands/enrichment/remove.ts
7076
- import { UncachedEnrichmentClient as UncachedEnrichmentClient5 } from "@uniformdev/context/api";
7077
7114
  var EnrichmentRemoveModule = {
7078
7115
  command: "remove <id>",
7079
7116
  aliases: ["delete", "rm"],
@@ -7087,7 +7124,7 @@ var EnrichmentRemoveModule = {
7087
7124
  ),
7088
7125
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
7089
7126
  const fetch3 = nodeFetchProxy(proxy);
7090
- const client = new UncachedEnrichmentClient5({ apiKey, apiHost, fetch: fetch3, projectId });
7127
+ const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
7091
7128
  await client.removeCategory({ enrichmentId: id });
7092
7129
  }
7093
7130
  };
@@ -8101,13 +8138,13 @@ import yargs26 from "yargs";
8101
8138
  import { readFileSync } from "fs";
8102
8139
 
8103
8140
  // src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
8104
- import { createLimitPolicy } from "@uniformdev/canvas";
8141
+ import { createLimitPolicy as createLimitPolicy2 } from "@uniformdev/canvas";
8105
8142
  import { ApiClient } from "@uniformdev/context/api";
8106
8143
  var ENDPOINT = "/api/v1/integration-edgehancers";
8107
8144
  var EdgehancerClient = class extends ApiClient {
8108
8145
  constructor(options) {
8109
8146
  if (!options.limitPolicy) {
8110
- options.limitPolicy = createLimitPolicy({});
8147
+ options.limitPolicy = createLimitPolicy2({});
8111
8148
  }
8112
8149
  super(options);
8113
8150
  this.options = options;
@@ -8197,13 +8234,13 @@ var IntegrationEdgehancerModule = {
8197
8234
  };
8198
8235
 
8199
8236
  // src/commands/integration/commands/definition/DefinitionClient.ts
8200
- import { createLimitPolicy as createLimitPolicy2 } from "@uniformdev/canvas";
8237
+ import { createLimitPolicy as createLimitPolicy3 } from "@uniformdev/canvas";
8201
8238
  import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
8202
8239
  var ENDPOINT2 = "/api/v1/integration-definitions";
8203
8240
  var DefinitionClient = class extends ApiClient2 {
8204
8241
  constructor(options) {
8205
8242
  if (!options.limitPolicy) {
8206
- options.limitPolicy = createLimitPolicy2({});
8243
+ options.limitPolicy = createLimitPolicy3({});
8207
8244
  }
8208
8245
  super(options);
8209
8246
  this.options = options;
@@ -8282,13 +8319,13 @@ var IntegrationDefinitionModule = {
8282
8319
  };
8283
8320
 
8284
8321
  // src/commands/integration/commands/InstallClient.ts
8285
- import { createLimitPolicy as createLimitPolicy3 } from "@uniformdev/canvas";
8322
+ import { createLimitPolicy as createLimitPolicy4 } from "@uniformdev/canvas";
8286
8323
  import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
8287
8324
  var ENDPOINT3 = "/api/v1/integration-installations";
8288
8325
  var InstallClient = class extends ApiClient3 {
8289
8326
  constructor(options) {
8290
8327
  if (!options.limitPolicy) {
8291
- options.limitPolicy = createLimitPolicy3({});
8328
+ options.limitPolicy = createLimitPolicy4({});
8292
8329
  }
8293
8330
  super(options);
8294
8331
  this.options = options;
@@ -8330,10 +8367,10 @@ var IntegrationInstallModule = {
8330
8367
  )
8331
8368
  )
8332
8369
  ),
8333
- handler: async ({ apiHost, apiKey, proxy, type, configuration: configuration2, project: projectId }) => {
8370
+ handler: async ({ apiHost, apiKey, proxy, type, configuration, project: projectId }) => {
8334
8371
  const fetch3 = nodeFetchProxy(proxy);
8335
8372
  const client = new InstallClient({ apiKey, apiHost, fetch: fetch3, projectId });
8336
- const data = configuration2 ? JSON.parse(configuration2) : void 0;
8373
+ const data = configuration ? JSON.parse(configuration) : void 0;
8337
8374
  await client.install({ data, type });
8338
8375
  }
8339
8376
  };
@@ -8393,7 +8430,7 @@ import { PostHog } from "posthog-node";
8393
8430
  // package.json
8394
8431
  var package_default = {
8395
8432
  name: "@uniformdev/cli",
8396
- version: "19.209.1",
8433
+ version: "19.210.0",
8397
8434
  description: "Uniform command line interface tool",
8398
8435
  license: "SEE LICENSE IN LICENSE.txt",
8399
8436
  main: "./cli.js",
@@ -8442,7 +8479,7 @@ var package_default = {
8442
8479
  "isomorphic-git": "1.25.2",
8443
8480
  "js-yaml": "^4.1.0",
8444
8481
  jsonwebtoken: "9.0.2",
8445
- "lodash.isequalwith": "^4.4.0",
8482
+ mitt: "^3.0.1",
8446
8483
  open: "10.1.0",
8447
8484
  ora: "8.0.1",
8448
8485
  "p-queue": "7.3.4",
@@ -8459,7 +8496,6 @@ var package_default = {
8459
8496
  "@types/inquirer": "9.0.7",
8460
8497
  "@types/js-yaml": "4.0.9",
8461
8498
  "@types/jsonwebtoken": "9.0.5",
8462
- "@types/lodash.isequalwith": "4.4.9",
8463
8499
  "@types/node": "22.7.8",
8464
8500
  "@types/yargs": "17.0.32"
8465
8501
  },
@@ -9555,8 +9591,15 @@ import yargs33 from "yargs";
9555
9591
  // src/commands/project-map/commands/projectMapDefinition.ts
9556
9592
  import yargs31 from "yargs";
9557
9593
 
9558
- // src/commands/project-map/commands/ProjectMapDefinition/get.ts
9594
+ // src/commands/project-map/commands/ProjectMapDefinition/_util.ts
9559
9595
  import { UncachedProjectMapClient } from "@uniformdev/project-map";
9596
+ var selectIdentifier13 = (source) => source.id;
9597
+ var selectDisplayName13 = (source) => `${source.name} (pid: ${source.id})`;
9598
+ function getProjectMapClient(options) {
9599
+ return new UncachedProjectMapClient({ ...options, limitPolicy: cliLimitPolicy });
9600
+ }
9601
+
9602
+ // src/commands/project-map/commands/ProjectMapDefinition/get.ts
9560
9603
  var ProjectMapDefinitionGetModule = {
9561
9604
  command: "get <id>",
9562
9605
  describe: "Fetch a project map",
@@ -9571,7 +9614,7 @@ var ProjectMapDefinitionGetModule = {
9571
9614
  ),
9572
9615
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
9573
9616
  const fetch3 = nodeFetchProxy(proxy);
9574
- const client = new UncachedProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9617
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9575
9618
  const res = await client.getProjectMapDefinition({ projectMapId: id });
9576
9619
  if (res.projectMaps.length === 0) {
9577
9620
  console.error("ProjectMap does not exist");
@@ -9583,7 +9626,6 @@ var ProjectMapDefinitionGetModule = {
9583
9626
  };
9584
9627
 
9585
9628
  // src/commands/project-map/commands/ProjectMapDefinition/list.ts
9586
- import { UncachedProjectMapClient as UncachedProjectMapClient2 } from "@uniformdev/project-map";
9587
9629
  var ProjectMapDefinitionListModule = {
9588
9630
  command: "list",
9589
9631
  describe: "List of project maps",
@@ -9591,15 +9633,12 @@ var ProjectMapDefinitionListModule = {
9591
9633
  builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
9592
9634
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9593
9635
  const fetch3 = nodeFetchProxy(proxy);
9594
- const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
9636
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9595
9637
  const res = await client.getProjectMapDefinitions();
9596
9638
  emitWithFormat(res.projectMaps, format, filename);
9597
9639
  }
9598
9640
  };
9599
9641
 
9600
- // src/commands/project-map/commands/ProjectMapDefinition/pull.ts
9601
- import { UncachedProjectMapClient as UncachedProjectMapClient3 } from "@uniformdev/project-map";
9602
-
9603
9642
  // src/commands/project-map/package.ts
9604
9643
  function readContextPackage2(filename, assertExists, verbose) {
9605
9644
  if (verbose) {
@@ -9611,10 +9650,6 @@ function writeContextPackage2(filename, packageContents) {
9611
9650
  writeUniformPackage(filename, packageContents);
9612
9651
  }
9613
9652
 
9614
- // src/commands/project-map/commands/ProjectMapDefinition/_util.ts
9615
- var selectIdentifier13 = (source) => source.id;
9616
- var selectDisplayName13 = (source) => `${source.name} (pid: ${source.id})`;
9617
-
9618
9653
  // src/commands/project-map/ProjectMapDefinitionEngineDataSource.ts
9619
9654
  function createProjectMapDefinitionEngineDataSource({
9620
9655
  client
@@ -9689,7 +9724,7 @@ var ProjectMapDefinitionPullModule = {
9689
9724
  verbose
9690
9725
  }) => {
9691
9726
  const fetch3 = nodeFetchProxy(proxy, verbose);
9692
- const client = new UncachedProjectMapClient3({ apiKey, apiHost, fetch: fetch3, projectId });
9727
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9693
9728
  const source = createProjectMapDefinitionEngineDataSource({ client });
9694
9729
  let target;
9695
9730
  const isPackage = isPathAPackageFile(directory);
@@ -9726,7 +9761,6 @@ var ProjectMapDefinitionPullModule = {
9726
9761
  };
9727
9762
 
9728
9763
  // src/commands/project-map/commands/ProjectMapDefinition/push.ts
9729
- import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformdev/project-map";
9730
9764
  var ProjectMapDefinitionPushModule = {
9731
9765
  command: "push <directory>",
9732
9766
  describe: "Pushes all project maps from files in a directory or package to Uniform",
@@ -9763,7 +9797,7 @@ var ProjectMapDefinitionPushModule = {
9763
9797
  verbose
9764
9798
  }) => {
9765
9799
  const fetch3 = nodeFetchProxy(proxy, verbose);
9766
- const client = new UncachedProjectMapClient4({ apiKey, apiHost, fetch: fetch3, projectId });
9800
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9767
9801
  let source;
9768
9802
  const isPackage = isPathAPackageFile(directory);
9769
9803
  if (isPackage) {
@@ -9795,7 +9829,6 @@ var ProjectMapDefinitionPushModule = {
9795
9829
  };
9796
9830
 
9797
9831
  // src/commands/project-map/commands/ProjectMapDefinition/remove.ts
9798
- import { UncachedProjectMapClient as UncachedProjectMapClient5 } from "@uniformdev/project-map";
9799
9832
  var ProjectMapDefinitionRemoveModule = {
9800
9833
  command: "remove <id>",
9801
9834
  aliases: ["delete", "rm"],
@@ -9807,13 +9840,12 @@ var ProjectMapDefinitionRemoveModule = {
9807
9840
  ),
9808
9841
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
9809
9842
  const fetch3 = nodeFetchProxy(proxy);
9810
- const client = new UncachedProjectMapClient5({ apiKey, apiHost, fetch: fetch3, projectId });
9843
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9811
9844
  await client.deleteProjectMap({ projectMapId: id });
9812
9845
  }
9813
9846
  };
9814
9847
 
9815
9848
  // src/commands/project-map/commands/ProjectMapDefinition/update.ts
9816
- import { UncachedProjectMapClient as UncachedProjectMapClient6 } from "@uniformdev/project-map";
9817
9849
  var ProjectMapDefinitionUpdateModule = {
9818
9850
  command: "update <filename>",
9819
9851
  aliases: ["put"],
@@ -9827,7 +9859,7 @@ var ProjectMapDefinitionUpdateModule = {
9827
9859
  ),
9828
9860
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
9829
9861
  const fetch3 = nodeFetchProxy(proxy);
9830
- const client = new UncachedProjectMapClient6({ apiKey, apiHost, fetch: fetch3, projectId });
9862
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9831
9863
  const file = readFileToObject(filename);
9832
9864
  await client.upsertProjectMap({ projectMap: file });
9833
9865
  }
@@ -9847,7 +9879,6 @@ var ProjectMapDefinitionModule = {
9847
9879
  import yargs32 from "yargs";
9848
9880
 
9849
9881
  // src/commands/project-map/commands/ProjectMapNode/get.ts
9850
- import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
9851
9882
  var ProjectMapNodeGetModule = {
9852
9883
  command: "get <id> <projectMapId>",
9853
9884
  describe: "Fetch a project map node",
@@ -9862,7 +9893,7 @@ var ProjectMapNodeGetModule = {
9862
9893
  ),
9863
9894
  handler: async ({ apiHost, apiKey, proxy, id, projectMapId, format, project: projectId, filename }) => {
9864
9895
  const fetch3 = nodeFetchProxy(proxy);
9865
- const client = new UncachedProjectMapClient7({ apiKey, apiHost, fetch: fetch3, projectId });
9896
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9866
9897
  console.log("Debugging params for node get", { projectMapId, id, projectId });
9867
9898
  const res = await client.getNodes({ projectMapId, id });
9868
9899
  if (res.nodes?.length === 0) {
@@ -9875,7 +9906,6 @@ var ProjectMapNodeGetModule = {
9875
9906
  };
9876
9907
 
9877
9908
  // src/commands/project-map/commands/ProjectMapNode/list.ts
9878
- import { UncachedProjectMapClient as UncachedProjectMapClient8 } from "@uniformdev/project-map";
9879
9909
  var ProjectMapNodeListModule = {
9880
9910
  command: "list <projectMapId>",
9881
9911
  describe: "List project map nodes",
@@ -9896,15 +9926,12 @@ var ProjectMapNodeListModule = {
9896
9926
  ),
9897
9927
  handler: async ({ apiHost, apiKey, proxy, projectMapId, format, filename, project: projectId, state }) => {
9898
9928
  const fetch3 = nodeFetchProxy(proxy);
9899
- const client = new UncachedProjectMapClient8({ apiKey, apiHost, fetch: fetch3, projectId });
9929
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
9900
9930
  const res = await client.getNodes({ projectMapId, state: convertStateOption(state) });
9901
9931
  emitWithFormat({ nodes: res.nodes ?? [], projectMapId }, format, filename);
9902
9932
  }
9903
9933
  };
9904
9934
 
9905
- // src/commands/project-map/commands/ProjectMapNode/pull.ts
9906
- import { UncachedProjectMapClient as UncachedProjectMapClient9 } from "@uniformdev/project-map";
9907
-
9908
9935
  // src/commands/project-map/commands/ProjectMapNode/_util.ts
9909
9936
  var selectIdentifier14 = (source, projectId) => [
9910
9937
  projectId + source.projectMapId + source.id,
@@ -9998,7 +10025,7 @@ var ProjectMapNodePullModule = {
9998
10025
  verbose
9999
10026
  }) => {
10000
10027
  const fetch3 = nodeFetchProxy(proxy, verbose);
10001
- const client = new UncachedProjectMapClient9({ apiKey, apiHost, fetch: fetch3, projectId });
10028
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
10002
10029
  const source = createProjectMapNodeEngineDataSource({ client, projectId });
10003
10030
  let target;
10004
10031
  const isPackage = isPathAPackageFile(directory);
@@ -10040,8 +10067,7 @@ var ProjectMapNodePullModule = {
10040
10067
 
10041
10068
  // src/commands/project-map/commands/ProjectMapNode/push.ts
10042
10069
  import {
10043
- __INTERNAL_MISSING_PARENT_NODE_ERROR,
10044
- UncachedProjectMapClient as UncachedProjectMapClient10
10070
+ __INTERNAL_MISSING_PARENT_NODE_ERROR
10045
10071
  } from "@uniformdev/project-map";
10046
10072
  var ProjectMapNodePushModule = {
10047
10073
  command: "push <directory>",
@@ -10079,7 +10105,7 @@ var ProjectMapNodePushModule = {
10079
10105
  verbose
10080
10106
  }) => {
10081
10107
  const fetch3 = nodeFetchProxy(proxy, verbose);
10082
- const client = new UncachedProjectMapClient10({
10108
+ const client = getProjectMapClient({
10083
10109
  apiKey,
10084
10110
  apiHost,
10085
10111
  fetch: fetch3,
@@ -10149,7 +10175,6 @@ var ProjectMapNodePushModule = {
10149
10175
  };
10150
10176
 
10151
10177
  // src/commands/project-map/commands/ProjectMapNode/remove.ts
10152
- import { UncachedProjectMapClient as UncachedProjectMapClient11 } from "@uniformdev/project-map";
10153
10178
  var ProjectMapNodeRemoveModule = {
10154
10179
  command: "remove <id> <projectMapId>",
10155
10180
  aliases: ["delete", "rm"],
@@ -10163,13 +10188,12 @@ var ProjectMapNodeRemoveModule = {
10163
10188
  ),
10164
10189
  handler: async ({ apiHost, apiKey, proxy, projectMapId, id, project: projectId }) => {
10165
10190
  const fetch3 = nodeFetchProxy(proxy);
10166
- const client = new UncachedProjectMapClient11({ apiKey, apiHost, fetch: fetch3, projectId });
10191
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
10167
10192
  await client.deleteProjectMapNode({ projectMapId, nodeId: id });
10168
10193
  }
10169
10194
  };
10170
10195
 
10171
10196
  // src/commands/project-map/commands/ProjectMapNode/update.ts
10172
- import { UncachedProjectMapClient as UncachedProjectMapClient12 } from "@uniformdev/project-map";
10173
10197
  var ProjectMapNodeUpdateModule = {
10174
10198
  command: "update <filename> <projectMapId>",
10175
10199
  aliases: ["put"],
@@ -10183,7 +10207,7 @@ var ProjectMapNodeUpdateModule = {
10183
10207
  ),
10184
10208
  handler: async ({ apiHost, apiKey, proxy, projectMapId, filename, project: projectId }) => {
10185
10209
  const fetch3 = nodeFetchProxy(proxy);
10186
- const client = new UncachedProjectMapClient12({ apiKey, apiHost, fetch: fetch3, projectId });
10210
+ const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch3, projectId });
10187
10211
  const file = readFileToObject(filename);
10188
10212
  await client.upsertProjectMapNodes({ nodes: [{ node: file }], projectMapId });
10189
10213
  }
@@ -10216,8 +10240,26 @@ import yargs35 from "yargs";
10216
10240
  // src/commands/redirect/commands/redirect.ts
10217
10241
  import yargs34 from "yargs";
10218
10242
 
10219
- // src/commands/redirect/commands/RedirectDefinition/get.ts
10243
+ // src/commands/redirect/commands/RedirectDefinition/_util.ts
10220
10244
  import { UncachedRedirectClient } from "@uniformdev/redirect";
10245
+ var selectIdentifier15 = (source) => source.id;
10246
+ var selectFilename2 = (source) => {
10247
+ const index = source.sourceUrl.lastIndexOf("/");
10248
+ return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
10249
+ };
10250
+ var selectDisplayName15 = (source) => {
10251
+ let pathName = source.sourceUrl;
10252
+ if (pathName.length > 30) {
10253
+ const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
10254
+ pathName = "..." + pathName.substring(slashIndex);
10255
+ }
10256
+ return `${pathName} (id: ${source.id})`;
10257
+ };
10258
+ function getRedirectClient(options) {
10259
+ return new UncachedRedirectClient({ ...options, limitPolicy: cliLimitPolicy });
10260
+ }
10261
+
10262
+ // src/commands/redirect/commands/RedirectDefinition/get.ts
10221
10263
  var RedirectDefinitionGetModule = {
10222
10264
  command: "get <id>",
10223
10265
  describe: "Fetch a redirect",
@@ -10232,7 +10274,7 @@ var RedirectDefinitionGetModule = {
10232
10274
  ),
10233
10275
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
10234
10276
  const fetch3 = nodeFetchProxy(proxy);
10235
- const client = new UncachedRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10277
+ const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10236
10278
  const res = await client.getRedirect({ id });
10237
10279
  if (!res) {
10238
10280
  console.error("Redirect does not exist");
@@ -10244,7 +10286,6 @@ var RedirectDefinitionGetModule = {
10244
10286
  };
10245
10287
 
10246
10288
  // src/commands/redirect/commands/RedirectDefinition/list.ts
10247
- import { UncachedRedirectClient as UncachedRedirectClient2 } from "@uniformdev/redirect";
10248
10289
  var RedirectDefinitionListModule = {
10249
10290
  command: "list",
10250
10291
  describe: "List of redirects",
@@ -10252,15 +10293,12 @@ var RedirectDefinitionListModule = {
10252
10293
  builder: (yargs38) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs38)))),
10253
10294
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
10254
10295
  const fetch3 = nodeFetchProxy(proxy);
10255
- const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
10296
+ const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10256
10297
  const res = await client.getRedirects({});
10257
10298
  emitWithFormat(res, format, filename);
10258
10299
  }
10259
10300
  };
10260
10301
 
10261
- // src/commands/redirect/commands/RedirectDefinition/pull.ts
10262
- import { UncachedRedirectClient as UncachedRedirectClient3 } from "@uniformdev/redirect";
10263
-
10264
10302
  // src/commands/redirect/package.ts
10265
10303
  function readContextPackage3(filename, assertExists, verbose) {
10266
10304
  if (verbose) {
@@ -10272,21 +10310,6 @@ function writeContextPackage3(filename, packageContents) {
10272
10310
  writeUniformPackage(filename, packageContents);
10273
10311
  }
10274
10312
 
10275
- // src/commands/redirect/commands/RedirectDefinition/_util.ts
10276
- var selectIdentifier15 = (source) => source.id;
10277
- var selectFilename2 = (source) => {
10278
- const index = source.sourceUrl.lastIndexOf("/");
10279
- return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
10280
- };
10281
- var selectDisplayName15 = (source) => {
10282
- let pathName = source.sourceUrl;
10283
- if (pathName.length > 30) {
10284
- const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
10285
- pathName = "..." + pathName.substring(slashIndex);
10286
- }
10287
- return `${pathName} (id: ${source.id})`;
10288
- };
10289
-
10290
10313
  // src/commands/redirect/RedirectEngineDataSource.ts
10291
10314
  function createRedirectDefinitionEngineDataSource({
10292
10315
  client
@@ -10359,7 +10382,7 @@ var RedirectDefinitionPullModule = {
10359
10382
  verbose
10360
10383
  }) => {
10361
10384
  const fetch3 = nodeFetchProxy(proxy, verbose);
10362
- const client = new UncachedRedirectClient3({ apiKey, apiHost, fetch: fetch3, projectId });
10385
+ const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10363
10386
  const source = createRedirectDefinitionEngineDataSource({ client });
10364
10387
  let target;
10365
10388
  const isPackage = isPathAPackageFile(directory);
@@ -10397,7 +10420,6 @@ var RedirectDefinitionPullModule = {
10397
10420
  };
10398
10421
 
10399
10422
  // src/commands/redirect/commands/RedirectDefinition/push.ts
10400
- import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/redirect";
10401
10423
  var RedirectDefinitionPushModule = {
10402
10424
  command: "push <directory>",
10403
10425
  describe: "Pushes all redirects from files in a directory or package to Uniform",
@@ -10434,7 +10456,7 @@ var RedirectDefinitionPushModule = {
10434
10456
  verbose
10435
10457
  }) => {
10436
10458
  const fetch3 = nodeFetchProxy(proxy, verbose);
10437
- const client = new UncachedRedirectClient4({ apiKey, apiHost, fetch: fetch3, projectId });
10459
+ const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10438
10460
  let source;
10439
10461
  const isPackage = isPathAPackageFile(directory);
10440
10462
  if (isPackage) {
@@ -10466,7 +10488,6 @@ var RedirectDefinitionPushModule = {
10466
10488
  };
10467
10489
 
10468
10490
  // src/commands/redirect/commands/RedirectDefinition/remove.ts
10469
- import { UncachedRedirectClient as UncachedRedirectClient5 } from "@uniformdev/redirect";
10470
10491
  var RedirectDefinitionRemoveModule = {
10471
10492
  command: "remove <id>",
10472
10493
  aliases: ["delete", "rm"],
@@ -10478,13 +10499,12 @@ var RedirectDefinitionRemoveModule = {
10478
10499
  ),
10479
10500
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
10480
10501
  const fetch3 = nodeFetchProxy(proxy);
10481
- const client = new UncachedRedirectClient5({ apiKey, apiHost, fetch: fetch3, projectId });
10502
+ const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10482
10503
  await client.deleteRedirect(id);
10483
10504
  }
10484
10505
  };
10485
10506
 
10486
10507
  // src/commands/redirect/commands/RedirectDefinition/update.ts
10487
- import { UncachedRedirectClient as UncachedRedirectClient6 } from "@uniformdev/redirect";
10488
10508
  var RedirectDefinitionUpdateModule = {
10489
10509
  command: "update <filename>",
10490
10510
  aliases: ["put"],
@@ -10498,7 +10518,7 @@ var RedirectDefinitionUpdateModule = {
10498
10518
  ),
10499
10519
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
10500
10520
  const fetch3 = nodeFetchProxy(proxy);
10501
- const client = new UncachedRedirectClient6({ apiKey, apiHost, fetch: fetch3, projectId });
10521
+ const client = getRedirectClient({ apiKey, apiHost, fetch: fetch3, projectId });
10502
10522
  const file = readFileToObject(filename);
10503
10523
  await client.upsertRedirect(file);
10504
10524
  }
@@ -10534,28 +10554,53 @@ async function spinPromise(action, options) {
10534
10554
  const { successText, failText } = typeof options === "object" ? options : { successText: void 0, failText: void 0 };
10535
10555
  const spinner = ora2(options).start();
10536
10556
  const consoleReplay = [];
10537
- const revertLog = patchConsole("log", spinner, consoleReplay);
10538
- const revertError = patchConsole("error", spinner, consoleReplay);
10539
- const revertWarning = patchConsole("warn", spinner, consoleReplay);
10557
+ const revertLog = patchConsole({
10558
+ fn: "log",
10559
+ ora: spinner,
10560
+ replay: consoleReplay,
10561
+ defaultText: options.text
10562
+ });
10563
+ const revertError = patchConsole({
10564
+ fn: "error",
10565
+ ora: spinner,
10566
+ replay: consoleReplay,
10567
+ defaultText: options.text
10568
+ });
10569
+ const revertWarning = patchConsole({
10570
+ fn: "warn",
10571
+ ora: spinner,
10572
+ replay: consoleReplay,
10573
+ defaultText: options.text
10574
+ });
10540
10575
  const unpatchConsole = () => {
10541
10576
  revertLog();
10542
10577
  revertError();
10543
10578
  revertWarning();
10544
10579
  };
10545
10580
  let thrownError = void 0;
10581
+ const executeReplay = () => {
10582
+ unpatchConsole();
10583
+ replayConsole(consoleReplay);
10584
+ };
10585
+ const executeReplayOnSigint = () => {
10586
+ executeReplay();
10587
+ process.exit(1);
10588
+ };
10589
+ process.on("SIGINT", executeReplayOnSigint);
10546
10590
  try {
10547
10591
  const result = await action;
10548
- spinner.succeed(successText);
10592
+ const finalStatusText = spinner.text.startsWith(options.text) && spinner.text.length > options.text.length ? spinner.text.slice(options.text.length).trim() : `\u2699\uFE0F compared: ${numPad(0)} changes: 0`;
10593
+ const padding = " ".repeat(Math.max(4, 40 - successText.length));
10594
+ spinner.succeed(successText + padding + finalStatusText);
10549
10595
  return result;
10550
10596
  } catch (error) {
10551
- const indexOfConsoleMessages = spinner.text.indexOf("\n");
10552
- const capturedConsole = indexOfConsoleMessages > -1 ? spinner.text.slice(0, indexOfConsoleMessages) : "";
10553
- spinner.fail(failText === void 0 ? void 0 : failText(error, capturedConsole));
10597
+ executeReplay();
10598
+ spinner.fail(failText?.(error));
10554
10599
  thrownError = error;
10555
10600
  } finally {
10556
- unpatchConsole();
10601
+ process.off("SIGINT", executeReplayOnSigint);
10557
10602
  if (!thrownError) {
10558
- replayConsole(consoleReplay);
10603
+ executeReplay();
10559
10604
  }
10560
10605
  }
10561
10606
  if (thrownError) {
@@ -10567,20 +10612,51 @@ function replayConsole(replay) {
10567
10612
  console[fn](...args);
10568
10613
  }
10569
10614
  }
10570
- function patchConsole(fn, ora3, replay = []) {
10615
+ function patchConsole({
10616
+ fn,
10617
+ ora: ora3,
10618
+ replay = [],
10619
+ defaultText
10620
+ }) {
10571
10621
  const original = console[fn];
10572
- console[fn] = (...text) => {
10573
- if (text.length === 1 && typeof text[0] === "string") {
10574
- ora3.text += "\n" + text;
10622
+ const handleSyncStatusUpdate = ({
10623
+ compared,
10624
+ changeCount,
10625
+ changesApplied,
10626
+ fetched
10627
+ }) => {
10628
+ if (compared === 0 && fetched === 0) {
10629
+ return;
10630
+ }
10631
+ const clauses = [];
10632
+ if (fetched > 0 && compared === 0) {
10633
+ clauses.push(`fetching: ${numPad(fetched)}`);
10634
+ }
10635
+ if (compared > 0) {
10636
+ clauses.push(`compared: ${numPad(compared)}`);
10637
+ }
10638
+ if (changesApplied === 0) {
10639
+ clauses.push(`changes: ${changeCount}`);
10575
10640
  } else {
10576
- original(...text);
10641
+ clauses.push(`applied: ${changesApplied}/${changeCount}`);
10577
10642
  }
10643
+ const statusText = clauses.join(" ");
10644
+ const padding = " ".repeat(Math.max(4, 40 - defaultText.length));
10645
+ ora3.text = `${defaultText}${padding}\u2699\uFE0F ${statusText}`;
10646
+ };
10647
+ syncEngineEvents.on("statusUpdate", handleSyncStatusUpdate);
10648
+ console[fn] = (...text) => {
10578
10649
  replay.push({ fn, args: text });
10579
10650
  };
10580
10651
  return () => {
10581
10652
  console[fn] = original;
10653
+ syncEngineEvents.off("statusUpdate", handleSyncStatusUpdate);
10582
10654
  };
10583
10655
  }
10656
+ function numPad(num, spaces = 6) {
10657
+ const numbah = num.toString(10);
10658
+ return numbah + " ".repeat(Math.max(0, spaces - numbah.length));
10659
+ }
10584
10660
 
10585
10661
  // src/commands/sync/commands/pull.ts
10586
10662
  var SyncPullModule = {
@@ -10749,19 +10825,102 @@ var SyncPushModule = {
10749
10825
  }
10750
10826
  }
10751
10827
  if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
10752
- await ComponentPatternPublishModule.handler({ ...otherParams, all: true });
10828
+ try {
10829
+ await spinPromise(
10830
+ ComponentPatternPublishModule.handler({
10831
+ ...otherParams,
10832
+ patternType: "component",
10833
+ onlyPatterns: true,
10834
+ all: true
10835
+ }),
10836
+ {
10837
+ text: "publishing component patterns...",
10838
+ successText: "published component patterns",
10839
+ failText(error) {
10840
+ return `publishing component patterns
10841
+
10842
+ ${error.stack ?? error.message}`;
10843
+ }
10844
+ }
10845
+ );
10846
+ } catch {
10847
+ process.exit(1);
10848
+ }
10753
10849
  }
10754
10850
  if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
10755
- await CompositionPatternPublishModule.handler({ ...otherParams, all: true });
10851
+ try {
10852
+ await spinPromise(
10853
+ CompositionPatternPublishModule.handler({
10854
+ ...otherParams,
10855
+ all: true,
10856
+ onlyPatterns: true,
10857
+ patternType: "composition"
10858
+ }),
10859
+ {
10860
+ text: "publishing composition patterns...",
10861
+ successText: "published composition patterns",
10862
+ failText(error) {
10863
+ return `publishing composition patterns
10864
+
10865
+ ${error.stack ?? error.message}`;
10866
+ }
10867
+ }
10868
+ );
10869
+ } catch {
10870
+ process.exit(1);
10871
+ }
10756
10872
  }
10757
10873
  if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
10758
- await CompositionPublishModule.handler({ ...otherParams, all: true });
10874
+ try {
10875
+ await spinPromise(
10876
+ CompositionPublishModule.handler({
10877
+ ...otherParams,
10878
+ all: true,
10879
+ onlyCompositions: true
10880
+ }),
10881
+ {
10882
+ text: "publishing compositions...",
10883
+ successText: "published compositions",
10884
+ failText(error) {
10885
+ return `publishing compositions
10886
+
10887
+ ${error.stack ?? error.message}`;
10888
+ }
10889
+ }
10890
+ );
10891
+ } catch {
10892
+ process.exit(1);
10893
+ }
10759
10894
  }
10760
10895
  if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
10761
- await EntryPublishModule.handler({ ...otherParams, all: true });
10896
+ try {
10897
+ await spinPromise(EntryPublishModule.handler({ ...otherParams, all: true }), {
10898
+ text: "publishing entries...",
10899
+ successText: "published entries",
10900
+ failText(error) {
10901
+ return `publishing entries
10902
+
10903
+ ${error.stack ?? error.message}`;
10904
+ }
10905
+ });
10906
+ } catch {
10907
+ process.exit(1);
10908
+ }
10762
10909
  }
10763
10910
  if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
10764
- await EntryPatternPublishModule.handler({ ...otherParams, all: true });
10911
+ try {
10912
+ await spinPromise(EntryPatternPublishModule.handler({ ...otherParams, all: true }), {
10913
+ text: "publishing entry patterns...",
10914
+ successText: "published entry patterns",
10915
+ failText(error) {
10916
+ return `publishing entry patterns
10917
+
10918
+ ${error.stack ?? error.message}`;
10919
+ }
10920
+ });
10921
+ } catch {
10922
+ process.exit(1);
10923
+ }
10765
10924
  }
10766
10925
  }
10767
10926
  };
@@ -11048,12 +11207,9 @@ First found was: v${firstVersion}`;
11048
11207
  // src/index.ts
11049
11208
  dotenv.config();
11050
11209
  var yarggery = yargs37(hideBin(process.argv));
11051
- var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
11052
- var configuration = loadConfig(inlineConfigurationFilePath || null);
11210
+ var defaultConfig2 = loadConfig(null);
11053
11211
  yarggery.option("verbose", {
11054
11212
  describe: "Include verbose logging",
11055
11213
  default: false,
11056
11214
  type: "boolean"
11057
- }).scriptName("uniform").config(configuration).config("config", function() {
11058
- return {};
11059
- }).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).command(IntegrationCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;
11215
+ }).scriptName("uniform").config(defaultConfig2).config("config", "Specify a custom Uniform CLI config file", (configPath) => loadConfig(configPath)).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).command(IntegrationCommand).recommendCommands().demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).parse();