sf-plugin-permission-sets 0.0.0-dev.19 → 0.0.0-dev.21

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 (71) hide show
  1. package/README.md +31 -28
  2. package/lib/adapters/connection-org-client.d.ts +7 -3
  3. package/lib/adapters/connection-org-client.js +173 -4
  4. package/lib/adapters/connection-org-client.js.map +1 -1
  5. package/lib/commands/ps/apply.d.ts +25 -0
  6. package/lib/commands/ps/apply.js +116 -0
  7. package/lib/commands/ps/apply.js.map +1 -0
  8. package/lib/commands/ps/check.d.ts +1 -1
  9. package/lib/commands/ps/check.js +1 -1
  10. package/lib/commands/ps/check.js.map +1 -1
  11. package/lib/commands/ps/export.d.ts +17 -0
  12. package/lib/commands/ps/export.js +29 -0
  13. package/lib/commands/ps/export.js.map +1 -0
  14. package/lib/commands/ps/plan.d.ts +21 -0
  15. package/lib/commands/ps/plan.js +74 -0
  16. package/lib/commands/ps/plan.js.map +1 -0
  17. package/lib/commands/ps/validate.d.ts +1 -1
  18. package/lib/commands/ps/validate.js +1 -1
  19. package/lib/commands/ps/validate.js.map +1 -1
  20. package/lib/core/diff.d.ts +8 -0
  21. package/lib/core/diff.js +35 -0
  22. package/lib/core/diff.js.map +1 -0
  23. package/lib/core/finding.d.ts +27 -0
  24. package/lib/core/finding.js +22 -0
  25. package/lib/core/finding.js.map +1 -0
  26. package/lib/core/load.js +2 -1
  27. package/lib/core/load.js.map +1 -1
  28. package/lib/core/model.d.ts +38 -7
  29. package/lib/core/normalize.d.ts +5 -1
  30. package/lib/core/normalize.js +6 -9
  31. package/lib/core/normalize.js.map +1 -1
  32. package/lib/core/parse.d.ts +1 -1
  33. package/lib/core/parse.js +3 -8
  34. package/lib/core/parse.js.map +1 -1
  35. package/lib/core/report.d.ts +6 -8
  36. package/lib/core/report.js +45 -11
  37. package/lib/core/report.js.map +1 -1
  38. package/lib/core/resolve.d.ts +6 -1
  39. package/lib/core/resolve.js +31 -12
  40. package/lib/core/resolve.js.map +1 -1
  41. package/lib/core/schema.d.ts +1 -1
  42. package/lib/core/schema.js +2 -6
  43. package/lib/core/schema.js.map +1 -1
  44. package/lib/core/serialize.d.ts +7 -0
  45. package/lib/core/serialize.js +27 -0
  46. package/lib/core/serialize.js.map +1 -0
  47. package/lib/services/adapters/org-client.d.ts +19 -0
  48. package/lib/services/adapters/org-client.js.map +1 -0
  49. package/lib/services/apply.d.ts +40 -0
  50. package/lib/services/apply.js +115 -0
  51. package/lib/services/apply.js.map +1 -0
  52. package/lib/services/check.d.ts +2 -1
  53. package/lib/services/check.js +1 -1
  54. package/lib/services/check.js.map +1 -1
  55. package/lib/services/export.d.ts +13 -0
  56. package/lib/services/export.js +25 -0
  57. package/lib/services/export.js.map +1 -0
  58. package/lib/services/plan.d.ts +35 -0
  59. package/lib/services/plan.js +70 -0
  60. package/lib/services/plan.js.map +1 -0
  61. package/lib/services/validate.d.ts +3 -2
  62. package/lib/services/validate.js +2 -2
  63. package/lib/services/validate.js.map +1 -1
  64. package/messages/ps.apply.md +81 -0
  65. package/messages/ps.export.md +25 -0
  66. package/messages/ps.plan.md +45 -0
  67. package/oclif.manifest.json +267 -1
  68. package/package.json +10 -7
  69. package/lib/services/org-client.d.ts +0 -11
  70. package/lib/services/org-client.js.map +0 -1
  71. /package/lib/services/{org-client.js → adapters/org-client.js} +0 -0
@@ -0,0 +1,45 @@
1
+ # summary
2
+
3
+ Preview the changes that would reconcile a target org to the assignment files.
4
+
5
+ # description
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.
8
+
9
+ # flags.file.summary
10
+
11
+ YAML file or glob to plan. Repeatable.
12
+
13
+ # flags.mode.summary
14
+
15
+ Which half of the reconcile to preview: additive adds only, destructive removes only, sync does both. Adds and removes are always shown either way.
16
+
17
+ # summary.counts
18
+
19
+ Plan: %s to add, %s to remove, %s unchanged.
20
+
21
+ # summary.next
22
+
23
+ Reviewed the plan? Apply it with the same files: sf ps apply --mode %s
24
+
25
+ # drift.note
26
+
27
+ %s change(s) the %s mode does not act on were surfaced as drift.
28
+
29
+ # error.invalid
30
+
31
+ The files do not resolve cleanly against the org. Fix the errors above, then re-run.
32
+
33
+ # examples
34
+
35
+ - Preview a full reconcile of the dev org:
36
+
37
+ <%= config.bin %> <%= command.id %> --file "permissions/*.yml" --target-org dev --mode sync
38
+
39
+ - Preview only the additions the default additive run would make:
40
+
41
+ <%= config.bin %> <%= command.id %> --file "permissions/*.yml" --target-org dev
42
+
43
+ - Preview a full reconcile of production before applying it:
44
+
45
+ <%= config.bin %> <%= command.id %> --file "permissions/*.yml" --target-org prod --mode sync
@@ -1,5 +1,112 @@
1
1
  {
2
2
  "commands": {
3
+ "ps:apply": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Load the files, resolve every user and target against the org, diff the desired state against what the org currently has, then add and/or remove assignments per the mode. Additions and removals run through the sObject Collections API with partial success, so one bad record does not roll back the rest. Deletions are capped by --max-deletes and confirmed before they run. Run validate and a --dry-run first.",
7
+ "examples": [
8
+ "Preview a full reconcile of the dev org without changing anything:\n<%= config.bin %> <%= command.id %> --file \"permissions/*.yml\" --target-org dev --mode sync --dry-run",
9
+ "Grant any missing assignments (additive, the default):\n<%= config.bin %> <%= command.id %> --file \"permissions/*.yml\" --target-org dev",
10
+ "Full reconcile of production in CI, without prompts:\n<%= config.bin %> <%= command.id %> --file \"permissions/*.yml\" --target-org prod --mode sync --no-prompt"
11
+ ],
12
+ "flags": {
13
+ "json": {
14
+ "description": "Format output as json.",
15
+ "helpGroup": "GLOBAL",
16
+ "name": "json",
17
+ "allowNo": false,
18
+ "type": "boolean"
19
+ },
20
+ "flags-dir": {
21
+ "helpGroup": "GLOBAL",
22
+ "name": "flags-dir",
23
+ "summary": "Import flag values from a directory.",
24
+ "hasDynamicHelp": false,
25
+ "multiple": false,
26
+ "type": "option"
27
+ },
28
+ "target-org": {
29
+ "char": "o",
30
+ "name": "target-org",
31
+ "noCacheDefault": true,
32
+ "required": true,
33
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
34
+ "hasDynamicHelp": true,
35
+ "multiple": false,
36
+ "type": "option"
37
+ },
38
+ "api-version": {
39
+ "description": "Override the api version used for api requests made by this command",
40
+ "name": "api-version",
41
+ "hasDynamicHelp": false,
42
+ "multiple": false,
43
+ "type": "option"
44
+ },
45
+ "file": {
46
+ "char": "f",
47
+ "name": "file",
48
+ "required": true,
49
+ "summary": "YAML file or glob to apply. Repeatable.",
50
+ "hasDynamicHelp": false,
51
+ "multiple": true,
52
+ "type": "option"
53
+ },
54
+ "mode": {
55
+ "name": "mode",
56
+ "summary": "Which half of the reconcile to run: additive adds only, destructive removes only, sync does both.",
57
+ "default": "additive",
58
+ "hasDynamicHelp": false,
59
+ "multiple": false,
60
+ "options": [
61
+ "additive",
62
+ "destructive",
63
+ "sync"
64
+ ],
65
+ "type": "option"
66
+ },
67
+ "max-deletes": {
68
+ "name": "max-deletes",
69
+ "summary": "Abort before any change if the run would remove more than this many assignments.",
70
+ "default": 50,
71
+ "hasDynamicHelp": false,
72
+ "multiple": false,
73
+ "type": "option"
74
+ },
75
+ "dry-run": {
76
+ "name": "dry-run",
77
+ "summary": "Resolve and diff, print the plan, and change nothing.",
78
+ "allowNo": false,
79
+ "type": "boolean"
80
+ },
81
+ "no-prompt": {
82
+ "name": "no-prompt",
83
+ "summary": "Skip the deletion confirmation prompt. Required to delete in JSON or other non-interactive runs.",
84
+ "allowNo": false,
85
+ "type": "boolean"
86
+ }
87
+ },
88
+ "hasDynamicHelp": true,
89
+ "hiddenAliases": [],
90
+ "id": "ps:apply",
91
+ "pluginAlias": "sf-plugin-permission-sets",
92
+ "pluginName": "sf-plugin-permission-sets",
93
+ "pluginType": "core",
94
+ "strict": true,
95
+ "summary": "Reconcile a target org to match the permission set assignment files.",
96
+ "enableJsonFlag": true,
97
+ "isESM": true,
98
+ "relativePath": [
99
+ "lib",
100
+ "commands",
101
+ "ps",
102
+ "apply.js"
103
+ ],
104
+ "aliasPermutations": [],
105
+ "permutations": [
106
+ "ps:apply",
107
+ "apply:ps"
108
+ ]
109
+ },
3
110
  "ps:check": {
4
111
  "aliases": [],
5
112
  "args": {},
@@ -62,6 +169,78 @@
62
169
  "check:ps"
63
170
  ]
64
171
  },
172
+ "ps:export": {
173
+ "aliases": [],
174
+ "args": {},
175
+ "description": "Query the target org for every assignable permission set, group, and license assignment held by active users and write them to a single user-keyed YAML file. The result is valid input for check, validate, plan, and apply, so it is a read-only way to bootstrap adoption from an org's current state. Profile-owned permission sets and inactive users are skipped.",
176
+ "examples": [
177
+ "Export the dev org's assignments to permissions.yml:\n<%= config.bin %> <%= command.id %> --target-org dev --output-file permissions.yml",
178
+ "Export a production org into an environment folder:\n<%= config.bin %> <%= command.id %> --target-org prod --output-file permissions/prod.yml"
179
+ ],
180
+ "flags": {
181
+ "json": {
182
+ "description": "Format output as json.",
183
+ "helpGroup": "GLOBAL",
184
+ "name": "json",
185
+ "allowNo": false,
186
+ "type": "boolean"
187
+ },
188
+ "flags-dir": {
189
+ "helpGroup": "GLOBAL",
190
+ "name": "flags-dir",
191
+ "summary": "Import flag values from a directory.",
192
+ "hasDynamicHelp": false,
193
+ "multiple": false,
194
+ "type": "option"
195
+ },
196
+ "target-org": {
197
+ "char": "o",
198
+ "name": "target-org",
199
+ "noCacheDefault": true,
200
+ "required": true,
201
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
202
+ "hasDynamicHelp": true,
203
+ "multiple": false,
204
+ "type": "option"
205
+ },
206
+ "api-version": {
207
+ "description": "Override the api version used for api requests made by this command",
208
+ "name": "api-version",
209
+ "hasDynamicHelp": false,
210
+ "multiple": false,
211
+ "type": "option"
212
+ },
213
+ "output-file": {
214
+ "name": "output-file",
215
+ "required": true,
216
+ "summary": "Path of the YAML file to write. Created (and its parent directories) if missing, overwritten if present.",
217
+ "hasDynamicHelp": false,
218
+ "multiple": false,
219
+ "type": "option"
220
+ }
221
+ },
222
+ "hasDynamicHelp": true,
223
+ "hiddenAliases": [],
224
+ "id": "ps:export",
225
+ "pluginAlias": "sf-plugin-permission-sets",
226
+ "pluginName": "sf-plugin-permission-sets",
227
+ "pluginType": "core",
228
+ "strict": true,
229
+ "summary": "Generate a YAML file from the current org's permission set assignments.",
230
+ "enableJsonFlag": true,
231
+ "isESM": true,
232
+ "relativePath": [
233
+ "lib",
234
+ "commands",
235
+ "ps",
236
+ "export.js"
237
+ ],
238
+ "aliasPermutations": [],
239
+ "permutations": [
240
+ "ps:export",
241
+ "export:ps"
242
+ ]
243
+ },
65
244
  "ps:info": {
66
245
  "aliases": [],
67
246
  "args": {},
@@ -108,6 +287,93 @@
108
287
  "info:ps"
109
288
  ]
110
289
  },
290
+ "ps:plan": {
291
+ "aliases": [],
292
+ "args": {},
293
+ "description": "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.",
294
+ "examples": [
295
+ "Preview a full reconcile of the dev org:\n<%= config.bin %> <%= command.id %> --file \"permissions/*.yml\" --target-org dev --mode sync",
296
+ "Preview only the additions the default additive run would make:\n<%= config.bin %> <%= command.id %> --file \"permissions/*.yml\" --target-org dev",
297
+ "Preview a full reconcile of production before applying it:\n<%= config.bin %> <%= command.id %> --file \"permissions/*.yml\" --target-org prod --mode sync"
298
+ ],
299
+ "flags": {
300
+ "json": {
301
+ "description": "Format output as json.",
302
+ "helpGroup": "GLOBAL",
303
+ "name": "json",
304
+ "allowNo": false,
305
+ "type": "boolean"
306
+ },
307
+ "flags-dir": {
308
+ "helpGroup": "GLOBAL",
309
+ "name": "flags-dir",
310
+ "summary": "Import flag values from a directory.",
311
+ "hasDynamicHelp": false,
312
+ "multiple": false,
313
+ "type": "option"
314
+ },
315
+ "target-org": {
316
+ "char": "o",
317
+ "name": "target-org",
318
+ "noCacheDefault": true,
319
+ "required": true,
320
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
321
+ "hasDynamicHelp": true,
322
+ "multiple": false,
323
+ "type": "option"
324
+ },
325
+ "api-version": {
326
+ "description": "Override the api version used for api requests made by this command",
327
+ "name": "api-version",
328
+ "hasDynamicHelp": false,
329
+ "multiple": false,
330
+ "type": "option"
331
+ },
332
+ "file": {
333
+ "char": "f",
334
+ "name": "file",
335
+ "required": true,
336
+ "summary": "YAML file or glob to plan. Repeatable.",
337
+ "hasDynamicHelp": false,
338
+ "multiple": true,
339
+ "type": "option"
340
+ },
341
+ "mode": {
342
+ "name": "mode",
343
+ "summary": "Which half of the reconcile to preview: additive adds only, destructive removes only, sync does both. Adds and removes are always shown either way.",
344
+ "default": "additive",
345
+ "hasDynamicHelp": false,
346
+ "multiple": false,
347
+ "options": [
348
+ "additive",
349
+ "destructive",
350
+ "sync"
351
+ ],
352
+ "type": "option"
353
+ }
354
+ },
355
+ "hasDynamicHelp": true,
356
+ "hiddenAliases": [],
357
+ "id": "ps:plan",
358
+ "pluginAlias": "sf-plugin-permission-sets",
359
+ "pluginName": "sf-plugin-permission-sets",
360
+ "pluginType": "core",
361
+ "strict": true,
362
+ "summary": "Preview the changes that would reconcile a target org to the assignment files.",
363
+ "enableJsonFlag": true,
364
+ "isESM": true,
365
+ "relativePath": [
366
+ "lib",
367
+ "commands",
368
+ "ps",
369
+ "plan.js"
370
+ ],
371
+ "aliasPermutations": [],
372
+ "permutations": [
373
+ "ps:plan",
374
+ "plan:ps"
375
+ ]
376
+ },
111
377
  "ps:validate": {
112
378
  "aliases": [],
113
379
  "args": {},
@@ -182,5 +448,5 @@
182
448
  ]
183
449
  }
184
450
  },
185
- "version": "0.0.0-dev.19"
451
+ "version": "0.0.0-dev.21"
186
452
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sf-plugin-permission-sets",
3
- "description": "Declarative permission set assignment management for Salesforce. Under active development, with breaking changes possible until v1.0.0.",
3
+ "description": "Declarative, GitOps-style management of permission set assignments for Salesforce orgs.",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zaclummys/sf-plugin-permission-sets.git"
@@ -32,13 +32,16 @@
32
32
  "/oclif.lock"
33
33
  ],
34
34
  "keywords": [
35
- "force",
36
35
  "salesforce",
37
- "salesforcedx",
38
- "sf",
39
36
  "sf-plugin",
40
- "sfdx",
41
- "sfdx-plugin"
37
+ "sfdx-plugin",
38
+ "permission-sets",
39
+ "permission-set-assignment",
40
+ "permission-set-group",
41
+ "access-management",
42
+ "user-provisioning",
43
+ "gitops",
44
+ "declarative"
42
45
  ],
43
46
  "license": "BSD-3-Clause",
44
47
  "oclif": {
@@ -133,5 +136,5 @@
133
136
  "exports": "./lib/index.js",
134
137
  "type": "module",
135
138
  "author": "Isaac Ferreira",
136
- "version": "0.0.0-dev.19"
139
+ "version": "0.0.0-dev.21"
137
140
  }
@@ -1,11 +0,0 @@
1
- import { Kind, OrgUser } from '../core/model.js';
2
- /**
3
- * Port: the org lookups a service needs, in domain terms. Declared here, by the
4
- * consumer, so services depend on the abstraction and the adapter implements it.
5
- */
6
- export interface OrgClient {
7
- /** The users that exist in the org, among the given usernames. */
8
- findUsers(usernames: string[]): Promise<OrgUser[]>;
9
- /** The identifiers that exist in the org, among the given targets of one kind. */
10
- findTargets(kind: Kind, names: string[]): Promise<string[]>;
11
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"org-client.js","sourceRoot":"","sources":["../../src/services/org-client.ts"],"names":[],"mappings":""}