Skip to content

Commit

Permalink
Merge pull request #31 from betwixt-labs/to-JSON
Browse files Browse the repository at this point in the history
fix!: typedefs for methods
  • Loading branch information
andrewmd5 authored Jun 27, 2023
2 parents 84769cb + ad0421f commit a64f9d9
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 944 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=0.0.9
VERSION=0.0.10
8 changes: 4 additions & 4 deletions examples/typescript/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
],
"devDependencies": {
"@types/node": "^18.7.20",
"bebop-tools": "^2.8.3",
"bebop-tools": "^2.8.5",
"tsup": "^6.7.0",
"tsx": "^3.12.7",
"typescript": "^4.8.3",
"wait-port": "^1.0.4"
},
"dependencies": {
"@tempojs/client": "^0.0.6",
"@tempojs/node-http-router": "^0.0.6",
"bebop": "^2.8.3"
"@tempojs/client": "^0.0.10",
"@tempojs/node-http-router": "^0.0.10",
"bebop": "^2.8.5"
}
}
912 changes: 0 additions & 912 deletions examples/typescript/minimal/yarn.lock

This file was deleted.

8 changes: 4 additions & 4 deletions typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tempojs",
"version": "0.0.9",
"version": "0.0.10",
"description": "something",
"private": true,
"workspaces": [
Expand All @@ -26,8 +26,8 @@
"vitest": "^0.30.1"
},
"dependencies": {
"@tempojs/client": "^0.0.9",
"@tempojs/common": "^0.0.9",
"@tempojs/server": "^0.0.9"
"@tempojs/client": "^0.0.10",
"@tempojs/common": "^0.0.10",
"@tempojs/server": "^0.0.10"
}
}
4 changes: 2 additions & 2 deletions typescript/packages/cf-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tempojs/cloudflare-worker-router",
"version": "0.0.9",
"version": "0.0.10",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -19,7 +19,7 @@
"author": "andrew",
"license": "",
"dependencies": {
"@tempojs/server": "^0.0.9"
"@tempojs/server": "^0.0.10"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20221111.1"
Expand Down
4 changes: 2 additions & 2 deletions typescript/packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tempojs/client",
"version": "0.0.9",
"version": "0.0.10",
"description": "xrpc client",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -16,6 +16,6 @@
"test": "vitest"
},
"dependencies": {
"@tempojs/common": "^0.0.9"
"@tempojs/common": "^0.0.10"
}
}
4 changes: 2 additions & 2 deletions typescript/packages/client/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export abstract class BaseChannel {
case 'bebop':
return method.serialize(request);
case 'json':
return TempoUtil.utf8GetBytes(method.toJson(request));
return TempoUtil.utf8GetBytes(method.toJSON(request));
default:
throw new TempoError(TempoStatusCode.UNKNOWN_CONTENT_TYPE, `invalid request content type: ${this.contentType}`);
}
Expand All @@ -182,7 +182,7 @@ export abstract class BaseChannel {
case 'bebop':
return method.deserialize(response);
case 'json':
return method.fromJson(TempoUtil.utf8GetString(response));
return method.fromJSON(TempoUtil.utf8GetString(response));
default:
throw new TempoError(
TempoStatusCode.UNKNOWN_CONTENT_TYPE,
Expand Down
4 changes: 2 additions & 2 deletions typescript/packages/client/src/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export interface MethodInfo<TRequest extends BebopRecord, TResponse extends Bebo
* @param value - The request object to convert.
* @returns A JSON string representation of the request object.
*/
toJson(value: TRequest): string;
toJSON(value: TRequest): string;

/**
* Converts the given JSON string to a response object.
* @param data - The JSON string to convert.
* @returns The response object.
*/
fromJson(data: string): TResponse;
fromJSON(data: string): TResponse;

/**
* The type of the method.
Expand Down
4 changes: 2 additions & 2 deletions typescript/packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tempojs/common",
"version": "0.0.9",
"version": "0.0.10",
"description": "tempo common",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -13,7 +13,7 @@
}
},
"dependencies": {
"bebop": "^2.8.4"
"bebop": "^2.8.5"
},
"scripts": {
"test": "vitest"
Expand Down
2 changes: 1 addition & 1 deletion typescript/packages/common/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const TempoVersion = '0.0.9';
export const TempoVersion = '0.0.10';
4 changes: 2 additions & 2 deletions typescript/packages/node-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tempojs/node-http-router",
"version": "0.0.9",
"version": "0.0.10",
"description": "tempo node http",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -19,6 +19,6 @@
"@types/node": "^14.14.31"
},
"dependencies": {
"@tempojs/server": "^0.0.9"
"@tempojs/server": "^0.0.10"
}
}
4 changes: 2 additions & 2 deletions typescript/packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tempojs/server",
"version": "0.0.9",
"version": "0.0.10",
"description": "tempo server",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -16,6 +16,6 @@
"test": "vitest"
},
"dependencies": {
"@tempojs/common": "^0.0.9"
"@tempojs/common": "^0.0.10"
}
}
4 changes: 2 additions & 2 deletions typescript/packages/server/src/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export interface BebopMethod<TRequest extends BebopRecord, TResponse extends Beb
* @param value - The response data to convert to JSON.
* @returns The JSON string representation of the response data.
*/
toJson(value: TResponse): string;
toJSON(value: TResponse): string;

/**
* Converts the given JSON string to request data.
*
* @param data - The JSON string to convert to request data.
* @returns The request data represented by the JSON string.
*/
fromJson(data: string): TRequest;
fromJSON(data: string): TRequest;

/**
* The type of the method.
Expand Down
4 changes: 2 additions & 2 deletions typescript/packages/server/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export abstract class BaseRouter<TRequest, TEnvironment, TResponse> {
case 'bebop':
return method.deserialize(requestData);
case 'json':
return method.fromJson(TempoUtil.utf8GetString(requestData));
return method.fromJSON(TempoUtil.utf8GetString(requestData));
default:
throw new TempoError(TempoStatusCode.UNKNOWN_CONTENT_TYPE, `invalid request content type: ${contentType}`);
}
Expand All @@ -207,7 +207,7 @@ export abstract class BaseRouter<TRequest, TEnvironment, TResponse> {
case 'bebop':
return method.serialize(response);
case 'json':
return TempoUtil.utf8GetBytes(method.toJson(response));
return TempoUtil.utf8GetBytes(method.toJSON(response));
default:
throw new TempoError(TempoStatusCode.UNKNOWN_CONTENT_TYPE, `invalid response content type: ${contentType}`);
}
Expand Down
8 changes: 4 additions & 4 deletions typescript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,10 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

bebop@^2.8.4:
version "2.8.4"
resolved "https://registry.yarnpkg.com/bebop/-/bebop-2.8.4.tgz#5e7c0b9d65b585bd966311759f48762da6ab1b39"
integrity sha512-r+wQMYg0iuCqpCu4N3PTICpdAfx8ZJx117Oqb2PdpfJ0qMR9+/H3hamUNrRSpb4ROBjGe8q0oAWImBtM7tMMAA==
bebop@^2.8.5:
version "2.8.5"
resolved "https://registry.yarnpkg.com/bebop/-/bebop-2.8.5.tgz#5ccabc44100d9ba309698567e4dee44d15e6dc06"
integrity sha512-mWctvJeE7DLIHItjdbuBotpOisim4ZXz7nOiEbbnIZCO2fFie+9T0GSc00jGPOdi9sm0XppecsLl5KSyNf0RKw==

benchmark@^2.1.4:
version "2.1.4"
Expand Down

0 comments on commit a64f9d9

Please sign in to comment.