sf-plugin-permission-sets 0.0.0-dev.55 → 0.0.0-dev.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -29
- package/lib/commands/ps/apply.d.ts +1 -15
- package/lib/commands/ps/apply.d.ts.map +1 -1
- package/lib/commands/ps/apply.js +4 -75
- package/lib/commands/ps/apply.js.map +1 -1
- package/lib/commands/ps/plan.d.ts +0 -6
- package/lib/commands/ps/plan.d.ts.map +1 -1
- package/lib/commands/ps/plan.js +2 -36
- package/lib/commands/ps/plan.js.map +1 -1
- package/lib/core/index.d.ts +0 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +0 -1
- package/lib/core/index.js.map +1 -1
- package/lib/services/apply.d.ts +1 -12
- package/lib/services/apply.d.ts.map +1 -1
- package/lib/services/apply.js +0 -26
- package/lib/services/apply.js.map +1 -1
- package/lib/services/index.d.ts +0 -1
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +0 -1
- package/lib/services/index.js.map +1 -1
- package/lib/services/plan.d.ts +0 -3
- package/lib/services/plan.d.ts.map +1 -1
- package/lib/services/plan.js +1 -7
- package/lib/services/plan.js.map +1 -1
- package/messages/ps.apply.md +2 -34
- package/messages/ps.plan.md +0 -8
- package/package.json +1 -1
- package/lib/core/plan-file.d.ts +0 -61
- package/lib/core/plan-file.d.ts.map +0 -1
- package/lib/core/plan-file.js +0 -74
- package/lib/core/plan-file.js.map +0 -1
package/README.md
CHANGED
|
@@ -250,19 +250,15 @@ group, and license referenced actually exists and resolves uniquely.
|
|
|
250
250
|
|
|
251
251
|
```
|
|
252
252
|
USAGE
|
|
253
|
-
$ sf ps plan -o <org> -f <glob>... [--mode <value>] [--show-unchanged]
|
|
254
|
-
[--out <file>] [--json]
|
|
253
|
+
$ sf ps plan -o <org> -f <glob>... [--mode <value>] [--show-unchanged] [--json]
|
|
255
254
|
|
|
256
255
|
FLAGS
|
|
257
256
|
-o, --target-org=<org> (required)
|
|
258
257
|
-f, --file=<glob>... (required) YAML file(s) to read. Repeatable, globs expanded by the plugin.
|
|
259
258
|
--mode=<value> additive | destructive | sync [default: additive]
|
|
260
259
|
--show-unchanged List assignments that already match, instead of only counting them.
|
|
261
|
-
--out=<file> Write the computed change set to a plan file that `apply` can run verbatim.
|
|
262
260
|
```
|
|
263
261
|
|
|
264
|
-
With `--out` the plan is also saved to a file: the resolved change set (adds, updates, removes with their record ids), the mode it was computed for, and the org it targets. Feed that file to `apply --plan` to execute exactly what you reviewed, with no recomputation. See [Saved plans](#saved-plans).
|
|
265
|
-
|
|
266
262
|
The body shows only what the mode will do, and unchanged assignments are summarized as a count (pass `--show-unchanged` to list them). The default `additive` run previews only what it grants, and reports the undeclared assignment it won't remove as drift:
|
|
267
263
|
|
|
268
264
|
```text
|
|
@@ -311,13 +307,12 @@ Next: sf ps apply -o prod -f "permissions/*.yml" --mode sync
|
|
|
311
307
|
|
|
312
308
|
```
|
|
313
309
|
USAGE
|
|
314
|
-
$ sf ps apply -o <org>
|
|
310
|
+
$ sf ps apply -o <org> -f <glob>... [--mode <value>]
|
|
315
311
|
[--max-deletes <n>] [--dry-run] [--show-unchanged] [--no-prompt] [--json]
|
|
316
312
|
|
|
317
313
|
FLAGS
|
|
318
314
|
-o, --target-org=<org> (required)
|
|
319
|
-
-f, --file=<glob>... YAML file(s) to read. Repeatable, globs expanded by the plugin.
|
|
320
|
-
--plan=<file> Apply a saved plan file from `plan --out` instead of re-reading YAML.
|
|
315
|
+
-f, --file=<glob>... (required) YAML file(s) to read. Repeatable, globs expanded by the plugin.
|
|
321
316
|
--mode=<value> additive | destructive | sync [default: additive]
|
|
322
317
|
--max-deletes=<n> Abort if a run would remove more than n assignments. [default: 50]
|
|
323
318
|
--dry-run Resolve and diff, print what would happen, change nothing.
|
|
@@ -325,28 +320,10 @@ FLAGS
|
|
|
325
320
|
--no-prompt Skip the deletion confirmation prompt (for CI).
|
|
326
321
|
```
|
|
327
322
|
|
|
328
|
-
|
|
323
|
+
`apply` recomputes from the files every run: it re-reads the YAML, re-resolves every reference to an org id, and re-diffs against live state, then acts per `--mode`. Run `plan` shortly before `apply` so the preview you review reflects what `apply` will do (an edited file, a renamed permission set, or another admin's change between the two shifts the outcome).
|
|
329
324
|
|
|
330
325
|
Deletions always prompt for confirmation unless `--no-prompt` is set, and are hard-capped by `--max-deletes` so a bad merge can't unassign your whole org. DML is executed with the sObject Collections API and reports partial successes/failures per record.
|
|
331
326
|
|
|
332
|
-
#### Saved plans
|
|
333
|
-
|
|
334
|
-
`plan --out` and `apply --plan` split review from execution, so what you approve is exactly what runs:
|
|
335
|
-
|
|
336
|
-
```bash
|
|
337
|
-
sf ps plan -o prod -f "permissions/*.yml" --mode sync --out prod.plan
|
|
338
|
-
# ... review prod.plan, get sign-off ...
|
|
339
|
-
sf ps apply -o prod --plan prod.plan
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
Without a saved plan, `apply` recomputes from the files: it re-reads the YAML, re-resolves every reference to an org id, and re-diffs against live state. Anything that changed since you ran `plan` (an edited file, a renamed permission set, another admin's assignment) silently changes what `apply` does. A saved plan freezes the resolved change set, so `apply --plan` executes those exact records with no recomputation.
|
|
343
|
-
|
|
344
|
-
Guardrails:
|
|
345
|
-
|
|
346
|
-
- `apply --plan` refuses a plan built for a different org (the plan records the org id).
|
|
347
|
-
- It refuses a plan file it cannot parse or whose format version it does not recognize.
|
|
348
|
-
- The plan is executed as recorded. If the org drifted after the plan was written, individual records may fail (a removed target, an already-deleted assignment); those surface as per-record failures in the outcome report rather than aborting the run. Re-run `plan` to get a fresh plan when in doubt.
|
|
349
|
-
|
|
350
327
|
### `sf ps export`
|
|
351
328
|
|
|
352
329
|
Read-only. Snapshots the org's current assignments as YAML you can commit and then feed back into the other commands. Writes to a file with `--output-file`, or to stdout when that flag is omitted.
|
|
@@ -519,9 +496,8 @@ The plugin is layered so every command reuses the same core. Commands stay thin,
|
|
|
519
496
|
| `diff` | The desired model vs. the org's current state, producing adds, removes, and unchanged. |
|
|
520
497
|
| `mode` | Scope a diff to what a reconcile mode acts on, plus the drift it leaves alone. |
|
|
521
498
|
| `report` | Format a diff as a plan. |
|
|
522
|
-
| `plan-file` | Serialize and parse a saved plan: the frozen change set `apply --plan` runs. |
|
|
523
499
|
|
|
524
|
-
Commands are slices of one pipeline. `check` runs the **load** stage only, with no org. `validate` adds **resolve**: it looks the declared references up through the `OrgClient` port (the adapter builds the SOQL) and evaluates the org's answers with resolve's pure rules. `export` runs in the opposite direction: it **fetch**es the org's current assignments through the port and **serialize**s them straight back to YAML, skipping load entirely. `apply` is the full pipeline: load, resolve to ids, **fetch** current state, **diff**, then insert and delete through the Collections API per the mode (guarded by `--max-deletes` and a confirmation). `plan` is that same pipeline stopping before the DML: load, resolve to ids, **fetch** current state, **diff**, and report, the same preview `apply --dry-run` produces.
|
|
500
|
+
Commands are slices of one pipeline. `check` runs the **load** stage only, with no org. `validate` adds **resolve**: it looks the declared references up through the `OrgClient` port (the adapter builds the SOQL) and evaluates the org's answers with resolve's pure rules. `export` runs in the opposite direction: it **fetch**es the org's current assignments through the port and **serialize**s them straight back to YAML, skipping load entirely. `apply` is the full pipeline: load, resolve to ids, **fetch** current state, **diff**, then insert and delete through the Collections API per the mode (guarded by `--max-deletes` and a confirmation). `plan` is that same pipeline stopping before the DML: load, resolve to ids, **fetch** current state, **diff**, and report, the same preview `apply --dry-run` produces.
|
|
525
501
|
|
|
526
502
|
## License
|
|
527
503
|
|
|
@@ -15,8 +15,7 @@ export default class Apply extends SfCommand<PsApplyResult> {
|
|
|
15
15
|
static readonly examples: string[];
|
|
16
16
|
static readonly flags: {
|
|
17
17
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
-
file: import("@oclif/core/interfaces").OptionFlag<string[]
|
|
19
|
-
plan: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
20
19
|
mode: import("@oclif/core/interfaces").OptionFlag<"additive" | "destructive" | "sync", import("@oclif/core/interfaces").CustomOptions>;
|
|
21
20
|
'max-deletes': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
21
|
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -24,12 +23,6 @@ export default class Apply extends SfCommand<PsApplyResult> {
|
|
|
24
23
|
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
25
24
|
};
|
|
26
25
|
run(): Promise<PsApplyResult>;
|
|
27
|
-
/** Enforce exactly one source (--file or --plan), and that --mode is not paired with a plan. */
|
|
28
|
-
private validateSource;
|
|
29
|
-
private runFromFiles;
|
|
30
|
-
private runFromPlan;
|
|
31
|
-
/** Read and validate the plan file, erroring out (never returning) if it cannot be used. */
|
|
32
|
-
private readPlan;
|
|
33
26
|
/** Log findings, print the diff body, and report the outcome. Shared by both sources. */
|
|
34
27
|
private report;
|
|
35
28
|
/** Report the outcome of a completed (non-invalid) apply, setting the exit code as needed. */
|
|
@@ -41,13 +34,6 @@ export default class Apply extends SfCommand<PsApplyResult> {
|
|
|
41
34
|
private logFailureLine;
|
|
42
35
|
private logDriftNote;
|
|
43
36
|
private confirmDelete;
|
|
44
|
-
private logApplyingPlan;
|
|
45
|
-
private errorSourceConflict;
|
|
46
|
-
private errorSourceMissing;
|
|
47
|
-
private errorModeWithPlan;
|
|
48
|
-
private errorPlanRead;
|
|
49
|
-
private errorPlanInvalid;
|
|
50
|
-
private errorPlanOrg;
|
|
51
37
|
private errorInvalid;
|
|
52
38
|
private errorMaxDeletes;
|
|
53
39
|
private errorFailed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/apply.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,6BAA6B,CAAC;AAU/D,MAAM,MAAM,aAAa,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CACpB,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;;;;;;;;MA2B1B;IAEW,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;IAoB1C,yFAAyF;IACzF,OAAO,CAAC,MAAM;IA2Cd,8FAA8F;IAC9F,OAAO,CAAC,aAAa;IAqCrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,WAAW;CAGtB"}
|
package/lib/commands/ps/apply.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
1
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
3
2
|
import { Messages } from '@salesforce/core';
|
|
4
3
|
import { ConnectionOrgClient } from '../../adapters/index.js';
|
|
5
4
|
import { ApplyService } from '../../services/index.js';
|
|
6
|
-
import { formatDiff, formatFindings
|
|
5
|
+
import { formatDiff, formatFindings } from '../../core/index.js';
|
|
7
6
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
8
7
|
const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.apply');
|
|
9
8
|
export default class Apply extends SfCommand {
|
|
@@ -15,11 +14,9 @@ export default class Apply extends SfCommand {
|
|
|
15
14
|
file: Flags.string({
|
|
16
15
|
char: 'f',
|
|
17
16
|
summary: messages.getMessage('flags.file.summary'),
|
|
17
|
+
required: true,
|
|
18
18
|
multiple: true,
|
|
19
19
|
}),
|
|
20
|
-
plan: Flags.string({
|
|
21
|
-
summary: messages.getMessage('flags.plan.summary'),
|
|
22
|
-
}),
|
|
23
20
|
mode: Flags.option({
|
|
24
21
|
summary: messages.getMessage('flags.mode.summary'),
|
|
25
22
|
options: ['additive', 'destructive', 'sync'],
|
|
@@ -42,7 +39,6 @@ export default class Apply extends SfCommand {
|
|
|
42
39
|
};
|
|
43
40
|
async run() {
|
|
44
41
|
const { flags } = await this.parse(Apply);
|
|
45
|
-
this.validateSource(flags);
|
|
46
42
|
const targetOrg = flags['target-org'];
|
|
47
43
|
const connection = targetOrg.getConnection();
|
|
48
44
|
const orgClient = new ConnectionOrgClient(connection);
|
|
@@ -54,52 +50,12 @@ export default class Apply extends SfCommand {
|
|
|
54
50
|
return this.confirmDelete(count);
|
|
55
51
|
};
|
|
56
52
|
const service = new ApplyService(orgClient, confirmDeletions);
|
|
57
|
-
const
|
|
58
|
-
? await this.runFromPlan(service, flags, targetOrg)
|
|
59
|
-
: await this.runFromFiles(service, flags);
|
|
60
|
-
return this.report(outcome.result, outcome.mode, flags['max-deletes'], flags['show-unchanged']);
|
|
61
|
-
}
|
|
62
|
-
/** Enforce exactly one source (--file or --plan), and that --mode is not paired with a plan. */
|
|
63
|
-
validateSource(flags) {
|
|
64
|
-
const hasFile = !!flags.file;
|
|
65
|
-
const hasPlan = !!flags.plan;
|
|
66
|
-
if (hasFile && hasPlan)
|
|
67
|
-
this.errorSourceConflict();
|
|
68
|
-
if (!hasFile && !hasPlan)
|
|
69
|
-
this.errorSourceMissing();
|
|
70
|
-
const modeProvided = this.argv.some((arg) => arg === '--mode' || arg.startsWith('--mode='));
|
|
71
|
-
if (hasPlan && modeProvided)
|
|
72
|
-
this.errorModeWithPlan();
|
|
73
|
-
}
|
|
74
|
-
async runFromFiles(service, flags) {
|
|
75
|
-
const result = await service.run(flags.file ?? [], {
|
|
53
|
+
const result = await service.run(flags.file, {
|
|
76
54
|
mode: flags.mode,
|
|
77
55
|
maxDeletes: flags['max-deletes'],
|
|
78
56
|
dryRun: flags['dry-run'],
|
|
79
57
|
});
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
async runFromPlan(service, flags, targetOrg) {
|
|
83
|
-
const plan = await this.readPlan(flags.plan ?? '');
|
|
84
|
-
const orgId = targetOrg.getOrgId();
|
|
85
|
-
if (plan.org !== orgId)
|
|
86
|
-
this.errorPlanOrg(plan.org, orgId);
|
|
87
|
-
this.logApplyingPlan(plan.mode);
|
|
88
|
-
const result = await service.runPlan(plan, {
|
|
89
|
-
maxDeletes: flags['max-deletes'],
|
|
90
|
-
dryRun: flags['dry-run'],
|
|
91
|
-
});
|
|
92
|
-
return { result, mode: plan.mode };
|
|
93
|
-
}
|
|
94
|
-
/** Read and validate the plan file, erroring out (never returning) if it cannot be used. */
|
|
95
|
-
async readPlan(planFile) {
|
|
96
|
-
const text = await readFile(planFile, 'utf8').catch(() => undefined);
|
|
97
|
-
if (text == null)
|
|
98
|
-
this.errorPlanRead(planFile);
|
|
99
|
-
const parsed = parsePlan(text);
|
|
100
|
-
if (!parsed.plan)
|
|
101
|
-
this.errorPlanInvalid(planFile, parsed.error ?? 'unknown');
|
|
102
|
-
return parsed.plan;
|
|
58
|
+
return this.report(result, flags.mode, flags['max-deletes'], flags['show-unchanged']);
|
|
103
59
|
}
|
|
104
60
|
/** Log findings, print the diff body, and report the outcome. Shared by both sources. */
|
|
105
61
|
report(result, mode, maxDeletes, showUnchanged) {
|
|
@@ -206,33 +162,6 @@ export default class Apply extends SfCommand {
|
|
|
206
162
|
confirmDelete(count) {
|
|
207
163
|
return this.confirm({ message: messages.getMessage('confirm.delete', [count]) });
|
|
208
164
|
}
|
|
209
|
-
logApplyingPlan(mode) {
|
|
210
|
-
this.log(messages.getMessage('info.applyingPlan', [mode]));
|
|
211
|
-
}
|
|
212
|
-
errorSourceConflict() {
|
|
213
|
-
this.error(messages.getMessage('error.sourceConflict'), { exit: 1 });
|
|
214
|
-
}
|
|
215
|
-
errorSourceMissing() {
|
|
216
|
-
this.error(messages.getMessage('error.sourceMissing'), { exit: 1 });
|
|
217
|
-
}
|
|
218
|
-
errorModeWithPlan() {
|
|
219
|
-
this.error(messages.getMessage('error.modeWithPlan'), { exit: 1 });
|
|
220
|
-
}
|
|
221
|
-
errorPlanRead(planFile) {
|
|
222
|
-
this.error(messages.getMessage('error.planRead', [planFile]), { exit: 1 });
|
|
223
|
-
}
|
|
224
|
-
errorPlanInvalid(planFile, detail) {
|
|
225
|
-
this.error(messages.getMessage('error.planInvalid', [
|
|
226
|
-
planFile,
|
|
227
|
-
detail,
|
|
228
|
-
]), { exit: 1 });
|
|
229
|
-
}
|
|
230
|
-
errorPlanOrg(planOrg, targetOrg) {
|
|
231
|
-
this.error(messages.getMessage('error.planOrg', [
|
|
232
|
-
planOrg,
|
|
233
|
-
targetOrg,
|
|
234
|
-
]), { exit: 1 });
|
|
235
|
-
}
|
|
236
165
|
errorInvalid() {
|
|
237
166
|
this.error(messages.getMessage('error.invalid'), { exit: 1 });
|
|
238
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/ps/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/ps/apply.ts"],"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AAE,CAAC,CAAC;IACrF,CAAC;IAEO,YAAY;QAChB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IAEO,eAAe,CAAC,WAAmB,EAAE,UAAkB;QAC3D,IAAI,CAAC,KAAK,CACN,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE;YACpC,WAAW;YACX,UAAU;SACb,CAAC,EACF,EAAE,IAAI,EAAE,CAAC,EAAE,CACd,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"}
|
|
@@ -26,8 +26,6 @@ export type PsPlanResult = {
|
|
|
26
26
|
toRemove: ActualAssignment[];
|
|
27
27
|
unchanged: ActualAssignment[];
|
|
28
28
|
};
|
|
29
|
-
/** The plan file written, when --out was given. */
|
|
30
|
-
outFile?: string;
|
|
31
29
|
};
|
|
32
30
|
export default class Plan extends SfCommand<PsPlanResult> {
|
|
33
31
|
static readonly summary: string;
|
|
@@ -38,12 +36,8 @@ export default class Plan extends SfCommand<PsPlanResult> {
|
|
|
38
36
|
file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
39
37
|
mode: import("@oclif/core/interfaces").OptionFlag<"additive" | "destructive" | "sync", import("@oclif/core/interfaces").CustomOptions>;
|
|
40
38
|
'show-unchanged': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
41
|
-
out: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
39
|
};
|
|
43
40
|
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
41
|
/** Render the human-readable plan body once the run is known to be valid. */
|
|
48
42
|
private logPlan;
|
|
49
43
|
/** The assignments the chosen mode would actually act on. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/ps/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,6BAA6B,CAAC;AAK/D,OAAO,EAGH,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAGpB,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;CACL,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;;;;;MAgB1B;IAEW,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC;IA6DzC,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"}
|
package/lib/commands/ps/plan.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { writeFile, mkdir } from 'node:fs/promises';
|
|
2
|
-
import { dirname } from 'node:path';
|
|
3
1
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
4
2
|
import { Messages } from '@salesforce/core';
|
|
5
3
|
import { ConnectionOrgClient } from '../../adapters/index.js';
|
|
6
|
-
import { PlanService
|
|
7
|
-
import { formatDiff, formatFindings,
|
|
4
|
+
import { PlanService } from '../../services/index.js';
|
|
5
|
+
import { formatDiff, formatFindings, } from '../../core/index.js';
|
|
8
6
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
9
7
|
const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.plan');
|
|
10
8
|
export default class Plan extends SfCommand {
|
|
@@ -27,9 +25,6 @@ export default class Plan extends SfCommand {
|
|
|
27
25
|
'show-unchanged': Flags.boolean({
|
|
28
26
|
summary: messages.getMessage('flags.show-unchanged.summary'),
|
|
29
27
|
}),
|
|
30
|
-
out: Flags.string({
|
|
31
|
-
summary: messages.getMessage('flags.out.summary'),
|
|
32
|
-
}),
|
|
33
28
|
};
|
|
34
29
|
async run() {
|
|
35
30
|
const { flags } = await this.parse(Plan);
|
|
@@ -82,37 +77,8 @@ export default class Plan extends SfCommand {
|
|
|
82
77
|
actionable,
|
|
83
78
|
usersAffected,
|
|
84
79
|
});
|
|
85
|
-
if (flags.out) {
|
|
86
|
-
await this.writePlanFile(flags.out, { diff, mode, orgId, resolution: result.resolution });
|
|
87
|
-
summary.outFile = flags.out;
|
|
88
|
-
}
|
|
89
80
|
return summary;
|
|
90
81
|
}
|
|
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
82
|
/** Render the human-readable plan body once the run is known to be valid. */
|
|
117
83
|
logPlan(args) {
|
|
118
84
|
const { diff, mode, orgName, orgId, files, showUnchanged, actionable, usersAffected } = args;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/commands/ps/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/commands/ps/plan.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,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACH,UAAU,EACV,cAAc,GAMjB,MAAM,qBAAqB,CAAC;AAE7B,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,2BAA2B,EAAE,SAAS,CAAC,CAAC;AAiB/E,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAuB;IAC9C,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,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC3B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACf,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;YAClD,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,IAAI,EAAE,KAAK,C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AC,KAAa;QACrC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,yBAAyB,CAAC,KAAa;QAC3C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,yBAAyB,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC"}
|
package/lib/core/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { loadFiles } from './load.js';
|
|
|
4
4
|
export { ActualAssignment, AssignmentFilter, AssignmentOutcome, AssignmentUpdate, DesiredAssignment, Diff, Kind, OrgTarget, OrgUser, ReconcileMode, ResolvedAddition, TargetRef, } from './model.js';
|
|
5
5
|
export { scopeToMode, ScopedChange } from './mode.js';
|
|
6
6
|
export { kindForScopeKey } from './normalize.js';
|
|
7
|
-
export { savedPlanVersion, SavedPlan, serializePlan, parsePlan } from './plan-file.js';
|
|
8
7
|
export { formatDiff } from './report.js';
|
|
9
8
|
export { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, indexUsersById, indexTargetsById, } from './resolve.js';
|
|
10
9
|
export { serializeAssignments } from './serialize.js';
|
package/lib/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/lib/core/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export { formatFindings, countFindings } from './finding.js';
|
|
|
3
3
|
export { loadFiles } from './load.js';
|
|
4
4
|
export { scopeToMode } from './mode.js';
|
|
5
5
|
export { kindForScopeKey } from './normalize.js';
|
|
6
|
-
export { savedPlanVersion, serializePlan, parsePlan } from './plan-file.js';
|
|
7
6
|
export { formatDiff } from './report.js';
|
|
8
7
|
export { kinds, distinctAssignees, distinctTargets, evaluateUsers, evaluateTargets, indexUsersById, indexTargetsById, } from './resolve.js';
|
|
9
8
|
export { serializeAssignments } from './serialize.js';
|
package/lib/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAW,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAetC,OAAO,EAAE,WAAW,EAAgB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAW,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAetC,OAAO,EAAE,WAAW,EAAgB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/lib/services/apply.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssignmentOutcome, Diff,
|
|
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,11 +8,6 @@ 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 = {
|
|
@@ -39,12 +34,6 @@ export declare class ApplyService {
|
|
|
39
34
|
private readonly confirmDeletions;
|
|
40
35
|
constructor(org: OrgClient, confirmDeletions: ConfirmDeletions);
|
|
41
36
|
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
37
|
private executeResolved;
|
|
49
38
|
}
|
|
50
39
|
//# 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,
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EAEjB,IAAI,EAEJ,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,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,sBAAsB,GAAG,SAAS,CAAC;AAElG,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,+DAA+D;IAC/D,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAiBF;;;;GAIG;AACH,qBAAa,YAAY;IAEjB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,GAAG,EAAE,SAAS,EACd,gBAAgB,EAAE,gBAAgB;IAG1C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;YAqD5D,eAAe;CAiBhC"}
|
package/lib/services/apply.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { loadFiles, diffAssignments, scopeToMode, countFindings, } from '../core/index.js';
|
|
2
2
|
import { ResolutionService, managedTargets, resolveAdditions } from './resolution.js';
|
|
3
|
-
const noDrift = { adds: 0, updates: 0, removes: 0 };
|
|
4
3
|
const emptyDiff = { toAdd: [], toUpdate: [], toRemove: [], unchanged: [] };
|
|
5
4
|
/** An aborted-before-any-change result, carrying the findings that explain why. */
|
|
6
5
|
function invalidResult(files, findings) {
|
|
@@ -70,31 +69,6 @@ export class ApplyService {
|
|
|
70
69
|
const failed = outcomes.some((outcome) => !outcome.success);
|
|
71
70
|
return { files: loaded.files, findings, diff, drift, outcomes, status: 'applied', failed };
|
|
72
71
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Apply a saved plan verbatim: no load, resolve, or diff. The plan is already
|
|
75
|
-
* mode-scoped and resolved, so there is no drift and no findings. maxDeletes and
|
|
76
|
-
* the deletion confirmation still guard the run.
|
|
77
|
-
*/
|
|
78
|
-
async runPlan(plan, input) {
|
|
79
|
-
const diff = { toAdd: plan.add, toUpdate: plan.update, toRemove: plan.remove, unchanged: [] };
|
|
80
|
-
const { maxDeletes, dryRun } = input;
|
|
81
|
-
const base = { files: [], findings: [], diff, drift: noDrift, outcomes: [] };
|
|
82
|
-
if (plan.remove.length > maxDeletes) {
|
|
83
|
-
return { ...base, status: 'max-deletes-exceeded', failed: true };
|
|
84
|
-
}
|
|
85
|
-
if (dryRun) {
|
|
86
|
-
return { ...base, status: 'dry-run', failed: false };
|
|
87
|
-
}
|
|
88
|
-
if (plan.remove.length > 0) {
|
|
89
|
-
const confirmed = await this.confirmDeletions(plan.remove.length);
|
|
90
|
-
if (!confirmed) {
|
|
91
|
-
return { ...base, status: 'declined', failed: false };
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const outcomes = await this.executeResolved(plan.add, plan.update, plan.remove);
|
|
95
|
-
const failed = outcomes.some((outcome) => !outcome.success);
|
|
96
|
-
return { ...base, outcomes, status: 'applied', failed };
|
|
97
|
-
}
|
|
98
72
|
async executeResolved(additions, updates, removals) {
|
|
99
73
|
const [added, updated, removed] = await Promise.all([
|
|
100
74
|
additions.length > 0 ? this.org.addAssignments(additions) : Promise.resolve([]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/services/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,eAAe,EACf,WAAW,EAOX,aAAa,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA2BtF,MAAM,SAAS,GAAS,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAEjF,mFAAmF;AACnF,SAAS,aAAa,CAAC,KAAe,EAAE,QAAmB;IACvD,OAAO;QACH,KAAK;QACL,QAAQ;QACR,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;QAC1C,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,IAAI;KACf,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAEA;IACA;IAFrB,YACqB,GAAc,EACd,gBAAkC;QADlC,QAAG,GAAH,GAAG,CAAW;QACd,qBAAgB,GAAhB,gBAAgB,CAAkB;IACpD,CAAC;IAEG,KAAK,CAAC,GAAG,CAAC,KAAe,EAAE,KAAiB;QAC/C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,UAAU,CAAC,MAAM,GAAG,CAA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,CAAsB,EAAE,CAAC;YACpG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAsB,EAAE,CAAC;YACnG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAsB,EAAE,CAAC;SACxG,CAAC,CAAC;QAEH,OAAO;YACH,GAAG,KAAK;YACR,GAAG,OAAO;YACV,GAAG,OAAO;SACb,CAAC;IACN,CAAC;CACJ"}
|
package/lib/services/index.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ export { ApplyService, ConfirmDeletions, ApplyResult } from './apply.js';
|
|
|
2
2
|
export { CheckService } from './check.js';
|
|
3
3
|
export { ExportService } from './export.js';
|
|
4
4
|
export { PlanService } from './plan.js';
|
|
5
|
-
export { Resolution, resolveAdditions } from './resolution.js';
|
|
6
5
|
export { ValidateService } from './validate.js';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/services/index.js
CHANGED
|
@@ -2,6 +2,5 @@ export { ApplyService } from './apply.js';
|
|
|
2
2
|
export { CheckService } from './check.js';
|
|
3
3
|
export { ExportService } from './export.js';
|
|
4
4
|
export { PlanService } from './plan.js';
|
|
5
|
-
export { resolveAdditions } from './resolution.js';
|
|
6
5
|
export { ValidateService } from './validate.js';
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/services/plan.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Diff, Finding } from '../core/index.js';
|
|
2
2
|
import { OrgClient } from './adapters/index.js';
|
|
3
|
-
import { Resolution } from './resolution.js';
|
|
4
3
|
export type PlanMode = 'additive' | 'destructive' | 'sync';
|
|
5
4
|
/** How a run ended, so the command can report and set the exit code. */
|
|
6
5
|
export type PlanStatus = 'planned' | 'invalid';
|
|
@@ -14,8 +13,6 @@ export type PlanResult = {
|
|
|
14
13
|
updates: number;
|
|
15
14
|
removes: number;
|
|
16
15
|
};
|
|
17
|
-
/** The resolved id maps, so callers can freeze a plan without re-resolving. */
|
|
18
|
-
resolution: Resolution;
|
|
19
16
|
status: PlanStatus;
|
|
20
17
|
};
|
|
21
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/services/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/services/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,CAAC;AAE3D,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,iEAAiE;IACjE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AAeF;;;;;GAKG;AACH,qBAAa,WAAW;IACD,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAErC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CA4BzE"}
|
package/lib/services/plan.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { loadFiles, diffAssignments, countFindings } from '../core/index.js';
|
|
2
2
|
import { ResolutionService, managedTargets } from './resolution.js';
|
|
3
3
|
const emptyDiff = { toAdd: [], toUpdate: [], toRemove: [], unchanged: [] };
|
|
4
|
-
const emptyResolution = {
|
|
5
|
-
findings: [],
|
|
6
|
-
userIds: new Map(),
|
|
7
|
-
targetIds: {},
|
|
8
|
-
};
|
|
9
4
|
/** An aborted-before-the-diff result, carrying the findings that explain why. */
|
|
10
5
|
function invalidResult(files, findings) {
|
|
11
6
|
return {
|
|
@@ -13,7 +8,6 @@ function invalidResult(files, findings) {
|
|
|
13
8
|
findings,
|
|
14
9
|
diff: emptyDiff,
|
|
15
10
|
drift: { adds: 0, updates: 0, removes: 0 },
|
|
16
|
-
resolution: emptyResolution,
|
|
17
11
|
status: 'invalid',
|
|
18
12
|
};
|
|
19
13
|
}
|
|
@@ -51,7 +45,7 @@ export class PlanService {
|
|
|
51
45
|
updates: mode === 'destructive' ? diff.toUpdate.length : 0,
|
|
52
46
|
removes: mode === 'additive' ? diff.toRemove.length : 0,
|
|
53
47
|
};
|
|
54
|
-
return { files: loaded.files, findings, diff, drift,
|
|
48
|
+
return { files: loaded.files, findings, diff, drift, status: 'planned' };
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
//# sourceMappingURL=plan.js.map
|
package/lib/services/plan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/services/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/services/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAA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QAAQ,CAAC,CAAC;QAC9C,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;QAC7E,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG;YACV,IAAI,EAAE,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO,EAAE,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SAC1D,CAAC;QAEF,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC7E,CAAC;CACJ"}
|
package/messages/ps.apply.md
CHANGED
|
@@ -8,15 +8,11 @@ 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.
|
|
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.
|
|
11
|
+
YAML file or glob to apply. Repeatable.
|
|
16
12
|
|
|
17
13
|
# flags.mode.summary
|
|
18
14
|
|
|
19
|
-
Which half of the reconcile to run: additive adds missing assignments and updates expirations, destructive removes only, sync does both.
|
|
15
|
+
Which half of the reconcile to run: additive adds missing assignments and updates expirations, destructive removes only, sync does both.
|
|
20
16
|
|
|
21
17
|
# flags.max-deletes.summary
|
|
22
18
|
|
|
@@ -34,10 +30,6 @@ List assignments that already match, instead of only counting them.
|
|
|
34
30
|
|
|
35
31
|
Skip the deletion confirmation prompt. Required to delete in JSON or other non-interactive runs.
|
|
36
32
|
|
|
37
|
-
# info.applyingPlan
|
|
38
|
-
|
|
39
|
-
Applying saved plan (mode %s).
|
|
40
|
-
|
|
41
33
|
# confirm.delete
|
|
42
34
|
|
|
43
35
|
This will remove %s assignment(s) from the org. Continue?
|
|
@@ -62,30 +54,6 @@ Aborted at the confirmation prompt. Nothing was changed.
|
|
|
62
54
|
|
|
63
55
|
failed to %s %s on %s: %s
|
|
64
56
|
|
|
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
|
-
|
|
89
57
|
# error.invalid
|
|
90
58
|
|
|
91
59
|
The files do not resolve cleanly against the org. Fix the errors above, then re-run.
|
package/messages/ps.plan.md
CHANGED
|
@@ -18,14 +18,6 @@ Which half of the reconcile to preview: additive adds and updates expirations, d
|
|
|
18
18
|
|
|
19
19
|
List assignments that already match, instead of only counting them.
|
|
20
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
21
|
# header.title
|
|
30
22
|
|
|
31
23
|
Permission Set Assignments Plan
|
package/package.json
CHANGED
package/lib/core/plan-file.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* The saved-plan format version. Bump when the shape changes incompatibly, so an
|
|
4
|
-
* `apply --plan` on an old file fails loudly instead of misreading it.
|
|
5
|
-
*/
|
|
6
|
-
export declare const savedPlanVersion = 1;
|
|
7
|
-
declare const savedPlanSchema: z.ZodObject<{
|
|
8
|
-
version: z.ZodLiteral<1>;
|
|
9
|
-
org: z.ZodString;
|
|
10
|
-
mode: z.ZodEnum<{
|
|
11
|
-
additive: "additive";
|
|
12
|
-
destructive: "destructive";
|
|
13
|
-
sync: "sync";
|
|
14
|
-
}>;
|
|
15
|
-
add: z.ZodArray<z.ZodObject<{
|
|
16
|
-
assignee: z.ZodString;
|
|
17
|
-
kind: z.ZodEnum<{
|
|
18
|
-
permissionSet: "permissionSet";
|
|
19
|
-
permissionSetGroup: "permissionSetGroup";
|
|
20
|
-
permissionSetLicense: "permissionSetLicense";
|
|
21
|
-
}>;
|
|
22
|
-
target: z.ZodString;
|
|
23
|
-
expiration: z.ZodOptional<z.ZodString>;
|
|
24
|
-
assigneeId: z.ZodString;
|
|
25
|
-
targetId: z.ZodString;
|
|
26
|
-
}, z.core.$strict>>;
|
|
27
|
-
update: z.ZodArray<z.ZodObject<{
|
|
28
|
-
recordId: z.ZodString;
|
|
29
|
-
assignee: z.ZodString;
|
|
30
|
-
kind: z.ZodEnum<{
|
|
31
|
-
permissionSet: "permissionSet";
|
|
32
|
-
permissionSetGroup: "permissionSetGroup";
|
|
33
|
-
permissionSetLicense: "permissionSetLicense";
|
|
34
|
-
}>;
|
|
35
|
-
target: z.ZodString;
|
|
36
|
-
expiration: z.ZodOptional<z.ZodString>;
|
|
37
|
-
previousExpiration: z.ZodOptional<z.ZodString>;
|
|
38
|
-
}, z.core.$strict>>;
|
|
39
|
-
remove: z.ZodArray<z.ZodObject<{
|
|
40
|
-
recordId: z.ZodString;
|
|
41
|
-
assignee: z.ZodString;
|
|
42
|
-
kind: z.ZodEnum<{
|
|
43
|
-
permissionSet: "permissionSet";
|
|
44
|
-
permissionSetGroup: "permissionSetGroup";
|
|
45
|
-
permissionSetLicense: "permissionSetLicense";
|
|
46
|
-
}>;
|
|
47
|
-
target: z.ZodString;
|
|
48
|
-
expiration: z.ZodOptional<z.ZodString>;
|
|
49
|
-
}, z.core.$strict>>;
|
|
50
|
-
}, z.core.$strict>;
|
|
51
|
-
/** A reviewed, resolved change set frozen to a file, ready for `apply` to run verbatim. */
|
|
52
|
-
export type SavedPlan = z.infer<typeof savedPlanSchema>;
|
|
53
|
-
/** Serialize a plan to its on-disk YAML form. */
|
|
54
|
-
export declare function serializePlan(plan: SavedPlan): string;
|
|
55
|
-
/** Parse and validate a plan file's text. Returns the plan, or a single error message describing why it is invalid. */
|
|
56
|
-
export declare function parsePlan(content: string): {
|
|
57
|
-
plan?: SavedPlan;
|
|
58
|
-
error?: string;
|
|
59
|
-
};
|
|
60
|
-
export {};
|
|
61
|
-
//# sourceMappingURL=plan-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan-file.d.ts","sourceRoot":"","sources":["../../src/core/plan-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AA2ClC,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAOnB,CAAC;AAEH,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,iDAAiD;AACjD,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAErD;AAED,uHAAuH;AACvH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAkB/E"}
|
package/lib/core/plan-file.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { parse, stringify } from 'yaml';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
/**
|
|
4
|
-
* The saved-plan format version. Bump when the shape changes incompatibly, so an
|
|
5
|
-
* `apply --plan` on an old file fails loudly instead of misreading it.
|
|
6
|
-
*/
|
|
7
|
-
export const savedPlanVersion = 1;
|
|
8
|
-
const kind = z.enum([
|
|
9
|
-
'permissionSet',
|
|
10
|
-
'permissionSetGroup',
|
|
11
|
-
'permissionSetLicense',
|
|
12
|
-
]);
|
|
13
|
-
const mode = z.enum([
|
|
14
|
-
'additive',
|
|
15
|
-
'destructive',
|
|
16
|
-
'sync',
|
|
17
|
-
]);
|
|
18
|
-
/** A resolved addition: the assignment plus the org ids needed to insert it. */
|
|
19
|
-
const resolvedAddition = z.strictObject({
|
|
20
|
-
assignee: z.string().min(1),
|
|
21
|
-
kind,
|
|
22
|
-
target: z.string().min(1),
|
|
23
|
-
expiration: z.string().min(1).optional(),
|
|
24
|
-
assigneeId: z.string().min(1),
|
|
25
|
-
targetId: z.string().min(1),
|
|
26
|
-
});
|
|
27
|
-
/** An expiration change on an existing record. */
|
|
28
|
-
const assignmentUpdate = z.strictObject({
|
|
29
|
-
recordId: z.string().min(1),
|
|
30
|
-
assignee: z.string().min(1),
|
|
31
|
-
kind,
|
|
32
|
-
target: z.string().min(1),
|
|
33
|
-
expiration: z.string().min(1).optional(),
|
|
34
|
-
previousExpiration: z.string().min(1).optional(),
|
|
35
|
-
});
|
|
36
|
-
/** An existing record to remove, carrying its id. */
|
|
37
|
-
const actualAssignment = z.strictObject({
|
|
38
|
-
recordId: z.string().min(1),
|
|
39
|
-
assignee: z.string().min(1),
|
|
40
|
-
kind,
|
|
41
|
-
target: z.string().min(1),
|
|
42
|
-
expiration: z.string().min(1).optional(),
|
|
43
|
-
});
|
|
44
|
-
const savedPlanSchema = z.strictObject({
|
|
45
|
-
version: z.literal(savedPlanVersion),
|
|
46
|
-
org: z.string().min(1),
|
|
47
|
-
mode,
|
|
48
|
-
add: z.array(resolvedAddition),
|
|
49
|
-
update: z.array(assignmentUpdate),
|
|
50
|
-
remove: z.array(actualAssignment),
|
|
51
|
-
});
|
|
52
|
-
/** Serialize a plan to its on-disk YAML form. */
|
|
53
|
-
export function serializePlan(plan) {
|
|
54
|
-
return stringify(plan);
|
|
55
|
-
}
|
|
56
|
-
/** Parse and validate a plan file's text. Returns the plan, or a single error message describing why it is invalid. */
|
|
57
|
-
export function parsePlan(content) {
|
|
58
|
-
let data;
|
|
59
|
-
try {
|
|
60
|
-
data = parse(content);
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
return { error: `invalid YAML: ${err.message}` };
|
|
64
|
-
}
|
|
65
|
-
const result = savedPlanSchema.safeParse(data);
|
|
66
|
-
if (!result.success) {
|
|
67
|
-
const detail = result.error.issues
|
|
68
|
-
.map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)
|
|
69
|
-
.join('; ');
|
|
70
|
-
return { error: detail };
|
|
71
|
-
}
|
|
72
|
-
return { plan: result.data };
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=plan-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan-file.js","sourceR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