@uniformdev/cli 19.58.1-alpha.16 → 19.58.2-alpha.0
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 +493 -827
- package/package.json +9 -10
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 yargs24 from "yargs";
|
|
13
13
|
import { hideBin } from "yargs/helpers";
|
|
14
14
|
|
|
15
15
|
// src/commands/canvas/index.ts
|
|
16
|
-
import
|
|
16
|
+
import yargs8 from "yargs";
|
|
17
17
|
|
|
18
|
-
// src/commands/canvas/commands/
|
|
18
|
+
// src/commands/canvas/commands/category.ts
|
|
19
19
|
import yargs from "yargs";
|
|
20
20
|
|
|
21
|
-
// src/commands/canvas/commands/
|
|
22
|
-
import {
|
|
21
|
+
// src/commands/canvas/commands/category/get.ts
|
|
22
|
+
import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
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(yargs25) {
|
|
130
|
+
return yargs25.option("serialization", {
|
|
131
131
|
skipValidation: true,
|
|
132
132
|
hidden: true
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
function withApiOptions(
|
|
136
|
-
return
|
|
135
|
+
function withApiOptions(yargs25) {
|
|
136
|
+
return yargs25.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(yargs25) {
|
|
176
|
+
return yargs25.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(yargs26) {
|
|
|
183
183
|
alias: ["p"]
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
function withFormatOptions(
|
|
187
|
-
return
|
|
186
|
+
function withFormatOptions(yargs25) {
|
|
187
|
+
return yargs25.option("format", {
|
|
188
188
|
alias: ["f"],
|
|
189
189
|
describe: "Output format",
|
|
190
190
|
default: "yaml",
|
|
@@ -196,8 +196,8 @@ function withFormatOptions(yargs26) {
|
|
|
196
196
|
type: "string"
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function withDiffOptions(
|
|
200
|
-
return
|
|
199
|
+
function withDiffOptions(yargs25) {
|
|
200
|
+
return yargs25.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,569 +613,15 @@ 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
|
-
|
|
1169
616
|
// src/commands/canvas/commands/category/get.ts
|
|
1170
|
-
import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
1171
617
|
var CategoryGetModule = {
|
|
1172
618
|
command: "get <id>",
|
|
1173
619
|
describe: "Fetch a category",
|
|
1174
|
-
builder: (
|
|
620
|
+
builder: (yargs25) => withConfiguration(
|
|
1175
621
|
withFormatOptions(
|
|
1176
622
|
withApiOptions(
|
|
1177
623
|
withProjectOptions(
|
|
1178
|
-
|
|
624
|
+
yargs25.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1179
625
|
)
|
|
1180
626
|
)
|
|
1181
627
|
)
|
|
@@ -1200,7 +646,7 @@ var CategoryListModule = {
|
|
|
1200
646
|
command: "list",
|
|
1201
647
|
describe: "List categories",
|
|
1202
648
|
aliases: ["ls"],
|
|
1203
|
-
builder: (
|
|
649
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25.options({}))))),
|
|
1204
650
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1205
651
|
const fetch3 = nodeFetchProxy(proxy);
|
|
1206
652
|
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -1245,15 +691,23 @@ function createCategoriesEngineDataSource({
|
|
|
1245
691
|
};
|
|
1246
692
|
}
|
|
1247
693
|
|
|
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
|
+
|
|
1248
702
|
// src/commands/canvas/commands/category/pull.ts
|
|
1249
703
|
var CategoryPullModule = {
|
|
1250
704
|
command: "pull <directory>",
|
|
1251
705
|
describe: "Pulls all categories to local files in a directory",
|
|
1252
|
-
builder: (
|
|
706
|
+
builder: (yargs25) => withConfiguration(
|
|
1253
707
|
withApiOptions(
|
|
1254
708
|
withProjectOptions(
|
|
1255
709
|
withDiffOptions(
|
|
1256
|
-
|
|
710
|
+
yargs25.positional("directory", {
|
|
1257
711
|
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.",
|
|
1258
712
|
type: "string"
|
|
1259
713
|
}).option("format", {
|
|
@@ -1329,11 +783,11 @@ import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/c
|
|
|
1329
783
|
var CategoryPushModule = {
|
|
1330
784
|
command: "push <directory>",
|
|
1331
785
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1332
|
-
builder: (
|
|
786
|
+
builder: (yargs25) => withConfiguration(
|
|
1333
787
|
withApiOptions(
|
|
1334
788
|
withProjectOptions(
|
|
1335
789
|
withDiffOptions(
|
|
1336
|
-
|
|
790
|
+
yargs25.positional("directory", {
|
|
1337
791
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1338
792
|
type: "string"
|
|
1339
793
|
}).option("what-if", {
|
|
@@ -1397,10 +851,10 @@ var CategoryRemoveModule = {
|
|
|
1397
851
|
command: "remove <id>",
|
|
1398
852
|
aliases: ["delete", "rm"],
|
|
1399
853
|
describe: "Delete a category",
|
|
1400
|
-
builder: (
|
|
854
|
+
builder: (yargs25) => withConfiguration(
|
|
1401
855
|
withApiOptions(
|
|
1402
856
|
withProjectOptions(
|
|
1403
|
-
|
|
857
|
+
yargs25.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
1404
858
|
)
|
|
1405
859
|
)
|
|
1406
860
|
),
|
|
@@ -1417,10 +871,10 @@ var CategoryUpdateModule = {
|
|
|
1417
871
|
command: "update <filename>",
|
|
1418
872
|
aliases: ["put"],
|
|
1419
873
|
describe: "Insert or update a category",
|
|
1420
|
-
builder: (
|
|
874
|
+
builder: (yargs25) => withConfiguration(
|
|
1421
875
|
withApiOptions(
|
|
1422
876
|
withProjectOptions(
|
|
1423
|
-
|
|
877
|
+
yargs25.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
1424
878
|
)
|
|
1425
879
|
)
|
|
1426
880
|
),
|
|
@@ -1437,14 +891,14 @@ var CategoryModule = {
|
|
|
1437
891
|
command: "category <command>",
|
|
1438
892
|
aliases: ["cat"],
|
|
1439
893
|
describe: "Commands for Canvas categories",
|
|
1440
|
-
builder: (
|
|
894
|
+
builder: (yargs25) => yargs25.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
1441
895
|
handler: () => {
|
|
1442
|
-
|
|
896
|
+
yargs.help();
|
|
1443
897
|
}
|
|
1444
898
|
};
|
|
1445
899
|
|
|
1446
900
|
// src/commands/canvas/commands/component.ts
|
|
1447
|
-
import
|
|
901
|
+
import yargs2 from "yargs";
|
|
1448
902
|
|
|
1449
903
|
// src/commands/canvas/commands/component/get.ts
|
|
1450
904
|
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
@@ -1458,11 +912,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
1458
912
|
var ComponentGetModule = {
|
|
1459
913
|
command: "get <id>",
|
|
1460
914
|
describe: "Fetch a component definition",
|
|
1461
|
-
builder: (
|
|
915
|
+
builder: (yargs25) => withConfiguration(
|
|
1462
916
|
withFormatOptions(
|
|
1463
917
|
withApiOptions(
|
|
1464
918
|
withProjectOptions(
|
|
1465
|
-
|
|
919
|
+
yargs25.positional("id", {
|
|
1466
920
|
demandOption: true,
|
|
1467
921
|
describe: "Component definition public ID to fetch"
|
|
1468
922
|
})
|
|
@@ -1496,11 +950,11 @@ var ComponentListModule = {
|
|
|
1496
950
|
command: "list",
|
|
1497
951
|
describe: "List component definitions",
|
|
1498
952
|
aliases: ["ls"],
|
|
1499
|
-
builder: (
|
|
953
|
+
builder: (yargs25) => withConfiguration(
|
|
1500
954
|
withFormatOptions(
|
|
1501
955
|
withApiOptions(
|
|
1502
956
|
withProjectOptions(
|
|
1503
|
-
|
|
957
|
+
yargs25.options({
|
|
1504
958
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1505
959
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
1506
960
|
})
|
|
@@ -1555,11 +1009,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1555
1009
|
var ComponentPullModule = {
|
|
1556
1010
|
command: "pull <directory>",
|
|
1557
1011
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1558
|
-
builder: (
|
|
1012
|
+
builder: (yargs25) => withConfiguration(
|
|
1559
1013
|
withApiOptions(
|
|
1560
1014
|
withProjectOptions(
|
|
1561
1015
|
withDiffOptions(
|
|
1562
|
-
|
|
1016
|
+
yargs25.positional("directory", {
|
|
1563
1017
|
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.",
|
|
1564
1018
|
type: "string"
|
|
1565
1019
|
}).option("format", {
|
|
@@ -1636,11 +1090,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1636
1090
|
var ComponentPushModule = {
|
|
1637
1091
|
command: "push <directory>",
|
|
1638
1092
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1639
|
-
builder: (
|
|
1093
|
+
builder: (yargs25) => withConfiguration(
|
|
1640
1094
|
withApiOptions(
|
|
1641
1095
|
withProjectOptions(
|
|
1642
1096
|
withDiffOptions(
|
|
1643
|
-
|
|
1097
|
+
yargs25.positional("directory", {
|
|
1644
1098
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1645
1099
|
type: "string"
|
|
1646
1100
|
}).option("what-if", {
|
|
@@ -1705,10 +1159,10 @@ var ComponentRemoveModule = {
|
|
|
1705
1159
|
command: "remove <id>",
|
|
1706
1160
|
aliases: ["delete", "rm"],
|
|
1707
1161
|
describe: "Delete a component definition",
|
|
1708
|
-
builder: (
|
|
1162
|
+
builder: (yargs25) => withConfiguration(
|
|
1709
1163
|
withApiOptions(
|
|
1710
1164
|
withProjectOptions(
|
|
1711
|
-
|
|
1165
|
+
yargs25.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1712
1166
|
)
|
|
1713
1167
|
)
|
|
1714
1168
|
),
|
|
@@ -1725,10 +1179,10 @@ var ComponentUpdateModule = {
|
|
|
1725
1179
|
command: "update <filename>",
|
|
1726
1180
|
aliases: ["put"],
|
|
1727
1181
|
describe: "Insert or update a component definition",
|
|
1728
|
-
builder: (
|
|
1182
|
+
builder: (yargs25) => withConfiguration(
|
|
1729
1183
|
withApiOptions(
|
|
1730
1184
|
withProjectOptions(
|
|
1731
|
-
|
|
1185
|
+
yargs25.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1732
1186
|
)
|
|
1733
1187
|
)
|
|
1734
1188
|
),
|
|
@@ -1745,26 +1199,63 @@ var ComponentModule = {
|
|
|
1745
1199
|
command: "component <command>",
|
|
1746
1200
|
aliases: ["def"],
|
|
1747
1201
|
describe: "Commands for Canvas component definitions",
|
|
1748
|
-
builder: (
|
|
1202
|
+
builder: (yargs25) => yargs25.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1749
1203
|
handler: () => {
|
|
1750
|
-
|
|
1204
|
+
yargs2.help();
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// src/commands/canvas/commands/composition.ts
|
|
1209
|
+
import yargs3 from "yargs";
|
|
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;
|
|
1751
1239
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
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
|
+
}
|
|
1756
1248
|
|
|
1757
1249
|
// src/commands/canvas/commands/composition/get.ts
|
|
1758
|
-
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1759
1250
|
var CompositionGetModule = {
|
|
1760
1251
|
command: "get <id>",
|
|
1761
1252
|
describe: "Fetch a composition",
|
|
1762
|
-
builder: (
|
|
1253
|
+
builder: (yargs25) => withFormatOptions(
|
|
1763
1254
|
withConfiguration(
|
|
1764
1255
|
withApiOptions(
|
|
1765
1256
|
withProjectOptions(
|
|
1766
1257
|
withStateOptions(
|
|
1767
|
-
|
|
1258
|
+
yargs25.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1768
1259
|
resolvePatterns: {
|
|
1769
1260
|
type: "boolean",
|
|
1770
1261
|
default: false,
|
|
@@ -1835,12 +1326,12 @@ var CompositionListModule = {
|
|
|
1835
1326
|
command: "list",
|
|
1836
1327
|
describe: "List compositions",
|
|
1837
1328
|
aliases: ["ls"],
|
|
1838
|
-
builder: (
|
|
1329
|
+
builder: (yargs25) => withFormatOptions(
|
|
1839
1330
|
withConfiguration(
|
|
1840
1331
|
withApiOptions(
|
|
1841
1332
|
withProjectOptions(
|
|
1842
1333
|
withStateOptions(
|
|
1843
|
-
|
|
1334
|
+
yargs25.options({
|
|
1844
1335
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1845
1336
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1846
1337
|
resolvePatterns: {
|
|
@@ -1961,11 +1452,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
1961
1452
|
var CompositionPublishModule = {
|
|
1962
1453
|
command: "publish [ids]",
|
|
1963
1454
|
describe: "Publishes composition(s)",
|
|
1964
|
-
builder: (
|
|
1455
|
+
builder: (yargs25) => withConfiguration(
|
|
1965
1456
|
withApiOptions(
|
|
1966
1457
|
withProjectOptions(
|
|
1967
1458
|
withDiffOptions(
|
|
1968
|
-
|
|
1459
|
+
yargs25.positional("ids", {
|
|
1969
1460
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1970
1461
|
type: "string"
|
|
1971
1462
|
}).option("all", {
|
|
@@ -2037,15 +1528,189 @@ var CompositionPublishModule = {
|
|
|
2037
1528
|
|
|
2038
1529
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2039
1530
|
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
|
|
2040
1705
|
var CompositionPullModule = {
|
|
2041
1706
|
command: "pull <directory>",
|
|
2042
1707
|
describe: "Pulls all compositions to local files in a directory",
|
|
2043
|
-
builder: (
|
|
1708
|
+
builder: (yargs25) => withConfiguration(
|
|
2044
1709
|
withApiOptions(
|
|
2045
1710
|
withProjectOptions(
|
|
2046
1711
|
withStateOptions(
|
|
2047
1712
|
withDiffOptions(
|
|
2048
|
-
|
|
1713
|
+
yargs25.positional("directory", {
|
|
2049
1714
|
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.",
|
|
2050
1715
|
type: "string"
|
|
2051
1716
|
}).option("format", {
|
|
@@ -2136,16 +1801,16 @@ var CompositionPullModule = {
|
|
|
2136
1801
|
|
|
2137
1802
|
// src/commands/canvas/commands/composition/push.ts
|
|
2138
1803
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2139
|
-
import {
|
|
1804
|
+
import { FileClient as FileClient2 } from "@uniformdev/files";
|
|
2140
1805
|
var CompositionPushModule = {
|
|
2141
1806
|
command: "push <directory>",
|
|
2142
1807
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
2143
|
-
builder: (
|
|
1808
|
+
builder: (yargs25) => withConfiguration(
|
|
2144
1809
|
withApiOptions(
|
|
2145
1810
|
withProjectOptions(
|
|
2146
1811
|
withStateOptions(
|
|
2147
1812
|
withDiffOptions(
|
|
2148
|
-
|
|
1813
|
+
yargs25.positional("directory", {
|
|
2149
1814
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
2150
1815
|
type: "string"
|
|
2151
1816
|
}).option("what-if", {
|
|
@@ -2206,7 +1871,7 @@ var CompositionPushModule = {
|
|
|
2206
1871
|
});
|
|
2207
1872
|
}
|
|
2208
1873
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2209
|
-
const fileClient = new
|
|
1874
|
+
const fileClient = new FileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2210
1875
|
await syncEngine({
|
|
2211
1876
|
source,
|
|
2212
1877
|
target,
|
|
@@ -2215,13 +1880,15 @@ var CompositionPushModule = {
|
|
|
2215
1880
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2216
1881
|
onBeforeCompareObjects: async (sourceObject) => {
|
|
2217
1882
|
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
2218
|
-
fileClient
|
|
1883
|
+
fileClient,
|
|
1884
|
+
projectId
|
|
2219
1885
|
});
|
|
2220
1886
|
},
|
|
2221
1887
|
onBeforeWriteObject: async (sourceObject) => {
|
|
2222
1888
|
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
2223
1889
|
directory,
|
|
2224
|
-
fileClient
|
|
1890
|
+
fileClient,
|
|
1891
|
+
projectId
|
|
2225
1892
|
});
|
|
2226
1893
|
}
|
|
2227
1894
|
});
|
|
@@ -2234,10 +1901,10 @@ var CompositionRemoveModule = {
|
|
|
2234
1901
|
command: "remove <id>",
|
|
2235
1902
|
aliases: ["delete", "rm"],
|
|
2236
1903
|
describe: "Delete a composition",
|
|
2237
|
-
builder: (
|
|
1904
|
+
builder: (yargs25) => withConfiguration(
|
|
2238
1905
|
withApiOptions(
|
|
2239
1906
|
withProjectOptions(
|
|
2240
|
-
|
|
1907
|
+
yargs25.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
2241
1908
|
)
|
|
2242
1909
|
)
|
|
2243
1910
|
),
|
|
@@ -2254,10 +1921,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
2254
1921
|
var CompositionUnpublishModule = {
|
|
2255
1922
|
command: "unpublish [ids]",
|
|
2256
1923
|
describe: "Unpublish a composition(s)",
|
|
2257
|
-
builder: (
|
|
1924
|
+
builder: (yargs25) => withConfiguration(
|
|
2258
1925
|
withApiOptions(
|
|
2259
1926
|
withProjectOptions(
|
|
2260
|
-
|
|
1927
|
+
yargs25.positional("ids", {
|
|
2261
1928
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
2262
1929
|
type: "string"
|
|
2263
1930
|
}).option("all", {
|
|
@@ -2351,11 +2018,11 @@ var CompositionUpdateModule = {
|
|
|
2351
2018
|
command: "update <filename>",
|
|
2352
2019
|
aliases: ["put"],
|
|
2353
2020
|
describe: "Insert or update a composition",
|
|
2354
|
-
builder: (
|
|
2021
|
+
builder: (yargs25) => withConfiguration(
|
|
2355
2022
|
withApiOptions(
|
|
2356
2023
|
withProjectOptions(
|
|
2357
2024
|
withStateOptions(
|
|
2358
|
-
|
|
2025
|
+
yargs25.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2359
2026
|
)
|
|
2360
2027
|
)
|
|
2361
2028
|
)
|
|
@@ -2373,26 +2040,26 @@ var CompositionModule = {
|
|
|
2373
2040
|
command: "composition <command>",
|
|
2374
2041
|
describe: "Commands for Canvas compositions",
|
|
2375
2042
|
aliases: ["comp"],
|
|
2376
|
-
builder: (
|
|
2043
|
+
builder: (yargs25) => yargs25.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2377
2044
|
handler: () => {
|
|
2378
|
-
|
|
2045
|
+
yargs3.help();
|
|
2379
2046
|
}
|
|
2380
2047
|
};
|
|
2381
2048
|
|
|
2382
2049
|
// src/commands/canvas/commands/contentType.ts
|
|
2383
|
-
import
|
|
2050
|
+
import yargs4 from "yargs";
|
|
2384
2051
|
|
|
2385
2052
|
// src/commands/canvas/commands/contentType/get.ts
|
|
2386
2053
|
import { ContentClient } from "@uniformdev/canvas";
|
|
2387
2054
|
var ContentTypeGetModule = {
|
|
2388
2055
|
command: "get <id>",
|
|
2389
2056
|
describe: "Get a content type",
|
|
2390
|
-
builder: (
|
|
2057
|
+
builder: (yargs25) => withConfiguration(
|
|
2391
2058
|
withFormatOptions(
|
|
2392
2059
|
withApiOptions(
|
|
2393
2060
|
withProjectOptions(
|
|
2394
2061
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2395
|
-
|
|
2062
|
+
yargs25.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2396
2063
|
)
|
|
2397
2064
|
)
|
|
2398
2065
|
)
|
|
@@ -2414,7 +2081,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2414
2081
|
var ContentTypeListModule = {
|
|
2415
2082
|
command: "list",
|
|
2416
2083
|
describe: "List content types",
|
|
2417
|
-
builder: (
|
|
2084
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2418
2085
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2419
2086
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2420
2087
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2461,11 +2128,11 @@ function createContentTypeEngineDataSource({
|
|
|
2461
2128
|
var ContentTypePullModule = {
|
|
2462
2129
|
command: "pull <directory>",
|
|
2463
2130
|
describe: "Pulls all content types to local files in a directory",
|
|
2464
|
-
builder: (
|
|
2131
|
+
builder: (yargs25) => withConfiguration(
|
|
2465
2132
|
withApiOptions(
|
|
2466
2133
|
withProjectOptions(
|
|
2467
2134
|
withDiffOptions(
|
|
2468
|
-
|
|
2135
|
+
yargs25.positional("directory", {
|
|
2469
2136
|
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.",
|
|
2470
2137
|
type: "string"
|
|
2471
2138
|
}).option("format", {
|
|
@@ -2547,11 +2214,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2547
2214
|
var ContentTypePushModule = {
|
|
2548
2215
|
command: "push <directory>",
|
|
2549
2216
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2550
|
-
builder: (
|
|
2217
|
+
builder: (yargs25) => withConfiguration(
|
|
2551
2218
|
withApiOptions(
|
|
2552
2219
|
withProjectOptions(
|
|
2553
2220
|
withDiffOptions(
|
|
2554
|
-
|
|
2221
|
+
yargs25.positional("directory", {
|
|
2555
2222
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2556
2223
|
type: "string"
|
|
2557
2224
|
}).option("what-if", {
|
|
@@ -2621,10 +2288,10 @@ var ContentTypeRemoveModule = {
|
|
|
2621
2288
|
command: "remove <id>",
|
|
2622
2289
|
aliases: ["delete", "rm"],
|
|
2623
2290
|
describe: "Delete a content type",
|
|
2624
|
-
builder: (
|
|
2291
|
+
builder: (yargs25) => withConfiguration(
|
|
2625
2292
|
withApiOptions(
|
|
2626
2293
|
withProjectOptions(
|
|
2627
|
-
|
|
2294
|
+
yargs25.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2628
2295
|
)
|
|
2629
2296
|
)
|
|
2630
2297
|
),
|
|
@@ -2641,10 +2308,10 @@ var ContentTypeUpdateModule = {
|
|
|
2641
2308
|
command: "update <filename>",
|
|
2642
2309
|
aliases: ["put"],
|
|
2643
2310
|
describe: "Insert or update a content type",
|
|
2644
|
-
builder: (
|
|
2311
|
+
builder: (yargs25) => withConfiguration(
|
|
2645
2312
|
withApiOptions(
|
|
2646
2313
|
withProjectOptions(
|
|
2647
|
-
|
|
2314
|
+
yargs25.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2648
2315
|
)
|
|
2649
2316
|
)
|
|
2650
2317
|
),
|
|
@@ -2661,14 +2328,14 @@ var ContentTypeModule = {
|
|
|
2661
2328
|
command: "contenttype <command>",
|
|
2662
2329
|
aliases: ["ct"],
|
|
2663
2330
|
describe: "Commands for Content Types",
|
|
2664
|
-
builder: (
|
|
2331
|
+
builder: (yargs25) => yargs25.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2665
2332
|
handler: () => {
|
|
2666
|
-
|
|
2333
|
+
yargs4.help();
|
|
2667
2334
|
}
|
|
2668
2335
|
};
|
|
2669
2336
|
|
|
2670
2337
|
// src/commands/canvas/commands/dataType.ts
|
|
2671
|
-
import
|
|
2338
|
+
import yargs5 from "yargs";
|
|
2672
2339
|
|
|
2673
2340
|
// src/commands/canvas/commands/dataType/get.ts
|
|
2674
2341
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
@@ -2676,12 +2343,12 @@ var DataTypeGetModule = {
|
|
|
2676
2343
|
command: "get <id>",
|
|
2677
2344
|
describe: "Get a data type",
|
|
2678
2345
|
aliases: ["ls"],
|
|
2679
|
-
builder: (
|
|
2346
|
+
builder: (yargs25) => withConfiguration(
|
|
2680
2347
|
withFormatOptions(
|
|
2681
2348
|
withApiOptions(
|
|
2682
2349
|
withProjectOptions(
|
|
2683
2350
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2684
|
-
|
|
2351
|
+
yargs25.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2685
2352
|
)
|
|
2686
2353
|
)
|
|
2687
2354
|
)
|
|
@@ -2704,7 +2371,7 @@ var DataTypeListModule = {
|
|
|
2704
2371
|
command: "list",
|
|
2705
2372
|
describe: "List data types",
|
|
2706
2373
|
aliases: ["ls"],
|
|
2707
|
-
builder: (
|
|
2374
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
2708
2375
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2709
2376
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2710
2377
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2757,11 +2424,11 @@ function createDataTypeEngineDataSource({
|
|
|
2757
2424
|
var DataTypePullModule = {
|
|
2758
2425
|
command: "pull <directory>",
|
|
2759
2426
|
describe: "Pulls all data types to local files in a directory",
|
|
2760
|
-
builder: (
|
|
2427
|
+
builder: (yargs25) => withConfiguration(
|
|
2761
2428
|
withApiOptions(
|
|
2762
2429
|
withProjectOptions(
|
|
2763
2430
|
withDiffOptions(
|
|
2764
|
-
|
|
2431
|
+
yargs25.positional("directory", {
|
|
2765
2432
|
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.",
|
|
2766
2433
|
type: "string"
|
|
2767
2434
|
}).option("format", {
|
|
@@ -2843,11 +2510,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
2843
2510
|
var DataTypePushModule = {
|
|
2844
2511
|
command: "push <directory>",
|
|
2845
2512
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2846
|
-
builder: (
|
|
2513
|
+
builder: (yargs25) => withConfiguration(
|
|
2847
2514
|
withApiOptions(
|
|
2848
2515
|
withProjectOptions(
|
|
2849
2516
|
withDiffOptions(
|
|
2850
|
-
|
|
2517
|
+
yargs25.positional("directory", {
|
|
2851
2518
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2852
2519
|
type: "string"
|
|
2853
2520
|
}).option("what-if", {
|
|
@@ -2917,10 +2584,10 @@ var DataTypeRemoveModule = {
|
|
|
2917
2584
|
command: "remove <id>",
|
|
2918
2585
|
aliases: ["delete", "rm"],
|
|
2919
2586
|
describe: "Delete a data type",
|
|
2920
|
-
builder: (
|
|
2587
|
+
builder: (yargs25) => withConfiguration(
|
|
2921
2588
|
withApiOptions(
|
|
2922
2589
|
withProjectOptions(
|
|
2923
|
-
|
|
2590
|
+
yargs25.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2924
2591
|
)
|
|
2925
2592
|
)
|
|
2926
2593
|
),
|
|
@@ -2937,10 +2604,10 @@ var DataTypeUpdateModule = {
|
|
|
2937
2604
|
command: "update <filename>",
|
|
2938
2605
|
aliases: ["put"],
|
|
2939
2606
|
describe: "Insert or update a data type",
|
|
2940
|
-
builder: (
|
|
2607
|
+
builder: (yargs25) => withConfiguration(
|
|
2941
2608
|
withApiOptions(
|
|
2942
2609
|
withProjectOptions(
|
|
2943
|
-
|
|
2610
|
+
yargs25.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2944
2611
|
)
|
|
2945
2612
|
)
|
|
2946
2613
|
),
|
|
@@ -2957,26 +2624,26 @@ var DataTypeModule = {
|
|
|
2957
2624
|
command: "datatype <command>",
|
|
2958
2625
|
aliases: ["dt"],
|
|
2959
2626
|
describe: "Commands for Data Type definitions",
|
|
2960
|
-
builder: (
|
|
2627
|
+
builder: (yargs25) => yargs25.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
2961
2628
|
handler: () => {
|
|
2962
|
-
|
|
2629
|
+
yargs5.help();
|
|
2963
2630
|
}
|
|
2964
2631
|
};
|
|
2965
2632
|
|
|
2966
2633
|
// src/commands/canvas/commands/entry.ts
|
|
2967
|
-
import
|
|
2634
|
+
import yargs6 from "yargs";
|
|
2968
2635
|
|
|
2969
2636
|
// src/commands/canvas/commands/entry/get.ts
|
|
2970
2637
|
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
2971
2638
|
var EntryGetModule = {
|
|
2972
2639
|
command: "get <id>",
|
|
2973
2640
|
describe: "Get an entry",
|
|
2974
|
-
builder: (
|
|
2641
|
+
builder: (yargs25) => withConfiguration(
|
|
2975
2642
|
withFormatOptions(
|
|
2976
2643
|
withApiOptions(
|
|
2977
2644
|
withProjectOptions(
|
|
2978
2645
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2979
|
-
|
|
2646
|
+
yargs25.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
2980
2647
|
)
|
|
2981
2648
|
)
|
|
2982
2649
|
)
|
|
@@ -2997,7 +2664,7 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
|
2997
2664
|
var EntryListModule = {
|
|
2998
2665
|
command: "list",
|
|
2999
2666
|
describe: "List entries",
|
|
3000
|
-
builder: (
|
|
2667
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
3001
2668
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3002
2669
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3003
2670
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3054,12 +2721,12 @@ function createEntryEngineDataSource({
|
|
|
3054
2721
|
var EntryPullModule = {
|
|
3055
2722
|
command: "pull <directory>",
|
|
3056
2723
|
describe: "Pulls all entries to local files in a directory",
|
|
3057
|
-
builder: (
|
|
2724
|
+
builder: (yargs25) => withConfiguration(
|
|
3058
2725
|
withApiOptions(
|
|
3059
2726
|
withProjectOptions(
|
|
3060
2727
|
withStateOptions(
|
|
3061
2728
|
withDiffOptions(
|
|
3062
|
-
|
|
2729
|
+
yargs25.positional("directory", {
|
|
3063
2730
|
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.",
|
|
3064
2731
|
type: "string"
|
|
3065
2732
|
}).option("format", {
|
|
@@ -3143,12 +2810,12 @@ import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
|
3143
2810
|
var EntryPushModule = {
|
|
3144
2811
|
command: "push <directory>",
|
|
3145
2812
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
3146
|
-
builder: (
|
|
2813
|
+
builder: (yargs25) => withConfiguration(
|
|
3147
2814
|
withApiOptions(
|
|
3148
2815
|
withProjectOptions(
|
|
3149
2816
|
withStateOptions(
|
|
3150
2817
|
withDiffOptions(
|
|
3151
|
-
|
|
2818
|
+
yargs25.positional("directory", {
|
|
3152
2819
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
3153
2820
|
type: "string"
|
|
3154
2821
|
}).option("what-if", {
|
|
@@ -3220,10 +2887,10 @@ var EntryRemoveModule = {
|
|
|
3220
2887
|
command: "remove <id>",
|
|
3221
2888
|
aliases: ["delete", "rm"],
|
|
3222
2889
|
describe: "Delete an entry",
|
|
3223
|
-
builder: (
|
|
2890
|
+
builder: (yargs25) => withConfiguration(
|
|
3224
2891
|
withApiOptions(
|
|
3225
2892
|
withProjectOptions(
|
|
3226
|
-
|
|
2893
|
+
yargs25.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
3227
2894
|
)
|
|
3228
2895
|
)
|
|
3229
2896
|
),
|
|
@@ -3240,10 +2907,10 @@ var EntryUpdateModule = {
|
|
|
3240
2907
|
command: "update <filename>",
|
|
3241
2908
|
aliases: ["put"],
|
|
3242
2909
|
describe: "Insert or update an entry",
|
|
3243
|
-
builder: (
|
|
2910
|
+
builder: (yargs25) => withConfiguration(
|
|
3244
2911
|
withApiOptions(
|
|
3245
2912
|
withProjectOptions(
|
|
3246
|
-
|
|
2913
|
+
yargs25.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
3247
2914
|
)
|
|
3248
2915
|
)
|
|
3249
2916
|
),
|
|
@@ -3259,14 +2926,14 @@ var EntryUpdateModule = {
|
|
|
3259
2926
|
var EntryModule = {
|
|
3260
2927
|
command: "entry <command>",
|
|
3261
2928
|
describe: "Commands for Entries",
|
|
3262
|
-
builder: (
|
|
2929
|
+
builder: (yargs25) => yargs25.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
3263
2930
|
handler: () => {
|
|
3264
|
-
|
|
2931
|
+
yargs6.help();
|
|
3265
2932
|
}
|
|
3266
2933
|
};
|
|
3267
2934
|
|
|
3268
2935
|
// src/commands/canvas/commands/pattern.ts
|
|
3269
|
-
import
|
|
2936
|
+
import yargs7 from "yargs";
|
|
3270
2937
|
|
|
3271
2938
|
// src/commands/canvas/commands/pattern/get.ts
|
|
3272
2939
|
var PatternGetModule = {
|
|
@@ -3278,12 +2945,12 @@ var PatternGetModule = {
|
|
|
3278
2945
|
var PatternListModule = {
|
|
3279
2946
|
...CompositionListModule,
|
|
3280
2947
|
describe: "List patterns",
|
|
3281
|
-
builder: (
|
|
2948
|
+
builder: (yargs25) => withFormatOptions(
|
|
3282
2949
|
withConfiguration(
|
|
3283
2950
|
withApiOptions(
|
|
3284
2951
|
withProjectOptions(
|
|
3285
2952
|
withStateOptions(
|
|
3286
|
-
|
|
2953
|
+
yargs25.options({
|
|
3287
2954
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3288
2955
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
3289
2956
|
resolvePatterns: {
|
|
@@ -3321,11 +2988,11 @@ var PatternListModule = {
|
|
|
3321
2988
|
var PatternPublishModule = {
|
|
3322
2989
|
...CompositionPublishModule,
|
|
3323
2990
|
describe: "Publishes pattern(s)",
|
|
3324
|
-
builder: (
|
|
2991
|
+
builder: (yargs25) => withConfiguration(
|
|
3325
2992
|
withApiOptions(
|
|
3326
2993
|
withProjectOptions(
|
|
3327
2994
|
withDiffOptions(
|
|
3328
|
-
|
|
2995
|
+
yargs25.positional("ids", {
|
|
3329
2996
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3330
2997
|
type: "string"
|
|
3331
2998
|
}).option("all", {
|
|
@@ -3363,12 +3030,12 @@ var PatternPublishModule = {
|
|
|
3363
3030
|
var PatternPullModule = {
|
|
3364
3031
|
...CompositionPullModule,
|
|
3365
3032
|
describe: "Pulls all patterns to local files in a directory",
|
|
3366
|
-
builder: (
|
|
3033
|
+
builder: (yargs25) => withConfiguration(
|
|
3367
3034
|
withApiOptions(
|
|
3368
3035
|
withProjectOptions(
|
|
3369
3036
|
withStateOptions(
|
|
3370
3037
|
withDiffOptions(
|
|
3371
|
-
|
|
3038
|
+
yargs25.positional("directory", {
|
|
3372
3039
|
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.",
|
|
3373
3040
|
type: "string"
|
|
3374
3041
|
}).option("format", {
|
|
@@ -3406,12 +3073,12 @@ var PatternPullModule = {
|
|
|
3406
3073
|
var PatternPushModule = {
|
|
3407
3074
|
...CompositionPushModule,
|
|
3408
3075
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
3409
|
-
builder: (
|
|
3076
|
+
builder: (yargs25) => withConfiguration(
|
|
3410
3077
|
withApiOptions(
|
|
3411
3078
|
withProjectOptions(
|
|
3412
3079
|
withStateOptions(
|
|
3413
3080
|
withDiffOptions(
|
|
3414
|
-
|
|
3081
|
+
yargs25.positional("directory", {
|
|
3415
3082
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
3416
3083
|
type: "string"
|
|
3417
3084
|
}).option("what-if", {
|
|
@@ -3449,10 +3116,10 @@ var PatternRemoveModule = {
|
|
|
3449
3116
|
var PatternUnpublishModule = {
|
|
3450
3117
|
command: "unpublish [ids]",
|
|
3451
3118
|
describe: "Unpublish a pattern(s)",
|
|
3452
|
-
builder: (
|
|
3119
|
+
builder: (yargs25) => withConfiguration(
|
|
3453
3120
|
withApiOptions(
|
|
3454
3121
|
withProjectOptions(
|
|
3455
|
-
|
|
3122
|
+
yargs25.positional("ids", {
|
|
3456
3123
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3457
3124
|
type: "string"
|
|
3458
3125
|
}).option("all", {
|
|
@@ -3491,9 +3158,9 @@ var PatternUpdateModule = {
|
|
|
3491
3158
|
var PatternModule = {
|
|
3492
3159
|
command: "pattern <command>",
|
|
3493
3160
|
describe: "Commands for Canvas patterns",
|
|
3494
|
-
builder: (
|
|
3161
|
+
builder: (yargs25) => yargs25.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3495
3162
|
handler: () => {
|
|
3496
|
-
|
|
3163
|
+
yargs7.help();
|
|
3497
3164
|
}
|
|
3498
3165
|
};
|
|
3499
3166
|
|
|
@@ -3502,28 +3169,28 @@ var CanvasCommand = {
|
|
|
3502
3169
|
command: "canvas <command>",
|
|
3503
3170
|
aliases: ["cv", "pm", "presentation"],
|
|
3504
3171
|
describe: "Uniform Canvas commands",
|
|
3505
|
-
builder: (
|
|
3172
|
+
builder: (yargs25) => yargs25.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).demandCommand(),
|
|
3506
3173
|
handler: () => {
|
|
3507
|
-
|
|
3174
|
+
yargs8.showHelp();
|
|
3508
3175
|
}
|
|
3509
3176
|
};
|
|
3510
3177
|
|
|
3511
3178
|
// src/commands/context/index.ts
|
|
3512
|
-
import
|
|
3179
|
+
import yargs15 from "yargs";
|
|
3513
3180
|
|
|
3514
3181
|
// src/commands/context/commands/aggregate.ts
|
|
3515
|
-
import
|
|
3182
|
+
import yargs9 from "yargs";
|
|
3516
3183
|
|
|
3517
3184
|
// src/commands/context/commands/aggregate/get.ts
|
|
3518
3185
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
3519
3186
|
var AggregateGetModule = {
|
|
3520
3187
|
command: "get <id>",
|
|
3521
3188
|
describe: "Fetch an aggregate",
|
|
3522
|
-
builder: (
|
|
3189
|
+
builder: (yargs25) => withConfiguration(
|
|
3523
3190
|
withFormatOptions(
|
|
3524
3191
|
withApiOptions(
|
|
3525
3192
|
withProjectOptions(
|
|
3526
|
-
|
|
3193
|
+
yargs25.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3527
3194
|
)
|
|
3528
3195
|
)
|
|
3529
3196
|
)
|
|
@@ -3547,7 +3214,7 @@ var AggregateListModule = {
|
|
|
3547
3214
|
command: "list",
|
|
3548
3215
|
describe: "List aggregates",
|
|
3549
3216
|
aliases: ["ls"],
|
|
3550
|
-
builder: (
|
|
3217
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
3551
3218
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3552
3219
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3553
3220
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3613,11 +3280,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
3613
3280
|
var AggregatePullModule = {
|
|
3614
3281
|
command: "pull <directory>",
|
|
3615
3282
|
describe: "Pulls all aggregates to local files in a directory",
|
|
3616
|
-
builder: (
|
|
3283
|
+
builder: (yargs25) => withConfiguration(
|
|
3617
3284
|
withApiOptions(
|
|
3618
3285
|
withProjectOptions(
|
|
3619
3286
|
withDiffOptions(
|
|
3620
|
-
|
|
3287
|
+
yargs25.positional("directory", {
|
|
3621
3288
|
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.",
|
|
3622
3289
|
type: "string"
|
|
3623
3290
|
}).option("format", {
|
|
@@ -3692,11 +3359,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
3692
3359
|
var AggregatePushModule = {
|
|
3693
3360
|
command: "push <directory>",
|
|
3694
3361
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
3695
|
-
builder: (
|
|
3362
|
+
builder: (yargs25) => withConfiguration(
|
|
3696
3363
|
withApiOptions(
|
|
3697
3364
|
withProjectOptions(
|
|
3698
3365
|
withDiffOptions(
|
|
3699
|
-
|
|
3366
|
+
yargs25.positional("directory", {
|
|
3700
3367
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
3701
3368
|
type: "string"
|
|
3702
3369
|
}).option("what-if", {
|
|
@@ -3761,10 +3428,10 @@ var AggregateRemoveModule = {
|
|
|
3761
3428
|
command: "remove <id>",
|
|
3762
3429
|
aliases: ["delete", "rm"],
|
|
3763
3430
|
describe: "Delete an aggregate",
|
|
3764
|
-
builder: (
|
|
3431
|
+
builder: (yargs25) => withConfiguration(
|
|
3765
3432
|
withApiOptions(
|
|
3766
3433
|
withProjectOptions(
|
|
3767
|
-
|
|
3434
|
+
yargs25.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
3768
3435
|
)
|
|
3769
3436
|
)
|
|
3770
3437
|
),
|
|
@@ -3781,10 +3448,10 @@ var AggregateUpdateModule = {
|
|
|
3781
3448
|
command: "update <filename>",
|
|
3782
3449
|
aliases: ["put"],
|
|
3783
3450
|
describe: "Insert or update an aggregate",
|
|
3784
|
-
builder: (
|
|
3451
|
+
builder: (yargs25) => withConfiguration(
|
|
3785
3452
|
withApiOptions(
|
|
3786
3453
|
withProjectOptions(
|
|
3787
|
-
|
|
3454
|
+
yargs25.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
3788
3455
|
)
|
|
3789
3456
|
)
|
|
3790
3457
|
),
|
|
@@ -3801,25 +3468,25 @@ var AggregateModule = {
|
|
|
3801
3468
|
command: "aggregate <command>",
|
|
3802
3469
|
aliases: ["agg", "intent", "audience"],
|
|
3803
3470
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
3804
|
-
builder: (
|
|
3471
|
+
builder: (yargs25) => yargs25.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
3805
3472
|
handler: () => {
|
|
3806
|
-
|
|
3473
|
+
yargs9.help();
|
|
3807
3474
|
}
|
|
3808
3475
|
};
|
|
3809
3476
|
|
|
3810
3477
|
// src/commands/context/commands/enrichment.ts
|
|
3811
|
-
import
|
|
3478
|
+
import yargs10 from "yargs";
|
|
3812
3479
|
|
|
3813
3480
|
// src/commands/context/commands/enrichment/get.ts
|
|
3814
3481
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
3815
3482
|
var EnrichmentGetModule = {
|
|
3816
3483
|
command: "get <id>",
|
|
3817
3484
|
describe: "Fetch an enrichment category and its values",
|
|
3818
|
-
builder: (
|
|
3485
|
+
builder: (yargs25) => withFormatOptions(
|
|
3819
3486
|
withConfiguration(
|
|
3820
3487
|
withApiOptions(
|
|
3821
3488
|
withProjectOptions(
|
|
3822
|
-
|
|
3489
|
+
yargs25.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
3823
3490
|
)
|
|
3824
3491
|
)
|
|
3825
3492
|
)
|
|
@@ -3844,7 +3511,7 @@ var EnrichmentListModule = {
|
|
|
3844
3511
|
command: "list",
|
|
3845
3512
|
describe: "List enrichments",
|
|
3846
3513
|
aliases: ["ls"],
|
|
3847
|
-
builder: (
|
|
3514
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
3848
3515
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3849
3516
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3850
3517
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3945,11 +3612,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
3945
3612
|
var EnrichmentPullModule = {
|
|
3946
3613
|
command: "pull <directory>",
|
|
3947
3614
|
describe: "Pulls all enrichments to local files in a directory",
|
|
3948
|
-
builder: (
|
|
3615
|
+
builder: (yargs25) => withConfiguration(
|
|
3949
3616
|
withApiOptions(
|
|
3950
3617
|
withProjectOptions(
|
|
3951
3618
|
withDiffOptions(
|
|
3952
|
-
|
|
3619
|
+
yargs25.positional("directory", {
|
|
3953
3620
|
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.",
|
|
3954
3621
|
type: "string"
|
|
3955
3622
|
}).option("format", {
|
|
@@ -4024,11 +3691,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
4024
3691
|
var EnrichmentPushModule = {
|
|
4025
3692
|
command: "push <directory>",
|
|
4026
3693
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
4027
|
-
builder: (
|
|
3694
|
+
builder: (yargs25) => withConfiguration(
|
|
4028
3695
|
withApiOptions(
|
|
4029
3696
|
withProjectOptions(
|
|
4030
3697
|
withDiffOptions(
|
|
4031
|
-
|
|
3698
|
+
yargs25.positional("directory", {
|
|
4032
3699
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
4033
3700
|
type: "string"
|
|
4034
3701
|
}).option("what-if", {
|
|
@@ -4092,10 +3759,10 @@ var EnrichmentRemoveModule = {
|
|
|
4092
3759
|
command: "remove <id>",
|
|
4093
3760
|
aliases: ["delete", "rm"],
|
|
4094
3761
|
describe: "Delete an enrichment category and its values",
|
|
4095
|
-
builder: (
|
|
3762
|
+
builder: (yargs25) => withConfiguration(
|
|
4096
3763
|
withApiOptions(
|
|
4097
3764
|
withProjectOptions(
|
|
4098
|
-
|
|
3765
|
+
yargs25.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
4099
3766
|
)
|
|
4100
3767
|
)
|
|
4101
3768
|
),
|
|
@@ -4111,14 +3778,14 @@ var EnrichmentModule = {
|
|
|
4111
3778
|
command: "enrichment <command>",
|
|
4112
3779
|
aliases: ["enr"],
|
|
4113
3780
|
describe: "Commands for Context enrichments",
|
|
4114
|
-
builder: (
|
|
3781
|
+
builder: (yargs25) => yargs25.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
4115
3782
|
handler: () => {
|
|
4116
|
-
|
|
3783
|
+
yargs10.help();
|
|
4117
3784
|
}
|
|
4118
3785
|
};
|
|
4119
3786
|
|
|
4120
3787
|
// src/commands/context/commands/manifest.ts
|
|
4121
|
-
import
|
|
3788
|
+
import yargs11 from "yargs";
|
|
4122
3789
|
|
|
4123
3790
|
// src/commands/context/commands/manifest/get.ts
|
|
4124
3791
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -4129,10 +3796,10 @@ var ManifestGetModule = {
|
|
|
4129
3796
|
command: "get [output]",
|
|
4130
3797
|
aliases: ["dl", "download"],
|
|
4131
3798
|
describe: "Download the Uniform Context manifest for a project",
|
|
4132
|
-
builder: (
|
|
3799
|
+
builder: (yargs25) => withConfiguration(
|
|
4133
3800
|
withApiOptions(
|
|
4134
3801
|
withProjectOptions(
|
|
4135
|
-
|
|
3802
|
+
yargs25.option("preview", {
|
|
4136
3803
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
4137
3804
|
default: false,
|
|
4138
3805
|
type: "boolean",
|
|
@@ -4194,7 +3861,7 @@ import { exit as exit2 } from "process";
|
|
|
4194
3861
|
var ManifestPublishModule = {
|
|
4195
3862
|
command: "publish",
|
|
4196
3863
|
describe: "Publish the Uniform Context manifest for a project",
|
|
4197
|
-
builder: (
|
|
3864
|
+
builder: (yargs25) => withConfiguration(withApiOptions(withProjectOptions(yargs25))),
|
|
4198
3865
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
4199
3866
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4200
3867
|
try {
|
|
@@ -4227,25 +3894,25 @@ var ManifestModule = {
|
|
|
4227
3894
|
command: "manifest <command>",
|
|
4228
3895
|
describe: "Commands for context manifests",
|
|
4229
3896
|
aliases: ["man"],
|
|
4230
|
-
builder: (
|
|
3897
|
+
builder: (yargs25) => yargs25.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
4231
3898
|
handler: () => {
|
|
4232
|
-
|
|
3899
|
+
yargs11.help();
|
|
4233
3900
|
}
|
|
4234
3901
|
};
|
|
4235
3902
|
|
|
4236
3903
|
// src/commands/context/commands/quirk.ts
|
|
4237
|
-
import
|
|
3904
|
+
import yargs12 from "yargs";
|
|
4238
3905
|
|
|
4239
3906
|
// src/commands/context/commands/quirk/get.ts
|
|
4240
3907
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
4241
3908
|
var QuirkGetModule = {
|
|
4242
3909
|
command: "get <id>",
|
|
4243
3910
|
describe: "Fetch a quirk",
|
|
4244
|
-
builder: (
|
|
3911
|
+
builder: (yargs25) => withConfiguration(
|
|
4245
3912
|
withFormatOptions(
|
|
4246
3913
|
withApiOptions(
|
|
4247
3914
|
withProjectOptions(
|
|
4248
|
-
|
|
3915
|
+
yargs25.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
4249
3916
|
)
|
|
4250
3917
|
)
|
|
4251
3918
|
)
|
|
@@ -4269,11 +3936,11 @@ var QuirkListModule = {
|
|
|
4269
3936
|
command: "list",
|
|
4270
3937
|
describe: "List quirks",
|
|
4271
3938
|
aliases: ["ls"],
|
|
4272
|
-
builder: (
|
|
3939
|
+
builder: (yargs25) => withConfiguration(
|
|
4273
3940
|
withFormatOptions(
|
|
4274
3941
|
withApiOptions(
|
|
4275
3942
|
withProjectOptions(
|
|
4276
|
-
|
|
3943
|
+
yargs25.option("withIntegrations", {
|
|
4277
3944
|
alias: ["i"],
|
|
4278
3945
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
4279
3946
|
type: "boolean"
|
|
@@ -4330,11 +3997,11 @@ function createQuirkEngineDataSource({
|
|
|
4330
3997
|
var QuirkPullModule = {
|
|
4331
3998
|
command: "pull <directory>",
|
|
4332
3999
|
describe: "Pulls all quirks to local files in a directory",
|
|
4333
|
-
builder: (
|
|
4000
|
+
builder: (yargs25) => withConfiguration(
|
|
4334
4001
|
withApiOptions(
|
|
4335
4002
|
withProjectOptions(
|
|
4336
4003
|
withDiffOptions(
|
|
4337
|
-
|
|
4004
|
+
yargs25.positional("directory", {
|
|
4338
4005
|
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.",
|
|
4339
4006
|
type: "string"
|
|
4340
4007
|
}).option("format", {
|
|
@@ -4409,11 +4076,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
4409
4076
|
var QuirkPushModule = {
|
|
4410
4077
|
command: "push <directory>",
|
|
4411
4078
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
4412
|
-
builder: (
|
|
4079
|
+
builder: (yargs25) => withConfiguration(
|
|
4413
4080
|
withApiOptions(
|
|
4414
4081
|
withProjectOptions(
|
|
4415
4082
|
withDiffOptions(
|
|
4416
|
-
|
|
4083
|
+
yargs25.positional("directory", {
|
|
4417
4084
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
4418
4085
|
type: "string"
|
|
4419
4086
|
}).option("what-if", {
|
|
@@ -4477,10 +4144,10 @@ var QuirkRemoveModule = {
|
|
|
4477
4144
|
command: "remove <id>",
|
|
4478
4145
|
aliases: ["delete", "rm"],
|
|
4479
4146
|
describe: "Delete a quirk",
|
|
4480
|
-
builder: (
|
|
4147
|
+
builder: (yargs25) => withConfiguration(
|
|
4481
4148
|
withApiOptions(
|
|
4482
4149
|
withProjectOptions(
|
|
4483
|
-
|
|
4150
|
+
yargs25.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4484
4151
|
)
|
|
4485
4152
|
)
|
|
4486
4153
|
),
|
|
@@ -4497,10 +4164,10 @@ var QuirkUpdateModule = {
|
|
|
4497
4164
|
command: "update <filename>",
|
|
4498
4165
|
aliases: ["put"],
|
|
4499
4166
|
describe: "Insert or update a quirk",
|
|
4500
|
-
builder: (
|
|
4167
|
+
builder: (yargs25) => withConfiguration(
|
|
4501
4168
|
withApiOptions(
|
|
4502
4169
|
withProjectOptions(
|
|
4503
|
-
|
|
4170
|
+
yargs25.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4504
4171
|
)
|
|
4505
4172
|
)
|
|
4506
4173
|
),
|
|
@@ -4517,25 +4184,25 @@ var QuirkModule = {
|
|
|
4517
4184
|
command: "quirk <command>",
|
|
4518
4185
|
aliases: ["qk"],
|
|
4519
4186
|
describe: "Commands for Context quirks",
|
|
4520
|
-
builder: (
|
|
4187
|
+
builder: (yargs25) => yargs25.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
4521
4188
|
handler: () => {
|
|
4522
|
-
|
|
4189
|
+
yargs12.help();
|
|
4523
4190
|
}
|
|
4524
4191
|
};
|
|
4525
4192
|
|
|
4526
4193
|
// src/commands/context/commands/signal.ts
|
|
4527
|
-
import
|
|
4194
|
+
import yargs13 from "yargs";
|
|
4528
4195
|
|
|
4529
4196
|
// src/commands/context/commands/signal/get.ts
|
|
4530
4197
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
4531
4198
|
var SignalGetModule = {
|
|
4532
4199
|
command: "get <id>",
|
|
4533
4200
|
describe: "Fetch a signal",
|
|
4534
|
-
builder: (
|
|
4201
|
+
builder: (yargs25) => withConfiguration(
|
|
4535
4202
|
withFormatOptions(
|
|
4536
4203
|
withApiOptions(
|
|
4537
4204
|
withProjectOptions(
|
|
4538
|
-
|
|
4205
|
+
yargs25.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4539
4206
|
)
|
|
4540
4207
|
)
|
|
4541
4208
|
)
|
|
@@ -4559,7 +4226,7 @@ var SignalListModule = {
|
|
|
4559
4226
|
command: "list",
|
|
4560
4227
|
describe: "List signals",
|
|
4561
4228
|
aliases: ["ls"],
|
|
4562
|
-
builder: (
|
|
4229
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
4563
4230
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4564
4231
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4565
4232
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4608,11 +4275,11 @@ function createSignalEngineDataSource({
|
|
|
4608
4275
|
var SignalPullModule = {
|
|
4609
4276
|
command: "pull <directory>",
|
|
4610
4277
|
describe: "Pulls all signals to local files in a directory",
|
|
4611
|
-
builder: (
|
|
4278
|
+
builder: (yargs25) => withConfiguration(
|
|
4612
4279
|
withApiOptions(
|
|
4613
4280
|
withProjectOptions(
|
|
4614
4281
|
withDiffOptions(
|
|
4615
|
-
|
|
4282
|
+
yargs25.positional("directory", {
|
|
4616
4283
|
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.",
|
|
4617
4284
|
type: "string"
|
|
4618
4285
|
}).option("format", {
|
|
@@ -4687,11 +4354,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
4687
4354
|
var SignalPushModule = {
|
|
4688
4355
|
command: "push <directory>",
|
|
4689
4356
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
4690
|
-
builder: (
|
|
4357
|
+
builder: (yargs25) => withConfiguration(
|
|
4691
4358
|
withApiOptions(
|
|
4692
4359
|
withProjectOptions(
|
|
4693
4360
|
withDiffOptions(
|
|
4694
|
-
|
|
4361
|
+
yargs25.positional("directory", {
|
|
4695
4362
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
4696
4363
|
type: "string"
|
|
4697
4364
|
}).option("what-if", {
|
|
@@ -4755,10 +4422,10 @@ var SignalRemoveModule = {
|
|
|
4755
4422
|
command: "remove <id>",
|
|
4756
4423
|
aliases: ["delete", "rm"],
|
|
4757
4424
|
describe: "Delete a signal",
|
|
4758
|
-
builder: (
|
|
4425
|
+
builder: (yargs25) => withConfiguration(
|
|
4759
4426
|
withApiOptions(
|
|
4760
4427
|
withProjectOptions(
|
|
4761
|
-
|
|
4428
|
+
yargs25.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
4762
4429
|
)
|
|
4763
4430
|
)
|
|
4764
4431
|
),
|
|
@@ -4775,10 +4442,10 @@ var SignalUpdateModule = {
|
|
|
4775
4442
|
command: "update <filename>",
|
|
4776
4443
|
aliases: ["put"],
|
|
4777
4444
|
describe: "Insert or update a signal",
|
|
4778
|
-
builder: (
|
|
4445
|
+
builder: (yargs25) => withConfiguration(
|
|
4779
4446
|
withApiOptions(
|
|
4780
4447
|
withProjectOptions(
|
|
4781
|
-
|
|
4448
|
+
yargs25.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
4782
4449
|
)
|
|
4783
4450
|
)
|
|
4784
4451
|
),
|
|
@@ -4795,25 +4462,25 @@ var SignalModule = {
|
|
|
4795
4462
|
command: "signal <command>",
|
|
4796
4463
|
aliases: ["sig"],
|
|
4797
4464
|
describe: "Commands for Context signals",
|
|
4798
|
-
builder: (
|
|
4465
|
+
builder: (yargs25) => yargs25.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
4799
4466
|
handler: () => {
|
|
4800
|
-
|
|
4467
|
+
yargs13.help();
|
|
4801
4468
|
}
|
|
4802
4469
|
};
|
|
4803
4470
|
|
|
4804
4471
|
// src/commands/context/commands/test.ts
|
|
4805
|
-
import
|
|
4472
|
+
import yargs14 from "yargs";
|
|
4806
4473
|
|
|
4807
4474
|
// src/commands/context/commands/test/get.ts
|
|
4808
4475
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
4809
4476
|
var TestGetModule = {
|
|
4810
4477
|
command: "get <id>",
|
|
4811
4478
|
describe: "Fetch a test",
|
|
4812
|
-
builder: (
|
|
4479
|
+
builder: (yargs25) => withConfiguration(
|
|
4813
4480
|
withFormatOptions(
|
|
4814
4481
|
withApiOptions(
|
|
4815
4482
|
withProjectOptions(
|
|
4816
|
-
|
|
4483
|
+
yargs25.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
4817
4484
|
)
|
|
4818
4485
|
)
|
|
4819
4486
|
)
|
|
@@ -4837,7 +4504,7 @@ var TestListModule = {
|
|
|
4837
4504
|
command: "list",
|
|
4838
4505
|
describe: "List tests",
|
|
4839
4506
|
aliases: ["ls"],
|
|
4840
|
-
builder: (
|
|
4507
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
4841
4508
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4842
4509
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4843
4510
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4886,11 +4553,11 @@ function createTestEngineDataSource({
|
|
|
4886
4553
|
var TestPullModule = {
|
|
4887
4554
|
command: "pull <directory>",
|
|
4888
4555
|
describe: "Pulls all tests to local files in a directory",
|
|
4889
|
-
builder: (
|
|
4556
|
+
builder: (yargs25) => withConfiguration(
|
|
4890
4557
|
withApiOptions(
|
|
4891
4558
|
withProjectOptions(
|
|
4892
4559
|
withDiffOptions(
|
|
4893
|
-
|
|
4560
|
+
yargs25.positional("directory", {
|
|
4894
4561
|
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.",
|
|
4895
4562
|
type: "string"
|
|
4896
4563
|
}).option("format", {
|
|
@@ -4965,11 +4632,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
4965
4632
|
var TestPushModule = {
|
|
4966
4633
|
command: "push <directory>",
|
|
4967
4634
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
4968
|
-
builder: (
|
|
4635
|
+
builder: (yargs25) => withConfiguration(
|
|
4969
4636
|
withApiOptions(
|
|
4970
4637
|
withProjectOptions(
|
|
4971
4638
|
withDiffOptions(
|
|
4972
|
-
|
|
4639
|
+
yargs25.positional("directory", {
|
|
4973
4640
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
4974
4641
|
type: "string"
|
|
4975
4642
|
}).option("what-if", {
|
|
@@ -5033,10 +4700,10 @@ var TestRemoveModule = {
|
|
|
5033
4700
|
command: "remove <id>",
|
|
5034
4701
|
aliases: ["delete", "rm"],
|
|
5035
4702
|
describe: "Delete a test",
|
|
5036
|
-
builder: (
|
|
4703
|
+
builder: (yargs25) => withConfiguration(
|
|
5037
4704
|
withApiOptions(
|
|
5038
4705
|
withProjectOptions(
|
|
5039
|
-
|
|
4706
|
+
yargs25.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
5040
4707
|
)
|
|
5041
4708
|
)
|
|
5042
4709
|
),
|
|
@@ -5053,9 +4720,9 @@ var TestUpdateModule = {
|
|
|
5053
4720
|
command: "update <filename>",
|
|
5054
4721
|
aliases: ["put"],
|
|
5055
4722
|
describe: "Insert or update a test",
|
|
5056
|
-
builder: (
|
|
4723
|
+
builder: (yargs25) => withConfiguration(
|
|
5057
4724
|
withApiOptions(
|
|
5058
|
-
withProjectOptions(
|
|
4725
|
+
withProjectOptions(yargs25.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
5059
4726
|
)
|
|
5060
4727
|
),
|
|
5061
4728
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5070,9 +4737,9 @@ var TestUpdateModule = {
|
|
|
5070
4737
|
var TestModule = {
|
|
5071
4738
|
command: "test <command>",
|
|
5072
4739
|
describe: "Commands for Context A/B tests",
|
|
5073
|
-
builder: (
|
|
4740
|
+
builder: (yargs25) => yargs25.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
5074
4741
|
handler: () => {
|
|
5075
|
-
|
|
4742
|
+
yargs14.help();
|
|
5076
4743
|
}
|
|
5077
4744
|
};
|
|
5078
4745
|
|
|
@@ -5081,9 +4748,9 @@ var ContextCommand = {
|
|
|
5081
4748
|
command: "context <command>",
|
|
5082
4749
|
aliases: ["ctx"],
|
|
5083
4750
|
describe: "Uniform Context commands",
|
|
5084
|
-
builder: (
|
|
4751
|
+
builder: (yargs25) => yargs25.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
5085
4752
|
handler: () => {
|
|
5086
|
-
|
|
4753
|
+
yargs15.showHelp();
|
|
5087
4754
|
}
|
|
5088
4755
|
};
|
|
5089
4756
|
|
|
@@ -5111,7 +4778,7 @@ import { PostHog } from "posthog-node";
|
|
|
5111
4778
|
// package.json
|
|
5112
4779
|
var package_default = {
|
|
5113
4780
|
name: "@uniformdev/cli",
|
|
5114
|
-
version: "19.58.
|
|
4781
|
+
version: "19.58.1",
|
|
5115
4782
|
description: "Uniform command line interface tool",
|
|
5116
4783
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5117
4784
|
main: "./cli.js",
|
|
@@ -5128,7 +4795,6 @@ var package_default = {
|
|
|
5128
4795
|
},
|
|
5129
4796
|
dependencies: {
|
|
5130
4797
|
"@thi.ng/mime": "^2.2.23",
|
|
5131
|
-
"@uniformdev/assets": "workspace:*",
|
|
5132
4798
|
"@uniformdev/canvas": "workspace:*",
|
|
5133
4799
|
"@uniformdev/context": "workspace:*",
|
|
5134
4800
|
"@uniformdev/files": "workspace:*",
|
|
@@ -5147,7 +4813,7 @@ var package_default = {
|
|
|
5147
4813
|
"image-size": "^1.0.2",
|
|
5148
4814
|
inquirer: "9.2.11",
|
|
5149
4815
|
"isomorphic-git": "1.24.5",
|
|
5150
|
-
"isomorphic-unfetch": "^
|
|
4816
|
+
"isomorphic-unfetch": "^4.0.0",
|
|
5151
4817
|
"js-yaml": "^4.1.0",
|
|
5152
4818
|
jsonwebtoken: "9.0.2",
|
|
5153
4819
|
"lodash.isequalwith": "^4.4.0",
|
|
@@ -5161,7 +4827,7 @@ var package_default = {
|
|
|
5161
4827
|
zod: "3.21.4"
|
|
5162
4828
|
},
|
|
5163
4829
|
devDependencies: {
|
|
5164
|
-
"@types/diff": "5.0.
|
|
4830
|
+
"@types/diff": "5.0.5",
|
|
5165
4831
|
"@types/inquirer": "9.0.3",
|
|
5166
4832
|
"@types/js-yaml": "4.0.6",
|
|
5167
4833
|
"@types/jsonwebtoken": "9.0.3",
|
|
@@ -6156,10 +5822,10 @@ var NewMeshCmd = {
|
|
|
6156
5822
|
};
|
|
6157
5823
|
|
|
6158
5824
|
// src/commands/optimize/index.ts
|
|
6159
|
-
import
|
|
5825
|
+
import yargs17 from "yargs";
|
|
6160
5826
|
|
|
6161
5827
|
// src/commands/optimize/manifest.ts
|
|
6162
|
-
import
|
|
5828
|
+
import yargs16 from "yargs";
|
|
6163
5829
|
|
|
6164
5830
|
// src/commands/optimize/manifest/download.ts
|
|
6165
5831
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -6174,7 +5840,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
6174
5840
|
var module = {
|
|
6175
5841
|
command: "download [output]",
|
|
6176
5842
|
describe: "Download intent manifest",
|
|
6177
|
-
builder: (
|
|
5843
|
+
builder: (yargs25) => yargs25.option("apiKey", {
|
|
6178
5844
|
alias: "k",
|
|
6179
5845
|
demandOption: true,
|
|
6180
5846
|
string: true,
|
|
@@ -6275,10 +5941,10 @@ var module2 = {
|
|
|
6275
5941
|
command: "manifest <command>",
|
|
6276
5942
|
describe: "Intent manifest commands",
|
|
6277
5943
|
builder: () => {
|
|
6278
|
-
return
|
|
5944
|
+
return yargs16.command(download_default);
|
|
6279
5945
|
},
|
|
6280
5946
|
handler: () => {
|
|
6281
|
-
|
|
5947
|
+
yargs16.showHelp();
|
|
6282
5948
|
}
|
|
6283
5949
|
};
|
|
6284
5950
|
var manifest_default = module2;
|
|
@@ -6289,29 +5955,29 @@ var OptimizeCommand = {
|
|
|
6289
5955
|
aliases: ["opt"],
|
|
6290
5956
|
describe: "Uniform Optimize commands",
|
|
6291
5957
|
builder: () => {
|
|
6292
|
-
return
|
|
5958
|
+
return yargs17.command(manifest_default);
|
|
6293
5959
|
},
|
|
6294
5960
|
handler: () => {
|
|
6295
|
-
|
|
5961
|
+
yargs17.showHelp();
|
|
6296
5962
|
}
|
|
6297
5963
|
};
|
|
6298
5964
|
|
|
6299
5965
|
// src/commands/project-map/index.ts
|
|
6300
|
-
import
|
|
5966
|
+
import yargs20 from "yargs";
|
|
6301
5967
|
|
|
6302
5968
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
6303
|
-
import
|
|
5969
|
+
import yargs18 from "yargs";
|
|
6304
5970
|
|
|
6305
5971
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
6306
5972
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
6307
5973
|
var ProjectMapDefinitionGetModule = {
|
|
6308
5974
|
command: "get <id>",
|
|
6309
5975
|
describe: "Fetch a project map",
|
|
6310
|
-
builder: (
|
|
5976
|
+
builder: (yargs25) => withFormatOptions(
|
|
6311
5977
|
withConfiguration(
|
|
6312
5978
|
withApiOptions(
|
|
6313
5979
|
withProjectOptions(
|
|
6314
|
-
|
|
5980
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
6315
5981
|
)
|
|
6316
5982
|
)
|
|
6317
5983
|
)
|
|
@@ -6335,7 +6001,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
6335
6001
|
command: "list",
|
|
6336
6002
|
describe: "List of project maps",
|
|
6337
6003
|
aliases: ["ls"],
|
|
6338
|
-
builder: (
|
|
6004
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
6339
6005
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6340
6006
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6341
6007
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6392,11 +6058,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
6392
6058
|
var ProjectMapDefinitionPullModule = {
|
|
6393
6059
|
command: "pull <directory>",
|
|
6394
6060
|
describe: "Pulls all project maps to local files in a directory",
|
|
6395
|
-
builder: (
|
|
6061
|
+
builder: (yargs25) => withConfiguration(
|
|
6396
6062
|
withApiOptions(
|
|
6397
6063
|
withProjectOptions(
|
|
6398
6064
|
withDiffOptions(
|
|
6399
|
-
|
|
6065
|
+
yargs25.positional("directory", {
|
|
6400
6066
|
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.",
|
|
6401
6067
|
type: "string"
|
|
6402
6068
|
}).option("format", {
|
|
@@ -6471,11 +6137,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
6471
6137
|
var ProjectMapDefinitionPushModule = {
|
|
6472
6138
|
command: "push <directory>",
|
|
6473
6139
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
6474
|
-
builder: (
|
|
6140
|
+
builder: (yargs25) => withConfiguration(
|
|
6475
6141
|
withApiOptions(
|
|
6476
6142
|
withProjectOptions(
|
|
6477
6143
|
withDiffOptions(
|
|
6478
|
-
|
|
6144
|
+
yargs25.positional("directory", {
|
|
6479
6145
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6480
6146
|
type: "string"
|
|
6481
6147
|
}).option("what-if", {
|
|
@@ -6539,9 +6205,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
6539
6205
|
command: "remove <id>",
|
|
6540
6206
|
aliases: ["delete", "rm"],
|
|
6541
6207
|
describe: "Delete a project map",
|
|
6542
|
-
builder: (
|
|
6208
|
+
builder: (yargs25) => withConfiguration(
|
|
6543
6209
|
withApiOptions(
|
|
6544
|
-
withProjectOptions(
|
|
6210
|
+
withProjectOptions(yargs25.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6545
6211
|
)
|
|
6546
6212
|
),
|
|
6547
6213
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6557,10 +6223,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6557
6223
|
command: "update <filename>",
|
|
6558
6224
|
aliases: ["put"],
|
|
6559
6225
|
describe: "Insert or update a project map",
|
|
6560
|
-
builder: (
|
|
6226
|
+
builder: (yargs25) => withConfiguration(
|
|
6561
6227
|
withApiOptions(
|
|
6562
6228
|
withProjectOptions(
|
|
6563
|
-
|
|
6229
|
+
yargs25.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6564
6230
|
)
|
|
6565
6231
|
)
|
|
6566
6232
|
),
|
|
@@ -6576,25 +6242,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6576
6242
|
var ProjectMapDefinitionModule = {
|
|
6577
6243
|
command: "definition <command>",
|
|
6578
6244
|
describe: "Commands for ProjectMap Definitions",
|
|
6579
|
-
builder: (
|
|
6245
|
+
builder: (yargs25) => yargs25.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
6580
6246
|
handler: () => {
|
|
6581
|
-
|
|
6247
|
+
yargs18.help();
|
|
6582
6248
|
}
|
|
6583
6249
|
};
|
|
6584
6250
|
|
|
6585
6251
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
6586
|
-
import
|
|
6252
|
+
import yargs19 from "yargs";
|
|
6587
6253
|
|
|
6588
6254
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
6589
6255
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
6590
6256
|
var ProjectMapNodeGetModule = {
|
|
6591
6257
|
command: "get <id> <projectMapId>",
|
|
6592
6258
|
describe: "Fetch a project map node",
|
|
6593
|
-
builder: (
|
|
6259
|
+
builder: (yargs25) => withConfiguration(
|
|
6594
6260
|
withFormatOptions(
|
|
6595
6261
|
withApiOptions(
|
|
6596
6262
|
withProjectOptions(
|
|
6597
|
-
|
|
6263
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6598
6264
|
)
|
|
6599
6265
|
)
|
|
6600
6266
|
)
|
|
@@ -6620,11 +6286,11 @@ var ProjectMapNodeListModule = {
|
|
|
6620
6286
|
command: "list <projectMapId>",
|
|
6621
6287
|
describe: "List project map nodes",
|
|
6622
6288
|
aliases: ["ls"],
|
|
6623
|
-
builder: (
|
|
6289
|
+
builder: (yargs25) => withConfiguration(
|
|
6624
6290
|
withFormatOptions(
|
|
6625
6291
|
withApiOptions(
|
|
6626
6292
|
withProjectOptions(
|
|
6627
|
-
|
|
6293
|
+
yargs25.positional("projectMapId", {
|
|
6628
6294
|
demandOption: true,
|
|
6629
6295
|
describe: "ProjectMap UUID to fetch from"
|
|
6630
6296
|
})
|
|
@@ -6695,11 +6361,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
6695
6361
|
var ProjectMapNodePullModule = {
|
|
6696
6362
|
command: "pull <directory>",
|
|
6697
6363
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
6698
|
-
builder: (
|
|
6364
|
+
builder: (yargs25) => withConfiguration(
|
|
6699
6365
|
withApiOptions(
|
|
6700
6366
|
withProjectOptions(
|
|
6701
6367
|
withDiffOptions(
|
|
6702
|
-
|
|
6368
|
+
yargs25.positional("directory", {
|
|
6703
6369
|
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.",
|
|
6704
6370
|
type: "string"
|
|
6705
6371
|
}).option("format", {
|
|
@@ -6778,11 +6444,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
6778
6444
|
var ProjectMapNodePushModule = {
|
|
6779
6445
|
command: "push <directory>",
|
|
6780
6446
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
6781
|
-
builder: (
|
|
6447
|
+
builder: (yargs25) => withConfiguration(
|
|
6782
6448
|
withApiOptions(
|
|
6783
6449
|
withProjectOptions(
|
|
6784
6450
|
withDiffOptions(
|
|
6785
|
-
|
|
6451
|
+
yargs25.positional("directory", {
|
|
6786
6452
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6787
6453
|
type: "string"
|
|
6788
6454
|
}).option("what-if", {
|
|
@@ -6855,10 +6521,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
6855
6521
|
command: "remove <id> <projectMapId>",
|
|
6856
6522
|
aliases: ["delete", "rm"],
|
|
6857
6523
|
describe: "Delete a project map node",
|
|
6858
|
-
builder: (
|
|
6524
|
+
builder: (yargs25) => withConfiguration(
|
|
6859
6525
|
withApiOptions(
|
|
6860
6526
|
withProjectOptions(
|
|
6861
|
-
|
|
6527
|
+
yargs25.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
6862
6528
|
)
|
|
6863
6529
|
)
|
|
6864
6530
|
),
|
|
@@ -6875,10 +6541,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
6875
6541
|
command: "update <filename> <projectMapId>",
|
|
6876
6542
|
aliases: ["put"],
|
|
6877
6543
|
describe: "Insert or update a project map node",
|
|
6878
|
-
builder: (
|
|
6544
|
+
builder: (yargs25) => withConfiguration(
|
|
6879
6545
|
withApiOptions(
|
|
6880
6546
|
withProjectOptions(
|
|
6881
|
-
|
|
6547
|
+
yargs25.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
6882
6548
|
)
|
|
6883
6549
|
)
|
|
6884
6550
|
),
|
|
@@ -6894,9 +6560,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
6894
6560
|
var ProjectMapNodeModule = {
|
|
6895
6561
|
command: "node <command>",
|
|
6896
6562
|
describe: "Commands for ProjectMap Nodes",
|
|
6897
|
-
builder: (
|
|
6563
|
+
builder: (yargs25) => yargs25.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
6898
6564
|
handler: () => {
|
|
6899
|
-
|
|
6565
|
+
yargs19.help();
|
|
6900
6566
|
}
|
|
6901
6567
|
};
|
|
6902
6568
|
|
|
@@ -6905,28 +6571,28 @@ var ProjectMapCommand = {
|
|
|
6905
6571
|
command: "project-map <command>",
|
|
6906
6572
|
aliases: ["prm"],
|
|
6907
6573
|
describe: "Uniform ProjectMap commands",
|
|
6908
|
-
builder: (
|
|
6574
|
+
builder: (yargs25) => yargs25.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
6909
6575
|
handler: () => {
|
|
6910
|
-
|
|
6576
|
+
yargs20.showHelp();
|
|
6911
6577
|
}
|
|
6912
6578
|
};
|
|
6913
6579
|
|
|
6914
6580
|
// src/commands/redirect/index.ts
|
|
6915
|
-
import
|
|
6581
|
+
import yargs22 from "yargs";
|
|
6916
6582
|
|
|
6917
6583
|
// src/commands/redirect/commands/redirect.ts
|
|
6918
|
-
import
|
|
6584
|
+
import yargs21 from "yargs";
|
|
6919
6585
|
|
|
6920
6586
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
6921
6587
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
6922
6588
|
var RedirectDefinitionGetModule = {
|
|
6923
6589
|
command: "get <id>",
|
|
6924
6590
|
describe: "Fetch a redirect",
|
|
6925
|
-
builder: (
|
|
6591
|
+
builder: (yargs25) => withConfiguration(
|
|
6926
6592
|
withFormatOptions(
|
|
6927
6593
|
withApiOptions(
|
|
6928
6594
|
withProjectOptions(
|
|
6929
|
-
|
|
6595
|
+
yargs25.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
6930
6596
|
)
|
|
6931
6597
|
)
|
|
6932
6598
|
)
|
|
@@ -6950,7 +6616,7 @@ var RedirectDefinitionListModule = {
|
|
|
6950
6616
|
command: "list",
|
|
6951
6617
|
describe: "List of redirects",
|
|
6952
6618
|
aliases: ["ls"],
|
|
6953
|
-
builder: (
|
|
6619
|
+
builder: (yargs25) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs25)))),
|
|
6954
6620
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6955
6621
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6956
6622
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -7016,11 +6682,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
7016
6682
|
var RedirectDefinitionPullModule = {
|
|
7017
6683
|
command: "pull <directory>",
|
|
7018
6684
|
describe: "Pulls all redirects to local files in a directory",
|
|
7019
|
-
builder: (
|
|
6685
|
+
builder: (yargs25) => withConfiguration(
|
|
7020
6686
|
withApiOptions(
|
|
7021
6687
|
withProjectOptions(
|
|
7022
6688
|
withDiffOptions(
|
|
7023
|
-
|
|
6689
|
+
yargs25.positional("directory", {
|
|
7024
6690
|
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.",
|
|
7025
6691
|
type: "string"
|
|
7026
6692
|
}).option("format", {
|
|
@@ -7096,11 +6762,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
7096
6762
|
var RedirectDefinitionPushModule = {
|
|
7097
6763
|
command: "push <directory>",
|
|
7098
6764
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
7099
|
-
builder: (
|
|
6765
|
+
builder: (yargs25) => withConfiguration(
|
|
7100
6766
|
withApiOptions(
|
|
7101
6767
|
withProjectOptions(
|
|
7102
6768
|
withDiffOptions(
|
|
7103
|
-
|
|
6769
|
+
yargs25.positional("directory", {
|
|
7104
6770
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
7105
6771
|
type: "string"
|
|
7106
6772
|
}).option("what-if", {
|
|
@@ -7164,9 +6830,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
7164
6830
|
command: "remove <id>",
|
|
7165
6831
|
aliases: ["delete", "rm"],
|
|
7166
6832
|
describe: "Delete a redirect",
|
|
7167
|
-
builder: (
|
|
6833
|
+
builder: (yargs25) => withConfiguration(
|
|
7168
6834
|
withApiOptions(
|
|
7169
|
-
withProjectOptions(
|
|
6835
|
+
withProjectOptions(yargs25.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
7170
6836
|
)
|
|
7171
6837
|
),
|
|
7172
6838
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -7182,10 +6848,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7182
6848
|
command: "update <filename>",
|
|
7183
6849
|
aliases: ["put"],
|
|
7184
6850
|
describe: "Insert or update a redirect",
|
|
7185
|
-
builder: (
|
|
6851
|
+
builder: (yargs25) => withConfiguration(
|
|
7186
6852
|
withApiOptions(
|
|
7187
6853
|
withProjectOptions(
|
|
7188
|
-
|
|
6854
|
+
yargs25.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
7189
6855
|
)
|
|
7190
6856
|
)
|
|
7191
6857
|
),
|
|
@@ -7201,9 +6867,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7201
6867
|
var RedirectDefinitionModule = {
|
|
7202
6868
|
command: "definition <command>",
|
|
7203
6869
|
describe: "Commands for Redirect Definitions",
|
|
7204
|
-
builder: (
|
|
6870
|
+
builder: (yargs25) => yargs25.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
7205
6871
|
handler: () => {
|
|
7206
|
-
|
|
6872
|
+
yargs21.help();
|
|
7207
6873
|
}
|
|
7208
6874
|
};
|
|
7209
6875
|
|
|
@@ -7212,14 +6878,14 @@ var RedirectCommand = {
|
|
|
7212
6878
|
command: "redirect <command>",
|
|
7213
6879
|
aliases: ["red"],
|
|
7214
6880
|
describe: "Uniform Redirect commands",
|
|
7215
|
-
builder: (
|
|
6881
|
+
builder: (yargs25) => yargs25.command(RedirectDefinitionModule).demandCommand(),
|
|
7216
6882
|
handler: () => {
|
|
7217
|
-
|
|
6883
|
+
yargs22.showHelp();
|
|
7218
6884
|
}
|
|
7219
6885
|
};
|
|
7220
6886
|
|
|
7221
6887
|
// src/commands/sync/index.ts
|
|
7222
|
-
import
|
|
6888
|
+
import yargs23 from "yargs";
|
|
7223
6889
|
|
|
7224
6890
|
// src/commands/sync/commands/util.ts
|
|
7225
6891
|
import ora2 from "ora";
|
|
@@ -7250,11 +6916,11 @@ function spin(entityType) {
|
|
|
7250
6916
|
var SyncPullModule = {
|
|
7251
6917
|
command: "pull",
|
|
7252
6918
|
describe: "Pulls whole project to local files in a directory",
|
|
7253
|
-
builder: (
|
|
6919
|
+
builder: (yargs25) => withConfiguration(
|
|
7254
6920
|
withApiOptions(
|
|
7255
6921
|
withProjectOptions(
|
|
7256
6922
|
withDiffOptions(
|
|
7257
|
-
|
|
6923
|
+
yargs25.option("what-if", {
|
|
7258
6924
|
alias: ["w"],
|
|
7259
6925
|
describe: "What-if mode reports what would be done but changes no files",
|
|
7260
6926
|
default: false,
|
|
@@ -7339,11 +7005,11 @@ var getFormat = (entityType, config2) => {
|
|
|
7339
7005
|
var SyncPushModule = {
|
|
7340
7006
|
command: "push",
|
|
7341
7007
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
7342
|
-
builder: (
|
|
7008
|
+
builder: (yargs25) => withConfiguration(
|
|
7343
7009
|
withApiOptions(
|
|
7344
7010
|
withProjectOptions(
|
|
7345
7011
|
withDiffOptions(
|
|
7346
|
-
|
|
7012
|
+
yargs25.option("what-if", {
|
|
7347
7013
|
alias: ["w"],
|
|
7348
7014
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
7349
7015
|
default: false,
|
|
@@ -7435,9 +7101,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
7435
7101
|
var SyncCommand = {
|
|
7436
7102
|
command: "sync <command>",
|
|
7437
7103
|
describe: "Uniform Sync commands",
|
|
7438
|
-
builder: (
|
|
7104
|
+
builder: (yargs25) => yargs25.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
7439
7105
|
handler: () => {
|
|
7440
|
-
|
|
7106
|
+
yargs23.showHelp();
|
|
7441
7107
|
}
|
|
7442
7108
|
};
|
|
7443
7109
|
|
|
@@ -7553,7 +7219,7 @@ First found was: v${firstVersion}`;
|
|
|
7553
7219
|
|
|
7554
7220
|
// src/index.ts
|
|
7555
7221
|
dotenv.config();
|
|
7556
|
-
var yarggery =
|
|
7222
|
+
var yarggery = yargs24(hideBin(process.argv));
|
|
7557
7223
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
7558
7224
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
7559
7225
|
yarggery.option("verbose", {
|