UNPKG

stackpress

Version:

Incept is a content management framework.

29 lines (28 loc) 1 kB
import { isObject } from '@stackpress/ingest/helpers'; import Fieldset from './spec/Fieldset.js'; import Model from './spec/Model.js'; export default class Registry { constructor(schema) { if (schema.enum && isObject(schema.enum)) { for (const key in schema.enum) { this.enum.set(key, schema.enum[key]); } } if (schema.type && isObject(schema.type)) { for (const name in schema.type) { const { attributes, columns } = schema.type[name]; this.fieldset.set(name, new Fieldset(this, name, attributes, columns)); } } if (schema.model && isObject(schema.model)) { for (const name in schema.model) { const { attributes, columns } = schema.model[name]; this.model.set(name, new Model(this, name, attributes, columns)); } } } enum = new Map(); fieldset = new Map(); model = new Map(); } ;