@simplysf/simply-schema-core
v0.2.3
Published
sObject schema generation (CSV/Excel parsing, field/object normalization) and interactive schema-report rendering — the library layer behind @simplysf/simply-schema, published separately for direct consumption (e.g. editor tooling, CI scripts) without the
Readme
@simplysf/simply-schema-core
sObject schema generation (CSV/Excel parsing, field/object normalization) and interactive schema-report rendering. This is not a Salesforce CLI plugin — it's the library layer behind @simplysf/simply-schema's generate/visualize commands, published separately so it can be imported directly by anything that wants the same logic (an editor extension, a CI job, a script) without pulling in the CLI framework.
Install
npm install @simplysf/simply-schema-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 |
| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| getObjectInfo(workbook) | Reads the object worksheet into a plain property map. |
| getFieldInfo(workbook) | Reads the fields worksheet into one row object per field. |
| getValuesInfo(valuesWorksheet) | Reads a picklist values worksheet into one entry per value. |
| toBoolean(value) | Converts a CSV/Excel value to a boolean, preserving undefined for empty/missing input. |
| blankToUndefined(value) | Treats an empty string the same as undefined. |
| buildSchemaReportHtml(options) | Renders a self-contained, interactive HTML schema report (diagram + relationship data table). |
| IMPLEMENTED_FIELD_TYPES | The Salesforce field types this package knows how to generate CustomField metadata for. |
| FIELD_TYPES_WITHOUT_REQUIRED_PROP | Field types whose CustomField metadata never carries a required tag. |
| XML_BUILDER_OPTIONS | Standardized XML builder options matching Salesforce CLI's own output formatting. |
| ObjectData, NormalizedFieldData, RecordTypeData, BoolLike | The normalized object/field/record-type shapes both the CSV and Excel flows produce, and the boolean-or-text input toBoolean accepts. |
| PicklistValueSet, PicklistValueSetDefinition, PicklistValueSetValue, PicklistValueSettingEntry | The valueSet node structure of a Picklist/MultiselectPicklist CustomField. |
| ExcelObjectInfo, ExcelFieldRow, ExcelValueRow | Row shapes returned by getObjectInfo/getFieldInfo/getValuesInfo. |
| SchemaRelationship, SchemaDiagramNode, SchemaDiagramEdge | buildSchemaReportHtml's relationship rows and vis-network node/edge inputs. |
import { getObjectInfo, getFieldInfo, getValuesInfo } from '@simplysf/simply-schema-core';
import ExcelJS from 'exceljs';
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.readFile('./schema.xlsx');
const objectInfo = getObjectInfo(workbook);
const fieldRows = getFieldInfo(workbook);import { toBoolean, blankToUndefined } from '@simplysf/simply-schema-core';
const required = toBoolean(csvRow.Required);
const description = blankToUndefined(csvRow.Description);import { buildSchemaReportHtml } from '@simplysf/simply-schema-core';
const html = buildSchemaReportHtml({ username: org.username, nodes, edges, relationships });Issues
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.
