Skip to content

Commit

Permalink
Fix queries with variables returning incorrect result format
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chambers committed Jan 18, 2024
1 parent 7bef05d commit 5cf77ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,19 @@ export const connector: sdk.Connector<RawConfiguration, Configuration, State> =
request: sdk.QueryRequest
): Promise<sdk.QueryResponse> {

const rows = [];
const rowSets: sdk.RowSet[] = [];
for(const variables of request.variables ?? [{}]) {
const args = resolveArguments(request.collection, request.arguments, variables);
const result = await query(configuration, state, request.collection, args, request.query.fields ?? null);
rows.push({ '__value': result });
rowSets.push({
aggregates: {},
rows: [
{ '__value': result }
]
});
}

return [{
aggregates: {},
rows
}];
return rowSets;
},

async mutation(
Expand Down
2 changes: 1 addition & 1 deletion src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// Have this dependency defined in one place

export * as sdk from 'npm:@hasura/[email protected].6';
export * as sdk from 'npm:@hasura/[email protected].8';

0 comments on commit 5cf77ec

Please sign in to comment.