Skip to content

Commit

Permalink
Fixed queries with variables returning incorrect result format (#90)
Browse files Browse the repository at this point in the history
* Fix queries with variables returning incorrect result format
* Update changelog
  • Loading branch information
daniel-chambers authored Jan 18, 2024
1 parent 7bef05d commit f7a7b99
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ This changelog documents the changes between release versions.

Changes to be included in the next upcoming release.

Update TS SDK dependency to v1.2.8.

* Fixed issue where query response format was incorrect when variables were used in the request

## v0.22

Update TS SDK Dependency to v1.2.6.
Expand Down
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 f7a7b99

Please sign in to comment.