@uniformdev/cli 19.66.1 → 19.69.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.d.mts +1 -1
- package/dist/index.mjs +1067 -691
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -16,24 +16,25 @@ var __dirname = /* @__PURE__ */ getDirname();
|
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
import * as dotenv from "dotenv";
|
|
19
|
-
import
|
|
19
|
+
import yargs26 from "yargs";
|
|
20
20
|
import { hideBin } from "yargs/helpers";
|
|
21
21
|
|
|
22
22
|
// src/commands/canvas/index.ts
|
|
23
|
-
import
|
|
23
|
+
import yargs10 from "yargs";
|
|
24
24
|
|
|
25
|
-
// src/commands/canvas/commands/
|
|
25
|
+
// src/commands/canvas/commands/asset.ts
|
|
26
26
|
import yargs from "yargs";
|
|
27
27
|
|
|
28
|
-
// src/commands/canvas/commands/
|
|
29
|
-
import {
|
|
28
|
+
// src/commands/canvas/commands/asset/get.ts
|
|
29
|
+
import { UncachedAssetClient } from "@uniformdev/assets";
|
|
30
30
|
|
|
31
31
|
// src/sync/arraySyncEngineDataSource.ts
|
|
32
32
|
async function createArraySyncEngineDataSource({
|
|
33
33
|
objects,
|
|
34
34
|
selectIdentifier: selectIdentifier13,
|
|
35
35
|
selectDisplayName: selectDisplayName13 = selectIdentifier13,
|
|
36
|
-
onSyncComplete
|
|
36
|
+
onSyncComplete,
|
|
37
|
+
onBeforeDeleteObject
|
|
37
38
|
}) {
|
|
38
39
|
const objectIndex = objects.reduce(
|
|
39
40
|
(result, current) => {
|
|
@@ -66,7 +67,10 @@ async function createArraySyncEngineDataSource({
|
|
|
66
67
|
}
|
|
67
68
|
return {
|
|
68
69
|
objects: getObjects(),
|
|
69
|
-
deleteObject: async (providerId) => {
|
|
70
|
+
deleteObject: async (providerId, object) => {
|
|
71
|
+
if (onBeforeDeleteObject) {
|
|
72
|
+
await onBeforeDeleteObject(providerId, object);
|
|
73
|
+
}
|
|
70
74
|
delete objectIndex[providerId];
|
|
71
75
|
},
|
|
72
76
|
writeObject: async (objectToWrite) => {
|
|
@@ -133,14 +137,14 @@ import httpsProxyAgent from "https-proxy-agent";
|
|
|
133
137
|
import unfetch from "isomorphic-unfetch";
|
|
134
138
|
import { dump, load } from "js-yaml";
|
|
135
139
|
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
136
|
-
function withConfiguration(
|
|
137
|
-
return
|
|
140
|
+
function withConfiguration(yargs27) {
|
|
141
|
+
return yargs27.option("serialization", {
|
|
138
142
|
skipValidation: true,
|
|
139
143
|
hidden: true
|
|
140
144
|
});
|
|
141
145
|
}
|
|
142
|
-
function withApiOptions(
|
|
143
|
-
return
|
|
146
|
+
function withApiOptions(yargs27) {
|
|
147
|
+
return yargs27.option("apiKey", {
|
|
144
148
|
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
145
149
|
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
146
150
|
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
@@ -179,8 +183,8 @@ function nodeFetchProxy(proxy) {
|
|
|
179
183
|
};
|
|
180
184
|
return wrappedFetch;
|
|
181
185
|
}
|
|
182
|
-
function withProjectOptions(
|
|
183
|
-
return
|
|
186
|
+
function withProjectOptions(yargs27) {
|
|
187
|
+
return yargs27.option("project", {
|
|
184
188
|
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
185
189
|
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
186
190
|
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
@@ -190,8 +194,8 @@ function withProjectOptions(yargs26) {
|
|
|
190
194
|
alias: ["p"]
|
|
191
195
|
});
|
|
192
196
|
}
|
|
193
|
-
function withFormatOptions(
|
|
194
|
-
return
|
|
197
|
+
function withFormatOptions(yargs27) {
|
|
198
|
+
return yargs27.option("format", {
|
|
195
199
|
alias: ["f"],
|
|
196
200
|
describe: "Output format",
|
|
197
201
|
default: "yaml",
|
|
@@ -203,8 +207,8 @@ function withFormatOptions(yargs26) {
|
|
|
203
207
|
type: "string"
|
|
204
208
|
});
|
|
205
209
|
}
|
|
206
|
-
function withDiffOptions(
|
|
207
|
-
return
|
|
210
|
+
function withDiffOptions(yargs27) {
|
|
211
|
+
return yargs27.option("diff", {
|
|
208
212
|
describe: "Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",
|
|
209
213
|
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
210
214
|
type: "string",
|
|
@@ -362,7 +366,8 @@ async function createFileSyncEngineDataSource({
|
|
|
362
366
|
selectIdentifier: selectIdentifier13,
|
|
363
367
|
selectDisplayName: selectDisplayName13 = selectIdentifier13,
|
|
364
368
|
selectFilename: selectFilename3,
|
|
365
|
-
selectSchemaUrl: selectSchemaUrl2
|
|
369
|
+
selectSchemaUrl: selectSchemaUrl2,
|
|
370
|
+
onBeforeDeleteObject
|
|
366
371
|
}) {
|
|
367
372
|
const dirExists = existsSync(directory);
|
|
368
373
|
if (!dirExists) {
|
|
@@ -398,7 +403,10 @@ ${e == null ? void 0 : e.message}`));
|
|
|
398
403
|
}
|
|
399
404
|
return {
|
|
400
405
|
objects: getObjects(),
|
|
401
|
-
deleteObject: async (providerId) => {
|
|
406
|
+
deleteObject: async (providerId, object) => {
|
|
407
|
+
if (onBeforeDeleteObject) {
|
|
408
|
+
await onBeforeDeleteObject(providerId, object);
|
|
409
|
+
}
|
|
402
410
|
await unlink(providerId);
|
|
403
411
|
},
|
|
404
412
|
writeObject: async (object) => {
|
|
@@ -620,225 +628,800 @@ function createPublishStatusSyncEngineConsoleLogger(options) {
|
|
|
620
628
|
};
|
|
621
629
|
}
|
|
622
630
|
|
|
623
|
-
// src/commands/canvas/commands/
|
|
624
|
-
var
|
|
631
|
+
// src/commands/canvas/commands/asset/get.ts
|
|
632
|
+
var AssetGetModule = {
|
|
625
633
|
command: "get <id>",
|
|
626
|
-
describe: "
|
|
627
|
-
builder: (
|
|
634
|
+
describe: "Get an asset",
|
|
635
|
+
builder: (yargs27) => withConfiguration(
|
|
628
636
|
withFormatOptions(
|
|
629
637
|
withApiOptions(
|
|
630
638
|
withProjectOptions(
|
|
631
|
-
|
|
639
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
640
|
+
yargs27.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
632
641
|
)
|
|
633
642
|
)
|
|
634
643
|
)
|
|
635
644
|
),
|
|
636
|
-
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId
|
|
645
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
637
646
|
const fetch3 = nodeFetchProxy(proxy);
|
|
638
|
-
const client = new
|
|
639
|
-
const res = await client.
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
console.error("Category did not exist");
|
|
643
|
-
process.exit(1);
|
|
644
|
-
} else {
|
|
645
|
-
emitWithFormat(category, format, filename);
|
|
647
|
+
const client = new UncachedAssetClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
648
|
+
const res = await client.get({ offset: 0, limit: 1, assetId: id });
|
|
649
|
+
if (!res) {
|
|
650
|
+
throw new Error(`Asset with ID ${id} not found`);
|
|
646
651
|
}
|
|
652
|
+
emitWithFormat(res, format, filename);
|
|
647
653
|
}
|
|
648
654
|
};
|
|
649
655
|
|
|
650
|
-
// src/commands/canvas/commands/
|
|
651
|
-
import {
|
|
652
|
-
var
|
|
656
|
+
// src/commands/canvas/commands/asset/list.ts
|
|
657
|
+
import { UncachedAssetClient as UncachedAssetClient2 } from "@uniformdev/assets";
|
|
658
|
+
var AssetListModule = {
|
|
653
659
|
command: "list",
|
|
654
|
-
describe: "List
|
|
655
|
-
|
|
656
|
-
builder: (yargs26) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs26.options({}))))),
|
|
660
|
+
describe: "List assets",
|
|
661
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
657
662
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
658
663
|
const fetch3 = nodeFetchProxy(proxy);
|
|
659
|
-
const client = new
|
|
660
|
-
const res = await client.
|
|
661
|
-
emitWithFormat(res.
|
|
664
|
+
const client = new UncachedAssetClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
665
|
+
const res = await client.get({ offset: 0, limit: 1e3 });
|
|
666
|
+
emitWithFormat(res.assets, format, filename);
|
|
662
667
|
}
|
|
663
668
|
};
|
|
664
669
|
|
|
665
|
-
// src/commands/canvas/commands/
|
|
666
|
-
import {
|
|
667
|
-
|
|
668
|
-
// src/commands/canvas/commands/category/_util.ts
|
|
669
|
-
var selectIdentifier = (category) => category.id;
|
|
670
|
-
var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
|
|
670
|
+
// src/commands/canvas/commands/asset/pull.ts
|
|
671
|
+
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
671
672
|
|
|
672
|
-
// src/
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
673
|
+
// src/files/index.ts
|
|
674
|
+
import { preferredType } from "@thi.ng/mime";
|
|
675
|
+
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
676
|
+
import { createHash } from "crypto";
|
|
677
|
+
import fsj from "fs-jetpack";
|
|
678
|
+
import sizeOf from "image-size";
|
|
679
|
+
import PQueue from "p-queue";
|
|
680
|
+
import { join as join2 } from "path";
|
|
681
|
+
var FILES_DIRECTORY_NAME = "files";
|
|
682
|
+
var urlToHash = (url) => {
|
|
683
|
+
const hash = createHash("sha256");
|
|
684
|
+
hash.update(url);
|
|
685
|
+
return hash.digest("hex");
|
|
686
|
+
};
|
|
687
|
+
var urlToFileName = (url) => {
|
|
688
|
+
const fileName = urlToHash(url);
|
|
689
|
+
const fileNameChunks = url.split(".");
|
|
690
|
+
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
691
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
692
|
+
};
|
|
693
|
+
var deleteDownloadedFileByUrl = async (url, options) => {
|
|
694
|
+
const fileName = urlToFileName(url);
|
|
695
|
+
const fileToDelete = join2(options.directory, FILES_DIRECTORY_NAME, fileName);
|
|
696
|
+
try {
|
|
697
|
+
await fsj.removeAsync(fileToDelete);
|
|
698
|
+
} catch {
|
|
699
|
+
console.warn(`Failed to delete a local file ${fileToDelete}`);
|
|
689
700
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
alias: ["f"],
|
|
722
|
-
describe: "Output format",
|
|
723
|
-
default: "yaml",
|
|
724
|
-
choices: ["yaml", "json"],
|
|
725
|
-
type: "string"
|
|
726
|
-
}).option("what-if", {
|
|
727
|
-
alias: ["w"],
|
|
728
|
-
describe: "What-if mode reports what would be done but changes no files",
|
|
729
|
-
default: false,
|
|
730
|
-
type: "boolean"
|
|
731
|
-
}).option("mode", {
|
|
732
|
-
alias: ["m"],
|
|
733
|
-
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',
|
|
734
|
-
choices: ["create", "createOrUpdate", "mirror"],
|
|
735
|
-
default: "mirror",
|
|
736
|
-
type: "string"
|
|
737
|
-
})
|
|
738
|
-
)
|
|
739
|
-
)
|
|
740
|
-
)
|
|
741
|
-
),
|
|
742
|
-
handler: async ({
|
|
743
|
-
apiHost,
|
|
744
|
-
apiKey,
|
|
745
|
-
proxy,
|
|
746
|
-
directory,
|
|
747
|
-
format,
|
|
748
|
-
mode,
|
|
749
|
-
whatIf,
|
|
750
|
-
project: projectId,
|
|
751
|
-
diff: diffMode
|
|
752
|
-
}) => {
|
|
753
|
-
const fetch3 = nodeFetchProxy(proxy);
|
|
754
|
-
const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
755
|
-
const source = createCategoriesEngineDataSource({ client });
|
|
756
|
-
let target;
|
|
757
|
-
const isPackage = isPathAPackageFile(directory);
|
|
758
|
-
if (isPackage) {
|
|
759
|
-
const packageContents = readCanvasPackage(directory, false);
|
|
760
|
-
target = await createArraySyncEngineDataSource({
|
|
761
|
-
objects: packageContents.categories ?? [],
|
|
762
|
-
selectIdentifier,
|
|
763
|
-
selectDisplayName,
|
|
764
|
-
onSyncComplete: async (_, synced) => {
|
|
765
|
-
packageContents.categories = synced;
|
|
766
|
-
writeCanvasPackage(directory, packageContents);
|
|
701
|
+
};
|
|
702
|
+
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
703
|
+
const objectAsString = JSON.stringify(object);
|
|
704
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
705
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
706
|
+
);
|
|
707
|
+
if (uniformFileUrlMatches) {
|
|
708
|
+
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
709
|
+
for (const match of uniformFileUrlMatches) {
|
|
710
|
+
const url = new URL(match[1]);
|
|
711
|
+
fileDownloadQueue.add(async () => {
|
|
712
|
+
try {
|
|
713
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
714
|
+
const fileName = urlToFileName(url.toString());
|
|
715
|
+
const fileAlreadyExists = await fsj.existsAsync(
|
|
716
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
717
|
+
);
|
|
718
|
+
if (fileAlreadyExists) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
const response = await fetch(fetchUrl);
|
|
722
|
+
if (!response.ok) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
const fileBuffer = await response.arrayBuffer();
|
|
726
|
+
await fsj.writeAsync(
|
|
727
|
+
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
728
|
+
Buffer.from(fileBuffer)
|
|
729
|
+
);
|
|
730
|
+
} catch {
|
|
731
|
+
console.warn(`Failed to download file ${url}`);
|
|
767
732
|
}
|
|
768
733
|
});
|
|
769
|
-
} else {
|
|
770
|
-
target = await createFileSyncEngineDataSource({
|
|
771
|
-
directory,
|
|
772
|
-
selectIdentifier,
|
|
773
|
-
selectDisplayName,
|
|
774
|
-
format
|
|
775
|
-
});
|
|
776
734
|
}
|
|
777
|
-
await
|
|
778
|
-
source,
|
|
779
|
-
target,
|
|
780
|
-
mode,
|
|
781
|
-
whatIf,
|
|
782
|
-
allowEmptySource: true,
|
|
783
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
784
|
-
});
|
|
735
|
+
await fileDownloadQueue.onIdle();
|
|
785
736
|
}
|
|
737
|
+
return object;
|
|
786
738
|
};
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
739
|
+
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
740
|
+
let objectAsString = JSON.stringify(object);
|
|
741
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
742
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
743
|
+
);
|
|
744
|
+
if (uniformFileUrlMatches) {
|
|
745
|
+
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
746
|
+
for (const match of uniformFileUrlMatches) {
|
|
747
|
+
const url = match[1];
|
|
748
|
+
const hash = urlToHash(url);
|
|
749
|
+
fileUploadQueue.add(async () => {
|
|
750
|
+
try {
|
|
751
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
752
|
+
options.fileClient.get({ url }).catch(() => null),
|
|
753
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
754
|
+
]);
|
|
755
|
+
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
const localFileName = urlToFileName(url);
|
|
759
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
760
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
761
|
+
);
|
|
762
|
+
if (!fileExistsLocally) {
|
|
763
|
+
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
const fileBuffer = await fsj.readAsync(
|
|
767
|
+
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
768
|
+
"buffer"
|
|
769
|
+
);
|
|
770
|
+
if (!fileBuffer) {
|
|
771
|
+
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
const fileName = getFileNameFromUrl(url);
|
|
775
|
+
const { width, height } = (() => {
|
|
776
|
+
try {
|
|
777
|
+
return sizeOf(fileBuffer);
|
|
778
|
+
} catch {
|
|
779
|
+
return {
|
|
780
|
+
width: void 0,
|
|
781
|
+
height: void 0
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
})();
|
|
785
|
+
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
786
|
+
name: fileName,
|
|
787
|
+
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
788
|
+
size: fileBuffer.length,
|
|
789
|
+
width,
|
|
790
|
+
height,
|
|
791
|
+
sourceId: hash
|
|
792
|
+
});
|
|
793
|
+
const uploadResponse = await fetch(uploadUrl, {
|
|
794
|
+
method,
|
|
795
|
+
body: fileBuffer
|
|
796
|
+
});
|
|
797
|
+
if (!uploadResponse.ok) {
|
|
798
|
+
console.warn(`Failed to upload file ${url}`);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
const checkForFile = async () => {
|
|
802
|
+
const file = await options.fileClient.get({ id });
|
|
803
|
+
if (!file || file.state !== FILE_READY_STATE || !file.url) {
|
|
804
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
805
|
+
return checkForFile();
|
|
806
|
+
}
|
|
807
|
+
return file.url;
|
|
808
|
+
};
|
|
809
|
+
const abortTimeout = setTimeout(() => {
|
|
810
|
+
throw new Error(`Failed to upload file ${url}`);
|
|
811
|
+
}, 1e4);
|
|
812
|
+
const uploadedFileUrl = await checkForFile();
|
|
813
|
+
clearTimeout(abortTimeout);
|
|
814
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
815
|
+
} catch {
|
|
816
|
+
console.warn(`Failed to upload file ${url}`);
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
await fileUploadQueue.onIdle();
|
|
821
|
+
}
|
|
822
|
+
return JSON.parse(objectAsString);
|
|
823
|
+
};
|
|
824
|
+
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
825
|
+
let objectAsString = JSON.stringify(object);
|
|
826
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
827
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
828
|
+
);
|
|
829
|
+
if (uniformFileUrlMatches) {
|
|
830
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
831
|
+
for (const match of uniformFileUrlMatches) {
|
|
832
|
+
const url = match[1];
|
|
833
|
+
const hash = urlToHash(url);
|
|
834
|
+
fileUrlReplacementQueue.add(async () => {
|
|
835
|
+
try {
|
|
836
|
+
const fileAlreadyExistsChecks = await Promise.all([
|
|
837
|
+
options.fileClient.get({ url }).catch(() => null),
|
|
838
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
839
|
+
]);
|
|
840
|
+
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
841
|
+
if (!file) {
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
845
|
+
} catch {
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
await fileUrlReplacementQueue.onIdle();
|
|
850
|
+
}
|
|
851
|
+
return JSON.parse(objectAsString);
|
|
852
|
+
};
|
|
853
|
+
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
854
|
+
var _a;
|
|
855
|
+
const fileUrl = (_a = asset.asset.url) == null ? void 0 : _a.value;
|
|
856
|
+
if (!fileUrl || !asset.asset.file) {
|
|
857
|
+
return asset;
|
|
858
|
+
}
|
|
859
|
+
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
860
|
+
if (!file) {
|
|
861
|
+
return asset;
|
|
862
|
+
}
|
|
863
|
+
asset.asset.file.value = file.id;
|
|
864
|
+
return asset;
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
// src/commands/canvas/assetEngineDataSource.ts
|
|
868
|
+
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
869
|
+
|
|
870
|
+
// src/commands/canvas/commands/asset/_util.ts
|
|
871
|
+
var selectAssetIdentifier = (e) => e.asset._id;
|
|
872
|
+
var selectAssetDisplayName = (e) => {
|
|
873
|
+
var _a;
|
|
874
|
+
return `${((_a = e.asset.title) == null ? void 0 : _a.value) ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// src/commands/canvas/util.ts
|
|
878
|
+
import {
|
|
879
|
+
CANVAS_DRAFT_STATE,
|
|
880
|
+
CANVAS_PUBLISHED_STATE
|
|
881
|
+
} from "@uniformdev/canvas";
|
|
882
|
+
function prepCompositionForDisk(composition) {
|
|
883
|
+
const prepped = {
|
|
884
|
+
...composition
|
|
885
|
+
};
|
|
886
|
+
delete prepped.projectId;
|
|
887
|
+
delete prepped.state;
|
|
888
|
+
return prepped;
|
|
889
|
+
}
|
|
890
|
+
function withStateOptions(yargs27) {
|
|
891
|
+
return yargs27.option("state", {
|
|
892
|
+
type: "string",
|
|
893
|
+
describe: `Composition state to fetch.`,
|
|
894
|
+
choices: ["preview", "published"],
|
|
895
|
+
default: "preview"
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
function convertCompositionState(state) {
|
|
899
|
+
const number = Number(state);
|
|
900
|
+
if (!isNaN(number)) {
|
|
901
|
+
return number;
|
|
902
|
+
}
|
|
903
|
+
if (!state) {
|
|
904
|
+
return CANVAS_PUBLISHED_STATE;
|
|
905
|
+
}
|
|
906
|
+
if (typeof state !== "string") {
|
|
907
|
+
throw new Error('state must be "published", "preview", or a number');
|
|
908
|
+
}
|
|
909
|
+
return state === "preview" ? CANVAS_DRAFT_STATE : CANVAS_PUBLISHED_STATE;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// src/commands/canvas/assetEngineDataSource.ts
|
|
913
|
+
function createAssetEngineDataSource({
|
|
914
|
+
client
|
|
915
|
+
}) {
|
|
916
|
+
async function* getObjects() {
|
|
917
|
+
const assets = paginateAsync(
|
|
918
|
+
async (offset, limit) => (await client.get({
|
|
919
|
+
limit,
|
|
920
|
+
offset
|
|
921
|
+
})).assets,
|
|
922
|
+
{ pageSize: 100 }
|
|
923
|
+
);
|
|
924
|
+
for await (const e of assets) {
|
|
925
|
+
const result = {
|
|
926
|
+
id: selectAssetIdentifier(e),
|
|
927
|
+
displayName: selectAssetDisplayName(e),
|
|
928
|
+
providerId: e.asset._id,
|
|
929
|
+
object: prepCompositionForDisk(e)
|
|
930
|
+
};
|
|
931
|
+
yield result;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return {
|
|
935
|
+
objects: getObjects(),
|
|
936
|
+
deleteObject: async (providerId) => {
|
|
937
|
+
await client.delete({ assetId: providerId });
|
|
938
|
+
},
|
|
939
|
+
writeObject: async ({ object }) => {
|
|
940
|
+
await client.upsert(convertAssetToPutAsset(object));
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// src/commands/canvas/package.ts
|
|
946
|
+
function readCanvasPackage(filename, assertExists) {
|
|
947
|
+
return readUniformPackage(filename, assertExists);
|
|
948
|
+
}
|
|
949
|
+
function writeCanvasPackage(filename, packageContents) {
|
|
950
|
+
writeUniformPackage(filename, packageContents);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// src/commands/canvas/commands/asset/pull.ts
|
|
954
|
+
var AssetPullModule = {
|
|
955
|
+
command: "pull <directory>",
|
|
956
|
+
describe: "Pulls all assets to local files in a directory",
|
|
957
|
+
builder: (yargs27) => withConfiguration(
|
|
958
|
+
withApiOptions(
|
|
959
|
+
withProjectOptions(
|
|
960
|
+
withDiffOptions(
|
|
961
|
+
yargs27.positional("directory", {
|
|
962
|
+
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.",
|
|
963
|
+
type: "string"
|
|
964
|
+
}).option("format", {
|
|
965
|
+
alias: ["f"],
|
|
966
|
+
describe: "Output format",
|
|
967
|
+
default: "yaml",
|
|
968
|
+
choices: ["yaml", "json"],
|
|
969
|
+
type: "string"
|
|
970
|
+
}).option("what-if", {
|
|
971
|
+
alias: ["w"],
|
|
972
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
973
|
+
default: false,
|
|
974
|
+
type: "boolean"
|
|
975
|
+
}).option("mode", {
|
|
976
|
+
alias: ["m"],
|
|
977
|
+
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',
|
|
978
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
979
|
+
default: "mirror",
|
|
980
|
+
type: "string"
|
|
981
|
+
})
|
|
982
|
+
)
|
|
983
|
+
)
|
|
984
|
+
)
|
|
985
|
+
),
|
|
986
|
+
handler: async ({
|
|
987
|
+
apiHost,
|
|
988
|
+
apiKey,
|
|
989
|
+
proxy,
|
|
990
|
+
directory,
|
|
991
|
+
format,
|
|
992
|
+
mode,
|
|
993
|
+
whatIf,
|
|
994
|
+
project: projectId,
|
|
995
|
+
diff: diffMode
|
|
996
|
+
}) => {
|
|
997
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
998
|
+
const client = new UncachedAssetClient3({
|
|
999
|
+
apiKey,
|
|
1000
|
+
apiHost,
|
|
1001
|
+
fetch: fetch3,
|
|
1002
|
+
projectId
|
|
1003
|
+
});
|
|
1004
|
+
const source = createAssetEngineDataSource({ client });
|
|
1005
|
+
let target;
|
|
1006
|
+
const isPackage = isPathAPackageFile(directory);
|
|
1007
|
+
const onBeforeDeleteObject = async (id, object) => {
|
|
1008
|
+
var _a;
|
|
1009
|
+
const asset = object.object;
|
|
1010
|
+
if (!((_a = asset.asset.url) == null ? void 0 : _a.value)) {
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
await deleteDownloadedFileByUrl(asset.asset.url.value, {
|
|
1014
|
+
directory
|
|
1015
|
+
});
|
|
1016
|
+
};
|
|
1017
|
+
if (isPackage) {
|
|
1018
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
1019
|
+
target = await createArraySyncEngineDataSource({
|
|
1020
|
+
objects: packageContents.assets ?? [],
|
|
1021
|
+
selectIdentifier: selectAssetIdentifier,
|
|
1022
|
+
selectDisplayName: selectAssetDisplayName,
|
|
1023
|
+
onSyncComplete: async (_, synced) => {
|
|
1024
|
+
packageContents.assets = synced;
|
|
1025
|
+
writeCanvasPackage(directory, packageContents);
|
|
1026
|
+
},
|
|
1027
|
+
onBeforeDeleteObject
|
|
1028
|
+
});
|
|
1029
|
+
} else {
|
|
1030
|
+
target = await createFileSyncEngineDataSource({
|
|
1031
|
+
directory,
|
|
1032
|
+
selectIdentifier: selectAssetIdentifier,
|
|
1033
|
+
selectDisplayName: selectAssetDisplayName,
|
|
1034
|
+
format,
|
|
1035
|
+
onBeforeDeleteObject
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
await syncEngine({
|
|
1039
|
+
source,
|
|
1040
|
+
target,
|
|
1041
|
+
mode,
|
|
1042
|
+
whatIf,
|
|
1043
|
+
allowEmptySource: true,
|
|
1044
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1045
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
1046
|
+
delete sourceObject.object.asset._author;
|
|
1047
|
+
return sourceObject;
|
|
1048
|
+
},
|
|
1049
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1050
|
+
delete sourceObject.object.asset._author;
|
|
1051
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1052
|
+
directory
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
// src/commands/canvas/commands/asset/push.ts
|
|
1060
|
+
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1061
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
1062
|
+
var AssetPushModule = {
|
|
1063
|
+
command: "push <directory>",
|
|
1064
|
+
describe: "Pushes all assets from files in a directory to Uniform",
|
|
1065
|
+
builder: (yargs27) => withConfiguration(
|
|
1066
|
+
withApiOptions(
|
|
1067
|
+
withProjectOptions(
|
|
1068
|
+
withDiffOptions(
|
|
1069
|
+
yargs27.positional("directory", {
|
|
1070
|
+
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
1071
|
+
type: "string"
|
|
1072
|
+
}).option("what-if", {
|
|
1073
|
+
alias: ["w"],
|
|
1074
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1075
|
+
default: false,
|
|
1076
|
+
type: "boolean"
|
|
1077
|
+
}).option("mode", {
|
|
1078
|
+
alias: ["m"],
|
|
1079
|
+
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',
|
|
1080
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1081
|
+
default: "mirror",
|
|
1082
|
+
type: "string"
|
|
1083
|
+
})
|
|
1084
|
+
)
|
|
1085
|
+
)
|
|
1086
|
+
)
|
|
1087
|
+
),
|
|
1088
|
+
handler: async ({
|
|
1089
|
+
apiHost,
|
|
1090
|
+
apiKey,
|
|
1091
|
+
proxy,
|
|
1092
|
+
directory,
|
|
1093
|
+
mode,
|
|
1094
|
+
whatIf,
|
|
1095
|
+
project: projectId,
|
|
1096
|
+
diff: diffMode
|
|
1097
|
+
}) => {
|
|
1098
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1099
|
+
const client = new UncachedAssetClient4({
|
|
1100
|
+
apiKey,
|
|
1101
|
+
apiHost,
|
|
1102
|
+
fetch: fetch3,
|
|
1103
|
+
projectId
|
|
1104
|
+
});
|
|
1105
|
+
let source;
|
|
1106
|
+
const isPackage = isPathAPackageFile(directory);
|
|
1107
|
+
if (isPackage) {
|
|
1108
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
1109
|
+
source = await createArraySyncEngineDataSource({
|
|
1110
|
+
objects: packageContents.assets ?? [],
|
|
1111
|
+
selectIdentifier: selectAssetIdentifier,
|
|
1112
|
+
selectDisplayName: selectAssetDisplayName
|
|
1113
|
+
});
|
|
1114
|
+
} else {
|
|
1115
|
+
source = await createFileSyncEngineDataSource({
|
|
1116
|
+
directory,
|
|
1117
|
+
selectIdentifier: selectAssetIdentifier,
|
|
1118
|
+
selectDisplayName: selectAssetDisplayName
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
const target = createAssetEngineDataSource({ client });
|
|
1122
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1123
|
+
await syncEngine({
|
|
1124
|
+
source,
|
|
1125
|
+
target,
|
|
1126
|
+
mode,
|
|
1127
|
+
whatIf,
|
|
1128
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1129
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1130
|
+
if (targetObject) {
|
|
1131
|
+
delete targetObject.object.asset._author;
|
|
1132
|
+
}
|
|
1133
|
+
const sourceObjectWithNewFileUrls = await swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
1134
|
+
fileClient
|
|
1135
|
+
});
|
|
1136
|
+
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1137
|
+
sourceObjectWithNewFileUrls.object,
|
|
1138
|
+
{
|
|
1139
|
+
fileClient
|
|
1140
|
+
}
|
|
1141
|
+
);
|
|
1142
|
+
return sourceObjectWithNewFileUrls;
|
|
1143
|
+
},
|
|
1144
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
1145
|
+
const sourceObjectWithNewFileUrls = await extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1146
|
+
directory,
|
|
1147
|
+
fileClient
|
|
1148
|
+
});
|
|
1149
|
+
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1150
|
+
sourceObjectWithNewFileUrls.object,
|
|
1151
|
+
{
|
|
1152
|
+
fileClient
|
|
1153
|
+
}
|
|
1154
|
+
);
|
|
1155
|
+
return sourceObjectWithNewFileUrls;
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// src/commands/canvas/commands/asset/remove.ts
|
|
1162
|
+
import { UncachedAssetClient as UncachedAssetClient5 } from "@uniformdev/assets";
|
|
1163
|
+
var AssetRemoveModule = {
|
|
1164
|
+
command: "remove <id>",
|
|
1165
|
+
aliases: ["delete", "rm"],
|
|
1166
|
+
describe: "Delete an asset",
|
|
1167
|
+
builder: (yargs27) => withConfiguration(
|
|
1168
|
+
withApiOptions(
|
|
1169
|
+
withProjectOptions(yargs27.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
1170
|
+
)
|
|
1171
|
+
),
|
|
1172
|
+
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
1173
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1174
|
+
const client = new UncachedAssetClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1175
|
+
await client.delete({ assetId: id });
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1179
|
+
// src/commands/canvas/commands/asset/update.ts
|
|
1180
|
+
import { convertAssetToPutAsset as convertAssetToPutAsset2, UncachedAssetClient as UncachedAssetClient6 } from "@uniformdev/assets";
|
|
1181
|
+
var AssetUpdateModule = {
|
|
1182
|
+
command: "update <filename>",
|
|
1183
|
+
aliases: ["put"],
|
|
1184
|
+
describe: "Insert or update an asset",
|
|
1185
|
+
builder: (yargs27) => withConfiguration(
|
|
1186
|
+
withApiOptions(
|
|
1187
|
+
withProjectOptions(
|
|
1188
|
+
yargs27.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
1189
|
+
)
|
|
1190
|
+
)
|
|
1191
|
+
),
|
|
1192
|
+
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
1193
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1194
|
+
const client = new UncachedAssetClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1195
|
+
const file = readFileToObject(filename);
|
|
1196
|
+
await client.upsert(convertAssetToPutAsset2(file));
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
// src/commands/canvas/commands/asset.ts
|
|
1201
|
+
var AssetModule = {
|
|
1202
|
+
command: "asset <command>",
|
|
1203
|
+
describe: "Commands for Assets",
|
|
1204
|
+
builder: (yargs27) => yargs27.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
1205
|
+
handler: () => {
|
|
1206
|
+
yargs.help();
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
// src/commands/canvas/commands/category.ts
|
|
1211
|
+
import yargs2 from "yargs";
|
|
1212
|
+
|
|
1213
|
+
// src/commands/canvas/commands/category/get.ts
|
|
1214
|
+
import { UncachedCategoryClient } from "@uniformdev/canvas";
|
|
1215
|
+
var CategoryGetModule = {
|
|
1216
|
+
command: "get <id>",
|
|
1217
|
+
describe: "Fetch a category",
|
|
1218
|
+
builder: (yargs27) => withConfiguration(
|
|
1219
|
+
withFormatOptions(
|
|
1220
|
+
withApiOptions(
|
|
1221
|
+
withProjectOptions(
|
|
1222
|
+
yargs27.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
1223
|
+
)
|
|
1224
|
+
)
|
|
1225
|
+
)
|
|
1226
|
+
),
|
|
1227
|
+
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
1228
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1229
|
+
const client = new UncachedCategoryClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1230
|
+
const res = await client.getCategories();
|
|
1231
|
+
const category = res.categories.find((c) => c.id === id);
|
|
1232
|
+
if (!category) {
|
|
1233
|
+
console.error("Category did not exist");
|
|
1234
|
+
process.exit(1);
|
|
1235
|
+
} else {
|
|
1236
|
+
emitWithFormat(category, format, filename);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
// src/commands/canvas/commands/category/list.ts
|
|
1242
|
+
import { UncachedCategoryClient as UncachedCategoryClient2 } from "@uniformdev/canvas";
|
|
1243
|
+
var CategoryListModule = {
|
|
1244
|
+
command: "list",
|
|
1245
|
+
describe: "List categories",
|
|
1246
|
+
aliases: ["ls"],
|
|
1247
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27.options({}))))),
|
|
1248
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
1249
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1250
|
+
const client = new UncachedCategoryClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1251
|
+
const res = await client.getCategories();
|
|
1252
|
+
emitWithFormat(res.categories, format, filename);
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1256
|
+
// src/commands/canvas/commands/category/pull.ts
|
|
1257
|
+
import { UncachedCategoryClient as UncachedCategoryClient3 } from "@uniformdev/canvas";
|
|
1258
|
+
|
|
1259
|
+
// src/commands/canvas/commands/category/_util.ts
|
|
1260
|
+
var selectIdentifier = (category) => category.id;
|
|
1261
|
+
var selectDisplayName = (category) => `${category.name} (pid: ${category.id})`;
|
|
1262
|
+
|
|
1263
|
+
// src/commands/canvas/categoriesEngineDataSource.ts
|
|
1264
|
+
function createCategoriesEngineDataSource({
|
|
1265
|
+
client
|
|
1266
|
+
}) {
|
|
1267
|
+
async function* getObjects() {
|
|
1268
|
+
const componentDefinitions = paginateAsync(async () => (await client.getCategories()).categories, {
|
|
1269
|
+
pageSize: 100
|
|
1270
|
+
});
|
|
1271
|
+
for await (const def of componentDefinitions) {
|
|
1272
|
+
const result = {
|
|
1273
|
+
id: selectIdentifier(def),
|
|
1274
|
+
displayName: selectDisplayName(def),
|
|
1275
|
+
providerId: def.id,
|
|
1276
|
+
object: def
|
|
1277
|
+
};
|
|
1278
|
+
yield result;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return {
|
|
1282
|
+
objects: getObjects(),
|
|
1283
|
+
deleteObject: async (providerId) => {
|
|
1284
|
+
await client.removeCategory({ categoryId: providerId });
|
|
1285
|
+
},
|
|
1286
|
+
writeObject: async (object) => {
|
|
1287
|
+
await client.upsertCategories([object.object]);
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
// src/commands/canvas/commands/category/pull.ts
|
|
1293
|
+
var CategoryPullModule = {
|
|
1294
|
+
command: "pull <directory>",
|
|
1295
|
+
describe: "Pulls all categories to local files in a directory",
|
|
1296
|
+
builder: (yargs27) => withConfiguration(
|
|
1297
|
+
withApiOptions(
|
|
1298
|
+
withProjectOptions(
|
|
1299
|
+
withDiffOptions(
|
|
1300
|
+
yargs27.positional("directory", {
|
|
1301
|
+
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.",
|
|
1302
|
+
type: "string"
|
|
1303
|
+
}).option("format", {
|
|
1304
|
+
alias: ["f"],
|
|
1305
|
+
describe: "Output format",
|
|
1306
|
+
default: "yaml",
|
|
1307
|
+
choices: ["yaml", "json"],
|
|
1308
|
+
type: "string"
|
|
1309
|
+
}).option("what-if", {
|
|
1310
|
+
alias: ["w"],
|
|
1311
|
+
describe: "What-if mode reports what would be done but changes no files",
|
|
1312
|
+
default: false,
|
|
1313
|
+
type: "boolean"
|
|
1314
|
+
}).option("mode", {
|
|
1315
|
+
alias: ["m"],
|
|
1316
|
+
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',
|
|
1317
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1318
|
+
default: "mirror",
|
|
1319
|
+
type: "string"
|
|
1320
|
+
})
|
|
1321
|
+
)
|
|
1322
|
+
)
|
|
1323
|
+
)
|
|
1324
|
+
),
|
|
1325
|
+
handler: async ({
|
|
1326
|
+
apiHost,
|
|
1327
|
+
apiKey,
|
|
1328
|
+
proxy,
|
|
1329
|
+
directory,
|
|
1330
|
+
format,
|
|
1331
|
+
mode,
|
|
1332
|
+
whatIf,
|
|
1333
|
+
project: projectId,
|
|
1334
|
+
diff: diffMode
|
|
1335
|
+
}) => {
|
|
1336
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1337
|
+
const client = new UncachedCategoryClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1338
|
+
const source = createCategoriesEngineDataSource({ client });
|
|
1339
|
+
let target;
|
|
1340
|
+
const isPackage = isPathAPackageFile(directory);
|
|
1341
|
+
if (isPackage) {
|
|
1342
|
+
const packageContents = readCanvasPackage(directory, false);
|
|
1343
|
+
target = await createArraySyncEngineDataSource({
|
|
1344
|
+
objects: packageContents.categories ?? [],
|
|
1345
|
+
selectIdentifier,
|
|
1346
|
+
selectDisplayName,
|
|
1347
|
+
onSyncComplete: async (_, synced) => {
|
|
1348
|
+
packageContents.categories = synced;
|
|
1349
|
+
writeCanvasPackage(directory, packageContents);
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
} else {
|
|
1353
|
+
target = await createFileSyncEngineDataSource({
|
|
1354
|
+
directory,
|
|
1355
|
+
selectIdentifier,
|
|
1356
|
+
selectDisplayName,
|
|
1357
|
+
format
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
await syncEngine({
|
|
1361
|
+
source,
|
|
1362
|
+
target,
|
|
1363
|
+
mode,
|
|
1364
|
+
whatIf,
|
|
1365
|
+
allowEmptySource: true,
|
|
1366
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
// src/commands/canvas/commands/category/push.ts
|
|
1372
|
+
import { UncachedCategoryClient as UncachedCategoryClient4 } from "@uniformdev/canvas";
|
|
1373
|
+
var CategoryPushModule = {
|
|
1374
|
+
command: "push <directory>",
|
|
1375
|
+
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
1376
|
+
builder: (yargs27) => withConfiguration(
|
|
1377
|
+
withApiOptions(
|
|
1378
|
+
withProjectOptions(
|
|
1379
|
+
withDiffOptions(
|
|
1380
|
+
yargs27.positional("directory", {
|
|
1381
|
+
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
1382
|
+
type: "string"
|
|
1383
|
+
}).option("what-if", {
|
|
1384
|
+
alias: ["w"],
|
|
1385
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
1386
|
+
default: false,
|
|
1387
|
+
type: "boolean"
|
|
1388
|
+
}).option("mode", {
|
|
1389
|
+
alias: ["m"],
|
|
1390
|
+
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',
|
|
1391
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
1392
|
+
default: "mirror",
|
|
1393
|
+
type: "string"
|
|
1394
|
+
})
|
|
1395
|
+
)
|
|
1396
|
+
)
|
|
1397
|
+
)
|
|
1398
|
+
),
|
|
1399
|
+
handler: async ({
|
|
1400
|
+
apiHost,
|
|
1401
|
+
apiKey,
|
|
1402
|
+
proxy,
|
|
1403
|
+
directory,
|
|
1404
|
+
mode,
|
|
1405
|
+
whatIf,
|
|
1406
|
+
project: projectId,
|
|
1407
|
+
diff: diffMode
|
|
1408
|
+
}) => {
|
|
1409
|
+
const fetch3 = nodeFetchProxy(proxy);
|
|
1410
|
+
const client = new UncachedCategoryClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1411
|
+
let source;
|
|
1412
|
+
const isPackage = isPathAPackageFile(directory);
|
|
1413
|
+
if (isPackage) {
|
|
1414
|
+
const packageContents = readCanvasPackage(directory, true);
|
|
1415
|
+
source = await createArraySyncEngineDataSource({
|
|
1416
|
+
objects: packageContents.categories ?? [],
|
|
1417
|
+
selectIdentifier,
|
|
1418
|
+
selectDisplayName
|
|
1419
|
+
});
|
|
1420
|
+
} else {
|
|
1421
|
+
source = await createFileSyncEngineDataSource({
|
|
1422
|
+
directory,
|
|
1423
|
+
selectIdentifier,
|
|
1424
|
+
selectDisplayName
|
|
842
1425
|
});
|
|
843
1426
|
}
|
|
844
1427
|
const target = createCategoriesEngineDataSource({ client });
|
|
@@ -858,10 +1441,10 @@ var CategoryRemoveModule = {
|
|
|
858
1441
|
command: "remove <id>",
|
|
859
1442
|
aliases: ["delete", "rm"],
|
|
860
1443
|
describe: "Delete a category",
|
|
861
|
-
builder: (
|
|
1444
|
+
builder: (yargs27) => withConfiguration(
|
|
862
1445
|
withApiOptions(
|
|
863
1446
|
withProjectOptions(
|
|
864
|
-
|
|
1447
|
+
yargs27.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
865
1448
|
)
|
|
866
1449
|
)
|
|
867
1450
|
),
|
|
@@ -878,10 +1461,10 @@ var CategoryUpdateModule = {
|
|
|
878
1461
|
command: "update <filename>",
|
|
879
1462
|
aliases: ["put"],
|
|
880
1463
|
describe: "Insert or update a category",
|
|
881
|
-
builder: (
|
|
1464
|
+
builder: (yargs27) => withConfiguration(
|
|
882
1465
|
withApiOptions(
|
|
883
1466
|
withProjectOptions(
|
|
884
|
-
|
|
1467
|
+
yargs27.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
885
1468
|
)
|
|
886
1469
|
)
|
|
887
1470
|
),
|
|
@@ -898,14 +1481,14 @@ var CategoryModule = {
|
|
|
898
1481
|
command: "category <command>",
|
|
899
1482
|
aliases: ["cat"],
|
|
900
1483
|
describe: "Commands for Canvas categories",
|
|
901
|
-
builder: (
|
|
1484
|
+
builder: (yargs27) => yargs27.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
902
1485
|
handler: () => {
|
|
903
|
-
|
|
1486
|
+
yargs2.help();
|
|
904
1487
|
}
|
|
905
1488
|
};
|
|
906
1489
|
|
|
907
1490
|
// src/commands/canvas/commands/component.ts
|
|
908
|
-
import
|
|
1491
|
+
import yargs3 from "yargs";
|
|
909
1492
|
|
|
910
1493
|
// src/commands/canvas/commands/component/get.ts
|
|
911
1494
|
import { UncachedCanvasClient } from "@uniformdev/canvas";
|
|
@@ -919,11 +1502,11 @@ var selectSchemaUrl = () => "/schemas/json-schema/component-definition/v1.json";
|
|
|
919
1502
|
var ComponentGetModule = {
|
|
920
1503
|
command: "get <id>",
|
|
921
1504
|
describe: "Fetch a component definition",
|
|
922
|
-
builder: (
|
|
1505
|
+
builder: (yargs27) => withConfiguration(
|
|
923
1506
|
withFormatOptions(
|
|
924
1507
|
withApiOptions(
|
|
925
1508
|
withProjectOptions(
|
|
926
|
-
|
|
1509
|
+
yargs27.positional("id", {
|
|
927
1510
|
demandOption: true,
|
|
928
1511
|
describe: "Component definition public ID to fetch"
|
|
929
1512
|
})
|
|
@@ -957,11 +1540,11 @@ var ComponentListModule = {
|
|
|
957
1540
|
command: "list",
|
|
958
1541
|
describe: "List component definitions",
|
|
959
1542
|
aliases: ["ls"],
|
|
960
|
-
builder: (
|
|
1543
|
+
builder: (yargs27) => withConfiguration(
|
|
961
1544
|
withFormatOptions(
|
|
962
1545
|
withApiOptions(
|
|
963
1546
|
withProjectOptions(
|
|
964
|
-
|
|
1547
|
+
yargs27.options({
|
|
965
1548
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
966
1549
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
967
1550
|
})
|
|
@@ -1016,11 +1599,11 @@ function createComponentDefinitionEngineDataSource({
|
|
|
1016
1599
|
var ComponentPullModule = {
|
|
1017
1600
|
command: "pull <directory>",
|
|
1018
1601
|
describe: "Pulls all component definitions to local files in a directory",
|
|
1019
|
-
builder: (
|
|
1602
|
+
builder: (yargs27) => withConfiguration(
|
|
1020
1603
|
withApiOptions(
|
|
1021
1604
|
withProjectOptions(
|
|
1022
1605
|
withDiffOptions(
|
|
1023
|
-
|
|
1606
|
+
yargs27.positional("directory", {
|
|
1024
1607
|
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.",
|
|
1025
1608
|
type: "string"
|
|
1026
1609
|
}).option("format", {
|
|
@@ -1097,11 +1680,11 @@ import { UncachedCanvasClient as UncachedCanvasClient4 } from "@uniformdev/canva
|
|
|
1097
1680
|
var ComponentPushModule = {
|
|
1098
1681
|
command: "push <directory>",
|
|
1099
1682
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
1100
|
-
builder: (
|
|
1683
|
+
builder: (yargs27) => withConfiguration(
|
|
1101
1684
|
withApiOptions(
|
|
1102
1685
|
withProjectOptions(
|
|
1103
1686
|
withDiffOptions(
|
|
1104
|
-
|
|
1687
|
+
yargs27.positional("directory", {
|
|
1105
1688
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
1106
1689
|
type: "string"
|
|
1107
1690
|
}).option("what-if", {
|
|
@@ -1166,10 +1749,10 @@ var ComponentRemoveModule = {
|
|
|
1166
1749
|
command: "remove <id>",
|
|
1167
1750
|
aliases: ["delete", "rm"],
|
|
1168
1751
|
describe: "Delete a component definition",
|
|
1169
|
-
builder: (
|
|
1752
|
+
builder: (yargs27) => withConfiguration(
|
|
1170
1753
|
withApiOptions(
|
|
1171
1754
|
withProjectOptions(
|
|
1172
|
-
|
|
1755
|
+
yargs27.positional("id", { demandOption: true, describe: "Component definition public ID to delete" })
|
|
1173
1756
|
)
|
|
1174
1757
|
)
|
|
1175
1758
|
),
|
|
@@ -1186,10 +1769,10 @@ var ComponentUpdateModule = {
|
|
|
1186
1769
|
command: "update <filename>",
|
|
1187
1770
|
aliases: ["put"],
|
|
1188
1771
|
describe: "Insert or update a component definition",
|
|
1189
|
-
builder: (
|
|
1772
|
+
builder: (yargs27) => withConfiguration(
|
|
1190
1773
|
withApiOptions(
|
|
1191
1774
|
withProjectOptions(
|
|
1192
|
-
|
|
1775
|
+
yargs27.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
1193
1776
|
)
|
|
1194
1777
|
)
|
|
1195
1778
|
),
|
|
@@ -1205,64 +1788,27 @@ var ComponentUpdateModule = {
|
|
|
1205
1788
|
var ComponentModule = {
|
|
1206
1789
|
command: "component <command>",
|
|
1207
1790
|
aliases: ["def"],
|
|
1208
|
-
describe: "Commands for Canvas component definitions",
|
|
1209
|
-
builder: (
|
|
1210
|
-
handler: () => {
|
|
1211
|
-
|
|
1212
|
-
}
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
|
-
// src/commands/canvas/commands/composition.ts
|
|
1216
|
-
import yargs3 from "yargs";
|
|
1217
|
-
|
|
1218
|
-
// src/commands/canvas/commands/composition/get.ts
|
|
1219
|
-
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1220
|
-
|
|
1221
|
-
// src/commands/canvas/util.ts
|
|
1222
|
-
import {
|
|
1223
|
-
CANVAS_DRAFT_STATE,
|
|
1224
|
-
CANVAS_PUBLISHED_STATE
|
|
1225
|
-
} from "@uniformdev/canvas";
|
|
1226
|
-
function prepCompositionForDisk(composition) {
|
|
1227
|
-
const prepped = {
|
|
1228
|
-
...composition
|
|
1229
|
-
};
|
|
1230
|
-
delete prepped.projectId;
|
|
1231
|
-
delete prepped.state;
|
|
1232
|
-
return prepped;
|
|
1233
|
-
}
|
|
1234
|
-
function withStateOptions(yargs26) {
|
|
1235
|
-
return yargs26.option("state", {
|
|
1236
|
-
type: "string",
|
|
1237
|
-
describe: `Composition state to fetch.`,
|
|
1238
|
-
choices: ["preview", "published"],
|
|
1239
|
-
default: "preview"
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
function convertCompositionState(state) {
|
|
1243
|
-
const number = Number(state);
|
|
1244
|
-
if (!isNaN(number)) {
|
|
1245
|
-
return number;
|
|
1246
|
-
}
|
|
1247
|
-
if (!state) {
|
|
1248
|
-
return CANVAS_PUBLISHED_STATE;
|
|
1249
|
-
}
|
|
1250
|
-
if (typeof state !== "string") {
|
|
1251
|
-
throw new Error('state must be "published", "preview", or a number');
|
|
1791
|
+
describe: "Commands for Canvas component definitions",
|
|
1792
|
+
builder: (yargs27) => yargs27.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
1793
|
+
handler: () => {
|
|
1794
|
+
yargs3.help();
|
|
1252
1795
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1798
|
+
// src/commands/canvas/commands/composition.ts
|
|
1799
|
+
import yargs4 from "yargs";
|
|
1255
1800
|
|
|
1256
1801
|
// src/commands/canvas/commands/composition/get.ts
|
|
1802
|
+
import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
|
|
1257
1803
|
var CompositionGetModule = {
|
|
1258
1804
|
command: "get <id>",
|
|
1259
1805
|
describe: "Fetch a composition",
|
|
1260
|
-
builder: (
|
|
1806
|
+
builder: (yargs27) => withFormatOptions(
|
|
1261
1807
|
withConfiguration(
|
|
1262
1808
|
withApiOptions(
|
|
1263
1809
|
withProjectOptions(
|
|
1264
1810
|
withStateOptions(
|
|
1265
|
-
|
|
1811
|
+
yargs27.positional("id", { demandOption: true, describe: "Composition/pattern public ID to fetch" }).option({
|
|
1266
1812
|
resolvePatterns: {
|
|
1267
1813
|
type: "boolean",
|
|
1268
1814
|
default: false,
|
|
@@ -1333,12 +1879,12 @@ var CompositionListModule = {
|
|
|
1333
1879
|
command: "list",
|
|
1334
1880
|
describe: "List compositions",
|
|
1335
1881
|
aliases: ["ls"],
|
|
1336
|
-
builder: (
|
|
1882
|
+
builder: (yargs27) => withFormatOptions(
|
|
1337
1883
|
withConfiguration(
|
|
1338
1884
|
withApiOptions(
|
|
1339
1885
|
withProjectOptions(
|
|
1340
1886
|
withStateOptions(
|
|
1341
|
-
|
|
1887
|
+
yargs27.options({
|
|
1342
1888
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
1343
1889
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
1344
1890
|
resolvePatterns: {
|
|
@@ -1459,11 +2005,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
1459
2005
|
var CompositionPublishModule = {
|
|
1460
2006
|
command: "publish [ids]",
|
|
1461
2007
|
describe: "Publishes composition(s)",
|
|
1462
|
-
builder: (
|
|
2008
|
+
builder: (yargs27) => withConfiguration(
|
|
1463
2009
|
withApiOptions(
|
|
1464
2010
|
withProjectOptions(
|
|
1465
2011
|
withDiffOptions(
|
|
1466
|
-
|
|
2012
|
+
yargs27.positional("ids", {
|
|
1467
2013
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
1468
2014
|
type: "string"
|
|
1469
2015
|
}).option("all", {
|
|
@@ -1535,189 +2081,15 @@ var CompositionPublishModule = {
|
|
|
1535
2081
|
|
|
1536
2082
|
// src/commands/canvas/commands/composition/pull.ts
|
|
1537
2083
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
1538
|
-
|
|
1539
|
-
// src/files/index.ts
|
|
1540
|
-
import { preferredType } from "@thi.ng/mime";
|
|
1541
|
-
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
1542
|
-
import { createHash } from "crypto";
|
|
1543
|
-
import fsj from "fs-jetpack";
|
|
1544
|
-
import sizeOf from "image-size";
|
|
1545
|
-
import PQueue from "p-queue";
|
|
1546
|
-
import { join as join2 } from "path";
|
|
1547
|
-
var FILES_DIRECTORY_NAME = "files";
|
|
1548
|
-
var urlToHash = (url) => {
|
|
1549
|
-
const hash = createHash("sha256");
|
|
1550
|
-
hash.update(url);
|
|
1551
|
-
return hash.digest("hex");
|
|
1552
|
-
};
|
|
1553
|
-
var urlToFileName = (url) => {
|
|
1554
|
-
const fileName = urlToHash(url);
|
|
1555
|
-
const fileNameChunks = url.split(".");
|
|
1556
|
-
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
1557
|
-
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
1558
|
-
};
|
|
1559
|
-
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
1560
|
-
const objectAsString = JSON.stringify(object);
|
|
1561
|
-
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1562
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1563
|
-
);
|
|
1564
|
-
if (uniformFileUrlMatches) {
|
|
1565
|
-
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
1566
|
-
for (const match of uniformFileUrlMatches) {
|
|
1567
|
-
const url = new URL(match[1]);
|
|
1568
|
-
fileDownloadQueue.add(async () => {
|
|
1569
|
-
try {
|
|
1570
|
-
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
1571
|
-
const fileName = urlToFileName(url.toString());
|
|
1572
|
-
const fileAlreadyExists = await fsj.existsAsync(
|
|
1573
|
-
join2(options.directory, FILES_DIRECTORY_NAME, fileName)
|
|
1574
|
-
);
|
|
1575
|
-
if (fileAlreadyExists) {
|
|
1576
|
-
return;
|
|
1577
|
-
}
|
|
1578
|
-
const response = await fetch(fetchUrl);
|
|
1579
|
-
if (!response.ok) {
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
const fileBuffer = await response.arrayBuffer();
|
|
1583
|
-
await fsj.writeAsync(
|
|
1584
|
-
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
1585
|
-
Buffer.from(fileBuffer)
|
|
1586
|
-
);
|
|
1587
|
-
} catch {
|
|
1588
|
-
console.warn(`Failed to download file ${url}`);
|
|
1589
|
-
}
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
await fileDownloadQueue.onIdle();
|
|
1593
|
-
}
|
|
1594
|
-
return object;
|
|
1595
|
-
};
|
|
1596
|
-
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
1597
|
-
let objectAsString = JSON.stringify(object);
|
|
1598
|
-
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1599
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1600
|
-
);
|
|
1601
|
-
if (uniformFileUrlMatches) {
|
|
1602
|
-
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
1603
|
-
for (const match of uniformFileUrlMatches) {
|
|
1604
|
-
const url = match[1];
|
|
1605
|
-
const hash = urlToHash(url);
|
|
1606
|
-
fileUploadQueue.add(async () => {
|
|
1607
|
-
try {
|
|
1608
|
-
const fileAlreadyExistsChecks = await Promise.all([
|
|
1609
|
-
options.fileClient.get({ url }).catch(() => null),
|
|
1610
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
1611
|
-
]);
|
|
1612
|
-
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
1613
|
-
return;
|
|
1614
|
-
}
|
|
1615
|
-
const localFileName = urlToFileName(url);
|
|
1616
|
-
const fileExistsLocally = await fsj.existsAsync(
|
|
1617
|
-
join2(options.directory, FILES_DIRECTORY_NAME, localFileName)
|
|
1618
|
-
);
|
|
1619
|
-
if (!fileExistsLocally) {
|
|
1620
|
-
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
1621
|
-
return;
|
|
1622
|
-
}
|
|
1623
|
-
const fileBuffer = await fsj.readAsync(
|
|
1624
|
-
join2(options.directory, FILES_DIRECTORY_NAME, localFileName),
|
|
1625
|
-
"buffer"
|
|
1626
|
-
);
|
|
1627
|
-
if (!fileBuffer) {
|
|
1628
|
-
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
1629
|
-
return;
|
|
1630
|
-
}
|
|
1631
|
-
const fileName = getFileNameFromUrl(url);
|
|
1632
|
-
const { width, height } = (() => {
|
|
1633
|
-
try {
|
|
1634
|
-
return sizeOf(fileBuffer);
|
|
1635
|
-
} catch {
|
|
1636
|
-
return {
|
|
1637
|
-
width: void 0,
|
|
1638
|
-
height: void 0
|
|
1639
|
-
};
|
|
1640
|
-
}
|
|
1641
|
-
})();
|
|
1642
|
-
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
1643
|
-
name: fileName,
|
|
1644
|
-
mediaType: preferredType(url.split(".").at(-1) ?? ""),
|
|
1645
|
-
size: fileBuffer.length,
|
|
1646
|
-
width,
|
|
1647
|
-
height,
|
|
1648
|
-
sourceId: hash
|
|
1649
|
-
});
|
|
1650
|
-
const uploadResponse = await fetch(uploadUrl, {
|
|
1651
|
-
method,
|
|
1652
|
-
body: fileBuffer
|
|
1653
|
-
});
|
|
1654
|
-
if (!uploadResponse.ok) {
|
|
1655
|
-
console.warn(`Failed to upload file ${url}`);
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
const checkForFile = async () => {
|
|
1659
|
-
const file = await options.fileClient.get({ id });
|
|
1660
|
-
if (!file || file.state !== FILE_READY_STATE || !file.url) {
|
|
1661
|
-
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
1662
|
-
return checkForFile();
|
|
1663
|
-
}
|
|
1664
|
-
return file.url;
|
|
1665
|
-
};
|
|
1666
|
-
const abortTimeout = setTimeout(() => {
|
|
1667
|
-
throw new Error(`Failed to upload file ${url}`);
|
|
1668
|
-
}, 1e4);
|
|
1669
|
-
const uploadedFileUrl = await checkForFile();
|
|
1670
|
-
clearTimeout(abortTimeout);
|
|
1671
|
-
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
1672
|
-
} catch {
|
|
1673
|
-
console.warn(`Failed to upload file ${url}`);
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
await fileUploadQueue.onIdle();
|
|
1678
|
-
}
|
|
1679
|
-
return JSON.parse(objectAsString);
|
|
1680
|
-
};
|
|
1681
|
-
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
1682
|
-
let objectAsString = JSON.stringify(object);
|
|
1683
|
-
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
1684
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
1685
|
-
);
|
|
1686
|
-
if (uniformFileUrlMatches) {
|
|
1687
|
-
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
1688
|
-
for (const match of uniformFileUrlMatches) {
|
|
1689
|
-
const url = match[1];
|
|
1690
|
-
const hash = urlToHash(url);
|
|
1691
|
-
fileUrlReplacementQueue.add(async () => {
|
|
1692
|
-
try {
|
|
1693
|
-
const fileAlreadyExistsChecks = await Promise.all([
|
|
1694
|
-
options.fileClient.get({ url }).catch(() => null),
|
|
1695
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
1696
|
-
]);
|
|
1697
|
-
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
1698
|
-
if (!file) {
|
|
1699
|
-
return;
|
|
1700
|
-
}
|
|
1701
|
-
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${file.url}"`);
|
|
1702
|
-
} catch {
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
await fileUrlReplacementQueue.onIdle();
|
|
1707
|
-
}
|
|
1708
|
-
return JSON.parse(objectAsString);
|
|
1709
|
-
};
|
|
1710
|
-
|
|
1711
|
-
// src/commands/canvas/commands/composition/pull.ts
|
|
1712
2084
|
var CompositionPullModule = {
|
|
1713
2085
|
command: "pull <directory>",
|
|
1714
2086
|
describe: "Pulls all compositions to local files in a directory",
|
|
1715
|
-
builder: (
|
|
2087
|
+
builder: (yargs27) => withConfiguration(
|
|
1716
2088
|
withApiOptions(
|
|
1717
2089
|
withProjectOptions(
|
|
1718
2090
|
withStateOptions(
|
|
1719
2091
|
withDiffOptions(
|
|
1720
|
-
|
|
2092
|
+
yargs27.positional("directory", {
|
|
1721
2093
|
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.",
|
|
1722
2094
|
type: "string"
|
|
1723
2095
|
}).option("format", {
|
|
@@ -1808,16 +2180,16 @@ var CompositionPullModule = {
|
|
|
1808
2180
|
|
|
1809
2181
|
// src/commands/canvas/commands/composition/push.ts
|
|
1810
2182
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
1811
|
-
import {
|
|
2183
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1812
2184
|
var CompositionPushModule = {
|
|
1813
2185
|
command: "push <directory>",
|
|
1814
2186
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
1815
|
-
builder: (
|
|
2187
|
+
builder: (yargs27) => withConfiguration(
|
|
1816
2188
|
withApiOptions(
|
|
1817
2189
|
withProjectOptions(
|
|
1818
2190
|
withStateOptions(
|
|
1819
2191
|
withDiffOptions(
|
|
1820
|
-
|
|
2192
|
+
yargs27.positional("directory", {
|
|
1821
2193
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
1822
2194
|
type: "string"
|
|
1823
2195
|
}).option("what-if", {
|
|
@@ -1878,7 +2250,7 @@ var CompositionPushModule = {
|
|
|
1878
2250
|
});
|
|
1879
2251
|
}
|
|
1880
2252
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
1881
|
-
const fileClient = new
|
|
2253
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1882
2254
|
await syncEngine({
|
|
1883
2255
|
source,
|
|
1884
2256
|
target,
|
|
@@ -1887,15 +2259,13 @@ var CompositionPushModule = {
|
|
|
1887
2259
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1888
2260
|
onBeforeCompareObjects: async (sourceObject) => {
|
|
1889
2261
|
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
1890
|
-
fileClient
|
|
1891
|
-
projectId
|
|
2262
|
+
fileClient
|
|
1892
2263
|
});
|
|
1893
2264
|
},
|
|
1894
2265
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1895
2266
|
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1896
2267
|
directory,
|
|
1897
|
-
fileClient
|
|
1898
|
-
projectId
|
|
2268
|
+
fileClient
|
|
1899
2269
|
});
|
|
1900
2270
|
}
|
|
1901
2271
|
});
|
|
@@ -1908,10 +2278,10 @@ var CompositionRemoveModule = {
|
|
|
1908
2278
|
command: "remove <id>",
|
|
1909
2279
|
aliases: ["delete", "rm"],
|
|
1910
2280
|
describe: "Delete a composition",
|
|
1911
|
-
builder: (
|
|
2281
|
+
builder: (yargs27) => withConfiguration(
|
|
1912
2282
|
withApiOptions(
|
|
1913
2283
|
withProjectOptions(
|
|
1914
|
-
|
|
2284
|
+
yargs27.positional("id", { demandOption: true, describe: "Composition/pattern public ID to delete" })
|
|
1915
2285
|
)
|
|
1916
2286
|
)
|
|
1917
2287
|
),
|
|
@@ -1928,10 +2298,10 @@ import { diffJson as diffJson2 } from "diff";
|
|
|
1928
2298
|
var CompositionUnpublishModule = {
|
|
1929
2299
|
command: "unpublish [ids]",
|
|
1930
2300
|
describe: "Unpublish a composition(s)",
|
|
1931
|
-
builder: (
|
|
2301
|
+
builder: (yargs27) => withConfiguration(
|
|
1932
2302
|
withApiOptions(
|
|
1933
2303
|
withProjectOptions(
|
|
1934
|
-
|
|
2304
|
+
yargs27.positional("ids", {
|
|
1935
2305
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
1936
2306
|
type: "string"
|
|
1937
2307
|
}).option("all", {
|
|
@@ -2025,11 +2395,11 @@ var CompositionUpdateModule = {
|
|
|
2025
2395
|
command: "update <filename>",
|
|
2026
2396
|
aliases: ["put"],
|
|
2027
2397
|
describe: "Insert or update a composition",
|
|
2028
|
-
builder: (
|
|
2398
|
+
builder: (yargs27) => withConfiguration(
|
|
2029
2399
|
withApiOptions(
|
|
2030
2400
|
withProjectOptions(
|
|
2031
2401
|
withStateOptions(
|
|
2032
|
-
|
|
2402
|
+
yargs27.positional("filename", { demandOption: true, describe: "Composition/pattern file to put" })
|
|
2033
2403
|
)
|
|
2034
2404
|
)
|
|
2035
2405
|
)
|
|
@@ -2047,26 +2417,26 @@ var CompositionModule = {
|
|
|
2047
2417
|
command: "composition <command>",
|
|
2048
2418
|
describe: "Commands for Canvas compositions",
|
|
2049
2419
|
aliases: ["comp"],
|
|
2050
|
-
builder: (
|
|
2420
|
+
builder: (yargs27) => yargs27.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
2051
2421
|
handler: () => {
|
|
2052
|
-
|
|
2422
|
+
yargs4.help();
|
|
2053
2423
|
}
|
|
2054
2424
|
};
|
|
2055
2425
|
|
|
2056
2426
|
// src/commands/canvas/commands/contentType.ts
|
|
2057
|
-
import
|
|
2427
|
+
import yargs5 from "yargs";
|
|
2058
2428
|
|
|
2059
2429
|
// src/commands/canvas/commands/contentType/get.ts
|
|
2060
2430
|
import { ContentClient } from "@uniformdev/canvas";
|
|
2061
2431
|
var ContentTypeGetModule = {
|
|
2062
2432
|
command: "get <id>",
|
|
2063
2433
|
describe: "Get a content type",
|
|
2064
|
-
builder: (
|
|
2434
|
+
builder: (yargs27) => withConfiguration(
|
|
2065
2435
|
withFormatOptions(
|
|
2066
2436
|
withApiOptions(
|
|
2067
2437
|
withProjectOptions(
|
|
2068
2438
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2069
|
-
|
|
2439
|
+
yargs27.positional("id", { demandOption: true, describe: "Content type public ID to fetch" })
|
|
2070
2440
|
)
|
|
2071
2441
|
)
|
|
2072
2442
|
)
|
|
@@ -2088,7 +2458,7 @@ import { ContentClient as ContentClient2 } from "@uniformdev/canvas";
|
|
|
2088
2458
|
var ContentTypeListModule = {
|
|
2089
2459
|
command: "list",
|
|
2090
2460
|
describe: "List content types",
|
|
2091
|
-
builder: (
|
|
2461
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
2092
2462
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2093
2463
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2094
2464
|
const client = new ContentClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2135,11 +2505,11 @@ function createContentTypeEngineDataSource({
|
|
|
2135
2505
|
var ContentTypePullModule = {
|
|
2136
2506
|
command: "pull <directory>",
|
|
2137
2507
|
describe: "Pulls all content types to local files in a directory",
|
|
2138
|
-
builder: (
|
|
2508
|
+
builder: (yargs27) => withConfiguration(
|
|
2139
2509
|
withApiOptions(
|
|
2140
2510
|
withProjectOptions(
|
|
2141
2511
|
withDiffOptions(
|
|
2142
|
-
|
|
2512
|
+
yargs27.positional("directory", {
|
|
2143
2513
|
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.",
|
|
2144
2514
|
type: "string"
|
|
2145
2515
|
}).option("format", {
|
|
@@ -2221,11 +2591,11 @@ import { ContentClient as ContentClient4 } from "@uniformdev/canvas";
|
|
|
2221
2591
|
var ContentTypePushModule = {
|
|
2222
2592
|
command: "push <directory>",
|
|
2223
2593
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
2224
|
-
builder: (
|
|
2594
|
+
builder: (yargs27) => withConfiguration(
|
|
2225
2595
|
withApiOptions(
|
|
2226
2596
|
withProjectOptions(
|
|
2227
2597
|
withDiffOptions(
|
|
2228
|
-
|
|
2598
|
+
yargs27.positional("directory", {
|
|
2229
2599
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
2230
2600
|
type: "string"
|
|
2231
2601
|
}).option("what-if", {
|
|
@@ -2295,10 +2665,10 @@ var ContentTypeRemoveModule = {
|
|
|
2295
2665
|
command: "remove <id>",
|
|
2296
2666
|
aliases: ["delete", "rm"],
|
|
2297
2667
|
describe: "Delete a content type",
|
|
2298
|
-
builder: (
|
|
2668
|
+
builder: (yargs27) => withConfiguration(
|
|
2299
2669
|
withApiOptions(
|
|
2300
2670
|
withProjectOptions(
|
|
2301
|
-
|
|
2671
|
+
yargs27.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
2302
2672
|
)
|
|
2303
2673
|
)
|
|
2304
2674
|
),
|
|
@@ -2315,10 +2685,10 @@ var ContentTypeUpdateModule = {
|
|
|
2315
2685
|
command: "update <filename>",
|
|
2316
2686
|
aliases: ["put"],
|
|
2317
2687
|
describe: "Insert or update a content type",
|
|
2318
|
-
builder: (
|
|
2688
|
+
builder: (yargs27) => withConfiguration(
|
|
2319
2689
|
withApiOptions(
|
|
2320
2690
|
withProjectOptions(
|
|
2321
|
-
|
|
2691
|
+
yargs27.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
2322
2692
|
)
|
|
2323
2693
|
)
|
|
2324
2694
|
),
|
|
@@ -2335,14 +2705,14 @@ var ContentTypeModule = {
|
|
|
2335
2705
|
command: "contenttype <command>",
|
|
2336
2706
|
aliases: ["ct"],
|
|
2337
2707
|
describe: "Commands for Content Types",
|
|
2338
|
-
builder: (
|
|
2708
|
+
builder: (yargs27) => yargs27.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
2339
2709
|
handler: () => {
|
|
2340
|
-
|
|
2710
|
+
yargs5.help();
|
|
2341
2711
|
}
|
|
2342
2712
|
};
|
|
2343
2713
|
|
|
2344
2714
|
// src/commands/canvas/commands/dataType.ts
|
|
2345
|
-
import
|
|
2715
|
+
import yargs6 from "yargs";
|
|
2346
2716
|
|
|
2347
2717
|
// src/commands/canvas/commands/dataType/get.ts
|
|
2348
2718
|
import { DataTypeClient } from "@uniformdev/canvas";
|
|
@@ -2350,12 +2720,12 @@ var DataTypeGetModule = {
|
|
|
2350
2720
|
command: "get <id>",
|
|
2351
2721
|
describe: "Get a data type",
|
|
2352
2722
|
aliases: ["ls"],
|
|
2353
|
-
builder: (
|
|
2723
|
+
builder: (yargs27) => withConfiguration(
|
|
2354
2724
|
withFormatOptions(
|
|
2355
2725
|
withApiOptions(
|
|
2356
2726
|
withProjectOptions(
|
|
2357
2727
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2358
|
-
|
|
2728
|
+
yargs27.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
2359
2729
|
)
|
|
2360
2730
|
)
|
|
2361
2731
|
)
|
|
@@ -2378,7 +2748,7 @@ var DataTypeListModule = {
|
|
|
2378
2748
|
command: "list",
|
|
2379
2749
|
describe: "List data types",
|
|
2380
2750
|
aliases: ["ls"],
|
|
2381
|
-
builder: (
|
|
2751
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
2382
2752
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2383
2753
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2384
2754
|
const client = new DataTypeClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2431,11 +2801,11 @@ function createDataTypeEngineDataSource({
|
|
|
2431
2801
|
var DataTypePullModule = {
|
|
2432
2802
|
command: "pull <directory>",
|
|
2433
2803
|
describe: "Pulls all data types to local files in a directory",
|
|
2434
|
-
builder: (
|
|
2804
|
+
builder: (yargs27) => withConfiguration(
|
|
2435
2805
|
withApiOptions(
|
|
2436
2806
|
withProjectOptions(
|
|
2437
2807
|
withDiffOptions(
|
|
2438
|
-
|
|
2808
|
+
yargs27.positional("directory", {
|
|
2439
2809
|
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.",
|
|
2440
2810
|
type: "string"
|
|
2441
2811
|
}).option("format", {
|
|
@@ -2517,11 +2887,11 @@ import { DataTypeClient as DataTypeClient4 } from "@uniformdev/canvas";
|
|
|
2517
2887
|
var DataTypePushModule = {
|
|
2518
2888
|
command: "push <directory>",
|
|
2519
2889
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
2520
|
-
builder: (
|
|
2890
|
+
builder: (yargs27) => withConfiguration(
|
|
2521
2891
|
withApiOptions(
|
|
2522
2892
|
withProjectOptions(
|
|
2523
2893
|
withDiffOptions(
|
|
2524
|
-
|
|
2894
|
+
yargs27.positional("directory", {
|
|
2525
2895
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
2526
2896
|
type: "string"
|
|
2527
2897
|
}).option("what-if", {
|
|
@@ -2591,10 +2961,10 @@ var DataTypeRemoveModule = {
|
|
|
2591
2961
|
command: "remove <id>",
|
|
2592
2962
|
aliases: ["delete", "rm"],
|
|
2593
2963
|
describe: "Delete a data type",
|
|
2594
|
-
builder: (
|
|
2964
|
+
builder: (yargs27) => withConfiguration(
|
|
2595
2965
|
withApiOptions(
|
|
2596
2966
|
withProjectOptions(
|
|
2597
|
-
|
|
2967
|
+
yargs27.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
2598
2968
|
)
|
|
2599
2969
|
)
|
|
2600
2970
|
),
|
|
@@ -2611,10 +2981,10 @@ var DataTypeUpdateModule = {
|
|
|
2611
2981
|
command: "update <filename>",
|
|
2612
2982
|
aliases: ["put"],
|
|
2613
2983
|
describe: "Insert or update a data type",
|
|
2614
|
-
builder: (
|
|
2984
|
+
builder: (yargs27) => withConfiguration(
|
|
2615
2985
|
withApiOptions(
|
|
2616
2986
|
withProjectOptions(
|
|
2617
|
-
|
|
2987
|
+
yargs27.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
2618
2988
|
)
|
|
2619
2989
|
)
|
|
2620
2990
|
),
|
|
@@ -2631,26 +3001,26 @@ var DataTypeModule = {
|
|
|
2631
3001
|
command: "datatype <command>",
|
|
2632
3002
|
aliases: ["dt"],
|
|
2633
3003
|
describe: "Commands for Data Type definitions",
|
|
2634
|
-
builder: (
|
|
3004
|
+
builder: (yargs27) => yargs27.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
2635
3005
|
handler: () => {
|
|
2636
|
-
|
|
3006
|
+
yargs6.help();
|
|
2637
3007
|
}
|
|
2638
3008
|
};
|
|
2639
3009
|
|
|
2640
3010
|
// src/commands/canvas/commands/entry.ts
|
|
2641
|
-
import
|
|
3011
|
+
import yargs7 from "yargs";
|
|
2642
3012
|
|
|
2643
3013
|
// src/commands/canvas/commands/entry/get.ts
|
|
2644
3014
|
import { ContentClient as ContentClient7 } from "@uniformdev/canvas";
|
|
2645
3015
|
var EntryGetModule = {
|
|
2646
3016
|
command: "get <id>",
|
|
2647
3017
|
describe: "Get an entry",
|
|
2648
|
-
builder: (
|
|
3018
|
+
builder: (yargs27) => withConfiguration(
|
|
2649
3019
|
withFormatOptions(
|
|
2650
3020
|
withApiOptions(
|
|
2651
3021
|
withProjectOptions(
|
|
2652
3022
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2653
|
-
|
|
3023
|
+
yargs27.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
|
|
2654
3024
|
)
|
|
2655
3025
|
)
|
|
2656
3026
|
)
|
|
@@ -2671,7 +3041,7 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
|
|
|
2671
3041
|
var EntryListModule = {
|
|
2672
3042
|
command: "list",
|
|
2673
3043
|
describe: "List entries",
|
|
2674
|
-
builder: (
|
|
3044
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
2675
3045
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
2676
3046
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2677
3047
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -2729,12 +3099,12 @@ function createEntryEngineDataSource({
|
|
|
2729
3099
|
var EntryPullModule = {
|
|
2730
3100
|
command: "pull <directory>",
|
|
2731
3101
|
describe: "Pulls all entries to local files in a directory",
|
|
2732
|
-
builder: (
|
|
3102
|
+
builder: (yargs27) => withConfiguration(
|
|
2733
3103
|
withApiOptions(
|
|
2734
3104
|
withProjectOptions(
|
|
2735
3105
|
withStateOptions(
|
|
2736
3106
|
withDiffOptions(
|
|
2737
|
-
|
|
3107
|
+
yargs27.positional("directory", {
|
|
2738
3108
|
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.",
|
|
2739
3109
|
type: "string"
|
|
2740
3110
|
}).option("format", {
|
|
@@ -2818,12 +3188,12 @@ import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
|
2818
3188
|
var EntryPushModule = {
|
|
2819
3189
|
command: "push <directory>",
|
|
2820
3190
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
2821
|
-
builder: (
|
|
3191
|
+
builder: (yargs27) => withConfiguration(
|
|
2822
3192
|
withApiOptions(
|
|
2823
3193
|
withProjectOptions(
|
|
2824
3194
|
withStateOptions(
|
|
2825
3195
|
withDiffOptions(
|
|
2826
|
-
|
|
3196
|
+
yargs27.positional("directory", {
|
|
2827
3197
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
2828
3198
|
type: "string"
|
|
2829
3199
|
}).option("what-if", {
|
|
@@ -2895,10 +3265,10 @@ var EntryRemoveModule = {
|
|
|
2895
3265
|
command: "remove <id>",
|
|
2896
3266
|
aliases: ["delete", "rm"],
|
|
2897
3267
|
describe: "Delete an entry",
|
|
2898
|
-
builder: (
|
|
3268
|
+
builder: (yargs27) => withConfiguration(
|
|
2899
3269
|
withApiOptions(
|
|
2900
3270
|
withProjectOptions(
|
|
2901
|
-
|
|
3271
|
+
yargs27.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
2902
3272
|
)
|
|
2903
3273
|
)
|
|
2904
3274
|
),
|
|
@@ -2915,10 +3285,10 @@ var EntryUpdateModule = {
|
|
|
2915
3285
|
command: "update <filename>",
|
|
2916
3286
|
aliases: ["put"],
|
|
2917
3287
|
describe: "Insert or update an entry",
|
|
2918
|
-
builder: (
|
|
3288
|
+
builder: (yargs27) => withConfiguration(
|
|
2919
3289
|
withApiOptions(
|
|
2920
3290
|
withProjectOptions(
|
|
2921
|
-
|
|
3291
|
+
yargs27.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
2922
3292
|
)
|
|
2923
3293
|
)
|
|
2924
3294
|
),
|
|
@@ -2934,14 +3304,14 @@ var EntryUpdateModule = {
|
|
|
2934
3304
|
var EntryModule = {
|
|
2935
3305
|
command: "entry <command>",
|
|
2936
3306
|
describe: "Commands for Entries",
|
|
2937
|
-
builder: (
|
|
3307
|
+
builder: (yargs27) => yargs27.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).demandCommand(),
|
|
2938
3308
|
handler: () => {
|
|
2939
|
-
|
|
3309
|
+
yargs7.help();
|
|
2940
3310
|
}
|
|
2941
3311
|
};
|
|
2942
3312
|
|
|
2943
3313
|
// src/commands/canvas/commands/pattern.ts
|
|
2944
|
-
import
|
|
3314
|
+
import yargs8 from "yargs";
|
|
2945
3315
|
|
|
2946
3316
|
// src/commands/canvas/commands/pattern/get.ts
|
|
2947
3317
|
var PatternGetModule = {
|
|
@@ -2953,12 +3323,12 @@ var PatternGetModule = {
|
|
|
2953
3323
|
var PatternListModule = {
|
|
2954
3324
|
...CompositionListModule,
|
|
2955
3325
|
describe: "List patterns",
|
|
2956
|
-
builder: (
|
|
3326
|
+
builder: (yargs27) => withFormatOptions(
|
|
2957
3327
|
withConfiguration(
|
|
2958
3328
|
withApiOptions(
|
|
2959
3329
|
withProjectOptions(
|
|
2960
3330
|
withStateOptions(
|
|
2961
|
-
|
|
3331
|
+
yargs27.options({
|
|
2962
3332
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
2963
3333
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
2964
3334
|
resolvePatterns: {
|
|
@@ -2996,11 +3366,11 @@ var PatternListModule = {
|
|
|
2996
3366
|
var PatternPublishModule = {
|
|
2997
3367
|
...CompositionPublishModule,
|
|
2998
3368
|
describe: "Publishes pattern(s)",
|
|
2999
|
-
builder: (
|
|
3369
|
+
builder: (yargs27) => withConfiguration(
|
|
3000
3370
|
withApiOptions(
|
|
3001
3371
|
withProjectOptions(
|
|
3002
3372
|
withDiffOptions(
|
|
3003
|
-
|
|
3373
|
+
yargs27.positional("ids", {
|
|
3004
3374
|
describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
3005
3375
|
type: "string"
|
|
3006
3376
|
}).option("all", {
|
|
@@ -3038,12 +3408,12 @@ var PatternPublishModule = {
|
|
|
3038
3408
|
var PatternPullModule = {
|
|
3039
3409
|
...CompositionPullModule,
|
|
3040
3410
|
describe: "Pulls all patterns to local files in a directory",
|
|
3041
|
-
builder: (
|
|
3411
|
+
builder: (yargs27) => withConfiguration(
|
|
3042
3412
|
withApiOptions(
|
|
3043
3413
|
withProjectOptions(
|
|
3044
3414
|
withStateOptions(
|
|
3045
3415
|
withDiffOptions(
|
|
3046
|
-
|
|
3416
|
+
yargs27.positional("directory", {
|
|
3047
3417
|
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.",
|
|
3048
3418
|
type: "string"
|
|
3049
3419
|
}).option("format", {
|
|
@@ -3081,12 +3451,12 @@ var PatternPullModule = {
|
|
|
3081
3451
|
var PatternPushModule = {
|
|
3082
3452
|
...CompositionPushModule,
|
|
3083
3453
|
describe: "Pushes all patterns from files in a directory to Uniform Canvas",
|
|
3084
|
-
builder: (
|
|
3454
|
+
builder: (yargs27) => withConfiguration(
|
|
3085
3455
|
withApiOptions(
|
|
3086
3456
|
withProjectOptions(
|
|
3087
3457
|
withStateOptions(
|
|
3088
3458
|
withDiffOptions(
|
|
3089
|
-
|
|
3459
|
+
yargs27.positional("directory", {
|
|
3090
3460
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
3091
3461
|
type: "string"
|
|
3092
3462
|
}).option("what-if", {
|
|
@@ -3124,10 +3494,10 @@ var PatternRemoveModule = {
|
|
|
3124
3494
|
var PatternUnpublishModule = {
|
|
3125
3495
|
command: "unpublish [ids]",
|
|
3126
3496
|
describe: "Unpublish a pattern(s)",
|
|
3127
|
-
builder: (
|
|
3497
|
+
builder: (yargs27) => withConfiguration(
|
|
3128
3498
|
withApiOptions(
|
|
3129
3499
|
withProjectOptions(
|
|
3130
|
-
|
|
3500
|
+
yargs27.positional("ids", {
|
|
3131
3501
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
3132
3502
|
type: "string"
|
|
3133
3503
|
}).option("all", {
|
|
@@ -3166,26 +3536,26 @@ var PatternUpdateModule = {
|
|
|
3166
3536
|
var PatternModule = {
|
|
3167
3537
|
command: "pattern <command>",
|
|
3168
3538
|
describe: "Commands for Canvas patterns",
|
|
3169
|
-
builder: (
|
|
3539
|
+
builder: (yargs27) => yargs27.command(PatternPullModule).command(PatternPushModule).command(PatternGetModule).command(PatternRemoveModule).command(PatternListModule).command(PatternUpdateModule).command(PatternPublishModule).command(PatternUnpublishModule).demandCommand(),
|
|
3170
3540
|
handler: () => {
|
|
3171
|
-
|
|
3541
|
+
yargs8.help();
|
|
3172
3542
|
}
|
|
3173
3543
|
};
|
|
3174
3544
|
|
|
3175
3545
|
// src/commands/canvas/commands/prompts.ts
|
|
3176
|
-
import
|
|
3546
|
+
import yargs9 from "yargs";
|
|
3177
3547
|
|
|
3178
3548
|
// src/commands/canvas/commands/prompts/get.ts
|
|
3179
3549
|
import { PromptClient } from "@uniformdev/canvas";
|
|
3180
3550
|
var PromptGetModule = {
|
|
3181
3551
|
command: "get <id>",
|
|
3182
3552
|
describe: "Get a prompt",
|
|
3183
|
-
builder: (
|
|
3553
|
+
builder: (yargs27) => withConfiguration(
|
|
3184
3554
|
withFormatOptions(
|
|
3185
3555
|
withApiOptions(
|
|
3186
3556
|
withProjectOptions(
|
|
3187
3557
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3188
|
-
|
|
3558
|
+
yargs27.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
3189
3559
|
)
|
|
3190
3560
|
)
|
|
3191
3561
|
)
|
|
@@ -3206,7 +3576,7 @@ import { PromptClient as PromptClient2 } from "@uniformdev/canvas";
|
|
|
3206
3576
|
var PromptListModule = {
|
|
3207
3577
|
command: "list",
|
|
3208
3578
|
describe: "List prompts",
|
|
3209
|
-
builder: (
|
|
3579
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
3210
3580
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3211
3581
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3212
3582
|
const client = new PromptClient2({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
@@ -3253,12 +3623,12 @@ function createPromptEngineDataSource({
|
|
|
3253
3623
|
var PromptPullModule = {
|
|
3254
3624
|
command: "pull <directory>",
|
|
3255
3625
|
describe: "Pulls all entries to local files in a directory",
|
|
3256
|
-
builder: (
|
|
3626
|
+
builder: (yargs27) => withConfiguration(
|
|
3257
3627
|
withApiOptions(
|
|
3258
3628
|
withProjectOptions(
|
|
3259
3629
|
withStateOptions(
|
|
3260
3630
|
withDiffOptions(
|
|
3261
|
-
|
|
3631
|
+
yargs27.positional("directory", {
|
|
3262
3632
|
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.",
|
|
3263
3633
|
type: "string"
|
|
3264
3634
|
}).option("format", {
|
|
@@ -3341,12 +3711,12 @@ import { PromptClient as PromptClient4 } from "@uniformdev/canvas";
|
|
|
3341
3711
|
var PromptPushModule = {
|
|
3342
3712
|
command: "push <directory>",
|
|
3343
3713
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
3344
|
-
builder: (
|
|
3714
|
+
builder: (yargs27) => withConfiguration(
|
|
3345
3715
|
withApiOptions(
|
|
3346
3716
|
withProjectOptions(
|
|
3347
3717
|
withStateOptions(
|
|
3348
3718
|
withDiffOptions(
|
|
3349
|
-
|
|
3719
|
+
yargs27.positional("directory", {
|
|
3350
3720
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
3351
3721
|
type: "string"
|
|
3352
3722
|
}).option("what-if", {
|
|
@@ -3417,9 +3787,9 @@ var PromptRemoveModule = {
|
|
|
3417
3787
|
command: "remove <id>",
|
|
3418
3788
|
aliases: ["delete", "rm"],
|
|
3419
3789
|
describe: "Delete a prompt",
|
|
3420
|
-
builder: (
|
|
3790
|
+
builder: (yargs27) => withConfiguration(
|
|
3421
3791
|
withApiOptions(
|
|
3422
|
-
withProjectOptions(
|
|
3792
|
+
withProjectOptions(yargs27.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
3423
3793
|
)
|
|
3424
3794
|
),
|
|
3425
3795
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -3435,10 +3805,10 @@ var PromptUpdateModule = {
|
|
|
3435
3805
|
command: "update <filename>",
|
|
3436
3806
|
aliases: ["put"],
|
|
3437
3807
|
describe: "Insert or update a prompt",
|
|
3438
|
-
builder: (
|
|
3808
|
+
builder: (yargs27) => withConfiguration(
|
|
3439
3809
|
withApiOptions(
|
|
3440
3810
|
withProjectOptions(
|
|
3441
|
-
|
|
3811
|
+
yargs27.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
3442
3812
|
)
|
|
3443
3813
|
)
|
|
3444
3814
|
),
|
|
@@ -3455,9 +3825,9 @@ var PromptModule = {
|
|
|
3455
3825
|
command: "prompt <command>",
|
|
3456
3826
|
aliases: ["dt"],
|
|
3457
3827
|
describe: "Commands for AI Prompt definitions",
|
|
3458
|
-
builder: (
|
|
3828
|
+
builder: (yargs27) => yargs27.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
3459
3829
|
handler: () => {
|
|
3460
|
-
|
|
3830
|
+
yargs9.help();
|
|
3461
3831
|
}
|
|
3462
3832
|
};
|
|
3463
3833
|
|
|
@@ -3466,28 +3836,28 @@ var CanvasCommand = {
|
|
|
3466
3836
|
command: "canvas <command>",
|
|
3467
3837
|
aliases: ["cv", "pm", "presentation"],
|
|
3468
3838
|
describe: "Uniform Canvas commands",
|
|
3469
|
-
builder: (
|
|
3839
|
+
builder: (yargs27) => yargs27.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(CategoryModule).command(PatternModule).command(ContentTypeModule).command(EntryModule).command(PromptModule).command(AssetModule).demandCommand(),
|
|
3470
3840
|
handler: () => {
|
|
3471
|
-
|
|
3841
|
+
yargs10.showHelp();
|
|
3472
3842
|
}
|
|
3473
3843
|
};
|
|
3474
3844
|
|
|
3475
3845
|
// src/commands/context/index.ts
|
|
3476
|
-
import
|
|
3846
|
+
import yargs17 from "yargs";
|
|
3477
3847
|
|
|
3478
3848
|
// src/commands/context/commands/aggregate.ts
|
|
3479
|
-
import
|
|
3849
|
+
import yargs11 from "yargs";
|
|
3480
3850
|
|
|
3481
3851
|
// src/commands/context/commands/aggregate/get.ts
|
|
3482
3852
|
import { UncachedAggregateClient } from "@uniformdev/context/api";
|
|
3483
3853
|
var AggregateGetModule = {
|
|
3484
3854
|
command: "get <id>",
|
|
3485
3855
|
describe: "Fetch an aggregate",
|
|
3486
|
-
builder: (
|
|
3856
|
+
builder: (yargs27) => withConfiguration(
|
|
3487
3857
|
withFormatOptions(
|
|
3488
3858
|
withApiOptions(
|
|
3489
3859
|
withProjectOptions(
|
|
3490
|
-
|
|
3860
|
+
yargs27.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
3491
3861
|
)
|
|
3492
3862
|
)
|
|
3493
3863
|
)
|
|
@@ -3511,7 +3881,7 @@ var AggregateListModule = {
|
|
|
3511
3881
|
command: "list",
|
|
3512
3882
|
describe: "List aggregates",
|
|
3513
3883
|
aliases: ["ls"],
|
|
3514
|
-
builder: (
|
|
3884
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
3515
3885
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3516
3886
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3517
3887
|
const client = new UncachedAggregateClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3577,11 +3947,11 @@ function writeContextPackage(filename, packageContents) {
|
|
|
3577
3947
|
var AggregatePullModule = {
|
|
3578
3948
|
command: "pull <directory>",
|
|
3579
3949
|
describe: "Pulls all aggregates to local files in a directory",
|
|
3580
|
-
builder: (
|
|
3950
|
+
builder: (yargs27) => withConfiguration(
|
|
3581
3951
|
withApiOptions(
|
|
3582
3952
|
withProjectOptions(
|
|
3583
3953
|
withDiffOptions(
|
|
3584
|
-
|
|
3954
|
+
yargs27.positional("directory", {
|
|
3585
3955
|
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.",
|
|
3586
3956
|
type: "string"
|
|
3587
3957
|
}).option("format", {
|
|
@@ -3656,11 +4026,11 @@ import { UncachedAggregateClient as UncachedAggregateClient4 } from "@uniformdev
|
|
|
3656
4026
|
var AggregatePushModule = {
|
|
3657
4027
|
command: "push <directory>",
|
|
3658
4028
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
3659
|
-
builder: (
|
|
4029
|
+
builder: (yargs27) => withConfiguration(
|
|
3660
4030
|
withApiOptions(
|
|
3661
4031
|
withProjectOptions(
|
|
3662
4032
|
withDiffOptions(
|
|
3663
|
-
|
|
4033
|
+
yargs27.positional("directory", {
|
|
3664
4034
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
3665
4035
|
type: "string"
|
|
3666
4036
|
}).option("what-if", {
|
|
@@ -3725,10 +4095,10 @@ var AggregateRemoveModule = {
|
|
|
3725
4095
|
command: "remove <id>",
|
|
3726
4096
|
aliases: ["delete", "rm"],
|
|
3727
4097
|
describe: "Delete an aggregate",
|
|
3728
|
-
builder: (
|
|
4098
|
+
builder: (yargs27) => withConfiguration(
|
|
3729
4099
|
withApiOptions(
|
|
3730
4100
|
withProjectOptions(
|
|
3731
|
-
|
|
4101
|
+
yargs27.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
3732
4102
|
)
|
|
3733
4103
|
)
|
|
3734
4104
|
),
|
|
@@ -3745,10 +4115,10 @@ var AggregateUpdateModule = {
|
|
|
3745
4115
|
command: "update <filename>",
|
|
3746
4116
|
aliases: ["put"],
|
|
3747
4117
|
describe: "Insert or update an aggregate",
|
|
3748
|
-
builder: (
|
|
4118
|
+
builder: (yargs27) => withConfiguration(
|
|
3749
4119
|
withApiOptions(
|
|
3750
4120
|
withProjectOptions(
|
|
3751
|
-
|
|
4121
|
+
yargs27.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
3752
4122
|
)
|
|
3753
4123
|
)
|
|
3754
4124
|
),
|
|
@@ -3765,25 +4135,25 @@ var AggregateModule = {
|
|
|
3765
4135
|
command: "aggregate <command>",
|
|
3766
4136
|
aliases: ["agg", "intent", "audience"],
|
|
3767
4137
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
3768
|
-
builder: (
|
|
4138
|
+
builder: (yargs27) => yargs27.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
3769
4139
|
handler: () => {
|
|
3770
|
-
|
|
4140
|
+
yargs11.help();
|
|
3771
4141
|
}
|
|
3772
4142
|
};
|
|
3773
4143
|
|
|
3774
4144
|
// src/commands/context/commands/enrichment.ts
|
|
3775
|
-
import
|
|
4145
|
+
import yargs12 from "yargs";
|
|
3776
4146
|
|
|
3777
4147
|
// src/commands/context/commands/enrichment/get.ts
|
|
3778
4148
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
3779
4149
|
var EnrichmentGetModule = {
|
|
3780
4150
|
command: "get <id>",
|
|
3781
4151
|
describe: "Fetch an enrichment category and its values",
|
|
3782
|
-
builder: (
|
|
4152
|
+
builder: (yargs27) => withFormatOptions(
|
|
3783
4153
|
withConfiguration(
|
|
3784
4154
|
withApiOptions(
|
|
3785
4155
|
withProjectOptions(
|
|
3786
|
-
|
|
4156
|
+
yargs27.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
3787
4157
|
)
|
|
3788
4158
|
)
|
|
3789
4159
|
)
|
|
@@ -3808,7 +4178,7 @@ var EnrichmentListModule = {
|
|
|
3808
4178
|
command: "list",
|
|
3809
4179
|
describe: "List enrichments",
|
|
3810
4180
|
aliases: ["ls"],
|
|
3811
|
-
builder: (
|
|
4181
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
3812
4182
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3813
4183
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3814
4184
|
const client = new UncachedEnrichmentClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -3909,11 +4279,11 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
3909
4279
|
var EnrichmentPullModule = {
|
|
3910
4280
|
command: "pull <directory>",
|
|
3911
4281
|
describe: "Pulls all enrichments to local files in a directory",
|
|
3912
|
-
builder: (
|
|
4282
|
+
builder: (yargs27) => withConfiguration(
|
|
3913
4283
|
withApiOptions(
|
|
3914
4284
|
withProjectOptions(
|
|
3915
4285
|
withDiffOptions(
|
|
3916
|
-
|
|
4286
|
+
yargs27.positional("directory", {
|
|
3917
4287
|
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.",
|
|
3918
4288
|
type: "string"
|
|
3919
4289
|
}).option("format", {
|
|
@@ -3988,11 +4358,11 @@ import { UncachedEnrichmentClient as UncachedEnrichmentClient4 } from "@uniformd
|
|
|
3988
4358
|
var EnrichmentPushModule = {
|
|
3989
4359
|
command: "push <directory>",
|
|
3990
4360
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
3991
|
-
builder: (
|
|
4361
|
+
builder: (yargs27) => withConfiguration(
|
|
3992
4362
|
withApiOptions(
|
|
3993
4363
|
withProjectOptions(
|
|
3994
4364
|
withDiffOptions(
|
|
3995
|
-
|
|
4365
|
+
yargs27.positional("directory", {
|
|
3996
4366
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
3997
4367
|
type: "string"
|
|
3998
4368
|
}).option("what-if", {
|
|
@@ -4056,10 +4426,10 @@ var EnrichmentRemoveModule = {
|
|
|
4056
4426
|
command: "remove <id>",
|
|
4057
4427
|
aliases: ["delete", "rm"],
|
|
4058
4428
|
describe: "Delete an enrichment category and its values",
|
|
4059
|
-
builder: (
|
|
4429
|
+
builder: (yargs27) => withConfiguration(
|
|
4060
4430
|
withApiOptions(
|
|
4061
4431
|
withProjectOptions(
|
|
4062
|
-
|
|
4432
|
+
yargs27.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
4063
4433
|
)
|
|
4064
4434
|
)
|
|
4065
4435
|
),
|
|
@@ -4075,14 +4445,14 @@ var EnrichmentModule = {
|
|
|
4075
4445
|
command: "enrichment <command>",
|
|
4076
4446
|
aliases: ["enr"],
|
|
4077
4447
|
describe: "Commands for Context enrichments",
|
|
4078
|
-
builder: (
|
|
4448
|
+
builder: (yargs27) => yargs27.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
4079
4449
|
handler: () => {
|
|
4080
|
-
|
|
4450
|
+
yargs12.help();
|
|
4081
4451
|
}
|
|
4082
4452
|
};
|
|
4083
4453
|
|
|
4084
4454
|
// src/commands/context/commands/manifest.ts
|
|
4085
|
-
import
|
|
4455
|
+
import yargs13 from "yargs";
|
|
4086
4456
|
|
|
4087
4457
|
// src/commands/context/commands/manifest/get.ts
|
|
4088
4458
|
import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -4093,10 +4463,10 @@ var ManifestGetModule = {
|
|
|
4093
4463
|
command: "get [output]",
|
|
4094
4464
|
aliases: ["dl", "download"],
|
|
4095
4465
|
describe: "Download the Uniform Context manifest for a project",
|
|
4096
|
-
builder: (
|
|
4466
|
+
builder: (yargs27) => withConfiguration(
|
|
4097
4467
|
withApiOptions(
|
|
4098
4468
|
withProjectOptions(
|
|
4099
|
-
|
|
4469
|
+
yargs27.option("preview", {
|
|
4100
4470
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
4101
4471
|
default: false,
|
|
4102
4472
|
type: "boolean",
|
|
@@ -4158,7 +4528,7 @@ import { exit as exit2 } from "process";
|
|
|
4158
4528
|
var ManifestPublishModule = {
|
|
4159
4529
|
command: "publish",
|
|
4160
4530
|
describe: "Publish the Uniform Context manifest for a project",
|
|
4161
|
-
builder: (
|
|
4531
|
+
builder: (yargs27) => withConfiguration(withApiOptions(withProjectOptions(yargs27))),
|
|
4162
4532
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
4163
4533
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4164
4534
|
try {
|
|
@@ -4191,25 +4561,25 @@ var ManifestModule = {
|
|
|
4191
4561
|
command: "manifest <command>",
|
|
4192
4562
|
describe: "Commands for context manifests",
|
|
4193
4563
|
aliases: ["man"],
|
|
4194
|
-
builder: (
|
|
4564
|
+
builder: (yargs27) => yargs27.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
4195
4565
|
handler: () => {
|
|
4196
|
-
|
|
4566
|
+
yargs13.help();
|
|
4197
4567
|
}
|
|
4198
4568
|
};
|
|
4199
4569
|
|
|
4200
4570
|
// src/commands/context/commands/quirk.ts
|
|
4201
|
-
import
|
|
4571
|
+
import yargs14 from "yargs";
|
|
4202
4572
|
|
|
4203
4573
|
// src/commands/context/commands/quirk/get.ts
|
|
4204
4574
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
4205
4575
|
var QuirkGetModule = {
|
|
4206
4576
|
command: "get <id>",
|
|
4207
4577
|
describe: "Fetch a quirk",
|
|
4208
|
-
builder: (
|
|
4578
|
+
builder: (yargs27) => withConfiguration(
|
|
4209
4579
|
withFormatOptions(
|
|
4210
4580
|
withApiOptions(
|
|
4211
4581
|
withProjectOptions(
|
|
4212
|
-
|
|
4582
|
+
yargs27.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
4213
4583
|
)
|
|
4214
4584
|
)
|
|
4215
4585
|
)
|
|
@@ -4233,11 +4603,11 @@ var QuirkListModule = {
|
|
|
4233
4603
|
command: "list",
|
|
4234
4604
|
describe: "List quirks",
|
|
4235
4605
|
aliases: ["ls"],
|
|
4236
|
-
builder: (
|
|
4606
|
+
builder: (yargs27) => withConfiguration(
|
|
4237
4607
|
withFormatOptions(
|
|
4238
4608
|
withApiOptions(
|
|
4239
4609
|
withProjectOptions(
|
|
4240
|
-
|
|
4610
|
+
yargs27.option("withIntegrations", {
|
|
4241
4611
|
alias: ["i"],
|
|
4242
4612
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
4243
4613
|
type: "boolean"
|
|
@@ -4294,11 +4664,11 @@ function createQuirkEngineDataSource({
|
|
|
4294
4664
|
var QuirkPullModule = {
|
|
4295
4665
|
command: "pull <directory>",
|
|
4296
4666
|
describe: "Pulls all quirks to local files in a directory",
|
|
4297
|
-
builder: (
|
|
4667
|
+
builder: (yargs27) => withConfiguration(
|
|
4298
4668
|
withApiOptions(
|
|
4299
4669
|
withProjectOptions(
|
|
4300
4670
|
withDiffOptions(
|
|
4301
|
-
|
|
4671
|
+
yargs27.positional("directory", {
|
|
4302
4672
|
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.",
|
|
4303
4673
|
type: "string"
|
|
4304
4674
|
}).option("format", {
|
|
@@ -4373,11 +4743,11 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
4373
4743
|
var QuirkPushModule = {
|
|
4374
4744
|
command: "push <directory>",
|
|
4375
4745
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
4376
|
-
builder: (
|
|
4746
|
+
builder: (yargs27) => withConfiguration(
|
|
4377
4747
|
withApiOptions(
|
|
4378
4748
|
withProjectOptions(
|
|
4379
4749
|
withDiffOptions(
|
|
4380
|
-
|
|
4750
|
+
yargs27.positional("directory", {
|
|
4381
4751
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
4382
4752
|
type: "string"
|
|
4383
4753
|
}).option("what-if", {
|
|
@@ -4441,10 +4811,10 @@ var QuirkRemoveModule = {
|
|
|
4441
4811
|
command: "remove <id>",
|
|
4442
4812
|
aliases: ["delete", "rm"],
|
|
4443
4813
|
describe: "Delete a quirk",
|
|
4444
|
-
builder: (
|
|
4814
|
+
builder: (yargs27) => withConfiguration(
|
|
4445
4815
|
withApiOptions(
|
|
4446
4816
|
withProjectOptions(
|
|
4447
|
-
|
|
4817
|
+
yargs27.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
4448
4818
|
)
|
|
4449
4819
|
)
|
|
4450
4820
|
),
|
|
@@ -4461,10 +4831,10 @@ var QuirkUpdateModule = {
|
|
|
4461
4831
|
command: "update <filename>",
|
|
4462
4832
|
aliases: ["put"],
|
|
4463
4833
|
describe: "Insert or update a quirk",
|
|
4464
|
-
builder: (
|
|
4834
|
+
builder: (yargs27) => withConfiguration(
|
|
4465
4835
|
withApiOptions(
|
|
4466
4836
|
withProjectOptions(
|
|
4467
|
-
|
|
4837
|
+
yargs27.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
4468
4838
|
)
|
|
4469
4839
|
)
|
|
4470
4840
|
),
|
|
@@ -4481,25 +4851,25 @@ var QuirkModule = {
|
|
|
4481
4851
|
command: "quirk <command>",
|
|
4482
4852
|
aliases: ["qk"],
|
|
4483
4853
|
describe: "Commands for Context quirks",
|
|
4484
|
-
builder: (
|
|
4854
|
+
builder: (yargs27) => yargs27.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
4485
4855
|
handler: () => {
|
|
4486
|
-
|
|
4856
|
+
yargs14.help();
|
|
4487
4857
|
}
|
|
4488
4858
|
};
|
|
4489
4859
|
|
|
4490
4860
|
// src/commands/context/commands/signal.ts
|
|
4491
|
-
import
|
|
4861
|
+
import yargs15 from "yargs";
|
|
4492
4862
|
|
|
4493
4863
|
// src/commands/context/commands/signal/get.ts
|
|
4494
4864
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
4495
4865
|
var SignalGetModule = {
|
|
4496
4866
|
command: "get <id>",
|
|
4497
4867
|
describe: "Fetch a signal",
|
|
4498
|
-
builder: (
|
|
4868
|
+
builder: (yargs27) => withConfiguration(
|
|
4499
4869
|
withFormatOptions(
|
|
4500
4870
|
withApiOptions(
|
|
4501
4871
|
withProjectOptions(
|
|
4502
|
-
|
|
4872
|
+
yargs27.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
4503
4873
|
)
|
|
4504
4874
|
)
|
|
4505
4875
|
)
|
|
@@ -4523,7 +4893,7 @@ var SignalListModule = {
|
|
|
4523
4893
|
command: "list",
|
|
4524
4894
|
describe: "List signals",
|
|
4525
4895
|
aliases: ["ls"],
|
|
4526
|
-
builder: (
|
|
4896
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
4527
4897
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4528
4898
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4529
4899
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4572,11 +4942,11 @@ function createSignalEngineDataSource({
|
|
|
4572
4942
|
var SignalPullModule = {
|
|
4573
4943
|
command: "pull <directory>",
|
|
4574
4944
|
describe: "Pulls all signals to local files in a directory",
|
|
4575
|
-
builder: (
|
|
4945
|
+
builder: (yargs27) => withConfiguration(
|
|
4576
4946
|
withApiOptions(
|
|
4577
4947
|
withProjectOptions(
|
|
4578
4948
|
withDiffOptions(
|
|
4579
|
-
|
|
4949
|
+
yargs27.positional("directory", {
|
|
4580
4950
|
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.",
|
|
4581
4951
|
type: "string"
|
|
4582
4952
|
}).option("format", {
|
|
@@ -4651,11 +5021,11 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
4651
5021
|
var SignalPushModule = {
|
|
4652
5022
|
command: "push <directory>",
|
|
4653
5023
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
4654
|
-
builder: (
|
|
5024
|
+
builder: (yargs27) => withConfiguration(
|
|
4655
5025
|
withApiOptions(
|
|
4656
5026
|
withProjectOptions(
|
|
4657
5027
|
withDiffOptions(
|
|
4658
|
-
|
|
5028
|
+
yargs27.positional("directory", {
|
|
4659
5029
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
4660
5030
|
type: "string"
|
|
4661
5031
|
}).option("what-if", {
|
|
@@ -4719,10 +5089,10 @@ var SignalRemoveModule = {
|
|
|
4719
5089
|
command: "remove <id>",
|
|
4720
5090
|
aliases: ["delete", "rm"],
|
|
4721
5091
|
describe: "Delete a signal",
|
|
4722
|
-
builder: (
|
|
5092
|
+
builder: (yargs27) => withConfiguration(
|
|
4723
5093
|
withApiOptions(
|
|
4724
5094
|
withProjectOptions(
|
|
4725
|
-
|
|
5095
|
+
yargs27.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
4726
5096
|
)
|
|
4727
5097
|
)
|
|
4728
5098
|
),
|
|
@@ -4739,10 +5109,10 @@ var SignalUpdateModule = {
|
|
|
4739
5109
|
command: "update <filename>",
|
|
4740
5110
|
aliases: ["put"],
|
|
4741
5111
|
describe: "Insert or update a signal",
|
|
4742
|
-
builder: (
|
|
5112
|
+
builder: (yargs27) => withConfiguration(
|
|
4743
5113
|
withApiOptions(
|
|
4744
5114
|
withProjectOptions(
|
|
4745
|
-
|
|
5115
|
+
yargs27.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
4746
5116
|
)
|
|
4747
5117
|
)
|
|
4748
5118
|
),
|
|
@@ -4759,25 +5129,25 @@ var SignalModule = {
|
|
|
4759
5129
|
command: "signal <command>",
|
|
4760
5130
|
aliases: ["sig"],
|
|
4761
5131
|
describe: "Commands for Context signals",
|
|
4762
|
-
builder: (
|
|
5132
|
+
builder: (yargs27) => yargs27.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
4763
5133
|
handler: () => {
|
|
4764
|
-
|
|
5134
|
+
yargs15.help();
|
|
4765
5135
|
}
|
|
4766
5136
|
};
|
|
4767
5137
|
|
|
4768
5138
|
// src/commands/context/commands/test.ts
|
|
4769
|
-
import
|
|
5139
|
+
import yargs16 from "yargs";
|
|
4770
5140
|
|
|
4771
5141
|
// src/commands/context/commands/test/get.ts
|
|
4772
5142
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
4773
5143
|
var TestGetModule = {
|
|
4774
5144
|
command: "get <id>",
|
|
4775
5145
|
describe: "Fetch a test",
|
|
4776
|
-
builder: (
|
|
5146
|
+
builder: (yargs27) => withConfiguration(
|
|
4777
5147
|
withFormatOptions(
|
|
4778
5148
|
withApiOptions(
|
|
4779
5149
|
withProjectOptions(
|
|
4780
|
-
|
|
5150
|
+
yargs27.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
4781
5151
|
)
|
|
4782
5152
|
)
|
|
4783
5153
|
)
|
|
@@ -4801,7 +5171,7 @@ var TestListModule = {
|
|
|
4801
5171
|
command: "list",
|
|
4802
5172
|
describe: "List tests",
|
|
4803
5173
|
aliases: ["ls"],
|
|
4804
|
-
builder: (
|
|
5174
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
4805
5175
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
4806
5176
|
const fetch3 = nodeFetchProxy(proxy);
|
|
4807
5177
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -4850,11 +5220,11 @@ function createTestEngineDataSource({
|
|
|
4850
5220
|
var TestPullModule = {
|
|
4851
5221
|
command: "pull <directory>",
|
|
4852
5222
|
describe: "Pulls all tests to local files in a directory",
|
|
4853
|
-
builder: (
|
|
5223
|
+
builder: (yargs27) => withConfiguration(
|
|
4854
5224
|
withApiOptions(
|
|
4855
5225
|
withProjectOptions(
|
|
4856
5226
|
withDiffOptions(
|
|
4857
|
-
|
|
5227
|
+
yargs27.positional("directory", {
|
|
4858
5228
|
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.",
|
|
4859
5229
|
type: "string"
|
|
4860
5230
|
}).option("format", {
|
|
@@ -4929,11 +5299,11 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
4929
5299
|
var TestPushModule = {
|
|
4930
5300
|
command: "push <directory>",
|
|
4931
5301
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
4932
|
-
builder: (
|
|
5302
|
+
builder: (yargs27) => withConfiguration(
|
|
4933
5303
|
withApiOptions(
|
|
4934
5304
|
withProjectOptions(
|
|
4935
5305
|
withDiffOptions(
|
|
4936
|
-
|
|
5306
|
+
yargs27.positional("directory", {
|
|
4937
5307
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
4938
5308
|
type: "string"
|
|
4939
5309
|
}).option("what-if", {
|
|
@@ -4997,10 +5367,10 @@ var TestRemoveModule = {
|
|
|
4997
5367
|
command: "remove <id>",
|
|
4998
5368
|
aliases: ["delete", "rm"],
|
|
4999
5369
|
describe: "Delete a test",
|
|
5000
|
-
builder: (
|
|
5370
|
+
builder: (yargs27) => withConfiguration(
|
|
5001
5371
|
withApiOptions(
|
|
5002
5372
|
withProjectOptions(
|
|
5003
|
-
|
|
5373
|
+
yargs27.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
5004
5374
|
)
|
|
5005
5375
|
)
|
|
5006
5376
|
),
|
|
@@ -5017,9 +5387,9 @@ var TestUpdateModule = {
|
|
|
5017
5387
|
command: "update <filename>",
|
|
5018
5388
|
aliases: ["put"],
|
|
5019
5389
|
describe: "Insert or update a test",
|
|
5020
|
-
builder: (
|
|
5390
|
+
builder: (yargs27) => withConfiguration(
|
|
5021
5391
|
withApiOptions(
|
|
5022
|
-
withProjectOptions(
|
|
5392
|
+
withProjectOptions(yargs27.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
5023
5393
|
)
|
|
5024
5394
|
),
|
|
5025
5395
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -5034,9 +5404,9 @@ var TestUpdateModule = {
|
|
|
5034
5404
|
var TestModule = {
|
|
5035
5405
|
command: "test <command>",
|
|
5036
5406
|
describe: "Commands for Context A/B tests",
|
|
5037
|
-
builder: (
|
|
5407
|
+
builder: (yargs27) => yargs27.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
5038
5408
|
handler: () => {
|
|
5039
|
-
|
|
5409
|
+
yargs16.help();
|
|
5040
5410
|
}
|
|
5041
5411
|
};
|
|
5042
5412
|
|
|
@@ -5045,9 +5415,9 @@ var ContextCommand = {
|
|
|
5045
5415
|
command: "context <command>",
|
|
5046
5416
|
aliases: ["ctx"],
|
|
5047
5417
|
describe: "Uniform Context commands",
|
|
5048
|
-
builder: (
|
|
5418
|
+
builder: (yargs27) => yargs27.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
5049
5419
|
handler: () => {
|
|
5050
|
-
|
|
5420
|
+
yargs17.showHelp();
|
|
5051
5421
|
}
|
|
5052
5422
|
};
|
|
5053
5423
|
|
|
@@ -5075,7 +5445,7 @@ import { PostHog } from "posthog-node";
|
|
|
5075
5445
|
// package.json
|
|
5076
5446
|
var package_default = {
|
|
5077
5447
|
name: "@uniformdev/cli",
|
|
5078
|
-
version: "19.
|
|
5448
|
+
version: "19.69.0",
|
|
5079
5449
|
description: "Uniform command line interface tool",
|
|
5080
5450
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5081
5451
|
main: "./cli.js",
|
|
@@ -5092,6 +5462,7 @@ var package_default = {
|
|
|
5092
5462
|
},
|
|
5093
5463
|
dependencies: {
|
|
5094
5464
|
"@thi.ng/mime": "^2.2.23",
|
|
5465
|
+
"@uniformdev/assets": "workspace:*",
|
|
5095
5466
|
"@uniformdev/canvas": "workspace:*",
|
|
5096
5467
|
"@uniformdev/context": "workspace:*",
|
|
5097
5468
|
"@uniformdev/files": "workspace:*",
|
|
@@ -6084,10 +6455,10 @@ var NewMeshCmd = {
|
|
|
6084
6455
|
};
|
|
6085
6456
|
|
|
6086
6457
|
// src/commands/optimize/index.ts
|
|
6087
|
-
import
|
|
6458
|
+
import yargs19 from "yargs";
|
|
6088
6459
|
|
|
6089
6460
|
// src/commands/optimize/manifest.ts
|
|
6090
|
-
import
|
|
6461
|
+
import yargs18 from "yargs";
|
|
6091
6462
|
|
|
6092
6463
|
// src/commands/optimize/manifest/download.ts
|
|
6093
6464
|
import { gray as gray4, green as green3, red as red5, yellow as yellow2 } from "colorette";
|
|
@@ -6102,7 +6473,7 @@ var UniformBaseUrl = "https://uniform.app";
|
|
|
6102
6473
|
var module = {
|
|
6103
6474
|
command: "download [output]",
|
|
6104
6475
|
describe: "Download intent manifest",
|
|
6105
|
-
builder: (
|
|
6476
|
+
builder: (yargs27) => yargs27.option("apiKey", {
|
|
6106
6477
|
alias: "k",
|
|
6107
6478
|
demandOption: true,
|
|
6108
6479
|
string: true,
|
|
@@ -6203,10 +6574,10 @@ var module2 = {
|
|
|
6203
6574
|
command: "manifest <command>",
|
|
6204
6575
|
describe: "Intent manifest commands",
|
|
6205
6576
|
builder: () => {
|
|
6206
|
-
return
|
|
6577
|
+
return yargs18.command(download_default);
|
|
6207
6578
|
},
|
|
6208
6579
|
handler: () => {
|
|
6209
|
-
|
|
6580
|
+
yargs18.showHelp();
|
|
6210
6581
|
}
|
|
6211
6582
|
};
|
|
6212
6583
|
var manifest_default = module2;
|
|
@@ -6217,29 +6588,29 @@ var OptimizeCommand = {
|
|
|
6217
6588
|
aliases: ["opt"],
|
|
6218
6589
|
describe: "Uniform Optimize commands",
|
|
6219
6590
|
builder: () => {
|
|
6220
|
-
return
|
|
6591
|
+
return yargs19.command(manifest_default);
|
|
6221
6592
|
},
|
|
6222
6593
|
handler: () => {
|
|
6223
|
-
|
|
6594
|
+
yargs19.showHelp();
|
|
6224
6595
|
}
|
|
6225
6596
|
};
|
|
6226
6597
|
|
|
6227
6598
|
// src/commands/project-map/index.ts
|
|
6228
|
-
import
|
|
6599
|
+
import yargs22 from "yargs";
|
|
6229
6600
|
|
|
6230
6601
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
6231
|
-
import
|
|
6602
|
+
import yargs20 from "yargs";
|
|
6232
6603
|
|
|
6233
6604
|
// src/commands/project-map/commands/ProjectMapDefinition/get.ts
|
|
6234
6605
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
6235
6606
|
var ProjectMapDefinitionGetModule = {
|
|
6236
6607
|
command: "get <id>",
|
|
6237
6608
|
describe: "Fetch a project map",
|
|
6238
|
-
builder: (
|
|
6609
|
+
builder: (yargs27) => withFormatOptions(
|
|
6239
6610
|
withConfiguration(
|
|
6240
6611
|
withApiOptions(
|
|
6241
6612
|
withProjectOptions(
|
|
6242
|
-
|
|
6613
|
+
yargs27.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
6243
6614
|
)
|
|
6244
6615
|
)
|
|
6245
6616
|
)
|
|
@@ -6263,7 +6634,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
6263
6634
|
command: "list",
|
|
6264
6635
|
describe: "List of project maps",
|
|
6265
6636
|
aliases: ["ls"],
|
|
6266
|
-
builder: (
|
|
6637
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
6267
6638
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6268
6639
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6269
6640
|
const client = new UncachedProjectMapClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6320,11 +6691,11 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
6320
6691
|
var ProjectMapDefinitionPullModule = {
|
|
6321
6692
|
command: "pull <directory>",
|
|
6322
6693
|
describe: "Pulls all project maps to local files in a directory",
|
|
6323
|
-
builder: (
|
|
6694
|
+
builder: (yargs27) => withConfiguration(
|
|
6324
6695
|
withApiOptions(
|
|
6325
6696
|
withProjectOptions(
|
|
6326
6697
|
withDiffOptions(
|
|
6327
|
-
|
|
6698
|
+
yargs27.positional("directory", {
|
|
6328
6699
|
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.",
|
|
6329
6700
|
type: "string"
|
|
6330
6701
|
}).option("format", {
|
|
@@ -6389,6 +6760,7 @@ var ProjectMapDefinitionPullModule = {
|
|
|
6389
6760
|
target,
|
|
6390
6761
|
mode,
|
|
6391
6762
|
whatIf,
|
|
6763
|
+
allowEmptySource: true,
|
|
6392
6764
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
6393
6765
|
});
|
|
6394
6766
|
}
|
|
@@ -6399,11 +6771,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient4 } from "@uniformd
|
|
|
6399
6771
|
var ProjectMapDefinitionPushModule = {
|
|
6400
6772
|
command: "push <directory>",
|
|
6401
6773
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
6402
|
-
builder: (
|
|
6774
|
+
builder: (yargs27) => withConfiguration(
|
|
6403
6775
|
withApiOptions(
|
|
6404
6776
|
withProjectOptions(
|
|
6405
6777
|
withDiffOptions(
|
|
6406
|
-
|
|
6778
|
+
yargs27.positional("directory", {
|
|
6407
6779
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6408
6780
|
type: "string"
|
|
6409
6781
|
}).option("what-if", {
|
|
@@ -6467,9 +6839,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
6467
6839
|
command: "remove <id>",
|
|
6468
6840
|
aliases: ["delete", "rm"],
|
|
6469
6841
|
describe: "Delete a project map",
|
|
6470
|
-
builder: (
|
|
6842
|
+
builder: (yargs27) => withConfiguration(
|
|
6471
6843
|
withApiOptions(
|
|
6472
|
-
withProjectOptions(
|
|
6844
|
+
withProjectOptions(yargs27.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
6473
6845
|
)
|
|
6474
6846
|
),
|
|
6475
6847
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -6485,10 +6857,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6485
6857
|
command: "update <filename>",
|
|
6486
6858
|
aliases: ["put"],
|
|
6487
6859
|
describe: "Insert or update a project map",
|
|
6488
|
-
builder: (
|
|
6860
|
+
builder: (yargs27) => withConfiguration(
|
|
6489
6861
|
withApiOptions(
|
|
6490
6862
|
withProjectOptions(
|
|
6491
|
-
|
|
6863
|
+
yargs27.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
6492
6864
|
)
|
|
6493
6865
|
)
|
|
6494
6866
|
),
|
|
@@ -6504,25 +6876,25 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
6504
6876
|
var ProjectMapDefinitionModule = {
|
|
6505
6877
|
command: "definition <command>",
|
|
6506
6878
|
describe: "Commands for ProjectMap Definitions",
|
|
6507
|
-
builder: (
|
|
6879
|
+
builder: (yargs27) => yargs27.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
6508
6880
|
handler: () => {
|
|
6509
|
-
|
|
6881
|
+
yargs20.help();
|
|
6510
6882
|
}
|
|
6511
6883
|
};
|
|
6512
6884
|
|
|
6513
6885
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
6514
|
-
import
|
|
6886
|
+
import yargs21 from "yargs";
|
|
6515
6887
|
|
|
6516
6888
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
6517
6889
|
import { UncachedProjectMapClient as UncachedProjectMapClient7 } from "@uniformdev/project-map";
|
|
6518
6890
|
var ProjectMapNodeGetModule = {
|
|
6519
6891
|
command: "get <id> <projectMapId>",
|
|
6520
6892
|
describe: "Fetch a project map node",
|
|
6521
|
-
builder: (
|
|
6893
|
+
builder: (yargs27) => withConfiguration(
|
|
6522
6894
|
withFormatOptions(
|
|
6523
6895
|
withApiOptions(
|
|
6524
6896
|
withProjectOptions(
|
|
6525
|
-
|
|
6897
|
+
yargs27.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
6526
6898
|
)
|
|
6527
6899
|
)
|
|
6528
6900
|
)
|
|
@@ -6548,11 +6920,11 @@ var ProjectMapNodeListModule = {
|
|
|
6548
6920
|
command: "list <projectMapId>",
|
|
6549
6921
|
describe: "List project map nodes",
|
|
6550
6922
|
aliases: ["ls"],
|
|
6551
|
-
builder: (
|
|
6923
|
+
builder: (yargs27) => withConfiguration(
|
|
6552
6924
|
withFormatOptions(
|
|
6553
6925
|
withApiOptions(
|
|
6554
6926
|
withProjectOptions(
|
|
6555
|
-
|
|
6927
|
+
yargs27.positional("projectMapId", {
|
|
6556
6928
|
demandOption: true,
|
|
6557
6929
|
describe: "ProjectMap UUID to fetch from"
|
|
6558
6930
|
})
|
|
@@ -6623,11 +6995,11 @@ function createProjectMapNodeEngineDataSource({
|
|
|
6623
6995
|
var ProjectMapNodePullModule = {
|
|
6624
6996
|
command: "pull <directory>",
|
|
6625
6997
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
6626
|
-
builder: (
|
|
6998
|
+
builder: (yargs27) => withConfiguration(
|
|
6627
6999
|
withApiOptions(
|
|
6628
7000
|
withProjectOptions(
|
|
6629
7001
|
withDiffOptions(
|
|
6630
|
-
|
|
7002
|
+
yargs27.positional("directory", {
|
|
6631
7003
|
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.",
|
|
6632
7004
|
type: "string"
|
|
6633
7005
|
}).option("format", {
|
|
@@ -6696,6 +7068,7 @@ var ProjectMapNodePullModule = {
|
|
|
6696
7068
|
target,
|
|
6697
7069
|
mode,
|
|
6698
7070
|
whatIf,
|
|
7071
|
+
allowEmptySource: true,
|
|
6699
7072
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
6700
7073
|
});
|
|
6701
7074
|
}
|
|
@@ -6706,11 +7079,11 @@ import { UncachedProjectMapClient as UncachedProjectMapClient10 } from "@uniform
|
|
|
6706
7079
|
var ProjectMapNodePushModule = {
|
|
6707
7080
|
command: "push <directory>",
|
|
6708
7081
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
6709
|
-
builder: (
|
|
7082
|
+
builder: (yargs27) => withConfiguration(
|
|
6710
7083
|
withApiOptions(
|
|
6711
7084
|
withProjectOptions(
|
|
6712
7085
|
withDiffOptions(
|
|
6713
|
-
|
|
7086
|
+
yargs27.positional("directory", {
|
|
6714
7087
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
6715
7088
|
type: "string"
|
|
6716
7089
|
}).option("what-if", {
|
|
@@ -6783,10 +7156,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
6783
7156
|
command: "remove <id> <projectMapId>",
|
|
6784
7157
|
aliases: ["delete", "rm"],
|
|
6785
7158
|
describe: "Delete a project map node",
|
|
6786
|
-
builder: (
|
|
7159
|
+
builder: (yargs27) => withConfiguration(
|
|
6787
7160
|
withApiOptions(
|
|
6788
7161
|
withProjectOptions(
|
|
6789
|
-
|
|
7162
|
+
yargs27.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
6790
7163
|
)
|
|
6791
7164
|
)
|
|
6792
7165
|
),
|
|
@@ -6803,10 +7176,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
6803
7176
|
command: "update <filename> <projectMapId>",
|
|
6804
7177
|
aliases: ["put"],
|
|
6805
7178
|
describe: "Insert or update a project map node",
|
|
6806
|
-
builder: (
|
|
7179
|
+
builder: (yargs27) => withConfiguration(
|
|
6807
7180
|
withApiOptions(
|
|
6808
7181
|
withProjectOptions(
|
|
6809
|
-
|
|
7182
|
+
yargs27.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
6810
7183
|
)
|
|
6811
7184
|
)
|
|
6812
7185
|
),
|
|
@@ -6822,9 +7195,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
6822
7195
|
var ProjectMapNodeModule = {
|
|
6823
7196
|
command: "node <command>",
|
|
6824
7197
|
describe: "Commands for ProjectMap Nodes",
|
|
6825
|
-
builder: (
|
|
7198
|
+
builder: (yargs27) => yargs27.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
6826
7199
|
handler: () => {
|
|
6827
|
-
|
|
7200
|
+
yargs21.help();
|
|
6828
7201
|
}
|
|
6829
7202
|
};
|
|
6830
7203
|
|
|
@@ -6833,28 +7206,28 @@ var ProjectMapCommand = {
|
|
|
6833
7206
|
command: "project-map <command>",
|
|
6834
7207
|
aliases: ["prm"],
|
|
6835
7208
|
describe: "Uniform ProjectMap commands",
|
|
6836
|
-
builder: (
|
|
7209
|
+
builder: (yargs27) => yargs27.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
6837
7210
|
handler: () => {
|
|
6838
|
-
|
|
7211
|
+
yargs22.showHelp();
|
|
6839
7212
|
}
|
|
6840
7213
|
};
|
|
6841
7214
|
|
|
6842
7215
|
// src/commands/redirect/index.ts
|
|
6843
|
-
import
|
|
7216
|
+
import yargs24 from "yargs";
|
|
6844
7217
|
|
|
6845
7218
|
// src/commands/redirect/commands/redirect.ts
|
|
6846
|
-
import
|
|
7219
|
+
import yargs23 from "yargs";
|
|
6847
7220
|
|
|
6848
7221
|
// src/commands/redirect/commands/RedirectDefinition/get.ts
|
|
6849
7222
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
6850
7223
|
var RedirectDefinitionGetModule = {
|
|
6851
7224
|
command: "get <id>",
|
|
6852
7225
|
describe: "Fetch a redirect",
|
|
6853
|
-
builder: (
|
|
7226
|
+
builder: (yargs27) => withConfiguration(
|
|
6854
7227
|
withFormatOptions(
|
|
6855
7228
|
withApiOptions(
|
|
6856
7229
|
withProjectOptions(
|
|
6857
|
-
|
|
7230
|
+
yargs27.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
6858
7231
|
)
|
|
6859
7232
|
)
|
|
6860
7233
|
)
|
|
@@ -6878,7 +7251,7 @@ var RedirectDefinitionListModule = {
|
|
|
6878
7251
|
command: "list",
|
|
6879
7252
|
describe: "List of redirects",
|
|
6880
7253
|
aliases: ["ls"],
|
|
6881
|
-
builder: (
|
|
7254
|
+
builder: (yargs27) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs27)))),
|
|
6882
7255
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
6883
7256
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6884
7257
|
const client = new UncachedRedirectClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
@@ -6944,11 +7317,11 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
6944
7317
|
var RedirectDefinitionPullModule = {
|
|
6945
7318
|
command: "pull <directory>",
|
|
6946
7319
|
describe: "Pulls all redirects to local files in a directory",
|
|
6947
|
-
builder: (
|
|
7320
|
+
builder: (yargs27) => withConfiguration(
|
|
6948
7321
|
withApiOptions(
|
|
6949
7322
|
withProjectOptions(
|
|
6950
7323
|
withDiffOptions(
|
|
6951
|
-
|
|
7324
|
+
yargs27.positional("directory", {
|
|
6952
7325
|
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.",
|
|
6953
7326
|
type: "string"
|
|
6954
7327
|
}).option("format", {
|
|
@@ -7014,6 +7387,7 @@ var RedirectDefinitionPullModule = {
|
|
|
7014
7387
|
target,
|
|
7015
7388
|
mode,
|
|
7016
7389
|
whatIf,
|
|
7390
|
+
allowEmptySource: true,
|
|
7017
7391
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
7018
7392
|
});
|
|
7019
7393
|
}
|
|
@@ -7024,11 +7398,11 @@ import { UncachedRedirectClient as UncachedRedirectClient4 } from "@uniformdev/r
|
|
|
7024
7398
|
var RedirectDefinitionPushModule = {
|
|
7025
7399
|
command: "push <directory>",
|
|
7026
7400
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
7027
|
-
builder: (
|
|
7401
|
+
builder: (yargs27) => withConfiguration(
|
|
7028
7402
|
withApiOptions(
|
|
7029
7403
|
withProjectOptions(
|
|
7030
7404
|
withDiffOptions(
|
|
7031
|
-
|
|
7405
|
+
yargs27.positional("directory", {
|
|
7032
7406
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
7033
7407
|
type: "string"
|
|
7034
7408
|
}).option("what-if", {
|
|
@@ -7092,9 +7466,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
7092
7466
|
command: "remove <id>",
|
|
7093
7467
|
aliases: ["delete", "rm"],
|
|
7094
7468
|
describe: "Delete a redirect",
|
|
7095
|
-
builder: (
|
|
7469
|
+
builder: (yargs27) => withConfiguration(
|
|
7096
7470
|
withApiOptions(
|
|
7097
|
-
withProjectOptions(
|
|
7471
|
+
withProjectOptions(yargs27.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
7098
7472
|
)
|
|
7099
7473
|
),
|
|
7100
7474
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -7110,10 +7484,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7110
7484
|
command: "update <filename>",
|
|
7111
7485
|
aliases: ["put"],
|
|
7112
7486
|
describe: "Insert or update a redirect",
|
|
7113
|
-
builder: (
|
|
7487
|
+
builder: (yargs27) => withConfiguration(
|
|
7114
7488
|
withApiOptions(
|
|
7115
7489
|
withProjectOptions(
|
|
7116
|
-
|
|
7490
|
+
yargs27.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
7117
7491
|
)
|
|
7118
7492
|
)
|
|
7119
7493
|
),
|
|
@@ -7129,9 +7503,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
7129
7503
|
var RedirectDefinitionModule = {
|
|
7130
7504
|
command: "definition <command>",
|
|
7131
7505
|
describe: "Commands for Redirect Definitions",
|
|
7132
|
-
builder: (
|
|
7506
|
+
builder: (yargs27) => yargs27.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
7133
7507
|
handler: () => {
|
|
7134
|
-
|
|
7508
|
+
yargs23.help();
|
|
7135
7509
|
}
|
|
7136
7510
|
};
|
|
7137
7511
|
|
|
@@ -7140,14 +7514,14 @@ var RedirectCommand = {
|
|
|
7140
7514
|
command: "redirect <command>",
|
|
7141
7515
|
aliases: ["red"],
|
|
7142
7516
|
describe: "Uniform Redirect commands",
|
|
7143
|
-
builder: (
|
|
7517
|
+
builder: (yargs27) => yargs27.command(RedirectDefinitionModule).demandCommand(),
|
|
7144
7518
|
handler: () => {
|
|
7145
|
-
|
|
7519
|
+
yargs24.showHelp();
|
|
7146
7520
|
}
|
|
7147
7521
|
};
|
|
7148
7522
|
|
|
7149
7523
|
// src/commands/sync/index.ts
|
|
7150
|
-
import
|
|
7524
|
+
import yargs25 from "yargs";
|
|
7151
7525
|
|
|
7152
7526
|
// src/commands/sync/commands/util.ts
|
|
7153
7527
|
import ora2 from "ora";
|
|
@@ -7178,11 +7552,11 @@ function spin(entityType) {
|
|
|
7178
7552
|
var SyncPullModule = {
|
|
7179
7553
|
command: "pull",
|
|
7180
7554
|
describe: "Pulls whole project to local files in a directory",
|
|
7181
|
-
builder: (
|
|
7555
|
+
builder: (yargs27) => withConfiguration(
|
|
7182
7556
|
withApiOptions(
|
|
7183
7557
|
withProjectOptions(
|
|
7184
7558
|
withDiffOptions(
|
|
7185
|
-
|
|
7559
|
+
yargs27.option("what-if", {
|
|
7186
7560
|
alias: ["w"],
|
|
7187
7561
|
describe: "What-if mode reports what would be done but changes no files",
|
|
7188
7562
|
default: false,
|
|
@@ -7210,7 +7584,8 @@ var SyncPullModule = {
|
|
|
7210
7584
|
projectMapNode: ProjectMapNodePullModule,
|
|
7211
7585
|
redirect: RedirectDefinitionPullModule,
|
|
7212
7586
|
entry: EntryPullModule,
|
|
7213
|
-
contentType: ContentTypePullModule
|
|
7587
|
+
contentType: ContentTypePullModule,
|
|
7588
|
+
asset: AssetPullModule
|
|
7214
7589
|
}).filter(([entityType]) => {
|
|
7215
7590
|
var _a, _b, _c, _d, _e, _f;
|
|
7216
7591
|
return Boolean((_a = config2.entitiesConfig) == null ? void 0 : _a[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
@@ -7268,11 +7643,11 @@ var getFormat = (entityType, config2) => {
|
|
|
7268
7643
|
var SyncPushModule = {
|
|
7269
7644
|
command: "push",
|
|
7270
7645
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
7271
|
-
builder: (
|
|
7646
|
+
builder: (yargs27) => withConfiguration(
|
|
7272
7647
|
withApiOptions(
|
|
7273
7648
|
withProjectOptions(
|
|
7274
7649
|
withDiffOptions(
|
|
7275
|
-
|
|
7650
|
+
yargs27.option("what-if", {
|
|
7276
7651
|
alias: ["w"],
|
|
7277
7652
|
describe: "What-if mode reports what would be done but changes nothing",
|
|
7278
7653
|
default: false,
|
|
@@ -7301,7 +7676,8 @@ var SyncPushModule = {
|
|
|
7301
7676
|
projectMapNode: ProjectMapNodePushModule,
|
|
7302
7677
|
redirect: RedirectDefinitionPushModule,
|
|
7303
7678
|
contentType: ContentTypePushModule,
|
|
7304
|
-
entry: EntryPushModule
|
|
7679
|
+
entry: EntryPushModule,
|
|
7680
|
+
asset: AssetPushModule
|
|
7305
7681
|
}).filter(([entityType]) => {
|
|
7306
7682
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7307
7683
|
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
|
|
@@ -7365,9 +7741,9 @@ var getFormat2 = (entityType, config2) => {
|
|
|
7365
7741
|
var SyncCommand = {
|
|
7366
7742
|
command: "sync <command>",
|
|
7367
7743
|
describe: "Uniform Sync commands",
|
|
7368
|
-
builder: (
|
|
7744
|
+
builder: (yargs27) => yargs27.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
7369
7745
|
handler: () => {
|
|
7370
|
-
|
|
7746
|
+
yargs25.showHelp();
|
|
7371
7747
|
}
|
|
7372
7748
|
};
|
|
7373
7749
|
|
|
@@ -7633,7 +8009,7 @@ First found was: v${firstVersion}`;
|
|
|
7633
8009
|
|
|
7634
8010
|
// src/index.ts
|
|
7635
8011
|
dotenv.config();
|
|
7636
|
-
var yarggery =
|
|
8012
|
+
var yarggery = yargs26(hideBin(process.argv));
|
|
7637
8013
|
var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
|
|
7638
8014
|
var configuration = loadConfig(inlineConfigurationFilePath || null);
|
|
7639
8015
|
yarggery.option("verbose", {
|