UNPKG

2.16 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})();
15var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
16 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
17 return cooked;
18};
19Object.defineProperty(exports, "__esModule", { value: true });
20var graphql_binding_1 = require("graphql-binding");
21var graphql_1 = require("graphql");
22var PrismaGenerator = /** @class */ (function (_super) {
23 __extends(PrismaGenerator, _super);
24 function PrismaGenerator(options) {
25 return _super.call(this, options) || this;
26 }
27 PrismaGenerator.prototype.render = function () {
28 return this.compile(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", "\n\n\n/**\n * Type Defs\n*/\n\n", "\n\n", "\n"], ["\\\n", "\n\n\n/**\n * Type Defs\n*/\n\n", "\n\n", "\n"])), this.renderImports(), this.renderTypedefs(), this.renderExports());
29 };
30 PrismaGenerator.prototype.renderImports = function () {
31 return "const { makePrismaBindingClass } = require('prisma-binding')";
32 };
33 PrismaGenerator.prototype.renderExports = function () {
34 return "const Prisma = makePrismaBindingClass({ typeDefs })\nmodule.exports = { Prisma }";
35 };
36 PrismaGenerator.prototype.renderTypedefs = function () {
37 return ('const typeDefs = `' + graphql_1.printSchema(this.schema).replace(/`/g, '\\`') + '`');
38 };
39 return PrismaGenerator;
40}(graphql_binding_1.Generator));
41exports.PrismaGenerator = PrismaGenerator;
42var templateObject_1;
43//# sourceMappingURL=PrismaGenerator.js.map
\No newline at end of file