Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed connector.execute signature #35

Merged
merged 13 commits into from
Jan 21, 2020
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@youngapp/yap",
"version": "1.15.0",
"version": "1.16.0",
"description": "Yap Core",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/connectors/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export default class Connector {
/**
* Test function
*/
public test() {
public async test() {
throw new Error("Method validate is not implemented");
}

/**
* Execute function
*/
public execute(parent: any, args: any, context: Context, info: any) {
public async execute(parent: any, args: any, context: Context, info: any):Promise<any> {
throw new Error("Method validate is not implemented");
}

Expand Down
4 changes: 2 additions & 2 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Core', () => {
})
class TestConnector extends Connector {
public async execute(parent: any, args: any, context: Context, info: any) {
return new Promise(res => res(result));
return await new Promise(res => res(result));
}
}
@YapConnector({
Expand All @@ -49,7 +49,7 @@ describe('Core', () => {
description: "testDescription"
})
class TestErrorConnector extends Connector {
public execute(parent: any, args: any, context: Context, info: any) {
public async execute(parent: any, args: any, context: Context, info: any) {
throw new Error("Some error");
}
}
Expand Down