sf-plugin-permission-sets 0.0.0-dev.5 → 0.0.0-dev.50

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 (132) hide show
  1. package/LICENSE.md +28 -0
  2. package/README.md +250 -82
  3. package/lib/adapters/connection-org-client.d.ts +21 -0
  4. package/lib/adapters/connection-org-client.d.ts.map +1 -0
  5. package/lib/adapters/connection-org-client.js +279 -0
  6. package/lib/adapters/connection-org-client.js.map +1 -0
  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 +55 -0
  12. package/lib/commands/ps/apply.d.ts.map +1 -0
  13. package/lib/commands/ps/apply.js +249 -0
  14. package/lib/commands/ps/apply.js.map +1 -0
  15. package/lib/commands/ps/check.d.ts +21 -0
  16. package/lib/commands/ps/check.d.ts.map +1 -0
  17. package/lib/commands/ps/check.js +55 -0
  18. package/lib/commands/ps/check.js.map +1 -0
  19. package/lib/commands/ps/export.d.ts +26 -0
  20. package/lib/commands/ps/export.d.ts.map +1 -0
  21. package/lib/commands/ps/export.js +74 -0
  22. package/lib/commands/ps/export.js.map +1 -0
  23. package/lib/commands/ps/plan.d.ts +67 -0
  24. package/lib/commands/ps/plan.d.ts.map +1 -0
  25. package/lib/commands/ps/plan.js +246 -0
  26. package/lib/commands/ps/plan.js.map +1 -0
  27. package/lib/commands/ps/validate.d.ts +21 -0
  28. package/lib/commands/ps/validate.d.ts.map +1 -0
  29. package/lib/commands/ps/validate.js +56 -0
  30. package/lib/commands/ps/validate.js.map +1 -0
  31. package/lib/core/diff.d.ts +10 -0
  32. package/lib/core/diff.d.ts.map +1 -0
  33. package/lib/core/diff.js +54 -0
  34. package/lib/core/diff.js.map +1 -0
  35. package/lib/core/finding.d.ts +41 -0
  36. package/lib/core/finding.d.ts.map +1 -0
  37. package/lib/core/finding.js +68 -0
  38. package/lib/core/finding.js.map +1 -0
  39. package/lib/core/index.d.ts +11 -0
  40. package/lib/core/index.d.ts.map +1 -0
  41. package/lib/core/index.js +10 -0
  42. package/lib/core/index.js.map +1 -0
  43. package/lib/core/load.d.ts +4 -0
  44. package/lib/core/load.d.ts.map +1 -0
  45. package/lib/core/load.js +60 -0
  46. package/lib/core/load.js.map +1 -0
  47. package/lib/core/mode.d.ts +18 -0
  48. package/lib/core/mode.d.ts.map +1 -0
  49. package/lib/core/mode.js +16 -0
  50. package/lib/core/mode.js.map +1 -0
  51. package/lib/core/model.d.ts +78 -0
  52. package/lib/core/model.d.ts.map +1 -0
  53. package/lib/core/model.js +2 -0
  54. package/lib/core/model.js.map +1 -0
  55. package/lib/core/normalize.d.ts +17 -0
  56. package/lib/core/normalize.d.ts.map +1 -0
  57. package/lib/core/normalize.js +69 -0
  58. package/lib/core/normalize.js.map +1 -0
  59. package/lib/core/parse.d.ts +10 -0
  60. package/lib/core/parse.d.ts.map +1 -0
  61. package/lib/core/parse.js +20 -0
  62. package/lib/core/parse.js.map +1 -0
  63. package/lib/core/plan-file.d.ts +61 -0
  64. package/lib/core/plan-file.d.ts.map +1 -0
  65. package/lib/core/plan-file.js +74 -0
  66. package/lib/core/plan-file.js.map +1 -0
  67. package/lib/core/report.d.ts +15 -0
  68. package/lib/core/report.d.ts.map +1 -0
  69. package/lib/core/report.js +114 -0
  70. package/lib/core/report.js.map +1 -0
  71. package/lib/core/resolve.d.ts +20 -0
  72. package/lib/core/resolve.d.ts.map +1 -0
  73. package/lib/core/resolve.js +88 -0
  74. package/lib/core/resolve.js.map +1 -0
  75. package/lib/core/schema.d.ts +23 -0
  76. package/lib/core/schema.d.ts.map +1 -0
  77. package/lib/core/schema.js +35 -0
  78. package/lib/core/schema.js.map +1 -0
  79. package/lib/core/serialize.d.ts +9 -0
  80. package/lib/core/serialize.d.ts.map +1 -0
  81. package/lib/core/serialize.js +34 -0
  82. package/lib/core/serialize.js.map +1 -0
  83. package/lib/index.d.ts +1 -0
  84. package/lib/index.d.ts.map +1 -0
  85. package/lib/services/adapters/index.d.ts +2 -0
  86. package/lib/services/adapters/index.d.ts.map +1 -0
  87. package/lib/services/adapters/index.js +2 -0
  88. package/lib/services/adapters/index.js.map +1 -0
  89. package/lib/services/adapters/org-client.d.ts +22 -0
  90. package/lib/services/adapters/org-client.d.ts.map +1 -0
  91. package/lib/services/adapters/org-client.js +2 -0
  92. package/lib/services/adapters/org-client.js.map +1 -0
  93. package/lib/services/apply.d.ts +50 -0
  94. package/lib/services/apply.d.ts.map +1 -0
  95. package/lib/services/apply.js +111 -0
  96. package/lib/services/apply.js.map +1 -0
  97. package/lib/services/check.d.ts +14 -0
  98. package/lib/services/check.d.ts.map +1 -0
  99. package/lib/services/check.js +18 -0
  100. package/lib/services/check.js.map +1 -0
  101. package/lib/services/export.d.ts +19 -0
  102. package/lib/services/export.d.ts.map +1 -0
  103. package/lib/services/export.js +29 -0
  104. package/lib/services/export.js.map +1 -0
  105. package/lib/services/index.d.ts +7 -0
  106. package/lib/services/index.d.ts.map +1 -0
  107. package/lib/services/index.js +7 -0
  108. package/lib/services/index.js.map +1 -0
  109. package/lib/services/plan.d.ts +32 -0
  110. package/lib/services/plan.d.ts.map +1 -0
  111. package/lib/services/plan.js +57 -0
  112. package/lib/services/plan.js.map +1 -0
  113. package/lib/services/resolution.d.ts +17 -0
  114. package/lib/services/resolution.d.ts.map +1 -0
  115. package/lib/services/resolution.js +48 -0
  116. package/lib/services/resolution.js.map +1 -0
  117. package/lib/services/validate.d.ts +21 -0
  118. package/lib/services/validate.d.ts.map +1 -0
  119. package/lib/services/validate.js +50 -0
  120. package/lib/services/validate.js.map +1 -0
  121. package/messages/ps.apply.md +117 -0
  122. package/messages/ps.check.md +33 -0
  123. package/messages/ps.export.md +45 -0
  124. package/messages/ps.plan.md +93 -0
  125. package/messages/ps.validate.md +29 -0
  126. package/package.json +115 -180
  127. package/lib/commands/ps/info.d.ts +0 -11
  128. package/lib/commands/ps/info.js +0 -17
  129. package/lib/commands/ps/info.js.map +0 -1
  130. package/messages/ps.info.md +0 -17
  131. package/oclif.lock +0 -7781
  132. package/oclif.manifest.json +0 -51
@@ -0,0 +1,21 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { Finding } from '../../core/index.js';
3
+ export type PsCheckResult = {
4
+ files: number;
5
+ users: number;
6
+ assignments: number;
7
+ findings: Finding[];
8
+ };
9
+ export default class Check extends SfCommand<PsCheckResult> {
10
+ static readonly summary: string;
11
+ static readonly description: string;
12
+ static readonly examples: string[];
13
+ static readonly flags: {
14
+ file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
15
+ strict: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ };
17
+ run(): Promise<PsCheckResult>;
18
+ private logSummaryCounts;
19
+ private errorFailed;
20
+ }
21
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,6BAA6B,CAAC;AAI/D,OAAO,EAAkB,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9D,MAAM,MAAM,aAAa,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,SAAS,CAAC,aAAa,CAAC;IACvD,gBAAuB,OAAO,SAAkC;IAChE,gBAAuB,WAAW,SAAsC;IACxE,gBAAuB,QAAQ,WAAoC;IAEnE,gBAAuB,KAAK;;;MAU1B;IAEW,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;IA8B1C,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,WAAW;CAGtB"}
@@ -0,0 +1,55 @@
1
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
2
+ import { Messages } from '@salesforce/core';
3
+ import { CheckService } from '../../services/index.js';
4
+ import { formatFindings } from '../../core/index.js';
5
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
6
+ const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.check');
7
+ export default class Check extends SfCommand {
8
+ static summary = messages.getMessage('summary');
9
+ static description = messages.getMessage('description');
10
+ static examples = messages.getMessages('examples');
11
+ static flags = {
12
+ file: Flags.string({
13
+ char: 'f',
14
+ summary: messages.getMessage('flags.file.summary'),
15
+ required: true,
16
+ multiple: true,
17
+ }),
18
+ strict: Flags.boolean({
19
+ summary: messages.getMessage('flags.strict.summary'),
20
+ }),
21
+ };
22
+ async run() {
23
+ const { flags } = await this.parse(Check);
24
+ const service = new CheckService();
25
+ const result = await service.run(flags.file, flags.strict);
26
+ for (const line of formatFindings(result.findings)) {
27
+ this.log(line);
28
+ }
29
+ const assignees = new Set(result.assignments.map((assignment) => assignment.assignee));
30
+ this.log('');
31
+ this.logSummaryCounts(result.errors, result.warnings);
32
+ if (result.failed) {
33
+ process.exitCode = 1;
34
+ if (!this.jsonEnabled()) {
35
+ this.errorFailed();
36
+ }
37
+ }
38
+ return {
39
+ files: result.files.length,
40
+ users: assignees.size,
41
+ assignments: result.assignments.length,
42
+ findings: result.findings,
43
+ };
44
+ }
45
+ logSummaryCounts(errors, warnings) {
46
+ this.log(messages.getMessage('summary.counts', [
47
+ errors,
48
+ warnings,
49
+ ]));
50
+ }
51
+ errorFailed() {
52
+ this.error(messages.getMessage('error.failed'), { exit: 1 });
53
+ }
54
+ }
55
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/commands/ps/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/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AM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEvF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEtD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACtB,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,CAAC;QACL,CAAC;QAED,OAAO;YACH,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;YAC1B,KAAK,EAAE,SAAS,CAAC,IAAI;YACrB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM;YACtC,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC5B,CAAC;IACN,CAAC;IAEO,gBAAgB,CAAC,MAAc,EAAE,QAAgB;QACrD,IAAI,CAAC,GAAG,CACJ,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAClC,MAAM;YACN,QAAQ;SACX,CAAC,CACL,CAAC;IACN,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type PsExportResult = {
3
+ outputFile: string | null;
4
+ users: number;
5
+ assignments: number;
6
+ unmatchedUsers: string[];
7
+ /** The YAML document, present only when it was written to stdout rather than a file. */
8
+ content?: string;
9
+ };
10
+ export default class Export extends SfCommand<PsExportResult> {
11
+ static readonly summary: string;
12
+ static readonly description: string;
13
+ static readonly examples: string[];
14
+ static readonly flags: {
15
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'output-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ user: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ kind: import("@oclif/core/interfaces").OptionFlag<("permissionSets" | "permissionSetGroups" | "permissionSetLicenses")[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ };
20
+ run(): Promise<PsExportResult>;
21
+ private warnUnmatchedUsers;
22
+ private logExportSuccess;
23
+ /** Write the document to stdout with no extra trailing newline, so it is byte-identical to the file. */
24
+ private logDocument;
25
+ }
26
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,6BAA6B,CAAC;AAU/D,MAAM,MAAM,cAAc,GAAG;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAS,CAAC,cAAc,CAAC;IACzD,gBAAuB,OAAO,SAAkC;IAChE,gBAAuB,WAAW,SAAsC;IACxE,gBAAuB,QAAQ,WAAoC;IAEnE,gBAAuB,KAAK;;;;;MAe1B;IAEW,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;IAmC3C,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,gBAAgB;IAUxB,wGAAwG;IACxG,OAAO,CAAC,WAAW;CAGtB"}
@@ -0,0 +1,74 @@
1
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
2
+ import { Messages } from '@salesforce/core';
3
+ import { ConnectionOrgClient } from '../../adapters/index.js';
4
+ import { kindForScopeKey } from '../../core/index.js';
5
+ import { ExportService } from '../../services/index.js';
6
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
7
+ const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.export');
8
+ export default class Export extends SfCommand {
9
+ static summary = messages.getMessage('summary');
10
+ static description = messages.getMessage('description');
11
+ static examples = messages.getMessages('examples');
12
+ static flags = {
13
+ 'target-org': Flags.requiredOrg(),
14
+ 'output-file': Flags.string({
15
+ char: 'f',
16
+ summary: messages.getMessage('flags.output-file.summary'),
17
+ }),
18
+ user: Flags.string({
19
+ summary: messages.getMessage('flags.user.summary'),
20
+ multiple: true,
21
+ }),
22
+ kind: Flags.option({
23
+ summary: messages.getMessage('flags.kind.summary'),
24
+ options: ['permissionSets', 'permissionSetGroups', 'permissionSetLicenses'],
25
+ multiple: true,
26
+ })(),
27
+ };
28
+ async run() {
29
+ const { flags } = await this.parse(Export);
30
+ const filter = {
31
+ usernames: flags.user,
32
+ kinds: flags.kind?.map(kindForScopeKey),
33
+ };
34
+ const connection = flags['target-org'].getConnection();
35
+ const orgClient = new ConnectionOrgClient(connection);
36
+ const service = new ExportService(orgClient);
37
+ const result = await service.run(flags['output-file'], filter);
38
+ this.warnUnmatchedUsers(result.unmatchedUsers);
39
+ if (result.outputFile) {
40
+ this.logExportSuccess(result.assignments, result.users, result.outputFile);
41
+ return {
42
+ outputFile: result.outputFile,
43
+ users: result.users,
44
+ assignments: result.assignments,
45
+ unmatchedUsers: result.unmatchedUsers,
46
+ };
47
+ }
48
+ this.logDocument(result.content);
49
+ return {
50
+ outputFile: null,
51
+ users: result.users,
52
+ assignments: result.assignments,
53
+ unmatchedUsers: result.unmatchedUsers,
54
+ content: result.content,
55
+ };
56
+ }
57
+ warnUnmatchedUsers(unmatchedUsers) {
58
+ for (const username of unmatchedUsers) {
59
+ this.warn(messages.getMessage('warnNoAssignments', [username]));
60
+ }
61
+ }
62
+ logExportSuccess(assignments, users, outputFile) {
63
+ this.log(messages.getMessage('success', [
64
+ assignments,
65
+ users,
66
+ outputFile,
67
+ ]));
68
+ }
69
+ /** Write the document to stdout with no extra trailing newline, so it is byte-identical to the file. */
70
+ logDocument(content) {
71
+ this.log(content.endsWith('\n') ? content.slice(0, -1) : content);
72
+ }
73
+ }
74
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/commands/ps/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAoB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;AAWjF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAyB;IAClD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CA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core';
2
+ import { ActualAssignment, AssignmentUpdate, DesiredAssignment } from '../../core/index.js';
3
+ export type PsPlanResult = {
4
+ org: {
5
+ username: string;
6
+ id: string;
7
+ };
8
+ mode: string;
9
+ counts: {
10
+ toAdd: number;
11
+ toUpdate: number;
12
+ toRemove: number;
13
+ unchanged: number;
14
+ usersAffected: number;
15
+ };
16
+ /** What the chosen mode would not act on (surfaced as drift). */
17
+ drift: {
18
+ adds: number;
19
+ updates: number;
20
+ removes: number;
21
+ };
22
+ /** The full diff, regardless of mode, so machine consumers see everything the text scopes away. */
23
+ changes: {
24
+ toAdd: DesiredAssignment[];
25
+ toUpdate: AssignmentUpdate[];
26
+ toRemove: ActualAssignment[];
27
+ unchanged: ActualAssignment[];
28
+ };
29
+ /** The plan file written, when --out was given. */
30
+ outFile?: string;
31
+ };
32
+ export default class Plan extends SfCommand<PsPlanResult> {
33
+ static readonly summary: string;
34
+ static readonly description: string;
35
+ static readonly examples: string[];
36
+ static readonly flags: {
37
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
38
+ file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
39
+ mode: import("@oclif/core/interfaces").OptionFlag<"additive" | "destructive" | "sync", import("@oclif/core/interfaces").CustomOptions>;
40
+ 'show-unchanged': import("@oclif/core/interfaces").BooleanFlag<boolean>;
41
+ out: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
42
+ };
43
+ run(): Promise<PsPlanResult>;
44
+ /** Freeze the resolved, mode-scoped change set to a plan file that `apply --plan` runs verbatim. */
45
+ private writePlanFile;
46
+ private logWrotePlan;
47
+ /** Render the human-readable plan body once the run is known to be valid. */
48
+ private logPlan;
49
+ /** The assignments the chosen mode would actually act on. */
50
+ private actionable;
51
+ private logBody;
52
+ private countsLine;
53
+ private reportDrift;
54
+ private reportUnchanged;
55
+ private applyCommand;
56
+ private errorInvalid;
57
+ private logHeaderTitle;
58
+ private logHeaderOrg;
59
+ private logEmptyNoChanges;
60
+ private logEmptyNothingToApply;
61
+ private logSummaryNext;
62
+ private logDriftAdditive;
63
+ private logDriftDestructive;
64
+ private logSummaryUnchanged;
65
+ private logSummaryUnchangedListed;
66
+ }
67
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/plan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAS,MAAM,6BAA6B,CAAC;AAK/D,OAAO,EAMH,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAIpB,MAAM,qBAAqB,CAAC;AAK7B,MAAM,MAAM,YAAY,GAAG;IACvB,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACxG,iEAAiE;IACjE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,mGAAmG;IACnG,OAAO,EAAE;QACL,KAAK,EAAE,iBAAiB,EAAE,CAAC;QAC3B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;QAC7B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;QAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;KACjC,CAAC;IACF,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAS,CAAC,YAAY,CAAC;IACrD,gBAAuB,OAAO,SAAkC;IAChE,gBAAuB,WAAW,SAAsC;IACxE,gBAAuB,QAAQ,WAAoC;IAEnE,gBAAuB,KAAK;;;;;;MAmB1B;IAEW,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC;IAkEzC,oGAAoG;YACtF,aAAa;IAsB3B,OAAO,CAAC,YAAY;IAUpB,6EAA6E;IAC7E,OAAO,CAAC,OAAO;IA0Cf,6DAA6D;IAC7D,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,yBAAyB;CAGpC"}
@@ -0,0 +1,246 @@
1
+ import { writeFile, mkdir } from 'node:fs/promises';
2
+ import { dirname } from 'node:path';
3
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
4
+ import { Messages } from '@salesforce/core';
5
+ import { ConnectionOrgClient } from '../../adapters/index.js';
6
+ import { PlanService, resolveAdditions } from '../../services/index.js';
7
+ import { formatDiff, formatFindings, scopeToMode, serializePlan, savedPlanVersion, } from '../../core/index.js';
8
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
9
+ const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.plan');
10
+ export default class Plan extends SfCommand {
11
+ static summary = messages.getMessage('summary');
12
+ static description = messages.getMessage('description');
13
+ static examples = messages.getMessages('examples');
14
+ static flags = {
15
+ 'target-org': Flags.requiredOrg(),
16
+ file: Flags.string({
17
+ char: 'f',
18
+ summary: messages.getMessage('flags.file.summary'),
19
+ required: true,
20
+ multiple: true,
21
+ }),
22
+ mode: Flags.option({
23
+ summary: messages.getMessage('flags.mode.summary'),
24
+ options: ['additive', 'destructive', 'sync'],
25
+ default: 'additive',
26
+ })(),
27
+ 'show-unchanged': Flags.boolean({
28
+ summary: messages.getMessage('flags.show-unchanged.summary'),
29
+ }),
30
+ out: Flags.string({
31
+ summary: messages.getMessage('flags.out.summary'),
32
+ }),
33
+ };
34
+ async run() {
35
+ const { flags } = await this.parse(Plan);
36
+ const mode = flags.mode;
37
+ const targetOrg = flags['target-org'];
38
+ const connection = targetOrg.getConnection();
39
+ const orgClient = new ConnectionOrgClient(connection);
40
+ const service = new PlanService(orgClient);
41
+ const result = await service.run(flags.file, mode);
42
+ for (const line of formatFindings(result.findings)) {
43
+ this.log(line);
44
+ }
45
+ const diff = result.diff;
46
+ const orgId = targetOrg.getOrgId();
47
+ const username = targetOrg.getUsername() ?? '';
48
+ const orgName = username || orgId;
49
+ const actionable = this.actionable(diff, mode);
50
+ const usersAffected = new Set(actionable.map((assignment) => assignment.assignee.toLowerCase())).size;
51
+ const summary = {
52
+ org: { username, id: orgId },
53
+ mode,
54
+ counts: {
55
+ toAdd: diff.toAdd.length,
56
+ toUpdate: diff.toUpdate.length,
57
+ toRemove: diff.toRemove.length,
58
+ unchanged: diff.unchanged.length,
59
+ usersAffected,
60
+ },
61
+ drift: result.drift,
62
+ changes: {
63
+ toAdd: diff.toAdd,
64
+ toUpdate: diff.toUpdate,
65
+ toRemove: diff.toRemove,
66
+ unchanged: diff.unchanged,
67
+ },
68
+ };
69
+ if (result.status === 'invalid') {
70
+ process.exitCode = 1;
71
+ if (!this.jsonEnabled())
72
+ this.errorInvalid();
73
+ return summary;
74
+ }
75
+ this.logPlan({
76
+ diff,
77
+ mode,
78
+ orgName,
79
+ orgId,
80
+ files: flags.file,
81
+ showUnchanged: flags['show-unchanged'],
82
+ actionable,
83
+ usersAffected,
84
+ });
85
+ if (flags.out) {
86
+ await this.writePlanFile(flags.out, { diff, mode, orgId, resolution: result.resolution });
87
+ summary.outFile = flags.out;
88
+ }
89
+ return summary;
90
+ }
91
+ /** Freeze the resolved, mode-scoped change set to a plan file that `apply --plan` runs verbatim. */
92
+ async writePlanFile(outFile, args) {
93
+ const scoped = scopeToMode(args.diff, args.mode);
94
+ const add = resolveAdditions(scoped.additions, args.resolution);
95
+ const plan = {
96
+ version: savedPlanVersion,
97
+ org: args.orgId,
98
+ mode: args.mode,
99
+ add,
100
+ update: scoped.updates,
101
+ remove: scoped.removals,
102
+ };
103
+ const content = serializePlan(plan);
104
+ const total = add.length + scoped.updates.length + scoped.removals.length;
105
+ await mkdir(dirname(outFile), { recursive: true });
106
+ await writeFile(outFile, content, 'utf8');
107
+ this.logWrotePlan(total, outFile);
108
+ }
109
+ logWrotePlan(changes, outFile) {
110
+ this.log(messages.getMessage('summary.wrotePlan', [
111
+ changes,
112
+ outFile,
113
+ outFile,
114
+ ]));
115
+ }
116
+ /** Render the human-readable plan body once the run is known to be valid. */
117
+ logPlan(args) {
118
+ const { diff, mode, orgName, orgId, files, showUnchanged, actionable, usersAffected } = args;
119
+ this.logHeaderTitle();
120
+ this.logHeaderOrg(orgName, orgId, mode);
121
+ const totalChanges = diff.toAdd.length + diff.toUpdate.length + diff.toRemove.length;
122
+ if (totalChanges === 0) {
123
+ if (showUnchanged && diff.unchanged.length > 0) {
124
+ this.logBody(formatDiff(diff, { mode, showUnchanged: true }));
125
+ }
126
+ else {
127
+ this.log('');
128
+ }
129
+ this.logEmptyNoChanges(orgName);
130
+ return;
131
+ }
132
+ this.logBody(formatDiff(diff, { mode, showUnchanged }));
133
+ if (actionable.length === 0) {
134
+ this.logEmptyNothingToApply(mode);
135
+ }
136
+ else {
137
+ this.log(this.countsLine(diff, mode, usersAffected));
138
+ }
139
+ this.reportDrift(diff, mode);
140
+ this.reportUnchanged(diff.unchanged.length, showUnchanged);
141
+ if (actionable.length > 0) {
142
+ this.logSummaryNext(this.applyCommand(orgName, files, mode));
143
+ }
144
+ }
145
+ /** The assignments the chosen mode would actually act on. */
146
+ actionable(diff, mode) {
147
+ if (mode === 'destructive')
148
+ return diff.toRemove;
149
+ if (mode === 'additive')
150
+ return [
151
+ ...diff.toAdd,
152
+ ...diff.toUpdate,
153
+ ];
154
+ return [
155
+ ...diff.toAdd,
156
+ ...diff.toUpdate,
157
+ ...diff.toRemove,
158
+ ];
159
+ }
160
+ logBody(body) {
161
+ this.log('');
162
+ for (const line of body)
163
+ this.log(line);
164
+ if (body.length > 0)
165
+ this.log('');
166
+ }
167
+ countsLine(diff, mode, usersAffected) {
168
+ if (mode === 'destructive') {
169
+ return messages.getMessage('summary.counts.destructive', [
170
+ diff.toRemove.length,
171
+ usersAffected,
172
+ ]);
173
+ }
174
+ if (mode === 'additive') {
175
+ return messages.getMessage('summary.counts.additive', [
176
+ diff.toAdd.length,
177
+ diff.toUpdate.length,
178
+ usersAffected,
179
+ ]);
180
+ }
181
+ return messages.getMessage('summary.counts.sync', [
182
+ diff.toAdd.length,
183
+ diff.toUpdate.length,
184
+ diff.toRemove.length,
185
+ usersAffected,
186
+ ]);
187
+ }
188
+ reportDrift(diff, mode) {
189
+ if (mode === 'additive' && diff.toRemove.length > 0) {
190
+ this.logDriftAdditive(diff.toRemove.length);
191
+ }
192
+ if (mode === 'destructive') {
193
+ const skipped = diff.toAdd.length + diff.toUpdate.length;
194
+ if (skipped > 0)
195
+ this.logDriftDestructive(skipped);
196
+ }
197
+ }
198
+ reportUnchanged(count, showUnchanged) {
199
+ if (count === 0)
200
+ return;
201
+ if (showUnchanged)
202
+ this.logSummaryUnchangedListed(count);
203
+ else
204
+ this.logSummaryUnchanged(count);
205
+ }
206
+ applyCommand(orgName, files, mode) {
207
+ const fileArgs = files.map((file) => `-f "${file}"`).join(' ');
208
+ const modeArg = mode === 'additive' ? '' : ` --mode ${mode}`;
209
+ return `${this.config.bin} ps apply -o ${orgName} ${fileArgs}${modeArg}`;
210
+ }
211
+ errorInvalid() {
212
+ this.error(messages.getMessage('error.invalid'), { exit: 1 });
213
+ }
214
+ logHeaderTitle() {
215
+ this.log(messages.getMessage('header.title'));
216
+ }
217
+ logHeaderOrg(orgName, orgId, mode) {
218
+ this.log(messages.getMessage('header.org', [
219
+ orgName,
220
+ orgId,
221
+ mode,
222
+ ]));
223
+ }
224
+ logEmptyNoChanges(orgName) {
225
+ this.log(messages.getMessage('empty.noChanges', [orgName]));
226
+ }
227
+ logEmptyNothingToApply(mode) {
228
+ this.log(messages.getMessage('empty.nothingToApply', [mode]));
229
+ }
230
+ logSummaryNext(applyCommand) {
231
+ this.log(messages.getMessage('summary.next', [applyCommand]));
232
+ }
233
+ logDriftAdditive(count) {
234
+ this.log(messages.getMessage('drift.additive', [count]));
235
+ }
236
+ logDriftDestructive(count) {
237
+ this.log(messages.getMessage('drift.destructive', [count]));
238
+ }
239
+ logSummaryUnchanged(count) {
240
+ this.log(messages.getMessage('summary.unchanged', [count]));
241
+ }
242
+ logSummaryUnchangedListed(count) {
243
+ this.log(messages.getMessage('summary.unchangedListed', [count]));
244
+ }
245
+ }
246
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/commands/ps/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAc,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EACH,UAAU,EACV,cAAc,EACd,WAAW,EACX,aAAa,EACb,gB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
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { Finding } from '../../core/index.js';
3
+ export type PsValidateResult = {
4
+ files: number;
5
+ users: number;
6
+ assignments: number;
7
+ findings: Finding[];
8
+ };
9
+ export default class Validate extends SfCommand<PsValidateResult> {
10
+ static readonly summary: string;
11
+ static readonly description: string;
12
+ static readonly examples: string[];
13
+ static readonly flags: {
14
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
15
+ file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
16
+ };
17
+ run(): Promise<PsValidateResult>;
18
+ private logSummaryCounts;
19
+ private errorFailed;
20
+ }
21
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,6BAA6B,CAAC;AAK/D,OAAO,EAAkB,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9D,MAAM,MAAM,gBAAgB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IAC7D,gBAAuB,OAAO,SAAkC;IAChE,gBAAuB,WAAW,SAAsC;IACxE,gBAAuB,QAAQ,WAAoC;IAEnE,gBAAuB,KAAK;;;MAQ1B;IAEW,GAAG,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAgC7C,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,WAAW;CAGtB"}
@@ -0,0 +1,56 @@
1
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
2
+ import { Messages } from '@salesforce/core';
3
+ import { ConnectionOrgClient } from '../../adapters/index.js';
4
+ import { ValidateService } from '../../services/index.js';
5
+ import { formatFindings } from '../../core/index.js';
6
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
7
+ const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.validate');
8
+ export default class Validate extends SfCommand {
9
+ static summary = messages.getMessage('summary');
10
+ static description = messages.getMessage('description');
11
+ static examples = messages.getMessages('examples');
12
+ static flags = {
13
+ 'target-org': Flags.requiredOrg(),
14
+ file: Flags.string({
15
+ char: 'f',
16
+ summary: messages.getMessage('flags.file.summary'),
17
+ required: true,
18
+ multiple: true,
19
+ }),
20
+ };
21
+ async run() {
22
+ const { flags } = await this.parse(Validate);
23
+ const connection = flags['target-org'].getConnection();
24
+ const orgClient = new ConnectionOrgClient(connection);
25
+ const service = new ValidateService(orgClient);
26
+ const result = await service.run(flags.file);
27
+ for (const line of formatFindings(result.findings)) {
28
+ this.log(line);
29
+ }
30
+ const assignees = new Set(result.assignments.map((assignment) => assignment.assignee));
31
+ this.log('');
32
+ this.logSummaryCounts(result.errors, result.warnings);
33
+ if (result.failed) {
34
+ process.exitCode = 1;
35
+ if (!this.jsonEnabled()) {
36
+ this.errorFailed();
37
+ }
38
+ }
39
+ return {
40
+ files: result.files.length,
41
+ users: assignees.size,
42
+ assignments: result.assignments.length,
43
+ findings: result.findings,
44
+ };
45
+ }
46
+ logSummaryCounts(errors, warnings) {
47
+ this.log(messages.getMessage('summary.counts', [
48
+ errors,
49
+ warnings,
50
+ ]));
51
+ }
52
+ errorFailed() {
53
+ this.error(messages.getMessage('error.failed'), { exit: 1 });
54
+ }
55
+ }
56
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/ps/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,E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model.js';
2
+ /**
3
+ * Compare the desired assignments against the org's current memberships of the
4
+ * managed targets. `actual` must hold only assignments for targets that appear
5
+ * in `desired` (the managed set), so any actual row not in `desired` is an
6
+ * undeclared assignment eligible for removal. A declared assignment whose
7
+ * expiration differs from the org's is an update rather than unchanged.
8
+ */
9
+ export declare function diffAssignments(desired: DesiredAssignment[], actual: ActualAssignment[]): Diff;
10
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/core/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAoB,iBAAiB,EAAE,IAAI,EAAQ,MAAM,YAAY,CAAC;AAe/F;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAsC9F"}