graphql-query-parser 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +11 -13
  2. package/dist/builder/fragmentBuilder.d.ts +27 -0
  3. package/dist/builder/fragmentBuilder.d.ts.map +1 -0
  4. package/{builder → dist/builder}/fragmentBuilder.js +13 -8
  5. package/dist/builder/fragmentBuilder.js.map +1 -0
  6. package/dist/builder/graphQLQueryBuilder.d.ts +14 -0
  7. package/dist/builder/graphQLQueryBuilder.d.ts.map +1 -0
  8. package/{builder → dist/builder}/graphQLQueryBuilder.js +3 -6
  9. package/dist/builder/graphQLQueryBuilder.js.map +1 -0
  10. package/dist/builder/index.d.ts +3 -0
  11. package/dist/builder/index.d.ts.map +1 -0
  12. package/dist/builder/index.js +3 -0
  13. package/dist/builder/index.js.map +1 -0
  14. package/dist/builder/queryBuilder.d.ts +22 -0
  15. package/dist/builder/queryBuilder.d.ts.map +1 -0
  16. package/{builder → dist/builder}/queryBuilder.js +7 -9
  17. package/dist/builder/queryBuilder.js.map +1 -0
  18. package/dist/builder/results.d.ts +28 -0
  19. package/dist/builder/results.d.ts.map +1 -0
  20. package/{builder → dist/builder}/results.js +4 -5
  21. package/dist/builder/results.js.map +1 -0
  22. package/dist/cache/cache.d.ts +20 -0
  23. package/dist/cache/cache.d.ts.map +1 -0
  24. package/{cache → dist/cache}/cache.js +7 -8
  25. package/dist/cache/cache.js.map +1 -0
  26. package/dist/cache/index.d.ts +5 -0
  27. package/dist/cache/index.d.ts.map +1 -0
  28. package/dist/cache/index.js +4 -0
  29. package/dist/cache/index.js.map +1 -0
  30. package/dist/cache/indexCache.d.ts +27 -0
  31. package/dist/cache/indexCache.d.ts.map +1 -0
  32. package/{cache → dist/cache}/indexCache.js +2 -4
  33. package/dist/cache/indexCache.js.map +1 -0
  34. package/dist/graphQLQueryParser.d.ts +13 -0
  35. package/dist/graphQLQueryParser.d.ts.map +1 -0
  36. package/dist/graphQLQueryParser.js +50 -0
  37. package/dist/graphQLQueryParser.js.map +1 -0
  38. package/dist/index.d.ts +3 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +3 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/parser/graphql/fragment/fragmentExtractor.d.ts +16 -0
  43. package/dist/parser/graphql/fragment/fragmentExtractor.d.ts.map +1 -0
  44. package/dist/parser/graphql/fragment/fragmentExtractor.js +20 -0
  45. package/dist/parser/graphql/fragment/fragmentExtractor.js.map +1 -0
  46. package/dist/parser/graphql/fragment/fragmentParser.d.ts +19 -0
  47. package/dist/parser/graphql/fragment/fragmentParser.d.ts.map +1 -0
  48. package/{parser → dist/parser}/graphql/fragment/fragmentParser.js +12 -14
  49. package/dist/parser/graphql/fragment/fragmentParser.js.map +1 -0
  50. package/dist/parser/graphql/graphQLExtractor.d.ts +12 -0
  51. package/dist/parser/graphql/graphQLExtractor.d.ts.map +1 -0
  52. package/dist/parser/graphql/graphQLExtractor.js +2 -0
  53. package/dist/parser/graphql/graphQLParser.d.ts +12 -0
  54. package/dist/parser/graphql/graphQLParser.d.ts.map +1 -0
  55. package/dist/parser/graphql/graphQLParser.js +2 -0
  56. package/dist/parser/graphql/index.d.ts +5 -0
  57. package/dist/parser/graphql/index.d.ts.map +1 -0
  58. package/dist/parser/graphql/index.js +4 -0
  59. package/dist/parser/graphql/index.js.map +1 -0
  60. package/dist/parser/graphql/query/queryExtractor.d.ts +15 -0
  61. package/dist/parser/graphql/query/queryExtractor.d.ts.map +1 -0
  62. package/{parser → dist/parser}/graphql/query/queryExtractor.js +5 -6
  63. package/dist/parser/graphql/query/queryExtractor.js.map +1 -0
  64. package/dist/parser/graphql/query/queryParser.d.ts +24 -0
  65. package/dist/parser/graphql/query/queryParser.d.ts.map +1 -0
  66. package/{parser → dist/parser}/graphql/query/queryParser.js +17 -18
  67. package/dist/parser/graphql/query/queryParser.js.map +1 -0
  68. package/dist/parser/index.d.ts +4 -0
  69. package/dist/parser/index.d.ts.map +1 -0
  70. package/dist/parser/index.js +3 -0
  71. package/dist/parser/index.js.map +1 -0
  72. package/dist/parser/parseResults.d.ts +9 -0
  73. package/dist/parser/parseResults.d.ts.map +1 -0
  74. package/dist/parser/parseResults.js +2 -0
  75. package/dist/parser/parseResults.js.map +1 -0
  76. package/dist/parser/parser.d.ts +11 -0
  77. package/dist/parser/parser.d.ts.map +1 -0
  78. package/dist/parser/parser.js +2 -0
  79. package/dist/parser/readStreamParser.d.ts +19 -0
  80. package/dist/parser/readStreamParser.d.ts.map +1 -0
  81. package/dist/parser/readStreamParser.js +52 -0
  82. package/dist/parser/readStreamParser.js.map +1 -0
  83. package/dist/reader/directory/directoryReader.d.ts +15 -0
  84. package/dist/reader/directory/directoryReader.d.ts.map +1 -0
  85. package/dist/reader/directory/directoryReader.js +25 -0
  86. package/dist/reader/directory/directoryReader.js.map +1 -0
  87. package/dist/reader/errors/unsupportedTypeError.d.ts +4 -0
  88. package/dist/reader/errors/unsupportedTypeError.d.ts.map +1 -0
  89. package/dist/reader/errors/unsupportedTypeError.js +12 -0
  90. package/dist/reader/errors/unsupportedTypeError.js.map +1 -0
  91. package/dist/reader/file/fileReader.d.ts +15 -0
  92. package/dist/reader/file/fileReader.d.ts.map +1 -0
  93. package/dist/reader/file/fileReader.js +20 -0
  94. package/dist/reader/file/fileReader.js.map +1 -0
  95. package/dist/reader/graphQLQueryReader.d.ts +24 -0
  96. package/dist/reader/graphQLQueryReader.d.ts.map +1 -0
  97. package/{reader → dist/reader}/graphQLQueryReader.js +15 -19
  98. package/dist/reader/graphQLQueryReader.js.map +1 -0
  99. package/dist/reader/index.d.ts +3 -0
  100. package/dist/reader/index.d.ts.map +1 -0
  101. package/dist/reader/index.js +3 -0
  102. package/dist/reader/index.js.map +1 -0
  103. package/dist/reader/readFile.d.ts +14 -0
  104. package/dist/reader/readFile.d.ts.map +1 -0
  105. package/{reader → dist/reader}/readFile.js +9 -7
  106. package/dist/reader/readFile.js.map +1 -0
  107. package/dist/reader/reader.d.ts +12 -0
  108. package/dist/reader/reader.d.ts.map +1 -0
  109. package/dist/reader/reader.js +2 -0
  110. package/dist/templates/fragmentTemplate.d.ts +11 -0
  111. package/dist/templates/fragmentTemplate.d.ts.map +1 -0
  112. package/{templates → dist/templates}/fragmentTemplate.js +3 -4
  113. package/dist/templates/fragmentTemplate.js.map +1 -0
  114. package/dist/templates/index.d.ts +4 -0
  115. package/dist/templates/index.d.ts.map +1 -0
  116. package/dist/templates/index.js +4 -0
  117. package/dist/templates/index.js.map +1 -0
  118. package/dist/templates/queryTemplate.d.ts +12 -0
  119. package/dist/templates/queryTemplate.d.ts.map +1 -0
  120. package/{templates → dist/templates}/queryTemplate.js +5 -5
  121. package/dist/templates/queryTemplate.js.map +1 -0
  122. package/package.json +61 -46
  123. package/builder/fragmentBuilder.js.map +0 -1
  124. package/builder/graphQLQueryBuilder.js.map +0 -1
  125. package/builder/index.js +0 -5
  126. package/builder/index.js.map +0 -1
  127. package/builder/queryBuilder.js.map +0 -1
  128. package/builder/results.js.map +0 -1
  129. package/cache/cache.js.map +0 -1
  130. package/cache/index.js +0 -7
  131. package/cache/index.js.map +0 -1
  132. package/cache/indexCache.js.map +0 -1
  133. package/docs/CHANGELOG.md +0 -5
  134. package/docs/CONTRIBUTING.md +0 -17
  135. package/docs/EXAMPLES.md +0 -135
  136. package/graphQLQueryParser.js +0 -57
  137. package/graphQLQueryParser.js.map +0 -1
  138. package/index.js +0 -5
  139. package/index.js.map +0 -1
  140. package/parser/graphql/fragment/fragmentExtractor.js +0 -21
  141. package/parser/graphql/fragment/fragmentExtractor.js.map +0 -1
  142. package/parser/graphql/fragment/fragmentParser.js.map +0 -1
  143. package/parser/graphql/graphQLExtractor.js +0 -3
  144. package/parser/graphql/graphQLParser.js +0 -3
  145. package/parser/graphql/index.js +0 -7
  146. package/parser/graphql/index.js.map +0 -1
  147. package/parser/graphql/query/queryExtractor.js.map +0 -1
  148. package/parser/graphql/query/queryParser.js.map +0 -1
  149. package/parser/index.js +0 -5
  150. package/parser/index.js.map +0 -1
  151. package/parser/parseResults.js +0 -3
  152. package/parser/parseResults.js.map +0 -1
  153. package/parser/parser.js +0 -3
  154. package/parser/readStreamParser.js +0 -60
  155. package/parser/readStreamParser.js.map +0 -1
  156. package/reader/directory/directoryReader.js +0 -29
  157. package/reader/directory/directoryReader.js.map +0 -1
  158. package/reader/errors/unsupportedTypeError.js +0 -15
  159. package/reader/errors/unsupportedTypeError.js.map +0 -1
  160. package/reader/file/fileReader.js +0 -24
  161. package/reader/file/fileReader.js.map +0 -1
  162. package/reader/graphQLQueryReader.js.map +0 -1
  163. package/reader/index.js +0 -5
  164. package/reader/index.js.map +0 -1
  165. package/reader/readFile.js.map +0 -1
  166. package/reader/reader.js +0 -3
  167. package/templates/fragmentTemplate.js.map +0 -1
  168. package/templates/index.js +0 -7
  169. package/templates/index.js.map +0 -1
  170. package/templates/queryTemplate.js.map +0 -1
  171. /package/{parser → dist/parser}/graphql/graphQLExtractor.js.map +0 -0
  172. /package/{parser → dist/parser}/graphql/graphQLParser.js.map +0 -0
  173. /package/{parser → dist/parser}/parser.js.map +0 -0
  174. /package/{reader → dist/reader}/reader.js.map +0 -0
@@ -1,9 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const unsupportedTypeError_1 = require("./errors/unsupportedTypeError");
4
- const directoryReader_1 = require("./directory/directoryReader");
5
- const fileReader_1 = require("./file/fileReader");
6
- const fs = require("fs");
1
+ import * as fs from "fs";
2
+ import DirectoryReader from "./directory/directoryReader.js";
3
+ import UnsupportedTypeError from "./errors/unsupportedTypeError.js";
4
+ import FileReader from "./file/fileReader.js";
7
5
  /**
8
6
  * Flattens an array of arrays to a single array
9
7
  *
@@ -11,18 +9,18 @@ const fs = require("fs");
11
9
  */
12
10
  function flatten(arr) {
13
11
  return arr.reduce(function flatReduce(flat, toFlatten) {
14
- return flat.concat(Array.isArray(toFlatten)
15
- ? flatten(toFlatten)
16
- : toFlatten);
12
+ return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
17
13
  }, []);
18
14
  }
19
15
  /**
20
16
  * Reads GraphQL files from the input path provided
21
17
  */
22
- class GraphQLQueryReader {
18
+ export default class GraphQLQueryReader {
19
+ fileReader;
20
+ directoryReader;
23
21
  constructor() {
24
- this.fileReader = new fileReader_1.default();
25
- this.directoryReader = new directoryReader_1.default();
22
+ this.fileReader = new FileReader();
23
+ this.directoryReader = new DirectoryReader();
26
24
  }
27
25
  /**
28
26
  * Reads all the file information from the input path provided.
@@ -33,13 +31,14 @@ class GraphQLQueryReader {
33
31
  read(path) {
34
32
  const lstatResults = fs.lstatSync(path);
35
33
  if (lstatResults.isFile()) {
36
- return [this.fileReader.read(path)];
34
+ const stream = this.fileReader.read(path);
35
+ return stream ? [stream] : [];
37
36
  }
38
37
  else if (lstatResults.isDirectory()) {
39
38
  return this.directoryReader.read(path);
40
39
  }
41
40
  else {
42
- throw new unsupportedTypeError_1.default("Path %s was not recognized as a file or directory", [path]);
41
+ throw new UnsupportedTypeError("Path %s was not recognized as a file or directory", [path]);
43
42
  }
44
43
  }
45
44
  /**
@@ -50,13 +49,10 @@ class GraphQLQueryReader {
50
49
  */
51
50
  readMany(paths) {
52
51
  return paths
53
- .map(path => this.read(path))
52
+ .map((path) => this.read(path))
54
53
  .reduce((flat, toFlatten) => {
55
- return flat.concat(Array.isArray(toFlatten)
56
- ? flatten(toFlatten)
57
- : toFlatten);
54
+ return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
58
55
  }, []);
59
56
  }
60
57
  }
61
- exports.default = GraphQLQueryReader;
62
58
  //# sourceMappingURL=graphQLQueryReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphQLQueryReader.js","sourceRoot":"","sources":["../../lib/reader/graphQLQueryReader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAC7D,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAG9C;;;;GAIG;AACH,SAAS,OAAO,CAAI,GAAQ;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,UAAU,CAAC,IAAS,EAAE,SAAS;QACzD,OAAO,IAAI,CAAC,MAAM,CACjB,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CACzD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACR,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAC9B,UAAU,CAAuC;IACjD,eAAe,CAAkC;IAEzD;QACC,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,IAAY;QACvB,MAAM,YAAY,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1C,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,CAAC;aAAM,IAAI,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,oBAAoB,CAC7B,mDAAmD,EACnD,CAAC,IAAI,CAAC,CACN,CAAC;QACH,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAe;QAC9B,OAAO,KAAK;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC9B,MAAM,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;YAC3B,OAAO,IAAI,CAAC,MAAM,CACjB,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CACzD,CAAC;QACH,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACD"}
@@ -0,0 +1,3 @@
1
+ import GraphQLQueryReader from "./graphQLQueryReader.ts";
2
+ export { GraphQLQueryReader as default };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/reader/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import GraphQLQueryReader from "./graphQLQueryReader.js";
2
+ export { GraphQLQueryReader as default };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/reader/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as fs from "fs";
2
+ interface Options {
3
+ encoding: BufferEncoding;
4
+ }
5
+ /**
6
+ * Reads files and converts them into a ReadStream
7
+ *
8
+ * @param filePath File path to read from
9
+ * @param options Options for the read stream creation
10
+ */
11
+ declare function readFile(filePath: string, options: Options): fs.ReadStream | null;
12
+ export { readFile };
13
+ export type { Options };
14
+ //# sourceMappingURL=readFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readFile.d.ts","sourceRoot":"","sources":["../../lib/reader/readFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,UAAU,OAAO;IAChB,QAAQ,EAAE,cAAc,CAAC;CACzB;AAiBD;;;;;GAKG;AACH,iBAAS,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,CAAC,UAAU,GAAG,IAAI,CAK1E;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,OAAO,EAAE,CAAC"}
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("fs");
1
+ import * as fs from "fs";
4
2
  /**
5
3
  * Determines if the file is a GraphQL file
6
4
  *
@@ -8,8 +6,12 @@ const fs = require("fs");
8
6
  */
9
7
  function isGraphQLFile(filePath) {
10
8
  const regex = /(?:\.([^.]+))?$/;
11
- const ext = regex.exec(filePath)[1];
12
- return (ext === "graphqls" || ext === "graphql");
9
+ const match = regex.exec(filePath);
10
+ if (!match) {
11
+ return false;
12
+ }
13
+ const ext = match[1];
14
+ return ext === "graphqls" || ext === "graphql";
13
15
  }
14
16
  /**
15
17
  * Reads files and converts them into a ReadStream
@@ -19,9 +21,9 @@ function isGraphQLFile(filePath) {
19
21
  */
20
22
  function readFile(filePath, options) {
21
23
  if (isGraphQLFile(filePath)) {
22
- return fs.createReadStream(filePath, options.encoding);
24
+ return fs.createReadStream(filePath, { encoding: options.encoding });
23
25
  }
24
26
  return null;
25
27
  }
26
- exports.readFile = readFile;
28
+ export { readFile };
27
29
  //# sourceMappingURL=readFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readFile.js","sourceRoot":"","sources":["../../lib/reader/readFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAMzB;;;;GAIG;AACH,SAAS,aAAa,CAAC,QAAgB;IACtC,MAAM,KAAK,GAAG,iBAAiB,CAAC;IAChC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,SAAS,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAgB;IACnD,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A Reader is responsible for reading data from an external source
3
+ */
4
+ export default interface Reader<T, V> {
5
+ /**
6
+ * Reads data from an external source defined by parameters
7
+ *
8
+ * @param toRead External source of data
9
+ */
10
+ read(toRead: T): V;
11
+ }
12
+ //# sourceMappingURL=reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../lib/reader/reader.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC,CAAC,EAAE,CAAC;IACnC;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=reader.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Fragment Templates are the primary form of encapsulation for data about a Fragment
3
+ */
4
+ export default class FragmentTemplate {
5
+ private cacheKey;
6
+ private template;
7
+ constructor(cacheKey: string, template: string);
8
+ cache(): string;
9
+ apply(): string;
10
+ }
11
+ //# sourceMappingURL=fragmentTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragmentTemplate.d.ts","sourceRoot":"","sources":["../../lib/templates/fragmentTemplate.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAEN,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK9C,KAAK,IAAI,MAAM;IAIf,KAAK,IAAI,MAAM;CAGtB"}
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  /**
4
2
  * Fragment Templates are the primary form of encapsulation for data about a Fragment
5
3
  */
6
- class FragmentTemplate {
4
+ export default class FragmentTemplate {
5
+ cacheKey;
6
+ template;
7
7
  constructor(cacheKey, template) {
8
8
  this.cacheKey = cacheKey;
9
9
  this.template = template;
@@ -15,5 +15,4 @@ class FragmentTemplate {
15
15
  return this.template;
16
16
  }
17
17
  }
18
- exports.default = FragmentTemplate;
19
18
  //# sourceMappingURL=fragmentTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragmentTemplate.js","sourceRoot":"","sources":["../../lib/templates/fragmentTemplate.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAC5B,QAAQ,CAAS;IACjB,QAAQ,CAAS;IAEzB,YAAmB,QAAgB,EAAE,QAAgB;QACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAEM,KAAK;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAEM,KAAK;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD"}
@@ -0,0 +1,4 @@
1
+ import FragmentTemplate from "./fragmentTemplate.ts";
2
+ import QueryTemplate from "./queryTemplate.ts";
3
+ export { FragmentTemplate, QueryTemplate };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import FragmentTemplate from "./fragmentTemplate.js";
2
+ import QueryTemplate from "./queryTemplate.js";
3
+ export { FragmentTemplate, QueryTemplate };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Query Templates are the primary form of encapsulation for query information
3
+ */
4
+ export default class QueryTemplate {
5
+ private cacheKey;
6
+ private template;
7
+ variables: string[];
8
+ constructor(cacheKey: string, template: string, variables: string[]);
9
+ cache(): string;
10
+ apply(variables: Record<string, any>): string;
11
+ }
12
+ //# sourceMappingURL=queryTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryTemplate.d.ts","sourceRoot":"","sources":["../../lib/templates/queryTemplate.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IACjC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;gBAG1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EAAE;IAOb,KAAK,IAAI,MAAM;IAIf,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;CASpD"}
@@ -1,10 +1,11 @@
1
- "use strict";
2
1
  /* eslint @typescript-eslint/no-explicit-any: 0 */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
2
  /**
5
3
  * Query Templates are the primary form of encapsulation for query information
6
4
  */
7
- class QueryTemplate {
5
+ export default class QueryTemplate {
6
+ cacheKey;
7
+ template;
8
+ variables;
8
9
  constructor(cacheKey, template, variables) {
9
10
  this.cacheKey = cacheKey;
10
11
  this.template = template;
@@ -15,7 +16,7 @@ class QueryTemplate {
15
16
  }
16
17
  apply(variables) {
17
18
  const entries = Object.entries(variables);
18
- entries.forEach(entry => {
19
+ entries.forEach((entry) => {
19
20
  if (this.variables.includes(entry[0])) {
20
21
  this.template = this.template.replace(entry[0], entry[1]);
21
22
  }
@@ -23,5 +24,4 @@ class QueryTemplate {
23
24
  return this.template;
24
25
  }
25
26
  }
26
- exports.default = QueryTemplate;
27
27
  //# sourceMappingURL=queryTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryTemplate.js","sourceRoot":"","sources":["../../lib/templates/queryTemplate.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IACzB,QAAQ,CAAS;IACjB,QAAQ,CAAS;IAClB,SAAS,CAAW;IAE3B,YACC,QAAgB,EAChB,QAAgB,EAChB,SAAmB;QAEnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAEM,KAAK;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,SAA8B;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1C,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3D,CAAC;QACF,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD"}
package/package.json CHANGED
@@ -1,48 +1,63 @@
1
1
  {
2
- "name": "graphql-query-parser",
3
- "repository": {
4
- "type": "git",
5
- "url": "git+https://gitlab.com/msleevi/graphql-query-parser.git"
6
- },
7
- "version": "0.0.2",
8
- "description": "A utility for parsing queries out of GraphQL files",
9
- "main": "index.ts",
10
- "scripts": {
11
- "build": "npm run build:compile && npm run test && npm run build:dependency",
12
- "build:compile": "tsc --project tsconfig.json",
13
- "build:dependency": "depcruise --exclude \"^node_modules\" --output-type dot lib | dot -T svg > dependencygraph.svg",
14
- "lint": "npm run lint:lib && npm run lint:test",
15
- "lint:lib": "eslint lib/**/*.ts",
16
- "lint:test": "eslint tests/**/*.ts",
17
- "coverage": "nyc npm run test",
18
- "test": "npm run unit && npm run integration",
19
- "unit": "mocha --opts tests/unit/mocha.opts",
20
- "integration": "mocha --opts tests/integration/mocha.opts"
21
- },
22
- "keywords": [
23
- "graphql",
24
- "parse",
25
- "query"
26
- ],
27
- "author": "Michael Sleevi <michael.sleevi@gmail.com>",
28
- "license": "MIT",
29
- "devDependencies": {
30
- "@types/chai": "^4.1.7",
31
- "@types/mocha": "^5.2.7",
32
- "@types/node": "^12.0.2",
33
- "@typescript-eslint/eslint-plugin": "^1.9.0",
34
- "@typescript-eslint/parser": "^1.9.0",
35
- "chai": "^4.2.0",
36
- "dependency-cruiser": "^4.19.1",
37
- "eslint": "^5.16.0",
38
- "eslint-plugin-mocha": "^5.3.0",
39
- "mocha": "^6.1.4",
40
- "nyc": "^14.1.1",
41
- "ts-node": "^8.2.0",
42
- "typescript": "^3.5.1"
43
- },
44
- "bugs": {
45
- "url": "https://gitlab.com/msleevi/graphql-query-parser/issues"
46
- },
47
- "homepage": "https://gitlab.com/msleevi/graphql-query-parser#readme"
2
+ "name": "graphql-query-parser",
3
+ "description": "A utility for parsing queries out of GraphQL files",
4
+ "author": "Mikey Sleevi <development@frogman.simplelogin.com>",
5
+ "version": "0.1.0",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "engines": {
9
+ "node": ">=18.0.0"
10
+ },
11
+ "keywords": [
12
+ "graphql",
13
+ "parse",
14
+ "query"
15
+ ],
16
+ "homepage": "https://github.com/iveelsm/graphql-query-parser#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/iveelsm/graphql-query-parser.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/iveelsm/graphql-query-parser/issues"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "sideEffects": false,
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js",
34
+ "default": "./dist/index.js"
35
+ }
36
+ },
37
+ "scripts": {
38
+ "build": "npm run clean && npm run build:compile",
39
+ "build:compile": "tsc --project tsconfig.json",
40
+ "build:dependency": "depcruise --exclude \"^node_modules\" --output-type dot lib | dot -T svg > dependencygraph.svg",
41
+ "clean": "rm -rf dist",
42
+ "lint": "prettier --check . && eslint .",
43
+ "lint:fix": "prettier --write . && eslint . --fix",
44
+ "coverage": "c8 --reporter=lcov --reporter=text node --import tsx --test tests/**/*-test.ts",
45
+ "test": "node --import tsx --test tests/**/*-test.ts",
46
+ "unit": "node --import tsx --test tests/unit/**/*-test.ts",
47
+ "integration": "node --import tsx --test tests/integration/**/*-test.ts"
48
+ },
49
+ "devDependencies": {
50
+ "@eslint/js": "^9.19.0",
51
+ "@tsconfig/recommended": "^1.0.13",
52
+ "@types/node": "^24.0.0",
53
+ "c8": "^10.1.3",
54
+ "dependency-cruiser": "^17.0.0",
55
+ "eslint": "^9.19.0",
56
+ "eslint-plugin-perfectionist": "^5.5.0",
57
+ "globals": "^17.0.0",
58
+ "prettier": "^3.8.1",
59
+ "tsx": "^4.21.0",
60
+ "typescript": "^5.7.3",
61
+ "typescript-eslint": "^8.22.0"
62
+ }
48
63
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"fragmentBuilder.js","sourceRoot":"","sources":["../../lib/builder/fragmentBuilder.ts"],"names":[],"mappings":";;AAEA;;;;;GAKG;AACH,MAAqB,eAAe;IAGhC;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,KAAa,EAAE,KAAY;QAC3C,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,OAA0B,EAAE,YAAoB,EAAE,KAAY;QACvF,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC,CAAC;QACvD,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,OAAe,EAAE,OAA0B,EAAE,KAAY;QACjF,MAAM,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAE9D,IAAG,mBAAmB,EAAE;YACpB,mBAAmB,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;gBAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;gBAC9D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;SACN;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,YAAoB,EAAE,KAAY;QACpE,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC;IAEO,MAAM,CAAC,eAAe,CAAC,kBAA0B;QACrD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;;AArCc,6BAAa,GAAG,2CAA2C,CAAC;AAD/E,kCAuCC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphQLQueryBuilder.js","sourceRoot":"","sources":["../../lib/builder/graphQLQueryBuilder.ts"],"names":[],"mappings":";;AAAA,iDAA0C;AAG1C,kDAAkD;AAElD;;GAEG;AACH,MAAqB,mBAAmB;IACpC;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,KAAY,EAAE,SAA8B;QAC5D,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjD,KAAI,MAAM,KAAK,IAAI,OAAO,EAAE;YACxB,OAAO,CAAC,IAAI,CAAC,sBAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;SAChE;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAfD,sCAeC"}
package/builder/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const graphQLQueryBuilder_1 = require("./graphQLQueryBuilder");
4
- exports.default = graphQLQueryBuilder_1.default;
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/builder/index.ts"],"names":[],"mappings":";;AAAA,+DAAwD;AAG7B,kBAHpB,6BAAmB,CAGQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryBuilder.js","sourceRoot":"","sources":["../../lib/builder/queryBuilder.ts"],"names":[],"mappings":";;AAAA,uDAAgD;AAGhD,uCAAgC;AAEhC,kDAAkD;AAElD;;;;;;GAMG;AACH,MAAqB,YAAY;IAC7B;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CAAC,KAAoB,EAAE,KAAY,EAAE,SAA8B;QAClF,MAAM,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,WAAW,CAAC,CAAC;QAC7C,MAAM,cAAc,GAAG,yBAAe,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACjE,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC9B,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACJ;AApBD,+BAoBC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"results.js","sourceRoot":"","sources":["../../lib/builder/results.ts"],"names":[],"mappings":";;AAEA;;;GAGG;AACH,MAAqB,OAAO;IAIxB;QACI,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,gBAAgB,GAAG;YACpB,KAAK,EAAE,IAAI,GAAG,EAAE;YAChB,QAAQ,EAAE,IAAI,GAAG,EAAE;SACtB,CAAA;IACL,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,UAAkB,EAAE,KAAa;QAC7C,IAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC7C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,MAAM,CAAC;SAClC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAC,UAAkB,EAAE,QAAgB;QACnD,IAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAChD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;SACrC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ;AA9CD,0BA8CC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../lib/cache/cache.ts"],"names":[],"mappings":";;AACA,6CAAsC;AAUtC;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAY,EAAE,OAAwB;IACxD,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACpB,IAAG,KAAK,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;QACD,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAA;AACN,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAY,EAAE,SAA6B;IAC/D,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACzB,IAAG,QAAQ,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;QACD,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,SAA6B,EAAE,OAAwB;IACvE,MAAM,KAAK,GAAG;QACV,UAAU,EAAE,IAAI,oBAAU,EAAyB;QACnD,aAAa,EAAE,IAAI,oBAAU,EAA4B;KAC5D,CAAC;IACF,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7B,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC;AACjB,CAAC;AAIG,gCAAU"}
package/cache/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cache_1 = require("./cache");
4
- exports.buildCache = cache_1.buildCache;
5
- const indexCache_1 = require("./indexCache");
6
- exports.IndexCache = indexCache_1.default;
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/cache/index.ts"],"names":[],"mappings":";;AAAA,mCAA4C;AAIxC,qBAJY,kBAAU,CAIZ;AAHd,6CAAsC;AAIlC,qBAJG,oBAAU,CAIH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexCache.js","sourceRoot":"","sources":["../../lib/cache/indexCache.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAqB,UAAU;IAG3B;QACI,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAQ,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,GAAG,CAAC,GAAM,EAAE,KAAQ;QACvB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,GAAM;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,GAAM;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACJ;AAlCD,6BAkCC"}
package/docs/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
@@ -1,17 +0,0 @@
1
- # Contributing to GraphQL Query Parser
2
-
3
- > Please read these guidelines before submitting an issue, filing a feature request, or contributing code.
4
-
5
- ## Got a Question?
6
-
7
- If you have a question about using GraphQL Query Parser, open an issue under the `Documentation` template
8
-
9
- ## I Found a Bug
10
-
11
- If you've found a bug in this project, create a [new issue](https://gitlab.com/msleevi/graphql-query-parser/issues/new). If you can fix the bug yourself, feel free to create a [pull request](#propose-a-change) thereafter.
12
-
13
- If we need more information from you, we'll let you know.
14
-
15
- ## Propose a Change
16
-
17
- If you would like to propose a change, feel free to open a Merge Request and submit the code change.
package/docs/EXAMPLES.md DELETED
@@ -1,135 +0,0 @@
1
- Getting Started
2
- ----
3
-
4
- To get started with this project, you likely already have a list of files that you want to parse, something like the following groups.
5
-
6
- *files/Authors.graphql*
7
- ```graphql
8
- query GetAuthors {
9
- authors {
10
- ... AuthorFragment
11
- books {
12
- ... BookFragment
13
- }
14
- }
15
- }
16
-
17
- fragment AuthorFragment on Author {
18
- id
19
- name
20
- email
21
- }
22
- ```
23
-
24
- *files/Books.graphql*
25
- ```graphql
26
- query GetBooks {
27
- books {
28
- ... BookFragment
29
- }
30
- }
31
-
32
- fragment BookFragment on Book {
33
- id
34
- name
35
- date
36
- publisher
37
- }
38
- ```
39
-
40
- *files/Bookstore.graphql*
41
- ```graphql
42
- query GetBooksFromBookstore {
43
- topSellers {
44
- ... BookFragment
45
- authors {
46
- ... AuthorFragment
47
- }
48
- }
49
- }
50
- ```
51
-
52
- We can then use the `graphql-query-parser` to extract the executable queries as follows.
53
-
54
- ```javascript
55
- import { GraphQLQueryParser } from 'graphql-query-parser';
56
-
57
- async function findQueries(directory) {
58
- return await GraphQLQueryParser.parse(directory);
59
- }
60
-
61
- (async function() {
62
- const results = await findQueries('files/');
63
- results.forEach((result, idx) => {
64
- console.log("\nQuery %s: \n%s", idx, result);
65
- });
66
- });
67
- ```
68
-
69
- We would see the following results:
70
-
71
- ```graphql
72
- Query 0:
73
- query GetAuthors {
74
- authors {
75
- ... AuthorFragment
76
- books {
77
- ... BookFragment
78
- }
79
- }
80
- }
81
-
82
- fragment AuthorFragment on Author {
83
- id
84
- name
85
- email
86
- }
87
-
88
- fragment BookFragment on Book {
89
- id
90
- name
91
- date
92
- publisher
93
- }
94
-
95
-
96
-
97
- Query 1:
98
- query GetBooks {
99
- books {
100
- ... BookFragment
101
- }
102
- }
103
-
104
- fragment BookFragment on Book {
105
- id
106
- name
107
- date
108
- publisher
109
- }
110
-
111
-
112
-
113
- Query 2:
114
- query GetBooksFromBookstore {
115
- topSellers {
116
- ... BookFragment
117
- authors {
118
- ... AuthorFragment
119
- }
120
- }
121
- }
122
-
123
- fragment BookFragment on Book {
124
- id
125
- name
126
- date
127
- publisher
128
- }
129
-
130
- fragment AuthorFragment on Author {
131
- id
132
- name
133
- email
134
- }
135
- ```