lowlander 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -32
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ This project is still under heavy development. **DO NOT USE** for anything serio
|
|
|
6
6
|
|
|
7
7
|
To get an impression of what use of this framework currently looks like, check out the example project's...
|
|
8
8
|
|
|
9
|
-
- [server-side API](examples/helloworld/server/api.ts) and
|
|
10
|
-
- [client-side UI](examples/helloworld/client/js/base.ts) code.
|
|
9
|
+
- [server-side API](https://github.com/vanviegen/lowlander/blob/main/examples/helloworld/server/api.ts) and
|
|
10
|
+
- [client-side UI](https://github.com/vanviegen/lowlander/blob/main/examples/helloworld/client/js/base.ts) code.
|
|
11
11
|
|
|
12
12
|
## Tech
|
|
13
13
|
|
|
@@ -35,7 +35,7 @@ You can set a similar `EDINBURGH_LOG_LEVEL` variable to enable logging from the
|
|
|
35
35
|
|
|
36
36
|
The following is auto-generated from `server/server.ts`:
|
|
37
37
|
|
|
38
|
-
### createStreamType · [function](https://github.com/vanviegen/
|
|
38
|
+
### createStreamType · [function](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L162)
|
|
39
39
|
|
|
40
40
|
Creates a stream type for reactive model streaming to clients with automatic updates.
|
|
41
41
|
|
|
@@ -60,7 +60,7 @@ Supports nested linked models and type-safe field selection.
|
|
|
60
60
|
|
|
61
61
|
```ts
|
|
62
62
|
|
|
63
|
-
### sendModel · [function](https://github.com/vanviegen/
|
|
63
|
+
### sendModel · [function](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L262)
|
|
64
64
|
|
|
65
65
|
Sends (updated) data for `model` to `target`.
|
|
66
66
|
`target` is a virtual socket with a requestId+'d' user prefix, or a channel that subscribes such virtual sockets.
|
|
@@ -75,7 +75,7 @@ Sends (updated) data for `model` to `target`.
|
|
|
75
75
|
- `StreamType: typeof StreamTypeBase<any>`
|
|
76
76
|
- `changed?: E.Change`
|
|
77
77
|
|
|
78
|
-
### pushModel · [function](https://github.com/vanviegen/
|
|
78
|
+
### pushModel · [function](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L318)
|
|
79
79
|
|
|
80
80
|
Subscribes `target` to this model, and sends initial data.
|
|
81
81
|
`target` is a virtual socket with a requestId+'d' user prefix, or a channel that subscribes such virtual sockets.
|
|
@@ -90,7 +90,7 @@ Subscribes `target` to this model, and sends initial data.
|
|
|
90
90
|
- `SubStreamType: typeof StreamTypeBase<any>`
|
|
91
91
|
- `delta: number`
|
|
92
92
|
|
|
93
|
-
### start · [function](https://github.com/vanviegen/
|
|
93
|
+
### start · [function](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L427)
|
|
94
94
|
|
|
95
95
|
Starts the Lowlander WebSocket server.
|
|
96
96
|
|
|
@@ -112,15 +112,15 @@ const API_FILE = resolve(dirname(fileURLToPath(import.meta.url)), 'api.js');
|
|
|
112
112
|
start(API_FILE, { bind: '0.0.0.0:8080' });
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
### logLevel · [constant](https://github.com/vanviegen/
|
|
115
|
+
### logLevel · [constant](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L10)
|
|
116
116
|
|
|
117
117
|
**Value:** `number`
|
|
118
118
|
|
|
119
|
-
### warpsocket · [class](https://github.com/vanviegen/
|
|
119
|
+
### warpsocket · [class](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L13)
|
|
120
120
|
|
|
121
121
|
**Type:** `typeof import("/var/home/frank/projects/warpsocket/dist/src/index", { with: { "resolution-mode": "import" } })`
|
|
122
122
|
|
|
123
|
-
### StreamTypeBase · [abstract class](https://github.com/vanviegen/
|
|
123
|
+
### StreamTypeBase · [abstract class](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L34)
|
|
124
124
|
|
|
125
125
|
[object Object],[object Object],[object Object]
|
|
126
126
|
|
|
@@ -128,22 +128,22 @@ start(API_FILE, { bind: '0.0.0.0:8080' });
|
|
|
128
128
|
|
|
129
129
|
- `T`
|
|
130
130
|
|
|
131
|
-
#### StreamTypeBase.fields · [static property](https://github.com/vanviegen/
|
|
131
|
+
#### StreamTypeBase.fields · [static property](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L36)
|
|
132
132
|
|
|
133
133
|
**Type:** `{ [key: string]: number | true; }`
|
|
134
134
|
|
|
135
|
-
#### StreamTypeBase.id · [static property](https://github.com/vanviegen/
|
|
135
|
+
#### StreamTypeBase.id · [static property](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L38)
|
|
136
136
|
|
|
137
137
|
**Type:** `number`
|
|
138
138
|
|
|
139
|
-
#### streamTypeBase.toString · [method](https://github.com/vanviegen/
|
|
139
|
+
#### streamTypeBase.toString · [method](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L42)
|
|
140
140
|
|
|
141
141
|
**Signature:** `() => string`
|
|
142
142
|
|
|
143
143
|
**Parameters:**
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
### ServerProxy · [class](https://github.com/vanviegen/
|
|
146
|
+
### ServerProxy · [class](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L349)
|
|
147
147
|
|
|
148
148
|
Wraps a server-side API object to create a stateful, type-safe proxy accessible from clients.
|
|
149
149
|
Use for authentication, sessions, or any stateful context that persists across RPC calls.
|
|
@@ -174,14 +174,14 @@ export async function authenticate(token: string) {
|
|
|
174
174
|
- `api`: - Server-side API object exposed to the client
|
|
175
175
|
- `value`: - Value returned immediately to the client
|
|
176
176
|
|
|
177
|
-
#### serverProxy.toString · [method](https://github.com/vanviegen/
|
|
177
|
+
#### serverProxy.toString · [method](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L355)
|
|
178
178
|
|
|
179
179
|
**Signature:** `() => string`
|
|
180
180
|
|
|
181
181
|
**Parameters:**
|
|
182
182
|
|
|
183
183
|
|
|
184
|
-
### Socket · [class](https://github.com/vanviegen/
|
|
184
|
+
### Socket · [class](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L379)
|
|
185
185
|
|
|
186
186
|
Server-side socket for pushing data to a client. Server functions with `Socket<T>` parameters
|
|
187
187
|
receive client callbacks on the client side.
|
|
@@ -204,7 +204,7 @@ export function streamNumbers(socket: Socket<number>) {
|
|
|
204
204
|
api.streamNumbers(num => console.log(num));
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
#### socket.send · [method](https://github.com/vanviegen/
|
|
207
|
+
#### socket.send · [method](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L388)
|
|
208
208
|
|
|
209
209
|
Sends data to the client.
|
|
210
210
|
|
|
@@ -216,7 +216,7 @@ Sends data to the client.
|
|
|
216
216
|
|
|
217
217
|
**Returns:** `true` if sent, `false` if socket is closed
|
|
218
218
|
|
|
219
|
-
#### socket.subscribe · [method](https://github.com/vanviegen/
|
|
219
|
+
#### socket.subscribe · [method](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L394)
|
|
220
220
|
|
|
221
221
|
**Signature:** `(channel: Uint8Array<ArrayBufferLike>, delta?: number) => void`
|
|
222
222
|
|
|
@@ -225,14 +225,14 @@ Sends data to the client.
|
|
|
225
225
|
- `channel: Uint8Array`
|
|
226
226
|
- `delta: any` (optional)
|
|
227
227
|
|
|
228
|
-
#### socket.toString · [method](https://github.com/vanviegen/
|
|
228
|
+
#### socket.toString · [method](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L401)
|
|
229
229
|
|
|
230
230
|
**Signature:** `() => string`
|
|
231
231
|
|
|
232
232
|
**Parameters:**
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
#### socket.[Symbol.for('nodejs.util.inspect.custom')] · [method](https://github.com/vanviegen/
|
|
235
|
+
#### socket.[Symbol.for('nodejs.util.inspect.custom')] · [method](https://github.com/vanviegen/lowlander/blob/main/server/server.ts#L405)
|
|
236
236
|
|
|
237
237
|
**Signature:** `() => string`
|
|
238
238
|
|
|
@@ -243,13 +243,13 @@ Sends data to the client.
|
|
|
243
243
|
|
|
244
244
|
The following is auto-generated from `client/client.ts`:
|
|
245
245
|
|
|
246
|
-
### logLevel · [variable](https://github.com/vanviegen/
|
|
246
|
+
### logLevel · [variable](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L8)
|
|
247
247
|
|
|
248
248
|
Set to 1-3 for increasing verbosity.
|
|
249
249
|
|
|
250
250
|
**Value:** `number`
|
|
251
251
|
|
|
252
|
-
### ClientProxyObject · [type](https://github.com/vanviegen/
|
|
252
|
+
### ClientProxyObject · [type](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L157)
|
|
253
253
|
|
|
254
254
|
Transforms server-side API objects to client-side proxy objects with type-safe RPC methods.
|
|
255
255
|
|
|
@@ -257,7 +257,7 @@ Transforms server-side API objects to client-side proxy objects with type-safe R
|
|
|
257
257
|
[K in keyof T]: ClientProxyFunction<T[K]>
|
|
258
258
|
}`
|
|
259
259
|
|
|
260
|
-
### Connection · [class](https://github.com/vanviegen/
|
|
260
|
+
### Connection · [class](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L190)
|
|
261
261
|
|
|
262
262
|
WebSocket connection to a Lowlander server with type-safe RPC, automatic reconnection,
|
|
263
263
|
and reactive updates.
|
|
@@ -293,27 +293,27 @@ $(() => {
|
|
|
293
293
|
|
|
294
294
|
- `url`: - WebSocket URL (e.g., 'ws://localhost:8080/'), or a fake WebSocket object for testing
|
|
295
295
|
|
|
296
|
-
#### connection.ws · [property](https://github.com/vanviegen/
|
|
296
|
+
#### connection.ws · [property](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L192)
|
|
297
297
|
|
|
298
298
|
**Type:** `WebSocket`
|
|
299
299
|
|
|
300
|
-
#### connection.activeRequests · [property](https://github.com/vanviegen/
|
|
300
|
+
#### connection.activeRequests · [property](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L193)
|
|
301
301
|
|
|
302
302
|
**Type:** `Map<number, ActiveRequest>`
|
|
303
303
|
|
|
304
|
-
#### connection.requestCounter · [property](https://github.com/vanviegen/
|
|
304
|
+
#### connection.requestCounter · [property](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L194)
|
|
305
305
|
|
|
306
306
|
**Type:** `number`
|
|
307
307
|
|
|
308
|
-
#### connection.reconnectAttempts · [property](https://github.com/vanviegen/
|
|
308
|
+
#### connection.reconnectAttempts · [property](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L195)
|
|
309
309
|
|
|
310
310
|
**Type:** `number`
|
|
311
311
|
|
|
312
|
-
#### connection.onlineProxy · [property](https://github.com/vanviegen/
|
|
312
|
+
#### connection.onlineProxy · [property](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L198)
|
|
313
313
|
|
|
314
314
|
**Type:** `ValueRef<boolean>`
|
|
315
315
|
|
|
316
|
-
#### connection.api · [property](https://github.com/vanviegen/
|
|
316
|
+
#### connection.api · [property](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L205)
|
|
317
317
|
|
|
318
318
|
Type-safe proxy to the server-side API. Methods return `PromiseProxy` objects
|
|
319
319
|
that work reactively in Aberdeen scopes. `ServerProxy` returns include a
|
|
@@ -321,7 +321,7 @@ that work reactively in Aberdeen scopes. `ServerProxy` returns include a
|
|
|
321
321
|
|
|
322
322
|
**Type:** `ClientProxyObject<T>`
|
|
323
323
|
|
|
324
|
-
#### connection.isOnline · [method](https://github.com/vanviegen/
|
|
324
|
+
#### connection.isOnline · [method](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L218)
|
|
325
325
|
|
|
326
326
|
Returns the current connection status. Reactive in Aberdeen scopes.
|
|
327
327
|
|
|
@@ -330,21 +330,21 @@ Returns the current connection status. Reactive in Aberdeen scopes.
|
|
|
330
330
|
**Parameters:**
|
|
331
331
|
|
|
332
332
|
|
|
333
|
-
#### connection.connect · [method](https://github.com/vanviegen/
|
|
333
|
+
#### connection.connect · [method](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L220)
|
|
334
334
|
|
|
335
335
|
**Signature:** `() => void`
|
|
336
336
|
|
|
337
337
|
**Parameters:**
|
|
338
338
|
|
|
339
339
|
|
|
340
|
-
#### connection.reconnect · [method](https://github.com/vanviegen/
|
|
340
|
+
#### connection.reconnect · [method](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L374)
|
|
341
341
|
|
|
342
342
|
**Signature:** `() => void`
|
|
343
343
|
|
|
344
344
|
**Parameters:**
|
|
345
345
|
|
|
346
346
|
|
|
347
|
-
#### connection.pruneCommitIds · [method](https://github.com/vanviegen/
|
|
347
|
+
#### connection.pruneCommitIds · [method](https://github.com/vanviegen/lowlander/blob/main/client/client.ts#L388)
|
|
348
348
|
|
|
349
349
|
**Signature:** `(request: ActiveRequest, maxCommitId: number) => void`
|
|
350
350
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lowlander",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "TypeScript framework for data persistence, type-safe RPCs and real-time (partial) client synchronization.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/server/server.js",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"build": "tsc -b && cp -rf examples/helloworld/client/assets examples/helloworld/client/index.html build/examples/helloworld/client/ && npm run build:readme",
|
|
28
28
|
"typecheck": "bun x tsc -b",
|
|
29
29
|
"clean": "rm -rf build dist",
|
|
30
|
-
"
|
|
30
|
+
"prepack": "bun install && bun run build",
|
|
31
|
+
"build:readme": "readme-tsdoc --repo-url https://github.com/vanviegen/lowlander",
|
|
31
32
|
"test": "bun test"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|