@salesforce/metadata-plugins 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/dist/plugins/flow/ui/assets/{index-DJP9DbPL.js → index-OhJU6yxp.js} +1 -1
- package/dist/plugins/flow/ui/index.html +1 -1
- package/dist/plugins/permissionset/PermissionSetParser.d.ts +9 -1
- package/dist/plugins/permissionset/PermissionSetParser.d.ts.map +1 -1
- package/dist/plugins/permissionset/PermissionSetParser.js +12 -0
- package/dist/plugins/permissionset/objectGrouping.d.ts +112 -0
- package/dist/plugins/permissionset/objectGrouping.d.ts.map +1 -0
- package/dist/plugins/permissionset/objectGrouping.js +140 -0
- package/dist/plugins/permissionset/permissionsetSelectionGraph.d.ts +88 -0
- package/dist/plugins/permissionset/permissionsetSelectionGraph.d.ts.map +1 -0
- package/dist/plugins/permissionset/permissionsetSelectionGraph.js +277 -0
- package/dist/plugins/permissionset/sectionKeys.d.ts +45 -0
- package/dist/plugins/permissionset/sectionKeys.d.ts.map +1 -0
- package/dist/plugins/permissionset/sectionKeys.js +58 -0
- package/dist/plugins/permissionset/types/PermissionSetData.d.ts +9 -0
- package/dist/plugins/permissionset/types/PermissionSetData.d.ts.map +1 -1
- package/dist/plugins/permissionset/ui/assets/index-CMInRbR2.js +48 -0
- package/dist/plugins/permissionset/ui/assets/index-DqEUhEQc.css +1 -0
- package/dist/plugins/permissionset/ui/index.html +2 -2
- package/dist/plugins/schema/ui/assets/{index-BHwyhVGF.js → index-CWvLR0Fz.js} +9 -9
- package/dist/plugins/schema/ui/assets/{index-Cp1nVgsx.css → index-EHPZb2E3.css} +1 -1
- package/dist/plugins/schema/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/plugins/permissionset/ui/assets/index-CMOgdp7q.css +0 -1
- package/dist/plugins/permissionset/ui/assets/index-D_FwDkAf.js +0 -48
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
**/
|
|
7
|
+
/**
|
|
8
|
+
* Permission Set SelectionGraph (C1) — the plugin's ENTIRE vibe-edit
|
|
9
|
+
* contribution: one forward projection of the parsed permission set into the
|
|
10
|
+
* normalized `SelectableNode` contract, plus the id helpers the panel
|
|
11
|
+
* components stamp as `data-mv-id`. Because both the parser (host) and the UI
|
|
12
|
+
* import the SAME helpers, the id the parser emits and the id the UI renders
|
|
13
|
+
* are identical BY CONSTRUCTION — the generic core-sdk engine then resolves a
|
|
14
|
+
* selected element to its node by pure `Map.get(id)`.
|
|
15
|
+
*
|
|
16
|
+
* SELF-CONTAINED, like `schema`/`agent`: this module projects DIRECTLY off the
|
|
17
|
+
* raw `PermissionSetData` and imports only `./types/`, `./objectGrouping.js`,
|
|
18
|
+
* and core-sdk. It reuses NOTHING from `ui/`, so the panel's own render code
|
|
19
|
+
* (`objectRows.ts`, `toPermissionSetView.ts`, `constants.ts`, `helpers.ts`)
|
|
20
|
+
* stays as it was — vibe-edit is added purely on top. This is also what keeps
|
|
21
|
+
* the parser's static import graph free of the `ui/` tree (which Vite wipes
|
|
22
|
+
* from `dist` via `emptyOutDir`) and of `react` (a devDependency), so
|
|
23
|
+
* `getAllVisualizers()` loads cleanly in a pure-Node host.
|
|
24
|
+
*
|
|
25
|
+
* The projection reproduces the panel's "Object Settings" grouping so the
|
|
26
|
+
* emitted nodes match the DOM 1:1: each object row (real OR synthetic) parents
|
|
27
|
+
* its field / tab / record-type children, and the 14 flat named-access
|
|
28
|
+
* sections hang off the root. The grouping itself — which object rows exist, in
|
|
29
|
+
* what order, and which field/tab/record-type grants fold under each — is NOT
|
|
30
|
+
* re-implemented here: it comes from the SHARED `groupObjectSettings`
|
|
31
|
+
* (`./objectGrouping.js`) that the panel's `useObjectRows` also consumes, so the
|
|
32
|
+
* ids emitted here and the `data-mv-id`s the panel stamps cannot drift apart.
|
|
33
|
+
* This projection only reads the grant PAYLOADS (CRUD flags, readable/editable,
|
|
34
|
+
* visibility) off each grouped row's passed-through `.source`.
|
|
35
|
+
*
|
|
36
|
+
* Hierarchy (parentId chains):
|
|
37
|
+
*
|
|
38
|
+
* permissionset (root)
|
|
39
|
+
* ├─ objectPermission (one per Object Settings row — real OR synthetic)
|
|
40
|
+
* │ ├─ fieldPermission (unqualified field name)
|
|
41
|
+
* │ ├─ tabSetting (raw <tab> value)
|
|
42
|
+
* │ └─ recordTypeVisibility (unqualified record-type name)
|
|
43
|
+
* └─ <14 namedAccess-family sections> (flat children of root; type === section key)
|
|
44
|
+
*
|
|
45
|
+
* filePath: EVERY node carries `data.filePath` (the `.permissionset-meta.xml`).
|
|
46
|
+
* We deliberately do NOT use `sfdxPath()` — editing any grant edits the
|
|
47
|
+
* permission-set file, not the referenced object/field's own metadata file.
|
|
48
|
+
*/
|
|
49
|
+
import { structuralId } from '@salesforce/metadata-core-sdk';
|
|
50
|
+
import { groupObjectSettings } from './objectGrouping.js';
|
|
51
|
+
// ─── id helpers (shared by the parser projection AND the UI stamps) ──────────
|
|
52
|
+
// Each node kind gets ONE helper so a component computes the same id the
|
|
53
|
+
// projection emits. Ids are structural (parentId + type + apiName) so they are
|
|
54
|
+
// deterministic and environment-independent (host === render).
|
|
55
|
+
/** Root permission-set node — keyed on the PS api name. */
|
|
56
|
+
export function permissionSetNodeId(apiName) {
|
|
57
|
+
return structuralId('', 'permissionset', apiName);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The overview-card title (the permission set's label) — a pure-label heading
|
|
61
|
+
* child of the root. Selecting it targets JUST the label, without pulling in the
|
|
62
|
+
* whole permission set. Mirrors the agent plugin's header-card title heading.
|
|
63
|
+
*/
|
|
64
|
+
export function permissionSetTitleNodeId(psApiName) {
|
|
65
|
+
return structuralId(permissionSetNodeId(psApiName), 'heading', 'title');
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The overview-card description paragraph — a child of the root, selectable on
|
|
69
|
+
* its own so the user can edit just the description. Mirrors the agent plugin's
|
|
70
|
+
* standalone description node.
|
|
71
|
+
*/
|
|
72
|
+
export function permissionSetDescriptionNodeId(psApiName) {
|
|
73
|
+
return structuralId(permissionSetNodeId(psApiName), 'description', 'description');
|
|
74
|
+
}
|
|
75
|
+
/** An Object Settings row (real or synthetic) — child of the root. */
|
|
76
|
+
export function objectPermissionNodeId(psApiName, objectApiName) {
|
|
77
|
+
return structuralId(permissionSetNodeId(psApiName), 'objectPermission', objectApiName);
|
|
78
|
+
}
|
|
79
|
+
/** A field-level-security row — child of its object. `fieldApiName` is unqualified. */
|
|
80
|
+
export function fieldPermissionNodeId(psApiName, objectApiName, fieldApiName) {
|
|
81
|
+
return structuralId(objectPermissionNodeId(psApiName, objectApiName), 'fieldPermission', fieldApiName);
|
|
82
|
+
}
|
|
83
|
+
/** A record-type-visibility row — child of its object. `recordTypeName` is unqualified. */
|
|
84
|
+
export function recordTypeVisibilityNodeId(psApiName, objectApiName, recordTypeName) {
|
|
85
|
+
return structuralId(objectPermissionNodeId(psApiName, objectApiName), 'recordTypeVisibility', recordTypeName);
|
|
86
|
+
}
|
|
87
|
+
/** A tab-setting row — child of its object. `tab` is the RAW `<tab>` value. */
|
|
88
|
+
export function tabSettingNodeId(psApiName, objectApiName, tab) {
|
|
89
|
+
return structuralId(objectPermissionNodeId(psApiName, objectApiName), 'tabSetting', tab);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A flat named-access grant (apexClassAccesses, userPermissions, …). Scoped by
|
|
93
|
+
* the SECTION KEY as the `type` so the SAME name granted in two different
|
|
94
|
+
* sections yields two DISTINCT ids (otherwise both `<li>`s share a `data-mv-id`
|
|
95
|
+
* and selection is ambiguous).
|
|
96
|
+
*/
|
|
97
|
+
export function namedAccessNodeId(psApiName, sectionKey, name) {
|
|
98
|
+
return structuralId(permissionSetNodeId(psApiName), sectionKey, name);
|
|
99
|
+
}
|
|
100
|
+
// ─── projection helpers (pure, raw-data only — no ui/, no react) ─────────────
|
|
101
|
+
/**
|
|
102
|
+
* The 14 flat named-access sections in the panel's canonical display order
|
|
103
|
+
* (SECTION_DISPLAY_ORDER minus the folded object section). Each entry maps the
|
|
104
|
+
* VIEW section key the UI stamps to the raw grant array it comes from — so
|
|
105
|
+
* `pageAccesses` reads `apexPageAccesses`, `applicationVisibilities` maps its
|
|
106
|
+
* `application`/`visible` to `name`/`enabled`, etc. Enabled-only, matching the
|
|
107
|
+
* panel (it renders enabled toggles only, so the DOM stamps only those).
|
|
108
|
+
*/
|
|
109
|
+
const NAMED_ACCESS_SECTIONS = [
|
|
110
|
+
{ key: 'apexClassAccesses', get: (d) => d.apexClassAccesses },
|
|
111
|
+
{ key: 'pageAccesses', get: (d) => d.apexPageAccesses },
|
|
112
|
+
{ key: 'flowAccesses', get: (d) => d.flowAccesses },
|
|
113
|
+
{ key: 'agentAccesses', get: (d) => d.agentAccesses },
|
|
114
|
+
{ key: 'customPermissions', get: (d) => d.customPermissions },
|
|
115
|
+
{ key: 'customMetadataTypeAccesses', get: (d) => d.customMetadataTypeAccesses },
|
|
116
|
+
{ key: 'customSettingAccesses', get: (d) => d.customSettingAccesses },
|
|
117
|
+
{ key: 'externalDataSourceAccesses', get: (d) => d.externalDataSourceAccesses },
|
|
118
|
+
{ key: 'externalCredentialPrincipalAccesses', get: (d) => d.externalCredentialPrincipalAccesses },
|
|
119
|
+
{ key: 'servicePresenceStatusAccesses', get: (d) => d.servicePresenceStatusAccesses },
|
|
120
|
+
{ key: 'emailRoutingAddressAccesses', get: (d) => d.emailRoutingAddressAccesses },
|
|
121
|
+
{ key: 'genComputingSummaryDefAccesses', get: (d) => d.genComputingSummaryDefAccesses },
|
|
122
|
+
{ key: 'userPermissions', get: (d) => d.userPermissions },
|
|
123
|
+
{
|
|
124
|
+
key: 'applicationVisibilities',
|
|
125
|
+
get: (d) => d.applicationVisibilities.map((av) => ({ name: av.application, enabled: av.visible })),
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
const _assertSectionsCoverAllKeys = true;
|
|
129
|
+
void _assertSectionsCoverAllKeys;
|
|
130
|
+
/** The six CRUD + "view/modify all" flags, normalized to the emit attribute names. */
|
|
131
|
+
function objectAttributes(op) {
|
|
132
|
+
return {
|
|
133
|
+
create: op.allowCreate,
|
|
134
|
+
read: op.allowRead,
|
|
135
|
+
edit: op.allowEdit,
|
|
136
|
+
del: op.allowDelete,
|
|
137
|
+
viewAll: op.viewAllRecords,
|
|
138
|
+
viewAllFields: op.viewAllFields,
|
|
139
|
+
modifyAll: op.modifyAllRecords,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** An all-false object grant for a synthetic row (object referenced only by a child). */
|
|
143
|
+
const EMPTY_OBJECT_GRANT = {
|
|
144
|
+
create: false,
|
|
145
|
+
read: false,
|
|
146
|
+
edit: false,
|
|
147
|
+
del: false,
|
|
148
|
+
viewAll: false,
|
|
149
|
+
viewAllFields: false,
|
|
150
|
+
modifyAll: false,
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Emit the full Permission Set SelectionGraph. Used by
|
|
154
|
+
* `PermissionSetParser.getSelectableNodes()` (host) and matched exactly by the
|
|
155
|
+
* `data-mv-id` the panel components render (both via the helpers above).
|
|
156
|
+
*/
|
|
157
|
+
export function permissionsetSelectableNodes(data) {
|
|
158
|
+
const psApiName = data.apiName;
|
|
159
|
+
const filePath = data.filePath;
|
|
160
|
+
const rootId = permissionSetNodeId(psApiName);
|
|
161
|
+
const nodes = [];
|
|
162
|
+
// Root — always present (a PS always has an api name). For an otherwise-empty
|
|
163
|
+
// permission set the only nodes are this root plus its title heading.
|
|
164
|
+
nodes.push({
|
|
165
|
+
id: rootId,
|
|
166
|
+
type: 'permissionset',
|
|
167
|
+
apiName: psApiName,
|
|
168
|
+
attributes: {
|
|
169
|
+
label: data.label,
|
|
170
|
+
...(data.description ? { description: data.description } : {}),
|
|
171
|
+
...(data.license ? { license: data.license } : {}),
|
|
172
|
+
hasActivationRequired: data.hasActivationRequired,
|
|
173
|
+
},
|
|
174
|
+
filePath,
|
|
175
|
+
});
|
|
176
|
+
// Overview-card header sub-nodes — the title (label) and description are
|
|
177
|
+
// individually selectable so the user can target JUST the label or JUST the
|
|
178
|
+
// description without selecting the whole set. Mirrors the agent plugin's
|
|
179
|
+
// header card (title heading + standalone description). The title always
|
|
180
|
+
// renders (the h1 shows the label or the file name), so it is always emitted;
|
|
181
|
+
// the description node exists only when there is a description to stamp.
|
|
182
|
+
nodes.push({
|
|
183
|
+
id: permissionSetTitleNodeId(psApiName),
|
|
184
|
+
type: 'heading',
|
|
185
|
+
apiName: data.label || psApiName,
|
|
186
|
+
parentId: rootId,
|
|
187
|
+
attributes: { role: 'title', ...(data.label ? { label: data.label } : {}) },
|
|
188
|
+
filePath,
|
|
189
|
+
});
|
|
190
|
+
if (data.description) {
|
|
191
|
+
nodes.push({
|
|
192
|
+
id: permissionSetDescriptionNodeId(psApiName),
|
|
193
|
+
type: 'description',
|
|
194
|
+
apiName: `${data.label || psApiName}.description`,
|
|
195
|
+
parentId: rootId,
|
|
196
|
+
attributes: { description: data.description },
|
|
197
|
+
filePath,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
// Object Settings — one node per row (real OR synthetic), then its nested
|
|
201
|
+
// field / tab / record-type children. Child order mirrors the DOM
|
|
202
|
+
// (fields → tab → record types). The grouping (which rows exist, in what
|
|
203
|
+
// order, and what folds under each) comes from the SHARED `groupObjectSettings`
|
|
204
|
+
// that the panel also consumes, so these ids match the stamped `data-mv-id`
|
|
205
|
+
// by construction; here we only read the grant payloads off each `.source`.
|
|
206
|
+
const objectRows = groupObjectSettings({
|
|
207
|
+
objectPermissions: data.objectPermissions,
|
|
208
|
+
objectKey: (op) => op.object,
|
|
209
|
+
fieldPermissions: data.fieldPermissions,
|
|
210
|
+
fieldName: (fp) => fp.field,
|
|
211
|
+
tabSettings: data.tabSettings,
|
|
212
|
+
tabValue: (t) => t.tab,
|
|
213
|
+
recordTypeVisibilities: data.recordTypeVisibilities,
|
|
214
|
+
recordTypeName: (rt) => rt.recordType,
|
|
215
|
+
});
|
|
216
|
+
for (const row of objectRows) {
|
|
217
|
+
const objId = objectPermissionNodeId(psApiName, row.object);
|
|
218
|
+
const grant = row.objectSource ? objectAttributes(row.objectSource) : EMPTY_OBJECT_GRANT;
|
|
219
|
+
nodes.push({
|
|
220
|
+
id: objId,
|
|
221
|
+
type: 'objectPermission',
|
|
222
|
+
apiName: row.object,
|
|
223
|
+
parentId: rootId,
|
|
224
|
+
attributes: { ...grant, synthetic: row.synthetic },
|
|
225
|
+
filePath,
|
|
226
|
+
});
|
|
227
|
+
for (const f of row.fields) {
|
|
228
|
+
nodes.push({
|
|
229
|
+
id: fieldPermissionNodeId(psApiName, row.object, f.field),
|
|
230
|
+
type: 'fieldPermission',
|
|
231
|
+
apiName: f.field,
|
|
232
|
+
parentId: objId,
|
|
233
|
+
attributes: { readable: f.source.readable, editable: f.source.editable },
|
|
234
|
+
filePath,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if (row.tab) {
|
|
238
|
+
nodes.push({
|
|
239
|
+
id: tabSettingNodeId(psApiName, row.object, row.tab.rawTab),
|
|
240
|
+
type: 'tabSetting',
|
|
241
|
+
apiName: row.tab.rawTab,
|
|
242
|
+
parentId: objId,
|
|
243
|
+
attributes: { visibility: row.tab.source.visibility },
|
|
244
|
+
filePath,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
for (const rt of row.recordTypes) {
|
|
248
|
+
nodes.push({
|
|
249
|
+
id: recordTypeVisibilityNodeId(psApiName, row.object, rt.name),
|
|
250
|
+
type: 'recordTypeVisibility',
|
|
251
|
+
apiName: rt.name,
|
|
252
|
+
parentId: objId,
|
|
253
|
+
attributes: { visible: rt.source.visible },
|
|
254
|
+
filePath,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// The 14 flat named-access sections — enabled grants only (the panel renders
|
|
259
|
+
// enabled toggles only, so the DOM only stamps those). `type` === section key
|
|
260
|
+
// keeps same-named grants across sections distinct.
|
|
261
|
+
for (const section of NAMED_ACCESS_SECTIONS) {
|
|
262
|
+
for (const item of section.get(data)) {
|
|
263
|
+
if (!item.enabled) {
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
nodes.push({
|
|
267
|
+
id: namedAccessNodeId(psApiName, section.key, item.name),
|
|
268
|
+
type: section.key,
|
|
269
|
+
apiName: item.name,
|
|
270
|
+
parentId: rootId,
|
|
271
|
+
attributes: { section: section.key, enabled: true },
|
|
272
|
+
filePath,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return nodes;
|
|
277
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
**/
|
|
7
|
+
/**
|
|
8
|
+
* The SINGLE source of truth for the permission-set section keys — shared by
|
|
9
|
+
* BOTH the host-side SelectionGraph projection (`permissionsetSelectionGraph.ts`)
|
|
10
|
+
* and the panel UI (`ui/.../permissionset-types.ts`, `constants.ts`,
|
|
11
|
+
* `PermissionSetPanel.tsx`). Before this module the two sides each declared
|
|
12
|
+
* their own key union (the SG's `NamedAccessSectionKey`, the view's
|
|
13
|
+
* `PermissionSetSectionKey`) with no compile-time link, so adding a section
|
|
14
|
+
* meant editing several places by hand and the first omission would silently
|
|
15
|
+
* break selection (a stamped `data-mv-id` with no matching emitted node).
|
|
16
|
+
*
|
|
17
|
+
* Both unions now DERIVE from the `as const` tuples here, so a new section is a
|
|
18
|
+
* one-line tuple edit and TypeScript flows the key everywhere. This module is
|
|
19
|
+
* PURE (no `ui/`, no `react`), so the SelectionGraph may import it without
|
|
20
|
+
* dragging the Vite-wiped `ui/` tree or `react` into the parser graph — the
|
|
21
|
+
* packaging-guard test (`__tests__/selectionGraphModuleGraph.test.ts`) enforces
|
|
22
|
+
* that boundary.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The flat "named-access" section families — everything that hangs directly off
|
|
26
|
+
* the permission-set root (NOT the Object Settings family, which folds fields /
|
|
27
|
+
* tabs / record types under object rows). Order is irrelevant to the derived
|
|
28
|
+
* type; the panel's canonical display order lives in `constants.ts` and the
|
|
29
|
+
* projection's raw-array mapping in `permissionsetSelectionGraph.ts` (both of
|
|
30
|
+
* which are exhaustiveness-checked against this tuple).
|
|
31
|
+
*/
|
|
32
|
+
export declare const NAMED_ACCESS_SECTION_KEYS: readonly ["apexClassAccesses", "pageAccesses", "flowAccesses", "agentAccesses", "customPermissions", "customMetadataTypeAccesses", "customSettingAccesses", "externalDataSourceAccesses", "externalCredentialPrincipalAccesses", "servicePresenceStatusAccesses", "emailRoutingAddressAccesses", "genComputingSummaryDefAccesses", "userPermissions", "applicationVisibilities"];
|
|
33
|
+
/** A flat named-access section key (apexClassAccesses, userPermissions, …). */
|
|
34
|
+
export type NamedAccessSectionKey = (typeof NAMED_ACCESS_SECTION_KEYS)[number];
|
|
35
|
+
/**
|
|
36
|
+
* The "Object Settings" family — the sections that fold into object rows rather
|
|
37
|
+
* than hanging flat off the root. These are view-only section identifiers (the
|
|
38
|
+
* SelectionGraph emits object/field/tab/record-type nodes, not a section node).
|
|
39
|
+
*/
|
|
40
|
+
export declare const OBJECT_SETTINGS_SECTION_KEYS: readonly ["objectPermissions", "fieldPermissions", "tabSettings", "recordTypeVisibilities"];
|
|
41
|
+
/** An Object Settings family section key. */
|
|
42
|
+
export type ObjectSettingsSectionKey = (typeof OBJECT_SETTINGS_SECTION_KEYS)[number];
|
|
43
|
+
/** Every renderable section key the panel knows about (flat + Object Settings). */
|
|
44
|
+
export type PermissionSetSectionKey = NamedAccessSectionKey | ObjectSettingsSectionKey;
|
|
45
|
+
//# sourceMappingURL=sectionKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sectionKeys.d.ts","sourceRoot":"","sources":["../../../src/plugins/permissionset/sectionKeys.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,kXAe5B,CAAC;AAEX,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,6FAK/B,CAAC;AAEX,6CAA6C;AAC7C,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAErF,mFAAmF;AACnF,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
**/
|
|
7
|
+
/**
|
|
8
|
+
* The SINGLE source of truth for the permission-set section keys — shared by
|
|
9
|
+
* BOTH the host-side SelectionGraph projection (`permissionsetSelectionGraph.ts`)
|
|
10
|
+
* and the panel UI (`ui/.../permissionset-types.ts`, `constants.ts`,
|
|
11
|
+
* `PermissionSetPanel.tsx`). Before this module the two sides each declared
|
|
12
|
+
* their own key union (the SG's `NamedAccessSectionKey`, the view's
|
|
13
|
+
* `PermissionSetSectionKey`) with no compile-time link, so adding a section
|
|
14
|
+
* meant editing several places by hand and the first omission would silently
|
|
15
|
+
* break selection (a stamped `data-mv-id` with no matching emitted node).
|
|
16
|
+
*
|
|
17
|
+
* Both unions now DERIVE from the `as const` tuples here, so a new section is a
|
|
18
|
+
* one-line tuple edit and TypeScript flows the key everywhere. This module is
|
|
19
|
+
* PURE (no `ui/`, no `react`), so the SelectionGraph may import it without
|
|
20
|
+
* dragging the Vite-wiped `ui/` tree or `react` into the parser graph — the
|
|
21
|
+
* packaging-guard test (`__tests__/selectionGraphModuleGraph.test.ts`) enforces
|
|
22
|
+
* that boundary.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The flat "named-access" section families — everything that hangs directly off
|
|
26
|
+
* the permission-set root (NOT the Object Settings family, which folds fields /
|
|
27
|
+
* tabs / record types under object rows). Order is irrelevant to the derived
|
|
28
|
+
* type; the panel's canonical display order lives in `constants.ts` and the
|
|
29
|
+
* projection's raw-array mapping in `permissionsetSelectionGraph.ts` (both of
|
|
30
|
+
* which are exhaustiveness-checked against this tuple).
|
|
31
|
+
*/
|
|
32
|
+
export const NAMED_ACCESS_SECTION_KEYS = [
|
|
33
|
+
'apexClassAccesses',
|
|
34
|
+
'pageAccesses',
|
|
35
|
+
'flowAccesses',
|
|
36
|
+
'agentAccesses',
|
|
37
|
+
'customPermissions',
|
|
38
|
+
'customMetadataTypeAccesses',
|
|
39
|
+
'customSettingAccesses',
|
|
40
|
+
'externalDataSourceAccesses',
|
|
41
|
+
'externalCredentialPrincipalAccesses',
|
|
42
|
+
'servicePresenceStatusAccesses',
|
|
43
|
+
'emailRoutingAddressAccesses',
|
|
44
|
+
'genComputingSummaryDefAccesses',
|
|
45
|
+
'userPermissions',
|
|
46
|
+
'applicationVisibilities',
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* The "Object Settings" family — the sections that fold into object rows rather
|
|
50
|
+
* than hanging flat off the root. These are view-only section identifiers (the
|
|
51
|
+
* SelectionGraph emits object/field/tab/record-type nodes, not a section node).
|
|
52
|
+
*/
|
|
53
|
+
export const OBJECT_SETTINGS_SECTION_KEYS = [
|
|
54
|
+
'objectPermissions',
|
|
55
|
+
'fieldPermissions',
|
|
56
|
+
'tabSettings',
|
|
57
|
+
'recordTypeVisibilities',
|
|
58
|
+
];
|
|
@@ -77,6 +77,15 @@ export interface RecordTypeVisibility {
|
|
|
77
77
|
export interface PermissionSetData {
|
|
78
78
|
/** API name derived from the file name (e.g. "Sales_Manager") */
|
|
79
79
|
apiName: string;
|
|
80
|
+
/**
|
|
81
|
+
* Absolute source path of the `.permissionset-meta.xml` this data was parsed
|
|
82
|
+
* from. Threaded from the parser (mirrors `AgentScriptData.filePath`) and
|
|
83
|
+
* stamped onto every emitted SelectionGraph node's `filePath` — editing any
|
|
84
|
+
* grant (object/field/tab/record-type/named-access) edits THIS file, not the
|
|
85
|
+
* referenced object/field's own metadata file, so `sfdxPath()` is deliberately
|
|
86
|
+
* NOT used for permission-set nodes.
|
|
87
|
+
*/
|
|
88
|
+
filePath: string;
|
|
80
89
|
/** `<label>` from the XML, falling back to the API name */
|
|
81
90
|
label: string;
|
|
82
91
|
/** `<description>` when present */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionSetData.d.ts","sourceRoot":"","sources":["../../../../src/plugins/permissionset/types/PermissionSetData.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;GAWG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,qFAAqF;IACrF,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAA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AClC,CAAC;CACH"}
|
|
1
|
+
{"version":3,"file":"PermissionSetData.d.ts","sourceRoot":"","sources":["../../../../src/plugins/permissionset/types/PermissionSetData.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;GAWG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,qFAAqF;IACrF,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wFAAwF;AACxF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,8BAA8B;AAC9B,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oCAAoC;AACpC,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,8BAA8B;AAC9B,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;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