@super-line/server 0.5.0 → 0.6.0
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/dist/index.cjs +23 -0
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +23 -0
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -17162,6 +17162,29 @@ function createSuperLineServer(contract, opts) {
|
|
|
17162
17162
|
},
|
|
17163
17163
|
list() {
|
|
17164
17164
|
return Promise.resolve(store.list());
|
|
17165
|
+
},
|
|
17166
|
+
open(id, openOpts) {
|
|
17167
|
+
if (!store.open)
|
|
17168
|
+
throw new import_core2.SuperLineError("UNSUPPORTED", `Store ${name} does not support reactive open()`);
|
|
17169
|
+
const replica = store.open(id, openOpts);
|
|
17170
|
+
if (!inspectorEnabled) return replica;
|
|
17171
|
+
const origin = openOpts?.origin ?? SERVER_ORIGIN;
|
|
17172
|
+
const emit = (data) => emitInspectorEvent({ type: "store.write", store: name, id, origin, data: safeSnapshot(data) });
|
|
17173
|
+
return {
|
|
17174
|
+
...replica,
|
|
17175
|
+
set: (d) => {
|
|
17176
|
+
replica.set(d);
|
|
17177
|
+
emit(d);
|
|
17178
|
+
},
|
|
17179
|
+
update: (p) => {
|
|
17180
|
+
replica.update(p);
|
|
17181
|
+
emit(p);
|
|
17182
|
+
},
|
|
17183
|
+
delete: (path) => {
|
|
17184
|
+
replica.delete(path);
|
|
17185
|
+
emit({ delete: path });
|
|
17186
|
+
}
|
|
17187
|
+
};
|
|
17165
17188
|
}
|
|
17166
17189
|
};
|
|
17167
17190
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerMessageDef, RawConn, Serializer, ServerFrame, EmitData, ConnDescriptor, Adapter, PresenceStore, Contract, RoleOf, NodeStat, SharedEvents, SharedServerRequests, ClientInput, Output, SharedRequests, ServerInput, AnyData, RoleRequests, Events, DataOf, RoleTopics, AccessRules, Resource, Perms, SharedTopics, EventData, ServerTransport, Handshake, ServerStore } from '@super-line/core';
|
|
1
|
+
import { ServerMessageDef, RawConn, Serializer, ServerFrame, EmitData, ConnDescriptor, Adapter, PresenceStore, Contract, RoleOf, NodeStat, SharedEvents, SharedServerRequests, ClientInput, Output, SharedRequests, ServerInput, AnyData, RoleRequests, Events, DataOf, RoleTopics, AccessRules, Resource, Perms, ServerReplica, SharedTopics, EventData, ServerTransport, Handshake, ServerStore } from '@super-line/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A single client connection, passed to handlers as the third argument.
|
|
@@ -238,6 +238,15 @@ interface ServerStoreHandle {
|
|
|
238
238
|
delete(id: string): Promise<void>;
|
|
239
239
|
/** All Resource ids in this store. */
|
|
240
240
|
list(): Promise<string[]>;
|
|
241
|
+
/**
|
|
242
|
+
* Open a reactive in-process co-writer over a Resource's canonical state — the server half's mirror of
|
|
243
|
+
* `client.store(name).open(id)`. Reactive reads, merging `update`, and surgical `delete(path)` (the only
|
|
244
|
+
* way to remove a key server-side), all server-authoritative and fanned out to subscribers. `origin`
|
|
245
|
+
* (default `"server"`) tags its Changes for inspector attribution. Throws if the store has no `open`.
|
|
246
|
+
*/
|
|
247
|
+
open(id: string, opts?: {
|
|
248
|
+
origin?: string;
|
|
249
|
+
}): ServerReplica;
|
|
241
250
|
}
|
|
242
251
|
/** Options for {@link createSuperLineServer}. */
|
|
243
252
|
interface SuperLineServerOptions<C extends Contract, A extends AuthResult<C>> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerMessageDef, RawConn, Serializer, ServerFrame, EmitData, ConnDescriptor, Adapter, PresenceStore, Contract, RoleOf, NodeStat, SharedEvents, SharedServerRequests, ClientInput, Output, SharedRequests, ServerInput, AnyData, RoleRequests, Events, DataOf, RoleTopics, AccessRules, Resource, Perms, SharedTopics, EventData, ServerTransport, Handshake, ServerStore } from '@super-line/core';
|
|
1
|
+
import { ServerMessageDef, RawConn, Serializer, ServerFrame, EmitData, ConnDescriptor, Adapter, PresenceStore, Contract, RoleOf, NodeStat, SharedEvents, SharedServerRequests, ClientInput, Output, SharedRequests, ServerInput, AnyData, RoleRequests, Events, DataOf, RoleTopics, AccessRules, Resource, Perms, ServerReplica, SharedTopics, EventData, ServerTransport, Handshake, ServerStore } from '@super-line/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A single client connection, passed to handlers as the third argument.
|
|
@@ -238,6 +238,15 @@ interface ServerStoreHandle {
|
|
|
238
238
|
delete(id: string): Promise<void>;
|
|
239
239
|
/** All Resource ids in this store. */
|
|
240
240
|
list(): Promise<string[]>;
|
|
241
|
+
/**
|
|
242
|
+
* Open a reactive in-process co-writer over a Resource's canonical state — the server half's mirror of
|
|
243
|
+
* `client.store(name).open(id)`. Reactive reads, merging `update`, and surgical `delete(path)` (the only
|
|
244
|
+
* way to remove a key server-side), all server-authoritative and fanned out to subscribers. `origin`
|
|
245
|
+
* (default `"server"`) tags its Changes for inspector attribution. Throws if the store has no `open`.
|
|
246
|
+
*/
|
|
247
|
+
open(id: string, opts?: {
|
|
248
|
+
origin?: string;
|
|
249
|
+
}): ServerReplica;
|
|
241
250
|
}
|
|
242
251
|
/** Options for {@link createSuperLineServer}. */
|
|
243
252
|
interface SuperLineServerOptions<C extends Contract, A extends AuthResult<C>> {
|
package/dist/index.js
CHANGED
|
@@ -893,6 +893,29 @@ function createSuperLineServer(contract, opts) {
|
|
|
893
893
|
},
|
|
894
894
|
list() {
|
|
895
895
|
return Promise.resolve(store.list());
|
|
896
|
+
},
|
|
897
|
+
open(id, openOpts) {
|
|
898
|
+
if (!store.open)
|
|
899
|
+
throw new SuperLineError("UNSUPPORTED", `Store ${name} does not support reactive open()`);
|
|
900
|
+
const replica = store.open(id, openOpts);
|
|
901
|
+
if (!inspectorEnabled) return replica;
|
|
902
|
+
const origin = openOpts?.origin ?? SERVER_ORIGIN;
|
|
903
|
+
const emit = (data) => emitInspectorEvent({ type: "store.write", store: name, id, origin, data: safeSnapshot(data) });
|
|
904
|
+
return {
|
|
905
|
+
...replica,
|
|
906
|
+
set: (d) => {
|
|
907
|
+
replica.set(d);
|
|
908
|
+
emit(d);
|
|
909
|
+
},
|
|
910
|
+
update: (p) => {
|
|
911
|
+
replica.update(p);
|
|
912
|
+
emit(p);
|
|
913
|
+
},
|
|
914
|
+
delete: (path) => {
|
|
915
|
+
replica.delete(path);
|
|
916
|
+
emit({ delete: path });
|
|
917
|
+
}
|
|
918
|
+
};
|
|
896
919
|
}
|
|
897
920
|
};
|
|
898
921
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-line/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typesafe WebSocket server for super-line — rooms, topics, middleware, pluggable adapters.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@super-line/core": "^0.
|
|
50
|
+
"@super-line/core": "^0.6.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"zeromq": "^6.0.0",
|
|
69
69
|
"zod": "^3.24.1",
|
|
70
70
|
"zod-to-json-schema": "^3.25.2",
|
|
71
|
-
"@super-line/adapter-libp2p": "0.5.0",
|
|
72
71
|
"@super-line/adapter-zeromq": "0.5.0",
|
|
72
|
+
"@super-line/client": "0.6.0",
|
|
73
73
|
"@super-line/adapter-rabbitmq": "0.5.0",
|
|
74
|
+
"@super-line/adapter-libp2p": "0.5.0",
|
|
75
|
+
"@super-line/transport-websocket": "0.5.0",
|
|
74
76
|
"@super-line/transport-http": "0.5.0",
|
|
75
77
|
"@super-line/transport-loopback": "0.5.0",
|
|
76
|
-
"@super-line/adapter-redis": "0.5.0"
|
|
77
|
-
"@super-line/client": "0.5.0",
|
|
78
|
-
"@super-line/transport-websocket": "0.5.0"
|
|
78
|
+
"@super-line/adapter-redis": "0.5.0"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
81
|
"@standard-community/standard-json": "^0.3.5"
|