Skip to content

Commit

Permalink
🐛 Use arrow function to fix 'this' issue (#10)
Browse files Browse the repository at this point in the history
* 🐛 Use arrow function to fix 'this' issue

* 🔖 v0.0.1-alpha.11
  • Loading branch information
devkanro authored Sep 9, 2020
1 parent 2bf7d77 commit 2a5fe83
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "0.0.1-alpha.10"
"version": "0.0.1-alpha.11"
}
2 changes: 1 addition & 1 deletion packages/sisyphus-cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/sisyphus-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/cli",
"version": "0.0.1-alpha.10",
"version": "0.0.1-alpha.11",
"description": "Protobuf generator cli for sisyphus project",
"author": "Kanro <[email protected]>",
"bugs": {
Expand All @@ -24,7 +24,7 @@
"build": "tsc"
},
"dependencies": {
"@sisyphus.js/generator": "^0.0.1-alpha.10",
"@sisyphus.js/generator": "^0.0.1-alpha.11",
"commander": "^6.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sisyphus-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/sisyphus-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/core",
"version": "0.0.1-alpha.10",
"version": "0.0.1-alpha.11",
"description": "Protobuf runtime for sisyphus project on js platform",
"author": "Kanro <[email protected]>",
"bugs": {
Expand Down
6 changes: 3 additions & 3 deletions packages/sisyphus-core/src/transcoding.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Message, MessageConstructor} from "./message"
import {IRpcConfig, IRpcImpl} from "./client"
import {Method, Type} from "protobufjs"
import {Method, Type, util} from "protobufjs"
import {GrpcStatusError} from "./error";

export interface IHttpRule {
Expand Down Expand Up @@ -75,7 +75,7 @@ function getField(message: any, field: string | string[]): any {
}

for (let string of field) {
message = message[string]
message = message[util.camelCase(string)]
}
return message
}
Expand All @@ -86,7 +86,7 @@ function getFieldInfo(type: Type, field: string | string[]): Type | null {
}

for (let string of field) {
type = <any>type.fields[string].resolvedType
type = <any>type.fields[util.camelCase(string)].resolvedType
if (!type) return null
}

Expand Down
4 changes: 2 additions & 2 deletions packages/sisyphus-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sisyphus.js/generator",
"version": "0.0.1-alpha.10",
"version": "0.0.1-alpha.11",
"description": "Protobuf generator for sisyphus project on js platform",
"author": "Kanro <[email protected]>",
"bugs": {
Expand All @@ -21,7 +21,7 @@
"build": "tsc"
},
"dependencies": {
"@sisyphus.js/core": "^0.0.1-alpha.10",
"@sisyphus.js/core": "^0.0.1-alpha.11",
"change-case": "^4.1.1",
"protobufjs": "^6.10.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/sisyphus-generator/src/generator/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ServiceSpec implements GeneratorSpec {
if (method.comment != null) {
b.appendLn(normalizeComment(method.comment))
}
b.beginBlock(`async ${method.name}(input: ${this.file.typename(<any>method.resolvedRequestType)}, metadata?: { [k: string]: string }): Promise<${this.file.classname(<any>method.resolvedResponseType)}>`)
b.beginBlock(`${method.name} = async (input: ${this.file.typename(<any>method.resolvedRequestType)}, metadata?: { [k: string]: string }): Promise<${this.file.classname(<any>method.resolvedResponseType)}> =>`)
b.appendLn(`return await this.$call(this.$service.methods["${method.name}"], input, metadata)`)
b.endBlock()
}
Expand Down

0 comments on commit 2a5fe83

Please sign in to comment.