@uniformdev/cli 19.87.0 → 19.88.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +704 -334
- 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,43 @@ 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
|
+
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
814
|
+
if (file) {
|
|
815
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
759
816
|
return;
|
|
760
817
|
}
|
|
761
818
|
const localFileName = urlToFileName(url);
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
);
|
|
819
|
+
let expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
|
|
820
|
+
let fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
765
821
|
if (!fileExistsLocally) {
|
|
766
|
-
|
|
822
|
+
const localFileName2 = legacyUrlToFileName(url);
|
|
823
|
+
expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
|
|
824
|
+
fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
825
|
+
}
|
|
826
|
+
if (!fileExistsLocally) {
|
|
827
|
+
console.warn(
|
|
828
|
+
`Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
829
|
+
);
|
|
767
830
|
return;
|
|
768
831
|
}
|
|
769
|
-
const fileBuffer = await fsj.readAsync(
|
|
770
|
-
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName),
|
|
771
|
-
"buffer"
|
|
772
|
-
);
|
|
832
|
+
const fileBuffer = await fsj.readAsync(expectedFilePath, "buffer");
|
|
773
833
|
if (!fileBuffer) {
|
|
774
834
|
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
775
835
|
return;
|
|
@@ -807,16 +867,16 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
807
867
|
return;
|
|
808
868
|
}
|
|
809
869
|
const checkForFile = async () => {
|
|
810
|
-
const
|
|
811
|
-
if (!
|
|
870
|
+
const file2 = await options.fileClient.get({ id });
|
|
871
|
+
if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
|
|
812
872
|
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
813
873
|
return checkForFile();
|
|
814
874
|
}
|
|
815
|
-
return
|
|
875
|
+
return file2.url;
|
|
816
876
|
};
|
|
817
877
|
const abortTimeout = setTimeout(() => {
|
|
818
|
-
throw new Error(`Failed to upload file ${url}`);
|
|
819
|
-
},
|
|
878
|
+
throw new Error(`Failed to upload file ${url} (upload timed out)`);
|
|
879
|
+
}, 3e4);
|
|
820
880
|
const uploadedFileUrl = await checkForFile();
|
|
821
881
|
clearTimeout(abortTimeout);
|
|
822
882
|
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
@@ -831,19 +891,19 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
831
891
|
};
|
|
832
892
|
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
833
893
|
let objectAsString = JSON.stringify(object);
|
|
834
|
-
const uniformFileUrlMatches = objectAsString
|
|
835
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
836
|
-
);
|
|
894
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
837
895
|
if (uniformFileUrlMatches) {
|
|
838
896
|
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
839
897
|
for (const match of uniformFileUrlMatches) {
|
|
840
898
|
const url = match[1];
|
|
841
899
|
const hash = urlToHash(url);
|
|
900
|
+
const legacyHash = legacyUrlToHash(url);
|
|
842
901
|
fileUrlReplacementQueue.add(async () => {
|
|
843
902
|
try {
|
|
844
903
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
845
904
|
options.fileClient.get({ url }).catch(() => null),
|
|
846
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
905
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
906
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
847
907
|
]);
|
|
848
908
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
849
909
|
if (!file) {
|
|
@@ -858,19 +918,74 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
858
918
|
}
|
|
859
919
|
return JSON.parse(objectAsString);
|
|
860
920
|
};
|
|
921
|
+
var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
|
|
922
|
+
let sourceObjectAsString = JSON.stringify(sourceObject);
|
|
923
|
+
const targetObjectAsString = JSON.stringify(targetObject);
|
|
924
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
|
|
925
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
926
|
+
if (uniformFileUrlMatches) {
|
|
927
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
928
|
+
for (const match of uniformFileUrlMatches) {
|
|
929
|
+
const url = match[1];
|
|
930
|
+
fileUrlReplacementQueue.add(async () => {
|
|
931
|
+
try {
|
|
932
|
+
const localFileName = urlToFileName(url);
|
|
933
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
934
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
935
|
+
);
|
|
936
|
+
if (fileExistsLocally) {
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
const file = await options.fileClient.get({ url }).catch(() => null);
|
|
940
|
+
if (!file || !file.sourceId) {
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
const originalPartialPath = hashToPartialPathname(file.sourceId);
|
|
944
|
+
if (!originalPartialPath) {
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
|
|
948
|
+
if (!originalUrl) {
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
|
|
952
|
+
} catch {
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
await fileUrlReplacementQueue.onIdle();
|
|
957
|
+
}
|
|
958
|
+
return JSON.parse(sourceObjectAsString);
|
|
959
|
+
};
|
|
861
960
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
862
|
-
var _a
|
|
863
|
-
|
|
864
|
-
|
|
961
|
+
var _a;
|
|
962
|
+
if (!asset.asset.fields) {
|
|
963
|
+
return asset;
|
|
964
|
+
}
|
|
965
|
+
const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
|
|
966
|
+
if (!fileUrl) {
|
|
865
967
|
return asset;
|
|
866
968
|
}
|
|
867
969
|
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
868
970
|
if (!file) {
|
|
869
971
|
return asset;
|
|
870
972
|
}
|
|
871
|
-
asset.asset.fields.file
|
|
973
|
+
asset.asset.fields.file = {
|
|
974
|
+
type: "file",
|
|
975
|
+
value: file.id
|
|
976
|
+
};
|
|
872
977
|
return asset;
|
|
873
978
|
};
|
|
979
|
+
var legacyUrlToHash = (url) => {
|
|
980
|
+
const hash = createHash("sha256");
|
|
981
|
+
hash.update(url);
|
|
982
|
+
return hash.digest("hex");
|
|
983
|
+
};
|
|
984
|
+
var legacyUrlToFileName = (url) => {
|
|
985
|
+
const fileName = legacyUrlToHash(url);
|
|
986
|
+
const fileExtension = urlToFileExtension(url);
|
|
987
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
988
|
+
};
|
|
874
989
|
|
|
875
990
|
// src/commands/canvas/assetEngineDataSource.ts
|
|
876
991
|
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
@@ -895,8 +1010,8 @@ function prepCompositionForDisk(composition) {
|
|
|
895
1010
|
delete prepped.state;
|
|
896
1011
|
return prepped;
|
|
897
1012
|
}
|
|
898
|
-
function withStateOptions(
|
|
899
|
-
return
|
|
1013
|
+
function withStateOptions(yargs28) {
|
|
1014
|
+
return yargs28.option("state", {
|
|
900
1015
|
type: "string",
|
|
901
1016
|
describe: `Composition state to fetch.`,
|
|
902
1017
|
choices: ["preview", "published"],
|
|
@@ -962,11 +1077,11 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
962
1077
|
var AssetPullModule = {
|
|
963
1078
|
command: "pull <directory>",
|
|
964
1079
|
describe: "Pulls all assets to local files in a directory",
|
|
965
|
-
builder: (
|
|
1080
|
+
builder: (yargs28) => withConfiguration(
|
|
966
1081
|
withApiOptions(
|
|
967
1082
|
withProjectOptions(
|
|
968
1083
|
withDiffOptions(
|
|
969
|
-
|
|
1084
|
+
yargs28.positional("directory", {
|
|
970
1085
|
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
1086
|
type: "string"
|
|
972
1087
|
}).option("format", {
|
|
@@ -1009,6 +1124,7 @@ var AssetPullModule = {
|
|
|
1009
1124
|
fetch: fetch3,
|
|
1010
1125
|
projectId
|
|
1011
1126
|
});
|
|
1127
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1012
1128
|
const source = createAssetEngineDataSource({ client });
|
|
1013
1129
|
let target;
|
|
1014
1130
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1050,14 +1166,27 @@ var AssetPullModule = {
|
|
|
1050
1166
|
whatIf,
|
|
1051
1167
|
allowEmptySource: true,
|
|
1052
1168
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1053
|
-
onBeforeCompareObjects: async (sourceObject) => {
|
|
1169
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1170
|
+
var _a, _b;
|
|
1054
1171
|
delete sourceObject.object.asset._author;
|
|
1055
|
-
|
|
1172
|
+
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
1173
|
+
sourceObject,
|
|
1174
|
+
targetObject,
|
|
1175
|
+
{
|
|
1176
|
+
directory,
|
|
1177
|
+
fileClient
|
|
1178
|
+
}
|
|
1179
|
+
);
|
|
1180
|
+
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) {
|
|
1181
|
+
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1182
|
+
}
|
|
1183
|
+
return sourceObjectWithPotentiallySwappedUrl;
|
|
1056
1184
|
},
|
|
1057
1185
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1058
1186
|
delete sourceObject.object.asset._author;
|
|
1059
1187
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1060
|
-
directory
|
|
1188
|
+
directory,
|
|
1189
|
+
fileClient
|
|
1061
1190
|
});
|
|
1062
1191
|
}
|
|
1063
1192
|
});
|
|
@@ -1066,15 +1195,15 @@ var AssetPullModule = {
|
|
|
1066
1195
|
|
|
1067
1196
|
// src/commands/canvas/commands/asset/push.ts
|
|
1068
1197
|
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1069
|
-
import { UncachedFileClient } from "@uniformdev/files";
|
|
1198
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1070
1199
|
var AssetPushModule = {
|
|
1071
1200
|
command: "push <directory>",
|
|
1072
1201
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1073
|
-
builder: (
|
|
1202
|
+
builder: (yargs28) => withConfiguration(
|
|
1074
1203
|
withApiOptions(
|
|
1075
1204
|
withProjectOptions(
|
|
1076
1205
|
withDiffOptions(
|
|
1077
|
-
|
|
1206
|
+
yargs28.positional("directory", {
|
|
1078
1207
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1079
1208
|
type: "string"
|
|
1080
1209
|
}).option("what-if", {
|
|
@@ -1127,7 +1256,7 @@ var AssetPushModule = {
|
|
|
1127
1256
|
});
|
|
1128
1257
|
}
|
|
1129
1258
|
const target = createAssetEngineDataSource({ client });
|
|
1130
|
-
const fileClient = new
|
|
1259
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1131
1260
|
await syncEngine({
|
|
1132
1261
|
source,
|
|
1133
1262
|
target,
|
|
@@ -1172,9 +1301,9 @@ var AssetRemoveModule = {
|
|
|
1172
1301
|
command: "remove <id>",
|
|
1173
1302
|
aliases: ["delete", "rm"],
|
|
1174
1303
|
describe: "Delete an asset",
|
|
1175
|
-
builder: (
|
|
1304
|
+
builder: (yargs28) => withConfiguration(
|
|
1176
1305
|
withApiOptions(
|
|
1177
|
-
withProjectOptions(
|
|
1306
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1178
1307
|
)
|
|
1179
1308
|
),
|
|
1180
1309
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -1190,10 +1319,10 @@ var AssetUpdateModule = {
|
|
|
1190
1319
|
command: "update <filename>",
|
|
1191
1320
|
aliases: ["put"],
|
|
1192
1321
|
describe: "Insert or update an asset",
|
|
1193
|
-
builder: (
|
|
1322
|
+
builder: (yargs28) => withConfiguration(
|
|
1194
1323
|
withApiOptions(
|
|
1195
1324
|
withProjectOptions(
|
|
1196
|
-
|
|
1325
|
+
yargs28.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1197
1326
|
)
|
|
1198
1327
|
)
|
|
1199
1328
|
),
|
|
@@ -1209,7 +1338,7 @@ var AssetUpdateModule = {
|
|
|
1209
1338
|
var AssetModule = {
|
|
1210
1339
|
command: "asset <command>",
|
|
1211
1340
|
describe: "Commands for Assets",
|
|
1212
|
-
builder: (
|
|
1341
|
+
builder: (yargs28) => yargs28.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1213
1342
|
handler: () => {
|
|
1214
1343
|
yargs.help();
|
|
1215
1344
|
}
|
|
@@ -1223,11 +1352,11 @@ import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
|
1223
1352
|
var CategoryGetModule = {
|
|
1224
1353
|
command: "get <id>",
|
|
1225
1354
|
describe: "Fetch a category",
|
|
1226
|
-
builder: (
|
|
1355
|
+
builder: (yargs28) => withConfiguration(
|
|
1227
1356
|
withFormatOptions(
|
|
1228
1357
|
withApiOptions(
|
|
1229
1358
|
withProjectOptions(
|
|
1230
|
-
|
|
1359
|
+
yargs28.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1231
1360
|
)
|
|
1232
1361
|
)
|
|
1233
1362
|
)
|
|
@@ -1252,7 +1381,7 @@ var CategoryListModule = {
|
|
|
1252
1381
|
command: "list",
|
|
1253
1382
|
describe: "List categories",
|
|
1254
1383
|
aliases: ["ls"],
|
|
1255
|
-
builder: (
|
|
1384
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28.options({}))))),
|
|
1256
1385
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1257
1386
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1258
1387
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1301,11 +1430,11 @@ function createCategoriesEngineDataSource({
|
|
|
1301
1430
|
var CategoryPullModule = {
|
|
1302
1431
|
command: "pull <directory>",
|
|
1303
1432
|
describe: "Pulls all categories to local files in a directory",
|
|
1304
|
-
builder: (
|
|
1433
|
+
builder: (yargs28) => withConfiguration(
|
|
1305
1434
|
withApiOptions(
|
|
1306
1435
|
withProjectOptions(
|
|
1307
1436
|
withDiffOptions(
|
|
1308
|
-
|
|
1437
|
+
yargs28.positional("directory", {
|
|
1309
1438
|
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
1439
|
type: "string"
|
|
1311
1440
|
}).option("format", {
|
|
@@ -1381,11 +1510,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1381
1510
|
var CategoryPushModule = {
|
|
1382
1511
|
command: "push <directory>",
|
|
1383
1512
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1384
|
-
builder: (
|
|
1513
|
+
builder: (yargs28) => withConfiguration(
|
|
1385
1514
|
withApiOptions(
|
|
1386
1515
|
withProjectOptions(
|
|
1387
1516
|
withDiffOptions(
|
|
1388
|
-
|
|
1517
|
+
yargs28.positional("directory", {
|
|
1389
1518
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1390
1519
|
type: "string"
|
|
1391
1520
|
}).option("what-if", {
|
|
@@ -1449,10 +1578,10 @@ var CategoryRemoveModule = {
|
|
|
1449
1578
|
command: "remove <id>",
|
|
1450
1579
|
aliases: ["delete", "rm"],
|
|
1451
1580
|
describe: "Delete a category",
|
|
1452
|
-
builder: (
|
|
1581
|
+
builder: (yargs28) => withConfiguration(
|
|
1453
1582
|
withApiOptions(
|
|
1454
1583
|
withProjectOptions(
|
|
1455
|
-
|
|
1584
|
+
yargs28.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1456
1585
|
)
|
|
1457
1586
|
)
|
|
1458
1587
|
),
|
|
@@ -1469,10 +1598,10 @@ var CategoryUpdateModule = {
|
|
|
1469
1598
|
command: "update <filename>",
|
|
1470
1599
|
aliases: ["put"],
|
|
1471
1600
|
describe: "Insert or update a category",
|
|
1472
|
-
builder: (
|
|
1601
|
+
builder: (yargs28) => withConfiguration(
|
|
1473
1602
|
withApiOptions(
|
|
1474
1603
|
withProjectOptions(
|
|
1475
|
-
|
|
1604
|
+
yargs28.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1476
1605
|
)
|
|
1477
1606
|
)
|
|
1478
1607
|
),
|
|
@@ -1489,7 +1618,7 @@ var CategoryModule = {
|
|
|
1489
1618
|
command: "category <command>",
|
|
1490
1619
|
aliases: ["cat"],
|
|
1491
1620
|
describe: "Commands for Canvas categories",
|
|
1492
|
-
builder: (
|
|
1621
|
+
builder: (yargs28) => yargs28.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1493
1622
|
handler: () => {
|
|
1494
1623
|
yargs2.help();
|
|
1495
1624
|
}
|
|
@@ -1510,11 +1639,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1510
1639
|
var ComponentGetModule = {
|
|
1511
1640
|
command: "get <id>",
|
|
1512
1641
|
describe: "Fetch a component definition",
|
|
1513
|
-
builder: (
|
|
1642
|
+
builder: (yargs28) => withConfiguration(
|
|
1514
1643
|
withFormatOptions(
|
|
1515
1644
|
withApiOptions(
|
|
1516
1645
|
withProjectOptions(
|
|
1517
|
-
|
|
1646
|
+
yargs28.positional("id", {
|
|
1518
1647
|
demandOption: true,
|
|
1519
1648
|
describe: "Component definition public ID to fetch"
|
|
1520
1649
|
})
|
|
@@ -1548,11 +1677,11 @@ var ComponentListModule = {
|
|
|
1548
1677
|
command: "list",
|
|
1549
1678
|
describe: "List component definitions",
|
|
1550
1679
|
aliases: ["ls"],
|
|
1551
|
-
builder: (
|
|
1680
|
+
builder: (yargs28) => withConfiguration(
|
|
1552
1681
|
withFormatOptions(
|
|
1553
1682
|
withApiOptions(
|
|
1554
1683
|
withProjectOptions(
|
|
1555
|
-
|
|
1684
|
+
yargs28.options({
|
|
1556
1685
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1557
1686
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1558
1687
|
})
|
|
@@ -1607,11 +1736,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1607
1736
|
var ComponentPullModule = {
|
|
1608
1737
|
command: "pull <directory>",
|
|
1609
1738
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1610
|
-
builder: (
|
|
1739
|
+
builder: (yargs28) => withConfiguration(
|
|
1611
1740
|
withApiOptions(
|
|
1612
1741
|
withProjectOptions(
|
|
1613
1742
|
withDiffOptions(
|
|
1614
|
-
|
|
1743
|
+
yargs28.positional("directory", {
|
|
1615
1744
|
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
1745
|
type: "string"
|
|
1617
1746
|
}).option("format", {
|
|
@@ -1688,11 +1817,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1688
1817
|
var ComponentPushModule = {
|
|
1689
1818
|
command: "push <directory>",
|
|
1690
1819
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1691
|
-
builder: (
|
|
1820
|
+
builder: (yargs28) => withConfiguration(
|
|
1692
1821
|
withApiOptions(
|
|
1693
1822
|
withProjectOptions(
|
|
1694
1823
|
withDiffOptions(
|
|
1695
|
-
|
|
1824
|
+
yargs28.positional("directory", {
|
|
1696
1825
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1697
1826
|
type: "string"
|
|
1698
1827
|
}).option("what-if", {
|
|
@@ -1757,10 +1886,10 @@ var ComponentRemoveModule = {
|
|
|
1757
1886
|
command: "remove <id>",
|
|
1758
1887
|
aliases: ["delete", "rm"],
|
|
1759
1888
|
describe: "Delete a component definition",
|
|
1760
|
-
builder: (
|
|
1889
|
+
builder: (yargs28) => withConfiguration(
|
|
1761
1890
|
withApiOptions(
|
|
1762
1891
|
withProjectOptions(
|
|
1763
|
-
|
|
1892
|
+
yargs28.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1764
1893
|
)
|
|
1765
1894
|
)
|
|
1766
1895
|
),
|
|
@@ -1777,10 +1906,10 @@ var ComponentUpdateModule = {
|
|
|
1777
1906
|
command: "update <filename>",
|
|
1778
1907
|
aliases: ["put"],
|
|
1779
1908
|
describe: "Insert or update a component definition",
|
|
1780
|
-
builder: (
|
|
1909
|
+
builder: (yargs28) => withConfiguration(
|
|
1781
1910
|
withApiOptions(
|
|
1782
1911
|
withProjectOptions(
|
|
1783
|
-
|
|
1912
|
+
yargs28.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1784
1913
|
)
|
|
1785
1914
|
)
|
|
1786
1915
|
),
|
|
@@ -1797,7 +1926,7 @@ var ComponentModule = {
|
|
|
1797
1926
|
command: "component <command>",
|
|
1798
1927
|
aliases: ["def"],
|
|
1799
1928
|
describe: "Commands for Canvas component definitions",
|
|
1800
|
-
builder: (
|
|
1929
|
+
builder: (yargs28) => yargs28.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1801
1930
|
handler: () => {
|
|
1802
1931
|
yargs3.help();
|
|
1803
1932
|
}
|
|
@@ -1811,12 +1940,12 @@ import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canva
|
|
|
1811
1940
|
var CompositionGetModule = {
|
|
1812
1941
|
command: "get <id>",
|
|
1813
1942
|
describe: "Fetch a composition",
|
|
1814
|
-
builder: (
|
|
1943
|
+
builder: (yargs28) => withFormatOptions(
|
|
1815
1944
|
withConfiguration(
|
|
1816
1945
|
withApiOptions(
|
|
1817
1946
|
withProjectOptions(
|
|
1818
1947
|
withStateOptions(
|
|
1819
|
-
|
|
1948
|
+
yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1820
1949
|
resolvePatterns: {
|
|
1821
1950
|
type: "boolean",
|
|
1822
1951
|
default: false,
|
|
@@ -1887,12 +2016,12 @@ var CompositionListModule = {
|
|
|
1887
2016
|
command: "list",
|
|
1888
2017
|
describe: "List compositions",
|
|
1889
2018
|
aliases: ["ls"],
|
|
1890
|
-
builder: (
|
|
2019
|
+
builder: (yargs28) => withFormatOptions(
|
|
1891
2020
|
withConfiguration(
|
|
1892
2021
|
withApiOptions(
|
|
1893
2022
|
withProjectOptions(
|
|
1894
2023
|
withStateOptions(
|
|
1895
|
-
|
|
2024
|
+
yargs28.options({
|
|
1896
2025
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1897
2026
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1898
2027
|
resolvePatterns: {
|
|
@@ -2013,11 +2142,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
2013
2142
|
var CompositionPublishModule = {
|
|
2014
2143
|
command: "publish [ids]",
|
|
2015
2144
|
describe: "Publishes composition(s)",
|
|
2016
|
-
builder: (
|
|
2145
|
+
builder: (yargs28) => withConfiguration(
|
|
2017
2146
|
withApiOptions(
|
|
2018
2147
|
withProjectOptions(
|
|
2019
2148
|
withDiffOptions(
|
|
2020
|
-
|
|
2149
|
+
yargs28.positional("ids", {
|
|
2021
2150
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2022
2151
|
type: "string"
|
|
2023
2152
|
}).option("all", {
|
|
@@ -2089,15 +2218,16 @@ var CompositionPublishModule = {
|
|
|
2089
2218
|
|
|
2090
2219
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2091
2220
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
2221
|
+
import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
2092
2222
|
var CompositionPullModule = {
|
|
2093
2223
|
command: "pull <directory>",
|
|
2094
2224
|
describe: "Pulls all compositions to local files in a directory",
|
|
2095
|
-
builder: (
|
|
2225
|
+
builder: (yargs28) => withConfiguration(
|
|
2096
2226
|
withApiOptions(
|
|
2097
2227
|
withProjectOptions(
|
|
2098
2228
|
withStateOptions(
|
|
2099
2229
|
withDiffOptions(
|
|
2100
|
-
|
|
2230
|
+
yargs28.positional("directory", {
|
|
2101
2231
|
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
2232
|
type: "string"
|
|
2103
2233
|
}).option("format", {
|
|
@@ -2148,6 +2278,7 @@ var CompositionPullModule = {
|
|
|
2148
2278
|
}) => {
|
|
2149
2279
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2150
2280
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2281
|
+
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2151
2282
|
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2152
2283
|
const isPackage = isPathAPackageFile(directory);
|
|
2153
2284
|
let target;
|
|
@@ -2177,9 +2308,16 @@ var CompositionPullModule = {
|
|
|
2177
2308
|
whatIf,
|
|
2178
2309
|
allowEmptySource: true,
|
|
2179
2310
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2311
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
2312
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
2313
|
+
directory,
|
|
2314
|
+
fileClient
|
|
2315
|
+
});
|
|
2316
|
+
},
|
|
2180
2317
|
onBeforeWriteObject: async (sourceObject) => {
|
|
2181
2318
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
2182
|
-
directory
|
|
2319
|
+
directory,
|
|
2320
|
+
fileClient
|
|
2183
2321
|
});
|
|
2184
2322
|
}
|
|
2185
2323
|
});
|
|
@@ -2188,16 +2326,16 @@ var CompositionPullModule = {
|
|
|
2188
2326
|
|
|
2189
2327
|
// src/commands/canvas/commands/composition/push.ts
|
|
2190
2328
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2191
|
-
import { UncachedFileClient as
|
|
2329
|
+
import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
2192
2330
|
var CompositionPushModule = {
|
|
2193
2331
|
command: "push <directory>",
|
|
2194
2332
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2195
|
-
builder: (
|
|
2333
|
+
builder: (yargs28) => withConfiguration(
|
|
2196
2334
|
withApiOptions(
|
|
2197
2335
|
withProjectOptions(
|
|
2198
2336
|
withStateOptions(
|
|
2199
2337
|
withDiffOptions(
|
|
2200
|
-
|
|
2338
|
+
yargs28.positional("directory", {
|
|
2201
2339
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2202
2340
|
type: "string"
|
|
2203
2341
|
}).option("what-if", {
|
|
@@ -2258,7 +2396,7 @@ var CompositionPushModule = {
|
|
|
2258
2396
|
});
|
|
2259
2397
|
}
|
|
2260
2398
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2261
|
-
const fileClient = new
|
|
2399
|
+
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2262
2400
|
await syncEngine({
|
|
2263
2401
|
source,
|
|
2264
2402
|
target,
|
|
@@ -2286,10 +2424,10 @@ var CompositionRemoveModule = {
|
|
|
2286
2424
|
command: "remove <id>",
|
|
2287
2425
|
aliases: ["delete", "rm"],
|
|
2288
2426
|
describe: "Delete a composition",
|
|
2289
|
-
builder: (
|
|
2427
|
+
builder: (yargs28) => withConfiguration(
|
|
2290
2428
|
withApiOptions(
|
|
2291
2429
|
withProjectOptions(
|
|
2292
|
-
|
|
2430
|
+
yargs28.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2293
2431
|
)
|
|
2294
2432
|
)
|
|
2295
2433
|
),
|
|
@@ -2306,10 +2444,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2306
2444
|
var CompositionUnpublishModule = {
|
|
2307
2445
|
command: "unpublish [ids]",
|
|
2308
2446
|
describe: "Unpublish a composition(s)",
|
|
2309
|
-
builder: (
|
|
2447
|
+
builder: (yargs28) => withConfiguration(
|
|
2310
2448
|
withApiOptions(
|
|
2311
2449
|
withProjectOptions(
|
|
2312
|
-
|
|
2450
|
+
yargs28.positional("ids", {
|
|
2313
2451
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2314
2452
|
type: "string"
|
|
2315
2453
|
}).option("all", {
|
|
@@ -2403,11 +2541,11 @@ var CompositionUpdateModule = {
|
|
|
2403
2541
|
command: "update <filename>",
|
|
2404
2542
|
aliases: ["put"],
|
|
2405
2543
|
describe: "Insert or update a composition",
|
|
2406
|
-
builder: (
|
|
2544
|
+
builder: (yargs28) => withConfiguration(
|
|
2407
2545
|
withApiOptions(
|
|
2408
2546
|
withProjectOptions(
|
|
2409
2547
|
withStateOptions(
|
|
2410
|
-
|
|
2548
|
+
yargs28.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2411
2549
|
)
|
|
2412
2550
|
)
|
|
2413
2551
|
)
|
|
@@ -2425,7 +2563,7 @@ var CompositionModule = {
|
|
|
2425
2563
|
command: "composition <command>",
|
|
2426
2564
|
describe: "Commands for Canvas compositions",
|
|
2427
2565
|
aliases: ["comp"],
|
|
2428
|
-
builder: (
|
|
2566
|
+
builder: (yargs28) => yargs28.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2429
2567
|
handler: () => {
|
|
2430
2568
|
yargs4.help();
|
|
2431
2569
|
}
|
|
@@ -2439,12 +2577,12 @@ import { ContentClient } from "@uniformdev/canvas";
|
|
|
2439
2577
|
var ContentTypeGetModule = {
|
|
2440
2578
|
command: "get <id>",
|
|
2441
2579
|
describe: "Get a content type",
|
|
2442
|
-
builder: (
|
|
2580
|
+
builder: (yargs28) => withConfiguration(
|
|
2443
2581
|
withFormatOptions(
|
|
2444
2582
|
withApiOptions(
|
|
2445
2583
|
withProjectOptions(
|
|
2446
2584
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2447
|
-
|
|
2585
|
+
yargs28.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2448
2586
|
)
|
|
2449
2587
|
)
|
|
2450
2588
|
)
|
|
@@ -2466,7 +2604,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2466
2604
|
var ContentTypeListModule = {
|
|
2467
2605
|
command: "list",
|
|
2468
2606
|
describe: "List content types",
|
|
2469
|
-
builder: (
|
|
2607
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
2470
2608
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2471
2609
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2472
2610
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2513,11 +2651,11 @@ function createContentTypeEngineDataSource({
|
|
|
2513
2651
|
var ContentTypePullModule = {
|
|
2514
2652
|
command: "pull <directory>",
|
|
2515
2653
|
describe: "Pulls all content types to local files in a directory",
|
|
2516
|
-
builder: (
|
|
2654
|
+
builder: (yargs28) => withConfiguration(
|
|
2517
2655
|
withApiOptions(
|
|
2518
2656
|
withProjectOptions(
|
|
2519
2657
|
withDiffOptions(
|
|
2520
|
-
|
|
2658
|
+
yargs28.positional("directory", {
|
|
2521
2659
|
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
2660
|
type: "string"
|
|
2523
2661
|
}).option("format", {
|
|
@@ -2599,11 +2737,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2599
2737
|
var ContentTypePushModule = {
|
|
2600
2738
|
command: "push <directory>",
|
|
2601
2739
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2602
|
-
builder: (
|
|
2740
|
+
builder: (yargs28) => withConfiguration(
|
|
2603
2741
|
withApiOptions(
|
|
2604
2742
|
withProjectOptions(
|
|
2605
2743
|
withDiffOptions(
|
|
2606
|
-
|
|
2744
|
+
yargs28.positional("directory", {
|
|
2607
2745
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2608
2746
|
type: "string"
|
|
2609
2747
|
}).option("what-if", {
|
|
@@ -2673,10 +2811,10 @@ var ContentTypeRemoveModule = {
|
|
|
2673
2811
|
command: "remove <id>",
|
|
2674
2812
|
aliases: ["delete", "rm"],
|
|
2675
2813
|
describe: "Delete a content type",
|
|
2676
|
-
builder: (
|
|
2814
|
+
builder: (yargs28) => withConfiguration(
|
|
2677
2815
|
withApiOptions(
|
|
2678
2816
|
withProjectOptions(
|
|
2679
|
-
|
|
2817
|
+
yargs28.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2680
2818
|
)
|
|
2681
2819
|
)
|
|
2682
2820
|
),
|
|
@@ -2693,10 +2831,10 @@ var ContentTypeUpdateModule = {
|
|
|
2693
2831
|
command: "update <filename>",
|
|
2694
2832
|
aliases: ["put"],
|
|
2695
2833
|
describe: "Insert or update a content type",
|
|
2696
|
-
builder: (
|
|
2834
|
+
builder: (yargs28) => withConfiguration(
|
|
2697
2835
|
withApiOptions(
|
|
2698
2836
|
withProjectOptions(
|
|
2699
|
-
|
|
2837
|
+
yargs28.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2700
2838
|
)
|
|
2701
2839
|
)
|
|
2702
2840
|
),
|
|
@@ -2713,7 +2851,7 @@ var ContentTypeModule = {
|
|
|
2713
2851
|
command: "contenttype <command>",
|
|
2714
2852
|
aliases: ["ct"],
|
|
2715
2853
|
describe: "Commands for Content Types",
|
|
2716
|
-
builder: (
|
|
2854
|
+
builder: (yargs28) => yargs28.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2717
2855
|
handler: () => {
|
|
2718
2856
|
yargs5.help();
|
|
2719
2857
|
}
|
|
@@ -2728,12 +2866,12 @@ var DataTypeGetModule = {
|
|
|
2728
2866
|
command: "get <id>",
|
|
2729
2867
|
describe: "Get a data type",
|
|
2730
2868
|
aliases: ["ls"],
|
|
2731
|
-
builder: (
|
|
2869
|
+
builder: (yargs28) => withConfiguration(
|
|
2732
2870
|
withFormatOptions(
|
|
2733
2871
|
withApiOptions(
|
|
2734
2872
|
withProjectOptions(
|
|
2735
2873
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2736
|
-
|
|
2874
|
+
yargs28.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2737
2875
|
)
|
|
2738
2876
|
)
|
|
2739
2877
|
)
|
|
@@ -2756,7 +2894,7 @@ var DataTypeListModule = {
|
|
|
2756
2894
|
command: "list",
|
|
2757
2895
|
describe: "List data types",
|
|
2758
2896
|
aliases: ["ls"],
|
|
2759
|
-
builder: (
|
|
2897
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
2760
2898
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2761
2899
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2762
2900
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2805,11 +2943,11 @@ function createDataTypeEngineDataSource({
|
|
|
2805
2943
|
var DataTypePullModule = {
|
|
2806
2944
|
command: "pull <directory>",
|
|
2807
2945
|
describe: "Pulls all data types to local files in a directory",
|
|
2808
|
-
builder: (
|
|
2946
|
+
builder: (yargs28) => withConfiguration(
|
|
2809
2947
|
withApiOptions(
|
|
2810
2948
|
withProjectOptions(
|
|
2811
2949
|
withDiffOptions(
|
|
2812
|
-
|
|
2950
|
+
yargs28.positional("directory", {
|
|
2813
2951
|
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
2952
|
type: "string"
|
|
2815
2953
|
}).option("format", {
|
|
@@ -2891,11 +3029,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
2891
3029
|
var DataTypePushModule = {
|
|
2892
3030
|
command: "push <directory>",
|
|
2893
3031
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2894
|
-
builder: (
|
|
3032
|
+
builder: (yargs28) => withConfiguration(
|
|
2895
3033
|
withApiOptions(
|
|
2896
3034
|
withProjectOptions(
|
|
2897
3035
|
withDiffOptions(
|
|
2898
|
-
|
|
3036
|
+
yargs28.positional("directory", {
|
|
2899
3037
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2900
3038
|
type: "string"
|
|
2901
3039
|
}).option("what-if", {
|
|
@@ -2965,10 +3103,10 @@ var DataTypeRemoveModule = {
|
|
|
2965
3103
|
command: "remove <id>",
|
|
2966
3104
|
aliases: ["delete", "rm"],
|
|
2967
3105
|
describe: "Delete a data type",
|
|
2968
|
-
builder: (
|
|
3106
|
+
builder: (yargs28) => withConfiguration(
|
|
2969
3107
|
withApiOptions(
|
|
2970
3108
|
withProjectOptions(
|
|
2971
|
-
|
|
3109
|
+
yargs28.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2972
3110
|
)
|
|
2973
3111
|
)
|
|
2974
3112
|
),
|
|
@@ -2985,10 +3123,10 @@ var DataTypeUpdateModule = {
|
|
|
2985
3123
|
command: "update <filename>",
|
|
2986
3124
|
aliases: ["put"],
|
|
2987
3125
|
describe: "Insert or update a data type",
|
|
2988
|
-
builder: (
|
|
3126
|
+
builder: (yargs28) => withConfiguration(
|
|
2989
3127
|
withApiOptions(
|
|
2990
3128
|
withProjectOptions(
|
|
2991
|
-
|
|
3129
|
+
yargs28.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2992
3130
|
)
|
|
2993
3131
|
)
|
|
2994
3132
|
),
|
|
@@ -3005,7 +3143,7 @@ var DataTypeModule = {
|
|
|
3005
3143
|
command: "datatype <command>",
|
|
3006
3144
|
aliases: ["dt"],
|
|
3007
3145
|
describe: "Commands for Data Type definitions",
|
|
3008
|
-
builder: (
|
|
3146
|
+
builder: (yargs28) => yargs28.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
3009
3147
|
handler: () => {
|
|
3010
3148
|
yargs6.help();
|
|
3011
3149
|
}
|
|
@@ -3019,12 +3157,12 @@ import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
|
3019
3157
|
var EntryGetModule = {
|
|
3020
3158
|
command: "get <id>",
|
|
3021
3159
|
describe: "Get an entry",
|
|
3022
|
-
builder: (
|
|
3160
|
+
builder: (yargs28) => withConfiguration(
|
|
3023
3161
|
withFormatOptions(
|
|
3024
3162
|
withApiOptions(
|
|
3025
3163
|
withProjectOptions(
|
|
3026
3164
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3027
|
-
|
|
3165
|
+
yargs28.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
3028
3166
|
)
|
|
3029
3167
|
)
|
|
3030
3168
|
)
|
|
@@ -3050,7 +3188,7 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
|
3050
3188
|
var EntryListModule = {
|
|
3051
3189
|
command: "list",
|
|
3052
3190
|
describe: "List entries",
|
|
3053
|
-
builder: (
|
|
3191
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3054
3192
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3055
3193
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3056
3194
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3061,6 +3199,7 @@ var EntryListModule = {
|
|
|
3061
3199
|
|
|
3062
3200
|
// src/commands/canvas/commands/entry/pull.ts
|
|
3063
3201
|
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3202
|
+
import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
3064
3203
|
|
|
3065
3204
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3066
3205
|
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
@@ -3109,12 +3248,12 @@ function createEntryEngineDataSource({
|
|
|
3109
3248
|
var EntryPullModule = {
|
|
3110
3249
|
command: "pull <directory>",
|
|
3111
3250
|
describe: "Pulls all entries to local files in a directory",
|
|
3112
|
-
builder: (
|
|
3251
|
+
builder: (yargs28) => withConfiguration(
|
|
3113
3252
|
withApiOptions(
|
|
3114
3253
|
withProjectOptions(
|
|
3115
3254
|
withStateOptions(
|
|
3116
3255
|
withDiffOptions(
|
|
3117
|
-
|
|
3256
|
+
yargs28.positional("directory", {
|
|
3118
3257
|
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
3258
|
type: "string"
|
|
3120
3259
|
}).option("format", {
|
|
@@ -3160,6 +3299,7 @@ var EntryPullModule = {
|
|
|
3160
3299
|
projectId,
|
|
3161
3300
|
bypassCache: true
|
|
3162
3301
|
});
|
|
3302
|
+
const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3163
3303
|
const source = createEntryEngineDataSource({ client, state });
|
|
3164
3304
|
let target;
|
|
3165
3305
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3188,22 +3328,35 @@ var EntryPullModule = {
|
|
|
3188
3328
|
mode,
|
|
3189
3329
|
whatIf,
|
|
3190
3330
|
allowEmptySource: true,
|
|
3191
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3331
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3332
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
3333
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
3334
|
+
directory,
|
|
3335
|
+
fileClient
|
|
3336
|
+
});
|
|
3337
|
+
},
|
|
3338
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3339
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
3340
|
+
directory,
|
|
3341
|
+
fileClient
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3192
3344
|
});
|
|
3193
3345
|
}
|
|
3194
3346
|
};
|
|
3195
3347
|
|
|
3196
3348
|
// src/commands/canvas/commands/entry/push.ts
|
|
3197
3349
|
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
3350
|
+
import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
3198
3351
|
var EntryPushModule = {
|
|
3199
3352
|
command: "push <directory>",
|
|
3200
3353
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3201
|
-
builder: (
|
|
3354
|
+
builder: (yargs28) => withConfiguration(
|
|
3202
3355
|
withApiOptions(
|
|
3203
3356
|
withProjectOptions(
|
|
3204
3357
|
withStateOptions(
|
|
3205
3358
|
withDiffOptions(
|
|
3206
|
-
|
|
3359
|
+
yargs28.positional("directory", {
|
|
3207
3360
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3208
3361
|
type: "string"
|
|
3209
3362
|
}).option("what-if", {
|
|
@@ -3259,12 +3412,24 @@ var EntryPushModule = {
|
|
|
3259
3412
|
});
|
|
3260
3413
|
}
|
|
3261
3414
|
const target = createEntryEngineDataSource({ client, state });
|
|
3415
|
+
const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3262
3416
|
await syncEngine({
|
|
3263
3417
|
source,
|
|
3264
3418
|
target,
|
|
3265
3419
|
mode,
|
|
3266
3420
|
whatIf,
|
|
3267
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3421
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3422
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
3423
|
+
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
3424
|
+
fileClient
|
|
3425
|
+
});
|
|
3426
|
+
},
|
|
3427
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3428
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
3429
|
+
directory,
|
|
3430
|
+
fileClient
|
|
3431
|
+
});
|
|
3432
|
+
}
|
|
3268
3433
|
});
|
|
3269
3434
|
}
|
|
3270
3435
|
};
|
|
@@ -3275,10 +3440,10 @@ var EntryRemoveModule = {
|
|
|
3275
3440
|
command: "remove <id>",
|
|
3276
3441
|
aliases: ["delete", "rm"],
|
|
3277
3442
|
describe: "Delete an entry",
|
|
3278
|
-
builder: (
|
|
3443
|
+
builder: (yargs28) => withConfiguration(
|
|
3279
3444
|
withApiOptions(
|
|
3280
3445
|
withProjectOptions(
|
|
3281
|
-
|
|
3446
|
+
yargs28.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3282
3447
|
)
|
|
3283
3448
|
)
|
|
3284
3449
|
),
|
|
@@ -3295,10 +3460,10 @@ var EntryUpdateModule = {
|
|
|
3295
3460
|
command: "update <filename>",
|
|
3296
3461
|
aliases: ["put"],
|
|
3297
3462
|
describe: "Insert or update an entry",
|
|
3298
|
-
builder: (
|
|
3463
|
+
builder: (yargs28) => withConfiguration(
|
|
3299
3464
|
withApiOptions(
|
|
3300
3465
|
withProjectOptions(
|
|
3301
|
-
|
|
3466
|
+
yargs28.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
3302
3467
|
)
|
|
3303
3468
|
)
|
|
3304
3469
|
),
|
|
@@ -3314,15 +3479,218 @@ var EntryUpdateModule = {
|
|
|
3314
3479
|
var EntryModule = {
|
|
3315
3480
|
command: "entry <command>",
|
|
3316
3481
|
describe: "Commands for Entries",
|
|
3317
|
-
builder: (
|
|
3482
|
+
builder: (yargs28) => yargs28.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
3318
3483
|
handler: () => {
|
|
3319
3484
|
yargs7.help();
|
|
3320
3485
|
}
|
|
3321
3486
|
};
|
|
3322
3487
|
|
|
3323
|
-
// src/commands/canvas/commands/
|
|
3488
|
+
// src/commands/canvas/commands/locale.ts
|
|
3324
3489
|
import yargs8 from "yargs";
|
|
3325
3490
|
|
|
3491
|
+
// src/commands/canvas/commands/locale/pull.ts
|
|
3492
|
+
import { LocaleClient } from "@uniformdev/canvas";
|
|
3493
|
+
|
|
3494
|
+
// src/commands/canvas/localesEngineDataSource.ts
|
|
3495
|
+
function createLocaleEngineDataSource({
|
|
3496
|
+
client
|
|
3497
|
+
}) {
|
|
3498
|
+
async function* getObjects() {
|
|
3499
|
+
const locales = (await client.get()).results;
|
|
3500
|
+
for await (const locale of locales) {
|
|
3501
|
+
const result = {
|
|
3502
|
+
id: locale.locale,
|
|
3503
|
+
displayName: locale.displayName,
|
|
3504
|
+
providerId: locale.locale,
|
|
3505
|
+
object: locale
|
|
3506
|
+
};
|
|
3507
|
+
yield result;
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
return {
|
|
3511
|
+
objects: getObjects(),
|
|
3512
|
+
deleteObject: async (providerId) => {
|
|
3513
|
+
await client.remove({ locale: providerId });
|
|
3514
|
+
},
|
|
3515
|
+
writeObject: async (object) => {
|
|
3516
|
+
await client.upsert({
|
|
3517
|
+
locale: object.object
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
};
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
// src/commands/canvas/commands/locale/pull.ts
|
|
3524
|
+
var LocalePullModule = {
|
|
3525
|
+
command: "pull <directory>",
|
|
3526
|
+
describe: "Pulls all locales to local files in a directory",
|
|
3527
|
+
builder: (yargs28) => withConfiguration(
|
|
3528
|
+
withApiOptions(
|
|
3529
|
+
withProjectOptions(
|
|
3530
|
+
withDiffOptions(
|
|
3531
|
+
yargs28.positional("directory", {
|
|
3532
|
+
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.",
|
|
3533
|
+
type: "string"
|
|
3534
|
+
}).option("format", {
|
|
3535
|
+
alias: ["f"],
|
|
3536
|
+
describe: "Output format",
|
|
3537
|
+
default: "yaml",
|
|
3538
|
+
choices: ["yaml", "json"],
|
|
3539
|
+
type: "string"
|
|
3540
|
+
}).option("what-if", {
|
|
3541
|
+
alias: ["w"],
|
|
3542
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
3543
|
+
default: false,
|
|
3544
|
+
type: "boolean"
|
|
3545
|
+
}).option("mode", {
|
|
3546
|
+
alias: ["m"],
|
|
3547
|
+
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',
|
|
3548
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3549
|
+
default: "mirror",
|
|
3550
|
+
type: "string"
|
|
3551
|
+
})
|
|
3552
|
+
)
|
|
3553
|
+
)
|
|
3554
|
+
)
|
|
3555
|
+
),
|
|
3556
|
+
handler: async ({
|
|
3557
|
+
apiHost,
|
|
3558
|
+
apiKey,
|
|
3559
|
+
proxy,
|
|
3560
|
+
directory,
|
|
3561
|
+
format,
|
|
3562
|
+
mode,
|
|
3563
|
+
whatIf,
|
|
3564
|
+
project: projectId,
|
|
3565
|
+
diff: diffMode
|
|
3566
|
+
}) => {
|
|
3567
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
3568
|
+
const client = new LocaleClient({
|
|
3569
|
+
apiKey,
|
|
3570
|
+
apiHost,
|
|
3571
|
+
fetch: fetch3,
|
|
3572
|
+
projectId,
|
|
3573
|
+
bypassCache: true
|
|
3574
|
+
});
|
|
3575
|
+
const source = createLocaleEngineDataSource({ client });
|
|
3576
|
+
let target;
|
|
3577
|
+
const isPackage = isPathAPackageFile(directory);
|
|
3578
|
+
if (isPackage) {
|
|
3579
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
3580
|
+
target = await createArraySyncEngineDataSource({
|
|
3581
|
+
objects: packageContents.locales ?? [],
|
|
3582
|
+
selectIdentifier: (i) => i.locale,
|
|
3583
|
+
selectDisplayName: (i) => i.displayName,
|
|
3584
|
+
onSyncComplete: async (_, synced) => {
|
|
3585
|
+
packageContents.locales = synced;
|
|
3586
|
+
writeCanvasPackage(directory, packageContents);
|
|
3587
|
+
}
|
|
3588
|
+
});
|
|
3589
|
+
} else {
|
|
3590
|
+
target = await createFileSyncEngineDataSource({
|
|
3591
|
+
directory,
|
|
3592
|
+
selectIdentifier: (i) => i.locale,
|
|
3593
|
+
selectDisplayName: (i) => i.displayName,
|
|
3594
|
+
format
|
|
3595
|
+
});
|
|
3596
|
+
}
|
|
3597
|
+
await syncEngine({
|
|
3598
|
+
source,
|
|
3599
|
+
target,
|
|
3600
|
+
mode,
|
|
3601
|
+
whatIf,
|
|
3602
|
+
allowEmptySource: true,
|
|
3603
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3604
|
+
});
|
|
3605
|
+
}
|
|
3606
|
+
};
|
|
3607
|
+
|
|
3608
|
+
// src/commands/canvas/commands/locale/push.ts
|
|
3609
|
+
import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
|
|
3610
|
+
var LocalePushModule = {
|
|
3611
|
+
command: "push <directory>",
|
|
3612
|
+
describe: "Pushes all locales from files in a directory to Uniform",
|
|
3613
|
+
builder: (yargs28) => withConfiguration(
|
|
3614
|
+
withApiOptions(
|
|
3615
|
+
withProjectOptions(
|
|
3616
|
+
withDiffOptions(
|
|
3617
|
+
yargs28.positional("directory", {
|
|
3618
|
+
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
3619
|
+
type: "string"
|
|
3620
|
+
}).option("what-if", {
|
|
3621
|
+
alias: ["w"],
|
|
3622
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
3623
|
+
default: false,
|
|
3624
|
+
type: "boolean"
|
|
3625
|
+
}).option("mode", {
|
|
3626
|
+
alias: ["m"],
|
|
3627
|
+
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',
|
|
3628
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
3629
|
+
default: "mirror",
|
|
3630
|
+
type: "string"
|
|
3631
|
+
})
|
|
3632
|
+
)
|
|
3633
|
+
)
|
|
3634
|
+
)
|
|
3635
|
+
),
|
|
3636
|
+
handler: async ({
|
|
3637
|
+
apiHost,
|
|
3638
|
+
apiKey,
|
|
3639
|
+
proxy,
|
|
3640
|
+
directory,
|
|
3641
|
+
mode,
|
|
3642
|
+
whatIf,
|
|
3643
|
+
project: projectId,
|
|
3644
|
+
diff: diffMode
|
|
3645
|
+
}) => {
|
|
3646
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
3647
|
+
const client = new LocaleClient2({
|
|
3648
|
+
apiKey,
|
|
3649
|
+
apiHost,
|
|
3650
|
+
fetch: fetch3,
|
|
3651
|
+
projectId,
|
|
3652
|
+
bypassCache: true
|
|
3653
|
+
});
|
|
3654
|
+
let source;
|
|
3655
|
+
const isPackage = isPathAPackageFile(directory);
|
|
3656
|
+
if (isPackage) {
|
|
3657
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
3658
|
+
source = await createArraySyncEngineDataSource({
|
|
3659
|
+
objects: packageContents.locales ?? [],
|
|
3660
|
+
selectIdentifier: (locale) => locale.locale,
|
|
3661
|
+
selectDisplayName: (locale) => locale.displayName
|
|
3662
|
+
});
|
|
3663
|
+
} else {
|
|
3664
|
+
source = await createFileSyncEngineDataSource({
|
|
3665
|
+
directory,
|
|
3666
|
+
selectIdentifier: (locale) => locale.locale,
|
|
3667
|
+
selectDisplayName: (locale) => locale.displayName
|
|
3668
|
+
});
|
|
3669
|
+
}
|
|
3670
|
+
const target = createLocaleEngineDataSource({ client });
|
|
3671
|
+
await syncEngine({
|
|
3672
|
+
source,
|
|
3673
|
+
target,
|
|
3674
|
+
mode,
|
|
3675
|
+
whatIf,
|
|
3676
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
};
|
|
3680
|
+
|
|
3681
|
+
// src/commands/canvas/commands/locale.ts
|
|
3682
|
+
var LocaleModule = {
|
|
3683
|
+
command: "locale <command>",
|
|
3684
|
+
describe: "Commands for locale definitions",
|
|
3685
|
+
builder: (yargs28) => yargs28.command(LocalePullModule).command(LocalePushModule),
|
|
3686
|
+
handler: () => {
|
|
3687
|
+
yargs8.help();
|
|
3688
|
+
}
|
|
3689
|
+
};
|
|
3690
|
+
|
|
3691
|
+
// src/commands/canvas/commands/pattern.ts
|
|
3692
|
+
import yargs9 from "yargs";
|
|
3693
|
+
|
|
3326
3694
|
// src/commands/canvas/commands/pattern/get.ts
|
|
3327
3695
|
var PatternGetModule = {
|
|
3328
3696
|
...CompositionGetModule,
|
|
@@ -3333,12 +3701,12 @@ var PatternGetModule = {
|
|
|
3333
3701
|
var PatternListModule = {
|
|
3334
3702
|
...CompositionListModule,
|
|
3335
3703
|
describe: "List patterns",
|
|
3336
|
-
builder: (
|
|
3704
|
+
builder: (yargs28) => withFormatOptions(
|
|
3337
3705
|
withConfiguration(
|
|
3338
3706
|
withApiOptions(
|
|
3339
3707
|
withProjectOptions(
|
|
3340
3708
|
withStateOptions(
|
|
3341
|
-
|
|
3709
|
+
yargs28.options({
|
|
3342
3710
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3343
3711
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
3344
3712
|
resolvePatterns: {
|
|
@@ -3376,11 +3744,11 @@ var PatternListModule = {
|
|
|
3376
3744
|
var PatternPublishModule = {
|
|
3377
3745
|
...CompositionPublishModule,
|
|
3378
3746
|
describe: "Publishes pattern(s)",
|
|
3379
|
-
builder: (
|
|
3747
|
+
builder: (yargs28) => withConfiguration(
|
|
3380
3748
|
withApiOptions(
|
|
3381
3749
|
withProjectOptions(
|
|
3382
3750
|
withDiffOptions(
|
|
3383
|
-
|
|
3751
|
+
yargs28.positional("ids", {
|
|
3384
3752
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3385
3753
|
type: "string"
|
|
3386
3754
|
}).option("all", {
|
|
@@ -3418,12 +3786,12 @@ var PatternPublishModule = {
|
|
|
3418
3786
|
var PatternPullModule = {
|
|
3419
3787
|
...CompositionPullModule,
|
|
3420
3788
|
describe: "Pulls all patterns to local files in a directory",
|
|
3421
|
-
builder: (
|
|
3789
|
+
builder: (yargs28) => withConfiguration(
|
|
3422
3790
|
withApiOptions(
|
|
3423
3791
|
withProjectOptions(
|
|
3424
3792
|
withStateOptions(
|
|
3425
3793
|
withDiffOptions(
|
|
3426
|
-
|
|
3794
|
+
yargs28.positional("directory", {
|
|
3427
3795
|
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
3796
|
type: "string"
|
|
3429
3797
|
}).option("format", {
|
|
@@ -3461,12 +3829,12 @@ var PatternPullModule = {
|
|
|
3461
3829
|
var PatternPushModule = {
|
|
3462
3830
|
...CompositionPushModule,
|
|
3463
3831
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
3464
|
-
builder: (
|
|
3832
|
+
builder: (yargs28) => withConfiguration(
|
|
3465
3833
|
withApiOptions(
|
|
3466
3834
|
withProjectOptions(
|
|
3467
3835
|
withStateOptions(
|
|
3468
3836
|
withDiffOptions(
|
|
3469
|
-
|
|
3837
|
+
yargs28.positional("directory", {
|
|
3470
3838
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
3471
3839
|
type: "string"
|
|
3472
3840
|
}).option("what-if", {
|
|
@@ -3504,10 +3872,10 @@ var PatternRemoveModule = {
|
|
|
3504
3872
|
var PatternUnpublishModule = {
|
|
3505
3873
|
command: "unpublish [ids]",
|
|
3506
3874
|
describe: "Unpublish a pattern(s)",
|
|
3507
|
-
builder: (
|
|
3875
|
+
builder: (yargs28) => withConfiguration(
|
|
3508
3876
|
withApiOptions(
|
|
3509
3877
|
withProjectOptions(
|
|
3510
|
-
|
|
3878
|
+
yargs28.positional("ids", {
|
|
3511
3879
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3512
3880
|
type: "string"
|
|
3513
3881
|
}).option("all", {
|
|
@@ -3546,26 +3914,26 @@ var PatternUpdateModule = {
|
|
|
3546
3914
|
var PatternModule = {
|
|
3547
3915
|
command: "pattern <command>",
|
|
3548
3916
|
describe: "Commands for Canvas patterns",
|
|
3549
|
-
builder: (
|
|
3917
|
+
builder: (yargs28) => yargs28.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3550
3918
|
handler: () => {
|
|
3551
|
-
|
|
3919
|
+
yargs9.help();
|
|
3552
3920
|
}
|
|
3553
3921
|
};
|
|
3554
3922
|
|
|
3555
3923
|
// src/commands/canvas/commands/prompts.ts
|
|
3556
|
-
import
|
|
3924
|
+
import yargs10 from "yargs";
|
|
3557
3925
|
|
|
3558
3926
|
// src/commands/canvas/commands/prompts/get.ts
|
|
3559
3927
|
import { PromptClient } from "@uniformdev/canvas";
|
|
3560
3928
|
var PromptGetModule = {
|
|
3561
3929
|
command: "get <id>",
|
|
3562
3930
|
describe: "Get a prompt",
|
|
3563
|
-
builder: (
|
|
3931
|
+
builder: (yargs28) => withConfiguration(
|
|
3564
3932
|
withFormatOptions(
|
|
3565
3933
|
withApiOptions(
|
|
3566
3934
|
withProjectOptions(
|
|
3567
3935
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3568
|
-
|
|
3936
|
+
yargs28.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
3569
3937
|
)
|
|
3570
3938
|
)
|
|
3571
3939
|
)
|
|
@@ -3586,7 +3954,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
3586
3954
|
var PromptListModule = {
|
|
3587
3955
|
command: "list",
|
|
3588
3956
|
describe: "List prompts",
|
|
3589
|
-
builder: (
|
|
3957
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3590
3958
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3591
3959
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3592
3960
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3633,12 +4001,12 @@ function createPromptEngineDataSource({
|
|
|
3633
4001
|
var PromptPullModule = {
|
|
3634
4002
|
command: "pull <directory>",
|
|
3635
4003
|
describe: "Pulls all entries to local files in a directory",
|
|
3636
|
-
builder: (
|
|
4004
|
+
builder: (yargs28) => withConfiguration(
|
|
3637
4005
|
withApiOptions(
|
|
3638
4006
|
withProjectOptions(
|
|
3639
4007
|
withStateOptions(
|
|
3640
4008
|
withDiffOptions(
|
|
3641
|
-
|
|
4009
|
+
yargs28.positional("directory", {
|
|
3642
4010
|
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
4011
|
type: "string"
|
|
3644
4012
|
}).option("format", {
|
|
@@ -3721,12 +4089,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
3721
4089
|
var PromptPushModule = {
|
|
3722
4090
|
command: "push <directory>",
|
|
3723
4091
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
3724
|
-
builder: (
|
|
4092
|
+
builder: (yargs28) => withConfiguration(
|
|
3725
4093
|
withApiOptions(
|
|
3726
4094
|
withProjectOptions(
|
|
3727
4095
|
withStateOptions(
|
|
3728
4096
|
withDiffOptions(
|
|
3729
|
-
|
|
4097
|
+
yargs28.positional("directory", {
|
|
3730
4098
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
3731
4099
|
type: "string"
|
|
3732
4100
|
}).option("what-if", {
|
|
@@ -3797,9 +4165,9 @@ var PromptRemoveModule = {
|
|
|
3797
4165
|
command: "remove <id>",
|
|
3798
4166
|
aliases: ["delete", "rm"],
|
|
3799
4167
|
describe: "Delete a prompt",
|
|
3800
|
-
builder: (
|
|
4168
|
+
builder: (yargs28) => withConfiguration(
|
|
3801
4169
|
withApiOptions(
|
|
3802
|
-
withProjectOptions(
|
|
4170
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
3803
4171
|
)
|
|
3804
4172
|
),
|
|
3805
4173
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -3815,10 +4183,10 @@ var PromptUpdateModule = {
|
|
|
3815
4183
|
command: "update <filename>",
|
|
3816
4184
|
aliases: ["put"],
|
|
3817
4185
|
describe: "Insert or update a prompt",
|
|
3818
|
-
builder: (
|
|
4186
|
+
builder: (yargs28) => withConfiguration(
|
|
3819
4187
|
withApiOptions(
|
|
3820
4188
|
withProjectOptions(
|
|
3821
|
-
|
|
4189
|
+
yargs28.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
3822
4190
|
)
|
|
3823
4191
|
)
|
|
3824
4192
|
),
|
|
@@ -3835,9 +4203,9 @@ var PromptModule = {
|
|
|
3835
4203
|
command: "prompt <command>",
|
|
3836
4204
|
aliases: ["dt"],
|
|
3837
4205
|
describe: "Commands for AI Prompt definitions",
|
|
3838
|
-
builder: (
|
|
4206
|
+
builder: (yargs28) => yargs28.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
3839
4207
|
handler: () => {
|
|
3840
|
-
|
|
4208
|
+
yargs10.help();
|
|
3841
4209
|
}
|
|
3842
4210
|
};
|
|
3843
4211
|
|
|
@@ -3846,28 +4214,28 @@ var CanvasCommand = {
|
|
|
3846
4214
|
command: "canvas <command>",
|
|
3847
4215
|
aliases: ["cv", "pm", "presentation"],
|
|
3848
4216
|
describe: "Uniform Canvas commands",
|
|
3849
|
-
builder: (
|
|
4217
|
+
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
4218
|
handler: () => {
|
|
3851
|
-
|
|
4219
|
+
yargs11.showHelp();
|
|
3852
4220
|
}
|
|
3853
4221
|
};
|
|
3854
4222
|
|
|
3855
4223
|
// src/commands/context/index.ts
|
|
3856
|
-
import
|
|
4224
|
+
import yargs18 from "yargs";
|
|
3857
4225
|
|
|
3858
4226
|
// src/commands/context/commands/aggregate.ts
|
|
3859
|
-
import
|
|
4227
|
+
import yargs12 from "yargs";
|
|
3860
4228
|
|
|
3861
4229
|
// src/commands/context/commands/aggregate/get.ts
|
|
3862
4230
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
3863
4231
|
var AggregateGetModule = {
|
|
3864
4232
|
command: "get <id>",
|
|
3865
4233
|
describe: "Fetch an aggregate",
|
|
3866
|
-
builder: (
|
|
4234
|
+
builder: (yargs28) => withConfiguration(
|
|
3867
4235
|
withFormatOptions(
|
|
3868
4236
|
withApiOptions(
|
|
3869
4237
|
withProjectOptions(
|
|
3870
|
-
|
|
4238
|
+
yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3871
4239
|
)
|
|
3872
4240
|
)
|
|
3873
4241
|
)
|
|
@@ -3891,7 +4259,7 @@ var AggregateListModule = {
|
|
|
3891
4259
|
command: "list",
|
|
3892
4260
|
describe: "List aggregates",
|
|
3893
4261
|
aliases: ["ls"],
|
|
3894
|
-
builder: (
|
|
4262
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
3895
4263
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3896
4264
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3897
4265
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3957,11 +4325,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
3957
4325
|
var AggregatePullModule = {
|
|
3958
4326
|
command: "pull <directory>",
|
|
3959
4327
|
describe: "Pulls all aggregates to local files in a directory",
|
|
3960
|
-
builder: (
|
|
4328
|
+
builder: (yargs28) => withConfiguration(
|
|
3961
4329
|
withApiOptions(
|
|
3962
4330
|
withProjectOptions(
|
|
3963
4331
|
withDiffOptions(
|
|
3964
|
-
|
|
4332
|
+
yargs28.positional("directory", {
|
|
3965
4333
|
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
4334
|
type: "string"
|
|
3967
4335
|
}).option("format", {
|
|
@@ -4036,11 +4404,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
4036
4404
|
var AggregatePushModule = {
|
|
4037
4405
|
command: "push <directory>",
|
|
4038
4406
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
4039
|
-
builder: (
|
|
4407
|
+
builder: (yargs28) => withConfiguration(
|
|
4040
4408
|
withApiOptions(
|
|
4041
4409
|
withProjectOptions(
|
|
4042
4410
|
withDiffOptions(
|
|
4043
|
-
|
|
4411
|
+
yargs28.positional("directory", {
|
|
4044
4412
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
4045
4413
|
type: "string"
|
|
4046
4414
|
}).option("what-if", {
|
|
@@ -4105,10 +4473,10 @@ var AggregateRemoveModule = {
|
|
|
4105
4473
|
command: "remove <id>",
|
|
4106
4474
|
aliases: ["delete", "rm"],
|
|
4107
4475
|
describe: "Delete an aggregate",
|
|
4108
|
-
builder: (
|
|
4476
|
+
builder: (yargs28) => withConfiguration(
|
|
4109
4477
|
withApiOptions(
|
|
4110
4478
|
withProjectOptions(
|
|
4111
|
-
|
|
4479
|
+
yargs28.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
4112
4480
|
)
|
|
4113
4481
|
)
|
|
4114
4482
|
),
|
|
@@ -4125,10 +4493,10 @@ var AggregateUpdateModule = {
|
|
|
4125
4493
|
command: "update <filename>",
|
|
4126
4494
|
aliases: ["put"],
|
|
4127
4495
|
describe: "Insert or update an aggregate",
|
|
4128
|
-
builder: (
|
|
4496
|
+
builder: (yargs28) => withConfiguration(
|
|
4129
4497
|
withApiOptions(
|
|
4130
4498
|
withProjectOptions(
|
|
4131
|
-
|
|
4499
|
+
yargs28.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
4132
4500
|
)
|
|
4133
4501
|
)
|
|
4134
4502
|
),
|
|
@@ -4145,25 +4513,25 @@ var AggregateModule = {
|
|
|
4145
4513
|
command: "aggregate <command>",
|
|
4146
4514
|
aliases: ["agg", "intent", "audience"],
|
|
4147
4515
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
4148
|
-
builder: (
|
|
4516
|
+
builder: (yargs28) => yargs28.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
4149
4517
|
handler: () => {
|
|
4150
|
-
|
|
4518
|
+
yargs12.help();
|
|
4151
4519
|
}
|
|
4152
4520
|
};
|
|
4153
4521
|
|
|
4154
4522
|
// src/commands/context/commands/enrichment.ts
|
|
4155
|
-
import
|
|
4523
|
+
import yargs13 from "yargs";
|
|
4156
4524
|
|
|
4157
4525
|
// src/commands/context/commands/enrichment/get.ts
|
|
4158
4526
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
4159
4527
|
var EnrichmentGetModule = {
|
|
4160
4528
|
command: "get <id>",
|
|
4161
4529
|
describe: "Fetch an enrichment category and its values",
|
|
4162
|
-
builder: (
|
|
4530
|
+
builder: (yargs28) => withFormatOptions(
|
|
4163
4531
|
withConfiguration(
|
|
4164
4532
|
withApiOptions(
|
|
4165
4533
|
withProjectOptions(
|
|
4166
|
-
|
|
4534
|
+
yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
4167
4535
|
)
|
|
4168
4536
|
)
|
|
4169
4537
|
)
|
|
@@ -4188,7 +4556,7 @@ var EnrichmentListModule = {
|
|
|
4188
4556
|
command: "list",
|
|
4189
4557
|
describe: "List enrichments",
|
|
4190
4558
|
aliases: ["ls"],
|
|
4191
|
-
builder: (
|
|
4559
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
4192
4560
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4193
4561
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4194
4562
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4289,11 +4657,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
4289
4657
|
var EnrichmentPullModule = {
|
|
4290
4658
|
command: "pull <directory>",
|
|
4291
4659
|
describe: "Pulls all enrichments to local files in a directory",
|
|
4292
|
-
builder: (
|
|
4660
|
+
builder: (yargs28) => withConfiguration(
|
|
4293
4661
|
withApiOptions(
|
|
4294
4662
|
withProjectOptions(
|
|
4295
4663
|
withDiffOptions(
|
|
4296
|
-
|
|
4664
|
+
yargs28.positional("directory", {
|
|
4297
4665
|
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
4666
|
type: "string"
|
|
4299
4667
|
}).option("format", {
|
|
@@ -4368,11 +4736,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
4368
4736
|
var EnrichmentPushModule = {
|
|
4369
4737
|
command: "push <directory>",
|
|
4370
4738
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
4371
|
-
builder: (
|
|
4739
|
+
builder: (yargs28) => withConfiguration(
|
|
4372
4740
|
withApiOptions(
|
|
4373
4741
|
withProjectOptions(
|
|
4374
4742
|
withDiffOptions(
|
|
4375
|
-
|
|
4743
|
+
yargs28.positional("directory", {
|
|
4376
4744
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
4377
4745
|
type: "string"
|
|
4378
4746
|
}).option("what-if", {
|
|
@@ -4436,10 +4804,10 @@ var EnrichmentRemoveModule = {
|
|
|
4436
4804
|
command: "remove <id>",
|
|
4437
4805
|
aliases: ["delete", "rm"],
|
|
4438
4806
|
describe: "Delete an enrichment category and its values",
|
|
4439
|
-
builder: (
|
|
4807
|
+
builder: (yargs28) => withConfiguration(
|
|
4440
4808
|
withApiOptions(
|
|
4441
4809
|
withProjectOptions(
|
|
4442
|
-
|
|
4810
|
+
yargs28.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
4443
4811
|
)
|
|
4444
4812
|
)
|
|
4445
4813
|
),
|
|
@@ -4455,14 +4823,14 @@ var EnrichmentModule = {
|
|
|
4455
4823
|
command: "enrichment <command>",
|
|
4456
4824
|
aliases: ["enr"],
|
|
4457
4825
|
describe: "Commands for Context enrichments",
|
|
4458
|
-
builder: (
|
|
4826
|
+
builder: (yargs28) => yargs28.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
4459
4827
|
handler: () => {
|
|
4460
|
-
|
|
4828
|
+
yargs13.help();
|
|
4461
4829
|
}
|
|
4462
4830
|
};
|
|
4463
4831
|
|
|
4464
4832
|
// src/commands/context/commands/manifest.ts
|
|
4465
|
-
import
|
|
4833
|
+
import yargs14 from "yargs";
|
|
4466
4834
|
|
|
4467
4835
|
// src/commands/context/commands/manifest/get.ts
|
|
4468
4836
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -4473,10 +4841,10 @@ var ManifestGetModule = {
|
|
|
4473
4841
|
command: "get [output]",
|
|
4474
4842
|
aliases: ["dl", "download"],
|
|
4475
4843
|
describe: "Download the Uniform Context manifest for a project",
|
|
4476
|
-
builder: (
|
|
4844
|
+
builder: (yargs28) => withConfiguration(
|
|
4477
4845
|
withApiOptions(
|
|
4478
4846
|
withProjectOptions(
|
|
4479
|
-
|
|
4847
|
+
yargs28.option("preview", {
|
|
4480
4848
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
4481
4849
|
default: false,
|
|
4482
4850
|
type: "boolean",
|
|
@@ -4538,7 +4906,7 @@ import { exit as exit2 } from "process";
|
|
|
4538
4906
|
var ManifestPublishModule = {
|
|
4539
4907
|
command: "publish",
|
|
4540
4908
|
describe: "Publish the Uniform Context manifest for a project",
|
|
4541
|
-
builder: (
|
|
4909
|
+
builder: (yargs28) => withConfiguration(withApiOptions(withProjectOptions(yargs28))),
|
|
4542
4910
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
4543
4911
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4544
4912
|
try {
|
|
@@ -4571,25 +4939,25 @@ var ManifestModule = {
|
|
|
4571
4939
|
command: "manifest <command>",
|
|
4572
4940
|
describe: "Commands for context manifests",
|
|
4573
4941
|
aliases: ["man"],
|
|
4574
|
-
builder: (
|
|
4942
|
+
builder: (yargs28) => yargs28.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
4575
4943
|
handler: () => {
|
|
4576
|
-
|
|
4944
|
+
yargs14.help();
|
|
4577
4945
|
}
|
|
4578
4946
|
};
|
|
4579
4947
|
|
|
4580
4948
|
// src/commands/context/commands/quirk.ts
|
|
4581
|
-
import
|
|
4949
|
+
import yargs15 from "yargs";
|
|
4582
4950
|
|
|
4583
4951
|
// src/commands/context/commands/quirk/get.ts
|
|
4584
4952
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
4585
4953
|
var QuirkGetModule = {
|
|
4586
4954
|
command: "get <id>",
|
|
4587
4955
|
describe: "Fetch a quirk",
|
|
4588
|
-
builder: (
|
|
4956
|
+
builder: (yargs28) => withConfiguration(
|
|
4589
4957
|
withFormatOptions(
|
|
4590
4958
|
withApiOptions(
|
|
4591
4959
|
withProjectOptions(
|
|
4592
|
-
|
|
4960
|
+
yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
4593
4961
|
)
|
|
4594
4962
|
)
|
|
4595
4963
|
)
|
|
@@ -4613,11 +4981,11 @@ var QuirkListModule = {
|
|
|
4613
4981
|
command: "list",
|
|
4614
4982
|
describe: "List quirks",
|
|
4615
4983
|
aliases: ["ls"],
|
|
4616
|
-
builder: (
|
|
4984
|
+
builder: (yargs28) => withConfiguration(
|
|
4617
4985
|
withFormatOptions(
|
|
4618
4986
|
withApiOptions(
|
|
4619
4987
|
withProjectOptions(
|
|
4620
|
-
|
|
4988
|
+
yargs28.option("withIntegrations", {
|
|
4621
4989
|
alias: ["i"],
|
|
4622
4990
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
4623
4991
|
type: "boolean"
|
|
@@ -4674,11 +5042,11 @@ function createQuirkEngineDataSource({
|
|
|
4674
5042
|
var QuirkPullModule = {
|
|
4675
5043
|
command: "pull <directory>",
|
|
4676
5044
|
describe: "Pulls all quirks to local files in a directory",
|
|
4677
|
-
builder: (
|
|
5045
|
+
builder: (yargs28) => withConfiguration(
|
|
4678
5046
|
withApiOptions(
|
|
4679
5047
|
withProjectOptions(
|
|
4680
5048
|
withDiffOptions(
|
|
4681
|
-
|
|
5049
|
+
yargs28.positional("directory", {
|
|
4682
5050
|
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
5051
|
type: "string"
|
|
4684
5052
|
}).option("format", {
|
|
@@ -4753,11 +5121,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
4753
5121
|
var QuirkPushModule = {
|
|
4754
5122
|
command: "push <directory>",
|
|
4755
5123
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
4756
|
-
builder: (
|
|
5124
|
+
builder: (yargs28) => withConfiguration(
|
|
4757
5125
|
withApiOptions(
|
|
4758
5126
|
withProjectOptions(
|
|
4759
5127
|
withDiffOptions(
|
|
4760
|
-
|
|
5128
|
+
yargs28.positional("directory", {
|
|
4761
5129
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
4762
5130
|
type: "string"
|
|
4763
5131
|
}).option("what-if", {
|
|
@@ -4821,10 +5189,10 @@ var QuirkRemoveModule = {
|
|
|
4821
5189
|
command: "remove <id>",
|
|
4822
5190
|
aliases: ["delete", "rm"],
|
|
4823
5191
|
describe: "Delete a quirk",
|
|
4824
|
-
builder: (
|
|
5192
|
+
builder: (yargs28) => withConfiguration(
|
|
4825
5193
|
withApiOptions(
|
|
4826
5194
|
withProjectOptions(
|
|
4827
|
-
|
|
5195
|
+
yargs28.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4828
5196
|
)
|
|
4829
5197
|
)
|
|
4830
5198
|
),
|
|
@@ -4841,10 +5209,10 @@ var QuirkUpdateModule = {
|
|
|
4841
5209
|
command: "update <filename>",
|
|
4842
5210
|
aliases: ["put"],
|
|
4843
5211
|
describe: "Insert or update a quirk",
|
|
4844
|
-
builder: (
|
|
5212
|
+
builder: (yargs28) => withConfiguration(
|
|
4845
5213
|
withApiOptions(
|
|
4846
5214
|
withProjectOptions(
|
|
4847
|
-
|
|
5215
|
+
yargs28.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4848
5216
|
)
|
|
4849
5217
|
)
|
|
4850
5218
|
),
|
|
@@ -4861,25 +5229,25 @@ var QuirkModule = {
|
|
|
4861
5229
|
command: "quirk <command>",
|
|
4862
5230
|
aliases: ["qk"],
|
|
4863
5231
|
describe: "Commands for Context quirks",
|
|
4864
|
-
builder: (
|
|
5232
|
+
builder: (yargs28) => yargs28.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
4865
5233
|
handler: () => {
|
|
4866
|
-
|
|
5234
|
+
yargs15.help();
|
|
4867
5235
|
}
|
|
4868
5236
|
};
|
|
4869
5237
|
|
|
4870
5238
|
// src/commands/context/commands/signal.ts
|
|
4871
|
-
import
|
|
5239
|
+
import yargs16 from "yargs";
|
|
4872
5240
|
|
|
4873
5241
|
// src/commands/context/commands/signal/get.ts
|
|
4874
5242
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
4875
5243
|
var SignalGetModule = {
|
|
4876
5244
|
command: "get <id>",
|
|
4877
5245
|
describe: "Fetch a signal",
|
|
4878
|
-
builder: (
|
|
5246
|
+
builder: (yargs28) => withConfiguration(
|
|
4879
5247
|
withFormatOptions(
|
|
4880
5248
|
withApiOptions(
|
|
4881
5249
|
withProjectOptions(
|
|
4882
|
-
|
|
5250
|
+
yargs28.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4883
5251
|
)
|
|
4884
5252
|
)
|
|
4885
5253
|
)
|
|
@@ -4903,7 +5271,7 @@ var SignalListModule = {
|
|
|
4903
5271
|
command: "list",
|
|
4904
5272
|
describe: "List signals",
|
|
4905
5273
|
aliases: ["ls"],
|
|
4906
|
-
builder: (
|
|
5274
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
4907
5275
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4908
5276
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4909
5277
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4952,11 +5320,11 @@ function createSignalEngineDataSource({
|
|
|
4952
5320
|
var SignalPullModule = {
|
|
4953
5321
|
command: "pull <directory>",
|
|
4954
5322
|
describe: "Pulls all signals to local files in a directory",
|
|
4955
|
-
builder: (
|
|
5323
|
+
builder: (yargs28) => withConfiguration(
|
|
4956
5324
|
withApiOptions(
|
|
4957
5325
|
withProjectOptions(
|
|
4958
5326
|
withDiffOptions(
|
|
4959
|
-
|
|
5327
|
+
yargs28.positional("directory", {
|
|
4960
5328
|
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
5329
|
type: "string"
|
|
4962
5330
|
}).option("format", {
|
|
@@ -5031,11 +5399,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
5031
5399
|
var SignalPushModule = {
|
|
5032
5400
|
command: "push <directory>",
|
|
5033
5401
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
5034
|
-
builder: (
|
|
5402
|
+
builder: (yargs28) => withConfiguration(
|
|
5035
5403
|
withApiOptions(
|
|
5036
5404
|
withProjectOptions(
|
|
5037
5405
|
withDiffOptions(
|
|
5038
|
-
|
|
5406
|
+
yargs28.positional("directory", {
|
|
5039
5407
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
5040
5408
|
type: "string"
|
|
5041
5409
|
}).option("what-if", {
|
|
@@ -5099,10 +5467,10 @@ var SignalRemoveModule = {
|
|
|
5099
5467
|
command: "remove <id>",
|
|
5100
5468
|
aliases: ["delete", "rm"],
|
|
5101
5469
|
describe: "Delete a signal",
|
|
5102
|
-
builder: (
|
|
5470
|
+
builder: (yargs28) => withConfiguration(
|
|
5103
5471
|
withApiOptions(
|
|
5104
5472
|
withProjectOptions(
|
|
5105
|
-
|
|
5473
|
+
yargs28.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
5106
5474
|
)
|
|
5107
5475
|
)
|
|
5108
5476
|
),
|
|
@@ -5119,10 +5487,10 @@ var SignalUpdateModule = {
|
|
|
5119
5487
|
command: "update <filename>",
|
|
5120
5488
|
aliases: ["put"],
|
|
5121
5489
|
describe: "Insert or update a signal",
|
|
5122
|
-
builder: (
|
|
5490
|
+
builder: (yargs28) => withConfiguration(
|
|
5123
5491
|
withApiOptions(
|
|
5124
5492
|
withProjectOptions(
|
|
5125
|
-
|
|
5493
|
+
yargs28.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
5126
5494
|
)
|
|
5127
5495
|
)
|
|
5128
5496
|
),
|
|
@@ -5139,25 +5507,25 @@ var SignalModule = {
|
|
|
5139
5507
|
command: "signal <command>",
|
|
5140
5508
|
aliases: ["sig"],
|
|
5141
5509
|
describe: "Commands for Context signals",
|
|
5142
|
-
builder: (
|
|
5510
|
+
builder: (yargs28) => yargs28.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
5143
5511
|
handler: () => {
|
|
5144
|
-
|
|
5512
|
+
yargs16.help();
|
|
5145
5513
|
}
|
|
5146
5514
|
};
|
|
5147
5515
|
|
|
5148
5516
|
// src/commands/context/commands/test.ts
|
|
5149
|
-
import
|
|
5517
|
+
import yargs17 from "yargs";
|
|
5150
5518
|
|
|
5151
5519
|
// src/commands/context/commands/test/get.ts
|
|
5152
5520
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
5153
5521
|
var TestGetModule = {
|
|
5154
5522
|
command: "get <id>",
|
|
5155
5523
|
describe: "Fetch a test",
|
|
5156
|
-
builder: (
|
|
5524
|
+
builder: (yargs28) => withConfiguration(
|
|
5157
5525
|
withFormatOptions(
|
|
5158
5526
|
withApiOptions(
|
|
5159
5527
|
withProjectOptions(
|
|
5160
|
-
|
|
5528
|
+
yargs28.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
5161
5529
|
)
|
|
5162
5530
|
)
|
|
5163
5531
|
)
|
|
@@ -5181,7 +5549,7 @@ var TestListModule = {
|
|
|
5181
5549
|
command: "list",
|
|
5182
5550
|
describe: "List tests",
|
|
5183
5551
|
aliases: ["ls"],
|
|
5184
|
-
builder: (
|
|
5552
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
5185
5553
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
5186
5554
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5187
5555
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -5230,11 +5598,11 @@ function createTestEngineDataSource({
|
|
|
5230
5598
|
var TestPullModule = {
|
|
5231
5599
|
command: "pull <directory>",
|
|
5232
5600
|
describe: "Pulls all tests to local files in a directory",
|
|
5233
|
-
builder: (
|
|
5601
|
+
builder: (yargs28) => withConfiguration(
|
|
5234
5602
|
withApiOptions(
|
|
5235
5603
|
withProjectOptions(
|
|
5236
5604
|
withDiffOptions(
|
|
5237
|
-
|
|
5605
|
+
yargs28.positional("directory", {
|
|
5238
5606
|
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
5607
|
type: "string"
|
|
5240
5608
|
}).option("format", {
|
|
@@ -5309,11 +5677,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
5309
5677
|
var TestPushModule = {
|
|
5310
5678
|
command: "push <directory>",
|
|
5311
5679
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
5312
|
-
builder: (
|
|
5680
|
+
builder: (yargs28) => withConfiguration(
|
|
5313
5681
|
withApiOptions(
|
|
5314
5682
|
withProjectOptions(
|
|
5315
5683
|
withDiffOptions(
|
|
5316
|
-
|
|
5684
|
+
yargs28.positional("directory", {
|
|
5317
5685
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
5318
5686
|
type: "string"
|
|
5319
5687
|
}).option("what-if", {
|
|
@@ -5377,10 +5745,10 @@ var TestRemoveModule = {
|
|
|
5377
5745
|
command: "remove <id>",
|
|
5378
5746
|
aliases: ["delete", "rm"],
|
|
5379
5747
|
describe: "Delete a test",
|
|
5380
|
-
builder: (
|
|
5748
|
+
builder: (yargs28) => withConfiguration(
|
|
5381
5749
|
withApiOptions(
|
|
5382
5750
|
withProjectOptions(
|
|
5383
|
-
|
|
5751
|
+
yargs28.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
5384
5752
|
)
|
|
5385
5753
|
)
|
|
5386
5754
|
),
|
|
@@ -5397,9 +5765,9 @@ var TestUpdateModule = {
|
|
|
5397
5765
|
command: "update <filename>",
|
|
5398
5766
|
aliases: ["put"],
|
|
5399
5767
|
describe: "Insert or update a test",
|
|
5400
|
-
builder: (
|
|
5768
|
+
builder: (yargs28) => withConfiguration(
|
|
5401
5769
|
withApiOptions(
|
|
5402
|
-
withProjectOptions(
|
|
5770
|
+
withProjectOptions(yargs28.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
5403
5771
|
)
|
|
5404
5772
|
),
|
|
5405
5773
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5414,9 +5782,9 @@ var TestUpdateModule = {
|
|
|
5414
5782
|
var TestModule = {
|
|
5415
5783
|
command: "test <command>",
|
|
5416
5784
|
describe: "Commands for Context A/B tests",
|
|
5417
|
-
builder: (
|
|
5785
|
+
builder: (yargs28) => yargs28.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
5418
5786
|
handler: () => {
|
|
5419
|
-
|
|
5787
|
+
yargs17.help();
|
|
5420
5788
|
}
|
|
5421
5789
|
};
|
|
5422
5790
|
|
|
@@ -5425,9 +5793,9 @@ var ContextCommand = {
|
|
|
5425
5793
|
command: "context <command>",
|
|
5426
5794
|
aliases: ["ctx"],
|
|
5427
5795
|
describe: "Uniform Context commands",
|
|
5428
|
-
builder: (
|
|
5796
|
+
builder: (yargs28) => yargs28.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
5429
5797
|
handler: () => {
|
|
5430
|
-
|
|
5798
|
+
yargs18.showHelp();
|
|
5431
5799
|
}
|
|
5432
5800
|
};
|
|
5433
5801
|
|
|
@@ -5455,7 +5823,7 @@ import { PostHog } from "posthog-node";
|
|
|
5455
5823
|
// package.json
|
|
5456
5824
|
var package_default = {
|
|
5457
5825
|
name: "@uniformdev/cli",
|
|
5458
|
-
version: "19.
|
|
5826
|
+
version: "19.88.0",
|
|
5459
5827
|
description: "Uniform command line interface tool",
|
|
5460
5828
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5461
5829
|
main: "./cli.js",
|
|
@@ -5512,7 +5880,7 @@ var package_default = {
|
|
|
5512
5880
|
"@types/js-yaml": "4.0.9",
|
|
5513
5881
|
"@types/jsonwebtoken": "9.0.5",
|
|
5514
5882
|
"@types/lodash.isequalwith": "4.4.9",
|
|
5515
|
-
"@types/node": "18.19.
|
|
5883
|
+
"@types/node": "18.19.3",
|
|
5516
5884
|
"@types/yargs": "17.0.32"
|
|
5517
5885
|
},
|
|
5518
5886
|
bin: {
|
|
@@ -6465,10 +6833,10 @@ var NewMeshCmd = {
|
|
|
6465
6833
|
};
|
|
6466
6834
|
|
|
6467
6835
|
// src/commands/optimize/index.ts
|
|
6468
|
-
import
|
|
6836
|
+
import yargs20 from "yargs";
|
|
6469
6837
|
|
|
6470
6838
|
// src/commands/optimize/manifest.ts
|
|
6471
|
-
import
|
|
6839
|
+
import yargs19 from "yargs";
|
|
6472
6840
|
|
|
6473
6841
|
// src/commands/optimize/manifest/download.ts
|
|
6474
6842
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -6483,7 +6851,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
6483
6851
|
var module = {
|
|
6484
6852
|
command: "download [output]",
|
|
6485
6853
|
describe: "Download intent manifest",
|
|
6486
|
-
builder: (
|
|
6854
|
+
builder: (yargs28) => yargs28.option("apiKey", {
|
|
6487
6855
|
alias: "k",
|
|
6488
6856
|
demandOption: true,
|
|
6489
6857
|
string: true,
|
|
@@ -6584,10 +6952,10 @@ var module2 = {
|
|
|
6584
6952
|
command: "manifest <command>",
|
|
6585
6953
|
describe: "Intent manifest commands",
|
|
6586
6954
|
builder: () => {
|
|
6587
|
-
return
|
|
6955
|
+
return yargs19.command(download_default);
|
|
6588
6956
|
},
|
|
6589
6957
|
handler: () => {
|
|
6590
|
-
|
|
6958
|
+
yargs19.showHelp();
|
|
6591
6959
|
}
|
|
6592
6960
|
};
|
|
6593
6961
|
var manifest_default = module2;
|
|
@@ -6598,29 +6966,29 @@ var OptimizeCommand = {
|
|
|
6598
6966
|
aliases: ["opt"],
|
|
6599
6967
|
describe: "Uniform Optimize commands",
|
|
6600
6968
|
builder: () => {
|
|
6601
|
-
return
|
|
6969
|
+
return yargs20.command(manifest_default);
|
|
6602
6970
|
},
|
|
6603
6971
|
handler: () => {
|
|
6604
|
-
|
|
6972
|
+
yargs20.showHelp();
|
|
6605
6973
|
}
|
|
6606
6974
|
};
|
|
6607
6975
|
|
|
6608
6976
|
// src/commands/project-map/index.ts
|
|
6609
|
-
import
|
|
6977
|
+
import yargs23 from "yargs";
|
|
6610
6978
|
|
|
6611
6979
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
6612
|
-
import
|
|
6980
|
+
import yargs21 from "yargs";
|
|
6613
6981
|
|
|
6614
6982
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
6615
6983
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
6616
6984
|
var ProjectMapDefinitionGetModule = {
|
|
6617
6985
|
command: "get <id>",
|
|
6618
6986
|
describe: "Fetch a project map",
|
|
6619
|
-
builder: (
|
|
6987
|
+
builder: (yargs28) => withFormatOptions(
|
|
6620
6988
|
withConfiguration(
|
|
6621
6989
|
withApiOptions(
|
|
6622
6990
|
withProjectOptions(
|
|
6623
|
-
|
|
6991
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
6624
6992
|
)
|
|
6625
6993
|
)
|
|
6626
6994
|
)
|
|
@@ -6644,7 +7012,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
6644
7012
|
command: "list",
|
|
6645
7013
|
describe: "List of project maps",
|
|
6646
7014
|
aliases: ["ls"],
|
|
6647
|
-
builder: (
|
|
7015
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
6648
7016
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6649
7017
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6650
7018
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6701,11 +7069,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
6701
7069
|
var ProjectMapDefinitionPullModule = {
|
|
6702
7070
|
command: "pull <directory>",
|
|
6703
7071
|
describe: "Pulls all project maps to local files in a directory",
|
|
6704
|
-
builder: (
|
|
7072
|
+
builder: (yargs28) => withConfiguration(
|
|
6705
7073
|
withApiOptions(
|
|
6706
7074
|
withProjectOptions(
|
|
6707
7075
|
withDiffOptions(
|
|
6708
|
-
|
|
7076
|
+
yargs28.positional("directory", {
|
|
6709
7077
|
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
7078
|
type: "string"
|
|
6711
7079
|
}).option("format", {
|
|
@@ -6781,11 +7149,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
6781
7149
|
var ProjectMapDefinitionPushModule = {
|
|
6782
7150
|
command: "push <directory>",
|
|
6783
7151
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
6784
|
-
builder: (
|
|
7152
|
+
builder: (yargs28) => withConfiguration(
|
|
6785
7153
|
withApiOptions(
|
|
6786
7154
|
withProjectOptions(
|
|
6787
7155
|
withDiffOptions(
|
|
6788
|
-
|
|
7156
|
+
yargs28.positional("directory", {
|
|
6789
7157
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6790
7158
|
type: "string"
|
|
6791
7159
|
}).option("what-if", {
|
|
@@ -6849,9 +7217,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
6849
7217
|
command: "remove <id>",
|
|
6850
7218
|
aliases: ["delete", "rm"],
|
|
6851
7219
|
describe: "Delete a project map",
|
|
6852
|
-
builder: (
|
|
7220
|
+
builder: (yargs28) => withConfiguration(
|
|
6853
7221
|
withApiOptions(
|
|
6854
|
-
withProjectOptions(
|
|
7222
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6855
7223
|
)
|
|
6856
7224
|
),
|
|
6857
7225
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6867,10 +7235,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6867
7235
|
command: "update <filename>",
|
|
6868
7236
|
aliases: ["put"],
|
|
6869
7237
|
describe: "Insert or update a project map",
|
|
6870
|
-
builder: (
|
|
7238
|
+
builder: (yargs28) => withConfiguration(
|
|
6871
7239
|
withApiOptions(
|
|
6872
7240
|
withProjectOptions(
|
|
6873
|
-
|
|
7241
|
+
yargs28.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6874
7242
|
)
|
|
6875
7243
|
)
|
|
6876
7244
|
),
|
|
@@ -6886,25 +7254,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6886
7254
|
var ProjectMapDefinitionModule = {
|
|
6887
7255
|
command: "definition <command>",
|
|
6888
7256
|
describe: "Commands for ProjectMap Definitions",
|
|
6889
|
-
builder: (
|
|
7257
|
+
builder: (yargs28) => yargs28.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
6890
7258
|
handler: () => {
|
|
6891
|
-
|
|
7259
|
+
yargs21.help();
|
|
6892
7260
|
}
|
|
6893
7261
|
};
|
|
6894
7262
|
|
|
6895
7263
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
6896
|
-
import
|
|
7264
|
+
import yargs22 from "yargs";
|
|
6897
7265
|
|
|
6898
7266
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
6899
7267
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
6900
7268
|
var ProjectMapNodeGetModule = {
|
|
6901
7269
|
command: "get <id> <projectMapId>",
|
|
6902
7270
|
describe: "Fetch a project map node",
|
|
6903
|
-
builder: (
|
|
7271
|
+
builder: (yargs28) => withConfiguration(
|
|
6904
7272
|
withFormatOptions(
|
|
6905
7273
|
withApiOptions(
|
|
6906
7274
|
withProjectOptions(
|
|
6907
|
-
|
|
7275
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6908
7276
|
)
|
|
6909
7277
|
)
|
|
6910
7278
|
)
|
|
@@ -6930,11 +7298,11 @@ var ProjectMapNodeListModule = {
|
|
|
6930
7298
|
command: "list <projectMapId>",
|
|
6931
7299
|
describe: "List project map nodes",
|
|
6932
7300
|
aliases: ["ls"],
|
|
6933
|
-
builder: (
|
|
7301
|
+
builder: (yargs28) => withConfiguration(
|
|
6934
7302
|
withFormatOptions(
|
|
6935
7303
|
withApiOptions(
|
|
6936
7304
|
withProjectOptions(
|
|
6937
|
-
|
|
7305
|
+
yargs28.positional("projectMapId", {
|
|
6938
7306
|
demandOption: true,
|
|
6939
7307
|
describe: "ProjectMap UUID to fetch from"
|
|
6940
7308
|
})
|
|
@@ -7005,11 +7373,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
7005
7373
|
var ProjectMapNodePullModule = {
|
|
7006
7374
|
command: "pull <directory>",
|
|
7007
7375
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
7008
|
-
builder: (
|
|
7376
|
+
builder: (yargs28) => withConfiguration(
|
|
7009
7377
|
withApiOptions(
|
|
7010
7378
|
withProjectOptions(
|
|
7011
7379
|
withDiffOptions(
|
|
7012
|
-
|
|
7380
|
+
yargs28.positional("directory", {
|
|
7013
7381
|
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
7382
|
type: "string"
|
|
7015
7383
|
}).option("format", {
|
|
@@ -7089,11 +7457,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
7089
7457
|
var ProjectMapNodePushModule = {
|
|
7090
7458
|
command: "push <directory>",
|
|
7091
7459
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
7092
|
-
builder: (
|
|
7460
|
+
builder: (yargs28) => withConfiguration(
|
|
7093
7461
|
withApiOptions(
|
|
7094
7462
|
withProjectOptions(
|
|
7095
7463
|
withDiffOptions(
|
|
7096
|
-
|
|
7464
|
+
yargs28.positional("directory", {
|
|
7097
7465
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
7098
7466
|
type: "string"
|
|
7099
7467
|
}).option("what-if", {
|
|
@@ -7166,10 +7534,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
7166
7534
|
command: "remove <id> <projectMapId>",
|
|
7167
7535
|
aliases: ["delete", "rm"],
|
|
7168
7536
|
describe: "Delete a project map node",
|
|
7169
|
-
builder: (
|
|
7537
|
+
builder: (yargs28) => withConfiguration(
|
|
7170
7538
|
withApiOptions(
|
|
7171
7539
|
withProjectOptions(
|
|
7172
|
-
|
|
7540
|
+
yargs28.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
7173
7541
|
)
|
|
7174
7542
|
)
|
|
7175
7543
|
),
|
|
@@ -7186,10 +7554,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
7186
7554
|
command: "update <filename> <projectMapId>",
|
|
7187
7555
|
aliases: ["put"],
|
|
7188
7556
|
describe: "Insert or update a project map node",
|
|
7189
|
-
builder: (
|
|
7557
|
+
builder: (yargs28) => withConfiguration(
|
|
7190
7558
|
withApiOptions(
|
|
7191
7559
|
withProjectOptions(
|
|
7192
|
-
|
|
7560
|
+
yargs28.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
7193
7561
|
)
|
|
7194
7562
|
)
|
|
7195
7563
|
),
|
|
@@ -7205,9 +7573,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
7205
7573
|
var ProjectMapNodeModule = {
|
|
7206
7574
|
command: "node <command>",
|
|
7207
7575
|
describe: "Commands for ProjectMap Nodes",
|
|
7208
|
-
builder: (
|
|
7576
|
+
builder: (yargs28) => yargs28.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
7209
7577
|
handler: () => {
|
|
7210
|
-
|
|
7578
|
+
yargs22.help();
|
|
7211
7579
|
}
|
|
7212
7580
|
};
|
|
7213
7581
|
|
|
@@ -7216,28 +7584,28 @@ var ProjectMapCommand = {
|
|
|
7216
7584
|
command: "project-map <command>",
|
|
7217
7585
|
aliases: ["prm"],
|
|
7218
7586
|
describe: "Uniform ProjectMap commands",
|
|
7219
|
-
builder: (
|
|
7587
|
+
builder: (yargs28) => yargs28.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
7220
7588
|
handler: () => {
|
|
7221
|
-
|
|
7589
|
+
yargs23.showHelp();
|
|
7222
7590
|
}
|
|
7223
7591
|
};
|
|
7224
7592
|
|
|
7225
7593
|
// src/commands/redirect/index.ts
|
|
7226
|
-
import
|
|
7594
|
+
import yargs25 from "yargs";
|
|
7227
7595
|
|
|
7228
7596
|
// src/commands/redirect/commands/redirect.ts
|
|
7229
|
-
import
|
|
7597
|
+
import yargs24 from "yargs";
|
|
7230
7598
|
|
|
7231
7599
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
7232
7600
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
7233
7601
|
var RedirectDefinitionGetModule = {
|
|
7234
7602
|
command: "get <id>",
|
|
7235
7603
|
describe: "Fetch a redirect",
|
|
7236
|
-
builder: (
|
|
7604
|
+
builder: (yargs28) => withConfiguration(
|
|
7237
7605
|
withFormatOptions(
|
|
7238
7606
|
withApiOptions(
|
|
7239
7607
|
withProjectOptions(
|
|
7240
|
-
|
|
7608
|
+
yargs28.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
7241
7609
|
)
|
|
7242
7610
|
)
|
|
7243
7611
|
)
|
|
@@ -7261,7 +7629,7 @@ var RedirectDefinitionListModule = {
|
|
|
7261
7629
|
command: "list",
|
|
7262
7630
|
describe: "List of redirects",
|
|
7263
7631
|
aliases: ["ls"],
|
|
7264
|
-
builder: (
|
|
7632
|
+
builder: (yargs28) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs28)))),
|
|
7265
7633
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
7266
7634
|
const fetch3 = nodeFetchProxy(proxy);
|
|
7267
7635
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7327,11 +7695,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
7327
7695
|
var RedirectDefinitionPullModule = {
|
|
7328
7696
|
command: "pull <directory>",
|
|
7329
7697
|
describe: "Pulls all redirects to local files in a directory",
|
|
7330
|
-
builder: (
|
|
7698
|
+
builder: (yargs28) => withConfiguration(
|
|
7331
7699
|
withApiOptions(
|
|
7332
7700
|
withProjectOptions(
|
|
7333
7701
|
withDiffOptions(
|
|
7334
|
-
|
|
7702
|
+
yargs28.positional("directory", {
|
|
7335
7703
|
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
7704
|
type: "string"
|
|
7337
7705
|
}).option("format", {
|
|
@@ -7408,11 +7776,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
7408
7776
|
var RedirectDefinitionPushModule = {
|
|
7409
7777
|
command: "push <directory>",
|
|
7410
7778
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
7411
|
-
builder: (
|
|
7779
|
+
builder: (yargs28) => withConfiguration(
|
|
7412
7780
|
withApiOptions(
|
|
7413
7781
|
withProjectOptions(
|
|
7414
7782
|
withDiffOptions(
|
|
7415
|
-
|
|
7783
|
+
yargs28.positional("directory", {
|
|
7416
7784
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
7417
7785
|
type: "string"
|
|
7418
7786
|
}).option("what-if", {
|
|
@@ -7476,9 +7844,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
7476
7844
|
command: "remove <id>",
|
|
7477
7845
|
aliases: ["delete", "rm"],
|
|
7478
7846
|
describe: "Delete a redirect",
|
|
7479
|
-
builder: (
|
|
7847
|
+
builder: (yargs28) => withConfiguration(
|
|
7480
7848
|
withApiOptions(
|
|
7481
|
-
withProjectOptions(
|
|
7849
|
+
withProjectOptions(yargs28.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
7482
7850
|
)
|
|
7483
7851
|
),
|
|
7484
7852
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -7494,10 +7862,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7494
7862
|
command: "update <filename>",
|
|
7495
7863
|
aliases: ["put"],
|
|
7496
7864
|
describe: "Insert or update a redirect",
|
|
7497
|
-
builder: (
|
|
7865
|
+
builder: (yargs28) => withConfiguration(
|
|
7498
7866
|
withApiOptions(
|
|
7499
7867
|
withProjectOptions(
|
|
7500
|
-
|
|
7868
|
+
yargs28.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
7501
7869
|
)
|
|
7502
7870
|
)
|
|
7503
7871
|
),
|
|
@@ -7513,9 +7881,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7513
7881
|
var RedirectDefinitionModule = {
|
|
7514
7882
|
command: "definition <command>",
|
|
7515
7883
|
describe: "Commands for Redirect Definitions",
|
|
7516
|
-
builder: (
|
|
7884
|
+
builder: (yargs28) => yargs28.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
7517
7885
|
handler: () => {
|
|
7518
|
-
|
|
7886
|
+
yargs24.help();
|
|
7519
7887
|
}
|
|
7520
7888
|
};
|
|
7521
7889
|
|
|
@@ -7524,14 +7892,14 @@ var RedirectCommand = {
|
|
|
7524
7892
|
command: "redirect <command>",
|
|
7525
7893
|
aliases: ["red"],
|
|
7526
7894
|
describe: "Uniform Redirect commands",
|
|
7527
|
-
builder: (
|
|
7895
|
+
builder: (yargs28) => yargs28.command(RedirectDefinitionModule).demandCommand(),
|
|
7528
7896
|
handler: () => {
|
|
7529
|
-
|
|
7897
|
+
yargs25.showHelp();
|
|
7530
7898
|
}
|
|
7531
7899
|
};
|
|
7532
7900
|
|
|
7533
7901
|
// src/commands/sync/index.ts
|
|
7534
|
-
import
|
|
7902
|
+
import yargs26 from "yargs";
|
|
7535
7903
|
|
|
7536
7904
|
// src/commands/sync/commands/util.ts
|
|
7537
7905
|
import ora2 from "ora";
|
|
@@ -7564,11 +7932,11 @@ function spin(entityType) {
|
|
|
7564
7932
|
var SyncPullModule = {
|
|
7565
7933
|
command: "pull",
|
|
7566
7934
|
describe: "Pulls whole project to local files in a directory",
|
|
7567
|
-
builder: (
|
|
7935
|
+
builder: (yargs28) => withConfiguration(
|
|
7568
7936
|
withApiOptions(
|
|
7569
7937
|
withProjectOptions(
|
|
7570
7938
|
withDiffOptions(
|
|
7571
|
-
|
|
7939
|
+
yargs28.option("what-if", {
|
|
7572
7940
|
alias: ["w"],
|
|
7573
7941
|
describe: "What-if mode reports what would be done but changes no files",
|
|
7574
7942
|
default: false,
|
|
@@ -7582,6 +7950,8 @@ var SyncPullModule = {
|
|
|
7582
7950
|
var _a;
|
|
7583
7951
|
const config2 = serialization;
|
|
7584
7952
|
const enabledEntities = Object.entries({
|
|
7953
|
+
locale: LocalePullModule,
|
|
7954
|
+
asset: AssetPullModule,
|
|
7585
7955
|
category: CategoryPullModule,
|
|
7586
7956
|
dataType: DataTypePullModule,
|
|
7587
7957
|
prompt: PromptPullModule,
|
|
@@ -7597,8 +7967,7 @@ var SyncPullModule = {
|
|
|
7597
7967
|
projectMapNode: ProjectMapNodePullModule,
|
|
7598
7968
|
redirect: RedirectDefinitionPullModule,
|
|
7599
7969
|
entry: EntryPullModule,
|
|
7600
|
-
contentType: ContentTypePullModule
|
|
7601
|
-
asset: AssetPullModule
|
|
7970
|
+
contentType: ContentTypePullModule
|
|
7602
7971
|
}).filter(([entityType]) => {
|
|
7603
7972
|
var _a2, _b, _c, _d, _e, _f;
|
|
7604
7973
|
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;
|
|
@@ -7660,11 +8029,11 @@ var getFormat = (entityType, config2) => {
|
|
|
7660
8029
|
var SyncPushModule = {
|
|
7661
8030
|
command: "push",
|
|
7662
8031
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
7663
|
-
builder: (
|
|
8032
|
+
builder: (yargs28) => withConfiguration(
|
|
7664
8033
|
withApiOptions(
|
|
7665
8034
|
withProjectOptions(
|
|
7666
8035
|
withDiffOptions(
|
|
7667
|
-
|
|
8036
|
+
yargs28.option("what-if", {
|
|
7668
8037
|
alias: ["w"],
|
|
7669
8038
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
7670
8039
|
default: false,
|
|
@@ -7678,6 +8047,8 @@ var SyncPushModule = {
|
|
|
7678
8047
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
7679
8048
|
const config2 = serialization;
|
|
7680
8049
|
const enabledEntities = Object.entries({
|
|
8050
|
+
locale: LocalePushModule,
|
|
8051
|
+
asset: AssetPushModule,
|
|
7681
8052
|
category: CategoryPushModule,
|
|
7682
8053
|
dataType: DataTypePushModule,
|
|
7683
8054
|
prompt: PromptPushModule,
|
|
@@ -7693,8 +8064,7 @@ var SyncPushModule = {
|
|
|
7693
8064
|
projectMapNode: ProjectMapNodePushModule,
|
|
7694
8065
|
redirect: RedirectDefinitionPushModule,
|
|
7695
8066
|
contentType: ContentTypePushModule,
|
|
7696
|
-
entry: EntryPushModule
|
|
7697
|
-
asset: AssetPushModule
|
|
8067
|
+
entry: EntryPushModule
|
|
7698
8068
|
}).filter(([entityType]) => {
|
|
7699
8069
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7700
8070
|
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;
|
|
@@ -7758,9 +8128,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
7758
8128
|
var SyncCommand = {
|
|
7759
8129
|
command: "sync <command>",
|
|
7760
8130
|
describe: "Uniform Sync commands",
|
|
7761
|
-
builder: (
|
|
8131
|
+
builder: (yargs28) => yargs28.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
7762
8132
|
handler: () => {
|
|
7763
|
-
|
|
8133
|
+
yargs26.showHelp();
|
|
7764
8134
|
}
|
|
7765
8135
|
};
|
|
7766
8136
|
|
|
@@ -8026,7 +8396,7 @@ First found was: v${firstVersion}`;
|
|
|
8026
8396
|
|
|
8027
8397
|
// src/index.ts
|
|
8028
8398
|
dotenv.config();
|
|
8029
|
-
var yarggery =
|
|
8399
|
+
var yarggery = yargs27(hideBin(process.argv));
|
|
8030
8400
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
8031
8401
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
8032
8402
|
yarggery.option("verbose", {
|