@graphcommerce/graphql-mesh 9.0.4-canary.9 → 9.1.0-canary.16
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 +14 -0
- package/package.json +4 -4
- package/utils/traverseSelectionSet.ts +13 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/graphql-mesh",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0
|
|
5
|
+
"version": "9.1.0-canary.16",
|
|
6
6
|
"main": "index.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@whatwg-node/fetch": "^0.10.1",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@apollo/client": "*",
|
|
17
|
-
"@graphcommerce/eslint-config-pwa": "^9.0
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^9.0
|
|
19
|
-
"@graphcommerce/typescript-config-pwa": "^9.0
|
|
17
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.16",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.16",
|
|
19
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.16",
|
|
20
20
|
"@graphql-mesh/runtime": "*",
|
|
21
21
|
"@graphql-mesh/types": "*"
|
|
22
22
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SelectionNode, SelectionSetNode } from 'graphql'
|
|
2
|
-
import { Kind } from 'graphql'
|
|
1
|
+
import type { GraphQLResolveInfo, SelectionNode, SelectionSetNode } from 'graphql'
|
|
2
|
+
import { Kind, print } from 'graphql'
|
|
3
3
|
import type { Path } from 'react-hook-form'
|
|
4
4
|
|
|
5
5
|
function isNumeric(n: string) {
|
|
@@ -45,3 +45,14 @@ export function traverseSelectionSet<Q>(incomingSelectionSet: SelectionSetNode,
|
|
|
45
45
|
export function hasSelectionSetPath<Q>(selectionSet: SelectionSetNode, path: Path<Q>): boolean {
|
|
46
46
|
return traverseSelectionSet<Q>(selectionSet, path).selections.length > 0
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
/** SelectionSet template literal that accepts SelectionSetNode and returns SelectionSetNode */
|
|
50
|
+
export function selectionSetTemplate(
|
|
51
|
+
strings: TemplateStringsArray,
|
|
52
|
+
...values: SelectionSetNode[]
|
|
53
|
+
): string {
|
|
54
|
+
return strings.reduce((acc, str, i) => {
|
|
55
|
+
const value = values[i] ? values[i].selections.map((s) => print(s)).join(' ') : ''
|
|
56
|
+
return acc + str + value
|
|
57
|
+
}, '')
|
|
58
|
+
}
|