sf-plugin-permission-sets 0.3.0 → 0.4.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 (106) hide show
  1. package/LICENSE.md +28 -0
  2. package/README.md +176 -36
  3. package/lib/adapters/connection-org-client.d.ts +7 -3
  4. package/lib/adapters/connection-org-client.d.ts.map +1 -1
  5. package/lib/adapters/connection-org-client.js +94 -63
  6. package/lib/adapters/connection-org-client.js.map +1 -1
  7. package/lib/adapters/index.d.ts +2 -0
  8. package/lib/adapters/index.d.ts.map +1 -0
  9. package/lib/adapters/index.js +2 -0
  10. package/lib/adapters/index.js.map +1 -0
  11. package/lib/commands/ps/apply.d.ts +29 -1
  12. package/lib/commands/ps/apply.d.ts.map +1 -1
  13. package/lib/commands/ps/apply.js +160 -35
  14. package/lib/commands/ps/apply.js.map +1 -1
  15. package/lib/commands/ps/check.d.ts +3 -1
  16. package/lib/commands/ps/check.d.ts.map +1 -1
  17. package/lib/commands/ps/check.js +15 -6
  18. package/lib/commands/ps/check.js.map +1 -1
  19. package/lib/commands/ps/export.d.ts +11 -2
  20. package/lib/commands/ps/export.d.ts.map +1 -1
  21. package/lib/commands/ps/export.js +53 -7
  22. package/lib/commands/ps/export.js.map +1 -1
  23. package/lib/commands/ps/plan.d.ts +51 -6
  24. package/lib/commands/ps/plan.d.ts.map +1 -1
  25. package/lib/commands/ps/plan.js +203 -34
  26. package/lib/commands/ps/plan.js.map +1 -1
  27. package/lib/commands/ps/validate.d.ts +3 -1
  28. package/lib/commands/ps/validate.d.ts.map +1 -1
  29. package/lib/commands/ps/validate.js +16 -7
  30. package/lib/commands/ps/validate.js.map +1 -1
  31. package/lib/core/diff.d.ts.map +1 -1
  32. package/lib/core/diff.js +1 -0
  33. package/lib/core/diff.js.map +1 -1
  34. package/lib/core/finding.d.ts +3 -2
  35. package/lib/core/finding.d.ts.map +1 -1
  36. package/lib/core/finding.js +1 -1
  37. package/lib/core/finding.js.map +1 -1
  38. package/lib/core/index.d.ts +11 -0
  39. package/lib/core/index.d.ts.map +1 -0
  40. package/lib/core/index.js +10 -0
  41. package/lib/core/index.js.map +1 -0
  42. package/lib/core/load.d.ts.map +1 -1
  43. package/lib/core/load.js +17 -10
  44. package/lib/core/load.js.map +1 -1
  45. package/lib/core/mode.d.ts +18 -0
  46. package/lib/core/mode.d.ts.map +1 -0
  47. package/lib/core/mode.js +16 -0
  48. package/lib/core/mode.js.map +1 -0
  49. package/lib/core/model.d.ts +9 -0
  50. package/lib/core/model.d.ts.map +1 -1
  51. package/lib/core/normalize.d.ts +2 -0
  52. package/lib/core/normalize.d.ts.map +1 -1
  53. package/lib/core/normalize.js +7 -0
  54. package/lib/core/normalize.js.map +1 -1
  55. package/lib/core/plan-file.d.ts +61 -0
  56. package/lib/core/plan-file.d.ts.map +1 -0
  57. package/lib/core/plan-file.js +74 -0
  58. package/lib/core/plan-file.js.map +1 -0
  59. package/lib/core/report.d.ts +12 -5
  60. package/lib/core/report.d.ts.map +1 -1
  61. package/lib/core/report.js +84 -32
  62. package/lib/core/report.js.map +1 -1
  63. package/lib/core/schema.d.ts +2 -12
  64. package/lib/core/schema.d.ts.map +1 -1
  65. package/lib/core/schema.js +2 -2
  66. package/lib/core/schema.js.map +1 -1
  67. package/lib/services/adapters/index.d.ts +2 -0
  68. package/lib/services/adapters/index.d.ts.map +1 -0
  69. package/lib/services/adapters/index.js +2 -0
  70. package/lib/services/adapters/index.js.map +1 -0
  71. package/lib/services/adapters/org-client.d.ts +3 -3
  72. package/lib/services/adapters/org-client.d.ts.map +1 -1
  73. package/lib/services/apply.d.ts +21 -11
  74. package/lib/services/apply.d.ts.map +1 -1
  75. package/lib/services/apply.js +54 -37
  76. package/lib/services/apply.js.map +1 -1
  77. package/lib/services/check.d.ts +3 -7
  78. package/lib/services/check.d.ts.map +1 -1
  79. package/lib/services/check.js +5 -12
  80. package/lib/services/check.js.map +1 -1
  81. package/lib/services/export.d.ts +11 -6
  82. package/lib/services/export.d.ts.map +1 -1
  83. package/lib/services/export.js +14 -10
  84. package/lib/services/export.js.map +1 -1
  85. package/lib/services/index.d.ts +7 -0
  86. package/lib/services/index.d.ts.map +1 -0
  87. package/lib/services/index.js +7 -0
  88. package/lib/services/index.js.map +1 -0
  89. package/lib/services/plan.d.ts +7 -10
  90. package/lib/services/plan.d.ts.map +1 -1
  91. package/lib/services/plan.js +28 -18
  92. package/lib/services/plan.js.map +1 -1
  93. package/lib/services/resolution.d.ts +6 -6
  94. package/lib/services/resolution.d.ts.map +1 -1
  95. package/lib/services/resolution.js +21 -9
  96. package/lib/services/resolution.js.map +1 -1
  97. package/lib/services/validate.d.ts +7 -7
  98. package/lib/services/validate.d.ts.map +1 -1
  99. package/lib/services/validate.js +20 -13
  100. package/lib/services/validate.js.map +1 -1
  101. package/messages/ps.apply.md +38 -2
  102. package/messages/ps.check.md +1 -1
  103. package/messages/ps.export.md +21 -1
  104. package/messages/ps.plan.md +55 -7
  105. package/messages/ps.validate.md +1 -1
  106. package/package.json +18 -14
@@ -1 +1 @@
1
- {"version":3,"file":"resolution.js","sourceRoot":"","sources":["../../src/services/resolution.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACnB,MAAM,oBAAoB,CAAC;AAS5B,MAAM,UAAU,cAAc,CAAC,UAAsB;IACjD,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;AAED,gGAAgG;AAChG,MAAM,OAAO,iBAAi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pC,CAAC,CAAC,CACL,CAAC;QAEF,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC5C,SAAS;YACT,WAAW;SACd,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAc,CAAC,GAAG,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACtE,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;QACN,CAAC;QAED,MAAM,SAAS,GAAG,EAAuC,CAAC;QAC1D,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC;YACpC,SAAS,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACxE,CAAC;CACJ"}
@@ -1,6 +1,5 @@
1
- import { DesiredAssignment } from '../core/model.js';
2
- import { Finding } from '../core/finding.js';
3
- import { OrgClient } from './adapters/org-client.js';
1
+ import { DesiredAssignment, Finding } from '../core/index.js';
2
+ import { OrgClient } from './adapters/index.js';
4
3
  export type ValidateResult = {
5
4
  files: string[];
6
5
  assignments: DesiredAssignment[];
@@ -9,13 +8,14 @@ export type ValidateResult = {
9
8
  warnings: number;
10
9
  failed: boolean;
11
10
  };
12
- /** Online validate: run the offline load, then resolve every reference against the org. */
11
+ /** Load the files, then resolve every reference against the org. */
13
12
  export declare class ValidateService {
14
13
  private readonly org;
15
- private readonly files;
16
- constructor(org: OrgClient, files: string[]);
17
- run(): Promise<ValidateResult>;
14
+ constructor(org: OrgClient);
15
+ run(files: string[]): Promise<ValidateResult>;
18
16
  /** Look every reference up in the org (in parallel) and evaluate the results. */
19
17
  private resolve;
18
+ private evaluateUserRefs;
19
+ private evaluateTargetRefs;
20
20
  }
21
21
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/services/validate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IACzB,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,2FAA2F;AAC3F,qBAAa,eAAe;IACL,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAa,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAtC,GAAG,EAAE,SAAS,EAAmB,KAAK,EAAE,MAAM,EAAE;IAEvE,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;IAiB3C,iFAAiF;YACnE,OAAO;CA0BxB"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/services/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,iBAAiB,EACjB,OAAO,EAGV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IACzB,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,oEAAoE;AACpE,qBAAa,eAAe;IACL,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAErC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAoB1D,iFAAiF;YACnE,OAAO;YAmBP,gBAAgB;YAKhB,kBAAkB;CAQnC"}
@@ -1,18 +1,17 @@
1
- import { loadFiles } from '../core/load.js';
2
- import { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets } from '../core/resolve.js';
3
- import { countFindings } from '../core/finding.js';
4
- /** Online validate: run the offline load, then resolve every reference against the org. */
1
+ import { loadFiles, kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, countFindings, } from '../core/index.js';
2
+ /** Load the files, then resolve every reference against the org. */
5
3
  export class ValidateService {
6
4
  org;
7
- files;
8
- constructor(org, files) {
5
+ constructor(org) {
9
6
  this.org = org;
10
- this.files = files;
11
7
  }
12
- async run() {
13
- const loaded = await loadFiles(this.files);
14
- const online = await this.resolve(loaded.assignments);
15
- const findings = [...loaded.findings, ...online];
8
+ async run(files) {
9
+ const loaded = await loadFiles(files);
10
+ const resolved = await this.resolve(loaded.assignments);
11
+ const findings = [
12
+ ...loaded.findings,
13
+ ...resolved,
14
+ ];
16
15
  const { errors, warnings } = countFindings(findings);
17
16
  return {
18
17
  files: loaded.files,
@@ -28,16 +27,24 @@ export class ValidateService {
28
27
  const tasks = [];
29
28
  const usernames = distinctAssignees(assignments);
30
29
  if (usernames.length > 0) {
31
- tasks.push(this.org.findUsers(usernames).then((found) => evaluateUsers(usernames, found)));
30
+ tasks.push(this.evaluateUserRefs(usernames));
32
31
  }
33
32
  for (const kind of kinds) {
34
33
  const targets = distinctTargets(assignments, kind);
35
34
  if (targets.length > 0) {
36
- tasks.push(this.org.findTargets(kind, targets).then((found) => evaluateTargets(kind, targets, found.map((target) => target.name))));
35
+ tasks.push(this.evaluateTargetRefs(kind, targets));
37
36
  }
38
37
  }
39
38
  const results = await Promise.all(tasks);
40
39
  return results.flat();
41
40
  }
41
+ async evaluateUserRefs(usernames) {
42
+ const found = await this.org.findUsers(usernames);
43
+ return evaluateUsers(usernames, found);
44
+ }
45
+ async evaluateTargetRefs(kind, targets) {
46
+ const found = await this.org.findTargets(kind, targets);
47
+ return evaluateTargets(kind, targets, found.map((target) => target.name));
48
+ }
42
49
  }
43
50
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/services/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE/G,OAAO,EAAW,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAY5D,2FAA2F;AAC3F,MAAM,OAAO,eAAe;IACY;IAAiC;IAArE,YAAoC,GAAc,EAAmB,KAAe;QAAhD,QAAG,GAAH,GAAG,CAAW;QAAmB,UAAK,GAAL,KAAK,CAAU;IAAG,CAAC;IAEjF,KAAK,CAAC,GAAG;QACZ,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAEtD,MAAM,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;QACjD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QAErD,OAAO;YACH,KAAK,EAA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C,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;YACvD,CAAC;QACL,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,SAAmB;QAC9C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClD,OAAO,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,IAAU,EAAE,OAAiB;QAC1D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,eAAe,CAClB,IAAI,EACJ,OAAO,EACP,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CACrC,CAAC;IACN,CAAC;CACJ"}
@@ -8,11 +8,15 @@ Load the files, resolve every user and target against the org, diff the desired
8
8
 
9
9
  # flags.file.summary
10
10
 
11
- YAML file or glob to apply. Repeatable.
11
+ YAML file or glob to apply. Repeatable. Provide either this or --plan.
12
+
13
+ # flags.plan.summary
14
+
15
+ Apply a saved plan file from plan --out, running the reviewed change set verbatim. Provide either this or --file.
12
16
 
13
17
  # flags.mode.summary
14
18
 
15
- Which half of the reconcile to run: additive adds missing assignments and updates expirations, destructive removes only, sync does both.
19
+ Which half of the reconcile to run: additive adds missing assignments and updates expirations, destructive removes only, sync does both. Cannot be combined with --plan, which carries its own mode.
16
20
 
17
21
  # flags.max-deletes.summary
18
22
 
@@ -22,10 +26,18 @@ Abort before any change if the run would remove more than this many assignments.
22
26
 
23
27
  Resolve and diff, print the plan, and change nothing.
24
28
 
29
+ # flags.show-unchanged.summary
30
+
31
+ List assignments that already match, instead of only counting them.
32
+
25
33
  # flags.no-prompt.summary
26
34
 
27
35
  Skip the deletion confirmation prompt. Required to delete in JSON or other non-interactive runs.
28
36
 
37
+ # info.applyingPlan
38
+
39
+ Applying saved plan (mode %s).
40
+
29
41
  # confirm.delete
30
42
 
31
43
  This will remove %s assignment(s) from the org. Continue?
@@ -50,6 +62,30 @@ Aborted at the confirmation prompt. Nothing was changed.
50
62
 
51
63
  failed to %s %s on %s: %s
52
64
 
65
+ # error.sourceConflict
66
+
67
+ Pass either --file or --plan, not both. --plan runs a saved plan; --file reads and diffs the YAML now.
68
+
69
+ # error.sourceMissing
70
+
71
+ Provide a source to apply: --file <glob> to read the YAML now, or --plan <file> to run a saved plan.
72
+
73
+ # error.modeWithPlan
74
+
75
+ --mode cannot be combined with --plan. A saved plan already carries the mode it was computed for. Re-run plan with the mode you want to get a new plan.
76
+
77
+ # error.planRead
78
+
79
+ Could not read the plan file: %s
80
+
81
+ # error.planInvalid
82
+
83
+ The plan file %s is not a valid plan: %s. Regenerate it with plan --out.
84
+
85
+ # error.planOrg
86
+
87
+ This plan was built for org %s but the target org is %s. Regenerate the plan against the target org.
88
+
53
89
  # error.invalid
54
90
 
55
91
  The files do not resolve cleanly against the org. Fix the errors above, then re-run.
@@ -4,7 +4,7 @@ Statically check permission set assignment files, with no org connection.
4
4
 
5
5
  # description
6
6
 
7
- Parse and validate the YAML files offline. Reports invalid YAML, schema violations, duplicate keys, duplicate targets, and empty entries. Run it in a pre-commit hook or in CI before validate, plan, or apply.
7
+ Parse and validate the YAML files, no org needed. Reports invalid YAML, schema violations, duplicate keys, duplicate targets, and empty entries. Run it in a pre-commit hook or in CI before validate, plan, or apply.
8
8
 
9
9
  # flags.file.summary
10
10
 
@@ -8,12 +8,24 @@ Query the target org for every assignable permission set, group, and license ass
8
8
 
9
9
  # flags.output-file.summary
10
10
 
11
- Path of the YAML file to write. Created (and its parent directories) if missing, overwritten if present.
11
+ Path of the YAML file to write. Created (and its parent directories) if missing, overwritten if present. Omit to write the document to stdout.
12
+
13
+ # flags.user.summary
14
+
15
+ Only export these users, matched on exact username. Repeatable; multiple values are a union.
16
+
17
+ # flags.kind.summary
18
+
19
+ Only export these scopes: permissionSets, permissionSetGroups, or permissionSetLicenses. Repeatable; combined with --user as an intersection.
12
20
 
13
21
  # success
14
22
 
15
23
  Exported %s assignments across %s users to %s.
16
24
 
25
+ # warnNoAssignments
26
+
27
+ No assignments in scope for user %s, it was skipped.
28
+
17
29
  # examples
18
30
 
19
31
  - Export the dev org's assignments to permissions.yml:
@@ -23,3 +35,11 @@ Exported %s assignments across %s users to %s.
23
35
  - Export a production org into an environment folder:
24
36
 
25
37
  <%= config.bin %> <%= command.id %> --target-org prod --output-file permissions/prod.yml
38
+
39
+ - Write to stdout and diff against a committed snapshot:
40
+
41
+ <%= config.bin %> <%= command.id %> --target-org prod | diff - permissions/prod.yml
42
+
43
+ - Export two users' permission sets and groups only:
44
+
45
+ <%= config.bin %> <%= command.id %> --target-org prod --output-file team.yml --user jdoe@acme.com --user asmith@acme.com --kind permissionSets --kind permissionSetGroups
@@ -4,7 +4,7 @@ Preview the changes that would reconcile a target org to the assignment files.
4
4
 
5
5
  # description
6
6
 
7
- Load the files, resolve every user and target against the org, fetch the org's current assignments, and diff the desired state against them. Read-only: it queries the org but never changes it, so it is the apply pipeline stopping before any DML. The full picture (assignments to add and would-be removes) is always shown regardless of mode, and whatever the chosen mode would not act on is surfaced as drift. Run it before apply to preview what would change.
7
+ Load the files, resolve every user and target against the org, fetch the org's current assignments, and diff the desired state against them. Read-only: it queries the org but never changes it, so it is the apply pipeline stopping before any DML. The body shows only what the chosen mode would do, so what plan shows is what apply does. Anything the mode would not touch is reported beneath the plan as drift. Run it before apply to preview what would change.
8
8
 
9
9
  # flags.file.summary
10
10
 
@@ -12,19 +12,67 @@ 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 and updates expirations, destructive removes only, sync does both. Adds, expiration updates, and removes are always shown either way.
15
+ Which half of the reconcile to preview: additive adds and updates expirations, destructive removes only, sync does both. The plan shows only what the chosen mode would do; anything it skips is reported as drift.
16
16
 
17
- # summary.counts
17
+ # flags.show-unchanged.summary
18
18
 
19
- Plan: %s to add, %s to update, %s to remove, %s unchanged.
19
+ List assignments that already match, instead of only counting them.
20
+
21
+ # flags.out.summary
22
+
23
+ Write the computed change set to a plan file that apply can run verbatim with --plan.
24
+
25
+ # summary.wrotePlan
26
+
27
+ Wrote a plan with %s change(s) to %s. Apply it with: ps apply --plan %s
28
+
29
+ # header.title
30
+
31
+ Permission Set Assignments Plan
32
+
33
+ # header.org
34
+
35
+ Org: %s (%s) Mode: %s
36
+
37
+ # summary.counts.additive
38
+
39
+ Plan: %s to add, %s to update. %s users affected.
40
+
41
+ # summary.counts.destructive
42
+
43
+ Plan: %s to remove. %s users affected.
44
+
45
+ # summary.counts.sync
46
+
47
+ Plan: %s to add, %s to update, %s to remove. %s users affected.
48
+
49
+ # summary.unchanged
50
+
51
+ Unchanged: %s assignments (--show-unchanged to list).
52
+
53
+ # summary.unchangedListed
54
+
55
+ Unchanged: %s assignments.
20
56
 
21
57
  # summary.next
22
58
 
23
- Reviewed the plan? Apply it with the same files: sf ps apply --mode %s
59
+ Next: %s
60
+
61
+ # drift.additive
62
+
63
+ Drift: %s undeclared assignment(s) not removed in additive mode. Run --mode sync to remove them.
64
+
65
+ # drift.destructive
66
+
67
+ Drift: %s declared assignment(s) not applied in destructive mode. Run --mode additive or sync to apply them.
68
+
69
+ # empty.noChanges
70
+
71
+ No changes. %s already matches your files.
24
72
 
25
- # drift.note
73
+ # empty.nothingToApply
26
74
 
27
- %s change(s) the %s mode does not act on were surfaced as drift.
75
+ Nothing to apply in %s mode.
28
76
 
29
77
  # error.invalid
30
78
 
@@ -4,7 +4,7 @@ Validate permission set assignment files against a target org.
4
4
 
5
5
  # description
6
6
 
7
- Run every offline check, then resolve each referenced user, permission set, group, and license against the org. Reports users that are missing or inactive and targets that are missing or not unique. Read-only: it queries the org but never changes it. Run it before plan or apply.
7
+ Run the same file checks as check, then resolve each referenced user, permission set, group, and license against the org. Reports users that are missing or inactive and targets that are missing or not unique. Read-only: it queries the org but never changes it. Run it before plan or apply.
8
8
 
9
9
  # flags.file.summary
10
10
 
package/package.json CHANGED
@@ -5,27 +5,31 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zaclummys/sf-plugin-permission-sets.git"
7
7
  },
8
+ "homepage": "https://github.com/zaclummys/sf-plugin-permission-sets#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/zaclummys/sf-plugin-permission-sets/issues"
11
+ },
8
12
  "dependencies": {
9
13
  "@oclif/core": "^4",
10
14
  "@salesforce/core": "^8",
11
15
  "@salesforce/sf-plugins-core": "^12",
12
- "globby": "^16.2.0",
13
- "yaml": "^2.9.0",
14
- "zod": "^4.4.3"
16
+ "globby": "^16",
17
+ "yaml": "^2",
18
+ "zod": "^4"
15
19
  },
16
20
  "devDependencies": {
17
- "@eslint/js": "^10.0.1",
18
- "eslint": "^10.6.0",
19
- "execa": "^9.6.1",
20
- "globals": "^17.7.0",
21
- "ts-node": "^10.9.2",
22
- "typescript": "^6.0.3",
23
- "typescript-eslint": "^8.62.1",
24
- "vitest": "^4.1.9",
25
- "wireit": "^0.14.0"
21
+ "@eslint/js": "^10",
22
+ "eslint": "^10",
23
+ "execa": "^9",
24
+ "globals": "^17",
25
+ "ts-node": "^10",
26
+ "typescript": "^6",
27
+ "typescript-eslint": "^8",
28
+ "vitest": "^4",
29
+ "wireit": "^0"
26
30
  },
27
31
  "engines": {
28
- "node": ">=18.0.0"
32
+ "node": ">=20.0.0"
29
33
  },
30
34
  "files": [
31
35
  "/lib",
@@ -118,5 +122,5 @@
118
122
  "exports": "./lib/index.js",
119
123
  "type": "module",
120
124
  "author": "Isaac Ferreira",
121
- "version": "0.3.0"
125
+ "version": "0.4.0"
122
126
  }