@uniformdev/cli 19.58.0 → 19.58.1-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +834 -500
- package/package.json +9 -8
package/dist/index.mjs
CHANGED
|
@@ -9,17 +9,17 @@ var __dirname = /* @__PURE__ */ getDirname();
|
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
import * as dotenv from "dotenv";
|
|
12
|
-
import
|
|
12
|
+
import yargs25 from "yargs";
|
|
13
13
|
import { hideBin } from "yargs/helpers";
|
|
14
14
|
|
|
15
15
|
// src/commands/canvas/index.ts
|
|
16
|
-
import
|
|
16
|
+
import yargs9 from "yargs";
|
|
17
17
|
|
|
18
|
-
// src/commands/canvas/commands/
|
|
18
|
+
// src/commands/canvas/commands/asset.ts
|
|
19
19
|
import yargs from "yargs";
|
|
20
20
|
|
|
21
|
-
// src/commands/canvas/commands/
|
|
22
|
-
import {
|
|
21
|
+
// src/commands/canvas/commands/asset/get.ts
|
|
22
|
+
import { UncachedAssetClient } from "@uniformdev/assets";
|
|
23
23
|
|
|
24
24
|
// src/sync/arraySyncEngineDataSource.ts
|
|
25
25
|
async function createArraySyncEngineDataSource({
|
|
@@ -126,14 +126,14 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
126
126
|
import unfetch from "isomorphic-unfetch";
|
|
127
127
|
import { dump, load } from "js-yaml";
|
|
128
128
|
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
129
|
-
function withConfiguration(
|
|
130
|
-
return
|
|
129
|
+
function withConfiguration(yargs26) {
|
|
130
|
+
return yargs26.option("serialization", {
|
|
131
131
|
skipValidation: true,
|
|
132
132
|
hidden: true
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
function withApiOptions(
|
|
136
|
-
return
|
|
135
|
+
function withApiOptions(yargs26) {
|
|
136
|
+
return yargs26.option("apiKey", {
|
|
137
137
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
138
138
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
139
139
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -172,8 +172,8 @@ function nodeFetchProxy(proxy) {
|
|
|
172
172
|
};
|
|
173
173
|
return wrappedFetch;
|
|
174
174
|
}
|
|
175
|
-
function withProjectOptions(
|
|
176
|
-
return
|
|
175
|
+
function withProjectOptions(yargs26) {
|
|
176
|
+
return yargs26.option("project", {
|
|
177
177
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
178
178
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
179
179
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -183,8 +183,8 @@ function withProjectOptions(yargs25) {
|
|
|
183
183
|
alias: ["p"]
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
function withFormatOptions(
|
|
187
|
-
return
|
|
186
|
+
function withFormatOptions(yargs26) {
|
|
187
|
+
return yargs26.option("format", {
|
|
188
188
|
alias: ["f"],
|
|
189
189
|
describe: "Output format",
|
|
190
190
|
default: "yaml",
|
|
@@ -196,8 +196,8 @@ function withFormatOptions(yargs25) {
|
|
|
196
196
|
type: "string"
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function withDiffOptions(
|
|
200
|
-
return
|
|
199
|
+
function withDiffOptions(yargs26) {
|
|
200
|
+
return yargs26.option("diff", {
|
|
201
201
|
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.",
|
|
202
202
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
203
203
|
type: "string",
|
|
@@ -613,15 +613,569 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
613
613
|
};
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
+
// src/commands/canvas/commands/asset/get.ts
|
|
617
|
+
var AssetGetModule = {
|
|
618
|
+
command: "get <id>",
|
|
619
|
+
describe: "Get an asset`",
|
|
620
|
+
builder: (yargs26) => withConfiguration(
|
|
621
|
+
withFormatOptions(
|
|
622
|
+
withApiOptions(
|
|
623
|
+
withProjectOptions(
|
|
624
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
625
|
+
yargs26.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
626
|
+
)
|
|
627
|
+
)
|
|
628
|
+
)
|
|
629
|
+
),
|
|
630
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
631
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
632
|
+
const client = new UncachedAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
633
|
+
const res = await client.get({ offset: 0, limit: 1, assetId: id });
|
|
634
|
+
if (!res) {
|
|
635
|
+
throw new Error(`Asset with ID ${id} not found`);
|
|
636
|
+
}
|
|
637
|
+
emitWithFormat(res, format, filename);
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
// src/commands/canvas/commands/asset/list.ts
|
|
642
|
+
import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets";
|
|
643
|
+
var AssetListModule = {
|
|
644
|
+
command: "list",
|
|
645
|
+
describe: "List assets",
|
|
646
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
647
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
648
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
649
|
+
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
650
|
+
const res = await client.get({ offset: 0, limit: 1e3 });
|
|
651
|
+
emitWithFormat(res.assets, format, filename);
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
// src/commands/canvas/commands/asset/pull.ts
|
|
656
|
+
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
657
|
+
|
|
658
|
+
// src/files/index.ts
|
|
659
|
+
import { preferredType } from "@thi.ng/mime";
|
|
660
|
+
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
661
|
+
import { createHash } from "crypto";
|
|
662
|
+
import fsj from "fs-jetpack";
|
|
663
|
+
import sizeOf from "image-size";
|
|
664
|
+
import PQueue from "p-queue";
|
|
665
|
+
import { join as join2 } from "path";
|
|
666
|
+
var FILES_DIRECTORY_NAME = "files";
|
|
667
|
+
var urlToHash = (url) => {
|
|
668
|
+
const hash = createHash("sha256");
|
|
669
|
+
hash.update(url);
|
|
670
|
+
return hash.digest("hex");
|
|
671
|
+
};
|
|
672
|
+
var urlToFileName = (url) => {
|
|
673
|
+
const fileName = urlToHash(url);
|
|
674
|
+
const fileNameChunks = url.split(".");
|
|
675
|
+
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
676
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
677
|
+
};
|
|
678
|
+
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
679
|
+
const objectAsString = JSON.stringify(object);
|
|
680
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
681
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
682
|
+
);
|
|
683
|
+
if (uniformFileUrlMatches) {
|
|
684
|
+
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
685
|
+
for (const match of uniformFileUrlMatches) {
|
|
686
|
+
const url = new URL(match[1]);
|
|
687
|
+
fileDownloadQueue.add(async () => {
|
|
688
|
+
try {
|
|
689
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
690
|
+
const fileName = urlToFileName(url.toString());
|
|
691
|
+
const fileAlreadyExists = await fsj.existsAsync(
|
|
692
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
693
|
+
);
|
|
694
|
+
if (fileAlreadyExists) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const response = await fetch(fetchUrl);
|
|
698
|
+
if (!response.ok) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const fileBuffer = await response.arrayBuffer();
|
|
702
|
+
await fsj.writeAsync(
|
|
703
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
704
|
+
Buffer.from(fileBuffer)
|
|
705
|
+
);
|
|
706
|
+
} catch {
|
|
707
|
+
console.warn(`Failed to download file ${url}`);
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
await fileDownloadQueue.onIdle();
|
|
712
|
+
}
|
|
713
|
+
return object;
|
|
714
|
+
};
|
|
715
|
+
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
716
|
+
let objectAsString = JSON.stringify(object);
|
|
717
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
718
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
719
|
+
);
|
|
720
|
+
if (uniformFileUrlMatches) {
|
|
721
|
+
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
722
|
+
for (const match of uniformFileUrlMatches) {
|
|
723
|
+
const url = match[1];
|
|
724
|
+
const hash = urlToHash(url);
|
|
725
|
+
fileUploadQueue.add(async () => {
|
|
726
|
+
try {
|
|
727
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
728
|
+
options.fileClient.get({ url }).catch(() => null),
|
|
729
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
730
|
+
]);
|
|
731
|
+
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const localFileName = urlToFileName(url);
|
|
735
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
736
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
737
|
+
);
|
|
738
|
+
if (!fileExistsLocally) {
|
|
739
|
+
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
const fileBuffer = await fsj.readAsync(
|
|
743
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
744
|
+
"buffer"
|
|
745
|
+
);
|
|
746
|
+
if (!fileBuffer) {
|
|
747
|
+
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
const fileName = getFileNameFromUrl(url);
|
|
751
|
+
const { width, height } = (() => {
|
|
752
|
+
try {
|
|
753
|
+
return sizeOf(fileBuffer);
|
|
754
|
+
} catch {
|
|
755
|
+
return {
|
|
756
|
+
width: void 0,
|
|
757
|
+
height: void 0
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
})();
|
|
761
|
+
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
762
|
+
name: fileName,
|
|
763
|
+
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
764
|
+
size: fileBuffer.length,
|
|
765
|
+
width,
|
|
766
|
+
height,
|
|
767
|
+
sourceId: hash
|
|
768
|
+
});
|
|
769
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
770
|
+
method,
|
|
771
|
+
body: fileBuffer
|
|
772
|
+
});
|
|
773
|
+
if (!uploadResponse.ok) {
|
|
774
|
+
console.warn(`Failed to upload file ${url}`);
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
const checkForFile = async () => {
|
|
778
|
+
const file = await options.fileClient.get({ id });
|
|
779
|
+
if (!file || file.state !== FILE_READY_STATE || !file.url) {
|
|
780
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
781
|
+
return checkForFile();
|
|
782
|
+
}
|
|
783
|
+
return file.url;
|
|
784
|
+
};
|
|
785
|
+
const abortTimeout = setTimeout(() => {
|
|
786
|
+
throw new Error(`Failed to upload file ${url}`);
|
|
787
|
+
}, 1e4);
|
|
788
|
+
const uploadedFileUrl = await checkForFile();
|
|
789
|
+
clearTimeout(abortTimeout);
|
|
790
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
791
|
+
} catch {
|
|
792
|
+
console.warn(`Failed to upload file ${url}`);
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
await fileUploadQueue.onIdle();
|
|
797
|
+
}
|
|
798
|
+
return JSON.parse(objectAsString);
|
|
799
|
+
};
|
|
800
|
+
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
801
|
+
let objectAsString = JSON.stringify(object);
|
|
802
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
803
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
804
|
+
);
|
|
805
|
+
if (uniformFileUrlMatches) {
|
|
806
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
807
|
+
for (const match of uniformFileUrlMatches) {
|
|
808
|
+
const url = match[1];
|
|
809
|
+
const hash = urlToHash(url);
|
|
810
|
+
fileUrlReplacementQueue.add(async () => {
|
|
811
|
+
try {
|
|
812
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
813
|
+
options.fileClient.get({ url }).catch(() => null),
|
|
814
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
815
|
+
]);
|
|
816
|
+
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
817
|
+
if (!file) {
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
821
|
+
} catch {
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
await fileUrlReplacementQueue.onIdle();
|
|
826
|
+
}
|
|
827
|
+
return JSON.parse(objectAsString);
|
|
828
|
+
};
|
|
829
|
+
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
830
|
+
var _a;
|
|
831
|
+
const fileUrl = (_a = asset.asset.url) == null ? void 0 : _a.value;
|
|
832
|
+
if (!fileUrl || !asset.asset.file) {
|
|
833
|
+
return asset;
|
|
834
|
+
}
|
|
835
|
+
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
836
|
+
if (!file) {
|
|
837
|
+
return asset;
|
|
838
|
+
}
|
|
839
|
+
asset.asset.file.value = file.id;
|
|
840
|
+
return asset;
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
// src/commands/canvas/assetEngineDataSource.ts
|
|
844
|
+
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
845
|
+
|
|
846
|
+
// src/commands/canvas/commands/asset/_util.ts
|
|
847
|
+
var selectAssetIdentifier = (e) => e.asset._id;
|
|
848
|
+
var selectAssetDisplayName = (e) => {
|
|
849
|
+
var _a;
|
|
850
|
+
return `${((_a = e.asset.title) == null ? void 0 : _a.value) ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// src/commands/canvas/util.ts
|
|
854
|
+
import {
|
|
855
|
+
CANVAS_DRAFT_STATE,
|
|
856
|
+
CANVAS_PUBLISHED_STATE
|
|
857
|
+
} from "@uniformdev/canvas";
|
|
858
|
+
function prepCompositionForDisk(composition) {
|
|
859
|
+
const prepped = {
|
|
860
|
+
...composition
|
|
861
|
+
};
|
|
862
|
+
delete prepped.projectId;
|
|
863
|
+
delete prepped.state;
|
|
864
|
+
return prepped;
|
|
865
|
+
}
|
|
866
|
+
function withStateOptions(yargs26) {
|
|
867
|
+
return yargs26.option("state", {
|
|
868
|
+
type: "string",
|
|
869
|
+
describe: `Composition state to fetch.`,
|
|
870
|
+
choices: ["preview", "published"],
|
|
871
|
+
default: "preview"
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
function convertCompositionState(state) {
|
|
875
|
+
const number = Number(state);
|
|
876
|
+
if (!isNaN(number)) {
|
|
877
|
+
return number;
|
|
878
|
+
}
|
|
879
|
+
if (!state) {
|
|
880
|
+
return CANVAS_PUBLISHED_STATE;
|
|
881
|
+
}
|
|
882
|
+
if (typeof state !== "string") {
|
|
883
|
+
throw new Error('state must be "published", "preview", or a number');
|
|
884
|
+
}
|
|
885
|
+
return state === "preview" ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// src/commands/canvas/assetEngineDataSource.ts
|
|
889
|
+
function createAssetEngineDataSource({
|
|
890
|
+
client
|
|
891
|
+
}) {
|
|
892
|
+
async function* getObjects() {
|
|
893
|
+
const assets = paginateAsync(
|
|
894
|
+
async (offset, limit) => (await client.get({
|
|
895
|
+
limit,
|
|
896
|
+
offset
|
|
897
|
+
})).assets,
|
|
898
|
+
{ pageSize: 100 }
|
|
899
|
+
);
|
|
900
|
+
for await (const e of assets) {
|
|
901
|
+
const result = {
|
|
902
|
+
id: selectAssetIdentifier(e),
|
|
903
|
+
displayName: selectAssetDisplayName(e),
|
|
904
|
+
providerId: e.asset._id,
|
|
905
|
+
object: prepCompositionForDisk(e)
|
|
906
|
+
};
|
|
907
|
+
yield result;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return {
|
|
911
|
+
objects: getObjects(),
|
|
912
|
+
deleteObject: async (providerId) => {
|
|
913
|
+
await client.delete({ assetId: providerId });
|
|
914
|
+
},
|
|
915
|
+
writeObject: async ({ object }) => {
|
|
916
|
+
await client.upsert(convertAssetToPutAsset(object));
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// src/commands/canvas/package.ts
|
|
922
|
+
function readCanvasPackage(filename, assertExists) {
|
|
923
|
+
return readUniformPackage(filename, assertExists);
|
|
924
|
+
}
|
|
925
|
+
function writeCanvasPackage(filename, packageContents) {
|
|
926
|
+
writeUniformPackage(filename, packageContents);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// src/commands/canvas/commands/asset/pull.ts
|
|
930
|
+
var AssetPullModule = {
|
|
931
|
+
command: "pull <directory>",
|
|
932
|
+
describe: "Pulls all assets to local files in a directory",
|
|
933
|
+
builder: (yargs26) => withConfiguration(
|
|
934
|
+
withApiOptions(
|
|
935
|
+
withProjectOptions(
|
|
936
|
+
withDiffOptions(
|
|
937
|
+
yargs26.positional("directory", {
|
|
938
|
+
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.",
|
|
939
|
+
type: "string"
|
|
940
|
+
}).option("format", {
|
|
941
|
+
alias: ["f"],
|
|
942
|
+
describe: "Output format",
|
|
943
|
+
default: "yaml",
|
|
944
|
+
choices: ["yaml", "json"],
|
|
945
|
+
type: "string"
|
|
946
|
+
}).option("what-if", {
|
|
947
|
+
alias: ["w"],
|
|
948
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
949
|
+
default: false,
|
|
950
|
+
type: "boolean"
|
|
951
|
+
}).option("mode", {
|
|
952
|
+
alias: ["m"],
|
|
953
|
+
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',
|
|
954
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
955
|
+
default: "mirror",
|
|
956
|
+
type: "string"
|
|
957
|
+
})
|
|
958
|
+
)
|
|
959
|
+
)
|
|
960
|
+
)
|
|
961
|
+
),
|
|
962
|
+
handler: async ({
|
|
963
|
+
apiHost,
|
|
964
|
+
apiKey,
|
|
965
|
+
proxy,
|
|
966
|
+
directory,
|
|
967
|
+
format,
|
|
968
|
+
mode,
|
|
969
|
+
whatIf,
|
|
970
|
+
project: projectId,
|
|
971
|
+
diff: diffMode
|
|
972
|
+
}) => {
|
|
973
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
974
|
+
const client = new UncachedAssetClient3({
|
|
975
|
+
apiKey,
|
|
976
|
+
apiHost,
|
|
977
|
+
fetch: fetch3,
|
|
978
|
+
projectId
|
|
979
|
+
});
|
|
980
|
+
const source = createAssetEngineDataSource({ client });
|
|
981
|
+
let target;
|
|
982
|
+
const isPackage = isPathAPackageFile(directory);
|
|
983
|
+
if (isPackage) {
|
|
984
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
985
|
+
target = await createArraySyncEngineDataSource({
|
|
986
|
+
objects: packageContents.assets ?? [],
|
|
987
|
+
selectIdentifier: selectAssetIdentifier,
|
|
988
|
+
selectDisplayName: selectAssetDisplayName,
|
|
989
|
+
onSyncComplete: async (_, synced) => {
|
|
990
|
+
packageContents.assets = synced;
|
|
991
|
+
writeCanvasPackage(directory, packageContents);
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
} else {
|
|
995
|
+
target = await createFileSyncEngineDataSource({
|
|
996
|
+
directory,
|
|
997
|
+
selectIdentifier: selectAssetIdentifier,
|
|
998
|
+
selectDisplayName: selectAssetDisplayName,
|
|
999
|
+
format
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
await syncEngine({
|
|
1003
|
+
source,
|
|
1004
|
+
target,
|
|
1005
|
+
mode,
|
|
1006
|
+
whatIf,
|
|
1007
|
+
allowEmptySource: true,
|
|
1008
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1009
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1010
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1011
|
+
directory
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
// src/commands/canvas/commands/asset/push.ts
|
|
1019
|
+
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1020
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
1021
|
+
var AssetPushModule = {
|
|
1022
|
+
command: "push <directory>",
|
|
1023
|
+
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1024
|
+
builder: (yargs26) => withConfiguration(
|
|
1025
|
+
withApiOptions(
|
|
1026
|
+
withProjectOptions(
|
|
1027
|
+
withDiffOptions(
|
|
1028
|
+
yargs26.positional("directory", {
|
|
1029
|
+
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1030
|
+
type: "string"
|
|
1031
|
+
}).option("what-if", {
|
|
1032
|
+
alias: ["w"],
|
|
1033
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1034
|
+
default: false,
|
|
1035
|
+
type: "boolean"
|
|
1036
|
+
}).option("mode", {
|
|
1037
|
+
alias: ["m"],
|
|
1038
|
+
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',
|
|
1039
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1040
|
+
default: "mirror",
|
|
1041
|
+
type: "string"
|
|
1042
|
+
})
|
|
1043
|
+
)
|
|
1044
|
+
)
|
|
1045
|
+
)
|
|
1046
|
+
),
|
|
1047
|
+
handler: async ({
|
|
1048
|
+
apiHost,
|
|
1049
|
+
apiKey,
|
|
1050
|
+
proxy,
|
|
1051
|
+
directory,
|
|
1052
|
+
mode,
|
|
1053
|
+
whatIf,
|
|
1054
|
+
project: projectId,
|
|
1055
|
+
diff: diffMode
|
|
1056
|
+
}) => {
|
|
1057
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1058
|
+
const client = new UncachedAssetClient4({
|
|
1059
|
+
apiKey,
|
|
1060
|
+
apiHost,
|
|
1061
|
+
fetch: fetch3,
|
|
1062
|
+
projectId
|
|
1063
|
+
});
|
|
1064
|
+
let source;
|
|
1065
|
+
const isPackage = isPathAPackageFile(directory);
|
|
1066
|
+
if (isPackage) {
|
|
1067
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
1068
|
+
source = await createArraySyncEngineDataSource({
|
|
1069
|
+
objects: packageContents.assets ?? [],
|
|
1070
|
+
selectIdentifier: selectAssetIdentifier,
|
|
1071
|
+
selectDisplayName: selectAssetDisplayName
|
|
1072
|
+
});
|
|
1073
|
+
} else {
|
|
1074
|
+
source = await createFileSyncEngineDataSource({
|
|
1075
|
+
directory,
|
|
1076
|
+
selectIdentifier: selectAssetIdentifier,
|
|
1077
|
+
selectDisplayName: selectAssetDisplayName
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
const target = createAssetEngineDataSource({ client });
|
|
1081
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1082
|
+
await syncEngine({
|
|
1083
|
+
source,
|
|
1084
|
+
target,
|
|
1085
|
+
mode,
|
|
1086
|
+
whatIf,
|
|
1087
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1088
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
1089
|
+
const sourceObjectWithNewFileUrls = await swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
1090
|
+
fileClient
|
|
1091
|
+
});
|
|
1092
|
+
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1093
|
+
sourceObjectWithNewFileUrls.object,
|
|
1094
|
+
{
|
|
1095
|
+
fileClient
|
|
1096
|
+
}
|
|
1097
|
+
);
|
|
1098
|
+
return sourceObjectWithNewFileUrls;
|
|
1099
|
+
},
|
|
1100
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1101
|
+
const sourceObjectWithNewFileUrls = await extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1102
|
+
directory,
|
|
1103
|
+
fileClient
|
|
1104
|
+
});
|
|
1105
|
+
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1106
|
+
sourceObjectWithNewFileUrls.object,
|
|
1107
|
+
{
|
|
1108
|
+
fileClient
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
return sourceObjectWithNewFileUrls;
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
// src/commands/canvas/commands/asset/remove.ts
|
|
1118
|
+
import { UncachedAssetClient as UncachedAssetClient5 } from "@uniformdev/assets";
|
|
1119
|
+
var AssetRemoveModule = {
|
|
1120
|
+
command: "remove <id>",
|
|
1121
|
+
aliases: ["delete", "rm"],
|
|
1122
|
+
describe: "Delete an asset",
|
|
1123
|
+
builder: (yargs26) => withConfiguration(
|
|
1124
|
+
withApiOptions(
|
|
1125
|
+
withProjectOptions(yargs26.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1126
|
+
)
|
|
1127
|
+
),
|
|
1128
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
1129
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1130
|
+
const client = new UncachedAssetClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1131
|
+
await client.delete({ assetId: id });
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
// src/commands/canvas/commands/asset/update.ts
|
|
1136
|
+
import { UncachedAssetClient as UncachedAssetClient6 } from "@uniformdev/assets";
|
|
1137
|
+
var AssetUpdateModule = {
|
|
1138
|
+
command: "update <filename>",
|
|
1139
|
+
aliases: ["put"],
|
|
1140
|
+
describe: "Insert or update an asset",
|
|
1141
|
+
builder: (yargs26) => withConfiguration(
|
|
1142
|
+
withApiOptions(
|
|
1143
|
+
withProjectOptions(
|
|
1144
|
+
yargs26.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1145
|
+
)
|
|
1146
|
+
)
|
|
1147
|
+
),
|
|
1148
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
1149
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1150
|
+
const client = new UncachedAssetClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1151
|
+
const file = readFileToObject(filename);
|
|
1152
|
+
await client.upsert(file);
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
// src/commands/canvas/commands/asset.ts
|
|
1157
|
+
var AssetModule = {
|
|
1158
|
+
command: "asset <command>",
|
|
1159
|
+
describe: "Commands for Assets",
|
|
1160
|
+
builder: (yargs26) => yargs26.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1161
|
+
handler: () => {
|
|
1162
|
+
yargs.help();
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
// src/commands/canvas/commands/category.ts
|
|
1167
|
+
import yargs2 from "yargs";
|
|
1168
|
+
|
|
616
1169
|
// src/commands/canvas/commands/category/get.ts
|
|
1170
|
+
import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
617
1171
|
var CategoryGetModule = {
|
|
618
1172
|
command: "get <id>",
|
|
619
1173
|
describe: "Fetch a category",
|
|
620
|
-
builder: (
|
|
1174
|
+
builder: (yargs26) => withConfiguration(
|
|
621
1175
|
withFormatOptions(
|
|
622
1176
|
withApiOptions(
|
|
623
1177
|
withProjectOptions(
|
|
624
|
-
|
|
1178
|
+
yargs26.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
625
1179
|
)
|
|
626
1180
|
)
|
|
627
1181
|
)
|
|
@@ -646,7 +1200,7 @@ var CategoryListModule = {
|
|
|
646
1200
|
command: "list",
|
|
647
1201
|
describe: "List categories",
|
|
648
1202
|
aliases: ["ls"],
|
|
649
|
-
builder: (
|
|
1203
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26.options({}))))),
|
|
650
1204
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
651
1205
|
const fetch3 = nodeFetchProxy(proxy);
|
|
652
1206
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -691,23 +1245,15 @@ function createCategoriesEngineDataSource({
|
|
|
691
1245
|
};
|
|
692
1246
|
}
|
|
693
1247
|
|
|
694
|
-
// src/commands/canvas/package.ts
|
|
695
|
-
function readCanvasPackage(filename, assertExists) {
|
|
696
|
-
return readUniformPackage(filename, assertExists);
|
|
697
|
-
}
|
|
698
|
-
function writeCanvasPackage(filename, packageContents) {
|
|
699
|
-
writeUniformPackage(filename, packageContents);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
1248
|
// src/commands/canvas/commands/category/pull.ts
|
|
703
1249
|
var CategoryPullModule = {
|
|
704
1250
|
command: "pull <directory>",
|
|
705
1251
|
describe: "Pulls all categories to local files in a directory",
|
|
706
|
-
builder: (
|
|
1252
|
+
builder: (yargs26) => withConfiguration(
|
|
707
1253
|
withApiOptions(
|
|
708
1254
|
withProjectOptions(
|
|
709
1255
|
withDiffOptions(
|
|
710
|
-
|
|
1256
|
+
yargs26.positional("directory", {
|
|
711
1257
|
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.",
|
|
712
1258
|
type: "string"
|
|
713
1259
|
}).option("format", {
|
|
@@ -783,11 +1329,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
783
1329
|
var CategoryPushModule = {
|
|
784
1330
|
command: "push <directory>",
|
|
785
1331
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
786
|
-
builder: (
|
|
1332
|
+
builder: (yargs26) => withConfiguration(
|
|
787
1333
|
withApiOptions(
|
|
788
1334
|
withProjectOptions(
|
|
789
1335
|
withDiffOptions(
|
|
790
|
-
|
|
1336
|
+
yargs26.positional("directory", {
|
|
791
1337
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
792
1338
|
type: "string"
|
|
793
1339
|
}).option("what-if", {
|
|
@@ -851,10 +1397,10 @@ var CategoryRemoveModule = {
|
|
|
851
1397
|
command: "remove <id>",
|
|
852
1398
|
aliases: ["delete", "rm"],
|
|
853
1399
|
describe: "Delete a category",
|
|
854
|
-
builder: (
|
|
1400
|
+
builder: (yargs26) => withConfiguration(
|
|
855
1401
|
withApiOptions(
|
|
856
1402
|
withProjectOptions(
|
|
857
|
-
|
|
1403
|
+
yargs26.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
858
1404
|
)
|
|
859
1405
|
)
|
|
860
1406
|
),
|
|
@@ -871,10 +1417,10 @@ var CategoryUpdateModule = {
|
|
|
871
1417
|
command: "update <filename>",
|
|
872
1418
|
aliases: ["put"],
|
|
873
1419
|
describe: "Insert or update a category",
|
|
874
|
-
builder: (
|
|
1420
|
+
builder: (yargs26) => withConfiguration(
|
|
875
1421
|
withApiOptions(
|
|
876
1422
|
withProjectOptions(
|
|
877
|
-
|
|
1423
|
+
yargs26.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
878
1424
|
)
|
|
879
1425
|
)
|
|
880
1426
|
),
|
|
@@ -891,14 +1437,14 @@ var CategoryModule = {
|
|
|
891
1437
|
command: "category <command>",
|
|
892
1438
|
aliases: ["cat"],
|
|
893
1439
|
describe: "Commands for Canvas categories",
|
|
894
|
-
builder: (
|
|
1440
|
+
builder: (yargs26) => yargs26.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
895
1441
|
handler: () => {
|
|
896
|
-
|
|
1442
|
+
yargs2.help();
|
|
897
1443
|
}
|
|
898
1444
|
};
|
|
899
1445
|
|
|
900
1446
|
// src/commands/canvas/commands/component.ts
|
|
901
|
-
import
|
|
1447
|
+
import yargs3 from "yargs";
|
|
902
1448
|
|
|
903
1449
|
// src/commands/canvas/commands/component/get.ts
|
|
904
1450
|
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
@@ -912,11 +1458,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
912
1458
|
var ComponentGetModule = {
|
|
913
1459
|
command: "get <id>",
|
|
914
1460
|
describe: "Fetch a component definition",
|
|
915
|
-
builder: (
|
|
1461
|
+
builder: (yargs26) => withConfiguration(
|
|
916
1462
|
withFormatOptions(
|
|
917
1463
|
withApiOptions(
|
|
918
1464
|
withProjectOptions(
|
|
919
|
-
|
|
1465
|
+
yargs26.positional("id", {
|
|
920
1466
|
demandOption: true,
|
|
921
1467
|
describe: "Component definition public ID to fetch"
|
|
922
1468
|
})
|
|
@@ -950,11 +1496,11 @@ var ComponentListModule = {
|
|
|
950
1496
|
command: "list",
|
|
951
1497
|
describe: "List component definitions",
|
|
952
1498
|
aliases: ["ls"],
|
|
953
|
-
builder: (
|
|
1499
|
+
builder: (yargs26) => withConfiguration(
|
|
954
1500
|
withFormatOptions(
|
|
955
1501
|
withApiOptions(
|
|
956
1502
|
withProjectOptions(
|
|
957
|
-
|
|
1503
|
+
yargs26.options({
|
|
958
1504
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
959
1505
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
960
1506
|
})
|
|
@@ -1009,11 +1555,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1009
1555
|
var ComponentPullModule = {
|
|
1010
1556
|
command: "pull <directory>",
|
|
1011
1557
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1012
|
-
builder: (
|
|
1558
|
+
builder: (yargs26) => withConfiguration(
|
|
1013
1559
|
withApiOptions(
|
|
1014
1560
|
withProjectOptions(
|
|
1015
1561
|
withDiffOptions(
|
|
1016
|
-
|
|
1562
|
+
yargs26.positional("directory", {
|
|
1017
1563
|
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.",
|
|
1018
1564
|
type: "string"
|
|
1019
1565
|
}).option("format", {
|
|
@@ -1090,11 +1636,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1090
1636
|
var ComponentPushModule = {
|
|
1091
1637
|
command: "push <directory>",
|
|
1092
1638
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1093
|
-
builder: (
|
|
1639
|
+
builder: (yargs26) => withConfiguration(
|
|
1094
1640
|
withApiOptions(
|
|
1095
1641
|
withProjectOptions(
|
|
1096
1642
|
withDiffOptions(
|
|
1097
|
-
|
|
1643
|
+
yargs26.positional("directory", {
|
|
1098
1644
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1099
1645
|
type: "string"
|
|
1100
1646
|
}).option("what-if", {
|
|
@@ -1159,10 +1705,10 @@ var ComponentRemoveModule = {
|
|
|
1159
1705
|
command: "remove <id>",
|
|
1160
1706
|
aliases: ["delete", "rm"],
|
|
1161
1707
|
describe: "Delete a component definition",
|
|
1162
|
-
builder: (
|
|
1708
|
+
builder: (yargs26) => withConfiguration(
|
|
1163
1709
|
withApiOptions(
|
|
1164
1710
|
withProjectOptions(
|
|
1165
|
-
|
|
1711
|
+
yargs26.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1166
1712
|
)
|
|
1167
1713
|
)
|
|
1168
1714
|
),
|
|
@@ -1179,10 +1725,10 @@ var ComponentUpdateModule = {
|
|
|
1179
1725
|
command: "update <filename>",
|
|
1180
1726
|
aliases: ["put"],
|
|
1181
1727
|
describe: "Insert or update a component definition",
|
|
1182
|
-
builder: (
|
|
1728
|
+
builder: (yargs26) => withConfiguration(
|
|
1183
1729
|
withApiOptions(
|
|
1184
1730
|
withProjectOptions(
|
|
1185
|
-
|
|
1731
|
+
yargs26.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1186
1732
|
)
|
|
1187
1733
|
)
|
|
1188
1734
|
),
|
|
@@ -1192,70 +1738,33 @@ var ComponentUpdateModule = {
|
|
|
1192
1738
|
const file = readFileToObject(filename);
|
|
1193
1739
|
await client.updateComponentDefinition({ componentDefinition: file });
|
|
1194
1740
|
}
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
// src/commands/canvas/commands/component.ts
|
|
1198
|
-
var ComponentModule = {
|
|
1199
|
-
command: "component <command>",
|
|
1200
|
-
aliases: ["def"],
|
|
1201
|
-
describe: "Commands for Canvas component definitions",
|
|
1202
|
-
builder: (
|
|
1203
|
-
handler: () => {
|
|
1204
|
-
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
|
|
1208
|
-
// src/commands/canvas/commands/composition.ts
|
|
1209
|
-
import
|
|
1210
|
-
|
|
1211
|
-
// src/commands/canvas/commands/composition/get.ts
|
|
1212
|
-
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1213
|
-
|
|
1214
|
-
// src/commands/canvas/util.ts
|
|
1215
|
-
import {
|
|
1216
|
-
CANVAS_DRAFT_STATE,
|
|
1217
|
-
CANVAS_PUBLISHED_STATE
|
|
1218
|
-
} from "@uniformdev/canvas";
|
|
1219
|
-
function prepCompositionForDisk(composition) {
|
|
1220
|
-
const prepped = {
|
|
1221
|
-
...composition
|
|
1222
|
-
};
|
|
1223
|
-
delete prepped.projectId;
|
|
1224
|
-
delete prepped.state;
|
|
1225
|
-
return prepped;
|
|
1226
|
-
}
|
|
1227
|
-
function withStateOptions(yargs25) {
|
|
1228
|
-
return yargs25.option("state", {
|
|
1229
|
-
type: "string",
|
|
1230
|
-
describe: `Composition state to fetch.`,
|
|
1231
|
-
choices: ["preview", "published"],
|
|
1232
|
-
default: "preview"
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
function convertCompositionState(state) {
|
|
1236
|
-
const number = Number(state);
|
|
1237
|
-
if (!isNaN(number)) {
|
|
1238
|
-
return number;
|
|
1239
|
-
}
|
|
1240
|
-
if (!state) {
|
|
1241
|
-
return CANVAS_PUBLISHED_STATE;
|
|
1242
|
-
}
|
|
1243
|
-
if (typeof state !== "string") {
|
|
1244
|
-
throw new Error('state must be "published", "preview", or a number');
|
|
1245
|
-
}
|
|
1246
|
-
return state === "preview" ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE;
|
|
1247
|
-
}
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
// src/commands/canvas/commands/component.ts
|
|
1744
|
+
var ComponentModule = {
|
|
1745
|
+
command: "component <command>",
|
|
1746
|
+
aliases: ["def"],
|
|
1747
|
+
describe: "Commands for Canvas component definitions",
|
|
1748
|
+
builder: (yargs26) => yargs26.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1749
|
+
handler: () => {
|
|
1750
|
+
yargs3.help();
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
|
|
1754
|
+
// src/commands/canvas/commands/composition.ts
|
|
1755
|
+
import yargs4 from "yargs";
|
|
1248
1756
|
|
|
1249
1757
|
// src/commands/canvas/commands/composition/get.ts
|
|
1758
|
+
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1250
1759
|
var CompositionGetModule = {
|
|
1251
1760
|
command: "get <id>",
|
|
1252
1761
|
describe: "Fetch a composition",
|
|
1253
|
-
builder: (
|
|
1762
|
+
builder: (yargs26) => withFormatOptions(
|
|
1254
1763
|
withConfiguration(
|
|
1255
1764
|
withApiOptions(
|
|
1256
1765
|
withProjectOptions(
|
|
1257
1766
|
withStateOptions(
|
|
1258
|
-
|
|
1767
|
+
yargs26.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1259
1768
|
resolvePatterns: {
|
|
1260
1769
|
type: "boolean",
|
|
1261
1770
|
default: false,
|
|
@@ -1326,12 +1835,12 @@ var CompositionListModule = {
|
|
|
1326
1835
|
command: "list",
|
|
1327
1836
|
describe: "List compositions",
|
|
1328
1837
|
aliases: ["ls"],
|
|
1329
|
-
builder: (
|
|
1838
|
+
builder: (yargs26) => withFormatOptions(
|
|
1330
1839
|
withConfiguration(
|
|
1331
1840
|
withApiOptions(
|
|
1332
1841
|
withProjectOptions(
|
|
1333
1842
|
withStateOptions(
|
|
1334
|
-
|
|
1843
|
+
yargs26.options({
|
|
1335
1844
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1336
1845
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1337
1846
|
resolvePatterns: {
|
|
@@ -1452,11 +1961,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
1452
1961
|
var CompositionPublishModule = {
|
|
1453
1962
|
command: "publish [ids]",
|
|
1454
1963
|
describe: "Publishes composition(s)",
|
|
1455
|
-
builder: (
|
|
1964
|
+
builder: (yargs26) => withConfiguration(
|
|
1456
1965
|
withApiOptions(
|
|
1457
1966
|
withProjectOptions(
|
|
1458
1967
|
withDiffOptions(
|
|
1459
|
-
|
|
1968
|
+
yargs26.positional("ids", {
|
|
1460
1969
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1461
1970
|
type: "string"
|
|
1462
1971
|
}).option("all", {
|
|
@@ -1528,189 +2037,15 @@ var CompositionPublishModule = {
|
|
|
1528
2037
|
|
|
1529
2038
|
// src/commands/canvas/commands/composition/pull.ts
|
|
1530
2039
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
1531
|
-
|
|
1532
|
-
// src/files/index.ts
|
|
1533
|
-
import { preferredType } from "@thi.ng/mime";
|
|
1534
|
-
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
1535
|
-
import { createHash } from "crypto";
|
|
1536
|
-
import fsj from "fs-jetpack";
|
|
1537
|
-
import sizeOf from "image-size";
|
|
1538
|
-
import PQueue from "p-queue";
|
|
1539
|
-
import { join as join2 } from "path";
|
|
1540
|
-
var FILES_DIRECTORY_NAME = "files";
|
|
1541
|
-
var urlToHash = (url) => {
|
|
1542
|
-
const hash = createHash("sha256");
|
|
1543
|
-
hash.update(url);
|
|
1544
|
-
return hash.digest("hex");
|
|
1545
|
-
};
|
|
1546
|
-
var urlToFileName = (url) => {
|
|
1547
|
-
const fileName = urlToHash(url);
|
|
1548
|
-
const fileNameChunks = url.split(".");
|
|
1549
|
-
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
1550
|
-
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
1551
|
-
};
|
|
1552
|
-
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
1553
|
-
const objectAsString = JSON.stringify(object);
|
|
1554
|
-
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1555
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1556
|
-
);
|
|
1557
|
-
if (uniformFileUrlMatches) {
|
|
1558
|
-
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
1559
|
-
for (const match of uniformFileUrlMatches) {
|
|
1560
|
-
const url = new URL(match[1]);
|
|
1561
|
-
fileDownloadQueue.add(async () => {
|
|
1562
|
-
try {
|
|
1563
|
-
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
1564
|
-
const fileName = urlToFileName(url.toString());
|
|
1565
|
-
const fileAlreadyExists = await fsj.existsAsync(
|
|
1566
|
-
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
1567
|
-
);
|
|
1568
|
-
if (fileAlreadyExists) {
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
const response = await fetch(fetchUrl);
|
|
1572
|
-
if (!response.ok) {
|
|
1573
|
-
return;
|
|
1574
|
-
}
|
|
1575
|
-
const fileBuffer = await response.arrayBuffer();
|
|
1576
|
-
await fsj.writeAsync(
|
|
1577
|
-
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
1578
|
-
Buffer.from(fileBuffer)
|
|
1579
|
-
);
|
|
1580
|
-
} catch {
|
|
1581
|
-
console.warn(`Failed to download file ${url}`);
|
|
1582
|
-
}
|
|
1583
|
-
});
|
|
1584
|
-
}
|
|
1585
|
-
await fileDownloadQueue.onIdle();
|
|
1586
|
-
}
|
|
1587
|
-
return object;
|
|
1588
|
-
};
|
|
1589
|
-
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
1590
|
-
let objectAsString = JSON.stringify(object);
|
|
1591
|
-
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1592
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1593
|
-
);
|
|
1594
|
-
if (uniformFileUrlMatches) {
|
|
1595
|
-
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
1596
|
-
for (const match of uniformFileUrlMatches) {
|
|
1597
|
-
const url = match[1];
|
|
1598
|
-
const hash = urlToHash(url);
|
|
1599
|
-
fileUploadQueue.add(async () => {
|
|
1600
|
-
try {
|
|
1601
|
-
const fileAlreadyExistsChecks = await Promise.all([
|
|
1602
|
-
options.fileClient.get({ url }).catch(() => null),
|
|
1603
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
1604
|
-
]);
|
|
1605
|
-
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
1606
|
-
return;
|
|
1607
|
-
}
|
|
1608
|
-
const localFileName = urlToFileName(url);
|
|
1609
|
-
const fileExistsLocally = await fsj.existsAsync(
|
|
1610
|
-
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
1611
|
-
);
|
|
1612
|
-
if (!fileExistsLocally) {
|
|
1613
|
-
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
const fileBuffer = await fsj.readAsync(
|
|
1617
|
-
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
1618
|
-
"buffer"
|
|
1619
|
-
);
|
|
1620
|
-
if (!fileBuffer) {
|
|
1621
|
-
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
1622
|
-
return;
|
|
1623
|
-
}
|
|
1624
|
-
const fileName = getFileNameFromUrl(url);
|
|
1625
|
-
const { width, height } = (() => {
|
|
1626
|
-
try {
|
|
1627
|
-
return sizeOf(fileBuffer);
|
|
1628
|
-
} catch {
|
|
1629
|
-
return {
|
|
1630
|
-
width: void 0,
|
|
1631
|
-
height: void 0
|
|
1632
|
-
};
|
|
1633
|
-
}
|
|
1634
|
-
})();
|
|
1635
|
-
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
1636
|
-
name: fileName,
|
|
1637
|
-
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
1638
|
-
size: fileBuffer.length,
|
|
1639
|
-
width,
|
|
1640
|
-
height,
|
|
1641
|
-
sourceId: hash
|
|
1642
|
-
});
|
|
1643
|
-
const uploadResponse = await fetch(uploadUrl, {
|
|
1644
|
-
method,
|
|
1645
|
-
body: fileBuffer
|
|
1646
|
-
});
|
|
1647
|
-
if (!uploadResponse.ok) {
|
|
1648
|
-
console.warn(`Failed to upload file ${url}`);
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1651
|
-
const checkForFile = async () => {
|
|
1652
|
-
const file = await options.fileClient.get({ id });
|
|
1653
|
-
if (!file || file.state !== FILE_READY_STATE || !file.url) {
|
|
1654
|
-
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
1655
|
-
return checkForFile();
|
|
1656
|
-
}
|
|
1657
|
-
return file.url;
|
|
1658
|
-
};
|
|
1659
|
-
const abortTimeout = setTimeout(() => {
|
|
1660
|
-
throw new Error(`Failed to upload file ${url}`);
|
|
1661
|
-
}, 1e4);
|
|
1662
|
-
const uploadedFileUrl = await checkForFile();
|
|
1663
|
-
clearTimeout(abortTimeout);
|
|
1664
|
-
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
1665
|
-
} catch {
|
|
1666
|
-
console.warn(`Failed to upload file ${url}`);
|
|
1667
|
-
}
|
|
1668
|
-
});
|
|
1669
|
-
}
|
|
1670
|
-
await fileUploadQueue.onIdle();
|
|
1671
|
-
}
|
|
1672
|
-
return JSON.parse(objectAsString);
|
|
1673
|
-
};
|
|
1674
|
-
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
1675
|
-
let objectAsString = JSON.stringify(object);
|
|
1676
|
-
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1677
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1678
|
-
);
|
|
1679
|
-
if (uniformFileUrlMatches) {
|
|
1680
|
-
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
1681
|
-
for (const match of uniformFileUrlMatches) {
|
|
1682
|
-
const url = match[1];
|
|
1683
|
-
const hash = urlToHash(url);
|
|
1684
|
-
fileUrlReplacementQueue.add(async () => {
|
|
1685
|
-
try {
|
|
1686
|
-
const fileAlreadyExistsChecks = await Promise.all([
|
|
1687
|
-
options.fileClient.get({ url }).catch(() => null),
|
|
1688
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
1689
|
-
]);
|
|
1690
|
-
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
1691
|
-
if (!file) {
|
|
1692
|
-
return;
|
|
1693
|
-
}
|
|
1694
|
-
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
1695
|
-
} catch {
|
|
1696
|
-
}
|
|
1697
|
-
});
|
|
1698
|
-
}
|
|
1699
|
-
await fileUrlReplacementQueue.onIdle();
|
|
1700
|
-
}
|
|
1701
|
-
return JSON.parse(objectAsString);
|
|
1702
|
-
};
|
|
1703
|
-
|
|
1704
|
-
// src/commands/canvas/commands/composition/pull.ts
|
|
1705
2040
|
var CompositionPullModule = {
|
|
1706
2041
|
command: "pull <directory>",
|
|
1707
2042
|
describe: "Pulls all compositions to local files in a directory",
|
|
1708
|
-
builder: (
|
|
2043
|
+
builder: (yargs26) => withConfiguration(
|
|
1709
2044
|
withApiOptions(
|
|
1710
2045
|
withProjectOptions(
|
|
1711
2046
|
withStateOptions(
|
|
1712
2047
|
withDiffOptions(
|
|
1713
|
-
|
|
2048
|
+
yargs26.positional("directory", {
|
|
1714
2049
|
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.",
|
|
1715
2050
|
type: "string"
|
|
1716
2051
|
}).option("format", {
|
|
@@ -1801,16 +2136,16 @@ var CompositionPullModule = {
|
|
|
1801
2136
|
|
|
1802
2137
|
// src/commands/canvas/commands/composition/push.ts
|
|
1803
2138
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
1804
|
-
import {
|
|
2139
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1805
2140
|
var CompositionPushModule = {
|
|
1806
2141
|
command: "push <directory>",
|
|
1807
2142
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
1808
|
-
builder: (
|
|
2143
|
+
builder: (yargs26) => withConfiguration(
|
|
1809
2144
|
withApiOptions(
|
|
1810
2145
|
withProjectOptions(
|
|
1811
2146
|
withStateOptions(
|
|
1812
2147
|
withDiffOptions(
|
|
1813
|
-
|
|
2148
|
+
yargs26.positional("directory", {
|
|
1814
2149
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
1815
2150
|
type: "string"
|
|
1816
2151
|
}).option("what-if", {
|
|
@@ -1871,7 +2206,7 @@ var CompositionPushModule = {
|
|
|
1871
2206
|
});
|
|
1872
2207
|
}
|
|
1873
2208
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1874
|
-
const fileClient = new
|
|
2209
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1875
2210
|
await syncEngine({
|
|
1876
2211
|
source,
|
|
1877
2212
|
target,
|
|
@@ -1880,15 +2215,13 @@ var CompositionPushModule = {
|
|
|
1880
2215
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1881
2216
|
onBeforeCompareObjects: async (sourceObject) => {
|
|
1882
2217
|
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
1883
|
-
fileClient
|
|
1884
|
-
projectId
|
|
2218
|
+
fileClient
|
|
1885
2219
|
});
|
|
1886
2220
|
},
|
|
1887
2221
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1888
2222
|
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1889
2223
|
directory,
|
|
1890
|
-
fileClient
|
|
1891
|
-
projectId
|
|
2224
|
+
fileClient
|
|
1892
2225
|
});
|
|
1893
2226
|
}
|
|
1894
2227
|
});
|
|
@@ -1901,10 +2234,10 @@ var CompositionRemoveModule = {
|
|
|
1901
2234
|
command: "remove <id>",
|
|
1902
2235
|
aliases: ["delete", "rm"],
|
|
1903
2236
|
describe: "Delete a composition",
|
|
1904
|
-
builder: (
|
|
2237
|
+
builder: (yargs26) => withConfiguration(
|
|
1905
2238
|
withApiOptions(
|
|
1906
2239
|
withProjectOptions(
|
|
1907
|
-
|
|
2240
|
+
yargs26.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
1908
2241
|
)
|
|
1909
2242
|
)
|
|
1910
2243
|
),
|
|
@@ -1921,10 +2254,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
1921
2254
|
var CompositionUnpublishModule = {
|
|
1922
2255
|
command: "unpublish [ids]",
|
|
1923
2256
|
describe: "Unpublish a composition(s)",
|
|
1924
|
-
builder: (
|
|
2257
|
+
builder: (yargs26) => withConfiguration(
|
|
1925
2258
|
withApiOptions(
|
|
1926
2259
|
withProjectOptions(
|
|
1927
|
-
|
|
2260
|
+
yargs26.positional("ids", {
|
|
1928
2261
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
1929
2262
|
type: "string"
|
|
1930
2263
|
}).option("all", {
|
|
@@ -2018,11 +2351,11 @@ var CompositionUpdateModule = {
|
|
|
2018
2351
|
command: "update <filename>",
|
|
2019
2352
|
aliases: ["put"],
|
|
2020
2353
|
describe: "Insert or update a composition",
|
|
2021
|
-
builder: (
|
|
2354
|
+
builder: (yargs26) => withConfiguration(
|
|
2022
2355
|
withApiOptions(
|
|
2023
2356
|
withProjectOptions(
|
|
2024
2357
|
withStateOptions(
|
|
2025
|
-
|
|
2358
|
+
yargs26.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2026
2359
|
)
|
|
2027
2360
|
)
|
|
2028
2361
|
)
|
|
@@ -2040,26 +2373,26 @@ var CompositionModule = {
|
|
|
2040
2373
|
command: "composition <command>",
|
|
2041
2374
|
describe: "Commands for Canvas compositions",
|
|
2042
2375
|
aliases: ["comp"],
|
|
2043
|
-
builder: (
|
|
2376
|
+
builder: (yargs26) => yargs26.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2044
2377
|
handler: () => {
|
|
2045
|
-
|
|
2378
|
+
yargs4.help();
|
|
2046
2379
|
}
|
|
2047
2380
|
};
|
|
2048
2381
|
|
|
2049
2382
|
// src/commands/canvas/commands/contentType.ts
|
|
2050
|
-
import
|
|
2383
|
+
import yargs5 from "yargs";
|
|
2051
2384
|
|
|
2052
2385
|
// src/commands/canvas/commands/contentType/get.ts
|
|
2053
2386
|
import { ContentClient } from "@uniformdev/canvas";
|
|
2054
2387
|
var ContentTypeGetModule = {
|
|
2055
2388
|
command: "get <id>",
|
|
2056
2389
|
describe: "Get a content type",
|
|
2057
|
-
builder: (
|
|
2390
|
+
builder: (yargs26) => withConfiguration(
|
|
2058
2391
|
withFormatOptions(
|
|
2059
2392
|
withApiOptions(
|
|
2060
2393
|
withProjectOptions(
|
|
2061
2394
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2062
|
-
|
|
2395
|
+
yargs26.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2063
2396
|
)
|
|
2064
2397
|
)
|
|
2065
2398
|
)
|
|
@@ -2081,7 +2414,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2081
2414
|
var ContentTypeListModule = {
|
|
2082
2415
|
command: "list",
|
|
2083
2416
|
describe: "List content types",
|
|
2084
|
-
builder: (
|
|
2417
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
2085
2418
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2086
2419
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2087
2420
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2128,11 +2461,11 @@ function createContentTypeEngineDataSource({
|
|
|
2128
2461
|
var ContentTypePullModule = {
|
|
2129
2462
|
command: "pull <directory>",
|
|
2130
2463
|
describe: "Pulls all content types to local files in a directory",
|
|
2131
|
-
builder: (
|
|
2464
|
+
builder: (yargs26) => withConfiguration(
|
|
2132
2465
|
withApiOptions(
|
|
2133
2466
|
withProjectOptions(
|
|
2134
2467
|
withDiffOptions(
|
|
2135
|
-
|
|
2468
|
+
yargs26.positional("directory", {
|
|
2136
2469
|
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.",
|
|
2137
2470
|
type: "string"
|
|
2138
2471
|
}).option("format", {
|
|
@@ -2214,11 +2547,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2214
2547
|
var ContentTypePushModule = {
|
|
2215
2548
|
command: "push <directory>",
|
|
2216
2549
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2217
|
-
builder: (
|
|
2550
|
+
builder: (yargs26) => withConfiguration(
|
|
2218
2551
|
withApiOptions(
|
|
2219
2552
|
withProjectOptions(
|
|
2220
2553
|
withDiffOptions(
|
|
2221
|
-
|
|
2554
|
+
yargs26.positional("directory", {
|
|
2222
2555
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2223
2556
|
type: "string"
|
|
2224
2557
|
}).option("what-if", {
|
|
@@ -2288,10 +2621,10 @@ var ContentTypeRemoveModule = {
|
|
|
2288
2621
|
command: "remove <id>",
|
|
2289
2622
|
aliases: ["delete", "rm"],
|
|
2290
2623
|
describe: "Delete a content type",
|
|
2291
|
-
builder: (
|
|
2624
|
+
builder: (yargs26) => withConfiguration(
|
|
2292
2625
|
withApiOptions(
|
|
2293
2626
|
withProjectOptions(
|
|
2294
|
-
|
|
2627
|
+
yargs26.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2295
2628
|
)
|
|
2296
2629
|
)
|
|
2297
2630
|
),
|
|
@@ -2308,10 +2641,10 @@ var ContentTypeUpdateModule = {
|
|
|
2308
2641
|
command: "update <filename>",
|
|
2309
2642
|
aliases: ["put"],
|
|
2310
2643
|
describe: "Insert or update a content type",
|
|
2311
|
-
builder: (
|
|
2644
|
+
builder: (yargs26) => withConfiguration(
|
|
2312
2645
|
withApiOptions(
|
|
2313
2646
|
withProjectOptions(
|
|
2314
|
-
|
|
2647
|
+
yargs26.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2315
2648
|
)
|
|
2316
2649
|
)
|
|
2317
2650
|
),
|
|
@@ -2328,14 +2661,14 @@ var ContentTypeModule = {
|
|
|
2328
2661
|
command: "contenttype <command>",
|
|
2329
2662
|
aliases: ["ct"],
|
|
2330
2663
|
describe: "Commands for Content Types",
|
|
2331
|
-
builder: (
|
|
2664
|
+
builder: (yargs26) => yargs26.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2332
2665
|
handler: () => {
|
|
2333
|
-
|
|
2666
|
+
yargs5.help();
|
|
2334
2667
|
}
|
|
2335
2668
|
};
|
|
2336
2669
|
|
|
2337
2670
|
// src/commands/canvas/commands/dataType.ts
|
|
2338
|
-
import
|
|
2671
|
+
import yargs6 from "yargs";
|
|
2339
2672
|
|
|
2340
2673
|
// src/commands/canvas/commands/dataType/get.ts
|
|
2341
2674
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
@@ -2343,12 +2676,12 @@ var DataTypeGetModule = {
|
|
|
2343
2676
|
command: "get <id>",
|
|
2344
2677
|
describe: "Get a data type",
|
|
2345
2678
|
aliases: ["ls"],
|
|
2346
|
-
builder: (
|
|
2679
|
+
builder: (yargs26) => withConfiguration(
|
|
2347
2680
|
withFormatOptions(
|
|
2348
2681
|
withApiOptions(
|
|
2349
2682
|
withProjectOptions(
|
|
2350
2683
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2351
|
-
|
|
2684
|
+
yargs26.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2352
2685
|
)
|
|
2353
2686
|
)
|
|
2354
2687
|
)
|
|
@@ -2371,7 +2704,7 @@ var DataTypeListModule = {
|
|
|
2371
2704
|
command: "list",
|
|
2372
2705
|
describe: "List data types",
|
|
2373
2706
|
aliases: ["ls"],
|
|
2374
|
-
builder: (
|
|
2707
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
2375
2708
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2376
2709
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2377
2710
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2424,11 +2757,11 @@ function createDataTypeEngineDataSource({
|
|
|
2424
2757
|
var DataTypePullModule = {
|
|
2425
2758
|
command: "pull <directory>",
|
|
2426
2759
|
describe: "Pulls all data types to local files in a directory",
|
|
2427
|
-
builder: (
|
|
2760
|
+
builder: (yargs26) => withConfiguration(
|
|
2428
2761
|
withApiOptions(
|
|
2429
2762
|
withProjectOptions(
|
|
2430
2763
|
withDiffOptions(
|
|
2431
|
-
|
|
2764
|
+
yargs26.positional("directory", {
|
|
2432
2765
|
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.",
|
|
2433
2766
|
type: "string"
|
|
2434
2767
|
}).option("format", {
|
|
@@ -2510,11 +2843,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
2510
2843
|
var DataTypePushModule = {
|
|
2511
2844
|
command: "push <directory>",
|
|
2512
2845
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2513
|
-
builder: (
|
|
2846
|
+
builder: (yargs26) => withConfiguration(
|
|
2514
2847
|
withApiOptions(
|
|
2515
2848
|
withProjectOptions(
|
|
2516
2849
|
withDiffOptions(
|
|
2517
|
-
|
|
2850
|
+
yargs26.positional("directory", {
|
|
2518
2851
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2519
2852
|
type: "string"
|
|
2520
2853
|
}).option("what-if", {
|
|
@@ -2584,10 +2917,10 @@ var DataTypeRemoveModule = {
|
|
|
2584
2917
|
command: "remove <id>",
|
|
2585
2918
|
aliases: ["delete", "rm"],
|
|
2586
2919
|
describe: "Delete a data type",
|
|
2587
|
-
builder: (
|
|
2920
|
+
builder: (yargs26) => withConfiguration(
|
|
2588
2921
|
withApiOptions(
|
|
2589
2922
|
withProjectOptions(
|
|
2590
|
-
|
|
2923
|
+
yargs26.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2591
2924
|
)
|
|
2592
2925
|
)
|
|
2593
2926
|
),
|
|
@@ -2604,10 +2937,10 @@ var DataTypeUpdateModule = {
|
|
|
2604
2937
|
command: "update <filename>",
|
|
2605
2938
|
aliases: ["put"],
|
|
2606
2939
|
describe: "Insert or update a data type",
|
|
2607
|
-
builder: (
|
|
2940
|
+
builder: (yargs26) => withConfiguration(
|
|
2608
2941
|
withApiOptions(
|
|
2609
2942
|
withProjectOptions(
|
|
2610
|
-
|
|
2943
|
+
yargs26.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2611
2944
|
)
|
|
2612
2945
|
)
|
|
2613
2946
|
),
|
|
@@ -2624,26 +2957,26 @@ var DataTypeModule = {
|
|
|
2624
2957
|
command: "datatype <command>",
|
|
2625
2958
|
aliases: ["dt"],
|
|
2626
2959
|
describe: "Commands for Data Type definitions",
|
|
2627
|
-
builder: (
|
|
2960
|
+
builder: (yargs26) => yargs26.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
2628
2961
|
handler: () => {
|
|
2629
|
-
|
|
2962
|
+
yargs6.help();
|
|
2630
2963
|
}
|
|
2631
2964
|
};
|
|
2632
2965
|
|
|
2633
2966
|
// src/commands/canvas/commands/entry.ts
|
|
2634
|
-
import
|
|
2967
|
+
import yargs7 from "yargs";
|
|
2635
2968
|
|
|
2636
2969
|
// src/commands/canvas/commands/entry/get.ts
|
|
2637
2970
|
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
2638
2971
|
var EntryGetModule = {
|
|
2639
2972
|
command: "get <id>",
|
|
2640
2973
|
describe: "Get an entry",
|
|
2641
|
-
builder: (
|
|
2974
|
+
builder: (yargs26) => withConfiguration(
|
|
2642
2975
|
withFormatOptions(
|
|
2643
2976
|
withApiOptions(
|
|
2644
2977
|
withProjectOptions(
|
|
2645
2978
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2646
|
-
|
|
2979
|
+
yargs26.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
2647
2980
|
)
|
|
2648
2981
|
)
|
|
2649
2982
|
)
|
|
@@ -2664,7 +2997,7 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
|
2664
2997
|
var EntryListModule = {
|
|
2665
2998
|
command: "list",
|
|
2666
2999
|
describe: "List entries",
|
|
2667
|
-
builder: (
|
|
3000
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
2668
3001
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2669
3002
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2670
3003
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2721,12 +3054,12 @@ function createEntryEngineDataSource({
|
|
|
2721
3054
|
var EntryPullModule = {
|
|
2722
3055
|
command: "pull <directory>",
|
|
2723
3056
|
describe: "Pulls all entries to local files in a directory",
|
|
2724
|
-
builder: (
|
|
3057
|
+
builder: (yargs26) => withConfiguration(
|
|
2725
3058
|
withApiOptions(
|
|
2726
3059
|
withProjectOptions(
|
|
2727
3060
|
withStateOptions(
|
|
2728
3061
|
withDiffOptions(
|
|
2729
|
-
|
|
3062
|
+
yargs26.positional("directory", {
|
|
2730
3063
|
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.",
|
|
2731
3064
|
type: "string"
|
|
2732
3065
|
}).option("format", {
|
|
@@ -2810,12 +3143,12 @@ import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
|
2810
3143
|
var EntryPushModule = {
|
|
2811
3144
|
command: "push <directory>",
|
|
2812
3145
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
2813
|
-
builder: (
|
|
3146
|
+
builder: (yargs26) => withConfiguration(
|
|
2814
3147
|
withApiOptions(
|
|
2815
3148
|
withProjectOptions(
|
|
2816
3149
|
withStateOptions(
|
|
2817
3150
|
withDiffOptions(
|
|
2818
|
-
|
|
3151
|
+
yargs26.positional("directory", {
|
|
2819
3152
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
2820
3153
|
type: "string"
|
|
2821
3154
|
}).option("what-if", {
|
|
@@ -2887,10 +3220,10 @@ var EntryRemoveModule = {
|
|
|
2887
3220
|
command: "remove <id>",
|
|
2888
3221
|
aliases: ["delete", "rm"],
|
|
2889
3222
|
describe: "Delete an entry",
|
|
2890
|
-
builder: (
|
|
3223
|
+
builder: (yargs26) => withConfiguration(
|
|
2891
3224
|
withApiOptions(
|
|
2892
3225
|
withProjectOptions(
|
|
2893
|
-
|
|
3226
|
+
yargs26.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
2894
3227
|
)
|
|
2895
3228
|
)
|
|
2896
3229
|
),
|
|
@@ -2907,10 +3240,10 @@ var EntryUpdateModule = {
|
|
|
2907
3240
|
command: "update <filename>",
|
|
2908
3241
|
aliases: ["put"],
|
|
2909
3242
|
describe: "Insert or update an entry",
|
|
2910
|
-
builder: (
|
|
3243
|
+
builder: (yargs26) => withConfiguration(
|
|
2911
3244
|
withApiOptions(
|
|
2912
3245
|
withProjectOptions(
|
|
2913
|
-
|
|
3246
|
+
yargs26.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
2914
3247
|
)
|
|
2915
3248
|
)
|
|
2916
3249
|
),
|
|
@@ -2926,14 +3259,14 @@ var EntryUpdateModule = {
|
|
|
2926
3259
|
var EntryModule = {
|
|
2927
3260
|
command: "entry <command>",
|
|
2928
3261
|
describe: "Commands for Entries",
|
|
2929
|
-
builder: (
|
|
3262
|
+
builder: (yargs26) => yargs26.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
2930
3263
|
handler: () => {
|
|
2931
|
-
|
|
3264
|
+
yargs7.help();
|
|
2932
3265
|
}
|
|
2933
3266
|
};
|
|
2934
3267
|
|
|
2935
3268
|
// src/commands/canvas/commands/pattern.ts
|
|
2936
|
-
import
|
|
3269
|
+
import yargs8 from "yargs";
|
|
2937
3270
|
|
|
2938
3271
|
// src/commands/canvas/commands/pattern/get.ts
|
|
2939
3272
|
var PatternGetModule = {
|
|
@@ -2945,12 +3278,12 @@ var PatternGetModule = {
|
|
|
2945
3278
|
var PatternListModule = {
|
|
2946
3279
|
...CompositionListModule,
|
|
2947
3280
|
describe: "List patterns",
|
|
2948
|
-
builder: (
|
|
3281
|
+
builder: (yargs26) => withFormatOptions(
|
|
2949
3282
|
withConfiguration(
|
|
2950
3283
|
withApiOptions(
|
|
2951
3284
|
withProjectOptions(
|
|
2952
3285
|
withStateOptions(
|
|
2953
|
-
|
|
3286
|
+
yargs26.options({
|
|
2954
3287
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2955
3288
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2956
3289
|
resolvePatterns: {
|
|
@@ -2988,11 +3321,11 @@ var PatternListModule = {
|
|
|
2988
3321
|
var PatternPublishModule = {
|
|
2989
3322
|
...CompositionPublishModule,
|
|
2990
3323
|
describe: "Publishes pattern(s)",
|
|
2991
|
-
builder: (
|
|
3324
|
+
builder: (yargs26) => withConfiguration(
|
|
2992
3325
|
withApiOptions(
|
|
2993
3326
|
withProjectOptions(
|
|
2994
3327
|
withDiffOptions(
|
|
2995
|
-
|
|
3328
|
+
yargs26.positional("ids", {
|
|
2996
3329
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
2997
3330
|
type: "string"
|
|
2998
3331
|
}).option("all", {
|
|
@@ -3030,12 +3363,12 @@ var PatternPublishModule = {
|
|
|
3030
3363
|
var PatternPullModule = {
|
|
3031
3364
|
...CompositionPullModule,
|
|
3032
3365
|
describe: "Pulls all patterns to local files in a directory",
|
|
3033
|
-
builder: (
|
|
3366
|
+
builder: (yargs26) => withConfiguration(
|
|
3034
3367
|
withApiOptions(
|
|
3035
3368
|
withProjectOptions(
|
|
3036
3369
|
withStateOptions(
|
|
3037
3370
|
withDiffOptions(
|
|
3038
|
-
|
|
3371
|
+
yargs26.positional("directory", {
|
|
3039
3372
|
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.",
|
|
3040
3373
|
type: "string"
|
|
3041
3374
|
}).option("format", {
|
|
@@ -3073,12 +3406,12 @@ var PatternPullModule = {
|
|
|
3073
3406
|
var PatternPushModule = {
|
|
3074
3407
|
...CompositionPushModule,
|
|
3075
3408
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
3076
|
-
builder: (
|
|
3409
|
+
builder: (yargs26) => withConfiguration(
|
|
3077
3410
|
withApiOptions(
|
|
3078
3411
|
withProjectOptions(
|
|
3079
3412
|
withStateOptions(
|
|
3080
3413
|
withDiffOptions(
|
|
3081
|
-
|
|
3414
|
+
yargs26.positional("directory", {
|
|
3082
3415
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
3083
3416
|
type: "string"
|
|
3084
3417
|
}).option("what-if", {
|
|
@@ -3116,10 +3449,10 @@ var PatternRemoveModule = {
|
|
|
3116
3449
|
var PatternUnpublishModule = {
|
|
3117
3450
|
command: "unpublish [ids]",
|
|
3118
3451
|
describe: "Unpublish a pattern(s)",
|
|
3119
|
-
builder: (
|
|
3452
|
+
builder: (yargs26) => withConfiguration(
|
|
3120
3453
|
withApiOptions(
|
|
3121
3454
|
withProjectOptions(
|
|
3122
|
-
|
|
3455
|
+
yargs26.positional("ids", {
|
|
3123
3456
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3124
3457
|
type: "string"
|
|
3125
3458
|
}).option("all", {
|
|
@@ -3158,9 +3491,9 @@ var PatternUpdateModule = {
|
|
|
3158
3491
|
var PatternModule = {
|
|
3159
3492
|
command: "pattern <command>",
|
|
3160
3493
|
describe: "Commands for Canvas patterns",
|
|
3161
|
-
builder: (
|
|
3494
|
+
builder: (yargs26) => yargs26.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3162
3495
|
handler: () => {
|
|
3163
|
-
|
|
3496
|
+
yargs8.help();
|
|
3164
3497
|
}
|
|
3165
3498
|
};
|
|
3166
3499
|
|
|
@@ -3169,28 +3502,28 @@ var CanvasCommand = {
|
|
|
3169
3502
|
command: "canvas <command>",
|
|
3170
3503
|
aliases: ["cv", "pm", "presentation"],
|
|
3171
3504
|
describe: "Uniform Canvas commands",
|
|
3172
|
-
builder: (
|
|
3505
|
+
builder: (yargs26) => yargs26.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).command(AssetModule).demandCommand(),
|
|
3173
3506
|
handler: () => {
|
|
3174
|
-
|
|
3507
|
+
yargs9.showHelp();
|
|
3175
3508
|
}
|
|
3176
3509
|
};
|
|
3177
3510
|
|
|
3178
3511
|
// src/commands/context/index.ts
|
|
3179
|
-
import
|
|
3512
|
+
import yargs16 from "yargs";
|
|
3180
3513
|
|
|
3181
3514
|
// src/commands/context/commands/aggregate.ts
|
|
3182
|
-
import
|
|
3515
|
+
import yargs10 from "yargs";
|
|
3183
3516
|
|
|
3184
3517
|
// src/commands/context/commands/aggregate/get.ts
|
|
3185
3518
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
3186
3519
|
var AggregateGetModule = {
|
|
3187
3520
|
command: "get <id>",
|
|
3188
3521
|
describe: "Fetch an aggregate",
|
|
3189
|
-
builder: (
|
|
3522
|
+
builder: (yargs26) => withConfiguration(
|
|
3190
3523
|
withFormatOptions(
|
|
3191
3524
|
withApiOptions(
|
|
3192
3525
|
withProjectOptions(
|
|
3193
|
-
|
|
3526
|
+
yargs26.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3194
3527
|
)
|
|
3195
3528
|
)
|
|
3196
3529
|
)
|
|
@@ -3214,7 +3547,7 @@ var AggregateListModule = {
|
|
|
3214
3547
|
command: "list",
|
|
3215
3548
|
describe: "List aggregates",
|
|
3216
3549
|
aliases: ["ls"],
|
|
3217
|
-
builder: (
|
|
3550
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
3218
3551
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3219
3552
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3220
3553
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3280,11 +3613,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
3280
3613
|
var AggregatePullModule = {
|
|
3281
3614
|
command: "pull <directory>",
|
|
3282
3615
|
describe: "Pulls all aggregates to local files in a directory",
|
|
3283
|
-
builder: (
|
|
3616
|
+
builder: (yargs26) => withConfiguration(
|
|
3284
3617
|
withApiOptions(
|
|
3285
3618
|
withProjectOptions(
|
|
3286
3619
|
withDiffOptions(
|
|
3287
|
-
|
|
3620
|
+
yargs26.positional("directory", {
|
|
3288
3621
|
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.",
|
|
3289
3622
|
type: "string"
|
|
3290
3623
|
}).option("format", {
|
|
@@ -3359,11 +3692,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
3359
3692
|
var AggregatePushModule = {
|
|
3360
3693
|
command: "push <directory>",
|
|
3361
3694
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
3362
|
-
builder: (
|
|
3695
|
+
builder: (yargs26) => withConfiguration(
|
|
3363
3696
|
withApiOptions(
|
|
3364
3697
|
withProjectOptions(
|
|
3365
3698
|
withDiffOptions(
|
|
3366
|
-
|
|
3699
|
+
yargs26.positional("directory", {
|
|
3367
3700
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
3368
3701
|
type: "string"
|
|
3369
3702
|
}).option("what-if", {
|
|
@@ -3428,10 +3761,10 @@ var AggregateRemoveModule = {
|
|
|
3428
3761
|
command: "remove <id>",
|
|
3429
3762
|
aliases: ["delete", "rm"],
|
|
3430
3763
|
describe: "Delete an aggregate",
|
|
3431
|
-
builder: (
|
|
3764
|
+
builder: (yargs26) => withConfiguration(
|
|
3432
3765
|
withApiOptions(
|
|
3433
3766
|
withProjectOptions(
|
|
3434
|
-
|
|
3767
|
+
yargs26.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
3435
3768
|
)
|
|
3436
3769
|
)
|
|
3437
3770
|
),
|
|
@@ -3448,10 +3781,10 @@ var AggregateUpdateModule = {
|
|
|
3448
3781
|
command: "update <filename>",
|
|
3449
3782
|
aliases: ["put"],
|
|
3450
3783
|
describe: "Insert or update an aggregate",
|
|
3451
|
-
builder: (
|
|
3784
|
+
builder: (yargs26) => withConfiguration(
|
|
3452
3785
|
withApiOptions(
|
|
3453
3786
|
withProjectOptions(
|
|
3454
|
-
|
|
3787
|
+
yargs26.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
3455
3788
|
)
|
|
3456
3789
|
)
|
|
3457
3790
|
),
|
|
@@ -3468,25 +3801,25 @@ var AggregateModule = {
|
|
|
3468
3801
|
command: "aggregate <command>",
|
|
3469
3802
|
aliases: ["agg", "intent", "audience"],
|
|
3470
3803
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
3471
|
-
builder: (
|
|
3804
|
+
builder: (yargs26) => yargs26.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
3472
3805
|
handler: () => {
|
|
3473
|
-
|
|
3806
|
+
yargs10.help();
|
|
3474
3807
|
}
|
|
3475
3808
|
};
|
|
3476
3809
|
|
|
3477
3810
|
// src/commands/context/commands/enrichment.ts
|
|
3478
|
-
import
|
|
3811
|
+
import yargs11 from "yargs";
|
|
3479
3812
|
|
|
3480
3813
|
// src/commands/context/commands/enrichment/get.ts
|
|
3481
3814
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
3482
3815
|
var EnrichmentGetModule = {
|
|
3483
3816
|
command: "get <id>",
|
|
3484
3817
|
describe: "Fetch an enrichment category and its values",
|
|
3485
|
-
builder: (
|
|
3818
|
+
builder: (yargs26) => withFormatOptions(
|
|
3486
3819
|
withConfiguration(
|
|
3487
3820
|
withApiOptions(
|
|
3488
3821
|
withProjectOptions(
|
|
3489
|
-
|
|
3822
|
+
yargs26.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
3490
3823
|
)
|
|
3491
3824
|
)
|
|
3492
3825
|
)
|
|
@@ -3511,7 +3844,7 @@ var EnrichmentListModule = {
|
|
|
3511
3844
|
command: "list",
|
|
3512
3845
|
describe: "List enrichments",
|
|
3513
3846
|
aliases: ["ls"],
|
|
3514
|
-
builder: (
|
|
3847
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
3515
3848
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3516
3849
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3517
3850
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3612,11 +3945,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
3612
3945
|
var EnrichmentPullModule = {
|
|
3613
3946
|
command: "pull <directory>",
|
|
3614
3947
|
describe: "Pulls all enrichments to local files in a directory",
|
|
3615
|
-
builder: (
|
|
3948
|
+
builder: (yargs26) => withConfiguration(
|
|
3616
3949
|
withApiOptions(
|
|
3617
3950
|
withProjectOptions(
|
|
3618
3951
|
withDiffOptions(
|
|
3619
|
-
|
|
3952
|
+
yargs26.positional("directory", {
|
|
3620
3953
|
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.",
|
|
3621
3954
|
type: "string"
|
|
3622
3955
|
}).option("format", {
|
|
@@ -3691,11 +4024,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
3691
4024
|
var EnrichmentPushModule = {
|
|
3692
4025
|
command: "push <directory>",
|
|
3693
4026
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
3694
|
-
builder: (
|
|
4027
|
+
builder: (yargs26) => withConfiguration(
|
|
3695
4028
|
withApiOptions(
|
|
3696
4029
|
withProjectOptions(
|
|
3697
4030
|
withDiffOptions(
|
|
3698
|
-
|
|
4031
|
+
yargs26.positional("directory", {
|
|
3699
4032
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
3700
4033
|
type: "string"
|
|
3701
4034
|
}).option("what-if", {
|
|
@@ -3759,10 +4092,10 @@ var EnrichmentRemoveModule = {
|
|
|
3759
4092
|
command: "remove <id>",
|
|
3760
4093
|
aliases: ["delete", "rm"],
|
|
3761
4094
|
describe: "Delete an enrichment category and its values",
|
|
3762
|
-
builder: (
|
|
4095
|
+
builder: (yargs26) => withConfiguration(
|
|
3763
4096
|
withApiOptions(
|
|
3764
4097
|
withProjectOptions(
|
|
3765
|
-
|
|
4098
|
+
yargs26.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
3766
4099
|
)
|
|
3767
4100
|
)
|
|
3768
4101
|
),
|
|
@@ -3778,14 +4111,14 @@ var EnrichmentModule = {
|
|
|
3778
4111
|
command: "enrichment <command>",
|
|
3779
4112
|
aliases: ["enr"],
|
|
3780
4113
|
describe: "Commands for Context enrichments",
|
|
3781
|
-
builder: (
|
|
4114
|
+
builder: (yargs26) => yargs26.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
3782
4115
|
handler: () => {
|
|
3783
|
-
|
|
4116
|
+
yargs11.help();
|
|
3784
4117
|
}
|
|
3785
4118
|
};
|
|
3786
4119
|
|
|
3787
4120
|
// src/commands/context/commands/manifest.ts
|
|
3788
|
-
import
|
|
4121
|
+
import yargs12 from "yargs";
|
|
3789
4122
|
|
|
3790
4123
|
// src/commands/context/commands/manifest/get.ts
|
|
3791
4124
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -3796,10 +4129,10 @@ var ManifestGetModule = {
|
|
|
3796
4129
|
command: "get [output]",
|
|
3797
4130
|
aliases: ["dl", "download"],
|
|
3798
4131
|
describe: "Download the Uniform Context manifest for a project",
|
|
3799
|
-
builder: (
|
|
4132
|
+
builder: (yargs26) => withConfiguration(
|
|
3800
4133
|
withApiOptions(
|
|
3801
4134
|
withProjectOptions(
|
|
3802
|
-
|
|
4135
|
+
yargs26.option("preview", {
|
|
3803
4136
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
3804
4137
|
default: false,
|
|
3805
4138
|
type: "boolean",
|
|
@@ -3861,7 +4194,7 @@ import { exit as exit2 } from "process";
|
|
|
3861
4194
|
var ManifestPublishModule = {
|
|
3862
4195
|
command: "publish",
|
|
3863
4196
|
describe: "Publish the Uniform Context manifest for a project",
|
|
3864
|
-
builder: (
|
|
4197
|
+
builder: (yargs26) => withConfiguration(withApiOptions(withProjectOptions(yargs26))),
|
|
3865
4198
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
3866
4199
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3867
4200
|
try {
|
|
@@ -3894,25 +4227,25 @@ var ManifestModule = {
|
|
|
3894
4227
|
command: "manifest <command>",
|
|
3895
4228
|
describe: "Commands for context manifests",
|
|
3896
4229
|
aliases: ["man"],
|
|
3897
|
-
builder: (
|
|
4230
|
+
builder: (yargs26) => yargs26.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
3898
4231
|
handler: () => {
|
|
3899
|
-
|
|
4232
|
+
yargs12.help();
|
|
3900
4233
|
}
|
|
3901
4234
|
};
|
|
3902
4235
|
|
|
3903
4236
|
// src/commands/context/commands/quirk.ts
|
|
3904
|
-
import
|
|
4237
|
+
import yargs13 from "yargs";
|
|
3905
4238
|
|
|
3906
4239
|
// src/commands/context/commands/quirk/get.ts
|
|
3907
4240
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
3908
4241
|
var QuirkGetModule = {
|
|
3909
4242
|
command: "get <id>",
|
|
3910
4243
|
describe: "Fetch a quirk",
|
|
3911
|
-
builder: (
|
|
4244
|
+
builder: (yargs26) => withConfiguration(
|
|
3912
4245
|
withFormatOptions(
|
|
3913
4246
|
withApiOptions(
|
|
3914
4247
|
withProjectOptions(
|
|
3915
|
-
|
|
4248
|
+
yargs26.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
3916
4249
|
)
|
|
3917
4250
|
)
|
|
3918
4251
|
)
|
|
@@ -3936,11 +4269,11 @@ var QuirkListModule = {
|
|
|
3936
4269
|
command: "list",
|
|
3937
4270
|
describe: "List quirks",
|
|
3938
4271
|
aliases: ["ls"],
|
|
3939
|
-
builder: (
|
|
4272
|
+
builder: (yargs26) => withConfiguration(
|
|
3940
4273
|
withFormatOptions(
|
|
3941
4274
|
withApiOptions(
|
|
3942
4275
|
withProjectOptions(
|
|
3943
|
-
|
|
4276
|
+
yargs26.option("withIntegrations", {
|
|
3944
4277
|
alias: ["i"],
|
|
3945
4278
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
3946
4279
|
type: "boolean"
|
|
@@ -3997,11 +4330,11 @@ function createQuirkEngineDataSource({
|
|
|
3997
4330
|
var QuirkPullModule = {
|
|
3998
4331
|
command: "pull <directory>",
|
|
3999
4332
|
describe: "Pulls all quirks to local files in a directory",
|
|
4000
|
-
builder: (
|
|
4333
|
+
builder: (yargs26) => withConfiguration(
|
|
4001
4334
|
withApiOptions(
|
|
4002
4335
|
withProjectOptions(
|
|
4003
4336
|
withDiffOptions(
|
|
4004
|
-
|
|
4337
|
+
yargs26.positional("directory", {
|
|
4005
4338
|
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.",
|
|
4006
4339
|
type: "string"
|
|
4007
4340
|
}).option("format", {
|
|
@@ -4076,11 +4409,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
4076
4409
|
var QuirkPushModule = {
|
|
4077
4410
|
command: "push <directory>",
|
|
4078
4411
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
4079
|
-
builder: (
|
|
4412
|
+
builder: (yargs26) => withConfiguration(
|
|
4080
4413
|
withApiOptions(
|
|
4081
4414
|
withProjectOptions(
|
|
4082
4415
|
withDiffOptions(
|
|
4083
|
-
|
|
4416
|
+
yargs26.positional("directory", {
|
|
4084
4417
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
4085
4418
|
type: "string"
|
|
4086
4419
|
}).option("what-if", {
|
|
@@ -4144,10 +4477,10 @@ var QuirkRemoveModule = {
|
|
|
4144
4477
|
command: "remove <id>",
|
|
4145
4478
|
aliases: ["delete", "rm"],
|
|
4146
4479
|
describe: "Delete a quirk",
|
|
4147
|
-
builder: (
|
|
4480
|
+
builder: (yargs26) => withConfiguration(
|
|
4148
4481
|
withApiOptions(
|
|
4149
4482
|
withProjectOptions(
|
|
4150
|
-
|
|
4483
|
+
yargs26.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4151
4484
|
)
|
|
4152
4485
|
)
|
|
4153
4486
|
),
|
|
@@ -4164,10 +4497,10 @@ var QuirkUpdateModule = {
|
|
|
4164
4497
|
command: "update <filename>",
|
|
4165
4498
|
aliases: ["put"],
|
|
4166
4499
|
describe: "Insert or update a quirk",
|
|
4167
|
-
builder: (
|
|
4500
|
+
builder: (yargs26) => withConfiguration(
|
|
4168
4501
|
withApiOptions(
|
|
4169
4502
|
withProjectOptions(
|
|
4170
|
-
|
|
4503
|
+
yargs26.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4171
4504
|
)
|
|
4172
4505
|
)
|
|
4173
4506
|
),
|
|
@@ -4184,25 +4517,25 @@ var QuirkModule = {
|
|
|
4184
4517
|
command: "quirk <command>",
|
|
4185
4518
|
aliases: ["qk"],
|
|
4186
4519
|
describe: "Commands for Context quirks",
|
|
4187
|
-
builder: (
|
|
4520
|
+
builder: (yargs26) => yargs26.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
4188
4521
|
handler: () => {
|
|
4189
|
-
|
|
4522
|
+
yargs13.help();
|
|
4190
4523
|
}
|
|
4191
4524
|
};
|
|
4192
4525
|
|
|
4193
4526
|
// src/commands/context/commands/signal.ts
|
|
4194
|
-
import
|
|
4527
|
+
import yargs14 from "yargs";
|
|
4195
4528
|
|
|
4196
4529
|
// src/commands/context/commands/signal/get.ts
|
|
4197
4530
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
4198
4531
|
var SignalGetModule = {
|
|
4199
4532
|
command: "get <id>",
|
|
4200
4533
|
describe: "Fetch a signal",
|
|
4201
|
-
builder: (
|
|
4534
|
+
builder: (yargs26) => withConfiguration(
|
|
4202
4535
|
withFormatOptions(
|
|
4203
4536
|
withApiOptions(
|
|
4204
4537
|
withProjectOptions(
|
|
4205
|
-
|
|
4538
|
+
yargs26.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4206
4539
|
)
|
|
4207
4540
|
)
|
|
4208
4541
|
)
|
|
@@ -4226,7 +4559,7 @@ var SignalListModule = {
|
|
|
4226
4559
|
command: "list",
|
|
4227
4560
|
describe: "List signals",
|
|
4228
4561
|
aliases: ["ls"],
|
|
4229
|
-
builder: (
|
|
4562
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
4230
4563
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4231
4564
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4232
4565
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4275,11 +4608,11 @@ function createSignalEngineDataSource({
|
|
|
4275
4608
|
var SignalPullModule = {
|
|
4276
4609
|
command: "pull <directory>",
|
|
4277
4610
|
describe: "Pulls all signals to local files in a directory",
|
|
4278
|
-
builder: (
|
|
4611
|
+
builder: (yargs26) => withConfiguration(
|
|
4279
4612
|
withApiOptions(
|
|
4280
4613
|
withProjectOptions(
|
|
4281
4614
|
withDiffOptions(
|
|
4282
|
-
|
|
4615
|
+
yargs26.positional("directory", {
|
|
4283
4616
|
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.",
|
|
4284
4617
|
type: "string"
|
|
4285
4618
|
}).option("format", {
|
|
@@ -4354,11 +4687,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
4354
4687
|
var SignalPushModule = {
|
|
4355
4688
|
command: "push <directory>",
|
|
4356
4689
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
4357
|
-
builder: (
|
|
4690
|
+
builder: (yargs26) => withConfiguration(
|
|
4358
4691
|
withApiOptions(
|
|
4359
4692
|
withProjectOptions(
|
|
4360
4693
|
withDiffOptions(
|
|
4361
|
-
|
|
4694
|
+
yargs26.positional("directory", {
|
|
4362
4695
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
4363
4696
|
type: "string"
|
|
4364
4697
|
}).option("what-if", {
|
|
@@ -4422,10 +4755,10 @@ var SignalRemoveModule = {
|
|
|
4422
4755
|
command: "remove <id>",
|
|
4423
4756
|
aliases: ["delete", "rm"],
|
|
4424
4757
|
describe: "Delete a signal",
|
|
4425
|
-
builder: (
|
|
4758
|
+
builder: (yargs26) => withConfiguration(
|
|
4426
4759
|
withApiOptions(
|
|
4427
4760
|
withProjectOptions(
|
|
4428
|
-
|
|
4761
|
+
yargs26.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
4429
4762
|
)
|
|
4430
4763
|
)
|
|
4431
4764
|
),
|
|
@@ -4442,10 +4775,10 @@ var SignalUpdateModule = {
|
|
|
4442
4775
|
command: "update <filename>",
|
|
4443
4776
|
aliases: ["put"],
|
|
4444
4777
|
describe: "Insert or update a signal",
|
|
4445
|
-
builder: (
|
|
4778
|
+
builder: (yargs26) => withConfiguration(
|
|
4446
4779
|
withApiOptions(
|
|
4447
4780
|
withProjectOptions(
|
|
4448
|
-
|
|
4781
|
+
yargs26.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
4449
4782
|
)
|
|
4450
4783
|
)
|
|
4451
4784
|
),
|
|
@@ -4462,25 +4795,25 @@ var SignalModule = {
|
|
|
4462
4795
|
command: "signal <command>",
|
|
4463
4796
|
aliases: ["sig"],
|
|
4464
4797
|
describe: "Commands for Context signals",
|
|
4465
|
-
builder: (
|
|
4798
|
+
builder: (yargs26) => yargs26.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
4466
4799
|
handler: () => {
|
|
4467
|
-
|
|
4800
|
+
yargs14.help();
|
|
4468
4801
|
}
|
|
4469
4802
|
};
|
|
4470
4803
|
|
|
4471
4804
|
// src/commands/context/commands/test.ts
|
|
4472
|
-
import
|
|
4805
|
+
import yargs15 from "yargs";
|
|
4473
4806
|
|
|
4474
4807
|
// src/commands/context/commands/test/get.ts
|
|
4475
4808
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
4476
4809
|
var TestGetModule = {
|
|
4477
4810
|
command: "get <id>",
|
|
4478
4811
|
describe: "Fetch a test",
|
|
4479
|
-
builder: (
|
|
4812
|
+
builder: (yargs26) => withConfiguration(
|
|
4480
4813
|
withFormatOptions(
|
|
4481
4814
|
withApiOptions(
|
|
4482
4815
|
withProjectOptions(
|
|
4483
|
-
|
|
4816
|
+
yargs26.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
4484
4817
|
)
|
|
4485
4818
|
)
|
|
4486
4819
|
)
|
|
@@ -4504,7 +4837,7 @@ var TestListModule = {
|
|
|
4504
4837
|
command: "list",
|
|
4505
4838
|
describe: "List tests",
|
|
4506
4839
|
aliases: ["ls"],
|
|
4507
|
-
builder: (
|
|
4840
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
4508
4841
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4509
4842
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4510
4843
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4553,11 +4886,11 @@ function createTestEngineDataSource({
|
|
|
4553
4886
|
var TestPullModule = {
|
|
4554
4887
|
command: "pull <directory>",
|
|
4555
4888
|
describe: "Pulls all tests to local files in a directory",
|
|
4556
|
-
builder: (
|
|
4889
|
+
builder: (yargs26) => withConfiguration(
|
|
4557
4890
|
withApiOptions(
|
|
4558
4891
|
withProjectOptions(
|
|
4559
4892
|
withDiffOptions(
|
|
4560
|
-
|
|
4893
|
+
yargs26.positional("directory", {
|
|
4561
4894
|
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.",
|
|
4562
4895
|
type: "string"
|
|
4563
4896
|
}).option("format", {
|
|
@@ -4632,11 +4965,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
4632
4965
|
var TestPushModule = {
|
|
4633
4966
|
command: "push <directory>",
|
|
4634
4967
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
4635
|
-
builder: (
|
|
4968
|
+
builder: (yargs26) => withConfiguration(
|
|
4636
4969
|
withApiOptions(
|
|
4637
4970
|
withProjectOptions(
|
|
4638
4971
|
withDiffOptions(
|
|
4639
|
-
|
|
4972
|
+
yargs26.positional("directory", {
|
|
4640
4973
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
4641
4974
|
type: "string"
|
|
4642
4975
|
}).option("what-if", {
|
|
@@ -4700,10 +5033,10 @@ var TestRemoveModule = {
|
|
|
4700
5033
|
command: "remove <id>",
|
|
4701
5034
|
aliases: ["delete", "rm"],
|
|
4702
5035
|
describe: "Delete a test",
|
|
4703
|
-
builder: (
|
|
5036
|
+
builder: (yargs26) => withConfiguration(
|
|
4704
5037
|
withApiOptions(
|
|
4705
5038
|
withProjectOptions(
|
|
4706
|
-
|
|
5039
|
+
yargs26.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
4707
5040
|
)
|
|
4708
5041
|
)
|
|
4709
5042
|
),
|
|
@@ -4720,9 +5053,9 @@ var TestUpdateModule = {
|
|
|
4720
5053
|
command: "update <filename>",
|
|
4721
5054
|
aliases: ["put"],
|
|
4722
5055
|
describe: "Insert or update a test",
|
|
4723
|
-
builder: (
|
|
5056
|
+
builder: (yargs26) => withConfiguration(
|
|
4724
5057
|
withApiOptions(
|
|
4725
|
-
withProjectOptions(
|
|
5058
|
+
withProjectOptions(yargs26.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
4726
5059
|
)
|
|
4727
5060
|
),
|
|
4728
5061
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -4737,9 +5070,9 @@ var TestUpdateModule = {
|
|
|
4737
5070
|
var TestModule = {
|
|
4738
5071
|
command: "test <command>",
|
|
4739
5072
|
describe: "Commands for Context A/B tests",
|
|
4740
|
-
builder: (
|
|
5073
|
+
builder: (yargs26) => yargs26.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
4741
5074
|
handler: () => {
|
|
4742
|
-
|
|
5075
|
+
yargs15.help();
|
|
4743
5076
|
}
|
|
4744
5077
|
};
|
|
4745
5078
|
|
|
@@ -4748,9 +5081,9 @@ var ContextCommand = {
|
|
|
4748
5081
|
command: "context <command>",
|
|
4749
5082
|
aliases: ["ctx"],
|
|
4750
5083
|
describe: "Uniform Context commands",
|
|
4751
|
-
builder: (
|
|
5084
|
+
builder: (yargs26) => yargs26.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
4752
5085
|
handler: () => {
|
|
4753
|
-
|
|
5086
|
+
yargs16.showHelp();
|
|
4754
5087
|
}
|
|
4755
5088
|
};
|
|
4756
5089
|
|
|
@@ -4795,6 +5128,7 @@ var package_default = {
|
|
|
4795
5128
|
},
|
|
4796
5129
|
dependencies: {
|
|
4797
5130
|
"@thi.ng/mime": "^2.2.23",
|
|
5131
|
+
"@uniformdev/assets": "workspace:*",
|
|
4798
5132
|
"@uniformdev/canvas": "workspace:*",
|
|
4799
5133
|
"@uniformdev/context": "workspace:*",
|
|
4800
5134
|
"@uniformdev/files": "workspace:*",
|
|
@@ -4832,7 +5166,7 @@ var package_default = {
|
|
|
4832
5166
|
"@types/js-yaml": "4.0.6",
|
|
4833
5167
|
"@types/jsonwebtoken": "9.0.3",
|
|
4834
5168
|
"@types/lodash.isequalwith": "4.4.7",
|
|
4835
|
-
"@types/node": "18.17.
|
|
5169
|
+
"@types/node": "18.17.18",
|
|
4836
5170
|
"@types/yargs": "17.0.24"
|
|
4837
5171
|
},
|
|
4838
5172
|
bin: {
|
|
@@ -5822,10 +6156,10 @@ var NewMeshCmd = {
|
|
|
5822
6156
|
};
|
|
5823
6157
|
|
|
5824
6158
|
// src/commands/optimize/index.ts
|
|
5825
|
-
import
|
|
6159
|
+
import yargs18 from "yargs";
|
|
5826
6160
|
|
|
5827
6161
|
// src/commands/optimize/manifest.ts
|
|
5828
|
-
import
|
|
6162
|
+
import yargs17 from "yargs";
|
|
5829
6163
|
|
|
5830
6164
|
// src/commands/optimize/manifest/download.ts
|
|
5831
6165
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -5840,7 +6174,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
5840
6174
|
var module = {
|
|
5841
6175
|
command: "download [output]",
|
|
5842
6176
|
describe: "Download intent manifest",
|
|
5843
|
-
builder: (
|
|
6177
|
+
builder: (yargs26) => yargs26.option("apiKey", {
|
|
5844
6178
|
alias: "k",
|
|
5845
6179
|
demandOption: true,
|
|
5846
6180
|
string: true,
|
|
@@ -5941,10 +6275,10 @@ var module2 = {
|
|
|
5941
6275
|
command: "manifest <command>",
|
|
5942
6276
|
describe: "Intent manifest commands",
|
|
5943
6277
|
builder: () => {
|
|
5944
|
-
return
|
|
6278
|
+
return yargs17.command(download_default);
|
|
5945
6279
|
},
|
|
5946
6280
|
handler: () => {
|
|
5947
|
-
|
|
6281
|
+
yargs17.showHelp();
|
|
5948
6282
|
}
|
|
5949
6283
|
};
|
|
5950
6284
|
var manifest_default = module2;
|
|
@@ -5955,29 +6289,29 @@ var OptimizeCommand = {
|
|
|
5955
6289
|
aliases: ["opt"],
|
|
5956
6290
|
describe: "Uniform Optimize commands",
|
|
5957
6291
|
builder: () => {
|
|
5958
|
-
return
|
|
6292
|
+
return yargs18.command(manifest_default);
|
|
5959
6293
|
},
|
|
5960
6294
|
handler: () => {
|
|
5961
|
-
|
|
6295
|
+
yargs18.showHelp();
|
|
5962
6296
|
}
|
|
5963
6297
|
};
|
|
5964
6298
|
|
|
5965
6299
|
// src/commands/project-map/index.ts
|
|
5966
|
-
import
|
|
6300
|
+
import yargs21 from "yargs";
|
|
5967
6301
|
|
|
5968
6302
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
5969
|
-
import
|
|
6303
|
+
import yargs19 from "yargs";
|
|
5970
6304
|
|
|
5971
6305
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
5972
6306
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
5973
6307
|
var ProjectMapDefinitionGetModule = {
|
|
5974
6308
|
command: "get <id>",
|
|
5975
6309
|
describe: "Fetch a project map",
|
|
5976
|
-
builder: (
|
|
6310
|
+
builder: (yargs26) => withFormatOptions(
|
|
5977
6311
|
withConfiguration(
|
|
5978
6312
|
withApiOptions(
|
|
5979
6313
|
withProjectOptions(
|
|
5980
|
-
|
|
6314
|
+
yargs26.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
5981
6315
|
)
|
|
5982
6316
|
)
|
|
5983
6317
|
)
|
|
@@ -6001,7 +6335,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
6001
6335
|
command: "list",
|
|
6002
6336
|
describe: "List of project maps",
|
|
6003
6337
|
aliases: ["ls"],
|
|
6004
|
-
builder: (
|
|
6338
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
6005
6339
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6006
6340
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6007
6341
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6058,11 +6392,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
6058
6392
|
var ProjectMapDefinitionPullModule = {
|
|
6059
6393
|
command: "pull <directory>",
|
|
6060
6394
|
describe: "Pulls all project maps to local files in a directory",
|
|
6061
|
-
builder: (
|
|
6395
|
+
builder: (yargs26) => withConfiguration(
|
|
6062
6396
|
withApiOptions(
|
|
6063
6397
|
withProjectOptions(
|
|
6064
6398
|
withDiffOptions(
|
|
6065
|
-
|
|
6399
|
+
yargs26.positional("directory", {
|
|
6066
6400
|
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.",
|
|
6067
6401
|
type: "string"
|
|
6068
6402
|
}).option("format", {
|
|
@@ -6137,11 +6471,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
6137
6471
|
var ProjectMapDefinitionPushModule = {
|
|
6138
6472
|
command: "push <directory>",
|
|
6139
6473
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
6140
|
-
builder: (
|
|
6474
|
+
builder: (yargs26) => withConfiguration(
|
|
6141
6475
|
withApiOptions(
|
|
6142
6476
|
withProjectOptions(
|
|
6143
6477
|
withDiffOptions(
|
|
6144
|
-
|
|
6478
|
+
yargs26.positional("directory", {
|
|
6145
6479
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6146
6480
|
type: "string"
|
|
6147
6481
|
}).option("what-if", {
|
|
@@ -6205,9 +6539,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
6205
6539
|
command: "remove <id>",
|
|
6206
6540
|
aliases: ["delete", "rm"],
|
|
6207
6541
|
describe: "Delete a project map",
|
|
6208
|
-
builder: (
|
|
6542
|
+
builder: (yargs26) => withConfiguration(
|
|
6209
6543
|
withApiOptions(
|
|
6210
|
-
withProjectOptions(
|
|
6544
|
+
withProjectOptions(yargs26.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6211
6545
|
)
|
|
6212
6546
|
),
|
|
6213
6547
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6223,10 +6557,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6223
6557
|
command: "update <filename>",
|
|
6224
6558
|
aliases: ["put"],
|
|
6225
6559
|
describe: "Insert or update a project map",
|
|
6226
|
-
builder: (
|
|
6560
|
+
builder: (yargs26) => withConfiguration(
|
|
6227
6561
|
withApiOptions(
|
|
6228
6562
|
withProjectOptions(
|
|
6229
|
-
|
|
6563
|
+
yargs26.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6230
6564
|
)
|
|
6231
6565
|
)
|
|
6232
6566
|
),
|
|
@@ -6242,25 +6576,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6242
6576
|
var ProjectMapDefinitionModule = {
|
|
6243
6577
|
command: "definition <command>",
|
|
6244
6578
|
describe: "Commands for ProjectMap Definitions",
|
|
6245
|
-
builder: (
|
|
6579
|
+
builder: (yargs26) => yargs26.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
6246
6580
|
handler: () => {
|
|
6247
|
-
|
|
6581
|
+
yargs19.help();
|
|
6248
6582
|
}
|
|
6249
6583
|
};
|
|
6250
6584
|
|
|
6251
6585
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
6252
|
-
import
|
|
6586
|
+
import yargs20 from "yargs";
|
|
6253
6587
|
|
|
6254
6588
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
6255
6589
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
6256
6590
|
var ProjectMapNodeGetModule = {
|
|
6257
6591
|
command: "get <id> <projectMapId>",
|
|
6258
6592
|
describe: "Fetch a project map node",
|
|
6259
|
-
builder: (
|
|
6593
|
+
builder: (yargs26) => withConfiguration(
|
|
6260
6594
|
withFormatOptions(
|
|
6261
6595
|
withApiOptions(
|
|
6262
6596
|
withProjectOptions(
|
|
6263
|
-
|
|
6597
|
+
yargs26.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6264
6598
|
)
|
|
6265
6599
|
)
|
|
6266
6600
|
)
|
|
@@ -6286,11 +6620,11 @@ var ProjectMapNodeListModule = {
|
|
|
6286
6620
|
command: "list <projectMapId>",
|
|
6287
6621
|
describe: "List project map nodes",
|
|
6288
6622
|
aliases: ["ls"],
|
|
6289
|
-
builder: (
|
|
6623
|
+
builder: (yargs26) => withConfiguration(
|
|
6290
6624
|
withFormatOptions(
|
|
6291
6625
|
withApiOptions(
|
|
6292
6626
|
withProjectOptions(
|
|
6293
|
-
|
|
6627
|
+
yargs26.positional("projectMapId", {
|
|
6294
6628
|
demandOption: true,
|
|
6295
6629
|
describe: "ProjectMap UUID to fetch from"
|
|
6296
6630
|
})
|
|
@@ -6361,11 +6695,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
6361
6695
|
var ProjectMapNodePullModule = {
|
|
6362
6696
|
command: "pull <directory>",
|
|
6363
6697
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
6364
|
-
builder: (
|
|
6698
|
+
builder: (yargs26) => withConfiguration(
|
|
6365
6699
|
withApiOptions(
|
|
6366
6700
|
withProjectOptions(
|
|
6367
6701
|
withDiffOptions(
|
|
6368
|
-
|
|
6702
|
+
yargs26.positional("directory", {
|
|
6369
6703
|
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.",
|
|
6370
6704
|
type: "string"
|
|
6371
6705
|
}).option("format", {
|
|
@@ -6444,11 +6778,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
6444
6778
|
var ProjectMapNodePushModule = {
|
|
6445
6779
|
command: "push <directory>",
|
|
6446
6780
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
6447
|
-
builder: (
|
|
6781
|
+
builder: (yargs26) => withConfiguration(
|
|
6448
6782
|
withApiOptions(
|
|
6449
6783
|
withProjectOptions(
|
|
6450
6784
|
withDiffOptions(
|
|
6451
|
-
|
|
6785
|
+
yargs26.positional("directory", {
|
|
6452
6786
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6453
6787
|
type: "string"
|
|
6454
6788
|
}).option("what-if", {
|
|
@@ -6521,10 +6855,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
6521
6855
|
command: "remove <id> <projectMapId>",
|
|
6522
6856
|
aliases: ["delete", "rm"],
|
|
6523
6857
|
describe: "Delete a project map node",
|
|
6524
|
-
builder: (
|
|
6858
|
+
builder: (yargs26) => withConfiguration(
|
|
6525
6859
|
withApiOptions(
|
|
6526
6860
|
withProjectOptions(
|
|
6527
|
-
|
|
6861
|
+
yargs26.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
6528
6862
|
)
|
|
6529
6863
|
)
|
|
6530
6864
|
),
|
|
@@ -6541,10 +6875,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
6541
6875
|
command: "update <filename> <projectMapId>",
|
|
6542
6876
|
aliases: ["put"],
|
|
6543
6877
|
describe: "Insert or update a project map node",
|
|
6544
|
-
builder: (
|
|
6878
|
+
builder: (yargs26) => withConfiguration(
|
|
6545
6879
|
withApiOptions(
|
|
6546
6880
|
withProjectOptions(
|
|
6547
|
-
|
|
6881
|
+
yargs26.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
6548
6882
|
)
|
|
6549
6883
|
)
|
|
6550
6884
|
),
|
|
@@ -6560,9 +6894,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
6560
6894
|
var ProjectMapNodeModule = {
|
|
6561
6895
|
command: "node <command>",
|
|
6562
6896
|
describe: "Commands for ProjectMap Nodes",
|
|
6563
|
-
builder: (
|
|
6897
|
+
builder: (yargs26) => yargs26.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
6564
6898
|
handler: () => {
|
|
6565
|
-
|
|
6899
|
+
yargs20.help();
|
|
6566
6900
|
}
|
|
6567
6901
|
};
|
|
6568
6902
|
|
|
@@ -6571,28 +6905,28 @@ var ProjectMapCommand = {
|
|
|
6571
6905
|
command: "project-map <command>",
|
|
6572
6906
|
aliases: ["prm"],
|
|
6573
6907
|
describe: "Uniform ProjectMap commands",
|
|
6574
|
-
builder: (
|
|
6908
|
+
builder: (yargs26) => yargs26.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
6575
6909
|
handler: () => {
|
|
6576
|
-
|
|
6910
|
+
yargs21.showHelp();
|
|
6577
6911
|
}
|
|
6578
6912
|
};
|
|
6579
6913
|
|
|
6580
6914
|
// src/commands/redirect/index.ts
|
|
6581
|
-
import
|
|
6915
|
+
import yargs23 from "yargs";
|
|
6582
6916
|
|
|
6583
6917
|
// src/commands/redirect/commands/redirect.ts
|
|
6584
|
-
import
|
|
6918
|
+
import yargs22 from "yargs";
|
|
6585
6919
|
|
|
6586
6920
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
6587
6921
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
6588
6922
|
var RedirectDefinitionGetModule = {
|
|
6589
6923
|
command: "get <id>",
|
|
6590
6924
|
describe: "Fetch a redirect",
|
|
6591
|
-
builder: (
|
|
6925
|
+
builder: (yargs26) => withConfiguration(
|
|
6592
6926
|
withFormatOptions(
|
|
6593
6927
|
withApiOptions(
|
|
6594
6928
|
withProjectOptions(
|
|
6595
|
-
|
|
6929
|
+
yargs26.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
6596
6930
|
)
|
|
6597
6931
|
)
|
|
6598
6932
|
)
|
|
@@ -6616,7 +6950,7 @@ var RedirectDefinitionListModule = {
|
|
|
6616
6950
|
command: "list",
|
|
6617
6951
|
describe: "List of redirects",
|
|
6618
6952
|
aliases: ["ls"],
|
|
6619
|
-
builder: (
|
|
6953
|
+
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26)))),
|
|
6620
6954
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6621
6955
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6622
6956
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6682,11 +7016,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
6682
7016
|
var RedirectDefinitionPullModule = {
|
|
6683
7017
|
command: "pull <directory>",
|
|
6684
7018
|
describe: "Pulls all redirects to local files in a directory",
|
|
6685
|
-
builder: (
|
|
7019
|
+
builder: (yargs26) => withConfiguration(
|
|
6686
7020
|
withApiOptions(
|
|
6687
7021
|
withProjectOptions(
|
|
6688
7022
|
withDiffOptions(
|
|
6689
|
-
|
|
7023
|
+
yargs26.positional("directory", {
|
|
6690
7024
|
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.",
|
|
6691
7025
|
type: "string"
|
|
6692
7026
|
}).option("format", {
|
|
@@ -6762,11 +7096,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
6762
7096
|
var RedirectDefinitionPushModule = {
|
|
6763
7097
|
command: "push <directory>",
|
|
6764
7098
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
6765
|
-
builder: (
|
|
7099
|
+
builder: (yargs26) => withConfiguration(
|
|
6766
7100
|
withApiOptions(
|
|
6767
7101
|
withProjectOptions(
|
|
6768
7102
|
withDiffOptions(
|
|
6769
|
-
|
|
7103
|
+
yargs26.positional("directory", {
|
|
6770
7104
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
6771
7105
|
type: "string"
|
|
6772
7106
|
}).option("what-if", {
|
|
@@ -6830,9 +7164,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
6830
7164
|
command: "remove <id>",
|
|
6831
7165
|
aliases: ["delete", "rm"],
|
|
6832
7166
|
describe: "Delete a redirect",
|
|
6833
|
-
builder: (
|
|
7167
|
+
builder: (yargs26) => withConfiguration(
|
|
6834
7168
|
withApiOptions(
|
|
6835
|
-
withProjectOptions(
|
|
7169
|
+
withProjectOptions(yargs26.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6836
7170
|
)
|
|
6837
7171
|
),
|
|
6838
7172
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6848,10 +7182,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
6848
7182
|
command: "update <filename>",
|
|
6849
7183
|
aliases: ["put"],
|
|
6850
7184
|
describe: "Insert or update a redirect",
|
|
6851
|
-
builder: (
|
|
7185
|
+
builder: (yargs26) => withConfiguration(
|
|
6852
7186
|
withApiOptions(
|
|
6853
7187
|
withProjectOptions(
|
|
6854
|
-
|
|
7188
|
+
yargs26.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
6855
7189
|
)
|
|
6856
7190
|
)
|
|
6857
7191
|
),
|
|
@@ -6867,9 +7201,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
6867
7201
|
var RedirectDefinitionModule = {
|
|
6868
7202
|
command: "definition <command>",
|
|
6869
7203
|
describe: "Commands for Redirect Definitions",
|
|
6870
|
-
builder: (
|
|
7204
|
+
builder: (yargs26) => yargs26.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
6871
7205
|
handler: () => {
|
|
6872
|
-
|
|
7206
|
+
yargs22.help();
|
|
6873
7207
|
}
|
|
6874
7208
|
};
|
|
6875
7209
|
|
|
@@ -6878,14 +7212,14 @@ var RedirectCommand = {
|
|
|
6878
7212
|
command: "redirect <command>",
|
|
6879
7213
|
aliases: ["red"],
|
|
6880
7214
|
describe: "Uniform Redirect commands",
|
|
6881
|
-
builder: (
|
|
7215
|
+
builder: (yargs26) => yargs26.command(RedirectDefinitionModule).demandCommand(),
|
|
6882
7216
|
handler: () => {
|
|
6883
|
-
|
|
7217
|
+
yargs23.showHelp();
|
|
6884
7218
|
}
|
|
6885
7219
|
};
|
|
6886
7220
|
|
|
6887
7221
|
// src/commands/sync/index.ts
|
|
6888
|
-
import
|
|
7222
|
+
import yargs24 from "yargs";
|
|
6889
7223
|
|
|
6890
7224
|
// src/commands/sync/commands/util.ts
|
|
6891
7225
|
import ora2 from "ora";
|
|
@@ -6916,11 +7250,11 @@ function spin(entityType) {
|
|
|
6916
7250
|
var SyncPullModule = {
|
|
6917
7251
|
command: "pull",
|
|
6918
7252
|
describe: "Pulls whole project to local files in a directory",
|
|
6919
|
-
builder: (
|
|
7253
|
+
builder: (yargs26) => withConfiguration(
|
|
6920
7254
|
withApiOptions(
|
|
6921
7255
|
withProjectOptions(
|
|
6922
7256
|
withDiffOptions(
|
|
6923
|
-
|
|
7257
|
+
yargs26.option("what-if", {
|
|
6924
7258
|
alias: ["w"],
|
|
6925
7259
|
describe: "What-if mode reports what would be done but changes no files",
|
|
6926
7260
|
default: false,
|
|
@@ -7005,11 +7339,11 @@ var getFormat = (entityType, config2) => {
|
|
|
7005
7339
|
var SyncPushModule = {
|
|
7006
7340
|
command: "push",
|
|
7007
7341
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
7008
|
-
builder: (
|
|
7342
|
+
builder: (yargs26) => withConfiguration(
|
|
7009
7343
|
withApiOptions(
|
|
7010
7344
|
withProjectOptions(
|
|
7011
7345
|
withDiffOptions(
|
|
7012
|
-
|
|
7346
|
+
yargs26.option("what-if", {
|
|
7013
7347
|
alias: ["w"],
|
|
7014
7348
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
7015
7349
|
default: false,
|
|
@@ -7101,9 +7435,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
7101
7435
|
var SyncCommand = {
|
|
7102
7436
|
command: "sync <command>",
|
|
7103
7437
|
describe: "Uniform Sync commands",
|
|
7104
|
-
builder: (
|
|
7438
|
+
builder: (yargs26) => yargs26.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
7105
7439
|
handler: () => {
|
|
7106
|
-
|
|
7440
|
+
yargs24.showHelp();
|
|
7107
7441
|
}
|
|
7108
7442
|
};
|
|
7109
7443
|
|
|
@@ -7219,7 +7553,7 @@ First found was: v${firstVersion}`;
|
|
|
7219
7553
|
|
|
7220
7554
|
// src/index.ts
|
|
7221
7555
|
dotenv.config();
|
|
7222
|
-
var yarggery =
|
|
7556
|
+
var yarggery = yargs25(hideBin(process.argv));
|
|
7223
7557
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
7224
7558
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
7225
7559
|
yarggery.option("verbose", {
|