declastruct 1.1.11 → 1.1.12
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.
|
@@ -8,35 +8,35 @@ const DeclastructChange_1 = require("../../domain.objects/DeclastructChange");
|
|
|
8
8
|
/**
|
|
9
9
|
* .what = checks if two resources are equivalent
|
|
10
10
|
* .why = determines whether a resource needs to be updated
|
|
11
|
-
* .note = uses deterministic serialization for deep equality check, ignoring
|
|
11
|
+
* .note = uses deterministic serialization for deep equality check, ignoring readonly
|
|
12
12
|
*/
|
|
13
13
|
const checkAreResourcesEquivalent = (input) => {
|
|
14
|
-
// serialize both deterministically for deep comparison, omitting
|
|
15
|
-
const remoteSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.
|
|
16
|
-
const desiredSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.
|
|
14
|
+
// serialize both deterministically for deep comparison, omitting readonly
|
|
15
|
+
const remoteSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.omitReadonly)(input.remote));
|
|
16
|
+
const desiredSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.omitReadonly)(input.desired));
|
|
17
17
|
return remoteSerialized === desiredSerialized;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* .what = computes human-readable diff between two resources
|
|
21
21
|
* .why = helps users understand what will change
|
|
22
|
-
* .note = returns null if resources are identical; for CREATE uses empty object to show all attributes; ignores
|
|
22
|
+
* .note = returns null if resources are identical; for CREATE uses empty object to show all attributes; ignores readonly
|
|
23
23
|
*/
|
|
24
24
|
const computeDiff = ({ from, into, }) => {
|
|
25
25
|
// no diff if both are null
|
|
26
26
|
if (from === null && into === null)
|
|
27
27
|
return null;
|
|
28
|
-
// check if resources are equivalent after omitting
|
|
28
|
+
// check if resources are equivalent after omitting readonly
|
|
29
29
|
if (from !== null && into !== null) {
|
|
30
|
-
const fromSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.
|
|
31
|
-
const intoSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.
|
|
30
|
+
const fromSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.omitReadonly)(from));
|
|
31
|
+
const intoSerialized = (0, domain_objects_1.serialize)((0, domain_objects_1.omitReadonly)(into));
|
|
32
32
|
if (fromSerialized === intoSerialized)
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
|
-
// omit
|
|
36
|
-
const
|
|
37
|
-
const
|
|
35
|
+
// omit readonly before diff
|
|
36
|
+
const fromWithoutReadonly = from === null ? {} : (0, domain_objects_1.omitReadonly)(from);
|
|
37
|
+
const intoWithoutReadonly = into === null ? {} : (0, domain_objects_1.omitReadonly)(into);
|
|
38
38
|
// compute diff using jest-diff
|
|
39
|
-
const difference = (0, jest_diff_1.diff)(
|
|
39
|
+
const difference = (0, jest_diff_1.diff)(fromWithoutReadonly, intoWithoutReadonly, {
|
|
40
40
|
aAnnotation: 'Remote',
|
|
41
41
|
bAnnotation: 'Desired',
|
|
42
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeChange.js","sourceRoot":"","sources":["../../../src/domain.operations/plan/computeChange.ts"],"names":[],"mappings":";;;AAAA,mDAKwB;AACxB,mDAAyD;AACzD,yCAAiC;AAEjC,8EAGgD;AAEhD;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,CAAC,KAGpC,EAAW,EAAE;IACZ,0EAA0E;IAC1E,MAAM,gBAAgB,GAAG,IAAA,0BAAS,EAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"computeChange.js","sourceRoot":"","sources":["../../../src/domain.operations/plan/computeChange.ts"],"names":[],"mappings":";;;AAAA,mDAKwB;AACxB,mDAAyD;AACzD,yCAAiC;AAEjC,8EAGgD;AAEhD;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,CAAC,KAGpC,EAAW,EAAE;IACZ,0EAA0E;IAC1E,MAAM,gBAAgB,GAAG,IAAA,0BAAS,EAAC,IAAA,6BAAY,EAAC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EAChD;gBACE,OAAO,EAAE,mCAAmC;gBAC5C,QAAQ,EAAE;oBACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;oBAC1B,KAAK,EAAE;wBACL,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI;wBAClC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI;qBACjC;iBACF;aACF,CACF,EAAE;SACJ;QACD,MAAM;QACN,KAAK,EAAE;YACL,OAAO;YACP,MAAM;YACN,UAAU;SACX;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AArEW,QAAA,aAAa,iBAqExB"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "declastruct",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "Add declarative control to any resource constructs. Declare, plan, and apply within an observable pit-of-success.",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.12",
|
|
6
6
|
"repository": "ehmpathy/declastruct",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/declastruct",
|
|
8
8
|
"keywords": [
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid-fns": "1.0.2"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"domain-objects": "
|
|
67
|
+
"domain-objects": "0.31.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@commitlint/cli": "19.3.0",
|