@uniformdev/cli 19.86.1-alpha.12 → 19.87.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 +10 -3
- package/dist/index.mjs +55 -185
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
type CLICompositionState = 'preview' | 'published' | number;
|
|
3
|
+
type StateArgs = {
|
|
4
|
+
state: CLICompositionState;
|
|
5
|
+
};
|
|
6
|
+
|
|
2
7
|
type SyncMode = 'mirror' | 'createOrUpdate' | 'create';
|
|
3
8
|
type EntityTypes = 'category' | 'dataType' | 'quirk' | 'test' | 'signal' | 'enrichment' | 'aggregate' | 'component' | 'composition' | 'pattern' | 'projectMapDefinition' | 'projectMapNode' | 'redirect' | 'entry' | 'contentType' | 'asset';
|
|
4
9
|
type SyncFileFormat = 'yaml' | 'json';
|
|
@@ -8,7 +13,8 @@ type EntityConfiguration = {
|
|
|
8
13
|
format?: SyncFileFormat;
|
|
9
14
|
disabled?: true;
|
|
10
15
|
};
|
|
11
|
-
type
|
|
16
|
+
type EntityWithStateConfiguration = EntityConfiguration & Partial<StateArgs>;
|
|
17
|
+
type PublishableEntitiesConfiguration = EntityWithStateConfiguration & {
|
|
12
18
|
publish?: boolean;
|
|
13
19
|
};
|
|
14
20
|
type SerializationConfiguration = {
|
|
@@ -16,8 +22,9 @@ type SerializationConfiguration = {
|
|
|
16
22
|
pull?: EntityConfiguration;
|
|
17
23
|
push?: EntityConfiguration;
|
|
18
24
|
} & EntityConfiguration> & {
|
|
19
|
-
composition?:
|
|
20
|
-
pattern?:
|
|
25
|
+
composition?: PublishableEntitiesConfiguration;
|
|
26
|
+
pattern?: PublishableEntitiesConfiguration;
|
|
27
|
+
entry?: EntityWithStateConfiguration;
|
|
21
28
|
}>;
|
|
22
29
|
directory: string;
|
|
23
30
|
mode: SyncMode;
|
package/dist/index.mjs
CHANGED
|
@@ -669,62 +669,30 @@ var AssetListModule = {
|
|
|
669
669
|
|
|
670
670
|
// src/commands/canvas/commands/asset/pull.ts
|
|
671
671
|
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
672
|
-
import { UncachedFileClient } from "@uniformdev/files";
|
|
673
672
|
|
|
674
673
|
// src/files/index.ts
|
|
675
674
|
import { preferredType } from "@thi.ng/mime";
|
|
676
675
|
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
676
|
+
import { createHash } from "crypto";
|
|
677
677
|
import fsj from "fs-jetpack";
|
|
678
678
|
import sizeOf from "image-size";
|
|
679
679
|
import PQueue from "p-queue";
|
|
680
680
|
import { dirname as dirname2, join as join2 } from "path";
|
|
681
681
|
var FILES_DIRECTORY_NAME = "files";
|
|
682
|
-
var escapeRegExp = (string) => {
|
|
683
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
684
|
-
};
|
|
685
682
|
var urlToHash = (url) => {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
new URL(url).pathname.substring(0, 64)
|
|
690
|
-
).toString("base64");
|
|
691
|
-
};
|
|
692
|
-
var hashToPartialPathname = (hash) => {
|
|
693
|
-
try {
|
|
694
|
-
return Buffer.from(hash, "base64").toString("utf8");
|
|
695
|
-
} catch {
|
|
696
|
-
return null;
|
|
697
|
-
}
|
|
683
|
+
const hash = createHash("sha256");
|
|
684
|
+
hash.update(url);
|
|
685
|
+
return hash.digest("hex");
|
|
698
686
|
};
|
|
699
|
-
var
|
|
700
|
-
const
|
|
701
|
-
const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
|
|
702
|
-
const match = source.match(regex);
|
|
703
|
-
if (match && match[1]) {
|
|
704
|
-
return match[1];
|
|
705
|
-
}
|
|
706
|
-
return null;
|
|
707
|
-
};
|
|
708
|
-
var urlToFileName = (url, hash) => {
|
|
709
|
-
const fileName = hash ?? urlToHash(url);
|
|
687
|
+
var urlToFileName = (url) => {
|
|
688
|
+
const fileName = urlToHash(url);
|
|
710
689
|
const fileNameChunks = url.split(".");
|
|
711
690
|
const fileExtension = fileNameChunks.length > 1 ? fileNameChunks.at(-1) : "";
|
|
712
691
|
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
713
692
|
};
|
|
714
|
-
var getFilesDirectory = (directory) => {
|
|
715
|
-
const isPackage = isPathAPackageFile(directory);
|
|
716
|
-
return isPackage ? dirname2(directory) : (
|
|
717
|
-
// If we are syncing to a directory, we want to write all files into a
|
|
718
|
-
// top-lvl folder. That way any entities that contain files will sync to the
|
|
719
|
-
// same directory, so there is no duplication
|
|
720
|
-
join2(directory, "..")
|
|
721
|
-
);
|
|
722
|
-
};
|
|
723
|
-
var getUniformFileUrlMatches = (string) => {
|
|
724
|
-
return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
|
|
725
|
-
};
|
|
726
693
|
var deleteDownloadedFileByUrl = async (url, options) => {
|
|
727
|
-
const
|
|
694
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
695
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
728
696
|
const fileName = urlToFileName(url);
|
|
729
697
|
const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
|
|
730
698
|
try {
|
|
@@ -735,14 +703,18 @@ var deleteDownloadedFileByUrl = async (url, options) => {
|
|
|
735
703
|
};
|
|
736
704
|
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
737
705
|
const objectAsString = JSON.stringify(object);
|
|
738
|
-
const uniformFileUrlMatches =
|
|
739
|
-
|
|
706
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
707
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
708
|
+
);
|
|
709
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
710
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
740
711
|
if (uniformFileUrlMatches) {
|
|
741
712
|
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
742
713
|
for (const match of uniformFileUrlMatches) {
|
|
743
714
|
const url = new URL(match[1]);
|
|
744
715
|
fileDownloadQueue.add(async () => {
|
|
745
716
|
try {
|
|
717
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
746
718
|
const fileName = urlToFileName(url.toString());
|
|
747
719
|
const fileAlreadyExists = await fsj.existsAsync(
|
|
748
720
|
join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
|
|
@@ -750,23 +722,6 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
750
722
|
if (fileAlreadyExists) {
|
|
751
723
|
return;
|
|
752
724
|
}
|
|
753
|
-
const file = await options.fileClient.get({ url: url.toString() }).catch(() => null);
|
|
754
|
-
if (!file) {
|
|
755
|
-
console.warn(`Skipping file ${url} as it does not exist in the project anymore`);
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
if (file.sourceId) {
|
|
759
|
-
try {
|
|
760
|
-
const hashAlreadyExists = await fsj.findAsync(join2(writeDirectory, FILES_DIRECTORY_NAME), {
|
|
761
|
-
matching: [file.sourceId, `${file.sourceId}.*`]
|
|
762
|
-
});
|
|
763
|
-
if (hashAlreadyExists.length > 0) {
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
} catch {
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
770
725
|
const response = await fetch(fetchUrl);
|
|
771
726
|
if (!response.ok) {
|
|
772
727
|
return;
|
|
@@ -784,8 +739,11 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
784
739
|
};
|
|
785
740
|
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
786
741
|
let objectAsString = JSON.stringify(object);
|
|
787
|
-
const uniformFileUrlMatches =
|
|
788
|
-
|
|
742
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
743
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
744
|
+
);
|
|
745
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
746
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
789
747
|
if (uniformFileUrlMatches) {
|
|
790
748
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
791
749
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -801,12 +759,11 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
801
759
|
return;
|
|
802
760
|
}
|
|
803
761
|
const localFileName = urlToFileName(url);
|
|
804
|
-
const
|
|
805
|
-
|
|
762
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
763
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
764
|
+
);
|
|
806
765
|
if (!fileExistsLocally) {
|
|
807
|
-
console.warn(
|
|
808
|
-
`Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
809
|
-
);
|
|
766
|
+
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
810
767
|
return;
|
|
811
768
|
}
|
|
812
769
|
const fileBuffer = await fsj.readAsync(
|
|
@@ -858,8 +815,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
858
815
|
return file.url;
|
|
859
816
|
};
|
|
860
817
|
const abortTimeout = setTimeout(() => {
|
|
861
|
-
throw new Error(`Failed to upload file ${url}
|
|
862
|
-
},
|
|
818
|
+
throw new Error(`Failed to upload file ${url}`);
|
|
819
|
+
}, 1e4);
|
|
863
820
|
const uploadedFileUrl = await checkForFile();
|
|
864
821
|
clearTimeout(abortTimeout);
|
|
865
822
|
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
@@ -874,7 +831,9 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
874
831
|
};
|
|
875
832
|
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
876
833
|
let objectAsString = JSON.stringify(object);
|
|
877
|
-
const uniformFileUrlMatches =
|
|
834
|
+
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
835
|
+
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
836
|
+
);
|
|
878
837
|
if (uniformFileUrlMatches) {
|
|
879
838
|
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
880
839
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -899,45 +858,6 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
899
858
|
}
|
|
900
859
|
return JSON.parse(objectAsString);
|
|
901
860
|
};
|
|
902
|
-
var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
|
|
903
|
-
let sourceObjectAsString = JSON.stringify(sourceObject);
|
|
904
|
-
const targetObjectAsString = JSON.stringify(targetObject);
|
|
905
|
-
const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
|
|
906
|
-
const writeDirectory = getFilesDirectory(options.directory);
|
|
907
|
-
if (uniformFileUrlMatches) {
|
|
908
|
-
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
909
|
-
for (const match of uniformFileUrlMatches) {
|
|
910
|
-
const url = match[1];
|
|
911
|
-
fileUrlReplacementQueue.add(async () => {
|
|
912
|
-
try {
|
|
913
|
-
const localFileName = urlToFileName(url);
|
|
914
|
-
const fileExistsLocally = await fsj.existsAsync(
|
|
915
|
-
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
916
|
-
);
|
|
917
|
-
if (fileExistsLocally) {
|
|
918
|
-
return;
|
|
919
|
-
}
|
|
920
|
-
const file = await options.fileClient.get({ url }).catch(() => null);
|
|
921
|
-
if (!file || !file.sourceId) {
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
const originalPartialPath = hashToPartialPathname(file.sourceId);
|
|
925
|
-
if (!originalPartialPath) {
|
|
926
|
-
return;
|
|
927
|
-
}
|
|
928
|
-
const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
|
|
929
|
-
if (!originalUrl) {
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
|
|
933
|
-
} catch {
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
await fileUrlReplacementQueue.onIdle();
|
|
938
|
-
}
|
|
939
|
-
return JSON.parse(sourceObjectAsString);
|
|
940
|
-
};
|
|
941
861
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
942
862
|
var _a, _b, _c;
|
|
943
863
|
const fileUrl = (_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
|
|
@@ -1089,7 +1009,6 @@ var AssetPullModule = {
|
|
|
1089
1009
|
fetch: fetch3,
|
|
1090
1010
|
projectId
|
|
1091
1011
|
});
|
|
1092
|
-
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1093
1012
|
const source = createAssetEngineDataSource({ client });
|
|
1094
1013
|
let target;
|
|
1095
1014
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1131,27 +1050,14 @@ var AssetPullModule = {
|
|
|
1131
1050
|
whatIf,
|
|
1132
1051
|
allowEmptySource: true,
|
|
1133
1052
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1134
|
-
onBeforeCompareObjects: async (sourceObject
|
|
1135
|
-
var _a, _b;
|
|
1053
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
1136
1054
|
delete sourceObject.object.asset._author;
|
|
1137
|
-
|
|
1138
|
-
sourceObject,
|
|
1139
|
-
targetObject,
|
|
1140
|
-
{
|
|
1141
|
-
directory,
|
|
1142
|
-
fileClient
|
|
1143
|
-
}
|
|
1144
|
-
);
|
|
1145
|
-
if (((_a = sourceObjectWithPotentiallySwappedUrl.object.asset.fields) == null ? void 0 : _a.url) && ((_b = targetObject.object.asset.fields) == null ? void 0 : _b.url) && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
|
|
1146
|
-
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1147
|
-
}
|
|
1148
|
-
return sourceObjectWithPotentiallySwappedUrl;
|
|
1055
|
+
return sourceObject;
|
|
1149
1056
|
},
|
|
1150
1057
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1151
1058
|
delete sourceObject.object.asset._author;
|
|
1152
1059
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1153
|
-
directory
|
|
1154
|
-
fileClient
|
|
1060
|
+
directory
|
|
1155
1061
|
});
|
|
1156
1062
|
}
|
|
1157
1063
|
});
|
|
@@ -1160,7 +1066,7 @@ var AssetPullModule = {
|
|
|
1160
1066
|
|
|
1161
1067
|
// src/commands/canvas/commands/asset/push.ts
|
|
1162
1068
|
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1163
|
-
import { UncachedFileClient
|
|
1069
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
1164
1070
|
var AssetPushModule = {
|
|
1165
1071
|
command: "push <directory>",
|
|
1166
1072
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
@@ -1221,7 +1127,7 @@ var AssetPushModule = {
|
|
|
1221
1127
|
});
|
|
1222
1128
|
}
|
|
1223
1129
|
const target = createAssetEngineDataSource({ client });
|
|
1224
|
-
const fileClient = new
|
|
1130
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1225
1131
|
await syncEngine({
|
|
1226
1132
|
source,
|
|
1227
1133
|
target,
|
|
@@ -1244,15 +1150,10 @@ var AssetPushModule = {
|
|
|
1244
1150
|
return sourceObjectWithNewFileUrls;
|
|
1245
1151
|
},
|
|
1246
1152
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1247
|
-
const sourceObjectWithNewFileUrls = await
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
}),
|
|
1252
|
-
{
|
|
1253
|
-
fileClient
|
|
1254
|
-
}
|
|
1255
|
-
);
|
|
1153
|
+
const sourceObjectWithNewFileUrls = await extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1154
|
+
directory,
|
|
1155
|
+
fileClient
|
|
1156
|
+
});
|
|
1256
1157
|
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1257
1158
|
sourceObjectWithNewFileUrls.object,
|
|
1258
1159
|
{
|
|
@@ -2188,7 +2089,6 @@ var CompositionPublishModule = {
|
|
|
2188
2089
|
|
|
2189
2090
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2190
2091
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
2191
|
-
import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
2192
2092
|
var CompositionPullModule = {
|
|
2193
2093
|
command: "pull <directory>",
|
|
2194
2094
|
describe: "Pulls all compositions to local files in a directory",
|
|
@@ -2248,7 +2148,6 @@ var CompositionPullModule = {
|
|
|
2248
2148
|
}) => {
|
|
2249
2149
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2250
2150
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2251
|
-
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2252
2151
|
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2253
2152
|
const isPackage = isPathAPackageFile(directory);
|
|
2254
2153
|
let target;
|
|
@@ -2278,16 +2177,9 @@ var CompositionPullModule = {
|
|
|
2278
2177
|
whatIf,
|
|
2279
2178
|
allowEmptySource: true,
|
|
2280
2179
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2281
|
-
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
2282
|
-
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
2283
|
-
directory,
|
|
2284
|
-
fileClient
|
|
2285
|
-
});
|
|
2286
|
-
},
|
|
2287
2180
|
onBeforeWriteObject: async (sourceObject) => {
|
|
2288
2181
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
2289
|
-
directory
|
|
2290
|
-
fileClient
|
|
2182
|
+
directory
|
|
2291
2183
|
});
|
|
2292
2184
|
}
|
|
2293
2185
|
});
|
|
@@ -2296,7 +2188,7 @@ var CompositionPullModule = {
|
|
|
2296
2188
|
|
|
2297
2189
|
// src/commands/canvas/commands/composition/push.ts
|
|
2298
2190
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2299
|
-
import { UncachedFileClient as
|
|
2191
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
2300
2192
|
var CompositionPushModule = {
|
|
2301
2193
|
command: "push <directory>",
|
|
2302
2194
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
@@ -2366,7 +2258,7 @@ var CompositionPushModule = {
|
|
|
2366
2258
|
});
|
|
2367
2259
|
}
|
|
2368
2260
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2369
|
-
const fileClient = new
|
|
2261
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2370
2262
|
await syncEngine({
|
|
2371
2263
|
source,
|
|
2372
2264
|
target,
|
|
@@ -3169,7 +3061,6 @@ var EntryListModule = {
|
|
|
3169
3061
|
|
|
3170
3062
|
// src/commands/canvas/commands/entry/pull.ts
|
|
3171
3063
|
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3172
|
-
import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
3173
3064
|
|
|
3174
3065
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3175
3066
|
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
@@ -3269,7 +3160,6 @@ var EntryPullModule = {
|
|
|
3269
3160
|
projectId,
|
|
3270
3161
|
bypassCache: true
|
|
3271
3162
|
});
|
|
3272
|
-
const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3273
3163
|
const source = createEntryEngineDataSource({ client, state });
|
|
3274
3164
|
let target;
|
|
3275
3165
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3298,26 +3188,13 @@ var EntryPullModule = {
|
|
|
3298
3188
|
mode,
|
|
3299
3189
|
whatIf,
|
|
3300
3190
|
allowEmptySource: true,
|
|
3301
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3302
|
-
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
3303
|
-
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
3304
|
-
directory,
|
|
3305
|
-
fileClient
|
|
3306
|
-
});
|
|
3307
|
-
},
|
|
3308
|
-
onBeforeWriteObject: async (sourceObject) => {
|
|
3309
|
-
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
3310
|
-
directory,
|
|
3311
|
-
fileClient
|
|
3312
|
-
});
|
|
3313
|
-
}
|
|
3191
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3314
3192
|
});
|
|
3315
3193
|
}
|
|
3316
3194
|
};
|
|
3317
3195
|
|
|
3318
3196
|
// src/commands/canvas/commands/entry/push.ts
|
|
3319
3197
|
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
3320
|
-
import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
3321
3198
|
var EntryPushModule = {
|
|
3322
3199
|
command: "push <directory>",
|
|
3323
3200
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
@@ -3382,24 +3259,12 @@ var EntryPushModule = {
|
|
|
3382
3259
|
});
|
|
3383
3260
|
}
|
|
3384
3261
|
const target = createEntryEngineDataSource({ client, state });
|
|
3385
|
-
const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3386
3262
|
await syncEngine({
|
|
3387
3263
|
source,
|
|
3388
3264
|
target,
|
|
3389
3265
|
mode,
|
|
3390
3266
|
whatIf,
|
|
3391
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3392
|
-
onBeforeCompareObjects: async (sourceObject) => {
|
|
3393
|
-
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
3394
|
-
fileClient
|
|
3395
|
-
});
|
|
3396
|
-
},
|
|
3397
|
-
onBeforeWriteObject: async (sourceObject) => {
|
|
3398
|
-
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
3399
|
-
directory,
|
|
3400
|
-
fileClient
|
|
3401
|
-
});
|
|
3402
|
-
}
|
|
3267
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3403
3268
|
});
|
|
3404
3269
|
}
|
|
3405
3270
|
};
|
|
@@ -5590,7 +5455,7 @@ import { PostHog } from "posthog-node";
|
|
|
5590
5455
|
// package.json
|
|
5591
5456
|
var package_default = {
|
|
5592
5457
|
name: "@uniformdev/cli",
|
|
5593
|
-
version: "19.
|
|
5458
|
+
version: "19.87.0",
|
|
5594
5459
|
description: "Uniform command line interface tool",
|
|
5595
5460
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5596
5461
|
main: "./cli.js",
|
|
@@ -7714,9 +7579,9 @@ var SyncPullModule = {
|
|
|
7714
7579
|
)
|
|
7715
7580
|
),
|
|
7716
7581
|
handler: async ({ serialization, ...otherParams }) => {
|
|
7582
|
+
var _a;
|
|
7717
7583
|
const config2 = serialization;
|
|
7718
7584
|
const enabledEntities = Object.entries({
|
|
7719
|
-
asset: AssetPullModule,
|
|
7720
7585
|
category: CategoryPullModule,
|
|
7721
7586
|
dataType: DataTypePullModule,
|
|
7722
7587
|
prompt: PromptPullModule,
|
|
@@ -7732,10 +7597,11 @@ var SyncPullModule = {
|
|
|
7732
7597
|
projectMapNode: ProjectMapNodePullModule,
|
|
7733
7598
|
redirect: RedirectDefinitionPullModule,
|
|
7734
7599
|
entry: EntryPullModule,
|
|
7735
|
-
contentType: ContentTypePullModule
|
|
7600
|
+
contentType: ContentTypePullModule,
|
|
7601
|
+
asset: AssetPullModule
|
|
7736
7602
|
}).filter(([entityType]) => {
|
|
7737
|
-
var
|
|
7738
|
-
return Boolean((
|
|
7603
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
7604
|
+
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
7739
7605
|
});
|
|
7740
7606
|
if (enabledEntities.length === 0) {
|
|
7741
7607
|
throw new Error(
|
|
@@ -7744,10 +7610,14 @@ var SyncPullModule = {
|
|
|
7744
7610
|
}
|
|
7745
7611
|
for (const [entityType, module3] of enabledEntities) {
|
|
7746
7612
|
const spinner = spin(entityType);
|
|
7613
|
+
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
7614
|
+
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
7615
|
+
};
|
|
7616
|
+
const entityConfig = (_a = config2.entitiesConfig) == null ? void 0 : _a[entityType];
|
|
7747
7617
|
try {
|
|
7748
7618
|
await module3.handler({
|
|
7749
7619
|
...otherParams,
|
|
7750
|
-
state: 0,
|
|
7620
|
+
state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
|
|
7751
7621
|
format: getFormat(entityType, config2),
|
|
7752
7622
|
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
7753
7623
|
onlyPatterns: entityType === "pattern" ? true : void 0,
|
|
@@ -7808,7 +7678,6 @@ var SyncPushModule = {
|
|
|
7808
7678
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
7809
7679
|
const config2 = serialization;
|
|
7810
7680
|
const enabledEntities = Object.entries({
|
|
7811
|
-
asset: AssetPushModule,
|
|
7812
7681
|
category: CategoryPushModule,
|
|
7813
7682
|
dataType: DataTypePushModule,
|
|
7814
7683
|
prompt: PromptPushModule,
|
|
@@ -7824,7 +7693,8 @@ var SyncPushModule = {
|
|
|
7824
7693
|
projectMapNode: ProjectMapNodePushModule,
|
|
7825
7694
|
redirect: RedirectDefinitionPushModule,
|
|
7826
7695
|
contentType: ContentTypePushModule,
|
|
7827
|
-
entry: EntryPushModule
|
|
7696
|
+
entry: EntryPushModule,
|
|
7697
|
+
asset: AssetPushModule
|
|
7828
7698
|
}).filter(([entityType]) => {
|
|
7829
7699
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7830
7700
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.87.0",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@thi.ng/mime": "^2.2.23",
|
|
20
|
-
"@uniformdev/assets": "19.
|
|
21
|
-
"@uniformdev/canvas": "19.
|
|
22
|
-
"@uniformdev/context": "19.
|
|
23
|
-
"@uniformdev/files": "19.
|
|
24
|
-
"@uniformdev/project-map": "19.
|
|
25
|
-
"@uniformdev/redirect": "19.
|
|
20
|
+
"@uniformdev/assets": "19.87.0",
|
|
21
|
+
"@uniformdev/canvas": "19.87.0",
|
|
22
|
+
"@uniformdev/context": "19.87.0",
|
|
23
|
+
"@uniformdev/files": "19.87.0",
|
|
24
|
+
"@uniformdev/project-map": "19.87.0",
|
|
25
|
+
"@uniformdev/redirect": "19.87.0",
|
|
26
26
|
"call-bind": "^1.0.2",
|
|
27
27
|
"colorette": "2.0.20",
|
|
28
28
|
"cosmiconfig": "8.3.6",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "596b9c4afbabb8579dd0e6c80690df135d6c55fc"
|
|
73
73
|
}
|