MCPcopy
hub / github.com/subquery/subql / bindProjections

Function bindProjections

packages/utils/src/graphql/builder.ts:50–63  ·  view source on GitHub ↗
(node: GqlNode)

Source from the content-addressed store, hash-verified

48}
49
50const bindProjections = (node: GqlNode): string => {
51 return `${node.entity} ${node.args ? `(${buildArgs(node.args)})` : ``}${
52 node.project
53 ? `{${node.project
54 .map((el: GqlNode | string) => {
55 if (typeof el === 'string') {
56 return `${el} `;
57 }
58 return `${bindProjections(el)} `;
59 })
60 .join('')}} `
61 : ``
62 }`;
63};
64
65const toVarDefs = (vars: GqlVar[]): string => {
66 return vars && vars.length ? `(${vars.map((item) => `$${item.name}:${item.gqlType}`)})` : ``;

Callers 1

buildQueryFunction · 0.85

Calls 2

buildArgsFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected