@uniformdev/cli 20.63.1-alpha.12 → 20.63.1-alpha.17
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.
|
@@ -22,7 +22,7 @@ import { fetch as undiciFetch, ProxyAgent } from "undici";
|
|
|
22
22
|
// package.json
|
|
23
23
|
var package_default = {
|
|
24
24
|
name: "@uniformdev/cli",
|
|
25
|
-
version: "20.
|
|
25
|
+
version: "20.66.0",
|
|
26
26
|
description: "Uniform command line interface tool",
|
|
27
27
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
28
28
|
main: "./cli.js",
|
package/dist/defaultConfig.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
withFormatOptions,
|
|
19
19
|
withProjectOptions,
|
|
20
20
|
withTeamOptions
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KIFJLCAG.mjs";
|
|
22
22
|
|
|
23
23
|
// src/index.ts
|
|
24
24
|
import * as dotenv from "dotenv";
|
|
@@ -625,9 +625,6 @@ export default uniformConfig({
|
|
|
625
625
|
`;
|
|
626
626
|
|
|
627
627
|
// src/sync/fileSyncEngineDataSource.ts
|
|
628
|
-
function isErrorWithCode(error, code) {
|
|
629
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
630
|
-
}
|
|
631
628
|
async function createFileSyncEngineDataSource({
|
|
632
629
|
directory,
|
|
633
630
|
format = "yaml",
|
|
@@ -688,7 +685,7 @@ ${e?.message}`));
|
|
|
688
685
|
}
|
|
689
686
|
await unlink(providerId);
|
|
690
687
|
},
|
|
691
|
-
writeObject: async (object4
|
|
688
|
+
writeObject: async (object4) => {
|
|
692
689
|
const filename = selectFilename3 ? join(directory, `${selectFilename3(object4.object)}.${format}`) : getFullFilename(object4.id);
|
|
693
690
|
let contents = object4.object;
|
|
694
691
|
if (selectSchemaUrl2) {
|
|
@@ -701,18 +698,6 @@ ${e?.message}`));
|
|
|
701
698
|
console.log(`Writing file ${filename}`);
|
|
702
699
|
}
|
|
703
700
|
emitWithFormat(contents, format, filename);
|
|
704
|
-
if (existingObject?.providerId && existingObject.providerId !== filename) {
|
|
705
|
-
if (verbose) {
|
|
706
|
-
console.log(`Deleting file ${existingObject.providerId}`);
|
|
707
|
-
}
|
|
708
|
-
try {
|
|
709
|
-
await unlink(existingObject.providerId);
|
|
710
|
-
} catch (error) {
|
|
711
|
-
if (!isErrorWithCode(error, "ENOENT")) {
|
|
712
|
-
throw error;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
701
|
}
|
|
717
702
|
};
|
|
718
703
|
}
|
|
@@ -851,46 +836,43 @@ async function syncEngine({
|
|
|
851
836
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
852
837
|
const targetObject = targetItems.get(ids[0]);
|
|
853
838
|
status.compared++;
|
|
854
|
-
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter(
|
|
855
|
-
(invalidTargetObject) => typeof invalidTargetObject !== "undefined" && invalidTargetObject.object !== targetObject?.object
|
|
856
|
-
);
|
|
857
|
-
const targetIds = Array.isArray(targetObject?.id) ? targetObject.id : [targetObject?.id];
|
|
858
|
-
const processedIds = new Set([...ids, ...targetIds].filter((id) => typeof id === "string"));
|
|
859
|
-
const processUpdate = async (sourceObject2, targetObject2) => {
|
|
860
|
-
try {
|
|
861
|
-
if (!whatIf) {
|
|
862
|
-
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
863
|
-
await target.writeObject(finalSourceObject, targetObject2);
|
|
864
|
-
status.changesApplied++;
|
|
865
|
-
}
|
|
866
|
-
} catch (e) {
|
|
867
|
-
if (onError) {
|
|
868
|
-
onError(e, sourceObject2);
|
|
869
|
-
} else {
|
|
870
|
-
throw new SyncEngineError(e, sourceObject2);
|
|
871
|
-
}
|
|
872
|
-
} finally {
|
|
873
|
-
log2({
|
|
874
|
-
action: "update",
|
|
875
|
-
id: ids[0],
|
|
876
|
-
providerId: sourceObject2.providerId,
|
|
877
|
-
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
878
|
-
whatIf,
|
|
879
|
-
diff: () => diffJson(targetObject2.object, sourceObject2.object)
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
};
|
|
839
|
+
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o?.object !== targetObject?.object);
|
|
883
840
|
if (targetObject && invalidTargetObjects.length === 0) {
|
|
884
841
|
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
885
842
|
const compareResult = compareContents(sourceObject, targetObject);
|
|
886
843
|
if (!compareResult) {
|
|
887
844
|
if (mode === "createOrUpdate" || mode === "mirror") {
|
|
888
845
|
status.changeCount++;
|
|
889
|
-
|
|
846
|
+
const process2 = async (sourceObject2, targetObject2) => {
|
|
847
|
+
try {
|
|
848
|
+
if (!whatIf) {
|
|
849
|
+
const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
|
|
850
|
+
await target.writeObject(finalSourceObject, targetObject2);
|
|
851
|
+
status.changesApplied++;
|
|
852
|
+
}
|
|
853
|
+
} catch (e) {
|
|
854
|
+
if (onError) {
|
|
855
|
+
onError(e, sourceObject2);
|
|
856
|
+
} else {
|
|
857
|
+
throw new SyncEngineError(e, sourceObject2);
|
|
858
|
+
}
|
|
859
|
+
} finally {
|
|
860
|
+
log2({
|
|
861
|
+
action: "update",
|
|
862
|
+
id: ids[0],
|
|
863
|
+
providerId: sourceObject2.providerId,
|
|
864
|
+
displayName: sourceObject2.displayName ?? sourceObject2.providerId,
|
|
865
|
+
whatIf,
|
|
866
|
+
diff: () => diffJson(targetObject2.object, sourceObject2.object)
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
actions.push(() => process2(sourceObject, targetObject));
|
|
890
871
|
}
|
|
891
872
|
}
|
|
892
|
-
|
|
873
|
+
ids.forEach((i) => targetItems.delete(i));
|
|
893
874
|
} else {
|
|
875
|
+
status.changeCount++;
|
|
894
876
|
const processUpsert = async (sourceObject2, id) => {
|
|
895
877
|
try {
|
|
896
878
|
if (!whatIf) {
|
|
@@ -916,23 +898,6 @@ async function syncEngine({
|
|
|
916
898
|
}
|
|
917
899
|
};
|
|
918
900
|
if (invalidTargetObjects.length > 0) {
|
|
919
|
-
if (mode === "createOrUpdate" && !targetObject && invalidTargetObjects.length === 1) {
|
|
920
|
-
const matchedTargetObject = invalidTargetObjects[0];
|
|
921
|
-
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, matchedTargetObject) : sourceObject;
|
|
922
|
-
const compareResult = compareContents(sourceObject, matchedTargetObject);
|
|
923
|
-
if (!compareResult) {
|
|
924
|
-
status.changeCount++;
|
|
925
|
-
actions.push(() => processUpdate(sourceObject, matchedTargetObject));
|
|
926
|
-
}
|
|
927
|
-
(Array.isArray(matchedTargetObject.id) ? matchedTargetObject.id : [matchedTargetObject.id]).forEach(
|
|
928
|
-
(i) => targetItems.delete(i)
|
|
929
|
-
);
|
|
930
|
-
continue;
|
|
931
|
-
}
|
|
932
|
-
if (mode !== "mirror") {
|
|
933
|
-
continue;
|
|
934
|
-
}
|
|
935
|
-
status.changeCount++;
|
|
936
901
|
[...invalidTargetObjects, targetObject].forEach((o) => {
|
|
937
902
|
(Array.isArray(o?.id) ? o?.id : [o?.id])?.forEach((i) => i && targetItems.delete(i));
|
|
938
903
|
});
|
|
@@ -944,22 +909,20 @@ async function syncEngine({
|
|
|
944
909
|
() => Promise.all(deletes.map((deleteFn) => deleteFn())).then(() => processUpsert(sourceObject, ids[0]))
|
|
945
910
|
);
|
|
946
911
|
} else {
|
|
947
|
-
status.changeCount++;
|
|
948
912
|
actions.push(() => processUpsert(sourceObject, ids[0]));
|
|
949
913
|
}
|
|
950
914
|
}
|
|
951
915
|
}
|
|
952
|
-
|
|
916
|
+
status.changeCount += targetItems.size;
|
|
917
|
+
status.compared += targetItems.size;
|
|
953
918
|
if (mode === "mirror") {
|
|
954
|
-
|
|
955
|
-
status.compared += orphanTargetObjects.size;
|
|
956
|
-
if (!sourceHasItems && !allowEmptySource && orphanTargetObjects.size > 0) {
|
|
919
|
+
if (!sourceHasItems && !allowEmptySource && targetItems.size > 0) {
|
|
957
920
|
throw new Error(
|
|
958
921
|
`Sync source (${source.name}) is empty and mode is mirror. This would cause deletion of everything in the target (${target.name}), and most likely indicates an error in source definition.`
|
|
959
922
|
);
|
|
960
923
|
}
|
|
961
924
|
const deletes = [];
|
|
962
|
-
|
|
925
|
+
targetItems.forEach((object4) => {
|
|
963
926
|
deletes.push(() => processDelete(object4));
|
|
964
927
|
});
|
|
965
928
|
await Promise.all(deletes.map((d) => d()));
|
|
@@ -11994,20 +11957,6 @@ var selectIdentifier15 = (source, projectId) => [
|
|
|
11994
11957
|
];
|
|
11995
11958
|
var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
|
|
11996
11959
|
var selectDisplayName15 = (source) => `${source.name} (pid: ${source.id})`;
|
|
11997
|
-
function alignProjectMapNodeWithTargetIdentifier(sourceObject, targetObject) {
|
|
11998
|
-
if (!targetObject) {
|
|
11999
|
-
return sourceObject;
|
|
12000
|
-
}
|
|
12001
|
-
return {
|
|
12002
|
-
...sourceObject,
|
|
12003
|
-
id: targetObject.id,
|
|
12004
|
-
providerId: targetObject.providerId,
|
|
12005
|
-
object: {
|
|
12006
|
-
...sourceObject.object,
|
|
12007
|
-
id: targetObject.object.id
|
|
12008
|
-
}
|
|
12009
|
-
};
|
|
12010
|
-
}
|
|
12011
11960
|
|
|
12012
11961
|
// src/commands/project-map/ProjectMapNodeEngineDataSource.ts
|
|
12013
11962
|
function createProjectMapNodeEngineDataSource({
|
|
@@ -12224,12 +12173,6 @@ var ProjectMapNodePushModule = {
|
|
|
12224
12173
|
whatIf,
|
|
12225
12174
|
allowEmptySource,
|
|
12226
12175
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
12227
|
-
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
12228
|
-
return alignProjectMapNodeWithTargetIdentifier(sourceObject, targetObject);
|
|
12229
|
-
},
|
|
12230
|
-
onBeforeWriteObject: async (sourceObject, targetObject) => {
|
|
12231
|
-
return alignProjectMapNodeWithTargetIdentifier(sourceObject, targetObject);
|
|
12232
|
-
},
|
|
12233
12176
|
onError: (error, object4) => {
|
|
12234
12177
|
if (error.message.includes(__INTERNAL_MISSING_PARENT_NODE_ERROR)) {
|
|
12235
12178
|
nodesFailedDueToMissingParent.add(object4.object);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "20.63.1-alpha.
|
|
3
|
+
"version": "20.63.1-alpha.17+cd7eca3818",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@inquirer/prompts": "^7.10.1",
|
|
29
29
|
"@thi.ng/mime": "^2.2.23",
|
|
30
|
-
"@uniformdev/assets": "20.63.1-alpha.
|
|
31
|
-
"@uniformdev/canvas": "20.63.1-alpha.
|
|
32
|
-
"@uniformdev/context": "20.63.1-alpha.
|
|
33
|
-
"@uniformdev/files": "20.63.1-alpha.
|
|
34
|
-
"@uniformdev/project-map": "20.63.1-alpha.
|
|
35
|
-
"@uniformdev/redirect": "20.63.1-alpha.
|
|
36
|
-
"@uniformdev/richtext": "20.63.1-alpha.
|
|
30
|
+
"@uniformdev/assets": "20.63.1-alpha.17+cd7eca3818",
|
|
31
|
+
"@uniformdev/canvas": "20.63.1-alpha.17+cd7eca3818",
|
|
32
|
+
"@uniformdev/context": "20.63.1-alpha.17+cd7eca3818",
|
|
33
|
+
"@uniformdev/files": "20.63.1-alpha.17+cd7eca3818",
|
|
34
|
+
"@uniformdev/project-map": "20.63.1-alpha.17+cd7eca3818",
|
|
35
|
+
"@uniformdev/redirect": "20.63.1-alpha.17+cd7eca3818",
|
|
36
|
+
"@uniformdev/richtext": "20.63.1-alpha.17+cd7eca3818",
|
|
37
37
|
"call-bind": "^1.0.2",
|
|
38
38
|
"colorette": "2.0.20",
|
|
39
39
|
"cosmiconfig": "9.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "cd7eca38189533a6ba5899bf872b72e1331c4aa3"
|
|
84
84
|
}
|