Skip to content

Commit 6ffa7ba

Browse files
authored
Merge pull request #17 from jsonjoy-com/schema
Schema
2 parents 9506713 + de2c229 commit 6ffa7ba

File tree

13 files changed

+111
-54
lines changed

13 files changed

+111
-54
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
node-version: ${{ matrix.node-version }}
2121
cache: yarn
2222
- run: yarn install --frozen-lockfile
23-
- run: yarn prettier:check
23+
- run: yarn lint
2424
- run: yarn format
2525
- run: yarn test:ci --ci
2626
- run: PORT=10000 yarn test:e2e --server http1 --suite sample-api

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"demo:ui:json": "webpack serve --config ./src/__demos__/ui-json/webpack.config.js",
5959
"demo:ui:text": "webpack serve --config ./src/__demos__/ui-text/webpack.config.js",
6060
"start:json-crdt-server:http1": "NODE_ENV=production PORT=80 JSON_CRDT_STORE=level pm2 start lib/__demos__/json-crdt-server/main-http1.js",
61-
"start": "NODE_ENV=production PORT=80 JSON_CRDT_STORE=level pm2 start lib/__demos__/json-crdt-server/main-http1.js --exp-backoff-restart-delay=100",
61+
"start": "ts-node src/__demos__/json-crdt-server/main-http1",
6262
"coverage": "yarn test --collectCoverage",
6363
"typedoc": "typedoc",
6464
"build:pages": "rimraf gh-pages && mkdir -p gh-pages && cp -r typedocs/* gh-pages && cp -r coverage gh-pages/coverage",

src/__demos__/json-crdt-server/__bench__/ping.bench.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const main = async () => {
2323
newChannel: () =>
2424
new WebSocketChannel({
2525
newSocket: () =>
26-
new WebSocket('ws://localhost:9999/rpc', [codec.specifier()], {perMessageDeflate: false}) as any,
26+
new WebSocket('ws://localhost:9999/rx', [codec.specifier()], {perMessageDeflate: false}) as any,
2727
}),
2828
},
2929
});

src/__demos__/json-crdt-server/main-http1.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Run: npx ts-node src/json-crdt-server/main-http1.ts
2-
// curl localhost:9999/rpc -H 'Content-Type: rpc.rx.compact.json' -d '[1,1,"util.ping"]'
2+
// curl localhost:9999/rpc -d '{"method": "util.ping", "id": 0}'
3+
// curl localhost:9999/rx -d '[1,1,"util.ping"]'
34

45
import {createCaller, createServices} from './routes';
56
import {RpcServer} from '../../server/http1/RpcServer';

src/__demos__/json-crdt-server/main-uws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Run: npx ts-node src/json-crdt-server/main-uws.ts
2-
// curl localhost:9999/rpc -H 'Content-Type: rpc.rx.compact.json' -d '[1,1,"util.ping"]'
2+
// curl localhost:9999/rx -d '[1,1,"util.ping"]'
33

44
import {App} from 'uWebSockets.js';
55
import {RpcApp} from '../../server/uws/RpcApp';

src/__demos__/ui-json/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {Model, Patch} from 'json-joy/lib/json-crdt';
77
/* tslint:disable no-console */
88

99
const repo = new JsonCrdtRepo({
10-
wsUrl: 'wss://demo-iasd8921ondk0.jsonjoy.com/rpc',
10+
wsUrl: 'wss://demo-iasd8921ondk0.jsonjoy.com/rx',
1111
});
1212
const id = 'block-sync-ui-demo-json';
1313
const session = repo.make(id);

src/__demos__/ui-text/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Model, Patch} from 'json-joy/lib/json-crdt';
88

99
const main = async () => {
1010
const repo = new JsonCrdtRepo({
11-
wsUrl: 'wss://demo-iasd8921ondk0.jsonjoy.com/rpc',
11+
wsUrl: 'wss://demo-iasd8921ondk0.jsonjoy.com/rx',
1212
});
1313
const id = 'block-sync-ui-demo-text-3';
1414
const session = await repo.sessions.load({id: [id], make: {}, remote: {timeout: 1000}});

src/__tests__/e2e/clients.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {StreamingRpcClient} from '../../common';
66

77
export const setupRpcPersistentClient = (codec: RpcCodec) => {
88
const port = +(process.env.PORT || 9999);
9-
const url = `ws://localhost:${port}/rpc`;
9+
const url = `ws://localhost:${port}/rx`;
1010
const client = new RpcPersistentClient({
1111
codec,
1212
channel: {
@@ -25,7 +25,7 @@ export const setupRpcPersistentClient = (codec: RpcCodec) => {
2525

2626
export const setupFetchRpcClient = (codec: RpcCodec) => {
2727
const port = +(process.env.PORT || 9999);
28-
const url = `http://localhost:${port}/rpc`;
28+
const url = `http://localhost:${port}/rx`;
2929
const client = new FetchRpcClient({
3030
url,
3131
msgCodec: codec.msg,
@@ -44,7 +44,7 @@ export const setupStreamingRpcClient = (codec: RpcCodec) => {
4444
const client = new StreamingRpcClient({
4545
send: async (messages) => {
4646
const port = +(process.env.PORT || 9999);
47-
const url = `http://localhost:${port}/rpc`;
47+
const url = `http://localhost:${port}/rx`;
4848
codec.req.encoder.writer.reset();
4949
codec.msg.encodeBatch(codec.req, messages);
5050
const body = codec.req.encoder.writer.flush();

src/__tests__/e2e/demo-client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const host = 'demo-iasd8921ondk0.jsonjoy.com';
88
// const host = '127.0.0.1:8080';
99

1010
export const setupDemoServerPersistentClient = (codec: RpcCodec) => {
11-
const url = `ws${secure ? 's' : ''}://${host}/rpc`;
11+
const url = `ws${secure ? 's' : ''}://${host}/rx`;
1212
const client = new RpcPersistentClient({
1313
codec,
1414
channel: {
@@ -26,7 +26,7 @@ export const setupDemoServerPersistentClient = (codec: RpcCodec) => {
2626
};
2727

2828
export const setupDemoServerFetchClient = (codec: RpcCodec) => {
29-
const url = `http${secure ? 's' : ''}://${host}/rpc`;
29+
const url = `http${secure ? 's' : ''}://${host}/rx`;
3030
const client = new FetchRpcClient({
3131
url,
3232
msgCodec: codec.msg,
@@ -44,7 +44,7 @@ export const setupDemoServerStreamingClient = (codec: RpcCodec) => {
4444
const contentType = 'application/x.' + protocolSpecifier;
4545
const client = new StreamingRpcClient({
4646
send: async (messages) => {
47-
const url = `http${secure ? 's' : ''}://${host}/rpc`;
47+
const url = `http${secure ? 's' : ''}://${host}/rx`;
4848
codec.req.encoder.writer.reset();
4949
codec.msg.encodeBatch(codec.req, messages);
5050
const body = codec.req.encoder.writer.flush();

src/common/rpc/caller/ObjectValueCaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class ObjectValueCaller<V extends ObjectValue<ObjectType<any>>, Ctx = unk
4343
extends RpcCaller<Ctx>
4444
implements Printable
4545
{
46-
protected readonly router: V;
46+
public readonly router: V;
4747
protected readonly system: TypeSystem;
4848
protected readonly methods = new Map<string, StaticRpcMethod<Ctx> | StreamingRpcMethod<Ctx>>();
4949

0 commit comments

Comments
 (0)