@uniformdev/cli 19.79.0 → 19.79.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -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.38.3_postcss@8.4.32_typescript@5.3.2/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 yargs27 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 yargs11 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(yargs28) {
141
+ return yargs28.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(yargs28) {
147
+ return yargs28.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(yargs28) {
187
+ return yargs28.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,8 @@ function withProjectOptions(yargs27) {
194
194
  alias: ["p"]
195
195
  });
196
196
  }
197
- function withFormatOptions(yargs27) {
198
- return yargs27.option("format", {
197
+ function withFormatOptions(yargs28) {
198
+ return yargs28.option("format", {
199
199
  alias: ["f"],
200
200
  describe: "Output format",
201
201
  default: "yaml",
@@ -207,8 +207,8 @@ function withFormatOptions(yargs27) {
207
207
  type: "string"
208
208
  });
209
209
  }
210
- function withDiffOptions(yargs27) {
211
- return yargs27.option("diff", {
210
+ function withDiffOptions(yargs28) {
211
+ return yargs28.option("diff", {
212
212
  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
213
  default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
214
214
  type: "string",
@@ -295,6 +295,7 @@ async function* paginateAsync(fetchPage, options) {
295
295
  var defaultSyncConfiguration = {
296
296
  entitiesConfig: {},
297
297
  directory: "uniform-data",
298
+ allowEmptySource: false,
298
299
  format: "yaml",
299
300
  mode: "mirror"
300
301
  };
@@ -632,12 +633,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
632
633
  var AssetGetModule = {
633
634
  command: "get <id>",
634
635
  describe: "Get an asset",
635
- builder: (yargs27) => withConfiguration(
636
+ builder: (yargs28) => withConfiguration(
636
637
  withFormatOptions(
637
638
  withApiOptions(
638
639
  withProjectOptions(
639
640
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
640
- yargs27.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
641
+ yargs28.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
641
642
  )
642
643
  )
643
644
  )
@@ -658,7 +659,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
658
659
  var AssetListModule = {
659
660
  command: "list",
660
661
  describe: "List assets",
661
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
662
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
662
663
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
663
664
  const fetch3 = nodeFetchProxy(proxy);
664
665
  const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -669,6 +670,7 @@ var AssetListModule = {
669
670
 
670
671
  // src/commands/canvas/commands/asset/pull.ts
671
672
  import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
673
+ import { UncachedFileClient } from "@uniformdev/files";
672
674
 
673
675
  // src/files/index.ts
674
676
  import { preferredType } from "@thi.ng/mime";
@@ -679,20 +681,62 @@ import sizeOf from "image-size";
679
681
  import PQueue from "p-queue";
680
682
  import { dirname as dirname2, join as join2 } from "path";
681
683
  var FILES_DIRECTORY_NAME = "files";
684
+ var escapeRegExp = (string) => {
685
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
686
+ };
682
687
  var urlToHash = (url) => {
683
- const hash = createHash("sha256");
684
- hash.update(url);
685
- return hash.digest("hex");
688
+ return Buffer.from(
689
+ // We take only the first 64 characters of the pathname as
690
+ // that's enough to guarantee uniqueness
691
+ new URL(url).pathname.substring(0, 64)
692
+ ).toString("base64");
693
+ };
694
+ var hashToPartialPathname = (hash) => {
695
+ try {
696
+ return Buffer.from(hash, "base64").toString("utf8");
697
+ } catch {
698
+ return null;
699
+ }
700
+ };
701
+ var findUrlMatchingPartialPathname = (source, pathname) => {
702
+ const escapedPathname = escapeRegExp(pathname);
703
+ const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
704
+ const match = source.match(regex);
705
+ if (match && match[1]) {
706
+ return match[1];
707
+ }
708
+ return null;
686
709
  };
687
- var urlToFileName = (url) => {
688
- const fileName = urlToHash(url);
689
- const fileNameChunks = url.split(".");
690
- const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
710
+ var urlToFileExtension = (url) => {
711
+ try {
712
+ const urlObject = new URL(url);
713
+ const fileNameChunks = urlObject.pathname.split(".");
714
+ return fileNameChunks.length > 1 ? fileNameChunks.at(-1) ?? null : null;
715
+ } catch {
716
+ return null;
717
+ }
718
+ };
719
+ var urlToFileName = (url, hash) => {
720
+ const fileName = hash ?? urlToHash(url);
721
+ const fileExtension = urlToFileExtension(url);
691
722
  return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
692
723
  };
724
+ var getFilesDirectory = (directory) => {
725
+ const isPackage = isPathAPackageFile(directory);
726
+ return isPackage ? dirname2(directory) : (
727
+ // If we are syncing to a directory, we want to write all files into a
728
+ // top-lvl folder. That way any entities that contain files will sync to the
729
+ // same directory, so there is no duplication
730
+ join2(directory, "..")
731
+ );
732
+ };
733
+ var getUniformFileUrlMatches = (string) => {
734
+ return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
735
+ };
693
736
  var deleteDownloadedFileByUrl = async (url, options) => {
737
+ const writeDirectory = getFilesDirectory(options.directory);
694
738
  const fileName = urlToFileName(url);
695
- const fileToDelete = join2(options.directory, FILES_DIRECTORY_NAME, fileName);
739
+ const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
696
740
  try {
697
741
  await fsj.removeAsync(fileToDelete);
698
742
  } catch {
@@ -701,30 +745,43 @@ var deleteDownloadedFileByUrl = async (url, options) => {
701
745
  };
702
746
  var extractAndDownloadUniformFilesForObject = async (object, options) => {
703
747
  const objectAsString = JSON.stringify(object);
704
- const uniformFileUrlMatches = objectAsString.matchAll(
705
- /"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
706
- );
748
+ const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
749
+ const writeDirectory = getFilesDirectory(options.directory);
707
750
  if (uniformFileUrlMatches) {
708
751
  const fileDownloadQueue = new PQueue({ concurrency: 10 });
709
752
  for (const match of uniformFileUrlMatches) {
710
753
  const url = new URL(match[1]);
711
754
  fileDownloadQueue.add(async () => {
712
755
  try {
713
- const fetchUrl = `${url.origin}${url.pathname}?format=original`;
714
756
  const fileName = urlToFileName(url.toString());
715
757
  const fileAlreadyExists = await fsj.existsAsync(
716
- join2(options.directory, FILES_DIRECTORY_NAME, fileName)
758
+ join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
717
759
  );
718
760
  if (fileAlreadyExists) {
719
761
  return;
720
762
  }
763
+ const file = await options.fileClient.get({ url: url.toString() }).catch(() => null);
764
+ if (!file) {
765
+ console.warn(`Skipping file ${url} as it does not exist in the project anymore`);
766
+ return;
767
+ }
768
+ if (file.sourceId) {
769
+ try {
770
+ const hashAlreadyExists = await fsj.findAsync(join2(writeDirectory, FILES_DIRECTORY_NAME), {
771
+ matching: [file.sourceId, `${file.sourceId}.*`]
772
+ });
773
+ if (hashAlreadyExists.length > 0) {
774
+ return;
775
+ }
776
+ } catch {
777
+ }
778
+ }
779
+ const fetchUrl = `${url.origin}${url.pathname}?format=original`;
721
780
  const response = await fetch(fetchUrl);
722
781
  if (!response.ok) {
723
782
  return;
724
783
  }
725
784
  const fileBuffer = await response.arrayBuffer();
726
- const isPackage = isPathAPackageFile(options.directory);
727
- const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
728
785
  await fsj.writeAsync(join2(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
729
786
  } catch {
730
787
  console.warn(`Failed to download file ${url}`);
@@ -737,37 +794,45 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
737
794
  };
738
795
  var extractAndUploadUniformFilesForObject = async (object, options) => {
739
796
  let objectAsString = JSON.stringify(object);
740
- const uniformFileUrlMatches = objectAsString.matchAll(
741
- /"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
742
- );
797
+ const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
798
+ const writeDirectory = getFilesDirectory(options.directory);
799
+ const isPackage = isPathAPackageFile(options.directory);
800
+ const legacyWriteDirectory = isPackage ? dirname2(options.directory) : options.directory;
743
801
  if (uniformFileUrlMatches) {
744
802
  const fileUploadQueue = new PQueue({ concurrency: 3 });
745
803
  for (const match of uniformFileUrlMatches) {
746
804
  const url = match[1];
747
805
  const hash = urlToHash(url);
806
+ const legacyHash = legacyUrlToHash(url);
748
807
  fileUploadQueue.add(async () => {
749
808
  try {
750
809
  const fileAlreadyExistsChecks = await Promise.all([
751
810
  options.fileClient.get({ url }).catch(() => null),
752
- options.fileClient.get({ sourceId: hash }).catch(() => null)
811
+ options.fileClient.get({ sourceId: hash }).catch(() => null),
812
+ options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
753
813
  ]);
754
- if (fileAlreadyExistsChecks.some((check) => check !== null)) {
814
+ const file = fileAlreadyExistsChecks.find((check) => check !== null);
815
+ if (file) {
816
+ objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
755
817
  return;
756
818
  }
757
819
  const localFileName = urlToFileName(url);
758
- const fileExistsLocally = await fsj.existsAsync(
759
- join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
760
- );
820
+ let expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
821
+ let fileExistsLocally = await fsj.existsAsync(expectedFilePath);
822
+ if (!fileExistsLocally) {
823
+ const localFileName2 = legacyUrlToFileName(url);
824
+ expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
825
+ fileExistsLocally = await fsj.existsAsync(expectedFilePath);
826
+ }
761
827
  if (!fileExistsLocally) {
762
- console.warn(`Skipping file ${url} as we couldn't find a local copy`);
828
+ console.warn(
829
+ `Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
830
+ );
763
831
  return;
764
832
  }
765
- const fileBuffer = await fsj.readAsync(
766
- join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
767
- "buffer"
768
- );
833
+ const fileBuffer = await fsj.readAsync(expectedFilePath, "buffer");
769
834
  if (!fileBuffer) {
770
- console.warn(`Skipping file ${url} as we couldn't read it`);
835
+ console.warn(`Skipping file ${url} (${expectedFilePath}) as we couldn't read it`);
771
836
  return;
772
837
  }
773
838
  const fileName = getFileNameFromUrl(url);
@@ -799,20 +864,20 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
799
864
  }
800
865
  });
801
866
  if (!uploadResponse.ok) {
802
- console.warn(`Failed to upload file ${url}`);
867
+ console.warn(`Failed to upload file ${url} (${expectedFilePath})`);
803
868
  return;
804
869
  }
805
870
  const checkForFile = async () => {
806
- const file = await options.fileClient.get({ id });
807
- if (!file || file.state !== FILE_READY_STATE || !file.url) {
871
+ const file2 = await options.fileClient.get({ id });
872
+ if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
808
873
  await new Promise((resolve2) => setTimeout(resolve2, 500));
809
874
  return checkForFile();
810
875
  }
811
- return file.url;
876
+ return file2.url;
812
877
  };
813
878
  const abortTimeout = setTimeout(() => {
814
- throw new Error(`Failed to upload file ${url}`);
815
- }, 1e4);
879
+ throw new Error(`Failed to upload file ${url} (${expectedFilePath}) - upload timed out`);
880
+ }, 3e4);
816
881
  const uploadedFileUrl = await checkForFile();
817
882
  clearTimeout(abortTimeout);
818
883
  objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
@@ -827,19 +892,19 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
827
892
  };
828
893
  var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
829
894
  let objectAsString = JSON.stringify(object);
830
- const uniformFileUrlMatches = objectAsString.matchAll(
831
- /"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
832
- );
895
+ const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
833
896
  if (uniformFileUrlMatches) {
834
897
  const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
835
898
  for (const match of uniformFileUrlMatches) {
836
899
  const url = match[1];
837
900
  const hash = urlToHash(url);
901
+ const legacyHash = legacyUrlToHash(url);
838
902
  fileUrlReplacementQueue.add(async () => {
839
903
  try {
840
904
  const fileAlreadyExistsChecks = await Promise.all([
841
905
  options.fileClient.get({ url }).catch(() => null),
842
- options.fileClient.get({ sourceId: hash }).catch(() => null)
906
+ options.fileClient.get({ sourceId: hash }).catch(() => null),
907
+ options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
843
908
  ]);
844
909
  const file = fileAlreadyExistsChecks.find((check) => check !== null);
845
910
  if (!file) {
@@ -854,19 +919,74 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
854
919
  }
855
920
  return JSON.parse(objectAsString);
856
921
  };
922
+ var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
923
+ let sourceObjectAsString = JSON.stringify(sourceObject);
924
+ const targetObjectAsString = JSON.stringify(targetObject);
925
+ const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
926
+ const writeDirectory = getFilesDirectory(options.directory);
927
+ if (uniformFileUrlMatches) {
928
+ const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
929
+ for (const match of uniformFileUrlMatches) {
930
+ const url = match[1];
931
+ fileUrlReplacementQueue.add(async () => {
932
+ try {
933
+ const localFileName = urlToFileName(url);
934
+ const fileExistsLocally = await fsj.existsAsync(
935
+ join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
936
+ );
937
+ if (fileExistsLocally) {
938
+ return;
939
+ }
940
+ const file = await options.fileClient.get({ url }).catch(() => null);
941
+ if (!file || !file.sourceId) {
942
+ return;
943
+ }
944
+ const originalPartialPath = hashToPartialPathname(file.sourceId);
945
+ if (!originalPartialPath) {
946
+ return;
947
+ }
948
+ const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
949
+ if (!originalUrl) {
950
+ return;
951
+ }
952
+ sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
953
+ } catch {
954
+ }
955
+ });
956
+ }
957
+ await fileUrlReplacementQueue.onIdle();
958
+ }
959
+ return JSON.parse(sourceObjectAsString);
960
+ };
857
961
  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)) {
962
+ var _a;
963
+ if (!asset.asset.fields) {
964
+ return asset;
965
+ }
966
+ const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
967
+ if (!fileUrl) {
861
968
  return asset;
862
969
  }
863
970
  const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
864
971
  if (!file) {
865
972
  return asset;
866
973
  }
867
- asset.asset.fields.file.value = file.id;
974
+ asset.asset.fields.file = {
975
+ type: "file",
976
+ value: file.id
977
+ };
868
978
  return asset;
869
979
  };
980
+ var legacyUrlToHash = (url) => {
981
+ const hash = createHash("sha256");
982
+ hash.update(url);
983
+ return hash.digest("hex");
984
+ };
985
+ var legacyUrlToFileName = (url) => {
986
+ const fileName = legacyUrlToHash(url);
987
+ const fileExtension = urlToFileExtension(url);
988
+ return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
989
+ };
870
990
 
871
991
  // src/commands/canvas/assetEngineDataSource.ts
872
992
  import { convertAssetToPutAsset } from "@uniformdev/assets";
@@ -891,8 +1011,8 @@ function prepCompositionForDisk(composition) {
891
1011
  delete prepped.state;
892
1012
  return prepped;
893
1013
  }
894
- function withStateOptions(yargs27) {
895
- return yargs27.option("state", {
1014
+ function withStateOptions(yargs28) {
1015
+ return yargs28.option("state", {
896
1016
  type: "string",
897
1017
  describe: `Composition state to fetch.`,
898
1018
  choices: ["preview", "published"],
@@ -958,11 +1078,11 @@ function writeCanvasPackage(filename, packageContents) {
958
1078
  var AssetPullModule = {
959
1079
  command: "pull <directory>",
960
1080
  describe: "Pulls all assets to local files in a directory",
961
- builder: (yargs27) => withConfiguration(
1081
+ builder: (yargs28) => withConfiguration(
962
1082
  withApiOptions(
963
1083
  withProjectOptions(
964
1084
  withDiffOptions(
965
- yargs27.positional("directory", {
1085
+ yargs28.positional("directory", {
966
1086
  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
1087
  type: "string"
968
1088
  }).option("format", {
@@ -996,7 +1116,8 @@ var AssetPullModule = {
996
1116
  mode,
997
1117
  whatIf,
998
1118
  project: projectId,
999
- diff: diffMode
1119
+ diff: diffMode,
1120
+ allowEmptySource
1000
1121
  }) => {
1001
1122
  const fetch3 = nodeFetchProxy(proxy);
1002
1123
  const client = new UncachedAssetClient3({
@@ -1005,6 +1126,7 @@ var AssetPullModule = {
1005
1126
  fetch: fetch3,
1006
1127
  projectId
1007
1128
  });
1129
+ const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
1008
1130
  const source = createAssetEngineDataSource({ client });
1009
1131
  let target;
1010
1132
  const isPackage = isPathAPackageFile(directory);
@@ -1044,16 +1166,29 @@ var AssetPullModule = {
1044
1166
  target,
1045
1167
  mode,
1046
1168
  whatIf,
1047
- allowEmptySource: true,
1169
+ allowEmptySource: allowEmptySource ?? true,
1048
1170
  log: createSyncEngineConsoleLogger({ diffMode }),
1049
- onBeforeCompareObjects: async (sourceObject) => {
1171
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
1172
+ var _a, _b;
1050
1173
  delete sourceObject.object.asset._author;
1051
- return sourceObject;
1174
+ const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
1175
+ sourceObject,
1176
+ targetObject,
1177
+ {
1178
+ directory,
1179
+ fileClient
1180
+ }
1181
+ );
1182
+ 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) {
1183
+ targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
1184
+ }
1185
+ return sourceObjectWithPotentiallySwappedUrl;
1052
1186
  },
1053
1187
  onBeforeWriteObject: async (sourceObject) => {
1054
1188
  delete sourceObject.object.asset._author;
1055
1189
  return extractAndDownloadUniformFilesForObject(sourceObject, {
1056
- directory
1190
+ directory,
1191
+ fileClient
1057
1192
  });
1058
1193
  }
1059
1194
  });
@@ -1062,15 +1197,15 @@ var AssetPullModule = {
1062
1197
 
1063
1198
  // src/commands/canvas/commands/asset/push.ts
1064
1199
  import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
1065
- import { UncachedFileClient } from "@uniformdev/files";
1200
+ import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
1066
1201
  var AssetPushModule = {
1067
1202
  command: "push <directory>",
1068
1203
  describe: "Pushes all assets from files in a directory to Uniform",
1069
- builder: (yargs27) => withConfiguration(
1204
+ builder: (yargs28) => withConfiguration(
1070
1205
  withApiOptions(
1071
1206
  withProjectOptions(
1072
1207
  withDiffOptions(
1073
- yargs27.positional("directory", {
1208
+ yargs28.positional("directory", {
1074
1209
  describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
1075
1210
  type: "string"
1076
1211
  }).option("what-if", {
@@ -1097,7 +1232,8 @@ var AssetPushModule = {
1097
1232
  mode,
1098
1233
  whatIf,
1099
1234
  project: projectId,
1100
- diff: diffMode
1235
+ diff: diffMode,
1236
+ allowEmptySource
1101
1237
  }) => {
1102
1238
  const fetch3 = nodeFetchProxy(proxy);
1103
1239
  const client = new UncachedAssetClient4({
@@ -1123,12 +1259,13 @@ var AssetPushModule = {
1123
1259
  });
1124
1260
  }
1125
1261
  const target = createAssetEngineDataSource({ client });
1126
- const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
1262
+ const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
1127
1263
  await syncEngine({
1128
1264
  source,
1129
1265
  target,
1130
1266
  mode,
1131
1267
  whatIf,
1268
+ allowEmptySource,
1132
1269
  log: createSyncEngineConsoleLogger({ diffMode }),
1133
1270
  onBeforeCompareObjects: async (sourceObject, targetObject) => {
1134
1271
  if (targetObject) {
@@ -1168,9 +1305,9 @@ var AssetRemoveModule = {
1168
1305
  command: "remove <id>",
1169
1306
  aliases: ["delete", "rm"],
1170
1307
  describe: "Delete an asset",
1171
- builder: (yargs27) => withConfiguration(
1308
+ builder: (yargs28) => withConfiguration(
1172
1309
  withApiOptions(
1173
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
1310
+ withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
1174
1311
  )
1175
1312
  ),
1176
1313
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -1186,10 +1323,10 @@ var AssetUpdateModule = {
1186
1323
  command: "update <filename>",
1187
1324
  aliases: ["put"],
1188
1325
  describe: "Insert or update an asset",
1189
- builder: (yargs27) => withConfiguration(
1326
+ builder: (yargs28) => withConfiguration(
1190
1327
  withApiOptions(
1191
1328
  withProjectOptions(
1192
- yargs27.positional("filename", { demandOption: true, describe: "Asset file to put" })
1329
+ yargs28.positional("filename", { demandOption: true, describe: "Asset file to put" })
1193
1330
  )
1194
1331
  )
1195
1332
  ),
@@ -1205,7 +1342,7 @@ var AssetUpdateModule = {
1205
1342
  var AssetModule = {
1206
1343
  command: "asset <command>",
1207
1344
  describe: "Commands for Assets",
1208
- builder: (yargs27) => yargs27.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
1345
+ builder: (yargs28) => yargs28.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
1209
1346
  handler: () => {
1210
1347
  yargs.help();
1211
1348
  }
@@ -1219,11 +1356,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
1219
1356
  var CategoryGetModule = {
1220
1357
  command: "get <id>",
1221
1358
  describe: "Fetch a category",
1222
- builder: (yargs27) => withConfiguration(
1359
+ builder: (yargs28) => withConfiguration(
1223
1360
  withFormatOptions(
1224
1361
  withApiOptions(
1225
1362
  withProjectOptions(
1226
- yargs27.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
1363
+ yargs28.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
1227
1364
  )
1228
1365
  )
1229
1366
  )
@@ -1248,7 +1385,7 @@ var CategoryListModule = {
1248
1385
  command: "list",
1249
1386
  describe: "List categories",
1250
1387
  aliases: ["ls"],
1251
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27.options({}))))),
1388
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28.options({}))))),
1252
1389
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
1253
1390
  const fetch3 = nodeFetchProxy(proxy);
1254
1391
  const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1297,11 +1434,11 @@ function createCategoriesEngineDataSource({
1297
1434
  var CategoryPullModule = {
1298
1435
  command: "pull <directory>",
1299
1436
  describe: "Pulls all categories to local files in a directory",
1300
- builder: (yargs27) => withConfiguration(
1437
+ builder: (yargs28) => withConfiguration(
1301
1438
  withApiOptions(
1302
1439
  withProjectOptions(
1303
1440
  withDiffOptions(
1304
- yargs27.positional("directory", {
1441
+ yargs28.positional("directory", {
1305
1442
  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
1443
  type: "string"
1307
1444
  }).option("format", {
@@ -1335,7 +1472,8 @@ var CategoryPullModule = {
1335
1472
  mode,
1336
1473
  whatIf,
1337
1474
  project: projectId,
1338
- diff: diffMode
1475
+ diff: diffMode,
1476
+ allowEmptySource
1339
1477
  }) => {
1340
1478
  const fetch3 = nodeFetchProxy(proxy);
1341
1479
  const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1366,7 +1504,7 @@ var CategoryPullModule = {
1366
1504
  target,
1367
1505
  mode,
1368
1506
  whatIf,
1369
- allowEmptySource: true,
1507
+ allowEmptySource: allowEmptySource ?? true,
1370
1508
  log: createSyncEngineConsoleLogger({ diffMode })
1371
1509
  });
1372
1510
  }
@@ -1377,11 +1515,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
1377
1515
  var CategoryPushModule = {
1378
1516
  command: "push <directory>",
1379
1517
  describe: "Pushes all categories from files in a directory to Uniform Canvas",
1380
- builder: (yargs27) => withConfiguration(
1518
+ builder: (yargs28) => withConfiguration(
1381
1519
  withApiOptions(
1382
1520
  withProjectOptions(
1383
1521
  withDiffOptions(
1384
- yargs27.positional("directory", {
1522
+ yargs28.positional("directory", {
1385
1523
  describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
1386
1524
  type: "string"
1387
1525
  }).option("what-if", {
@@ -1408,7 +1546,8 @@ var CategoryPushModule = {
1408
1546
  mode,
1409
1547
  whatIf,
1410
1548
  project: projectId,
1411
- diff: diffMode
1549
+ diff: diffMode,
1550
+ allowEmptySource
1412
1551
  }) => {
1413
1552
  const fetch3 = nodeFetchProxy(proxy);
1414
1553
  const client = new UncachedCategoryClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1434,6 +1573,7 @@ var CategoryPushModule = {
1434
1573
  target,
1435
1574
  mode,
1436
1575
  whatIf,
1576
+ allowEmptySource,
1437
1577
  log: createSyncEngineConsoleLogger({ diffMode })
1438
1578
  });
1439
1579
  }
@@ -1445,10 +1585,10 @@ var CategoryRemoveModule = {
1445
1585
  command: "remove <id>",
1446
1586
  aliases: ["delete", "rm"],
1447
1587
  describe: "Delete a category",
1448
- builder: (yargs27) => withConfiguration(
1588
+ builder: (yargs28) => withConfiguration(
1449
1589
  withApiOptions(
1450
1590
  withProjectOptions(
1451
- yargs27.positional("id", { demandOption: true, describe: "Category UUID to delete" })
1591
+ yargs28.positional("id", { demandOption: true, describe: "Category UUID to delete" })
1452
1592
  )
1453
1593
  )
1454
1594
  ),
@@ -1465,10 +1605,10 @@ var CategoryUpdateModule = {
1465
1605
  command: "update <filename>",
1466
1606
  aliases: ["put"],
1467
1607
  describe: "Insert or update a category",
1468
- builder: (yargs27) => withConfiguration(
1608
+ builder: (yargs28) => withConfiguration(
1469
1609
  withApiOptions(
1470
1610
  withProjectOptions(
1471
- yargs27.positional("filename", { demandOption: true, describe: "Category file to put" })
1611
+ yargs28.positional("filename", { demandOption: true, describe: "Category file to put" })
1472
1612
  )
1473
1613
  )
1474
1614
  ),
@@ -1485,7 +1625,7 @@ var CategoryModule = {
1485
1625
  command: "category <command>",
1486
1626
  aliases: ["cat"],
1487
1627
  describe: "Commands for Canvas categories",
1488
- builder: (yargs27) => yargs27.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
1628
+ builder: (yargs28) => yargs28.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
1489
1629
  handler: () => {
1490
1630
  yargs2.help();
1491
1631
  }
@@ -1506,11 +1646,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
1506
1646
  var ComponentGetModule = {
1507
1647
  command: "get <id>",
1508
1648
  describe: "Fetch a component definition",
1509
- builder: (yargs27) => withConfiguration(
1649
+ builder: (yargs28) => withConfiguration(
1510
1650
  withFormatOptions(
1511
1651
  withApiOptions(
1512
1652
  withProjectOptions(
1513
- yargs27.positional("id", {
1653
+ yargs28.positional("id", {
1514
1654
  demandOption: true,
1515
1655
  describe: "Component definition public ID to fetch"
1516
1656
  })
@@ -1544,11 +1684,11 @@ var ComponentListModule = {
1544
1684
  command: "list",
1545
1685
  describe: "List component definitions",
1546
1686
  aliases: ["ls"],
1547
- builder: (yargs27) => withConfiguration(
1687
+ builder: (yargs28) => withConfiguration(
1548
1688
  withFormatOptions(
1549
1689
  withApiOptions(
1550
1690
  withProjectOptions(
1551
- yargs27.options({
1691
+ yargs28.options({
1552
1692
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
1553
1693
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
1554
1694
  })
@@ -1603,11 +1743,11 @@ function createComponentDefinitionEngineDataSource({
1603
1743
  var ComponentPullModule = {
1604
1744
  command: "pull <directory>",
1605
1745
  describe: "Pulls all component definitions to local files in a directory",
1606
- builder: (yargs27) => withConfiguration(
1746
+ builder: (yargs28) => withConfiguration(
1607
1747
  withApiOptions(
1608
1748
  withProjectOptions(
1609
1749
  withDiffOptions(
1610
- yargs27.positional("directory", {
1750
+ yargs28.positional("directory", {
1611
1751
  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
1752
  type: "string"
1613
1753
  }).option("format", {
@@ -1641,7 +1781,8 @@ var ComponentPullModule = {
1641
1781
  mode,
1642
1782
  whatIf,
1643
1783
  project: projectId,
1644
- diff: diffMode
1784
+ diff: diffMode,
1785
+ allowEmptySource
1645
1786
  }) => {
1646
1787
  const fetch3 = nodeFetchProxy(proxy);
1647
1788
  const client = new UncachedCanvasClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1673,7 +1814,7 @@ var ComponentPullModule = {
1673
1814
  target,
1674
1815
  mode,
1675
1816
  whatIf,
1676
- allowEmptySource: true,
1817
+ allowEmptySource: allowEmptySource ?? true,
1677
1818
  log: createSyncEngineConsoleLogger({ diffMode })
1678
1819
  });
1679
1820
  }
@@ -1684,11 +1825,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
1684
1825
  var ComponentPushModule = {
1685
1826
  command: "push <directory>",
1686
1827
  describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
1687
- builder: (yargs27) => withConfiguration(
1828
+ builder: (yargs28) => withConfiguration(
1688
1829
  withApiOptions(
1689
1830
  withProjectOptions(
1690
1831
  withDiffOptions(
1691
- yargs27.positional("directory", {
1832
+ yargs28.positional("directory", {
1692
1833
  describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
1693
1834
  type: "string"
1694
1835
  }).option("what-if", {
@@ -1715,7 +1856,8 @@ var ComponentPushModule = {
1715
1856
  mode,
1716
1857
  whatIf,
1717
1858
  project: projectId,
1718
- diff: diffMode
1859
+ diff: diffMode,
1860
+ allowEmptySource
1719
1861
  }) => {
1720
1862
  const fetch3 = nodeFetchProxy(proxy);
1721
1863
  const client = new UncachedCanvasClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -1742,6 +1884,7 @@ var ComponentPushModule = {
1742
1884
  target,
1743
1885
  mode,
1744
1886
  whatIf,
1887
+ allowEmptySource,
1745
1888
  log: createSyncEngineConsoleLogger({ diffMode })
1746
1889
  });
1747
1890
  }
@@ -1753,10 +1896,10 @@ var ComponentRemoveModule = {
1753
1896
  command: "remove <id>",
1754
1897
  aliases: ["delete", "rm"],
1755
1898
  describe: "Delete a component definition",
1756
- builder: (yargs27) => withConfiguration(
1899
+ builder: (yargs28) => withConfiguration(
1757
1900
  withApiOptions(
1758
1901
  withProjectOptions(
1759
- yargs27.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
1902
+ yargs28.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
1760
1903
  )
1761
1904
  )
1762
1905
  ),
@@ -1773,10 +1916,10 @@ var ComponentUpdateModule = {
1773
1916
  command: "update <filename>",
1774
1917
  aliases: ["put"],
1775
1918
  describe: "Insert or update a component definition",
1776
- builder: (yargs27) => withConfiguration(
1919
+ builder: (yargs28) => withConfiguration(
1777
1920
  withApiOptions(
1778
1921
  withProjectOptions(
1779
- yargs27.positional("filename", { demandOption: true, describe: "Component definition file to put" })
1922
+ yargs28.positional("filename", { demandOption: true, describe: "Component definition file to put" })
1780
1923
  )
1781
1924
  )
1782
1925
  ),
@@ -1793,7 +1936,7 @@ var ComponentModule = {
1793
1936
  command: "component <command>",
1794
1937
  aliases: ["def"],
1795
1938
  describe: "Commands for Canvas component definitions",
1796
- builder: (yargs27) => yargs27.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
1939
+ builder: (yargs28) => yargs28.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
1797
1940
  handler: () => {
1798
1941
  yargs3.help();
1799
1942
  }
@@ -1807,12 +1950,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
1807
1950
  var CompositionGetModule = {
1808
1951
  command: "get <id>",
1809
1952
  describe: "Fetch a composition",
1810
- builder: (yargs27) => withFormatOptions(
1953
+ builder: (yargs28) => withFormatOptions(
1811
1954
  withConfiguration(
1812
1955
  withApiOptions(
1813
1956
  withProjectOptions(
1814
1957
  withStateOptions(
1815
- yargs27.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
1958
+ yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
1816
1959
  resolvePatterns: {
1817
1960
  type: "boolean",
1818
1961
  default: false,
@@ -1883,12 +2026,12 @@ var CompositionListModule = {
1883
2026
  command: "list",
1884
2027
  describe: "List compositions",
1885
2028
  aliases: ["ls"],
1886
- builder: (yargs27) => withFormatOptions(
2029
+ builder: (yargs28) => withFormatOptions(
1887
2030
  withConfiguration(
1888
2031
  withApiOptions(
1889
2032
  withProjectOptions(
1890
2033
  withStateOptions(
1891
- yargs27.options({
2034
+ yargs28.options({
1892
2035
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
1893
2036
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
1894
2037
  resolvePatterns: {
@@ -2009,11 +2152,11 @@ function createComponentInstanceEngineDataSource({
2009
2152
  var CompositionPublishModule = {
2010
2153
  command: "publish [ids]",
2011
2154
  describe: "Publishes composition(s)",
2012
- builder: (yargs27) => withConfiguration(
2155
+ builder: (yargs28) => withConfiguration(
2013
2156
  withApiOptions(
2014
2157
  withProjectOptions(
2015
2158
  withDiffOptions(
2016
- yargs27.positional("ids", {
2159
+ yargs28.positional("ids", {
2017
2160
  describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
2018
2161
  type: "string"
2019
2162
  }).option("all", {
@@ -2085,15 +2228,16 @@ var CompositionPublishModule = {
2085
2228
 
2086
2229
  // src/commands/canvas/commands/composition/pull.ts
2087
2230
  import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
2231
+ import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
2088
2232
  var CompositionPullModule = {
2089
2233
  command: "pull <directory>",
2090
2234
  describe: "Pulls all compositions to local files in a directory",
2091
- builder: (yargs27) => withConfiguration(
2235
+ builder: (yargs28) => withConfiguration(
2092
2236
  withApiOptions(
2093
2237
  withProjectOptions(
2094
2238
  withStateOptions(
2095
2239
  withDiffOptions(
2096
- yargs27.positional("directory", {
2240
+ yargs28.positional("directory", {
2097
2241
  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
2242
  type: "string"
2099
2243
  }).option("format", {
@@ -2140,10 +2284,12 @@ var CompositionPullModule = {
2140
2284
  whatIf,
2141
2285
  state,
2142
2286
  project: projectId,
2143
- diff: diffMode
2287
+ diff: diffMode,
2288
+ allowEmptySource
2144
2289
  }) => {
2145
2290
  const fetch3 = nodeFetchProxy(proxy);
2146
2291
  const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
2292
+ const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
2147
2293
  const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
2148
2294
  const isPackage = isPathAPackageFile(directory);
2149
2295
  let target;
@@ -2171,11 +2317,18 @@ var CompositionPullModule = {
2171
2317
  target,
2172
2318
  mode,
2173
2319
  whatIf,
2174
- allowEmptySource: true,
2320
+ allowEmptySource: allowEmptySource ?? true,
2175
2321
  log: createSyncEngineConsoleLogger({ diffMode }),
2322
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
2323
+ return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
2324
+ directory,
2325
+ fileClient
2326
+ });
2327
+ },
2176
2328
  onBeforeWriteObject: async (sourceObject) => {
2177
2329
  return extractAndDownloadUniformFilesForObject(sourceObject, {
2178
- directory
2330
+ directory,
2331
+ fileClient
2179
2332
  });
2180
2333
  }
2181
2334
  });
@@ -2184,16 +2337,16 @@ var CompositionPullModule = {
2184
2337
 
2185
2338
  // src/commands/canvas/commands/composition/push.ts
2186
2339
  import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
2187
- import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
2340
+ import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
2188
2341
  var CompositionPushModule = {
2189
2342
  command: "push <directory>",
2190
2343
  describe: "Pushes all compositions from files in a directory to Uniform Canvas",
2191
- builder: (yargs27) => withConfiguration(
2344
+ builder: (yargs28) => withConfiguration(
2192
2345
  withApiOptions(
2193
2346
  withProjectOptions(
2194
2347
  withStateOptions(
2195
2348
  withDiffOptions(
2196
- yargs27.positional("directory", {
2349
+ yargs28.positional("directory", {
2197
2350
  describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
2198
2351
  type: "string"
2199
2352
  }).option("what-if", {
@@ -2233,7 +2386,8 @@ var CompositionPushModule = {
2233
2386
  project: projectId,
2234
2387
  onlyCompositions,
2235
2388
  onlyPatterns,
2236
- diff: diffMode
2389
+ diff: diffMode,
2390
+ allowEmptySource
2237
2391
  }) => {
2238
2392
  const fetch3 = nodeFetchProxy(proxy);
2239
2393
  const client = new UncachedCanvasClient11({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -2254,12 +2408,13 @@ var CompositionPushModule = {
2254
2408
  });
2255
2409
  }
2256
2410
  const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
2257
- const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
2411
+ const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
2258
2412
  await syncEngine({
2259
2413
  source,
2260
2414
  target,
2261
2415
  mode,
2262
2416
  whatIf,
2417
+ allowEmptySource,
2263
2418
  log: createSyncEngineConsoleLogger({ diffMode }),
2264
2419
  onBeforeCompareObjects: async (sourceObject) => {
2265
2420
  return swapOutUniformFileUrlsForTargetProject(sourceObject, {
@@ -2282,10 +2437,10 @@ var CompositionRemoveModule = {
2282
2437
  command: "remove <id>",
2283
2438
  aliases: ["delete", "rm"],
2284
2439
  describe: "Delete a composition",
2285
- builder: (yargs27) => withConfiguration(
2440
+ builder: (yargs28) => withConfiguration(
2286
2441
  withApiOptions(
2287
2442
  withProjectOptions(
2288
- yargs27.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
2443
+ yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
2289
2444
  )
2290
2445
  )
2291
2446
  ),
@@ -2302,10 +2457,10 @@ import { diffJson as diffJson2 } from "diff";
2302
2457
  var CompositionUnpublishModule = {
2303
2458
  command: "unpublish [ids]",
2304
2459
  describe: "Unpublish a composition(s)",
2305
- builder: (yargs27) => withConfiguration(
2460
+ builder: (yargs28) => withConfiguration(
2306
2461
  withApiOptions(
2307
2462
  withProjectOptions(
2308
- yargs27.positional("ids", {
2463
+ yargs28.positional("ids", {
2309
2464
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
2310
2465
  type: "string"
2311
2466
  }).option("all", {
@@ -2399,11 +2554,11 @@ var CompositionUpdateModule = {
2399
2554
  command: "update <filename>",
2400
2555
  aliases: ["put"],
2401
2556
  describe: "Insert or update a composition",
2402
- builder: (yargs27) => withConfiguration(
2557
+ builder: (yargs28) => withConfiguration(
2403
2558
  withApiOptions(
2404
2559
  withProjectOptions(
2405
2560
  withStateOptions(
2406
- yargs27.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
2561
+ yargs28.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
2407
2562
  )
2408
2563
  )
2409
2564
  )
@@ -2421,7 +2576,7 @@ var CompositionModule = {
2421
2576
  command: "composition <command>",
2422
2577
  describe: "Commands for Canvas compositions",
2423
2578
  aliases: ["comp"],
2424
- builder: (yargs27) => yargs27.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
2579
+ builder: (yargs28) => yargs28.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
2425
2580
  handler: () => {
2426
2581
  yargs4.help();
2427
2582
  }
@@ -2435,12 +2590,12 @@ import { ContentClient } from "@uniformdev/canvas";
2435
2590
  var ContentTypeGetModule = {
2436
2591
  command: "get <id>",
2437
2592
  describe: "Get a content type",
2438
- builder: (yargs27) => withConfiguration(
2593
+ builder: (yargs28) => withConfiguration(
2439
2594
  withFormatOptions(
2440
2595
  withApiOptions(
2441
2596
  withProjectOptions(
2442
2597
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2443
- yargs27.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
2598
+ yargs28.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
2444
2599
  )
2445
2600
  )
2446
2601
  )
@@ -2462,7 +2617,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
2462
2617
  var ContentTypeListModule = {
2463
2618
  command: "list",
2464
2619
  describe: "List content types",
2465
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
2620
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
2466
2621
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
2467
2622
  const fetch3 = nodeFetchProxy(proxy);
2468
2623
  const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
@@ -2509,11 +2664,11 @@ function createContentTypeEngineDataSource({
2509
2664
  var ContentTypePullModule = {
2510
2665
  command: "pull <directory>",
2511
2666
  describe: "Pulls all content types to local files in a directory",
2512
- builder: (yargs27) => withConfiguration(
2667
+ builder: (yargs28) => withConfiguration(
2513
2668
  withApiOptions(
2514
2669
  withProjectOptions(
2515
2670
  withDiffOptions(
2516
- yargs27.positional("directory", {
2671
+ yargs28.positional("directory", {
2517
2672
  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
2673
  type: "string"
2519
2674
  }).option("format", {
@@ -2547,7 +2702,8 @@ var ContentTypePullModule = {
2547
2702
  mode,
2548
2703
  whatIf,
2549
2704
  project: projectId,
2550
- diff: diffMode
2705
+ diff: diffMode,
2706
+ allowEmptySource
2551
2707
  }) => {
2552
2708
  const fetch3 = nodeFetchProxy(proxy);
2553
2709
  const client = new ContentClient3({
@@ -2584,7 +2740,7 @@ var ContentTypePullModule = {
2584
2740
  target,
2585
2741
  mode,
2586
2742
  whatIf,
2587
- allowEmptySource: true,
2743
+ allowEmptySource: allowEmptySource ?? true,
2588
2744
  log: createSyncEngineConsoleLogger({ diffMode })
2589
2745
  });
2590
2746
  }
@@ -2595,11 +2751,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
2595
2751
  var ContentTypePushModule = {
2596
2752
  command: "push <directory>",
2597
2753
  describe: "Pushes all content types from files in a directory to Uniform",
2598
- builder: (yargs27) => withConfiguration(
2754
+ builder: (yargs28) => withConfiguration(
2599
2755
  withApiOptions(
2600
2756
  withProjectOptions(
2601
2757
  withDiffOptions(
2602
- yargs27.positional("directory", {
2758
+ yargs28.positional("directory", {
2603
2759
  describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
2604
2760
  type: "string"
2605
2761
  }).option("what-if", {
@@ -2626,7 +2782,8 @@ var ContentTypePushModule = {
2626
2782
  mode,
2627
2783
  whatIf,
2628
2784
  project: projectId,
2629
- diff: diffMode
2785
+ diff: diffMode,
2786
+ allowEmptySource
2630
2787
  }) => {
2631
2788
  const fetch3 = nodeFetchProxy(proxy);
2632
2789
  const client = new ContentClient4({
@@ -2658,6 +2815,7 @@ var ContentTypePushModule = {
2658
2815
  target,
2659
2816
  mode,
2660
2817
  whatIf,
2818
+ allowEmptySource,
2661
2819
  log: createSyncEngineConsoleLogger({ diffMode })
2662
2820
  });
2663
2821
  }
@@ -2669,10 +2827,10 @@ var ContentTypeRemoveModule = {
2669
2827
  command: "remove <id>",
2670
2828
  aliases: ["delete", "rm"],
2671
2829
  describe: "Delete a content type",
2672
- builder: (yargs27) => withConfiguration(
2830
+ builder: (yargs28) => withConfiguration(
2673
2831
  withApiOptions(
2674
2832
  withProjectOptions(
2675
- yargs27.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
2833
+ yargs28.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
2676
2834
  )
2677
2835
  )
2678
2836
  ),
@@ -2689,10 +2847,10 @@ var ContentTypeUpdateModule = {
2689
2847
  command: "update <filename>",
2690
2848
  aliases: ["put"],
2691
2849
  describe: "Insert or update a content type",
2692
- builder: (yargs27) => withConfiguration(
2850
+ builder: (yargs28) => withConfiguration(
2693
2851
  withApiOptions(
2694
2852
  withProjectOptions(
2695
- yargs27.positional("filename", { demandOption: true, describe: "Content type file to put" })
2853
+ yargs28.positional("filename", { demandOption: true, describe: "Content type file to put" })
2696
2854
  )
2697
2855
  )
2698
2856
  ),
@@ -2709,7 +2867,7 @@ var ContentTypeModule = {
2709
2867
  command: "contenttype <command>",
2710
2868
  aliases: ["ct"],
2711
2869
  describe: "Commands for Content Types",
2712
- builder: (yargs27) => yargs27.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
2870
+ builder: (yargs28) => yargs28.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
2713
2871
  handler: () => {
2714
2872
  yargs5.help();
2715
2873
  }
@@ -2724,12 +2882,12 @@ var DataTypeGetModule = {
2724
2882
  command: "get <id>",
2725
2883
  describe: "Get a data type",
2726
2884
  aliases: ["ls"],
2727
- builder: (yargs27) => withConfiguration(
2885
+ builder: (yargs28) => withConfiguration(
2728
2886
  withFormatOptions(
2729
2887
  withApiOptions(
2730
2888
  withProjectOptions(
2731
2889
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2732
- yargs27.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
2890
+ yargs28.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
2733
2891
  )
2734
2892
  )
2735
2893
  )
@@ -2752,7 +2910,7 @@ var DataTypeListModule = {
2752
2910
  command: "list",
2753
2911
  describe: "List data types",
2754
2912
  aliases: ["ls"],
2755
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
2913
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
2756
2914
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
2757
2915
  const fetch3 = nodeFetchProxy(proxy);
2758
2916
  const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
@@ -2801,11 +2959,11 @@ function createDataTypeEngineDataSource({
2801
2959
  var DataTypePullModule = {
2802
2960
  command: "pull <directory>",
2803
2961
  describe: "Pulls all data types to local files in a directory",
2804
- builder: (yargs27) => withConfiguration(
2962
+ builder: (yargs28) => withConfiguration(
2805
2963
  withApiOptions(
2806
2964
  withProjectOptions(
2807
2965
  withDiffOptions(
2808
- yargs27.positional("directory", {
2966
+ yargs28.positional("directory", {
2809
2967
  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
2968
  type: "string"
2811
2969
  }).option("format", {
@@ -2839,7 +2997,8 @@ var DataTypePullModule = {
2839
2997
  mode,
2840
2998
  whatIf,
2841
2999
  project: projectId,
2842
- diff: diffMode
3000
+ diff: diffMode,
3001
+ allowEmptySource
2843
3002
  }) => {
2844
3003
  const fetch3 = nodeFetchProxy(proxy);
2845
3004
  const client = new DataTypeClient3({
@@ -2876,7 +3035,7 @@ var DataTypePullModule = {
2876
3035
  target,
2877
3036
  mode,
2878
3037
  whatIf,
2879
- allowEmptySource: true,
3038
+ allowEmptySource: allowEmptySource ?? true,
2880
3039
  log: createSyncEngineConsoleLogger({ diffMode })
2881
3040
  });
2882
3041
  }
@@ -2887,11 +3046,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
2887
3046
  var DataTypePushModule = {
2888
3047
  command: "push <directory>",
2889
3048
  describe: "Pushes all data types from files in a directory to Uniform",
2890
- builder: (yargs27) => withConfiguration(
3049
+ builder: (yargs28) => withConfiguration(
2891
3050
  withApiOptions(
2892
3051
  withProjectOptions(
2893
3052
  withDiffOptions(
2894
- yargs27.positional("directory", {
3053
+ yargs28.positional("directory", {
2895
3054
  describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
2896
3055
  type: "string"
2897
3056
  }).option("what-if", {
@@ -2918,7 +3077,8 @@ var DataTypePushModule = {
2918
3077
  mode,
2919
3078
  whatIf,
2920
3079
  project: projectId,
2921
- diff: diffMode
3080
+ diff: diffMode,
3081
+ allowEmptySource
2922
3082
  }) => {
2923
3083
  const fetch3 = nodeFetchProxy(proxy);
2924
3084
  const client = new DataTypeClient4({
@@ -2950,6 +3110,7 @@ var DataTypePushModule = {
2950
3110
  target,
2951
3111
  mode,
2952
3112
  whatIf,
3113
+ allowEmptySource,
2953
3114
  log: createSyncEngineConsoleLogger({ diffMode })
2954
3115
  });
2955
3116
  }
@@ -2961,10 +3122,10 @@ var DataTypeRemoveModule = {
2961
3122
  command: "remove <id>",
2962
3123
  aliases: ["delete", "rm"],
2963
3124
  describe: "Delete a data type",
2964
- builder: (yargs27) => withConfiguration(
3125
+ builder: (yargs28) => withConfiguration(
2965
3126
  withApiOptions(
2966
3127
  withProjectOptions(
2967
- yargs27.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
3128
+ yargs28.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
2968
3129
  )
2969
3130
  )
2970
3131
  ),
@@ -2981,10 +3142,10 @@ var DataTypeUpdateModule = {
2981
3142
  command: "update <filename>",
2982
3143
  aliases: ["put"],
2983
3144
  describe: "Insert or update a data type",
2984
- builder: (yargs27) => withConfiguration(
3145
+ builder: (yargs28) => withConfiguration(
2985
3146
  withApiOptions(
2986
3147
  withProjectOptions(
2987
- yargs27.positional("filename", { demandOption: true, describe: "Data type file to put" })
3148
+ yargs28.positional("filename", { demandOption: true, describe: "Data type file to put" })
2988
3149
  )
2989
3150
  )
2990
3151
  ),
@@ -3001,7 +3162,7 @@ var DataTypeModule = {
3001
3162
  command: "datatype <command>",
3002
3163
  aliases: ["dt"],
3003
3164
  describe: "Commands for Data Type definitions",
3004
- builder: (yargs27) => yargs27.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
3165
+ builder: (yargs28) => yargs28.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
3005
3166
  handler: () => {
3006
3167
  yargs6.help();
3007
3168
  }
@@ -3015,12 +3176,12 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
3015
3176
  var EntryGetModule = {
3016
3177
  command: "get <id>",
3017
3178
  describe: "Get an entry",
3018
- builder: (yargs27) => withConfiguration(
3179
+ builder: (yargs28) => withConfiguration(
3019
3180
  withFormatOptions(
3020
3181
  withApiOptions(
3021
3182
  withProjectOptions(
3022
3183
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3023
- yargs27.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
3184
+ yargs28.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
3024
3185
  )
3025
3186
  )
3026
3187
  )
@@ -3032,7 +3193,9 @@ var EntryGetModule = {
3032
3193
  offset: 0,
3033
3194
  limit: 1,
3034
3195
  entryIDs: [id],
3035
- skipOverridesResolution: true
3196
+ skipOverridesResolution: true,
3197
+ skipPatternResolution: true,
3198
+ skipDataResolution: true
3036
3199
  });
3037
3200
  if (res.entries.length !== 1) {
3038
3201
  throw new Error(`Entry with ID ${id} not found`);
@@ -3046,17 +3209,24 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
3046
3209
  var EntryListModule = {
3047
3210
  command: "list",
3048
3211
  describe: "List entries",
3049
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
3212
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
3050
3213
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3051
3214
  const fetch3 = nodeFetchProxy(proxy);
3052
3215
  const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3053
- const res = await client.getEntries({ offset: 0, limit: 1e3, skipOverridesResolution: true });
3216
+ const res = await client.getEntries({
3217
+ offset: 0,
3218
+ limit: 1e3,
3219
+ skipOverridesResolution: true,
3220
+ skipPatternResolution: true,
3221
+ skipDataResolution: true
3222
+ });
3054
3223
  emitWithFormat(res.entries, format, filename);
3055
3224
  }
3056
3225
  };
3057
3226
 
3058
3227
  // src/commands/canvas/commands/entry/pull.ts
3059
3228
  import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
3229
+ import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
3060
3230
 
3061
3231
  // src/commands/canvas/entryEngineDataSource.ts
3062
3232
  import { convertEntryToPutEntry } from "@uniformdev/canvas";
@@ -3077,6 +3247,7 @@ function createEntryEngineDataSource({
3077
3247
  limit: 1e3,
3078
3248
  skipDataResolution: true,
3079
3249
  skipOverridesResolution: true,
3250
+ skipPatternResolution: true,
3080
3251
  state: stateId,
3081
3252
  withComponentIDs: true
3082
3253
  });
@@ -3105,12 +3276,12 @@ function createEntryEngineDataSource({
3105
3276
  var EntryPullModule = {
3106
3277
  command: "pull <directory>",
3107
3278
  describe: "Pulls all entries to local files in a directory",
3108
- builder: (yargs27) => withConfiguration(
3279
+ builder: (yargs28) => withConfiguration(
3109
3280
  withApiOptions(
3110
3281
  withProjectOptions(
3111
3282
  withStateOptions(
3112
3283
  withDiffOptions(
3113
- yargs27.positional("directory", {
3284
+ yargs28.positional("directory", {
3114
3285
  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
3286
  type: "string"
3116
3287
  }).option("format", {
@@ -3146,7 +3317,8 @@ var EntryPullModule = {
3146
3317
  whatIf,
3147
3318
  state,
3148
3319
  project: projectId,
3149
- diff: diffMode
3320
+ diff: diffMode,
3321
+ allowEmptySource
3150
3322
  }) => {
3151
3323
  const fetch3 = nodeFetchProxy(proxy);
3152
3324
  const client = new ContentClient10({
@@ -3156,6 +3328,7 @@ var EntryPullModule = {
3156
3328
  projectId,
3157
3329
  bypassCache: true
3158
3330
  });
3331
+ const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
3159
3332
  const source = createEntryEngineDataSource({ client, state });
3160
3333
  let target;
3161
3334
  const isPackage = isPathAPackageFile(directory);
@@ -3183,23 +3356,36 @@ var EntryPullModule = {
3183
3356
  target,
3184
3357
  mode,
3185
3358
  whatIf,
3186
- allowEmptySource: true,
3187
- log: createSyncEngineConsoleLogger({ diffMode })
3359
+ allowEmptySource: allowEmptySource ?? true,
3360
+ log: createSyncEngineConsoleLogger({ diffMode }),
3361
+ onBeforeCompareObjects: async (sourceObject, targetObject) => {
3362
+ return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
3363
+ directory,
3364
+ fileClient
3365
+ });
3366
+ },
3367
+ onBeforeWriteObject: async (sourceObject) => {
3368
+ return extractAndDownloadUniformFilesForObject(sourceObject, {
3369
+ directory,
3370
+ fileClient
3371
+ });
3372
+ }
3188
3373
  });
3189
3374
  }
3190
3375
  };
3191
3376
 
3192
3377
  // src/commands/canvas/commands/entry/push.ts
3193
3378
  import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
3379
+ import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
3194
3380
  var EntryPushModule = {
3195
3381
  command: "push <directory>",
3196
3382
  describe: "Pushes all entries from files in a directory to Uniform",
3197
- builder: (yargs27) => withConfiguration(
3383
+ builder: (yargs28) => withConfiguration(
3198
3384
  withApiOptions(
3199
3385
  withProjectOptions(
3200
3386
  withStateOptions(
3201
3387
  withDiffOptions(
3202
- yargs27.positional("directory", {
3388
+ yargs28.positional("directory", {
3203
3389
  describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
3204
3390
  type: "string"
3205
3391
  }).option("what-if", {
@@ -3228,7 +3414,8 @@ var EntryPushModule = {
3228
3414
  whatIf,
3229
3415
  state,
3230
3416
  project: projectId,
3231
- diff: diffMode
3417
+ diff: diffMode,
3418
+ allowEmptySource
3232
3419
  }) => {
3233
3420
  const fetch3 = nodeFetchProxy(proxy);
3234
3421
  const client = new ContentClient11({
@@ -3255,12 +3442,25 @@ var EntryPushModule = {
3255
3442
  });
3256
3443
  }
3257
3444
  const target = createEntryEngineDataSource({ client, state });
3445
+ const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
3258
3446
  await syncEngine({
3259
3447
  source,
3260
3448
  target,
3261
3449
  mode,
3262
3450
  whatIf,
3263
- log: createSyncEngineConsoleLogger({ diffMode })
3451
+ allowEmptySource,
3452
+ log: createSyncEngineConsoleLogger({ diffMode }),
3453
+ onBeforeCompareObjects: async (sourceObject) => {
3454
+ return swapOutUniformFileUrlsForTargetProject(sourceObject, {
3455
+ fileClient
3456
+ });
3457
+ },
3458
+ onBeforeWriteObject: async (sourceObject) => {
3459
+ return extractAndUploadUniformFilesForObject(sourceObject, {
3460
+ directory,
3461
+ fileClient
3462
+ });
3463
+ }
3264
3464
  });
3265
3465
  }
3266
3466
  };
@@ -3271,10 +3471,10 @@ var EntryRemoveModule = {
3271
3471
  command: "remove <id>",
3272
3472
  aliases: ["delete", "rm"],
3273
3473
  describe: "Delete an entry",
3274
- builder: (yargs27) => withConfiguration(
3474
+ builder: (yargs28) => withConfiguration(
3275
3475
  withApiOptions(
3276
3476
  withProjectOptions(
3277
- yargs27.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
3477
+ yargs28.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
3278
3478
  )
3279
3479
  )
3280
3480
  ),
@@ -3291,10 +3491,10 @@ var EntryUpdateModule = {
3291
3491
  command: "update <filename>",
3292
3492
  aliases: ["put"],
3293
3493
  describe: "Insert or update an entry",
3294
- builder: (yargs27) => withConfiguration(
3494
+ builder: (yargs28) => withConfiguration(
3295
3495
  withApiOptions(
3296
3496
  withProjectOptions(
3297
- yargs27.positional("filename", { demandOption: true, describe: "Entry file to put" })
3497
+ yargs28.positional("filename", { demandOption: true, describe: "Entry file to put" })
3298
3498
  )
3299
3499
  )
3300
3500
  ),
@@ -3310,15 +3510,221 @@ var EntryUpdateModule = {
3310
3510
  var EntryModule = {
3311
3511
  command: "entry <command>",
3312
3512
  describe: "Commands for Entries",
3313
- builder: (yargs27) => yargs27.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
3513
+ builder: (yargs28) => yargs28.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
3314
3514
  handler: () => {
3315
3515
  yargs7.help();
3316
3516
  }
3317
3517
  };
3318
3518
 
3319
- // src/commands/canvas/commands/pattern.ts
3519
+ // src/commands/canvas/commands/locale.ts
3320
3520
  import yargs8 from "yargs";
3321
3521
 
3522
+ // src/commands/canvas/commands/locale/pull.ts
3523
+ import { LocaleClient } from "@uniformdev/canvas";
3524
+
3525
+ // src/commands/canvas/localesEngineDataSource.ts
3526
+ function createLocaleEngineDataSource({
3527
+ client
3528
+ }) {
3529
+ async function* getObjects() {
3530
+ const locales = (await client.get()).results;
3531
+ for await (const locale of locales) {
3532
+ const result = {
3533
+ id: locale.locale,
3534
+ displayName: locale.displayName,
3535
+ providerId: locale.locale,
3536
+ object: locale
3537
+ };
3538
+ yield result;
3539
+ }
3540
+ }
3541
+ return {
3542
+ objects: getObjects(),
3543
+ deleteObject: async (providerId) => {
3544
+ await client.remove({ locale: providerId });
3545
+ },
3546
+ writeObject: async (object) => {
3547
+ await client.upsert({
3548
+ locale: object.object
3549
+ });
3550
+ }
3551
+ };
3552
+ }
3553
+
3554
+ // src/commands/canvas/commands/locale/pull.ts
3555
+ var LocalePullModule = {
3556
+ command: "pull <directory>",
3557
+ describe: "Pulls all locales to local files in a directory",
3558
+ builder: (yargs28) => withConfiguration(
3559
+ withApiOptions(
3560
+ withProjectOptions(
3561
+ withDiffOptions(
3562
+ yargs28.positional("directory", {
3563
+ 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.",
3564
+ type: "string"
3565
+ }).option("format", {
3566
+ alias: ["f"],
3567
+ describe: "Output format",
3568
+ default: "yaml",
3569
+ choices: ["yaml", "json"],
3570
+ type: "string"
3571
+ }).option("what-if", {
3572
+ alias: ["w"],
3573
+ describe: "What-if mode reports what would be done but changes no files",
3574
+ default: false,
3575
+ type: "boolean"
3576
+ }).option("mode", {
3577
+ alias: ["m"],
3578
+ 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',
3579
+ choices: ["create", "createOrUpdate", "mirror"],
3580
+ default: "mirror",
3581
+ type: "string"
3582
+ })
3583
+ )
3584
+ )
3585
+ )
3586
+ ),
3587
+ handler: async ({
3588
+ apiHost,
3589
+ apiKey,
3590
+ proxy,
3591
+ directory,
3592
+ format,
3593
+ mode,
3594
+ whatIf,
3595
+ project: projectId,
3596
+ diff: diffMode,
3597
+ allowEmptySource
3598
+ }) => {
3599
+ const fetch3 = nodeFetchProxy(proxy);
3600
+ const client = new LocaleClient({
3601
+ apiKey,
3602
+ apiHost,
3603
+ fetch: fetch3,
3604
+ projectId,
3605
+ bypassCache: true
3606
+ });
3607
+ const source = createLocaleEngineDataSource({ client });
3608
+ let target;
3609
+ const isPackage = isPathAPackageFile(directory);
3610
+ if (isPackage) {
3611
+ const packageContents = readCanvasPackage(directory, false);
3612
+ target = await createArraySyncEngineDataSource({
3613
+ objects: packageContents.locales ?? [],
3614
+ selectIdentifier: (i) => i.locale,
3615
+ selectDisplayName: (i) => i.displayName,
3616
+ onSyncComplete: async (_, synced) => {
3617
+ packageContents.locales = synced;
3618
+ writeCanvasPackage(directory, packageContents);
3619
+ }
3620
+ });
3621
+ } else {
3622
+ target = await createFileSyncEngineDataSource({
3623
+ directory,
3624
+ selectIdentifier: (i) => i.locale,
3625
+ selectDisplayName: (i) => i.displayName,
3626
+ format
3627
+ });
3628
+ }
3629
+ await syncEngine({
3630
+ source,
3631
+ target,
3632
+ mode,
3633
+ whatIf,
3634
+ allowEmptySource: allowEmptySource ?? true,
3635
+ log: createSyncEngineConsoleLogger({ diffMode })
3636
+ });
3637
+ }
3638
+ };
3639
+
3640
+ // src/commands/canvas/commands/locale/push.ts
3641
+ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
3642
+ var LocalePushModule = {
3643
+ command: "push <directory>",
3644
+ describe: "Pushes all locales from files in a directory to Uniform",
3645
+ builder: (yargs28) => withConfiguration(
3646
+ withApiOptions(
3647
+ withProjectOptions(
3648
+ withDiffOptions(
3649
+ yargs28.positional("directory", {
3650
+ describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
3651
+ type: "string"
3652
+ }).option("what-if", {
3653
+ alias: ["w"],
3654
+ describe: "What-if mode reports what would be done but changes nothing",
3655
+ default: false,
3656
+ type: "boolean"
3657
+ }).option("mode", {
3658
+ alias: ["m"],
3659
+ 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',
3660
+ choices: ["create", "createOrUpdate", "mirror"],
3661
+ default: "mirror",
3662
+ type: "string"
3663
+ })
3664
+ )
3665
+ )
3666
+ )
3667
+ ),
3668
+ handler: async ({
3669
+ apiHost,
3670
+ apiKey,
3671
+ proxy,
3672
+ directory,
3673
+ mode,
3674
+ whatIf,
3675
+ project: projectId,
3676
+ diff: diffMode,
3677
+ allowEmptySource
3678
+ }) => {
3679
+ const fetch3 = nodeFetchProxy(proxy);
3680
+ const client = new LocaleClient2({
3681
+ apiKey,
3682
+ apiHost,
3683
+ fetch: fetch3,
3684
+ projectId,
3685
+ bypassCache: true
3686
+ });
3687
+ let source;
3688
+ const isPackage = isPathAPackageFile(directory);
3689
+ if (isPackage) {
3690
+ const packageContents = readCanvasPackage(directory, true);
3691
+ source = await createArraySyncEngineDataSource({
3692
+ objects: packageContents.locales ?? [],
3693
+ selectIdentifier: (locale) => locale.locale,
3694
+ selectDisplayName: (locale) => locale.displayName
3695
+ });
3696
+ } else {
3697
+ source = await createFileSyncEngineDataSource({
3698
+ directory,
3699
+ selectIdentifier: (locale) => locale.locale,
3700
+ selectDisplayName: (locale) => locale.displayName
3701
+ });
3702
+ }
3703
+ const target = createLocaleEngineDataSource({ client });
3704
+ await syncEngine({
3705
+ source,
3706
+ target,
3707
+ mode,
3708
+ whatIf,
3709
+ allowEmptySource,
3710
+ log: createSyncEngineConsoleLogger({ diffMode })
3711
+ });
3712
+ }
3713
+ };
3714
+
3715
+ // src/commands/canvas/commands/locale.ts
3716
+ var LocaleModule = {
3717
+ command: "locale <command>",
3718
+ describe: "Commands for locale definitions",
3719
+ builder: (yargs28) => yargs28.command(LocalePullModule).command(LocalePushModule),
3720
+ handler: () => {
3721
+ yargs8.help();
3722
+ }
3723
+ };
3724
+
3725
+ // src/commands/canvas/commands/pattern.ts
3726
+ import yargs9 from "yargs";
3727
+
3322
3728
  // src/commands/canvas/commands/pattern/get.ts
3323
3729
  var PatternGetModule = {
3324
3730
  ...CompositionGetModule,
@@ -3329,12 +3735,12 @@ var PatternGetModule = {
3329
3735
  var PatternListModule = {
3330
3736
  ...CompositionListModule,
3331
3737
  describe: "List patterns",
3332
- builder: (yargs27) => withFormatOptions(
3738
+ builder: (yargs28) => withFormatOptions(
3333
3739
  withConfiguration(
3334
3740
  withApiOptions(
3335
3741
  withProjectOptions(
3336
3742
  withStateOptions(
3337
- yargs27.options({
3743
+ yargs28.options({
3338
3744
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
3339
3745
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
3340
3746
  resolvePatterns: {
@@ -3372,11 +3778,11 @@ var PatternListModule = {
3372
3778
  var PatternPublishModule = {
3373
3779
  ...CompositionPublishModule,
3374
3780
  describe: "Publishes pattern(s)",
3375
- builder: (yargs27) => withConfiguration(
3781
+ builder: (yargs28) => withConfiguration(
3376
3782
  withApiOptions(
3377
3783
  withProjectOptions(
3378
3784
  withDiffOptions(
3379
- yargs27.positional("ids", {
3785
+ yargs28.positional("ids", {
3380
3786
  describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
3381
3787
  type: "string"
3382
3788
  }).option("all", {
@@ -3414,12 +3820,12 @@ var PatternPublishModule = {
3414
3820
  var PatternPullModule = {
3415
3821
  ...CompositionPullModule,
3416
3822
  describe: "Pulls all patterns to local files in a directory",
3417
- builder: (yargs27) => withConfiguration(
3823
+ builder: (yargs28) => withConfiguration(
3418
3824
  withApiOptions(
3419
3825
  withProjectOptions(
3420
3826
  withStateOptions(
3421
3827
  withDiffOptions(
3422
- yargs27.positional("directory", {
3828
+ yargs28.positional("directory", {
3423
3829
  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
3830
  type: "string"
3425
3831
  }).option("format", {
@@ -3457,12 +3863,12 @@ var PatternPullModule = {
3457
3863
  var PatternPushModule = {
3458
3864
  ...CompositionPushModule,
3459
3865
  describe: "Pushes all patterns from files in a directory to Uniform Canvas",
3460
- builder: (yargs27) => withConfiguration(
3866
+ builder: (yargs28) => withConfiguration(
3461
3867
  withApiOptions(
3462
3868
  withProjectOptions(
3463
3869
  withStateOptions(
3464
3870
  withDiffOptions(
3465
- yargs27.positional("directory", {
3871
+ yargs28.positional("directory", {
3466
3872
  describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
3467
3873
  type: "string"
3468
3874
  }).option("what-if", {
@@ -3500,10 +3906,10 @@ var PatternRemoveModule = {
3500
3906
  var PatternUnpublishModule = {
3501
3907
  command: "unpublish [ids]",
3502
3908
  describe: "Unpublish a pattern(s)",
3503
- builder: (yargs27) => withConfiguration(
3909
+ builder: (yargs28) => withConfiguration(
3504
3910
  withApiOptions(
3505
3911
  withProjectOptions(
3506
- yargs27.positional("ids", {
3912
+ yargs28.positional("ids", {
3507
3913
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
3508
3914
  type: "string"
3509
3915
  }).option("all", {
@@ -3542,26 +3948,26 @@ var PatternUpdateModule = {
3542
3948
  var PatternModule = {
3543
3949
  command: "pattern <command>",
3544
3950
  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(),
3951
+ builder: (yargs28) => yargs28.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
3546
3952
  handler: () => {
3547
- yargs8.help();
3953
+ yargs9.help();
3548
3954
  }
3549
3955
  };
3550
3956
 
3551
3957
  // src/commands/canvas/commands/prompts.ts
3552
- import yargs9 from "yargs";
3958
+ import yargs10 from "yargs";
3553
3959
 
3554
3960
  // src/commands/canvas/commands/prompts/get.ts
3555
3961
  import { PromptClient } from "@uniformdev/canvas";
3556
3962
  var PromptGetModule = {
3557
3963
  command: "get <id>",
3558
3964
  describe: "Get a prompt",
3559
- builder: (yargs27) => withConfiguration(
3965
+ builder: (yargs28) => withConfiguration(
3560
3966
  withFormatOptions(
3561
3967
  withApiOptions(
3562
3968
  withProjectOptions(
3563
3969
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3564
- yargs27.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
3970
+ yargs28.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
3565
3971
  )
3566
3972
  )
3567
3973
  )
@@ -3582,7 +3988,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
3582
3988
  var PromptListModule = {
3583
3989
  command: "list",
3584
3990
  describe: "List prompts",
3585
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
3991
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
3586
3992
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3587
3993
  const fetch3 = nodeFetchProxy(proxy);
3588
3994
  const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
@@ -3629,12 +4035,12 @@ function createPromptEngineDataSource({
3629
4035
  var PromptPullModule = {
3630
4036
  command: "pull <directory>",
3631
4037
  describe: "Pulls all entries to local files in a directory",
3632
- builder: (yargs27) => withConfiguration(
4038
+ builder: (yargs28) => withConfiguration(
3633
4039
  withApiOptions(
3634
4040
  withProjectOptions(
3635
4041
  withStateOptions(
3636
4042
  withDiffOptions(
3637
- yargs27.positional("directory", {
4043
+ yargs28.positional("directory", {
3638
4044
  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
4045
  type: "string"
3640
4046
  }).option("format", {
@@ -3669,7 +4075,8 @@ var PromptPullModule = {
3669
4075
  mode,
3670
4076
  whatIf,
3671
4077
  project: projectId,
3672
- diff: diffMode
4078
+ diff: diffMode,
4079
+ allowEmptySource
3673
4080
  }) => {
3674
4081
  const fetch3 = nodeFetchProxy(proxy);
3675
4082
  const client = new PromptClient3({
@@ -3706,7 +4113,7 @@ var PromptPullModule = {
3706
4113
  target,
3707
4114
  mode,
3708
4115
  whatIf,
3709
- allowEmptySource: true,
4116
+ allowEmptySource: allowEmptySource ?? true,
3710
4117
  log: createSyncEngineConsoleLogger({ diffMode })
3711
4118
  });
3712
4119
  }
@@ -3717,12 +4124,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
3717
4124
  var PromptPushModule = {
3718
4125
  command: "push <directory>",
3719
4126
  describe: "Pushes all prompts from files in a directory to Uniform",
3720
- builder: (yargs27) => withConfiguration(
4127
+ builder: (yargs28) => withConfiguration(
3721
4128
  withApiOptions(
3722
4129
  withProjectOptions(
3723
4130
  withStateOptions(
3724
4131
  withDiffOptions(
3725
- yargs27.positional("directory", {
4132
+ yargs28.positional("directory", {
3726
4133
  describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
3727
4134
  type: "string"
3728
4135
  }).option("what-if", {
@@ -3750,7 +4157,8 @@ var PromptPushModule = {
3750
4157
  mode,
3751
4158
  whatIf,
3752
4159
  project: projectId,
3753
- diff: diffMode
4160
+ diff: diffMode,
4161
+ allowEmptySource
3754
4162
  }) => {
3755
4163
  const fetch3 = nodeFetchProxy(proxy);
3756
4164
  const client = new PromptClient4({
@@ -3782,6 +4190,7 @@ var PromptPushModule = {
3782
4190
  target,
3783
4191
  mode,
3784
4192
  whatIf,
4193
+ allowEmptySource,
3785
4194
  log: createSyncEngineConsoleLogger({ diffMode })
3786
4195
  });
3787
4196
  }
@@ -3793,9 +4202,9 @@ var PromptRemoveModule = {
3793
4202
  command: "remove <id>",
3794
4203
  aliases: ["delete", "rm"],
3795
4204
  describe: "Delete a prompt",
3796
- builder: (yargs27) => withConfiguration(
4205
+ builder: (yargs28) => withConfiguration(
3797
4206
  withApiOptions(
3798
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
4207
+ withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
3799
4208
  )
3800
4209
  ),
3801
4210
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -3811,10 +4220,10 @@ var PromptUpdateModule = {
3811
4220
  command: "update <filename>",
3812
4221
  aliases: ["put"],
3813
4222
  describe: "Insert or update a prompt",
3814
- builder: (yargs27) => withConfiguration(
4223
+ builder: (yargs28) => withConfiguration(
3815
4224
  withApiOptions(
3816
4225
  withProjectOptions(
3817
- yargs27.positional("filename", { demandOption: true, describe: "Prompt file to put" })
4226
+ yargs28.positional("filename", { demandOption: true, describe: "Prompt file to put" })
3818
4227
  )
3819
4228
  )
3820
4229
  ),
@@ -3831,9 +4240,9 @@ var PromptModule = {
3831
4240
  command: "prompt <command>",
3832
4241
  aliases: ["dt"],
3833
4242
  describe: "Commands for AI Prompt definitions",
3834
- builder: (yargs27) => yargs27.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
4243
+ builder: (yargs28) => yargs28.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
3835
4244
  handler: () => {
3836
- yargs9.help();
4245
+ yargs10.help();
3837
4246
  }
3838
4247
  };
3839
4248
 
@@ -3842,28 +4251,28 @@ var CanvasCommand = {
3842
4251
  command: "canvas <command>",
3843
4252
  aliases: ["cv", "pm", "presentation"],
3844
4253
  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(),
4254
+ builder: (yargs28) => yargs28.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).command(PromptModule).command(AssetModule).command(LocaleModule).demandCommand(),
3846
4255
  handler: () => {
3847
- yargs10.showHelp();
4256
+ yargs11.showHelp();
3848
4257
  }
3849
4258
  };
3850
4259
 
3851
4260
  // src/commands/context/index.ts
3852
- import yargs17 from "yargs";
4261
+ import yargs18 from "yargs";
3853
4262
 
3854
4263
  // src/commands/context/commands/aggregate.ts
3855
- import yargs11 from "yargs";
4264
+ import yargs12 from "yargs";
3856
4265
 
3857
4266
  // src/commands/context/commands/aggregate/get.ts
3858
4267
  import { UncachedAggregateClient } from "@uniformdev/context/api";
3859
4268
  var AggregateGetModule = {
3860
4269
  command: "get <id>",
3861
4270
  describe: "Fetch an aggregate",
3862
- builder: (yargs27) => withConfiguration(
4271
+ builder: (yargs28) => withConfiguration(
3863
4272
  withFormatOptions(
3864
4273
  withApiOptions(
3865
4274
  withProjectOptions(
3866
- yargs27.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
4275
+ yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
3867
4276
  )
3868
4277
  )
3869
4278
  )
@@ -3887,7 +4296,7 @@ var AggregateListModule = {
3887
4296
  command: "list",
3888
4297
  describe: "List aggregates",
3889
4298
  aliases: ["ls"],
3890
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
4299
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
3891
4300
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3892
4301
  const fetch3 = nodeFetchProxy(proxy);
3893
4302
  const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -3953,11 +4362,11 @@ function writeContextPackage(filename, packageContents) {
3953
4362
  var AggregatePullModule = {
3954
4363
  command: "pull <directory>",
3955
4364
  describe: "Pulls all aggregates to local files in a directory",
3956
- builder: (yargs27) => withConfiguration(
4365
+ builder: (yargs28) => withConfiguration(
3957
4366
  withApiOptions(
3958
4367
  withProjectOptions(
3959
4368
  withDiffOptions(
3960
- yargs27.positional("directory", {
4369
+ yargs28.positional("directory", {
3961
4370
  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
4371
  type: "string"
3963
4372
  }).option("format", {
@@ -3991,7 +4400,8 @@ var AggregatePullModule = {
3991
4400
  mode,
3992
4401
  whatIf,
3993
4402
  project: projectId,
3994
- diff: diffMode
4403
+ diff: diffMode,
4404
+ allowEmptySource
3995
4405
  }) => {
3996
4406
  const fetch3 = nodeFetchProxy(proxy);
3997
4407
  const client = new UncachedAggregateClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4022,6 +4432,7 @@ var AggregatePullModule = {
4022
4432
  target,
4023
4433
  mode,
4024
4434
  whatIf,
4435
+ allowEmptySource,
4025
4436
  log: createSyncEngineConsoleLogger({ diffMode })
4026
4437
  });
4027
4438
  }
@@ -4032,11 +4443,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
4032
4443
  var AggregatePushModule = {
4033
4444
  command: "push <directory>",
4034
4445
  describe: "Pushes all aggregates from files in a directory or package to Uniform",
4035
- builder: (yargs27) => withConfiguration(
4446
+ builder: (yargs28) => withConfiguration(
4036
4447
  withApiOptions(
4037
4448
  withProjectOptions(
4038
4449
  withDiffOptions(
4039
- yargs27.positional("directory", {
4450
+ yargs28.positional("directory", {
4040
4451
  describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
4041
4452
  type: "string"
4042
4453
  }).option("what-if", {
@@ -4063,7 +4474,8 @@ var AggregatePushModule = {
4063
4474
  mode,
4064
4475
  whatIf,
4065
4476
  project: projectId,
4066
- diff: diffMode
4477
+ diff: diffMode,
4478
+ allowEmptySource
4067
4479
  }) => {
4068
4480
  const fetch3 = nodeFetchProxy(proxy);
4069
4481
  const client = new UncachedAggregateClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4089,6 +4501,7 @@ var AggregatePushModule = {
4089
4501
  target,
4090
4502
  mode,
4091
4503
  whatIf,
4504
+ allowEmptySource,
4092
4505
  log: createSyncEngineConsoleLogger({ diffMode })
4093
4506
  });
4094
4507
  await target.complete();
@@ -4101,10 +4514,10 @@ var AggregateRemoveModule = {
4101
4514
  command: "remove <id>",
4102
4515
  aliases: ["delete", "rm"],
4103
4516
  describe: "Delete an aggregate",
4104
- builder: (yargs27) => withConfiguration(
4517
+ builder: (yargs28) => withConfiguration(
4105
4518
  withApiOptions(
4106
4519
  withProjectOptions(
4107
- yargs27.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
4520
+ yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
4108
4521
  )
4109
4522
  )
4110
4523
  ),
@@ -4121,10 +4534,10 @@ var AggregateUpdateModule = {
4121
4534
  command: "update <filename>",
4122
4535
  aliases: ["put"],
4123
4536
  describe: "Insert or update an aggregate",
4124
- builder: (yargs27) => withConfiguration(
4537
+ builder: (yargs28) => withConfiguration(
4125
4538
  withApiOptions(
4126
4539
  withProjectOptions(
4127
- yargs27.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
4540
+ yargs28.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
4128
4541
  )
4129
4542
  )
4130
4543
  ),
@@ -4141,25 +4554,25 @@ var AggregateModule = {
4141
4554
  command: "aggregate <command>",
4142
4555
  aliases: ["agg", "intent", "audience"],
4143
4556
  describe: "Commands for Context aggregates (intents, audiences)",
4144
- builder: (yargs27) => yargs27.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
4557
+ builder: (yargs28) => yargs28.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
4145
4558
  handler: () => {
4146
- yargs11.help();
4559
+ yargs12.help();
4147
4560
  }
4148
4561
  };
4149
4562
 
4150
4563
  // src/commands/context/commands/enrichment.ts
4151
- import yargs12 from "yargs";
4564
+ import yargs13 from "yargs";
4152
4565
 
4153
4566
  // src/commands/context/commands/enrichment/get.ts
4154
4567
  import { UncachedEnrichmentClient } from "@uniformdev/context/api";
4155
4568
  var EnrichmentGetModule = {
4156
4569
  command: "get <id>",
4157
4570
  describe: "Fetch an enrichment category and its values",
4158
- builder: (yargs27) => withFormatOptions(
4571
+ builder: (yargs28) => withFormatOptions(
4159
4572
  withConfiguration(
4160
4573
  withApiOptions(
4161
4574
  withProjectOptions(
4162
- yargs27.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
4575
+ yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
4163
4576
  )
4164
4577
  )
4165
4578
  )
@@ -4184,7 +4597,7 @@ var EnrichmentListModule = {
4184
4597
  command: "list",
4185
4598
  describe: "List enrichments",
4186
4599
  aliases: ["ls"],
4187
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
4600
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
4188
4601
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
4189
4602
  const fetch3 = nodeFetchProxy(proxy);
4190
4603
  const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4285,11 +4698,11 @@ var createEnrichmentValueEngineDataSource = ({
4285
4698
  var EnrichmentPullModule = {
4286
4699
  command: "pull <directory>",
4287
4700
  describe: "Pulls all enrichments to local files in a directory",
4288
- builder: (yargs27) => withConfiguration(
4701
+ builder: (yargs28) => withConfiguration(
4289
4702
  withApiOptions(
4290
4703
  withProjectOptions(
4291
4704
  withDiffOptions(
4292
- yargs27.positional("directory", {
4705
+ yargs28.positional("directory", {
4293
4706
  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
4707
  type: "string"
4295
4708
  }).option("format", {
@@ -4323,7 +4736,8 @@ var EnrichmentPullModule = {
4323
4736
  mode,
4324
4737
  whatIf,
4325
4738
  project: projectId,
4326
- diff: diffMode
4739
+ diff: diffMode,
4740
+ allowEmptySource
4327
4741
  }) => {
4328
4742
  const fetch3 = nodeFetchProxy(proxy);
4329
4743
  const client = new UncachedEnrichmentClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4354,6 +4768,7 @@ var EnrichmentPullModule = {
4354
4768
  target,
4355
4769
  mode,
4356
4770
  whatIf,
4771
+ allowEmptySource,
4357
4772
  log: createSyncEngineConsoleLogger({ diffMode })
4358
4773
  });
4359
4774
  }
@@ -4364,11 +4779,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
4364
4779
  var EnrichmentPushModule = {
4365
4780
  command: "push <directory>",
4366
4781
  describe: "Pushes all enrichments from files in a directory or package to Uniform",
4367
- builder: (yargs27) => withConfiguration(
4782
+ builder: (yargs28) => withConfiguration(
4368
4783
  withApiOptions(
4369
4784
  withProjectOptions(
4370
4785
  withDiffOptions(
4371
- yargs27.positional("directory", {
4786
+ yargs28.positional("directory", {
4372
4787
  describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
4373
4788
  type: "string"
4374
4789
  }).option("what-if", {
@@ -4395,7 +4810,8 @@ var EnrichmentPushModule = {
4395
4810
  mode,
4396
4811
  whatIf,
4397
4812
  project: projectId,
4398
- diff: diffMode
4813
+ diff: diffMode,
4814
+ allowEmptySource
4399
4815
  }) => {
4400
4816
  const fetch3 = nodeFetchProxy(proxy);
4401
4817
  const client = new UncachedEnrichmentClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4421,6 +4837,7 @@ var EnrichmentPushModule = {
4421
4837
  target,
4422
4838
  mode,
4423
4839
  whatIf,
4840
+ allowEmptySource,
4424
4841
  log: createSyncEngineConsoleLogger({ diffMode })
4425
4842
  });
4426
4843
  }
@@ -4432,10 +4849,10 @@ var EnrichmentRemoveModule = {
4432
4849
  command: "remove <id>",
4433
4850
  aliases: ["delete", "rm"],
4434
4851
  describe: "Delete an enrichment category and its values",
4435
- builder: (yargs27) => withConfiguration(
4852
+ builder: (yargs28) => withConfiguration(
4436
4853
  withApiOptions(
4437
4854
  withProjectOptions(
4438
- yargs27.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
4855
+ yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
4439
4856
  )
4440
4857
  )
4441
4858
  ),
@@ -4451,14 +4868,14 @@ var EnrichmentModule = {
4451
4868
  command: "enrichment <command>",
4452
4869
  aliases: ["enr"],
4453
4870
  describe: "Commands for Context enrichments",
4454
- builder: (yargs27) => yargs27.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
4871
+ builder: (yargs28) => yargs28.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
4455
4872
  handler: () => {
4456
- yargs12.help();
4873
+ yargs13.help();
4457
4874
  }
4458
4875
  };
4459
4876
 
4460
4877
  // src/commands/context/commands/manifest.ts
4461
- import yargs13 from "yargs";
4878
+ import yargs14 from "yargs";
4462
4879
 
4463
4880
  // src/commands/context/commands/manifest/get.ts
4464
4881
  import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
@@ -4469,10 +4886,10 @@ var ManifestGetModule = {
4469
4886
  command: "get [output]",
4470
4887
  aliases: ["dl", "download"],
4471
4888
  describe: "Download the Uniform Context manifest for a project",
4472
- builder: (yargs27) => withConfiguration(
4889
+ builder: (yargs28) => withConfiguration(
4473
4890
  withApiOptions(
4474
4891
  withProjectOptions(
4475
- yargs27.option("preview", {
4892
+ yargs28.option("preview", {
4476
4893
  describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
4477
4894
  default: false,
4478
4895
  type: "boolean",
@@ -4534,7 +4951,7 @@ import { exit as exit2 } from "process";
4534
4951
  var ManifestPublishModule = {
4535
4952
  command: "publish",
4536
4953
  describe: "Publish the Uniform Context manifest for a project",
4537
- builder: (yargs27) => withConfiguration(withApiOptions(withProjectOptions(yargs27))),
4954
+ builder: (yargs28) => withConfiguration(withApiOptions(withProjectOptions(yargs28))),
4538
4955
  handler: async ({ apiKey, apiHost, proxy, project }) => {
4539
4956
  const fetch3 = nodeFetchProxy(proxy);
4540
4957
  try {
@@ -4567,25 +4984,25 @@ var ManifestModule = {
4567
4984
  command: "manifest <command>",
4568
4985
  describe: "Commands for context manifests",
4569
4986
  aliases: ["man"],
4570
- builder: (yargs27) => yargs27.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
4987
+ builder: (yargs28) => yargs28.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
4571
4988
  handler: () => {
4572
- yargs13.help();
4989
+ yargs14.help();
4573
4990
  }
4574
4991
  };
4575
4992
 
4576
4993
  // src/commands/context/commands/quirk.ts
4577
- import yargs14 from "yargs";
4994
+ import yargs15 from "yargs";
4578
4995
 
4579
4996
  // src/commands/context/commands/quirk/get.ts
4580
4997
  import { UncachedQuirkClient } from "@uniformdev/context/api";
4581
4998
  var QuirkGetModule = {
4582
4999
  command: "get <id>",
4583
5000
  describe: "Fetch a quirk",
4584
- builder: (yargs27) => withConfiguration(
5001
+ builder: (yargs28) => withConfiguration(
4585
5002
  withFormatOptions(
4586
5003
  withApiOptions(
4587
5004
  withProjectOptions(
4588
- yargs27.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
5005
+ yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
4589
5006
  )
4590
5007
  )
4591
5008
  )
@@ -4609,11 +5026,11 @@ var QuirkListModule = {
4609
5026
  command: "list",
4610
5027
  describe: "List quirks",
4611
5028
  aliases: ["ls"],
4612
- builder: (yargs27) => withConfiguration(
5029
+ builder: (yargs28) => withConfiguration(
4613
5030
  withFormatOptions(
4614
5031
  withApiOptions(
4615
5032
  withProjectOptions(
4616
- yargs27.option("withIntegrations", {
5033
+ yargs28.option("withIntegrations", {
4617
5034
  alias: ["i"],
4618
5035
  describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
4619
5036
  type: "boolean"
@@ -4670,11 +5087,11 @@ function createQuirkEngineDataSource({
4670
5087
  var QuirkPullModule = {
4671
5088
  command: "pull <directory>",
4672
5089
  describe: "Pulls all quirks to local files in a directory",
4673
- builder: (yargs27) => withConfiguration(
5090
+ builder: (yargs28) => withConfiguration(
4674
5091
  withApiOptions(
4675
5092
  withProjectOptions(
4676
5093
  withDiffOptions(
4677
- yargs27.positional("directory", {
5094
+ yargs28.positional("directory", {
4678
5095
  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
5096
  type: "string"
4680
5097
  }).option("format", {
@@ -4708,7 +5125,8 @@ var QuirkPullModule = {
4708
5125
  mode,
4709
5126
  whatIf,
4710
5127
  project: projectId,
4711
- diff: diffMode
5128
+ diff: diffMode,
5129
+ allowEmptySource
4712
5130
  }) => {
4713
5131
  const fetch3 = nodeFetchProxy(proxy);
4714
5132
  const client = new UncachedQuirkClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4739,6 +5157,7 @@ var QuirkPullModule = {
4739
5157
  target,
4740
5158
  mode,
4741
5159
  whatIf,
5160
+ allowEmptySource,
4742
5161
  log: createSyncEngineConsoleLogger({ diffMode })
4743
5162
  });
4744
5163
  }
@@ -4749,11 +5168,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
4749
5168
  var QuirkPushModule = {
4750
5169
  command: "push <directory>",
4751
5170
  describe: "Pushes all quirks from files in a directory or package to Uniform",
4752
- builder: (yargs27) => withConfiguration(
5171
+ builder: (yargs28) => withConfiguration(
4753
5172
  withApiOptions(
4754
5173
  withProjectOptions(
4755
5174
  withDiffOptions(
4756
- yargs27.positional("directory", {
5175
+ yargs28.positional("directory", {
4757
5176
  describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
4758
5177
  type: "string"
4759
5178
  }).option("what-if", {
@@ -4780,7 +5199,8 @@ var QuirkPushModule = {
4780
5199
  mode,
4781
5200
  whatIf,
4782
5201
  project: projectId,
4783
- diff: diffMode
5202
+ diff: diffMode,
5203
+ allowEmptySource
4784
5204
  }) => {
4785
5205
  const fetch3 = nodeFetchProxy(proxy);
4786
5206
  const client = new UncachedQuirkClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4806,6 +5226,7 @@ var QuirkPushModule = {
4806
5226
  target,
4807
5227
  mode,
4808
5228
  whatIf,
5229
+ allowEmptySource,
4809
5230
  log: createSyncEngineConsoleLogger({ diffMode })
4810
5231
  });
4811
5232
  }
@@ -4817,10 +5238,10 @@ var QuirkRemoveModule = {
4817
5238
  command: "remove <id>",
4818
5239
  aliases: ["delete", "rm"],
4819
5240
  describe: "Delete a quirk",
4820
- builder: (yargs27) => withConfiguration(
5241
+ builder: (yargs28) => withConfiguration(
4821
5242
  withApiOptions(
4822
5243
  withProjectOptions(
4823
- yargs27.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
5244
+ yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
4824
5245
  )
4825
5246
  )
4826
5247
  ),
@@ -4837,10 +5258,10 @@ var QuirkUpdateModule = {
4837
5258
  command: "update <filename>",
4838
5259
  aliases: ["put"],
4839
5260
  describe: "Insert or update a quirk",
4840
- builder: (yargs27) => withConfiguration(
5261
+ builder: (yargs28) => withConfiguration(
4841
5262
  withApiOptions(
4842
5263
  withProjectOptions(
4843
- yargs27.positional("filename", { demandOption: true, describe: "Quirk file to put" })
5264
+ yargs28.positional("filename", { demandOption: true, describe: "Quirk file to put" })
4844
5265
  )
4845
5266
  )
4846
5267
  ),
@@ -4857,25 +5278,25 @@ var QuirkModule = {
4857
5278
  command: "quirk <command>",
4858
5279
  aliases: ["qk"],
4859
5280
  describe: "Commands for Context quirks",
4860
- builder: (yargs27) => yargs27.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
5281
+ builder: (yargs28) => yargs28.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
4861
5282
  handler: () => {
4862
- yargs14.help();
5283
+ yargs15.help();
4863
5284
  }
4864
5285
  };
4865
5286
 
4866
5287
  // src/commands/context/commands/signal.ts
4867
- import yargs15 from "yargs";
5288
+ import yargs16 from "yargs";
4868
5289
 
4869
5290
  // src/commands/context/commands/signal/get.ts
4870
5291
  import { UncachedSignalClient } from "@uniformdev/context/api";
4871
5292
  var SignalGetModule = {
4872
5293
  command: "get <id>",
4873
5294
  describe: "Fetch a signal",
4874
- builder: (yargs27) => withConfiguration(
5295
+ builder: (yargs28) => withConfiguration(
4875
5296
  withFormatOptions(
4876
5297
  withApiOptions(
4877
5298
  withProjectOptions(
4878
- yargs27.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
5299
+ yargs28.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
4879
5300
  )
4880
5301
  )
4881
5302
  )
@@ -4899,7 +5320,7 @@ var SignalListModule = {
4899
5320
  command: "list",
4900
5321
  describe: "List signals",
4901
5322
  aliases: ["ls"],
4902
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
5323
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
4903
5324
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
4904
5325
  const fetch3 = nodeFetchProxy(proxy);
4905
5326
  const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -4948,11 +5369,11 @@ function createSignalEngineDataSource({
4948
5369
  var SignalPullModule = {
4949
5370
  command: "pull <directory>",
4950
5371
  describe: "Pulls all signals to local files in a directory",
4951
- builder: (yargs27) => withConfiguration(
5372
+ builder: (yargs28) => withConfiguration(
4952
5373
  withApiOptions(
4953
5374
  withProjectOptions(
4954
5375
  withDiffOptions(
4955
- yargs27.positional("directory", {
5376
+ yargs28.positional("directory", {
4956
5377
  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
5378
  type: "string"
4958
5379
  }).option("format", {
@@ -4986,7 +5407,8 @@ var SignalPullModule = {
4986
5407
  mode,
4987
5408
  whatIf,
4988
5409
  project: projectId,
4989
- diff: diffMode
5410
+ diff: diffMode,
5411
+ allowEmptySource
4990
5412
  }) => {
4991
5413
  const fetch3 = nodeFetchProxy(proxy);
4992
5414
  const client = new UncachedSignalClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5017,6 +5439,7 @@ var SignalPullModule = {
5017
5439
  target,
5018
5440
  mode,
5019
5441
  whatIf,
5442
+ allowEmptySource,
5020
5443
  log: createSyncEngineConsoleLogger({ diffMode })
5021
5444
  });
5022
5445
  }
@@ -5027,11 +5450,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
5027
5450
  var SignalPushModule = {
5028
5451
  command: "push <directory>",
5029
5452
  describe: "Pushes all signals from files in a directory or package to Uniform",
5030
- builder: (yargs27) => withConfiguration(
5453
+ builder: (yargs28) => withConfiguration(
5031
5454
  withApiOptions(
5032
5455
  withProjectOptions(
5033
5456
  withDiffOptions(
5034
- yargs27.positional("directory", {
5457
+ yargs28.positional("directory", {
5035
5458
  describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
5036
5459
  type: "string"
5037
5460
  }).option("what-if", {
@@ -5058,7 +5481,8 @@ var SignalPushModule = {
5058
5481
  mode,
5059
5482
  whatIf,
5060
5483
  project: projectId,
5061
- diff: diffMode
5484
+ diff: diffMode,
5485
+ allowEmptySource
5062
5486
  }) => {
5063
5487
  const fetch3 = nodeFetchProxy(proxy);
5064
5488
  const client = new UncachedSignalClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5084,6 +5508,7 @@ var SignalPushModule = {
5084
5508
  target,
5085
5509
  mode,
5086
5510
  whatIf,
5511
+ allowEmptySource,
5087
5512
  log: createSyncEngineConsoleLogger({ diffMode })
5088
5513
  });
5089
5514
  }
@@ -5095,10 +5520,10 @@ var SignalRemoveModule = {
5095
5520
  command: "remove <id>",
5096
5521
  aliases: ["delete", "rm"],
5097
5522
  describe: "Delete a signal",
5098
- builder: (yargs27) => withConfiguration(
5523
+ builder: (yargs28) => withConfiguration(
5099
5524
  withApiOptions(
5100
5525
  withProjectOptions(
5101
- yargs27.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
5526
+ yargs28.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
5102
5527
  )
5103
5528
  )
5104
5529
  ),
@@ -5115,10 +5540,10 @@ var SignalUpdateModule = {
5115
5540
  command: "update <filename>",
5116
5541
  aliases: ["put"],
5117
5542
  describe: "Insert or update a signal",
5118
- builder: (yargs27) => withConfiguration(
5543
+ builder: (yargs28) => withConfiguration(
5119
5544
  withApiOptions(
5120
5545
  withProjectOptions(
5121
- yargs27.positional("filename", { demandOption: true, describe: "Signal file to put" })
5546
+ yargs28.positional("filename", { demandOption: true, describe: "Signal file to put" })
5122
5547
  )
5123
5548
  )
5124
5549
  ),
@@ -5135,25 +5560,25 @@ var SignalModule = {
5135
5560
  command: "signal <command>",
5136
5561
  aliases: ["sig"],
5137
5562
  describe: "Commands for Context signals",
5138
- builder: (yargs27) => yargs27.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
5563
+ builder: (yargs28) => yargs28.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
5139
5564
  handler: () => {
5140
- yargs15.help();
5565
+ yargs16.help();
5141
5566
  }
5142
5567
  };
5143
5568
 
5144
5569
  // src/commands/context/commands/test.ts
5145
- import yargs16 from "yargs";
5570
+ import yargs17 from "yargs";
5146
5571
 
5147
5572
  // src/commands/context/commands/test/get.ts
5148
5573
  import { UncachedTestClient } from "@uniformdev/context/api";
5149
5574
  var TestGetModule = {
5150
5575
  command: "get <id>",
5151
5576
  describe: "Fetch a test",
5152
- builder: (yargs27) => withConfiguration(
5577
+ builder: (yargs28) => withConfiguration(
5153
5578
  withFormatOptions(
5154
5579
  withApiOptions(
5155
5580
  withProjectOptions(
5156
- yargs27.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
5581
+ yargs28.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
5157
5582
  )
5158
5583
  )
5159
5584
  )
@@ -5177,7 +5602,7 @@ var TestListModule = {
5177
5602
  command: "list",
5178
5603
  describe: "List tests",
5179
5604
  aliases: ["ls"],
5180
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
5605
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
5181
5606
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
5182
5607
  const fetch3 = nodeFetchProxy(proxy);
5183
5608
  const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5226,11 +5651,11 @@ function createTestEngineDataSource({
5226
5651
  var TestPullModule = {
5227
5652
  command: "pull <directory>",
5228
5653
  describe: "Pulls all tests to local files in a directory",
5229
- builder: (yargs27) => withConfiguration(
5654
+ builder: (yargs28) => withConfiguration(
5230
5655
  withApiOptions(
5231
5656
  withProjectOptions(
5232
5657
  withDiffOptions(
5233
- yargs27.positional("directory", {
5658
+ yargs28.positional("directory", {
5234
5659
  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
5660
  type: "string"
5236
5661
  }).option("format", {
@@ -5264,7 +5689,8 @@ var TestPullModule = {
5264
5689
  mode,
5265
5690
  whatIf,
5266
5691
  project: projectId,
5267
- diff: diffMode
5692
+ diff: diffMode,
5693
+ allowEmptySource
5268
5694
  }) => {
5269
5695
  const fetch3 = nodeFetchProxy(proxy);
5270
5696
  const client = new UncachedTestClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5295,6 +5721,7 @@ var TestPullModule = {
5295
5721
  target,
5296
5722
  mode,
5297
5723
  whatIf,
5724
+ allowEmptySource,
5298
5725
  log: createSyncEngineConsoleLogger({ diffMode })
5299
5726
  });
5300
5727
  }
@@ -5305,11 +5732,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
5305
5732
  var TestPushModule = {
5306
5733
  command: "push <directory>",
5307
5734
  describe: "Pushes all tests from files in a directory or package to Uniform",
5308
- builder: (yargs27) => withConfiguration(
5735
+ builder: (yargs28) => withConfiguration(
5309
5736
  withApiOptions(
5310
5737
  withProjectOptions(
5311
5738
  withDiffOptions(
5312
- yargs27.positional("directory", {
5739
+ yargs28.positional("directory", {
5313
5740
  describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
5314
5741
  type: "string"
5315
5742
  }).option("what-if", {
@@ -5336,7 +5763,8 @@ var TestPushModule = {
5336
5763
  mode,
5337
5764
  whatIf,
5338
5765
  project: projectId,
5339
- diff: diffMode
5766
+ diff: diffMode,
5767
+ allowEmptySource
5340
5768
  }) => {
5341
5769
  const fetch3 = nodeFetchProxy(proxy);
5342
5770
  const client = new UncachedTestClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -5362,6 +5790,7 @@ var TestPushModule = {
5362
5790
  target,
5363
5791
  mode,
5364
5792
  whatIf,
5793
+ allowEmptySource,
5365
5794
  log: createSyncEngineConsoleLogger({ diffMode })
5366
5795
  });
5367
5796
  }
@@ -5373,10 +5802,10 @@ var TestRemoveModule = {
5373
5802
  command: "remove <id>",
5374
5803
  aliases: ["delete", "rm"],
5375
5804
  describe: "Delete a test",
5376
- builder: (yargs27) => withConfiguration(
5805
+ builder: (yargs28) => withConfiguration(
5377
5806
  withApiOptions(
5378
5807
  withProjectOptions(
5379
- yargs27.positional("id", { demandOption: true, describe: "Test public ID to delete" })
5808
+ yargs28.positional("id", { demandOption: true, describe: "Test public ID to delete" })
5380
5809
  )
5381
5810
  )
5382
5811
  ),
@@ -5393,9 +5822,9 @@ var TestUpdateModule = {
5393
5822
  command: "update <filename>",
5394
5823
  aliases: ["put"],
5395
5824
  describe: "Insert or update a test",
5396
- builder: (yargs27) => withConfiguration(
5825
+ builder: (yargs28) => withConfiguration(
5397
5826
  withApiOptions(
5398
- withProjectOptions(yargs27.positional("filename", { demandOption: true, describe: "Test file to put" }))
5827
+ withProjectOptions(yargs28.positional("filename", { demandOption: true, describe: "Test file to put" }))
5399
5828
  )
5400
5829
  ),
5401
5830
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
@@ -5410,9 +5839,9 @@ var TestUpdateModule = {
5410
5839
  var TestModule = {
5411
5840
  command: "test <command>",
5412
5841
  describe: "Commands for Context A/B tests",
5413
- builder: (yargs27) => yargs27.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
5842
+ builder: (yargs28) => yargs28.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
5414
5843
  handler: () => {
5415
- yargs16.help();
5844
+ yargs17.help();
5416
5845
  }
5417
5846
  };
5418
5847
 
@@ -5421,9 +5850,9 @@ var ContextCommand = {
5421
5850
  command: "context <command>",
5422
5851
  aliases: ["ctx"],
5423
5852
  describe: "Uniform Context commands",
5424
- builder: (yargs27) => yargs27.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
5853
+ builder: (yargs28) => yargs28.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
5425
5854
  handler: () => {
5426
- yargs17.showHelp();
5855
+ yargs18.showHelp();
5427
5856
  }
5428
5857
  };
5429
5858
 
@@ -5451,7 +5880,7 @@ import { PostHog } from "posthog-node";
5451
5880
  // package.json
5452
5881
  var package_default = {
5453
5882
  name: "@uniformdev/cli",
5454
- version: "19.79.0",
5883
+ version: "19.92.1",
5455
5884
  description: "Uniform command line interface tool",
5456
5885
  license: "SEE LICENSE IN LICENSE.txt",
5457
5886
  main: "./cli.js",
@@ -5486,7 +5915,7 @@ var package_default = {
5486
5915
  "graphql-request": "6.1.0",
5487
5916
  "https-proxy-agent": "^7.0.0",
5488
5917
  "image-size": "^1.0.2",
5489
- inquirer: "9.2.11",
5918
+ inquirer: "9.2.12",
5490
5919
  "isomorphic-git": "1.24.5",
5491
5920
  "isomorphic-unfetch": "^4.0.0",
5492
5921
  "js-yaml": "^4.1.0",
@@ -5503,13 +5932,13 @@ var package_default = {
5503
5932
  zod: "3.22.4"
5504
5933
  },
5505
5934
  devDependencies: {
5506
- "@types/diff": "5.0.8",
5507
- "@types/inquirer": "9.0.3",
5935
+ "@types/diff": "5.0.9",
5936
+ "@types/inquirer": "9.0.7",
5508
5937
  "@types/js-yaml": "4.0.9",
5509
5938
  "@types/jsonwebtoken": "9.0.5",
5510
- "@types/lodash.isequalwith": "4.4.7",
5511
- "@types/node": "18.17.18",
5512
- "@types/yargs": "17.0.24"
5939
+ "@types/lodash.isequalwith": "4.4.9",
5940
+ "@types/node": "18.19.3",
5941
+ "@types/yargs": "17.0.32"
5513
5942
  },
5514
5943
  bin: {
5515
5944
  uniform: "./cli.js"
@@ -6461,10 +6890,10 @@ var NewMeshCmd = {
6461
6890
  };
6462
6891
 
6463
6892
  // src/commands/optimize/index.ts
6464
- import yargs19 from "yargs";
6893
+ import yargs20 from "yargs";
6465
6894
 
6466
6895
  // src/commands/optimize/manifest.ts
6467
- import yargs18 from "yargs";
6896
+ import yargs19 from "yargs";
6468
6897
 
6469
6898
  // src/commands/optimize/manifest/download.ts
6470
6899
  import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
@@ -6479,7 +6908,7 @@ var UniformBaseUrl = "https://uniform.app";
6479
6908
  var module = {
6480
6909
  command: "download [output]",
6481
6910
  describe: "Download intent manifest",
6482
- builder: (yargs27) => yargs27.option("apiKey", {
6911
+ builder: (yargs28) => yargs28.option("apiKey", {
6483
6912
  alias: "k",
6484
6913
  demandOption: true,
6485
6914
  string: true,
@@ -6580,10 +7009,10 @@ var module2 = {
6580
7009
  command: "manifest <command>",
6581
7010
  describe: "Intent manifest commands",
6582
7011
  builder: () => {
6583
- return yargs18.command(download_default);
7012
+ return yargs19.command(download_default);
6584
7013
  },
6585
7014
  handler: () => {
6586
- yargs18.showHelp();
7015
+ yargs19.showHelp();
6587
7016
  }
6588
7017
  };
6589
7018
  var manifest_default = module2;
@@ -6594,29 +7023,29 @@ var OptimizeCommand = {
6594
7023
  aliases: ["opt"],
6595
7024
  describe: "Uniform Optimize commands",
6596
7025
  builder: () => {
6597
- return yargs19.command(manifest_default);
7026
+ return yargs20.command(manifest_default);
6598
7027
  },
6599
7028
  handler: () => {
6600
- yargs19.showHelp();
7029
+ yargs20.showHelp();
6601
7030
  }
6602
7031
  };
6603
7032
 
6604
7033
  // src/commands/project-map/index.ts
6605
- import yargs22 from "yargs";
7034
+ import yargs23 from "yargs";
6606
7035
 
6607
7036
  // src/commands/project-map/commands/projectMapDefinition.ts
6608
- import yargs20 from "yargs";
7037
+ import yargs21 from "yargs";
6609
7038
 
6610
7039
  // src/commands/project-map/commands/ProjectMapDefinition/get.ts
6611
7040
  import { UncachedProjectMapClient } from "@uniformdev/project-map";
6612
7041
  var ProjectMapDefinitionGetModule = {
6613
7042
  command: "get <id>",
6614
7043
  describe: "Fetch a project map",
6615
- builder: (yargs27) => withFormatOptions(
7044
+ builder: (yargs28) => withFormatOptions(
6616
7045
  withConfiguration(
6617
7046
  withApiOptions(
6618
7047
  withProjectOptions(
6619
- yargs27.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
7048
+ yargs28.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
6620
7049
  )
6621
7050
  )
6622
7051
  )
@@ -6640,7 +7069,7 @@ var ProjectMapDefinitionListModule = {
6640
7069
  command: "list",
6641
7070
  describe: "List of project maps",
6642
7071
  aliases: ["ls"],
6643
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
7072
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
6644
7073
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
6645
7074
  const fetch3 = nodeFetchProxy(proxy);
6646
7075
  const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -6697,11 +7126,11 @@ function createProjectMapDefinitionEngineDataSource({
6697
7126
  var ProjectMapDefinitionPullModule = {
6698
7127
  command: "pull <directory>",
6699
7128
  describe: "Pulls all project maps to local files in a directory",
6700
- builder: (yargs27) => withConfiguration(
7129
+ builder: (yargs28) => withConfiguration(
6701
7130
  withApiOptions(
6702
7131
  withProjectOptions(
6703
7132
  withDiffOptions(
6704
- yargs27.positional("directory", {
7133
+ yargs28.positional("directory", {
6705
7134
  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
7135
  type: "string"
6707
7136
  }).option("format", {
@@ -6735,7 +7164,8 @@ var ProjectMapDefinitionPullModule = {
6735
7164
  mode,
6736
7165
  whatIf,
6737
7166
  project: projectId,
6738
- diff: diffMode
7167
+ diff: diffMode,
7168
+ allowEmptySource
6739
7169
  }) => {
6740
7170
  const fetch3 = nodeFetchProxy(proxy);
6741
7171
  const client = new UncachedProjectMapClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -6766,7 +7196,7 @@ var ProjectMapDefinitionPullModule = {
6766
7196
  target,
6767
7197
  mode,
6768
7198
  whatIf,
6769
- allowEmptySource: true,
7199
+ allowEmptySource: allowEmptySource ?? true,
6770
7200
  log: createSyncEngineConsoleLogger({ diffMode })
6771
7201
  });
6772
7202
  }
@@ -6777,11 +7207,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
6777
7207
  var ProjectMapDefinitionPushModule = {
6778
7208
  command: "push <directory>",
6779
7209
  describe: "Pushes all project maps from files in a directory or package to Uniform",
6780
- builder: (yargs27) => withConfiguration(
7210
+ builder: (yargs28) => withConfiguration(
6781
7211
  withApiOptions(
6782
7212
  withProjectOptions(
6783
7213
  withDiffOptions(
6784
- yargs27.positional("directory", {
7214
+ yargs28.positional("directory", {
6785
7215
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
6786
7216
  type: "string"
6787
7217
  }).option("what-if", {
@@ -6808,7 +7238,8 @@ var ProjectMapDefinitionPushModule = {
6808
7238
  mode,
6809
7239
  whatIf,
6810
7240
  project: projectId,
6811
- diff: diffMode
7241
+ diff: diffMode,
7242
+ allowEmptySource
6812
7243
  }) => {
6813
7244
  const fetch3 = nodeFetchProxy(proxy);
6814
7245
  const client = new UncachedProjectMapClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -6834,6 +7265,7 @@ var ProjectMapDefinitionPushModule = {
6834
7265
  target,
6835
7266
  mode,
6836
7267
  whatIf,
7268
+ allowEmptySource,
6837
7269
  log: createSyncEngineConsoleLogger({ diffMode })
6838
7270
  });
6839
7271
  }
@@ -6845,9 +7277,9 @@ var ProjectMapDefinitionRemoveModule = {
6845
7277
  command: "remove <id>",
6846
7278
  aliases: ["delete", "rm"],
6847
7279
  describe: "Delete a project map",
6848
- builder: (yargs27) => withConfiguration(
7280
+ builder: (yargs28) => withConfiguration(
6849
7281
  withApiOptions(
6850
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: " UUID to delete" }))
7282
+ withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
6851
7283
  )
6852
7284
  ),
6853
7285
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -6863,10 +7295,10 @@ var ProjectMapDefinitionUpdateModule = {
6863
7295
  command: "update <filename>",
6864
7296
  aliases: ["put"],
6865
7297
  describe: "Insert or update a project map",
6866
- builder: (yargs27) => withConfiguration(
7298
+ builder: (yargs28) => withConfiguration(
6867
7299
  withApiOptions(
6868
7300
  withProjectOptions(
6869
- yargs27.positional("filename", { demandOption: true, describe: "Project map file to put" })
7301
+ yargs28.positional("filename", { demandOption: true, describe: "Project map file to put" })
6870
7302
  )
6871
7303
  )
6872
7304
  ),
@@ -6882,25 +7314,25 @@ var ProjectMapDefinitionUpdateModule = {
6882
7314
  var ProjectMapDefinitionModule = {
6883
7315
  command: "definition <command>",
6884
7316
  describe: "Commands for ProjectMap Definitions",
6885
- builder: (yargs27) => yargs27.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
7317
+ builder: (yargs28) => yargs28.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
6886
7318
  handler: () => {
6887
- yargs20.help();
7319
+ yargs21.help();
6888
7320
  }
6889
7321
  };
6890
7322
 
6891
7323
  // src/commands/project-map/commands/projectMapNode.ts
6892
- import yargs21 from "yargs";
7324
+ import yargs22 from "yargs";
6893
7325
 
6894
7326
  // src/commands/project-map/commands/ProjectMapNode/get.ts
6895
7327
  import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
6896
7328
  var ProjectMapNodeGetModule = {
6897
7329
  command: "get <id> <projectMapId>",
6898
7330
  describe: "Fetch a project map node",
6899
- builder: (yargs27) => withConfiguration(
7331
+ builder: (yargs28) => withConfiguration(
6900
7332
  withFormatOptions(
6901
7333
  withApiOptions(
6902
7334
  withProjectOptions(
6903
- yargs27.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
7335
+ yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
6904
7336
  )
6905
7337
  )
6906
7338
  )
@@ -6926,11 +7358,11 @@ var ProjectMapNodeListModule = {
6926
7358
  command: "list <projectMapId>",
6927
7359
  describe: "List project map nodes",
6928
7360
  aliases: ["ls"],
6929
- builder: (yargs27) => withConfiguration(
7361
+ builder: (yargs28) => withConfiguration(
6930
7362
  withFormatOptions(
6931
7363
  withApiOptions(
6932
7364
  withProjectOptions(
6933
- yargs27.positional("projectMapId", {
7365
+ yargs28.positional("projectMapId", {
6934
7366
  demandOption: true,
6935
7367
  describe: "ProjectMap UUID to fetch from"
6936
7368
  })
@@ -7001,11 +7433,11 @@ function createProjectMapNodeEngineDataSource({
7001
7433
  var ProjectMapNodePullModule = {
7002
7434
  command: "pull <directory>",
7003
7435
  describe: "Pulls all project maps nodes to local files in a directory",
7004
- builder: (yargs27) => withConfiguration(
7436
+ builder: (yargs28) => withConfiguration(
7005
7437
  withApiOptions(
7006
7438
  withProjectOptions(
7007
7439
  withDiffOptions(
7008
- yargs27.positional("directory", {
7440
+ yargs28.positional("directory", {
7009
7441
  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
7442
  type: "string"
7011
7443
  }).option("format", {
@@ -7039,7 +7471,8 @@ var ProjectMapNodePullModule = {
7039
7471
  mode,
7040
7472
  whatIf,
7041
7473
  project: projectId,
7042
- diff: diffMode
7474
+ diff: diffMode,
7475
+ allowEmptySource
7043
7476
  }) => {
7044
7477
  const fetch3 = nodeFetchProxy(proxy);
7045
7478
  const client = new UncachedProjectMapClient9({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7074,7 +7507,7 @@ var ProjectMapNodePullModule = {
7074
7507
  target,
7075
7508
  mode,
7076
7509
  whatIf,
7077
- allowEmptySource: true,
7510
+ allowEmptySource: allowEmptySource ?? true,
7078
7511
  log: createSyncEngineConsoleLogger({ diffMode })
7079
7512
  });
7080
7513
  }
@@ -7085,11 +7518,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
7085
7518
  var ProjectMapNodePushModule = {
7086
7519
  command: "push <directory>",
7087
7520
  describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
7088
- builder: (yargs27) => withConfiguration(
7521
+ builder: (yargs28) => withConfiguration(
7089
7522
  withApiOptions(
7090
7523
  withProjectOptions(
7091
7524
  withDiffOptions(
7092
- yargs27.positional("directory", {
7525
+ yargs28.positional("directory", {
7093
7526
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
7094
7527
  type: "string"
7095
7528
  }).option("what-if", {
@@ -7116,7 +7549,8 @@ var ProjectMapNodePushModule = {
7116
7549
  mode,
7117
7550
  whatIf,
7118
7551
  project: projectId,
7119
- diff: diffMode
7552
+ diff: diffMode,
7553
+ allowEmptySource
7120
7554
  }) => {
7121
7555
  const fetch3 = nodeFetchProxy(proxy);
7122
7556
  const client = new UncachedProjectMapClient10({
@@ -7151,6 +7585,7 @@ var ProjectMapNodePushModule = {
7151
7585
  target,
7152
7586
  mode,
7153
7587
  whatIf,
7588
+ allowEmptySource,
7154
7589
  log: createSyncEngineConsoleLogger({ diffMode })
7155
7590
  });
7156
7591
  }
@@ -7162,10 +7597,10 @@ var ProjectMapNodeRemoveModule = {
7162
7597
  command: "remove <id> <projectMapId>",
7163
7598
  aliases: ["delete", "rm"],
7164
7599
  describe: "Delete a project map node",
7165
- builder: (yargs27) => withConfiguration(
7600
+ builder: (yargs28) => withConfiguration(
7166
7601
  withApiOptions(
7167
7602
  withProjectOptions(
7168
- yargs27.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
7603
+ yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
7169
7604
  )
7170
7605
  )
7171
7606
  ),
@@ -7182,10 +7617,10 @@ var ProjectMapNodeUpdateModule = {
7182
7617
  command: "update <filename> <projectMapId>",
7183
7618
  aliases: ["put"],
7184
7619
  describe: "Insert or update a project map node",
7185
- builder: (yargs27) => withConfiguration(
7620
+ builder: (yargs28) => withConfiguration(
7186
7621
  withApiOptions(
7187
7622
  withProjectOptions(
7188
- yargs27.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
7623
+ yargs28.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
7189
7624
  )
7190
7625
  )
7191
7626
  ),
@@ -7201,9 +7636,9 @@ var ProjectMapNodeUpdateModule = {
7201
7636
  var ProjectMapNodeModule = {
7202
7637
  command: "node <command>",
7203
7638
  describe: "Commands for ProjectMap Nodes",
7204
- builder: (yargs27) => yargs27.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
7639
+ builder: (yargs28) => yargs28.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
7205
7640
  handler: () => {
7206
- yargs21.help();
7641
+ yargs22.help();
7207
7642
  }
7208
7643
  };
7209
7644
 
@@ -7212,28 +7647,28 @@ var ProjectMapCommand = {
7212
7647
  command: "project-map <command>",
7213
7648
  aliases: ["prm"],
7214
7649
  describe: "Uniform ProjectMap commands",
7215
- builder: (yargs27) => yargs27.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
7650
+ builder: (yargs28) => yargs28.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
7216
7651
  handler: () => {
7217
- yargs22.showHelp();
7652
+ yargs23.showHelp();
7218
7653
  }
7219
7654
  };
7220
7655
 
7221
7656
  // src/commands/redirect/index.ts
7222
- import yargs24 from "yargs";
7657
+ import yargs25 from "yargs";
7223
7658
 
7224
7659
  // src/commands/redirect/commands/redirect.ts
7225
- import yargs23 from "yargs";
7660
+ import yargs24 from "yargs";
7226
7661
 
7227
7662
  // src/commands/redirect/commands/RedirectDefinition/get.ts
7228
7663
  import { UncachedRedirectClient } from "@uniformdev/redirect";
7229
7664
  var RedirectDefinitionGetModule = {
7230
7665
  command: "get <id>",
7231
7666
  describe: "Fetch a redirect",
7232
- builder: (yargs27) => withConfiguration(
7667
+ builder: (yargs28) => withConfiguration(
7233
7668
  withFormatOptions(
7234
7669
  withApiOptions(
7235
7670
  withProjectOptions(
7236
- yargs27.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
7671
+ yargs28.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
7237
7672
  )
7238
7673
  )
7239
7674
  )
@@ -7257,7 +7692,7 @@ var RedirectDefinitionListModule = {
7257
7692
  command: "list",
7258
7693
  describe: "List of redirects",
7259
7694
  aliases: ["ls"],
7260
- builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
7695
+ builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
7261
7696
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
7262
7697
  const fetch3 = nodeFetchProxy(proxy);
7263
7698
  const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7323,11 +7758,11 @@ function createRedirectDefinitionEngineDataSource({
7323
7758
  var RedirectDefinitionPullModule = {
7324
7759
  command: "pull <directory>",
7325
7760
  describe: "Pulls all redirects to local files in a directory",
7326
- builder: (yargs27) => withConfiguration(
7761
+ builder: (yargs28) => withConfiguration(
7327
7762
  withApiOptions(
7328
7763
  withProjectOptions(
7329
7764
  withDiffOptions(
7330
- yargs27.positional("directory", {
7765
+ yargs28.positional("directory", {
7331
7766
  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
7767
  type: "string"
7333
7768
  }).option("format", {
@@ -7361,7 +7796,8 @@ var RedirectDefinitionPullModule = {
7361
7796
  mode,
7362
7797
  whatIf,
7363
7798
  project: projectId,
7364
- diff: diffMode
7799
+ diff: diffMode,
7800
+ allowEmptySource
7365
7801
  }) => {
7366
7802
  const fetch3 = nodeFetchProxy(proxy);
7367
7803
  const client = new UncachedRedirectClient3({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7393,7 +7829,7 @@ var RedirectDefinitionPullModule = {
7393
7829
  target,
7394
7830
  mode,
7395
7831
  whatIf,
7396
- allowEmptySource: true,
7832
+ allowEmptySource: allowEmptySource ?? true,
7397
7833
  log: createSyncEngineConsoleLogger({ diffMode })
7398
7834
  });
7399
7835
  }
@@ -7404,11 +7840,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
7404
7840
  var RedirectDefinitionPushModule = {
7405
7841
  command: "push <directory>",
7406
7842
  describe: "Pushes all redirects from files in a directory or package to Uniform",
7407
- builder: (yargs27) => withConfiguration(
7843
+ builder: (yargs28) => withConfiguration(
7408
7844
  withApiOptions(
7409
7845
  withProjectOptions(
7410
7846
  withDiffOptions(
7411
- yargs27.positional("directory", {
7847
+ yargs28.positional("directory", {
7412
7848
  describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
7413
7849
  type: "string"
7414
7850
  }).option("what-if", {
@@ -7435,7 +7871,8 @@ var RedirectDefinitionPushModule = {
7435
7871
  mode,
7436
7872
  whatIf,
7437
7873
  project: projectId,
7438
- diff: diffMode
7874
+ diff: diffMode,
7875
+ allowEmptySource
7439
7876
  }) => {
7440
7877
  const fetch3 = nodeFetchProxy(proxy);
7441
7878
  const client = new UncachedRedirectClient4({ apiKey, apiHost, fetch: fetch3, projectId });
@@ -7461,6 +7898,7 @@ var RedirectDefinitionPushModule = {
7461
7898
  target,
7462
7899
  mode,
7463
7900
  whatIf,
7901
+ allowEmptySource,
7464
7902
  log: createSyncEngineConsoleLogger({ diffMode })
7465
7903
  });
7466
7904
  }
@@ -7472,9 +7910,9 @@ var RedirectDefinitionRemoveModule = {
7472
7910
  command: "remove <id>",
7473
7911
  aliases: ["delete", "rm"],
7474
7912
  describe: "Delete a redirect",
7475
- builder: (yargs27) => withConfiguration(
7913
+ builder: (yargs28) => withConfiguration(
7476
7914
  withApiOptions(
7477
- withProjectOptions(yargs27.positional("id", { demandOption: true, describe: " UUID to delete" }))
7915
+ withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
7478
7916
  )
7479
7917
  ),
7480
7918
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -7490,10 +7928,10 @@ var RedirectDefinitionUpdateModule = {
7490
7928
  command: "update <filename>",
7491
7929
  aliases: ["put"],
7492
7930
  describe: "Insert or update a redirect",
7493
- builder: (yargs27) => withConfiguration(
7931
+ builder: (yargs28) => withConfiguration(
7494
7932
  withApiOptions(
7495
7933
  withProjectOptions(
7496
- yargs27.positional("filename", { demandOption: true, describe: "Redirect file to put" })
7934
+ yargs28.positional("filename", { demandOption: true, describe: "Redirect file to put" })
7497
7935
  )
7498
7936
  )
7499
7937
  ),
@@ -7509,9 +7947,9 @@ var RedirectDefinitionUpdateModule = {
7509
7947
  var RedirectDefinitionModule = {
7510
7948
  command: "definition <command>",
7511
7949
  describe: "Commands for Redirect Definitions",
7512
- builder: (yargs27) => yargs27.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
7950
+ builder: (yargs28) => yargs28.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
7513
7951
  handler: () => {
7514
- yargs23.help();
7952
+ yargs24.help();
7515
7953
  }
7516
7954
  };
7517
7955
 
@@ -7520,14 +7958,14 @@ var RedirectCommand = {
7520
7958
  command: "redirect <command>",
7521
7959
  aliases: ["red"],
7522
7960
  describe: "Uniform Redirect commands",
7523
- builder: (yargs27) => yargs27.command(RedirectDefinitionModule).demandCommand(),
7961
+ builder: (yargs28) => yargs28.command(RedirectDefinitionModule).demandCommand(),
7524
7962
  handler: () => {
7525
- yargs24.showHelp();
7963
+ yargs25.showHelp();
7526
7964
  }
7527
7965
  };
7528
7966
 
7529
7967
  // src/commands/sync/index.ts
7530
- import yargs25 from "yargs";
7968
+ import yargs26 from "yargs";
7531
7969
 
7532
7970
  // src/commands/sync/commands/util.ts
7533
7971
  import ora2 from "ora";
@@ -7546,10 +7984,12 @@ function spin(entityType) {
7546
7984
  stop: () => {
7547
7985
  spinner.stop();
7548
7986
  console.log = consoleLog;
7987
+ return spinner;
7549
7988
  },
7550
7989
  succeed() {
7551
7990
  spinner.succeed();
7552
7991
  console.log = consoleLog;
7992
+ return spinner;
7553
7993
  }
7554
7994
  };
7555
7995
  }
@@ -7558,11 +7998,11 @@ function spin(entityType) {
7558
7998
  var SyncPullModule = {
7559
7999
  command: "pull",
7560
8000
  describe: "Pulls whole project to local files in a directory",
7561
- builder: (yargs27) => withConfiguration(
8001
+ builder: (yargs28) => withConfiguration(
7562
8002
  withApiOptions(
7563
8003
  withProjectOptions(
7564
8004
  withDiffOptions(
7565
- yargs27.option("what-if", {
8005
+ yargs28.option("what-if", {
7566
8006
  alias: ["w"],
7567
8007
  describe: "What-if mode reports what would be done but changes no files",
7568
8008
  default: false,
@@ -7573,8 +8013,11 @@ var SyncPullModule = {
7573
8013
  )
7574
8014
  ),
7575
8015
  handler: async ({ serialization, ...otherParams }) => {
8016
+ var _a;
7576
8017
  const config2 = serialization;
7577
8018
  const enabledEntities = Object.entries({
8019
+ locale: LocalePullModule,
8020
+ asset: AssetPullModule,
7578
8021
  category: CategoryPullModule,
7579
8022
  dataType: DataTypePullModule,
7580
8023
  prompt: PromptPullModule,
@@ -7590,11 +8033,10 @@ var SyncPullModule = {
7590
8033
  projectMapNode: ProjectMapNodePullModule,
7591
8034
  redirect: RedirectDefinitionPullModule,
7592
8035
  entry: EntryPullModule,
7593
- contentType: ContentTypePullModule,
7594
- asset: AssetPullModule
8036
+ contentType: ContentTypePullModule
7595
8037
  }).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;
8038
+ var _a2, _b, _c, _d, _e, _f;
8039
+ 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
8040
  });
7599
8041
  if (enabledEntities.length === 0) {
7600
8042
  throw new Error(
@@ -7603,15 +8045,20 @@ var SyncPullModule = {
7603
8045
  }
7604
8046
  for (const [entityType, module3] of enabledEntities) {
7605
8047
  const spinner = spin(entityType);
8048
+ const entityConfigSupportsPullState = (entityConfig2) => {
8049
+ return entityConfig2 !== void 0 && "state" in entityConfig2;
8050
+ };
8051
+ const entityConfig = (_a = config2.entitiesConfig) == null ? void 0 : _a[entityType];
7606
8052
  try {
7607
8053
  await module3.handler({
7608
8054
  ...otherParams,
7609
- state: 0,
8055
+ state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
7610
8056
  format: getFormat(entityType, config2),
7611
8057
  onlyCompositions: entityType === "composition" ? true : void 0,
7612
8058
  onlyPatterns: entityType === "pattern" ? true : void 0,
7613
8059
  mode: getPullMode(entityType, config2),
7614
- directory: getPullFilename(entityType, config2)
8060
+ directory: getPullFilename(entityType, config2),
8061
+ allowEmptySource: config2.allowEmptySource
7615
8062
  });
7616
8063
  spinner.succeed();
7617
8064
  } catch (e) {
@@ -7649,11 +8096,11 @@ var getFormat = (entityType, config2) => {
7649
8096
  var SyncPushModule = {
7650
8097
  command: "push",
7651
8098
  describe: "Pushes whole project data from files in a directory or package to Uniform",
7652
- builder: (yargs27) => withConfiguration(
8099
+ builder: (yargs28) => withConfiguration(
7653
8100
  withApiOptions(
7654
8101
  withProjectOptions(
7655
8102
  withDiffOptions(
7656
- yargs27.option("what-if", {
8103
+ yargs28.option("what-if", {
7657
8104
  alias: ["w"],
7658
8105
  describe: "What-if mode reports what would be done but changes nothing",
7659
8106
  default: false,
@@ -7667,6 +8114,8 @@ var SyncPushModule = {
7667
8114
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
7668
8115
  const config2 = serialization;
7669
8116
  const enabledEntities = Object.entries({
8117
+ locale: LocalePushModule,
8118
+ asset: AssetPushModule,
7670
8119
  category: CategoryPushModule,
7671
8120
  dataType: DataTypePushModule,
7672
8121
  prompt: PromptPushModule,
@@ -7682,8 +8131,7 @@ var SyncPushModule = {
7682
8131
  projectMapNode: ProjectMapNodePushModule,
7683
8132
  redirect: RedirectDefinitionPushModule,
7684
8133
  contentType: ContentTypePushModule,
7685
- entry: EntryPushModule,
7686
- asset: AssetPushModule
8134
+ entry: EntryPushModule
7687
8135
  }).filter(([entityType]) => {
7688
8136
  var _a2, _b2, _c2, _d2, _e2, _f2;
7689
8137
  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 +8151,8 @@ var SyncPushModule = {
7703
8151
  onlyCompositions: entityType === "composition" ? true : void 0,
7704
8152
  onlyPatterns: entityType === "pattern" ? true : void 0,
7705
8153
  mode: getPushMode(entityType, config2),
7706
- directory: getPushFilename(entityType, config2)
8154
+ directory: getPushFilename(entityType, config2),
8155
+ allowEmptySource: config2.allowEmptySource
7707
8156
  });
7708
8157
  spinner.succeed();
7709
8158
  } catch (e) {
@@ -7747,9 +8196,9 @@ var getFormat2 = (entityType, config2) => {
7747
8196
  var SyncCommand = {
7748
8197
  command: "sync <command>",
7749
8198
  describe: "Uniform Sync commands",
7750
- builder: (yargs27) => yargs27.command(SyncPullModule).command(SyncPushModule).demandCommand(),
8199
+ builder: (yargs28) => yargs28.command(SyncPullModule).command(SyncPushModule).demandCommand(),
7751
8200
  handler: () => {
7752
- yargs25.showHelp();
8201
+ yargs26.showHelp();
7753
8202
  }
7754
8203
  };
7755
8204
 
@@ -8015,7 +8464,7 @@ First found was: v${firstVersion}`;
8015
8464
 
8016
8465
  // src/index.ts
8017
8466
  dotenv.config();
8018
- var yarggery = yargs26(hideBin(process.argv));
8467
+ var yarggery = yargs27(hideBin(process.argv));
8019
8468
  var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
8020
8469
  var configuration = loadConfig(inlineConfigurationFilePath || null);
8021
8470
  yarggery.option("verbose", {