UNPKG

@theguild/federation-composition

Version:
52 lines (51 loc) 1.3 kB
import { lazy } from './helpers.js'; export class FieldMove { typeName; fieldName; requires; provides; provided; _toString = lazy(() => { let str = this.fieldName; if (this.requires) { str += ` @require(${this.requires})`; } if (this.provides) { str += ` @provides(${this.provides})`; } if (this.provided) { str += ' @provided'; } return str; }); constructor(typeName, fieldName, requires = null, provides = null, provided = false) { this.typeName = typeName; this.fieldName = fieldName; this.requires = requires; this.provides = provides; this.provided = provided; } toString() { return this._toString.get(); } } export class AbstractMove { keyFields; _toString = lazy(() => (this.keyFields ? `🔮 🔑 ${this.keyFields}` : `🔮`)); constructor(keyFields) { this.keyFields = keyFields; } toString() { return this._toString.get(); } } export class EntityMove { keyFields; _toString = lazy(() => `🔑 ${this.keyFields}`); constructor(keyFields) { this.keyFields = keyFields; } toString() { return this._toString.get(); } }