UNPKG

stackpress

Version:

Incept is a content management framework.

35 lines (34 loc) 1.38 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const helpers_1 = require("@stackpress/ingest/helpers"); const Fieldset_js_1 = __importDefault(require("./spec/Fieldset.js")); const Model_js_1 = __importDefault(require("./spec/Model.js")); class Registry { constructor(schema) { this.enum = new Map(); this.fieldset = new Map(); this.model = new Map(); if (schema.enum && (0, helpers_1.isObject)(schema.enum)) { for (const key in schema.enum) { this.enum.set(key, schema.enum[key]); } } if (schema.type && (0, helpers_1.isObject)(schema.type)) { for (const name in schema.type) { const { attributes, columns } = schema.type[name]; this.fieldset.set(name, new Fieldset_js_1.default(this, name, attributes, columns)); } } if (schema.model && (0, helpers_1.isObject)(schema.model)) { for (const name in schema.model) { const { attributes, columns } = schema.model[name]; this.model.set(name, new Model_js_1.default(this, name, attributes, columns)); } } } } exports.default = Registry; ;