UNPKG

@mdf.js/core

Version:

MMS - API Core - Common types, classes and functions

44 lines 1.79 kB
"use strict"; /** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; const Manager_1 = require("./Manager"); /** * Create a new Provider Factory based in a Port * @param port - Port instance * @param validation - Port config validation struct * @param defaultName - Default name for the provider * @param type - Provider type * @returns Factory class, with a static `create` methods to create a provider instances */ function default_1(port, validation, defaultName, type) { return class MixinFactory { /** * Create a new provider * @param options - Provider configuration options */ static create(options) { return new MixinFactory(options).provider; } /** * Private constructor for provider factory * @param options - Provider configuration options */ constructor(options) { var _a, _b; this.provider = new Manager_1.Manager(port, { name: (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : defaultName, type, validation, useEnvironment: (_b = options === null || options === void 0 ? void 0 : options.useEnvironment) !== null && _b !== void 0 ? _b : true, logger: options === null || options === void 0 ? void 0 : options.logger, }, options === null || options === void 0 ? void 0 : options.config); } }; } //# sourceMappingURL=Factory.js.map