1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var isValidPath = require("is-valid-path");
|
4 | var graphql_1 = require("graphql");
|
5 | var DocumentFromString = (function () {
|
6 | function DocumentFromString() {
|
7 | }
|
8 | DocumentFromString.prototype.canHandle = function (doc) {
|
9 | if (isValidPath(doc)) {
|
10 | return false;
|
11 | }
|
12 | try {
|
13 | graphql_1.parse(doc);
|
14 | return true;
|
15 | }
|
16 | catch (e) {
|
17 | return false;
|
18 | }
|
19 | };
|
20 | DocumentFromString.prototype.handle = function (doc, config) {
|
21 | return [{ filePath: 'document.graphql', content: graphql_1.parse(doc) }];
|
22 | };
|
23 | return DocumentFromString;
|
24 | }());
|
25 | exports.DocumentFromString = DocumentFromString;
|
26 |
|
\ | No newline at end of file |