sf-plugin-permission-sets 0.4.0 → 0.6.0

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.
Files changed (96) hide show
  1. package/README.md +135 -79
  2. package/lib/adapters/connection-org-client.d.ts +8 -6
  3. package/lib/adapters/connection-org-client.d.ts.map +1 -1
  4. package/lib/adapters/connection-org-client.js +187 -96
  5. package/lib/adapters/connection-org-client.js.map +1 -1
  6. package/lib/commands/ps/apply.d.ts +1 -15
  7. package/lib/commands/ps/apply.d.ts.map +1 -1
  8. package/lib/commands/ps/apply.js +11 -81
  9. package/lib/commands/ps/apply.js.map +1 -1
  10. package/lib/commands/ps/check.d.ts.map +1 -1
  11. package/lib/commands/ps/check.js +3 -3
  12. package/lib/commands/ps/check.js.map +1 -1
  13. package/lib/commands/ps/export.js +2 -2
  14. package/lib/commands/ps/export.js.map +1 -1
  15. package/lib/commands/ps/plan.d.ts +2 -8
  16. package/lib/commands/ps/plan.d.ts.map +1 -1
  17. package/lib/commands/ps/plan.js +31 -84
  18. package/lib/commands/ps/plan.js.map +1 -1
  19. package/lib/commands/ps/validate.d.ts.map +1 -1
  20. package/lib/commands/ps/validate.js +3 -3
  21. package/lib/commands/ps/validate.js.map +1 -1
  22. package/lib/core/diff.d.ts +37 -1
  23. package/lib/core/diff.d.ts.map +1 -1
  24. package/lib/core/diff.js +68 -4
  25. package/lib/core/diff.js.map +1 -1
  26. package/lib/core/finding.d.ts +9 -7
  27. package/lib/core/finding.d.ts.map +1 -1
  28. package/lib/core/finding.js +16 -8
  29. package/lib/core/finding.js.map +1 -1
  30. package/lib/core/index.d.ts +4 -4
  31. package/lib/core/index.d.ts.map +1 -1
  32. package/lib/core/index.js +3 -3
  33. package/lib/core/index.js.map +1 -1
  34. package/lib/core/load.js +1 -1
  35. package/lib/core/load.js.map +1 -1
  36. package/lib/core/model.d.ts +24 -25
  37. package/lib/core/model.d.ts.map +1 -1
  38. package/lib/core/normalize.d.ts.map +1 -1
  39. package/lib/core/normalize.js +13 -8
  40. package/lib/core/normalize.js.map +1 -1
  41. package/lib/core/report.d.ts +2 -1
  42. package/lib/core/report.d.ts.map +1 -1
  43. package/lib/core/report.js +30 -17
  44. package/lib/core/report.js.map +1 -1
  45. package/lib/core/resolve.d.ts +8 -6
  46. package/lib/core/resolve.d.ts.map +1 -1
  47. package/lib/core/resolve.js +18 -14
  48. package/lib/core/resolve.js.map +1 -1
  49. package/lib/core/serialize.d.ts.map +1 -1
  50. package/lib/core/serialize.js +29 -13
  51. package/lib/core/serialize.js.map +1 -1
  52. package/lib/core/target-name.d.ts +20 -0
  53. package/lib/core/target-name.d.ts.map +1 -0
  54. package/lib/core/target-name.js +32 -0
  55. package/lib/core/target-name.js.map +1 -0
  56. package/lib/core/username.d.ts +23 -0
  57. package/lib/core/username.d.ts.map +1 -0
  58. package/lib/core/username.js +35 -0
  59. package/lib/core/username.js.map +1 -0
  60. package/lib/services/adapters/org-client.d.ts +9 -5
  61. package/lib/services/adapters/org-client.d.ts.map +1 -1
  62. package/lib/services/apply.d.ts +1 -18
  63. package/lib/services/apply.d.ts.map +1 -1
  64. package/lib/services/apply.js +9 -38
  65. package/lib/services/apply.js.map +1 -1
  66. package/lib/services/export.d.ts.map +1 -1
  67. package/lib/services/export.js +3 -2
  68. package/lib/services/export.js.map +1 -1
  69. package/lib/services/index.d.ts +0 -1
  70. package/lib/services/index.d.ts.map +1 -1
  71. package/lib/services/index.js +0 -1
  72. package/lib/services/index.js.map +1 -1
  73. package/lib/services/plan.d.ts +4 -14
  74. package/lib/services/plan.d.ts.map +1 -1
  75. package/lib/services/plan.js +9 -22
  76. package/lib/services/plan.js.map +1 -1
  77. package/lib/services/resolution.d.ts +17 -9
  78. package/lib/services/resolution.d.ts.map +1 -1
  79. package/lib/services/resolution.js +43 -16
  80. package/lib/services/resolution.js.map +1 -1
  81. package/lib/services/validate.d.ts +2 -1
  82. package/lib/services/validate.d.ts.map +1 -1
  83. package/lib/services/validate.js +10 -1
  84. package/lib/services/validate.js.map +1 -1
  85. package/messages/ps.apply.md +2 -34
  86. package/messages/ps.plan.md +0 -8
  87. package/messages/ps.validate.md +1 -1
  88. package/package.json +10 -6
  89. package/lib/core/mode.d.ts +0 -18
  90. package/lib/core/mode.d.ts.map +0 -1
  91. package/lib/core/mode.js +0 -16
  92. package/lib/core/mode.js.map +0 -1
  93. package/lib/core/plan-file.d.ts +0 -61
  94. package/lib/core/plan-file.d.ts.map +0 -1
  95. package/lib/core/plan-file.js +0 -74
  96. package/lib/core/plan-file.js.map +0 -1
@@ -11,12 +11,13 @@ function bucketFor(byKind, kind, target) {
11
11
  byTarget = new Map();
12
12
  byKind.set(kind, byTarget);
13
13
  }
14
- let bucket = byTarget.get(target);
15
- if (!bucket) {
16
- bucket = { adds: new Map(), updates: new Map(), removes: new Set(), unchanged: new Map() };
17
- byTarget.set(target, bucket);
14
+ let entry = byTarget.get(target.asKey());
15
+ if (!entry) {
16
+ const bucket = { adds: new Map(), updates: new Map(), removes: new Set(), unchanged: new Map() };
17
+ entry = { target, bucket };
18
+ byTarget.set(target.asKey(), entry);
18
19
  }
19
- return bucket;
20
+ return entry.bucket;
20
21
  }
21
22
  /**
22
23
  * A canonical, readable form of an expiration instant, so values from the org and from the
@@ -31,12 +32,20 @@ function canonicalExpiration(value) {
31
32
  }
32
33
  /** An assignee line suffixed with its expiration when there is one. */
33
34
  function withExpiry(assignee, expiration) {
34
- return expiration ? `${assignee} expires ${canonicalExpiration(expiration)}` : assignee;
35
+ if (!expiration)
36
+ return assignee;
37
+ return `${assignee} expires ${canonicalExpiration(expiration)}`;
38
+ }
39
+ /** A canonical expiration for display, with `never` standing in for no expiration. */
40
+ function expiryOrNever(expiration) {
41
+ if (!expiration)
42
+ return 'never';
43
+ return canonicalExpiration(expiration);
35
44
  }
36
45
  /** An update line showing the expiration transition, with `never` standing in for no expiration. */
37
46
  function withTransition(assignee, previous, next) {
38
- const from = previous ? canonicalExpiration(previous) : 'never';
39
- const to = next ? canonicalExpiration(next) : 'never';
47
+ const from = expiryOrNever(previous);
48
+ const to = expiryOrNever(next);
40
49
  return `${assignee} expires ${from} → ${to}`;
41
50
  }
42
51
  /** Group a diff into per-kind, per-target buckets, keeping only the operations the mode shows. */
@@ -46,10 +55,12 @@ function collectBuckets(diff, options) {
46
55
  const byKind = new Map();
47
56
  if (showAdditive) {
48
57
  for (const assignment of diff.toAdd) {
49
- bucketFor(byKind, assignment.kind, assignment.target).adds.set(assignment.assignee, assignment.expiration);
58
+ const bucket = bucketFor(byKind, assignment.kind, assignment.target);
59
+ bucket.adds.set(assignment.assignee.toString(), assignment.expiration);
50
60
  }
51
61
  for (const update of diff.toUpdate) {
52
- bucketFor(byKind, update.kind, update.target).updates.set(update.assignee, {
62
+ const bucket = bucketFor(byKind, update.kind, update.target);
63
+ bucket.updates.set(update.assignee.toString(), {
53
64
  previous: update.previousExpiration,
54
65
  next: update.expiration,
55
66
  });
@@ -57,12 +68,14 @@ function collectBuckets(diff, options) {
57
68
  }
58
69
  if (showDestructive) {
59
70
  for (const assignment of diff.toRemove) {
60
- bucketFor(byKind, assignment.kind, assignment.target).removes.add(assignment.assignee);
71
+ const bucket = bucketFor(byKind, assignment.kind, assignment.target);
72
+ bucket.removes.add(assignment.assignee.toString());
61
73
  }
62
74
  }
63
75
  if (options.showUnchanged) {
64
76
  for (const assignment of diff.unchanged) {
65
- bucketFor(byKind, assignment.kind, assignment.target).unchanged.set(assignment.assignee, assignment.expiration);
77
+ const bucket = bucketFor(byKind, assignment.kind, assignment.target);
78
+ bucket.unchanged.set(assignment.assignee.toString(), assignment.expiration);
66
79
  }
67
80
  }
68
81
  return byKind;
@@ -71,7 +84,7 @@ function collectBuckets(diff, options) {
71
84
  function renderBucket(bucket) {
72
85
  const entries = [];
73
86
  for (const assignee of [...bucket.adds.keys()].sort()) {
74
- entries.push(` + ${withExpiry(assignee, bucket.adds.get(assignee))}`);
87
+ entries.push(` + ${withExpiry(assignee, bucket.adds.get(assignee) ?? null)}`);
75
88
  }
76
89
  for (const assignee of [...bucket.updates.keys()].sort()) {
77
90
  const change = bucket.updates.get(assignee);
@@ -80,7 +93,7 @@ function renderBucket(bucket) {
80
93
  for (const assignee of [...bucket.removes].sort())
81
94
  entries.push(` - ${assignee}`);
82
95
  for (const assignee of [...bucket.unchanged.keys()].sort()) {
83
- entries.push(` = ${withExpiry(assignee, bucket.unchanged.get(assignee))}`);
96
+ entries.push(` = ${withExpiry(assignee, bucket.unchanged.get(assignee) ?? null)}`);
84
97
  }
85
98
  return entries;
86
99
  }
@@ -97,13 +110,13 @@ export function formatDiff(diff, options) {
97
110
  const byTarget = byKind.get(kind);
98
111
  if (!byTarget)
99
112
  continue;
100
- const sorted = [...byTarget].sort((left, right) => left[0].localeCompare(right[0]));
113
+ const sorted = [...byTarget.values()].sort((left, right) => left.target.toString().localeCompare(right.target.toString()));
101
114
  const targetLines = [];
102
- for (const [target, bucket] of sorted) {
115
+ for (const { target, bucket } of sorted) {
103
116
  const entries = renderBucket(bucket);
104
117
  if (entries.length === 0)
105
118
  continue;
106
- targetLines.push(` ${target}`, ...entries);
119
+ targetLines.push(` ${target.toString()}`, ...entries);
107
120
  }
108
121
  if (targetLines.length === 0)
109
122
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/core/report.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS1C,uFAAuF;AACvF,MAAM,UAAU,GAAyB;IACrC,aAAa,EAAE,iBAAiB;IAChC,kBAAkB,EAAE,uBAAuB;IAC3C,oBAAoB,EAAE,yBAAyB;CAClD,CAAC;AAQF,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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GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ;YAAE,SAAS;QAExB,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAChE,CAAC;QACF,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;YACrC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YACnC,WAAW,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,CAAC;QAC3D,CAAC;QAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACvC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -1,20 +1,22 @@
1
1
  import { DesiredAssignment, Kind, OrgTarget, OrgUser } from './model.js';
2
+ import { TargetName } from './target-name.js';
3
+ import { Username } from './username.js';
2
4
  import { Finding } from './finding.js';
3
5
  export declare const kinds: Kind[];
4
6
  /** The distinct usernames assigned across all assignments. */
5
- export declare function distinctAssignees(assignments: DesiredAssignment[]): string[];
7
+ export declare function distinctAssignees(assignments: DesiredAssignment[]): Username[];
6
8
  /** The distinct targets of one kind across all assignments. */
7
- export declare function distinctTargets(assignments: DesiredAssignment[], kind: Kind): string[];
9
+ export declare function distinctTargets(assignments: DesiredAssignment[], kind: Kind): TargetName[];
8
10
  /** Every declared user must exist in the org and be active. */
9
- export declare function evaluateUsers(declared: string[], found: OrgUser[]): Finding[];
11
+ export declare function evaluateUsers(declared: Username[], found: OrgUser[]): Finding[];
10
12
  /**
11
13
  * Every declared target of one kind must resolve to exactly one record in the
12
14
  * org. `found` is the list of matching identifiers the org returned; matching is
13
15
  * case-insensitive, mirroring how the org compares them.
14
16
  */
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 evaluateTargets(kind: Kind, declared: TargetName[], found: TargetName[]): Finding[];
18
+ /** Index active users by their comparison key to their org id, for building assignments. */
17
19
  export declare function indexUsersById(found: OrgUser[]): Map<string, string>;
18
- /** Index targets by lowercased name to their org id, skipping names that resolve ambiguously. */
20
+ /** Index targets by their comparison key to their org id, skipping names that resolve ambiguously. */
19
21
  export declare function indexTargetsById(found: OrgTarget[]): Map<string, string>;
20
22
  //# sourceMappingURL=resolve.d.ts.map
@@ -1 +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;A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;AAC5F,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAQpE;AAED,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxE"}
@@ -6,8 +6,15 @@ const kindLabels = {
6
6
  permissionSetLicense: 'permission set license',
7
7
  };
8
8
  export const kinds = Object.keys(kindLabels);
9
+ /** De-duplicate identifiers by their comparison key, keeping the first spelling of each. */
9
10
  function distinct(values) {
10
- return [...new Set(values)];
11
+ const byKey = new Map();
12
+ for (const value of values) {
13
+ if (!byKey.has(value.asKey())) {
14
+ byKey.set(value.asKey(), value);
15
+ }
16
+ }
17
+ return [...byKey.values()];
11
18
  }
12
19
  /** The distinct usernames assigned across all assignments. */
13
20
  export function distinctAssignees(assignments) {
@@ -21,11 +28,11 @@ export function distinctTargets(assignments, kind) {
21
28
  export function evaluateUsers(declared, found) {
22
29
  const byName = new Map();
23
30
  for (const user of found) {
24
- byName.set(user.username.toLowerCase(), user);
31
+ byName.set(user.username.asKey(), user);
25
32
  }
26
33
  const findings = [];
27
34
  for (const username of declared) {
28
- const user = byName.get(username.toLowerCase());
35
+ const user = byName.get(username.asKey());
29
36
  if (!user) {
30
37
  findings.push(userNotFoundError(username));
31
38
  }
@@ -44,12 +51,11 @@ export function evaluateTargets(kind, declared, found) {
44
51
  const label = kindLabels[kind];
45
52
  const counts = new Map();
46
53
  for (const name of found) {
47
- const key = name.toLowerCase();
48
- counts.set(key, (counts.get(key) ?? 0) + 1);
54
+ counts.set(name.asKey(), (counts.get(name.asKey()) ?? 0) + 1);
49
55
  }
50
56
  const findings = [];
51
57
  for (const target of declared) {
52
- const count = counts.get(target.toLowerCase()) ?? 0;
58
+ const count = counts.get(target.asKey()) ?? 0;
53
59
  if (count === 0) {
54
60
  findings.push(targetNotFoundError(target, label));
55
61
  }
@@ -59,28 +65,26 @@ export function evaluateTargets(kind, declared, found) {
59
65
  }
60
66
  return findings;
61
67
  }
62
- /** Index active users by lowercased username to their org id, for building assignments. */
68
+ /** Index active users by their comparison key to their org id, for building assignments. */
63
69
  export function indexUsersById(found) {
64
70
  const byName = new Map();
65
71
  for (const user of found) {
66
72
  if (user.isActive) {
67
- byName.set(user.username.toLowerCase(), user.id);
73
+ byName.set(user.username.asKey(), user.id);
68
74
  }
69
75
  }
70
76
  return byName;
71
77
  }
72
- /** Index targets by lowercased name to their org id, skipping names that resolve ambiguously. */
78
+ /** Index targets by their comparison key to their org id, skipping names that resolve ambiguously. */
73
79
  export function indexTargetsById(found) {
74
80
  const counts = new Map();
75
81
  for (const target of found) {
76
- const key = target.name.toLowerCase();
77
- counts.set(key, (counts.get(key) ?? 0) + 1);
82
+ counts.set(target.name.asKey(), (counts.get(target.name.asKey()) ?? 0) + 1);
78
83
  }
79
84
  const byName = new Map();
80
85
  for (const target of found) {
81
- const key = target.name.toLowerCase();
82
- if (counts.get(key) === 1) {
83
- byName.set(key, target.id);
86
+ if (counts.get(target.name.asKey()) === 1) {
87
+ byName.set(target.name.asKey(), target.id);
84
88
  }
85
89
  }
86
90
  return byName;
@@ -1 +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,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AE,GAAG,MAAM,CAiC7E"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/core/serialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAuC/C;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAuB7E"}
@@ -1,5 +1,29 @@
1
1
  import { stringify } from 'yaml';
2
2
  import { kindKeys } from './normalize.js';
3
+ import { distinctAssignees } from './resolve.js';
4
+ /** Order identifiers by their text, matching the plain string sort the output relies on. */
5
+ function byText(left, right) {
6
+ const leftText = left.toString();
7
+ const rightText = right.toString();
8
+ if (leftText === rightText)
9
+ return 0;
10
+ return leftText < rightText ? -1 : 1;
11
+ }
12
+ /** One user's entries for one scope, de-duplicated by target and ordered by name. */
13
+ function scopeEntries(assignments) {
14
+ const byTarget = new Map();
15
+ for (const assignment of assignments) {
16
+ if (!byTarget.has(assignment.target.asKey())) {
17
+ byTarget.set(assignment.target.asKey(), { target: assignment.target, expiration: assignment.expiration });
18
+ }
19
+ }
20
+ const sorted = [...byTarget.values()].sort((left, right) => byText(left.target, right.target));
21
+ return sorted.map(({ target, expiration }) => {
22
+ if (!expiration)
23
+ return target.toString();
24
+ return { name: target.toString(), expiration };
25
+ });
26
+ }
3
27
  /**
4
28
  * Emit canonical assignments back to a user-keyed YAML document: the inverse of
5
29
  * normalize. Usernames and targets are sorted and de-duplicated so the output is
@@ -7,27 +31,19 @@ import { kindKeys } from './normalize.js';
7
31
  * is written as the object form so it round-trips through the schema.
8
32
  */
9
33
  export function serializeAssignments(assignments) {
10
- const usernames = [...new Set(assignments.map((assignment) => assignment.assignee))].sort();
34
+ const assignees = distinctAssignees(assignments);
35
+ const usernames = assignees.sort(byText);
11
36
  const users = {};
12
37
  for (const username of usernames) {
13
38
  const entry = {};
14
39
  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
- return expiration ? { name: target, expiration } : target;
25
- });
40
+ const matching = assignments.filter((assignment) => assignment.assignee.equals(username) && assignment.kind === kind);
41
+ const entries = scopeEntries(matching);
26
42
  if (entries.length > 0) {
27
43
  entry[key] = entries;
28
44
  }
29
45
  }
30
- users[username] = entry;
46
+ users[username.toString()] = entry;
31
47
  }
32
48
  return stringify({ users });
33
49
  }
@@ -1 +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,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,MAAM,KAAK,GAAgC,EAAE,CAAC;QAE9C,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAC/B,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,QAAQ,IAAI,UAAU,CAAC,IAAI,KAAK,IAAI,CAC/E,CAAC;YAEF,MAAM,kBAAkB,GAAG,IAAI,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M,CAAC,CAAC;IACzC,MAAM,KAAK,GAAwB,EAAE,CAAC;IAEtC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAgC,EAAE,CAAC;QAE9C,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAC/B,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,IAAI,CACnF,CAAC;YACF,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YAEvC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;YACzB,CAAC;QACL,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC;IACvC,CAAC;IAED,OAAO,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The API name of a permission set, group, or license. An org compares these without
3
+ * regard to case, so the model compares, indexes, and de-duplicates by `key` and keeps
4
+ * the text as written only for display and for round-tripping back to YAML.
5
+ *
6
+ * See Username for why these are two classes rather than one with a shared base.
7
+ */
8
+ export declare class TargetName {
9
+ private readonly raw;
10
+ private constructor();
11
+ static of(value: string): TargetName;
12
+ /** The value to compare, index, and de-duplicate by. */
13
+ asKey(): string;
14
+ equals(other: TargetName): boolean;
15
+ /** The name as written, for display and for messages. */
16
+ toString(): string;
17
+ /** Keeps `--json` payloads plain strings, spelled as the files and the org spell them. */
18
+ toJSON(): string;
19
+ }
20
+ //# sourceMappingURL=target-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target-name.d.ts","sourceRoot":"","sources":["../../src/core/target-name.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,UAAU;IACC,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAxC,OAAO;WAEO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAI3C,wDAAwD;IACjD,KAAK,IAAI,MAAM;IAIf,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAIzC,yDAAyD;IAClD,QAAQ,IAAI,MAAM;IAIzB,0FAA0F;IACnF,MAAM,IAAI,MAAM;CAG1B"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The API name of a permission set, group, or license. An org compares these without
3
+ * regard to case, so the model compares, indexes, and de-duplicates by `key` and keeps
4
+ * the text as written only for display and for round-tripping back to YAML.
5
+ *
6
+ * See Username for why these are two classes rather than one with a shared base.
7
+ */
8
+ export class TargetName {
9
+ raw;
10
+ constructor(raw) {
11
+ this.raw = raw;
12
+ }
13
+ static of(value) {
14
+ return new TargetName(value);
15
+ }
16
+ /** The value to compare, index, and de-duplicate by. */
17
+ asKey() {
18
+ return this.raw.toLowerCase();
19
+ }
20
+ equals(other) {
21
+ return this.asKey() === other.asKey();
22
+ }
23
+ /** The name as written, for display and for messages. */
24
+ toString() {
25
+ return this.raw;
26
+ }
27
+ /** Keeps `--json` payloads plain strings, spelled as the files and the org spell them. */
28
+ toJSON() {
29
+ return this.raw;
30
+ }
31
+ }
32
+ //# sourceMappingURL=target-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target-name.js","sourceRoot":"","sources":["../../src/core/target-name.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IACkB;IAArC,YAAqC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAE7C,MAAM,CAAC,EAAE,CAAC,KAAa;QAC1B,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,wDAAwD;IACjD,KAAK;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,KAAiB;QAC3B,OAAO,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;IAED,yDAAyD;IAClD,QAAQ;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,0FAA0F;IACnF,MAAM;QACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;CACJ"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A Salesforce username. An org compares usernames without regard to case, so every
3
+ * comparison, index, and de-duplication in the model goes through `key` rather than the
4
+ * raw text, and the text as written survives only for display and for round-tripping
5
+ * back to YAML.
6
+ *
7
+ * Deliberately not sharing a base class with TargetName: the private field is what makes
8
+ * the two nominally distinct to the compiler, so one cannot be passed where the other is
9
+ * expected. A shared base would make them structurally identical again.
10
+ */
11
+ export declare class Username {
12
+ private readonly raw;
13
+ private constructor();
14
+ static of(value: string): Username;
15
+ /** The value to compare, index, and de-duplicate by. */
16
+ asKey(): string;
17
+ equals(other: Username): boolean;
18
+ /** The username as written, for display and for messages. */
19
+ toString(): string;
20
+ /** Keeps `--json` payloads plain strings, spelled as the files and the org spell them. */
21
+ toJSON(): string;
22
+ }
23
+ //# sourceMappingURL=username.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"username.d.ts","sourceRoot":"","sources":["../../src/core/username.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,QAAQ;IACG,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAxC,OAAO;WAEO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAIzC,wDAAwD;IACjD,KAAK,IAAI,MAAM;IAIf,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAIvC,6DAA6D;IACtD,QAAQ,IAAI,MAAM;IAIzB,0FAA0F;IACnF,MAAM,IAAI,MAAM;CAG1B"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * A Salesforce username. An org compares usernames without regard to case, so every
3
+ * comparison, index, and de-duplication in the model goes through `key` rather than the
4
+ * raw text, and the text as written survives only for display and for round-tripping
5
+ * back to YAML.
6
+ *
7
+ * Deliberately not sharing a base class with TargetName: the private field is what makes
8
+ * the two nominally distinct to the compiler, so one cannot be passed where the other is
9
+ * expected. A shared base would make them structurally identical again.
10
+ */
11
+ export class Username {
12
+ raw;
13
+ constructor(raw) {
14
+ this.raw = raw;
15
+ }
16
+ static of(value) {
17
+ return new Username(value);
18
+ }
19
+ /** The value to compare, index, and de-duplicate by. */
20
+ asKey() {
21
+ return this.raw.toLowerCase();
22
+ }
23
+ equals(other) {
24
+ return this.asKey() === other.asKey();
25
+ }
26
+ /** The username as written, for display and for messages. */
27
+ toString() {
28
+ return this.raw;
29
+ }
30
+ /** Keeps `--json` payloads plain strings, spelled as the files and the org spell them. */
31
+ toJSON() {
32
+ return this.raw;
33
+ }
34
+ }
35
+ //# sourceMappingURL=username.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"username.js","sourceRoot":"","sources":["../../src/core/username.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,OAAO,QAAQ;IACoB;IAArC,YAAqC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAE7C,MAAM,CAAC,EAAE,CAAC,KAAa;QAC1B,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,wDAAwD;IACjD,KAAK;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,KAAe;QACzB,OAAO,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;IAED,6DAA6D;IACtD,QAAQ;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,0FAA0F;IACnF,MAAM;QACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;CACJ"}
@@ -1,17 +1,21 @@
1
- import { ActualAssignment, AssignmentFilter, AssignmentOutcome, AssignmentUpdate, DesiredAssignment, Kind, OrgTarget, OrgUser, ResolvedAddition, TargetRef } from '../../core/index.js';
1
+ import { ActualAssignment, AssignmentFilter, AssignmentOutcome, AssignmentUpdate, DesiredAssignment, OrgTarget, OrgUser, ResolvedAddition, TargetName, TargetRef, Username } from '../../core/index.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.
5
5
  */
6
6
  export interface OrgClient {
7
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[]>;
8
+ findUsers(usernames: Username[]): Promise<OrgUser[]>;
9
+ /** The permission sets (with ids) that exist in the org, among the given names. */
10
+ findPermissionSets(names: TargetName[]): Promise<OrgTarget[]>;
11
+ /** The permission set groups (with ids) that exist in the org, among the given developer names. */
12
+ findPermissionSetGroups(names: TargetName[]): Promise<OrgTarget[]>;
13
+ /** The permission set licenses (with ids) that exist in the org, among the given developer names. */
14
+ findPermissionSetLicenses(names: TargetName[]): Promise<OrgTarget[]>;
11
15
  /** Every assignable permission set, group, and license assignment held by active users, narrowed by the filter. */
12
16
  listAssignments(filter?: AssignmentFilter): Promise<DesiredAssignment[]>;
13
17
  /** The current assignments of the given managed targets, with their record ids. */
14
- currentAssignments(targets: TargetRef[]): Promise<ActualAssignment[]>;
18
+ listCurrentAssignments(targets: TargetRef[]): Promise<ActualAssignment[]>;
15
19
  /** Insert the given assignments, reporting per-record success or failure. */
16
20
  addAssignments(additions: ResolvedAddition[]): Promise<AssignmentOutcome[]>;
17
21
  /** Update the expiration of the given assignments, reporting per-record success or failure. */
@@ -1 +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"}
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,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,QAAQ,EACX,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB,kEAAkE;IAClE,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,mFAAmF;IACnF,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC9D,mGAAmG;IACnG,uBAAuB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACnE,qGAAqG;IACrG,yBAAyB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACrE,mHAAmH;IACnH,eAAe,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACzE,mFAAmF;IACnF,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1E,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"}
@@ -1,4 +1,4 @@
1
- import { AssignmentOutcome, Diff, SavedPlan, Finding } from '../core/index.js';
1
+ import { AssignmentOutcome, Diff, Finding } from '../core/index.js';
2
2
  import { OrgClient } from './adapters/index.js';
3
3
  export type ApplyMode = 'additive' | 'destructive' | 'sync';
4
4
  /** How the service asks its caller to approve a destructive batch before applying it. */
@@ -8,23 +8,12 @@ export type ApplyInput = {
8
8
  maxDeletes: number;
9
9
  dryRun: boolean;
10
10
  };
11
- /** The inputs a saved-plan apply needs. The mode is already baked into the plan. */
12
- export type ApplyPlanInput = {
13
- maxDeletes: number;
14
- dryRun: boolean;
15
- };
16
11
  /** How a run ended, so the command can report and set the exit code. */
17
12
  export type ApplyStatus = 'applied' | 'dry-run' | 'declined' | 'max-deletes-exceeded' | 'invalid';
18
13
  export type ApplyResult = {
19
14
  files: string[];
20
15
  findings: Finding[];
21
16
  diff: Diff;
22
- /** What the chosen mode did not act on (surfaced as drift). */
23
- drift: {
24
- adds: number;
25
- updates: number;
26
- removes: number;
27
- };
28
17
  outcomes: AssignmentOutcome[];
29
18
  status: ApplyStatus;
30
19
  failed: boolean;
@@ -39,12 +28,6 @@ export declare class ApplyService {
39
28
  private readonly confirmDeletions;
40
29
  constructor(org: OrgClient, confirmDeletions: ConfirmDeletions);
41
30
  run(files: string[], input: ApplyInput): Promise<ApplyResult>;
42
- /**
43
- * Apply a saved plan verbatim: no load, resolve, or diff. The plan is already
44
- * mode-scoped and resolved, so there is no drift and no findings. maxDeletes and
45
- * the deletion confirmation still guard the run.
46
- */
47
- runPlan(plan: SavedPlan, input: ApplyPlanInput): Promise<ApplyResult>;
48
31
  private executeResolved;
49
32
  }
50
33
  //# sourceMappingURL=apply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EAEjB,IAAI,EAEJ,SAAS,EACT,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,C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