@livestore/webmesh 0.3.0-dev.2 → 0.3.0-dev.21

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.
Files changed (48) hide show
  1. package/README.md +26 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/channel/message-channel-internal.d.ts +26 -0
  4. package/dist/channel/message-channel-internal.d.ts.map +1 -0
  5. package/dist/channel/message-channel-internal.js +217 -0
  6. package/dist/channel/message-channel-internal.js.map +1 -0
  7. package/dist/channel/message-channel.d.ts +21 -19
  8. package/dist/channel/message-channel.d.ts.map +1 -1
  9. package/dist/channel/message-channel.js +132 -162
  10. package/dist/channel/message-channel.js.map +1 -1
  11. package/dist/channel/proxy-channel.d.ts +2 -2
  12. package/dist/channel/proxy-channel.d.ts.map +1 -1
  13. package/dist/channel/proxy-channel.js +30 -11
  14. package/dist/channel/proxy-channel.js.map +1 -1
  15. package/dist/common.d.ts +32 -5
  16. package/dist/common.d.ts.map +1 -1
  17. package/dist/common.js +2 -1
  18. package/dist/common.js.map +1 -1
  19. package/dist/mesh-schema.d.ts +68 -2
  20. package/dist/mesh-schema.d.ts.map +1 -1
  21. package/dist/mesh-schema.js +53 -4
  22. package/dist/mesh-schema.js.map +1 -1
  23. package/dist/node.d.ts +31 -9
  24. package/dist/node.d.ts.map +1 -1
  25. package/dist/node.js +225 -49
  26. package/dist/node.js.map +1 -1
  27. package/dist/node.test.d.ts +1 -1
  28. package/dist/node.test.d.ts.map +1 -1
  29. package/dist/node.test.js +384 -149
  30. package/dist/node.test.js.map +1 -1
  31. package/dist/websocket-connection.d.ts +5 -6
  32. package/dist/websocket-connection.d.ts.map +1 -1
  33. package/dist/websocket-connection.js +21 -26
  34. package/dist/websocket-connection.js.map +1 -1
  35. package/dist/websocket-server.d.ts.map +1 -1
  36. package/dist/websocket-server.js +17 -3
  37. package/dist/websocket-server.js.map +1 -1
  38. package/package.json +7 -6
  39. package/src/channel/message-channel-internal.ts +356 -0
  40. package/src/channel/message-channel.ts +190 -310
  41. package/src/channel/proxy-channel.ts +257 -229
  42. package/src/common.ts +4 -2
  43. package/src/mesh-schema.ts +60 -4
  44. package/src/node.test.ts +544 -179
  45. package/src/node.ts +363 -69
  46. package/src/websocket-connection.ts +96 -95
  47. package/src/websocket-server.ts +20 -3
  48. package/tmp/pack.tgz +0 -0
package/dist/common.d.ts CHANGED
@@ -10,7 +10,7 @@ export type MessageQueueItem = {
10
10
  };
11
11
  export type MeshNodeName = string;
12
12
  export type ChannelName = string;
13
- export type ChannelKey = `${MeshNodeName}-${ChannelName}`;
13
+ export type ChannelKey = `target:${MeshNodeName}, channelName:${ChannelName}`;
14
14
  declare const NoConnectionRouteSignal_base: Schema.TaggedErrorClass<NoConnectionRouteSignal, "NoConnectionRouteSignal", {
15
15
  readonly _tag: Schema.tag<"NoConnectionRouteSignal">;
16
16
  }>;
@@ -25,7 +25,10 @@ export declare class ConnectionAlreadyExistsError extends ConnectionAlreadyExist
25
25
  }
26
26
  export declare const packetAsOtelAttributes: (packet: typeof Packet.Type) => {
27
27
  packet?: {
28
- readonly remainingHops?: undefined;
28
+ readonly remainingHops?: readonly string[] | undefined;
29
+ readonly channelVersion: number;
30
+ readonly reqId: string | undefined;
31
+ readonly sourceId: string;
29
32
  readonly id: string;
30
33
  readonly target: string;
31
34
  readonly source: string;
@@ -34,13 +37,13 @@ export declare const packetAsOtelAttributes: (packet: typeof Packet.Type) => {
34
37
  readonly _tag: "MessageChannelRequest";
35
38
  } | {
36
39
  readonly remainingHops: readonly string[];
40
+ readonly reqId: string;
37
41
  readonly id: string;
38
42
  readonly target: string;
39
43
  readonly source: string;
40
44
  readonly channelName: string;
41
45
  readonly hops: readonly string[];
42
46
  readonly _tag: "MessageChannelResponseNoTransferables";
43
- readonly reqId: string;
44
47
  } | {
45
48
  readonly remainingHops?: undefined;
46
49
  readonly id: string;
@@ -52,32 +55,56 @@ export declare const packetAsOtelAttributes: (packet: typeof Packet.Type) => {
52
55
  readonly channelIdCandidate: string;
53
56
  } | {
54
57
  readonly remainingHops: readonly string[];
58
+ readonly reqId: string;
55
59
  readonly id: string;
56
60
  readonly target: string;
57
61
  readonly source: string;
58
62
  readonly channelName: string;
59
63
  readonly hops: readonly string[];
60
64
  readonly _tag: "ProxyChannelResponseSuccess";
61
- readonly reqId: string;
62
65
  readonly channelIdCandidate: string;
63
66
  readonly combinedChannelId: string;
64
67
  } | {
65
68
  readonly remainingHops: readonly string[];
69
+ readonly reqId: string;
66
70
  readonly id: string;
67
71
  readonly target: string;
68
72
  readonly source: string;
69
73
  readonly channelName: string;
70
74
  readonly hops: readonly string[];
71
75
  readonly _tag: "ProxyChannelPayloadAck";
72
- readonly reqId: string;
73
76
  readonly combinedChannelId: string;
74
77
  } | {
75
78
  readonly id: string;
76
79
  readonly target: string;
77
80
  readonly source: string;
78
81
  readonly _tag: "NetworkConnectionAdded";
82
+ } | {
83
+ readonly id: string;
84
+ readonly target: "-";
85
+ readonly source: string;
86
+ readonly hops: readonly string[];
87
+ readonly _tag: "NetworkConnectionTopologyRequest";
88
+ } | {
89
+ readonly remainingHops: readonly string[];
90
+ readonly reqId: string;
91
+ readonly id: string;
92
+ readonly target: "-";
93
+ readonly source: string;
94
+ readonly _tag: "NetworkConnectionTopologyResponse";
95
+ readonly nodeName: string;
96
+ readonly connections: readonly string[];
97
+ } | {
98
+ readonly id: string;
99
+ readonly target: "-";
100
+ readonly source: string;
101
+ readonly channelName: string;
102
+ readonly hops: readonly string[];
103
+ readonly _tag: "BroadcastChannelPacket";
104
+ readonly payload: any;
79
105
  } | undefined;
80
106
  packetId: string;
107
+ 'span.label': string;
81
108
  };
82
109
  export {};
83
110
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAE7D,OAAO,KAAK,EA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,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CAC9E,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,OAAO,oBAAoB,CAAC,IAAI,CAAA;IACxC,eAAe,EAAE,CAAC,GAAG,EAAE,OAAO,oBAAoB,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CAChF,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAChC,MAAM,MAAM,UAAU,GAAG,UAAU,YAAY,iBAAiB,WAAW,EAAE,CAAA;;;;AAG7E,qBAAa,uBAAwB,SAAQ,4BAG5C;CAAG;;;;;;AAEJ,qBAAa,4BAA6B,SAAQ,iCAKjD;CAAG;AAEJ,eAAO,MAAM,sBAAsB,GAAI,QAAQ,OAAO,MAAM,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK/D,CAAA"}
package/dist/common.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Schema } from '@livestore/utils/effect';
1
+ import { Predicate, Schema } from '@livestore/utils/effect';
2
2
  // TODO actually use this to avoid timeouts in certain cases
3
3
  export class NoConnectionRouteSignal extends Schema.TaggedError()('NoConnectionRouteSignal', {}) {
4
4
  }
@@ -8,6 +8,7 @@ export class ConnectionAlreadyExistsError extends Schema.TaggedError()('Connecti
8
8
  }
9
9
  export const packetAsOtelAttributes = (packet) => ({
10
10
  packetId: packet.id,
11
+ 'span.label': packet.id + (Predicate.hasProperty(packet, 'reqId') && packet.reqId !== undefined ? ` for ${packet.reqId}` : ''),
11
12
  ...(packet._tag !== 'MessageChannelResponseSuccess' && packet._tag !== 'ProxyChannelPayload' ? { packet } : {}),
12
13
  });
13
14
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAmB7D,4DAA4D;AAC5D,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,WAAW,EAA2B,CACxF,yBAAyB,EACzB,EAAE,CACH;CAAG;AAEJ,MAAM,OAAO,4BAA6B,SAAQ,MAAM,CAAC,WAAW,EAAgC,CAClG,8BAA8B,EAC9B;IACE,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,MAA0B,EAAE,EAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,MAAM,CAAC,EAAE;IACnB,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,+BAA+B,IAAI,MAAM,CAAC,IAAI,KAAK,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAChH,CAAC,CAAA"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAmBxE,4DAA4D;AAC5D,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,WAAW,EAA2B,CACxF,yBAAyB,EACzB,EAAE,CACH;CAAG;AAEJ,MAAM,OAAO,4BAA6B,SAAQ,MAAM,CAAC,WAAW,EAAgC,CAClG,8BAA8B,EAC9B;IACE,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,MAA0B,EAAE,EAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,MAAM,CAAC,EAAE;IACnB,YAAY,EACV,MAAM,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClH,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,+BAA+B,IAAI,MAAM,CAAC,IAAI,KAAK,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAChH,CAAC,CAAA"}
@@ -1,18 +1,34 @@
1
1
  import { Schema } from '@livestore/utils/effect';
2
2
  declare const MessageChannelRequest_base: Schema.TaggedStruct<"MessageChannelRequest", {
3
- remainingHops: Schema.optional<typeof Schema.Undefined>;
3
+ remainingHops: Schema.optional<Schema.Array$<typeof Schema.String>>;
4
+ channelVersion: typeof Schema.Number;
5
+ /** Only set if the request is in response to an incoming request */
6
+ reqId: Schema.UndefinedOr<typeof Schema.String>;
7
+ /**
8
+ * Additionally to the `source` field, we use this field to track whether the instance of a
9
+ * source has changed.
10
+ */
11
+ sourceId: typeof Schema.String;
4
12
  id: Schema.PropertySignature<":", string, never, "?:", string | undefined, true, never>;
5
13
  target: typeof Schema.String;
6
14
  source: typeof Schema.String;
7
15
  channelName: typeof Schema.String;
8
16
  hops: Schema.Array$<typeof Schema.String>;
9
17
  }>;
18
+ /**
19
+ * Needs to go through already existing MessageChannel connections, times out otherwise
20
+ *
21
+ * Can't yet contain the `port` because the request might be duplicated while forwarding to multiple nodes.
22
+ * We need a clear path back to the sender to avoid this, thus we respond with a separate
23
+ * `MessageChannelResponseSuccess` which contains the `port`.
24
+ */
10
25
  export declare class MessageChannelRequest extends MessageChannelRequest_base {
11
26
  }
12
27
  declare const MessageChannelResponseSuccess_base: Schema.TaggedStruct<"MessageChannelResponseSuccess", {
13
28
  reqId: typeof Schema.String;
14
29
  port: Schema.Schema<MessagePort, MessagePort, never>;
15
30
  remainingHops: Schema.Array$<typeof Schema.String>;
31
+ channelVersion: typeof Schema.Number;
16
32
  id: Schema.PropertySignature<":", string, never, "?:", string | undefined, true, never>;
17
33
  target: typeof Schema.String;
18
34
  source: typeof Schema.String;
@@ -91,14 +107,64 @@ declare const NetworkConnectionAdded_base: Schema.TaggedStruct<"NetworkConnectio
91
107
  */
92
108
  export declare class NetworkConnectionAdded extends NetworkConnectionAdded_base {
93
109
  }
110
+ declare const NetworkConnectionTopologyRequest_base: Schema.TaggedStruct<"NetworkConnectionTopologyRequest", {
111
+ id: Schema.PropertySignature<":", string, never, "?:", string | undefined, true, never>;
112
+ hops: Schema.Array$<typeof Schema.String>;
113
+ /** Always fixed to who requested the topology */
114
+ source: typeof Schema.String;
115
+ target: Schema.Literal<["-"]>;
116
+ }>;
117
+ export declare class NetworkConnectionTopologyRequest extends NetworkConnectionTopologyRequest_base {
118
+ }
119
+ declare const NetworkConnectionTopologyResponse_base: Schema.TaggedStruct<"NetworkConnectionTopologyResponse", {
120
+ id: Schema.PropertySignature<":", string, never, "?:", string | undefined, true, never>;
121
+ reqId: typeof Schema.String;
122
+ remainingHops: Schema.Array$<typeof Schema.String>;
123
+ nodeName: typeof Schema.String;
124
+ connections: Schema.Array$<typeof Schema.String>;
125
+ /** Always fixed to who requested the topology */
126
+ source: typeof Schema.String;
127
+ target: Schema.Literal<["-"]>;
128
+ }>;
129
+ export declare class NetworkConnectionTopologyResponse extends NetworkConnectionTopologyResponse_base {
130
+ }
131
+ export declare const BroadcastChannelPacket: Schema.TaggedStruct<"BroadcastChannelPacket", {
132
+ id: Schema.PropertySignature<":", string, never, "?:", string | undefined, true, never>;
133
+ channelName: typeof Schema.String;
134
+ /**
135
+ * The payload is expected to be encoded/decoded by the send/listen schema.
136
+ * Transferables are not supported.
137
+ */
138
+ payload: typeof Schema.Any;
139
+ hops: Schema.Array$<typeof Schema.String>;
140
+ source: typeof Schema.String;
141
+ target: Schema.Literal<["-"]>;
142
+ }>;
94
143
  declare const MessageChannelPacket_base: Schema.Union<[typeof MessageChannelRequest, typeof MessageChannelResponseSuccess, typeof MessageChannelResponseNoTransferables]>;
95
144
  export declare class MessageChannelPacket extends MessageChannelPacket_base {
96
145
  }
97
146
  declare const ProxyChannelPacket_base: Schema.Union<[typeof ProxyChannelRequest, typeof ProxyChannelResponseSuccess, typeof ProxyChannelPayload, typeof ProxyChannelPayloadAck]>;
98
147
  export declare class ProxyChannelPacket extends ProxyChannelPacket_base {
99
148
  }
100
- declare const Packet_base: Schema.Union<[typeof MessageChannelPacket, typeof ProxyChannelPacket, typeof NetworkConnectionAdded]>;
149
+ declare const Packet_base: Schema.Union<[typeof MessageChannelPacket, typeof ProxyChannelPacket, typeof NetworkConnectionAdded, typeof NetworkConnectionTopologyRequest, typeof NetworkConnectionTopologyResponse, Schema.TaggedStruct<"BroadcastChannelPacket", {
150
+ id: Schema.PropertySignature<":", string, never, "?:", string | undefined, true, never>;
151
+ channelName: typeof Schema.String;
152
+ /**
153
+ * The payload is expected to be encoded/decoded by the send/listen schema.
154
+ * Transferables are not supported.
155
+ */
156
+ payload: typeof Schema.Any;
157
+ hops: Schema.Array$<typeof Schema.String>;
158
+ source: typeof Schema.String;
159
+ target: Schema.Literal<["-"]>;
160
+ }>]>;
101
161
  export declare class Packet extends Packet_base {
102
162
  }
163
+ declare const MessageChannelPing_base: Schema.TaggedStruct<"MessageChannelPing", {}>;
164
+ export declare class MessageChannelPing extends MessageChannelPing_base {
165
+ }
166
+ declare const MessageChannelPong_base: Schema.TaggedStruct<"MessageChannelPong", {}>;
167
+ export declare class MessageChannelPong extends MessageChannelPong_base {
168
+ }
103
169
  export {};
104
170
  //# sourceMappingURL=mesh-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-schema.d.ts","sourceRoot":"","sources":["../src/mesh-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,yBAAyB,CAAA;;;;;;;;;AAmB9D,qBAAa,qBAAsB,SAAQ,0BAGzC;CAAG;;;;;;;;;;;AAEL,qBAAa,6BAA8B,SAAQ,kCAMjD;CAAG;;;;;;;;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AAEL,eAAO,MAAM,sBAAsB;;;IAGjC;;;OAGG;;;;;EAKH,CAAA;;AAEF,qBAAa,oBAAqB,SAAQ,yBAIzC;CAAG;;AAEJ,qBAAa,kBAAmB,SAAQ,uBAKvC;CAAG;;;;IArBF;;;OAGG;;;;;;AAoBL,qBAAa,MAAO,SAAQ,WAO3B;CAAG;;AAEJ,qBAAa,kBAAmB,SAAQ,uBAA6C;CAAG;;AACxF,qBAAa,kBAAmB,SAAQ,uBAA6C;CAAG"}
@@ -9,10 +9,24 @@ const defaultPacketFields = {
9
9
  hops: Schema.Array(Schema.String),
10
10
  };
11
11
  const remainingHopsUndefined = Schema.Undefined.pipe(Schema.optional);
12
- // Needs to go through already existing MessageChannel connections, times out otherwise
12
+ /**
13
+ * Needs to go through already existing MessageChannel connections, times out otherwise
14
+ *
15
+ * Can't yet contain the `port` because the request might be duplicated while forwarding to multiple nodes.
16
+ * We need a clear path back to the sender to avoid this, thus we respond with a separate
17
+ * `MessageChannelResponseSuccess` which contains the `port`.
18
+ */
13
19
  export class MessageChannelRequest extends Schema.TaggedStruct('MessageChannelRequest', {
14
20
  ...defaultPacketFields,
15
- remainingHops: remainingHopsUndefined,
21
+ remainingHops: Schema.Array(Schema.String).pipe(Schema.optional),
22
+ channelVersion: Schema.Number,
23
+ /** Only set if the request is in response to an incoming request */
24
+ reqId: Schema.UndefinedOr(Schema.String),
25
+ /**
26
+ * Additionally to the `source` field, we use this field to track whether the instance of a
27
+ * source has changed.
28
+ */
29
+ sourceId: Schema.String,
16
30
  }) {
17
31
  }
18
32
  export class MessageChannelResponseSuccess extends Schema.TaggedStruct('MessageChannelResponseSuccess', {
@@ -21,6 +35,7 @@ export class MessageChannelResponseSuccess extends Schema.TaggedStruct('MessageC
21
35
  port: Transferable.MessagePort,
22
36
  // Since we can't copy this message, we need to follow the exact route back to the sender
23
37
  remainingHops: Schema.Array(Schema.String),
38
+ channelVersion: Schema.Number,
24
39
  }) {
25
40
  }
26
41
  export class MessageChannelResponseNoTransferables extends Schema.TaggedStruct('MessageChannelResponseNoTransferables', {
@@ -61,17 +76,51 @@ export class ProxyChannelPayloadAck extends Schema.TaggedStruct('ProxyChannelPay
61
76
  * Broadcast to all nodes when a new connection is added.
62
77
  * Mostly used for auto-reconnect purposes.
63
78
  */
64
- // TODO actually use for this use case
65
79
  export class NetworkConnectionAdded extends Schema.TaggedStruct('NetworkConnectionAdded', {
66
80
  id,
67
81
  source: Schema.String,
68
82
  target: Schema.String,
69
83
  }) {
70
84
  }
85
+ export class NetworkConnectionTopologyRequest extends Schema.TaggedStruct('NetworkConnectionTopologyRequest', {
86
+ id,
87
+ hops: Schema.Array(Schema.String),
88
+ /** Always fixed to who requested the topology */
89
+ source: Schema.String,
90
+ target: Schema.Literal('-'),
91
+ }) {
92
+ }
93
+ export class NetworkConnectionTopologyResponse extends Schema.TaggedStruct('NetworkConnectionTopologyResponse', {
94
+ id,
95
+ reqId: Schema.String,
96
+ remainingHops: Schema.Array(Schema.String),
97
+ nodeName: Schema.String,
98
+ connections: Schema.Array(Schema.String),
99
+ /** Always fixed to who requested the topology */
100
+ source: Schema.String,
101
+ target: Schema.Literal('-'),
102
+ }) {
103
+ }
104
+ export const BroadcastChannelPacket = Schema.TaggedStruct('BroadcastChannelPacket', {
105
+ id,
106
+ channelName: Schema.String,
107
+ /**
108
+ * The payload is expected to be encoded/decoded by the send/listen schema.
109
+ * Transferables are not supported.
110
+ */
111
+ payload: Schema.Any,
112
+ hops: Schema.Array(Schema.String),
113
+ source: Schema.String,
114
+ target: Schema.Literal('-'),
115
+ });
71
116
  export class MessageChannelPacket extends Schema.Union(MessageChannelRequest, MessageChannelResponseSuccess, MessageChannelResponseNoTransferables) {
72
117
  }
73
118
  export class ProxyChannelPacket extends Schema.Union(ProxyChannelRequest, ProxyChannelResponseSuccess, ProxyChannelPayload, ProxyChannelPayloadAck) {
74
119
  }
75
- export class Packet extends Schema.Union(MessageChannelPacket, ProxyChannelPacket, NetworkConnectionAdded) {
120
+ export class Packet extends Schema.Union(MessageChannelPacket, ProxyChannelPacket, NetworkConnectionAdded, NetworkConnectionTopologyRequest, NetworkConnectionTopologyResponse, BroadcastChannelPacket) {
121
+ }
122
+ export class MessageChannelPing extends Schema.TaggedStruct('MessageChannelPing', {}) {
123
+ }
124
+ export class MessageChannelPong extends Schema.TaggedStruct('MessageChannelPong', {}) {
76
125
  }
77
126
  //# sourceMappingURL=mesh-schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-schema.js","sourceRoot":"","sources":["../src/mesh-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC3B,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CACnF,CAAA;AAED,MAAM,mBAAmB,GAAG;IAC1B,EAAE;IACF,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;CAClC,CAAA;AAED,MAAM,sBAAsB,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAErE,uFAAuF;AACvF,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,YAAY,CAAC,uBAAuB,EAAE;IACtF,GAAG,mBAAmB;IACtB,aAAa,EAAE,sBAAsB;CACtC,CAAC;CAAG;AAEL,MAAM,OAAO,6BAA8B,SAAQ,MAAM,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mB,SAAQ,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE,EAAE,CAAC;CAAG;AACxF,MAAM,OAAO,kBAAmB,SAAQ,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE,EAAE,CAAC;CAAG"}
package/dist/node.d.ts CHANGED
@@ -1,14 +1,19 @@
1
- import type { Scope } from '@livestore/utils/effect';
2
- import { Cause, Duration, Effect, Schema, WebChannel } from '@livestore/utils/effect';
1
+ import { Cause, Duration, Effect, Schema, Scope, WebChannel } from '@livestore/utils/effect';
3
2
  import type { MeshNodeName } from './common.js';
4
3
  import { ConnectionAlreadyExistsError } from './common.js';
5
- import * as MeshSchema from './mesh-schema.js';
6
- type ConnectionChannel = WebChannel.WebChannel<typeof MeshSchema.Packet.Type, typeof MeshSchema.Packet.Type>;
7
- export interface MeshNode {
8
- nodeName: MeshNodeName;
4
+ import * as WebmeshSchema from './mesh-schema.js';
5
+ type ConnectionChannel = WebChannel.WebChannel<typeof WebmeshSchema.Packet.Type, typeof WebmeshSchema.Packet.Type>;
6
+ export interface MeshNode<TName extends MeshNodeName = MeshNodeName> {
7
+ nodeName: TName;
9
8
  connectionKeys: Effect.Effect<Set<MeshNodeName>>;
10
9
  debug: {
11
- printChannelQueues: () => void;
10
+ print: () => void;
11
+ /** Sends a ping message to all connected nodes and channels */
12
+ ping: (payload?: string) => void;
13
+ /**
14
+ * Requests the topology of the network from all connected nodes
15
+ */
16
+ requestTopology: (timeoutMs?: number) => Promise<void>;
12
17
  };
13
18
  /**
14
19
  * Manually adds a connection to get connected to the network of nodes with an existing WebChannel.
@@ -35,7 +40,16 @@ export interface MeshNode {
35
40
  /**
36
41
  * Tries to broker a MessageChannel connection between the nodes, otherwise will proxy messages via hop-nodes
37
42
  *
38
- * For a channel to successfully open, both sides need to have a connection and call `makeChannel`
43
+ * For a channel to successfully open, both sides need to have a connection and call `makeChannel`.
44
+ *
45
+ * Example:
46
+ * ```ts
47
+ * // Code on node A
48
+ * const channel = nodeA.makeChannel({ target: 'B', channelName: 'my-channel', schema: ... })
49
+ *
50
+ * // Code on node B
51
+ * const channel = nodeB.makeChannel({ target: 'A', channelName: 'my-channel', schema: ... })
52
+ * ```
39
53
  */
40
54
  makeChannel: <MsgListen, MsgSend>(args: {
41
55
  target: MeshNodeName;
@@ -59,7 +73,15 @@ export interface MeshNode {
59
73
  */
60
74
  timeout?: Duration.DurationInput;
61
75
  }) => Effect.Effect<WebChannel.WebChannel<MsgListen, MsgSend>, never, Scope.Scope>;
76
+ /**
77
+ * Creates a WebChannel that is broadcasted to all connected nodes.
78
+ * Messages won't be buffered for nodes that join the network after the broadcast channel has been created.
79
+ */
80
+ makeBroadcastChannel: <Msg>(args: {
81
+ channelName: string;
82
+ schema: Schema.Schema<Msg, any>;
83
+ }) => Effect.Effect<WebChannel.WebChannel<Msg, Msg>, never, Scope.Scope>;
62
84
  }
63
- export declare const makeMeshNode: (nodeName: MeshNodeName) => Effect.Effect<MeshNode, never, Scope.Scope>;
85
+ export declare const makeMeshNode: <TName extends MeshNodeName>(nodeName: TName) => Effect.Effect<MeshNode<TName>, never, Scope.Scope>;
64
86
  export {};
65
87
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EAKN,MAAM,EAEN,UAAU,EACX,MAAM,yBAAyB,CAAA;AAIhC,OAAO,KAAK,EAAc,YAAY,EAAoC,MAAM,aAAa,CAAA;AAC7F,OAAO,EAAE,4BAA4B,EAA0B,MAAM,aAAa,CAAA;AAClF,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAG9C,KAAK,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,UAAU,CAAC,MAAM,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