@uniformdev/cli 20.50.2-alpha.149 → 20.50.2-alpha.167

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
@@ -23,7 +23,7 @@ import {
23
23
  withFormatOptions,
24
24
  withProjectOptions,
25
25
  withTeamOptions
26
- } from "./chunk-7P2U2VCH.mjs";
26
+ } from "./chunk-6GYRC5EF.mjs";
27
27
 
28
28
  // src/index.ts
29
29
  import * as dotenv from "dotenv";
@@ -630,6 +630,9 @@ export default uniformConfig({
630
630
  `;
631
631
 
632
632
  // src/sync/fileSyncEngineDataSource.ts
633
+ function isErrorWithCode(error, code) {
634
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
635
+ }
633
636
  async function createFileSyncEngineDataSource({
634
637
  directory,
635
638
  format = "yaml",
@@ -690,7 +693,7 @@ ${e?.message}`));
690
693
  }
691
694
  await unlink(providerId);
692
695
  },
693
- writeObject: async (object4) => {
696
+ writeObject: async (object4, existingObject) => {
694
697
  const filename = selectFilename3 ? join(directory, `${selectFilename3(object4.object)}.${format}`) : getFullFilename(object4.id);
695
698
  let contents = object4.object;
696
699
  if (selectSchemaUrl2) {
@@ -703,6 +706,18 @@ ${e?.message}`));
703
706
  console.log(`Writing file ${filename}`);
704
707
  }
705
708
  emitWithFormat(contents, format, filename);
709
+ if (existingObject?.providerId && existingObject.providerId !== filename) {
710
+ if (verbose) {
711
+ console.log(`Deleting file ${existingObject.providerId}`);
712
+ }
713
+ try {
714
+ await unlink(existingObject.providerId);
715
+ } catch (error) {
716
+ if (!isErrorWithCode(error, "ENOENT")) {
717
+ throw error;
718
+ }
719
+ }
720
+ }
706
721
  }
707
722
  };
708
723
  }
@@ -726,6 +741,7 @@ function writeUniformPackage(filename, packageContents) {
726
741
  // src/sync/syncEngine.ts
727
742
  import { diffJson, diffLines } from "diff";
728
743
  import mitt from "mitt";
744
+ import PQueue from "p-queue";
729
745
 
730
746
  // src/sync/serializedDequal.ts
731
747
  var has = Object.prototype.hasOwnProperty;
@@ -792,7 +808,8 @@ async function syncEngine({
792
808
  onBeforeProcessObject,
793
809
  onBeforeCompareObjects,
794
810
  onBeforeWriteObject,
795
- onError
811
+ onError,
812
+ actionConcurrency
796
813
  //verbose = false,
797
814
  }) {
798
815
  const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
@@ -841,43 +858,46 @@ async function syncEngine({
841
858
  const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
842
859
  const targetObject = targetItems.get(ids[0]);
843
860
  status.compared++;
844
- const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o?.object !== targetObject?.object);
861
+ const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter(
862
+ (invalidTargetObject) => typeof invalidTargetObject !== "undefined" && invalidTargetObject.object !== targetObject?.object
863
+ );
864
+ const targetIds = Array.isArray(targetObject?.id) ? targetObject.id : [targetObject?.id];
865
+ const processedIds = new Set([...ids, ...targetIds].filter((id) => typeof id === "string"));
866
+ const processUpdate = async (sourceObject2, targetObject2) => {
867
+ try {
868
+ if (!whatIf) {
869
+ const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
870
+ await target.writeObject(finalSourceObject, targetObject2);
871
+ status.changesApplied++;
872
+ }
873
+ } catch (e) {
874
+ if (onError) {
875
+ onError(e, sourceObject2);
876
+ } else {
877
+ throw new SyncEngineError(e, sourceObject2);
878
+ }
879
+ } finally {
880
+ log2({
881
+ action: "update",
882
+ id: ids[0],
883
+ providerId: sourceObject2.providerId,
884
+ displayName: sourceObject2.displayName ?? sourceObject2.providerId,
885
+ whatIf,
886
+ diff: () => diffJson(targetObject2.object, sourceObject2.object)
887
+ });
888
+ }
889
+ };
845
890
  if (targetObject && invalidTargetObjects.length === 0) {
846
891
  sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
847
892
  const compareResult = compareContents(sourceObject, targetObject);
848
893
  if (!compareResult) {
849
894
  if (mode === "createOrUpdate" || mode === "mirror") {
850
895
  status.changeCount++;
851
- const process2 = async (sourceObject2, targetObject2) => {
852
- try {
853
- if (!whatIf) {
854
- const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
855
- await target.writeObject(finalSourceObject, targetObject2);
856
- status.changesApplied++;
857
- }
858
- } catch (e) {
859
- if (onError) {
860
- onError(e, sourceObject2);
861
- } else {
862
- throw new SyncEngineError(e, sourceObject2);
863
- }
864
- } finally {
865
- log2({
866
- action: "update",
867
- id: ids[0],
868
- providerId: sourceObject2.providerId,
869
- displayName: sourceObject2.displayName ?? sourceObject2.providerId,
870
- whatIf,
871
- diff: () => diffJson(targetObject2.object, sourceObject2.object)
872
- });
873
- }
874
- };
875
- actions.push(() => process2(sourceObject, targetObject));
896
+ actions.push(() => processUpdate(sourceObject, targetObject));
876
897
  }
877
898
  }
878
- ids.forEach((i) => targetItems.delete(i));
899
+ processedIds.forEach((i) => targetItems.delete(i));
879
900
  } else {
880
- status.changeCount++;
881
901
  const processUpsert = async (sourceObject2, id) => {
882
902
  try {
883
903
  if (!whatIf) {
@@ -903,38 +923,73 @@ async function syncEngine({
903
923
  }
904
924
  };
905
925
  if (invalidTargetObjects.length > 0) {
926
+ if (mode === "createOrUpdate" && !targetObject && invalidTargetObjects.length === 1) {
927
+ const matchedTargetObject = invalidTargetObjects[0];
928
+ sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, matchedTargetObject) : sourceObject;
929
+ const compareResult = compareContents(sourceObject, matchedTargetObject);
930
+ if (!compareResult) {
931
+ status.changeCount++;
932
+ actions.push(() => processUpdate(sourceObject, matchedTargetObject));
933
+ }
934
+ (Array.isArray(matchedTargetObject.id) ? matchedTargetObject.id : [matchedTargetObject.id]).forEach(
935
+ (i) => targetItems.delete(i)
936
+ );
937
+ continue;
938
+ }
939
+ if (mode !== "mirror") {
940
+ continue;
941
+ }
942
+ status.changeCount++;
906
943
  [...invalidTargetObjects, targetObject].forEach((o) => {
907
944
  (Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
908
945
  });
909
- const deletes = invalidTargetObjects.filter((invalidTargetObject) => typeof invalidTargetObject !== "undefined").map((invalidTargetObject) => () => processDelete(invalidTargetObject));
946
+ const deletes = invalidTargetObjects.map(
947
+ (invalidTargetObject) => () => processDelete(invalidTargetObject)
948
+ );
910
949
  if (targetObject) {
911
950
  deletes.push(() => processDelete(targetObject));
912
951
  }
913
- actions.push(
914
- () => Promise.all(deletes.map((deleteFn) => deleteFn())).then(() => processUpsert(sourceObject, ids[0]))
915
- );
952
+ actions.push(async () => {
953
+ for (const deleteFn of deletes) {
954
+ await deleteFn();
955
+ }
956
+ await processUpsert(sourceObject, ids[0]);
957
+ });
916
958
  } else {
959
+ status.changeCount++;
917
960
  actions.push(() => processUpsert(sourceObject, ids[0]));
918
961
  }
919
962
  }
920
963
  }
921
- status.changeCount += targetItems.size;
922
- status.compared += targetItems.size;
964
+ const orphanTargetObjects = new Set(targetItems.values());
923
965
  if (mode === "mirror") {
924
- if (!sourceHasItems && !allowEmptySource && targetItems.size > 0) {
966
+ status.changeCount += orphanTargetObjects.size;
967
+ status.compared += orphanTargetObjects.size;
968
+ if (!sourceHasItems && !allowEmptySource && orphanTargetObjects.size > 0) {
925
969
  throw new Error(
926
970
  `Sync source (${source.name}) is empty and mode is mirror. This would cause deletion of everything in the target (${target.name}), and most likely indicates an error in source definition.`
927
971
  );
928
972
  }
929
973
  const deletes = [];
930
- targetItems.forEach((object4) => {
974
+ orphanTargetObjects.forEach((object4) => {
931
975
  deletes.push(() => processDelete(object4));
932
976
  });
933
- await Promise.all(deletes.map((d) => d()));
977
+ await runSyncActions(deletes, actionConcurrency);
934
978
  }
935
- await Promise.all(actions.map((a) => a()));
979
+ await runSyncActions(actions, actionConcurrency);
936
980
  await Promise.all([source.onSyncComplete?.(false), target.onSyncComplete?.(true)]);
937
981
  }
982
+ var runSyncActions = async (actions, actionConcurrency) => {
983
+ if (actions.length === 0) {
984
+ return;
985
+ }
986
+ if (typeof actionConcurrency === "undefined") {
987
+ await Promise.all(actions.map((action) => action()));
988
+ return;
989
+ }
990
+ const queue = new PQueue({ concurrency: actionConcurrency });
991
+ await queue.addAll(actions);
992
+ };
938
993
  var SyncEngineError = class _SyncEngineError extends Error {
939
994
  constructor(innerError, sourceObject) {
940
995
  super(
@@ -1108,7 +1163,7 @@ var getUserInfo = async (baseUrl, authToken) => {
1108
1163
  const projectClient = new ProjectClient({ apiHost: baseUrl, bearerToken: authToken });
1109
1164
  const [profile, projectsRes] = await Promise.all([
1110
1165
  fetchMemberProfile({ baseUrl, bearerToken: authToken }),
1111
- projectClient.getProjects()
1166
+ projectClient.list()
1112
1167
  ]);
1113
1168
  return {
1114
1169
  name: profile.name,
@@ -1184,7 +1239,7 @@ var Telemetry = class {
1184
1239
  });
1185
1240
  }
1186
1241
  shutdown() {
1187
- this.send("exited", { exitCode: process.exitCode });
1242
+ this.send("exited", { exitCode: process.exitCode ?? void 0 });
1188
1243
  return this.posthog?.shutdown();
1189
1244
  }
1190
1245
  };
@@ -2370,8 +2425,8 @@ import yargs22 from "yargs";
2370
2425
  import yargs5 from "yargs";
2371
2426
 
2372
2427
  // src/commands/canvas/commands/asset/_util.ts
2373
- import { UncachedAssetClient } from "@uniformdev/assets";
2374
- import { UncachedFileClient } from "@uniformdev/files";
2428
+ import { AssetClient } from "@uniformdev/assets";
2429
+ import { FileClient } from "@uniformdev/files";
2375
2430
 
2376
2431
  // src/cliLimitPolicy.ts
2377
2432
  import { createLimitPolicy } from "@uniformdev/canvas";
@@ -2386,10 +2441,10 @@ var cliLimitPolicy = createLimitPolicy({
2386
2441
  var selectAssetIdentifier = (e) => e.asset._id;
2387
2442
  var selectAssetDisplayName = (e) => `${e.asset.fields?.title?.value ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
2388
2443
  function getAssetClient(options) {
2389
- return new UncachedAssetClient({ ...options, limitPolicy: cliLimitPolicy });
2444
+ return new AssetClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
2390
2445
  }
2391
2446
  function getFileClient(options) {
2392
- return new UncachedFileClient({ ...options, limitPolicy: cliLimitPolicy });
2447
+ return new FileClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
2393
2448
  }
2394
2449
 
2395
2450
  // src/commands/canvas/commands/asset/get.ts
@@ -2500,20 +2555,64 @@ import {
2500
2555
  } from "@uniformdev/canvas";
2501
2556
  import { isRichTextNodeType, isRichTextValue, walkRichTextTree } from "@uniformdev/richtext";
2502
2557
  import fsj4 from "fs-jetpack";
2503
- import PQueue2 from "p-queue";
2558
+ import PQueue3 from "p-queue";
2504
2559
  import { join as join11 } from "path";
2505
2560
 
2506
2561
  // src/files/downloadFile.ts
2562
+ import { createWriteStream } from "fs";
2507
2563
  import fsj2 from "fs-jetpack";
2508
- import { join as join9 } from "path";
2564
+ import { dirname as dirname2, join as join9 } from "path";
2565
+ import { Readable } from "stream";
2566
+ import { pipeline } from "stream/promises";
2567
+ var downloadedFilePathCacheByDirectory = /* @__PURE__ */ new Map();
2568
+ var tempDownloadFileCounter = 0;
2569
+ var getTempDownloadFilePath = (filePath) => {
2570
+ tempDownloadFileCounter += 1;
2571
+ return `${filePath}.${process.pid}.${Date.now()}.${tempDownloadFileCounter}.download`;
2572
+ };
2573
+ var getDownloadedFilePathCache = (filesDirectory) => {
2574
+ const cached = downloadedFilePathCacheByDirectory.get(filesDirectory);
2575
+ if (cached) {
2576
+ return cached;
2577
+ }
2578
+ const cache = fsj2.cwd(filesDirectory).findAsync({ files: true, directories: false }).then((paths) => new Set(paths)).catch(() => /* @__PURE__ */ new Set());
2579
+ downloadedFilePathCacheByDirectory.set(filesDirectory, cache);
2580
+ return cache;
2581
+ };
2582
+ var filePathMatchesSourceId = (filePath, sourceId) => filePath === sourceId || filePath.startsWith(`${sourceId}.`);
2583
+ var hasFilePathMatchingSourceId = (filePaths, sourceId) => {
2584
+ for (const filePath of filePaths) {
2585
+ if (filePathMatchesSourceId(filePath, sourceId)) {
2586
+ return true;
2587
+ }
2588
+ }
2589
+ return false;
2590
+ };
2591
+ var writeResponseBodyToFile = async (response, filePath) => {
2592
+ if (!response.body) {
2593
+ throw new Error("Response does not contain a body");
2594
+ }
2595
+ const tempFilePath = getTempDownloadFilePath(filePath);
2596
+ await fsj2.dirAsync(dirname2(filePath));
2597
+ try {
2598
+ const responseBody = response.body;
2599
+ await pipeline(Readable.fromWeb(responseBody), createWriteStream(tempFilePath));
2600
+ await fsj2.moveAsync(tempFilePath, filePath, { overwrite: true });
2601
+ } catch (error) {
2602
+ await fsj2.removeAsync(tempFilePath).catch(() => void 0);
2603
+ throw error;
2604
+ }
2605
+ };
2509
2606
  var downloadFile = async ({
2510
2607
  fileClient,
2511
2608
  fileUrl,
2512
2609
  directory
2513
2610
  }) => {
2514
2611
  const writeDirectory = getFilesDirectory(directory);
2612
+ const filesDirectory = join9(writeDirectory, FILES_DIRECTORY_NAME);
2515
2613
  const fileName = urlToFileName(fileUrl.toString());
2516
- const fileAlreadyExists = await fsj2.existsAsync(join9(writeDirectory, FILES_DIRECTORY_NAME, fileName));
2614
+ const filePath = join9(filesDirectory, fileName);
2615
+ const fileAlreadyExists = await fsj2.existsAsync(filePath);
2517
2616
  if (fileAlreadyExists) {
2518
2617
  return { url: fileUrl };
2519
2618
  }
@@ -2523,11 +2622,10 @@ var downloadFile = async ({
2523
2622
  return null;
2524
2623
  }
2525
2624
  if (file.sourceId) {
2625
+ const sourceId = file.sourceId;
2526
2626
  try {
2527
- const hashAlreadyExists = await fsj2.findAsync(join9(writeDirectory, FILES_DIRECTORY_NAME), {
2528
- matching: [file.sourceId, `${file.sourceId}.*`]
2529
- });
2530
- if (hashAlreadyExists.length > 0) {
2627
+ const downloadedFilePaths = await getDownloadedFilePathCache(filesDirectory);
2628
+ if (hasFilePathMatchingSourceId(downloadedFilePaths, sourceId)) {
2531
2629
  return { id: file.id, url: fileUrl };
2532
2630
  }
2533
2631
  } catch {
@@ -2538,8 +2636,12 @@ var downloadFile = async ({
2538
2636
  if (!response.ok) {
2539
2637
  return null;
2540
2638
  }
2541
- const fileBuffer = await response.arrayBuffer();
2542
- await fsj2.writeAsync(join9(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
2639
+ await writeResponseBodyToFile(response, filePath);
2640
+ const downloadedFilePathCache = downloadedFilePathCacheByDirectory.get(filesDirectory);
2641
+ if (downloadedFilePathCache) {
2642
+ const downloadedFilePaths = await downloadedFilePathCache;
2643
+ downloadedFilePaths.add(fileName);
2644
+ }
2543
2645
  return { id: file.id, url: fileUrl };
2544
2646
  };
2545
2647
 
@@ -2551,10 +2653,10 @@ import { createReadStream } from "fs";
2551
2653
  import fsj3 from "fs-jetpack";
2552
2654
  import { imageSizeFromFile } from "image-size/fromFile";
2553
2655
  import normalizeNewline from "normalize-newline";
2554
- import PQueue from "p-queue";
2656
+ import PQueue2 from "p-queue";
2555
2657
  import { join as join10 } from "path";
2556
2658
  var uploadQueueByKey = /* @__PURE__ */ new Map();
2557
- var fileUploadQueue = new PQueue({ concurrency: 10 });
2659
+ var fileUploadQueue = new PQueue2({ concurrency: 10 });
2558
2660
  var uploadFile = async ({
2559
2661
  fileClient,
2560
2662
  fileUrl,
@@ -2734,9 +2836,9 @@ var walkFileUrlsForCompositionOrEntry = ({
2734
2836
  };
2735
2837
 
2736
2838
  // src/files/files.ts
2737
- var fileDownloadQueue = new PQueue2({ concurrency: 10 });
2738
- var fileUploadQueue2 = new PQueue2({ concurrency: 10 });
2739
- var fileUrlReplacementQueue = new PQueue2({ concurrency: 10 });
2839
+ var fileDownloadQueue = new PQueue3({ concurrency: 10 });
2840
+ var fileUploadQueue2 = new PQueue3({ concurrency: 10 });
2841
+ var fileUrlReplacementQueue = new PQueue3({ concurrency: 10 });
2740
2842
  var downloadFileForAsset = async ({
2741
2843
  asset,
2742
2844
  directory,
@@ -3040,13 +3142,13 @@ function createAssetEngineDataSource({
3040
3142
  if (verbose) {
3041
3143
  console.log(`Deleting asset ${providerId}`);
3042
3144
  }
3043
- await client.delete({ assetId: providerId });
3145
+ await client.remove({ assetId: providerId });
3044
3146
  },
3045
3147
  writeObject: async ({ object: object4 }) => {
3046
3148
  if (verbose) {
3047
3149
  console.log(`Upserting asset ${object4.asset._id}`);
3048
3150
  }
3049
- await client.upsert(convertAssetToPutAsset(object4));
3151
+ await client.save(convertAssetToPutAsset(object4));
3050
3152
  }
3051
3153
  };
3052
3154
  }
@@ -3063,6 +3165,7 @@ function writeCanvasPackage(filename, packageContents) {
3063
3165
  }
3064
3166
 
3065
3167
  // src/commands/canvas/commands/asset/pull.ts
3168
+ var ASSET_PULL_ACTION_CONCURRENCY = 10;
3066
3169
  var AssetPullModule = {
3067
3170
  command: "pull <directory>",
3068
3171
  describe: "Pulls all assets to local files in a directory",
@@ -3161,6 +3264,7 @@ var AssetPullModule = {
3161
3264
  target,
3162
3265
  mode,
3163
3266
  whatIf,
3267
+ actionConcurrency: ASSET_PULL_ACTION_CONCURRENCY,
3164
3268
  allowEmptySource: allowEmptySource ?? true,
3165
3269
  log: createSyncEngineConsoleLogger({ diffMode }),
3166
3270
  onBeforeCompareObjects: async (sourceObject) => {
@@ -3188,6 +3292,7 @@ var AssetPullModule = {
3188
3292
  };
3189
3293
 
3190
3294
  // src/commands/canvas/commands/asset/push.ts
3295
+ var ASSET_PUSH_ACTION_CONCURRENCY = 10;
3191
3296
  var AssetPushModule = {
3192
3297
  command: "push <directory>",
3193
3298
  describe: "Pushes all assets from files in a directory to Uniform",
@@ -3263,6 +3368,7 @@ var AssetPushModule = {
3263
3368
  target,
3264
3369
  mode,
3265
3370
  whatIf,
3371
+ actionConcurrency: ASSET_PUSH_ACTION_CONCURRENCY,
3266
3372
  allowEmptySource,
3267
3373
  log: createSyncEngineConsoleLogger({ diffMode }),
3268
3374
  onBeforeCompareObjects: async (sourceObject, targetObject) => {
@@ -3339,7 +3445,7 @@ var AssetRemoveModule = {
3339
3445
  const fetch2 = nodeFetchProxy(proxy, verbose);
3340
3446
  const client = getAssetClient({ apiKey, apiHost, fetch: fetch2, projectId });
3341
3447
  if (!whatIf) {
3342
- await client.delete({ assetId: id });
3448
+ await client.remove({ assetId: id });
3343
3449
  } else {
3344
3450
  whatIfSimpleLog({ id, displayName: "Asset", action: "delete" });
3345
3451
  }
@@ -3367,7 +3473,7 @@ var AssetUpdateModule = {
3367
3473
  const file = readFileToObject(filename);
3368
3474
  const putAsset = convertAssetToPutAsset2(file);
3369
3475
  if (!whatIf) {
3370
- await client.upsert(putAsset);
3476
+ await client.save(putAsset);
3371
3477
  } else {
3372
3478
  whatIfSimpleLog({
3373
3479
  id: putAsset.asset?._id ?? "",
@@ -3392,11 +3498,11 @@ var AssetModule = {
3392
3498
  import yargs6 from "yargs";
3393
3499
 
3394
3500
  // src/commands/canvas/commands/category/_util.ts
3395
- import { UncachedCategoryClient } from "@uniformdev/canvas";
3501
+ import { CategoryClient } from "@uniformdev/canvas";
3396
3502
  var selectIdentifier = (category) => category.id;
3397
3503
  var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
3398
3504
  function getCategoryClient(options) {
3399
- return new UncachedCategoryClient({ ...options, limitPolicy: cliLimitPolicy });
3505
+ return new CategoryClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
3400
3506
  }
3401
3507
 
3402
3508
  // src/commands/canvas/commands/category/get.ts
@@ -3417,7 +3523,7 @@ var CategoryGetModule = {
3417
3523
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
3418
3524
  const fetch2 = nodeFetchProxy(proxy, verbose);
3419
3525
  const client = getCategoryClient({ apiKey, apiHost, fetch: fetch2, projectId });
3420
- const res = await client.getCategories();
3526
+ const res = await client.list();
3421
3527
  const category = res.categories.find((c) => c.id === id);
3422
3528
  if (!category) {
3423
3529
  console.error("Category did not exist");
@@ -3439,7 +3545,7 @@ var CategoryListModule = {
3439
3545
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
3440
3546
  const fetch2 = nodeFetchProxy(proxy, verbose);
3441
3547
  const client = getCategoryClient({ apiKey, apiHost, fetch: fetch2, projectId });
3442
- const res = await client.getCategories();
3548
+ const res = await client.list();
3443
3549
  emitWithFormat(res.categories, format, filename);
3444
3550
  }
3445
3551
  };
@@ -3449,7 +3555,7 @@ function createCategoriesEngineDataSource({
3449
3555
  client
3450
3556
  }) {
3451
3557
  async function* getObjects() {
3452
- const categories = (await client.getCategories()).categories;
3558
+ const categories = (await client.list()).categories;
3453
3559
  for (const def of categories) {
3454
3560
  const result = {
3455
3561
  id: selectIdentifier(def),
@@ -3464,10 +3570,10 @@ function createCategoriesEngineDataSource({
3464
3570
  name: "Uniform API",
3465
3571
  objects: getObjects(),
3466
3572
  deleteObject: async (providerId) => {
3467
- await client.removeCategory({ categoryId: providerId });
3573
+ await client.remove({ categoryId: providerId });
3468
3574
  },
3469
3575
  writeObject: async (object4) => {
3470
- await client.upsertCategories([object4.object]);
3576
+ await client.save([object4.object]);
3471
3577
  }
3472
3578
  };
3473
3579
  }
@@ -3638,7 +3744,7 @@ var CategoryRemoveModule = {
3638
3744
  const fetch2 = nodeFetchProxy(proxy, verbose);
3639
3745
  const client = getCategoryClient({ apiKey, apiHost, fetch: fetch2, projectId });
3640
3746
  if (!whatIf) {
3641
- await client.removeCategory({ categoryId: id });
3747
+ await client.remove({ categoryId: id });
3642
3748
  } else {
3643
3749
  whatIfSimpleLog({ id, displayName: "Category", action: "delete" });
3644
3750
  }
@@ -3664,7 +3770,7 @@ var CategoryUpdateModule = {
3664
3770
  const client = getCategoryClient({ apiKey, apiHost, fetch: fetch2, projectId });
3665
3771
  const file = readFileToObject(filename);
3666
3772
  if (!whatIf) {
3667
- await client.upsertCategories([file]);
3773
+ await client.save([file]);
3668
3774
  } else {
3669
3775
  whatIfSimpleLog({ id: file.id, displayName: `Category: ${file.name}`, action: "update" });
3670
3776
  }
@@ -3686,12 +3792,22 @@ var CategoryModule = {
3686
3792
  import yargs7 from "yargs";
3687
3793
 
3688
3794
  // src/commands/canvas/commands/component/_util.ts
3689
- import { UncachedCanvasClient } from "@uniformdev/canvas";
3795
+ import {
3796
+ ComponentDefinitionClient,
3797
+ CompositionDeliveryClient,
3798
+ CompositionManagementClient
3799
+ } from "@uniformdev/canvas";
3690
3800
  var selectIdentifier2 = (component) => component.id;
3691
3801
  var selectDisplayName2 = (component) => `${component.name} (pid: ${component.id})`;
3692
3802
  var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
3693
- function getCanvasClient(options) {
3694
- return new UncachedCanvasClient({ ...options, limitPolicy: cliLimitPolicy });
3803
+ function getComponentDefinitionClient(options) {
3804
+ return new ComponentDefinitionClient({ ...options, limitPolicy: cliLimitPolicy });
3805
+ }
3806
+ function getCompositionManagementClient(options) {
3807
+ return new CompositionManagementClient({ ...options, limitPolicy: cliLimitPolicy });
3808
+ }
3809
+ function getCompositionDeliveryClient(options) {
3810
+ return new CompositionDeliveryClient({ ...options, limitPolicy: cliLimitPolicy });
3695
3811
  }
3696
3812
 
3697
3813
  // src/commands/canvas/commands/component/get.ts
@@ -3714,8 +3830,8 @@ var ComponentGetModule = {
3714
3830
  ),
3715
3831
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename, verbose }) => {
3716
3832
  const fetch2 = nodeFetchProxy(proxy, verbose);
3717
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
3718
- const res = await client.getComponentDefinitions({ componentId: id, limit: 1 });
3833
+ const client = getComponentDefinitionClient({ apiKey, apiHost, fetch: fetch2, projectId });
3834
+ const res = await client.list({ componentId: id, limit: 1 });
3719
3835
  if (res.componentDefinitions.length === 0) {
3720
3836
  console.error("Component did not exist");
3721
3837
  process.exit(1);
@@ -3763,8 +3879,8 @@ var ComponentListModule = {
3763
3879
  verbose
3764
3880
  }) => {
3765
3881
  const fetch2 = nodeFetchProxy(proxy, verbose);
3766
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
3767
- const res = await client.getComponentDefinitions({ limit: limit2, offset });
3882
+ const client = getComponentDefinitionClient({ apiKey, apiHost, fetch: fetch2, projectId });
3883
+ const res = await client.list({ limit: limit2, offset });
3768
3884
  emitWithFormat(res.componentDefinitions, format, filename);
3769
3885
  }
3770
3886
  };
@@ -3777,7 +3893,7 @@ function createComponentDefinitionEngineDataSource({
3777
3893
  }) {
3778
3894
  async function* getObjects() {
3779
3895
  const componentDefinitions = paginateAsync(
3780
- async (offset, limit2) => (await client.getComponentDefinitions({ limit: limit2, offset })).componentDefinitions,
3896
+ async (offset, limit2) => (await client.list({ limit: limit2, offset })).componentDefinitions,
3781
3897
  { pageSize: batchSize ?? 200, verbose, entityName: "components" }
3782
3898
  );
3783
3899
  for await (const def of componentDefinitions) {
@@ -3794,7 +3910,7 @@ function createComponentDefinitionEngineDataSource({
3794
3910
  name: "Uniform API",
3795
3911
  objects: getObjects(),
3796
3912
  deleteObject: async (providerId) => {
3797
- await client.removeComponentDefinition({ componentId: providerId });
3913
+ await client.remove({ componentId: providerId });
3798
3914
  },
3799
3915
  writeObject: async (object4) => {
3800
3916
  if (object4.object.parameters === void 0) {
@@ -3802,7 +3918,7 @@ function createComponentDefinitionEngineDataSource({
3802
3918
  `Component definition parameters property set to undefined is ignored. If you want to remove all parameters, set it to an empty array instead (id: ${object4.object.id})`
3803
3919
  );
3804
3920
  }
3805
- await client.updateComponentDefinition({
3921
+ await client.save({
3806
3922
  componentDefinition: object4.object
3807
3923
  });
3808
3924
  }
@@ -3857,7 +3973,7 @@ var ComponentPullModule = {
3857
3973
  resolvedBatchSize
3858
3974
  }) => {
3859
3975
  const fetch2 = nodeFetchProxy(proxy, verbose);
3860
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
3976
+ const client = getComponentDefinitionClient({ apiKey, apiHost, fetch: fetch2, projectId });
3861
3977
  const source = createComponentDefinitionEngineDataSource({
3862
3978
  client,
3863
3979
  batchSize: resolvedBatchSize,
@@ -3939,7 +4055,7 @@ var ComponentPushModule = {
3939
4055
  resolvedBatchSize
3940
4056
  }) => {
3941
4057
  const fetch2 = nodeFetchProxy(proxy, verbose);
3942
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4058
+ const client = getComponentDefinitionClient({ apiKey, apiHost, fetch: fetch2, projectId });
3943
4059
  let source;
3944
4060
  const isPackage = isPathAPackageFile(directory);
3945
4061
  if (isPackage) {
@@ -3994,9 +4110,9 @@ var ComponentRemoveModule = {
3994
4110
  ),
3995
4111
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
3996
4112
  const fetch2 = nodeFetchProxy(proxy, verbose);
3997
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4113
+ const client = getComponentDefinitionClient({ apiKey, apiHost, fetch: fetch2, projectId });
3998
4114
  if (!whatIf) {
3999
- await client.removeComponentDefinition({ componentId: id });
4115
+ await client.remove({ componentId: id });
4000
4116
  } else {
4001
4117
  whatIfSimpleLog({ id, displayName: `Component`, action: "delete" });
4002
4118
  }
@@ -4019,10 +4135,10 @@ var ComponentUpdateModule = {
4019
4135
  ),
4020
4136
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
4021
4137
  const fetch2 = nodeFetchProxy(proxy, verbose);
4022
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4138
+ const client = getComponentDefinitionClient({ apiKey, apiHost, fetch: fetch2, projectId });
4023
4139
  const file = readFileToObject(filename);
4024
4140
  if (!whatIf) {
4025
- await client.updateComponentDefinition({ componentDefinition: omit(file, ["$schema"]) });
4141
+ await client.save({ componentDefinition: omit(file, ["$schema"]) });
4026
4142
  } else {
4027
4143
  whatIfSimpleLog({ id: file.id, displayName: `Component: ${file.name}`, action: "update" });
4028
4144
  }
@@ -4053,9 +4169,8 @@ function getEntryActualType(entry) {
4053
4169
  }
4054
4170
  async function validateCompositionType(client, id, expectedType) {
4055
4171
  try {
4056
- const composition = await client.getCompositionById({
4172
+ const composition = await client.get({
4057
4173
  compositionId: id,
4058
- skipDataResolution: true,
4059
4174
  state: CANVAS_DRAFT_STATE2,
4060
4175
  withPatternType: true
4061
4176
  });
@@ -4077,11 +4192,10 @@ async function validateCompositionType(client, id, expectedType) {
4077
4192
  }
4078
4193
  }
4079
4194
  async function validateEntryType(client, id, expectedType) {
4080
- const res = await client.getEntries({
4195
+ const res = await client.list({
4081
4196
  offset: 0,
4082
4197
  limit: 1,
4083
4198
  entryIDs: [id],
4084
- skipDataResolution: true,
4085
4199
  state: CANVAS_DRAFT_STATE2,
4086
4200
  pattern: expectedType === "entry-pattern" ? true : void 0
4087
4201
  });
@@ -4156,29 +4270,32 @@ function createCompositionGetHandler(expectedType) {
4156
4270
  project: projectId,
4157
4271
  resolvePatterns,
4158
4272
  resolveOverrides,
4159
- componentIDs,
4160
4273
  resolveData,
4161
4274
  diagnostics,
4162
4275
  resolutionDepth,
4163
4276
  verbose
4164
4277
  }) => {
4165
- const parameters = {
4278
+ const fetch2 = nodeFetchProxy(proxy, verbose);
4279
+ const sharedParameters = {
4166
4280
  compositionId: id,
4167
4281
  state: convertStateOption(state),
4168
4282
  skipPatternResolution: !resolvePatterns,
4169
4283
  skipOverridesResolution: !resolveOverrides,
4170
- withComponentIDs: componentIDs,
4171
- skipDataResolution: !resolveData,
4172
- diagnostics: resolveData ? diagnostics : void 0,
4173
- resolutionDepth: resolveData ? resolutionDepth : void 0,
4174
4284
  withPatternType: true
4175
4285
  };
4176
4286
  if (verbose) {
4177
- console.log(`\u{1F41B} get ${expectedType}:`, parameters);
4178
- }
4179
- const fetch2 = nodeFetchProxy(proxy, verbose);
4180
- const client = getCanvasClient({ apiKey, edgeApiHost, apiHost, fetch: fetch2, projectId });
4181
- const composition = await client.getCompositionById(parameters);
4287
+ console.log(`\u{1F41B} get ${expectedType}:`, {
4288
+ ...sharedParameters,
4289
+ resolveData,
4290
+ diagnostics,
4291
+ resolutionDepth
4292
+ });
4293
+ }
4294
+ const composition = resolveData ? await getCompositionDeliveryClient({ apiKey, edgeApiHost, apiHost, fetch: fetch2, projectId }).get({
4295
+ ...sharedParameters,
4296
+ diagnostics,
4297
+ resolutionDepth
4298
+ }) : await getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId }).get(sharedParameters);
4182
4299
  const actualType = getCompositionActualType(composition);
4183
4300
  if (actualType !== expectedType) {
4184
4301
  console.error(formatCompositionTypeError(id, actualType, expectedType, "get"));
@@ -4216,11 +4333,6 @@ var CompositionGetModule = {
4216
4333
  default: false,
4217
4334
  describe: "Resolves pattern overrides in the composition and removes override definition data"
4218
4335
  },
4219
- componentIDs: {
4220
- type: "boolean",
4221
- default: false,
4222
- describe: "Include individual component UIDs"
4223
- },
4224
4336
  resolveData: {
4225
4337
  type: "boolean",
4226
4338
  default: false,
@@ -4239,7 +4351,8 @@ var CompositionGetModule = {
4239
4351
  })
4240
4352
  )
4241
4353
  )
4242
- )
4354
+ ),
4355
+ { includeEdgeApiHost: true }
4243
4356
  )
4244
4357
  )
4245
4358
  ),
@@ -4288,11 +4401,6 @@ var CompositionListModule = {
4288
4401
  default: false,
4289
4402
  type: "boolean",
4290
4403
  hidden: true
4291
- },
4292
- componentIDs: {
4293
- type: "boolean",
4294
- default: false,
4295
- describe: "Include individual component UIDs"
4296
4404
  }
4297
4405
  })
4298
4406
  )
@@ -4317,7 +4425,6 @@ var CompositionListModule = {
4317
4425
  state,
4318
4426
  resolvePatterns,
4319
4427
  resolveOverrides,
4320
- componentIDs,
4321
4428
  verbose
4322
4429
  }) => {
4323
4430
  const parameters = {
@@ -4328,15 +4435,14 @@ var CompositionListModule = {
4328
4435
  patternType,
4329
4436
  state: convertStateOption(state),
4330
4437
  skipPatternResolution: !resolvePatterns,
4331
- withComponentIDs: componentIDs,
4332
4438
  skipOverridesResolution: !resolveOverrides
4333
4439
  };
4334
4440
  if (verbose) {
4335
4441
  console.log(`\u{1F41B} list compositions:`, parameters);
4336
4442
  }
4337
4443
  const fetch2 = nodeFetchProxy(proxy, verbose);
4338
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4339
- const res = await client.getCompositionList(parameters);
4444
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
4445
+ const res = await client.list(parameters);
4340
4446
  emitWithFormat(res.compositions, format, filename);
4341
4447
  }
4342
4448
  };
@@ -4375,12 +4481,6 @@ var ComponentPatternListModule = {
4375
4481
  default: "component",
4376
4482
  choices: ["all", "component", "composition"],
4377
4483
  hidden: true
4378
- },
4379
- componentIDs: {
4380
- alias: ["componentIDs"],
4381
- type: "boolean",
4382
- default: false,
4383
- describe: "Include individual component UIDs"
4384
4484
  }
4385
4485
  })
4386
4486
  )
@@ -4430,16 +4530,13 @@ function createComponentInstanceEngineDataSource({
4430
4530
  offset,
4431
4531
  pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
4432
4532
  state: stateId,
4433
- skipPatternResolution: true,
4434
- skipOverridesResolution: true,
4435
- withComponentIDs: true,
4436
4533
  patternType,
4437
4534
  editions: "all"
4438
4535
  };
4439
4536
  if (verbose) {
4440
4537
  console.log(`\u{1F41B} pull compositions: `, parameters);
4441
4538
  }
4442
- return (await client.getCompositionList(parameters)).compositions;
4539
+ return (await client.list(parameters)).compositions;
4443
4540
  },
4444
4541
  { pageSize: batchSize ?? 100, verbose, entityName: "compositions" }
4445
4542
  );
@@ -4460,13 +4557,13 @@ function createComponentInstanceEngineDataSource({
4460
4557
  if (verbose) {
4461
4558
  console.log(`\u{1F41B} delete composition: (id: ${parseCompositionSerializedId(providerId)})`);
4462
4559
  }
4463
- await client.removeComposition(parseCompositionSerializedId(providerId));
4560
+ await client.remove(parseCompositionSerializedId(providerId));
4464
4561
  },
4465
4562
  writeObject: async (object4) => {
4466
4563
  if (verbose) {
4467
4564
  console.log(`\u{1F41B} push composition: (id: ${object4.object.composition._id})`);
4468
4565
  }
4469
- await client.updateComposition({ ...object4.object, state: stateId });
4566
+ await client.save({ ...object4.object, state: stateId });
4470
4567
  }
4471
4568
  };
4472
4569
  }
@@ -4527,7 +4624,7 @@ var CompositionPublishModule = {
4527
4624
  }
4528
4625
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
4529
4626
  const fetch2 = nodeFetchProxy(proxy, verbose);
4530
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4627
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
4531
4628
  const source = createComponentInstanceEngineDataSource({
4532
4629
  client,
4533
4630
  state: "preview",
@@ -4686,7 +4783,7 @@ function componentInstancePullModuleFactory(type, entityType) {
4686
4783
  resolvedBatchSize
4687
4784
  }) => {
4688
4785
  const fetch2 = nodeFetchProxy(proxy, verbose);
4689
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4786
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
4690
4787
  const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
4691
4788
  const source = createComponentInstanceEngineDataSource({
4692
4789
  client,
@@ -4807,7 +4904,7 @@ async function fetchUniformLocales(options) {
4807
4904
  bypassCache: true,
4808
4905
  limitPolicy: cliLimitPolicy
4809
4906
  });
4810
- const locales = (await client.get()).results;
4907
+ const locales = (await client.list()).results;
4811
4908
  return new Set(locales.map((locale) => locale.locale));
4812
4909
  }
4813
4910
  function validateEntityLocales(entity, uniformLocales, entityName) {
@@ -4885,7 +4982,7 @@ function componentInstancePushModuleFactory(type, entityType) {
4885
4982
  resolvedBatchSize
4886
4983
  }) => {
4887
4984
  const fetch2 = nodeFetchProxy(proxy, verbose);
4888
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4985
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
4889
4986
  let source;
4890
4987
  const isPackage = isPathAPackageFile(directory);
4891
4988
  if (isPackage) {
@@ -5008,7 +5105,7 @@ function createCompositionRemoveHandler(expectedType) {
5008
5105
  console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
5009
5106
  }
5010
5107
  const fetch2 = nodeFetchProxy(proxy, verbose);
5011
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
5108
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
5012
5109
  const validation = await validateCompositionType(client, id, expectedType);
5013
5110
  if (!validation.exists) {
5014
5111
  console.error(`Error: ${getCompositionDisplayName(expectedType)} with ID "${id}" not found.`);
@@ -5019,7 +5116,7 @@ function createCompositionRemoveHandler(expectedType) {
5019
5116
  process.exit(1);
5020
5117
  }
5021
5118
  if (!whatIf) {
5022
- await client.removeComposition({ compositionId: id });
5119
+ await client.remove({ compositionId: id });
5023
5120
  } else {
5024
5121
  whatIfSimpleLog({ id, displayName: getCompositionDisplayName(expectedType), action: "delete" });
5025
5122
  }
@@ -5052,10 +5149,7 @@ var ComponentPatternRemoveModule = {
5052
5149
  };
5053
5150
 
5054
5151
  // src/commands/canvas/commands/composition/unpublish.ts
5055
- import {
5056
- ApiClientError,
5057
- CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
5058
- } from "@uniformdev/canvas";
5152
+ import { ApiClientError } from "@uniformdev/canvas";
5059
5153
  import { diffJson as diffJson2 } from "diff";
5060
5154
  var CompositionUnpublishModule = {
5061
5155
  command: "unpublish [ids]",
@@ -5110,7 +5204,7 @@ var CompositionUnpublishModule = {
5110
5204
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
5111
5205
  const targetItems = /* @__PURE__ */ new Map();
5112
5206
  const fetch2 = nodeFetchProxy(proxy, verbose);
5113
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
5207
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
5114
5208
  const source = createComponentInstanceEngineDataSource({
5115
5209
  client,
5116
5210
  state: "published",
@@ -5152,7 +5246,7 @@ var CompositionUnpublishModule = {
5152
5246
  }
5153
5247
  if (!whatIf) {
5154
5248
  actions.push(
5155
- client.removeComposition({ ...parseCompositionSerializedId(id), state: CANVAS_PUBLISHED_STATE2 }).catch((err) => {
5249
+ client.unpublish(parseCompositionSerializedId(id)).catch((err) => {
5156
5250
  const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
5157
5251
  if (isNotFound) {
5158
5252
  console.warn(
@@ -5230,7 +5324,7 @@ function createCompositionUpdateHandler(expectedType) {
5230
5324
  console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
5231
5325
  }
5232
5326
  const fetch2 = nodeFetchProxy(proxy, verbose);
5233
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
5327
+ const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
5234
5328
  const file = readFileToObject(filename);
5235
5329
  const id = file.composition._id;
5236
5330
  const validation = await validateCompositionType(client, id, expectedType);
@@ -5239,7 +5333,7 @@ function createCompositionUpdateHandler(expectedType) {
5239
5333
  process.exit(1);
5240
5334
  }
5241
5335
  if (!whatIf) {
5242
- await client.updateComposition({ ...file, state: convertStateOption(state) });
5336
+ await client.save({ ...file, state: convertStateOption(state) });
5243
5337
  } else {
5244
5338
  whatIfSimpleLog({
5245
5339
  id,
@@ -5343,12 +5437,6 @@ var CompositionPatternListModule = {
5343
5437
  default: "composition",
5344
5438
  choices: ["all", "component", "composition"],
5345
5439
  hidden: true
5346
- },
5347
- componentIDs: {
5348
- alias: ["componentIDs"],
5349
- type: "boolean",
5350
- default: false,
5351
- describe: "Include individual composition pattern UIDs"
5352
5440
  }
5353
5441
  })
5354
5442
  )
@@ -5551,11 +5639,21 @@ var CompositionPatternModule = {
5551
5639
  import yargs11 from "yargs";
5552
5640
 
5553
5641
  // src/commands/canvas/commands/contentType/_util.ts
5554
- import { ContentClient } from "@uniformdev/canvas";
5642
+ import {
5643
+ ContentTypeClient,
5644
+ EntryDeliveryClient,
5645
+ EntryManagementClient
5646
+ } from "@uniformdev/canvas";
5555
5647
  var selectContentTypeIdentifier = (ct) => ct.id;
5556
5648
  var selectContentTypeDisplayName = (ct) => `${ct.name} (pid: ${ct.id})`;
5557
- function getContentClient(options) {
5558
- return new ContentClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
5649
+ function getContentTypeClient(options) {
5650
+ return new ContentTypeClient({ ...options, limitPolicy: cliLimitPolicy });
5651
+ }
5652
+ function getEntryManagementClient(options) {
5653
+ return new EntryManagementClient({ ...options, limitPolicy: cliLimitPolicy });
5654
+ }
5655
+ function getEntryDeliveryClient(options) {
5656
+ return new EntryDeliveryClient({ ...options, limitPolicy: cliLimitPolicy });
5559
5657
  }
5560
5658
 
5561
5659
  // src/commands/canvas/commands/contentType/get.ts
@@ -5578,12 +5676,8 @@ var ContentTypeGetModule = {
5578
5676
  ),
5579
5677
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
5580
5678
  const fetch2 = nodeFetchProxy(proxy, verbose);
5581
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
5582
- const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
5583
- const found = res.contentTypes.find((f) => f.id === id);
5584
- if (!found) {
5585
- throw new Error(`Content type with ID ${id} not found`);
5586
- }
5679
+ const client = getContentTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
5680
+ const found = await client.get({ contentTypeId: id });
5587
5681
  emitWithFormat(found, format, filename);
5588
5682
  }
5589
5683
  };
@@ -5595,8 +5689,8 @@ var ContentTypeListModule = {
5595
5689
  builder: (yargs44) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs44))))),
5596
5690
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5597
5691
  const fetch2 = nodeFetchProxy(proxy, verbose);
5598
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
5599
- const res = await client.getContentTypes({ offset: 0, limit: 1e3 });
5692
+ const client = getContentTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
5693
+ const res = await client.list({ offset: 0, limit: 1e3 });
5600
5694
  emitWithFormat(res.contentTypes, format, filename);
5601
5695
  }
5602
5696
  };
@@ -5609,7 +5703,7 @@ function createContentTypeEngineDataSource({
5609
5703
  }) {
5610
5704
  async function* getObjects() {
5611
5705
  const contentTypes = paginateAsync(
5612
- async (offset, limit2) => (await client.getContentTypes({ offset, limit: limit2 })).contentTypes,
5706
+ async (offset, limit2) => (await client.list({ offset, limit: limit2 })).contentTypes,
5613
5707
  { pageSize: batchSize ?? 100, verbose, entityName: "content types" }
5614
5708
  );
5615
5709
  for await (const ct of contentTypes) {
@@ -5626,10 +5720,10 @@ function createContentTypeEngineDataSource({
5626
5720
  name: "Uniform API",
5627
5721
  objects: getObjects(),
5628
5722
  deleteObject: async (providerId) => {
5629
- await client.deleteContentType({ contentTypeId: providerId });
5723
+ await client.remove({ contentTypeId: providerId });
5630
5724
  },
5631
5725
  writeObject: async ({ object: object4 }) => {
5632
- await client.upsertContentType({ contentType: object4 });
5726
+ await client.save({ contentType: object4 });
5633
5727
  }
5634
5728
  };
5635
5729
  }
@@ -5682,7 +5776,7 @@ var ContentTypePullModule = {
5682
5776
  resolvedBatchSize
5683
5777
  }) => {
5684
5778
  const fetch2 = nodeFetchProxy(proxy, verbose);
5685
- const client = getContentClient({
5779
+ const client = getContentTypeClient({
5686
5780
  apiKey,
5687
5781
  apiHost,
5688
5782
  fetch: fetch2,
@@ -5773,7 +5867,7 @@ var ContentTypePushModule = {
5773
5867
  resolvedBatchSize
5774
5868
  }) => {
5775
5869
  const fetch2 = nodeFetchProxy(proxy, verbose);
5776
- const client = getContentClient({
5870
+ const client = getContentTypeClient({
5777
5871
  apiKey,
5778
5872
  apiHost,
5779
5873
  fetch: fetch2,
@@ -5829,9 +5923,9 @@ var ContentTypeRemoveModule = {
5829
5923
  ),
5830
5924
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
5831
5925
  const fetch2 = nodeFetchProxy(proxy, verbose);
5832
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
5926
+ const client = getContentTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
5833
5927
  if (!whatIf) {
5834
- await client.deleteContentType({ contentTypeId: id });
5928
+ await client.remove({ contentTypeId: id });
5835
5929
  } else {
5836
5930
  whatIfSimpleLog({ id, displayName: `Content Type`, action: "delete" });
5837
5931
  }
@@ -5854,10 +5948,10 @@ var ContentTypeUpdateModule = {
5854
5948
  ),
5855
5949
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, verbose, whatIf }) => {
5856
5950
  const fetch2 = nodeFetchProxy(proxy, verbose);
5857
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
5951
+ const client = getContentTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
5858
5952
  const file = readFileToObject(filename);
5859
5953
  if (!whatIf) {
5860
- await client.upsertContentType({ contentType: file });
5954
+ await client.save({ contentType: file });
5861
5955
  } else {
5862
5956
  whatIfSimpleLog({ id: file.id, displayName: `Content Type: ${file.name}`, action: "update" });
5863
5957
  }
@@ -5962,7 +6056,7 @@ var DataSourceUpdateModule = {
5962
6056
  const client = getDataSourceClient({ apiKey, apiHost, fetch: fetch2, projectId });
5963
6057
  const file = JSON.parse(dataSource);
5964
6058
  if (!whatIf) {
5965
- await client.upsert({ data: file, integrationType });
6059
+ await client.save({ data: file, integrationType });
5966
6060
  } else {
5967
6061
  whatIfSimpleLog({ id: file.id, displayName: `Data Source: ${file.displayName}`, action: "update" });
5968
6062
  }
@@ -6010,7 +6104,7 @@ var DataTypeGetModule = {
6010
6104
  handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, verbose }) => {
6011
6105
  const fetch2 = nodeFetchProxy(proxy, verbose);
6012
6106
  const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
6013
- const res = await client.get();
6107
+ const res = await client.list();
6014
6108
  const found = res.results.find((f) => f.id === id);
6015
6109
  if (!found) {
6016
6110
  throw new Error(`Data type with ID ${id} not found`);
@@ -6028,7 +6122,7 @@ var DataTypeListModule = {
6028
6122
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
6029
6123
  const fetch2 = nodeFetchProxy(proxy, verbose);
6030
6124
  const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
6031
- const res = await client.get();
6125
+ const res = await client.list();
6032
6126
  emitWithFormat(res.results, format, filename);
6033
6127
  }
6034
6128
  };
@@ -6038,7 +6132,7 @@ function createDataTypeEngineDataSource({
6038
6132
  client
6039
6133
  }) {
6040
6134
  async function* getObjects() {
6041
- const dataTypes = (await client.get()).results;
6135
+ const dataTypes = (await client.list()).results;
6042
6136
  for await (const dataType of dataTypes) {
6043
6137
  const result = {
6044
6138
  id: selectIdentifier4(dataType),
@@ -6056,7 +6150,7 @@ function createDataTypeEngineDataSource({
6056
6150
  await client.remove({ typeId: providerId });
6057
6151
  },
6058
6152
  writeObject: async (object4) => {
6059
- await client.upsert({
6153
+ await client.save({
6060
6154
  data: object4.object
6061
6155
  });
6062
6156
  }
@@ -6265,7 +6359,7 @@ var DataTypeUpdateModule = {
6265
6359
  const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
6266
6360
  const file = readFileToObject(filename);
6267
6361
  if (!whatIf) {
6268
- await client.upsert({ data: file });
6362
+ await client.save({ data: file });
6269
6363
  } else {
6270
6364
  whatIfSimpleLog({ id: file.id, displayName: `Data Type: ${file.displayName}`, action: "update" });
6271
6365
  }
@@ -6301,32 +6395,27 @@ function createEntryGetHandler(expectedType) {
6301
6395
  resolveData,
6302
6396
  diagnostics,
6303
6397
  resolutionDepth,
6304
- withComponentIDs,
6305
6398
  verbose
6306
6399
  }) => {
6307
6400
  if (verbose) {
6308
6401
  console.log(`\u{1F41B} get ${expectedType}: (id: ${id})`);
6309
6402
  }
6310
6403
  const fetch2 = nodeFetchProxy(proxy, verbose);
6311
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6312
- const res = await client.getEntries({
6313
- offset: 0,
6314
- limit: 1,
6315
- entryIDs: [id],
6316
- state: convertStateOption(state),
6317
- skipOverridesResolution: true,
6404
+ const clientOptions = { apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId };
6405
+ const stateType = convertStateOption(state);
6406
+ const entry = resolveData ? await getEntryDeliveryClient(clientOptions).get({
6407
+ entryId: id,
6408
+ state: stateType,
6409
+ // Preserve the old resolved-read shape: data resources resolved, but
6410
+ // patterns/overrides left unresolved.
6318
6411
  skipPatternResolution: true,
6319
- skipDataResolution: !resolveData,
6320
- diagnostics: resolveData ? diagnostics : void 0,
6321
- resolutionDepth: resolveData ? resolutionDepth : void 0,
6322
- withComponentIDs,
6323
- pattern: expectedType === "entry-pattern" ? true : void 0
6412
+ skipOverridesResolution: true,
6413
+ diagnostics,
6414
+ resolutionDepth
6415
+ }) : await getEntryManagementClient(clientOptions).get({
6416
+ entryId: id,
6417
+ state: stateType
6324
6418
  });
6325
- if (res.entries.length !== 1) {
6326
- console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
6327
- process.exit(1);
6328
- }
6329
- const entry = res.entries[0];
6330
6419
  const actualType = getEntryActualType(entry);
6331
6420
  if (actualType !== expectedType) {
6332
6421
  console.error(formatEntryTypeError(id, actualType, expectedType, "get"));
@@ -6359,17 +6448,13 @@ var EntryGetModule = {
6359
6448
  type: "number",
6360
6449
  default: 1,
6361
6450
  describe: "Controls how many levels deep content references should be resolved"
6362
- },
6363
- withComponentIDs: {
6364
- type: "boolean",
6365
- default: false,
6366
- describe: "Include IDs of blocks in block fields"
6367
6451
  }
6368
6452
  }),
6369
6453
  // for backwards compatibility, we default to the "published" state, unlike compositions
6370
6454
  "published"
6371
6455
  )
6372
- )
6456
+ ),
6457
+ { includeEdgeApiHost: true }
6373
6458
  )
6374
6459
  )
6375
6460
  )
@@ -6395,12 +6480,7 @@ var EntryListModule = {
6395
6480
  type: "number",
6396
6481
  default: LEGACY_DEFAULT_LIMIT
6397
6482
  },
6398
- search: { describe: "Search query", type: "string", default: "" },
6399
- withComponentIDs: {
6400
- type: "boolean",
6401
- default: false,
6402
- describe: "Include IDs of blocks in block fields"
6403
- }
6483
+ search: { describe: "Search query", type: "string", default: "" }
6404
6484
  }),
6405
6485
  // for backwards compatibility, we default to the "published" state, unlike compositions
6406
6486
  "published"
@@ -6412,7 +6492,6 @@ var EntryListModule = {
6412
6492
  ),
6413
6493
  handler: async ({
6414
6494
  apiHost,
6415
- edgeApiHost,
6416
6495
  apiKey,
6417
6496
  proxy,
6418
6497
  format,
@@ -6422,21 +6501,16 @@ var EntryListModule = {
6422
6501
  limit: limit2,
6423
6502
  offset,
6424
6503
  search,
6425
- withComponentIDs,
6426
6504
  verbose
6427
6505
  }) => {
6428
6506
  const fetch2 = nodeFetchProxy(proxy, verbose);
6429
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6430
- const res = await client.getEntries({
6507
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
6508
+ const res = await client.list({
6431
6509
  offset,
6432
6510
  limit: search.length > 0 && limit2 === LEGACY_DEFAULT_LIMIT ? 100 : limit2,
6433
6511
  // Search API requires a lower default limit (100)
6434
6512
  search: search.length > 0 ? search : void 0,
6435
- state: convertStateOption(state),
6436
- skipOverridesResolution: true,
6437
- skipPatternResolution: true,
6438
- skipDataResolution: true,
6439
- withComponentIDs
6513
+ state: convertStateOption(state)
6440
6514
  });
6441
6515
  emitWithFormat(res.entries, format, filename);
6442
6516
  }
@@ -6478,16 +6552,12 @@ function createEntryEngineDataSource({
6478
6552
  const entries = paginateAsync(
6479
6553
  async (offset, limit2) => {
6480
6554
  try {
6481
- return (await client.getEntries({
6555
+ return (await client.list({
6482
6556
  offset,
6483
6557
  limit: limit2,
6484
6558
  entryIDs,
6485
6559
  pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
6486
- skipDataResolution: true,
6487
- skipOverridesResolution: true,
6488
- skipPatternResolution: true,
6489
6560
  state: stateId,
6490
- withComponentIDs: true,
6491
6561
  editions: "all"
6492
6562
  })).entries;
6493
6563
  } catch (error) {
@@ -6513,10 +6583,10 @@ function createEntryEngineDataSource({
6513
6583
  name: "Uniform API",
6514
6584
  objects: getObjects(),
6515
6585
  deleteObject: async (providerId) => {
6516
- await client.deleteEntry(parseEntrySerializedId(providerId));
6586
+ await client.remove(parseEntrySerializedId(providerId));
6517
6587
  },
6518
6588
  writeObject: async ({ object: object4 }) => {
6519
- await client.upsertEntry({ ...convertEntryToPutEntry(object4), state: stateId });
6589
+ await client.save({ ...convertEntryToPutEntry(object4), state: stateId });
6520
6590
  }
6521
6591
  };
6522
6592
  }
@@ -6549,7 +6619,6 @@ var EntryPublishModule = {
6549
6619
  ),
6550
6620
  handler: async ({
6551
6621
  apiHost,
6552
- edgeApiHost,
6553
6622
  apiKey,
6554
6623
  proxy,
6555
6624
  ids,
@@ -6566,7 +6635,7 @@ var EntryPublishModule = {
6566
6635
  }
6567
6636
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
6568
6637
  const fetch2 = nodeFetchProxy(proxy, verbose);
6569
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6638
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
6570
6639
  const source = createEntryEngineDataSource({
6571
6640
  client,
6572
6641
  state: "preview",
@@ -6658,7 +6727,7 @@ var EntryPullModule = {
6658
6727
  resolvedBatchSize
6659
6728
  }) => {
6660
6729
  const fetch2 = nodeFetchProxy(proxy, verbose);
6661
- const client = getContentClient({
6730
+ const client = getEntryManagementClient({
6662
6731
  apiKey,
6663
6732
  apiHost,
6664
6733
  fetch: fetch2,
@@ -6767,7 +6836,7 @@ var EntryPushModule = {
6767
6836
  resolvedBatchSize
6768
6837
  }) => {
6769
6838
  const fetch2 = nodeFetchProxy(proxy, verbose);
6770
- const client = getContentClient({
6839
+ const client = getEntryManagementClient({
6771
6840
  apiKey,
6772
6841
  apiHost,
6773
6842
  fetch: fetch2,
@@ -6852,7 +6921,7 @@ function createEntryRemoveHandler(expectedType) {
6852
6921
  console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
6853
6922
  }
6854
6923
  const fetch2 = nodeFetchProxy(proxy, verbose);
6855
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6924
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
6856
6925
  const validation = await validateEntryType(client, id, expectedType);
6857
6926
  if (!validation.exists) {
6858
6927
  console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
@@ -6863,7 +6932,7 @@ function createEntryRemoveHandler(expectedType) {
6863
6932
  process.exit(1);
6864
6933
  }
6865
6934
  if (!whatIf) {
6866
- await client.deleteEntry({ entryId: id });
6935
+ await client.remove({ entryId: id });
6867
6936
  } else {
6868
6937
  whatIfSimpleLog({ id, displayName: getEntryDisplayName(expectedType), action: "delete" });
6869
6938
  }
@@ -6886,7 +6955,7 @@ var EntryRemoveModule = {
6886
6955
  };
6887
6956
 
6888
6957
  // src/commands/canvas/commands/entry/unpublish.ts
6889
- import { ApiClientError as ApiClientError3, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6958
+ import { ApiClientError as ApiClientError3 } from "@uniformdev/canvas";
6890
6959
  import { diffJson as diffJson3 } from "diff";
6891
6960
  var EntryUnpublishModule = {
6892
6961
  command: "unpublish [ids]",
@@ -6929,7 +6998,7 @@ var EntryUnpublishModule = {
6929
6998
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
6930
6999
  const targetItems = /* @__PURE__ */ new Map();
6931
7000
  const fetch2 = nodeFetchProxy(proxy, verbose);
6932
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
7001
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
6933
7002
  const source = createEntryEngineDataSource({
6934
7003
  client,
6935
7004
  state: "published",
@@ -6965,7 +7034,7 @@ var EntryUnpublishModule = {
6965
7034
  }
6966
7035
  if (!whatIf) {
6967
7036
  actions.push(
6968
- client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE3 }).catch((err) => {
7037
+ client.unpublish(parseEntrySerializedId(id)).catch((err) => {
6969
7038
  const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
6970
7039
  if (isNotFound) {
6971
7040
  console.warn(
@@ -6994,7 +7063,6 @@ var EntryUnpublishModule = {
6994
7063
  function createEntryUpdateHandler(expectedType) {
6995
7064
  return async ({
6996
7065
  apiHost,
6997
- edgeApiHost,
6998
7066
  apiKey,
6999
7067
  proxy,
7000
7068
  filename,
@@ -7007,7 +7075,7 @@ function createEntryUpdateHandler(expectedType) {
7007
7075
  console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
7008
7076
  }
7009
7077
  const fetch2 = nodeFetchProxy(proxy, verbose);
7010
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
7078
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
7011
7079
  const file = readFileToObject(filename);
7012
7080
  const id = file.entry._id;
7013
7081
  const validation = await validateEntryType(client, id, expectedType);
@@ -7016,7 +7084,7 @@ function createEntryUpdateHandler(expectedType) {
7016
7084
  process.exit(1);
7017
7085
  }
7018
7086
  if (!whatIf) {
7019
- await client.upsertEntry({ ...file, state: convertStateOption(state) });
7087
+ await client.save({ ...file, state: convertStateOption(state) });
7020
7088
  } else {
7021
7089
  whatIfSimpleLog({
7022
7090
  id,
@@ -7082,16 +7150,12 @@ var EntryPatternGetModule = {
7082
7150
  type: "number",
7083
7151
  default: 1,
7084
7152
  describe: "Controls how many levels deep content references should be resolved"
7085
- },
7086
- withComponentIDs: {
7087
- type: "boolean",
7088
- default: false,
7089
- describe: "Include IDs of blocks in block fields"
7090
7153
  }
7091
7154
  }),
7092
7155
  "published"
7093
7156
  )
7094
- )
7157
+ ),
7158
+ { includeEdgeApiHost: true }
7095
7159
  )
7096
7160
  )
7097
7161
  )
@@ -7105,47 +7169,17 @@ var EntryPatternListModule = {
7105
7169
  describe: "List entry patterns",
7106
7170
  builder: (yargs44) => withConfiguration(
7107
7171
  withDebugOptions(
7108
- withFormatOptions(
7109
- withApiOptions(
7110
- withProjectOptions(
7111
- withStateOptions(
7112
- yargs44.option({
7113
- withComponentIDs: {
7114
- type: "boolean",
7115
- default: false,
7116
- describe: "Include IDs of blocks in block fields"
7117
- }
7118
- }),
7119
- "published"
7120
- )
7121
- )
7122
- )
7123
- )
7172
+ withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs44, "published"))))
7124
7173
  )
7125
7174
  ),
7126
- handler: async ({
7127
- apiHost,
7128
- edgeApiHost,
7129
- apiKey,
7130
- proxy,
7131
- format,
7132
- filename,
7133
- project: projectId,
7134
- state,
7135
- withComponentIDs,
7136
- verbose
7137
- }) => {
7175
+ handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, state, verbose }) => {
7138
7176
  const fetch2 = nodeFetchProxy(proxy, verbose);
7139
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
7140
- const res = await client.getEntries({
7177
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
7178
+ const res = await client.list({
7141
7179
  offset: 0,
7142
7180
  limit: 1e3,
7143
7181
  state: convertStateOption(state),
7144
- skipOverridesResolution: true,
7145
- skipPatternResolution: true,
7146
- skipDataResolution: true,
7147
- pattern: true,
7148
- withComponentIDs
7182
+ pattern: true
7149
7183
  });
7150
7184
  emitWithFormat(res.entries, format, filename);
7151
7185
  }
@@ -7179,7 +7213,6 @@ var EntryPatternPublishModule = {
7179
7213
  ),
7180
7214
  handler: async ({
7181
7215
  apiHost,
7182
- edgeApiHost,
7183
7216
  apiKey,
7184
7217
  proxy,
7185
7218
  ids,
@@ -7196,7 +7229,7 @@ var EntryPatternPublishModule = {
7196
7229
  }
7197
7230
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
7198
7231
  const fetch2 = nodeFetchProxy(proxy, verbose);
7199
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
7232
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
7200
7233
  const source = createEntryEngineDataSource({
7201
7234
  client,
7202
7235
  state: "preview",
@@ -7288,7 +7321,7 @@ var EntryPatternPullModule = {
7288
7321
  resolvedBatchSize
7289
7322
  }) => {
7290
7323
  const fetch2 = nodeFetchProxy(proxy, verbose);
7291
- const client = getContentClient({
7324
+ const client = getEntryManagementClient({
7292
7325
  apiKey,
7293
7326
  apiHost,
7294
7327
  fetch: fetch2,
@@ -7402,7 +7435,7 @@ var EntryPatternPushModule = {
7402
7435
  resolvedBatchSize
7403
7436
  }) => {
7404
7437
  const fetch2 = nodeFetchProxy(proxy, verbose);
7405
- const client = getContentClient({
7438
+ const client = getEntryManagementClient({
7406
7439
  apiKey,
7407
7440
  apiHost,
7408
7441
  fetch: fetch2,
@@ -7490,7 +7523,7 @@ var EntryPatternRemoveModule = {
7490
7523
  };
7491
7524
 
7492
7525
  // src/commands/canvas/commands/entryPattern/unpublish.ts
7493
- import { ApiClientError as ApiClientError4, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
7526
+ import { ApiClientError as ApiClientError4 } from "@uniformdev/canvas";
7494
7527
  import { diffJson as diffJson4 } from "diff";
7495
7528
  var EntryPatternUnpublishModule = {
7496
7529
  command: "unpublish [ids]",
@@ -7533,7 +7566,7 @@ var EntryPatternUnpublishModule = {
7533
7566
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
7534
7567
  const targetItems = /* @__PURE__ */ new Map();
7535
7568
  const fetch2 = nodeFetchProxy(proxy, verbose);
7536
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
7569
+ const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
7537
7570
  const source = createEntryEngineDataSource({
7538
7571
  client,
7539
7572
  state: "published",
@@ -7569,7 +7602,7 @@ var EntryPatternUnpublishModule = {
7569
7602
  }
7570
7603
  if (!whatIf) {
7571
7604
  actions.push(
7572
- client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
7605
+ client.unpublish(parseEntrySerializedId(id)).catch((err) => {
7573
7606
  const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
7574
7607
  if (isNotFound) {
7575
7608
  console.warn(
@@ -7637,10 +7670,11 @@ function createLabelsEngineDataSource({
7637
7670
  verbose
7638
7671
  }) {
7639
7672
  async function* getObjects() {
7640
- const labels = paginateAsync(
7641
- async (offset, limit2) => (await client.getLabels({ offset, limit: limit2 })).labels,
7642
- { pageSize: batchSize ?? 100, verbose, entityName: "labels" }
7643
- );
7673
+ const labels = paginateAsync(async (offset, limit2) => (await client.list({ offset, limit: limit2 })).labels, {
7674
+ pageSize: batchSize ?? 100,
7675
+ verbose,
7676
+ entityName: "labels"
7677
+ });
7644
7678
  for await (const label of labels) {
7645
7679
  const result = {
7646
7680
  id: label.label.publicId,
@@ -7655,10 +7689,10 @@ function createLabelsEngineDataSource({
7655
7689
  name: "Uniform API",
7656
7690
  objects: getObjects(),
7657
7691
  deleteObject: async (providerId) => {
7658
- await client.removeLabel({ labelId: providerId });
7692
+ await client.remove({ labelId: providerId });
7659
7693
  },
7660
7694
  writeObject: async ({ object: object4 }) => {
7661
- await client.upsertLabel({ label: object4.label });
7695
+ await client.save({ label: object4.label });
7662
7696
  }
7663
7697
  };
7664
7698
  }
@@ -7888,7 +7922,7 @@ function createLocaleEngineDataSource({
7888
7922
  client
7889
7923
  }) {
7890
7924
  async function* getObjects() {
7891
- const locales = (await client.get()).results;
7925
+ const locales = (await client.list()).results;
7892
7926
  for await (const locale of locales) {
7893
7927
  const result = {
7894
7928
  id: locale.locale,
@@ -7906,7 +7940,7 @@ function createLocaleEngineDataSource({
7906
7940
  await client.remove({ locale: providerId });
7907
7941
  },
7908
7942
  writeObject: async (object4) => {
7909
- await client.upsert({
7943
+ await client.save({
7910
7944
  locale: object4.object
7911
7945
  });
7912
7946
  }
@@ -8981,7 +9015,7 @@ function createWorkflowEngineDataSource({
8981
9015
  verbose
8982
9016
  }) {
8983
9017
  async function* getObjects() {
8984
- const workflows = paginateAsync(async (offset, limit2) => (await client.get({ offset, limit: limit2 })).results, {
9018
+ const workflows = paginateAsync(async (offset, limit2) => (await client.list({ offset, limit: limit2 })).results, {
8985
9019
  pageSize: batchSize ?? 100,
8986
9020
  verbose,
8987
9021
  entityName: "workflows"
@@ -9004,7 +9038,7 @@ function createWorkflowEngineDataSource({
9004
9038
  await client.remove({ workflowId: providerId });
9005
9039
  },
9006
9040
  writeObject: async (object4) => {
9007
- await client.upsert({ workflow: object4.object });
9041
+ await client.save({ workflow: object4.object });
9008
9042
  }
9009
9043
  };
9010
9044
  }
@@ -9500,11 +9534,11 @@ var AggregateModule = {
9500
9534
  import yargs24 from "yargs";
9501
9535
 
9502
9536
  // src/commands/context/commands/enrichment/_util.ts
9503
- import { UncachedEnrichmentClient } from "@uniformdev/context/api";
9537
+ import { EnrichmentClient } from "@uniformdev/context/api";
9504
9538
  var selectIdentifier9 = (source) => source.id;
9505
9539
  var selectDisplayName9 = (source) => `${source.name} (pid: ${source.id})`;
9506
9540
  function getEnrichmentClient(options) {
9507
- return new UncachedEnrichmentClient({ ...options, limitPolicy: cliLimitPolicy });
9541
+ return new EnrichmentClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
9508
9542
  }
9509
9543
 
9510
9544
  // src/commands/context/commands/enrichment/get.ts
@@ -9809,7 +9843,7 @@ var EnrichmentModule = {
9809
9843
  import yargs25 from "yargs";
9810
9844
 
9811
9845
  // src/commands/context/commands/manifest/get.ts
9812
- import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
9846
+ import { ApiClientError as ApiClientError5, ManifestClient } from "@uniformdev/context/api";
9813
9847
  import { gray as gray4, green as green6, red as red6 } from "colorette";
9814
9848
  import { writeFile } from "fs";
9815
9849
  import { exit } from "process";
@@ -9837,11 +9871,12 @@ var ManifestGetModule = {
9837
9871
  ),
9838
9872
  handler: async ({ apiKey, apiHost, proxy, output, project, preview }) => {
9839
9873
  const fetch2 = nodeFetchProxy(proxy);
9840
- const client = new UncachedManifestClient({
9874
+ const client = new ManifestClient({
9841
9875
  apiHost,
9842
9876
  projectId: project,
9843
9877
  apiKey,
9844
- fetch: fetch2
9878
+ fetch: fetch2,
9879
+ bypassCache: true
9845
9880
  });
9846
9881
  try {
9847
9882
  const manifest = await client.get({ preview });
@@ -9876,7 +9911,7 @@ var ManifestGetModule = {
9876
9911
  };
9877
9912
 
9878
9913
  // src/commands/context/commands/manifest/publish.ts
9879
- import { ApiClientError as ApiClientError6, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9914
+ import { ApiClientError as ApiClientError6, ManifestClient as ManifestClient2 } from "@uniformdev/context/api";
9880
9915
  import { gray as gray5, red as red7 } from "colorette";
9881
9916
  import { exit as exit2 } from "process";
9882
9917
  var ManifestPublishModule = {
@@ -9886,11 +9921,12 @@ var ManifestPublishModule = {
9886
9921
  handler: async ({ apiKey, apiHost, proxy, project }) => {
9887
9922
  const fetch2 = nodeFetchProxy(proxy);
9888
9923
  try {
9889
- const client = new UncachedManifestClient2({
9924
+ const client = new ManifestClient2({
9890
9925
  apiHost,
9891
9926
  projectId: project,
9892
9927
  apiKey,
9893
- fetch: fetch2
9928
+ fetch: fetch2,
9929
+ bypassCache: true
9894
9930
  });
9895
9931
  await client.publish();
9896
9932
  } catch (e) {
@@ -9925,7 +9961,7 @@ var ManifestModule = {
9925
9961
  import yargs26 from "yargs";
9926
9962
 
9927
9963
  // src/commands/context/commands/quirk/get.ts
9928
- import { UncachedQuirkClient } from "@uniformdev/context/api";
9964
+ import { QuirkClient } from "@uniformdev/context/api";
9929
9965
  var QuirkGetModule = {
9930
9966
  command: "get <id>",
9931
9967
  describe: "Fetch a quirk",
@@ -9940,7 +9976,7 @@ var QuirkGetModule = {
9940
9976
  ),
9941
9977
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
9942
9978
  const fetch2 = nodeFetchProxy(proxy);
9943
- const client = new UncachedQuirkClient({ apiKey, apiHost, fetch: fetch2, projectId });
9979
+ const client = new QuirkClient({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
9944
9980
  const res = await client.get({ quirkId: id, withIntegrations: true });
9945
9981
  if (res.quirks.length === 0) {
9946
9982
  console.error("Quirk did not exist");
@@ -9952,7 +9988,7 @@ var QuirkGetModule = {
9952
9988
  };
9953
9989
 
9954
9990
  // src/commands/context/commands/quirk/list.ts
9955
- import { UncachedQuirkClient as UncachedQuirkClient2 } from "@uniformdev/context/api";
9991
+ import { QuirkClient as QuirkClient2 } from "@uniformdev/context/api";
9956
9992
  var QuirkListModule = {
9957
9993
  command: "list",
9958
9994
  describe: "List quirks",
@@ -9972,14 +10008,14 @@ var QuirkListModule = {
9972
10008
  ),
9973
10009
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, withIntegrations }) => {
9974
10010
  const fetch2 = nodeFetchProxy(proxy);
9975
- const client = new UncachedQuirkClient2({ apiKey, apiHost, fetch: fetch2, projectId });
10011
+ const client = new QuirkClient2({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
9976
10012
  const res = await client.get({ withIntegrations });
9977
10013
  emitWithFormat(res.quirks, format, filename);
9978
10014
  }
9979
10015
  };
9980
10016
 
9981
10017
  // src/commands/context/commands/quirk/pull.ts
9982
- import { UncachedQuirkClient as UncachedQuirkClient3 } from "@uniformdev/context/api";
10018
+ import { QuirkClient as QuirkClient3 } from "@uniformdev/context/api";
9983
10019
 
9984
10020
  // src/commands/context/commands/quirk/_util.ts
9985
10021
  var selectIdentifier10 = (source) => source.id;
@@ -10059,7 +10095,7 @@ var QuirkPullModule = {
10059
10095
  verbose
10060
10096
  }) => {
10061
10097
  const fetch2 = nodeFetchProxy(proxy, verbose);
10062
- const client = new UncachedQuirkClient3({ apiKey, apiHost, fetch: fetch2, projectId });
10098
+ const client = new QuirkClient3({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10063
10099
  const source = createQuirkEngineDataSource({ client });
10064
10100
  let target;
10065
10101
  const isPackage = isPathAPackageFile(directory);
@@ -10096,7 +10132,7 @@ var QuirkPullModule = {
10096
10132
  };
10097
10133
 
10098
10134
  // src/commands/context/commands/quirk/push.ts
10099
- import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context/api";
10135
+ import { QuirkClient as QuirkClient4 } from "@uniformdev/context/api";
10100
10136
  var QuirkPushModule = {
10101
10137
  command: "push <directory>",
10102
10138
  describe: "Pushes all quirks from files in a directory or package to Uniform",
@@ -10133,7 +10169,7 @@ var QuirkPushModule = {
10133
10169
  verbose
10134
10170
  }) => {
10135
10171
  const fetch2 = nodeFetchProxy(proxy, verbose);
10136
- const client = new UncachedQuirkClient4({ apiKey, apiHost, fetch: fetch2, projectId });
10172
+ const client = new QuirkClient4({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10137
10173
  let source;
10138
10174
  const isPackage = isPathAPackageFile(directory);
10139
10175
  if (isPackage) {
@@ -10165,7 +10201,7 @@ var QuirkPushModule = {
10165
10201
  };
10166
10202
 
10167
10203
  // src/commands/context/commands/quirk/remove.ts
10168
- import { UncachedQuirkClient as UncachedQuirkClient5 } from "@uniformdev/context/api";
10204
+ import { QuirkClient as QuirkClient5 } from "@uniformdev/context/api";
10169
10205
  var QuirkRemoveModule = {
10170
10206
  command: "remove <id>",
10171
10207
  aliases: ["delete", "rm"],
@@ -10179,13 +10215,13 @@ var QuirkRemoveModule = {
10179
10215
  ),
10180
10216
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
10181
10217
  const fetch2 = nodeFetchProxy(proxy);
10182
- const client = new UncachedQuirkClient5({ apiKey, apiHost, fetch: fetch2, projectId });
10218
+ const client = new QuirkClient5({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10183
10219
  await client.remove({ quirkId: id });
10184
10220
  }
10185
10221
  };
10186
10222
 
10187
10223
  // src/commands/context/commands/quirk/update.ts
10188
- import { UncachedQuirkClient as UncachedQuirkClient6 } from "@uniformdev/context/api";
10224
+ import { QuirkClient as QuirkClient6 } from "@uniformdev/context/api";
10189
10225
  var QuirkUpdateModule = {
10190
10226
  command: "update <filename>",
10191
10227
  aliases: ["put"],
@@ -10199,7 +10235,7 @@ var QuirkUpdateModule = {
10199
10235
  ),
10200
10236
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
10201
10237
  const fetch2 = nodeFetchProxy(proxy);
10202
- const client = new UncachedQuirkClient6({ apiKey, apiHost, fetch: fetch2, projectId });
10238
+ const client = new QuirkClient6({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10203
10239
  const file = readFileToObject(filename);
10204
10240
  await client.upsert({ quirk: file });
10205
10241
  }
@@ -10220,7 +10256,7 @@ var QuirkModule = {
10220
10256
  import yargs27 from "yargs";
10221
10257
 
10222
10258
  // src/commands/context/commands/signal/get.ts
10223
- import { UncachedSignalClient } from "@uniformdev/context/api";
10259
+ import { SignalClient } from "@uniformdev/context/api";
10224
10260
  var SignalGetModule = {
10225
10261
  command: "get <id>",
10226
10262
  describe: "Fetch a signal",
@@ -10235,7 +10271,7 @@ var SignalGetModule = {
10235
10271
  ),
10236
10272
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
10237
10273
  const fetch2 = nodeFetchProxy(proxy);
10238
- const client = new UncachedSignalClient({ apiKey, apiHost, fetch: fetch2, projectId });
10274
+ const client = new SignalClient({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10239
10275
  const res = await client.get({ signalId: id });
10240
10276
  if (res.signals.length === 0) {
10241
10277
  console.error("Signal did not exist");
@@ -10247,7 +10283,7 @@ var SignalGetModule = {
10247
10283
  };
10248
10284
 
10249
10285
  // src/commands/context/commands/signal/list.ts
10250
- import { UncachedSignalClient as UncachedSignalClient2 } from "@uniformdev/context/api";
10286
+ import { SignalClient as SignalClient2 } from "@uniformdev/context/api";
10251
10287
  var SignalListModule = {
10252
10288
  command: "list",
10253
10289
  describe: "List signals",
@@ -10255,14 +10291,14 @@ var SignalListModule = {
10255
10291
  builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
10256
10292
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
10257
10293
  const fetch2 = nodeFetchProxy(proxy);
10258
- const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch2, projectId });
10294
+ const client = new SignalClient2({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10259
10295
  const res = await client.get();
10260
10296
  emitWithFormat(res.signals, format, filename);
10261
10297
  }
10262
10298
  };
10263
10299
 
10264
10300
  // src/commands/context/commands/signal/pull.ts
10265
- import { UncachedSignalClient as UncachedSignalClient3 } from "@uniformdev/context/api";
10301
+ import { SignalClient as SignalClient3 } from "@uniformdev/context/api";
10266
10302
 
10267
10303
  // src/commands/context/commands/signal/_util.ts
10268
10304
  var selectIdentifier11 = (source) => source.id;
@@ -10342,7 +10378,7 @@ var SignalPullModule = {
10342
10378
  verbose
10343
10379
  }) => {
10344
10380
  const fetch2 = nodeFetchProxy(proxy, verbose);
10345
- const client = new UncachedSignalClient3({ apiKey, apiHost, fetch: fetch2, projectId });
10381
+ const client = new SignalClient3({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10346
10382
  const source = createSignalEngineDataSource({ client });
10347
10383
  let target;
10348
10384
  const isPackage = isPathAPackageFile(directory);
@@ -10379,7 +10415,7 @@ var SignalPullModule = {
10379
10415
  };
10380
10416
 
10381
10417
  // src/commands/context/commands/signal/push.ts
10382
- import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/context/api";
10418
+ import { SignalClient as SignalClient4 } from "@uniformdev/context/api";
10383
10419
  var SignalPushModule = {
10384
10420
  command: "push <directory>",
10385
10421
  describe: "Pushes all signals from files in a directory or package to Uniform",
@@ -10416,7 +10452,7 @@ var SignalPushModule = {
10416
10452
  verbose
10417
10453
  }) => {
10418
10454
  const fetch2 = nodeFetchProxy(proxy, verbose);
10419
- const client = new UncachedSignalClient4({ apiKey, apiHost, fetch: fetch2, projectId });
10455
+ const client = new SignalClient4({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10420
10456
  let source;
10421
10457
  const isPackage = isPathAPackageFile(directory);
10422
10458
  if (isPackage) {
@@ -10448,7 +10484,7 @@ var SignalPushModule = {
10448
10484
  };
10449
10485
 
10450
10486
  // src/commands/context/commands/signal/remove.ts
10451
- import { UncachedSignalClient as UncachedSignalClient5 } from "@uniformdev/context/api";
10487
+ import { SignalClient as SignalClient5 } from "@uniformdev/context/api";
10452
10488
  var SignalRemoveModule = {
10453
10489
  command: "remove <id>",
10454
10490
  aliases: ["delete", "rm"],
@@ -10462,13 +10498,13 @@ var SignalRemoveModule = {
10462
10498
  ),
10463
10499
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
10464
10500
  const fetch2 = nodeFetchProxy(proxy);
10465
- const client = new UncachedSignalClient5({ apiKey, apiHost, fetch: fetch2, projectId });
10501
+ const client = new SignalClient5({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10466
10502
  await client.remove({ signalId: id });
10467
10503
  }
10468
10504
  };
10469
10505
 
10470
10506
  // src/commands/context/commands/signal/update.ts
10471
- import { UncachedSignalClient as UncachedSignalClient6 } from "@uniformdev/context/api";
10507
+ import { SignalClient as SignalClient6 } from "@uniformdev/context/api";
10472
10508
  var SignalUpdateModule = {
10473
10509
  command: "update <filename>",
10474
10510
  aliases: ["put"],
@@ -10482,7 +10518,7 @@ var SignalUpdateModule = {
10482
10518
  ),
10483
10519
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
10484
10520
  const fetch2 = nodeFetchProxy(proxy);
10485
- const client = new UncachedSignalClient6({ apiKey, apiHost, fetch: fetch2, projectId });
10521
+ const client = new SignalClient6({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10486
10522
  const file = readFileToObject(filename);
10487
10523
  await client.upsert({ signal: file });
10488
10524
  }
@@ -10503,7 +10539,7 @@ var SignalModule = {
10503
10539
  import yargs28 from "yargs";
10504
10540
 
10505
10541
  // src/commands/context/commands/test/get.ts
10506
- import { UncachedTestClient } from "@uniformdev/context/api";
10542
+ import { TestClient } from "@uniformdev/context/api";
10507
10543
  var TestGetModule = {
10508
10544
  command: "get <id>",
10509
10545
  describe: "Fetch a test",
@@ -10518,7 +10554,7 @@ var TestGetModule = {
10518
10554
  ),
10519
10555
  handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
10520
10556
  const fetch2 = nodeFetchProxy(proxy);
10521
- const client = new UncachedTestClient({ apiKey, apiHost, fetch: fetch2, projectId });
10557
+ const client = new TestClient({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10522
10558
  const res = await client.get({ testId: id });
10523
10559
  if (res.tests.length === 0) {
10524
10560
  console.error("Test did not exist");
@@ -10530,7 +10566,7 @@ var TestGetModule = {
10530
10566
  };
10531
10567
 
10532
10568
  // src/commands/context/commands/test/list.ts
10533
- import { UncachedTestClient as UncachedTestClient2 } from "@uniformdev/context/api";
10569
+ import { TestClient as TestClient2 } from "@uniformdev/context/api";
10534
10570
  var TestListModule = {
10535
10571
  command: "list",
10536
10572
  describe: "List tests",
@@ -10538,14 +10574,14 @@ var TestListModule = {
10538
10574
  builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
10539
10575
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
10540
10576
  const fetch2 = nodeFetchProxy(proxy);
10541
- const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch2, projectId });
10577
+ const client = new TestClient2({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10542
10578
  const res = await client.get();
10543
10579
  emitWithFormat(res.tests, format, filename);
10544
10580
  }
10545
10581
  };
10546
10582
 
10547
10583
  // src/commands/context/commands/test/pull.ts
10548
- import { UncachedTestClient as UncachedTestClient3 } from "@uniformdev/context/api";
10584
+ import { TestClient as TestClient3 } from "@uniformdev/context/api";
10549
10585
 
10550
10586
  // src/commands/context/commands/test/_util.ts
10551
10587
  var selectIdentifier12 = (source) => source.id;
@@ -10625,7 +10661,7 @@ var TestPullModule = {
10625
10661
  verbose
10626
10662
  }) => {
10627
10663
  const fetch2 = nodeFetchProxy(proxy, verbose);
10628
- const client = new UncachedTestClient3({ apiKey, apiHost, fetch: fetch2, projectId });
10664
+ const client = new TestClient3({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10629
10665
  const source = createTestEngineDataSource({ client });
10630
10666
  let target;
10631
10667
  const isPackage = isPathAPackageFile(directory);
@@ -10662,7 +10698,7 @@ var TestPullModule = {
10662
10698
  };
10663
10699
 
10664
10700
  // src/commands/context/commands/test/push.ts
10665
- import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/api";
10701
+ import { TestClient as TestClient4 } from "@uniformdev/context/api";
10666
10702
  var TestPushModule = {
10667
10703
  command: "push <directory>",
10668
10704
  describe: "Pushes all tests from files in a directory or package to Uniform",
@@ -10699,7 +10735,7 @@ var TestPushModule = {
10699
10735
  verbose
10700
10736
  }) => {
10701
10737
  const fetch2 = nodeFetchProxy(proxy, verbose);
10702
- const client = new UncachedTestClient4({ apiKey, apiHost, fetch: fetch2, projectId });
10738
+ const client = new TestClient4({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10703
10739
  let source;
10704
10740
  const isPackage = isPathAPackageFile(directory);
10705
10741
  if (isPackage) {
@@ -10731,7 +10767,7 @@ var TestPushModule = {
10731
10767
  };
10732
10768
 
10733
10769
  // src/commands/context/commands/test/remove.ts
10734
- import { UncachedTestClient as UncachedTestClient5 } from "@uniformdev/context/api";
10770
+ import { TestClient as TestClient5 } from "@uniformdev/context/api";
10735
10771
  var TestRemoveModule = {
10736
10772
  command: "remove <id>",
10737
10773
  aliases: ["delete", "rm"],
@@ -10745,13 +10781,13 @@ var TestRemoveModule = {
10745
10781
  ),
10746
10782
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
10747
10783
  const fetch2 = nodeFetchProxy(proxy);
10748
- const client = new UncachedTestClient5({ apiKey, apiHost, fetch: fetch2, projectId });
10784
+ const client = new TestClient5({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10749
10785
  await client.remove({ testId: id });
10750
10786
  }
10751
10787
  };
10752
10788
 
10753
10789
  // src/commands/context/commands/test/update.ts
10754
- import { UncachedTestClient as UncachedTestClient6 } from "@uniformdev/context/api";
10790
+ import { TestClient as TestClient6 } from "@uniformdev/context/api";
10755
10791
  var TestUpdateModule = {
10756
10792
  command: "update <filename>",
10757
10793
  aliases: ["put"],
@@ -10763,7 +10799,7 @@ var TestUpdateModule = {
10763
10799
  ),
10764
10800
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
10765
10801
  const fetch2 = nodeFetchProxy(proxy);
10766
- const client = new UncachedTestClient6({ apiKey, apiHost, fetch: fetch2, projectId });
10802
+ const client = new TestClient6({ apiKey, apiHost, fetch: fetch2, projectId, bypassCache: true });
10767
10803
  const file = readFileToObject(filename);
10768
10804
  await client.upsert({ test: file });
10769
10805
  }
@@ -12083,11 +12119,11 @@ import yargs38 from "yargs";
12083
12119
  import yargs36 from "yargs";
12084
12120
 
12085
12121
  // src/commands/project-map/commands/ProjectMapDefinition/_util.ts
12086
- import { UncachedProjectMapClient } from "@uniformdev/project-map";
12122
+ import { ProjectMapClient } from "@uniformdev/project-map";
12087
12123
  var selectIdentifier14 = (source) => source.id;
12088
12124
  var selectDisplayName14 = (source) => `${source.name} (pid: ${source.id})`;
12089
12125
  function getProjectMapClient(options) {
12090
- return new UncachedProjectMapClient({ ...options, limitPolicy: cliLimitPolicy });
12126
+ return new ProjectMapClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
12091
12127
  }
12092
12128
 
12093
12129
  // src/commands/project-map/commands/ProjectMapDefinition/get.ts
@@ -12430,6 +12466,20 @@ var selectIdentifier15 = (source, projectId) => [
12430
12466
  ];
12431
12467
  var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
12432
12468
  var selectDisplayName15 = (source) => `${source.name} (pid: ${source.id})`;
12469
+ function alignProjectMapNodeWithTargetIdentifier(sourceObject, targetObject) {
12470
+ if (!targetObject) {
12471
+ return sourceObject;
12472
+ }
12473
+ return {
12474
+ ...sourceObject,
12475
+ id: targetObject.id,
12476
+ providerId: targetObject.providerId,
12477
+ object: {
12478
+ ...sourceObject.object,
12479
+ id: targetObject.object.id
12480
+ }
12481
+ };
12482
+ }
12433
12483
 
12434
12484
  // src/commands/project-map/ProjectMapNodeEngineDataSource.ts
12435
12485
  function createProjectMapNodeEngineDataSource({
@@ -12646,6 +12696,12 @@ var ProjectMapNodePushModule = {
12646
12696
  whatIf,
12647
12697
  allowEmptySource,
12648
12698
  log: createSyncEngineConsoleLogger({ diffMode }),
12699
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
12700
+ return alignProjectMapNodeWithTargetIdentifier(sourceObject, targetObject);
12701
+ },
12702
+ onBeforeWriteObject: async (sourceObject, targetObject) => {
12703
+ return alignProjectMapNodeWithTargetIdentifier(sourceObject, targetObject);
12704
+ },
12649
12705
  onError: (error, object4) => {
12650
12706
  if (error.message.includes(__INTERNAL_MISSING_PARENT_NODE_ERROR)) {
12651
12707
  nodesFailedDueToMissingParent.add(object4.object);
@@ -12740,7 +12796,7 @@ import yargs40 from "yargs";
12740
12796
  import yargs39 from "yargs";
12741
12797
 
12742
12798
  // src/commands/redirect/commands/RedirectDefinition/_util.ts
12743
- import { UncachedRedirectClient } from "@uniformdev/redirect";
12799
+ import { RedirectClient } from "@uniformdev/redirect";
12744
12800
  var selectIdentifier16 = (source) => source.id;
12745
12801
  var selectFilename2 = (source) => {
12746
12802
  const index = source.sourceUrl.lastIndexOf("/");
@@ -12755,7 +12811,7 @@ var selectDisplayName16 = (source) => {
12755
12811
  return `${pathName} (id: ${source.id})`;
12756
12812
  };
12757
12813
  function getRedirectClient(options) {
12758
- return new UncachedRedirectClient({ ...options, limitPolicy: cliLimitPolicy });
12814
+ return new RedirectClient({ ...options, limitPolicy: cliLimitPolicy, bypassCache: true });
12759
12815
  }
12760
12816
 
12761
12817
  // src/commands/redirect/commands/RedirectDefinition/get.ts
@@ -13049,7 +13105,7 @@ import yargs41 from "yargs";
13049
13105
 
13050
13106
  // src/webhooksClient.ts
13051
13107
  import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
13052
- import PQueue3 from "p-queue";
13108
+ import PQueue4 from "p-queue";
13053
13109
  import { Svix } from "svix";
13054
13110
  import * as z4 from "zod";
13055
13111
  var WEBHOOKS_DASHBOARD_BASE_PATH = "/api/v1/svix-dashboard";
@@ -13097,7 +13153,7 @@ var WebhooksClient = class extends ApiClient4 {
13097
13153
  };
13098
13154
  }
13099
13155
  async get() {
13100
- const webhooksAPIQueue = new PQueue3({ concurrency: 10 });
13156
+ const webhooksAPIQueue = new PQueue4({ concurrency: 10 });
13101
13157
  const { appId, token } = await this.getToken();
13102
13158
  const svix = new Svix(token);
13103
13159
  const getEndpoints = async ({
@@ -13846,7 +13902,7 @@ var WhoamiCommand = {
13846
13902
  command: "whoami",
13847
13903
  describe: "Prints configured identity and connection context.",
13848
13904
  builder: (yargs44) => withConfiguration(
13849
- withFormatOptions(withApiOptions(yargs44)).option("project", {
13905
+ withFormatOptions(withApiOptions(yargs44, { includeEdgeApiHost: true })).option("project", {
13850
13906
  describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
13851
13907
  default: process.env.UNIFORM_CLI_PROJECT_ID ?? process.env.UNIFORM_PROJECT_ID,
13852
13908
  type: "string",