UNPKG

2.6 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 }
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16var oda_gen_common_1 = require("oda-gen-common");
17var deepMerge = oda_gen_common_1.lib.deepMerge;
18var graphql_tools_1 = require("graphql-tools");
19var lodash_1 = require("./lodash");
20var LodashSchema = (function (_super) {
21 __extends(LodashSchema, _super);
22 function LodashSchema() {
23 var _this = _super !== null && _super.apply(this, arguments) || this;
24 _this._name = 'LodashSchema';
25 _this._composite = [
26 new oda_gen_common_1.types.DefaultTypes({}),
27 new lodash_1.LodashModule({}),
28 ];
29 return _this;
30 }
31 Object.defineProperty(LodashSchema.prototype, "typeDefs", {
32 get: function () {
33 return "\n " + this.typeDef.join('\n ') + "\n\n type RootQuery {\n dummy: String\n }\n\n schema {\n query: RootQuery\n }\n ";
34 },
35 enumerable: true,
36 configurable: true
37 });
38 LodashSchema.prototype.build = function () {
39 _super.prototype.build.call(this);
40 this._resolver = deepMerge(this.resolver, {
41 RootQuery: this.query,
42 });
43 };
44 Object.defineProperty(LodashSchema.prototype, "resolvers", {
45 get: function () {
46 return this.applyHooks(this.resolver);
47 },
48 enumerable: true,
49 configurable: true
50 });
51 return LodashSchema;
52}(oda_gen_common_1.types.GQLModule));
53var _lodashAST;
54function lodashAST() {
55 if (!_lodashAST) {
56 var current = new LodashSchema({});
57 current.build();
58 var schema = graphql_tools_1.makeExecutableSchema({
59 typeDefs: current.typeDefs.toString(),
60 resolvers: current.resolvers,
61 resolverValidationOptions: {
62 requireResolversForNonScalar: false,
63 },
64 });
65 _lodashAST = schema.getDirective('_');
66 }
67 return _lodashAST;
68}
69exports.lodashAST = lodashAST;
70//# sourceMappingURL=schema.js.map
\No newline at end of file