UNPKG

@aws-amplify/graphql-transformer-core

Version:

A framework to transform from GraphQL SDL to AWS CloudFormation.

30 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TransformerDataSourceManager = void 0; class TransformerDataSourceManager { constructor() { this.dataSourceMap = new Map(); this.add = (type, dataSourceInstance) => { const key = type.name.value; if (this.dataSourceMap.has(key)) { throw new Error(`DataSource already exists for type ${key}`); } this.dataSourceMap.set(key, dataSourceInstance); }; this.get = (type) => { const key = type.name.value; if (!this.dataSourceMap.has(key)) { throw new Error(`DataSource for type ${key} does not exist`); } return this.dataSourceMap.get(key); }; this.collectDataSources = () => { return this.dataSourceMap; }; this.has = (name) => { return this.dataSourceMap.has(name); }; } } exports.TransformerDataSourceManager = TransformerDataSourceManager; //# sourceMappingURL=datasource.js.map