UNPKG

@themost/jspa

Version:
35 lines (30 loc) 1.46 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var common = require('@themost/common'); var jspa = require('@themost/jspa'); class DefaultEntityLoaderStrategy extends jspa.EntityLoaderStrategy { constructor(config) { super(config); const values = config.getSourceAt('settings/jspa/imports') || []; common.Args.check(Array.isArray(values), new Error('Invalid configuration. The persistent annotation imports, defined by `settings/jspa/imports`, must be an array of modules.')); // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return this.imports = values.map((id) => { if (/^(\.\/|\..\/)/.test(id)) { const executionPath = config.getExecutionPath(); if (executionPath) { common.TraceUtils.debug(`@themost/jspa Loading persistent types from relative module "${id}"`); return require(common.PathUtils.join(config.getExecutionPath(), id)); } } common.TraceUtils.debug(`@themost/jspa Loading persistent types from module "${id}"`); return require(id); }); // read imports this.readSync(); } getModelDefinition(name) { return super.getModelDefinition(name); } } exports.DefaultEntityLoaderStrategy = DefaultEntityLoaderStrategy; //# sourceMappingURL=index.js.map