Skip to content

Releases: webrpc/gen-typescript

v0.13.0: Expose as Go module

04 Apr 14:59
2f1daf9
Compare
Choose a tag to compare
Merge pull request #16 from webrpc/gomod

Expose as a Go module with //go:embed FS

v0.12.0

28 Jul 14:55
38f5b96
Compare
Choose a tag to compare
  • Backport AbortSignal feature from cohere.ai #9
  • Add check for error type #8

v0.11.2

19 Jul 10:56
f50891a
Compare
Choose a tag to compare

Fixes webrpc/webrpc#205

By @kolberg-dev.

v0.11.1

23 Mar 21:58
c9ed0dd
Compare
Choose a tag to compare

Return WebrpcRequestFailedError on net::ERR_CONNECTION_REFUSED.

v0.11.0 schema errors

23 Mar 11:53
a807898
Compare
Choose a tag to compare

See full webrpc@v0.11.0 release.

Note: Schema errors are implemented on client side only for now. TODO: Server side support.

typescript@v0.11.0 breaking client changes

  • All errors thrown by webrpc client are now instance of WebrpcError, which extends JavaScript Error. No need to re-throw errors anymore.
  • error.msg error.message
  • by default, the error messages are "human-friendly", they don't contain any details about the backend error cause
  • underlying backend error (for developers) is optionally available as error.cause?
  • error.code or error.message can be used as input for user-friendly error i18n translations

You can now check for explicit error class instance (as defined in RIDL schema) or against a generic WebrpcError class.

try {
  const resp = await testApiClient.getUser();
  // setUser(resp.user)
} catch (error) {
  if (error instanceof RateLimitedError) {
    // retry with back-off time
  }
  
  if (error instanceof UnauthorizedError) {
    // render sign-in page
  }
  
  if (error instanceof WebrpcError) {
    console.log(error.status) // print response HTTP status code (ie. 4xx or 5xx)
    console.log(error.code) // print unique schema error code; generic endpoint errors are 0
    console.log(error.message) // print error message
    console.log(error.cause) // print the underlying backend error -- ie. "DB error" - useful for debugging / reporting to Sentry
  }
  
  // setError(error.message)
}

v0.10.0: Interoperability tests

02 Jan 16:17
87775b4
Compare
Choose a tag to compare

v0.9.0: Update to webrpc@v0.9.0

28 Dec 18:40
1c79d38
Compare
Choose a tag to compare
Update templates to webrpc@v0.9.0 schema (#4)

* Update to webrpc@v0.9.0 JSON schema

* Fix generated code

* Switch webrpc to https://github.com/webrpc/webrpc/pull/171

* Update RIDL to v0.9.0

* Print all make commands

* Regenerate examples

v0.7.3: Fixes runtime template error in types.go.tmpl

21 Dec 17:41
80dcc13
Compare
Choose a tag to compare
types.go.tmpl:27:13: executing "types" at <eq (get $meta "json") "-">: error calling eq: incompatible types for comparison

Fixes webrpc/webrpc#167

v0.7.2: Adds wrapper around fetch() to add native browser support

16 Nov 15:31
1400f3e
Compare
Choose a tag to compare

v0.7.1: Standalone TypeScript generator templates

14 Nov 18:24
Compare
Choose a tag to compare

Tested with webrpc-gen v0.7.0. ✅

This version of TypeScript generator spits out generated code that is fully backward-compatible with webrpc-gen v0.6.0.

Previous version (v0.7.0) rendered an extra line compared to webrpc-gen v0.6.0.