@uniformdev/cli 19.79.1-alpha.11 → 19.79.1-alpha.18

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