@simplysf/simply-permissions-core
v0.2.4
Published
Permission set XML and permissions report rendering — the library layer behind @simplysf/simply-permissions, published separately for direct consumption (e.g. editor tooling, CI scripts) without the CLI framework
Readme
@simplysf/simply-permissions-core
Permission set XML and permissions report rendering. This is not a Salesforce CLI plugin — it's the library layer behind @simplysf/simply-permissions's permission set/report commands, published separately so it can be imported directly by anything that wants the same rendering (an editor extension, a CI job, a script) without pulling in the CLI framework.
Install
npm install @simplysf/simply-permissions-coreRequires Node.js >=22 and either "type": "module" or a dynamic import() — this package ships ESM only.
API
Everything below is exported from the package root. Removing or renaming an export is a breaking change; see src/index.ts.
| Export | Description |
| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| buildPermissionSetXml(data) | Pure function: renders a complete PermissionSet metadata XML document from typed template data. |
| buildPermissionsReportHtml(options) | Pure function: renders a self-contained HTML report of permission sets/groups, grouped by package. |
| ObjectPermission, FieldPermission, TabSetting, RecordTypeVisibility, UserPermission, PermissionSetTemplateData | Types for buildPermissionSetXml's input. |
| ObjectPermissionEntry, FieldPermissionEntry, PermissionSetReportEntry, PermissionSetGroupReportEntry, GroupedPermissionsData | Types for buildPermissionsReportHtml's input. |
import { buildPermissionSetXml, type PermissionSetTemplateData } from '@simplysf/simply-permissions-core';
const data: PermissionSetTemplateData = {
label: 'My Permission Set',
hasActivationRequired: false,
objectPermissions: [
{
object: 'Account',
allowCreate: true,
allowDelete: false,
allowEdit: true,
allowRead: true,
modifyAllRecords: false,
viewAllRecords: true,
viewAllFields: false,
},
],
fieldPermissions: [],
tabSettings: [],
recordTypeVisibilities: [],
userPermissions: [],
};
const xml = buildPermissionSetXml(data);
// write xml to a `.permissionset-meta.xml` fileimport { buildPermissionsReportHtml } from '@simplysf/simply-permissions-core';
const html = buildPermissionsReportHtml({
username: '[email protected]',
reportDate: new Date().toISOString(),
groupedData: new Map([['', { permissionSets: [], permissionSetGroups: [] }]]),
});
// write html to a report fileIssues
Please report any issues at https://github.com/SimplySF/simply-plugins-core/issues
Contributing
This package is part of the @simplysf/simply monorepo. See CONTRIBUTING.md for what's specific to this package, and the repo's root CONTRIBUTING.md for repo structure, setup, commit conventions, and how to submit a pull request. Please also read our Code of Conduct.
License
Licensed under the Apache-2.0 license.
