@uniformdev/cli 19.79.0 → 19.79.1-alpha.13

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.
Files changed (3) hide show
  1. package/dist/index.d.mts +13 -5
  2. package/dist/index.mjs +1509 -497
  3. package/package.json +17 -17
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  throw Error('Dynamic require of "' + x + '" is not supported');
8
8
  });
9
9
 
10
- // ../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.31_ts-node@10.9.1_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
10
+ // ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.0_postcss@8.4.32_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
11
11
  import { fileURLToPath } from "url";
12
12
  import path from "path";
13
13
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -16,11 +16,11 @@ var __dirname = /* @__PURE__ */ getDirname();
16
16
 
17
17
  // src/index.ts
18
18
  import * as dotenv from "dotenv";
19
- import yargs26 from "yargs";
19
+ import yargs31 from "yargs";
20
20
  import { hideBin } from "yargs/helpers";
21
21
 
22
22
  // src/commands/canvas/index.ts
23
- import yargs10 from "yargs";
23
+ import yargs12 from "yargs";
24
24
 
25
25
  // src/commands/canvas/commands/asset.ts
26
26
  import yargs from "yargs";
@@ -137,14 +137,14 @@ import httpsProxyAgent from "https-proxy-agent";
137
137
  import unfetch from "isomorphic-unfetch";
138
138
  import { dump, load } from "js-yaml";
139
139
  import { dirname, extname, isAbsolute, resolve, sep } from "path";
140
- function withConfiguration(yargs27) {
141
- return yargs27.option("serialization", {
140
+ function withConfiguration(yargs32) {
141
+ return yargs32.option("serialization", {
142
142
  skipValidation: true,
143
143
  hidden: true
144
144
  });
145
145
  }
146
- function withApiOptions(yargs27) {
147
- return yargs27.option("apiKey", {
146
+ function withApiOptions(yargs32) {
147
+ return yargs32.option("apiKey", {
148
148
  describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
149
149
  default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
150
150
  process.env.CANVAS_CLI_API_KEY ?? // deprecated
@@ -183,8 +183,8 @@ function nodeFetchProxy(proxy) {
183
183
  };
184
184
  return wrappedFetch;
185
185
  }
186
- function withProjectOptions(yargs27) {
187
- return yargs27.option("project", {
186
+ function withProjectOptions(yargs32) {
187
+ return yargs32.option("project", {
188
188
  describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
189
189
  default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
190
190
  process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
@@ -194,8 +194,17 @@ function withProjectOptions(yargs27) {
194
194
  alias: ["p"]
195
195
  });
196
196
  }
197
- function withFormatOptions(yargs27) {
198
- return yargs27.option("format", {
197
+ function withTeamOptions(yargs32) {
198
+ return yargs32.option("team", {
199
+ describe: "Uniform team ID. Defaults to UNIFORM_CLI_TEAM_ID or UNIFORM_TEAM_ID env. Supports dotenv.",
200
+ default: process.env.UNIFORM_CLI_TEAM_ID ?? process.env.UNIFORM_TEAM_ID,
201
+ demandOption: true,
202
+ type: "string",
203
+ alias: ["p"]
204
+ });
205
+ }
206
+ function withFormatOptions(yargs32) {
207
+ return yargs32.option("format", {
199
208
  alias: ["f"],
200
209
  describe: "Output format",
201
210
  default: "yaml",
@@ -207,8 +216,8 @@ function withFormatOptions(yargs27) {
207
216
  type: "string"
208
217
  });
209
218
  }
210
- function withDiffOptions(yargs27) {
211
- return yargs27.option("diff", {
219
+ function withDiffOptions(yargs32) {
220
+ return yargs32.option("diff", {
212
221
  describe: "Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",
213
222
  default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
214
223
  type: "string",
@@ -295,6 +304,7 @@ async function* paginateAsync(fetchPage, options) {
295
304
  var defaultSyncConfiguration = {
296
305
  entitiesConfig: {},
297
306
  directory: "uniform-data",
307
+ allowEmptySource: false,
298
308
  format: "yaml",
299
309
  mode: "mirror"
300
310
  };
@@ -632,12 +642,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
632
642
  var AssetGetModule = {
633
643
  command: "get <id>",
634
644
  describe: "Get an asset",
635
- builder: (yargs27) => withConfiguration(
645
+ builder: (yargs32) => withConfiguration(
636
646
  withFormatOptions(
637
647
  withApiOptions(
638
648
  withProjectOptions(
639
649
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
640
- yargs27.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
650
+ yargs32.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
641
651
  )
642
652
  )
643
653
  )
@@ -658,7 +668,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
658
668
  var AssetListModule = {
659
669
  command: "list",
660
670
  describe: "List assets",
661
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
671
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
662
672
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
663
673
  const fetch3 = nodeFetchProxy(proxy);
664
674
  const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -669,6 +679,7 @@ var AssetListModule = {
669
679
 
670
680
  // src/commands/canvas/commands/asset/pull.ts
671
681
  import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
682
+ import { UncachedFileClient } from "@uniformdev/files";
672
683
 
673
684
  // src/files/index.ts
674
685
  import { preferredType } from "@thi.ng/mime";
@@ -679,20 +690,62 @@ import sizeOf from "image-size";
679
690
  import PQueue from "p-queue";
680
691
  import { dirname as dirname2, join as join2 } from "path";
681
692
  var FILES_DIRECTORY_NAME = "files";
693
+ var escapeRegExp = (string) => {
694
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
695
+ };
682
696
  var urlToHash = (url) => {
683
- const hash = createHash("sha256");
684
- hash.update(url);
685
- return hash.digest("hex");
697
+ return Buffer.from(
698
+ // We take only the first 64 characters of the pathname as
699
+ // that's enough to guarantee uniqueness
700
+ new URL(url).pathname.substring(0, 64)
701
+ ).toString("base64");
702
+ };
703
+ var hashToPartialPathname = (hash) => {
704
+ try {
705
+ return Buffer.from(hash, "base64").toString("utf8");
706
+ } catch {
707
+ return null;
708
+ }
709
+ };
710
+ var findUrlMatchingPartialPathname = (source, pathname) => {
711
+ const escapedPathname = escapeRegExp(pathname);
712
+ const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
713
+ const match = source.match(regex);
714
+ if (match && match[1]) {
715
+ return match[1];
716
+ }
717
+ return null;
718
+ };
719
+ var urlToFileExtension = (url) => {
720
+ try {
721
+ const urlObject = new URL(url);
722
+ const fileNameChunks = urlObject.pathname.split(".");
723
+ return fileNameChunks.length > 1 ? fileNameChunks.at(-1) ?? null : null;
724
+ } catch {
725
+ return null;
726
+ }
686
727
  };
687
- var urlToFileName = (url) => {
688
- const fileName = urlToHash(url);
689
- const fileNameChunks = url.split(".");
690
- const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
728
+ var urlToFileName = (url, hash) => {
729
+ const fileName = hash ?? urlToHash(url);
730
+ const fileExtension = urlToFileExtension(url);
691
731
  return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
692
732
  };
733
+ var getFilesDirectory = (directory) => {
734
+ const isPackage = isPathAPackageFile(directory);
735
+ return isPackage ? dirname2(directory) : (
736
+ // If we are syncing to a directory, we want to write all files into a
737
+ // top-lvl folder. That way any entities that contain files will sync to the
738
+ // same directory, so there is no duplication
739
+ join2(directory, "..")
740
+ );
741
+ };
742
+ var getUniformFileUrlMatches = (string) => {
743
+ return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
744
+ };
693
745
  var deleteDownloadedFileByUrl = async (url, options) => {
746
+ const writeDirectory = getFilesDirectory(options.directory);
694
747
  const fileName = urlToFileName(url);
695
- const fileToDelete = join2(options.directory, FILES_DIRECTORY_NAME, fileName);
748
+ const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
696
749
  try {
697
750
  await fsj.removeAsync(fileToDelete);
698
751
  } catch {
@@ -701,30 +754,43 @@ var deleteDownloadedFileByUrl = async (url, options) => {
701
754
  };
702
755
  var extractAndDownloadUniformFilesForObject = async (object, options) => {
703
756
  const objectAsString = JSON.stringify(object);
704
- const uniformFileUrlMatches = objectAsString.matchAll(
705
- /"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
706
- );
757
+ const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
758
+ const writeDirectory = getFilesDirectory(options.directory);
707
759
  if (uniformFileUrlMatches) {
708
760
  const fileDownloadQueue = new PQueue({ concurrency: 10 });
709
761
  for (const match of uniformFileUrlMatches) {
710
762
  const url = new URL(match[1]);
711
763
  fileDownloadQueue.add(async () => {
712
764
  try {
713
- const fetchUrl = `${url.origin}${url.pathname}?format=original`;
714
765
  const fileName = urlToFileName(url.toString());
715
766
  const fileAlreadyExists = await fsj.existsAsync(
716
- join2(options.directory, FILES_DIRECTORY_NAME, fileName)
767
+ join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
717
768
  );
718
769
  if (fileAlreadyExists) {
719
770
  return;
720
771
  }
772
+ const file = await options.fileClient.get({ url: url.toString() }).catch(() => null);
773
+ if (!file) {
774
+ console.warn(`Skipping file ${url} as it does not exist in the project anymore`);
775
+ return;
776
+ }
777
+ if (file.sourceId) {
778
+ try {
779
+ const hashAlreadyExists = await fsj.findAsync(join2(writeDirectory, FILES_DIRECTORY_NAME), {
780
+ matching: [file.sourceId, `${file.sourceId}.*`]
781
+ });
782
+ if (hashAlreadyExists.length > 0) {
783
+ return;
784
+ }
785
+ } catch {
786
+ }
787
+ }
788
+ const fetchUrl = `${url.origin}${url.pathname}?format=original`;
721
789
  const response = await fetch(fetchUrl);
722
790
  if (!response.ok) {
723
791
  return;
724
792
  }
725
793
  const fileBuffer = await response.arrayBuffer();
726
- const isPackage = isPathAPackageFile(options.directory);
727
- const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
728
794
  await fsj.writeAsync(join2(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
729
795
  } catch {
730
796
  console.warn(`Failed to download file ${url}`);
@@ -737,37 +803,45 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
737
803
  };
738
804
  var extractAndUploadUniformFilesForObject = async (object, options) => {
739
805
  let objectAsString = JSON.stringify(object);
740
- const uniformFileUrlMatches = objectAsString.matchAll(
741
- /"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
742
- );
806
+ const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
807
+ const writeDirectory = getFilesDirectory(options.directory);
808
+ const isPackage = isPathAPackageFile(options.directory);
809
+ const legacyWriteDirectory = isPackage ? dirname2(options.directory) : options.directory;
743
810
  if (uniformFileUrlMatches) {
744
811
  const fileUploadQueue = new PQueue({ concurrency: 3 });
745
812
  for (const match of uniformFileUrlMatches) {
746
813
  const url = match[1];
747
814
  const hash = urlToHash(url);
815
+ const legacyHash = legacyUrlToHash(url);
748
816
  fileUploadQueue.add(async () => {
749
817
  try {
750
818
  const fileAlreadyExistsChecks = await Promise.all([
751
819
  options.fileClient.get({ url }).catch(() => null),
752
- options.fileClient.get({ sourceId: hash }).catch(() => null)
820
+ options.fileClient.get({ sourceId: hash }).catch(() => null),
821
+ options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
753
822
  ]);
754
- if (fileAlreadyExistsChecks.some((check) => check !== null)) {
823
+ const file = fileAlreadyExistsChecks.find((check) => check !== null);
824
+ if (file) {
825
+ objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
755
826
  return;
756
827
  }
757
828
  const localFileName = urlToFileName(url);
758
- const fileExistsLocally = await fsj.existsAsync(
759
- join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
760
- );
829
+ let expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
830
+ let fileExistsLocally = await fsj.existsAsync(expectedFilePath);
831
+ if (!fileExistsLocally) {
832
+ const localFileName2 = legacyUrlToFileName(url);
833
+ expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
834
+ fileExistsLocally = await fsj.existsAsync(expectedFilePath);
835
+ }
761
836
  if (!fileExistsLocally) {
762
- console.warn(`Skipping file ${url} as we couldn't find a local copy`);
837
+ console.warn(
838
+ `Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
839
+ );
763
840
  return;
764
841
  }
765
- const fileBuffer = await fsj.readAsync(
766
- join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
767
- "buffer"
768
- );
842
+ const fileBuffer = await fsj.readAsync(expectedFilePath, "buffer");
769
843
  if (!fileBuffer) {
770
- console.warn(`Skipping file ${url} as we couldn't read it`);
844
+ console.warn(`Skipping file ${url} (${expectedFilePath}) as we couldn't read it`);
771
845
  return;
772
846
  }
773
847
  const fileName = getFileNameFromUrl(url);
@@ -799,25 +873,29 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
799
873
  }
800
874
  });
801
875
  if (!uploadResponse.ok) {
802
- console.warn(`Failed to upload file ${url}`);
876
+ console.warn(`Failed to upload file ${url} (${expectedFilePath})`);
803
877
  return;
804
878
  }
879
+ let error;
805
880
  const checkForFile = async () => {
806
- const file = await options.fileClient.get({ id });
807
- if (!file || file.state !== FILE_READY_STATE || !file.url) {
808
- await new Promise((resolve2) => setTimeout(resolve2, 500));
881
+ if (error) {
882
+ throw error;
883
+ }
884
+ const file2 = await options.fileClient.get({ id });
885
+ if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
886
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
809
887
  return checkForFile();
810
888
  }
811
- return file.url;
889
+ return file2.url;
812
890
  };
813
891
  const abortTimeout = setTimeout(() => {
814
- throw new Error(`Failed to upload file ${url}`);
815
- }, 1e4);
892
+ error = new Error(`Failed to upload file ${url} (${expectedFilePath}) - upload timed out`);
893
+ }, 6e4);
816
894
  const uploadedFileUrl = await checkForFile();
817
895
  clearTimeout(abortTimeout);
818
896
  objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
819
- } catch {
820
- console.warn(`Failed to upload file ${url}`);
897
+ } catch (e) {
898
+ console.warn(`Failed to upload file ${url}`, e);
821
899
  }
822
900
  });
823
901
  }
@@ -827,19 +905,19 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
827
905
  };
828
906
  var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
829
907
  let objectAsString = JSON.stringify(object);
830
- const uniformFileUrlMatches = objectAsString.matchAll(
831
- /"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
832
- );
908
+ const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
833
909
  if (uniformFileUrlMatches) {
834
910
  const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
835
911
  for (const match of uniformFileUrlMatches) {
836
912
  const url = match[1];
837
913
  const hash = urlToHash(url);
914
+ const legacyHash = legacyUrlToHash(url);
838
915
  fileUrlReplacementQueue.add(async () => {
839
916
  try {
840
917
  const fileAlreadyExistsChecks = await Promise.all([
841
918
  options.fileClient.get({ url }).catch(() => null),
842
- options.fileClient.get({ sourceId: hash }).catch(() => null)
919
+ options.fileClient.get({ sourceId: hash }).catch(() => null),
920
+ options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
843
921
  ]);
844
922
  const file = fileAlreadyExistsChecks.find((check) => check !== null);
845
923
  if (!file) {
@@ -854,19 +932,74 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
854
932
  }
855
933
  return JSON.parse(objectAsString);
856
934
  };
935
+ var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
936
+ let sourceObjectAsString = JSON.stringify(sourceObject);
937
+ const targetObjectAsString = JSON.stringify(targetObject);
938
+ const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
939
+ const writeDirectory = getFilesDirectory(options.directory);
940
+ if (uniformFileUrlMatches) {
941
+ const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
942
+ for (const match of uniformFileUrlMatches) {
943
+ const url = match[1];
944
+ fileUrlReplacementQueue.add(async () => {
945
+ try {
946
+ const localFileName = urlToFileName(url);
947
+ const fileExistsLocally = await fsj.existsAsync(
948
+ join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
949
+ );
950
+ if (fileExistsLocally) {
951
+ return;
952
+ }
953
+ const file = await options.fileClient.get({ url }).catch(() => null);
954
+ if (!file || !file.sourceId) {
955
+ return;
956
+ }
957
+ const originalPartialPath = hashToPartialPathname(file.sourceId);
958
+ if (!originalPartialPath) {
959
+ return;
960
+ }
961
+ const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
962
+ if (!originalUrl) {
963
+ return;
964
+ }
965
+ sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
966
+ } catch {
967
+ }
968
+ });
969
+ }
970
+ await fileUrlReplacementQueue.onIdle();
971
+ }
972
+ return JSON.parse(sourceObjectAsString);
973
+ };
857
974
  var updateAssetFileIdBasedOnUrl = async (asset, options) => {
858
- var _a, _b, _c;
859
- const fileUrl = (_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
860
- if (!fileUrl || !((_c = asset.asset.fields) == null ? void 0 : _c.file)) {
975
+ var _a;
976
+ if (!asset.asset.fields) {
977
+ return asset;
978
+ }
979
+ const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
980
+ if (!fileUrl) {
861
981
  return asset;
862
982
  }
863
983
  const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
864
984
  if (!file) {
865
985
  return asset;
866
986
  }
867
- asset.asset.fields.file.value = file.id;
987
+ asset.asset.fields.file = {
988
+ type: "file",
989
+ value: file.id
990
+ };
868
991
  return asset;
869
992
  };
993
+ var legacyUrlToHash = (url) => {
994
+ const hash = createHash("sha256");
995
+ hash.update(url);
996
+ return hash.digest("hex");
997
+ };
998
+ var legacyUrlToFileName = (url) => {
999
+ const fileName = legacyUrlToHash(url);
1000
+ const fileExtension = urlToFileExtension(url);
1001
+ return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
1002
+ };
870
1003
 
871
1004
  // src/commands/canvas/assetEngineDataSource.ts
872
1005
  import { convertAssetToPutAsset } from "@uniformdev/assets";
@@ -891,8 +1024,8 @@ function prepCompositionForDisk(composition) {
891
1024
  delete prepped.state;
892
1025
  return prepped;
893
1026
  }
894
- function withStateOptions(yargs27) {
895
- return yargs27.option("state", {
1027
+ function withStateOptions(yargs32) {
1028
+ return yargs32.option("state", {
896
1029
  type: "string",
897
1030
  describe: `Composition state to fetch.`,
898
1031
  choices: ["preview", "published"],
@@ -958,11 +1091,11 @@ function writeCanvasPackage(filename, packageContents) {
958
1091
  var AssetPullModule = {
959
1092
  command: "pull <directory>",
960
1093
  describe: "Pulls all assets to local files in a directory",
961
- builder: (yargs27) => withConfiguration(
1094
+ builder: (yargs32) => withConfiguration(
962
1095
  withApiOptions(
963
1096
  withProjectOptions(
964
1097
  withDiffOptions(
965
- yargs27.positional("directory", {
1098
+ yargs32.positional("directory", {
966
1099
  describe: "Directory to save the assets to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
967
1100
  type: "string"
968
1101
  }).option("format", {
@@ -996,7 +1129,8 @@ var AssetPullModule = {
996
1129
  mode,
997
1130
  whatIf,
998
1131
  project: projectId,
999
- diff: diffMode
1132
+ diff: diffMode,
1133
+ allowEmptySource
1000
1134
  }) => {
1001
1135
  const fetch3 = nodeFetchProxy(proxy);
1002
1136
  const client = new UncachedAssetClient3({
@@ -1005,6 +1139,7 @@ var AssetPullModule = {
1005
1139
  fetch: fetch3,
1006
1140
  projectId
1007
1141
  });
1142
+ const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
1008
1143
  const source = createAssetEngineDataSource({ client });
1009
1144
  let target;
1010
1145
  const isPackage = isPathAPackageFile(directory);
@@ -1044,16 +1179,29 @@ var AssetPullModule = {
1044
1179
  target,
1045
1180
  mode,
1046
1181
  whatIf,
1047
- allowEmptySource: true,
1182
+ allowEmptySource: allowEmptySource ?? true,
1048
1183
  log: createSyncEngineConsoleLogger({ diffMode }),
1049
- onBeforeCompareObjects: async (sourceObject) => {
1184
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
1185
+ var _a, _b;
1050
1186
  delete sourceObject.object.asset._author;
1051
- return sourceObject;
1187
+ const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
1188
+ sourceObject,
1189
+ targetObject,
1190
+ {
1191
+ directory,
1192
+ fileClient
1193
+ }
1194
+ );
1195
+ if (((_a = sourceObjectWithPotentiallySwappedUrl.object.asset.fields) == null ? void 0 : _a.url) && ((_b = targetObject.object.asset.fields) == null ? void 0 : _b.url) && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
1196
+ targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
1197
+ }
1198
+ return sourceObjectWithPotentiallySwappedUrl;
1052
1199
  },
1053
1200
  onBeforeWriteObject: async (sourceObject) => {
1054
1201
  delete sourceObject.object.asset._author;
1055
1202
  return extractAndDownloadUniformFilesForObject(sourceObject, {
1056
- directory
1203
+ directory,
1204
+ fileClient
1057
1205
  });
1058
1206
  }
1059
1207
  });
@@ -1062,15 +1210,15 @@ var AssetPullModule = {
1062
1210
 
1063
1211
  // src/commands/canvas/commands/asset/push.ts
1064
1212
  import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
1065
- import { UncachedFileClient } from "@uniformdev/files";
1213
+ import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
1066
1214
  var AssetPushModule = {
1067
1215
  command: "push <directory>",
1068
1216
  describe: "Pushes all assets from files in a directory to Uniform",
1069
- builder: (yargs27) => withConfiguration(
1217
+ builder: (yargs32) => withConfiguration(
1070
1218
  withApiOptions(
1071
1219
  withProjectOptions(
1072
1220
  withDiffOptions(
1073
- yargs27.positional("directory", {
1221
+ yargs32.positional("directory", {
1074
1222
  describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
1075
1223
  type: "string"
1076
1224
  }).option("what-if", {
@@ -1097,7 +1245,8 @@ var AssetPushModule = {
1097
1245
  mode,
1098
1246
  whatIf,
1099
1247
  project: projectId,
1100
- diff: diffMode
1248
+ diff: diffMode,
1249
+ allowEmptySource
1101
1250
  }) => {
1102
1251
  const fetch3 = nodeFetchProxy(proxy);
1103
1252
  const client = new UncachedAssetClient4({
@@ -1123,12 +1272,13 @@ var AssetPushModule = {
1123
1272
  });
1124
1273
  }
1125
1274
  const target = createAssetEngineDataSource({ client });
1126
- const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
1275
+ const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
1127
1276
  await syncEngine({
1128
1277
  source,
1129
1278
  target,
1130
1279
  mode,
1131
1280
  whatIf,
1281
+ allowEmptySource,
1132
1282
  log: createSyncEngineConsoleLogger({ diffMode }),
1133
1283
  onBeforeCompareObjects: async (sourceObject, targetObject) => {
1134
1284
  if (targetObject) {
@@ -1168,9 +1318,9 @@ var AssetRemoveModule = {
1168
1318
  command: "remove <id>",
1169
1319
  aliases: ["delete", "rm"],
1170
1320
  describe: "Delete an asset",
1171
- builder: (yargs27) => withConfiguration(
1321
+ builder: (yargs32) => withConfiguration(
1172
1322
  withApiOptions(
1173
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
1323
+ withProjectOptions(yargs32.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
1174
1324
  )
1175
1325
  ),
1176
1326
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -1186,10 +1336,10 @@ var AssetUpdateModule = {
1186
1336
  command: "update <filename>",
1187
1337
  aliases: ["put"],
1188
1338
  describe: "Insert or update an asset",
1189
- builder: (yargs27) => withConfiguration(
1339
+ builder: (yargs32) => withConfiguration(
1190
1340
  withApiOptions(
1191
1341
  withProjectOptions(
1192
- yargs27.positional("filename", { demandOption: true, describe: "Asset file to put" })
1342
+ yargs32.positional("filename", { demandOption: true, describe: "Asset file to put" })
1193
1343
  )
1194
1344
  )
1195
1345
  ),
@@ -1205,7 +1355,7 @@ var AssetUpdateModule = {
1205
1355
  var AssetModule = {
1206
1356
  command: "asset <command>",
1207
1357
  describe: "Commands for Assets",
1208
- builder: (yargs27) => yargs27.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
1358
+ builder: (yargs32) => yargs32.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
1209
1359
  handler: () => {
1210
1360
  yargs.help();
1211
1361
  }
@@ -1219,11 +1369,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
1219
1369
  var CategoryGetModule = {
1220
1370
  command: "get <id>",
1221
1371
  describe: "Fetch a category",
1222
- builder: (yargs27) => withConfiguration(
1372
+ builder: (yargs32) => withConfiguration(
1223
1373
  withFormatOptions(
1224
1374
  withApiOptions(
1225
1375
  withProjectOptions(
1226
- yargs27.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
1376
+ yargs32.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
1227
1377
  )
1228
1378
  )
1229
1379
  )
@@ -1248,7 +1398,7 @@ var CategoryListModule = {
1248
1398
  command: "list",
1249
1399
  describe: "List categories",
1250
1400
  aliases: ["ls"],
1251
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27.options({}))))),
1401
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32.options({}))))),
1252
1402
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
1253
1403
  const fetch3 = nodeFetchProxy(proxy);
1254
1404
  const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1297,11 +1447,11 @@ function createCategoriesEngineDataSource({
1297
1447
  var CategoryPullModule = {
1298
1448
  command: "pull <directory>",
1299
1449
  describe: "Pulls all categories to local files in a directory",
1300
- builder: (yargs27) => withConfiguration(
1450
+ builder: (yargs32) => withConfiguration(
1301
1451
  withApiOptions(
1302
1452
  withProjectOptions(
1303
1453
  withDiffOptions(
1304
- yargs27.positional("directory", {
1454
+ yargs32.positional("directory", {
1305
1455
  describe: "Directory to save the categories to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
1306
1456
  type: "string"
1307
1457
  }).option("format", {
@@ -1335,7 +1485,8 @@ var CategoryPullModule = {
1335
1485
  mode,
1336
1486
  whatIf,
1337
1487
  project: projectId,
1338
- diff: diffMode
1488
+ diff: diffMode,
1489
+ allowEmptySource
1339
1490
  }) => {
1340
1491
  const fetch3 = nodeFetchProxy(proxy);
1341
1492
  const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1366,7 +1517,7 @@ var CategoryPullModule = {
1366
1517
  target,
1367
1518
  mode,
1368
1519
  whatIf,
1369
- allowEmptySource: true,
1520
+ allowEmptySource: allowEmptySource ?? true,
1370
1521
  log: createSyncEngineConsoleLogger({ diffMode })
1371
1522
  });
1372
1523
  }
@@ -1377,11 +1528,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
1377
1528
  var CategoryPushModule = {
1378
1529
  command: "push <directory>",
1379
1530
  describe: "Pushes all categories from files in a directory to Uniform Canvas",
1380
- builder: (yargs27) => withConfiguration(
1531
+ builder: (yargs32) => withConfiguration(
1381
1532
  withApiOptions(
1382
1533
  withProjectOptions(
1383
1534
  withDiffOptions(
1384
- yargs27.positional("directory", {
1535
+ yargs32.positional("directory", {
1385
1536
  describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
1386
1537
  type: "string"
1387
1538
  }).option("what-if", {
@@ -1408,7 +1559,8 @@ var CategoryPushModule = {
1408
1559
  mode,
1409
1560
  whatIf,
1410
1561
  project: projectId,
1411
- diff: diffMode
1562
+ diff: diffMode,
1563
+ allowEmptySource
1412
1564
  }) => {
1413
1565
  const fetch3 = nodeFetchProxy(proxy);
1414
1566
  const client = new UncachedCategoryClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1434,6 +1586,7 @@ var CategoryPushModule = {
1434
1586
  target,
1435
1587
  mode,
1436
1588
  whatIf,
1589
+ allowEmptySource,
1437
1590
  log: createSyncEngineConsoleLogger({ diffMode })
1438
1591
  });
1439
1592
  }
@@ -1445,10 +1598,10 @@ var CategoryRemoveModule = {
1445
1598
  command: "remove <id>",
1446
1599
  aliases: ["delete", "rm"],
1447
1600
  describe: "Delete a category",
1448
- builder: (yargs27) => withConfiguration(
1601
+ builder: (yargs32) => withConfiguration(
1449
1602
  withApiOptions(
1450
1603
  withProjectOptions(
1451
- yargs27.positional("id", { demandOption: true, describe: "Category UUID to delete" })
1604
+ yargs32.positional("id", { demandOption: true, describe: "Category UUID to delete" })
1452
1605
  )
1453
1606
  )
1454
1607
  ),
@@ -1465,10 +1618,10 @@ var CategoryUpdateModule = {
1465
1618
  command: "update <filename>",
1466
1619
  aliases: ["put"],
1467
1620
  describe: "Insert or update a category",
1468
- builder: (yargs27) => withConfiguration(
1621
+ builder: (yargs32) => withConfiguration(
1469
1622
  withApiOptions(
1470
1623
  withProjectOptions(
1471
- yargs27.positional("filename", { demandOption: true, describe: "Category file to put" })
1624
+ yargs32.positional("filename", { demandOption: true, describe: "Category file to put" })
1472
1625
  )
1473
1626
  )
1474
1627
  ),
@@ -1485,7 +1638,7 @@ var CategoryModule = {
1485
1638
  command: "category <command>",
1486
1639
  aliases: ["cat"],
1487
1640
  describe: "Commands for Canvas categories",
1488
- builder: (yargs27) => yargs27.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
1641
+ builder: (yargs32) => yargs32.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
1489
1642
  handler: () => {
1490
1643
  yargs2.help();
1491
1644
  }
@@ -1506,11 +1659,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
1506
1659
  var ComponentGetModule = {
1507
1660
  command: "get <id>",
1508
1661
  describe: "Fetch a component definition",
1509
- builder: (yargs27) => withConfiguration(
1662
+ builder: (yargs32) => withConfiguration(
1510
1663
  withFormatOptions(
1511
1664
  withApiOptions(
1512
1665
  withProjectOptions(
1513
- yargs27.positional("id", {
1666
+ yargs32.positional("id", {
1514
1667
  demandOption: true,
1515
1668
  describe: "Component definition public ID to fetch"
1516
1669
  })
@@ -1544,11 +1697,11 @@ var ComponentListModule = {
1544
1697
  command: "list",
1545
1698
  describe: "List component definitions",
1546
1699
  aliases: ["ls"],
1547
- builder: (yargs27) => withConfiguration(
1700
+ builder: (yargs32) => withConfiguration(
1548
1701
  withFormatOptions(
1549
1702
  withApiOptions(
1550
1703
  withProjectOptions(
1551
- yargs27.options({
1704
+ yargs32.options({
1552
1705
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
1553
1706
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
1554
1707
  })
@@ -1603,11 +1756,11 @@ function createComponentDefinitionEngineDataSource({
1603
1756
  var ComponentPullModule = {
1604
1757
  command: "pull <directory>",
1605
1758
  describe: "Pulls all component definitions to local files in a directory",
1606
- builder: (yargs27) => withConfiguration(
1759
+ builder: (yargs32) => withConfiguration(
1607
1760
  withApiOptions(
1608
1761
  withProjectOptions(
1609
1762
  withDiffOptions(
1610
- yargs27.positional("directory", {
1763
+ yargs32.positional("directory", {
1611
1764
  describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
1612
1765
  type: "string"
1613
1766
  }).option("format", {
@@ -1641,7 +1794,8 @@ var ComponentPullModule = {
1641
1794
  mode,
1642
1795
  whatIf,
1643
1796
  project: projectId,
1644
- diff: diffMode
1797
+ diff: diffMode,
1798
+ allowEmptySource
1645
1799
  }) => {
1646
1800
  const fetch3 = nodeFetchProxy(proxy);
1647
1801
  const client = new UncachedCanvasClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1673,7 +1827,7 @@ var ComponentPullModule = {
1673
1827
  target,
1674
1828
  mode,
1675
1829
  whatIf,
1676
- allowEmptySource: true,
1830
+ allowEmptySource: allowEmptySource ?? true,
1677
1831
  log: createSyncEngineConsoleLogger({ diffMode })
1678
1832
  });
1679
1833
  }
@@ -1684,11 +1838,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
1684
1838
  var ComponentPushModule = {
1685
1839
  command: "push <directory>",
1686
1840
  describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
1687
- builder: (yargs27) => withConfiguration(
1841
+ builder: (yargs32) => withConfiguration(
1688
1842
  withApiOptions(
1689
1843
  withProjectOptions(
1690
1844
  withDiffOptions(
1691
- yargs27.positional("directory", {
1845
+ yargs32.positional("directory", {
1692
1846
  describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
1693
1847
  type: "string"
1694
1848
  }).option("what-if", {
@@ -1715,7 +1869,8 @@ var ComponentPushModule = {
1715
1869
  mode,
1716
1870
  whatIf,
1717
1871
  project: projectId,
1718
- diff: diffMode
1872
+ diff: diffMode,
1873
+ allowEmptySource
1719
1874
  }) => {
1720
1875
  const fetch3 = nodeFetchProxy(proxy);
1721
1876
  const client = new UncachedCanvasClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1742,6 +1897,7 @@ var ComponentPushModule = {
1742
1897
  target,
1743
1898
  mode,
1744
1899
  whatIf,
1900
+ allowEmptySource,
1745
1901
  log: createSyncEngineConsoleLogger({ diffMode })
1746
1902
  });
1747
1903
  }
@@ -1753,10 +1909,10 @@ var ComponentRemoveModule = {
1753
1909
  command: "remove <id>",
1754
1910
  aliases: ["delete", "rm"],
1755
1911
  describe: "Delete a component definition",
1756
- builder: (yargs27) => withConfiguration(
1912
+ builder: (yargs32) => withConfiguration(
1757
1913
  withApiOptions(
1758
1914
  withProjectOptions(
1759
- yargs27.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
1915
+ yargs32.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
1760
1916
  )
1761
1917
  )
1762
1918
  ),
@@ -1773,10 +1929,10 @@ var ComponentUpdateModule = {
1773
1929
  command: "update <filename>",
1774
1930
  aliases: ["put"],
1775
1931
  describe: "Insert or update a component definition",
1776
- builder: (yargs27) => withConfiguration(
1932
+ builder: (yargs32) => withConfiguration(
1777
1933
  withApiOptions(
1778
1934
  withProjectOptions(
1779
- yargs27.positional("filename", { demandOption: true, describe: "Component definition file to put" })
1935
+ yargs32.positional("filename", { demandOption: true, describe: "Component definition file to put" })
1780
1936
  )
1781
1937
  )
1782
1938
  ),
@@ -1793,7 +1949,7 @@ var ComponentModule = {
1793
1949
  command: "component <command>",
1794
1950
  aliases: ["def"],
1795
1951
  describe: "Commands for Canvas component definitions",
1796
- builder: (yargs27) => yargs27.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
1952
+ builder: (yargs32) => yargs32.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
1797
1953
  handler: () => {
1798
1954
  yargs3.help();
1799
1955
  }
@@ -1807,12 +1963,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
1807
1963
  var CompositionGetModule = {
1808
1964
  command: "get <id>",
1809
1965
  describe: "Fetch a composition",
1810
- builder: (yargs27) => withFormatOptions(
1966
+ builder: (yargs32) => withFormatOptions(
1811
1967
  withConfiguration(
1812
1968
  withApiOptions(
1813
1969
  withProjectOptions(
1814
1970
  withStateOptions(
1815
- yargs27.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
1971
+ yargs32.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
1816
1972
  resolvePatterns: {
1817
1973
  type: "boolean",
1818
1974
  default: false,
@@ -1883,12 +2039,12 @@ var CompositionListModule = {
1883
2039
  command: "list",
1884
2040
  describe: "List compositions",
1885
2041
  aliases: ["ls"],
1886
- builder: (yargs27) => withFormatOptions(
2042
+ builder: (yargs32) => withFormatOptions(
1887
2043
  withConfiguration(
1888
2044
  withApiOptions(
1889
2045
  withProjectOptions(
1890
2046
  withStateOptions(
1891
- yargs27.options({
2047
+ yargs32.options({
1892
2048
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
1893
2049
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
1894
2050
  resolvePatterns: {
@@ -2009,11 +2165,11 @@ function createComponentInstanceEngineDataSource({
2009
2165
  var CompositionPublishModule = {
2010
2166
  command: "publish [ids]",
2011
2167
  describe: "Publishes composition(s)",
2012
- builder: (yargs27) => withConfiguration(
2168
+ builder: (yargs32) => withConfiguration(
2013
2169
  withApiOptions(
2014
2170
  withProjectOptions(
2015
2171
  withDiffOptions(
2016
- yargs27.positional("ids", {
2172
+ yargs32.positional("ids", {
2017
2173
  describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
2018
2174
  type: "string"
2019
2175
  }).option("all", {
@@ -2085,15 +2241,16 @@ var CompositionPublishModule = {
2085
2241
 
2086
2242
  // src/commands/canvas/commands/composition/pull.ts
2087
2243
  import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
2244
+ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
2088
2245
  var CompositionPullModule = {
2089
2246
  command: "pull <directory>",
2090
2247
  describe: "Pulls all compositions to local files in a directory",
2091
- builder: (yargs27) => withConfiguration(
2248
+ builder: (yargs32) => withConfiguration(
2092
2249
  withApiOptions(
2093
2250
  withProjectOptions(
2094
2251
  withStateOptions(
2095
2252
  withDiffOptions(
2096
- yargs27.positional("directory", {
2253
+ yargs32.positional("directory", {
2097
2254
  describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2098
2255
  type: "string"
2099
2256
  }).option("format", {
@@ -2140,10 +2297,12 @@ var CompositionPullModule = {
2140
2297
  whatIf,
2141
2298
  state,
2142
2299
  project: projectId,
2143
- diff: diffMode
2300
+ diff: diffMode,
2301
+ allowEmptySource
2144
2302
  }) => {
2145
2303
  const fetch3 = nodeFetchProxy(proxy);
2146
2304
  const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
2305
+ const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
2147
2306
  const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
2148
2307
  const isPackage = isPathAPackageFile(directory);
2149
2308
  let target;
@@ -2171,11 +2330,18 @@ var CompositionPullModule = {
2171
2330
  target,
2172
2331
  mode,
2173
2332
  whatIf,
2174
- allowEmptySource: true,
2333
+ allowEmptySource: allowEmptySource ?? true,
2175
2334
  log: createSyncEngineConsoleLogger({ diffMode }),
2335
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
2336
+ return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
2337
+ directory,
2338
+ fileClient
2339
+ });
2340
+ },
2176
2341
  onBeforeWriteObject: async (sourceObject) => {
2177
2342
  return extractAndDownloadUniformFilesForObject(sourceObject, {
2178
- directory
2343
+ directory,
2344
+ fileClient
2179
2345
  });
2180
2346
  }
2181
2347
  });
@@ -2184,16 +2350,16 @@ var CompositionPullModule = {
2184
2350
 
2185
2351
  // src/commands/canvas/commands/composition/push.ts
2186
2352
  import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
2187
- import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
2353
+ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
2188
2354
  var CompositionPushModule = {
2189
2355
  command: "push <directory>",
2190
2356
  describe: "Pushes all compositions from files in a directory to Uniform Canvas",
2191
- builder: (yargs27) => withConfiguration(
2357
+ builder: (yargs32) => withConfiguration(
2192
2358
  withApiOptions(
2193
2359
  withProjectOptions(
2194
2360
  withStateOptions(
2195
2361
  withDiffOptions(
2196
- yargs27.positional("directory", {
2362
+ yargs32.positional("directory", {
2197
2363
  describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
2198
2364
  type: "string"
2199
2365
  }).option("what-if", {
@@ -2233,7 +2399,8 @@ var CompositionPushModule = {
2233
2399
  project: projectId,
2234
2400
  onlyCompositions,
2235
2401
  onlyPatterns,
2236
- diff: diffMode
2402
+ diff: diffMode,
2403
+ allowEmptySource
2237
2404
  }) => {
2238
2405
  const fetch3 = nodeFetchProxy(proxy);
2239
2406
  const client = new UncachedCanvasClient11({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -2254,12 +2421,13 @@ var CompositionPushModule = {
2254
2421
  });
2255
2422
  }
2256
2423
  const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
2257
- const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
2424
+ const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
2258
2425
  await syncEngine({
2259
2426
  source,
2260
2427
  target,
2261
2428
  mode,
2262
2429
  whatIf,
2430
+ allowEmptySource,
2263
2431
  log: createSyncEngineConsoleLogger({ diffMode }),
2264
2432
  onBeforeCompareObjects: async (sourceObject) => {
2265
2433
  return swapOutUniformFileUrlsForTargetProject(sourceObject, {
@@ -2282,10 +2450,10 @@ var CompositionRemoveModule = {
2282
2450
  command: "remove <id>",
2283
2451
  aliases: ["delete", "rm"],
2284
2452
  describe: "Delete a composition",
2285
- builder: (yargs27) => withConfiguration(
2453
+ builder: (yargs32) => withConfiguration(
2286
2454
  withApiOptions(
2287
2455
  withProjectOptions(
2288
- yargs27.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
2456
+ yargs32.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
2289
2457
  )
2290
2458
  )
2291
2459
  ),
@@ -2302,10 +2470,10 @@ import { diffJson as diffJson2 } from "diff";
2302
2470
  var CompositionUnpublishModule = {
2303
2471
  command: "unpublish [ids]",
2304
2472
  describe: "Unpublish a composition(s)",
2305
- builder: (yargs27) => withConfiguration(
2473
+ builder: (yargs32) => withConfiguration(
2306
2474
  withApiOptions(
2307
2475
  withProjectOptions(
2308
- yargs27.positional("ids", {
2476
+ yargs32.positional("ids", {
2309
2477
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
2310
2478
  type: "string"
2311
2479
  }).option("all", {
@@ -2399,11 +2567,11 @@ var CompositionUpdateModule = {
2399
2567
  command: "update <filename>",
2400
2568
  aliases: ["put"],
2401
2569
  describe: "Insert or update a composition",
2402
- builder: (yargs27) => withConfiguration(
2570
+ builder: (yargs32) => withConfiguration(
2403
2571
  withApiOptions(
2404
2572
  withProjectOptions(
2405
2573
  withStateOptions(
2406
- yargs27.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
2574
+ yargs32.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
2407
2575
  )
2408
2576
  )
2409
2577
  )
@@ -2421,7 +2589,7 @@ var CompositionModule = {
2421
2589
  command: "composition <command>",
2422
2590
  describe: "Commands for Canvas compositions",
2423
2591
  aliases: ["comp"],
2424
- builder: (yargs27) => yargs27.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
2592
+ builder: (yargs32) => yargs32.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
2425
2593
  handler: () => {
2426
2594
  yargs4.help();
2427
2595
  }
@@ -2435,12 +2603,12 @@ import { ContentClient } from "@uniformdev/canvas";
2435
2603
  var ContentTypeGetModule = {
2436
2604
  command: "get <id>",
2437
2605
  describe: "Get a content type",
2438
- builder: (yargs27) => withConfiguration(
2606
+ builder: (yargs32) => withConfiguration(
2439
2607
  withFormatOptions(
2440
2608
  withApiOptions(
2441
2609
  withProjectOptions(
2442
2610
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2443
- yargs27.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
2611
+ yargs32.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
2444
2612
  )
2445
2613
  )
2446
2614
  )
@@ -2462,7 +2630,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
2462
2630
  var ContentTypeListModule = {
2463
2631
  command: "list",
2464
2632
  describe: "List content types",
2465
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
2633
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
2466
2634
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
2467
2635
  const fetch3 = nodeFetchProxy(proxy);
2468
2636
  const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
@@ -2509,11 +2677,11 @@ function createContentTypeEngineDataSource({
2509
2677
  var ContentTypePullModule = {
2510
2678
  command: "pull <directory>",
2511
2679
  describe: "Pulls all content types to local files in a directory",
2512
- builder: (yargs27) => withConfiguration(
2680
+ builder: (yargs32) => withConfiguration(
2513
2681
  withApiOptions(
2514
2682
  withProjectOptions(
2515
2683
  withDiffOptions(
2516
- yargs27.positional("directory", {
2684
+ yargs32.positional("directory", {
2517
2685
  describe: "Directory to save the content types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2518
2686
  type: "string"
2519
2687
  }).option("format", {
@@ -2547,7 +2715,8 @@ var ContentTypePullModule = {
2547
2715
  mode,
2548
2716
  whatIf,
2549
2717
  project: projectId,
2550
- diff: diffMode
2718
+ diff: diffMode,
2719
+ allowEmptySource
2551
2720
  }) => {
2552
2721
  const fetch3 = nodeFetchProxy(proxy);
2553
2722
  const client = new ContentClient3({
@@ -2584,7 +2753,7 @@ var ContentTypePullModule = {
2584
2753
  target,
2585
2754
  mode,
2586
2755
  whatIf,
2587
- allowEmptySource: true,
2756
+ allowEmptySource: allowEmptySource ?? true,
2588
2757
  log: createSyncEngineConsoleLogger({ diffMode })
2589
2758
  });
2590
2759
  }
@@ -2595,11 +2764,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
2595
2764
  var ContentTypePushModule = {
2596
2765
  command: "push <directory>",
2597
2766
  describe: "Pushes all content types from files in a directory to Uniform",
2598
- builder: (yargs27) => withConfiguration(
2767
+ builder: (yargs32) => withConfiguration(
2599
2768
  withApiOptions(
2600
2769
  withProjectOptions(
2601
2770
  withDiffOptions(
2602
- yargs27.positional("directory", {
2771
+ yargs32.positional("directory", {
2603
2772
  describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
2604
2773
  type: "string"
2605
2774
  }).option("what-if", {
@@ -2626,7 +2795,8 @@ var ContentTypePushModule = {
2626
2795
  mode,
2627
2796
  whatIf,
2628
2797
  project: projectId,
2629
- diff: diffMode
2798
+ diff: diffMode,
2799
+ allowEmptySource
2630
2800
  }) => {
2631
2801
  const fetch3 = nodeFetchProxy(proxy);
2632
2802
  const client = new ContentClient4({
@@ -2658,6 +2828,7 @@ var ContentTypePushModule = {
2658
2828
  target,
2659
2829
  mode,
2660
2830
  whatIf,
2831
+ allowEmptySource,
2661
2832
  log: createSyncEngineConsoleLogger({ diffMode })
2662
2833
  });
2663
2834
  }
@@ -2669,10 +2840,10 @@ var ContentTypeRemoveModule = {
2669
2840
  command: "remove <id>",
2670
2841
  aliases: ["delete", "rm"],
2671
2842
  describe: "Delete a content type",
2672
- builder: (yargs27) => withConfiguration(
2843
+ builder: (yargs32) => withConfiguration(
2673
2844
  withApiOptions(
2674
2845
  withProjectOptions(
2675
- yargs27.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
2846
+ yargs32.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
2676
2847
  )
2677
2848
  )
2678
2849
  ),
@@ -2689,10 +2860,10 @@ var ContentTypeUpdateModule = {
2689
2860
  command: "update <filename>",
2690
2861
  aliases: ["put"],
2691
2862
  describe: "Insert or update a content type",
2692
- builder: (yargs27) => withConfiguration(
2863
+ builder: (yargs32) => withConfiguration(
2693
2864
  withApiOptions(
2694
2865
  withProjectOptions(
2695
- yargs27.positional("filename", { demandOption: true, describe: "Content type file to put" })
2866
+ yargs32.positional("filename", { demandOption: true, describe: "Content type file to put" })
2696
2867
  )
2697
2868
  )
2698
2869
  ),
@@ -2709,27 +2880,106 @@ var ContentTypeModule = {
2709
2880
  command: "contenttype <command>",
2710
2881
  aliases: ["ct"],
2711
2882
  describe: "Commands for Content Types",
2712
- builder: (yargs27) => yargs27.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
2883
+ builder: (yargs32) => yargs32.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
2713
2884
  handler: () => {
2714
2885
  yargs5.help();
2715
2886
  }
2716
2887
  };
2717
2888
 
2718
- // src/commands/canvas/commands/dataType.ts
2889
+ // src/commands/canvas/commands/dataSource.ts
2719
2890
  import yargs6 from "yargs";
2720
2891
 
2892
+ // src/commands/canvas/commands/dataSource/get.ts
2893
+ import { DataSourceClient } from "@uniformdev/canvas";
2894
+ var DataSourceGetModule = {
2895
+ command: "get <id>",
2896
+ describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
2897
+ builder: (yargs32) => withConfiguration(
2898
+ withApiOptions(
2899
+ withProjectOptions(
2900
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2901
+ yargs32.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
2902
+ )
2903
+ )
2904
+ ),
2905
+ handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
2906
+ const fetch3 = nodeFetchProxy(proxy);
2907
+ const client = new DataSourceClient({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2908
+ const res = await client.get({ dataSourceId: id });
2909
+ emitWithFormat(res.result, "json", void 0);
2910
+ }
2911
+ };
2912
+
2913
+ // src/commands/canvas/commands/dataSource/remove.ts
2914
+ import { DataSourceClient as DataSourceClient2 } from "@uniformdev/canvas";
2915
+ var DataSourceRemoveModule = {
2916
+ command: "remove <id>",
2917
+ aliases: ["delete", "rm"],
2918
+ describe: "Delete a data source",
2919
+ builder: (yargs32) => withConfiguration(
2920
+ withApiOptions(
2921
+ withProjectOptions(
2922
+ yargs32.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
2923
+ )
2924
+ )
2925
+ ),
2926
+ handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
2927
+ const fetch3 = nodeFetchProxy(proxy);
2928
+ const client = new DataSourceClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2929
+ await client.remove({ dataSourceId: id });
2930
+ }
2931
+ };
2932
+
2933
+ // src/commands/canvas/commands/dataSource/update.ts
2934
+ import { DataSourceClient as DataSourceClient3 } from "@uniformdev/canvas";
2935
+ var DataSourceUpdateModule = {
2936
+ command: "update <dataSource>",
2937
+ aliases: ["put"],
2938
+ describe: "Insert or update a data source",
2939
+ builder: (yargs32) => withConfiguration(
2940
+ withApiOptions(
2941
+ withProjectOptions(
2942
+ yargs32.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
2943
+ describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
2944
+ type: "string",
2945
+ demandOption: true
2946
+ })
2947
+ )
2948
+ )
2949
+ ),
2950
+ handler: async ({ apiHost, apiKey, proxy, dataSource, integrationType, project: projectId }) => {
2951
+ const fetch3 = nodeFetchProxy(proxy);
2952
+ const client = new DataSourceClient3({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2953
+ await client.upsert({ data: JSON.parse(dataSource), integrationType });
2954
+ }
2955
+ };
2956
+
2957
+ // src/commands/canvas/commands/dataSource.ts
2958
+ var DataSourceModule = {
2959
+ command: "datasource <command>",
2960
+ aliases: ["ds"],
2961
+ describe: "Commands for Data Source definitions",
2962
+ builder: (yargs32) => yargs32.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
2963
+ handler: () => {
2964
+ yargs6.help();
2965
+ }
2966
+ };
2967
+
2968
+ // src/commands/canvas/commands/dataType.ts
2969
+ import yargs7 from "yargs";
2970
+
2721
2971
  // src/commands/canvas/commands/dataType/get.ts
2722
2972
  import { DataTypeClient } from "@uniformdev/canvas";
2723
2973
  var DataTypeGetModule = {
2724
2974
  command: "get <id>",
2725
2975
  describe: "Get a data type",
2726
2976
  aliases: ["ls"],
2727
- builder: (yargs27) => withConfiguration(
2977
+ builder: (yargs32) => withConfiguration(
2728
2978
  withFormatOptions(
2729
2979
  withApiOptions(
2730
2980
  withProjectOptions(
2731
2981
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2732
- yargs27.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
2982
+ yargs32.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
2733
2983
  )
2734
2984
  )
2735
2985
  )
@@ -2752,7 +3002,7 @@ var DataTypeListModule = {
2752
3002
  command: "list",
2753
3003
  describe: "List data types",
2754
3004
  aliases: ["ls"],
2755
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
3005
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
2756
3006
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
2757
3007
  const fetch3 = nodeFetchProxy(proxy);
2758
3008
  const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
@@ -2801,11 +3051,11 @@ function createDataTypeEngineDataSource({
2801
3051
  var DataTypePullModule = {
2802
3052
  command: "pull <directory>",
2803
3053
  describe: "Pulls all data types to local files in a directory",
2804
- builder: (yargs27) => withConfiguration(
3054
+ builder: (yargs32) => withConfiguration(
2805
3055
  withApiOptions(
2806
3056
  withProjectOptions(
2807
3057
  withDiffOptions(
2808
- yargs27.positional("directory", {
3058
+ yargs32.positional("directory", {
2809
3059
  describe: "Directory to save the data types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2810
3060
  type: "string"
2811
3061
  }).option("format", {
@@ -2839,7 +3089,8 @@ var DataTypePullModule = {
2839
3089
  mode,
2840
3090
  whatIf,
2841
3091
  project: projectId,
2842
- diff: diffMode
3092
+ diff: diffMode,
3093
+ allowEmptySource
2843
3094
  }) => {
2844
3095
  const fetch3 = nodeFetchProxy(proxy);
2845
3096
  const client = new DataTypeClient3({
@@ -2876,7 +3127,7 @@ var DataTypePullModule = {
2876
3127
  target,
2877
3128
  mode,
2878
3129
  whatIf,
2879
- allowEmptySource: true,
3130
+ allowEmptySource: allowEmptySource ?? true,
2880
3131
  log: createSyncEngineConsoleLogger({ diffMode })
2881
3132
  });
2882
3133
  }
@@ -2887,11 +3138,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
2887
3138
  var DataTypePushModule = {
2888
3139
  command: "push <directory>",
2889
3140
  describe: "Pushes all data types from files in a directory to Uniform",
2890
- builder: (yargs27) => withConfiguration(
3141
+ builder: (yargs32) => withConfiguration(
2891
3142
  withApiOptions(
2892
3143
  withProjectOptions(
2893
3144
  withDiffOptions(
2894
- yargs27.positional("directory", {
3145
+ yargs32.positional("directory", {
2895
3146
  describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
2896
3147
  type: "string"
2897
3148
  }).option("what-if", {
@@ -2918,7 +3169,8 @@ var DataTypePushModule = {
2918
3169
  mode,
2919
3170
  whatIf,
2920
3171
  project: projectId,
2921
- diff: diffMode
3172
+ diff: diffMode,
3173
+ allowEmptySource
2922
3174
  }) => {
2923
3175
  const fetch3 = nodeFetchProxy(proxy);
2924
3176
  const client = new DataTypeClient4({
@@ -2950,6 +3202,7 @@ var DataTypePushModule = {
2950
3202
  target,
2951
3203
  mode,
2952
3204
  whatIf,
3205
+ allowEmptySource,
2953
3206
  log: createSyncEngineConsoleLogger({ diffMode })
2954
3207
  });
2955
3208
  }
@@ -2961,10 +3214,10 @@ var DataTypeRemoveModule = {
2961
3214
  command: "remove <id>",
2962
3215
  aliases: ["delete", "rm"],
2963
3216
  describe: "Delete a data type",
2964
- builder: (yargs27) => withConfiguration(
3217
+ builder: (yargs32) => withConfiguration(
2965
3218
  withApiOptions(
2966
3219
  withProjectOptions(
2967
- yargs27.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
3220
+ yargs32.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
2968
3221
  )
2969
3222
  )
2970
3223
  ),
@@ -2981,10 +3234,10 @@ var DataTypeUpdateModule = {
2981
3234
  command: "update <filename>",
2982
3235
  aliases: ["put"],
2983
3236
  describe: "Insert or update a data type",
2984
- builder: (yargs27) => withConfiguration(
3237
+ builder: (yargs32) => withConfiguration(
2985
3238
  withApiOptions(
2986
3239
  withProjectOptions(
2987
- yargs27.positional("filename", { demandOption: true, describe: "Data type file to put" })
3240
+ yargs32.positional("filename", { demandOption: true, describe: "Data type file to put" })
2988
3241
  )
2989
3242
  )
2990
3243
  ),
@@ -3001,26 +3254,26 @@ var DataTypeModule = {
3001
3254
  command: "datatype <command>",
3002
3255
  aliases: ["dt"],
3003
3256
  describe: "Commands for Data Type definitions",
3004
- builder: (yargs27) => yargs27.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
3257
+ builder: (yargs32) => yargs32.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
3005
3258
  handler: () => {
3006
- yargs6.help();
3259
+ yargs7.help();
3007
3260
  }
3008
3261
  };
3009
3262
 
3010
3263
  // src/commands/canvas/commands/entry.ts
3011
- import yargs7 from "yargs";
3264
+ import yargs8 from "yargs";
3012
3265
 
3013
3266
  // src/commands/canvas/commands/entry/get.ts
3014
3267
  import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
3015
3268
  var EntryGetModule = {
3016
3269
  command: "get <id>",
3017
3270
  describe: "Get an entry",
3018
- builder: (yargs27) => withConfiguration(
3271
+ builder: (yargs32) => withConfiguration(
3019
3272
  withFormatOptions(
3020
3273
  withApiOptions(
3021
3274
  withProjectOptions(
3022
3275
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3023
- yargs27.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
3276
+ yargs32.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
3024
3277
  )
3025
3278
  )
3026
3279
  )
@@ -3032,7 +3285,9 @@ var EntryGetModule = {
3032
3285
  offset: 0,
3033
3286
  limit: 1,
3034
3287
  entryIDs: [id],
3035
- skipOverridesResolution: true
3288
+ skipOverridesResolution: true,
3289
+ skipPatternResolution: true,
3290
+ skipDataResolution: true
3036
3291
  });
3037
3292
  if (res.entries.length !== 1) {
3038
3293
  throw new Error(`Entry with ID ${id} not found`);
@@ -3046,16 +3301,22 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
3046
3301
  var EntryListModule = {
3047
3302
  command: "list",
3048
3303
  describe: "List entries",
3049
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
3304
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
3050
3305
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3051
3306
  const fetch3 = nodeFetchProxy(proxy);
3052
3307
  const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3053
- const res = await client.getEntries({ offset: 0, limit: 1e3, skipOverridesResolution: true });
3308
+ const res = await client.getEntries({
3309
+ offset: 0,
3310
+ limit: 1e3,
3311
+ skipOverridesResolution: true,
3312
+ skipPatternResolution: true,
3313
+ skipDataResolution: true
3314
+ });
3054
3315
  emitWithFormat(res.entries, format, filename);
3055
3316
  }
3056
3317
  };
3057
3318
 
3058
- // src/commands/canvas/commands/entry/pull.ts
3319
+ // src/commands/canvas/commands/entry/publish.ts
3059
3320
  import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
3060
3321
 
3061
3322
  // src/commands/canvas/entryEngineDataSource.ts
@@ -3068,18 +3329,27 @@ var selectEntryDisplayName = (e) => `${e.entry._name ?? "Untitled"} (pid: ${e.en
3068
3329
  // src/commands/canvas/entryEngineDataSource.ts
3069
3330
  function createEntryEngineDataSource({
3070
3331
  client,
3071
- state
3332
+ state,
3333
+ onlyEntries,
3334
+ onlyPatterns,
3335
+ entryIDs
3072
3336
  }) {
3073
3337
  const stateId = convertCompositionState(state);
3074
3338
  async function* getObjects() {
3075
- const { entries } = await client.getEntries({
3076
- offset: 0,
3077
- limit: 1e3,
3078
- skipDataResolution: true,
3079
- skipOverridesResolution: true,
3080
- state: stateId,
3081
- withComponentIDs: true
3082
- });
3339
+ const entries = paginateAsync(
3340
+ async (offset, limit) => (await client.getEntries({
3341
+ offset,
3342
+ limit,
3343
+ entryIDs,
3344
+ pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
3345
+ skipDataResolution: true,
3346
+ skipOverridesResolution: true,
3347
+ skipPatternResolution: true,
3348
+ state: stateId,
3349
+ withComponentIDs: true
3350
+ })).entries,
3351
+ { pageSize: 100 }
3352
+ );
3083
3353
  for await (const e of entries) {
3084
3354
  const result = {
3085
3355
  id: selectEntryIdentifier(e),
@@ -3101,16 +3371,96 @@ function createEntryEngineDataSource({
3101
3371
  };
3102
3372
  }
3103
3373
 
3374
+ // src/commands/canvas/commands/entry/publish.ts
3375
+ var EntryPublishModule = {
3376
+ command: "publish [ids]",
3377
+ describe: "Publishes entry(ies)",
3378
+ builder: (yargs32) => withConfiguration(
3379
+ withApiOptions(
3380
+ withProjectOptions(
3381
+ withDiffOptions(
3382
+ yargs32.positional("ids", {
3383
+ describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
3384
+ type: "string"
3385
+ }).option("all", {
3386
+ alias: ["a"],
3387
+ describe: "Publishes all entries. Use --ids to publish selected entries instead.",
3388
+ default: false,
3389
+ type: "boolean"
3390
+ }).option("what-if", {
3391
+ alias: ["w"],
3392
+ describe: "What-if mode reports what would be done but does not perform any publishing",
3393
+ default: false,
3394
+ type: "boolean"
3395
+ }).option("onlyEntries", {
3396
+ describe: "Only publishing entries and not patterns",
3397
+ default: false,
3398
+ type: "boolean"
3399
+ }).option("onlyPatterns", {
3400
+ describe: "Only pulling patterns and not entries",
3401
+ default: false,
3402
+ type: "boolean",
3403
+ hidden: true
3404
+ })
3405
+ )
3406
+ )
3407
+ )
3408
+ ),
3409
+ handler: async ({
3410
+ apiHost,
3411
+ apiKey,
3412
+ proxy,
3413
+ ids,
3414
+ all,
3415
+ whatIf,
3416
+ project: projectId,
3417
+ onlyEntries,
3418
+ onlyPatterns
3419
+ }) => {
3420
+ if (!all && !ids || all && ids) {
3421
+ console.error(`Specify --all or entry ID(s) to publish.`);
3422
+ process.exit(1);
3423
+ }
3424
+ const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
3425
+ const fetch3 = nodeFetchProxy(proxy);
3426
+ const client = new ContentClient10({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3427
+ const source = createEntryEngineDataSource({
3428
+ client,
3429
+ state: "preview",
3430
+ entryIDs: entryIDsArray,
3431
+ onlyEntries,
3432
+ onlyPatterns
3433
+ });
3434
+ const target = createEntryEngineDataSource({
3435
+ client,
3436
+ state: "published",
3437
+ entryIDs: entryIDsArray,
3438
+ onlyEntries,
3439
+ onlyPatterns
3440
+ });
3441
+ await syncEngine({
3442
+ source,
3443
+ target,
3444
+ // Publishing is one-direction operation, so no need to support automatic un-publishing
3445
+ mode: "createOrUpdate",
3446
+ whatIf,
3447
+ log: createPublishStatusSyncEngineConsoleLogger({ status: "publish" })
3448
+ });
3449
+ }
3450
+ };
3451
+
3104
3452
  // src/commands/canvas/commands/entry/pull.ts
3453
+ import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
3454
+ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
3105
3455
  var EntryPullModule = {
3106
3456
  command: "pull <directory>",
3107
3457
  describe: "Pulls all entries to local files in a directory",
3108
- builder: (yargs27) => withConfiguration(
3458
+ builder: (yargs32) => withConfiguration(
3109
3459
  withApiOptions(
3110
3460
  withProjectOptions(
3111
3461
  withStateOptions(
3112
3462
  withDiffOptions(
3113
- yargs27.positional("directory", {
3463
+ yargs32.positional("directory", {
3114
3464
  describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3115
3465
  type: "string"
3116
3466
  }).option("format", {
@@ -3146,16 +3496,18 @@ var EntryPullModule = {
3146
3496
  whatIf,
3147
3497
  state,
3148
3498
  project: projectId,
3149
- diff: diffMode
3499
+ diff: diffMode,
3500
+ allowEmptySource
3150
3501
  }) => {
3151
3502
  const fetch3 = nodeFetchProxy(proxy);
3152
- const client = new ContentClient10({
3503
+ const client = new ContentClient11({
3153
3504
  apiKey,
3154
3505
  apiHost,
3155
3506
  fetch: fetch3,
3156
3507
  projectId,
3157
3508
  bypassCache: true
3158
3509
  });
3510
+ const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
3159
3511
  const source = createEntryEngineDataSource({ client, state });
3160
3512
  let target;
3161
3513
  const isPackage = isPathAPackageFile(directory);
@@ -3166,15 +3518,387 @@ var EntryPullModule = {
3166
3518
  selectIdentifier: selectEntryIdentifier,
3167
3519
  selectDisplayName: selectEntryDisplayName,
3168
3520
  onSyncComplete: async (_, synced) => {
3169
- packageContents.entries = synced;
3521
+ packageContents.entries = synced;
3522
+ writeCanvasPackage(directory, packageContents);
3523
+ }
3524
+ });
3525
+ } else {
3526
+ target = await createFileSyncEngineDataSource({
3527
+ directory,
3528
+ selectIdentifier: selectEntryIdentifier,
3529
+ selectDisplayName: selectEntryDisplayName,
3530
+ format
3531
+ });
3532
+ }
3533
+ await syncEngine({
3534
+ source,
3535
+ target,
3536
+ mode,
3537
+ whatIf,
3538
+ allowEmptySource: allowEmptySource ?? true,
3539
+ log: createSyncEngineConsoleLogger({ diffMode }),
3540
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
3541
+ return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
3542
+ directory,
3543
+ fileClient
3544
+ });
3545
+ },
3546
+ onBeforeWriteObject: async (sourceObject) => {
3547
+ return extractAndDownloadUniformFilesForObject(sourceObject, {
3548
+ directory,
3549
+ fileClient
3550
+ });
3551
+ }
3552
+ });
3553
+ }
3554
+ };
3555
+
3556
+ // src/commands/canvas/commands/entry/push.ts
3557
+ import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
3558
+ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
3559
+ var EntryPushModule = {
3560
+ command: "push <directory>",
3561
+ describe: "Pushes all entries from files in a directory to Uniform",
3562
+ builder: (yargs32) => withConfiguration(
3563
+ withApiOptions(
3564
+ withProjectOptions(
3565
+ withStateOptions(
3566
+ withDiffOptions(
3567
+ yargs32.positional("directory", {
3568
+ describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
3569
+ type: "string"
3570
+ }).option("what-if", {
3571
+ alias: ["w"],
3572
+ describe: "What-if mode reports what would be done but changes nothing",
3573
+ default: false,
3574
+ type: "boolean"
3575
+ }).option("mode", {
3576
+ alias: ["m"],
3577
+ describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
3578
+ choices: ["create", "createOrUpdate", "mirror"],
3579
+ default: "mirror",
3580
+ type: "string"
3581
+ })
3582
+ )
3583
+ )
3584
+ )
3585
+ )
3586
+ ),
3587
+ handler: async ({
3588
+ apiHost,
3589
+ apiKey,
3590
+ proxy,
3591
+ directory,
3592
+ mode,
3593
+ whatIf,
3594
+ state,
3595
+ project: projectId,
3596
+ diff: diffMode,
3597
+ allowEmptySource
3598
+ }) => {
3599
+ const fetch3 = nodeFetchProxy(proxy);
3600
+ const client = new ContentClient12({
3601
+ apiKey,
3602
+ apiHost,
3603
+ fetch: fetch3,
3604
+ projectId,
3605
+ bypassCache: true
3606
+ });
3607
+ let source;
3608
+ const isPackage = isPathAPackageFile(directory);
3609
+ if (isPackage) {
3610
+ const packageContents = readCanvasPackage(directory, true);
3611
+ source = await createArraySyncEngineDataSource({
3612
+ objects: packageContents.entries ?? [],
3613
+ selectIdentifier: selectEntryIdentifier,
3614
+ selectDisplayName: selectEntryDisplayName
3615
+ });
3616
+ } else {
3617
+ source = await createFileSyncEngineDataSource({
3618
+ directory,
3619
+ selectIdentifier: selectEntryIdentifier,
3620
+ selectDisplayName: selectEntryDisplayName
3621
+ });
3622
+ }
3623
+ const target = createEntryEngineDataSource({ client, state });
3624
+ const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
3625
+ await syncEngine({
3626
+ source,
3627
+ target,
3628
+ mode,
3629
+ whatIf,
3630
+ allowEmptySource,
3631
+ log: createSyncEngineConsoleLogger({ diffMode }),
3632
+ onBeforeCompareObjects: async (sourceObject) => {
3633
+ return swapOutUniformFileUrlsForTargetProject(sourceObject, {
3634
+ fileClient
3635
+ });
3636
+ },
3637
+ onBeforeWriteObject: async (sourceObject) => {
3638
+ return extractAndUploadUniformFilesForObject(sourceObject, {
3639
+ directory,
3640
+ fileClient
3641
+ });
3642
+ }
3643
+ });
3644
+ }
3645
+ };
3646
+
3647
+ // src/commands/canvas/commands/entry/remove.ts
3648
+ import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
3649
+ var EntryRemoveModule = {
3650
+ command: "remove <id>",
3651
+ aliases: ["delete", "rm"],
3652
+ describe: "Delete an entry",
3653
+ builder: (yargs32) => withConfiguration(
3654
+ withApiOptions(
3655
+ withProjectOptions(
3656
+ yargs32.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
3657
+ )
3658
+ )
3659
+ ),
3660
+ handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
3661
+ const fetch3 = nodeFetchProxy(proxy);
3662
+ const client = new ContentClient13({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3663
+ await client.deleteEntry({ entryId: id });
3664
+ }
3665
+ };
3666
+
3667
+ // src/commands/canvas/commands/entry/unpublish.ts
3668
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3, ContentClient as ContentClient14 } from "@uniformdev/canvas";
3669
+ import { diffJson as diffJson3 } from "diff";
3670
+ var EntryUnpublishModule = {
3671
+ command: "unpublish [ids]",
3672
+ describe: "Unpublish an entry(ies)",
3673
+ builder: (yargs32) => withConfiguration(
3674
+ withApiOptions(
3675
+ withProjectOptions(
3676
+ yargs32.positional("ids", {
3677
+ describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
3678
+ type: "string"
3679
+ }).option("all", {
3680
+ alias: ["a"],
3681
+ describe: "Un-publishes all entries. Use --all to un-publish selected entries instead.",
3682
+ default: false,
3683
+ type: "boolean"
3684
+ }).option("what-if", {
3685
+ alias: ["w"],
3686
+ describe: "What-if mode reports what would be done but does not perform any un-publishing",
3687
+ default: false,
3688
+ type: "boolean"
3689
+ }).option("onlyEntries", {
3690
+ describe: "Only un-publishing entries and not patterns",
3691
+ default: false,
3692
+ type: "boolean"
3693
+ }).option("onlyPatterns", {
3694
+ describe: "Only un-publishing patterns and not entries",
3695
+ default: false,
3696
+ type: "boolean",
3697
+ hidden: true
3698
+ })
3699
+ )
3700
+ )
3701
+ ),
3702
+ handler: async ({
3703
+ apiHost,
3704
+ apiKey,
3705
+ proxy,
3706
+ ids,
3707
+ all,
3708
+ onlyEntries,
3709
+ onlyPatterns,
3710
+ project: projectId,
3711
+ whatIf
3712
+ }) => {
3713
+ if (!all && !ids || all && ids) {
3714
+ console.error(`Specify --all or entry ID(s) to publish.`);
3715
+ process.exit(1);
3716
+ }
3717
+ const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
3718
+ const targetItems = /* @__PURE__ */ new Map();
3719
+ const fetch3 = nodeFetchProxy(proxy);
3720
+ const client = new ContentClient14({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3721
+ const source = createEntryEngineDataSource({
3722
+ client,
3723
+ state: "published",
3724
+ entryIDs: entryIDsArray,
3725
+ onlyEntries,
3726
+ onlyPatterns
3727
+ });
3728
+ const target = createEntryEngineDataSource({
3729
+ client,
3730
+ state: "preview",
3731
+ entryIDs: entryIDsArray,
3732
+ onlyEntries,
3733
+ onlyPatterns
3734
+ });
3735
+ const actions = [];
3736
+ const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
3737
+ for await (const obj of target.objects) {
3738
+ if (Array.isArray(obj.id)) {
3739
+ obj.id.forEach((o) => targetItems.set(o, obj));
3740
+ } else {
3741
+ targetItems.set(obj.id, obj);
3742
+ }
3743
+ }
3744
+ for await (const sourceObject of source.objects) {
3745
+ const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
3746
+ const targetObject = targetItems.get(id);
3747
+ if (!targetObject) {
3748
+ console.log(`Entry ${id} was not found`);
3749
+ return;
3750
+ }
3751
+ actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE3 }));
3752
+ log({
3753
+ action: "update",
3754
+ id,
3755
+ providerId: sourceObject.providerId,
3756
+ displayName: sourceObject.displayName ?? sourceObject.providerId,
3757
+ whatIf,
3758
+ diff: diffJson3(targetObject.object, sourceObject.object)
3759
+ });
3760
+ }
3761
+ }
3762
+ };
3763
+
3764
+ // src/commands/canvas/commands/entry/update.ts
3765
+ import { ContentClient as ContentClient15 } from "@uniformdev/canvas";
3766
+ var EntryUpdateModule = {
3767
+ command: "update <filename>",
3768
+ aliases: ["put"],
3769
+ describe: "Insert or update an entry",
3770
+ builder: (yargs32) => withConfiguration(
3771
+ withApiOptions(
3772
+ withProjectOptions(
3773
+ yargs32.positional("filename", { demandOption: true, describe: "Entry file to put" })
3774
+ )
3775
+ )
3776
+ ),
3777
+ handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
3778
+ const fetch3 = nodeFetchProxy(proxy);
3779
+ const client = new ContentClient15({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3780
+ const file = readFileToObject(filename);
3781
+ await client.upsertEntry(file);
3782
+ }
3783
+ };
3784
+
3785
+ // src/commands/canvas/commands/entry.ts
3786
+ var EntryModule = {
3787
+ command: "entry <command>",
3788
+ describe: "Commands for Entries",
3789
+ builder: (yargs32) => yargs32.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
3790
+ handler: () => {
3791
+ yargs8.help();
3792
+ }
3793
+ };
3794
+
3795
+ // src/commands/canvas/commands/locale.ts
3796
+ import yargs9 from "yargs";
3797
+
3798
+ // src/commands/canvas/commands/locale/pull.ts
3799
+ import { LocaleClient } from "@uniformdev/canvas";
3800
+
3801
+ // src/commands/canvas/localesEngineDataSource.ts
3802
+ function createLocaleEngineDataSource({
3803
+ client
3804
+ }) {
3805
+ async function* getObjects() {
3806
+ const locales = (await client.get()).results;
3807
+ for await (const locale of locales) {
3808
+ const result = {
3809
+ id: locale.locale,
3810
+ displayName: locale.displayName,
3811
+ providerId: locale.locale,
3812
+ object: locale
3813
+ };
3814
+ yield result;
3815
+ }
3816
+ }
3817
+ return {
3818
+ objects: getObjects(),
3819
+ deleteObject: async (providerId) => {
3820
+ await client.remove({ locale: providerId });
3821
+ },
3822
+ writeObject: async (object) => {
3823
+ await client.upsert({
3824
+ locale: object.object
3825
+ });
3826
+ }
3827
+ };
3828
+ }
3829
+
3830
+ // src/commands/canvas/commands/locale/pull.ts
3831
+ var LocalePullModule = {
3832
+ command: "pull <directory>",
3833
+ describe: "Pulls all locales to local files in a directory",
3834
+ builder: (yargs32) => withConfiguration(
3835
+ withApiOptions(
3836
+ withProjectOptions(
3837
+ withDiffOptions(
3838
+ yargs32.positional("directory", {
3839
+ describe: "Directory to save the locales to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3840
+ type: "string"
3841
+ }).option("format", {
3842
+ alias: ["f"],
3843
+ describe: "Output format",
3844
+ default: "yaml",
3845
+ choices: ["yaml", "json"],
3846
+ type: "string"
3847
+ }).option("what-if", {
3848
+ alias: ["w"],
3849
+ describe: "What-if mode reports what would be done but changes no files",
3850
+ default: false,
3851
+ type: "boolean"
3852
+ }).option("mode", {
3853
+ alias: ["m"],
3854
+ describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
3855
+ choices: ["create", "createOrUpdate", "mirror"],
3856
+ default: "mirror",
3857
+ type: "string"
3858
+ })
3859
+ )
3860
+ )
3861
+ )
3862
+ ),
3863
+ handler: async ({
3864
+ apiHost,
3865
+ apiKey,
3866
+ proxy,
3867
+ directory,
3868
+ format,
3869
+ mode,
3870
+ whatIf,
3871
+ project: projectId,
3872
+ diff: diffMode,
3873
+ allowEmptySource
3874
+ }) => {
3875
+ const fetch3 = nodeFetchProxy(proxy);
3876
+ const client = new LocaleClient({
3877
+ apiKey,
3878
+ apiHost,
3879
+ fetch: fetch3,
3880
+ projectId,
3881
+ bypassCache: true
3882
+ });
3883
+ const source = createLocaleEngineDataSource({ client });
3884
+ let target;
3885
+ const isPackage = isPathAPackageFile(directory);
3886
+ if (isPackage) {
3887
+ const packageContents = readCanvasPackage(directory, false);
3888
+ target = await createArraySyncEngineDataSource({
3889
+ objects: packageContents.locales ?? [],
3890
+ selectIdentifier: (i) => i.locale,
3891
+ selectDisplayName: (i) => i.displayName,
3892
+ onSyncComplete: async (_, synced) => {
3893
+ packageContents.locales = synced;
3170
3894
  writeCanvasPackage(directory, packageContents);
3171
3895
  }
3172
3896
  });
3173
3897
  } else {
3174
3898
  target = await createFileSyncEngineDataSource({
3175
3899
  directory,
3176
- selectIdentifier: selectEntryIdentifier,
3177
- selectDisplayName: selectEntryDisplayName,
3900
+ selectIdentifier: (i) => i.locale,
3901
+ selectDisplayName: (i) => i.displayName,
3178
3902
  format
3179
3903
  });
3180
3904
  }
@@ -3183,38 +3907,36 @@ var EntryPullModule = {
3183
3907
  target,
3184
3908
  mode,
3185
3909
  whatIf,
3186
- allowEmptySource: true,
3910
+ allowEmptySource: allowEmptySource ?? true,
3187
3911
  log: createSyncEngineConsoleLogger({ diffMode })
3188
3912
  });
3189
3913
  }
3190
3914
  };
3191
3915
 
3192
- // src/commands/canvas/commands/entry/push.ts
3193
- import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
3194
- var EntryPushModule = {
3916
+ // src/commands/canvas/commands/locale/push.ts
3917
+ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
3918
+ var LocalePushModule = {
3195
3919
  command: "push <directory>",
3196
- describe: "Pushes all entries from files in a directory to Uniform",
3197
- builder: (yargs27) => withConfiguration(
3920
+ describe: "Pushes all locales from files in a directory to Uniform",
3921
+ builder: (yargs32) => withConfiguration(
3198
3922
  withApiOptions(
3199
3923
  withProjectOptions(
3200
- withStateOptions(
3201
- withDiffOptions(
3202
- yargs27.positional("directory", {
3203
- describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
3204
- type: "string"
3205
- }).option("what-if", {
3206
- alias: ["w"],
3207
- describe: "What-if mode reports what would be done but changes nothing",
3208
- default: false,
3209
- type: "boolean"
3210
- }).option("mode", {
3211
- alias: ["m"],
3212
- describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
3213
- choices: ["create", "createOrUpdate", "mirror"],
3214
- default: "mirror",
3215
- type: "string"
3216
- })
3217
- )
3924
+ withDiffOptions(
3925
+ yargs32.positional("directory", {
3926
+ describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
3927
+ type: "string"
3928
+ }).option("what-if", {
3929
+ alias: ["w"],
3930
+ describe: "What-if mode reports what would be done but changes nothing",
3931
+ default: false,
3932
+ type: "boolean"
3933
+ }).option("mode", {
3934
+ alias: ["m"],
3935
+ describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
3936
+ choices: ["create", "createOrUpdate", "mirror"],
3937
+ default: "mirror",
3938
+ type: "string"
3939
+ })
3218
3940
  )
3219
3941
  )
3220
3942
  )
@@ -3226,12 +3948,12 @@ var EntryPushModule = {
3226
3948
  directory,
3227
3949
  mode,
3228
3950
  whatIf,
3229
- state,
3230
3951
  project: projectId,
3231
- diff: diffMode
3952
+ diff: diffMode,
3953
+ allowEmptySource
3232
3954
  }) => {
3233
3955
  const fetch3 = nodeFetchProxy(proxy);
3234
- const client = new ContentClient11({
3956
+ const client = new LocaleClient2({
3235
3957
  apiKey,
3236
3958
  apiHost,
3237
3959
  fetch: fetch3,
@@ -3243,81 +3965,41 @@ var EntryPushModule = {
3243
3965
  if (isPackage) {
3244
3966
  const packageContents = readCanvasPackage(directory, true);
3245
3967
  source = await createArraySyncEngineDataSource({
3246
- objects: packageContents.entries ?? [],
3247
- selectIdentifier: selectEntryIdentifier,
3248
- selectDisplayName: selectEntryDisplayName
3968
+ objects: packageContents.locales ?? [],
3969
+ selectIdentifier: (locale) => locale.locale,
3970
+ selectDisplayName: (locale) => locale.displayName
3249
3971
  });
3250
3972
  } else {
3251
3973
  source = await createFileSyncEngineDataSource({
3252
3974
  directory,
3253
- selectIdentifier: selectEntryIdentifier,
3254
- selectDisplayName: selectEntryDisplayName
3975
+ selectIdentifier: (locale) => locale.locale,
3976
+ selectDisplayName: (locale) => locale.displayName
3255
3977
  });
3256
3978
  }
3257
- const target = createEntryEngineDataSource({ client, state });
3979
+ const target = createLocaleEngineDataSource({ client });
3258
3980
  await syncEngine({
3259
3981
  source,
3260
3982
  target,
3261
3983
  mode,
3262
3984
  whatIf,
3985
+ allowEmptySource,
3263
3986
  log: createSyncEngineConsoleLogger({ diffMode })
3264
3987
  });
3265
3988
  }
3266
3989
  };
3267
3990
 
3268
- // src/commands/canvas/commands/entry/remove.ts
3269
- import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
3270
- var EntryRemoveModule = {
3271
- command: "remove <id>",
3272
- aliases: ["delete", "rm"],
3273
- describe: "Delete an entry",
3274
- builder: (yargs27) => withConfiguration(
3275
- withApiOptions(
3276
- withProjectOptions(
3277
- yargs27.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
3278
- )
3279
- )
3280
- ),
3281
- handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
3282
- const fetch3 = nodeFetchProxy(proxy);
3283
- const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3284
- await client.deleteEntry({ entryId: id });
3285
- }
3286
- };
3287
-
3288
- // src/commands/canvas/commands/entry/update.ts
3289
- import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
3290
- var EntryUpdateModule = {
3291
- command: "update <filename>",
3292
- aliases: ["put"],
3293
- describe: "Insert or update an entry",
3294
- builder: (yargs27) => withConfiguration(
3295
- withApiOptions(
3296
- withProjectOptions(
3297
- yargs27.positional("filename", { demandOption: true, describe: "Entry file to put" })
3298
- )
3299
- )
3300
- ),
3301
- handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
3302
- const fetch3 = nodeFetchProxy(proxy);
3303
- const client = new ContentClient13({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3304
- const file = readFileToObject(filename);
3305
- await client.upsertEntry(file);
3306
- }
3307
- };
3308
-
3309
- // src/commands/canvas/commands/entry.ts
3310
- var EntryModule = {
3311
- command: "entry <command>",
3312
- describe: "Commands for Entries",
3313
- builder: (yargs27) => yargs27.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
3991
+ // src/commands/canvas/commands/locale.ts
3992
+ var LocaleModule = {
3993
+ command: "locale <command>",
3994
+ describe: "Commands for locale definitions",
3995
+ builder: (yargs32) => yargs32.command(LocalePullModule).command(LocalePushModule),
3314
3996
  handler: () => {
3315
- yargs7.help();
3997
+ yargs9.help();
3316
3998
  }
3317
3999
  };
3318
4000
 
3319
4001
  // src/commands/canvas/commands/pattern.ts
3320
- import yargs8 from "yargs";
4002
+ import yargs10 from "yargs";
3321
4003
 
3322
4004
  // src/commands/canvas/commands/pattern/get.ts
3323
4005
  var PatternGetModule = {
@@ -3329,12 +4011,12 @@ var PatternGetModule = {
3329
4011
  var PatternListModule = {
3330
4012
  ...CompositionListModule,
3331
4013
  describe: "List patterns",
3332
- builder: (yargs27) => withFormatOptions(
4014
+ builder: (yargs32) => withFormatOptions(
3333
4015
  withConfiguration(
3334
4016
  withApiOptions(
3335
4017
  withProjectOptions(
3336
4018
  withStateOptions(
3337
- yargs27.options({
4019
+ yargs32.options({
3338
4020
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
3339
4021
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
3340
4022
  resolvePatterns: {
@@ -3372,11 +4054,11 @@ var PatternListModule = {
3372
4054
  var PatternPublishModule = {
3373
4055
  ...CompositionPublishModule,
3374
4056
  describe: "Publishes pattern(s)",
3375
- builder: (yargs27) => withConfiguration(
4057
+ builder: (yargs32) => withConfiguration(
3376
4058
  withApiOptions(
3377
4059
  withProjectOptions(
3378
4060
  withDiffOptions(
3379
- yargs27.positional("ids", {
4061
+ yargs32.positional("ids", {
3380
4062
  describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
3381
4063
  type: "string"
3382
4064
  }).option("all", {
@@ -3414,12 +4096,12 @@ var PatternPublishModule = {
3414
4096
  var PatternPullModule = {
3415
4097
  ...CompositionPullModule,
3416
4098
  describe: "Pulls all patterns to local files in a directory",
3417
- builder: (yargs27) => withConfiguration(
4099
+ builder: (yargs32) => withConfiguration(
3418
4100
  withApiOptions(
3419
4101
  withProjectOptions(
3420
4102
  withStateOptions(
3421
4103
  withDiffOptions(
3422
- yargs27.positional("directory", {
4104
+ yargs32.positional("directory", {
3423
4105
  describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3424
4106
  type: "string"
3425
4107
  }).option("format", {
@@ -3457,12 +4139,12 @@ var PatternPullModule = {
3457
4139
  var PatternPushModule = {
3458
4140
  ...CompositionPushModule,
3459
4141
  describe: "Pushes all patterns from files in a directory to Uniform Canvas",
3460
- builder: (yargs27) => withConfiguration(
4142
+ builder: (yargs32) => withConfiguration(
3461
4143
  withApiOptions(
3462
4144
  withProjectOptions(
3463
4145
  withStateOptions(
3464
4146
  withDiffOptions(
3465
- yargs27.positional("directory", {
4147
+ yargs32.positional("directory", {
3466
4148
  describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
3467
4149
  type: "string"
3468
4150
  }).option("what-if", {
@@ -3500,10 +4182,10 @@ var PatternRemoveModule = {
3500
4182
  var PatternUnpublishModule = {
3501
4183
  command: "unpublish [ids]",
3502
4184
  describe: "Unpublish a pattern(s)",
3503
- builder: (yargs27) => withConfiguration(
4185
+ builder: (yargs32) => withConfiguration(
3504
4186
  withApiOptions(
3505
4187
  withProjectOptions(
3506
- yargs27.positional("ids", {
4188
+ yargs32.positional("ids", {
3507
4189
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
3508
4190
  type: "string"
3509
4191
  }).option("all", {
@@ -3542,26 +4224,26 @@ var PatternUpdateModule = {
3542
4224
  var PatternModule = {
3543
4225
  command: "pattern <command>",
3544
4226
  describe: "Commands for Canvas patterns",
3545
- builder: (yargs27) => yargs27.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
4227
+ builder: (yargs32) => yargs32.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
3546
4228
  handler: () => {
3547
- yargs8.help();
4229
+ yargs10.help();
3548
4230
  }
3549
4231
  };
3550
4232
 
3551
4233
  // src/commands/canvas/commands/prompts.ts
3552
- import yargs9 from "yargs";
4234
+ import yargs11 from "yargs";
3553
4235
 
3554
4236
  // src/commands/canvas/commands/prompts/get.ts
3555
4237
  import { PromptClient } from "@uniformdev/canvas";
3556
4238
  var PromptGetModule = {
3557
4239
  command: "get <id>",
3558
4240
  describe: "Get a prompt",
3559
- builder: (yargs27) => withConfiguration(
4241
+ builder: (yargs32) => withConfiguration(
3560
4242
  withFormatOptions(
3561
4243
  withApiOptions(
3562
4244
  withProjectOptions(
3563
4245
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3564
- yargs27.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
4246
+ yargs32.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
3565
4247
  )
3566
4248
  )
3567
4249
  )
@@ -3582,7 +4264,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
3582
4264
  var PromptListModule = {
3583
4265
  command: "list",
3584
4266
  describe: "List prompts",
3585
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
4267
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
3586
4268
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3587
4269
  const fetch3 = nodeFetchProxy(proxy);
3588
4270
  const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
@@ -3629,12 +4311,12 @@ function createPromptEngineDataSource({
3629
4311
  var PromptPullModule = {
3630
4312
  command: "pull <directory>",
3631
4313
  describe: "Pulls all entries to local files in a directory",
3632
- builder: (yargs27) => withConfiguration(
4314
+ builder: (yargs32) => withConfiguration(
3633
4315
  withApiOptions(
3634
4316
  withProjectOptions(
3635
4317
  withStateOptions(
3636
4318
  withDiffOptions(
3637
- yargs27.positional("directory", {
4319
+ yargs32.positional("directory", {
3638
4320
  describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3639
4321
  type: "string"
3640
4322
  }).option("format", {
@@ -3669,7 +4351,8 @@ var PromptPullModule = {
3669
4351
  mode,
3670
4352
  whatIf,
3671
4353
  project: projectId,
3672
- diff: diffMode
4354
+ diff: diffMode,
4355
+ allowEmptySource
3673
4356
  }) => {
3674
4357
  const fetch3 = nodeFetchProxy(proxy);
3675
4358
  const client = new PromptClient3({
@@ -3706,7 +4389,7 @@ var PromptPullModule = {
3706
4389
  target,
3707
4390
  mode,
3708
4391
  whatIf,
3709
- allowEmptySource: true,
4392
+ allowEmptySource: allowEmptySource ?? true,
3710
4393
  log: createSyncEngineConsoleLogger({ diffMode })
3711
4394
  });
3712
4395
  }
@@ -3717,12 +4400,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
3717
4400
  var PromptPushModule = {
3718
4401
  command: "push <directory>",
3719
4402
  describe: "Pushes all prompts from files in a directory to Uniform",
3720
- builder: (yargs27) => withConfiguration(
4403
+ builder: (yargs32) => withConfiguration(
3721
4404
  withApiOptions(
3722
4405
  withProjectOptions(
3723
4406
  withStateOptions(
3724
4407
  withDiffOptions(
3725
- yargs27.positional("directory", {
4408
+ yargs32.positional("directory", {
3726
4409
  describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
3727
4410
  type: "string"
3728
4411
  }).option("what-if", {
@@ -3750,7 +4433,8 @@ var PromptPushModule = {
3750
4433
  mode,
3751
4434
  whatIf,
3752
4435
  project: projectId,
3753
- diff: diffMode
4436
+ diff: diffMode,
4437
+ allowEmptySource
3754
4438
  }) => {
3755
4439
  const fetch3 = nodeFetchProxy(proxy);
3756
4440
  const client = new PromptClient4({
@@ -3782,6 +4466,7 @@ var PromptPushModule = {
3782
4466
  target,
3783
4467
  mode,
3784
4468
  whatIf,
4469
+ allowEmptySource,
3785
4470
  log: createSyncEngineConsoleLogger({ diffMode })
3786
4471
  });
3787
4472
  }
@@ -3793,9 +4478,9 @@ var PromptRemoveModule = {
3793
4478
  command: "remove <id>",
3794
4479
  aliases: ["delete", "rm"],
3795
4480
  describe: "Delete a prompt",
3796
- builder: (yargs27) => withConfiguration(
4481
+ builder: (yargs32) => withConfiguration(
3797
4482
  withApiOptions(
3798
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
4483
+ withProjectOptions(yargs32.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
3799
4484
  )
3800
4485
  ),
3801
4486
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -3811,10 +4496,10 @@ var PromptUpdateModule = {
3811
4496
  command: "update <filename>",
3812
4497
  aliases: ["put"],
3813
4498
  describe: "Insert or update a prompt",
3814
- builder: (yargs27) => withConfiguration(
4499
+ builder: (yargs32) => withConfiguration(
3815
4500
  withApiOptions(
3816
4501
  withProjectOptions(
3817
- yargs27.positional("filename", { demandOption: true, describe: "Prompt file to put" })
4502
+ yargs32.positional("filename", { demandOption: true, describe: "Prompt file to put" })
3818
4503
  )
3819
4504
  )
3820
4505
  ),
@@ -3831,9 +4516,9 @@ var PromptModule = {
3831
4516
  command: "prompt <command>",
3832
4517
  aliases: ["dt"],
3833
4518
  describe: "Commands for AI Prompt definitions",
3834
- builder: (yargs27) => yargs27.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
4519
+ builder: (yargs32) => yargs32.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
3835
4520
  handler: () => {
3836
- yargs9.help();
4521
+ yargs11.help();
3837
4522
  }
3838
4523
  };
3839
4524
 
@@ -3842,28 +4527,28 @@ var CanvasCommand = {
3842
4527
  command: "canvas <command>",
3843
4528
  aliases: ["cv", "pm", "presentation"],
3844
4529
  describe: "Uniform Canvas commands",
3845
- builder: (yargs27) => yargs27.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).command(PromptModule).command(AssetModule).demandCommand(),
4530
+ builder: (yargs32) => yargs32.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).command(PromptModule).command(AssetModule).command(LocaleModule).demandCommand(),
3846
4531
  handler: () => {
3847
- yargs10.showHelp();
4532
+ yargs12.showHelp();
3848
4533
  }
3849
4534
  };
3850
4535
 
3851
4536
  // src/commands/context/index.ts
3852
- import yargs17 from "yargs";
4537
+ import yargs19 from "yargs";
3853
4538
 
3854
4539
  // src/commands/context/commands/aggregate.ts
3855
- import yargs11 from "yargs";
4540
+ import yargs13 from "yargs";
3856
4541
 
3857
4542
  // src/commands/context/commands/aggregate/get.ts
3858
4543
  import { UncachedAggregateClient } from "@uniformdev/context/api";
3859
4544
  var AggregateGetModule = {
3860
4545
  command: "get <id>",
3861
4546
  describe: "Fetch an aggregate",
3862
- builder: (yargs27) => withConfiguration(
4547
+ builder: (yargs32) => withConfiguration(
3863
4548
  withFormatOptions(
3864
4549
  withApiOptions(
3865
4550
  withProjectOptions(
3866
- yargs27.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
4551
+ yargs32.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
3867
4552
  )
3868
4553
  )
3869
4554
  )
@@ -3887,7 +4572,7 @@ var AggregateListModule = {
3887
4572
  command: "list",
3888
4573
  describe: "List aggregates",
3889
4574
  aliases: ["ls"],
3890
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
4575
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
3891
4576
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3892
4577
  const fetch3 = nodeFetchProxy(proxy);
3893
4578
  const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -3953,11 +4638,11 @@ function writeContextPackage(filename, packageContents) {
3953
4638
  var AggregatePullModule = {
3954
4639
  command: "pull <directory>",
3955
4640
  describe: "Pulls all aggregates to local files in a directory",
3956
- builder: (yargs27) => withConfiguration(
4641
+ builder: (yargs32) => withConfiguration(
3957
4642
  withApiOptions(
3958
4643
  withProjectOptions(
3959
4644
  withDiffOptions(
3960
- yargs27.positional("directory", {
4645
+ yargs32.positional("directory", {
3961
4646
  describe: "Directory to save the aggregates to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3962
4647
  type: "string"
3963
4648
  }).option("format", {
@@ -3991,7 +4676,8 @@ var AggregatePullModule = {
3991
4676
  mode,
3992
4677
  whatIf,
3993
4678
  project: projectId,
3994
- diff: diffMode
4679
+ diff: diffMode,
4680
+ allowEmptySource
3995
4681
  }) => {
3996
4682
  const fetch3 = nodeFetchProxy(proxy);
3997
4683
  const client = new UncachedAggregateClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4022,6 +4708,7 @@ var AggregatePullModule = {
4022
4708
  target,
4023
4709
  mode,
4024
4710
  whatIf,
4711
+ allowEmptySource,
4025
4712
  log: createSyncEngineConsoleLogger({ diffMode })
4026
4713
  });
4027
4714
  }
@@ -4032,11 +4719,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
4032
4719
  var AggregatePushModule = {
4033
4720
  command: "push <directory>",
4034
4721
  describe: "Pushes all aggregates from files in a directory or package to Uniform",
4035
- builder: (yargs27) => withConfiguration(
4722
+ builder: (yargs32) => withConfiguration(
4036
4723
  withApiOptions(
4037
4724
  withProjectOptions(
4038
4725
  withDiffOptions(
4039
- yargs27.positional("directory", {
4726
+ yargs32.positional("directory", {
4040
4727
  describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
4041
4728
  type: "string"
4042
4729
  }).option("what-if", {
@@ -4063,7 +4750,8 @@ var AggregatePushModule = {
4063
4750
  mode,
4064
4751
  whatIf,
4065
4752
  project: projectId,
4066
- diff: diffMode
4753
+ diff: diffMode,
4754
+ allowEmptySource
4067
4755
  }) => {
4068
4756
  const fetch3 = nodeFetchProxy(proxy);
4069
4757
  const client = new UncachedAggregateClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4089,6 +4777,7 @@ var AggregatePushModule = {
4089
4777
  target,
4090
4778
  mode,
4091
4779
  whatIf,
4780
+ allowEmptySource,
4092
4781
  log: createSyncEngineConsoleLogger({ diffMode })
4093
4782
  });
4094
4783
  await target.complete();
@@ -4101,10 +4790,10 @@ var AggregateRemoveModule = {
4101
4790
  command: "remove <id>",
4102
4791
  aliases: ["delete", "rm"],
4103
4792
  describe: "Delete an aggregate",
4104
- builder: (yargs27) => withConfiguration(
4793
+ builder: (yargs32) => withConfiguration(
4105
4794
  withApiOptions(
4106
4795
  withProjectOptions(
4107
- yargs27.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
4796
+ yargs32.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
4108
4797
  )
4109
4798
  )
4110
4799
  ),
@@ -4121,10 +4810,10 @@ var AggregateUpdateModule = {
4121
4810
  command: "update <filename>",
4122
4811
  aliases: ["put"],
4123
4812
  describe: "Insert or update an aggregate",
4124
- builder: (yargs27) => withConfiguration(
4813
+ builder: (yargs32) => withConfiguration(
4125
4814
  withApiOptions(
4126
4815
  withProjectOptions(
4127
- yargs27.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
4816
+ yargs32.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
4128
4817
  )
4129
4818
  )
4130
4819
  ),
@@ -4141,25 +4830,25 @@ var AggregateModule = {
4141
4830
  command: "aggregate <command>",
4142
4831
  aliases: ["agg", "intent", "audience"],
4143
4832
  describe: "Commands for Context aggregates (intents, audiences)",
4144
- builder: (yargs27) => yargs27.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
4833
+ builder: (yargs32) => yargs32.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
4145
4834
  handler: () => {
4146
- yargs11.help();
4835
+ yargs13.help();
4147
4836
  }
4148
4837
  };
4149
4838
 
4150
4839
  // src/commands/context/commands/enrichment.ts
4151
- import yargs12 from "yargs";
4840
+ import yargs14 from "yargs";
4152
4841
 
4153
4842
  // src/commands/context/commands/enrichment/get.ts
4154
4843
  import { UncachedEnrichmentClient } from "@uniformdev/context/api";
4155
4844
  var EnrichmentGetModule = {
4156
4845
  command: "get <id>",
4157
4846
  describe: "Fetch an enrichment category and its values",
4158
- builder: (yargs27) => withFormatOptions(
4847
+ builder: (yargs32) => withFormatOptions(
4159
4848
  withConfiguration(
4160
4849
  withApiOptions(
4161
4850
  withProjectOptions(
4162
- yargs27.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
4851
+ yargs32.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
4163
4852
  )
4164
4853
  )
4165
4854
  )
@@ -4184,7 +4873,7 @@ var EnrichmentListModule = {
4184
4873
  command: "list",
4185
4874
  describe: "List enrichments",
4186
4875
  aliases: ["ls"],
4187
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
4876
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
4188
4877
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
4189
4878
  const fetch3 = nodeFetchProxy(proxy);
4190
4879
  const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4285,11 +4974,11 @@ var createEnrichmentValueEngineDataSource = ({
4285
4974
  var EnrichmentPullModule = {
4286
4975
  command: "pull <directory>",
4287
4976
  describe: "Pulls all enrichments to local files in a directory",
4288
- builder: (yargs27) => withConfiguration(
4977
+ builder: (yargs32) => withConfiguration(
4289
4978
  withApiOptions(
4290
4979
  withProjectOptions(
4291
4980
  withDiffOptions(
4292
- yargs27.positional("directory", {
4981
+ yargs32.positional("directory", {
4293
4982
  describe: "Directory to save the enrichments to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
4294
4983
  type: "string"
4295
4984
  }).option("format", {
@@ -4323,7 +5012,8 @@ var EnrichmentPullModule = {
4323
5012
  mode,
4324
5013
  whatIf,
4325
5014
  project: projectId,
4326
- diff: diffMode
5015
+ diff: diffMode,
5016
+ allowEmptySource
4327
5017
  }) => {
4328
5018
  const fetch3 = nodeFetchProxy(proxy);
4329
5019
  const client = new UncachedEnrichmentClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4354,6 +5044,7 @@ var EnrichmentPullModule = {
4354
5044
  target,
4355
5045
  mode,
4356
5046
  whatIf,
5047
+ allowEmptySource,
4357
5048
  log: createSyncEngineConsoleLogger({ diffMode })
4358
5049
  });
4359
5050
  }
@@ -4364,11 +5055,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
4364
5055
  var EnrichmentPushModule = {
4365
5056
  command: "push <directory>",
4366
5057
  describe: "Pushes all enrichments from files in a directory or package to Uniform",
4367
- builder: (yargs27) => withConfiguration(
5058
+ builder: (yargs32) => withConfiguration(
4368
5059
  withApiOptions(
4369
5060
  withProjectOptions(
4370
5061
  withDiffOptions(
4371
- yargs27.positional("directory", {
5062
+ yargs32.positional("directory", {
4372
5063
  describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
4373
5064
  type: "string"
4374
5065
  }).option("what-if", {
@@ -4395,7 +5086,8 @@ var EnrichmentPushModule = {
4395
5086
  mode,
4396
5087
  whatIf,
4397
5088
  project: projectId,
4398
- diff: diffMode
5089
+ diff: diffMode,
5090
+ allowEmptySource
4399
5091
  }) => {
4400
5092
  const fetch3 = nodeFetchProxy(proxy);
4401
5093
  const client = new UncachedEnrichmentClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4421,6 +5113,7 @@ var EnrichmentPushModule = {
4421
5113
  target,
4422
5114
  mode,
4423
5115
  whatIf,
5116
+ allowEmptySource,
4424
5117
  log: createSyncEngineConsoleLogger({ diffMode })
4425
5118
  });
4426
5119
  }
@@ -4432,10 +5125,10 @@ var EnrichmentRemoveModule = {
4432
5125
  command: "remove <id>",
4433
5126
  aliases: ["delete", "rm"],
4434
5127
  describe: "Delete an enrichment category and its values",
4435
- builder: (yargs27) => withConfiguration(
5128
+ builder: (yargs32) => withConfiguration(
4436
5129
  withApiOptions(
4437
5130
  withProjectOptions(
4438
- yargs27.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
5131
+ yargs32.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
4439
5132
  )
4440
5133
  )
4441
5134
  ),
@@ -4451,14 +5144,14 @@ var EnrichmentModule = {
4451
5144
  command: "enrichment <command>",
4452
5145
  aliases: ["enr"],
4453
5146
  describe: "Commands for Context enrichments",
4454
- builder: (yargs27) => yargs27.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
5147
+ builder: (yargs32) => yargs32.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
4455
5148
  handler: () => {
4456
- yargs12.help();
5149
+ yargs14.help();
4457
5150
  }
4458
5151
  };
4459
5152
 
4460
5153
  // src/commands/context/commands/manifest.ts
4461
- import yargs13 from "yargs";
5154
+ import yargs15 from "yargs";
4462
5155
 
4463
5156
  // src/commands/context/commands/manifest/get.ts
4464
5157
  import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
@@ -4469,10 +5162,10 @@ var ManifestGetModule = {
4469
5162
  command: "get [output]",
4470
5163
  aliases: ["dl", "download"],
4471
5164
  describe: "Download the Uniform Context manifest for a project",
4472
- builder: (yargs27) => withConfiguration(
5165
+ builder: (yargs32) => withConfiguration(
4473
5166
  withApiOptions(
4474
5167
  withProjectOptions(
4475
- yargs27.option("preview", {
5168
+ yargs32.option("preview", {
4476
5169
  describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
4477
5170
  default: false,
4478
5171
  type: "boolean",
@@ -4534,7 +5227,7 @@ import { exit as exit2 } from "process";
4534
5227
  var ManifestPublishModule = {
4535
5228
  command: "publish",
4536
5229
  describe: "Publish the Uniform Context manifest for a project",
4537
- builder: (yargs27) => withConfiguration(withApiOptions(withProjectOptions(yargs27))),
5230
+ builder: (yargs32) => withConfiguration(withApiOptions(withProjectOptions(yargs32))),
4538
5231
  handler: async ({ apiKey, apiHost, proxy, project }) => {
4539
5232
  const fetch3 = nodeFetchProxy(proxy);
4540
5233
  try {
@@ -4567,25 +5260,25 @@ var ManifestModule = {
4567
5260
  command: "manifest <command>",
4568
5261
  describe: "Commands for context manifests",
4569
5262
  aliases: ["man"],
4570
- builder: (yargs27) => yargs27.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
5263
+ builder: (yargs32) => yargs32.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
4571
5264
  handler: () => {
4572
- yargs13.help();
5265
+ yargs15.help();
4573
5266
  }
4574
5267
  };
4575
5268
 
4576
5269
  // src/commands/context/commands/quirk.ts
4577
- import yargs14 from "yargs";
5270
+ import yargs16 from "yargs";
4578
5271
 
4579
5272
  // src/commands/context/commands/quirk/get.ts
4580
5273
  import { UncachedQuirkClient } from "@uniformdev/context/api";
4581
5274
  var QuirkGetModule = {
4582
5275
  command: "get <id>",
4583
5276
  describe: "Fetch a quirk",
4584
- builder: (yargs27) => withConfiguration(
5277
+ builder: (yargs32) => withConfiguration(
4585
5278
  withFormatOptions(
4586
5279
  withApiOptions(
4587
5280
  withProjectOptions(
4588
- yargs27.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
5281
+ yargs32.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
4589
5282
  )
4590
5283
  )
4591
5284
  )
@@ -4609,11 +5302,11 @@ var QuirkListModule = {
4609
5302
  command: "list",
4610
5303
  describe: "List quirks",
4611
5304
  aliases: ["ls"],
4612
- builder: (yargs27) => withConfiguration(
5305
+ builder: (yargs32) => withConfiguration(
4613
5306
  withFormatOptions(
4614
5307
  withApiOptions(
4615
5308
  withProjectOptions(
4616
- yargs27.option("withIntegrations", {
5309
+ yargs32.option("withIntegrations", {
4617
5310
  alias: ["i"],
4618
5311
  describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
4619
5312
  type: "boolean"
@@ -4670,11 +5363,11 @@ function createQuirkEngineDataSource({
4670
5363
  var QuirkPullModule = {
4671
5364
  command: "pull <directory>",
4672
5365
  describe: "Pulls all quirks to local files in a directory",
4673
- builder: (yargs27) => withConfiguration(
5366
+ builder: (yargs32) => withConfiguration(
4674
5367
  withApiOptions(
4675
5368
  withProjectOptions(
4676
5369
  withDiffOptions(
4677
- yargs27.positional("directory", {
5370
+ yargs32.positional("directory", {
4678
5371
  describe: "Directory to save the quirks to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
4679
5372
  type: "string"
4680
5373
  }).option("format", {
@@ -4708,7 +5401,8 @@ var QuirkPullModule = {
4708
5401
  mode,
4709
5402
  whatIf,
4710
5403
  project: projectId,
4711
- diff: diffMode
5404
+ diff: diffMode,
5405
+ allowEmptySource
4712
5406
  }) => {
4713
5407
  const fetch3 = nodeFetchProxy(proxy);
4714
5408
  const client = new UncachedQuirkClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4739,6 +5433,7 @@ var QuirkPullModule = {
4739
5433
  target,
4740
5434
  mode,
4741
5435
  whatIf,
5436
+ allowEmptySource,
4742
5437
  log: createSyncEngineConsoleLogger({ diffMode })
4743
5438
  });
4744
5439
  }
@@ -4749,11 +5444,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
4749
5444
  var QuirkPushModule = {
4750
5445
  command: "push <directory>",
4751
5446
  describe: "Pushes all quirks from files in a directory or package to Uniform",
4752
- builder: (yargs27) => withConfiguration(
5447
+ builder: (yargs32) => withConfiguration(
4753
5448
  withApiOptions(
4754
5449
  withProjectOptions(
4755
5450
  withDiffOptions(
4756
- yargs27.positional("directory", {
5451
+ yargs32.positional("directory", {
4757
5452
  describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
4758
5453
  type: "string"
4759
5454
  }).option("what-if", {
@@ -4780,7 +5475,8 @@ var QuirkPushModule = {
4780
5475
  mode,
4781
5476
  whatIf,
4782
5477
  project: projectId,
4783
- diff: diffMode
5478
+ diff: diffMode,
5479
+ allowEmptySource
4784
5480
  }) => {
4785
5481
  const fetch3 = nodeFetchProxy(proxy);
4786
5482
  const client = new UncachedQuirkClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4806,6 +5502,7 @@ var QuirkPushModule = {
4806
5502
  target,
4807
5503
  mode,
4808
5504
  whatIf,
5505
+ allowEmptySource,
4809
5506
  log: createSyncEngineConsoleLogger({ diffMode })
4810
5507
  });
4811
5508
  }
@@ -4817,10 +5514,10 @@ var QuirkRemoveModule = {
4817
5514
  command: "remove <id>",
4818
5515
  aliases: ["delete", "rm"],
4819
5516
  describe: "Delete a quirk",
4820
- builder: (yargs27) => withConfiguration(
5517
+ builder: (yargs32) => withConfiguration(
4821
5518
  withApiOptions(
4822
5519
  withProjectOptions(
4823
- yargs27.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
5520
+ yargs32.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
4824
5521
  )
4825
5522
  )
4826
5523
  ),
@@ -4837,10 +5534,10 @@ var QuirkUpdateModule = {
4837
5534
  command: "update <filename>",
4838
5535
  aliases: ["put"],
4839
5536
  describe: "Insert or update a quirk",
4840
- builder: (yargs27) => withConfiguration(
5537
+ builder: (yargs32) => withConfiguration(
4841
5538
  withApiOptions(
4842
5539
  withProjectOptions(
4843
- yargs27.positional("filename", { demandOption: true, describe: "Quirk file to put" })
5540
+ yargs32.positional("filename", { demandOption: true, describe: "Quirk file to put" })
4844
5541
  )
4845
5542
  )
4846
5543
  ),
@@ -4857,25 +5554,25 @@ var QuirkModule = {
4857
5554
  command: "quirk <command>",
4858
5555
  aliases: ["qk"],
4859
5556
  describe: "Commands for Context quirks",
4860
- builder: (yargs27) => yargs27.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
5557
+ builder: (yargs32) => yargs32.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
4861
5558
  handler: () => {
4862
- yargs14.help();
5559
+ yargs16.help();
4863
5560
  }
4864
5561
  };
4865
5562
 
4866
5563
  // src/commands/context/commands/signal.ts
4867
- import yargs15 from "yargs";
5564
+ import yargs17 from "yargs";
4868
5565
 
4869
5566
  // src/commands/context/commands/signal/get.ts
4870
5567
  import { UncachedSignalClient } from "@uniformdev/context/api";
4871
5568
  var SignalGetModule = {
4872
5569
  command: "get <id>",
4873
5570
  describe: "Fetch a signal",
4874
- builder: (yargs27) => withConfiguration(
5571
+ builder: (yargs32) => withConfiguration(
4875
5572
  withFormatOptions(
4876
5573
  withApiOptions(
4877
5574
  withProjectOptions(
4878
- yargs27.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
5575
+ yargs32.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
4879
5576
  )
4880
5577
  )
4881
5578
  )
@@ -4899,7 +5596,7 @@ var SignalListModule = {
4899
5596
  command: "list",
4900
5597
  describe: "List signals",
4901
5598
  aliases: ["ls"],
4902
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
5599
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
4903
5600
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
4904
5601
  const fetch3 = nodeFetchProxy(proxy);
4905
5602
  const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4948,11 +5645,11 @@ function createSignalEngineDataSource({
4948
5645
  var SignalPullModule = {
4949
5646
  command: "pull <directory>",
4950
5647
  describe: "Pulls all signals to local files in a directory",
4951
- builder: (yargs27) => withConfiguration(
5648
+ builder: (yargs32) => withConfiguration(
4952
5649
  withApiOptions(
4953
5650
  withProjectOptions(
4954
5651
  withDiffOptions(
4955
- yargs27.positional("directory", {
5652
+ yargs32.positional("directory", {
4956
5653
  describe: "Directory to save the signals to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
4957
5654
  type: "string"
4958
5655
  }).option("format", {
@@ -4986,7 +5683,8 @@ var SignalPullModule = {
4986
5683
  mode,
4987
5684
  whatIf,
4988
5685
  project: projectId,
4989
- diff: diffMode
5686
+ diff: diffMode,
5687
+ allowEmptySource
4990
5688
  }) => {
4991
5689
  const fetch3 = nodeFetchProxy(proxy);
4992
5690
  const client = new UncachedSignalClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5017,6 +5715,7 @@ var SignalPullModule = {
5017
5715
  target,
5018
5716
  mode,
5019
5717
  whatIf,
5718
+ allowEmptySource,
5020
5719
  log: createSyncEngineConsoleLogger({ diffMode })
5021
5720
  });
5022
5721
  }
@@ -5027,11 +5726,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
5027
5726
  var SignalPushModule = {
5028
5727
  command: "push <directory>",
5029
5728
  describe: "Pushes all signals from files in a directory or package to Uniform",
5030
- builder: (yargs27) => withConfiguration(
5729
+ builder: (yargs32) => withConfiguration(
5031
5730
  withApiOptions(
5032
5731
  withProjectOptions(
5033
5732
  withDiffOptions(
5034
- yargs27.positional("directory", {
5733
+ yargs32.positional("directory", {
5035
5734
  describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
5036
5735
  type: "string"
5037
5736
  }).option("what-if", {
@@ -5058,7 +5757,8 @@ var SignalPushModule = {
5058
5757
  mode,
5059
5758
  whatIf,
5060
5759
  project: projectId,
5061
- diff: diffMode
5760
+ diff: diffMode,
5761
+ allowEmptySource
5062
5762
  }) => {
5063
5763
  const fetch3 = nodeFetchProxy(proxy);
5064
5764
  const client = new UncachedSignalClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5084,6 +5784,7 @@ var SignalPushModule = {
5084
5784
  target,
5085
5785
  mode,
5086
5786
  whatIf,
5787
+ allowEmptySource,
5087
5788
  log: createSyncEngineConsoleLogger({ diffMode })
5088
5789
  });
5089
5790
  }
@@ -5095,10 +5796,10 @@ var SignalRemoveModule = {
5095
5796
  command: "remove <id>",
5096
5797
  aliases: ["delete", "rm"],
5097
5798
  describe: "Delete a signal",
5098
- builder: (yargs27) => withConfiguration(
5799
+ builder: (yargs32) => withConfiguration(
5099
5800
  withApiOptions(
5100
5801
  withProjectOptions(
5101
- yargs27.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
5802
+ yargs32.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
5102
5803
  )
5103
5804
  )
5104
5805
  ),
@@ -5115,10 +5816,10 @@ var SignalUpdateModule = {
5115
5816
  command: "update <filename>",
5116
5817
  aliases: ["put"],
5117
5818
  describe: "Insert or update a signal",
5118
- builder: (yargs27) => withConfiguration(
5819
+ builder: (yargs32) => withConfiguration(
5119
5820
  withApiOptions(
5120
5821
  withProjectOptions(
5121
- yargs27.positional("filename", { demandOption: true, describe: "Signal file to put" })
5822
+ yargs32.positional("filename", { demandOption: true, describe: "Signal file to put" })
5122
5823
  )
5123
5824
  )
5124
5825
  ),
@@ -5135,25 +5836,25 @@ var SignalModule = {
5135
5836
  command: "signal <command>",
5136
5837
  aliases: ["sig"],
5137
5838
  describe: "Commands for Context signals",
5138
- builder: (yargs27) => yargs27.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
5839
+ builder: (yargs32) => yargs32.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
5139
5840
  handler: () => {
5140
- yargs15.help();
5841
+ yargs17.help();
5141
5842
  }
5142
5843
  };
5143
5844
 
5144
5845
  // src/commands/context/commands/test.ts
5145
- import yargs16 from "yargs";
5846
+ import yargs18 from "yargs";
5146
5847
 
5147
5848
  // src/commands/context/commands/test/get.ts
5148
5849
  import { UncachedTestClient } from "@uniformdev/context/api";
5149
5850
  var TestGetModule = {
5150
5851
  command: "get <id>",
5151
5852
  describe: "Fetch a test",
5152
- builder: (yargs27) => withConfiguration(
5853
+ builder: (yargs32) => withConfiguration(
5153
5854
  withFormatOptions(
5154
5855
  withApiOptions(
5155
5856
  withProjectOptions(
5156
- yargs27.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
5857
+ yargs32.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
5157
5858
  )
5158
5859
  )
5159
5860
  )
@@ -5177,7 +5878,7 @@ var TestListModule = {
5177
5878
  command: "list",
5178
5879
  describe: "List tests",
5179
5880
  aliases: ["ls"],
5180
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
5881
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
5181
5882
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
5182
5883
  const fetch3 = nodeFetchProxy(proxy);
5183
5884
  const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5226,11 +5927,11 @@ function createTestEngineDataSource({
5226
5927
  var TestPullModule = {
5227
5928
  command: "pull <directory>",
5228
5929
  describe: "Pulls all tests to local files in a directory",
5229
- builder: (yargs27) => withConfiguration(
5930
+ builder: (yargs32) => withConfiguration(
5230
5931
  withApiOptions(
5231
5932
  withProjectOptions(
5232
5933
  withDiffOptions(
5233
- yargs27.positional("directory", {
5934
+ yargs32.positional("directory", {
5234
5935
  describe: "Directory to save the tests to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
5235
5936
  type: "string"
5236
5937
  }).option("format", {
@@ -5264,7 +5965,8 @@ var TestPullModule = {
5264
5965
  mode,
5265
5966
  whatIf,
5266
5967
  project: projectId,
5267
- diff: diffMode
5968
+ diff: diffMode,
5969
+ allowEmptySource
5268
5970
  }) => {
5269
5971
  const fetch3 = nodeFetchProxy(proxy);
5270
5972
  const client = new UncachedTestClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5295,6 +5997,7 @@ var TestPullModule = {
5295
5997
  target,
5296
5998
  mode,
5297
5999
  whatIf,
6000
+ allowEmptySource,
5298
6001
  log: createSyncEngineConsoleLogger({ diffMode })
5299
6002
  });
5300
6003
  }
@@ -5305,11 +6008,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
5305
6008
  var TestPushModule = {
5306
6009
  command: "push <directory>",
5307
6010
  describe: "Pushes all tests from files in a directory or package to Uniform",
5308
- builder: (yargs27) => withConfiguration(
6011
+ builder: (yargs32) => withConfiguration(
5309
6012
  withApiOptions(
5310
6013
  withProjectOptions(
5311
6014
  withDiffOptions(
5312
- yargs27.positional("directory", {
6015
+ yargs32.positional("directory", {
5313
6016
  describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
5314
6017
  type: "string"
5315
6018
  }).option("what-if", {
@@ -5336,7 +6039,8 @@ var TestPushModule = {
5336
6039
  mode,
5337
6040
  whatIf,
5338
6041
  project: projectId,
5339
- diff: diffMode
6042
+ diff: diffMode,
6043
+ allowEmptySource
5340
6044
  }) => {
5341
6045
  const fetch3 = nodeFetchProxy(proxy);
5342
6046
  const client = new UncachedTestClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5362,6 +6066,7 @@ var TestPushModule = {
5362
6066
  target,
5363
6067
  mode,
5364
6068
  whatIf,
6069
+ allowEmptySource,
5365
6070
  log: createSyncEngineConsoleLogger({ diffMode })
5366
6071
  });
5367
6072
  }
@@ -5373,10 +6078,10 @@ var TestRemoveModule = {
5373
6078
  command: "remove <id>",
5374
6079
  aliases: ["delete", "rm"],
5375
6080
  describe: "Delete a test",
5376
- builder: (yargs27) => withConfiguration(
6081
+ builder: (yargs32) => withConfiguration(
5377
6082
  withApiOptions(
5378
6083
  withProjectOptions(
5379
- yargs27.positional("id", { demandOption: true, describe: "Test public ID to delete" })
6084
+ yargs32.positional("id", { demandOption: true, describe: "Test public ID to delete" })
5380
6085
  )
5381
6086
  )
5382
6087
  ),
@@ -5393,9 +6098,9 @@ var TestUpdateModule = {
5393
6098
  command: "update <filename>",
5394
6099
  aliases: ["put"],
5395
6100
  describe: "Insert or update a test",
5396
- builder: (yargs27) => withConfiguration(
6101
+ builder: (yargs32) => withConfiguration(
5397
6102
  withApiOptions(
5398
- withProjectOptions(yargs27.positional("filename", { demandOption: true, describe: "Test file to put" }))
6103
+ withProjectOptions(yargs32.positional("filename", { demandOption: true, describe: "Test file to put" }))
5399
6104
  )
5400
6105
  ),
5401
6106
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
@@ -5410,9 +6115,9 @@ var TestUpdateModule = {
5410
6115
  var TestModule = {
5411
6116
  command: "test <command>",
5412
6117
  describe: "Commands for Context A/B tests",
5413
- builder: (yargs27) => yargs27.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
6118
+ builder: (yargs32) => yargs32.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
5414
6119
  handler: () => {
5415
- yargs16.help();
6120
+ yargs18.help();
5416
6121
  }
5417
6122
  };
5418
6123
 
@@ -5421,9 +6126,290 @@ var ContextCommand = {
5421
6126
  command: "context <command>",
5422
6127
  aliases: ["ctx"],
5423
6128
  describe: "Uniform Context commands",
5424
- builder: (yargs27) => yargs27.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
6129
+ builder: (yargs32) => yargs32.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
6130
+ handler: () => {
6131
+ yargs19.showHelp();
6132
+ }
6133
+ };
6134
+
6135
+ // src/commands/integration/index.ts
6136
+ import yargs22 from "yargs";
6137
+
6138
+ // src/commands/integration/commands/definition.ts
6139
+ import yargs21 from "yargs";
6140
+
6141
+ // src/commands/integration/commands/definition/edgehancer/edgehancer.ts
6142
+ import yargs20 from "yargs";
6143
+
6144
+ // src/commands/integration/commands/definition/edgehancer/deploy.ts
6145
+ import { readFileSync as readFileSync2 } from "fs";
6146
+
6147
+ // src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
6148
+ import { createLimitPolicy } from "@uniformdev/canvas";
6149
+ import { ApiClient } from "@uniformdev/context/api";
6150
+ var ENDPOINT = "/api/v1/integration-edgehancers";
6151
+ var EdgehancerClient = class extends ApiClient {
6152
+ constructor(options) {
6153
+ if (!options.limitPolicy) {
6154
+ options.limitPolicy = createLimitPolicy({});
6155
+ }
6156
+ super(options);
6157
+ this.options = options;
6158
+ }
6159
+ async deploy(definition) {
6160
+ const { teamId } = this.options;
6161
+ const fetchUri = this.createUrl(ENDPOINT);
6162
+ return await this.apiClient(fetchUri, {
6163
+ method: "PUT",
6164
+ body: JSON.stringify({ ...definition, teamId }),
6165
+ expectNoContent: true
6166
+ });
6167
+ }
6168
+ async remove(edgehancer) {
6169
+ const { teamId } = this.options;
6170
+ const fetchUri = this.createUrl(ENDPOINT);
6171
+ return await this.apiClient(fetchUri, {
6172
+ method: "DELETE",
6173
+ body: JSON.stringify({ teamId, ...edgehancer }),
6174
+ expectNoContent: true
6175
+ });
6176
+ }
6177
+ };
6178
+
6179
+ // src/commands/integration/commands/definition/edgehancer/util.ts
6180
+ function withEdgehancerIdOptions(yargs32) {
6181
+ return yargs32.option("connectorType", {
6182
+ describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
6183
+ demandOption: true,
6184
+ type: "string"
6185
+ }).option("archetype", {
6186
+ describe: "Data connector archetype to edgehance. Must be defined within the connectorType.",
6187
+ demandOption: true,
6188
+ type: "string"
6189
+ }).option("hook", {
6190
+ describe: "Edgehancer hook to deploy to.",
6191
+ demandOption: true,
6192
+ choices: ["preRequest", "request"],
6193
+ type: "string"
6194
+ });
6195
+ }
6196
+
6197
+ // src/commands/integration/commands/definition/edgehancer/deploy.ts
6198
+ var IntegrationEdgehancerDeployModule = {
6199
+ command: "deploy <filename>",
6200
+ describe: "Deploys a custom edgehancer hook to run when a data resource of a specific archetype is fetched. The API key used must have team admin permissions.",
6201
+ builder: (yargs32) => withConfiguration(
6202
+ withApiOptions(
6203
+ withTeamOptions(
6204
+ withEdgehancerIdOptions(
6205
+ yargs32.positional("filename", {
6206
+ demandOption: true,
6207
+ describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
6208
+ })
6209
+ )
6210
+ )
6211
+ )
6212
+ ),
6213
+ handler: async ({ apiHost, apiKey, proxy, filename, team: teamId, archetype, connectorType, hook }) => {
6214
+ const fetch3 = nodeFetchProxy(proxy);
6215
+ const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
6216
+ const code = readFileSync2(filename, "utf8");
6217
+ await client.deploy({ archetype, code, connectorType, hook });
6218
+ }
6219
+ };
6220
+
6221
+ // src/commands/integration/commands/definition/edgehancer/remove.ts
6222
+ var IntegrationEdgehancerRemoveModule = {
6223
+ command: "remove",
6224
+ describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
6225
+ builder: (yargs32) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs32)))),
6226
+ handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
6227
+ const fetch3 = nodeFetchProxy(proxy);
6228
+ const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
6229
+ await client.remove({ archetype, connectorType, hook });
6230
+ }
6231
+ };
6232
+
6233
+ // src/commands/integration/commands/definition/edgehancer/edgehancer.ts
6234
+ var IntegrationEdgehancerModule = {
6235
+ command: "edgehancer <command>",
6236
+ describe: "Commands for managing custom integration edgehancers at the team level.",
6237
+ builder: (yargs32) => yargs32.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
6238
+ handler: () => {
6239
+ yargs20.help();
6240
+ }
6241
+ };
6242
+
6243
+ // src/commands/integration/commands/definition/DefinitionClient.ts
6244
+ import { createLimitPolicy as createLimitPolicy2 } from "@uniformdev/canvas";
6245
+ import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
6246
+ var ENDPOINT2 = "/api/v1/integration-definitions";
6247
+ var DefinitionClient = class extends ApiClient2 {
6248
+ constructor(options) {
6249
+ if (!options.limitPolicy) {
6250
+ options.limitPolicy = createLimitPolicy2({});
6251
+ }
6252
+ super(options);
6253
+ this.options = options;
6254
+ }
6255
+ async register(manifest) {
6256
+ const { teamId } = this.options;
6257
+ const fetchUri = this.createUrl(ENDPOINT2);
6258
+ return await this.apiClient(fetchUri, {
6259
+ method: "PUT",
6260
+ body: JSON.stringify({ data: manifest, teamId }),
6261
+ expectNoContent: true
6262
+ });
6263
+ }
6264
+ async remove(integrationType) {
6265
+ const { teamId } = this.options;
6266
+ const fetchUri = this.createUrl(ENDPOINT2);
6267
+ return await this.apiClient(fetchUri, {
6268
+ method: "DELETE",
6269
+ body: JSON.stringify({ teamId, type: integrationType }),
6270
+ expectNoContent: true
6271
+ });
6272
+ }
6273
+ };
6274
+
6275
+ // src/commands/integration/commands/definition/register.ts
6276
+ var IntegrationDefinitionRegisterModule = {
6277
+ command: "register <filename>",
6278
+ describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
6279
+ builder: (yargs32) => withConfiguration(
6280
+ withApiOptions(
6281
+ withTeamOptions(
6282
+ yargs32.positional("filename", {
6283
+ demandOption: true,
6284
+ describe: "Integration definition manifest to register"
6285
+ })
6286
+ )
6287
+ )
6288
+ ),
6289
+ handler: async ({ apiHost, apiKey, proxy, filename, team: teamId }) => {
6290
+ const fetch3 = nodeFetchProxy(proxy);
6291
+ const client = new DefinitionClient({ apiKey, apiHost, fetch: fetch3, teamId });
6292
+ const file = readFileToObject(filename);
6293
+ await client.register(file);
6294
+ }
6295
+ };
6296
+
6297
+ // src/commands/integration/commands/definition/remove.ts
6298
+ var IntegrationDefinitionRemoveModule = {
6299
+ command: "remove <type>",
6300
+ describe: "Deletes a custom integration definition from a team. This will uninstall it on any active projects. Existing usages of the integration may break. The API key used must have team admin permissions.",
6301
+ builder: (yargs32) => withConfiguration(
6302
+ withApiOptions(
6303
+ withTeamOptions(
6304
+ yargs32.positional("type", {
6305
+ demandOption: true,
6306
+ describe: "Integration type (from its manifest) to remove."
6307
+ })
6308
+ )
6309
+ )
6310
+ ),
6311
+ handler: async ({ apiHost, apiKey, proxy, type, team: teamId }) => {
6312
+ const fetch3 = nodeFetchProxy(proxy);
6313
+ const client = new DefinitionClient({ apiKey, apiHost, fetch: fetch3, teamId });
6314
+ await client.remove(type);
6315
+ }
6316
+ };
6317
+
6318
+ // src/commands/integration/commands/definition.ts
6319
+ var IntegrationDefinitionModule = {
6320
+ command: "definition <command>",
6321
+ describe: "Commands for managing custom integration definitions at the team level.",
6322
+ builder: (yargs32) => yargs32.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).demandCommand(),
6323
+ handler: () => {
6324
+ yargs21.help();
6325
+ }
6326
+ };
6327
+
6328
+ // src/commands/integration/commands/InstallClient.ts
6329
+ import { createLimitPolicy as createLimitPolicy3 } from "@uniformdev/canvas";
6330
+ import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
6331
+ var ENDPOINT3 = "/api/v1/integration-installations";
6332
+ var InstallClient = class extends ApiClient3 {
6333
+ constructor(options) {
6334
+ if (!options.limitPolicy) {
6335
+ options.limitPolicy = createLimitPolicy3({});
6336
+ }
6337
+ super(options);
6338
+ this.options = options;
6339
+ }
6340
+ async install(definition) {
6341
+ const { projectId } = this.options;
6342
+ const fetchUri = this.createUrl(ENDPOINT3);
6343
+ return await this.apiClient(fetchUri, {
6344
+ method: "PUT",
6345
+ body: JSON.stringify({ ...definition, projectId }),
6346
+ expectNoContent: true
6347
+ });
6348
+ }
6349
+ async remove(type) {
6350
+ const { projectId } = this.options;
6351
+ const fetchUri = this.createUrl(ENDPOINT3);
6352
+ return await this.apiClient(fetchUri, {
6353
+ method: "DELETE",
6354
+ body: JSON.stringify({ projectId, type }),
6355
+ expectNoContent: true
6356
+ });
6357
+ }
6358
+ };
6359
+
6360
+ // src/commands/integration/commands/install.ts
6361
+ var IntegrationInstallModule = {
6362
+ command: "install <type>",
6363
+ describe: "Installs an integration to a project. The integration may be built-in or custom. Custom integrations must be registered to the parent team first.",
6364
+ builder: (yargs32) => withConfiguration(
6365
+ withApiOptions(
6366
+ withProjectOptions(
6367
+ yargs32.positional("type", {
6368
+ demandOption: true,
6369
+ describe: "Integration type to install (as defined in its manifest)"
6370
+ }).option("configuration", {
6371
+ describe: "Optional JSON configuration data for the integration, to pre-configure it. The schema is specific to each integration.",
6372
+ type: "string"
6373
+ })
6374
+ )
6375
+ )
6376
+ ),
6377
+ handler: async ({ apiHost, apiKey, proxy, type, configuration: configuration2, project: projectId }) => {
6378
+ const fetch3 = nodeFetchProxy(proxy);
6379
+ const client = new InstallClient({ apiKey, apiHost, fetch: fetch3, projectId });
6380
+ const data = configuration2 ? JSON.parse(configuration2) : void 0;
6381
+ await client.install({ data, type });
6382
+ }
6383
+ };
6384
+
6385
+ // src/commands/integration/commands/uninstall.ts
6386
+ var IntegrationUninstallModule = {
6387
+ command: "uninstall <type>",
6388
+ describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
6389
+ builder: (yargs32) => withConfiguration(
6390
+ withApiOptions(
6391
+ withProjectOptions(
6392
+ yargs32.positional("type", {
6393
+ demandOption: true,
6394
+ describe: "Integration type to uninstall (as defined in its manifest)"
6395
+ })
6396
+ )
6397
+ )
6398
+ ),
6399
+ handler: async ({ apiHost, apiKey, proxy, type, project: projectId }) => {
6400
+ const fetch3 = nodeFetchProxy(proxy);
6401
+ const client = new InstallClient({ apiKey, apiHost, fetch: fetch3, projectId });
6402
+ await client.remove(type);
6403
+ }
6404
+ };
6405
+
6406
+ // src/commands/integration/index.ts
6407
+ var IntegrationCommand = {
6408
+ command: "integration <command>",
6409
+ describe: "Integration management commands",
6410
+ builder: (yargs32) => yargs32.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
5425
6411
  handler: () => {
5426
- yargs17.showHelp();
6412
+ yargs22.showHelp();
5427
6413
  }
5428
6414
  };
5429
6415
 
@@ -5451,7 +6437,7 @@ import { PostHog } from "posthog-node";
5451
6437
  // package.json
5452
6438
  var package_default = {
5453
6439
  name: "@uniformdev/cli",
5454
- version: "19.79.0",
6440
+ version: "19.112.0",
5455
6441
  description: "Uniform command line interface tool",
5456
6442
  license: "SEE LICENSE IN LICENSE.txt",
5457
6443
  main: "./cli.js",
@@ -5486,16 +6472,16 @@ var package_default = {
5486
6472
  "graphql-request": "6.1.0",
5487
6473
  "https-proxy-agent": "^7.0.0",
5488
6474
  "image-size": "^1.0.2",
5489
- inquirer: "9.2.11",
5490
- "isomorphic-git": "1.24.5",
6475
+ inquirer: "9.2.12",
6476
+ "isomorphic-git": "1.25.2",
5491
6477
  "isomorphic-unfetch": "^4.0.0",
5492
6478
  "js-yaml": "^4.1.0",
5493
6479
  jsonwebtoken: "9.0.2",
5494
6480
  "lodash.isequalwith": "^4.4.0",
5495
6481
  open: "9.1.0",
5496
- ora: "7.0.1",
6482
+ ora: "8.0.1",
5497
6483
  "p-queue": "7.3.4",
5498
- "posthog-node": "3.1.3",
6484
+ "posthog-node": "3.2.1",
5499
6485
  "registry-auth-token": "^5.0.0",
5500
6486
  "registry-url": "^6.0.0",
5501
6487
  slugify: "1.6.6",
@@ -5503,13 +6489,13 @@ var package_default = {
5503
6489
  zod: "3.22.4"
5504
6490
  },
5505
6491
  devDependencies: {
5506
- "@types/diff": "5.0.8",
5507
- "@types/inquirer": "9.0.3",
6492
+ "@types/diff": "5.0.9",
6493
+ "@types/inquirer": "9.0.7",
5508
6494
  "@types/js-yaml": "4.0.9",
5509
6495
  "@types/jsonwebtoken": "9.0.5",
5510
- "@types/lodash.isequalwith": "4.4.7",
5511
- "@types/node": "18.17.18",
5512
- "@types/yargs": "17.0.24"
6496
+ "@types/lodash.isequalwith": "4.4.9",
6497
+ "@types/node": "20.10.6",
6498
+ "@types/yargs": "17.0.32"
5513
6499
  },
5514
6500
  bin: {
5515
6501
  uniform: "./cli.js"
@@ -6266,7 +7252,7 @@ npm run dev
6266
7252
  }
6267
7253
 
6268
7254
  // src/commands/new/commands/new-mesh-integration.ts
6269
- import { existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
7255
+ import { existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
6270
7256
  import inquirer5 from "inquirer";
6271
7257
  import path4 from "path";
6272
7258
  import slugify2 from "slugify";
@@ -6313,13 +7299,13 @@ async function newMeshIntegrationHandler({
6313
7299
  if (!existsSync3(pathToManifest)) {
6314
7300
  throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
6315
7301
  }
6316
- const manifestContents = readFileSync2(pathToManifest, "utf-8");
7302
+ const manifestContents = readFileSync3(pathToManifest, "utf-8");
6317
7303
  const manifestJson = JSON.parse(manifestContents);
6318
7304
  manifestJson.type = typeSlug;
6319
7305
  manifestJson.displayName = name;
6320
7306
  writeFileSync2(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
6321
7307
  const packageJsonPath = path4.resolve(targetDir, "package.json");
6322
- const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
7308
+ const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
6323
7309
  packageJson.name = typeSlug;
6324
7310
  writeFileSync2(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
6325
7311
  const fullMeshAppKey = await uniformClient.registerMeshIntegration({ teamId, manifest: manifestJson });
@@ -6461,10 +7447,10 @@ var NewMeshCmd = {
6461
7447
  };
6462
7448
 
6463
7449
  // src/commands/optimize/index.ts
6464
- import yargs19 from "yargs";
7450
+ import yargs24 from "yargs";
6465
7451
 
6466
7452
  // src/commands/optimize/manifest.ts
6467
- import yargs18 from "yargs";
7453
+ import yargs23 from "yargs";
6468
7454
 
6469
7455
  // src/commands/optimize/manifest/download.ts
6470
7456
  import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
@@ -6479,7 +7465,7 @@ var UniformBaseUrl = "https://uniform.app";
6479
7465
  var module = {
6480
7466
  command: "download [output]",
6481
7467
  describe: "Download intent manifest",
6482
- builder: (yargs27) => yargs27.option("apiKey", {
7468
+ builder: (yargs32) => yargs32.option("apiKey", {
6483
7469
  alias: "k",
6484
7470
  demandOption: true,
6485
7471
  string: true,
@@ -6580,10 +7566,10 @@ var module2 = {
6580
7566
  command: "manifest <command>",
6581
7567
  describe: "Intent manifest commands",
6582
7568
  builder: () => {
6583
- return yargs18.command(download_default);
7569
+ return yargs23.command(download_default);
6584
7570
  },
6585
7571
  handler: () => {
6586
- yargs18.showHelp();
7572
+ yargs23.showHelp();
6587
7573
  }
6588
7574
  };
6589
7575
  var manifest_default = module2;
@@ -6594,29 +7580,29 @@ var OptimizeCommand = {
6594
7580
  aliases: ["opt"],
6595
7581
  describe: "Uniform Optimize commands",
6596
7582
  builder: () => {
6597
- return yargs19.command(manifest_default);
7583
+ return yargs24.command(manifest_default);
6598
7584
  },
6599
7585
  handler: () => {
6600
- yargs19.showHelp();
7586
+ yargs24.showHelp();
6601
7587
  }
6602
7588
  };
6603
7589
 
6604
7590
  // src/commands/project-map/index.ts
6605
- import yargs22 from "yargs";
7591
+ import yargs27 from "yargs";
6606
7592
 
6607
7593
  // src/commands/project-map/commands/projectMapDefinition.ts
6608
- import yargs20 from "yargs";
7594
+ import yargs25 from "yargs";
6609
7595
 
6610
7596
  // src/commands/project-map/commands/ProjectMapDefinition/get.ts
6611
7597
  import { UncachedProjectMapClient } from "@uniformdev/project-map";
6612
7598
  var ProjectMapDefinitionGetModule = {
6613
7599
  command: "get <id>",
6614
7600
  describe: "Fetch a project map",
6615
- builder: (yargs27) => withFormatOptions(
7601
+ builder: (yargs32) => withFormatOptions(
6616
7602
  withConfiguration(
6617
7603
  withApiOptions(
6618
7604
  withProjectOptions(
6619
- yargs27.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
7605
+ yargs32.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
6620
7606
  )
6621
7607
  )
6622
7608
  )
@@ -6640,7 +7626,7 @@ var ProjectMapDefinitionListModule = {
6640
7626
  command: "list",
6641
7627
  describe: "List of project maps",
6642
7628
  aliases: ["ls"],
6643
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
7629
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
6644
7630
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
6645
7631
  const fetch3 = nodeFetchProxy(proxy);
6646
7632
  const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -6697,11 +7683,11 @@ function createProjectMapDefinitionEngineDataSource({
6697
7683
  var ProjectMapDefinitionPullModule = {
6698
7684
  command: "pull <directory>",
6699
7685
  describe: "Pulls all project maps to local files in a directory",
6700
- builder: (yargs27) => withConfiguration(
7686
+ builder: (yargs32) => withConfiguration(
6701
7687
  withApiOptions(
6702
7688
  withProjectOptions(
6703
7689
  withDiffOptions(
6704
- yargs27.positional("directory", {
7690
+ yargs32.positional("directory", {
6705
7691
  describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
6706
7692
  type: "string"
6707
7693
  }).option("format", {
@@ -6735,7 +7721,8 @@ var ProjectMapDefinitionPullModule = {
6735
7721
  mode,
6736
7722
  whatIf,
6737
7723
  project: projectId,
6738
- diff: diffMode
7724
+ diff: diffMode,
7725
+ allowEmptySource
6739
7726
  }) => {
6740
7727
  const fetch3 = nodeFetchProxy(proxy);
6741
7728
  const client = new UncachedProjectMapClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -6766,7 +7753,7 @@ var ProjectMapDefinitionPullModule = {
6766
7753
  target,
6767
7754
  mode,
6768
7755
  whatIf,
6769
- allowEmptySource: true,
7756
+ allowEmptySource: allowEmptySource ?? true,
6770
7757
  log: createSyncEngineConsoleLogger({ diffMode })
6771
7758
  });
6772
7759
  }
@@ -6777,11 +7764,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
6777
7764
  var ProjectMapDefinitionPushModule = {
6778
7765
  command: "push <directory>",
6779
7766
  describe: "Pushes all project maps from files in a directory or package to Uniform",
6780
- builder: (yargs27) => withConfiguration(
7767
+ builder: (yargs32) => withConfiguration(
6781
7768
  withApiOptions(
6782
7769
  withProjectOptions(
6783
7770
  withDiffOptions(
6784
- yargs27.positional("directory", {
7771
+ yargs32.positional("directory", {
6785
7772
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
6786
7773
  type: "string"
6787
7774
  }).option("what-if", {
@@ -6808,7 +7795,8 @@ var ProjectMapDefinitionPushModule = {
6808
7795
  mode,
6809
7796
  whatIf,
6810
7797
  project: projectId,
6811
- diff: diffMode
7798
+ diff: diffMode,
7799
+ allowEmptySource
6812
7800
  }) => {
6813
7801
  const fetch3 = nodeFetchProxy(proxy);
6814
7802
  const client = new UncachedProjectMapClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -6834,6 +7822,7 @@ var ProjectMapDefinitionPushModule = {
6834
7822
  target,
6835
7823
  mode,
6836
7824
  whatIf,
7825
+ allowEmptySource,
6837
7826
  log: createSyncEngineConsoleLogger({ diffMode })
6838
7827
  });
6839
7828
  }
@@ -6845,9 +7834,9 @@ var ProjectMapDefinitionRemoveModule = {
6845
7834
  command: "remove <id>",
6846
7835
  aliases: ["delete", "rm"],
6847
7836
  describe: "Delete a project map",
6848
- builder: (yargs27) => withConfiguration(
7837
+ builder: (yargs32) => withConfiguration(
6849
7838
  withApiOptions(
6850
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: " UUID to delete" }))
7839
+ withProjectOptions(yargs32.positional("id", { demandOption: true, describe: " UUID to delete" }))
6851
7840
  )
6852
7841
  ),
6853
7842
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -6863,10 +7852,10 @@ var ProjectMapDefinitionUpdateModule = {
6863
7852
  command: "update <filename>",
6864
7853
  aliases: ["put"],
6865
7854
  describe: "Insert or update a project map",
6866
- builder: (yargs27) => withConfiguration(
7855
+ builder: (yargs32) => withConfiguration(
6867
7856
  withApiOptions(
6868
7857
  withProjectOptions(
6869
- yargs27.positional("filename", { demandOption: true, describe: "Project map file to put" })
7858
+ yargs32.positional("filename", { demandOption: true, describe: "Project map file to put" })
6870
7859
  )
6871
7860
  )
6872
7861
  ),
@@ -6882,25 +7871,25 @@ var ProjectMapDefinitionUpdateModule = {
6882
7871
  var ProjectMapDefinitionModule = {
6883
7872
  command: "definition <command>",
6884
7873
  describe: "Commands for ProjectMap Definitions",
6885
- builder: (yargs27) => yargs27.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
7874
+ builder: (yargs32) => yargs32.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
6886
7875
  handler: () => {
6887
- yargs20.help();
7876
+ yargs25.help();
6888
7877
  }
6889
7878
  };
6890
7879
 
6891
7880
  // src/commands/project-map/commands/projectMapNode.ts
6892
- import yargs21 from "yargs";
7881
+ import yargs26 from "yargs";
6893
7882
 
6894
7883
  // src/commands/project-map/commands/ProjectMapNode/get.ts
6895
7884
  import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
6896
7885
  var ProjectMapNodeGetModule = {
6897
7886
  command: "get <id> <projectMapId>",
6898
7887
  describe: "Fetch a project map node",
6899
- builder: (yargs27) => withConfiguration(
7888
+ builder: (yargs32) => withConfiguration(
6900
7889
  withFormatOptions(
6901
7890
  withApiOptions(
6902
7891
  withProjectOptions(
6903
- yargs27.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
7892
+ yargs32.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
6904
7893
  )
6905
7894
  )
6906
7895
  )
@@ -6926,22 +7915,24 @@ var ProjectMapNodeListModule = {
6926
7915
  command: "list <projectMapId>",
6927
7916
  describe: "List project map nodes",
6928
7917
  aliases: ["ls"],
6929
- builder: (yargs27) => withConfiguration(
7918
+ builder: (yargs32) => withConfiguration(
6930
7919
  withFormatOptions(
6931
7920
  withApiOptions(
6932
7921
  withProjectOptions(
6933
- yargs27.positional("projectMapId", {
6934
- demandOption: true,
6935
- describe: "ProjectMap UUID to fetch from"
6936
- })
7922
+ withStateOptions(
7923
+ yargs32.positional("projectMapId", {
7924
+ demandOption: true,
7925
+ describe: "ProjectMap UUID to fetch from"
7926
+ })
7927
+ )
6937
7928
  )
6938
7929
  )
6939
7930
  )
6940
7931
  ),
6941
- handler: async ({ apiHost, apiKey, proxy, projectMapId, format, filename, project: projectId }) => {
7932
+ handler: async ({ apiHost, apiKey, proxy, projectMapId, format, filename, project: projectId, state }) => {
6942
7933
  const fetch3 = nodeFetchProxy(proxy);
6943
7934
  const client = new UncachedProjectMapClient8({ apiKey, apiHost, fetch: fetch3, projectId });
6944
- const res = await client.getNodes({ projectMapId });
7935
+ const res = await client.getNodes({ projectMapId, state: convertCompositionState(state) });
6945
7936
  emitWithFormat({ nodes: res.nodes ?? [], projectMapId }, format, filename);
6946
7937
  }
6947
7938
  };
@@ -7001,11 +7992,11 @@ function createProjectMapNodeEngineDataSource({
7001
7992
  var ProjectMapNodePullModule = {
7002
7993
  command: "pull <directory>",
7003
7994
  describe: "Pulls all project maps nodes to local files in a directory",
7004
- builder: (yargs27) => withConfiguration(
7995
+ builder: (yargs32) => withConfiguration(
7005
7996
  withApiOptions(
7006
7997
  withProjectOptions(
7007
7998
  withDiffOptions(
7008
- yargs27.positional("directory", {
7999
+ yargs32.positional("directory", {
7009
8000
  describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7010
8001
  type: "string"
7011
8002
  }).option("format", {
@@ -7039,7 +8030,8 @@ var ProjectMapNodePullModule = {
7039
8030
  mode,
7040
8031
  whatIf,
7041
8032
  project: projectId,
7042
- diff: diffMode
8033
+ diff: diffMode,
8034
+ allowEmptySource
7043
8035
  }) => {
7044
8036
  const fetch3 = nodeFetchProxy(proxy);
7045
8037
  const client = new UncachedProjectMapClient9({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7074,7 +8066,7 @@ var ProjectMapNodePullModule = {
7074
8066
  target,
7075
8067
  mode,
7076
8068
  whatIf,
7077
- allowEmptySource: true,
8069
+ allowEmptySource: allowEmptySource ?? true,
7078
8070
  log: createSyncEngineConsoleLogger({ diffMode })
7079
8071
  });
7080
8072
  }
@@ -7085,11 +8077,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
7085
8077
  var ProjectMapNodePushModule = {
7086
8078
  command: "push <directory>",
7087
8079
  describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
7088
- builder: (yargs27) => withConfiguration(
8080
+ builder: (yargs32) => withConfiguration(
7089
8081
  withApiOptions(
7090
8082
  withProjectOptions(
7091
8083
  withDiffOptions(
7092
- yargs27.positional("directory", {
8084
+ yargs32.positional("directory", {
7093
8085
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
7094
8086
  type: "string"
7095
8087
  }).option("what-if", {
@@ -7116,7 +8108,8 @@ var ProjectMapNodePushModule = {
7116
8108
  mode,
7117
8109
  whatIf,
7118
8110
  project: projectId,
7119
- diff: diffMode
8111
+ diff: diffMode,
8112
+ allowEmptySource
7120
8113
  }) => {
7121
8114
  const fetch3 = nodeFetchProxy(proxy);
7122
8115
  const client = new UncachedProjectMapClient10({
@@ -7151,6 +8144,7 @@ var ProjectMapNodePushModule = {
7151
8144
  target,
7152
8145
  mode,
7153
8146
  whatIf,
8147
+ allowEmptySource,
7154
8148
  log: createSyncEngineConsoleLogger({ diffMode })
7155
8149
  });
7156
8150
  }
@@ -7162,10 +8156,10 @@ var ProjectMapNodeRemoveModule = {
7162
8156
  command: "remove <id> <projectMapId>",
7163
8157
  aliases: ["delete", "rm"],
7164
8158
  describe: "Delete a project map node",
7165
- builder: (yargs27) => withConfiguration(
8159
+ builder: (yargs32) => withConfiguration(
7166
8160
  withApiOptions(
7167
8161
  withProjectOptions(
7168
- yargs27.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
8162
+ yargs32.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
7169
8163
  )
7170
8164
  )
7171
8165
  ),
@@ -7182,10 +8176,10 @@ var ProjectMapNodeUpdateModule = {
7182
8176
  command: "update <filename> <projectMapId>",
7183
8177
  aliases: ["put"],
7184
8178
  describe: "Insert or update a project map node",
7185
- builder: (yargs27) => withConfiguration(
8179
+ builder: (yargs32) => withConfiguration(
7186
8180
  withApiOptions(
7187
8181
  withProjectOptions(
7188
- yargs27.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
8182
+ yargs32.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
7189
8183
  )
7190
8184
  )
7191
8185
  ),
@@ -7201,9 +8195,9 @@ var ProjectMapNodeUpdateModule = {
7201
8195
  var ProjectMapNodeModule = {
7202
8196
  command: "node <command>",
7203
8197
  describe: "Commands for ProjectMap Nodes",
7204
- builder: (yargs27) => yargs27.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
8198
+ builder: (yargs32) => yargs32.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
7205
8199
  handler: () => {
7206
- yargs21.help();
8200
+ yargs26.help();
7207
8201
  }
7208
8202
  };
7209
8203
 
@@ -7212,28 +8206,28 @@ var ProjectMapCommand = {
7212
8206
  command: "project-map <command>",
7213
8207
  aliases: ["prm"],
7214
8208
  describe: "Uniform ProjectMap commands",
7215
- builder: (yargs27) => yargs27.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
8209
+ builder: (yargs32) => yargs32.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
7216
8210
  handler: () => {
7217
- yargs22.showHelp();
8211
+ yargs27.showHelp();
7218
8212
  }
7219
8213
  };
7220
8214
 
7221
8215
  // src/commands/redirect/index.ts
7222
- import yargs24 from "yargs";
8216
+ import yargs29 from "yargs";
7223
8217
 
7224
8218
  // src/commands/redirect/commands/redirect.ts
7225
- import yargs23 from "yargs";
8219
+ import yargs28 from "yargs";
7226
8220
 
7227
8221
  // src/commands/redirect/commands/RedirectDefinition/get.ts
7228
8222
  import { UncachedRedirectClient } from "@uniformdev/redirect";
7229
8223
  var RedirectDefinitionGetModule = {
7230
8224
  command: "get <id>",
7231
8225
  describe: "Fetch a redirect",
7232
- builder: (yargs27) => withConfiguration(
8226
+ builder: (yargs32) => withConfiguration(
7233
8227
  withFormatOptions(
7234
8228
  withApiOptions(
7235
8229
  withProjectOptions(
7236
- yargs27.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
8230
+ yargs32.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
7237
8231
  )
7238
8232
  )
7239
8233
  )
@@ -7257,7 +8251,7 @@ var RedirectDefinitionListModule = {
7257
8251
  command: "list",
7258
8252
  describe: "List of redirects",
7259
8253
  aliases: ["ls"],
7260
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
8254
+ builder: (yargs32) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs32)))),
7261
8255
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
7262
8256
  const fetch3 = nodeFetchProxy(proxy);
7263
8257
  const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7323,11 +8317,11 @@ function createRedirectDefinitionEngineDataSource({
7323
8317
  var RedirectDefinitionPullModule = {
7324
8318
  command: "pull <directory>",
7325
8319
  describe: "Pulls all redirects to local files in a directory",
7326
- builder: (yargs27) => withConfiguration(
8320
+ builder: (yargs32) => withConfiguration(
7327
8321
  withApiOptions(
7328
8322
  withProjectOptions(
7329
8323
  withDiffOptions(
7330
- yargs27.positional("directory", {
8324
+ yargs32.positional("directory", {
7331
8325
  describe: "Directory to save redirects to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7332
8326
  type: "string"
7333
8327
  }).option("format", {
@@ -7361,7 +8355,8 @@ var RedirectDefinitionPullModule = {
7361
8355
  mode,
7362
8356
  whatIf,
7363
8357
  project: projectId,
7364
- diff: diffMode
8358
+ diff: diffMode,
8359
+ allowEmptySource
7365
8360
  }) => {
7366
8361
  const fetch3 = nodeFetchProxy(proxy);
7367
8362
  const client = new UncachedRedirectClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7393,7 +8388,7 @@ var RedirectDefinitionPullModule = {
7393
8388
  target,
7394
8389
  mode,
7395
8390
  whatIf,
7396
- allowEmptySource: true,
8391
+ allowEmptySource: allowEmptySource ?? true,
7397
8392
  log: createSyncEngineConsoleLogger({ diffMode })
7398
8393
  });
7399
8394
  }
@@ -7404,11 +8399,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
7404
8399
  var RedirectDefinitionPushModule = {
7405
8400
  command: "push <directory>",
7406
8401
  describe: "Pushes all redirects from files in a directory or package to Uniform",
7407
- builder: (yargs27) => withConfiguration(
8402
+ builder: (yargs32) => withConfiguration(
7408
8403
  withApiOptions(
7409
8404
  withProjectOptions(
7410
8405
  withDiffOptions(
7411
- yargs27.positional("directory", {
8406
+ yargs32.positional("directory", {
7412
8407
  describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
7413
8408
  type: "string"
7414
8409
  }).option("what-if", {
@@ -7435,7 +8430,8 @@ var RedirectDefinitionPushModule = {
7435
8430
  mode,
7436
8431
  whatIf,
7437
8432
  project: projectId,
7438
- diff: diffMode
8433
+ diff: diffMode,
8434
+ allowEmptySource
7439
8435
  }) => {
7440
8436
  const fetch3 = nodeFetchProxy(proxy);
7441
8437
  const client = new UncachedRedirectClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7461,6 +8457,7 @@ var RedirectDefinitionPushModule = {
7461
8457
  target,
7462
8458
  mode,
7463
8459
  whatIf,
8460
+ allowEmptySource,
7464
8461
  log: createSyncEngineConsoleLogger({ diffMode })
7465
8462
  });
7466
8463
  }
@@ -7472,9 +8469,9 @@ var RedirectDefinitionRemoveModule = {
7472
8469
  command: "remove <id>",
7473
8470
  aliases: ["delete", "rm"],
7474
8471
  describe: "Delete a redirect",
7475
- builder: (yargs27) => withConfiguration(
8472
+ builder: (yargs32) => withConfiguration(
7476
8473
  withApiOptions(
7477
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: " UUID to delete" }))
8474
+ withProjectOptions(yargs32.positional("id", { demandOption: true, describe: " UUID to delete" }))
7478
8475
  )
7479
8476
  ),
7480
8477
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -7490,10 +8487,10 @@ var RedirectDefinitionUpdateModule = {
7490
8487
  command: "update <filename>",
7491
8488
  aliases: ["put"],
7492
8489
  describe: "Insert or update a redirect",
7493
- builder: (yargs27) => withConfiguration(
8490
+ builder: (yargs32) => withConfiguration(
7494
8491
  withApiOptions(
7495
8492
  withProjectOptions(
7496
- yargs27.positional("filename", { demandOption: true, describe: "Redirect file to put" })
8493
+ yargs32.positional("filename", { demandOption: true, describe: "Redirect file to put" })
7497
8494
  )
7498
8495
  )
7499
8496
  ),
@@ -7509,9 +8506,9 @@ var RedirectDefinitionUpdateModule = {
7509
8506
  var RedirectDefinitionModule = {
7510
8507
  command: "definition <command>",
7511
8508
  describe: "Commands for Redirect Definitions",
7512
- builder: (yargs27) => yargs27.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
8509
+ builder: (yargs32) => yargs32.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
7513
8510
  handler: () => {
7514
- yargs23.help();
8511
+ yargs28.help();
7515
8512
  }
7516
8513
  };
7517
8514
 
@@ -7520,14 +8517,14 @@ var RedirectCommand = {
7520
8517
  command: "redirect <command>",
7521
8518
  aliases: ["red"],
7522
8519
  describe: "Uniform Redirect commands",
7523
- builder: (yargs27) => yargs27.command(RedirectDefinitionModule).demandCommand(),
8520
+ builder: (yargs32) => yargs32.command(RedirectDefinitionModule).demandCommand(),
7524
8521
  handler: () => {
7525
- yargs24.showHelp();
8522
+ yargs29.showHelp();
7526
8523
  }
7527
8524
  };
7528
8525
 
7529
8526
  // src/commands/sync/index.ts
7530
- import yargs25 from "yargs";
8527
+ import yargs30 from "yargs";
7531
8528
 
7532
8529
  // src/commands/sync/commands/util.ts
7533
8530
  import ora2 from "ora";
@@ -7546,10 +8543,12 @@ function spin(entityType) {
7546
8543
  stop: () => {
7547
8544
  spinner.stop();
7548
8545
  console.log = consoleLog;
8546
+ return spinner;
7549
8547
  },
7550
8548
  succeed() {
7551
8549
  spinner.succeed();
7552
8550
  console.log = consoleLog;
8551
+ return spinner;
7553
8552
  }
7554
8553
  };
7555
8554
  }
@@ -7558,11 +8557,11 @@ function spin(entityType) {
7558
8557
  var SyncPullModule = {
7559
8558
  command: "pull",
7560
8559
  describe: "Pulls whole project to local files in a directory",
7561
- builder: (yargs27) => withConfiguration(
8560
+ builder: (yargs32) => withConfiguration(
7562
8561
  withApiOptions(
7563
8562
  withProjectOptions(
7564
8563
  withDiffOptions(
7565
- yargs27.option("what-if", {
8564
+ yargs32.option("what-if", {
7566
8565
  alias: ["w"],
7567
8566
  describe: "What-if mode reports what would be done but changes no files",
7568
8567
  default: false,
@@ -7573,8 +8572,11 @@ var SyncPullModule = {
7573
8572
  )
7574
8573
  ),
7575
8574
  handler: async ({ serialization, ...otherParams }) => {
8575
+ var _a;
7576
8576
  const config2 = serialization;
7577
8577
  const enabledEntities = Object.entries({
8578
+ locale: LocalePullModule,
8579
+ asset: AssetPullModule,
7578
8580
  category: CategoryPullModule,
7579
8581
  dataType: DataTypePullModule,
7580
8582
  prompt: PromptPullModule,
@@ -7590,11 +8592,10 @@ var SyncPullModule = {
7590
8592
  projectMapNode: ProjectMapNodePullModule,
7591
8593
  redirect: RedirectDefinitionPullModule,
7592
8594
  entry: EntryPullModule,
7593
- contentType: ContentTypePullModule,
7594
- asset: AssetPullModule
8595
+ contentType: ContentTypePullModule
7595
8596
  }).filter(([entityType]) => {
7596
- var _a, _b, _c, _d, _e, _f;
7597
- return Boolean((_a = config2.entitiesConfig) == null ? void 0 : _a[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
8597
+ var _a2, _b, _c, _d, _e, _f;
8598
+ return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
7598
8599
  });
7599
8600
  if (enabledEntities.length === 0) {
7600
8601
  throw new Error(
@@ -7603,15 +8604,20 @@ var SyncPullModule = {
7603
8604
  }
7604
8605
  for (const [entityType, module3] of enabledEntities) {
7605
8606
  const spinner = spin(entityType);
8607
+ const entityConfigSupportsPullState = (entityConfig2) => {
8608
+ return entityConfig2 !== void 0 && "state" in entityConfig2;
8609
+ };
8610
+ const entityConfig = (_a = config2.entitiesConfig) == null ? void 0 : _a[entityType];
7606
8611
  try {
7607
8612
  await module3.handler({
7608
8613
  ...otherParams,
7609
- state: 0,
8614
+ state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
7610
8615
  format: getFormat(entityType, config2),
7611
8616
  onlyCompositions: entityType === "composition" ? true : void 0,
7612
8617
  onlyPatterns: entityType === "pattern" ? true : void 0,
7613
8618
  mode: getPullMode(entityType, config2),
7614
- directory: getPullFilename(entityType, config2)
8619
+ directory: getPullFilename(entityType, config2),
8620
+ allowEmptySource: config2.allowEmptySource
7615
8621
  });
7616
8622
  spinner.succeed();
7617
8623
  } catch (e) {
@@ -7649,11 +8655,11 @@ var getFormat = (entityType, config2) => {
7649
8655
  var SyncPushModule = {
7650
8656
  command: "push",
7651
8657
  describe: "Pushes whole project data from files in a directory or package to Uniform",
7652
- builder: (yargs27) => withConfiguration(
8658
+ builder: (yargs32) => withConfiguration(
7653
8659
  withApiOptions(
7654
8660
  withProjectOptions(
7655
8661
  withDiffOptions(
7656
- yargs27.option("what-if", {
8662
+ yargs32.option("what-if", {
7657
8663
  alias: ["w"],
7658
8664
  describe: "What-if mode reports what would be done but changes nothing",
7659
8665
  default: false,
@@ -7664,9 +8670,11 @@ var SyncPushModule = {
7664
8670
  )
7665
8671
  ),
7666
8672
  handler: async ({ serialization, ...otherParams }) => {
7667
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
8673
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
7668
8674
  const config2 = serialization;
7669
8675
  const enabledEntities = Object.entries({
8676
+ locale: LocalePushModule,
8677
+ asset: AssetPushModule,
7670
8678
  category: CategoryPushModule,
7671
8679
  dataType: DataTypePushModule,
7672
8680
  prompt: PromptPushModule,
@@ -7682,8 +8690,7 @@ var SyncPushModule = {
7682
8690
  projectMapNode: ProjectMapNodePushModule,
7683
8691
  redirect: RedirectDefinitionPushModule,
7684
8692
  contentType: ContentTypePushModule,
7685
- entry: EntryPushModule,
7686
- asset: AssetPushModule
8693
+ entry: EntryPushModule
7687
8694
  }).filter(([entityType]) => {
7688
8695
  var _a2, _b2, _c2, _d2, _e2, _f2;
7689
8696
  return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
@@ -7703,7 +8710,8 @@ var SyncPushModule = {
7703
8710
  onlyCompositions: entityType === "composition" ? true : void 0,
7704
8711
  onlyPatterns: entityType === "pattern" ? true : void 0,
7705
8712
  mode: getPushMode(entityType, config2),
7706
- directory: getPushFilename(entityType, config2)
8713
+ directory: getPushFilename(entityType, config2),
8714
+ allowEmptySource: config2.allowEmptySource
7707
8715
  });
7708
8716
  spinner.succeed();
7709
8717
  } catch (e) {
@@ -7717,6 +8725,9 @@ var SyncPushModule = {
7717
8725
  if (((_g = config2.entitiesConfig) == null ? void 0 : _g.composition) && ((_j = (_i = (_h = config2.entitiesConfig) == null ? void 0 : _h.composition) == null ? void 0 : _i.push) == null ? void 0 : _j.disabled) !== true && ((_l = (_k = config2.entitiesConfig) == null ? void 0 : _k.composition) == null ? void 0 : _l.publish)) {
7718
8726
  await CompositionPublishModule.handler({ ...otherParams, all: true });
7719
8727
  }
8728
+ if (((_m = config2.entitiesConfig) == null ? void 0 : _m.entry) && ((_p = (_o = (_n = config2.entitiesConfig) == null ? void 0 : _n.entry) == null ? void 0 : _o.push) == null ? void 0 : _p.disabled) !== true && ((_r = (_q = config2.entitiesConfig) == null ? void 0 : _q.entry) == null ? void 0 : _r.publish)) {
8729
+ await EntryPublishModule.handler({ ...otherParams, all: true });
8730
+ }
7720
8731
  }
7721
8732
  };
7722
8733
  var getPushMode = (entityType, config2) => {
@@ -7747,9 +8758,9 @@ var getFormat2 = (entityType, config2) => {
7747
8758
  var SyncCommand = {
7748
8759
  command: "sync <command>",
7749
8760
  describe: "Uniform Sync commands",
7750
- builder: (yargs27) => yargs27.command(SyncPullModule).command(SyncPushModule).demandCommand(),
8761
+ builder: (yargs32) => yargs32.command(SyncPullModule).command(SyncPushModule).demandCommand(),
7751
8762
  handler: () => {
7752
- yargs25.showHelp();
8763
+ yargs30.showHelp();
7753
8764
  }
7754
8765
  };
7755
8766
 
@@ -7761,18 +8772,19 @@ import { reset } from "colorette";
7761
8772
  function fillString(char, length) {
7762
8773
  return Array.from({ length }).map(() => char).join("");
7763
8774
  }
8775
+ var stdErrLog = (message) => process.stderr.write(message + "\n");
7764
8776
  function logCallout(options) {
7765
8777
  const message = typeof options === "string" ? options : options.message;
7766
8778
  const messageLines = message.trim().split("\n");
7767
8779
  const longestLine = messageLines.reduce((longest, next) => next.length > longest.length ? next : longest);
7768
8780
  const bar = "**" + fillString("*", reset(longestLine).length);
7769
- console.log("");
7770
- console.log(bar);
8781
+ stdErrLog("");
8782
+ stdErrLog(bar);
7771
8783
  for (const line of messageLines) {
7772
- console.log(` ${line}`);
8784
+ stdErrLog(` ${line}`);
7773
8785
  }
7774
- console.log(bar);
7775
- console.log("");
8786
+ stdErrLog(bar);
8787
+ stdErrLog("");
7776
8788
  }
7777
8789
 
7778
8790
  // src/updateCheck.ts
@@ -8015,7 +9027,7 @@ First found was: v${firstVersion}`;
8015
9027
 
8016
9028
  // src/index.ts
8017
9029
  dotenv.config();
8018
- var yarggery = yargs26(hideBin(process.argv));
9030
+ var yarggery = yargs31(hideBin(process.argv));
8019
9031
  var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
8020
9032
  var configuration = loadConfig(inlineConfigurationFilePath || null);
8021
9033
  yarggery.option("verbose", {
@@ -8024,4 +9036,4 @@ yarggery.option("verbose", {
8024
9036
  type: "boolean"
8025
9037
  }).scriptName("uniform").config(configuration).config("config", function() {
8026
9038
  return {};
8027
- }).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;
9039
+ }).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).command(IntegrationCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;