Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gen/golang/embed/static.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gen/golang/templates/types.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{$enumType := .EnumType}}
type {{$enumName}} {{$enumType}}

const (
var (
{{- range .Fields}}
{{$enumName}}_{{.Name}} {{$enumName}} = {{.Value}}
{{- end}}
Expand Down
2 changes: 1 addition & 1 deletion gen/javascript/embed/static.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gen/typescript/embed/static.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions gen/typescript/funcmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func methodInputs(in *schema.Method) (string, error) {
inputs = append(inputs, fmt.Sprintf("args: %s", methodArgumentInputInterfaceName(in)))
}
inputs = append(inputs, "headers?: object")
inputs = append(inputs, "signal?: AbortSignal")
return strings.Join(inputs, ", "), nil
}

Expand Down
6 changes: 3 additions & 3 deletions gen/typescript/templates/client.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export class {{.Name}} implements {{.Name | serviceInterfaceName}} {
return this.fetch(
this.url('{{.Name}}'),
{{- if .Inputs | len}}
createHTTPRequest(args, headers)
createHTTPRequest(args, headers, signal),
{{- else}}
createHTTPRequest({}, headers)
{{end -}}
createHTTPRequest({}, headers, signal),
{{end}}
).then((res) => {
return buildResponse(res).then(_data => {
return {
Expand Down
5 changes: 3 additions & 2 deletions gen/typescript/templates/client_helpers.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ export interface WebRPCError extends Error {
status: number
}

const createHTTPRequest = (body: object = {}, headers: object = {}): object => {
const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal = null): object => {
return {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify(body || {})
body: JSON.stringify(body || {}),
signal
}
}

Expand Down
Binary file modified linuxbuild/webrpc-gen
Binary file not shown.