UNPKG

couchbase-index-manager

Version:
37 lines 892 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NodeMap = void 0; /** * Stores a map of node aliases to their fully qualified name */ class NodeMap { constructor(configuration) { this._values = {}; if (configuration) { this.merge(configuration); } } /** * Adds or overwrites mapped nodes */ merge(hash) { this._values = { ...this._values, ...hash }; } /** * Applies node mappings to an array of index definitions */ apply(definition) { for (const def of definition) { if (def.nodes) { def.nodes = def.nodes.map((node) => { return this._values[node] || node; }); } } } } exports.NodeMap = NodeMap; //# sourceMappingURL=node-map.js.map