Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit fa3a58d

Browse files
Actual fix of compatibility with older QueryVariables API (#140)
1 parent c13c502 commit fa3a58d

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Change Log
22

3+
## UNRELEASED
4+
5+
- Actual fix of compatibility with older QueryVariables API [#140](https://github.com/hypermodeAI/functions-as/pull/140)
6+
37
## 2024-07-15 - Version 0.10.2
48

59
- No changes (re-publish of 0.10.1 to fix npm packaging issue)
610

711
## 2024-07-15 - Version 0.10.1
812

9-
- Fix compatibility with older QueryVariables API [#137](https://github.com/hypermodeAI/functions-as/pull/137)
13+
- Attempted fix compatibility with older QueryVariables API [#137](https://github.com/hypermodeAI/functions-as/pull/137)
1014

1115
## 2024-07-15 - Version 0.10.0
1216

src/assembly/compat.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ export abstract class connection {
99
/**
1010
* @deprecated Use `graphql.execute` instead.
1111
*/
12-
static invokeGraphqlApi<TData>(
12+
static invokeGraphqlApi<T>(
1313
hostName: string,
1414
statement: string,
15-
variables = new graphql.Variables(),
16-
): graphql.Response<TData> {
17-
return graphql.execute<TData>(hostName, statement, variables);
15+
variables: QueryVariables = new QueryVariables(),
16+
): GQLResponse<T> {
17+
const r = graphql.execute<T>(hostName, statement, variables);
18+
return <GQLResponse<T>>{
19+
errors: r.errors,
20+
data: r.data,
21+
};
1822
}
1923
}
2024

2125
/**
2226
* @deprecated Import `graphql`, and use `graphql.Variables` instead.
2327
*/
24-
export class QueryVariables {
25-
private qv: graphql.Variables = new graphql.Variables();
28+
export class QueryVariables extends graphql.Variables {}
2629

27-
public set<T>(name: string, value: T): void {
28-
this.qv.set(name, value);
29-
}
30-
31-
public toJSON(): string {
32-
return this.qv.toJSON();
33-
}
34-
}
30+
/**
31+
* @deprecated Import `graphql`, and use `graphql.Response` instead.
32+
*/
33+
@json
34+
export class GQLResponse<T> extends graphql.Response<T> {}

0 commit comments

Comments
 (0)