UNPKG

819 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var isValidPath = require("is-valid-path");
4var graphql_1 = require("graphql");
5var DocumentFromString = /** @class */ (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}());
25exports.DocumentFromString = DocumentFromString;
26//# sourceMappingURL=document-from-string.js.map
\No newline at end of file