sf-plugin-permission-sets 0.0.0-dev.6 → 0.0.0-dev.60
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 +243 -85
- package/lib/adapters/connection-org-client.d.ts +21 -0
- package/lib/adapters/connection-org-client.d.ts.map +1 -0
- package/lib/adapters/connection-org-client.js +265 -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 +178 -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 +212 -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 +10 -0
- package/lib/core/diff.d.ts.map +1 -0
- package/lib/core/diff.js +54 -0
- package/lib/core/diff.js.map +1 -0
- package/lib/core/finding.d.ts +41 -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 +10 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +9 -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/mode.d.ts +18 -0
- package/lib/core/mode.d.ts.map +1 -0
- package/lib/core/mode.js +16 -0
- package/lib/core/mode.js.map +1 -0
- package/lib/core/model.d.ts +78 -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 +72 -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 +15 -0
- package/lib/core/report.d.ts.map +1 -0
- package/lib/core/report.js +122 -0
- package/lib/core/report.js.map +1 -0
- package/lib/core/resolve.d.ts +20 -0
- package/lib/core/resolve.d.ts.map +1 -0
- package/lib/core/resolve.js +88 -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 +36 -0
- package/lib/core/serialize.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 +22 -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 +39 -0
- package/lib/services/apply.d.ts.map +1 -0
- package/lib/services/apply.js +85 -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 +29 -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 +29 -0
- package/lib/services/plan.d.ts.map +1 -0
- package/lib/services/plan.js +51 -0
- package/lib/services/plan.js.map +1 -0
- package/lib/services/resolution.d.ts +17 -0
- package/lib/services/resolution.d.ts.map +1 -0
- package/lib/services/resolution.js +48 -0
- package/lib/services/resolution.js.map +1 -0
- package/lib/services/validate.d.ts +21 -0
- package/lib/services/validate.d.ts.map +1 -0
- package/lib/services/validate.js +50 -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 +115 -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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DesiredAssignment, Kind, OrgTarget, OrgUser } from './model.js';
|
|
2
|
+
import { Finding } from './finding.js';
|
|
3
|
+
export declare const kinds: Kind[];
|
|
4
|
+
/** The distinct usernames assigned across all assignments. */
|
|
5
|
+
export declare function distinctAssignees(assignments: DesiredAssignment[]): string[];
|
|
6
|
+
/** The distinct targets of one kind across all assignments. */
|
|
7
|
+
export declare function distinctTargets(assignments: DesiredAssignment[], kind: Kind): string[];
|
|
8
|
+
/** Every declared user must exist in the org and be active. */
|
|
9
|
+
export declare function evaluateUsers(declared: string[], found: OrgUser[]): Finding[];
|
|
10
|
+
/**
|
|
11
|
+
* Every declared target of one kind must resolve to exactly one record in the
|
|
12
|
+
* org. `found` is the list of matching identifiers the org returned; matching is
|
|
13
|
+
* case-insensitive, mirroring how the org compares them.
|
|
14
|
+
*/
|
|
15
|
+
export declare function evaluateTargets(kind: Kind, declared: string[], found: string[]): Finding[];
|
|
16
|
+
/** Index active users by lowercased username to their org id, for building assignments. */
|
|
17
|
+
export declare function indexUsersById(found: OrgUser[]): Map<string, string>;
|
|
18
|
+
/** Index targets by lowercased name to their org id, skipping names that resolve ambiguously. */
|
|
19
|
+
export declare function indexTargetsById(found: OrgTarget[]): Map<string, string>;
|
|
20
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,OAAO,EAAmF,MAAM,cAAc,CAAC;AASxH,eAAO,MAAM,KAAK,EAA8B,IAAI,EAAE,CAAC;AAMvD,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAE5E;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,WAAW,EAAE,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAItF;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAgB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAmB1F;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAQpE;AAED,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAexE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { userNotFoundError, userInactiveError, targetNotFoundError, targetAmbiguousError } from './finding.js';
|
|
2
|
+
/** Human label per kind, used in findings. Domain wording, not SObject names. */
|
|
3
|
+
const kindLabels = {
|
|
4
|
+
permissionSet: 'permission set',
|
|
5
|
+
permissionSetGroup: 'permission set group',
|
|
6
|
+
permissionSetLicense: 'permission set license',
|
|
7
|
+
};
|
|
8
|
+
export const kinds = Object.keys(kindLabels);
|
|
9
|
+
function distinct(values) {
|
|
10
|
+
return [...new Set(values)];
|
|
11
|
+
}
|
|
12
|
+
/** The distinct usernames assigned across all assignments. */
|
|
13
|
+
export function distinctAssignees(assignments) {
|
|
14
|
+
return distinct(assignments.map((assignment) => assignment.assignee));
|
|
15
|
+
}
|
|
16
|
+
/** The distinct targets of one kind across all assignments. */
|
|
17
|
+
export function distinctTargets(assignments, kind) {
|
|
18
|
+
return distinct(assignments.filter((assignment) => assignment.kind === kind).map((assignment) => assignment.target));
|
|
19
|
+
}
|
|
20
|
+
/** Every declared user must exist in the org and be active. */
|
|
21
|
+
export function evaluateUsers(declared, found) {
|
|
22
|
+
const byName = new Map();
|
|
23
|
+
for (const user of found) {
|
|
24
|
+
byName.set(user.username.toLowerCase(), user);
|
|
25
|
+
}
|
|
26
|
+
const findings = [];
|
|
27
|
+
for (const username of declared) {
|
|
28
|
+
const user = byName.get(username.toLowerCase());
|
|
29
|
+
if (!user) {
|
|
30
|
+
findings.push(userNotFoundError(username));
|
|
31
|
+
}
|
|
32
|
+
else if (!user.isActive) {
|
|
33
|
+
findings.push(userInactiveError(username));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return findings;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Every declared target of one kind must resolve to exactly one record in the
|
|
40
|
+
* org. `found` is the list of matching identifiers the org returned; matching is
|
|
41
|
+
* case-insensitive, mirroring how the org compares them.
|
|
42
|
+
*/
|
|
43
|
+
export function evaluateTargets(kind, declared, found) {
|
|
44
|
+
const label = kindLabels[kind];
|
|
45
|
+
const counts = new Map();
|
|
46
|
+
for (const name of found) {
|
|
47
|
+
const key = name.toLowerCase();
|
|
48
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
49
|
+
}
|
|
50
|
+
const findings = [];
|
|
51
|
+
for (const target of declared) {
|
|
52
|
+
const count = counts.get(target.toLowerCase()) ?? 0;
|
|
53
|
+
if (count === 0) {
|
|
54
|
+
findings.push(targetNotFoundError(target, label));
|
|
55
|
+
}
|
|
56
|
+
else if (count > 1) {
|
|
57
|
+
findings.push(targetAmbiguousError(target, label));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return findings;
|
|
61
|
+
}
|
|
62
|
+
/** Index active users by lowercased username to their org id, for building assignments. */
|
|
63
|
+
export function indexUsersById(found) {
|
|
64
|
+
const byName = new Map();
|
|
65
|
+
for (const user of found) {
|
|
66
|
+
if (user.isActive) {
|
|
67
|
+
byName.set(user.username.toLowerCase(), user.id);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return byName;
|
|
71
|
+
}
|
|
72
|
+
/** Index targets by lowercased name to their org id, skipping names that resolve ambiguously. */
|
|
73
|
+
export function indexTargetsById(found) {
|
|
74
|
+
const counts = new Map();
|
|
75
|
+
for (const target of found) {
|
|
76
|
+
const key = target.name.toLowerCase();
|
|
77
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
78
|
+
}
|
|
79
|
+
const byName = new Map();
|
|
80
|
+
for (const target of found) {
|
|
81
|
+
const key = target.name.toLowerCase();
|
|
82
|
+
if (counts.get(key) === 1) {
|
|
83
|
+
byName.set(key, target.id);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return byName;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/core/resolve.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAExH,iFAAiF;AACjF,MAAM,UAAU,GAAyB;IACrC,aAAa,EAAE,gBAAgB;IAC/B,kBAAkB,EAAE,sBAAsB;IAC1C,oBAAoB,EAAE,wBAAwB;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAW,CAAC;AAEvD,SAAS,QAAQ,CAAC,MAAgB;IAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,iBAAiB,CAAC,WAAgC;IAC9D,OAAO,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,eAAe,CAAC,WAAgC,EAAE,IAAU;IACxE,OAAO,QAAQ,CACX,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CACtG,CAAC;AACN,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,aAAa,CAAC,QAAkB,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CAAC,WAAW,EAAE,CAAC;QACtC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Finding } from './finding.js';
|
|
3
|
+
declare const fileSchema: z.ZodObject<{
|
|
4
|
+
users: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
5
|
+
permissionSets: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
expiration: z.ZodISODateTime;
|
|
8
|
+
}, z.core.$strict>]>>>;
|
|
9
|
+
permissionSetGroups: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
expiration: z.ZodISODateTime;
|
|
12
|
+
}, z.core.$strict>]>>>;
|
|
13
|
+
permissionSetLicenses: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type FileShape = z.infer<typeof fileSchema>;
|
|
17
|
+
/** Validate a parsed object against the file contract, turning issues into findings. */
|
|
18
|
+
export declare function validateFile(data: unknown, file: string): {
|
|
19
|
+
data?: FileShape;
|
|
20
|
+
findings: Finding[];
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAe,MAAM,cAAc,CAAC;AA4BpD,QAAA,MAAM,UAAU;;;;;;;;;;;;kBAEd,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAUnG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { schemaError } from './finding.js';
|
|
3
|
+
// The permission set name
|
|
4
|
+
const name = z.string().min(1);
|
|
5
|
+
// The permission set expiration date
|
|
6
|
+
const expiration = z.iso.datetime({ offset: true });
|
|
7
|
+
/** An entry is either a bare target name or a name with an expiration. */
|
|
8
|
+
const expiringList = z.array(z.union([
|
|
9
|
+
name,
|
|
10
|
+
z.strictObject({
|
|
11
|
+
name,
|
|
12
|
+
expiration,
|
|
13
|
+
}),
|
|
14
|
+
]));
|
|
15
|
+
/** Licenses cannot expire (PermissionSetLicenseAssign has no ExpirationDate), so names only. */
|
|
16
|
+
const plainList = z.array(name);
|
|
17
|
+
const userEntrySchema = z.strictObject({
|
|
18
|
+
permissionSets: expiringList.optional(),
|
|
19
|
+
permissionSetGroups: expiringList.optional(),
|
|
20
|
+
permissionSetLicenses: plainList.optional(),
|
|
21
|
+
});
|
|
22
|
+
const fileSchema = z.strictObject({
|
|
23
|
+
users: z.record(z.string().min(1), userEntrySchema),
|
|
24
|
+
});
|
|
25
|
+
/** Validate a parsed object against the file contract, turning issues into findings. */
|
|
26
|
+
export function validateFile(data, file) {
|
|
27
|
+
const parsed = fileSchema.safeParse(data);
|
|
28
|
+
if (parsed.success) {
|
|
29
|
+
return { data: parsed.data, findings: [] };
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
findings: parsed.error.issues.map((issue) => schemaError(issue.path.join('.') || '(root)', issue.message, file)),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAW,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpD,0BAA0B;AAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE/B,qCAAqC;AACrC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpD,0EAA0E;AAC1E,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CACxB,CAAC,CAAC,KAAK,CAAC;IACJ,IAAI;IACJ,CAAC,CAAC,YAAY,CAAC;QACX,IAAI;QACJ,UAAU;KACb,CAAC;CACL,CAAC,CACL,CAAC;AAEF,gGAAgG;AAChG,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEhC,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC;IACnC,cAAc,EAAE,YAAY,CAAC,QAAQ,EAAE;IACvC,mBAAmB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC5C,qBAAqB,EAAE,SAAS,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC;CACtD,CAAC,CAAC;AAIH,wFAAwF;AACxF,MAAM,UAAU,YAAY,CAAC,IAAa,EAAE,IAAY;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO;QACH,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACxC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CACrE;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DesiredAssignment } from './model.js';
|
|
2
|
+
/**
|
|
3
|
+
* Emit canonical assignments back to a user-keyed YAML document: the inverse of
|
|
4
|
+
* normalize. Usernames and targets are sorted and de-duplicated so the output is
|
|
5
|
+
* deterministic, empty scopes are omitted, and an assignment with an expiration
|
|
6
|
+
* is written as the object form so it round-trips through the schema.
|
|
7
|
+
*/
|
|
8
|
+
export declare function serializeAssignments(assignments: DesiredAssignment[]): string;
|
|
9
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/core/serialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAS/C;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAmC7E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { stringify } from 'yaml';
|
|
2
|
+
import { kindKeys } from './normalize.js';
|
|
3
|
+
/**
|
|
4
|
+
* Emit canonical assignments back to a user-keyed YAML document: the inverse of
|
|
5
|
+
* normalize. Usernames and targets are sorted and de-duplicated so the output is
|
|
6
|
+
* deterministic, empty scopes are omitted, and an assignment with an expiration
|
|
7
|
+
* is written as the object form so it round-trips through the schema.
|
|
8
|
+
*/
|
|
9
|
+
export function serializeAssignments(assignments) {
|
|
10
|
+
const usernames = [...new Set(assignments.map((assignment) => assignment.assignee))].sort();
|
|
11
|
+
const users = {};
|
|
12
|
+
for (const username of usernames) {
|
|
13
|
+
const entry = {};
|
|
14
|
+
for (const [kind, key] of kindKeys) {
|
|
15
|
+
const matching = assignments.filter((assignment) => assignment.assignee === username && assignment.kind === kind);
|
|
16
|
+
const expirationByTarget = new Map();
|
|
17
|
+
for (const assignment of matching) {
|
|
18
|
+
if (!expirationByTarget.has(assignment.target)) {
|
|
19
|
+
expirationByTarget.set(assignment.target, assignment.expiration);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const entries = [...expirationByTarget.keys()].sort().map((target) => {
|
|
23
|
+
const expiration = expirationByTarget.get(target);
|
|
24
|
+
if (!expiration)
|
|
25
|
+
return target;
|
|
26
|
+
return { name: target, expiration };
|
|
27
|
+
});
|
|
28
|
+
if (entries.length > 0) {
|
|
29
|
+
entry[key] = entries;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
users[username] = entry;
|
|
33
|
+
}
|
|
34
|
+
return stringify({ users });
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/core/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AAQpD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAgC;IACjE,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UA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AAC,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,OAAO,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAChC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,wBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/adapters/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ActualAssignment, AssignmentFilter, AssignmentOutcome, AssignmentUpdate, DesiredAssignment, Kind, OrgTarget, OrgUser, ResolvedAddition, TargetRef } from '../../core/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Port: the org operations a service needs, in domain terms. Declared here, by the
|
|
4
|
+
* consumer, so services depend on the abstraction and the adapter implements it.
|
|
5
|
+
*/
|
|
6
|
+
export interface OrgClient {
|
|
7
|
+
/** The users that exist in the org, among the given usernames. */
|
|
8
|
+
findUsers(usernames: string[]): Promise<OrgUser[]>;
|
|
9
|
+
/** The targets (with ids) that exist in the org, among the given names of one kind. */
|
|
10
|
+
findTargets(kind: Kind, names: string[]): Promise<OrgTarget[]>;
|
|
11
|
+
/** Every assignable permission set, group, and license assignment held by active users, narrowed by the filter. */
|
|
12
|
+
listAssignments(filter?: AssignmentFilter): Promise<DesiredAssignment[]>;
|
|
13
|
+
/** The current assignments of the given managed targets, with their record ids. */
|
|
14
|
+
currentAssignments(targets: TargetRef[]): Promise<ActualAssignment[]>;
|
|
15
|
+
/** Insert the given assignments, reporting per-record success or failure. */
|
|
16
|
+
addAssignments(additions: ResolvedAddition[]): Promise<AssignmentOutcome[]>;
|
|
17
|
+
/** Update the expiration of the given assignments, reporting per-record success or failure. */
|
|
18
|
+
updateAssignments(updates: AssignmentUpdate[]): Promise<AssignmentOutcome[]>;
|
|
19
|
+
/** Delete the given assignments by record id, reporting per-record success or failure. */
|
|
20
|
+
removeAssignments(removals: ActualAssignment[]): Promise<AssignmentOutcome[]>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=org-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-client.d.ts","sourceRoot":"","sources":["../../../src/services/adapters/org-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB,kEAAkE;IAClE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACnD,uFAAuF;IACvF,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC/D,mHAAmH;IACnH,eAAe,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACzE,mFAAmF;IACnF,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACtE,6EAA6E;IAC7E,cAAc,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC5E,+FAA+F;IAC/F,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC7E,0FAA0F;IAC1F,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;CACjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-client.js","sourceRoot":"","sources":["../../../src/services/adapters/org-client.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AssignmentOutcome, Diff, Finding } from '../core/index.js';
|
|
2
|
+
import { OrgClient } from './adapters/index.js';
|
|
3
|
+
export type ApplyMode = 'additive' | 'destructive' | 'sync';
|
|
4
|
+
/** How the service asks its caller to approve a destructive batch before applying it. */
|
|
5
|
+
export type ConfirmDeletions = (count: number) => Promise<boolean>;
|
|
6
|
+
export type ApplyInput = {
|
|
7
|
+
mode: ApplyMode;
|
|
8
|
+
maxDeletes: number;
|
|
9
|
+
dryRun: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** How a run ended, so the command can report and set the exit code. */
|
|
12
|
+
export type ApplyStatus = 'applied' | 'dry-run' | 'declined' | 'max-deletes-exceeded' | 'invalid';
|
|
13
|
+
export type ApplyResult = {
|
|
14
|
+
files: string[];
|
|
15
|
+
findings: Finding[];
|
|
16
|
+
diff: Diff;
|
|
17
|
+
/** What the chosen mode did not act on (surfaced as drift). */
|
|
18
|
+
drift: {
|
|
19
|
+
adds: number;
|
|
20
|
+
updates: number;
|
|
21
|
+
removes: number;
|
|
22
|
+
};
|
|
23
|
+
outcomes: AssignmentOutcome[];
|
|
24
|
+
status: ApplyStatus;
|
|
25
|
+
failed: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Load the files, resolve every reference to an org id, diff against the org's
|
|
29
|
+
* current state, then add and/or remove per the mode. Deletions are capped by
|
|
30
|
+
* maxDeletes and gated by an injected confirmation.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ApplyService {
|
|
33
|
+
private readonly org;
|
|
34
|
+
private readonly confirmDeletions;
|
|
35
|
+
constructor(org: OrgClient, confirmDeletions: ConfirmDeletions);
|
|
36
|
+
run(files: string[], input: ApplyInput): Promise<ApplyResult>;
|
|
37
|
+
private executeResolved;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EAEjB,IAAI,EAEJ,OAAO,EAEV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAC;AAE5D,yFAAyF;AACzF,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,sBAAsB,GAAG,SAAS,CAAC;AAElG,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,+DAA+D;IAC/D,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAiBF;;;;GAIG;AACH,qBAAa,YAAY;IAEjB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,GAAG,EAAE,SAAS,EACd,gBAAgB,EAAE,gBAAgB;IAG1C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;YAqD5D,eAAe;CAiBhC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { loadFiles, diffAssignments, scopeToMode, countFindings, } from '../core/index.js';
|
|
2
|
+
import { ResolutionService, managedTargets, resolveAdditions } from './resolution.js';
|
|
3
|
+
const emptyDiff = { toAdd: [], toUpdate: [], toRemove: [], unchanged: [] };
|
|
4
|
+
/** An aborted-before-any-change result, carrying the findings that explain why. */
|
|
5
|
+
function invalidResult(files, findings) {
|
|
6
|
+
return {
|
|
7
|
+
files,
|
|
8
|
+
findings,
|
|
9
|
+
diff: emptyDiff,
|
|
10
|
+
drift: { adds: 0, updates: 0, removes: 0 },
|
|
11
|
+
outcomes: [],
|
|
12
|
+
status: 'invalid',
|
|
13
|
+
failed: true,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Load the files, resolve every reference to an org id, diff against the org's
|
|
18
|
+
* current state, then add and/or remove per the mode. Deletions are capped by
|
|
19
|
+
* maxDeletes and gated by an injected confirmation.
|
|
20
|
+
*/
|
|
21
|
+
export class ApplyService {
|
|
22
|
+
org;
|
|
23
|
+
confirmDeletions;
|
|
24
|
+
constructor(org, confirmDeletions) {
|
|
25
|
+
this.org = org;
|
|
26
|
+
this.confirmDeletions = confirmDeletions;
|
|
27
|
+
}
|
|
28
|
+
async run(files, input) {
|
|
29
|
+
const loaded = await loadFiles(files);
|
|
30
|
+
const loadCounts = countFindings(loaded.findings);
|
|
31
|
+
if (loadCounts.errors > 0) {
|
|
32
|
+
return invalidResult(loaded.files, loaded.findings);
|
|
33
|
+
}
|
|
34
|
+
const resolutionService = new ResolutionService(this.org);
|
|
35
|
+
const resolution = await resolutionService.run(loaded.assignments);
|
|
36
|
+
const findings = [
|
|
37
|
+
...loaded.findings,
|
|
38
|
+
...resolution.findings,
|
|
39
|
+
];
|
|
40
|
+
const findingCounts = countFindings(findings);
|
|
41
|
+
if (findingCounts.errors > 0) {
|
|
42
|
+
return invalidResult(loaded.files, findings);
|
|
43
|
+
}
|
|
44
|
+
const actual = await this.org.currentAssignments(managedTargets(resolution));
|
|
45
|
+
const diff = diffAssignments(loaded.assignments, actual);
|
|
46
|
+
const { mode, maxDeletes, dryRun } = input;
|
|
47
|
+
const { additions, updates, removals, drift } = scopeToMode(diff, mode);
|
|
48
|
+
if (removals.length > maxDeletes) {
|
|
49
|
+
return {
|
|
50
|
+
files: loaded.files,
|
|
51
|
+
findings,
|
|
52
|
+
diff,
|
|
53
|
+
drift,
|
|
54
|
+
outcomes: [],
|
|
55
|
+
status: 'max-deletes-exceeded',
|
|
56
|
+
failed: true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (dryRun) {
|
|
60
|
+
return { files: loaded.files, findings, diff, drift, outcomes: [], status: 'dry-run', failed: false };
|
|
61
|
+
}
|
|
62
|
+
if (removals.length > 0) {
|
|
63
|
+
const confirmed = await this.confirmDeletions(removals.length);
|
|
64
|
+
if (!confirmed) {
|
|
65
|
+
return { files: loaded.files, findings, diff, drift, outcomes: [], status: 'declined', failed: false };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const outcomes = await this.executeResolved(resolveAdditions(additions, resolution), updates, removals);
|
|
69
|
+
const failed = outcomes.some((outcome) => !outcome.success);
|
|
70
|
+
return { files: loaded.files, findings, diff, drift, outcomes, status: 'applied', failed };
|
|
71
|
+
}
|
|
72
|
+
async executeResolved(additions, updates, removals) {
|
|
73
|
+
const [added, updated, removed] = await Promise.all([
|
|
74
|
+
additions.length > 0 ? this.org.addAssignments(additions) : Promise.resolve([]),
|
|
75
|
+
updates.length > 0 ? this.org.updateAssignments(updates) : Promise.resolve([]),
|
|
76
|
+
removals.length > 0 ? this.org.removeAssignments(removals) : Promise.resolve([]),
|
|
77
|
+
]);
|
|
78
|
+
return [
|
|
79
|
+
...added,
|
|
80
|
+
...updated,
|
|
81
|
+
...removed,
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,EAOX,aAAa,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA2BtF,MAAM,SAAS,GAAS,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAEjF,mFAAmF;AACnF,SAAS,aAAa,CAAC,KAAe,EAAE,QAAmB;IACvD,OAAO;QACH,KAAK;QACL,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QAC1C,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,IAAI;KACf,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAEA;IACA;IAFrB,YACqB,GAAc,EACd,gBAAkC;QADlC,QAAG,GAAH,GAAG,CAAW;QACd,qBAAgB,GAAhB,gBAAgB,CAAkB;IACpD,CAAC;IAEG,KAAK,CAAC,GAAG,CAAC,KAAe,EAAE,KAAiB;QAC/C,MAAM,MAAM,GAAG,MAAM,SAAS,CA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AS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAsB,EAAE,CAAC;YACpG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAsB,EAAE,CAAC;YACnG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAsB,EAAE,CAAC;SACxG,CAAC,CAAC;QAEH,OAAO;YACH,GAAG,KAAK;YACR,GAAG,OAAO;YACV,GAAG,OAAO;SACb,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DesiredAssignment, Finding } from '../core/index.js';
|
|
2
|
+
export type CheckResult = {
|
|
3
|
+
files: string[];
|
|
4
|
+
assignments: DesiredAssignment[];
|
|
5
|
+
findings: Finding[];
|
|
6
|
+
errors: number;
|
|
7
|
+
warnings: number;
|
|
8
|
+
failed: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Load the files, validate them, and summarize the findings. No org needed. */
|
|
11
|
+
export declare class CheckService {
|
|
12
|
+
run(files: string[], strict: boolean): Promise<CheckResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/services/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,iBAAiB,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAExF,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,gFAAgF;AAChF,qBAAa,YAAY;IACR,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;CAc3E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { loadFiles, countFindings } from '../core/index.js';
|
|
2
|
+
/** Load the files, validate them, and summarize the findings. No org needed. */
|
|
3
|
+
export class CheckService {
|
|
4
|
+
async run(files, strict) {
|
|
5
|
+
const loaded = await loadFiles(files);
|
|
6
|
+
const { errors, warnings } = countFindings(loaded.findings);
|
|
7
|
+
const failed = errors > 0 || (strict && warnings > 0);
|
|
8
|
+
return {
|
|
9
|
+
files: loaded.files,
|
|
10
|
+
assignments: loaded.assignments,
|
|
11
|
+
findings: loaded.findings,
|
|
12
|
+
errors,
|
|
13
|
+
warnings,
|
|
14
|
+
failed,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/services/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAWxF,gFAAgF;AAChF,MAAM,OAAO,YAAY;IACd,KAAK,CAAC,GAAG,CAAC,KAAe,EAAE,MAAe;QAC7C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;QAEtD,OAAO;YACH,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM;YACN,QAAQ;YACR,MAAM;SACT,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AssignmentFilter } from '../core/index.js';
|
|
2
|
+
import { OrgClient } from './adapters/index.js';
|
|
3
|
+
export type ExportResult = {
|
|
4
|
+
/** The path written, or null when the document was returned for stdout instead of a file. */
|
|
5
|
+
outputFile: string | null;
|
|
6
|
+
/** The serialized YAML document, exactly as written to the file. */
|
|
7
|
+
content: string;
|
|
8
|
+
users: number;
|
|
9
|
+
assignments: number;
|
|
10
|
+
/** Requested users (from the filter) that matched no assignments in scope. */
|
|
11
|
+
unmatchedUsers: string[];
|
|
12
|
+
};
|
|
13
|
+
/** Read the org's current assignments and serialize them as YAML. */
|
|
14
|
+
export declare class ExportService {
|
|
15
|
+
private readonly org;
|
|
16
|
+
constructor(org: OrgClient);
|
|
17
|
+
run(outputFile: string | undefined, filter?: AssignmentFilter): Promise<ExportResult>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/services/export.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAwB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG;IACvB,6FAA6F;IAC7F,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,cAAc,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,qEAAqE;AACrE,qBAAa,aAAa;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAErC,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAqBrG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { serializeAssignments } from '../core/index.js';
|
|
4
|
+
/** Read the org's current assignments and serialize them as YAML. */
|
|
5
|
+
export class ExportService {
|
|
6
|
+
org;
|
|
7
|
+
constructor(org) {
|
|
8
|
+
this.org = org;
|
|
9
|
+
}
|
|
10
|
+
async run(outputFile, filter) {
|
|
11
|
+
const assignments = await this.org.listAssignments(filter);
|
|
12
|
+
const content = serializeAssignments(assignments);
|
|
13
|
+
if (outputFile) {
|
|
14
|
+
await mkdir(dirname(outputFile), { recursive: true });
|
|
15
|
+
await writeFile(outputFile, content, 'utf8');
|
|
16
|
+
}
|
|
17
|
+
const assignees = new Set(assignments.map((assignment) => assignment.assignee));
|
|
18
|
+
const requested = filter?.usernames ?? [];
|
|
19
|
+
const unmatchedUsers = requested.filter((username) => !assignees.has(username));
|
|
20
|
+
return {
|
|
21
|
+
outputFile: outputFile ?? null,
|
|
22
|
+
content,
|
|
23
|
+
users: assignees.size,
|
|
24
|
+
assignments: assignments.length,
|
|
25
|
+
unmatchedUsers,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/services/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM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
|
|
3
|
+
export { ExportService } from './export.js';
|
|
4
|
+
export { PlanService } from './plan.js';
|
|
5
|
+
export { ValidateService } from './validate.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Diff, Finding } from '../core/index.js';
|
|
2
|
+
import { OrgClient } from './adapters/index.js';
|
|
3
|
+
export type PlanMode = 'additive' | 'destructive' | 'sync';
|
|
4
|
+
/** How a run ended, so the command can report and set the exit code. */
|
|
5
|
+
export type PlanStatus = 'planned' | 'invalid';
|
|
6
|
+
export type PlanResult = {
|
|
7
|
+
files: string[];
|
|
8
|
+
findings: Finding[];
|
|
9
|
+
diff: Diff;
|
|
10
|
+
/** What the chosen mode would not act on (surfaced as drift). */
|
|
11
|
+
drift: {
|
|
12
|
+
adds: number;
|
|
13
|
+
updates: number;
|
|
14
|
+
removes: number;
|
|
15
|
+
};
|
|
16
|
+
status: PlanStatus;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Read-only preview: load the files, resolve every reference to an org id, fetch the
|
|
20
|
+
* current state, and diff. The full diff (adds and would-be removes) is always returned
|
|
21
|
+
* regardless of mode; drift is whatever the chosen mode would not act on. Never changes
|
|
22
|
+
* the org. This is the apply pipeline stopping before any DML.
|
|
23
|
+
*/
|
|
24
|
+
export declare class PlanService {
|
|
25
|
+
private readonly org;
|
|
26
|
+
constructor(org: OrgClient);
|
|
27
|
+
run(files: string[], mode: PlanMode): Promise<PlanResult>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/services/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAC;AAE3D,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,iEAAiE;IACjE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AAeF;;;;;GAKG;AACH,qBAAa,WAAW;IACD,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAErC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CA4BzE"}
|