@uniformdev/cli 19.79.1-alpha.11 → 19.79.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +13 -5
- package/dist/index.mjs +836 -391
- package/package.json +14 -14
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.
|
|
10
|
+
// ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_postcss@8.4.32_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
import path from "path";
|
|
13
13
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -16,11 +16,11 @@ var __dirname = /* @__PURE__ */ getDirname();
|
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
import * as dotenv from "dotenv";
|
|
19
|
-
import
|
|
19
|
+
import yargs27 from "yargs";
|
|
20
20
|
import { hideBin } from "yargs/helpers";
|
|
21
21
|
|
|
22
22
|
// src/commands/canvas/index.ts
|
|
23
|
-
import
|
|
23
|
+
import yargs11 from "yargs";
|
|
24
24
|
|
|
25
25
|
// src/commands/canvas/commands/asset.ts
|
|
26
26
|
import yargs from "yargs";
|
|
@@ -137,14 +137,14 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
137
137
|
import unfetch from "isomorphic-unfetch";
|
|
138
138
|
import { dump, load } from "js-yaml";
|
|
139
139
|
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
140
|
-
function withConfiguration(
|
|
141
|
-
return
|
|
140
|
+
function withConfiguration(yargs28) {
|
|
141
|
+
return yargs28.option("serialization", {
|
|
142
142
|
skipValidation: true,
|
|
143
143
|
hidden: true
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function withApiOptions(
|
|
147
|
-
return
|
|
146
|
+
function withApiOptions(yargs28) {
|
|
147
|
+
return yargs28.option("apiKey", {
|
|
148
148
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
149
149
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
150
150
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -183,8 +183,8 @@ function nodeFetchProxy(proxy) {
|
|
|
183
183
|
};
|
|
184
184
|
return wrappedFetch;
|
|
185
185
|
}
|
|
186
|
-
function withProjectOptions(
|
|
187
|
-
return
|
|
186
|
+
function withProjectOptions(yargs28) {
|
|
187
|
+
return yargs28.option("project", {
|
|
188
188
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
189
189
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
190
190
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -194,8 +194,8 @@ function withProjectOptions(yargs27) {
|
|
|
194
194
|
alias: ["p"]
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
function withFormatOptions(
|
|
198
|
-
return
|
|
197
|
+
function withFormatOptions(yargs28) {
|
|
198
|
+
return yargs28.option("format", {
|
|
199
199
|
alias: ["f"],
|
|
200
200
|
describe: "Output format",
|
|
201
201
|
default: "yaml",
|
|
@@ -207,8 +207,8 @@ function withFormatOptions(yargs27) {
|
|
|
207
207
|
type: "string"
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
function withDiffOptions(
|
|
211
|
-
return
|
|
210
|
+
function withDiffOptions(yargs28) {
|
|
211
|
+
return yargs28.option("diff", {
|
|
212
212
|
describe: "Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",
|
|
213
213
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
214
214
|
type: "string",
|
|
@@ -295,6 +295,7 @@ async function* paginateAsync(fetchPage, options) {
|
|
|
295
295
|
var defaultSyncConfiguration = {
|
|
296
296
|
entitiesConfig: {},
|
|
297
297
|
directory: "uniform-data",
|
|
298
|
+
allowEmptySource: false,
|
|
298
299
|
format: "yaml",
|
|
299
300
|
mode: "mirror"
|
|
300
301
|
};
|
|
@@ -632,12 +633,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
632
633
|
var AssetGetModule = {
|
|
633
634
|
command: "get <id>",
|
|
634
635
|
describe: "Get an asset",
|
|
635
|
-
builder: (
|
|
636
|
+
builder: (yargs28) => withConfiguration(
|
|
636
637
|
withFormatOptions(
|
|
637
638
|
withApiOptions(
|
|
638
639
|
withProjectOptions(
|
|
639
640
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
640
|
-
|
|
641
|
+
yargs28.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
641
642
|
)
|
|
642
643
|
)
|
|
643
644
|
)
|
|
@@ -658,7 +659,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
|
|
|
658
659
|
var AssetListModule = {
|
|
659
660
|
command: "list",
|
|
660
661
|
describe: "List assets",
|
|
661
|
-
builder: (
|
|
662
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
662
663
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
663
664
|
const fetch3 = nodeFetchProxy(proxy);
|
|
664
665
|
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -669,6 +670,7 @@ var AssetListModule = {
|
|
|
669
670
|
|
|
670
671
|
// src/commands/canvas/commands/asset/pull.ts
|
|
671
672
|
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
673
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
672
674
|
|
|
673
675
|
// src/files/index.ts
|
|
674
676
|
import { preferredType } from "@thi.ng/mime";
|
|
@@ -679,20 +681,60 @@ import sizeOf from "image-size";
|
|
|
679
681
|
import PQueue from "p-queue";
|
|
680
682
|
import { dirname as dirname2, join as join2 } from "path";
|
|
681
683
|
var FILES_DIRECTORY_NAME = "files";
|
|
684
|
+
var escapeRegExp = (string) => {
|
|
685
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
686
|
+
};
|
|
682
687
|
var urlToHash = (url) => {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
688
|
+
return Buffer.from(
|
|
689
|
+
// We take only the first 64 characters of the pathname as
|
|
690
|
+
// that's enough to guarantee uniqueness
|
|
691
|
+
new URL(url).pathname.substring(0, 64)
|
|
692
|
+
).toString("base64");
|
|
693
|
+
};
|
|
694
|
+
var hashToPartialPathname = (hash) => {
|
|
695
|
+
try {
|
|
696
|
+
return Buffer.from(hash, "base64").toString("utf8");
|
|
697
|
+
} catch {
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
var findUrlMatchingPartialPathname = (source, pathname) => {
|
|
702
|
+
const escapedPathname = escapeRegExp(pathname);
|
|
703
|
+
const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
|
|
704
|
+
const match = source.match(regex);
|
|
705
|
+
if (match && match[1]) {
|
|
706
|
+
return match[1];
|
|
707
|
+
}
|
|
708
|
+
return null;
|
|
686
709
|
};
|
|
687
|
-
var
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
710
|
+
var urlToFileExtension = (url) => {
|
|
711
|
+
try {
|
|
712
|
+
const urlObject = new URL(url);
|
|
713
|
+
const fileNameChunks = urlObject.pathname.split(".");
|
|
714
|
+
return fileNameChunks.length > 1 ? fileNameChunks.at(-1) ?? null : null;
|
|
715
|
+
} catch {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
var urlToFileName = (url, hash) => {
|
|
720
|
+
const fileName = hash ?? urlToHash(url);
|
|
721
|
+
const fileExtension = urlToFileExtension(url);
|
|
691
722
|
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
692
723
|
};
|
|
724
|
+
var getFilesDirectory = (directory) => {
|
|
725
|
+
const isPackage = isPathAPackageFile(directory);
|
|
726
|
+
return isPackage ? dirname2(directory) : (
|
|
727
|
+
// If we are syncing to a directory, we want to write all files into a
|
|
728
|
+
// top-lvl folder. That way any entities that contain files will sync to the
|
|
729
|
+
// same directory, so there is no duplication
|
|
730
|
+
join2(directory, "..")
|
|
731
|
+
);
|
|
732
|
+
};
|
|
733
|
+
var getUniformFileUrlMatches = (string) => {
|
|
734
|
+
return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
|
|
735
|
+
};
|
|
693
736
|
var deleteDownloadedFileByUrl = async (url, options) => {
|
|
694
|
-
const
|
|
695
|
-
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
737
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
696
738
|
const fileName = urlToFileName(url);
|
|
697
739
|
const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
|
|
698
740
|
try {
|
|
@@ -703,18 +745,14 @@ var deleteDownloadedFileByUrl = async (url, options) => {
|
|
|
703
745
|
};
|
|
704
746
|
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
705
747
|
const objectAsString = JSON.stringify(object);
|
|
706
|
-
const uniformFileUrlMatches = objectAsString
|
|
707
|
-
|
|
708
|
-
);
|
|
709
|
-
const isPackage = isPathAPackageFile(options.directory);
|
|
710
|
-
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
748
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
749
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
711
750
|
if (uniformFileUrlMatches) {
|
|
712
751
|
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
713
752
|
for (const match of uniformFileUrlMatches) {
|
|
714
753
|
const url = new URL(match[1]);
|
|
715
754
|
fileDownloadQueue.add(async () => {
|
|
716
755
|
try {
|
|
717
|
-
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
718
756
|
const fileName = urlToFileName(url.toString());
|
|
719
757
|
const fileAlreadyExists = await fsj.existsAsync(
|
|
720
758
|
join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
|
|
@@ -722,6 +760,23 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
722
760
|
if (fileAlreadyExists) {
|
|
723
761
|
return;
|
|
724
762
|
}
|
|
763
|
+
const file = await options.fileClient.get({ url: url.toString() }).catch(() => null);
|
|
764
|
+
if (!file) {
|
|
765
|
+
console.warn(`Skipping file ${url} as it does not exist in the project anymore`);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
if (file.sourceId) {
|
|
769
|
+
try {
|
|
770
|
+
const hashAlreadyExists = await fsj.findAsync(join2(writeDirectory, FILES_DIRECTORY_NAME), {
|
|
771
|
+
matching: [file.sourceId, `${file.sourceId}.*`]
|
|
772
|
+
});
|
|
773
|
+
if (hashAlreadyExists.length > 0) {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
} catch {
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
725
780
|
const response = await fetch(fetchUrl);
|
|
726
781
|
if (!response.ok) {
|
|
727
782
|
return;
|
|
@@ -739,39 +794,45 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
739
794
|
};
|
|
740
795
|
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
741
796
|
let objectAsString = JSON.stringify(object);
|
|
742
|
-
const uniformFileUrlMatches = objectAsString
|
|
743
|
-
|
|
744
|
-
);
|
|
797
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
798
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
745
799
|
const isPackage = isPathAPackageFile(options.directory);
|
|
746
|
-
const
|
|
800
|
+
const legacyWriteDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
747
801
|
if (uniformFileUrlMatches) {
|
|
748
802
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
749
803
|
for (const match of uniformFileUrlMatches) {
|
|
750
804
|
const url = match[1];
|
|
751
805
|
const hash = urlToHash(url);
|
|
806
|
+
const legacyHash = legacyUrlToHash(url);
|
|
752
807
|
fileUploadQueue.add(async () => {
|
|
753
808
|
try {
|
|
754
809
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
755
810
|
options.fileClient.get({ url }).catch(() => null),
|
|
756
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
811
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
812
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
757
813
|
]);
|
|
758
|
-
|
|
814
|
+
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
815
|
+
if (file) {
|
|
816
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
759
817
|
return;
|
|
760
818
|
}
|
|
761
819
|
const localFileName = urlToFileName(url);
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
)
|
|
820
|
+
let expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
|
|
821
|
+
let fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
822
|
+
if (!fileExistsLocally) {
|
|
823
|
+
const localFileName2 = legacyUrlToFileName(url);
|
|
824
|
+
expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
|
|
825
|
+
fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
826
|
+
}
|
|
765
827
|
if (!fileExistsLocally) {
|
|
766
|
-
console.warn(
|
|
828
|
+
console.warn(
|
|
829
|
+
`Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
830
|
+
);
|
|
767
831
|
return;
|
|
768
832
|
}
|
|
769
|
-
const fileBuffer = await fsj.readAsync(
|
|
770
|
-
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName),
|
|
771
|
-
"buffer"
|
|
772
|
-
);
|
|
833
|
+
const fileBuffer = await fsj.readAsync(expectedFilePath, "buffer");
|
|
773
834
|
if (!fileBuffer) {
|
|
774
|
-
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
835
|
+
console.warn(`Skipping file ${url} (${expectedFilePath}) as we couldn't read it`);
|
|
775
836
|
return;
|
|
776
837
|
}
|
|
777
838
|
const fileName = getFileNameFromUrl(url);
|
|
@@ -803,20 +864,20 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
803
864
|
}
|
|
804
865
|
});
|
|
805
866
|
if (!uploadResponse.ok) {
|
|
806
|
-
console.warn(`Failed to upload file ${url}`);
|
|
867
|
+
console.warn(`Failed to upload file ${url} (${expectedFilePath})`);
|
|
807
868
|
return;
|
|
808
869
|
}
|
|
809
870
|
const checkForFile = async () => {
|
|
810
|
-
const
|
|
811
|
-
if (!
|
|
871
|
+
const file2 = await options.fileClient.get({ id });
|
|
872
|
+
if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
|
|
812
873
|
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
813
874
|
return checkForFile();
|
|
814
875
|
}
|
|
815
|
-
return
|
|
876
|
+
return file2.url;
|
|
816
877
|
};
|
|
817
878
|
const abortTimeout = setTimeout(() => {
|
|
818
|
-
throw new Error(`Failed to upload file ${url}`);
|
|
819
|
-
},
|
|
879
|
+
throw new Error(`Failed to upload file ${url} (${expectedFilePath}) - upload timed out`);
|
|
880
|
+
}, 3e4);
|
|
820
881
|
const uploadedFileUrl = await checkForFile();
|
|
821
882
|
clearTimeout(abortTimeout);
|
|
822
883
|
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
@@ -831,19 +892,19 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
831
892
|
};
|
|
832
893
|
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
833
894
|
let objectAsString = JSON.stringify(object);
|
|
834
|
-
const uniformFileUrlMatches = objectAsString
|
|
835
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
836
|
-
);
|
|
895
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
837
896
|
if (uniformFileUrlMatches) {
|
|
838
897
|
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
839
898
|
for (const match of uniformFileUrlMatches) {
|
|
840
899
|
const url = match[1];
|
|
841
900
|
const hash = urlToHash(url);
|
|
901
|
+
const legacyHash = legacyUrlToHash(url);
|
|
842
902
|
fileUrlReplacementQueue.add(async () => {
|
|
843
903
|
try {
|
|
844
904
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
845
905
|
options.fileClient.get({ url }).catch(() => null),
|
|
846
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
906
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
907
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
847
908
|
]);
|
|
848
909
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
849
910
|
if (!file) {
|
|
@@ -858,19 +919,74 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
858
919
|
}
|
|
859
920
|
return JSON.parse(objectAsString);
|
|
860
921
|
};
|
|
922
|
+
var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
|
|
923
|
+
let sourceObjectAsString = JSON.stringify(sourceObject);
|
|
924
|
+
const targetObjectAsString = JSON.stringify(targetObject);
|
|
925
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
|
|
926
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
927
|
+
if (uniformFileUrlMatches) {
|
|
928
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
929
|
+
for (const match of uniformFileUrlMatches) {
|
|
930
|
+
const url = match[1];
|
|
931
|
+
fileUrlReplacementQueue.add(async () => {
|
|
932
|
+
try {
|
|
933
|
+
const localFileName = urlToFileName(url);
|
|
934
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
935
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
936
|
+
);
|
|
937
|
+
if (fileExistsLocally) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
const file = await options.fileClient.get({ url }).catch(() => null);
|
|
941
|
+
if (!file || !file.sourceId) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const originalPartialPath = hashToPartialPathname(file.sourceId);
|
|
945
|
+
if (!originalPartialPath) {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
|
|
949
|
+
if (!originalUrl) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
|
|
953
|
+
} catch {
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
await fileUrlReplacementQueue.onIdle();
|
|
958
|
+
}
|
|
959
|
+
return JSON.parse(sourceObjectAsString);
|
|
960
|
+
};
|
|
861
961
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
862
|
-
var _a
|
|
863
|
-
|
|
864
|
-
|
|
962
|
+
var _a;
|
|
963
|
+
if (!asset.asset.fields) {
|
|
964
|
+
return asset;
|
|
965
|
+
}
|
|
966
|
+
const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
|
|
967
|
+
if (!fileUrl) {
|
|
865
968
|
return asset;
|
|
866
969
|
}
|
|
867
970
|
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
868
971
|
if (!file) {
|
|
869
972
|
return asset;
|
|
870
973
|
}
|
|
871
|
-
asset.asset.fields.file
|
|
974
|
+
asset.asset.fields.file = {
|
|
975
|
+
type: "file",
|
|
976
|
+
value: file.id
|
|
977
|
+
};
|
|
872
978
|
return asset;
|
|
873
979
|
};
|
|
980
|
+
var legacyUrlToHash = (url) => {
|
|
981
|
+
const hash = createHash("sha256");
|
|
982
|
+
hash.update(url);
|
|
983
|
+
return hash.digest("hex");
|
|
984
|
+
};
|
|
985
|
+
var legacyUrlToFileName = (url) => {
|
|
986
|
+
const fileName = legacyUrlToHash(url);
|
|
987
|
+
const fileExtension = urlToFileExtension(url);
|
|
988
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
989
|
+
};
|
|
874
990
|
|
|
875
991
|
// src/commands/canvas/assetEngineDataSource.ts
|
|
876
992
|
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
@@ -895,8 +1011,8 @@ function prepCompositionForDisk(composition) {
|
|
|
895
1011
|
delete prepped.state;
|
|
896
1012
|
return prepped;
|
|
897
1013
|
}
|
|
898
|
-
function withStateOptions(
|
|
899
|
-
return
|
|
1014
|
+
function withStateOptions(yargs28) {
|
|
1015
|
+
return yargs28.option("state", {
|
|
900
1016
|
type: "string",
|
|
901
1017
|
describe: `Composition state to fetch.`,
|
|
902
1018
|
choices: ["preview", "published"],
|
|
@@ -962,11 +1078,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
962
1078
|
var AssetPullModule = {
|
|
963
1079
|
command: "pull <directory>",
|
|
964
1080
|
describe: "Pulls all assets to local files in a directory",
|
|
965
|
-
builder: (
|
|
1081
|
+
builder: (yargs28) => withConfiguration(
|
|
966
1082
|
withApiOptions(
|
|
967
1083
|
withProjectOptions(
|
|
968
1084
|
withDiffOptions(
|
|
969
|
-
|
|
1085
|
+
yargs28.positional("directory", {
|
|
970
1086
|
describe: "Directory to save the assets to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
971
1087
|
type: "string"
|
|
972
1088
|
}).option("format", {
|
|
@@ -1000,7 +1116,8 @@ var AssetPullModule = {
|
|
|
1000
1116
|
mode,
|
|
1001
1117
|
whatIf,
|
|
1002
1118
|
project: projectId,
|
|
1003
|
-
diff: diffMode
|
|
1119
|
+
diff: diffMode,
|
|
1120
|
+
allowEmptySource
|
|
1004
1121
|
}) => {
|
|
1005
1122
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1006
1123
|
const client = new UncachedAssetClient3({
|
|
@@ -1009,6 +1126,7 @@ var AssetPullModule = {
|
|
|
1009
1126
|
fetch: fetch3,
|
|
1010
1127
|
projectId
|
|
1011
1128
|
});
|
|
1129
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1012
1130
|
const source = createAssetEngineDataSource({ client });
|
|
1013
1131
|
let target;
|
|
1014
1132
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1048,16 +1166,29 @@ var AssetPullModule = {
|
|
|
1048
1166
|
target,
|
|
1049
1167
|
mode,
|
|
1050
1168
|
whatIf,
|
|
1051
|
-
allowEmptySource: true,
|
|
1169
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
1052
1170
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1053
|
-
onBeforeCompareObjects: async (sourceObject) => {
|
|
1171
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1172
|
+
var _a, _b;
|
|
1054
1173
|
delete sourceObject.object.asset._author;
|
|
1055
|
-
|
|
1174
|
+
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
1175
|
+
sourceObject,
|
|
1176
|
+
targetObject,
|
|
1177
|
+
{
|
|
1178
|
+
directory,
|
|
1179
|
+
fileClient
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
if (((_a = sourceObjectWithPotentiallySwappedUrl.object.asset.fields) == null ? void 0 : _a.url) && ((_b = targetObject.object.asset.fields) == null ? void 0 : _b.url) && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
|
|
1183
|
+
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1184
|
+
}
|
|
1185
|
+
return sourceObjectWithPotentiallySwappedUrl;
|
|
1056
1186
|
},
|
|
1057
1187
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1058
1188
|
delete sourceObject.object.asset._author;
|
|
1059
1189
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1060
|
-
directory
|
|
1190
|
+
directory,
|
|
1191
|
+
fileClient
|
|
1061
1192
|
});
|
|
1062
1193
|
}
|
|
1063
1194
|
});
|
|
@@ -1066,15 +1197,15 @@ var AssetPullModule = {
|
|
|
1066
1197
|
|
|
1067
1198
|
// src/commands/canvas/commands/asset/push.ts
|
|
1068
1199
|
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1069
|
-
import { UncachedFileClient } from "@uniformdev/files";
|
|
1200
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1070
1201
|
var AssetPushModule = {
|
|
1071
1202
|
command: "push <directory>",
|
|
1072
1203
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1073
|
-
builder: (
|
|
1204
|
+
builder: (yargs28) => withConfiguration(
|
|
1074
1205
|
withApiOptions(
|
|
1075
1206
|
withProjectOptions(
|
|
1076
1207
|
withDiffOptions(
|
|
1077
|
-
|
|
1208
|
+
yargs28.positional("directory", {
|
|
1078
1209
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1079
1210
|
type: "string"
|
|
1080
1211
|
}).option("what-if", {
|
|
@@ -1101,7 +1232,8 @@ var AssetPushModule = {
|
|
|
1101
1232
|
mode,
|
|
1102
1233
|
whatIf,
|
|
1103
1234
|
project: projectId,
|
|
1104
|
-
diff: diffMode
|
|
1235
|
+
diff: diffMode,
|
|
1236
|
+
allowEmptySource
|
|
1105
1237
|
}) => {
|
|
1106
1238
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1107
1239
|
const client = new UncachedAssetClient4({
|
|
@@ -1127,12 +1259,13 @@ var AssetPushModule = {
|
|
|
1127
1259
|
});
|
|
1128
1260
|
}
|
|
1129
1261
|
const target = createAssetEngineDataSource({ client });
|
|
1130
|
-
const fileClient = new
|
|
1262
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1131
1263
|
await syncEngine({
|
|
1132
1264
|
source,
|
|
1133
1265
|
target,
|
|
1134
1266
|
mode,
|
|
1135
1267
|
whatIf,
|
|
1268
|
+
allowEmptySource,
|
|
1136
1269
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1137
1270
|
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1138
1271
|
if (targetObject) {
|
|
@@ -1172,9 +1305,9 @@ var AssetRemoveModule = {
|
|
|
1172
1305
|
command: "remove <id>",
|
|
1173
1306
|
aliases: ["delete", "rm"],
|
|
1174
1307
|
describe: "Delete an asset",
|
|
1175
|
-
builder: (
|
|
1308
|
+
builder: (yargs28) => withConfiguration(
|
|
1176
1309
|
withApiOptions(
|
|
1177
|
-
withProjectOptions(
|
|
1310
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1178
1311
|
)
|
|
1179
1312
|
),
|
|
1180
1313
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1190,10 +1323,10 @@ var AssetUpdateModule = {
|
|
|
1190
1323
|
command: "update <filename>",
|
|
1191
1324
|
aliases: ["put"],
|
|
1192
1325
|
describe: "Insert or update an asset",
|
|
1193
|
-
builder: (
|
|
1326
|
+
builder: (yargs28) => withConfiguration(
|
|
1194
1327
|
withApiOptions(
|
|
1195
1328
|
withProjectOptions(
|
|
1196
|
-
|
|
1329
|
+
yargs28.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1197
1330
|
)
|
|
1198
1331
|
)
|
|
1199
1332
|
),
|
|
@@ -1209,7 +1342,7 @@ var AssetUpdateModule = {
|
|
|
1209
1342
|
var AssetModule = {
|
|
1210
1343
|
command: "asset <command>",
|
|
1211
1344
|
describe: "Commands for Assets",
|
|
1212
|
-
builder: (
|
|
1345
|
+
builder: (yargs28) => yargs28.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1213
1346
|
handler: () => {
|
|
1214
1347
|
yargs.help();
|
|
1215
1348
|
}
|
|
@@ -1223,11 +1356,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1223
1356
|
var CategoryGetModule = {
|
|
1224
1357
|
command: "get <id>",
|
|
1225
1358
|
describe: "Fetch a category",
|
|
1226
|
-
builder: (
|
|
1359
|
+
builder: (yargs28) => withConfiguration(
|
|
1227
1360
|
withFormatOptions(
|
|
1228
1361
|
withApiOptions(
|
|
1229
1362
|
withProjectOptions(
|
|
1230
|
-
|
|
1363
|
+
yargs28.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1231
1364
|
)
|
|
1232
1365
|
)
|
|
1233
1366
|
)
|
|
@@ -1252,7 +1385,7 @@ var CategoryListModule = {
|
|
|
1252
1385
|
command: "list",
|
|
1253
1386
|
describe: "List categories",
|
|
1254
1387
|
aliases: ["ls"],
|
|
1255
|
-
builder: (
|
|
1388
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28.options({}))))),
|
|
1256
1389
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1257
1390
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1258
1391
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1301,11 +1434,11 @@ function createCategoriesEngineDataSource({
|
|
|
1301
1434
|
var CategoryPullModule = {
|
|
1302
1435
|
command: "pull <directory>",
|
|
1303
1436
|
describe: "Pulls all categories to local files in a directory",
|
|
1304
|
-
builder: (
|
|
1437
|
+
builder: (yargs28) => withConfiguration(
|
|
1305
1438
|
withApiOptions(
|
|
1306
1439
|
withProjectOptions(
|
|
1307
1440
|
withDiffOptions(
|
|
1308
|
-
|
|
1441
|
+
yargs28.positional("directory", {
|
|
1309
1442
|
describe: "Directory to save the categories to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
1310
1443
|
type: "string"
|
|
1311
1444
|
}).option("format", {
|
|
@@ -1339,7 +1472,8 @@ var CategoryPullModule = {
|
|
|
1339
1472
|
mode,
|
|
1340
1473
|
whatIf,
|
|
1341
1474
|
project: projectId,
|
|
1342
|
-
diff: diffMode
|
|
1475
|
+
diff: diffMode,
|
|
1476
|
+
allowEmptySource
|
|
1343
1477
|
}) => {
|
|
1344
1478
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1345
1479
|
const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1370,7 +1504,7 @@ var CategoryPullModule = {
|
|
|
1370
1504
|
target,
|
|
1371
1505
|
mode,
|
|
1372
1506
|
whatIf,
|
|
1373
|
-
allowEmptySource: true,
|
|
1507
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
1374
1508
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1375
1509
|
});
|
|
1376
1510
|
}
|
|
@@ -1381,11 +1515,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1381
1515
|
var CategoryPushModule = {
|
|
1382
1516
|
command: "push <directory>",
|
|
1383
1517
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1384
|
-
builder: (
|
|
1518
|
+
builder: (yargs28) => withConfiguration(
|
|
1385
1519
|
withApiOptions(
|
|
1386
1520
|
withProjectOptions(
|
|
1387
1521
|
withDiffOptions(
|
|
1388
|
-
|
|
1522
|
+
yargs28.positional("directory", {
|
|
1389
1523
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1390
1524
|
type: "string"
|
|
1391
1525
|
}).option("what-if", {
|
|
@@ -1412,7 +1546,8 @@ var CategoryPushModule = {
|
|
|
1412
1546
|
mode,
|
|
1413
1547
|
whatIf,
|
|
1414
1548
|
project: projectId,
|
|
1415
|
-
diff: diffMode
|
|
1549
|
+
diff: diffMode,
|
|
1550
|
+
allowEmptySource
|
|
1416
1551
|
}) => {
|
|
1417
1552
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1418
1553
|
const client = new UncachedCategoryClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1438,6 +1573,7 @@ var CategoryPushModule = {
|
|
|
1438
1573
|
target,
|
|
1439
1574
|
mode,
|
|
1440
1575
|
whatIf,
|
|
1576
|
+
allowEmptySource,
|
|
1441
1577
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1442
1578
|
});
|
|
1443
1579
|
}
|
|
@@ -1449,10 +1585,10 @@ var CategoryRemoveModule = {
|
|
|
1449
1585
|
command: "remove <id>",
|
|
1450
1586
|
aliases: ["delete", "rm"],
|
|
1451
1587
|
describe: "Delete a category",
|
|
1452
|
-
builder: (
|
|
1588
|
+
builder: (yargs28) => withConfiguration(
|
|
1453
1589
|
withApiOptions(
|
|
1454
1590
|
withProjectOptions(
|
|
1455
|
-
|
|
1591
|
+
yargs28.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1456
1592
|
)
|
|
1457
1593
|
)
|
|
1458
1594
|
),
|
|
@@ -1469,10 +1605,10 @@ var CategoryUpdateModule = {
|
|
|
1469
1605
|
command: "update <filename>",
|
|
1470
1606
|
aliases: ["put"],
|
|
1471
1607
|
describe: "Insert or update a category",
|
|
1472
|
-
builder: (
|
|
1608
|
+
builder: (yargs28) => withConfiguration(
|
|
1473
1609
|
withApiOptions(
|
|
1474
1610
|
withProjectOptions(
|
|
1475
|
-
|
|
1611
|
+
yargs28.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1476
1612
|
)
|
|
1477
1613
|
)
|
|
1478
1614
|
),
|
|
@@ -1489,7 +1625,7 @@ var CategoryModule = {
|
|
|
1489
1625
|
command: "category <command>",
|
|
1490
1626
|
aliases: ["cat"],
|
|
1491
1627
|
describe: "Commands for Canvas categories",
|
|
1492
|
-
builder: (
|
|
1628
|
+
builder: (yargs28) => yargs28.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1493
1629
|
handler: () => {
|
|
1494
1630
|
yargs2.help();
|
|
1495
1631
|
}
|
|
@@ -1510,11 +1646,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1510
1646
|
var ComponentGetModule = {
|
|
1511
1647
|
command: "get <id>",
|
|
1512
1648
|
describe: "Fetch a component definition",
|
|
1513
|
-
builder: (
|
|
1649
|
+
builder: (yargs28) => withConfiguration(
|
|
1514
1650
|
withFormatOptions(
|
|
1515
1651
|
withApiOptions(
|
|
1516
1652
|
withProjectOptions(
|
|
1517
|
-
|
|
1653
|
+
yargs28.positional("id", {
|
|
1518
1654
|
demandOption: true,
|
|
1519
1655
|
describe: "Component definition public ID to fetch"
|
|
1520
1656
|
})
|
|
@@ -1548,11 +1684,11 @@ var ComponentListModule = {
|
|
|
1548
1684
|
command: "list",
|
|
1549
1685
|
describe: "List component definitions",
|
|
1550
1686
|
aliases: ["ls"],
|
|
1551
|
-
builder: (
|
|
1687
|
+
builder: (yargs28) => withConfiguration(
|
|
1552
1688
|
withFormatOptions(
|
|
1553
1689
|
withApiOptions(
|
|
1554
1690
|
withProjectOptions(
|
|
1555
|
-
|
|
1691
|
+
yargs28.options({
|
|
1556
1692
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1557
1693
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1558
1694
|
})
|
|
@@ -1607,11 +1743,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1607
1743
|
var ComponentPullModule = {
|
|
1608
1744
|
command: "pull <directory>",
|
|
1609
1745
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1610
|
-
builder: (
|
|
1746
|
+
builder: (yargs28) => withConfiguration(
|
|
1611
1747
|
withApiOptions(
|
|
1612
1748
|
withProjectOptions(
|
|
1613
1749
|
withDiffOptions(
|
|
1614
|
-
|
|
1750
|
+
yargs28.positional("directory", {
|
|
1615
1751
|
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
1616
1752
|
type: "string"
|
|
1617
1753
|
}).option("format", {
|
|
@@ -1645,7 +1781,8 @@ var ComponentPullModule = {
|
|
|
1645
1781
|
mode,
|
|
1646
1782
|
whatIf,
|
|
1647
1783
|
project: projectId,
|
|
1648
|
-
diff: diffMode
|
|
1784
|
+
diff: diffMode,
|
|
1785
|
+
allowEmptySource
|
|
1649
1786
|
}) => {
|
|
1650
1787
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1651
1788
|
const client = new UncachedCanvasClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1677,7 +1814,7 @@ var ComponentPullModule = {
|
|
|
1677
1814
|
target,
|
|
1678
1815
|
mode,
|
|
1679
1816
|
whatIf,
|
|
1680
|
-
allowEmptySource: true,
|
|
1817
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
1681
1818
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1682
1819
|
});
|
|
1683
1820
|
}
|
|
@@ -1688,11 +1825,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1688
1825
|
var ComponentPushModule = {
|
|
1689
1826
|
command: "push <directory>",
|
|
1690
1827
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1691
|
-
builder: (
|
|
1828
|
+
builder: (yargs28) => withConfiguration(
|
|
1692
1829
|
withApiOptions(
|
|
1693
1830
|
withProjectOptions(
|
|
1694
1831
|
withDiffOptions(
|
|
1695
|
-
|
|
1832
|
+
yargs28.positional("directory", {
|
|
1696
1833
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1697
1834
|
type: "string"
|
|
1698
1835
|
}).option("what-if", {
|
|
@@ -1719,7 +1856,8 @@ var ComponentPushModule = {
|
|
|
1719
1856
|
mode,
|
|
1720
1857
|
whatIf,
|
|
1721
1858
|
project: projectId,
|
|
1722
|
-
diff: diffMode
|
|
1859
|
+
diff: diffMode,
|
|
1860
|
+
allowEmptySource
|
|
1723
1861
|
}) => {
|
|
1724
1862
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1725
1863
|
const client = new UncachedCanvasClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1746,6 +1884,7 @@ var ComponentPushModule = {
|
|
|
1746
1884
|
target,
|
|
1747
1885
|
mode,
|
|
1748
1886
|
whatIf,
|
|
1887
|
+
allowEmptySource,
|
|
1749
1888
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1750
1889
|
});
|
|
1751
1890
|
}
|
|
@@ -1757,10 +1896,10 @@ var ComponentRemoveModule = {
|
|
|
1757
1896
|
command: "remove <id>",
|
|
1758
1897
|
aliases: ["delete", "rm"],
|
|
1759
1898
|
describe: "Delete a component definition",
|
|
1760
|
-
builder: (
|
|
1899
|
+
builder: (yargs28) => withConfiguration(
|
|
1761
1900
|
withApiOptions(
|
|
1762
1901
|
withProjectOptions(
|
|
1763
|
-
|
|
1902
|
+
yargs28.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1764
1903
|
)
|
|
1765
1904
|
)
|
|
1766
1905
|
),
|
|
@@ -1777,10 +1916,10 @@ var ComponentUpdateModule = {
|
|
|
1777
1916
|
command: "update <filename>",
|
|
1778
1917
|
aliases: ["put"],
|
|
1779
1918
|
describe: "Insert or update a component definition",
|
|
1780
|
-
builder: (
|
|
1919
|
+
builder: (yargs28) => withConfiguration(
|
|
1781
1920
|
withApiOptions(
|
|
1782
1921
|
withProjectOptions(
|
|
1783
|
-
|
|
1922
|
+
yargs28.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1784
1923
|
)
|
|
1785
1924
|
)
|
|
1786
1925
|
),
|
|
@@ -1797,7 +1936,7 @@ var ComponentModule = {
|
|
|
1797
1936
|
command: "component <command>",
|
|
1798
1937
|
aliases: ["def"],
|
|
1799
1938
|
describe: "Commands for Canvas component definitions",
|
|
1800
|
-
builder: (
|
|
1939
|
+
builder: (yargs28) => yargs28.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1801
1940
|
handler: () => {
|
|
1802
1941
|
yargs3.help();
|
|
1803
1942
|
}
|
|
@@ -1811,12 +1950,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1811
1950
|
var CompositionGetModule = {
|
|
1812
1951
|
command: "get <id>",
|
|
1813
1952
|
describe: "Fetch a composition",
|
|
1814
|
-
builder: (
|
|
1953
|
+
builder: (yargs28) => withFormatOptions(
|
|
1815
1954
|
withConfiguration(
|
|
1816
1955
|
withApiOptions(
|
|
1817
1956
|
withProjectOptions(
|
|
1818
1957
|
withStateOptions(
|
|
1819
|
-
|
|
1958
|
+
yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1820
1959
|
resolvePatterns: {
|
|
1821
1960
|
type: "boolean",
|
|
1822
1961
|
default: false,
|
|
@@ -1887,12 +2026,12 @@ var CompositionListModule = {
|
|
|
1887
2026
|
command: "list",
|
|
1888
2027
|
describe: "List compositions",
|
|
1889
2028
|
aliases: ["ls"],
|
|
1890
|
-
builder: (
|
|
2029
|
+
builder: (yargs28) => withFormatOptions(
|
|
1891
2030
|
withConfiguration(
|
|
1892
2031
|
withApiOptions(
|
|
1893
2032
|
withProjectOptions(
|
|
1894
2033
|
withStateOptions(
|
|
1895
|
-
|
|
2034
|
+
yargs28.options({
|
|
1896
2035
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1897
2036
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1898
2037
|
resolvePatterns: {
|
|
@@ -2013,11 +2152,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2013
2152
|
var CompositionPublishModule = {
|
|
2014
2153
|
command: "publish [ids]",
|
|
2015
2154
|
describe: "Publishes composition(s)",
|
|
2016
|
-
builder: (
|
|
2155
|
+
builder: (yargs28) => withConfiguration(
|
|
2017
2156
|
withApiOptions(
|
|
2018
2157
|
withProjectOptions(
|
|
2019
2158
|
withDiffOptions(
|
|
2020
|
-
|
|
2159
|
+
yargs28.positional("ids", {
|
|
2021
2160
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2022
2161
|
type: "string"
|
|
2023
2162
|
}).option("all", {
|
|
@@ -2089,15 +2228,16 @@ var CompositionPublishModule = {
|
|
|
2089
2228
|
|
|
2090
2229
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2091
2230
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
2231
|
+
import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
2092
2232
|
var CompositionPullModule = {
|
|
2093
2233
|
command: "pull <directory>",
|
|
2094
2234
|
describe: "Pulls all compositions to local files in a directory",
|
|
2095
|
-
builder: (
|
|
2235
|
+
builder: (yargs28) => withConfiguration(
|
|
2096
2236
|
withApiOptions(
|
|
2097
2237
|
withProjectOptions(
|
|
2098
2238
|
withStateOptions(
|
|
2099
2239
|
withDiffOptions(
|
|
2100
|
-
|
|
2240
|
+
yargs28.positional("directory", {
|
|
2101
2241
|
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2102
2242
|
type: "string"
|
|
2103
2243
|
}).option("format", {
|
|
@@ -2144,10 +2284,12 @@ var CompositionPullModule = {
|
|
|
2144
2284
|
whatIf,
|
|
2145
2285
|
state,
|
|
2146
2286
|
project: projectId,
|
|
2147
|
-
diff: diffMode
|
|
2287
|
+
diff: diffMode,
|
|
2288
|
+
allowEmptySource
|
|
2148
2289
|
}) => {
|
|
2149
2290
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2150
2291
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2292
|
+
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2151
2293
|
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2152
2294
|
const isPackage = isPathAPackageFile(directory);
|
|
2153
2295
|
let target;
|
|
@@ -2175,11 +2317,18 @@ var CompositionPullModule = {
|
|
|
2175
2317
|
target,
|
|
2176
2318
|
mode,
|
|
2177
2319
|
whatIf,
|
|
2178
|
-
allowEmptySource: true,
|
|
2320
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
2179
2321
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2322
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
2323
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
2324
|
+
directory,
|
|
2325
|
+
fileClient
|
|
2326
|
+
});
|
|
2327
|
+
},
|
|
2180
2328
|
onBeforeWriteObject: async (sourceObject) => {
|
|
2181
2329
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
2182
|
-
directory
|
|
2330
|
+
directory,
|
|
2331
|
+
fileClient
|
|
2183
2332
|
});
|
|
2184
2333
|
}
|
|
2185
2334
|
});
|
|
@@ -2188,16 +2337,16 @@ var CompositionPullModule = {
|
|
|
2188
2337
|
|
|
2189
2338
|
// src/commands/canvas/commands/composition/push.ts
|
|
2190
2339
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2191
|
-
import { UncachedFileClient as
|
|
2340
|
+
import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
2192
2341
|
var CompositionPushModule = {
|
|
2193
2342
|
command: "push <directory>",
|
|
2194
2343
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2195
|
-
builder: (
|
|
2344
|
+
builder: (yargs28) => withConfiguration(
|
|
2196
2345
|
withApiOptions(
|
|
2197
2346
|
withProjectOptions(
|
|
2198
2347
|
withStateOptions(
|
|
2199
2348
|
withDiffOptions(
|
|
2200
|
-
|
|
2349
|
+
yargs28.positional("directory", {
|
|
2201
2350
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2202
2351
|
type: "string"
|
|
2203
2352
|
}).option("what-if", {
|
|
@@ -2237,7 +2386,8 @@ var CompositionPushModule = {
|
|
|
2237
2386
|
project: projectId,
|
|
2238
2387
|
onlyCompositions,
|
|
2239
2388
|
onlyPatterns,
|
|
2240
|
-
diff: diffMode
|
|
2389
|
+
diff: diffMode,
|
|
2390
|
+
allowEmptySource
|
|
2241
2391
|
}) => {
|
|
2242
2392
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2243
2393
|
const client = new UncachedCanvasClient11({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -2258,12 +2408,13 @@ var CompositionPushModule = {
|
|
|
2258
2408
|
});
|
|
2259
2409
|
}
|
|
2260
2410
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2261
|
-
const fileClient = new
|
|
2411
|
+
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2262
2412
|
await syncEngine({
|
|
2263
2413
|
source,
|
|
2264
2414
|
target,
|
|
2265
2415
|
mode,
|
|
2266
2416
|
whatIf,
|
|
2417
|
+
allowEmptySource,
|
|
2267
2418
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2268
2419
|
onBeforeCompareObjects: async (sourceObject) => {
|
|
2269
2420
|
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
@@ -2286,10 +2437,10 @@ var CompositionRemoveModule = {
|
|
|
2286
2437
|
command: "remove <id>",
|
|
2287
2438
|
aliases: ["delete", "rm"],
|
|
2288
2439
|
describe: "Delete a composition",
|
|
2289
|
-
builder: (
|
|
2440
|
+
builder: (yargs28) => withConfiguration(
|
|
2290
2441
|
withApiOptions(
|
|
2291
2442
|
withProjectOptions(
|
|
2292
|
-
|
|
2443
|
+
yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2293
2444
|
)
|
|
2294
2445
|
)
|
|
2295
2446
|
),
|
|
@@ -2306,10 +2457,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2306
2457
|
var CompositionUnpublishModule = {
|
|
2307
2458
|
command: "unpublish [ids]",
|
|
2308
2459
|
describe: "Unpublish a composition(s)",
|
|
2309
|
-
builder: (
|
|
2460
|
+
builder: (yargs28) => withConfiguration(
|
|
2310
2461
|
withApiOptions(
|
|
2311
2462
|
withProjectOptions(
|
|
2312
|
-
|
|
2463
|
+
yargs28.positional("ids", {
|
|
2313
2464
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2314
2465
|
type: "string"
|
|
2315
2466
|
}).option("all", {
|
|
@@ -2403,11 +2554,11 @@ var CompositionUpdateModule = {
|
|
|
2403
2554
|
command: "update <filename>",
|
|
2404
2555
|
aliases: ["put"],
|
|
2405
2556
|
describe: "Insert or update a composition",
|
|
2406
|
-
builder: (
|
|
2557
|
+
builder: (yargs28) => withConfiguration(
|
|
2407
2558
|
withApiOptions(
|
|
2408
2559
|
withProjectOptions(
|
|
2409
2560
|
withStateOptions(
|
|
2410
|
-
|
|
2561
|
+
yargs28.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2411
2562
|
)
|
|
2412
2563
|
)
|
|
2413
2564
|
)
|
|
@@ -2425,7 +2576,7 @@ var CompositionModule = {
|
|
|
2425
2576
|
command: "composition <command>",
|
|
2426
2577
|
describe: "Commands for Canvas compositions",
|
|
2427
2578
|
aliases: ["comp"],
|
|
2428
|
-
builder: (
|
|
2579
|
+
builder: (yargs28) => yargs28.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2429
2580
|
handler: () => {
|
|
2430
2581
|
yargs4.help();
|
|
2431
2582
|
}
|
|
@@ -2439,12 +2590,12 @@ import { ContentClient } from "@uniformdev/canvas";
|
|
|
2439
2590
|
var ContentTypeGetModule = {
|
|
2440
2591
|
command: "get <id>",
|
|
2441
2592
|
describe: "Get a content type",
|
|
2442
|
-
builder: (
|
|
2593
|
+
builder: (yargs28) => withConfiguration(
|
|
2443
2594
|
withFormatOptions(
|
|
2444
2595
|
withApiOptions(
|
|
2445
2596
|
withProjectOptions(
|
|
2446
2597
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2447
|
-
|
|
2598
|
+
yargs28.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2448
2599
|
)
|
|
2449
2600
|
)
|
|
2450
2601
|
)
|
|
@@ -2466,7 +2617,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2466
2617
|
var ContentTypeListModule = {
|
|
2467
2618
|
command: "list",
|
|
2468
2619
|
describe: "List content types",
|
|
2469
|
-
builder: (
|
|
2620
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
2470
2621
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2471
2622
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2472
2623
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2513,11 +2664,11 @@ function createContentTypeEngineDataSource({
|
|
|
2513
2664
|
var ContentTypePullModule = {
|
|
2514
2665
|
command: "pull <directory>",
|
|
2515
2666
|
describe: "Pulls all content types to local files in a directory",
|
|
2516
|
-
builder: (
|
|
2667
|
+
builder: (yargs28) => withConfiguration(
|
|
2517
2668
|
withApiOptions(
|
|
2518
2669
|
withProjectOptions(
|
|
2519
2670
|
withDiffOptions(
|
|
2520
|
-
|
|
2671
|
+
yargs28.positional("directory", {
|
|
2521
2672
|
describe: "Directory to save the content types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2522
2673
|
type: "string"
|
|
2523
2674
|
}).option("format", {
|
|
@@ -2551,7 +2702,8 @@ var ContentTypePullModule = {
|
|
|
2551
2702
|
mode,
|
|
2552
2703
|
whatIf,
|
|
2553
2704
|
project: projectId,
|
|
2554
|
-
diff: diffMode
|
|
2705
|
+
diff: diffMode,
|
|
2706
|
+
allowEmptySource
|
|
2555
2707
|
}) => {
|
|
2556
2708
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2557
2709
|
const client = new ContentClient3({
|
|
@@ -2588,7 +2740,7 @@ var ContentTypePullModule = {
|
|
|
2588
2740
|
target,
|
|
2589
2741
|
mode,
|
|
2590
2742
|
whatIf,
|
|
2591
|
-
allowEmptySource: true,
|
|
2743
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
2592
2744
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2593
2745
|
});
|
|
2594
2746
|
}
|
|
@@ -2599,11 +2751,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2599
2751
|
var ContentTypePushModule = {
|
|
2600
2752
|
command: "push <directory>",
|
|
2601
2753
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2602
|
-
builder: (
|
|
2754
|
+
builder: (yargs28) => withConfiguration(
|
|
2603
2755
|
withApiOptions(
|
|
2604
2756
|
withProjectOptions(
|
|
2605
2757
|
withDiffOptions(
|
|
2606
|
-
|
|
2758
|
+
yargs28.positional("directory", {
|
|
2607
2759
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2608
2760
|
type: "string"
|
|
2609
2761
|
}).option("what-if", {
|
|
@@ -2630,7 +2782,8 @@ var ContentTypePushModule = {
|
|
|
2630
2782
|
mode,
|
|
2631
2783
|
whatIf,
|
|
2632
2784
|
project: projectId,
|
|
2633
|
-
diff: diffMode
|
|
2785
|
+
diff: diffMode,
|
|
2786
|
+
allowEmptySource
|
|
2634
2787
|
}) => {
|
|
2635
2788
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2636
2789
|
const client = new ContentClient4({
|
|
@@ -2662,6 +2815,7 @@ var ContentTypePushModule = {
|
|
|
2662
2815
|
target,
|
|
2663
2816
|
mode,
|
|
2664
2817
|
whatIf,
|
|
2818
|
+
allowEmptySource,
|
|
2665
2819
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2666
2820
|
});
|
|
2667
2821
|
}
|
|
@@ -2673,10 +2827,10 @@ var ContentTypeRemoveModule = {
|
|
|
2673
2827
|
command: "remove <id>",
|
|
2674
2828
|
aliases: ["delete", "rm"],
|
|
2675
2829
|
describe: "Delete a content type",
|
|
2676
|
-
builder: (
|
|
2830
|
+
builder: (yargs28) => withConfiguration(
|
|
2677
2831
|
withApiOptions(
|
|
2678
2832
|
withProjectOptions(
|
|
2679
|
-
|
|
2833
|
+
yargs28.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2680
2834
|
)
|
|
2681
2835
|
)
|
|
2682
2836
|
),
|
|
@@ -2693,10 +2847,10 @@ var ContentTypeUpdateModule = {
|
|
|
2693
2847
|
command: "update <filename>",
|
|
2694
2848
|
aliases: ["put"],
|
|
2695
2849
|
describe: "Insert or update a content type",
|
|
2696
|
-
builder: (
|
|
2850
|
+
builder: (yargs28) => withConfiguration(
|
|
2697
2851
|
withApiOptions(
|
|
2698
2852
|
withProjectOptions(
|
|
2699
|
-
|
|
2853
|
+
yargs28.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2700
2854
|
)
|
|
2701
2855
|
)
|
|
2702
2856
|
),
|
|
@@ -2713,7 +2867,7 @@ var ContentTypeModule = {
|
|
|
2713
2867
|
command: "contenttype <command>",
|
|
2714
2868
|
aliases: ["ct"],
|
|
2715
2869
|
describe: "Commands for Content Types",
|
|
2716
|
-
builder: (
|
|
2870
|
+
builder: (yargs28) => yargs28.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2717
2871
|
handler: () => {
|
|
2718
2872
|
yargs5.help();
|
|
2719
2873
|
}
|
|
@@ -2728,12 +2882,12 @@ var DataTypeGetModule = {
|
|
|
2728
2882
|
command: "get <id>",
|
|
2729
2883
|
describe: "Get a data type",
|
|
2730
2884
|
aliases: ["ls"],
|
|
2731
|
-
builder: (
|
|
2885
|
+
builder: (yargs28) => withConfiguration(
|
|
2732
2886
|
withFormatOptions(
|
|
2733
2887
|
withApiOptions(
|
|
2734
2888
|
withProjectOptions(
|
|
2735
2889
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2736
|
-
|
|
2890
|
+
yargs28.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2737
2891
|
)
|
|
2738
2892
|
)
|
|
2739
2893
|
)
|
|
@@ -2756,7 +2910,7 @@ var DataTypeListModule = {
|
|
|
2756
2910
|
command: "list",
|
|
2757
2911
|
describe: "List data types",
|
|
2758
2912
|
aliases: ["ls"],
|
|
2759
|
-
builder: (
|
|
2913
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
2760
2914
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2761
2915
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2762
2916
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2805,11 +2959,11 @@ function createDataTypeEngineDataSource({
|
|
|
2805
2959
|
var DataTypePullModule = {
|
|
2806
2960
|
command: "pull <directory>",
|
|
2807
2961
|
describe: "Pulls all data types to local files in a directory",
|
|
2808
|
-
builder: (
|
|
2962
|
+
builder: (yargs28) => withConfiguration(
|
|
2809
2963
|
withApiOptions(
|
|
2810
2964
|
withProjectOptions(
|
|
2811
2965
|
withDiffOptions(
|
|
2812
|
-
|
|
2966
|
+
yargs28.positional("directory", {
|
|
2813
2967
|
describe: "Directory to save the data types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
2814
2968
|
type: "string"
|
|
2815
2969
|
}).option("format", {
|
|
@@ -2843,7 +2997,8 @@ var DataTypePullModule = {
|
|
|
2843
2997
|
mode,
|
|
2844
2998
|
whatIf,
|
|
2845
2999
|
project: projectId,
|
|
2846
|
-
diff: diffMode
|
|
3000
|
+
diff: diffMode,
|
|
3001
|
+
allowEmptySource
|
|
2847
3002
|
}) => {
|
|
2848
3003
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2849
3004
|
const client = new DataTypeClient3({
|
|
@@ -2880,7 +3035,7 @@ var DataTypePullModule = {
|
|
|
2880
3035
|
target,
|
|
2881
3036
|
mode,
|
|
2882
3037
|
whatIf,
|
|
2883
|
-
allowEmptySource: true,
|
|
3038
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
2884
3039
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2885
3040
|
});
|
|
2886
3041
|
}
|
|
@@ -2891,11 +3046,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
2891
3046
|
var DataTypePushModule = {
|
|
2892
3047
|
command: "push <directory>",
|
|
2893
3048
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2894
|
-
builder: (
|
|
3049
|
+
builder: (yargs28) => withConfiguration(
|
|
2895
3050
|
withApiOptions(
|
|
2896
3051
|
withProjectOptions(
|
|
2897
3052
|
withDiffOptions(
|
|
2898
|
-
|
|
3053
|
+
yargs28.positional("directory", {
|
|
2899
3054
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2900
3055
|
type: "string"
|
|
2901
3056
|
}).option("what-if", {
|
|
@@ -2922,7 +3077,8 @@ var DataTypePushModule = {
|
|
|
2922
3077
|
mode,
|
|
2923
3078
|
whatIf,
|
|
2924
3079
|
project: projectId,
|
|
2925
|
-
diff: diffMode
|
|
3080
|
+
diff: diffMode,
|
|
3081
|
+
allowEmptySource
|
|
2926
3082
|
}) => {
|
|
2927
3083
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2928
3084
|
const client = new DataTypeClient4({
|
|
@@ -2954,6 +3110,7 @@ var DataTypePushModule = {
|
|
|
2954
3110
|
target,
|
|
2955
3111
|
mode,
|
|
2956
3112
|
whatIf,
|
|
3113
|
+
allowEmptySource,
|
|
2957
3114
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
2958
3115
|
});
|
|
2959
3116
|
}
|
|
@@ -2965,10 +3122,10 @@ var DataTypeRemoveModule = {
|
|
|
2965
3122
|
command: "remove <id>",
|
|
2966
3123
|
aliases: ["delete", "rm"],
|
|
2967
3124
|
describe: "Delete a data type",
|
|
2968
|
-
builder: (
|
|
3125
|
+
builder: (yargs28) => withConfiguration(
|
|
2969
3126
|
withApiOptions(
|
|
2970
3127
|
withProjectOptions(
|
|
2971
|
-
|
|
3128
|
+
yargs28.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2972
3129
|
)
|
|
2973
3130
|
)
|
|
2974
3131
|
),
|
|
@@ -2985,10 +3142,10 @@ var DataTypeUpdateModule = {
|
|
|
2985
3142
|
command: "update <filename>",
|
|
2986
3143
|
aliases: ["put"],
|
|
2987
3144
|
describe: "Insert or update a data type",
|
|
2988
|
-
builder: (
|
|
3145
|
+
builder: (yargs28) => withConfiguration(
|
|
2989
3146
|
withApiOptions(
|
|
2990
3147
|
withProjectOptions(
|
|
2991
|
-
|
|
3148
|
+
yargs28.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2992
3149
|
)
|
|
2993
3150
|
)
|
|
2994
3151
|
),
|
|
@@ -3005,7 +3162,7 @@ var DataTypeModule = {
|
|
|
3005
3162
|
command: "datatype <command>",
|
|
3006
3163
|
aliases: ["dt"],
|
|
3007
3164
|
describe: "Commands for Data Type definitions",
|
|
3008
|
-
builder: (
|
|
3165
|
+
builder: (yargs28) => yargs28.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3009
3166
|
handler: () => {
|
|
3010
3167
|
yargs6.help();
|
|
3011
3168
|
}
|
|
@@ -3019,12 +3176,12 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
|
3019
3176
|
var EntryGetModule = {
|
|
3020
3177
|
command: "get <id>",
|
|
3021
3178
|
describe: "Get an entry",
|
|
3022
|
-
builder: (
|
|
3179
|
+
builder: (yargs28) => withConfiguration(
|
|
3023
3180
|
withFormatOptions(
|
|
3024
3181
|
withApiOptions(
|
|
3025
3182
|
withProjectOptions(
|
|
3026
3183
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3027
|
-
|
|
3184
|
+
yargs28.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
3028
3185
|
)
|
|
3029
3186
|
)
|
|
3030
3187
|
)
|
|
@@ -3036,7 +3193,9 @@ var EntryGetModule = {
|
|
|
3036
3193
|
offset: 0,
|
|
3037
3194
|
limit: 1,
|
|
3038
3195
|
entryIDs: [id],
|
|
3039
|
-
skipOverridesResolution: true
|
|
3196
|
+
skipOverridesResolution: true,
|
|
3197
|
+
skipPatternResolution: true,
|
|
3198
|
+
skipDataResolution: true
|
|
3040
3199
|
});
|
|
3041
3200
|
if (res.entries.length !== 1) {
|
|
3042
3201
|
throw new Error(`Entry with ID ${id} not found`);
|
|
@@ -3050,17 +3209,24 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
|
3050
3209
|
var EntryListModule = {
|
|
3051
3210
|
command: "list",
|
|
3052
3211
|
describe: "List entries",
|
|
3053
|
-
builder: (
|
|
3212
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3054
3213
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3055
3214
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3056
3215
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
3057
|
-
const res = await client.getEntries({
|
|
3216
|
+
const res = await client.getEntries({
|
|
3217
|
+
offset: 0,
|
|
3218
|
+
limit: 1e3,
|
|
3219
|
+
skipOverridesResolution: true,
|
|
3220
|
+
skipPatternResolution: true,
|
|
3221
|
+
skipDataResolution: true
|
|
3222
|
+
});
|
|
3058
3223
|
emitWithFormat(res.entries, format, filename);
|
|
3059
3224
|
}
|
|
3060
3225
|
};
|
|
3061
3226
|
|
|
3062
3227
|
// src/commands/canvas/commands/entry/pull.ts
|
|
3063
3228
|
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3229
|
+
import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
3064
3230
|
|
|
3065
3231
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3066
3232
|
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
@@ -3081,6 +3247,7 @@ function createEntryEngineDataSource({
|
|
|
3081
3247
|
limit: 1e3,
|
|
3082
3248
|
skipDataResolution: true,
|
|
3083
3249
|
skipOverridesResolution: true,
|
|
3250
|
+
skipPatternResolution: true,
|
|
3084
3251
|
state: stateId,
|
|
3085
3252
|
withComponentIDs: true
|
|
3086
3253
|
});
|
|
@@ -3109,12 +3276,12 @@ function createEntryEngineDataSource({
|
|
|
3109
3276
|
var EntryPullModule = {
|
|
3110
3277
|
command: "pull <directory>",
|
|
3111
3278
|
describe: "Pulls all entries to local files in a directory",
|
|
3112
|
-
builder: (
|
|
3279
|
+
builder: (yargs28) => withConfiguration(
|
|
3113
3280
|
withApiOptions(
|
|
3114
3281
|
withProjectOptions(
|
|
3115
3282
|
withStateOptions(
|
|
3116
3283
|
withDiffOptions(
|
|
3117
|
-
|
|
3284
|
+
yargs28.positional("directory", {
|
|
3118
3285
|
describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3119
3286
|
type: "string"
|
|
3120
3287
|
}).option("format", {
|
|
@@ -3150,7 +3317,8 @@ var EntryPullModule = {
|
|
|
3150
3317
|
whatIf,
|
|
3151
3318
|
state,
|
|
3152
3319
|
project: projectId,
|
|
3153
|
-
diff: diffMode
|
|
3320
|
+
diff: diffMode,
|
|
3321
|
+
allowEmptySource
|
|
3154
3322
|
}) => {
|
|
3155
3323
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3156
3324
|
const client = new ContentClient10({
|
|
@@ -3160,6 +3328,7 @@ var EntryPullModule = {
|
|
|
3160
3328
|
projectId,
|
|
3161
3329
|
bypassCache: true
|
|
3162
3330
|
});
|
|
3331
|
+
const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3163
3332
|
const source = createEntryEngineDataSource({ client, state });
|
|
3164
3333
|
let target;
|
|
3165
3334
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3187,23 +3356,36 @@ var EntryPullModule = {
|
|
|
3187
3356
|
target,
|
|
3188
3357
|
mode,
|
|
3189
3358
|
whatIf,
|
|
3190
|
-
allowEmptySource: true,
|
|
3191
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3359
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
3360
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3361
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
3362
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
3363
|
+
directory,
|
|
3364
|
+
fileClient
|
|
3365
|
+
});
|
|
3366
|
+
},
|
|
3367
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3368
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
3369
|
+
directory,
|
|
3370
|
+
fileClient
|
|
3371
|
+
});
|
|
3372
|
+
}
|
|
3192
3373
|
});
|
|
3193
3374
|
}
|
|
3194
3375
|
};
|
|
3195
3376
|
|
|
3196
3377
|
// src/commands/canvas/commands/entry/push.ts
|
|
3197
3378
|
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
3379
|
+
import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
3198
3380
|
var EntryPushModule = {
|
|
3199
3381
|
command: "push <directory>",
|
|
3200
3382
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3201
|
-
builder: (
|
|
3383
|
+
builder: (yargs28) => withConfiguration(
|
|
3202
3384
|
withApiOptions(
|
|
3203
3385
|
withProjectOptions(
|
|
3204
3386
|
withStateOptions(
|
|
3205
3387
|
withDiffOptions(
|
|
3206
|
-
|
|
3388
|
+
yargs28.positional("directory", {
|
|
3207
3389
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3208
3390
|
type: "string"
|
|
3209
3391
|
}).option("what-if", {
|
|
@@ -3232,7 +3414,8 @@ var EntryPushModule = {
|
|
|
3232
3414
|
whatIf,
|
|
3233
3415
|
state,
|
|
3234
3416
|
project: projectId,
|
|
3235
|
-
diff: diffMode
|
|
3417
|
+
diff: diffMode,
|
|
3418
|
+
allowEmptySource
|
|
3236
3419
|
}) => {
|
|
3237
3420
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3238
3421
|
const client = new ContentClient11({
|
|
@@ -3259,12 +3442,25 @@ var EntryPushModule = {
|
|
|
3259
3442
|
});
|
|
3260
3443
|
}
|
|
3261
3444
|
const target = createEntryEngineDataSource({ client, state });
|
|
3445
|
+
const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3262
3446
|
await syncEngine({
|
|
3263
3447
|
source,
|
|
3264
3448
|
target,
|
|
3265
3449
|
mode,
|
|
3266
3450
|
whatIf,
|
|
3267
|
-
|
|
3451
|
+
allowEmptySource,
|
|
3452
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3453
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
3454
|
+
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
3455
|
+
fileClient
|
|
3456
|
+
});
|
|
3457
|
+
},
|
|
3458
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3459
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
3460
|
+
directory,
|
|
3461
|
+
fileClient
|
|
3462
|
+
});
|
|
3463
|
+
}
|
|
3268
3464
|
});
|
|
3269
3465
|
}
|
|
3270
3466
|
};
|
|
@@ -3275,10 +3471,10 @@ var EntryRemoveModule = {
|
|
|
3275
3471
|
command: "remove <id>",
|
|
3276
3472
|
aliases: ["delete", "rm"],
|
|
3277
3473
|
describe: "Delete an entry",
|
|
3278
|
-
builder: (
|
|
3474
|
+
builder: (yargs28) => withConfiguration(
|
|
3279
3475
|
withApiOptions(
|
|
3280
3476
|
withProjectOptions(
|
|
3281
|
-
|
|
3477
|
+
yargs28.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3282
3478
|
)
|
|
3283
3479
|
)
|
|
3284
3480
|
),
|
|
@@ -3295,10 +3491,10 @@ var EntryUpdateModule = {
|
|
|
3295
3491
|
command: "update <filename>",
|
|
3296
3492
|
aliases: ["put"],
|
|
3297
3493
|
describe: "Insert or update an entry",
|
|
3298
|
-
builder: (
|
|
3494
|
+
builder: (yargs28) => withConfiguration(
|
|
3299
3495
|
withApiOptions(
|
|
3300
3496
|
withProjectOptions(
|
|
3301
|
-
|
|
3497
|
+
yargs28.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
3302
3498
|
)
|
|
3303
3499
|
)
|
|
3304
3500
|
),
|
|
@@ -3314,15 +3510,221 @@ var EntryUpdateModule = {
|
|
|
3314
3510
|
var EntryModule = {
|
|
3315
3511
|
command: "entry <command>",
|
|
3316
3512
|
describe: "Commands for Entries",
|
|
3317
|
-
builder: (
|
|
3513
|
+
builder: (yargs28) => yargs28.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
3318
3514
|
handler: () => {
|
|
3319
3515
|
yargs7.help();
|
|
3320
3516
|
}
|
|
3321
3517
|
};
|
|
3322
3518
|
|
|
3323
|
-
// src/commands/canvas/commands/
|
|
3519
|
+
// src/commands/canvas/commands/locale.ts
|
|
3324
3520
|
import yargs8 from "yargs";
|
|
3325
3521
|
|
|
3522
|
+
// src/commands/canvas/commands/locale/pull.ts
|
|
3523
|
+
import { LocaleClient } from "@uniformdev/canvas";
|
|
3524
|
+
|
|
3525
|
+
// src/commands/canvas/localesEngineDataSource.ts
|
|
3526
|
+
function createLocaleEngineDataSource({
|
|
3527
|
+
client
|
|
3528
|
+
}) {
|
|
3529
|
+
async function* getObjects() {
|
|
3530
|
+
const locales = (await client.get()).results;
|
|
3531
|
+
for await (const locale of locales) {
|
|
3532
|
+
const result = {
|
|
3533
|
+
id: locale.locale,
|
|
3534
|
+
displayName: locale.displayName,
|
|
3535
|
+
providerId: locale.locale,
|
|
3536
|
+
object: locale
|
|
3537
|
+
};
|
|
3538
|
+
yield result;
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
return {
|
|
3542
|
+
objects: getObjects(),
|
|
3543
|
+
deleteObject: async (providerId) => {
|
|
3544
|
+
await client.remove({ locale: providerId });
|
|
3545
|
+
},
|
|
3546
|
+
writeObject: async (object) => {
|
|
3547
|
+
await client.upsert({
|
|
3548
|
+
locale: object.object
|
|
3549
|
+
});
|
|
3550
|
+
}
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
// src/commands/canvas/commands/locale/pull.ts
|
|
3555
|
+
var LocalePullModule = {
|
|
3556
|
+
command: "pull <directory>",
|
|
3557
|
+
describe: "Pulls all locales to local files in a directory",
|
|
3558
|
+
builder: (yargs28) => withConfiguration(
|
|
3559
|
+
withApiOptions(
|
|
3560
|
+
withProjectOptions(
|
|
3561
|
+
withDiffOptions(
|
|
3562
|
+
yargs28.positional("directory", {
|
|
3563
|
+
describe: "Directory to save the locales to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3564
|
+
type: "string"
|
|
3565
|
+
}).option("format", {
|
|
3566
|
+
alias: ["f"],
|
|
3567
|
+
describe: "Output format",
|
|
3568
|
+
default: "yaml",
|
|
3569
|
+
choices: ["yaml", "json"],
|
|
3570
|
+
type: "string"
|
|
3571
|
+
}).option("what-if", {
|
|
3572
|
+
alias: ["w"],
|
|
3573
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3574
|
+
default: false,
|
|
3575
|
+
type: "boolean"
|
|
3576
|
+
}).option("mode", {
|
|
3577
|
+
alias: ["m"],
|
|
3578
|
+
describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
|
|
3579
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3580
|
+
default: "mirror",
|
|
3581
|
+
type: "string"
|
|
3582
|
+
})
|
|
3583
|
+
)
|
|
3584
|
+
)
|
|
3585
|
+
)
|
|
3586
|
+
),
|
|
3587
|
+
handler: async ({
|
|
3588
|
+
apiHost,
|
|
3589
|
+
apiKey,
|
|
3590
|
+
proxy,
|
|
3591
|
+
directory,
|
|
3592
|
+
format,
|
|
3593
|
+
mode,
|
|
3594
|
+
whatIf,
|
|
3595
|
+
project: projectId,
|
|
3596
|
+
diff: diffMode,
|
|
3597
|
+
allowEmptySource
|
|
3598
|
+
}) => {
|
|
3599
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
3600
|
+
const client = new LocaleClient({
|
|
3601
|
+
apiKey,
|
|
3602
|
+
apiHost,
|
|
3603
|
+
fetch: fetch3,
|
|
3604
|
+
projectId,
|
|
3605
|
+
bypassCache: true
|
|
3606
|
+
});
|
|
3607
|
+
const source = createLocaleEngineDataSource({ client });
|
|
3608
|
+
let target;
|
|
3609
|
+
const isPackage = isPathAPackageFile(directory);
|
|
3610
|
+
if (isPackage) {
|
|
3611
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
3612
|
+
target = await createArraySyncEngineDataSource({
|
|
3613
|
+
objects: packageContents.locales ?? [],
|
|
3614
|
+
selectIdentifier: (i) => i.locale,
|
|
3615
|
+
selectDisplayName: (i) => i.displayName,
|
|
3616
|
+
onSyncComplete: async (_, synced) => {
|
|
3617
|
+
packageContents.locales = synced;
|
|
3618
|
+
writeCanvasPackage(directory, packageContents);
|
|
3619
|
+
}
|
|
3620
|
+
});
|
|
3621
|
+
} else {
|
|
3622
|
+
target = await createFileSyncEngineDataSource({
|
|
3623
|
+
directory,
|
|
3624
|
+
selectIdentifier: (i) => i.locale,
|
|
3625
|
+
selectDisplayName: (i) => i.displayName,
|
|
3626
|
+
format
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
await syncEngine({
|
|
3630
|
+
source,
|
|
3631
|
+
target,
|
|
3632
|
+
mode,
|
|
3633
|
+
whatIf,
|
|
3634
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
3635
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3636
|
+
});
|
|
3637
|
+
}
|
|
3638
|
+
};
|
|
3639
|
+
|
|
3640
|
+
// src/commands/canvas/commands/locale/push.ts
|
|
3641
|
+
import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
3642
|
+
var LocalePushModule = {
|
|
3643
|
+
command: "push <directory>",
|
|
3644
|
+
describe: "Pushes all locales from files in a directory to Uniform",
|
|
3645
|
+
builder: (yargs28) => withConfiguration(
|
|
3646
|
+
withApiOptions(
|
|
3647
|
+
withProjectOptions(
|
|
3648
|
+
withDiffOptions(
|
|
3649
|
+
yargs28.positional("directory", {
|
|
3650
|
+
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
3651
|
+
type: "string"
|
|
3652
|
+
}).option("what-if", {
|
|
3653
|
+
alias: ["w"],
|
|
3654
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3655
|
+
default: false,
|
|
3656
|
+
type: "boolean"
|
|
3657
|
+
}).option("mode", {
|
|
3658
|
+
alias: ["m"],
|
|
3659
|
+
describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
|
|
3660
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3661
|
+
default: "mirror",
|
|
3662
|
+
type: "string"
|
|
3663
|
+
})
|
|
3664
|
+
)
|
|
3665
|
+
)
|
|
3666
|
+
)
|
|
3667
|
+
),
|
|
3668
|
+
handler: async ({
|
|
3669
|
+
apiHost,
|
|
3670
|
+
apiKey,
|
|
3671
|
+
proxy,
|
|
3672
|
+
directory,
|
|
3673
|
+
mode,
|
|
3674
|
+
whatIf,
|
|
3675
|
+
project: projectId,
|
|
3676
|
+
diff: diffMode,
|
|
3677
|
+
allowEmptySource
|
|
3678
|
+
}) => {
|
|
3679
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
3680
|
+
const client = new LocaleClient2({
|
|
3681
|
+
apiKey,
|
|
3682
|
+
apiHost,
|
|
3683
|
+
fetch: fetch3,
|
|
3684
|
+
projectId,
|
|
3685
|
+
bypassCache: true
|
|
3686
|
+
});
|
|
3687
|
+
let source;
|
|
3688
|
+
const isPackage = isPathAPackageFile(directory);
|
|
3689
|
+
if (isPackage) {
|
|
3690
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
3691
|
+
source = await createArraySyncEngineDataSource({
|
|
3692
|
+
objects: packageContents.locales ?? [],
|
|
3693
|
+
selectIdentifier: (locale) => locale.locale,
|
|
3694
|
+
selectDisplayName: (locale) => locale.displayName
|
|
3695
|
+
});
|
|
3696
|
+
} else {
|
|
3697
|
+
source = await createFileSyncEngineDataSource({
|
|
3698
|
+
directory,
|
|
3699
|
+
selectIdentifier: (locale) => locale.locale,
|
|
3700
|
+
selectDisplayName: (locale) => locale.displayName
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
const target = createLocaleEngineDataSource({ client });
|
|
3704
|
+
await syncEngine({
|
|
3705
|
+
source,
|
|
3706
|
+
target,
|
|
3707
|
+
mode,
|
|
3708
|
+
whatIf,
|
|
3709
|
+
allowEmptySource,
|
|
3710
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
};
|
|
3714
|
+
|
|
3715
|
+
// src/commands/canvas/commands/locale.ts
|
|
3716
|
+
var LocaleModule = {
|
|
3717
|
+
command: "locale <command>",
|
|
3718
|
+
describe: "Commands for locale definitions",
|
|
3719
|
+
builder: (yargs28) => yargs28.command(LocalePullModule).command(LocalePushModule),
|
|
3720
|
+
handler: () => {
|
|
3721
|
+
yargs8.help();
|
|
3722
|
+
}
|
|
3723
|
+
};
|
|
3724
|
+
|
|
3725
|
+
// src/commands/canvas/commands/pattern.ts
|
|
3726
|
+
import yargs9 from "yargs";
|
|
3727
|
+
|
|
3326
3728
|
// src/commands/canvas/commands/pattern/get.ts
|
|
3327
3729
|
var PatternGetModule = {
|
|
3328
3730
|
...CompositionGetModule,
|
|
@@ -3333,12 +3735,12 @@ var PatternGetModule = {
|
|
|
3333
3735
|
var PatternListModule = {
|
|
3334
3736
|
...CompositionListModule,
|
|
3335
3737
|
describe: "List patterns",
|
|
3336
|
-
builder: (
|
|
3738
|
+
builder: (yargs28) => withFormatOptions(
|
|
3337
3739
|
withConfiguration(
|
|
3338
3740
|
withApiOptions(
|
|
3339
3741
|
withProjectOptions(
|
|
3340
3742
|
withStateOptions(
|
|
3341
|
-
|
|
3743
|
+
yargs28.options({
|
|
3342
3744
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3343
3745
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
3344
3746
|
resolvePatterns: {
|
|
@@ -3376,11 +3778,11 @@ var PatternListModule = {
|
|
|
3376
3778
|
var PatternPublishModule = {
|
|
3377
3779
|
...CompositionPublishModule,
|
|
3378
3780
|
describe: "Publishes pattern(s)",
|
|
3379
|
-
builder: (
|
|
3781
|
+
builder: (yargs28) => withConfiguration(
|
|
3380
3782
|
withApiOptions(
|
|
3381
3783
|
withProjectOptions(
|
|
3382
3784
|
withDiffOptions(
|
|
3383
|
-
|
|
3785
|
+
yargs28.positional("ids", {
|
|
3384
3786
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3385
3787
|
type: "string"
|
|
3386
3788
|
}).option("all", {
|
|
@@ -3418,12 +3820,12 @@ var PatternPublishModule = {
|
|
|
3418
3820
|
var PatternPullModule = {
|
|
3419
3821
|
...CompositionPullModule,
|
|
3420
3822
|
describe: "Pulls all patterns to local files in a directory",
|
|
3421
|
-
builder: (
|
|
3823
|
+
builder: (yargs28) => withConfiguration(
|
|
3422
3824
|
withApiOptions(
|
|
3423
3825
|
withProjectOptions(
|
|
3424
3826
|
withStateOptions(
|
|
3425
3827
|
withDiffOptions(
|
|
3426
|
-
|
|
3828
|
+
yargs28.positional("directory", {
|
|
3427
3829
|
describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3428
3830
|
type: "string"
|
|
3429
3831
|
}).option("format", {
|
|
@@ -3461,12 +3863,12 @@ var PatternPullModule = {
|
|
|
3461
3863
|
var PatternPushModule = {
|
|
3462
3864
|
...CompositionPushModule,
|
|
3463
3865
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
3464
|
-
builder: (
|
|
3866
|
+
builder: (yargs28) => withConfiguration(
|
|
3465
3867
|
withApiOptions(
|
|
3466
3868
|
withProjectOptions(
|
|
3467
3869
|
withStateOptions(
|
|
3468
3870
|
withDiffOptions(
|
|
3469
|
-
|
|
3871
|
+
yargs28.positional("directory", {
|
|
3470
3872
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
3471
3873
|
type: "string"
|
|
3472
3874
|
}).option("what-if", {
|
|
@@ -3504,10 +3906,10 @@ var PatternRemoveModule = {
|
|
|
3504
3906
|
var PatternUnpublishModule = {
|
|
3505
3907
|
command: "unpublish [ids]",
|
|
3506
3908
|
describe: "Unpublish a pattern(s)",
|
|
3507
|
-
builder: (
|
|
3909
|
+
builder: (yargs28) => withConfiguration(
|
|
3508
3910
|
withApiOptions(
|
|
3509
3911
|
withProjectOptions(
|
|
3510
|
-
|
|
3912
|
+
yargs28.positional("ids", {
|
|
3511
3913
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3512
3914
|
type: "string"
|
|
3513
3915
|
}).option("all", {
|
|
@@ -3546,26 +3948,26 @@ var PatternUpdateModule = {
|
|
|
3546
3948
|
var PatternModule = {
|
|
3547
3949
|
command: "pattern <command>",
|
|
3548
3950
|
describe: "Commands for Canvas patterns",
|
|
3549
|
-
builder: (
|
|
3951
|
+
builder: (yargs28) => yargs28.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3550
3952
|
handler: () => {
|
|
3551
|
-
|
|
3953
|
+
yargs9.help();
|
|
3552
3954
|
}
|
|
3553
3955
|
};
|
|
3554
3956
|
|
|
3555
3957
|
// src/commands/canvas/commands/prompts.ts
|
|
3556
|
-
import
|
|
3958
|
+
import yargs10 from "yargs";
|
|
3557
3959
|
|
|
3558
3960
|
// src/commands/canvas/commands/prompts/get.ts
|
|
3559
3961
|
import { PromptClient } from "@uniformdev/canvas";
|
|
3560
3962
|
var PromptGetModule = {
|
|
3561
3963
|
command: "get <id>",
|
|
3562
3964
|
describe: "Get a prompt",
|
|
3563
|
-
builder: (
|
|
3965
|
+
builder: (yargs28) => withConfiguration(
|
|
3564
3966
|
withFormatOptions(
|
|
3565
3967
|
withApiOptions(
|
|
3566
3968
|
withProjectOptions(
|
|
3567
3969
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3568
|
-
|
|
3970
|
+
yargs28.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
3569
3971
|
)
|
|
3570
3972
|
)
|
|
3571
3973
|
)
|
|
@@ -3586,7 +3988,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
3586
3988
|
var PromptListModule = {
|
|
3587
3989
|
command: "list",
|
|
3588
3990
|
describe: "List prompts",
|
|
3589
|
-
builder: (
|
|
3991
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3590
3992
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3591
3993
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3592
3994
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3633,12 +4035,12 @@ function createPromptEngineDataSource({
|
|
|
3633
4035
|
var PromptPullModule = {
|
|
3634
4036
|
command: "pull <directory>",
|
|
3635
4037
|
describe: "Pulls all entries to local files in a directory",
|
|
3636
|
-
builder: (
|
|
4038
|
+
builder: (yargs28) => withConfiguration(
|
|
3637
4039
|
withApiOptions(
|
|
3638
4040
|
withProjectOptions(
|
|
3639
4041
|
withStateOptions(
|
|
3640
4042
|
withDiffOptions(
|
|
3641
|
-
|
|
4043
|
+
yargs28.positional("directory", {
|
|
3642
4044
|
describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3643
4045
|
type: "string"
|
|
3644
4046
|
}).option("format", {
|
|
@@ -3673,7 +4075,8 @@ var PromptPullModule = {
|
|
|
3673
4075
|
mode,
|
|
3674
4076
|
whatIf,
|
|
3675
4077
|
project: projectId,
|
|
3676
|
-
diff: diffMode
|
|
4078
|
+
diff: diffMode,
|
|
4079
|
+
allowEmptySource
|
|
3677
4080
|
}) => {
|
|
3678
4081
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3679
4082
|
const client = new PromptClient3({
|
|
@@ -3710,7 +4113,7 @@ var PromptPullModule = {
|
|
|
3710
4113
|
target,
|
|
3711
4114
|
mode,
|
|
3712
4115
|
whatIf,
|
|
3713
|
-
allowEmptySource: true,
|
|
4116
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
3714
4117
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3715
4118
|
});
|
|
3716
4119
|
}
|
|
@@ -3721,12 +4124,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
3721
4124
|
var PromptPushModule = {
|
|
3722
4125
|
command: "push <directory>",
|
|
3723
4126
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
3724
|
-
builder: (
|
|
4127
|
+
builder: (yargs28) => withConfiguration(
|
|
3725
4128
|
withApiOptions(
|
|
3726
4129
|
withProjectOptions(
|
|
3727
4130
|
withStateOptions(
|
|
3728
4131
|
withDiffOptions(
|
|
3729
|
-
|
|
4132
|
+
yargs28.positional("directory", {
|
|
3730
4133
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
3731
4134
|
type: "string"
|
|
3732
4135
|
}).option("what-if", {
|
|
@@ -3754,7 +4157,8 @@ var PromptPushModule = {
|
|
|
3754
4157
|
mode,
|
|
3755
4158
|
whatIf,
|
|
3756
4159
|
project: projectId,
|
|
3757
|
-
diff: diffMode
|
|
4160
|
+
diff: diffMode,
|
|
4161
|
+
allowEmptySource
|
|
3758
4162
|
}) => {
|
|
3759
4163
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3760
4164
|
const client = new PromptClient4({
|
|
@@ -3786,6 +4190,7 @@ var PromptPushModule = {
|
|
|
3786
4190
|
target,
|
|
3787
4191
|
mode,
|
|
3788
4192
|
whatIf,
|
|
4193
|
+
allowEmptySource,
|
|
3789
4194
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3790
4195
|
});
|
|
3791
4196
|
}
|
|
@@ -3797,9 +4202,9 @@ var PromptRemoveModule = {
|
|
|
3797
4202
|
command: "remove <id>",
|
|
3798
4203
|
aliases: ["delete", "rm"],
|
|
3799
4204
|
describe: "Delete a prompt",
|
|
3800
|
-
builder: (
|
|
4205
|
+
builder: (yargs28) => withConfiguration(
|
|
3801
4206
|
withApiOptions(
|
|
3802
|
-
withProjectOptions(
|
|
4207
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
3803
4208
|
)
|
|
3804
4209
|
),
|
|
3805
4210
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -3815,10 +4220,10 @@ var PromptUpdateModule = {
|
|
|
3815
4220
|
command: "update <filename>",
|
|
3816
4221
|
aliases: ["put"],
|
|
3817
4222
|
describe: "Insert or update a prompt",
|
|
3818
|
-
builder: (
|
|
4223
|
+
builder: (yargs28) => withConfiguration(
|
|
3819
4224
|
withApiOptions(
|
|
3820
4225
|
withProjectOptions(
|
|
3821
|
-
|
|
4226
|
+
yargs28.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
3822
4227
|
)
|
|
3823
4228
|
)
|
|
3824
4229
|
),
|
|
@@ -3835,9 +4240,9 @@ var PromptModule = {
|
|
|
3835
4240
|
command: "prompt <command>",
|
|
3836
4241
|
aliases: ["dt"],
|
|
3837
4242
|
describe: "Commands for AI Prompt definitions",
|
|
3838
|
-
builder: (
|
|
4243
|
+
builder: (yargs28) => yargs28.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
3839
4244
|
handler: () => {
|
|
3840
|
-
|
|
4245
|
+
yargs10.help();
|
|
3841
4246
|
}
|
|
3842
4247
|
};
|
|
3843
4248
|
|
|
@@ -3846,28 +4251,28 @@ var CanvasCommand = {
|
|
|
3846
4251
|
command: "canvas <command>",
|
|
3847
4252
|
aliases: ["cv", "pm", "presentation"],
|
|
3848
4253
|
describe: "Uniform Canvas commands",
|
|
3849
|
-
builder: (
|
|
4254
|
+
builder: (yargs28) => yargs28.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).command(PromptModule).command(AssetModule).command(LocaleModule).demandCommand(),
|
|
3850
4255
|
handler: () => {
|
|
3851
|
-
|
|
4256
|
+
yargs11.showHelp();
|
|
3852
4257
|
}
|
|
3853
4258
|
};
|
|
3854
4259
|
|
|
3855
4260
|
// src/commands/context/index.ts
|
|
3856
|
-
import
|
|
4261
|
+
import yargs18 from "yargs";
|
|
3857
4262
|
|
|
3858
4263
|
// src/commands/context/commands/aggregate.ts
|
|
3859
|
-
import
|
|
4264
|
+
import yargs12 from "yargs";
|
|
3860
4265
|
|
|
3861
4266
|
// src/commands/context/commands/aggregate/get.ts
|
|
3862
4267
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
3863
4268
|
var AggregateGetModule = {
|
|
3864
4269
|
command: "get <id>",
|
|
3865
4270
|
describe: "Fetch an aggregate",
|
|
3866
|
-
builder: (
|
|
4271
|
+
builder: (yargs28) => withConfiguration(
|
|
3867
4272
|
withFormatOptions(
|
|
3868
4273
|
withApiOptions(
|
|
3869
4274
|
withProjectOptions(
|
|
3870
|
-
|
|
4275
|
+
yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3871
4276
|
)
|
|
3872
4277
|
)
|
|
3873
4278
|
)
|
|
@@ -3891,7 +4296,7 @@ var AggregateListModule = {
|
|
|
3891
4296
|
command: "list",
|
|
3892
4297
|
describe: "List aggregates",
|
|
3893
4298
|
aliases: ["ls"],
|
|
3894
|
-
builder: (
|
|
4299
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3895
4300
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3896
4301
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3897
4302
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3957,11 +4362,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
3957
4362
|
var AggregatePullModule = {
|
|
3958
4363
|
command: "pull <directory>",
|
|
3959
4364
|
describe: "Pulls all aggregates to local files in a directory",
|
|
3960
|
-
builder: (
|
|
4365
|
+
builder: (yargs28) => withConfiguration(
|
|
3961
4366
|
withApiOptions(
|
|
3962
4367
|
withProjectOptions(
|
|
3963
4368
|
withDiffOptions(
|
|
3964
|
-
|
|
4369
|
+
yargs28.positional("directory", {
|
|
3965
4370
|
describe: "Directory to save the aggregates to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
3966
4371
|
type: "string"
|
|
3967
4372
|
}).option("format", {
|
|
@@ -3995,7 +4400,8 @@ var AggregatePullModule = {
|
|
|
3995
4400
|
mode,
|
|
3996
4401
|
whatIf,
|
|
3997
4402
|
project: projectId,
|
|
3998
|
-
diff: diffMode
|
|
4403
|
+
diff: diffMode,
|
|
4404
|
+
allowEmptySource
|
|
3999
4405
|
}) => {
|
|
4000
4406
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4001
4407
|
const client = new UncachedAggregateClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4026,6 +4432,7 @@ var AggregatePullModule = {
|
|
|
4026
4432
|
target,
|
|
4027
4433
|
mode,
|
|
4028
4434
|
whatIf,
|
|
4435
|
+
allowEmptySource,
|
|
4029
4436
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4030
4437
|
});
|
|
4031
4438
|
}
|
|
@@ -4036,11 +4443,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
4036
4443
|
var AggregatePushModule = {
|
|
4037
4444
|
command: "push <directory>",
|
|
4038
4445
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
4039
|
-
builder: (
|
|
4446
|
+
builder: (yargs28) => withConfiguration(
|
|
4040
4447
|
withApiOptions(
|
|
4041
4448
|
withProjectOptions(
|
|
4042
4449
|
withDiffOptions(
|
|
4043
|
-
|
|
4450
|
+
yargs28.positional("directory", {
|
|
4044
4451
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
4045
4452
|
type: "string"
|
|
4046
4453
|
}).option("what-if", {
|
|
@@ -4067,7 +4474,8 @@ var AggregatePushModule = {
|
|
|
4067
4474
|
mode,
|
|
4068
4475
|
whatIf,
|
|
4069
4476
|
project: projectId,
|
|
4070
|
-
diff: diffMode
|
|
4477
|
+
diff: diffMode,
|
|
4478
|
+
allowEmptySource
|
|
4071
4479
|
}) => {
|
|
4072
4480
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4073
4481
|
const client = new UncachedAggregateClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4093,6 +4501,7 @@ var AggregatePushModule = {
|
|
|
4093
4501
|
target,
|
|
4094
4502
|
mode,
|
|
4095
4503
|
whatIf,
|
|
4504
|
+
allowEmptySource,
|
|
4096
4505
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4097
4506
|
});
|
|
4098
4507
|
await target.complete();
|
|
@@ -4105,10 +4514,10 @@ var AggregateRemoveModule = {
|
|
|
4105
4514
|
command: "remove <id>",
|
|
4106
4515
|
aliases: ["delete", "rm"],
|
|
4107
4516
|
describe: "Delete an aggregate",
|
|
4108
|
-
builder: (
|
|
4517
|
+
builder: (yargs28) => withConfiguration(
|
|
4109
4518
|
withApiOptions(
|
|
4110
4519
|
withProjectOptions(
|
|
4111
|
-
|
|
4520
|
+
yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
4112
4521
|
)
|
|
4113
4522
|
)
|
|
4114
4523
|
),
|
|
@@ -4125,10 +4534,10 @@ var AggregateUpdateModule = {
|
|
|
4125
4534
|
command: "update <filename>",
|
|
4126
4535
|
aliases: ["put"],
|
|
4127
4536
|
describe: "Insert or update an aggregate",
|
|
4128
|
-
builder: (
|
|
4537
|
+
builder: (yargs28) => withConfiguration(
|
|
4129
4538
|
withApiOptions(
|
|
4130
4539
|
withProjectOptions(
|
|
4131
|
-
|
|
4540
|
+
yargs28.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
4132
4541
|
)
|
|
4133
4542
|
)
|
|
4134
4543
|
),
|
|
@@ -4145,25 +4554,25 @@ var AggregateModule = {
|
|
|
4145
4554
|
command: "aggregate <command>",
|
|
4146
4555
|
aliases: ["agg", "intent", "audience"],
|
|
4147
4556
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
4148
|
-
builder: (
|
|
4557
|
+
builder: (yargs28) => yargs28.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
4149
4558
|
handler: () => {
|
|
4150
|
-
|
|
4559
|
+
yargs12.help();
|
|
4151
4560
|
}
|
|
4152
4561
|
};
|
|
4153
4562
|
|
|
4154
4563
|
// src/commands/context/commands/enrichment.ts
|
|
4155
|
-
import
|
|
4564
|
+
import yargs13 from "yargs";
|
|
4156
4565
|
|
|
4157
4566
|
// src/commands/context/commands/enrichment/get.ts
|
|
4158
4567
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
4159
4568
|
var EnrichmentGetModule = {
|
|
4160
4569
|
command: "get <id>",
|
|
4161
4570
|
describe: "Fetch an enrichment category and its values",
|
|
4162
|
-
builder: (
|
|
4571
|
+
builder: (yargs28) => withFormatOptions(
|
|
4163
4572
|
withConfiguration(
|
|
4164
4573
|
withApiOptions(
|
|
4165
4574
|
withProjectOptions(
|
|
4166
|
-
|
|
4575
|
+
yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
4167
4576
|
)
|
|
4168
4577
|
)
|
|
4169
4578
|
)
|
|
@@ -4188,7 +4597,7 @@ var EnrichmentListModule = {
|
|
|
4188
4597
|
command: "list",
|
|
4189
4598
|
describe: "List enrichments",
|
|
4190
4599
|
aliases: ["ls"],
|
|
4191
|
-
builder: (
|
|
4600
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
4192
4601
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4193
4602
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4194
4603
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4289,11 +4698,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
4289
4698
|
var EnrichmentPullModule = {
|
|
4290
4699
|
command: "pull <directory>",
|
|
4291
4700
|
describe: "Pulls all enrichments to local files in a directory",
|
|
4292
|
-
builder: (
|
|
4701
|
+
builder: (yargs28) => withConfiguration(
|
|
4293
4702
|
withApiOptions(
|
|
4294
4703
|
withProjectOptions(
|
|
4295
4704
|
withDiffOptions(
|
|
4296
|
-
|
|
4705
|
+
yargs28.positional("directory", {
|
|
4297
4706
|
describe: "Directory to save the enrichments to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4298
4707
|
type: "string"
|
|
4299
4708
|
}).option("format", {
|
|
@@ -4327,7 +4736,8 @@ var EnrichmentPullModule = {
|
|
|
4327
4736
|
mode,
|
|
4328
4737
|
whatIf,
|
|
4329
4738
|
project: projectId,
|
|
4330
|
-
diff: diffMode
|
|
4739
|
+
diff: diffMode,
|
|
4740
|
+
allowEmptySource
|
|
4331
4741
|
}) => {
|
|
4332
4742
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4333
4743
|
const client = new UncachedEnrichmentClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4358,6 +4768,7 @@ var EnrichmentPullModule = {
|
|
|
4358
4768
|
target,
|
|
4359
4769
|
mode,
|
|
4360
4770
|
whatIf,
|
|
4771
|
+
allowEmptySource,
|
|
4361
4772
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4362
4773
|
});
|
|
4363
4774
|
}
|
|
@@ -4368,11 +4779,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
4368
4779
|
var EnrichmentPushModule = {
|
|
4369
4780
|
command: "push <directory>",
|
|
4370
4781
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
4371
|
-
builder: (
|
|
4782
|
+
builder: (yargs28) => withConfiguration(
|
|
4372
4783
|
withApiOptions(
|
|
4373
4784
|
withProjectOptions(
|
|
4374
4785
|
withDiffOptions(
|
|
4375
|
-
|
|
4786
|
+
yargs28.positional("directory", {
|
|
4376
4787
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
4377
4788
|
type: "string"
|
|
4378
4789
|
}).option("what-if", {
|
|
@@ -4399,7 +4810,8 @@ var EnrichmentPushModule = {
|
|
|
4399
4810
|
mode,
|
|
4400
4811
|
whatIf,
|
|
4401
4812
|
project: projectId,
|
|
4402
|
-
diff: diffMode
|
|
4813
|
+
diff: diffMode,
|
|
4814
|
+
allowEmptySource
|
|
4403
4815
|
}) => {
|
|
4404
4816
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4405
4817
|
const client = new UncachedEnrichmentClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4425,6 +4837,7 @@ var EnrichmentPushModule = {
|
|
|
4425
4837
|
target,
|
|
4426
4838
|
mode,
|
|
4427
4839
|
whatIf,
|
|
4840
|
+
allowEmptySource,
|
|
4428
4841
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4429
4842
|
});
|
|
4430
4843
|
}
|
|
@@ -4436,10 +4849,10 @@ var EnrichmentRemoveModule = {
|
|
|
4436
4849
|
command: "remove <id>",
|
|
4437
4850
|
aliases: ["delete", "rm"],
|
|
4438
4851
|
describe: "Delete an enrichment category and its values",
|
|
4439
|
-
builder: (
|
|
4852
|
+
builder: (yargs28) => withConfiguration(
|
|
4440
4853
|
withApiOptions(
|
|
4441
4854
|
withProjectOptions(
|
|
4442
|
-
|
|
4855
|
+
yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
4443
4856
|
)
|
|
4444
4857
|
)
|
|
4445
4858
|
),
|
|
@@ -4455,14 +4868,14 @@ var EnrichmentModule = {
|
|
|
4455
4868
|
command: "enrichment <command>",
|
|
4456
4869
|
aliases: ["enr"],
|
|
4457
4870
|
describe: "Commands for Context enrichments",
|
|
4458
|
-
builder: (
|
|
4871
|
+
builder: (yargs28) => yargs28.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
4459
4872
|
handler: () => {
|
|
4460
|
-
|
|
4873
|
+
yargs13.help();
|
|
4461
4874
|
}
|
|
4462
4875
|
};
|
|
4463
4876
|
|
|
4464
4877
|
// src/commands/context/commands/manifest.ts
|
|
4465
|
-
import
|
|
4878
|
+
import yargs14 from "yargs";
|
|
4466
4879
|
|
|
4467
4880
|
// src/commands/context/commands/manifest/get.ts
|
|
4468
4881
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -4473,10 +4886,10 @@ var ManifestGetModule = {
|
|
|
4473
4886
|
command: "get [output]",
|
|
4474
4887
|
aliases: ["dl", "download"],
|
|
4475
4888
|
describe: "Download the Uniform Context manifest for a project",
|
|
4476
|
-
builder: (
|
|
4889
|
+
builder: (yargs28) => withConfiguration(
|
|
4477
4890
|
withApiOptions(
|
|
4478
4891
|
withProjectOptions(
|
|
4479
|
-
|
|
4892
|
+
yargs28.option("preview", {
|
|
4480
4893
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
4481
4894
|
default: false,
|
|
4482
4895
|
type: "boolean",
|
|
@@ -4538,7 +4951,7 @@ import { exit as exit2 } from "process";
|
|
|
4538
4951
|
var ManifestPublishModule = {
|
|
4539
4952
|
command: "publish",
|
|
4540
4953
|
describe: "Publish the Uniform Context manifest for a project",
|
|
4541
|
-
builder: (
|
|
4954
|
+
builder: (yargs28) => withConfiguration(withApiOptions(withProjectOptions(yargs28))),
|
|
4542
4955
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
4543
4956
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4544
4957
|
try {
|
|
@@ -4571,25 +4984,25 @@ var ManifestModule = {
|
|
|
4571
4984
|
command: "manifest <command>",
|
|
4572
4985
|
describe: "Commands for context manifests",
|
|
4573
4986
|
aliases: ["man"],
|
|
4574
|
-
builder: (
|
|
4987
|
+
builder: (yargs28) => yargs28.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
4575
4988
|
handler: () => {
|
|
4576
|
-
|
|
4989
|
+
yargs14.help();
|
|
4577
4990
|
}
|
|
4578
4991
|
};
|
|
4579
4992
|
|
|
4580
4993
|
// src/commands/context/commands/quirk.ts
|
|
4581
|
-
import
|
|
4994
|
+
import yargs15 from "yargs";
|
|
4582
4995
|
|
|
4583
4996
|
// src/commands/context/commands/quirk/get.ts
|
|
4584
4997
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
4585
4998
|
var QuirkGetModule = {
|
|
4586
4999
|
command: "get <id>",
|
|
4587
5000
|
describe: "Fetch a quirk",
|
|
4588
|
-
builder: (
|
|
5001
|
+
builder: (yargs28) => withConfiguration(
|
|
4589
5002
|
withFormatOptions(
|
|
4590
5003
|
withApiOptions(
|
|
4591
5004
|
withProjectOptions(
|
|
4592
|
-
|
|
5005
|
+
yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
4593
5006
|
)
|
|
4594
5007
|
)
|
|
4595
5008
|
)
|
|
@@ -4613,11 +5026,11 @@ var QuirkListModule = {
|
|
|
4613
5026
|
command: "list",
|
|
4614
5027
|
describe: "List quirks",
|
|
4615
5028
|
aliases: ["ls"],
|
|
4616
|
-
builder: (
|
|
5029
|
+
builder: (yargs28) => withConfiguration(
|
|
4617
5030
|
withFormatOptions(
|
|
4618
5031
|
withApiOptions(
|
|
4619
5032
|
withProjectOptions(
|
|
4620
|
-
|
|
5033
|
+
yargs28.option("withIntegrations", {
|
|
4621
5034
|
alias: ["i"],
|
|
4622
5035
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
4623
5036
|
type: "boolean"
|
|
@@ -4674,11 +5087,11 @@ function createQuirkEngineDataSource({
|
|
|
4674
5087
|
var QuirkPullModule = {
|
|
4675
5088
|
command: "pull <directory>",
|
|
4676
5089
|
describe: "Pulls all quirks to local files in a directory",
|
|
4677
|
-
builder: (
|
|
5090
|
+
builder: (yargs28) => withConfiguration(
|
|
4678
5091
|
withApiOptions(
|
|
4679
5092
|
withProjectOptions(
|
|
4680
5093
|
withDiffOptions(
|
|
4681
|
-
|
|
5094
|
+
yargs28.positional("directory", {
|
|
4682
5095
|
describe: "Directory to save the quirks to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4683
5096
|
type: "string"
|
|
4684
5097
|
}).option("format", {
|
|
@@ -4712,7 +5125,8 @@ var QuirkPullModule = {
|
|
|
4712
5125
|
mode,
|
|
4713
5126
|
whatIf,
|
|
4714
5127
|
project: projectId,
|
|
4715
|
-
diff: diffMode
|
|
5128
|
+
diff: diffMode,
|
|
5129
|
+
allowEmptySource
|
|
4716
5130
|
}) => {
|
|
4717
5131
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4718
5132
|
const client = new UncachedQuirkClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4743,6 +5157,7 @@ var QuirkPullModule = {
|
|
|
4743
5157
|
target,
|
|
4744
5158
|
mode,
|
|
4745
5159
|
whatIf,
|
|
5160
|
+
allowEmptySource,
|
|
4746
5161
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4747
5162
|
});
|
|
4748
5163
|
}
|
|
@@ -4753,11 +5168,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
4753
5168
|
var QuirkPushModule = {
|
|
4754
5169
|
command: "push <directory>",
|
|
4755
5170
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
4756
|
-
builder: (
|
|
5171
|
+
builder: (yargs28) => withConfiguration(
|
|
4757
5172
|
withApiOptions(
|
|
4758
5173
|
withProjectOptions(
|
|
4759
5174
|
withDiffOptions(
|
|
4760
|
-
|
|
5175
|
+
yargs28.positional("directory", {
|
|
4761
5176
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
4762
5177
|
type: "string"
|
|
4763
5178
|
}).option("what-if", {
|
|
@@ -4784,7 +5199,8 @@ var QuirkPushModule = {
|
|
|
4784
5199
|
mode,
|
|
4785
5200
|
whatIf,
|
|
4786
5201
|
project: projectId,
|
|
4787
|
-
diff: diffMode
|
|
5202
|
+
diff: diffMode,
|
|
5203
|
+
allowEmptySource
|
|
4788
5204
|
}) => {
|
|
4789
5205
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4790
5206
|
const client = new UncachedQuirkClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4810,6 +5226,7 @@ var QuirkPushModule = {
|
|
|
4810
5226
|
target,
|
|
4811
5227
|
mode,
|
|
4812
5228
|
whatIf,
|
|
5229
|
+
allowEmptySource,
|
|
4813
5230
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
4814
5231
|
});
|
|
4815
5232
|
}
|
|
@@ -4821,10 +5238,10 @@ var QuirkRemoveModule = {
|
|
|
4821
5238
|
command: "remove <id>",
|
|
4822
5239
|
aliases: ["delete", "rm"],
|
|
4823
5240
|
describe: "Delete a quirk",
|
|
4824
|
-
builder: (
|
|
5241
|
+
builder: (yargs28) => withConfiguration(
|
|
4825
5242
|
withApiOptions(
|
|
4826
5243
|
withProjectOptions(
|
|
4827
|
-
|
|
5244
|
+
yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4828
5245
|
)
|
|
4829
5246
|
)
|
|
4830
5247
|
),
|
|
@@ -4841,10 +5258,10 @@ var QuirkUpdateModule = {
|
|
|
4841
5258
|
command: "update <filename>",
|
|
4842
5259
|
aliases: ["put"],
|
|
4843
5260
|
describe: "Insert or update a quirk",
|
|
4844
|
-
builder: (
|
|
5261
|
+
builder: (yargs28) => withConfiguration(
|
|
4845
5262
|
withApiOptions(
|
|
4846
5263
|
withProjectOptions(
|
|
4847
|
-
|
|
5264
|
+
yargs28.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4848
5265
|
)
|
|
4849
5266
|
)
|
|
4850
5267
|
),
|
|
@@ -4861,25 +5278,25 @@ var QuirkModule = {
|
|
|
4861
5278
|
command: "quirk <command>",
|
|
4862
5279
|
aliases: ["qk"],
|
|
4863
5280
|
describe: "Commands for Context quirks",
|
|
4864
|
-
builder: (
|
|
5281
|
+
builder: (yargs28) => yargs28.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
4865
5282
|
handler: () => {
|
|
4866
|
-
|
|
5283
|
+
yargs15.help();
|
|
4867
5284
|
}
|
|
4868
5285
|
};
|
|
4869
5286
|
|
|
4870
5287
|
// src/commands/context/commands/signal.ts
|
|
4871
|
-
import
|
|
5288
|
+
import yargs16 from "yargs";
|
|
4872
5289
|
|
|
4873
5290
|
// src/commands/context/commands/signal/get.ts
|
|
4874
5291
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
4875
5292
|
var SignalGetModule = {
|
|
4876
5293
|
command: "get <id>",
|
|
4877
5294
|
describe: "Fetch a signal",
|
|
4878
|
-
builder: (
|
|
5295
|
+
builder: (yargs28) => withConfiguration(
|
|
4879
5296
|
withFormatOptions(
|
|
4880
5297
|
withApiOptions(
|
|
4881
5298
|
withProjectOptions(
|
|
4882
|
-
|
|
5299
|
+
yargs28.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4883
5300
|
)
|
|
4884
5301
|
)
|
|
4885
5302
|
)
|
|
@@ -4903,7 +5320,7 @@ var SignalListModule = {
|
|
|
4903
5320
|
command: "list",
|
|
4904
5321
|
describe: "List signals",
|
|
4905
5322
|
aliases: ["ls"],
|
|
4906
|
-
builder: (
|
|
5323
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
4907
5324
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4908
5325
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4909
5326
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4952,11 +5369,11 @@ function createSignalEngineDataSource({
|
|
|
4952
5369
|
var SignalPullModule = {
|
|
4953
5370
|
command: "pull <directory>",
|
|
4954
5371
|
describe: "Pulls all signals to local files in a directory",
|
|
4955
|
-
builder: (
|
|
5372
|
+
builder: (yargs28) => withConfiguration(
|
|
4956
5373
|
withApiOptions(
|
|
4957
5374
|
withProjectOptions(
|
|
4958
5375
|
withDiffOptions(
|
|
4959
|
-
|
|
5376
|
+
yargs28.positional("directory", {
|
|
4960
5377
|
describe: "Directory to save the signals to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
4961
5378
|
type: "string"
|
|
4962
5379
|
}).option("format", {
|
|
@@ -4990,7 +5407,8 @@ var SignalPullModule = {
|
|
|
4990
5407
|
mode,
|
|
4991
5408
|
whatIf,
|
|
4992
5409
|
project: projectId,
|
|
4993
|
-
diff: diffMode
|
|
5410
|
+
diff: diffMode,
|
|
5411
|
+
allowEmptySource
|
|
4994
5412
|
}) => {
|
|
4995
5413
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4996
5414
|
const client = new UncachedSignalClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5021,6 +5439,7 @@ var SignalPullModule = {
|
|
|
5021
5439
|
target,
|
|
5022
5440
|
mode,
|
|
5023
5441
|
whatIf,
|
|
5442
|
+
allowEmptySource,
|
|
5024
5443
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5025
5444
|
});
|
|
5026
5445
|
}
|
|
@@ -5031,11 +5450,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
5031
5450
|
var SignalPushModule = {
|
|
5032
5451
|
command: "push <directory>",
|
|
5033
5452
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
5034
|
-
builder: (
|
|
5453
|
+
builder: (yargs28) => withConfiguration(
|
|
5035
5454
|
withApiOptions(
|
|
5036
5455
|
withProjectOptions(
|
|
5037
5456
|
withDiffOptions(
|
|
5038
|
-
|
|
5457
|
+
yargs28.positional("directory", {
|
|
5039
5458
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
5040
5459
|
type: "string"
|
|
5041
5460
|
}).option("what-if", {
|
|
@@ -5062,7 +5481,8 @@ var SignalPushModule = {
|
|
|
5062
5481
|
mode,
|
|
5063
5482
|
whatIf,
|
|
5064
5483
|
project: projectId,
|
|
5065
|
-
diff: diffMode
|
|
5484
|
+
diff: diffMode,
|
|
5485
|
+
allowEmptySource
|
|
5066
5486
|
}) => {
|
|
5067
5487
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5068
5488
|
const client = new UncachedSignalClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5088,6 +5508,7 @@ var SignalPushModule = {
|
|
|
5088
5508
|
target,
|
|
5089
5509
|
mode,
|
|
5090
5510
|
whatIf,
|
|
5511
|
+
allowEmptySource,
|
|
5091
5512
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5092
5513
|
});
|
|
5093
5514
|
}
|
|
@@ -5099,10 +5520,10 @@ var SignalRemoveModule = {
|
|
|
5099
5520
|
command: "remove <id>",
|
|
5100
5521
|
aliases: ["delete", "rm"],
|
|
5101
5522
|
describe: "Delete a signal",
|
|
5102
|
-
builder: (
|
|
5523
|
+
builder: (yargs28) => withConfiguration(
|
|
5103
5524
|
withApiOptions(
|
|
5104
5525
|
withProjectOptions(
|
|
5105
|
-
|
|
5526
|
+
yargs28.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
5106
5527
|
)
|
|
5107
5528
|
)
|
|
5108
5529
|
),
|
|
@@ -5119,10 +5540,10 @@ var SignalUpdateModule = {
|
|
|
5119
5540
|
command: "update <filename>",
|
|
5120
5541
|
aliases: ["put"],
|
|
5121
5542
|
describe: "Insert or update a signal",
|
|
5122
|
-
builder: (
|
|
5543
|
+
builder: (yargs28) => withConfiguration(
|
|
5123
5544
|
withApiOptions(
|
|
5124
5545
|
withProjectOptions(
|
|
5125
|
-
|
|
5546
|
+
yargs28.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
5126
5547
|
)
|
|
5127
5548
|
)
|
|
5128
5549
|
),
|
|
@@ -5139,25 +5560,25 @@ var SignalModule = {
|
|
|
5139
5560
|
command: "signal <command>",
|
|
5140
5561
|
aliases: ["sig"],
|
|
5141
5562
|
describe: "Commands for Context signals",
|
|
5142
|
-
builder: (
|
|
5563
|
+
builder: (yargs28) => yargs28.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
5143
5564
|
handler: () => {
|
|
5144
|
-
|
|
5565
|
+
yargs16.help();
|
|
5145
5566
|
}
|
|
5146
5567
|
};
|
|
5147
5568
|
|
|
5148
5569
|
// src/commands/context/commands/test.ts
|
|
5149
|
-
import
|
|
5570
|
+
import yargs17 from "yargs";
|
|
5150
5571
|
|
|
5151
5572
|
// src/commands/context/commands/test/get.ts
|
|
5152
5573
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
5153
5574
|
var TestGetModule = {
|
|
5154
5575
|
command: "get <id>",
|
|
5155
5576
|
describe: "Fetch a test",
|
|
5156
|
-
builder: (
|
|
5577
|
+
builder: (yargs28) => withConfiguration(
|
|
5157
5578
|
withFormatOptions(
|
|
5158
5579
|
withApiOptions(
|
|
5159
5580
|
withProjectOptions(
|
|
5160
|
-
|
|
5581
|
+
yargs28.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
5161
5582
|
)
|
|
5162
5583
|
)
|
|
5163
5584
|
)
|
|
@@ -5181,7 +5602,7 @@ var TestListModule = {
|
|
|
5181
5602
|
command: "list",
|
|
5182
5603
|
describe: "List tests",
|
|
5183
5604
|
aliases: ["ls"],
|
|
5184
|
-
builder: (
|
|
5605
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
5185
5606
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5186
5607
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5187
5608
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5230,11 +5651,11 @@ function createTestEngineDataSource({
|
|
|
5230
5651
|
var TestPullModule = {
|
|
5231
5652
|
command: "pull <directory>",
|
|
5232
5653
|
describe: "Pulls all tests to local files in a directory",
|
|
5233
|
-
builder: (
|
|
5654
|
+
builder: (yargs28) => withConfiguration(
|
|
5234
5655
|
withApiOptions(
|
|
5235
5656
|
withProjectOptions(
|
|
5236
5657
|
withDiffOptions(
|
|
5237
|
-
|
|
5658
|
+
yargs28.positional("directory", {
|
|
5238
5659
|
describe: "Directory to save the tests to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
5239
5660
|
type: "string"
|
|
5240
5661
|
}).option("format", {
|
|
@@ -5268,7 +5689,8 @@ var TestPullModule = {
|
|
|
5268
5689
|
mode,
|
|
5269
5690
|
whatIf,
|
|
5270
5691
|
project: projectId,
|
|
5271
|
-
diff: diffMode
|
|
5692
|
+
diff: diffMode,
|
|
5693
|
+
allowEmptySource
|
|
5272
5694
|
}) => {
|
|
5273
5695
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5274
5696
|
const client = new UncachedTestClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5299,6 +5721,7 @@ var TestPullModule = {
|
|
|
5299
5721
|
target,
|
|
5300
5722
|
mode,
|
|
5301
5723
|
whatIf,
|
|
5724
|
+
allowEmptySource,
|
|
5302
5725
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5303
5726
|
});
|
|
5304
5727
|
}
|
|
@@ -5309,11 +5732,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
5309
5732
|
var TestPushModule = {
|
|
5310
5733
|
command: "push <directory>",
|
|
5311
5734
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
5312
|
-
builder: (
|
|
5735
|
+
builder: (yargs28) => withConfiguration(
|
|
5313
5736
|
withApiOptions(
|
|
5314
5737
|
withProjectOptions(
|
|
5315
5738
|
withDiffOptions(
|
|
5316
|
-
|
|
5739
|
+
yargs28.positional("directory", {
|
|
5317
5740
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
5318
5741
|
type: "string"
|
|
5319
5742
|
}).option("what-if", {
|
|
@@ -5340,7 +5763,8 @@ var TestPushModule = {
|
|
|
5340
5763
|
mode,
|
|
5341
5764
|
whatIf,
|
|
5342
5765
|
project: projectId,
|
|
5343
|
-
diff: diffMode
|
|
5766
|
+
diff: diffMode,
|
|
5767
|
+
allowEmptySource
|
|
5344
5768
|
}) => {
|
|
5345
5769
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5346
5770
|
const client = new UncachedTestClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5366,6 +5790,7 @@ var TestPushModule = {
|
|
|
5366
5790
|
target,
|
|
5367
5791
|
mode,
|
|
5368
5792
|
whatIf,
|
|
5793
|
+
allowEmptySource,
|
|
5369
5794
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
5370
5795
|
});
|
|
5371
5796
|
}
|
|
@@ -5377,10 +5802,10 @@ var TestRemoveModule = {
|
|
|
5377
5802
|
command: "remove <id>",
|
|
5378
5803
|
aliases: ["delete", "rm"],
|
|
5379
5804
|
describe: "Delete a test",
|
|
5380
|
-
builder: (
|
|
5805
|
+
builder: (yargs28) => withConfiguration(
|
|
5381
5806
|
withApiOptions(
|
|
5382
5807
|
withProjectOptions(
|
|
5383
|
-
|
|
5808
|
+
yargs28.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
5384
5809
|
)
|
|
5385
5810
|
)
|
|
5386
5811
|
),
|
|
@@ -5397,9 +5822,9 @@ var TestUpdateModule = {
|
|
|
5397
5822
|
command: "update <filename>",
|
|
5398
5823
|
aliases: ["put"],
|
|
5399
5824
|
describe: "Insert or update a test",
|
|
5400
|
-
builder: (
|
|
5825
|
+
builder: (yargs28) => withConfiguration(
|
|
5401
5826
|
withApiOptions(
|
|
5402
|
-
withProjectOptions(
|
|
5827
|
+
withProjectOptions(yargs28.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
5403
5828
|
)
|
|
5404
5829
|
),
|
|
5405
5830
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5414,9 +5839,9 @@ var TestUpdateModule = {
|
|
|
5414
5839
|
var TestModule = {
|
|
5415
5840
|
command: "test <command>",
|
|
5416
5841
|
describe: "Commands for Context A/B tests",
|
|
5417
|
-
builder: (
|
|
5842
|
+
builder: (yargs28) => yargs28.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
5418
5843
|
handler: () => {
|
|
5419
|
-
|
|
5844
|
+
yargs17.help();
|
|
5420
5845
|
}
|
|
5421
5846
|
};
|
|
5422
5847
|
|
|
@@ -5425,9 +5850,9 @@ var ContextCommand = {
|
|
|
5425
5850
|
command: "context <command>",
|
|
5426
5851
|
aliases: ["ctx"],
|
|
5427
5852
|
describe: "Uniform Context commands",
|
|
5428
|
-
builder: (
|
|
5853
|
+
builder: (yargs28) => yargs28.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
5429
5854
|
handler: () => {
|
|
5430
|
-
|
|
5855
|
+
yargs18.showHelp();
|
|
5431
5856
|
}
|
|
5432
5857
|
};
|
|
5433
5858
|
|
|
@@ -5455,7 +5880,7 @@ import { PostHog } from "posthog-node";
|
|
|
5455
5880
|
// package.json
|
|
5456
5881
|
var package_default = {
|
|
5457
5882
|
name: "@uniformdev/cli",
|
|
5458
|
-
version: "19.
|
|
5883
|
+
version: "19.92.1",
|
|
5459
5884
|
description: "Uniform command line interface tool",
|
|
5460
5885
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5461
5886
|
main: "./cli.js",
|
|
@@ -5490,7 +5915,7 @@ var package_default = {
|
|
|
5490
5915
|
"graphql-request": "6.1.0",
|
|
5491
5916
|
"https-proxy-agent": "^7.0.0",
|
|
5492
5917
|
"image-size": "^1.0.2",
|
|
5493
|
-
inquirer: "9.2.
|
|
5918
|
+
inquirer: "9.2.12",
|
|
5494
5919
|
"isomorphic-git": "1.24.5",
|
|
5495
5920
|
"isomorphic-unfetch": "^4.0.0",
|
|
5496
5921
|
"js-yaml": "^4.1.0",
|
|
@@ -5507,13 +5932,13 @@ var package_default = {
|
|
|
5507
5932
|
zod: "3.22.4"
|
|
5508
5933
|
},
|
|
5509
5934
|
devDependencies: {
|
|
5510
|
-
"@types/diff": "5.0.
|
|
5511
|
-
"@types/inquirer": "9.0.
|
|
5935
|
+
"@types/diff": "5.0.9",
|
|
5936
|
+
"@types/inquirer": "9.0.7",
|
|
5512
5937
|
"@types/js-yaml": "4.0.9",
|
|
5513
5938
|
"@types/jsonwebtoken": "9.0.5",
|
|
5514
|
-
"@types/lodash.isequalwith": "4.4.
|
|
5515
|
-
"@types/node": "18.
|
|
5516
|
-
"@types/yargs": "17.0.
|
|
5939
|
+
"@types/lodash.isequalwith": "4.4.9",
|
|
5940
|
+
"@types/node": "18.19.3",
|
|
5941
|
+
"@types/yargs": "17.0.32"
|
|
5517
5942
|
},
|
|
5518
5943
|
bin: {
|
|
5519
5944
|
uniform: "./cli.js"
|
|
@@ -6465,10 +6890,10 @@ var NewMeshCmd = {
|
|
|
6465
6890
|
};
|
|
6466
6891
|
|
|
6467
6892
|
// src/commands/optimize/index.ts
|
|
6468
|
-
import
|
|
6893
|
+
import yargs20 from "yargs";
|
|
6469
6894
|
|
|
6470
6895
|
// src/commands/optimize/manifest.ts
|
|
6471
|
-
import
|
|
6896
|
+
import yargs19 from "yargs";
|
|
6472
6897
|
|
|
6473
6898
|
// src/commands/optimize/manifest/download.ts
|
|
6474
6899
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -6483,7 +6908,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
6483
6908
|
var module = {
|
|
6484
6909
|
command: "download [output]",
|
|
6485
6910
|
describe: "Download intent manifest",
|
|
6486
|
-
builder: (
|
|
6911
|
+
builder: (yargs28) => yargs28.option("apiKey", {
|
|
6487
6912
|
alias: "k",
|
|
6488
6913
|
demandOption: true,
|
|
6489
6914
|
string: true,
|
|
@@ -6584,10 +7009,10 @@ var module2 = {
|
|
|
6584
7009
|
command: "manifest <command>",
|
|
6585
7010
|
describe: "Intent manifest commands",
|
|
6586
7011
|
builder: () => {
|
|
6587
|
-
return
|
|
7012
|
+
return yargs19.command(download_default);
|
|
6588
7013
|
},
|
|
6589
7014
|
handler: () => {
|
|
6590
|
-
|
|
7015
|
+
yargs19.showHelp();
|
|
6591
7016
|
}
|
|
6592
7017
|
};
|
|
6593
7018
|
var manifest_default = module2;
|
|
@@ -6598,29 +7023,29 @@ var OptimizeCommand = {
|
|
|
6598
7023
|
aliases: ["opt"],
|
|
6599
7024
|
describe: "Uniform Optimize commands",
|
|
6600
7025
|
builder: () => {
|
|
6601
|
-
return
|
|
7026
|
+
return yargs20.command(manifest_default);
|
|
6602
7027
|
},
|
|
6603
7028
|
handler: () => {
|
|
6604
|
-
|
|
7029
|
+
yargs20.showHelp();
|
|
6605
7030
|
}
|
|
6606
7031
|
};
|
|
6607
7032
|
|
|
6608
7033
|
// src/commands/project-map/index.ts
|
|
6609
|
-
import
|
|
7034
|
+
import yargs23 from "yargs";
|
|
6610
7035
|
|
|
6611
7036
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
6612
|
-
import
|
|
7037
|
+
import yargs21 from "yargs";
|
|
6613
7038
|
|
|
6614
7039
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
6615
7040
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
6616
7041
|
var ProjectMapDefinitionGetModule = {
|
|
6617
7042
|
command: "get <id>",
|
|
6618
7043
|
describe: "Fetch a project map",
|
|
6619
|
-
builder: (
|
|
7044
|
+
builder: (yargs28) => withFormatOptions(
|
|
6620
7045
|
withConfiguration(
|
|
6621
7046
|
withApiOptions(
|
|
6622
7047
|
withProjectOptions(
|
|
6623
|
-
|
|
7048
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
6624
7049
|
)
|
|
6625
7050
|
)
|
|
6626
7051
|
)
|
|
@@ -6644,7 +7069,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
6644
7069
|
command: "list",
|
|
6645
7070
|
describe: "List of project maps",
|
|
6646
7071
|
aliases: ["ls"],
|
|
6647
|
-
builder: (
|
|
7072
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
6648
7073
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6649
7074
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6650
7075
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6701,11 +7126,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
6701
7126
|
var ProjectMapDefinitionPullModule = {
|
|
6702
7127
|
command: "pull <directory>",
|
|
6703
7128
|
describe: "Pulls all project maps to local files in a directory",
|
|
6704
|
-
builder: (
|
|
7129
|
+
builder: (yargs28) => withConfiguration(
|
|
6705
7130
|
withApiOptions(
|
|
6706
7131
|
withProjectOptions(
|
|
6707
7132
|
withDiffOptions(
|
|
6708
|
-
|
|
7133
|
+
yargs28.positional("directory", {
|
|
6709
7134
|
describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
6710
7135
|
type: "string"
|
|
6711
7136
|
}).option("format", {
|
|
@@ -6739,7 +7164,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
6739
7164
|
mode,
|
|
6740
7165
|
whatIf,
|
|
6741
7166
|
project: projectId,
|
|
6742
|
-
diff: diffMode
|
|
7167
|
+
diff: diffMode,
|
|
7168
|
+
allowEmptySource
|
|
6743
7169
|
}) => {
|
|
6744
7170
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6745
7171
|
const client = new UncachedProjectMapClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6770,7 +7196,7 @@ var ProjectMapDefinitionPullModule = {
|
|
|
6770
7196
|
target,
|
|
6771
7197
|
mode,
|
|
6772
7198
|
whatIf,
|
|
6773
|
-
allowEmptySource: true,
|
|
7199
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
6774
7200
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
6775
7201
|
});
|
|
6776
7202
|
}
|
|
@@ -6781,11 +7207,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
6781
7207
|
var ProjectMapDefinitionPushModule = {
|
|
6782
7208
|
command: "push <directory>",
|
|
6783
7209
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
6784
|
-
builder: (
|
|
7210
|
+
builder: (yargs28) => withConfiguration(
|
|
6785
7211
|
withApiOptions(
|
|
6786
7212
|
withProjectOptions(
|
|
6787
7213
|
withDiffOptions(
|
|
6788
|
-
|
|
7214
|
+
yargs28.positional("directory", {
|
|
6789
7215
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6790
7216
|
type: "string"
|
|
6791
7217
|
}).option("what-if", {
|
|
@@ -6812,7 +7238,8 @@ var ProjectMapDefinitionPushModule = {
|
|
|
6812
7238
|
mode,
|
|
6813
7239
|
whatIf,
|
|
6814
7240
|
project: projectId,
|
|
6815
|
-
diff: diffMode
|
|
7241
|
+
diff: diffMode,
|
|
7242
|
+
allowEmptySource
|
|
6816
7243
|
}) => {
|
|
6817
7244
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6818
7245
|
const client = new UncachedProjectMapClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6838,6 +7265,7 @@ var ProjectMapDefinitionPushModule = {
|
|
|
6838
7265
|
target,
|
|
6839
7266
|
mode,
|
|
6840
7267
|
whatIf,
|
|
7268
|
+
allowEmptySource,
|
|
6841
7269
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
6842
7270
|
});
|
|
6843
7271
|
}
|
|
@@ -6849,9 +7277,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
6849
7277
|
command: "remove <id>",
|
|
6850
7278
|
aliases: ["delete", "rm"],
|
|
6851
7279
|
describe: "Delete a project map",
|
|
6852
|
-
builder: (
|
|
7280
|
+
builder: (yargs28) => withConfiguration(
|
|
6853
7281
|
withApiOptions(
|
|
6854
|
-
withProjectOptions(
|
|
7282
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6855
7283
|
)
|
|
6856
7284
|
),
|
|
6857
7285
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6867,10 +7295,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6867
7295
|
command: "update <filename>",
|
|
6868
7296
|
aliases: ["put"],
|
|
6869
7297
|
describe: "Insert or update a project map",
|
|
6870
|
-
builder: (
|
|
7298
|
+
builder: (yargs28) => withConfiguration(
|
|
6871
7299
|
withApiOptions(
|
|
6872
7300
|
withProjectOptions(
|
|
6873
|
-
|
|
7301
|
+
yargs28.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6874
7302
|
)
|
|
6875
7303
|
)
|
|
6876
7304
|
),
|
|
@@ -6886,25 +7314,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6886
7314
|
var ProjectMapDefinitionModule = {
|
|
6887
7315
|
command: "definition <command>",
|
|
6888
7316
|
describe: "Commands for ProjectMap Definitions",
|
|
6889
|
-
builder: (
|
|
7317
|
+
builder: (yargs28) => yargs28.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
6890
7318
|
handler: () => {
|
|
6891
|
-
|
|
7319
|
+
yargs21.help();
|
|
6892
7320
|
}
|
|
6893
7321
|
};
|
|
6894
7322
|
|
|
6895
7323
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
6896
|
-
import
|
|
7324
|
+
import yargs22 from "yargs";
|
|
6897
7325
|
|
|
6898
7326
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
6899
7327
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
6900
7328
|
var ProjectMapNodeGetModule = {
|
|
6901
7329
|
command: "get <id> <projectMapId>",
|
|
6902
7330
|
describe: "Fetch a project map node",
|
|
6903
|
-
builder: (
|
|
7331
|
+
builder: (yargs28) => withConfiguration(
|
|
6904
7332
|
withFormatOptions(
|
|
6905
7333
|
withApiOptions(
|
|
6906
7334
|
withProjectOptions(
|
|
6907
|
-
|
|
7335
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6908
7336
|
)
|
|
6909
7337
|
)
|
|
6910
7338
|
)
|
|
@@ -6930,11 +7358,11 @@ var ProjectMapNodeListModule = {
|
|
|
6930
7358
|
command: "list <projectMapId>",
|
|
6931
7359
|
describe: "List project map nodes",
|
|
6932
7360
|
aliases: ["ls"],
|
|
6933
|
-
builder: (
|
|
7361
|
+
builder: (yargs28) => withConfiguration(
|
|
6934
7362
|
withFormatOptions(
|
|
6935
7363
|
withApiOptions(
|
|
6936
7364
|
withProjectOptions(
|
|
6937
|
-
|
|
7365
|
+
yargs28.positional("projectMapId", {
|
|
6938
7366
|
demandOption: true,
|
|
6939
7367
|
describe: "ProjectMap UUID to fetch from"
|
|
6940
7368
|
})
|
|
@@ -7005,11 +7433,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
7005
7433
|
var ProjectMapNodePullModule = {
|
|
7006
7434
|
command: "pull <directory>",
|
|
7007
7435
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
7008
|
-
builder: (
|
|
7436
|
+
builder: (yargs28) => withConfiguration(
|
|
7009
7437
|
withApiOptions(
|
|
7010
7438
|
withProjectOptions(
|
|
7011
7439
|
withDiffOptions(
|
|
7012
|
-
|
|
7440
|
+
yargs28.positional("directory", {
|
|
7013
7441
|
describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
7014
7442
|
type: "string"
|
|
7015
7443
|
}).option("format", {
|
|
@@ -7043,7 +7471,8 @@ var ProjectMapNodePullModule = {
|
|
|
7043
7471
|
mode,
|
|
7044
7472
|
whatIf,
|
|
7045
7473
|
project: projectId,
|
|
7046
|
-
diff: diffMode
|
|
7474
|
+
diff: diffMode,
|
|
7475
|
+
allowEmptySource
|
|
7047
7476
|
}) => {
|
|
7048
7477
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7049
7478
|
const client = new UncachedProjectMapClient9({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7078,7 +7507,7 @@ var ProjectMapNodePullModule = {
|
|
|
7078
7507
|
target,
|
|
7079
7508
|
mode,
|
|
7080
7509
|
whatIf,
|
|
7081
|
-
allowEmptySource: true,
|
|
7510
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
7082
7511
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
7083
7512
|
});
|
|
7084
7513
|
}
|
|
@@ -7089,11 +7518,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
7089
7518
|
var ProjectMapNodePushModule = {
|
|
7090
7519
|
command: "push <directory>",
|
|
7091
7520
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
7092
|
-
builder: (
|
|
7521
|
+
builder: (yargs28) => withConfiguration(
|
|
7093
7522
|
withApiOptions(
|
|
7094
7523
|
withProjectOptions(
|
|
7095
7524
|
withDiffOptions(
|
|
7096
|
-
|
|
7525
|
+
yargs28.positional("directory", {
|
|
7097
7526
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
7098
7527
|
type: "string"
|
|
7099
7528
|
}).option("what-if", {
|
|
@@ -7120,7 +7549,8 @@ var ProjectMapNodePushModule = {
|
|
|
7120
7549
|
mode,
|
|
7121
7550
|
whatIf,
|
|
7122
7551
|
project: projectId,
|
|
7123
|
-
diff: diffMode
|
|
7552
|
+
diff: diffMode,
|
|
7553
|
+
allowEmptySource
|
|
7124
7554
|
}) => {
|
|
7125
7555
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7126
7556
|
const client = new UncachedProjectMapClient10({
|
|
@@ -7155,6 +7585,7 @@ var ProjectMapNodePushModule = {
|
|
|
7155
7585
|
target,
|
|
7156
7586
|
mode,
|
|
7157
7587
|
whatIf,
|
|
7588
|
+
allowEmptySource,
|
|
7158
7589
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
7159
7590
|
});
|
|
7160
7591
|
}
|
|
@@ -7166,10 +7597,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
7166
7597
|
command: "remove <id> <projectMapId>",
|
|
7167
7598
|
aliases: ["delete", "rm"],
|
|
7168
7599
|
describe: "Delete a project map node",
|
|
7169
|
-
builder: (
|
|
7600
|
+
builder: (yargs28) => withConfiguration(
|
|
7170
7601
|
withApiOptions(
|
|
7171
7602
|
withProjectOptions(
|
|
7172
|
-
|
|
7603
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
7173
7604
|
)
|
|
7174
7605
|
)
|
|
7175
7606
|
),
|
|
@@ -7186,10 +7617,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
7186
7617
|
command: "update <filename> <projectMapId>",
|
|
7187
7618
|
aliases: ["put"],
|
|
7188
7619
|
describe: "Insert or update a project map node",
|
|
7189
|
-
builder: (
|
|
7620
|
+
builder: (yargs28) => withConfiguration(
|
|
7190
7621
|
withApiOptions(
|
|
7191
7622
|
withProjectOptions(
|
|
7192
|
-
|
|
7623
|
+
yargs28.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
7193
7624
|
)
|
|
7194
7625
|
)
|
|
7195
7626
|
),
|
|
@@ -7205,9 +7636,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
7205
7636
|
var ProjectMapNodeModule = {
|
|
7206
7637
|
command: "node <command>",
|
|
7207
7638
|
describe: "Commands for ProjectMap Nodes",
|
|
7208
|
-
builder: (
|
|
7639
|
+
builder: (yargs28) => yargs28.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
7209
7640
|
handler: () => {
|
|
7210
|
-
|
|
7641
|
+
yargs22.help();
|
|
7211
7642
|
}
|
|
7212
7643
|
};
|
|
7213
7644
|
|
|
@@ -7216,28 +7647,28 @@ var ProjectMapCommand = {
|
|
|
7216
7647
|
command: "project-map <command>",
|
|
7217
7648
|
aliases: ["prm"],
|
|
7218
7649
|
describe: "Uniform ProjectMap commands",
|
|
7219
|
-
builder: (
|
|
7650
|
+
builder: (yargs28) => yargs28.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
7220
7651
|
handler: () => {
|
|
7221
|
-
|
|
7652
|
+
yargs23.showHelp();
|
|
7222
7653
|
}
|
|
7223
7654
|
};
|
|
7224
7655
|
|
|
7225
7656
|
// src/commands/redirect/index.ts
|
|
7226
|
-
import
|
|
7657
|
+
import yargs25 from "yargs";
|
|
7227
7658
|
|
|
7228
7659
|
// src/commands/redirect/commands/redirect.ts
|
|
7229
|
-
import
|
|
7660
|
+
import yargs24 from "yargs";
|
|
7230
7661
|
|
|
7231
7662
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
7232
7663
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
7233
7664
|
var RedirectDefinitionGetModule = {
|
|
7234
7665
|
command: "get <id>",
|
|
7235
7666
|
describe: "Fetch a redirect",
|
|
7236
|
-
builder: (
|
|
7667
|
+
builder: (yargs28) => withConfiguration(
|
|
7237
7668
|
withFormatOptions(
|
|
7238
7669
|
withApiOptions(
|
|
7239
7670
|
withProjectOptions(
|
|
7240
|
-
|
|
7671
|
+
yargs28.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
7241
7672
|
)
|
|
7242
7673
|
)
|
|
7243
7674
|
)
|
|
@@ -7261,7 +7692,7 @@ var RedirectDefinitionListModule = {
|
|
|
7261
7692
|
command: "list",
|
|
7262
7693
|
describe: "List of redirects",
|
|
7263
7694
|
aliases: ["ls"],
|
|
7264
|
-
builder: (
|
|
7695
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
7265
7696
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
7266
7697
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7267
7698
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7327,11 +7758,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
7327
7758
|
var RedirectDefinitionPullModule = {
|
|
7328
7759
|
command: "pull <directory>",
|
|
7329
7760
|
describe: "Pulls all redirects to local files in a directory",
|
|
7330
|
-
builder: (
|
|
7761
|
+
builder: (yargs28) => withConfiguration(
|
|
7331
7762
|
withApiOptions(
|
|
7332
7763
|
withProjectOptions(
|
|
7333
7764
|
withDiffOptions(
|
|
7334
|
-
|
|
7765
|
+
yargs28.positional("directory", {
|
|
7335
7766
|
describe: "Directory to save redirects to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
|
|
7336
7767
|
type: "string"
|
|
7337
7768
|
}).option("format", {
|
|
@@ -7365,7 +7796,8 @@ var RedirectDefinitionPullModule = {
|
|
|
7365
7796
|
mode,
|
|
7366
7797
|
whatIf,
|
|
7367
7798
|
project: projectId,
|
|
7368
|
-
diff: diffMode
|
|
7799
|
+
diff: diffMode,
|
|
7800
|
+
allowEmptySource
|
|
7369
7801
|
}) => {
|
|
7370
7802
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7371
7803
|
const client = new UncachedRedirectClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7397,7 +7829,7 @@ var RedirectDefinitionPullModule = {
|
|
|
7397
7829
|
target,
|
|
7398
7830
|
mode,
|
|
7399
7831
|
whatIf,
|
|
7400
|
-
allowEmptySource: true,
|
|
7832
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
7401
7833
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
7402
7834
|
});
|
|
7403
7835
|
}
|
|
@@ -7408,11 +7840,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
7408
7840
|
var RedirectDefinitionPushModule = {
|
|
7409
7841
|
command: "push <directory>",
|
|
7410
7842
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
7411
|
-
builder: (
|
|
7843
|
+
builder: (yargs28) => withConfiguration(
|
|
7412
7844
|
withApiOptions(
|
|
7413
7845
|
withProjectOptions(
|
|
7414
7846
|
withDiffOptions(
|
|
7415
|
-
|
|
7847
|
+
yargs28.positional("directory", {
|
|
7416
7848
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
7417
7849
|
type: "string"
|
|
7418
7850
|
}).option("what-if", {
|
|
@@ -7439,7 +7871,8 @@ var RedirectDefinitionPushModule = {
|
|
|
7439
7871
|
mode,
|
|
7440
7872
|
whatIf,
|
|
7441
7873
|
project: projectId,
|
|
7442
|
-
diff: diffMode
|
|
7874
|
+
diff: diffMode,
|
|
7875
|
+
allowEmptySource
|
|
7443
7876
|
}) => {
|
|
7444
7877
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7445
7878
|
const client = new UncachedRedirectClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7465,6 +7898,7 @@ var RedirectDefinitionPushModule = {
|
|
|
7465
7898
|
target,
|
|
7466
7899
|
mode,
|
|
7467
7900
|
whatIf,
|
|
7901
|
+
allowEmptySource,
|
|
7468
7902
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
7469
7903
|
});
|
|
7470
7904
|
}
|
|
@@ -7476,9 +7910,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
7476
7910
|
command: "remove <id>",
|
|
7477
7911
|
aliases: ["delete", "rm"],
|
|
7478
7912
|
describe: "Delete a redirect",
|
|
7479
|
-
builder: (
|
|
7913
|
+
builder: (yargs28) => withConfiguration(
|
|
7480
7914
|
withApiOptions(
|
|
7481
|
-
withProjectOptions(
|
|
7915
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
7482
7916
|
)
|
|
7483
7917
|
),
|
|
7484
7918
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -7494,10 +7928,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7494
7928
|
command: "update <filename>",
|
|
7495
7929
|
aliases: ["put"],
|
|
7496
7930
|
describe: "Insert or update a redirect",
|
|
7497
|
-
builder: (
|
|
7931
|
+
builder: (yargs28) => withConfiguration(
|
|
7498
7932
|
withApiOptions(
|
|
7499
7933
|
withProjectOptions(
|
|
7500
|
-
|
|
7934
|
+
yargs28.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
7501
7935
|
)
|
|
7502
7936
|
)
|
|
7503
7937
|
),
|
|
@@ -7513,9 +7947,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7513
7947
|
var RedirectDefinitionModule = {
|
|
7514
7948
|
command: "definition <command>",
|
|
7515
7949
|
describe: "Commands for Redirect Definitions",
|
|
7516
|
-
builder: (
|
|
7950
|
+
builder: (yargs28) => yargs28.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
7517
7951
|
handler: () => {
|
|
7518
|
-
|
|
7952
|
+
yargs24.help();
|
|
7519
7953
|
}
|
|
7520
7954
|
};
|
|
7521
7955
|
|
|
@@ -7524,14 +7958,14 @@ var RedirectCommand = {
|
|
|
7524
7958
|
command: "redirect <command>",
|
|
7525
7959
|
aliases: ["red"],
|
|
7526
7960
|
describe: "Uniform Redirect commands",
|
|
7527
|
-
builder: (
|
|
7961
|
+
builder: (yargs28) => yargs28.command(RedirectDefinitionModule).demandCommand(),
|
|
7528
7962
|
handler: () => {
|
|
7529
|
-
|
|
7963
|
+
yargs25.showHelp();
|
|
7530
7964
|
}
|
|
7531
7965
|
};
|
|
7532
7966
|
|
|
7533
7967
|
// src/commands/sync/index.ts
|
|
7534
|
-
import
|
|
7968
|
+
import yargs26 from "yargs";
|
|
7535
7969
|
|
|
7536
7970
|
// src/commands/sync/commands/util.ts
|
|
7537
7971
|
import ora2 from "ora";
|
|
@@ -7550,10 +7984,12 @@ function spin(entityType) {
|
|
|
7550
7984
|
stop: () => {
|
|
7551
7985
|
spinner.stop();
|
|
7552
7986
|
console.log = consoleLog;
|
|
7987
|
+
return spinner;
|
|
7553
7988
|
},
|
|
7554
7989
|
succeed() {
|
|
7555
7990
|
spinner.succeed();
|
|
7556
7991
|
console.log = consoleLog;
|
|
7992
|
+
return spinner;
|
|
7557
7993
|
}
|
|
7558
7994
|
};
|
|
7559
7995
|
}
|
|
@@ -7562,11 +7998,11 @@ function spin(entityType) {
|
|
|
7562
7998
|
var SyncPullModule = {
|
|
7563
7999
|
command: "pull",
|
|
7564
8000
|
describe: "Pulls whole project to local files in a directory",
|
|
7565
|
-
builder: (
|
|
8001
|
+
builder: (yargs28) => withConfiguration(
|
|
7566
8002
|
withApiOptions(
|
|
7567
8003
|
withProjectOptions(
|
|
7568
8004
|
withDiffOptions(
|
|
7569
|
-
|
|
8005
|
+
yargs28.option("what-if", {
|
|
7570
8006
|
alias: ["w"],
|
|
7571
8007
|
describe: "What-if mode reports what would be done but changes no files",
|
|
7572
8008
|
default: false,
|
|
@@ -7577,8 +8013,11 @@ var SyncPullModule = {
|
|
|
7577
8013
|
)
|
|
7578
8014
|
),
|
|
7579
8015
|
handler: async ({ serialization, ...otherParams }) => {
|
|
8016
|
+
var _a;
|
|
7580
8017
|
const config2 = serialization;
|
|
7581
8018
|
const enabledEntities = Object.entries({
|
|
8019
|
+
locale: LocalePullModule,
|
|
8020
|
+
asset: AssetPullModule,
|
|
7582
8021
|
category: CategoryPullModule,
|
|
7583
8022
|
dataType: DataTypePullModule,
|
|
7584
8023
|
prompt: PromptPullModule,
|
|
@@ -7594,11 +8033,10 @@ var SyncPullModule = {
|
|
|
7594
8033
|
projectMapNode: ProjectMapNodePullModule,
|
|
7595
8034
|
redirect: RedirectDefinitionPullModule,
|
|
7596
8035
|
entry: EntryPullModule,
|
|
7597
|
-
contentType: ContentTypePullModule
|
|
7598
|
-
asset: AssetPullModule
|
|
8036
|
+
contentType: ContentTypePullModule
|
|
7599
8037
|
}).filter(([entityType]) => {
|
|
7600
|
-
var
|
|
7601
|
-
return Boolean((
|
|
8038
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
8039
|
+
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
7602
8040
|
});
|
|
7603
8041
|
if (enabledEntities.length === 0) {
|
|
7604
8042
|
throw new Error(
|
|
@@ -7607,15 +8045,20 @@ var SyncPullModule = {
|
|
|
7607
8045
|
}
|
|
7608
8046
|
for (const [entityType, module3] of enabledEntities) {
|
|
7609
8047
|
const spinner = spin(entityType);
|
|
8048
|
+
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
8049
|
+
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
8050
|
+
};
|
|
8051
|
+
const entityConfig = (_a = config2.entitiesConfig) == null ? void 0 : _a[entityType];
|
|
7610
8052
|
try {
|
|
7611
8053
|
await module3.handler({
|
|
7612
8054
|
...otherParams,
|
|
7613
|
-
state: 0,
|
|
8055
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
7614
8056
|
format: getFormat(entityType, config2),
|
|
7615
8057
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
7616
8058
|
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
7617
8059
|
mode: getPullMode(entityType, config2),
|
|
7618
|
-
directory: getPullFilename(entityType, config2)
|
|
8060
|
+
directory: getPullFilename(entityType, config2),
|
|
8061
|
+
allowEmptySource: config2.allowEmptySource
|
|
7619
8062
|
});
|
|
7620
8063
|
spinner.succeed();
|
|
7621
8064
|
} catch (e) {
|
|
@@ -7653,11 +8096,11 @@ var getFormat = (entityType, config2) => {
|
|
|
7653
8096
|
var SyncPushModule = {
|
|
7654
8097
|
command: "push",
|
|
7655
8098
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
7656
|
-
builder: (
|
|
8099
|
+
builder: (yargs28) => withConfiguration(
|
|
7657
8100
|
withApiOptions(
|
|
7658
8101
|
withProjectOptions(
|
|
7659
8102
|
withDiffOptions(
|
|
7660
|
-
|
|
8103
|
+
yargs28.option("what-if", {
|
|
7661
8104
|
alias: ["w"],
|
|
7662
8105
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
7663
8106
|
default: false,
|
|
@@ -7671,6 +8114,8 @@ var SyncPushModule = {
|
|
|
7671
8114
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
7672
8115
|
const config2 = serialization;
|
|
7673
8116
|
const enabledEntities = Object.entries({
|
|
8117
|
+
locale: LocalePushModule,
|
|
8118
|
+
asset: AssetPushModule,
|
|
7674
8119
|
category: CategoryPushModule,
|
|
7675
8120
|
dataType: DataTypePushModule,
|
|
7676
8121
|
prompt: PromptPushModule,
|
|
@@ -7686,8 +8131,7 @@ var SyncPushModule = {
|
|
|
7686
8131
|
projectMapNode: ProjectMapNodePushModule,
|
|
7687
8132
|
redirect: RedirectDefinitionPushModule,
|
|
7688
8133
|
contentType: ContentTypePushModule,
|
|
7689
|
-
entry: EntryPushModule
|
|
7690
|
-
asset: AssetPushModule
|
|
8134
|
+
entry: EntryPushModule
|
|
7691
8135
|
}).filter(([entityType]) => {
|
|
7692
8136
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7693
8137
|
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
|
|
@@ -7707,7 +8151,8 @@ var SyncPushModule = {
|
|
|
7707
8151
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
7708
8152
|
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
7709
8153
|
mode: getPushMode(entityType, config2),
|
|
7710
|
-
directory: getPushFilename(entityType, config2)
|
|
8154
|
+
directory: getPushFilename(entityType, config2),
|
|
8155
|
+
allowEmptySource: config2.allowEmptySource
|
|
7711
8156
|
});
|
|
7712
8157
|
spinner.succeed();
|
|
7713
8158
|
} catch (e) {
|
|
@@ -7751,9 +8196,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
7751
8196
|
var SyncCommand = {
|
|
7752
8197
|
command: "sync <command>",
|
|
7753
8198
|
describe: "Uniform Sync commands",
|
|
7754
|
-
builder: (
|
|
8199
|
+
builder: (yargs28) => yargs28.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
7755
8200
|
handler: () => {
|
|
7756
|
-
|
|
8201
|
+
yargs26.showHelp();
|
|
7757
8202
|
}
|
|
7758
8203
|
};
|
|
7759
8204
|
|
|
@@ -8019,7 +8464,7 @@ First found was: v${firstVersion}`;
|
|
|
8019
8464
|
|
|
8020
8465
|
// src/index.ts
|
|
8021
8466
|
dotenv.config();
|
|
8022
|
-
var yarggery =
|
|
8467
|
+
var yarggery = yargs27(hideBin(process.argv));
|
|
8023
8468
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
8024
8469
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
8025
8470
|
yarggery.option("verbose", {
|