@luvio/graphql-parser 0.135.2 → 0.135.3

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.
package/dist/gql.d.ts CHANGED
@@ -33,10 +33,6 @@ export declare function processSubstitutions(inputString: ReadonlyArray<string>,
33
33
  operationString: string;
34
34
  fragments: DefinitionNode[];
35
35
  } | null;
36
- /**
37
- * strips Document node and nested definitions of location references
38
- */
39
- export declare function stripLocation(node: any): any;
40
36
  /**
41
37
  *
42
38
  * @param astReference - ast reference passed from user land
@@ -12606,8 +12606,6 @@ function transform(root) {
12606
12606
  };
12607
12607
  }
12608
12608
 
12609
- const { create, keys } = Object;
12610
-
12611
12609
  /**
12612
12610
  * we should look into optimizing this before it turns into a memory hog
12613
12611
  * weakmaps, or limiting the size of the cache, or something
@@ -12643,16 +12641,15 @@ function parseDocument(inputString) {
12643
12641
  return cachedDoc;
12644
12642
  }
12645
12643
  // parse throws an GraphQLError in case of invalid query, should this be in try/catch?
12646
- const parsedDoc = parse(inputString);
12644
+ const parsedDoc = parse(inputString, { noLocation: true });
12647
12645
  if (!parsedDoc || parsedDoc.kind !== 'Document') {
12648
12646
  if (process.env.NODE_ENV !== 'production') {
12649
12647
  throw new Error('Invalid graphql doc');
12650
12648
  }
12651
12649
  return null;
12652
12650
  }
12653
- const parsedDocNoLoc = stripLocation(parsedDoc);
12654
- docMap.set(operationKey, parsedDocNoLoc);
12655
- return parsedDocNoLoc;
12651
+ docMap.set(operationKey, parsedDoc);
12652
+ return parsedDoc;
12656
12653
  }
12657
12654
  /**
12658
12655
  * If the input string has fragment substitution
@@ -12717,22 +12714,6 @@ function processSubstitutions(inputString, substitutions) {
12717
12714
  fragments,
12718
12715
  };
12719
12716
  }
12720
- /**
12721
- * strips Document node and nested definitions of location references
12722
- */
12723
- function stripLocation(node) {
12724
- if (node.loc) {
12725
- delete node.loc;
12726
- }
12727
- const keys$1 = keys(node);
12728
- for (const key of keys$1) {
12729
- const subNode = node[key];
12730
- if (subNode && typeof subNode === 'object') {
12731
- stripLocation(subNode);
12732
- }
12733
- }
12734
- return node;
12735
- }
12736
12717
  /**
12737
12718
  *
12738
12719
  * @param astReference - ast reference passed from user land
@@ -12933,7 +12914,7 @@ function metaschemaMapper(doc) {
12933
12914
  * @deprecated In favor of gql tagged template literal
12934
12915
  */
12935
12916
  function parseAndVisit(source) {
12936
- const ast = parse(source);
12917
+ const ast = parse(source, { noLocation: true });
12937
12918
  const luvioDocumentNode = transform(ast);
12938
12919
  // In-place substitution of metaschema annotations
12939
12920
  metaschemaMapper(ast);
@@ -12602,8 +12602,6 @@ function transform(root) {
12602
12602
  };
12603
12603
  }
12604
12604
 
12605
- const { create, keys } = Object;
12606
-
12607
12605
  /**
12608
12606
  * we should look into optimizing this before it turns into a memory hog
12609
12607
  * weakmaps, or limiting the size of the cache, or something
@@ -12639,16 +12637,15 @@ function parseDocument(inputString) {
12639
12637
  return cachedDoc;
12640
12638
  }
12641
12639
  // parse throws an GraphQLError in case of invalid query, should this be in try/catch?
12642
- const parsedDoc = parse(inputString);
12640
+ const parsedDoc = parse(inputString, { noLocation: true });
12643
12641
  if (!parsedDoc || parsedDoc.kind !== 'Document') {
12644
12642
  if (process.env.NODE_ENV !== 'production') {
12645
12643
  throw new Error('Invalid graphql doc');
12646
12644
  }
12647
12645
  return null;
12648
12646
  }
12649
- const parsedDocNoLoc = stripLocation(parsedDoc);
12650
- docMap.set(operationKey, parsedDocNoLoc);
12651
- return parsedDocNoLoc;
12647
+ docMap.set(operationKey, parsedDoc);
12648
+ return parsedDoc;
12652
12649
  }
12653
12650
  /**
12654
12651
  * If the input string has fragment substitution
@@ -12713,22 +12710,6 @@ function processSubstitutions(inputString, substitutions) {
12713
12710
  fragments,
12714
12711
  };
12715
12712
  }
12716
- /**
12717
- * strips Document node and nested definitions of location references
12718
- */
12719
- function stripLocation(node) {
12720
- if (node.loc) {
12721
- delete node.loc;
12722
- }
12723
- const keys$1 = keys(node);
12724
- for (const key of keys$1) {
12725
- const subNode = node[key];
12726
- if (subNode && typeof subNode === 'object') {
12727
- stripLocation(subNode);
12728
- }
12729
- }
12730
- return node;
12731
- }
12732
12713
  /**
12733
12714
  *
12734
12715
  * @param astReference - ast reference passed from user land
@@ -12929,7 +12910,7 @@ function metaschemaMapper(doc) {
12929
12910
  * @deprecated In favor of gql tagged template literal
12930
12911
  */
12931
12912
  function parseAndVisit(source) {
12932
- const ast = parse(source);
12913
+ const ast = parse(source, { noLocation: true });
12933
12914
  const luvioDocumentNode = transform(ast);
12934
12915
  // In-place substitution of metaschema annotations
12935
12916
  metaschemaMapper(ast);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/graphql-parser",
3
- "version": "0.135.2",
3
+ "version": "0.135.3",
4
4
  "description": "GraphQL parser for Luvio GraphQL adapter support",
5
5
  "repository": {
6
6
  "type": "git",