UNPKG

12.4 kBJavaScriptView Raw
1(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4/******/
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7/******/
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId]) {
10/******/ return installedModules[moduleId].exports;
11/******/ }
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ i: moduleId,
15/******/ l: false,
16/******/ exports: {}
17/******/ };
18/******/
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ // Flag the module as loaded
23/******/ module.l = true;
24/******/
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28/******/
29/******/
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32/******/
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35/******/
36/******/ // define getter function for harmony exports
37/******/ __webpack_require__.d = function(exports, name, getter) {
38/******/ if(!__webpack_require__.o(exports, name)) {
39/******/ Object.defineProperty(exports, name, {
40/******/ configurable: false,
41/******/ enumerable: true,
42/******/ get: getter
43/******/ });
44/******/ }
45/******/ };
46/******/
47/******/ // getDefaultExport function for compatibility with non-harmony modules
48/******/ __webpack_require__.n = function(module) {
49/******/ var getter = module && module.__esModule ?
50/******/ function getDefault() { return module['default']; } :
51/******/ function getModuleExports() { return module; };
52/******/ __webpack_require__.d(getter, 'a', getter);
53/******/ return getter;
54/******/ };
55/******/
56/******/ // Object.prototype.hasOwnProperty.call
57/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58/******/
59/******/ // __webpack_public_path__
60/******/ __webpack_require__.p = "";
61/******/
62/******/ // Load entry module and return exports
63/******/ return __webpack_require__(__webpack_require__.s = 4);
64/******/ })
65/************************************************************************/
66/******/ ([
67/* 0 */
68/***/ (function(module, exports, __webpack_require__) {
69
70"use strict";
71
72Object.defineProperty(exports, "__esModule", { value: true });
73exports.EInputType = {
74 SINGLE_FILE: 'SINGLE_FILE',
75 MULTIPLE_FILES: 'MULTIPLE_FILES',
76 PROJECT: 'PROJECT',
77};
78
79
80/***/ }),
81/* 1 */
82/***/ (function(module, exports, __webpack_require__) {
83
84"use strict";
85
86Object.defineProperty(exports, "__esModule", { value: true });
87var index = __webpack_require__(5);
88var type = __webpack_require__(6);
89var schema = __webpack_require__(7);
90var documents = __webpack_require__(8);
91var selectionSet = __webpack_require__(2);
92var types_1 = __webpack_require__(0);
93var config = {
94 inputType: types_1.EInputType.SINGLE_FILE,
95 templates: {
96 index: index,
97 type: type,
98 schema: schema,
99 documents: documents,
100 selectionSet: selectionSet,
101 },
102 flattenTypes: true,
103 primitives: {
104 String: 'string',
105 Int: 'number',
106 Float: 'number',
107 Boolean: 'boolean',
108 ID: 'string'
109 },
110 outFile: 'types.d.ts',
111};
112exports.default = config;
113
114
115/***/ }),
116/* 2 */
117/***/ (function(module, exports) {
118
119module.exports = "{{#each this}}\n{{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}}; {{#if description }} // {{description}}{{/if}}\n{{/each}}"
120
121/***/ }),
122/* 3 */
123/***/ (function(module, exports, __webpack_require__) {
124
125"use strict";
126
127Object.defineProperty(exports, "__esModule", { value: true });
128var type = __webpack_require__(9);
129var enumTemplate = __webpack_require__(10);
130var scalar = __webpack_require__(11);
131var union = __webpack_require__(12);
132var operation = __webpack_require__(13);
133var fragment = __webpack_require__(14);
134var selectionSet = __webpack_require__(2);
135var types_1 = __webpack_require__(0);
136var config = {
137 inputType: types_1.EInputType.MULTIPLE_FILES,
138 templates: {
139 type: type,
140 inputType: type,
141 'enum': enumTemplate,
142 'interface': type,
143 scalar: scalar,
144 union: union,
145 operation: operation,
146 fragment: fragment,
147 selectionSet: selectionSet,
148 },
149 flattenTypes: true,
150 primitives: {
151 String: 'string',
152 Int: 'number',
153 Float: 'number',
154 Boolean: 'boolean',
155 ID: 'string'
156 },
157 filesExtension: 'd.ts',
158};
159exports.default = config;
160
161
162/***/ }),
163/* 4 */
164/***/ (function(module, exports, __webpack_require__) {
165
166"use strict";
167
168Object.defineProperty(exports, "__esModule", { value: true });
169var config_1 = __webpack_require__(1);
170exports.TypescriptSingleFile = config_1.default;
171var config_2 = __webpack_require__(3);
172exports.TypescriptMultiFile = config_2.default;
173var types_1 = __webpack_require__(0);
174exports.EInputType = types_1.EInputType;
175var get_generator_1 = __webpack_require__(15);
176exports.getGeneratorConfig = get_generator_1.getGeneratorConfig;
177exports.definitions = get_generator_1.definitions;
178
179
180/***/ }),
181/* 5 */
182/***/ (function(module, exports) {
183
184module.exports = "/* tslint:disable */\n{{> schema }}\n{{> documents }}\n"
185
186/***/ }),
187/* 6 */
188/***/ (function(module, exports) {
189
190module.exports = "{{ toComment description }}\nexport interface {{ name }}{{#if hasInterfaces}} extends {{#each interfaces}}{{this}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} {\n{{#each fields}}\n {{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}}; {{ toComment description }}\n{{/each}}\n}\n"
191
192/***/ }),
193/* 7 */
194/***/ (function(module, exports) {
195
196module.exports = "{{#each scalars}}\n\n{{ toComment description }}\nexport type {{ name }} = any;\n{{/each}}\n{{#each interfaces}}\n {{~> type }}\n{{/each}}\n{{#each types}}\n {{~> type }}\n{{/each}}\n{{#each inputTypes}}\n {{~> type }}\n{{/each}}\n{{~#each types}}\n {{~#each fields}}\n {{~# if hasArguments }}\nexport interface {{ toPascalCase name }}{{ toPascalCase ../name }}Args {\n{{#each arguments}}\n {{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}}; {{ toComment description }}\n{{/each}}\n}\n {{/if}}\n {{/each}}\n{{/each}}\n{{#each enums}}\n{{ toComment description }}\nexport type {{ name }} = {{#each values }}\"{{ value }}\"{{#unless @last}} | {{/unless}}{{/each}};\n\n{{/each}}\n{{#each unions}}\n{{ toComment description }}\nexport type {{ name }} = {{#each possibleTypes}}{{this}}{{#unless @last}} | {{/unless}}{{/each}};\n\n{{/each}}\n"
197
198/***/ }),
199/* 8 */
200/***/ (function(module, exports) {
201
202module.exports = "{{#each operations }}\nexport namespace {{ toPascalCase name }} {\n export type Variables = {\n {{#each variables}}\n {{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}};\n {{/each}}\n }\n\n export type {{ toPascalCase operationType }} = {\n {{> selectionSet fields }}\n }{{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n {{#each innerModels }}\n\n export type {{ modelType }} = {\n {{> selectionSet fields }}\n }{{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n {{/each}}\n}\n{{/each}}\n{{#each fragments }}\n\nexport namespace {{name}} {\n export type Fragment = {\n {{> selectionSet fields }}\n }{{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n {{#each innerModels }}\n\n export type {{ modelType }} = {\n {{> selectionSet fields }}\n }{{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n {{/each}}\n}\n{{/each}}"
203
204/***/ }),
205/* 9 */
206/***/ (function(module, exports) {
207
208module.exports = "{{#eachImport this }}\nimport { {{ name }} } from './{{ file }}';\n{{/eachImport}}\n{{ toComment description }}\nexport interface {{ name }}{{#if hasInterfaces}} extends {{#each interfaces}}{{this}}{{#unless @last}},{{/unless}}{{/each}}{{/if}} {\n{{#each fields}}\n {{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}}; {{ toComment description }}\n{{/each}}\n}\n\n{{#each fields}}\n {{~# if hasArguments }}\nexport interface {{ toPascalCase name }}{{ toPascalCase ../name }}Args {\n{{#each arguments}}\n {{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}}; {{ toComment description }}\n{{/each}}\n}\n {{/if}}\n{{/each}}"
209
210/***/ }),
211/* 10 */
212/***/ (function(module, exports) {
213
214module.exports = "{{ toComment description }}\nexport type {{ name }} = {{#each values }}\"{{ value }}\"{{#unless @last}} | {{/unless}}{{/each}};"
215
216/***/ }),
217/* 11 */
218/***/ (function(module, exports) {
219
220module.exports = "{{#eachImport this }}\nimport { {{ name }} } from './{{ file }}';\n{{/eachImport}}\n{{ toComment description }}\nexport type {{ name }} = any;\n"
221
222/***/ }),
223/* 12 */
224/***/ (function(module, exports) {
225
226module.exports = "{{#eachImport this }}\nimport { {{ name }} } from './{{ file }}';\n{{/eachImport}}\n{{ toComment description }}\nexport type {{ name }} = {{#each possibleTypes}}{{this}}{{#unless @last}} | {{/unless}}{{/each}};\n"
227
228/***/ }),
229/* 13 */
230/***/ (function(module, exports) {
231
232module.exports = "{{#eachImport this }}\nimport { {{ name }} } from './{{ file }}';\n{{/eachImport}}\nexport namespace {{ toPascalCase name }} {\n export type Variables = {\n{{#each variables}}\n {{ name }}: {{ toPrimitive type }}{{#if isArray}}[]{{/if}}{{#unless isRequired}} | null{{/unless}};\n{{/each}}\n }\n\n export type {{ toPascalCase operationType }} = {\n {{> selectionSet fields }}\n } {{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n{{#each innerModels }}\n\n export type {{ modelType }} = {\n {{> selectionSet fields }}\n }{{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n{{/each}}\n}\n"
233
234/***/ }),
235/* 14 */
236/***/ (function(module, exports) {
237
238module.exports = "{{#eachImport this }}\nimport { {{ name }} } from './{{ file }}';\n{{/eachImport}}\nexport namespace {{name}} {\n export type Fragment = {\n {{> selectionSet fields }}\n } {{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n {{#each innerModels }}\n export type {{ modelType }} = {\n {{> selectionSet fields }}\n } {{#if hasFragmentsSpread}}{{#each fragmentsSpread}} & {{fragmentName}}.Fragment{{/each}}{{/if}}{{#if hasInlineFragments}}{{#each inlineFragments}} & {{onType}}{{/each}}{{/if}}\n {{/each}}\n}"
239
240/***/ }),
241/* 15 */
242/***/ (function(module, exports, __webpack_require__) {
243
244"use strict";
245
246Object.defineProperty(exports, "__esModule", { value: true });
247var config_1 = __webpack_require__(1);
248var config_2 = __webpack_require__(3);
249exports.definitions = {
250 // TypeScript single file
251 ts: config_1.default,
252 typescript: config_1.default,
253 'ts-single': config_1.default,
254 'typescript-single': config_1.default,
255 // TypeScript multiple files
256 'ts-multiple': config_2.default,
257 'typescript-multiple': config_2.default,
258};
259function getGeneratorConfig(name) {
260 return exports.definitions[name];
261}
262exports.getGeneratorConfig = getGeneratorConfig;
263
264
265/***/ })
266/******/ ])));
267//# sourceMappingURL=index.js.map
\No newline at end of file