@restorecommerce/facade 0.1.43 → 0.1.44

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.1.44](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.1.43...@restorecommerce/facade@0.1.44) (2022-02-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **facade:** for recursive circular references (ex: attributes -> having nested attributes) ([59c2904](https://github.com/restorecommerce/libs/commit/59c29049c23ecb5f3265ea37a6757ca551023b38))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.1.43](https://github.com/restorecommerce/libs/compare/@restorecommerce/facade@0.1.42...@restorecommerce/facade@0.1.43) (2022-02-02)
7
18
 
8
19
 
@@ -72,18 +72,13 @@ const recursiveEnumCheck = (typeName, enumMap, prevFieldName, traversedFields) =
72
72
  for (let fieldName of fieldNames) {
73
73
  let fieldType = gqlFields[fieldName].type.toString();
74
74
  // if fieldType is not basic type, get the object and make recursive check till no more objects are found
75
- let skipLoop = false;
76
75
  if (exports.scalarTypes.indexOf(fieldType) <= -1) {
77
- // check if fieldName already exists in the enumMap (to avoid circular reference for infinite loop)
78
- for (let [key, val] of enumMap) {
79
- const valueArray = val.split('.');
80
- // if fieldName already exists in enumMap, this field is a circular field ref
81
- // ignore it as its already traversed and enums are kept track of
82
- if (valueArray.indexOf(fieldName) > -1) {
83
- skipLoop = true;
84
- }
76
+ // check if fieldName already exists in the traversedFields (to avoid circular reference for infinite loop)
77
+ if (traversedFields.indexOf(fieldName) <= -1) {
78
+ traversedFields.push(fieldName);
85
79
  }
86
- if (skipLoop) {
80
+ else if (traversedFields.indexOf(fieldName) > -1) {
81
+ // skip loop as this GQL type is already traversed
87
82
  continue;
88
83
  }
89
84
  if (!prevFieldName || _.isEmpty(prevFieldName)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restorecommerce/facade",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "Facade for Restorecommerce microservices",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -101,5 +101,5 @@
101
101
  "publishConfig": {
102
102
  "access": "public"
103
103
  },
104
- "gitHead": "2b4964c14cf0a66ecfaf1e0af2a6d88f9a47fba7"
104
+ "gitHead": "dd8b26367482e61ada3120acf5e96b23569580f0"
105
105
  }