UNPKG

@vulcan-sql/core

Version:
34 lines 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InMemoryCodeLoader = void 0; const tslib_1 = require("tslib"); const models_1 = require("../../../models/index"); let InMemoryCodeLoader = class InMemoryCodeLoader extends models_1.CodeLoader { constructor() { super(...arguments); this.source = new Map(); } setSource(name, code) { this.source.set(name, eval(code)); } getSource(name) { if (!this.source.has(name)) return null; return { src: { type: 'code', // We've checked the map and ensured that the key exists // eslint-disable-next-line @typescript-eslint/no-non-null-assertion obj: this.source.get(name), }, path: name, noCache: true, }; } }; InMemoryCodeLoader = tslib_1.__decorate([ (0, models_1.VulcanInternalExtension)(), (0, models_1.VulcanExtensionId)('InMemory') ], InMemoryCodeLoader); exports.InMemoryCodeLoader = InMemoryCodeLoader; //# sourceMappingURL=inMemoryCodeLoader.js.map