filegrc 0.13.1 → 0.13.3
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/package.json +4 -2
- package/src/collection-review.js +28 -8
- package/src/git.js +1970 -794
- package/src/web.js +174 -73
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filegrc",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Zero-dependency Git-native GRC engine",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "node ../../scripts/run-filegrc-tests.mjs",
|
|
25
|
-
"test:
|
|
25
|
+
"test:unit": "node ../../scripts/run-filegrc-tests.mjs --tier unit",
|
|
26
|
+
"test:integration": "node ../../scripts/run-filegrc-tests.mjs --tier integration",
|
|
27
|
+
"test:fast": "npm run test:unit",
|
|
26
28
|
"test:full": "npm test"
|
|
27
29
|
},
|
|
28
30
|
"engines": {
|
package/src/collection-review.js
CHANGED
|
@@ -102,17 +102,37 @@ export async function scaffoldCollectionReview(input = process.cwd(), options =
|
|
|
102
102
|
const resourceType = requiredType(loaded, options.resourceType);
|
|
103
103
|
const assessment = assessCollectionReview(loaded, resourceType, { programId: program.id });
|
|
104
104
|
const allowedDecisions = assessment.configuration.decisions || ["complete"];
|
|
105
|
+
const now = options.now ? new Date(options.now) : new Date();
|
|
106
|
+
if (Number.isNaN(now.getTime())) throw new Error("A valid Collection Review time is required.");
|
|
107
|
+
const priorReview = assessment.review;
|
|
108
|
+
const v4 = modelSupports(loaded.model, "program-scope");
|
|
109
|
+
const priorAuthoritativeSourceId = priorReview?.authoritativeComponentId || priorReview?.authoritativeSystemId || null;
|
|
110
|
+
const priorAuthoritativeSourceActive = priorReview?.decision !== "externally-managed" || loaded.resources.some((record) => (
|
|
111
|
+
record.type === (v4 ? "component" : "system")
|
|
112
|
+
&& record.id === priorAuthoritativeSourceId
|
|
113
|
+
&& record.status === "active"
|
|
114
|
+
));
|
|
115
|
+
const priorDecisionStillValid = allowedDecisions.includes(priorReview?.decision)
|
|
116
|
+
&& priorAuthoritativeSourceActive
|
|
117
|
+
&& (assessment.records.length
|
|
118
|
+
? priorReview.decision !== "zero-population"
|
|
119
|
+
: priorReview.decision !== "complete");
|
|
120
|
+
const preservedAuthoritativeSourceId = priorDecisionStillValid && priorReview.decision === "externally-managed"
|
|
121
|
+
? priorAuthoritativeSourceId
|
|
122
|
+
: null;
|
|
105
123
|
return {
|
|
106
124
|
resourceType,
|
|
107
|
-
decision: assessment.records.length
|
|
125
|
+
decision: priorDecisionStillValid ? priorReview.decision : (assessment.records.length
|
|
108
126
|
? "complete"
|
|
109
|
-
: allowedDecisions.includes("zero-population") ? "zero-population" : null,
|
|
110
|
-
rationale: null,
|
|
111
|
-
reviewedByIds: [],
|
|
112
|
-
reviewedOn:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
127
|
+
: allowedDecisions.includes("zero-population") ? "zero-population" : null),
|
|
128
|
+
rationale: priorReview?.rationale || null,
|
|
129
|
+
reviewedByIds: [...(priorReview?.reviewedByIds || [])],
|
|
130
|
+
reviewedOn: priorReview?.reviewedOn
|
|
131
|
+
? currentCalendarDate(loaded.workspace.timezone, now)
|
|
132
|
+
: null,
|
|
133
|
+
...(v4
|
|
134
|
+
? { authoritativeComponentId: preservedAuthoritativeSourceId }
|
|
135
|
+
: { authoritativeSystemId: preservedAuthoritativeSourceId })
|
|
116
136
|
};
|
|
117
137
|
}
|
|
118
138
|
|