@uniformdev/cli 19.80.1-alpha.149 → 19.80.1-alpha.192
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 +11 -4
- package/dist/index.mjs +715 -337
- package/package.json +9 -9
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@8.0.1_@microsoft+api-extractor@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",
|
|
@@ -632,12 +632,12 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
632
632
|
var AssetGetModule = {
|
|
633
633
|
command: "get <id>",
|
|
634
634
|
describe: "Get an asset",
|
|
635
|
-
builder: (
|
|
635
|
+
builder: (yargs28) => withConfiguration(
|
|
636
636
|
withFormatOptions(
|
|
637
637
|
withApiOptions(
|
|
638
638
|
withProjectOptions(
|
|
639
639
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
640
|
-
|
|
640
|
+
yargs28.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
641
641
|
)
|
|
642
642
|
)
|
|
643
643
|
)
|
|
@@ -658,7 +658,7 @@ import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets"
|
|
|
658
658
|
var AssetListModule = {
|
|
659
659
|
command: "list",
|
|
660
660
|
describe: "List assets",
|
|
661
|
-
builder: (
|
|
661
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
662
662
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
663
663
|
const fetch3 = nodeFetchProxy(proxy);
|
|
664
664
|
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -669,6 +669,7 @@ var AssetListModule = {
|
|
|
669
669
|
|
|
670
670
|
// src/commands/canvas/commands/asset/pull.ts
|
|
671
671
|
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
672
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
672
673
|
|
|
673
674
|
// src/files/index.ts
|
|
674
675
|
import { preferredType } from "@thi.ng/mime";
|
|
@@ -679,20 +680,60 @@ import sizeOf from "image-size";
|
|
|
679
680
|
import PQueue from "p-queue";
|
|
680
681
|
import { dirname as dirname2, join as join2 } from "path";
|
|
681
682
|
var FILES_DIRECTORY_NAME = "files";
|
|
683
|
+
var escapeRegExp = (string) => {
|
|
684
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
685
|
+
};
|
|
682
686
|
var urlToHash = (url) => {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
687
|
+
return Buffer.from(
|
|
688
|
+
// We take only the first 64 characters of the pathname as
|
|
689
|
+
// that's enough to guarantee uniqueness
|
|
690
|
+
new URL(url).pathname.substring(0, 64)
|
|
691
|
+
).toString("base64");
|
|
692
|
+
};
|
|
693
|
+
var hashToPartialPathname = (hash) => {
|
|
694
|
+
try {
|
|
695
|
+
return Buffer.from(hash, "base64").toString("utf8");
|
|
696
|
+
} catch {
|
|
697
|
+
return null;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
var findUrlMatchingPartialPathname = (source, pathname) => {
|
|
701
|
+
const escapedPathname = escapeRegExp(pathname);
|
|
702
|
+
const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
|
|
703
|
+
const match = source.match(regex);
|
|
704
|
+
if (match && match[1]) {
|
|
705
|
+
return match[1];
|
|
706
|
+
}
|
|
707
|
+
return null;
|
|
686
708
|
};
|
|
687
|
-
var
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
709
|
+
var urlToFileExtension = (url) => {
|
|
710
|
+
try {
|
|
711
|
+
const urlObject = new URL(url);
|
|
712
|
+
const fileNameChunks = urlObject.pathname.split(".");
|
|
713
|
+
return fileNameChunks.length > 1 ? fileNameChunks.at(-1) ?? null : null;
|
|
714
|
+
} catch {
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
var urlToFileName = (url, hash) => {
|
|
719
|
+
const fileName = hash ?? urlToHash(url);
|
|
720
|
+
const fileExtension = urlToFileExtension(url);
|
|
691
721
|
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
692
722
|
};
|
|
723
|
+
var getFilesDirectory = (directory) => {
|
|
724
|
+
const isPackage = isPathAPackageFile(directory);
|
|
725
|
+
return isPackage ? dirname2(directory) : (
|
|
726
|
+
// If we are syncing to a directory, we want to write all files into a
|
|
727
|
+
// top-lvl folder. That way any entities that contain files will sync to the
|
|
728
|
+
// same directory, so there is no duplication
|
|
729
|
+
join2(directory, "..")
|
|
730
|
+
);
|
|
731
|
+
};
|
|
732
|
+
var getUniformFileUrlMatches = (string) => {
|
|
733
|
+
return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
|
|
734
|
+
};
|
|
693
735
|
var deleteDownloadedFileByUrl = async (url, options) => {
|
|
694
|
-
const
|
|
695
|
-
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
736
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
696
737
|
const fileName = urlToFileName(url);
|
|
697
738
|
const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
|
|
698
739
|
try {
|
|
@@ -703,18 +744,14 @@ var deleteDownloadedFileByUrl = async (url, options) => {
|
|
|
703
744
|
};
|
|
704
745
|
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
705
746
|
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;
|
|
747
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
748
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
711
749
|
if (uniformFileUrlMatches) {
|
|
712
750
|
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
713
751
|
for (const match of uniformFileUrlMatches) {
|
|
714
752
|
const url = new URL(match[1]);
|
|
715
753
|
fileDownloadQueue.add(async () => {
|
|
716
754
|
try {
|
|
717
|
-
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
718
755
|
const fileName = urlToFileName(url.toString());
|
|
719
756
|
const fileAlreadyExists = await fsj.existsAsync(
|
|
720
757
|
join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
|
|
@@ -722,6 +759,23 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
722
759
|
if (fileAlreadyExists) {
|
|
723
760
|
return;
|
|
724
761
|
}
|
|
762
|
+
const file = await options.fileClient.get({ url: url.toString() }).catch(() => null);
|
|
763
|
+
if (!file) {
|
|
764
|
+
console.warn(`Skipping file ${url} as it does not exist in the project anymore`);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (file.sourceId) {
|
|
768
|
+
try {
|
|
769
|
+
const hashAlreadyExists = await fsj.findAsync(join2(writeDirectory, FILES_DIRECTORY_NAME), {
|
|
770
|
+
matching: [file.sourceId, `${file.sourceId}.*`]
|
|
771
|
+
});
|
|
772
|
+
if (hashAlreadyExists.length > 0) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
} catch {
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
725
779
|
const response = await fetch(fetchUrl);
|
|
726
780
|
if (!response.ok) {
|
|
727
781
|
return;
|
|
@@ -739,37 +793,41 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
739
793
|
};
|
|
740
794
|
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
741
795
|
let objectAsString = JSON.stringify(object);
|
|
742
|
-
const uniformFileUrlMatches = objectAsString
|
|
743
|
-
|
|
744
|
-
);
|
|
796
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
797
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
745
798
|
const isPackage = isPathAPackageFile(options.directory);
|
|
746
|
-
const
|
|
799
|
+
const legacyWriteDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
747
800
|
if (uniformFileUrlMatches) {
|
|
748
801
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
749
802
|
for (const match of uniformFileUrlMatches) {
|
|
750
803
|
const url = match[1];
|
|
751
804
|
const hash = urlToHash(url);
|
|
805
|
+
const legacyHash = legacyUrlToHash(url);
|
|
752
806
|
fileUploadQueue.add(async () => {
|
|
753
807
|
try {
|
|
754
808
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
755
809
|
options.fileClient.get({ url }).catch(() => null),
|
|
756
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
810
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
811
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
757
812
|
]);
|
|
758
813
|
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
759
814
|
return;
|
|
760
815
|
}
|
|
761
816
|
const localFileName = urlToFileName(url);
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
);
|
|
817
|
+
let expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
|
|
818
|
+
let fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
765
819
|
if (!fileExistsLocally) {
|
|
766
|
-
|
|
820
|
+
const localFileName2 = legacyUrlToFileName(url);
|
|
821
|
+
expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
|
|
822
|
+
fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
823
|
+
}
|
|
824
|
+
if (!fileExistsLocally) {
|
|
825
|
+
console.warn(
|
|
826
|
+
`Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
827
|
+
);
|
|
767
828
|
return;
|
|
768
829
|
}
|
|
769
|
-
const fileBuffer = await fsj.readAsync(
|
|
770
|
-
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName),
|
|
771
|
-
"buffer"
|
|
772
|
-
);
|
|
830
|
+
const fileBuffer = await fsj.readAsync(expectedFilePath, "buffer");
|
|
773
831
|
if (!fileBuffer) {
|
|
774
832
|
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
775
833
|
return;
|
|
@@ -815,8 +873,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
815
873
|
return file.url;
|
|
816
874
|
};
|
|
817
875
|
const abortTimeout = setTimeout(() => {
|
|
818
|
-
throw new Error(`Failed to upload file ${url}`);
|
|
819
|
-
},
|
|
876
|
+
throw new Error(`Failed to upload file ${url} (upload timed out)`);
|
|
877
|
+
}, 3e4);
|
|
820
878
|
const uploadedFileUrl = await checkForFile();
|
|
821
879
|
clearTimeout(abortTimeout);
|
|
822
880
|
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
@@ -831,19 +889,19 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
831
889
|
};
|
|
832
890
|
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
833
891
|
let objectAsString = JSON.stringify(object);
|
|
834
|
-
const uniformFileUrlMatches = objectAsString
|
|
835
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
836
|
-
);
|
|
892
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
837
893
|
if (uniformFileUrlMatches) {
|
|
838
894
|
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
839
895
|
for (const match of uniformFileUrlMatches) {
|
|
840
896
|
const url = match[1];
|
|
841
897
|
const hash = urlToHash(url);
|
|
898
|
+
const legacyHash = legacyUrlToHash(url);
|
|
842
899
|
fileUrlReplacementQueue.add(async () => {
|
|
843
900
|
try {
|
|
844
901
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
845
902
|
options.fileClient.get({ url }).catch(() => null),
|
|
846
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
903
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
904
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
847
905
|
]);
|
|
848
906
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
849
907
|
if (!file) {
|
|
@@ -858,19 +916,74 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
858
916
|
}
|
|
859
917
|
return JSON.parse(objectAsString);
|
|
860
918
|
};
|
|
919
|
+
var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
|
|
920
|
+
let sourceObjectAsString = JSON.stringify(sourceObject);
|
|
921
|
+
const targetObjectAsString = JSON.stringify(targetObject);
|
|
922
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
|
|
923
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
924
|
+
if (uniformFileUrlMatches) {
|
|
925
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
926
|
+
for (const match of uniformFileUrlMatches) {
|
|
927
|
+
const url = match[1];
|
|
928
|
+
fileUrlReplacementQueue.add(async () => {
|
|
929
|
+
try {
|
|
930
|
+
const localFileName = urlToFileName(url);
|
|
931
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
932
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
933
|
+
);
|
|
934
|
+
if (fileExistsLocally) {
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
const file = await options.fileClient.get({ url }).catch(() => null);
|
|
938
|
+
if (!file || !file.sourceId) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const originalPartialPath = hashToPartialPathname(file.sourceId);
|
|
942
|
+
if (!originalPartialPath) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
|
|
946
|
+
if (!originalUrl) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
|
|
950
|
+
} catch {
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
await fileUrlReplacementQueue.onIdle();
|
|
955
|
+
}
|
|
956
|
+
return JSON.parse(sourceObjectAsString);
|
|
957
|
+
};
|
|
861
958
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
862
|
-
var _a
|
|
863
|
-
|
|
864
|
-
|
|
959
|
+
var _a;
|
|
960
|
+
if (!asset.asset.fields) {
|
|
961
|
+
return asset;
|
|
962
|
+
}
|
|
963
|
+
const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
|
|
964
|
+
if (!fileUrl) {
|
|
865
965
|
return asset;
|
|
866
966
|
}
|
|
867
967
|
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
868
968
|
if (!file) {
|
|
869
969
|
return asset;
|
|
870
970
|
}
|
|
871
|
-
asset.asset.fields.file
|
|
971
|
+
asset.asset.fields.file = {
|
|
972
|
+
type: "file",
|
|
973
|
+
value: file.id
|
|
974
|
+
};
|
|
872
975
|
return asset;
|
|
873
976
|
};
|
|
977
|
+
var legacyUrlToHash = (url) => {
|
|
978
|
+
const hash = createHash("sha256");
|
|
979
|
+
hash.update(url);
|
|
980
|
+
return hash.digest("hex");
|
|
981
|
+
};
|
|
982
|
+
var legacyUrlToFileName = (url) => {
|
|
983
|
+
const fileName = legacyUrlToHash(url);
|
|
984
|
+
const fileExtension = urlToFileExtension(url);
|
|
985
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
986
|
+
};
|
|
874
987
|
|
|
875
988
|
// src/commands/canvas/assetEngineDataSource.ts
|
|
876
989
|
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
@@ -895,8 +1008,8 @@ function prepCompositionForDisk(composition) {
|
|
|
895
1008
|
delete prepped.state;
|
|
896
1009
|
return prepped;
|
|
897
1010
|
}
|
|
898
|
-
function withStateOptions(
|
|
899
|
-
return
|
|
1011
|
+
function withStateOptions(yargs28) {
|
|
1012
|
+
return yargs28.option("state", {
|
|
900
1013
|
type: "string",
|
|
901
1014
|
describe: `Composition state to fetch.`,
|
|
902
1015
|
choices: ["preview", "published"],
|
|
@@ -962,11 +1075,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
962
1075
|
var AssetPullModule = {
|
|
963
1076
|
command: "pull <directory>",
|
|
964
1077
|
describe: "Pulls all assets to local files in a directory",
|
|
965
|
-
builder: (
|
|
1078
|
+
builder: (yargs28) => withConfiguration(
|
|
966
1079
|
withApiOptions(
|
|
967
1080
|
withProjectOptions(
|
|
968
1081
|
withDiffOptions(
|
|
969
|
-
|
|
1082
|
+
yargs28.positional("directory", {
|
|
970
1083
|
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
1084
|
type: "string"
|
|
972
1085
|
}).option("format", {
|
|
@@ -1009,6 +1122,7 @@ var AssetPullModule = {
|
|
|
1009
1122
|
fetch: fetch3,
|
|
1010
1123
|
projectId
|
|
1011
1124
|
});
|
|
1125
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1012
1126
|
const source = createAssetEngineDataSource({ client });
|
|
1013
1127
|
let target;
|
|
1014
1128
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1050,14 +1164,27 @@ var AssetPullModule = {
|
|
|
1050
1164
|
whatIf,
|
|
1051
1165
|
allowEmptySource: true,
|
|
1052
1166
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1053
|
-
onBeforeCompareObjects: async (sourceObject) => {
|
|
1167
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1168
|
+
var _a, _b;
|
|
1054
1169
|
delete sourceObject.object.asset._author;
|
|
1055
|
-
|
|
1170
|
+
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
1171
|
+
sourceObject,
|
|
1172
|
+
targetObject,
|
|
1173
|
+
{
|
|
1174
|
+
directory,
|
|
1175
|
+
fileClient
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
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) {
|
|
1179
|
+
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1180
|
+
}
|
|
1181
|
+
return sourceObjectWithPotentiallySwappedUrl;
|
|
1056
1182
|
},
|
|
1057
1183
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1058
1184
|
delete sourceObject.object.asset._author;
|
|
1059
1185
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1060
|
-
directory
|
|
1186
|
+
directory,
|
|
1187
|
+
fileClient
|
|
1061
1188
|
});
|
|
1062
1189
|
}
|
|
1063
1190
|
});
|
|
@@ -1066,15 +1193,15 @@ var AssetPullModule = {
|
|
|
1066
1193
|
|
|
1067
1194
|
// src/commands/canvas/commands/asset/push.ts
|
|
1068
1195
|
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1069
|
-
import { UncachedFileClient } from "@uniformdev/files";
|
|
1196
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1070
1197
|
var AssetPushModule = {
|
|
1071
1198
|
command: "push <directory>",
|
|
1072
1199
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1073
|
-
builder: (
|
|
1200
|
+
builder: (yargs28) => withConfiguration(
|
|
1074
1201
|
withApiOptions(
|
|
1075
1202
|
withProjectOptions(
|
|
1076
1203
|
withDiffOptions(
|
|
1077
|
-
|
|
1204
|
+
yargs28.positional("directory", {
|
|
1078
1205
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1079
1206
|
type: "string"
|
|
1080
1207
|
}).option("what-if", {
|
|
@@ -1127,7 +1254,7 @@ var AssetPushModule = {
|
|
|
1127
1254
|
});
|
|
1128
1255
|
}
|
|
1129
1256
|
const target = createAssetEngineDataSource({ client });
|
|
1130
|
-
const fileClient = new
|
|
1257
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1131
1258
|
await syncEngine({
|
|
1132
1259
|
source,
|
|
1133
1260
|
target,
|
|
@@ -1150,10 +1277,15 @@ var AssetPushModule = {
|
|
|
1150
1277
|
return sourceObjectWithNewFileUrls;
|
|
1151
1278
|
},
|
|
1152
1279
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1153
|
-
const sourceObjectWithNewFileUrls = await
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1280
|
+
const sourceObjectWithNewFileUrls = await swapOutUniformFileUrlsForTargetProject(
|
|
1281
|
+
await extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1282
|
+
directory,
|
|
1283
|
+
fileClient
|
|
1284
|
+
}),
|
|
1285
|
+
{
|
|
1286
|
+
fileClient
|
|
1287
|
+
}
|
|
1288
|
+
);
|
|
1157
1289
|
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1158
1290
|
sourceObjectWithNewFileUrls.object,
|
|
1159
1291
|
{
|
|
@@ -1172,9 +1304,9 @@ var AssetRemoveModule = {
|
|
|
1172
1304
|
command: "remove <id>",
|
|
1173
1305
|
aliases: ["delete", "rm"],
|
|
1174
1306
|
describe: "Delete an asset",
|
|
1175
|
-
builder: (
|
|
1307
|
+
builder: (yargs28) => withConfiguration(
|
|
1176
1308
|
withApiOptions(
|
|
1177
|
-
withProjectOptions(
|
|
1309
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1178
1310
|
)
|
|
1179
1311
|
),
|
|
1180
1312
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1190,10 +1322,10 @@ var AssetUpdateModule = {
|
|
|
1190
1322
|
command: "update <filename>",
|
|
1191
1323
|
aliases: ["put"],
|
|
1192
1324
|
describe: "Insert or update an asset",
|
|
1193
|
-
builder: (
|
|
1325
|
+
builder: (yargs28) => withConfiguration(
|
|
1194
1326
|
withApiOptions(
|
|
1195
1327
|
withProjectOptions(
|
|
1196
|
-
|
|
1328
|
+
yargs28.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1197
1329
|
)
|
|
1198
1330
|
)
|
|
1199
1331
|
),
|
|
@@ -1209,7 +1341,7 @@ var AssetUpdateModule = {
|
|
|
1209
1341
|
var AssetModule = {
|
|
1210
1342
|
command: "asset <command>",
|
|
1211
1343
|
describe: "Commands for Assets",
|
|
1212
|
-
builder: (
|
|
1344
|
+
builder: (yargs28) => yargs28.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1213
1345
|
handler: () => {
|
|
1214
1346
|
yargs.help();
|
|
1215
1347
|
}
|
|
@@ -1223,11 +1355,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1223
1355
|
var CategoryGetModule = {
|
|
1224
1356
|
command: "get <id>",
|
|
1225
1357
|
describe: "Fetch a category",
|
|
1226
|
-
builder: (
|
|
1358
|
+
builder: (yargs28) => withConfiguration(
|
|
1227
1359
|
withFormatOptions(
|
|
1228
1360
|
withApiOptions(
|
|
1229
1361
|
withProjectOptions(
|
|
1230
|
-
|
|
1362
|
+
yargs28.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1231
1363
|
)
|
|
1232
1364
|
)
|
|
1233
1365
|
)
|
|
@@ -1252,7 +1384,7 @@ var CategoryListModule = {
|
|
|
1252
1384
|
command: "list",
|
|
1253
1385
|
describe: "List categories",
|
|
1254
1386
|
aliases: ["ls"],
|
|
1255
|
-
builder: (
|
|
1387
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28.options({}))))),
|
|
1256
1388
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1257
1389
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1258
1390
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1301,11 +1433,11 @@ function createCategoriesEngineDataSource({
|
|
|
1301
1433
|
var CategoryPullModule = {
|
|
1302
1434
|
command: "pull <directory>",
|
|
1303
1435
|
describe: "Pulls all categories to local files in a directory",
|
|
1304
|
-
builder: (
|
|
1436
|
+
builder: (yargs28) => withConfiguration(
|
|
1305
1437
|
withApiOptions(
|
|
1306
1438
|
withProjectOptions(
|
|
1307
1439
|
withDiffOptions(
|
|
1308
|
-
|
|
1440
|
+
yargs28.positional("directory", {
|
|
1309
1441
|
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
1442
|
type: "string"
|
|
1311
1443
|
}).option("format", {
|
|
@@ -1381,11 +1513,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1381
1513
|
var CategoryPushModule = {
|
|
1382
1514
|
command: "push <directory>",
|
|
1383
1515
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1384
|
-
builder: (
|
|
1516
|
+
builder: (yargs28) => withConfiguration(
|
|
1385
1517
|
withApiOptions(
|
|
1386
1518
|
withProjectOptions(
|
|
1387
1519
|
withDiffOptions(
|
|
1388
|
-
|
|
1520
|
+
yargs28.positional("directory", {
|
|
1389
1521
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1390
1522
|
type: "string"
|
|
1391
1523
|
}).option("what-if", {
|
|
@@ -1449,10 +1581,10 @@ var CategoryRemoveModule = {
|
|
|
1449
1581
|
command: "remove <id>",
|
|
1450
1582
|
aliases: ["delete", "rm"],
|
|
1451
1583
|
describe: "Delete a category",
|
|
1452
|
-
builder: (
|
|
1584
|
+
builder: (yargs28) => withConfiguration(
|
|
1453
1585
|
withApiOptions(
|
|
1454
1586
|
withProjectOptions(
|
|
1455
|
-
|
|
1587
|
+
yargs28.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1456
1588
|
)
|
|
1457
1589
|
)
|
|
1458
1590
|
),
|
|
@@ -1469,10 +1601,10 @@ var CategoryUpdateModule = {
|
|
|
1469
1601
|
command: "update <filename>",
|
|
1470
1602
|
aliases: ["put"],
|
|
1471
1603
|
describe: "Insert or update a category",
|
|
1472
|
-
builder: (
|
|
1604
|
+
builder: (yargs28) => withConfiguration(
|
|
1473
1605
|
withApiOptions(
|
|
1474
1606
|
withProjectOptions(
|
|
1475
|
-
|
|
1607
|
+
yargs28.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1476
1608
|
)
|
|
1477
1609
|
)
|
|
1478
1610
|
),
|
|
@@ -1489,7 +1621,7 @@ var CategoryModule = {
|
|
|
1489
1621
|
command: "category <command>",
|
|
1490
1622
|
aliases: ["cat"],
|
|
1491
1623
|
describe: "Commands for Canvas categories",
|
|
1492
|
-
builder: (
|
|
1624
|
+
builder: (yargs28) => yargs28.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1493
1625
|
handler: () => {
|
|
1494
1626
|
yargs2.help();
|
|
1495
1627
|
}
|
|
@@ -1510,11 +1642,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1510
1642
|
var ComponentGetModule = {
|
|
1511
1643
|
command: "get <id>",
|
|
1512
1644
|
describe: "Fetch a component definition",
|
|
1513
|
-
builder: (
|
|
1645
|
+
builder: (yargs28) => withConfiguration(
|
|
1514
1646
|
withFormatOptions(
|
|
1515
1647
|
withApiOptions(
|
|
1516
1648
|
withProjectOptions(
|
|
1517
|
-
|
|
1649
|
+
yargs28.positional("id", {
|
|
1518
1650
|
demandOption: true,
|
|
1519
1651
|
describe: "Component definition public ID to fetch"
|
|
1520
1652
|
})
|
|
@@ -1548,11 +1680,11 @@ var ComponentListModule = {
|
|
|
1548
1680
|
command: "list",
|
|
1549
1681
|
describe: "List component definitions",
|
|
1550
1682
|
aliases: ["ls"],
|
|
1551
|
-
builder: (
|
|
1683
|
+
builder: (yargs28) => withConfiguration(
|
|
1552
1684
|
withFormatOptions(
|
|
1553
1685
|
withApiOptions(
|
|
1554
1686
|
withProjectOptions(
|
|
1555
|
-
|
|
1687
|
+
yargs28.options({
|
|
1556
1688
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1557
1689
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1558
1690
|
})
|
|
@@ -1607,11 +1739,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1607
1739
|
var ComponentPullModule = {
|
|
1608
1740
|
command: "pull <directory>",
|
|
1609
1741
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1610
|
-
builder: (
|
|
1742
|
+
builder: (yargs28) => withConfiguration(
|
|
1611
1743
|
withApiOptions(
|
|
1612
1744
|
withProjectOptions(
|
|
1613
1745
|
withDiffOptions(
|
|
1614
|
-
|
|
1746
|
+
yargs28.positional("directory", {
|
|
1615
1747
|
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
1748
|
type: "string"
|
|
1617
1749
|
}).option("format", {
|
|
@@ -1688,11 +1820,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1688
1820
|
var ComponentPushModule = {
|
|
1689
1821
|
command: "push <directory>",
|
|
1690
1822
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1691
|
-
builder: (
|
|
1823
|
+
builder: (yargs28) => withConfiguration(
|
|
1692
1824
|
withApiOptions(
|
|
1693
1825
|
withProjectOptions(
|
|
1694
1826
|
withDiffOptions(
|
|
1695
|
-
|
|
1827
|
+
yargs28.positional("directory", {
|
|
1696
1828
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1697
1829
|
type: "string"
|
|
1698
1830
|
}).option("what-if", {
|
|
@@ -1757,10 +1889,10 @@ var ComponentRemoveModule = {
|
|
|
1757
1889
|
command: "remove <id>",
|
|
1758
1890
|
aliases: ["delete", "rm"],
|
|
1759
1891
|
describe: "Delete a component definition",
|
|
1760
|
-
builder: (
|
|
1892
|
+
builder: (yargs28) => withConfiguration(
|
|
1761
1893
|
withApiOptions(
|
|
1762
1894
|
withProjectOptions(
|
|
1763
|
-
|
|
1895
|
+
yargs28.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1764
1896
|
)
|
|
1765
1897
|
)
|
|
1766
1898
|
),
|
|
@@ -1777,10 +1909,10 @@ var ComponentUpdateModule = {
|
|
|
1777
1909
|
command: "update <filename>",
|
|
1778
1910
|
aliases: ["put"],
|
|
1779
1911
|
describe: "Insert or update a component definition",
|
|
1780
|
-
builder: (
|
|
1912
|
+
builder: (yargs28) => withConfiguration(
|
|
1781
1913
|
withApiOptions(
|
|
1782
1914
|
withProjectOptions(
|
|
1783
|
-
|
|
1915
|
+
yargs28.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1784
1916
|
)
|
|
1785
1917
|
)
|
|
1786
1918
|
),
|
|
@@ -1797,7 +1929,7 @@ var ComponentModule = {
|
|
|
1797
1929
|
command: "component <command>",
|
|
1798
1930
|
aliases: ["def"],
|
|
1799
1931
|
describe: "Commands for Canvas component definitions",
|
|
1800
|
-
builder: (
|
|
1932
|
+
builder: (yargs28) => yargs28.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1801
1933
|
handler: () => {
|
|
1802
1934
|
yargs3.help();
|
|
1803
1935
|
}
|
|
@@ -1811,12 +1943,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1811
1943
|
var CompositionGetModule = {
|
|
1812
1944
|
command: "get <id>",
|
|
1813
1945
|
describe: "Fetch a composition",
|
|
1814
|
-
builder: (
|
|
1946
|
+
builder: (yargs28) => withFormatOptions(
|
|
1815
1947
|
withConfiguration(
|
|
1816
1948
|
withApiOptions(
|
|
1817
1949
|
withProjectOptions(
|
|
1818
1950
|
withStateOptions(
|
|
1819
|
-
|
|
1951
|
+
yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1820
1952
|
resolvePatterns: {
|
|
1821
1953
|
type: "boolean",
|
|
1822
1954
|
default: false,
|
|
@@ -1887,12 +2019,12 @@ var CompositionListModule = {
|
|
|
1887
2019
|
command: "list",
|
|
1888
2020
|
describe: "List compositions",
|
|
1889
2021
|
aliases: ["ls"],
|
|
1890
|
-
builder: (
|
|
2022
|
+
builder: (yargs28) => withFormatOptions(
|
|
1891
2023
|
withConfiguration(
|
|
1892
2024
|
withApiOptions(
|
|
1893
2025
|
withProjectOptions(
|
|
1894
2026
|
withStateOptions(
|
|
1895
|
-
|
|
2027
|
+
yargs28.options({
|
|
1896
2028
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1897
2029
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1898
2030
|
resolvePatterns: {
|
|
@@ -2013,11 +2145,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2013
2145
|
var CompositionPublishModule = {
|
|
2014
2146
|
command: "publish [ids]",
|
|
2015
2147
|
describe: "Publishes composition(s)",
|
|
2016
|
-
builder: (
|
|
2148
|
+
builder: (yargs28) => withConfiguration(
|
|
2017
2149
|
withApiOptions(
|
|
2018
2150
|
withProjectOptions(
|
|
2019
2151
|
withDiffOptions(
|
|
2020
|
-
|
|
2152
|
+
yargs28.positional("ids", {
|
|
2021
2153
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2022
2154
|
type: "string"
|
|
2023
2155
|
}).option("all", {
|
|
@@ -2089,15 +2221,16 @@ var CompositionPublishModule = {
|
|
|
2089
2221
|
|
|
2090
2222
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2091
2223
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
2224
|
+
import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
2092
2225
|
var CompositionPullModule = {
|
|
2093
2226
|
command: "pull <directory>",
|
|
2094
2227
|
describe: "Pulls all compositions to local files in a directory",
|
|
2095
|
-
builder: (
|
|
2228
|
+
builder: (yargs28) => withConfiguration(
|
|
2096
2229
|
withApiOptions(
|
|
2097
2230
|
withProjectOptions(
|
|
2098
2231
|
withStateOptions(
|
|
2099
2232
|
withDiffOptions(
|
|
2100
|
-
|
|
2233
|
+
yargs28.positional("directory", {
|
|
2101
2234
|
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
2235
|
type: "string"
|
|
2103
2236
|
}).option("format", {
|
|
@@ -2148,6 +2281,7 @@ var CompositionPullModule = {
|
|
|
2148
2281
|
}) => {
|
|
2149
2282
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2150
2283
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2284
|
+
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2151
2285
|
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2152
2286
|
const isPackage = isPathAPackageFile(directory);
|
|
2153
2287
|
let target;
|
|
@@ -2177,9 +2311,16 @@ var CompositionPullModule = {
|
|
|
2177
2311
|
whatIf,
|
|
2178
2312
|
allowEmptySource: true,
|
|
2179
2313
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2314
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
2315
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
2316
|
+
directory,
|
|
2317
|
+
fileClient
|
|
2318
|
+
});
|
|
2319
|
+
},
|
|
2180
2320
|
onBeforeWriteObject: async (sourceObject) => {
|
|
2181
2321
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
2182
|
-
directory
|
|
2322
|
+
directory,
|
|
2323
|
+
fileClient
|
|
2183
2324
|
});
|
|
2184
2325
|
}
|
|
2185
2326
|
});
|
|
@@ -2188,16 +2329,16 @@ var CompositionPullModule = {
|
|
|
2188
2329
|
|
|
2189
2330
|
// src/commands/canvas/commands/composition/push.ts
|
|
2190
2331
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2191
|
-
import { UncachedFileClient as
|
|
2332
|
+
import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
2192
2333
|
var CompositionPushModule = {
|
|
2193
2334
|
command: "push <directory>",
|
|
2194
2335
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2195
|
-
builder: (
|
|
2336
|
+
builder: (yargs28) => withConfiguration(
|
|
2196
2337
|
withApiOptions(
|
|
2197
2338
|
withProjectOptions(
|
|
2198
2339
|
withStateOptions(
|
|
2199
2340
|
withDiffOptions(
|
|
2200
|
-
|
|
2341
|
+
yargs28.positional("directory", {
|
|
2201
2342
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2202
2343
|
type: "string"
|
|
2203
2344
|
}).option("what-if", {
|
|
@@ -2258,7 +2399,7 @@ var CompositionPushModule = {
|
|
|
2258
2399
|
});
|
|
2259
2400
|
}
|
|
2260
2401
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2261
|
-
const fileClient = new
|
|
2402
|
+
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2262
2403
|
await syncEngine({
|
|
2263
2404
|
source,
|
|
2264
2405
|
target,
|
|
@@ -2286,10 +2427,10 @@ var CompositionRemoveModule = {
|
|
|
2286
2427
|
command: "remove <id>",
|
|
2287
2428
|
aliases: ["delete", "rm"],
|
|
2288
2429
|
describe: "Delete a composition",
|
|
2289
|
-
builder: (
|
|
2430
|
+
builder: (yargs28) => withConfiguration(
|
|
2290
2431
|
withApiOptions(
|
|
2291
2432
|
withProjectOptions(
|
|
2292
|
-
|
|
2433
|
+
yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2293
2434
|
)
|
|
2294
2435
|
)
|
|
2295
2436
|
),
|
|
@@ -2306,10 +2447,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2306
2447
|
var CompositionUnpublishModule = {
|
|
2307
2448
|
command: "unpublish [ids]",
|
|
2308
2449
|
describe: "Unpublish a composition(s)",
|
|
2309
|
-
builder: (
|
|
2450
|
+
builder: (yargs28) => withConfiguration(
|
|
2310
2451
|
withApiOptions(
|
|
2311
2452
|
withProjectOptions(
|
|
2312
|
-
|
|
2453
|
+
yargs28.positional("ids", {
|
|
2313
2454
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2314
2455
|
type: "string"
|
|
2315
2456
|
}).option("all", {
|
|
@@ -2403,11 +2544,11 @@ var CompositionUpdateModule = {
|
|
|
2403
2544
|
command: "update <filename>",
|
|
2404
2545
|
aliases: ["put"],
|
|
2405
2546
|
describe: "Insert or update a composition",
|
|
2406
|
-
builder: (
|
|
2547
|
+
builder: (yargs28) => withConfiguration(
|
|
2407
2548
|
withApiOptions(
|
|
2408
2549
|
withProjectOptions(
|
|
2409
2550
|
withStateOptions(
|
|
2410
|
-
|
|
2551
|
+
yargs28.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2411
2552
|
)
|
|
2412
2553
|
)
|
|
2413
2554
|
)
|
|
@@ -2425,7 +2566,7 @@ var CompositionModule = {
|
|
|
2425
2566
|
command: "composition <command>",
|
|
2426
2567
|
describe: "Commands for Canvas compositions",
|
|
2427
2568
|
aliases: ["comp"],
|
|
2428
|
-
builder: (
|
|
2569
|
+
builder: (yargs28) => yargs28.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2429
2570
|
handler: () => {
|
|
2430
2571
|
yargs4.help();
|
|
2431
2572
|
}
|
|
@@ -2439,12 +2580,12 @@ import { ContentClient } from "@uniformdev/canvas";
|
|
|
2439
2580
|
var ContentTypeGetModule = {
|
|
2440
2581
|
command: "get <id>",
|
|
2441
2582
|
describe: "Get a content type",
|
|
2442
|
-
builder: (
|
|
2583
|
+
builder: (yargs28) => withConfiguration(
|
|
2443
2584
|
withFormatOptions(
|
|
2444
2585
|
withApiOptions(
|
|
2445
2586
|
withProjectOptions(
|
|
2446
2587
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2447
|
-
|
|
2588
|
+
yargs28.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2448
2589
|
)
|
|
2449
2590
|
)
|
|
2450
2591
|
)
|
|
@@ -2466,7 +2607,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2466
2607
|
var ContentTypeListModule = {
|
|
2467
2608
|
command: "list",
|
|
2468
2609
|
describe: "List content types",
|
|
2469
|
-
builder: (
|
|
2610
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
2470
2611
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2471
2612
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2472
2613
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2513,11 +2654,11 @@ function createContentTypeEngineDataSource({
|
|
|
2513
2654
|
var ContentTypePullModule = {
|
|
2514
2655
|
command: "pull <directory>",
|
|
2515
2656
|
describe: "Pulls all content types to local files in a directory",
|
|
2516
|
-
builder: (
|
|
2657
|
+
builder: (yargs28) => withConfiguration(
|
|
2517
2658
|
withApiOptions(
|
|
2518
2659
|
withProjectOptions(
|
|
2519
2660
|
withDiffOptions(
|
|
2520
|
-
|
|
2661
|
+
yargs28.positional("directory", {
|
|
2521
2662
|
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
2663
|
type: "string"
|
|
2523
2664
|
}).option("format", {
|
|
@@ -2599,11 +2740,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2599
2740
|
var ContentTypePushModule = {
|
|
2600
2741
|
command: "push <directory>",
|
|
2601
2742
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2602
|
-
builder: (
|
|
2743
|
+
builder: (yargs28) => withConfiguration(
|
|
2603
2744
|
withApiOptions(
|
|
2604
2745
|
withProjectOptions(
|
|
2605
2746
|
withDiffOptions(
|
|
2606
|
-
|
|
2747
|
+
yargs28.positional("directory", {
|
|
2607
2748
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2608
2749
|
type: "string"
|
|
2609
2750
|
}).option("what-if", {
|
|
@@ -2673,10 +2814,10 @@ var ContentTypeRemoveModule = {
|
|
|
2673
2814
|
command: "remove <id>",
|
|
2674
2815
|
aliases: ["delete", "rm"],
|
|
2675
2816
|
describe: "Delete a content type",
|
|
2676
|
-
builder: (
|
|
2817
|
+
builder: (yargs28) => withConfiguration(
|
|
2677
2818
|
withApiOptions(
|
|
2678
2819
|
withProjectOptions(
|
|
2679
|
-
|
|
2820
|
+
yargs28.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2680
2821
|
)
|
|
2681
2822
|
)
|
|
2682
2823
|
),
|
|
@@ -2693,10 +2834,10 @@ var ContentTypeUpdateModule = {
|
|
|
2693
2834
|
command: "update <filename>",
|
|
2694
2835
|
aliases: ["put"],
|
|
2695
2836
|
describe: "Insert or update a content type",
|
|
2696
|
-
builder: (
|
|
2837
|
+
builder: (yargs28) => withConfiguration(
|
|
2697
2838
|
withApiOptions(
|
|
2698
2839
|
withProjectOptions(
|
|
2699
|
-
|
|
2840
|
+
yargs28.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2700
2841
|
)
|
|
2701
2842
|
)
|
|
2702
2843
|
),
|
|
@@ -2713,7 +2854,7 @@ var ContentTypeModule = {
|
|
|
2713
2854
|
command: "contenttype <command>",
|
|
2714
2855
|
aliases: ["ct"],
|
|
2715
2856
|
describe: "Commands for Content Types",
|
|
2716
|
-
builder: (
|
|
2857
|
+
builder: (yargs28) => yargs28.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2717
2858
|
handler: () => {
|
|
2718
2859
|
yargs5.help();
|
|
2719
2860
|
}
|
|
@@ -2728,12 +2869,12 @@ var DataTypeGetModule = {
|
|
|
2728
2869
|
command: "get <id>",
|
|
2729
2870
|
describe: "Get a data type",
|
|
2730
2871
|
aliases: ["ls"],
|
|
2731
|
-
builder: (
|
|
2872
|
+
builder: (yargs28) => withConfiguration(
|
|
2732
2873
|
withFormatOptions(
|
|
2733
2874
|
withApiOptions(
|
|
2734
2875
|
withProjectOptions(
|
|
2735
2876
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2736
|
-
|
|
2877
|
+
yargs28.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2737
2878
|
)
|
|
2738
2879
|
)
|
|
2739
2880
|
)
|
|
@@ -2756,7 +2897,7 @@ var DataTypeListModule = {
|
|
|
2756
2897
|
command: "list",
|
|
2757
2898
|
describe: "List data types",
|
|
2758
2899
|
aliases: ["ls"],
|
|
2759
|
-
builder: (
|
|
2900
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
2760
2901
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2761
2902
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2762
2903
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2805,11 +2946,11 @@ function createDataTypeEngineDataSource({
|
|
|
2805
2946
|
var DataTypePullModule = {
|
|
2806
2947
|
command: "pull <directory>",
|
|
2807
2948
|
describe: "Pulls all data types to local files in a directory",
|
|
2808
|
-
builder: (
|
|
2949
|
+
builder: (yargs28) => withConfiguration(
|
|
2809
2950
|
withApiOptions(
|
|
2810
2951
|
withProjectOptions(
|
|
2811
2952
|
withDiffOptions(
|
|
2812
|
-
|
|
2953
|
+
yargs28.positional("directory", {
|
|
2813
2954
|
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
2955
|
type: "string"
|
|
2815
2956
|
}).option("format", {
|
|
@@ -2891,11 +3032,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
2891
3032
|
var DataTypePushModule = {
|
|
2892
3033
|
command: "push <directory>",
|
|
2893
3034
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2894
|
-
builder: (
|
|
3035
|
+
builder: (yargs28) => withConfiguration(
|
|
2895
3036
|
withApiOptions(
|
|
2896
3037
|
withProjectOptions(
|
|
2897
3038
|
withDiffOptions(
|
|
2898
|
-
|
|
3039
|
+
yargs28.positional("directory", {
|
|
2899
3040
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2900
3041
|
type: "string"
|
|
2901
3042
|
}).option("what-if", {
|
|
@@ -2965,10 +3106,10 @@ var DataTypeRemoveModule = {
|
|
|
2965
3106
|
command: "remove <id>",
|
|
2966
3107
|
aliases: ["delete", "rm"],
|
|
2967
3108
|
describe: "Delete a data type",
|
|
2968
|
-
builder: (
|
|
3109
|
+
builder: (yargs28) => withConfiguration(
|
|
2969
3110
|
withApiOptions(
|
|
2970
3111
|
withProjectOptions(
|
|
2971
|
-
|
|
3112
|
+
yargs28.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2972
3113
|
)
|
|
2973
3114
|
)
|
|
2974
3115
|
),
|
|
@@ -2985,10 +3126,10 @@ var DataTypeUpdateModule = {
|
|
|
2985
3126
|
command: "update <filename>",
|
|
2986
3127
|
aliases: ["put"],
|
|
2987
3128
|
describe: "Insert or update a data type",
|
|
2988
|
-
builder: (
|
|
3129
|
+
builder: (yargs28) => withConfiguration(
|
|
2989
3130
|
withApiOptions(
|
|
2990
3131
|
withProjectOptions(
|
|
2991
|
-
|
|
3132
|
+
yargs28.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2992
3133
|
)
|
|
2993
3134
|
)
|
|
2994
3135
|
),
|
|
@@ -3005,7 +3146,7 @@ var DataTypeModule = {
|
|
|
3005
3146
|
command: "datatype <command>",
|
|
3006
3147
|
aliases: ["dt"],
|
|
3007
3148
|
describe: "Commands for Data Type definitions",
|
|
3008
|
-
builder: (
|
|
3149
|
+
builder: (yargs28) => yargs28.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3009
3150
|
handler: () => {
|
|
3010
3151
|
yargs6.help();
|
|
3011
3152
|
}
|
|
@@ -3019,12 +3160,12 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
|
3019
3160
|
var EntryGetModule = {
|
|
3020
3161
|
command: "get <id>",
|
|
3021
3162
|
describe: "Get an entry",
|
|
3022
|
-
builder: (
|
|
3163
|
+
builder: (yargs28) => withConfiguration(
|
|
3023
3164
|
withFormatOptions(
|
|
3024
3165
|
withApiOptions(
|
|
3025
3166
|
withProjectOptions(
|
|
3026
3167
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3027
|
-
|
|
3168
|
+
yargs28.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
3028
3169
|
)
|
|
3029
3170
|
)
|
|
3030
3171
|
)
|
|
@@ -3050,7 +3191,7 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
|
3050
3191
|
var EntryListModule = {
|
|
3051
3192
|
command: "list",
|
|
3052
3193
|
describe: "List entries",
|
|
3053
|
-
builder: (
|
|
3194
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3054
3195
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3055
3196
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3056
3197
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3061,6 +3202,7 @@ var EntryListModule = {
|
|
|
3061
3202
|
|
|
3062
3203
|
// src/commands/canvas/commands/entry/pull.ts
|
|
3063
3204
|
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3205
|
+
import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
3064
3206
|
|
|
3065
3207
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3066
3208
|
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
@@ -3109,12 +3251,12 @@ function createEntryEngineDataSource({
|
|
|
3109
3251
|
var EntryPullModule = {
|
|
3110
3252
|
command: "pull <directory>",
|
|
3111
3253
|
describe: "Pulls all entries to local files in a directory",
|
|
3112
|
-
builder: (
|
|
3254
|
+
builder: (yargs28) => withConfiguration(
|
|
3113
3255
|
withApiOptions(
|
|
3114
3256
|
withProjectOptions(
|
|
3115
3257
|
withStateOptions(
|
|
3116
3258
|
withDiffOptions(
|
|
3117
|
-
|
|
3259
|
+
yargs28.positional("directory", {
|
|
3118
3260
|
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
3261
|
type: "string"
|
|
3120
3262
|
}).option("format", {
|
|
@@ -3160,6 +3302,7 @@ var EntryPullModule = {
|
|
|
3160
3302
|
projectId,
|
|
3161
3303
|
bypassCache: true
|
|
3162
3304
|
});
|
|
3305
|
+
const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3163
3306
|
const source = createEntryEngineDataSource({ client, state });
|
|
3164
3307
|
let target;
|
|
3165
3308
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3188,22 +3331,35 @@ var EntryPullModule = {
|
|
|
3188
3331
|
mode,
|
|
3189
3332
|
whatIf,
|
|
3190
3333
|
allowEmptySource: true,
|
|
3191
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3334
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3335
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
3336
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
3337
|
+
directory,
|
|
3338
|
+
fileClient
|
|
3339
|
+
});
|
|
3340
|
+
},
|
|
3341
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3342
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
3343
|
+
directory,
|
|
3344
|
+
fileClient
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3192
3347
|
});
|
|
3193
3348
|
}
|
|
3194
3349
|
};
|
|
3195
3350
|
|
|
3196
3351
|
// src/commands/canvas/commands/entry/push.ts
|
|
3197
3352
|
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
3353
|
+
import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
3198
3354
|
var EntryPushModule = {
|
|
3199
3355
|
command: "push <directory>",
|
|
3200
3356
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3201
|
-
builder: (
|
|
3357
|
+
builder: (yargs28) => withConfiguration(
|
|
3202
3358
|
withApiOptions(
|
|
3203
3359
|
withProjectOptions(
|
|
3204
3360
|
withStateOptions(
|
|
3205
3361
|
withDiffOptions(
|
|
3206
|
-
|
|
3362
|
+
yargs28.positional("directory", {
|
|
3207
3363
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3208
3364
|
type: "string"
|
|
3209
3365
|
}).option("what-if", {
|
|
@@ -3259,12 +3415,24 @@ var EntryPushModule = {
|
|
|
3259
3415
|
});
|
|
3260
3416
|
}
|
|
3261
3417
|
const target = createEntryEngineDataSource({ client, state });
|
|
3418
|
+
const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3262
3419
|
await syncEngine({
|
|
3263
3420
|
source,
|
|
3264
3421
|
target,
|
|
3265
3422
|
mode,
|
|
3266
3423
|
whatIf,
|
|
3267
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3424
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3425
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
3426
|
+
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
3427
|
+
fileClient
|
|
3428
|
+
});
|
|
3429
|
+
},
|
|
3430
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3431
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
3432
|
+
directory,
|
|
3433
|
+
fileClient
|
|
3434
|
+
});
|
|
3435
|
+
}
|
|
3268
3436
|
});
|
|
3269
3437
|
}
|
|
3270
3438
|
};
|
|
@@ -3275,10 +3443,10 @@ var EntryRemoveModule = {
|
|
|
3275
3443
|
command: "remove <id>",
|
|
3276
3444
|
aliases: ["delete", "rm"],
|
|
3277
3445
|
describe: "Delete an entry",
|
|
3278
|
-
builder: (
|
|
3446
|
+
builder: (yargs28) => withConfiguration(
|
|
3279
3447
|
withApiOptions(
|
|
3280
3448
|
withProjectOptions(
|
|
3281
|
-
|
|
3449
|
+
yargs28.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3282
3450
|
)
|
|
3283
3451
|
)
|
|
3284
3452
|
),
|
|
@@ -3295,10 +3463,10 @@ var EntryUpdateModule = {
|
|
|
3295
3463
|
command: "update <filename>",
|
|
3296
3464
|
aliases: ["put"],
|
|
3297
3465
|
describe: "Insert or update an entry",
|
|
3298
|
-
builder: (
|
|
3466
|
+
builder: (yargs28) => withConfiguration(
|
|
3299
3467
|
withApiOptions(
|
|
3300
3468
|
withProjectOptions(
|
|
3301
|
-
|
|
3469
|
+
yargs28.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
3302
3470
|
)
|
|
3303
3471
|
)
|
|
3304
3472
|
),
|
|
@@ -3314,15 +3482,218 @@ var EntryUpdateModule = {
|
|
|
3314
3482
|
var EntryModule = {
|
|
3315
3483
|
command: "entry <command>",
|
|
3316
3484
|
describe: "Commands for Entries",
|
|
3317
|
-
builder: (
|
|
3485
|
+
builder: (yargs28) => yargs28.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
3318
3486
|
handler: () => {
|
|
3319
3487
|
yargs7.help();
|
|
3320
3488
|
}
|
|
3321
3489
|
};
|
|
3322
3490
|
|
|
3323
|
-
// src/commands/canvas/commands/
|
|
3491
|
+
// src/commands/canvas/commands/locale.ts
|
|
3324
3492
|
import yargs8 from "yargs";
|
|
3325
3493
|
|
|
3494
|
+
// src/commands/canvas/commands/locale/pull.ts
|
|
3495
|
+
import { LocaleClient } from "@uniformdev/canvas";
|
|
3496
|
+
|
|
3497
|
+
// src/commands/canvas/localesEngineDataSource.ts
|
|
3498
|
+
function createLocaleEngineDataSource({
|
|
3499
|
+
client
|
|
3500
|
+
}) {
|
|
3501
|
+
async function* getObjects() {
|
|
3502
|
+
const locales = (await client.get()).results;
|
|
3503
|
+
for await (const locale of locales) {
|
|
3504
|
+
const result = {
|
|
3505
|
+
id: locale.locale,
|
|
3506
|
+
displayName: locale.displayName,
|
|
3507
|
+
providerId: locale.locale,
|
|
3508
|
+
object: locale
|
|
3509
|
+
};
|
|
3510
|
+
yield result;
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
return {
|
|
3514
|
+
objects: getObjects(),
|
|
3515
|
+
deleteObject: async (providerId) => {
|
|
3516
|
+
await client.remove({ locale: providerId });
|
|
3517
|
+
},
|
|
3518
|
+
writeObject: async (object) => {
|
|
3519
|
+
await client.upsert({
|
|
3520
|
+
locale: object.object
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
// src/commands/canvas/commands/locale/pull.ts
|
|
3527
|
+
var LocalePullModule = {
|
|
3528
|
+
command: "pull <directory>",
|
|
3529
|
+
describe: "Pulls all locales to local files in a directory",
|
|
3530
|
+
builder: (yargs28) => withConfiguration(
|
|
3531
|
+
withApiOptions(
|
|
3532
|
+
withProjectOptions(
|
|
3533
|
+
withDiffOptions(
|
|
3534
|
+
yargs28.positional("directory", {
|
|
3535
|
+
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.",
|
|
3536
|
+
type: "string"
|
|
3537
|
+
}).option("format", {
|
|
3538
|
+
alias: ["f"],
|
|
3539
|
+
describe: "Output format",
|
|
3540
|
+
default: "yaml",
|
|
3541
|
+
choices: ["yaml", "json"],
|
|
3542
|
+
type: "string"
|
|
3543
|
+
}).option("what-if", {
|
|
3544
|
+
alias: ["w"],
|
|
3545
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3546
|
+
default: false,
|
|
3547
|
+
type: "boolean"
|
|
3548
|
+
}).option("mode", {
|
|
3549
|
+
alias: ["m"],
|
|
3550
|
+
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',
|
|
3551
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3552
|
+
default: "mirror",
|
|
3553
|
+
type: "string"
|
|
3554
|
+
})
|
|
3555
|
+
)
|
|
3556
|
+
)
|
|
3557
|
+
)
|
|
3558
|
+
),
|
|
3559
|
+
handler: async ({
|
|
3560
|
+
apiHost,
|
|
3561
|
+
apiKey,
|
|
3562
|
+
proxy,
|
|
3563
|
+
directory,
|
|
3564
|
+
format,
|
|
3565
|
+
mode,
|
|
3566
|
+
whatIf,
|
|
3567
|
+
project: projectId,
|
|
3568
|
+
diff: diffMode
|
|
3569
|
+
}) => {
|
|
3570
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
3571
|
+
const client = new LocaleClient({
|
|
3572
|
+
apiKey,
|
|
3573
|
+
apiHost,
|
|
3574
|
+
fetch: fetch3,
|
|
3575
|
+
projectId,
|
|
3576
|
+
bypassCache: true
|
|
3577
|
+
});
|
|
3578
|
+
const source = createLocaleEngineDataSource({ client });
|
|
3579
|
+
let target;
|
|
3580
|
+
const isPackage = isPathAPackageFile(directory);
|
|
3581
|
+
if (isPackage) {
|
|
3582
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
3583
|
+
target = await createArraySyncEngineDataSource({
|
|
3584
|
+
objects: packageContents.locales ?? [],
|
|
3585
|
+
selectIdentifier: (i) => i.locale,
|
|
3586
|
+
selectDisplayName: (i) => i.displayName,
|
|
3587
|
+
onSyncComplete: async (_, synced) => {
|
|
3588
|
+
packageContents.locales = synced;
|
|
3589
|
+
writeCanvasPackage(directory, packageContents);
|
|
3590
|
+
}
|
|
3591
|
+
});
|
|
3592
|
+
} else {
|
|
3593
|
+
target = await createFileSyncEngineDataSource({
|
|
3594
|
+
directory,
|
|
3595
|
+
selectIdentifier: (i) => i.locale,
|
|
3596
|
+
selectDisplayName: (i) => i.displayName,
|
|
3597
|
+
format
|
|
3598
|
+
});
|
|
3599
|
+
}
|
|
3600
|
+
await syncEngine({
|
|
3601
|
+
source,
|
|
3602
|
+
target,
|
|
3603
|
+
mode,
|
|
3604
|
+
whatIf,
|
|
3605
|
+
allowEmptySource: true,
|
|
3606
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3607
|
+
});
|
|
3608
|
+
}
|
|
3609
|
+
};
|
|
3610
|
+
|
|
3611
|
+
// src/commands/canvas/commands/locale/push.ts
|
|
3612
|
+
import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
3613
|
+
var LocalePushModule = {
|
|
3614
|
+
command: "push <directory>",
|
|
3615
|
+
describe: "Pushes all locales from files in a directory to Uniform",
|
|
3616
|
+
builder: (yargs28) => withConfiguration(
|
|
3617
|
+
withApiOptions(
|
|
3618
|
+
withProjectOptions(
|
|
3619
|
+
withDiffOptions(
|
|
3620
|
+
yargs28.positional("directory", {
|
|
3621
|
+
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
3622
|
+
type: "string"
|
|
3623
|
+
}).option("what-if", {
|
|
3624
|
+
alias: ["w"],
|
|
3625
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3626
|
+
default: false,
|
|
3627
|
+
type: "boolean"
|
|
3628
|
+
}).option("mode", {
|
|
3629
|
+
alias: ["m"],
|
|
3630
|
+
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',
|
|
3631
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3632
|
+
default: "mirror",
|
|
3633
|
+
type: "string"
|
|
3634
|
+
})
|
|
3635
|
+
)
|
|
3636
|
+
)
|
|
3637
|
+
)
|
|
3638
|
+
),
|
|
3639
|
+
handler: async ({
|
|
3640
|
+
apiHost,
|
|
3641
|
+
apiKey,
|
|
3642
|
+
proxy,
|
|
3643
|
+
directory,
|
|
3644
|
+
mode,
|
|
3645
|
+
whatIf,
|
|
3646
|
+
project: projectId,
|
|
3647
|
+
diff: diffMode
|
|
3648
|
+
}) => {
|
|
3649
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
3650
|
+
const client = new LocaleClient2({
|
|
3651
|
+
apiKey,
|
|
3652
|
+
apiHost,
|
|
3653
|
+
fetch: fetch3,
|
|
3654
|
+
projectId,
|
|
3655
|
+
bypassCache: true
|
|
3656
|
+
});
|
|
3657
|
+
let source;
|
|
3658
|
+
const isPackage = isPathAPackageFile(directory);
|
|
3659
|
+
if (isPackage) {
|
|
3660
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
3661
|
+
source = await createArraySyncEngineDataSource({
|
|
3662
|
+
objects: packageContents.locales ?? [],
|
|
3663
|
+
selectIdentifier: (locale) => locale.locale,
|
|
3664
|
+
selectDisplayName: (locale) => locale.displayName
|
|
3665
|
+
});
|
|
3666
|
+
} else {
|
|
3667
|
+
source = await createFileSyncEngineDataSource({
|
|
3668
|
+
directory,
|
|
3669
|
+
selectIdentifier: (locale) => locale.locale,
|
|
3670
|
+
selectDisplayName: (locale) => locale.displayName
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
const target = createLocaleEngineDataSource({ client });
|
|
3674
|
+
await syncEngine({
|
|
3675
|
+
source,
|
|
3676
|
+
target,
|
|
3677
|
+
mode,
|
|
3678
|
+
whatIf,
|
|
3679
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3680
|
+
});
|
|
3681
|
+
}
|
|
3682
|
+
};
|
|
3683
|
+
|
|
3684
|
+
// src/commands/canvas/commands/locale.ts
|
|
3685
|
+
var LocaleModule = {
|
|
3686
|
+
command: "locale <command>",
|
|
3687
|
+
describe: "Commands for locale definitions",
|
|
3688
|
+
builder: (yargs28) => yargs28.command(LocalePullModule).command(LocalePushModule),
|
|
3689
|
+
handler: () => {
|
|
3690
|
+
yargs8.help();
|
|
3691
|
+
}
|
|
3692
|
+
};
|
|
3693
|
+
|
|
3694
|
+
// src/commands/canvas/commands/pattern.ts
|
|
3695
|
+
import yargs9 from "yargs";
|
|
3696
|
+
|
|
3326
3697
|
// src/commands/canvas/commands/pattern/get.ts
|
|
3327
3698
|
var PatternGetModule = {
|
|
3328
3699
|
...CompositionGetModule,
|
|
@@ -3333,12 +3704,12 @@ var PatternGetModule = {
|
|
|
3333
3704
|
var PatternListModule = {
|
|
3334
3705
|
...CompositionListModule,
|
|
3335
3706
|
describe: "List patterns",
|
|
3336
|
-
builder: (
|
|
3707
|
+
builder: (yargs28) => withFormatOptions(
|
|
3337
3708
|
withConfiguration(
|
|
3338
3709
|
withApiOptions(
|
|
3339
3710
|
withProjectOptions(
|
|
3340
3711
|
withStateOptions(
|
|
3341
|
-
|
|
3712
|
+
yargs28.options({
|
|
3342
3713
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3343
3714
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
3344
3715
|
resolvePatterns: {
|
|
@@ -3376,11 +3747,11 @@ var PatternListModule = {
|
|
|
3376
3747
|
var PatternPublishModule = {
|
|
3377
3748
|
...CompositionPublishModule,
|
|
3378
3749
|
describe: "Publishes pattern(s)",
|
|
3379
|
-
builder: (
|
|
3750
|
+
builder: (yargs28) => withConfiguration(
|
|
3380
3751
|
withApiOptions(
|
|
3381
3752
|
withProjectOptions(
|
|
3382
3753
|
withDiffOptions(
|
|
3383
|
-
|
|
3754
|
+
yargs28.positional("ids", {
|
|
3384
3755
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3385
3756
|
type: "string"
|
|
3386
3757
|
}).option("all", {
|
|
@@ -3418,12 +3789,12 @@ var PatternPublishModule = {
|
|
|
3418
3789
|
var PatternPullModule = {
|
|
3419
3790
|
...CompositionPullModule,
|
|
3420
3791
|
describe: "Pulls all patterns to local files in a directory",
|
|
3421
|
-
builder: (
|
|
3792
|
+
builder: (yargs28) => withConfiguration(
|
|
3422
3793
|
withApiOptions(
|
|
3423
3794
|
withProjectOptions(
|
|
3424
3795
|
withStateOptions(
|
|
3425
3796
|
withDiffOptions(
|
|
3426
|
-
|
|
3797
|
+
yargs28.positional("directory", {
|
|
3427
3798
|
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
3799
|
type: "string"
|
|
3429
3800
|
}).option("format", {
|
|
@@ -3461,12 +3832,12 @@ var PatternPullModule = {
|
|
|
3461
3832
|
var PatternPushModule = {
|
|
3462
3833
|
...CompositionPushModule,
|
|
3463
3834
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
3464
|
-
builder: (
|
|
3835
|
+
builder: (yargs28) => withConfiguration(
|
|
3465
3836
|
withApiOptions(
|
|
3466
3837
|
withProjectOptions(
|
|
3467
3838
|
withStateOptions(
|
|
3468
3839
|
withDiffOptions(
|
|
3469
|
-
|
|
3840
|
+
yargs28.positional("directory", {
|
|
3470
3841
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
3471
3842
|
type: "string"
|
|
3472
3843
|
}).option("what-if", {
|
|
@@ -3504,10 +3875,10 @@ var PatternRemoveModule = {
|
|
|
3504
3875
|
var PatternUnpublishModule = {
|
|
3505
3876
|
command: "unpublish [ids]",
|
|
3506
3877
|
describe: "Unpublish a pattern(s)",
|
|
3507
|
-
builder: (
|
|
3878
|
+
builder: (yargs28) => withConfiguration(
|
|
3508
3879
|
withApiOptions(
|
|
3509
3880
|
withProjectOptions(
|
|
3510
|
-
|
|
3881
|
+
yargs28.positional("ids", {
|
|
3511
3882
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3512
3883
|
type: "string"
|
|
3513
3884
|
}).option("all", {
|
|
@@ -3546,26 +3917,26 @@ var PatternUpdateModule = {
|
|
|
3546
3917
|
var PatternModule = {
|
|
3547
3918
|
command: "pattern <command>",
|
|
3548
3919
|
describe: "Commands for Canvas patterns",
|
|
3549
|
-
builder: (
|
|
3920
|
+
builder: (yargs28) => yargs28.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3550
3921
|
handler: () => {
|
|
3551
|
-
|
|
3922
|
+
yargs9.help();
|
|
3552
3923
|
}
|
|
3553
3924
|
};
|
|
3554
3925
|
|
|
3555
3926
|
// src/commands/canvas/commands/prompts.ts
|
|
3556
|
-
import
|
|
3927
|
+
import yargs10 from "yargs";
|
|
3557
3928
|
|
|
3558
3929
|
// src/commands/canvas/commands/prompts/get.ts
|
|
3559
3930
|
import { PromptClient } from "@uniformdev/canvas";
|
|
3560
3931
|
var PromptGetModule = {
|
|
3561
3932
|
command: "get <id>",
|
|
3562
3933
|
describe: "Get a prompt",
|
|
3563
|
-
builder: (
|
|
3934
|
+
builder: (yargs28) => withConfiguration(
|
|
3564
3935
|
withFormatOptions(
|
|
3565
3936
|
withApiOptions(
|
|
3566
3937
|
withProjectOptions(
|
|
3567
3938
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3568
|
-
|
|
3939
|
+
yargs28.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
3569
3940
|
)
|
|
3570
3941
|
)
|
|
3571
3942
|
)
|
|
@@ -3586,7 +3957,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
3586
3957
|
var PromptListModule = {
|
|
3587
3958
|
command: "list",
|
|
3588
3959
|
describe: "List prompts",
|
|
3589
|
-
builder: (
|
|
3960
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3590
3961
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3591
3962
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3592
3963
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3633,12 +4004,12 @@ function createPromptEngineDataSource({
|
|
|
3633
4004
|
var PromptPullModule = {
|
|
3634
4005
|
command: "pull <directory>",
|
|
3635
4006
|
describe: "Pulls all entries to local files in a directory",
|
|
3636
|
-
builder: (
|
|
4007
|
+
builder: (yargs28) => withConfiguration(
|
|
3637
4008
|
withApiOptions(
|
|
3638
4009
|
withProjectOptions(
|
|
3639
4010
|
withStateOptions(
|
|
3640
4011
|
withDiffOptions(
|
|
3641
|
-
|
|
4012
|
+
yargs28.positional("directory", {
|
|
3642
4013
|
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
4014
|
type: "string"
|
|
3644
4015
|
}).option("format", {
|
|
@@ -3721,12 +4092,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
3721
4092
|
var PromptPushModule = {
|
|
3722
4093
|
command: "push <directory>",
|
|
3723
4094
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
3724
|
-
builder: (
|
|
4095
|
+
builder: (yargs28) => withConfiguration(
|
|
3725
4096
|
withApiOptions(
|
|
3726
4097
|
withProjectOptions(
|
|
3727
4098
|
withStateOptions(
|
|
3728
4099
|
withDiffOptions(
|
|
3729
|
-
|
|
4100
|
+
yargs28.positional("directory", {
|
|
3730
4101
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
3731
4102
|
type: "string"
|
|
3732
4103
|
}).option("what-if", {
|
|
@@ -3797,9 +4168,9 @@ var PromptRemoveModule = {
|
|
|
3797
4168
|
command: "remove <id>",
|
|
3798
4169
|
aliases: ["delete", "rm"],
|
|
3799
4170
|
describe: "Delete a prompt",
|
|
3800
|
-
builder: (
|
|
4171
|
+
builder: (yargs28) => withConfiguration(
|
|
3801
4172
|
withApiOptions(
|
|
3802
|
-
withProjectOptions(
|
|
4173
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
3803
4174
|
)
|
|
3804
4175
|
),
|
|
3805
4176
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -3815,10 +4186,10 @@ var PromptUpdateModule = {
|
|
|
3815
4186
|
command: "update <filename>",
|
|
3816
4187
|
aliases: ["put"],
|
|
3817
4188
|
describe: "Insert or update a prompt",
|
|
3818
|
-
builder: (
|
|
4189
|
+
builder: (yargs28) => withConfiguration(
|
|
3819
4190
|
withApiOptions(
|
|
3820
4191
|
withProjectOptions(
|
|
3821
|
-
|
|
4192
|
+
yargs28.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
3822
4193
|
)
|
|
3823
4194
|
)
|
|
3824
4195
|
),
|
|
@@ -3835,9 +4206,9 @@ var PromptModule = {
|
|
|
3835
4206
|
command: "prompt <command>",
|
|
3836
4207
|
aliases: ["dt"],
|
|
3837
4208
|
describe: "Commands for AI Prompt definitions",
|
|
3838
|
-
builder: (
|
|
4209
|
+
builder: (yargs28) => yargs28.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
3839
4210
|
handler: () => {
|
|
3840
|
-
|
|
4211
|
+
yargs10.help();
|
|
3841
4212
|
}
|
|
3842
4213
|
};
|
|
3843
4214
|
|
|
@@ -3846,28 +4217,28 @@ var CanvasCommand = {
|
|
|
3846
4217
|
command: "canvas <command>",
|
|
3847
4218
|
aliases: ["cv", "pm", "presentation"],
|
|
3848
4219
|
describe: "Uniform Canvas commands",
|
|
3849
|
-
builder: (
|
|
4220
|
+
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
4221
|
handler: () => {
|
|
3851
|
-
|
|
4222
|
+
yargs11.showHelp();
|
|
3852
4223
|
}
|
|
3853
4224
|
};
|
|
3854
4225
|
|
|
3855
4226
|
// src/commands/context/index.ts
|
|
3856
|
-
import
|
|
4227
|
+
import yargs18 from "yargs";
|
|
3857
4228
|
|
|
3858
4229
|
// src/commands/context/commands/aggregate.ts
|
|
3859
|
-
import
|
|
4230
|
+
import yargs12 from "yargs";
|
|
3860
4231
|
|
|
3861
4232
|
// src/commands/context/commands/aggregate/get.ts
|
|
3862
4233
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
3863
4234
|
var AggregateGetModule = {
|
|
3864
4235
|
command: "get <id>",
|
|
3865
4236
|
describe: "Fetch an aggregate",
|
|
3866
|
-
builder: (
|
|
4237
|
+
builder: (yargs28) => withConfiguration(
|
|
3867
4238
|
withFormatOptions(
|
|
3868
4239
|
withApiOptions(
|
|
3869
4240
|
withProjectOptions(
|
|
3870
|
-
|
|
4241
|
+
yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3871
4242
|
)
|
|
3872
4243
|
)
|
|
3873
4244
|
)
|
|
@@ -3891,7 +4262,7 @@ var AggregateListModule = {
|
|
|
3891
4262
|
command: "list",
|
|
3892
4263
|
describe: "List aggregates",
|
|
3893
4264
|
aliases: ["ls"],
|
|
3894
|
-
builder: (
|
|
4265
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3895
4266
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3896
4267
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3897
4268
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3957,11 +4328,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
3957
4328
|
var AggregatePullModule = {
|
|
3958
4329
|
command: "pull <directory>",
|
|
3959
4330
|
describe: "Pulls all aggregates to local files in a directory",
|
|
3960
|
-
builder: (
|
|
4331
|
+
builder: (yargs28) => withConfiguration(
|
|
3961
4332
|
withApiOptions(
|
|
3962
4333
|
withProjectOptions(
|
|
3963
4334
|
withDiffOptions(
|
|
3964
|
-
|
|
4335
|
+
yargs28.positional("directory", {
|
|
3965
4336
|
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
4337
|
type: "string"
|
|
3967
4338
|
}).option("format", {
|
|
@@ -4036,11 +4407,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
4036
4407
|
var AggregatePushModule = {
|
|
4037
4408
|
command: "push <directory>",
|
|
4038
4409
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
4039
|
-
builder: (
|
|
4410
|
+
builder: (yargs28) => withConfiguration(
|
|
4040
4411
|
withApiOptions(
|
|
4041
4412
|
withProjectOptions(
|
|
4042
4413
|
withDiffOptions(
|
|
4043
|
-
|
|
4414
|
+
yargs28.positional("directory", {
|
|
4044
4415
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
4045
4416
|
type: "string"
|
|
4046
4417
|
}).option("what-if", {
|
|
@@ -4105,10 +4476,10 @@ var AggregateRemoveModule = {
|
|
|
4105
4476
|
command: "remove <id>",
|
|
4106
4477
|
aliases: ["delete", "rm"],
|
|
4107
4478
|
describe: "Delete an aggregate",
|
|
4108
|
-
builder: (
|
|
4479
|
+
builder: (yargs28) => withConfiguration(
|
|
4109
4480
|
withApiOptions(
|
|
4110
4481
|
withProjectOptions(
|
|
4111
|
-
|
|
4482
|
+
yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
4112
4483
|
)
|
|
4113
4484
|
)
|
|
4114
4485
|
),
|
|
@@ -4125,10 +4496,10 @@ var AggregateUpdateModule = {
|
|
|
4125
4496
|
command: "update <filename>",
|
|
4126
4497
|
aliases: ["put"],
|
|
4127
4498
|
describe: "Insert or update an aggregate",
|
|
4128
|
-
builder: (
|
|
4499
|
+
builder: (yargs28) => withConfiguration(
|
|
4129
4500
|
withApiOptions(
|
|
4130
4501
|
withProjectOptions(
|
|
4131
|
-
|
|
4502
|
+
yargs28.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
4132
4503
|
)
|
|
4133
4504
|
)
|
|
4134
4505
|
),
|
|
@@ -4145,25 +4516,25 @@ var AggregateModule = {
|
|
|
4145
4516
|
command: "aggregate <command>",
|
|
4146
4517
|
aliases: ["agg", "intent", "audience"],
|
|
4147
4518
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
4148
|
-
builder: (
|
|
4519
|
+
builder: (yargs28) => yargs28.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
4149
4520
|
handler: () => {
|
|
4150
|
-
|
|
4521
|
+
yargs12.help();
|
|
4151
4522
|
}
|
|
4152
4523
|
};
|
|
4153
4524
|
|
|
4154
4525
|
// src/commands/context/commands/enrichment.ts
|
|
4155
|
-
import
|
|
4526
|
+
import yargs13 from "yargs";
|
|
4156
4527
|
|
|
4157
4528
|
// src/commands/context/commands/enrichment/get.ts
|
|
4158
4529
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
4159
4530
|
var EnrichmentGetModule = {
|
|
4160
4531
|
command: "get <id>",
|
|
4161
4532
|
describe: "Fetch an enrichment category and its values",
|
|
4162
|
-
builder: (
|
|
4533
|
+
builder: (yargs28) => withFormatOptions(
|
|
4163
4534
|
withConfiguration(
|
|
4164
4535
|
withApiOptions(
|
|
4165
4536
|
withProjectOptions(
|
|
4166
|
-
|
|
4537
|
+
yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
4167
4538
|
)
|
|
4168
4539
|
)
|
|
4169
4540
|
)
|
|
@@ -4188,7 +4559,7 @@ var EnrichmentListModule = {
|
|
|
4188
4559
|
command: "list",
|
|
4189
4560
|
describe: "List enrichments",
|
|
4190
4561
|
aliases: ["ls"],
|
|
4191
|
-
builder: (
|
|
4562
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
4192
4563
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4193
4564
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4194
4565
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4289,11 +4660,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
4289
4660
|
var EnrichmentPullModule = {
|
|
4290
4661
|
command: "pull <directory>",
|
|
4291
4662
|
describe: "Pulls all enrichments to local files in a directory",
|
|
4292
|
-
builder: (
|
|
4663
|
+
builder: (yargs28) => withConfiguration(
|
|
4293
4664
|
withApiOptions(
|
|
4294
4665
|
withProjectOptions(
|
|
4295
4666
|
withDiffOptions(
|
|
4296
|
-
|
|
4667
|
+
yargs28.positional("directory", {
|
|
4297
4668
|
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
4669
|
type: "string"
|
|
4299
4670
|
}).option("format", {
|
|
@@ -4368,11 +4739,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
4368
4739
|
var EnrichmentPushModule = {
|
|
4369
4740
|
command: "push <directory>",
|
|
4370
4741
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
4371
|
-
builder: (
|
|
4742
|
+
builder: (yargs28) => withConfiguration(
|
|
4372
4743
|
withApiOptions(
|
|
4373
4744
|
withProjectOptions(
|
|
4374
4745
|
withDiffOptions(
|
|
4375
|
-
|
|
4746
|
+
yargs28.positional("directory", {
|
|
4376
4747
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
4377
4748
|
type: "string"
|
|
4378
4749
|
}).option("what-if", {
|
|
@@ -4436,10 +4807,10 @@ var EnrichmentRemoveModule = {
|
|
|
4436
4807
|
command: "remove <id>",
|
|
4437
4808
|
aliases: ["delete", "rm"],
|
|
4438
4809
|
describe: "Delete an enrichment category and its values",
|
|
4439
|
-
builder: (
|
|
4810
|
+
builder: (yargs28) => withConfiguration(
|
|
4440
4811
|
withApiOptions(
|
|
4441
4812
|
withProjectOptions(
|
|
4442
|
-
|
|
4813
|
+
yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
4443
4814
|
)
|
|
4444
4815
|
)
|
|
4445
4816
|
),
|
|
@@ -4455,14 +4826,14 @@ var EnrichmentModule = {
|
|
|
4455
4826
|
command: "enrichment <command>",
|
|
4456
4827
|
aliases: ["enr"],
|
|
4457
4828
|
describe: "Commands for Context enrichments",
|
|
4458
|
-
builder: (
|
|
4829
|
+
builder: (yargs28) => yargs28.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
4459
4830
|
handler: () => {
|
|
4460
|
-
|
|
4831
|
+
yargs13.help();
|
|
4461
4832
|
}
|
|
4462
4833
|
};
|
|
4463
4834
|
|
|
4464
4835
|
// src/commands/context/commands/manifest.ts
|
|
4465
|
-
import
|
|
4836
|
+
import yargs14 from "yargs";
|
|
4466
4837
|
|
|
4467
4838
|
// src/commands/context/commands/manifest/get.ts
|
|
4468
4839
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -4473,10 +4844,10 @@ var ManifestGetModule = {
|
|
|
4473
4844
|
command: "get [output]",
|
|
4474
4845
|
aliases: ["dl", "download"],
|
|
4475
4846
|
describe: "Download the Uniform Context manifest for a project",
|
|
4476
|
-
builder: (
|
|
4847
|
+
builder: (yargs28) => withConfiguration(
|
|
4477
4848
|
withApiOptions(
|
|
4478
4849
|
withProjectOptions(
|
|
4479
|
-
|
|
4850
|
+
yargs28.option("preview", {
|
|
4480
4851
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
4481
4852
|
default: false,
|
|
4482
4853
|
type: "boolean",
|
|
@@ -4538,7 +4909,7 @@ import { exit as exit2 } from "process";
|
|
|
4538
4909
|
var ManifestPublishModule = {
|
|
4539
4910
|
command: "publish",
|
|
4540
4911
|
describe: "Publish the Uniform Context manifest for a project",
|
|
4541
|
-
builder: (
|
|
4912
|
+
builder: (yargs28) => withConfiguration(withApiOptions(withProjectOptions(yargs28))),
|
|
4542
4913
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
4543
4914
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4544
4915
|
try {
|
|
@@ -4571,25 +4942,25 @@ var ManifestModule = {
|
|
|
4571
4942
|
command: "manifest <command>",
|
|
4572
4943
|
describe: "Commands for context manifests",
|
|
4573
4944
|
aliases: ["man"],
|
|
4574
|
-
builder: (
|
|
4945
|
+
builder: (yargs28) => yargs28.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
4575
4946
|
handler: () => {
|
|
4576
|
-
|
|
4947
|
+
yargs14.help();
|
|
4577
4948
|
}
|
|
4578
4949
|
};
|
|
4579
4950
|
|
|
4580
4951
|
// src/commands/context/commands/quirk.ts
|
|
4581
|
-
import
|
|
4952
|
+
import yargs15 from "yargs";
|
|
4582
4953
|
|
|
4583
4954
|
// src/commands/context/commands/quirk/get.ts
|
|
4584
4955
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
4585
4956
|
var QuirkGetModule = {
|
|
4586
4957
|
command: "get <id>",
|
|
4587
4958
|
describe: "Fetch a quirk",
|
|
4588
|
-
builder: (
|
|
4959
|
+
builder: (yargs28) => withConfiguration(
|
|
4589
4960
|
withFormatOptions(
|
|
4590
4961
|
withApiOptions(
|
|
4591
4962
|
withProjectOptions(
|
|
4592
|
-
|
|
4963
|
+
yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
4593
4964
|
)
|
|
4594
4965
|
)
|
|
4595
4966
|
)
|
|
@@ -4613,11 +4984,11 @@ var QuirkListModule = {
|
|
|
4613
4984
|
command: "list",
|
|
4614
4985
|
describe: "List quirks",
|
|
4615
4986
|
aliases: ["ls"],
|
|
4616
|
-
builder: (
|
|
4987
|
+
builder: (yargs28) => withConfiguration(
|
|
4617
4988
|
withFormatOptions(
|
|
4618
4989
|
withApiOptions(
|
|
4619
4990
|
withProjectOptions(
|
|
4620
|
-
|
|
4991
|
+
yargs28.option("withIntegrations", {
|
|
4621
4992
|
alias: ["i"],
|
|
4622
4993
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
4623
4994
|
type: "boolean"
|
|
@@ -4674,11 +5045,11 @@ function createQuirkEngineDataSource({
|
|
|
4674
5045
|
var QuirkPullModule = {
|
|
4675
5046
|
command: "pull <directory>",
|
|
4676
5047
|
describe: "Pulls all quirks to local files in a directory",
|
|
4677
|
-
builder: (
|
|
5048
|
+
builder: (yargs28) => withConfiguration(
|
|
4678
5049
|
withApiOptions(
|
|
4679
5050
|
withProjectOptions(
|
|
4680
5051
|
withDiffOptions(
|
|
4681
|
-
|
|
5052
|
+
yargs28.positional("directory", {
|
|
4682
5053
|
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
5054
|
type: "string"
|
|
4684
5055
|
}).option("format", {
|
|
@@ -4753,11 +5124,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
4753
5124
|
var QuirkPushModule = {
|
|
4754
5125
|
command: "push <directory>",
|
|
4755
5126
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
4756
|
-
builder: (
|
|
5127
|
+
builder: (yargs28) => withConfiguration(
|
|
4757
5128
|
withApiOptions(
|
|
4758
5129
|
withProjectOptions(
|
|
4759
5130
|
withDiffOptions(
|
|
4760
|
-
|
|
5131
|
+
yargs28.positional("directory", {
|
|
4761
5132
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
4762
5133
|
type: "string"
|
|
4763
5134
|
}).option("what-if", {
|
|
@@ -4821,10 +5192,10 @@ var QuirkRemoveModule = {
|
|
|
4821
5192
|
command: "remove <id>",
|
|
4822
5193
|
aliases: ["delete", "rm"],
|
|
4823
5194
|
describe: "Delete a quirk",
|
|
4824
|
-
builder: (
|
|
5195
|
+
builder: (yargs28) => withConfiguration(
|
|
4825
5196
|
withApiOptions(
|
|
4826
5197
|
withProjectOptions(
|
|
4827
|
-
|
|
5198
|
+
yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4828
5199
|
)
|
|
4829
5200
|
)
|
|
4830
5201
|
),
|
|
@@ -4841,10 +5212,10 @@ var QuirkUpdateModule = {
|
|
|
4841
5212
|
command: "update <filename>",
|
|
4842
5213
|
aliases: ["put"],
|
|
4843
5214
|
describe: "Insert or update a quirk",
|
|
4844
|
-
builder: (
|
|
5215
|
+
builder: (yargs28) => withConfiguration(
|
|
4845
5216
|
withApiOptions(
|
|
4846
5217
|
withProjectOptions(
|
|
4847
|
-
|
|
5218
|
+
yargs28.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4848
5219
|
)
|
|
4849
5220
|
)
|
|
4850
5221
|
),
|
|
@@ -4861,25 +5232,25 @@ var QuirkModule = {
|
|
|
4861
5232
|
command: "quirk <command>",
|
|
4862
5233
|
aliases: ["qk"],
|
|
4863
5234
|
describe: "Commands for Context quirks",
|
|
4864
|
-
builder: (
|
|
5235
|
+
builder: (yargs28) => yargs28.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
4865
5236
|
handler: () => {
|
|
4866
|
-
|
|
5237
|
+
yargs15.help();
|
|
4867
5238
|
}
|
|
4868
5239
|
};
|
|
4869
5240
|
|
|
4870
5241
|
// src/commands/context/commands/signal.ts
|
|
4871
|
-
import
|
|
5242
|
+
import yargs16 from "yargs";
|
|
4872
5243
|
|
|
4873
5244
|
// src/commands/context/commands/signal/get.ts
|
|
4874
5245
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
4875
5246
|
var SignalGetModule = {
|
|
4876
5247
|
command: "get <id>",
|
|
4877
5248
|
describe: "Fetch a signal",
|
|
4878
|
-
builder: (
|
|
5249
|
+
builder: (yargs28) => withConfiguration(
|
|
4879
5250
|
withFormatOptions(
|
|
4880
5251
|
withApiOptions(
|
|
4881
5252
|
withProjectOptions(
|
|
4882
|
-
|
|
5253
|
+
yargs28.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4883
5254
|
)
|
|
4884
5255
|
)
|
|
4885
5256
|
)
|
|
@@ -4903,7 +5274,7 @@ var SignalListModule = {
|
|
|
4903
5274
|
command: "list",
|
|
4904
5275
|
describe: "List signals",
|
|
4905
5276
|
aliases: ["ls"],
|
|
4906
|
-
builder: (
|
|
5277
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
4907
5278
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4908
5279
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4909
5280
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4952,11 +5323,11 @@ function createSignalEngineDataSource({
|
|
|
4952
5323
|
var SignalPullModule = {
|
|
4953
5324
|
command: "pull <directory>",
|
|
4954
5325
|
describe: "Pulls all signals to local files in a directory",
|
|
4955
|
-
builder: (
|
|
5326
|
+
builder: (yargs28) => withConfiguration(
|
|
4956
5327
|
withApiOptions(
|
|
4957
5328
|
withProjectOptions(
|
|
4958
5329
|
withDiffOptions(
|
|
4959
|
-
|
|
5330
|
+
yargs28.positional("directory", {
|
|
4960
5331
|
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
5332
|
type: "string"
|
|
4962
5333
|
}).option("format", {
|
|
@@ -5031,11 +5402,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
5031
5402
|
var SignalPushModule = {
|
|
5032
5403
|
command: "push <directory>",
|
|
5033
5404
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
5034
|
-
builder: (
|
|
5405
|
+
builder: (yargs28) => withConfiguration(
|
|
5035
5406
|
withApiOptions(
|
|
5036
5407
|
withProjectOptions(
|
|
5037
5408
|
withDiffOptions(
|
|
5038
|
-
|
|
5409
|
+
yargs28.positional("directory", {
|
|
5039
5410
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
5040
5411
|
type: "string"
|
|
5041
5412
|
}).option("what-if", {
|
|
@@ -5099,10 +5470,10 @@ var SignalRemoveModule = {
|
|
|
5099
5470
|
command: "remove <id>",
|
|
5100
5471
|
aliases: ["delete", "rm"],
|
|
5101
5472
|
describe: "Delete a signal",
|
|
5102
|
-
builder: (
|
|
5473
|
+
builder: (yargs28) => withConfiguration(
|
|
5103
5474
|
withApiOptions(
|
|
5104
5475
|
withProjectOptions(
|
|
5105
|
-
|
|
5476
|
+
yargs28.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
5106
5477
|
)
|
|
5107
5478
|
)
|
|
5108
5479
|
),
|
|
@@ -5119,10 +5490,10 @@ var SignalUpdateModule = {
|
|
|
5119
5490
|
command: "update <filename>",
|
|
5120
5491
|
aliases: ["put"],
|
|
5121
5492
|
describe: "Insert or update a signal",
|
|
5122
|
-
builder: (
|
|
5493
|
+
builder: (yargs28) => withConfiguration(
|
|
5123
5494
|
withApiOptions(
|
|
5124
5495
|
withProjectOptions(
|
|
5125
|
-
|
|
5496
|
+
yargs28.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
5126
5497
|
)
|
|
5127
5498
|
)
|
|
5128
5499
|
),
|
|
@@ -5139,25 +5510,25 @@ var SignalModule = {
|
|
|
5139
5510
|
command: "signal <command>",
|
|
5140
5511
|
aliases: ["sig"],
|
|
5141
5512
|
describe: "Commands for Context signals",
|
|
5142
|
-
builder: (
|
|
5513
|
+
builder: (yargs28) => yargs28.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
5143
5514
|
handler: () => {
|
|
5144
|
-
|
|
5515
|
+
yargs16.help();
|
|
5145
5516
|
}
|
|
5146
5517
|
};
|
|
5147
5518
|
|
|
5148
5519
|
// src/commands/context/commands/test.ts
|
|
5149
|
-
import
|
|
5520
|
+
import yargs17 from "yargs";
|
|
5150
5521
|
|
|
5151
5522
|
// src/commands/context/commands/test/get.ts
|
|
5152
5523
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
5153
5524
|
var TestGetModule = {
|
|
5154
5525
|
command: "get <id>",
|
|
5155
5526
|
describe: "Fetch a test",
|
|
5156
|
-
builder: (
|
|
5527
|
+
builder: (yargs28) => withConfiguration(
|
|
5157
5528
|
withFormatOptions(
|
|
5158
5529
|
withApiOptions(
|
|
5159
5530
|
withProjectOptions(
|
|
5160
|
-
|
|
5531
|
+
yargs28.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
5161
5532
|
)
|
|
5162
5533
|
)
|
|
5163
5534
|
)
|
|
@@ -5181,7 +5552,7 @@ var TestListModule = {
|
|
|
5181
5552
|
command: "list",
|
|
5182
5553
|
describe: "List tests",
|
|
5183
5554
|
aliases: ["ls"],
|
|
5184
|
-
builder: (
|
|
5555
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
5185
5556
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5186
5557
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5187
5558
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5230,11 +5601,11 @@ function createTestEngineDataSource({
|
|
|
5230
5601
|
var TestPullModule = {
|
|
5231
5602
|
command: "pull <directory>",
|
|
5232
5603
|
describe: "Pulls all tests to local files in a directory",
|
|
5233
|
-
builder: (
|
|
5604
|
+
builder: (yargs28) => withConfiguration(
|
|
5234
5605
|
withApiOptions(
|
|
5235
5606
|
withProjectOptions(
|
|
5236
5607
|
withDiffOptions(
|
|
5237
|
-
|
|
5608
|
+
yargs28.positional("directory", {
|
|
5238
5609
|
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
5610
|
type: "string"
|
|
5240
5611
|
}).option("format", {
|
|
@@ -5309,11 +5680,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
5309
5680
|
var TestPushModule = {
|
|
5310
5681
|
command: "push <directory>",
|
|
5311
5682
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
5312
|
-
builder: (
|
|
5683
|
+
builder: (yargs28) => withConfiguration(
|
|
5313
5684
|
withApiOptions(
|
|
5314
5685
|
withProjectOptions(
|
|
5315
5686
|
withDiffOptions(
|
|
5316
|
-
|
|
5687
|
+
yargs28.positional("directory", {
|
|
5317
5688
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
5318
5689
|
type: "string"
|
|
5319
5690
|
}).option("what-if", {
|
|
@@ -5377,10 +5748,10 @@ var TestRemoveModule = {
|
|
|
5377
5748
|
command: "remove <id>",
|
|
5378
5749
|
aliases: ["delete", "rm"],
|
|
5379
5750
|
describe: "Delete a test",
|
|
5380
|
-
builder: (
|
|
5751
|
+
builder: (yargs28) => withConfiguration(
|
|
5381
5752
|
withApiOptions(
|
|
5382
5753
|
withProjectOptions(
|
|
5383
|
-
|
|
5754
|
+
yargs28.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
5384
5755
|
)
|
|
5385
5756
|
)
|
|
5386
5757
|
),
|
|
@@ -5397,9 +5768,9 @@ var TestUpdateModule = {
|
|
|
5397
5768
|
command: "update <filename>",
|
|
5398
5769
|
aliases: ["put"],
|
|
5399
5770
|
describe: "Insert or update a test",
|
|
5400
|
-
builder: (
|
|
5771
|
+
builder: (yargs28) => withConfiguration(
|
|
5401
5772
|
withApiOptions(
|
|
5402
|
-
withProjectOptions(
|
|
5773
|
+
withProjectOptions(yargs28.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
5403
5774
|
)
|
|
5404
5775
|
),
|
|
5405
5776
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5414,9 +5785,9 @@ var TestUpdateModule = {
|
|
|
5414
5785
|
var TestModule = {
|
|
5415
5786
|
command: "test <command>",
|
|
5416
5787
|
describe: "Commands for Context A/B tests",
|
|
5417
|
-
builder: (
|
|
5788
|
+
builder: (yargs28) => yargs28.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
5418
5789
|
handler: () => {
|
|
5419
|
-
|
|
5790
|
+
yargs17.help();
|
|
5420
5791
|
}
|
|
5421
5792
|
};
|
|
5422
5793
|
|
|
@@ -5425,9 +5796,9 @@ var ContextCommand = {
|
|
|
5425
5796
|
command: "context <command>",
|
|
5426
5797
|
aliases: ["ctx"],
|
|
5427
5798
|
describe: "Uniform Context commands",
|
|
5428
|
-
builder: (
|
|
5799
|
+
builder: (yargs28) => yargs28.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
5429
5800
|
handler: () => {
|
|
5430
|
-
|
|
5801
|
+
yargs18.showHelp();
|
|
5431
5802
|
}
|
|
5432
5803
|
};
|
|
5433
5804
|
|
|
@@ -5455,7 +5826,7 @@ import { PostHog } from "posthog-node";
|
|
|
5455
5826
|
// package.json
|
|
5456
5827
|
var package_default = {
|
|
5457
5828
|
name: "@uniformdev/cli",
|
|
5458
|
-
version: "19.
|
|
5829
|
+
version: "19.88.0",
|
|
5459
5830
|
description: "Uniform command line interface tool",
|
|
5460
5831
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5461
5832
|
main: "./cli.js",
|
|
@@ -5512,7 +5883,7 @@ var package_default = {
|
|
|
5512
5883
|
"@types/js-yaml": "4.0.9",
|
|
5513
5884
|
"@types/jsonwebtoken": "9.0.5",
|
|
5514
5885
|
"@types/lodash.isequalwith": "4.4.9",
|
|
5515
|
-
"@types/node": "18.19.
|
|
5886
|
+
"@types/node": "18.19.3",
|
|
5516
5887
|
"@types/yargs": "17.0.32"
|
|
5517
5888
|
},
|
|
5518
5889
|
bin: {
|
|
@@ -6465,10 +6836,10 @@ var NewMeshCmd = {
|
|
|
6465
6836
|
};
|
|
6466
6837
|
|
|
6467
6838
|
// src/commands/optimize/index.ts
|
|
6468
|
-
import
|
|
6839
|
+
import yargs20 from "yargs";
|
|
6469
6840
|
|
|
6470
6841
|
// src/commands/optimize/manifest.ts
|
|
6471
|
-
import
|
|
6842
|
+
import yargs19 from "yargs";
|
|
6472
6843
|
|
|
6473
6844
|
// src/commands/optimize/manifest/download.ts
|
|
6474
6845
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -6483,7 +6854,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
6483
6854
|
var module = {
|
|
6484
6855
|
command: "download [output]",
|
|
6485
6856
|
describe: "Download intent manifest",
|
|
6486
|
-
builder: (
|
|
6857
|
+
builder: (yargs28) => yargs28.option("apiKey", {
|
|
6487
6858
|
alias: "k",
|
|
6488
6859
|
demandOption: true,
|
|
6489
6860
|
string: true,
|
|
@@ -6584,10 +6955,10 @@ var module2 = {
|
|
|
6584
6955
|
command: "manifest <command>",
|
|
6585
6956
|
describe: "Intent manifest commands",
|
|
6586
6957
|
builder: () => {
|
|
6587
|
-
return
|
|
6958
|
+
return yargs19.command(download_default);
|
|
6588
6959
|
},
|
|
6589
6960
|
handler: () => {
|
|
6590
|
-
|
|
6961
|
+
yargs19.showHelp();
|
|
6591
6962
|
}
|
|
6592
6963
|
};
|
|
6593
6964
|
var manifest_default = module2;
|
|
@@ -6598,29 +6969,29 @@ var OptimizeCommand = {
|
|
|
6598
6969
|
aliases: ["opt"],
|
|
6599
6970
|
describe: "Uniform Optimize commands",
|
|
6600
6971
|
builder: () => {
|
|
6601
|
-
return
|
|
6972
|
+
return yargs20.command(manifest_default);
|
|
6602
6973
|
},
|
|
6603
6974
|
handler: () => {
|
|
6604
|
-
|
|
6975
|
+
yargs20.showHelp();
|
|
6605
6976
|
}
|
|
6606
6977
|
};
|
|
6607
6978
|
|
|
6608
6979
|
// src/commands/project-map/index.ts
|
|
6609
|
-
import
|
|
6980
|
+
import yargs23 from "yargs";
|
|
6610
6981
|
|
|
6611
6982
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
6612
|
-
import
|
|
6983
|
+
import yargs21 from "yargs";
|
|
6613
6984
|
|
|
6614
6985
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
6615
6986
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
6616
6987
|
var ProjectMapDefinitionGetModule = {
|
|
6617
6988
|
command: "get <id>",
|
|
6618
6989
|
describe: "Fetch a project map",
|
|
6619
|
-
builder: (
|
|
6990
|
+
builder: (yargs28) => withFormatOptions(
|
|
6620
6991
|
withConfiguration(
|
|
6621
6992
|
withApiOptions(
|
|
6622
6993
|
withProjectOptions(
|
|
6623
|
-
|
|
6994
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
6624
6995
|
)
|
|
6625
6996
|
)
|
|
6626
6997
|
)
|
|
@@ -6644,7 +7015,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
6644
7015
|
command: "list",
|
|
6645
7016
|
describe: "List of project maps",
|
|
6646
7017
|
aliases: ["ls"],
|
|
6647
|
-
builder: (
|
|
7018
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
6648
7019
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6649
7020
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6650
7021
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6701,11 +7072,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
6701
7072
|
var ProjectMapDefinitionPullModule = {
|
|
6702
7073
|
command: "pull <directory>",
|
|
6703
7074
|
describe: "Pulls all project maps to local files in a directory",
|
|
6704
|
-
builder: (
|
|
7075
|
+
builder: (yargs28) => withConfiguration(
|
|
6705
7076
|
withApiOptions(
|
|
6706
7077
|
withProjectOptions(
|
|
6707
7078
|
withDiffOptions(
|
|
6708
|
-
|
|
7079
|
+
yargs28.positional("directory", {
|
|
6709
7080
|
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
7081
|
type: "string"
|
|
6711
7082
|
}).option("format", {
|
|
@@ -6781,11 +7152,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
6781
7152
|
var ProjectMapDefinitionPushModule = {
|
|
6782
7153
|
command: "push <directory>",
|
|
6783
7154
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
6784
|
-
builder: (
|
|
7155
|
+
builder: (yargs28) => withConfiguration(
|
|
6785
7156
|
withApiOptions(
|
|
6786
7157
|
withProjectOptions(
|
|
6787
7158
|
withDiffOptions(
|
|
6788
|
-
|
|
7159
|
+
yargs28.positional("directory", {
|
|
6789
7160
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6790
7161
|
type: "string"
|
|
6791
7162
|
}).option("what-if", {
|
|
@@ -6849,9 +7220,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
6849
7220
|
command: "remove <id>",
|
|
6850
7221
|
aliases: ["delete", "rm"],
|
|
6851
7222
|
describe: "Delete a project map",
|
|
6852
|
-
builder: (
|
|
7223
|
+
builder: (yargs28) => withConfiguration(
|
|
6853
7224
|
withApiOptions(
|
|
6854
|
-
withProjectOptions(
|
|
7225
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6855
7226
|
)
|
|
6856
7227
|
),
|
|
6857
7228
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6867,10 +7238,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6867
7238
|
command: "update <filename>",
|
|
6868
7239
|
aliases: ["put"],
|
|
6869
7240
|
describe: "Insert or update a project map",
|
|
6870
|
-
builder: (
|
|
7241
|
+
builder: (yargs28) => withConfiguration(
|
|
6871
7242
|
withApiOptions(
|
|
6872
7243
|
withProjectOptions(
|
|
6873
|
-
|
|
7244
|
+
yargs28.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6874
7245
|
)
|
|
6875
7246
|
)
|
|
6876
7247
|
),
|
|
@@ -6886,25 +7257,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6886
7257
|
var ProjectMapDefinitionModule = {
|
|
6887
7258
|
command: "definition <command>",
|
|
6888
7259
|
describe: "Commands for ProjectMap Definitions",
|
|
6889
|
-
builder: (
|
|
7260
|
+
builder: (yargs28) => yargs28.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
6890
7261
|
handler: () => {
|
|
6891
|
-
|
|
7262
|
+
yargs21.help();
|
|
6892
7263
|
}
|
|
6893
7264
|
};
|
|
6894
7265
|
|
|
6895
7266
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
6896
|
-
import
|
|
7267
|
+
import yargs22 from "yargs";
|
|
6897
7268
|
|
|
6898
7269
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
6899
7270
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
6900
7271
|
var ProjectMapNodeGetModule = {
|
|
6901
7272
|
command: "get <id> <projectMapId>",
|
|
6902
7273
|
describe: "Fetch a project map node",
|
|
6903
|
-
builder: (
|
|
7274
|
+
builder: (yargs28) => withConfiguration(
|
|
6904
7275
|
withFormatOptions(
|
|
6905
7276
|
withApiOptions(
|
|
6906
7277
|
withProjectOptions(
|
|
6907
|
-
|
|
7278
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6908
7279
|
)
|
|
6909
7280
|
)
|
|
6910
7281
|
)
|
|
@@ -6930,11 +7301,11 @@ var ProjectMapNodeListModule = {
|
|
|
6930
7301
|
command: "list <projectMapId>",
|
|
6931
7302
|
describe: "List project map nodes",
|
|
6932
7303
|
aliases: ["ls"],
|
|
6933
|
-
builder: (
|
|
7304
|
+
builder: (yargs28) => withConfiguration(
|
|
6934
7305
|
withFormatOptions(
|
|
6935
7306
|
withApiOptions(
|
|
6936
7307
|
withProjectOptions(
|
|
6937
|
-
|
|
7308
|
+
yargs28.positional("projectMapId", {
|
|
6938
7309
|
demandOption: true,
|
|
6939
7310
|
describe: "ProjectMap UUID to fetch from"
|
|
6940
7311
|
})
|
|
@@ -7005,11 +7376,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
7005
7376
|
var ProjectMapNodePullModule = {
|
|
7006
7377
|
command: "pull <directory>",
|
|
7007
7378
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
7008
|
-
builder: (
|
|
7379
|
+
builder: (yargs28) => withConfiguration(
|
|
7009
7380
|
withApiOptions(
|
|
7010
7381
|
withProjectOptions(
|
|
7011
7382
|
withDiffOptions(
|
|
7012
|
-
|
|
7383
|
+
yargs28.positional("directory", {
|
|
7013
7384
|
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
7385
|
type: "string"
|
|
7015
7386
|
}).option("format", {
|
|
@@ -7089,11 +7460,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
7089
7460
|
var ProjectMapNodePushModule = {
|
|
7090
7461
|
command: "push <directory>",
|
|
7091
7462
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
7092
|
-
builder: (
|
|
7463
|
+
builder: (yargs28) => withConfiguration(
|
|
7093
7464
|
withApiOptions(
|
|
7094
7465
|
withProjectOptions(
|
|
7095
7466
|
withDiffOptions(
|
|
7096
|
-
|
|
7467
|
+
yargs28.positional("directory", {
|
|
7097
7468
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
7098
7469
|
type: "string"
|
|
7099
7470
|
}).option("what-if", {
|
|
@@ -7166,10 +7537,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
7166
7537
|
command: "remove <id> <projectMapId>",
|
|
7167
7538
|
aliases: ["delete", "rm"],
|
|
7168
7539
|
describe: "Delete a project map node",
|
|
7169
|
-
builder: (
|
|
7540
|
+
builder: (yargs28) => withConfiguration(
|
|
7170
7541
|
withApiOptions(
|
|
7171
7542
|
withProjectOptions(
|
|
7172
|
-
|
|
7543
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
7173
7544
|
)
|
|
7174
7545
|
)
|
|
7175
7546
|
),
|
|
@@ -7186,10 +7557,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
7186
7557
|
command: "update <filename> <projectMapId>",
|
|
7187
7558
|
aliases: ["put"],
|
|
7188
7559
|
describe: "Insert or update a project map node",
|
|
7189
|
-
builder: (
|
|
7560
|
+
builder: (yargs28) => withConfiguration(
|
|
7190
7561
|
withApiOptions(
|
|
7191
7562
|
withProjectOptions(
|
|
7192
|
-
|
|
7563
|
+
yargs28.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
7193
7564
|
)
|
|
7194
7565
|
)
|
|
7195
7566
|
),
|
|
@@ -7205,9 +7576,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
7205
7576
|
var ProjectMapNodeModule = {
|
|
7206
7577
|
command: "node <command>",
|
|
7207
7578
|
describe: "Commands for ProjectMap Nodes",
|
|
7208
|
-
builder: (
|
|
7579
|
+
builder: (yargs28) => yargs28.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
7209
7580
|
handler: () => {
|
|
7210
|
-
|
|
7581
|
+
yargs22.help();
|
|
7211
7582
|
}
|
|
7212
7583
|
};
|
|
7213
7584
|
|
|
@@ -7216,28 +7587,28 @@ var ProjectMapCommand = {
|
|
|
7216
7587
|
command: "project-map <command>",
|
|
7217
7588
|
aliases: ["prm"],
|
|
7218
7589
|
describe: "Uniform ProjectMap commands",
|
|
7219
|
-
builder: (
|
|
7590
|
+
builder: (yargs28) => yargs28.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
7220
7591
|
handler: () => {
|
|
7221
|
-
|
|
7592
|
+
yargs23.showHelp();
|
|
7222
7593
|
}
|
|
7223
7594
|
};
|
|
7224
7595
|
|
|
7225
7596
|
// src/commands/redirect/index.ts
|
|
7226
|
-
import
|
|
7597
|
+
import yargs25 from "yargs";
|
|
7227
7598
|
|
|
7228
7599
|
// src/commands/redirect/commands/redirect.ts
|
|
7229
|
-
import
|
|
7600
|
+
import yargs24 from "yargs";
|
|
7230
7601
|
|
|
7231
7602
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
7232
7603
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
7233
7604
|
var RedirectDefinitionGetModule = {
|
|
7234
7605
|
command: "get <id>",
|
|
7235
7606
|
describe: "Fetch a redirect",
|
|
7236
|
-
builder: (
|
|
7607
|
+
builder: (yargs28) => withConfiguration(
|
|
7237
7608
|
withFormatOptions(
|
|
7238
7609
|
withApiOptions(
|
|
7239
7610
|
withProjectOptions(
|
|
7240
|
-
|
|
7611
|
+
yargs28.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
7241
7612
|
)
|
|
7242
7613
|
)
|
|
7243
7614
|
)
|
|
@@ -7261,7 +7632,7 @@ var RedirectDefinitionListModule = {
|
|
|
7261
7632
|
command: "list",
|
|
7262
7633
|
describe: "List of redirects",
|
|
7263
7634
|
aliases: ["ls"],
|
|
7264
|
-
builder: (
|
|
7635
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
7265
7636
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
7266
7637
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7267
7638
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7327,11 +7698,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
7327
7698
|
var RedirectDefinitionPullModule = {
|
|
7328
7699
|
command: "pull <directory>",
|
|
7329
7700
|
describe: "Pulls all redirects to local files in a directory",
|
|
7330
|
-
builder: (
|
|
7701
|
+
builder: (yargs28) => withConfiguration(
|
|
7331
7702
|
withApiOptions(
|
|
7332
7703
|
withProjectOptions(
|
|
7333
7704
|
withDiffOptions(
|
|
7334
|
-
|
|
7705
|
+
yargs28.positional("directory", {
|
|
7335
7706
|
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
7707
|
type: "string"
|
|
7337
7708
|
}).option("format", {
|
|
@@ -7408,11 +7779,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
7408
7779
|
var RedirectDefinitionPushModule = {
|
|
7409
7780
|
command: "push <directory>",
|
|
7410
7781
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
7411
|
-
builder: (
|
|
7782
|
+
builder: (yargs28) => withConfiguration(
|
|
7412
7783
|
withApiOptions(
|
|
7413
7784
|
withProjectOptions(
|
|
7414
7785
|
withDiffOptions(
|
|
7415
|
-
|
|
7786
|
+
yargs28.positional("directory", {
|
|
7416
7787
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
7417
7788
|
type: "string"
|
|
7418
7789
|
}).option("what-if", {
|
|
@@ -7476,9 +7847,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
7476
7847
|
command: "remove <id>",
|
|
7477
7848
|
aliases: ["delete", "rm"],
|
|
7478
7849
|
describe: "Delete a redirect",
|
|
7479
|
-
builder: (
|
|
7850
|
+
builder: (yargs28) => withConfiguration(
|
|
7480
7851
|
withApiOptions(
|
|
7481
|
-
withProjectOptions(
|
|
7852
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
7482
7853
|
)
|
|
7483
7854
|
),
|
|
7484
7855
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -7494,10 +7865,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7494
7865
|
command: "update <filename>",
|
|
7495
7866
|
aliases: ["put"],
|
|
7496
7867
|
describe: "Insert or update a redirect",
|
|
7497
|
-
builder: (
|
|
7868
|
+
builder: (yargs28) => withConfiguration(
|
|
7498
7869
|
withApiOptions(
|
|
7499
7870
|
withProjectOptions(
|
|
7500
|
-
|
|
7871
|
+
yargs28.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
7501
7872
|
)
|
|
7502
7873
|
)
|
|
7503
7874
|
),
|
|
@@ -7513,9 +7884,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7513
7884
|
var RedirectDefinitionModule = {
|
|
7514
7885
|
command: "definition <command>",
|
|
7515
7886
|
describe: "Commands for Redirect Definitions",
|
|
7516
|
-
builder: (
|
|
7887
|
+
builder: (yargs28) => yargs28.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
7517
7888
|
handler: () => {
|
|
7518
|
-
|
|
7889
|
+
yargs24.help();
|
|
7519
7890
|
}
|
|
7520
7891
|
};
|
|
7521
7892
|
|
|
@@ -7524,14 +7895,14 @@ var RedirectCommand = {
|
|
|
7524
7895
|
command: "redirect <command>",
|
|
7525
7896
|
aliases: ["red"],
|
|
7526
7897
|
describe: "Uniform Redirect commands",
|
|
7527
|
-
builder: (
|
|
7898
|
+
builder: (yargs28) => yargs28.command(RedirectDefinitionModule).demandCommand(),
|
|
7528
7899
|
handler: () => {
|
|
7529
|
-
|
|
7900
|
+
yargs25.showHelp();
|
|
7530
7901
|
}
|
|
7531
7902
|
};
|
|
7532
7903
|
|
|
7533
7904
|
// src/commands/sync/index.ts
|
|
7534
|
-
import
|
|
7905
|
+
import yargs26 from "yargs";
|
|
7535
7906
|
|
|
7536
7907
|
// src/commands/sync/commands/util.ts
|
|
7537
7908
|
import ora2 from "ora";
|
|
@@ -7564,11 +7935,11 @@ function spin(entityType) {
|
|
|
7564
7935
|
var SyncPullModule = {
|
|
7565
7936
|
command: "pull",
|
|
7566
7937
|
describe: "Pulls whole project to local files in a directory",
|
|
7567
|
-
builder: (
|
|
7938
|
+
builder: (yargs28) => withConfiguration(
|
|
7568
7939
|
withApiOptions(
|
|
7569
7940
|
withProjectOptions(
|
|
7570
7941
|
withDiffOptions(
|
|
7571
|
-
|
|
7942
|
+
yargs28.option("what-if", {
|
|
7572
7943
|
alias: ["w"],
|
|
7573
7944
|
describe: "What-if mode reports what would be done but changes no files",
|
|
7574
7945
|
default: false,
|
|
@@ -7579,8 +7950,11 @@ var SyncPullModule = {
|
|
|
7579
7950
|
)
|
|
7580
7951
|
),
|
|
7581
7952
|
handler: async ({ serialization, ...otherParams }) => {
|
|
7953
|
+
var _a;
|
|
7582
7954
|
const config2 = serialization;
|
|
7583
7955
|
const enabledEntities = Object.entries({
|
|
7956
|
+
locale: LocalePullModule,
|
|
7957
|
+
asset: AssetPullModule,
|
|
7584
7958
|
category: CategoryPullModule,
|
|
7585
7959
|
dataType: DataTypePullModule,
|
|
7586
7960
|
prompt: PromptPullModule,
|
|
@@ -7596,11 +7970,10 @@ var SyncPullModule = {
|
|
|
7596
7970
|
projectMapNode: ProjectMapNodePullModule,
|
|
7597
7971
|
redirect: RedirectDefinitionPullModule,
|
|
7598
7972
|
entry: EntryPullModule,
|
|
7599
|
-
contentType: ContentTypePullModule
|
|
7600
|
-
asset: AssetPullModule
|
|
7973
|
+
contentType: ContentTypePullModule
|
|
7601
7974
|
}).filter(([entityType]) => {
|
|
7602
|
-
var
|
|
7603
|
-
return Boolean((
|
|
7975
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
7976
|
+
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;
|
|
7604
7977
|
});
|
|
7605
7978
|
if (enabledEntities.length === 0) {
|
|
7606
7979
|
throw new Error(
|
|
@@ -7609,10 +7982,14 @@ var SyncPullModule = {
|
|
|
7609
7982
|
}
|
|
7610
7983
|
for (const [entityType, module3] of enabledEntities) {
|
|
7611
7984
|
const spinner = spin(entityType);
|
|
7985
|
+
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
7986
|
+
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
7987
|
+
};
|
|
7988
|
+
const entityConfig = (_a = config2.entitiesConfig) == null ? void 0 : _a[entityType];
|
|
7612
7989
|
try {
|
|
7613
7990
|
await module3.handler({
|
|
7614
7991
|
...otherParams,
|
|
7615
|
-
state: 0,
|
|
7992
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
7616
7993
|
format: getFormat(entityType, config2),
|
|
7617
7994
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
7618
7995
|
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
@@ -7655,11 +8032,11 @@ var getFormat = (entityType, config2) => {
|
|
|
7655
8032
|
var SyncPushModule = {
|
|
7656
8033
|
command: "push",
|
|
7657
8034
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
7658
|
-
builder: (
|
|
8035
|
+
builder: (yargs28) => withConfiguration(
|
|
7659
8036
|
withApiOptions(
|
|
7660
8037
|
withProjectOptions(
|
|
7661
8038
|
withDiffOptions(
|
|
7662
|
-
|
|
8039
|
+
yargs28.option("what-if", {
|
|
7663
8040
|
alias: ["w"],
|
|
7664
8041
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
7665
8042
|
default: false,
|
|
@@ -7673,6 +8050,8 @@ var SyncPushModule = {
|
|
|
7673
8050
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
7674
8051
|
const config2 = serialization;
|
|
7675
8052
|
const enabledEntities = Object.entries({
|
|
8053
|
+
locale: LocalePushModule,
|
|
8054
|
+
asset: AssetPushModule,
|
|
7676
8055
|
category: CategoryPushModule,
|
|
7677
8056
|
dataType: DataTypePushModule,
|
|
7678
8057
|
prompt: PromptPushModule,
|
|
@@ -7688,8 +8067,7 @@ var SyncPushModule = {
|
|
|
7688
8067
|
projectMapNode: ProjectMapNodePushModule,
|
|
7689
8068
|
redirect: RedirectDefinitionPushModule,
|
|
7690
8069
|
contentType: ContentTypePushModule,
|
|
7691
|
-
entry: EntryPushModule
|
|
7692
|
-
asset: AssetPushModule
|
|
8070
|
+
entry: EntryPushModule
|
|
7693
8071
|
}).filter(([entityType]) => {
|
|
7694
8072
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7695
8073
|
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;
|
|
@@ -7753,9 +8131,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
7753
8131
|
var SyncCommand = {
|
|
7754
8132
|
command: "sync <command>",
|
|
7755
8133
|
describe: "Uniform Sync commands",
|
|
7756
|
-
builder: (
|
|
8134
|
+
builder: (yargs28) => yargs28.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
7757
8135
|
handler: () => {
|
|
7758
|
-
|
|
8136
|
+
yargs26.showHelp();
|
|
7759
8137
|
}
|
|
7760
8138
|
};
|
|
7761
8139
|
|
|
@@ -8021,7 +8399,7 @@ First found was: v${firstVersion}`;
|
|
|
8021
8399
|
|
|
8022
8400
|
// src/index.ts
|
|
8023
8401
|
dotenv.config();
|
|
8024
|
-
var yarggery =
|
|
8402
|
+
var yarggery = yargs27(hideBin(process.argv));
|
|
8025
8403
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
8026
8404
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
8027
8405
|
yarggery.option("verbose", {
|