sf-plugin-permission-sets 0.0.0-dev.7 → 0.0.0-dev.73
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/LICENSE.md +28 -0
- package/README.md +311 -88
- package/lib/adapters/connection-org-client.d.ts +23 -0
- package/lib/adapters/connection-org-client.d.ts.map +1 -0
- package/lib/adapters/connection-org-client.js +370 -0
- package/lib/adapters/connection-org-client.js.map +1 -0
- package/lib/adapters/index.d.ts +2 -0
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/index.js +2 -0
- package/lib/adapters/index.js.map +1 -0
- package/lib/commands/ps/apply.d.ts +41 -0
- package/lib/commands/ps/apply.d.ts.map +1 -0
- package/lib/commands/ps/apply.js +179 -0
- package/lib/commands/ps/apply.js.map +1 -0
- package/lib/commands/ps/check.d.ts +21 -0
- package/lib/commands/ps/check.d.ts.map +1 -0
- package/lib/commands/ps/check.js +55 -0
- package/lib/commands/ps/check.js.map +1 -0
- package/lib/commands/ps/export.d.ts +26 -0
- package/lib/commands/ps/export.d.ts.map +1 -0
- package/lib/commands/ps/export.js +74 -0
- package/lib/commands/ps/export.js.map +1 -0
- package/lib/commands/ps/plan.d.ts +61 -0
- package/lib/commands/ps/plan.d.ts.map +1 -0
- package/lib/commands/ps/plan.js +193 -0
- package/lib/commands/ps/plan.js.map +1 -0
- package/lib/commands/ps/validate.d.ts +21 -0
- package/lib/commands/ps/validate.d.ts.map +1 -0
- package/lib/commands/ps/validate.js +56 -0
- package/lib/commands/ps/validate.js.map +1 -0
- package/lib/core/diff.d.ts +46 -0
- package/lib/core/diff.d.ts.map +1 -0
- package/lib/core/diff.js +118 -0
- package/lib/core/diff.js.map +1 -0
- package/lib/core/finding.d.ts +43 -0
- package/lib/core/finding.d.ts.map +1 -0
- package/lib/core/finding.js +76 -0
- package/lib/core/finding.js.map +1 -0
- package/lib/core/index.d.ts +11 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/index.js +10 -0
- package/lib/core/index.js.map +1 -0
- package/lib/core/load.d.ts +4 -0
- package/lib/core/load.d.ts.map +1 -0
- package/lib/core/load.js +60 -0
- package/lib/core/load.js.map +1 -0
- package/lib/core/model.d.ts +77 -0
- package/lib/core/model.d.ts.map +1 -0
- package/lib/core/model.js +2 -0
- package/lib/core/model.js.map +1 -0
- package/lib/core/normalize.d.ts +17 -0
- package/lib/core/normalize.d.ts.map +1 -0
- package/lib/core/normalize.js +74 -0
- package/lib/core/normalize.js.map +1 -0
- package/lib/core/parse.d.ts +10 -0
- package/lib/core/parse.d.ts.map +1 -0
- package/lib/core/parse.js +20 -0
- package/lib/core/parse.js.map +1 -0
- package/lib/core/report.d.ts +16 -0
- package/lib/core/report.d.ts.map +1 -0
- package/lib/core/report.js +127 -0
- package/lib/core/report.js.map +1 -0
- package/lib/core/resolve.d.ts +22 -0
- package/lib/core/resolve.d.ts.map +1 -0
- package/lib/core/resolve.js +92 -0
- package/lib/core/resolve.js.map +1 -0
- package/lib/core/schema.d.ts +23 -0
- package/lib/core/schema.d.ts.map +1 -0
- package/lib/core/schema.js +35 -0
- package/lib/core/schema.js.map +1 -0
- package/lib/core/serialize.d.ts +9 -0
- package/lib/core/serialize.d.ts.map +1 -0
- package/lib/core/serialize.js +50 -0
- package/lib/core/serialize.js.map +1 -0
- package/lib/core/target-name.d.ts +20 -0
- package/lib/core/target-name.d.ts.map +1 -0
- package/lib/core/target-name.js +32 -0
- package/lib/core/target-name.js.map +1 -0
- package/lib/core/username.d.ts +23 -0
- package/lib/core/username.d.ts.map +1 -0
- package/lib/core/username.js +35 -0
- package/lib/core/username.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/services/adapters/index.d.ts +2 -0
- package/lib/services/adapters/index.d.ts.map +1 -0
- package/lib/services/adapters/index.js +2 -0
- package/lib/services/adapters/index.js.map +1 -0
- package/lib/services/adapters/org-client.d.ts +26 -0
- package/lib/services/adapters/org-client.d.ts.map +1 -0
- package/lib/services/adapters/org-client.js +2 -0
- package/lib/services/adapters/org-client.js.map +1 -0
- package/lib/services/apply.d.ts +33 -0
- package/lib/services/apply.d.ts.map +1 -0
- package/lib/services/apply.js +82 -0
- package/lib/services/apply.js.map +1 -0
- package/lib/services/check.d.ts +14 -0
- package/lib/services/check.d.ts.map +1 -0
- package/lib/services/check.js +18 -0
- package/lib/services/check.js.map +1 -0
- package/lib/services/export.d.ts +19 -0
- package/lib/services/export.d.ts.map +1 -0
- package/lib/services/export.js +30 -0
- package/lib/services/export.js.map +1 -0
- package/lib/services/index.d.ts +6 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +6 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/plan.d.ts +22 -0
- package/lib/services/plan.d.ts.map +1 -0
- package/lib/services/plan.js +44 -0
- package/lib/services/plan.js.map +1 -0
- package/lib/services/resolution.d.ts +25 -0
- package/lib/services/resolution.d.ts.map +1 -0
- package/lib/services/resolution.js +75 -0
- package/lib/services/resolution.js.map +1 -0
- package/lib/services/validate.d.ts +22 -0
- package/lib/services/validate.d.ts.map +1 -0
- package/lib/services/validate.js +59 -0
- package/lib/services/validate.js.map +1 -0
- package/messages/ps.apply.md +85 -0
- package/messages/ps.check.md +33 -0
- package/messages/ps.export.md +45 -0
- package/messages/ps.plan.md +85 -0
- package/messages/ps.validate.md +29 -0
- package/package.json +119 -180
- package/lib/commands/ps/info.d.ts +0 -11
- package/lib/commands/ps/info.js +0 -17
- package/lib/commands/ps/info.js.map +0 -1
- package/messages/ps.info.md +0 -17
- package/oclif.lock +0 -7781
- 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,EAAqC,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKjF,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 { distinctAssignees, 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 = distinctAssignees(result.assignments);
|
|
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.length,
|
|
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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AAC,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, Username } 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?.map((username) => Username.of(username)),
|
|
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,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAClF,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,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC3B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;YACxB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;SAC5D,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACf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AK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;aACxC,CAAC;QACN,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEjC,OAAO;YACH,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;SAC1B,CAAC;IACN,CAAC;IAEO,kBAAkB,CAAC,cAAwB;QAC/C,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC;IACL,CAAC;IAEO,gBAAgB,CAAC,WAAmB,EAAE,KAAa,EAAE,UAAkB;QAC3E,IAAI,CAAC,GAAG,CACJ,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE;YAC3B,WAAW;YACX,KAAK;YACL,UAAU;SACb,CAAC,CACL,CAAC;IACN,CAAC;IAED,wGAAwG;IAChG,WAAW,CAAC,OAAe;QAC/B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACtE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-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
|
+
};
|
|
30
|
+
export default class Plan extends SfCommand<PsPlanResult> {
|
|
31
|
+
static readonly summary: string;
|
|
32
|
+
static readonly description: string;
|
|
33
|
+
static readonly examples: string[];
|
|
34
|
+
static readonly flags: {
|
|
35
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
file: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
mode: import("@oclif/core/interfaces").OptionFlag<"additive" | "destructive" | "sync", import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
'show-unchanged': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
39
|
+
};
|
|
40
|
+
run(): Promise<PsPlanResult>;
|
|
41
|
+
/** Render the human-readable plan body once the run is known to be valid. */
|
|
42
|
+
private logPlan;
|
|
43
|
+
private logBody;
|
|
44
|
+
/** The counts line reports what the mode acts on, so it never contradicts the body above it. */
|
|
45
|
+
private countsLine;
|
|
46
|
+
/** Drift is already mode-scoped: only additive leaves removes, only destructive leaves adds. */
|
|
47
|
+
private reportDrift;
|
|
48
|
+
private reportUnchanged;
|
|
49
|
+
private applyCommand;
|
|
50
|
+
private errorInvalid;
|
|
51
|
+
private logHeaderTitle;
|
|
52
|
+
private logHeaderOrg;
|
|
53
|
+
private logEmptyNoChanges;
|
|
54
|
+
private logEmptyNothingToApply;
|
|
55
|
+
private logSummaryNext;
|
|
56
|
+
private logDriftAdditive;
|
|
57
|
+
private logDriftDestructive;
|
|
58
|
+
private logSummaryUnchanged;
|
|
59
|
+
private logSummaryUnchangedListed;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAKpB,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;IA0DzC,6EAA6E;IAC7E,OAAO,CAAC,OAAO;IAwCf,OAAO,CAAC,OAAO;IAMf,gGAAgG;IAChG,OAAO,CAAC,UAAU;IAsBlB,gGAAgG;IAChG,OAAO,CAAC,WAAW;IAOnB,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,193 @@
|
|
|
1
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { Messages } from '@salesforce/core';
|
|
3
|
+
import { ConnectionOrgClient } from '../../adapters/index.js';
|
|
4
|
+
import { PlanService } from '../../services/index.js';
|
|
5
|
+
import { formatDiff, formatFindings, } from '../../core/index.js';
|
|
6
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
7
|
+
const messages = Messages.loadMessages('sf-plugin-permission-sets', 'ps.plan');
|
|
8
|
+
export default class Plan 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
|
+
mode: Flags.option({
|
|
21
|
+
summary: messages.getMessage('flags.mode.summary'),
|
|
22
|
+
options: ['additive', 'destructive', 'sync'],
|
|
23
|
+
default: 'additive',
|
|
24
|
+
})(),
|
|
25
|
+
'show-unchanged': Flags.boolean({
|
|
26
|
+
summary: messages.getMessage('flags.show-unchanged.summary'),
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
async run() {
|
|
30
|
+
const { flags } = await this.parse(Plan);
|
|
31
|
+
const mode = flags.mode;
|
|
32
|
+
const targetOrg = flags['target-org'];
|
|
33
|
+
const connection = targetOrg.getConnection();
|
|
34
|
+
const orgClient = new ConnectionOrgClient(connection);
|
|
35
|
+
const service = new PlanService(orgClient);
|
|
36
|
+
const result = await service.run(flags.file);
|
|
37
|
+
for (const line of formatFindings(result.findings)) {
|
|
38
|
+
this.log(line);
|
|
39
|
+
}
|
|
40
|
+
const diff = result.diff;
|
|
41
|
+
const scoped = diff.scopeTo(mode);
|
|
42
|
+
const orgId = targetOrg.getOrgId();
|
|
43
|
+
const username = targetOrg.getUsername() ?? '';
|
|
44
|
+
const orgName = username || orgId;
|
|
45
|
+
const summary = {
|
|
46
|
+
org: { username, id: orgId },
|
|
47
|
+
mode,
|
|
48
|
+
counts: {
|
|
49
|
+
toAdd: diff.toAdd.length,
|
|
50
|
+
toUpdate: diff.toUpdate.length,
|
|
51
|
+
toRemove: diff.toRemove.length,
|
|
52
|
+
unchanged: diff.unchanged.length,
|
|
53
|
+
usersAffected: scoped.usersAffected,
|
|
54
|
+
},
|
|
55
|
+
drift: scoped.drift,
|
|
56
|
+
changes: {
|
|
57
|
+
toAdd: diff.toAdd,
|
|
58
|
+
toUpdate: diff.toUpdate,
|
|
59
|
+
toRemove: diff.toRemove,
|
|
60
|
+
unchanged: diff.unchanged,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
if (result.status === 'invalid') {
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
if (!this.jsonEnabled())
|
|
66
|
+
this.errorInvalid();
|
|
67
|
+
return summary;
|
|
68
|
+
}
|
|
69
|
+
this.logPlan({
|
|
70
|
+
diff,
|
|
71
|
+
scoped,
|
|
72
|
+
mode,
|
|
73
|
+
orgName,
|
|
74
|
+
orgId,
|
|
75
|
+
files: flags.file,
|
|
76
|
+
showUnchanged: flags['show-unchanged'],
|
|
77
|
+
});
|
|
78
|
+
return summary;
|
|
79
|
+
}
|
|
80
|
+
/** Render the human-readable plan body once the run is known to be valid. */
|
|
81
|
+
logPlan(args) {
|
|
82
|
+
const { diff, scoped, mode, orgName, orgId, files, showUnchanged } = args;
|
|
83
|
+
this.logHeaderTitle();
|
|
84
|
+
this.logHeaderOrg(orgName, orgId, mode);
|
|
85
|
+
if (diff.changeCount === 0) {
|
|
86
|
+
if (showUnchanged && diff.unchanged.length > 0) {
|
|
87
|
+
this.logBody(formatDiff(diff, { mode, showUnchanged: true }));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.log('');
|
|
91
|
+
}
|
|
92
|
+
this.logEmptyNoChanges(orgName);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.logBody(formatDiff(diff, { mode, showUnchanged }));
|
|
96
|
+
if (scoped.count === 0) {
|
|
97
|
+
this.logEmptyNothingToApply(mode);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.log(this.countsLine(scoped, mode));
|
|
101
|
+
}
|
|
102
|
+
this.reportDrift(scoped.drift);
|
|
103
|
+
this.reportUnchanged(diff.unchanged.length, showUnchanged);
|
|
104
|
+
if (scoped.count > 0) {
|
|
105
|
+
this.logSummaryNext(this.applyCommand(orgName, files, mode));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
logBody(body) {
|
|
109
|
+
this.log('');
|
|
110
|
+
for (const line of body)
|
|
111
|
+
this.log(line);
|
|
112
|
+
if (body.length > 0)
|
|
113
|
+
this.log('');
|
|
114
|
+
}
|
|
115
|
+
/** The counts line reports what the mode acts on, so it never contradicts the body above it. */
|
|
116
|
+
countsLine(scoped, mode) {
|
|
117
|
+
if (mode === 'destructive') {
|
|
118
|
+
return messages.getMessage('summary.counts.destructive', [
|
|
119
|
+
scoped.removals.length,
|
|
120
|
+
scoped.usersAffected,
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
if (mode === 'additive') {
|
|
124
|
+
return messages.getMessage('summary.counts.additive', [
|
|
125
|
+
scoped.additions.length,
|
|
126
|
+
scoped.updates.length,
|
|
127
|
+
scoped.usersAffected,
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
return messages.getMessage('summary.counts.sync', [
|
|
131
|
+
scoped.additions.length,
|
|
132
|
+
scoped.updates.length,
|
|
133
|
+
scoped.removals.length,
|
|
134
|
+
scoped.usersAffected,
|
|
135
|
+
]);
|
|
136
|
+
}
|
|
137
|
+
/** Drift is already mode-scoped: only additive leaves removes, only destructive leaves adds. */
|
|
138
|
+
reportDrift(drift) {
|
|
139
|
+
if (drift.removes > 0)
|
|
140
|
+
this.logDriftAdditive(drift.removes);
|
|
141
|
+
const skipped = drift.adds + drift.updates;
|
|
142
|
+
if (skipped > 0)
|
|
143
|
+
this.logDriftDestructive(skipped);
|
|
144
|
+
}
|
|
145
|
+
reportUnchanged(count, showUnchanged) {
|
|
146
|
+
if (count === 0)
|
|
147
|
+
return;
|
|
148
|
+
if (showUnchanged)
|
|
149
|
+
this.logSummaryUnchangedListed(count);
|
|
150
|
+
else
|
|
151
|
+
this.logSummaryUnchanged(count);
|
|
152
|
+
}
|
|
153
|
+
applyCommand(orgName, files, mode) {
|
|
154
|
+
const fileArgs = files.map((file) => `-f "${file}"`).join(' ');
|
|
155
|
+
const modeArg = mode === 'additive' ? '' : ` --mode ${mode}`;
|
|
156
|
+
return `${this.config.bin} ps apply -o ${orgName} ${fileArgs}${modeArg}`;
|
|
157
|
+
}
|
|
158
|
+
errorInvalid() {
|
|
159
|
+
this.error(messages.getMessage('error.invalid'), { exit: 1 });
|
|
160
|
+
}
|
|
161
|
+
logHeaderTitle() {
|
|
162
|
+
this.log(messages.getMessage('header.title'));
|
|
163
|
+
}
|
|
164
|
+
logHeaderOrg(orgName, orgId, mode) {
|
|
165
|
+
this.log(messages.getMessage('header.org', [
|
|
166
|
+
orgName,
|
|
167
|
+
orgId,
|
|
168
|
+
mode,
|
|
169
|
+
]));
|
|
170
|
+
}
|
|
171
|
+
logEmptyNoChanges(orgName) {
|
|
172
|
+
this.log(messages.getMessage('empty.noChanges', [orgName]));
|
|
173
|
+
}
|
|
174
|
+
logEmptyNothingToApply(mode) {
|
|
175
|
+
this.log(messages.getMessage('empty.nothingToApply', [mode]));
|
|
176
|
+
}
|
|
177
|
+
logSummaryNext(applyCommand) {
|
|
178
|
+
this.log(messages.getMessage('summary.next', [applyCommand]));
|
|
179
|
+
}
|
|
180
|
+
logDriftAdditive(count) {
|
|
181
|
+
this.log(messages.getMessage('drift.additive', [count]));
|
|
182
|
+
}
|
|
183
|
+
logDriftDestructive(count) {
|
|
184
|
+
this.log(messages.getMessage('drift.destructive', [count]));
|
|
185
|
+
}
|
|
186
|
+
logSummaryUnchanged(count) {
|
|
187
|
+
this.log(messages.getMessage('summary.unchanged', [count]));
|
|
188
|
+
}
|
|
189
|
+
logSummaryUnchangedListed(count) {
|
|
190
|
+
this.log(messages.getMessage('summary.unchangedListed', [count]));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# 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,6BAA6B,CA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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,mBAAmB,CAAC,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
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,EAAqC,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKjF,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 { distinctAssignees, 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 = distinctAssignees(result.assignments);
|
|
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.length,
|
|
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,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAW,MAAM,qBAAqB,CAAC;AA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AED,MAAM,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAExD,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,MAAM;YACvB,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,46 @@
|
|
|
1
|
+
import { ActualAssignment, AssignmentUpdate, DesiredAssignment, ReconcileMode } from './model.js';
|
|
2
|
+
/** What a mode deliberately leaves alone, reported beneath a plan as drift. */
|
|
3
|
+
export type Drift = {
|
|
4
|
+
adds: number;
|
|
5
|
+
updates: number;
|
|
6
|
+
removes: number;
|
|
7
|
+
};
|
|
8
|
+
/** A diff narrowed to one mode: what that mode acts on, and the drift it leaves behind. */
|
|
9
|
+
export declare class ScopedChange {
|
|
10
|
+
readonly additions: DesiredAssignment[];
|
|
11
|
+
readonly updates: AssignmentUpdate[];
|
|
12
|
+
readonly removals: ActualAssignment[];
|
|
13
|
+
readonly drift: Drift;
|
|
14
|
+
constructor(additions: DesiredAssignment[], updates: AssignmentUpdate[], removals: ActualAssignment[], drift: Drift);
|
|
15
|
+
/** How many assignments this mode would act on. */
|
|
16
|
+
get count(): number;
|
|
17
|
+
/** How many distinct users this mode would touch. */
|
|
18
|
+
get usersAffected(): number;
|
|
19
|
+
}
|
|
20
|
+
/** The change set between the desired model and the org's current state. */
|
|
21
|
+
export declare class Diff {
|
|
22
|
+
readonly toAdd: DesiredAssignment[];
|
|
23
|
+
readonly toUpdate: AssignmentUpdate[];
|
|
24
|
+
readonly toRemove: ActualAssignment[];
|
|
25
|
+
readonly unchanged: ActualAssignment[];
|
|
26
|
+
constructor(toAdd: DesiredAssignment[], toUpdate: AssignmentUpdate[], toRemove: ActualAssignment[], unchanged: ActualAssignment[]);
|
|
27
|
+
/** The diff of a run that aborted before it ever reached the org. */
|
|
28
|
+
static empty(): Diff;
|
|
29
|
+
/** How many assignments differ, whatever the mode would act on. */
|
|
30
|
+
get changeCount(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Narrow the diff to what the chosen mode acts on: additive skips removals,
|
|
33
|
+
* destructive skips adds and updates, sync acts on all. Whatever the mode skips
|
|
34
|
+
* comes back as drift, so plan and apply report it rather than hiding it.
|
|
35
|
+
*/
|
|
36
|
+
scopeTo(mode: ReconcileMode): ScopedChange;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Compare the desired assignments against the org's current memberships of the
|
|
40
|
+
* managed targets. `actual` must hold only assignments for targets that appear
|
|
41
|
+
* in `desired` (the managed set), so any actual row not in `desired` is an
|
|
42
|
+
* undeclared assignment eligible for removal. A declared assignment whose
|
|
43
|
+
* expiration differs from the org's is an update rather than unchanged.
|
|
44
|
+
*/
|
|
45
|
+
export declare function diffAssignments(desired: DesiredAssignment[], actual: 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