sf-plugin-permission-sets 0.0.0-dev.21 → 0.0.0-dev.22
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/README.md +20 -1
- package/lib/adapters/connection-org-client.d.ts +2 -1
- package/lib/adapters/connection-org-client.js +59 -15
- package/lib/adapters/connection-org-client.js.map +1 -1
- package/lib/commands/ps/apply.d.ts +2 -0
- package/lib/commands/ps/apply.js +11 -2
- package/lib/commands/ps/apply.js.map +1 -1
- package/lib/commands/ps/plan.d.ts +1 -0
- package/lib/commands/ps/plan.js +6 -2
- package/lib/commands/ps/plan.js.map +1 -1
- package/lib/core/diff.d.ts +2 -1
- package/lib/core/diff.js +22 -4
- package/lib/core/diff.js.map +1 -1
- package/lib/core/finding.d.ts +22 -10
- package/lib/core/finding.js +50 -4
- package/lib/core/finding.js.map +1 -1
- package/lib/core/load.js +2 -2
- package/lib/core/load.js.map +1 -1
- package/lib/core/model.d.ts +14 -1
- package/lib/core/normalize.js +9 -7
- package/lib/core/normalize.js.map +1 -1
- package/lib/core/parse.js +4 -4
- package/lib/core/parse.js.map +1 -1
- package/lib/core/report.d.ts +3 -2
- package/lib/core/report.js +23 -9
- package/lib/core/report.js.map +1 -1
- package/lib/core/resolve.js +5 -5
- package/lib/core/resolve.js.map +1 -1
- package/lib/core/schema.d.ts +16 -4
- package/lib/core/schema.js +14 -6
- package/lib/core/schema.js.map +1 -1
- package/lib/core/serialize.d.ts +4 -3
- package/lib/core/serialize.js +17 -10
- package/lib/core/serialize.js.map +1 -1
- package/lib/services/adapters/org-client.d.ts +3 -1
- package/lib/services/apply.d.ts +1 -0
- package/lib/services/apply.js +9 -6
- package/lib/services/apply.js.map +1 -1
- package/lib/services/plan.d.ts +1 -0
- package/lib/services/plan.js +3 -2
- package/lib/services/plan.js.map +1 -1
- package/messages/ps.apply.md +4 -4
- package/messages/ps.plan.md +2 -2
- package/oclif.manifest.json +4 -50
- package/package.json +1 -1
- 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/lib/core/model.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type DesiredAssignment = {
|
|
|
4
4
|
assignee: string;
|
|
5
5
|
kind: Kind;
|
|
6
6
|
target: string;
|
|
7
|
+
/** ISO 8601 datetime the grant should expire, if any. Only permission sets and groups support it. */
|
|
8
|
+
expiration?: string;
|
|
7
9
|
};
|
|
8
10
|
/** A user as it exists in the org, in domain terms (no SObject field names). */
|
|
9
11
|
export type OrgUser = {
|
|
@@ -22,6 +24,16 @@ export type ActualAssignment = {
|
|
|
22
24
|
assignee: string;
|
|
23
25
|
kind: Kind;
|
|
24
26
|
target: string;
|
|
27
|
+
/** The expiration the org has on record, if any. */
|
|
28
|
+
expiration?: string;
|
|
29
|
+
};
|
|
30
|
+
/** An existing assignment whose expiration should change. `expiration` undefined clears it. */
|
|
31
|
+
export type AssignmentUpdate = {
|
|
32
|
+
recordId: string;
|
|
33
|
+
assignee: string;
|
|
34
|
+
kind: Kind;
|
|
35
|
+
target: string;
|
|
36
|
+
expiration?: string;
|
|
25
37
|
};
|
|
26
38
|
/** A resolved managed target: its kind and the org id it resolved to. */
|
|
27
39
|
export type TargetRef = {
|
|
@@ -36,6 +48,7 @@ export type ResolvedAddition = DesiredAssignment & {
|
|
|
36
48
|
/** The change set between the desired model and the org's current state. */
|
|
37
49
|
export type Diff = {
|
|
38
50
|
toAdd: DesiredAssignment[];
|
|
51
|
+
toUpdate: AssignmentUpdate[];
|
|
39
52
|
toRemove: ActualAssignment[];
|
|
40
53
|
unchanged: ActualAssignment[];
|
|
41
54
|
};
|
|
@@ -44,7 +57,7 @@ export type AssignmentOutcome = {
|
|
|
44
57
|
assignee: string;
|
|
45
58
|
kind: Kind;
|
|
46
59
|
target: string;
|
|
47
|
-
operation: 'add' | 'remove';
|
|
60
|
+
operation: 'add' | 'update' | 'remove';
|
|
48
61
|
success: boolean;
|
|
49
62
|
message?: string;
|
|
50
63
|
};
|
package/lib/core/normalize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { emptyListWarning, dupTargetWarning, emptyUserWarning } from './finding.js';
|
|
2
2
|
/** The (kind, file scope key) pairing, in canonical order. Shared with serialize. */
|
|
3
3
|
export const kindKeys = [
|
|
4
4
|
['permissionSet', 'permissionSets'],
|
|
@@ -16,25 +16,27 @@ export function normalize(data, file) {
|
|
|
16
16
|
let scopeCount = 0;
|
|
17
17
|
for (const [kind, key] of kindKeys) {
|
|
18
18
|
const list = entry[key];
|
|
19
|
-
if (list
|
|
19
|
+
if (!list)
|
|
20
20
|
continue;
|
|
21
21
|
if (list.length === 0) {
|
|
22
|
-
findings.push(
|
|
22
|
+
findings.push(emptyListWarning(username, key, file));
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
25
|
scopeCount += 1;
|
|
26
26
|
const seen = new Set();
|
|
27
|
-
for (const
|
|
27
|
+
for (const item of list) {
|
|
28
|
+
const target = typeof item === 'string' ? item : item.name;
|
|
29
|
+
const expiration = typeof item === 'string' ? undefined : item.expiration;
|
|
28
30
|
if (seen.has(target)) {
|
|
29
|
-
findings.push(
|
|
31
|
+
findings.push(dupTargetWarning(username, target, key, file));
|
|
30
32
|
continue;
|
|
31
33
|
}
|
|
32
34
|
seen.add(target);
|
|
33
|
-
assignments.push({ assignee: username, kind, target });
|
|
35
|
+
assignments.push({ assignee: username, kind, target, ...(expiration ? { expiration } : {}) });
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
if (scopeCount === 0) {
|
|
37
|
-
findings.push(
|
|
39
|
+
findings.push(emptyUserWarning(username, file));
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
return { assignments, findings };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/core/normalize.ts"],"names":[],"mappings":"AAEA,OA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AC3D,MAAM,UAAU,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;gBAC1E,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;oBAC7D,SAAS;gBACb,CAAC;gBACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACjB,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAClG,CAAC;QACL,CAAC;QAED,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;QACpD,CAAC;IACL,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC"}
|
package/lib/core/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseDocument } from 'yaml';
|
|
2
|
-
import {
|
|
2
|
+
import { yamlError, emptyFileWarning } from './finding.js';
|
|
3
3
|
/**
|
|
4
4
|
* Read one file's text into a plain object. Reports invalid YAML and duplicate
|
|
5
5
|
* keys (uniqueKeys), and treats an empty document as a warning.
|
|
@@ -8,12 +8,12 @@ export function parseFile(text, file) {
|
|
|
8
8
|
const doc = parseDocument(text, { uniqueKeys: true });
|
|
9
9
|
if (doc.errors.length > 0) {
|
|
10
10
|
return {
|
|
11
|
-
findings: doc.errors.map((err) =>
|
|
11
|
+
findings: doc.errors.map((err) => yamlError(err.message, file, err.linePos?.[0]?.line)),
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
const data = doc.toJS();
|
|
15
|
-
if (data
|
|
16
|
-
return { findings: [
|
|
15
|
+
if (data == null) {
|
|
16
|
+
return { findings: [emptyFileWarning(file)] };
|
|
17
17
|
}
|
|
18
18
|
return { data, findings: [] };
|
|
19
19
|
}
|
package/lib/core/parse.js.map
CHANGED
|
@@ -1 +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,
|
|
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"}
|
package/lib/core/report.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Diff } from './model.js';
|
|
2
2
|
/**
|
|
3
|
-
* Render a diff as a plan, grouped by kind then target, with `+` adds,
|
|
4
|
-
* and `=` unchanged.
|
|
3
|
+
* Render a diff as a plan, grouped by kind then target, with `+` adds, `~` expiration
|
|
4
|
+
* updates, `-` removes, and `=` unchanged. Timed grants carry their expiration. Shared
|
|
5
|
+
* by plan and apply.
|
|
5
6
|
*/
|
|
6
7
|
export declare function formatDiff(diff: Diff): string[];
|
package/lib/core/report.js
CHANGED
|
@@ -7,25 +7,33 @@ function bucketFor(byKind, kind, target) {
|
|
|
7
7
|
}
|
|
8
8
|
let bucket = byTarget.get(target);
|
|
9
9
|
if (!bucket) {
|
|
10
|
-
bucket = { adds: new
|
|
10
|
+
bucket = { adds: new Map(), updates: new Map(), removes: new Set(), unchanged: new Map() };
|
|
11
11
|
byTarget.set(target, bucket);
|
|
12
12
|
}
|
|
13
13
|
return bucket;
|
|
14
14
|
}
|
|
15
|
+
/** An assignee line, annotated with its expiration when there is one. */
|
|
16
|
+
function withExpiry(assignee, expiration) {
|
|
17
|
+
return expiration ? `${assignee} (expires ${expiration})` : assignee;
|
|
18
|
+
}
|
|
15
19
|
/**
|
|
16
|
-
* Render a diff as a plan, grouped by kind then target, with `+` adds,
|
|
17
|
-
* and `=` unchanged.
|
|
20
|
+
* Render a diff as a plan, grouped by kind then target, with `+` adds, `~` expiration
|
|
21
|
+
* updates, `-` removes, and `=` unchanged. Timed grants carry their expiration. Shared
|
|
22
|
+
* by plan and apply.
|
|
18
23
|
*/
|
|
19
24
|
export function formatDiff(diff) {
|
|
20
25
|
const byKind = new Map();
|
|
21
26
|
for (const assignment of diff.toAdd) {
|
|
22
|
-
bucketFor(byKind, assignment.kind, assignment.target).adds.
|
|
27
|
+
bucketFor(byKind, assignment.kind, assignment.target).adds.set(assignment.assignee, assignment.expiration);
|
|
28
|
+
}
|
|
29
|
+
for (const update of diff.toUpdate) {
|
|
30
|
+
bucketFor(byKind, update.kind, update.target).updates.set(update.assignee, update.expiration);
|
|
23
31
|
}
|
|
24
32
|
for (const assignment of diff.toRemove) {
|
|
25
33
|
bucketFor(byKind, assignment.kind, assignment.target).removes.add(assignment.assignee);
|
|
26
34
|
}
|
|
27
35
|
for (const assignment of diff.unchanged) {
|
|
28
|
-
bucketFor(byKind, assignment.kind, assignment.target).unchanged.
|
|
36
|
+
bucketFor(byKind, assignment.kind, assignment.target).unchanged.set(assignment.assignee, assignment.expiration);
|
|
29
37
|
}
|
|
30
38
|
const lines = [];
|
|
31
39
|
for (const [kind, scopeKey] of kindKeys) {
|
|
@@ -35,12 +43,18 @@ export function formatDiff(diff) {
|
|
|
35
43
|
lines.push(`${scopeKey}:`);
|
|
36
44
|
for (const [target, bucket] of [...byTarget].sort((left, right) => left[0].localeCompare(right[0]))) {
|
|
37
45
|
lines.push(` ${target}`);
|
|
38
|
-
for (const assignee of [...bucket.adds].sort())
|
|
39
|
-
lines.push(` + ${assignee}`);
|
|
46
|
+
for (const assignee of [...bucket.adds.keys()].sort()) {
|
|
47
|
+
lines.push(` + ${withExpiry(assignee, bucket.adds.get(assignee))}`);
|
|
48
|
+
}
|
|
49
|
+
for (const assignee of [...bucket.updates.keys()].sort()) {
|
|
50
|
+
const expiration = bucket.updates.get(assignee);
|
|
51
|
+
lines.push(` ~ ${expiration ? withExpiry(assignee, expiration) : `${assignee} (expiry cleared)`}`);
|
|
52
|
+
}
|
|
40
53
|
for (const assignee of [...bucket.removes].sort())
|
|
41
54
|
lines.push(` - ${assignee}`);
|
|
42
|
-
for (const assignee of [...bucket.unchanged].sort())
|
|
43
|
-
lines.push(` = ${assignee}`);
|
|
55
|
+
for (const assignee of [...bucket.unchanged.keys()].sort()) {
|
|
56
|
+
lines.push(` = ${withExpiry(assignee, bucket.unchanged.get(assignee))}`);
|
|
57
|
+
}
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
60
|
return lines;
|
package/lib/core/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/core/report.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/core/report.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS1C,SAAS,SAAS,CAAC,MAA0C,EAAE,IAAU,EAAE,MAAc;IACrF,IAAI,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;QAC3F,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,yEAAyE;AACzE,SAAS,UAAU,CAAC,QAAgB,EAAE,UAA8B;IAChE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,aAAa,UAAU,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,C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I,CAAC,SAAS,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;YAChF,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/lib/core/resolve.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { userNotFoundError, userInactiveError, targetNotFoundError, targetAmbiguousError } from './finding.js';
|
|
2
2
|
/** Human label per kind, used in findings. Domain wording, not SObject names. */
|
|
3
3
|
const kindLabels = {
|
|
4
4
|
permissionSet: 'permission set',
|
|
@@ -27,10 +27,10 @@ export function evaluateUsers(declared, found) {
|
|
|
27
27
|
for (const username of declared) {
|
|
28
28
|
const user = byName.get(username.toLowerCase());
|
|
29
29
|
if (!user) {
|
|
30
|
-
findings.push(
|
|
30
|
+
findings.push(userNotFoundError(username));
|
|
31
31
|
}
|
|
32
32
|
else if (!user.isActive) {
|
|
33
|
-
findings.push(
|
|
33
|
+
findings.push(userInactiveError(username));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return findings;
|
|
@@ -51,10 +51,10 @@ export function evaluateTargets(kind, declared, found) {
|
|
|
51
51
|
for (const target of declared) {
|
|
52
52
|
const count = counts.get(target.toLowerCase()) ?? 0;
|
|
53
53
|
if (count === 0) {
|
|
54
|
-
findings.push(
|
|
54
|
+
findings.push(targetNotFoundError(target, label));
|
|
55
55
|
}
|
|
56
56
|
else if (count > 1) {
|
|
57
|
-
findings.push(
|
|
57
|
+
findings.push(targetAmbiguousError(target, label));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
return findings;
|
package/lib/core/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/core/resolve.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,
|
|
1
|
+
{"version":3,"file":"resolve.js","s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ED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Finding } from './finding.js';
|
|
3
3
|
export declare const userEntrySchema: z.ZodObject<{
|
|
4
|
-
permissionSets: z.ZodOptional<z.ZodArray<z.ZodString
|
|
5
|
-
|
|
4
|
+
permissionSets: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
expiration: z.ZodISODateTime;
|
|
7
|
+
}, z.core.$strict>]>>>;
|
|
8
|
+
permissionSetGroups: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
expiration: z.ZodISODateTime;
|
|
11
|
+
}, z.core.$strict>]>>>;
|
|
6
12
|
permissionSetLicenses: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
13
|
}, z.core.$strict>;
|
|
8
14
|
export declare const fileSchema: z.ZodObject<{
|
|
9
15
|
users: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
10
|
-
permissionSets: z.ZodOptional<z.ZodArray<z.ZodString
|
|
11
|
-
|
|
16
|
+
permissionSets: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
expiration: z.ZodISODateTime;
|
|
19
|
+
}, z.core.$strict>]>>>;
|
|
20
|
+
permissionSetGroups: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
expiration: z.ZodISODateTime;
|
|
23
|
+
}, z.core.$strict>]>>>;
|
|
12
24
|
permissionSetLicenses: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
25
|
}, z.core.$strict>>;
|
|
14
26
|
}, z.core.$strict>;
|
package/lib/core/schema.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { schemaError } from './finding.js';
|
|
3
|
+
/** A target with an expiration: the object form of an entry. */
|
|
4
|
+
const expiringTarget = z.strictObject({
|
|
5
|
+
name: z.string().min(1),
|
|
6
|
+
expiration: z.iso.datetime({ offset: true }),
|
|
7
|
+
});
|
|
8
|
+
/** An entry is either a bare target name or a name with an expiration. */
|
|
9
|
+
const expiringList = z.array(z.union([z.string().min(1), expiringTarget])).optional();
|
|
10
|
+
/** Licenses cannot expire (PermissionSetLicenseAssign has no ExpirationDate), so names only. */
|
|
11
|
+
const plainList = z.array(z.string().min(1)).optional();
|
|
4
12
|
export const userEntrySchema = z.strictObject({
|
|
5
|
-
permissionSets:
|
|
6
|
-
permissionSetGroups:
|
|
7
|
-
permissionSetLicenses:
|
|
13
|
+
permissionSets: expiringList,
|
|
14
|
+
permissionSetGroups: expiringList,
|
|
15
|
+
permissionSetLicenses: plainList,
|
|
8
16
|
});
|
|
9
17
|
export const fileSchema = z.strictObject({
|
|
10
18
|
users: z.record(z.string().min(1), userEntrySchema),
|
|
@@ -16,7 +24,7 @@ export function validateFile(data, file) {
|
|
|
16
24
|
return { data: parsed.data, findings: [] };
|
|
17
25
|
}
|
|
18
26
|
return {
|
|
19
|
-
findings: parsed.error.issues.map((issue) =>
|
|
27
|
+
findings: parsed.error.issues.map((issue) => schemaError(issue.path.join('.') || '(root)', issue.message, file)),
|
|
20
28
|
};
|
|
21
29
|
}
|
|
22
30
|
//# sourceMappingURL=schema.js.map
|
package/lib/core/schema.js.map
CHANGED
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EA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,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"}
|
package/lib/core/serialize.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DesiredAssignment } from './model.js';
|
|
2
2
|
/**
|
|
3
|
-
* Emit canonical
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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.
|
|
6
7
|
*/
|
|
7
8
|
export declare function serializeAssignments(assignments: DesiredAssignment[]): string;
|
package/lib/core/serialize.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { stringify } from 'yaml';
|
|
2
2
|
import { kindKeys } from './normalize.js';
|
|
3
3
|
/**
|
|
4
|
-
* Emit canonical
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
7
8
|
*/
|
|
8
9
|
export function serializeAssignments(assignments) {
|
|
9
10
|
const usernames = [...new Set(assignments.map((assignment) => assignment.assignee))].sort();
|
|
@@ -11,13 +12,19 @@ export function serializeAssignments(assignments) {
|
|
|
11
12
|
for (const username of usernames) {
|
|
12
13
|
const entry = {};
|
|
13
14
|
for (const [kind, key] of kindKeys) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const expirationByTarget = new Map();
|
|
16
|
+
for (const assignment of assignments) {
|
|
17
|
+
const mine = assignment.assignee === username && assignment.kind === kind;
|
|
18
|
+
if (mine && !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
|
+
return expiration ? { name: target, expiration } : target;
|
|
25
|
+
});
|
|
26
|
+
if (entries.length > 0) {
|
|
27
|
+
entry[key] = entries;
|
|
21
28
|
}
|
|
22
29
|
}
|
|
23
30
|
users[username] = entry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/core/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;
|
|
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,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5F,MAAM,KAAK,GAAwB,EAAE,CAAC;IAEtC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B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1
|
+
import { ActualAssignment, AssignmentOutcome, AssignmentUpdate, DesiredAssignment, Kind, OrgTarget, OrgUser, ResolvedAddition, TargetRef } from '../../core/model.js';
|
|
2
2
|
/**
|
|
3
3
|
* Port: the org operations a service needs, in domain terms. Declared here, by the
|
|
4
4
|
* consumer, so services depend on the abstraction and the adapter implements it.
|
|
@@ -14,6 +14,8 @@ export interface OrgClient {
|
|
|
14
14
|
currentAssignments(targets: TargetRef[]): Promise<ActualAssignment[]>;
|
|
15
15
|
/** Insert the given assignments, reporting per-record success or failure. */
|
|
16
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[]>;
|
|
17
19
|
/** Delete the given assignments by record id, reporting per-record success or failure. */
|
|
18
20
|
removeAssignments(removals: ActualAssignment[]): Promise<AssignmentOutcome[]>;
|
|
19
21
|
}
|
package/lib/services/apply.d.ts
CHANGED
package/lib/services/apply.js
CHANGED
|
@@ -2,14 +2,14 @@ import { loadFiles } from '../core/load.js';
|
|
|
2
2
|
import { diffAssignments } from '../core/diff.js';
|
|
3
3
|
import { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, indexUsersById, indexTargetsById, } from '../core/resolve.js';
|
|
4
4
|
import { countFindings } from '../core/finding.js';
|
|
5
|
-
const emptyDiff = { toAdd: [], toRemove: [], unchanged: [] };
|
|
5
|
+
const emptyDiff = { toAdd: [], toUpdate: [], toRemove: [], unchanged: [] };
|
|
6
6
|
/** An aborted-before-any-change result, carrying the findings that explain why. */
|
|
7
7
|
function invalidResult(files, findings) {
|
|
8
8
|
return {
|
|
9
9
|
files,
|
|
10
10
|
findings,
|
|
11
11
|
diff: emptyDiff,
|
|
12
|
-
drift: { adds: 0, removes: 0 },
|
|
12
|
+
drift: { adds: 0, updates: 0, removes: 0 },
|
|
13
13
|
outcomes: [],
|
|
14
14
|
status: 'invalid',
|
|
15
15
|
failed: true,
|
|
@@ -55,9 +55,11 @@ export class ApplyService {
|
|
|
55
55
|
const diff = diffAssignments(loaded.assignments, actual);
|
|
56
56
|
const { mode, maxDeletes, dryRun } = this.input;
|
|
57
57
|
const additions = mode === 'destructive' ? [] : diff.toAdd;
|
|
58
|
+
const updates = mode === 'destructive' ? [] : diff.toUpdate;
|
|
58
59
|
const removals = mode === 'additive' ? [] : diff.toRemove;
|
|
59
60
|
const drift = {
|
|
60
61
|
adds: mode === 'destructive' ? diff.toAdd.length : 0,
|
|
62
|
+
updates: mode === 'destructive' ? diff.toUpdate.length : 0,
|
|
61
63
|
removes: mode === 'additive' ? diff.toRemove.length : 0,
|
|
62
64
|
};
|
|
63
65
|
if (removals.length > maxDeletes) {
|
|
@@ -80,7 +82,7 @@ export class ApplyService {
|
|
|
80
82
|
return { files: loaded.files, findings, diff, drift, outcomes: [], status: 'declined', failed: false };
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
const outcomes = await this.execute(additions, removals, resolution);
|
|
85
|
+
const outcomes = await this.execute(additions, updates, removals, resolution);
|
|
84
86
|
const failed = outcomes.some((outcome) => !outcome.success);
|
|
85
87
|
return { files: loaded.files, findings, diff, drift, outcomes, status: 'applied', failed };
|
|
86
88
|
}
|
|
@@ -99,17 +101,18 @@ export class ApplyService {
|
|
|
99
101
|
}
|
|
100
102
|
return { findings, userIds: indexUsersById(foundUsers), targetIds };
|
|
101
103
|
}
|
|
102
|
-
async execute(additions, removals, resolution) {
|
|
104
|
+
async execute(additions, updates, removals, resolution) {
|
|
103
105
|
const resolved = additions.map((addition) => ({
|
|
104
106
|
...addition,
|
|
105
107
|
assigneeId: resolution.userIds.get(addition.assignee.toLowerCase()) ?? '',
|
|
106
108
|
targetId: resolution.targetIds[addition.kind].get(addition.target.toLowerCase()) ?? '',
|
|
107
109
|
}));
|
|
108
|
-
const [added, removed] = await Promise.all([
|
|
110
|
+
const [added, updated, removed] = await Promise.all([
|
|
109
111
|
resolved.length > 0 ? this.org.addAssignments(resolved) : Promise.resolve([]),
|
|
112
|
+
updates.length > 0 ? this.org.updateAssignments(updates) : Promise.resolve([]),
|
|
110
113
|
removals.length > 0 ? this.org.removeAssignments(removals) : Promise.resolve([]),
|
|
111
114
|
]);
|
|
112
|
-
return [...added, ...removed];
|
|
115
|
+
return [...added, ...updated, ...removed];
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
//# sourceMappingURL=apply.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACH,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACnB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACH,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACnB,MAAM,oBAAoB,CAAC;AAa5B,OAAO,EAAW,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA+B5D,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;QAC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C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAsB,EAAE,CAAC;SACxG,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;IAC9C,CAAC;CACJ"}
|
package/lib/services/plan.d.ts
CHANGED
package/lib/services/plan.js
CHANGED
|
@@ -2,10 +2,10 @@ import { loadFiles } from '../core/load.js';
|
|
|
2
2
|
import { diffAssignments } from '../core/diff.js';
|
|
3
3
|
import { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, indexTargetsById, } from '../core/resolve.js';
|
|
4
4
|
import { countFindings } from '../core/finding.js';
|
|
5
|
-
const emptyDiff = { toAdd: [], toRemove: [], unchanged: [] };
|
|
5
|
+
const emptyDiff = { toAdd: [], toUpdate: [], toRemove: [], unchanged: [] };
|
|
6
6
|
/** An aborted-before-the-diff result, carrying the findings that explain why. */
|
|
7
7
|
function invalidResult(files, findings) {
|
|
8
|
-
return { files, findings, diff: emptyDiff, drift: { adds: 0, removes: 0 }, status: 'invalid' };
|
|
8
|
+
return { files, findings, diff: emptyDiff, drift: { adds: 0, updates: 0, removes: 0 }, status: 'invalid' };
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Read-only preview: load the files, resolve every reference to an org id, fetch the
|
|
@@ -37,6 +37,7 @@ export class PlanService {
|
|
|
37
37
|
const { mode } = this.input;
|
|
38
38
|
const drift = {
|
|
39
39
|
adds: mode === 'destructive' ? diff.toAdd.length : 0,
|
|
40
|
+
updates: mode === 'destructive' ? diff.toUpdate.length : 0,
|
|
40
41
|
removes: mode === 'additive' ? diff.toRemove.length : 0,
|
|
41
42
|
};
|
|
42
43
|
return { files: loaded.files, findings, diff, drift, status: 'planned' };
|
package/lib/services/plan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/services/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAC,GAAG,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACtE,MAAM,SAAS,GAAG,EAAuC,CAAC;QAC1D,KAAK,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC;YAC7C,QAAQ,CAAC,IAAI,CACT,GAAG,eAAe,CACd,IAAI,EACJ,OAAO,EACP,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CACrC,CACJ,CAAC;YACF,SAAS,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACnC,CAAC;CACJ;AAED,qFAAqF;AACrF,SAAS,cAAc,CAAC,UAAsB;IAC1C,MAAM,IAAI,GAAgB,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,KAAK,MAAM,EAAE,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
package/messages/ps.apply.md
CHANGED
|
@@ -4,7 +4,7 @@ Reconcile a target org to match the permission set assignment files.
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Load the files, resolve every user and target against the org, diff the desired state against what the org currently has, then add and/or remove assignments per the mode. Additions and removals run through the sObject Collections API with partial success, so one bad record does not roll back the rest. Deletions are capped by --max-deletes and confirmed before they run. Run validate and a --dry-run first.
|
|
7
|
+
Load the files, resolve every user and target against the org, diff the desired state against what the org currently has, then add, update expirations, and/or remove assignments per the mode. Additions, expiration updates, and removals run through the sObject Collections API with partial success, so one bad record does not roll back the rest. Deletions are capped by --max-deletes and confirmed before they run. Run validate and a --dry-run first.
|
|
8
8
|
|
|
9
9
|
# flags.file.summary
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ YAML file or glob to apply. Repeatable.
|
|
|
12
12
|
|
|
13
13
|
# flags.mode.summary
|
|
14
14
|
|
|
15
|
-
Which half of the reconcile to run: additive adds
|
|
15
|
+
Which half of the reconcile to run: additive adds missing assignments and updates expirations, destructive removes only, sync does both.
|
|
16
16
|
|
|
17
17
|
# flags.max-deletes.summary
|
|
18
18
|
|
|
@@ -32,11 +32,11 @@ This will remove %s assignment(s) from the org. Continue?
|
|
|
32
32
|
|
|
33
33
|
# summary.dryRun
|
|
34
34
|
|
|
35
|
-
Dry run: %s to add, %s to remove. Nothing was changed.
|
|
35
|
+
Dry run: %s to add, %s to update, %s to remove. Nothing was changed.
|
|
36
36
|
|
|
37
37
|
# summary.applied
|
|
38
38
|
|
|
39
|
-
Applied: %s added, %s removed.
|
|
39
|
+
Applied: %s added, %s updated, %s removed.
|
|
40
40
|
|
|
41
41
|
# summary.declined
|
|
42
42
|
|
package/messages/ps.plan.md
CHANGED
|
@@ -12,11 +12,11 @@ YAML file or glob to plan. Repeatable.
|
|
|
12
12
|
|
|
13
13
|
# flags.mode.summary
|
|
14
14
|
|
|
15
|
-
Which half of the reconcile to preview: additive adds
|
|
15
|
+
Which half of the reconcile to preview: additive adds and updates expirations, destructive removes only, sync does both. Adds, expiration updates, and removes are always shown either way.
|
|
16
16
|
|
|
17
17
|
# summary.counts
|
|
18
18
|
|
|
19
|
-
Plan: %s to add, %s to remove, %s unchanged.
|
|
19
|
+
Plan: %s to add, %s to update, %s to remove, %s unchanged.
|
|
20
20
|
|
|
21
21
|
# summary.next
|
|
22
22
|
|