sf-plugin-permission-sets 0.0.0-dev.8 → 0.0.0-dev.80
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/LICENSE.md +28 -0
- package/README.md +335 -97
- package/lib/adapters/connection-org-client.d.ts +23 -0
- package/lib/adapters/connection-org-client.d.ts.map +1 -0
- package/lib/adapters/connection-org-client.js +370 -0
- package/lib/adapters/connection-org-client.js.map +1 -0
- package/lib/adapters/index.d.ts +2 -0
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/index.js +2 -0
- package/lib/adapters/index.js.map +1 -0
- package/lib/commands/ps/apply.d.ts +41 -0
- package/lib/commands/ps/apply.d.ts.map +1 -0
- package/lib/commands/ps/apply.js +179 -0
- package/lib/commands/ps/apply.js.map +1 -0
- package/lib/commands/ps/check.d.ts +21 -0
- package/lib/commands/ps/check.d.ts.map +1 -0
- package/lib/commands/ps/check.js +55 -0
- package/lib/commands/ps/check.js.map +1 -0
- package/lib/commands/ps/export.d.ts +26 -0
- package/lib/commands/ps/export.d.ts.map +1 -0
- package/lib/commands/ps/export.js +74 -0
- package/lib/commands/ps/export.js.map +1 -0
- package/lib/commands/ps/plan.d.ts +61 -0
- package/lib/commands/ps/plan.d.ts.map +1 -0
- package/lib/commands/ps/plan.js +193 -0
- package/lib/commands/ps/plan.js.map +1 -0
- package/lib/commands/ps/validate.d.ts +21 -0
- package/lib/commands/ps/validate.d.ts.map +1 -0
- package/lib/commands/ps/validate.js +56 -0
- package/lib/commands/ps/validate.js.map +1 -0
- package/lib/core/diff.d.ts +46 -0
- package/lib/core/diff.d.ts.map +1 -0
- package/lib/core/diff.js +118 -0
- package/lib/core/diff.js.map +1 -0
- package/lib/core/finding.d.ts +43 -0
- package/lib/core/finding.d.ts.map +1 -0
- package/lib/core/finding.js +76 -0
- package/lib/core/finding.js.map +1 -0
- package/lib/core/index.d.ts +11 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +10 -0
- package/lib/core/index.js.map +1 -0
- package/lib/core/load.d.ts +4 -0
- package/lib/core/load.d.ts.map +1 -0
- package/lib/core/load.js +60 -0
- package/lib/core/load.js.map +1 -0
- package/lib/core/model.d.ts +77 -0
- package/lib/core/model.d.ts.map +1 -0
- package/lib/core/model.js +2 -0
- package/lib/core/model.js.map +1 -0
- package/lib/core/normalize.d.ts +17 -0
- package/lib/core/normalize.d.ts.map +1 -0
- package/lib/core/normalize.js +74 -0
- package/lib/core/normalize.js.map +1 -0
- package/lib/core/parse.d.ts +10 -0
- package/lib/core/parse.d.ts.map +1 -0
- package/lib/core/parse.js +20 -0
- package/lib/core/parse.js.map +1 -0
- package/lib/core/report.d.ts +16 -0
- package/lib/core/report.d.ts.map +1 -0
- package/lib/core/report.js +138 -0
- package/lib/core/report.js.map +1 -0
- package/lib/core/resolve.d.ts +22 -0
- package/lib/core/resolve.d.ts.map +1 -0
- package/lib/core/resolve.js +92 -0
- package/lib/core/resolve.js.map +1 -0
- package/lib/core/schema.d.ts +23 -0
- package/lib/core/schema.d.ts.map +1 -0
- package/lib/core/schema.js +35 -0
- package/lib/core/schema.js.map +1 -0
- package/lib/core/serialize.d.ts +9 -0
- package/lib/core/serialize.d.ts.map +1 -0
- package/lib/core/serialize.js +50 -0
- package/lib/core/serialize.js.map +1 -0
- package/lib/core/target-name.d.ts +20 -0
- package/lib/core/target-name.d.ts.map +1 -0
- package/lib/core/target-name.js +32 -0
- package/lib/core/target-name.js.map +1 -0
- package/lib/core/username.d.ts +23 -0
- package/lib/core/username.d.ts.map +1 -0
- package/lib/core/username.js +35 -0
- package/lib/core/username.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/services/adapters/index.d.ts +2 -0
- package/lib/services/adapters/index.d.ts.map +1 -0
- package/lib/services/adapters/index.js +2 -0
- package/lib/services/adapters/index.js.map +1 -0
- package/lib/services/adapters/org-client.d.ts +26 -0
- package/lib/services/adapters/org-client.d.ts.map +1 -0
- package/lib/services/adapters/org-client.js +2 -0
- package/lib/services/adapters/org-client.js.map +1 -0
- package/lib/services/apply.d.ts +33 -0
- package/lib/services/apply.d.ts.map +1 -0
- package/lib/services/apply.js +82 -0
- package/lib/services/apply.js.map +1 -0
- package/lib/services/check.d.ts +14 -0
- package/lib/services/check.d.ts.map +1 -0
- package/lib/services/check.js +18 -0
- package/lib/services/check.js.map +1 -0
- package/lib/services/export.d.ts +19 -0
- package/lib/services/export.d.ts.map +1 -0
- package/lib/services/export.js +30 -0
- package/lib/services/export.js.map +1 -0
- package/lib/services/index.d.ts +6 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +6 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/plan.d.ts +22 -0
- package/lib/services/plan.d.ts.map +1 -0
- package/lib/services/plan.js +44 -0
- package/lib/services/plan.js.map +1 -0
- package/lib/services/resolution.d.ts +25 -0
- package/lib/services/resolution.d.ts.map +1 -0
- package/lib/services/resolution.js +78 -0
- package/lib/services/resolution.js.map +1 -0
- package/lib/services/validate.d.ts +22 -0
- package/lib/services/validate.d.ts.map +1 -0
- package/lib/services/validate.js +62 -0
- package/lib/services/validate.js.map +1 -0
- package/messages/ps.apply.md +85 -0
- package/messages/ps.check.md +33 -0
- package/messages/ps.export.md +45 -0
- package/messages/ps.plan.md +85 -0
- package/messages/ps.validate.md +29 -0
- package/package.json +119 -180
- package/lib/commands/ps/info.d.ts +0 -11
- package/lib/commands/ps/info.js +0 -17
- package/lib/commands/ps/info.js.map +0 -1
- package/messages/ps.info.md +0 -17
- package/oclif.lock +0 -7781
- package/oclif.manifest.json +0 -51
package/lib/core/diff.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** A diff narrowed to one mode: what that mode acts on, and the drift it leaves behind. */
|
|
2
|
+
export class ScopedChange {
|
|
3
|
+
additions;
|
|
4
|
+
updates;
|
|
5
|
+
removals;
|
|
6
|
+
drift;
|
|
7
|
+
constructor(additions, updates, removals, drift) {
|
|
8
|
+
this.additions = additions;
|
|
9
|
+
this.updates = updates;
|
|
10
|
+
this.removals = removals;
|
|
11
|
+
this.drift = drift;
|
|
12
|
+
}
|
|
13
|
+
/** How many assignments this mode would act on. */
|
|
14
|
+
get count() {
|
|
15
|
+
return this.additions.length + this.updates.length + this.removals.length;
|
|
16
|
+
}
|
|
17
|
+
/** How many distinct users this mode would touch. */
|
|
18
|
+
get usersAffected() {
|
|
19
|
+
const acted = [
|
|
20
|
+
...this.additions,
|
|
21
|
+
...this.updates,
|
|
22
|
+
...this.removals,
|
|
23
|
+
];
|
|
24
|
+
const assignees = new Set(acted.map((assignment) => assignment.assignee.asKey()));
|
|
25
|
+
return assignees.size;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** The change set between the desired model and the org's current state. */
|
|
29
|
+
export class Diff {
|
|
30
|
+
toAdd;
|
|
31
|
+
toUpdate;
|
|
32
|
+
toRemove;
|
|
33
|
+
unchanged;
|
|
34
|
+
constructor(toAdd, toUpdate, toRemove, unchanged) {
|
|
35
|
+
this.toAdd = toAdd;
|
|
36
|
+
this.toUpdate = toUpdate;
|
|
37
|
+
this.toRemove = toRemove;
|
|
38
|
+
this.unchanged = unchanged;
|
|
39
|
+
}
|
|
40
|
+
/** The diff of a run that aborted before it ever reached the org. */
|
|
41
|
+
static empty() {
|
|
42
|
+
return new Diff([], [], [], []);
|
|
43
|
+
}
|
|
44
|
+
/** How many assignments differ, whatever the mode would act on. */
|
|
45
|
+
get changeCount() {
|
|
46
|
+
return this.toAdd.length + this.toUpdate.length + this.toRemove.length;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Narrow the diff to what the chosen mode acts on: additive skips removals,
|
|
50
|
+
* destructive skips adds and updates, sync acts on all. Whatever the mode skips
|
|
51
|
+
* comes back as drift, so plan and apply report it rather than hiding it.
|
|
52
|
+
*/
|
|
53
|
+
scopeTo(mode) {
|
|
54
|
+
const additions = mode === 'destructive' ? [] : this.toAdd;
|
|
55
|
+
const updates = mode === 'destructive' ? [] : this.toUpdate;
|
|
56
|
+
const removals = mode === 'additive' ? [] : this.toRemove;
|
|
57
|
+
const drift = {
|
|
58
|
+
adds: mode === 'destructive' ? this.toAdd.length : 0,
|
|
59
|
+
updates: mode === 'destructive' ? this.toUpdate.length : 0,
|
|
60
|
+
removes: mode === 'additive' ? this.toRemove.length : 0,
|
|
61
|
+
};
|
|
62
|
+
return new ScopedChange(additions, updates, removals, drift);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Key for an (assignee, kind, target) tuple, off the identifiers' own comparison keys. */
|
|
66
|
+
function assignmentKey(assignee, kind, target) {
|
|
67
|
+
return `${assignee.asKey()} ${kind} ${target.asKey()}`;
|
|
68
|
+
}
|
|
69
|
+
/** Whether two expirations name the same instant. Both absent (null) counts as equal. */
|
|
70
|
+
function sameExpiration(left, right) {
|
|
71
|
+
if (!left || !right) {
|
|
72
|
+
return left === right;
|
|
73
|
+
}
|
|
74
|
+
return Date.parse(left) === Date.parse(right);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Compare the desired assignments against the org's current memberships of the
|
|
78
|
+
* managed targets. `actual` must hold only assignments for targets that appear
|
|
79
|
+
* in `desired` (the managed set), so any actual row not in `desired` is an
|
|
80
|
+
* undeclared assignment eligible for removal. A declared assignment whose
|
|
81
|
+
* expiration differs from the org's is an update rather than unchanged.
|
|
82
|
+
*/
|
|
83
|
+
export function diffAssignments(desired, actual) {
|
|
84
|
+
const actualByKey = new Map();
|
|
85
|
+
for (const assignment of actual) {
|
|
86
|
+
actualByKey.set(assignmentKey(assignment.assignee, assignment.kind, assignment.target), assignment);
|
|
87
|
+
}
|
|
88
|
+
const desiredKeys = new Set();
|
|
89
|
+
const toAdd = [];
|
|
90
|
+
const toUpdate = [];
|
|
91
|
+
const unchanged = [];
|
|
92
|
+
for (const assignment of desired) {
|
|
93
|
+
const key = assignmentKey(assignment.assignee, assignment.kind, assignment.target);
|
|
94
|
+
if (desiredKeys.has(key))
|
|
95
|
+
continue;
|
|
96
|
+
desiredKeys.add(key);
|
|
97
|
+
const existing = actualByKey.get(key);
|
|
98
|
+
if (!existing) {
|
|
99
|
+
toAdd.push(assignment);
|
|
100
|
+
}
|
|
101
|
+
else if (sameExpiration(existing.expiration, assignment.expiration)) {
|
|
102
|
+
unchanged.push(existing);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
toUpdate.push({
|
|
106
|
+
recordId: existing.recordId,
|
|
107
|
+
assignee: existing.assignee,
|
|
108
|
+
kind: existing.kind,
|
|
109
|
+
target: existing.target,
|
|
110
|
+
expiration: assignment.expiration,
|
|
111
|
+
previousExpiration: existing.expiration,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const toRemove = actual.filter((assignment) => !desiredKeys.has(assignmentKey(assignment.assignee, assignment.kind, assignment.target)));
|
|
116
|
+
return new Diff(toAdd, toUpdate, toRemove, unchanged);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/core/diff.ts"],"names":[],"mappings":"AAOA,2FAA2F;AAC3F,MAAM,OAAO,YAAY;IAED;IACA;IACA;IACA;IAJpB,YACoB,SAA8B,EAC9B,OAA2B,EAC3B,QAA4B,EAC5B,KAAY;QAHZ,cAAS,GAAT,SAAS,CAAqB;QAC9B,YAAO,GAAP,OAAO,CAAoB;QAC3B,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,UAAK,GAAL,KAAK,CAAO;IAC7B,CAAC;IAEJ,mDAAmD;IACnD,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9E,CAAC;IAED,qDAAqD;IACrD,IAAW,aAAa;QACpB,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C,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAC3G,CAAC;IAEF,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TargetName } from './target-name.js';
|
|
2
|
+
import { Username } from './username.js';
|
|
3
|
+
type FindingLevel = 'error' | 'warning';
|
|
4
|
+
/** The closed vocabulary of finding codes. Adding one here is required to emit it. */
|
|
5
|
+
type FindingCode = 'YAML' | 'EMPTY_FILE' | 'SCHEMA' | 'EMPTY_LIST' | 'DUP_TARGET' | 'EMPTY_USER' | 'NO_FILES' | 'USER_NOT_FOUND' | 'USER_INACTIVE' | 'TARGET_NOT_FOUND' | 'TARGET_AMBIGUOUS';
|
|
6
|
+
export type Finding = {
|
|
7
|
+
level: FindingLevel;
|
|
8
|
+
code: FindingCode;
|
|
9
|
+
message: string;
|
|
10
|
+
file?: string;
|
|
11
|
+
line?: number;
|
|
12
|
+
};
|
|
13
|
+
/** Invalid YAML: the parser rejected the document. */
|
|
14
|
+
export declare function yamlError(message: string, file: string, line?: number): Finding;
|
|
15
|
+
/** The document parsed to nothing. */
|
|
16
|
+
export declare function emptyFileWarning(file: string): Finding;
|
|
17
|
+
/** The file violates the schema at `path`. */
|
|
18
|
+
export declare function schemaError(path: string, message: string, file: string): Finding;
|
|
19
|
+
/** A scope key is present but its list is empty. */
|
|
20
|
+
export declare function emptyListWarning(username: Username, scopeKey: string, file: string): Finding;
|
|
21
|
+
/** A target appears more than once under one scope for one user. */
|
|
22
|
+
export declare function dupTargetWarning(username: Username, target: TargetName, scopeKey: string, file: string): Finding;
|
|
23
|
+
/** A user declares no scopes at all. */
|
|
24
|
+
export declare function emptyUserWarning(username: Username, file: string): Finding;
|
|
25
|
+
/** No file on disk matched the given glob patterns. */
|
|
26
|
+
export declare function noFilesError(patterns: string[]): Finding;
|
|
27
|
+
/** A declared user does not exist in the org. */
|
|
28
|
+
export declare function userNotFoundError(username: Username): Finding;
|
|
29
|
+
/** A declared user exists but is inactive. */
|
|
30
|
+
export declare function userInactiveError(username: Username): Finding;
|
|
31
|
+
/** A declared target does not exist in the org. `label` is the kind's human name. */
|
|
32
|
+
export declare function targetNotFoundError(target: TargetName, label: string): Finding;
|
|
33
|
+
/** A declared target resolves to more than one record in the org. */
|
|
34
|
+
export declare function targetAmbiguousError(target: TargetName, label: string): Finding;
|
|
35
|
+
/** Render findings as human-readable lines. Shared by check, validate, and apply. */
|
|
36
|
+
export declare function formatFindings(findings: Finding[]): string[];
|
|
37
|
+
/** Count findings by level. */
|
|
38
|
+
export declare function countFindings(findings: Finding[]): {
|
|
39
|
+
errors: number;
|
|
40
|
+
warnings: number;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=finding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finding.d.ts","sourceRoot":"","sources":["../../src/core/finding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,KAAK,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;AAExC,sFAAsF;AACtF,KAAK,WAAW,GACV,MAAM,GACN,YAAY,GACZ,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,CAAC;AAEzB,MAAM,MAAM,OAAO,GAAG;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAiBF,sDAAsD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EAAE,GAAG,MAAM,EAAE,CAM5D;AAED,+BAA+B;AAC/B,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAKvF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Construct an error-level finding. Private: callers use the named constructors below. */
|
|
2
|
+
function error(code, message, where = {}) {
|
|
3
|
+
return { level: 'error', code, message, ...where };
|
|
4
|
+
}
|
|
5
|
+
/** Construct a warning-level finding. Private: callers use the named constructors below. */
|
|
6
|
+
function warning(code, message, where = {}) {
|
|
7
|
+
return { level: 'warning', code, message, ...where };
|
|
8
|
+
}
|
|
9
|
+
// Findings raised while reading and structurally checking a file.
|
|
10
|
+
/** Invalid YAML: the parser rejected the document. */
|
|
11
|
+
export function yamlError(message, file, line) {
|
|
12
|
+
return error('YAML', message, { file, line });
|
|
13
|
+
}
|
|
14
|
+
/** The document parsed to nothing. */
|
|
15
|
+
export function emptyFileWarning(file) {
|
|
16
|
+
return warning('EMPTY_FILE', 'file is empty', { file });
|
|
17
|
+
}
|
|
18
|
+
/** The file violates the schema at `path`. */
|
|
19
|
+
export function schemaError(path, message, file) {
|
|
20
|
+
return error('SCHEMA', `${path}: ${message}`, { file });
|
|
21
|
+
}
|
|
22
|
+
/** A scope key is present but its list is empty. */
|
|
23
|
+
export function emptyListWarning(username, scopeKey, file) {
|
|
24
|
+
return warning('EMPTY_LIST', `${username.toString()}: ${scopeKey} is empty`, { file });
|
|
25
|
+
}
|
|
26
|
+
/** A target appears more than once under one scope for one user. */
|
|
27
|
+
export function dupTargetWarning(username, target, scopeKey, file) {
|
|
28
|
+
return warning('DUP_TARGET', `${username.toString()}: ${target.toString()} is listed twice under ${scopeKey}`, { file });
|
|
29
|
+
}
|
|
30
|
+
/** A user declares no scopes at all. */
|
|
31
|
+
export function emptyUserWarning(username, file) {
|
|
32
|
+
return warning('EMPTY_USER', `${username.toString()}: no scopes declared`, { file });
|
|
33
|
+
}
|
|
34
|
+
/** No file on disk matched the given glob patterns. */
|
|
35
|
+
export function noFilesError(patterns) {
|
|
36
|
+
return error('NO_FILES', `no files matched: ${patterns.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
// Org-side findings, raised while resolving declarations against the org. No file or line.
|
|
39
|
+
/** A declared user does not exist in the org. */
|
|
40
|
+
export function userNotFoundError(username) {
|
|
41
|
+
return error('USER_NOT_FOUND', `${username.toString()}: user not found in org`);
|
|
42
|
+
}
|
|
43
|
+
/** A declared user exists but is inactive. */
|
|
44
|
+
export function userInactiveError(username) {
|
|
45
|
+
return error('USER_INACTIVE', `${username.toString()}: user is inactive`);
|
|
46
|
+
}
|
|
47
|
+
/** A declared target does not exist in the org. `label` is the kind's human name. */
|
|
48
|
+
export function targetNotFoundError(target, label) {
|
|
49
|
+
return error('TARGET_NOT_FOUND', `${target.toString()}: ${label} not found in org`);
|
|
50
|
+
}
|
|
51
|
+
/** A declared target resolves to more than one record in the org. */
|
|
52
|
+
export function targetAmbiguousError(target, label) {
|
|
53
|
+
return error('TARGET_AMBIGUOUS', `${target.toString()}: ${label} is not unique in org`);
|
|
54
|
+
}
|
|
55
|
+
/** The trailing-space location prefix for a finding: `file:line `, `file `, or empty. */
|
|
56
|
+
function locationPrefix(finding) {
|
|
57
|
+
if (!finding.file)
|
|
58
|
+
return '';
|
|
59
|
+
if (!finding.line)
|
|
60
|
+
return `${finding.file} `;
|
|
61
|
+
return `${finding.file}:${finding.line} `;
|
|
62
|
+
}
|
|
63
|
+
/** Render findings as human-readable lines. Shared by check, validate, and apply. */
|
|
64
|
+
export function formatFindings(findings) {
|
|
65
|
+
return findings.map((finding) => {
|
|
66
|
+
const where = locationPrefix(finding);
|
|
67
|
+
return `${finding.level}: ${where}${finding.message}`;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** Count findings by level. */
|
|
71
|
+
export function countFindings(findings) {
|
|
72
|
+
const errors = findings.filter((finding) => finding.level === 'error');
|
|
73
|
+
const warnings = findings.filter((finding) => finding.level === 'warning');
|
|
74
|
+
return { errors: errors.length, warnings: warnings.length };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=finding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finding.js","sourceRoot":"","sources":["../../src/core/finding.ts"],"names":[],"mappings":"AA8BA,2FAA2F;AAC3F,SAAS,KAAK,CAAC,IAAiB,EAAE,OAAe,EAAE,QAAe,EAAE;IAChE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;AACvD,CAAC;AAED,4FAA4F;AAC5F,SAAS,OAAO,CAAC,IAAiB,EAAE,OAAe,EAAE,QAAe,EAAE;IAClE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;AACzD,CAAC;AAED,kEAAkE;AAElE,sDAAsD;AACtD,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,IAAY,EAAE,IAAa;IAClE,OAAO,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,gBAAgB,CAAC,IAAY;IACzC,OAAO,OAAO,CAAC,YAAY,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,OAAe,EAAE,IAAY;IACnE,OAAO,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,KAAK,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,gBAAgB,CAAC,QAAkB,EAAE,QAAgB,EAAE,IAAY;IAC/E,OAAO,OAAO,C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from './diff.js';
|
|
2
|
+
export { Finding, formatFindings, countFindings } from './finding.js';
|
|
3
|
+
export { loadFiles } from './load.js';
|
|
4
|
+
export { ActualAssignment, AssignmentFilter, AssignmentOutcome, AssignmentUpdate, DesiredAssignment, Kind, OrgTarget, OrgUser, ReconcileMode, ResolvedAddition, TargetRef, } from './model.js';
|
|
5
|
+
export { kindForScopeKey } from './normalize.js';
|
|
6
|
+
export { formatDiff } from './report.js';
|
|
7
|
+
export { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, indexUsersById, indexTargetsById, } from './resolve.js';
|
|
8
|
+
export { serializeAssignments } from './serialize.js';
|
|
9
|
+
export { TargetName } from './target-name.js';
|
|
10
|
+
export { Username } from './username.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { diffAssignments, Diff, ScopedChange } from './diff.js';
|
|
2
|
+
export { formatFindings, countFindings } from './finding.js';
|
|
3
|
+
export { loadFiles } from './load.js';
|
|
4
|
+
export { kindForScopeKey } from './normalize.js';
|
|
5
|
+
export { formatDiff } from './report.js';
|
|
6
|
+
export { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, indexUsersById, indexTargetsById, } from './resolve.js';
|
|
7
|
+
export { serializeAssignments } from './serialize.js';
|
|
8
|
+
export { TargetName } from './target-name.js';
|
|
9
|
+
export { Username } from './username.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAS,YAAY,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAW,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AActC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/core/load.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,UAAU,EAAE,MAAM,YAAY,CAAC;AAgC3D,oFAAoF;AACpF,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CA+BvE"}
|
package/lib/core/load.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { globby } from 'globby';
|
|
3
|
+
import { parseFile } from './parse.js';
|
|
4
|
+
import { validateFile } from './schema.js';
|
|
5
|
+
import { normalize } from './normalize.js';
|
|
6
|
+
import { noFilesError } from './finding.js';
|
|
7
|
+
/** Process one file's text through parse, validate, and normalize. Pure, no disk. */
|
|
8
|
+
function checkContent(text, file) {
|
|
9
|
+
const parsed = parseFile(text, file);
|
|
10
|
+
if (!parsed.data) {
|
|
11
|
+
return { assignments: [], findings: parsed.findings };
|
|
12
|
+
}
|
|
13
|
+
const validated = validateFile(parsed.data, file);
|
|
14
|
+
if (!validated.data) {
|
|
15
|
+
return {
|
|
16
|
+
assignments: [],
|
|
17
|
+
findings: [
|
|
18
|
+
...parsed.findings,
|
|
19
|
+
...validated.findings,
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const normalized = normalize(validated.data, file);
|
|
24
|
+
return {
|
|
25
|
+
assignments: normalized.assignments,
|
|
26
|
+
findings: [
|
|
27
|
+
...parsed.findings,
|
|
28
|
+
...validated.findings,
|
|
29
|
+
...normalized.findings,
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Expand the globs, read every matched file, and merge into one model by union. */
|
|
34
|
+
export async function loadFiles(patterns) {
|
|
35
|
+
const files = await globby(patterns);
|
|
36
|
+
if (files.length === 0) {
|
|
37
|
+
return {
|
|
38
|
+
files,
|
|
39
|
+
assignments: [],
|
|
40
|
+
findings: [noFilesError(patterns)],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const checked = await Promise.all(files.map(async (file) => {
|
|
44
|
+
const text = await readFile(file, 'utf8');
|
|
45
|
+
return checkContent(text, file);
|
|
46
|
+
}));
|
|
47
|
+
const findings = checked.flatMap((entry) => entry.findings);
|
|
48
|
+
const collected = checked.flatMap((entry) => entry.assignments);
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
const assignments = [];
|
|
51
|
+
for (const assignment of collected) {
|
|
52
|
+
const dedupeKey = `${assignment.assignee.asKey()} ${assignment.kind} ${assignment.target.asKey()}`;
|
|
53
|
+
if (seen.has(dedupeKey))
|
|
54
|
+
continue;
|
|
55
|
+
seen.add(dedupeKey);
|
|
56
|
+
assignments.push(assignment);
|
|
57
|
+
}
|
|
58
|
+
return { files, assignments, findings };
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/core/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAW,YAAY,EAAE,MAAM,cAAc,CAAC;AAErD,qFAAqF;AACrF,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY;IAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC1D,CAAC;IAED,MAAM,SAAS,GAAG,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AO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAEhE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,WAAW,GAAwB,EAAE,CAAC;IAE5C,KAAK,MAAM,UAAU,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QACnG,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,SAAS;QAClC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACpB,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Finding } from './finding.js';
|
|
2
|
+
import { TargetName } from './target-name.js';
|
|
3
|
+
import { Username } from './username.js';
|
|
4
|
+
export type Kind = 'permissionSet' | 'permissionSetGroup' | 'permissionSetLicense';
|
|
5
|
+
/** Which half of the reconcile a run acts on. Shared by plan, apply, and the report. */
|
|
6
|
+
export type ReconcileMode = 'additive' | 'destructive' | 'sync';
|
|
7
|
+
/** Narrows which assignments a read pulls from the org. An absent field means no limit on it. */
|
|
8
|
+
export type AssignmentFilter = {
|
|
9
|
+
usernames?: Username[];
|
|
10
|
+
kinds?: Kind[];
|
|
11
|
+
};
|
|
12
|
+
export type DesiredAssignment = {
|
|
13
|
+
assignee: Username;
|
|
14
|
+
kind: Kind;
|
|
15
|
+
target: TargetName;
|
|
16
|
+
/** ISO 8601 datetime the grant should expire; null for no expiration. Only permission sets and groups support it. */
|
|
17
|
+
expiration: string | null;
|
|
18
|
+
};
|
|
19
|
+
/** A user as it exists in the org, in domain terms (no SObject field names). */
|
|
20
|
+
export type OrgUser = {
|
|
21
|
+
id: string;
|
|
22
|
+
username: Username;
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** A target (permission set, group, or license) as it exists in the org. */
|
|
26
|
+
export type OrgTarget = {
|
|
27
|
+
id: string;
|
|
28
|
+
name: TargetName;
|
|
29
|
+
};
|
|
30
|
+
/** An assignment that currently exists in the org, carrying its record id for deletion. */
|
|
31
|
+
export type ActualAssignment = {
|
|
32
|
+
recordId: string;
|
|
33
|
+
assignee: Username;
|
|
34
|
+
kind: Kind;
|
|
35
|
+
target: TargetName;
|
|
36
|
+
/** The expiration the org has on record; null for none. */
|
|
37
|
+
expiration: string | null;
|
|
38
|
+
};
|
|
39
|
+
/** An existing assignment whose expiration should change. `expiration` null clears it. */
|
|
40
|
+
export type AssignmentUpdate = {
|
|
41
|
+
recordId: string;
|
|
42
|
+
assignee: Username;
|
|
43
|
+
kind: Kind;
|
|
44
|
+
target: TargetName;
|
|
45
|
+
expiration: string | null;
|
|
46
|
+
/** The expiration the org has now, before the update. Null means it had none. */
|
|
47
|
+
previousExpiration: string | null;
|
|
48
|
+
};
|
|
49
|
+
/** A resolved managed target: its kind and the org id it resolved to. */
|
|
50
|
+
export type TargetRef = {
|
|
51
|
+
kind: Kind;
|
|
52
|
+
id: string;
|
|
53
|
+
};
|
|
54
|
+
/** A desired assignment resolved to the ids needed to insert it. */
|
|
55
|
+
export type ResolvedAddition = DesiredAssignment & {
|
|
56
|
+
assigneeId: string;
|
|
57
|
+
targetId: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The per-record result of one add or remove, for partial-success reporting. A report
|
|
61
|
+
* record rather than a model record: it is only ever displayed, so it carries the names
|
|
62
|
+
* as plain text.
|
|
63
|
+
*/
|
|
64
|
+
export type AssignmentOutcome = {
|
|
65
|
+
assignee: string;
|
|
66
|
+
kind: Kind;
|
|
67
|
+
target: string;
|
|
68
|
+
operation: 'add' | 'update' | 'remove';
|
|
69
|
+
success: boolean;
|
|
70
|
+
message?: string;
|
|
71
|
+
};
|
|
72
|
+
export type LoadResult = {
|
|
73
|
+
files: string[];
|
|
74
|
+
assignments: DesiredAssignment[];
|
|
75
|
+
findings: Finding[];
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/core/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,MAAM,IAAI,GAAG,eAAe,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;AAEnF,wFAAwF;AACxF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAC;AAEhE,iGAAiG;AACjG,MAAM,MAAM,gBAAgB,GAAG;IAC3B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,UAAU,CAAC;IACnB,qHAAqH;IACrH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,OAAO,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,SAAS,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,2FAA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
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/core/model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FileShape } from './schema.js';
|
|
2
|
+
import { DesiredAssignment, Kind } from './model.js';
|
|
3
|
+
import { Finding } from './finding.js';
|
|
4
|
+
export type ScopeKey = 'permissionSets' | 'permissionSetGroups' | 'permissionSetLicenses';
|
|
5
|
+
/** The (kind, file scope key) pairing, in canonical order. Shared with serialize. */
|
|
6
|
+
export declare const kindKeys: [Kind, ScopeKey][];
|
|
7
|
+
/** Map a file scope key back to its internal kind, so the CLI never leaks SObject names. */
|
|
8
|
+
export declare function kindForScopeKey(key: ScopeKey): Kind;
|
|
9
|
+
/**
|
|
10
|
+
* Turn a validated file into canonical (assignee, kind, target) tuples, and
|
|
11
|
+
* emit the structural findings: duplicate targets, empty lists, empty users.
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalize(data: FileShape, file: string): {
|
|
14
|
+
assignments: DesiredAssignment[];
|
|
15
|
+
findings: Finding[];
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/core/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAE,OAAO,EAAwD,MAAM,cAAc,CAAC;AAE7F,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAE1F,qFAAqF;AACrF,eAAO,MAAM,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAItC,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAKnD;AAkED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAWlH"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { TargetName } from './target-name.js';
|
|
2
|
+
import { Username } from './username.js';
|
|
3
|
+
import { emptyListWarning, dupTargetWarning, emptyUserWarning } from './finding.js';
|
|
4
|
+
/** The (kind, file scope key) pairing, in canonical order. Shared with serialize. */
|
|
5
|
+
export const kindKeys = [
|
|
6
|
+
['permissionSet', 'permissionSets'],
|
|
7
|
+
['permissionSetGroup', 'permissionSetGroups'],
|
|
8
|
+
['permissionSetLicense', 'permissionSetLicenses'],
|
|
9
|
+
];
|
|
10
|
+
/** Map a file scope key back to its internal kind, so the CLI never leaks SObject names. */
|
|
11
|
+
export function kindForScopeKey(key) {
|
|
12
|
+
const pair = kindKeys.find(([, scopeKey]) => scopeKey === key);
|
|
13
|
+
if (!pair)
|
|
14
|
+
throw new Error(`Unknown scope key: ${key}`);
|
|
15
|
+
return pair[0];
|
|
16
|
+
}
|
|
17
|
+
/** A scope item in canonical form: the bare string is a target with no expiration. */
|
|
18
|
+
function scopeItemFields(item) {
|
|
19
|
+
if (typeof item === 'string')
|
|
20
|
+
return { target: TargetName.of(item), expiration: null };
|
|
21
|
+
return { target: TargetName.of(item.name), expiration: item.expiration };
|
|
22
|
+
}
|
|
23
|
+
function normalizeScope(username, kind, key, list, file) {
|
|
24
|
+
const items = list.map(scopeItemFields);
|
|
25
|
+
const assignments = [];
|
|
26
|
+
const findings = [];
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
for (const { target, expiration } of items) {
|
|
29
|
+
if (seen.has(target.asKey())) {
|
|
30
|
+
findings.push(dupTargetWarning(username, target, key, file));
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
seen.add(target.asKey());
|
|
34
|
+
assignments.push({ assignee: username, kind, target, expiration });
|
|
35
|
+
}
|
|
36
|
+
return { assignments, findings };
|
|
37
|
+
}
|
|
38
|
+
function normalizeUser(username, entry, file) {
|
|
39
|
+
const assignments = [];
|
|
40
|
+
const findings = [];
|
|
41
|
+
let scopeCount = 0;
|
|
42
|
+
for (const [kind, key] of kindKeys) {
|
|
43
|
+
const list = entry[key];
|
|
44
|
+
if (!list)
|
|
45
|
+
continue;
|
|
46
|
+
if (list.length === 0) {
|
|
47
|
+
findings.push(emptyListWarning(username, key, file));
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
scopeCount += 1;
|
|
51
|
+
const scope = normalizeScope(username, kind, key, list, file);
|
|
52
|
+
assignments.push(...scope.assignments);
|
|
53
|
+
findings.push(...scope.findings);
|
|
54
|
+
}
|
|
55
|
+
if (scopeCount === 0) {
|
|
56
|
+
findings.push(emptyUserWarning(username, file));
|
|
57
|
+
}
|
|
58
|
+
return { assignments, findings };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Turn a validated file into canonical (assignee, kind, target) tuples, and
|
|
62
|
+
* emit the structural findings: duplicate targets, empty lists, empty users.
|
|
63
|
+
*/
|
|
64
|
+
export function normalize(data, file) {
|
|
65
|
+
const assignments = [];
|
|
66
|
+
const findings = [];
|
|
67
|
+
for (const [username, entry] of Object.entries(data.users)) {
|
|
68
|
+
const user = normalizeUser(Username.of(username), entry, file);
|
|
69
|
+
assignments.push(...user.assignments);
|
|
70
|
+
findings.push(...user.findings);
|
|
71
|
+
}
|
|
72
|
+
return { assignments, findings };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/core/normalize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,O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QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAe,EAAE,IAAY;IACnD,MAAM,WAAW,GAAwB,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC/D,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;QACtC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Finding } from './finding.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read one file's text into a plain object. Reports invalid YAML and duplicate
|
|
4
|
+
* keys (uniqueKeys), and treats an empty document as a warning.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseFile(text: string, file: string): {
|
|
7
|
+
data?: unknown;
|
|
8
|
+
findings: Finding[];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/core/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAC;AAEpE;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAe7F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parseDocument } from 'yaml';
|
|
2
|
+
import { yamlError, emptyFileWarning } from './finding.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read one file's text into a plain object. Reports invalid YAML and duplicate
|
|
5
|
+
* keys (uniqueKeys), and treats an empty document as a warning.
|
|
6
|
+
*/
|
|
7
|
+
export function parseFile(text, file) {
|
|
8
|
+
const doc = parseDocument(text, { uniqueKeys: true });
|
|
9
|
+
if (doc.errors.length > 0) {
|
|
10
|
+
return {
|
|
11
|
+
findings: doc.errors.map((err) => yamlError(err.message, file, err.linePos?.[0]?.line)),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const data = doc.toJS();
|
|
15
|
+
if (data == null) {
|
|
16
|
+
return { findings: [emptyFileWarning(file)] };
|
|
17
|
+
}
|
|
18
|
+
return { data, findings: [] };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/core/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAW,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEpE;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAY;IAChD,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEtD,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO;YACH,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;SAC1F,CAAC;IACN,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAa,CAAC;IACnC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACf,OAAO,EAAE,QAAQ,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Diff } from './diff.js';
|
|
2
|
+
import { ReconcileMode } from './model.js';
|
|
3
|
+
/** What the report shows: the mode selects which operations, plus whether to list unchanged. */
|
|
4
|
+
type ReportOptions = {
|
|
5
|
+
mode: ReconcileMode;
|
|
6
|
+
showUnchanged: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Render a diff as a plan body, grouped by kind then target, with `+` adds, `~` expiration
|
|
10
|
+
* updates, `-` removes, and `=` unchanged. The mode scopes which operations appear (additive
|
|
11
|
+
* hides removes, destructive hides adds and updates), unchanged lines appear only when asked,
|
|
12
|
+
* and targets with nothing to show are omitted. Shared by plan and apply.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatDiff(diff: Diff, options: ReportOptions): string[];
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/core/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAQ,aAAa,EAAE,MAAM,YAAY,CAAC;AA0BjD,gGAAgG;AAChG,KAAK,aAAa,GAAG;IACjB,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;CAC1B,CAAC;AAyHF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAsBvE"}
|