@alexandreamormino/plugin-entity-manager-common
v1.0.1
Published
Common types, schemas, and utilities for Entity Manager plugins
Maintainers
Readme
Entity Manager Common Library
Shared types, schemas, utilities, and permissions for Entity Manager plugins.
Permissions
import {
entityManagerCreatePermission,
entityManagerReadPermission,
entityManagerUpdatePermission,
entityManagerDeletePermission,
entityManagerListPermission,
entityManagerPermissions, // array of all five
} from '@alexandreamormino/plugin-entity-manager-common';Permission names: entity.manager.entity.{create,read,update,delete,list}
Schema validation
import { SchemaLoader } from '@alexandreamormino/plugin-entity-manager-common';
const loader = new SchemaLoader(schemas, logger);
const result = loader.validate(entity);
if (!result.valid) {
console.log(result.errors);
}Built-in schemas
JSON schemas for Component, API, Resource, and System are bundled and used by default. You can override any of them with custom schemas via app-config.yaml.
import {
componentSchema,
apiSchema,
resourceSchema,
systemSchema,
} from '@alexandreamormino/plugin-entity-manager-common';YAML utilities
import { parseYamlEntity, entityToYaml } from '@alexandreamormino/plugin-entity-manager-common';Development
yarn workspace @alexandreamormino/plugin-entity-manager-common build
yarn workspace @alexandreamormino/plugin-entity-manager-common test