@dxos/edge-client 0.8.1 → 0.8.2-main.2f9c567
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/lib/browser/chunk-TKYUZ5ZK.mjs +302 -0
- package/dist/lib/browser/chunk-TKYUZ5ZK.mjs.map +7 -0
- package/dist/lib/browser/edge-ws-muxer.mjs +11 -0
- package/dist/lib/browser/edge-ws-muxer.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +93 -49
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +32 -20
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/chunk-ZOL3YSDR.cjs +322 -0
- package/dist/lib/node/chunk-ZOL3YSDR.cjs.map +7 -0
- package/dist/lib/node/edge-ws-muxer.cjs +33 -0
- package/dist/lib/node/edge-ws-muxer.cjs.map +7 -0
- package/dist/lib/node/index.cjs +105 -61
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +32 -21
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/chunk-25HGRGNZ.mjs +304 -0
- package/dist/lib/node-esm/chunk-25HGRGNZ.mjs.map +7 -0
- package/dist/lib/node-esm/edge-ws-muxer.mjs +12 -0
- package/dist/lib/node-esm/edge-ws-muxer.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +93 -49
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +32 -20
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/edge-client.d.ts +7 -2
- package/dist/types/src/edge-client.d.ts.map +1 -1
- package/dist/types/src/edge-ws-connection.d.ts +1 -0
- package/dist/types/src/edge-ws-connection.d.ts.map +1 -1
- package/dist/types/src/edge-ws-muxer.d.ts +35 -0
- package/dist/types/src/edge-ws-muxer.d.ts.map +1 -0
- package/dist/types/src/edge-ws-muxer.test.d.ts +2 -0
- package/dist/types/src/edge-ws-muxer.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-utils.d.ts +6 -2
- package/dist/types/src/testing/test-utils.d.ts.map +1 -1
- package/package.json +19 -14
- package/src/edge-client.test.ts +5 -4
- package/src/edge-client.ts +16 -8
- package/src/edge-ws-connection.ts +36 -18
- package/src/edge-ws-muxer.test.ts +55 -0
- package/src/edge-ws-muxer.ts +217 -0
- package/src/index.ts +1 -0
- package/src/testing/test-utils.ts +33 -26
- package/dist/lib/browser/chunk-ZWJXA37R.mjs +0 -113
- package/dist/lib/browser/chunk-ZWJXA37R.mjs.map +0 -7
- package/dist/lib/node/chunk-ANV2HBEH.cjs +0 -136
- package/dist/lib/node/chunk-ANV2HBEH.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-HNVT57AU.mjs +0 -115
- package/dist/lib/node-esm/chunk-HNVT57AU.mjs.map +0 -7
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Trigger } from '@dxos/async';
|
|
6
|
+
import { log } from '@dxos/log';
|
|
7
|
+
import { buf } from '@dxos/protocols/buf';
|
|
8
|
+
import { MessageSchema, type Message } from '@dxos/protocols/buf/dxos/edge/messenger_pb';
|
|
9
|
+
|
|
10
|
+
import { protocol } from './defs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 0000 0001 - message contains a part of segmented message chunk sequence.
|
|
14
|
+
* The next byte defines a channel id and the rest of the message contains a part of Message proto binary.
|
|
15
|
+
* Messages from different channels might interleave.
|
|
16
|
+
* When the flag is NOT set the rest of the message should be interpreted as the valid Message proto binary.
|
|
17
|
+
*/
|
|
18
|
+
const FLAG_SEGMENT_SEQ = 1;
|
|
19
|
+
/**
|
|
20
|
+
* 0000 0010 - message terminates a segmented message chunk sequence.
|
|
21
|
+
* All the chunks accumulated for the channel specified by the second byte can be concatenated
|
|
22
|
+
* and interpreted as a valid Message proto binary.
|
|
23
|
+
*/
|
|
24
|
+
const FLAG_SEGMENT_SEQ_TERMINATED = 1 << 1;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* https://developers.cloudflare.com/durable-objects/platform/limits/
|
|
28
|
+
*/
|
|
29
|
+
export const CLOUDFLARE_MESSAGE_MAX_BYTES = 1000 * 1000; // 1MB
|
|
30
|
+
export const CLOUDFLARE_RPC_MAX_BYTES = 32 * 1000 * 1000; // 32MB
|
|
31
|
+
|
|
32
|
+
const MAX_CHUNK_LENGTH = 16384;
|
|
33
|
+
const MAX_BUFFERED_AMOUNT = CLOUDFLARE_MESSAGE_MAX_BYTES;
|
|
34
|
+
const BUFFER_FULL_BACKOFF_TIMEOUT = 100;
|
|
35
|
+
|
|
36
|
+
export class WebSocketMuxer {
|
|
37
|
+
private readonly _inMessageAccumulator = new Map<number, Buffer[]>();
|
|
38
|
+
private readonly _outMessageChunks = new Map<number, MessageChunk[]>();
|
|
39
|
+
private readonly _outMessageChannelByService = new Map<string, number>();
|
|
40
|
+
|
|
41
|
+
private _sendTimeout: any | undefined;
|
|
42
|
+
|
|
43
|
+
private readonly _maxChunkLength: number;
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
private readonly _ws: WebSocketCompat,
|
|
47
|
+
config?: { maxChunkLength: number },
|
|
48
|
+
) {
|
|
49
|
+
this._maxChunkLength = config?.maxChunkLength ?? MAX_CHUNK_LENGTH;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Resolves when all the message chunks get enqueued for sending.
|
|
54
|
+
*/
|
|
55
|
+
public async send(message: Message): Promise<void> {
|
|
56
|
+
const binary = buf.toBinary(MessageSchema, message);
|
|
57
|
+
const channelId = this._resolveChannel(message);
|
|
58
|
+
if (
|
|
59
|
+
(channelId == null && binary.byteLength > CLOUDFLARE_MESSAGE_MAX_BYTES) ||
|
|
60
|
+
binary.byteLength > CLOUDFLARE_RPC_MAX_BYTES
|
|
61
|
+
) {
|
|
62
|
+
log.error('Large message dropped', {
|
|
63
|
+
byteLength: binary.byteLength,
|
|
64
|
+
serviceId: message.serviceId,
|
|
65
|
+
payload: protocol.getPayloadType(message),
|
|
66
|
+
channelId,
|
|
67
|
+
});
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (channelId == null || binary.length < this._maxChunkLength) {
|
|
72
|
+
const flags = Buffer.from([0]);
|
|
73
|
+
this._ws.send(Buffer.concat([flags, binary]));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const terminatorSentTrigger = new Trigger();
|
|
78
|
+
const messageChunks: MessageChunk[] = [];
|
|
79
|
+
for (let i = 0; i < binary.length; i += this._maxChunkLength) {
|
|
80
|
+
const chunk = binary.slice(i, i + this._maxChunkLength);
|
|
81
|
+
const isLastChunk = i + this._maxChunkLength >= binary.length;
|
|
82
|
+
if (isLastChunk) {
|
|
83
|
+
const flags = Buffer.from([FLAG_SEGMENT_SEQ | FLAG_SEGMENT_SEQ_TERMINATED, channelId]);
|
|
84
|
+
messageChunks.push({ payload: Buffer.concat([flags, chunk]), trigger: terminatorSentTrigger });
|
|
85
|
+
} else {
|
|
86
|
+
const flags = Buffer.from([FLAG_SEGMENT_SEQ, channelId]);
|
|
87
|
+
messageChunks.push({ payload: Buffer.concat([flags, chunk]) });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const queuedMessages = this._outMessageChunks.get(channelId);
|
|
92
|
+
if (queuedMessages) {
|
|
93
|
+
queuedMessages.push(...messageChunks);
|
|
94
|
+
} else {
|
|
95
|
+
this._outMessageChunks.set(channelId, messageChunks);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this._sendChunkedMessages();
|
|
99
|
+
|
|
100
|
+
return terminatorSentTrigger.wait();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public receiveData(data: Uint8Array): Message | undefined {
|
|
104
|
+
if ((data[0] & FLAG_SEGMENT_SEQ) === 0) {
|
|
105
|
+
return buf.fromBinary(MessageSchema, data.slice(1));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const [flags, channelId, ...payload] = data;
|
|
109
|
+
let chunkAccumulator = this._inMessageAccumulator.get(channelId);
|
|
110
|
+
if (chunkAccumulator) {
|
|
111
|
+
chunkAccumulator.push(Buffer.from(payload));
|
|
112
|
+
} else {
|
|
113
|
+
chunkAccumulator = [Buffer.from(payload)];
|
|
114
|
+
this._inMessageAccumulator.set(channelId, chunkAccumulator);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if ((flags & FLAG_SEGMENT_SEQ_TERMINATED) === 0) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const message = buf.fromBinary(MessageSchema, Buffer.concat(chunkAccumulator));
|
|
122
|
+
this._inMessageAccumulator.delete(channelId);
|
|
123
|
+
return message;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public destroy() {
|
|
127
|
+
if (this._sendTimeout) {
|
|
128
|
+
clearTimeout(this._sendTimeout);
|
|
129
|
+
this._sendTimeout = undefined;
|
|
130
|
+
}
|
|
131
|
+
for (const channelChunks of this._outMessageChunks.values()) {
|
|
132
|
+
channelChunks.forEach((chunk) => chunk.trigger?.wake());
|
|
133
|
+
}
|
|
134
|
+
this._outMessageChunks.clear();
|
|
135
|
+
this._inMessageAccumulator.clear();
|
|
136
|
+
this._outMessageChannelByService.clear();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private _sendChunkedMessages() {
|
|
140
|
+
if (this._sendTimeout) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const send = () => {
|
|
145
|
+
if (this._ws.readyState === WebSocket.CLOSING || this._ws.readyState === WebSocket.CLOSED) {
|
|
146
|
+
log.warn('send called for closed websocket');
|
|
147
|
+
this._sendTimeout = undefined;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let timeout = 0;
|
|
152
|
+
const emptyChannels: number[] = [];
|
|
153
|
+
for (const [channelId, messages] of this._outMessageChunks.entries()) {
|
|
154
|
+
if (this._ws.bufferedAmount != null) {
|
|
155
|
+
if (this._ws.bufferedAmount + MAX_CHUNK_LENGTH > MAX_BUFFERED_AMOUNT) {
|
|
156
|
+
timeout = BUFFER_FULL_BACKOFF_TIMEOUT;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const nextMessage = messages.shift();
|
|
162
|
+
if (nextMessage) {
|
|
163
|
+
this._ws.send(nextMessage.payload);
|
|
164
|
+
nextMessage.trigger?.wake();
|
|
165
|
+
} else {
|
|
166
|
+
emptyChannels.push(channelId);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
emptyChannels.forEach((channelId) => this._outMessageChunks.delete(channelId));
|
|
171
|
+
|
|
172
|
+
if (this._outMessageChunks.size > 0) {
|
|
173
|
+
this._sendTimeout = setTimeout(send, timeout);
|
|
174
|
+
} else {
|
|
175
|
+
this._sendTimeout = undefined;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
this._sendTimeout = setTimeout(send);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private _resolveChannel(message: Message): number | undefined {
|
|
182
|
+
if (!message.serviceId) {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
let id = this._outMessageChannelByService.get(message.serviceId);
|
|
186
|
+
if (!id) {
|
|
187
|
+
id = this._outMessageChannelByService.size + 1;
|
|
188
|
+
this._outMessageChannelByService.set(message.serviceId, id);
|
|
189
|
+
}
|
|
190
|
+
return id;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
type WebSocketCompat = {
|
|
195
|
+
readonly readyState: number;
|
|
196
|
+
/**
|
|
197
|
+
* Not available in workerd.
|
|
198
|
+
*/
|
|
199
|
+
bufferedAmount?: number;
|
|
200
|
+
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
type MessageChunk = {
|
|
204
|
+
payload: Buffer;
|
|
205
|
+
/**
|
|
206
|
+
* Wakes when the payload is enqueued by WebSocket.
|
|
207
|
+
*/
|
|
208
|
+
trigger?: Trigger;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* To avoid using isomorphic-ws on edge.
|
|
213
|
+
*/
|
|
214
|
+
enum WebSocket {
|
|
215
|
+
CLOSING = 2,
|
|
216
|
+
CLOSED = 3,
|
|
217
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,10 +6,12 @@ import WebSocket from 'isomorphic-ws';
|
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
|
+
import { EdgeWebsocketProtocol } from '@dxos/protocols';
|
|
9
10
|
import { buf } from '@dxos/protocols/buf';
|
|
10
11
|
import { MessageSchema, TextMessageSchema, type Message } from '@dxos/protocols/buf/dxos/edge/messenger_pb';
|
|
11
12
|
|
|
12
13
|
import { protocol } from '../defs';
|
|
14
|
+
import { WebSocketMuxer } from '../edge-ws-muxer';
|
|
13
15
|
import { toUint8Array } from '../protocol';
|
|
14
16
|
|
|
15
17
|
export const DEFAULT_PORT = 8080;
|
|
@@ -21,24 +23,33 @@ type TestEdgeWsServerParams = {
|
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export const createTestEdgeWsServer = async (port = DEFAULT_PORT, params?: TestEdgeWsServerParams) => {
|
|
24
|
-
const
|
|
26
|
+
const wsServer = new WebSocket.Server({
|
|
27
|
+
port,
|
|
28
|
+
verifyClient: createConnectionDelayHandler(params),
|
|
29
|
+
handleProtocols: () => [EdgeWebsocketProtocol.V1],
|
|
30
|
+
});
|
|
25
31
|
|
|
26
|
-
let connection: WebSocket | undefined;
|
|
32
|
+
let connection: { ws: WebSocket; muxer: WebSocketMuxer } | undefined;
|
|
27
33
|
|
|
28
34
|
const messageSink: any[] = [];
|
|
29
35
|
const messageSourceLog: any[] = [];
|
|
30
36
|
const closeTrigger = new Trigger();
|
|
31
|
-
const sendResponseMessage = createResponseSender(() => connection
|
|
37
|
+
const sendResponseMessage = createResponseSender(() => connection!.muxer);
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
wsServer.on('connection', (ws) => {
|
|
40
|
+
const muxer = new WebSocketMuxer(ws);
|
|
41
|
+
connection = { ws, muxer };
|
|
35
42
|
ws.on('error', (err) => log.catch(err));
|
|
36
43
|
ws.on('message', async (data) => {
|
|
37
44
|
if (String(data) === '__ping__') {
|
|
38
45
|
ws.send('__pong__');
|
|
39
46
|
return;
|
|
40
47
|
}
|
|
41
|
-
const
|
|
48
|
+
const message = muxer.receiveData(await toUint8Array(data));
|
|
49
|
+
if (!message) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const { request, requestPayload } = await decodePayload(message, params);
|
|
42
53
|
messageSourceLog.push(request.source);
|
|
43
54
|
if (params?.messageHandler) {
|
|
44
55
|
const responsePayload = await params.messageHandler(requestPayload);
|
|
@@ -57,19 +68,19 @@ export const createTestEdgeWsServer = async (port = DEFAULT_PORT, params?: TestE
|
|
|
57
68
|
});
|
|
58
69
|
|
|
59
70
|
return {
|
|
60
|
-
server,
|
|
71
|
+
server: wsServer,
|
|
61
72
|
messageSink,
|
|
62
73
|
messageSourceLog,
|
|
63
|
-
endpoint: `ws://
|
|
64
|
-
cleanup: () =>
|
|
74
|
+
endpoint: `ws://127.0.0.1:${port}`,
|
|
75
|
+
cleanup: () => wsServer.close(),
|
|
65
76
|
currentConnection: () => connection,
|
|
66
77
|
sendResponseMessage,
|
|
67
78
|
sendMessage: (msg: Message) => {
|
|
68
|
-
connection!.send(
|
|
79
|
+
return connection!.muxer.send(msg);
|
|
69
80
|
},
|
|
70
81
|
closeConnection: () => {
|
|
71
82
|
closeTrigger.reset();
|
|
72
|
-
connection!.close(1011);
|
|
83
|
+
connection!.ws.close(1011);
|
|
73
84
|
return closeTrigger.wait();
|
|
74
85
|
},
|
|
75
86
|
};
|
|
@@ -89,27 +100,23 @@ const createConnectionDelayHandler = (params: TestEdgeWsServerParams | undefined
|
|
|
89
100
|
};
|
|
90
101
|
};
|
|
91
102
|
|
|
92
|
-
const createResponseSender = (connection: () =>
|
|
103
|
+
const createResponseSender = (connection: () => WebSocketMuxer) => {
|
|
93
104
|
return (request: Message, responsePayload: Uint8Array) => {
|
|
94
105
|
const recipient = request.source!;
|
|
95
|
-
connection().send(
|
|
96
|
-
buf.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
payload: { value: responsePayload },
|
|
105
|
-
}),
|
|
106
|
-
),
|
|
106
|
+
void connection().send(
|
|
107
|
+
buf.create(MessageSchema, {
|
|
108
|
+
source: {
|
|
109
|
+
identityKey: recipient.identityKey,
|
|
110
|
+
peerKey: recipient.peerKey,
|
|
111
|
+
},
|
|
112
|
+
serviceId: request.serviceId!,
|
|
113
|
+
payload: { value: responsePayload },
|
|
114
|
+
}),
|
|
107
115
|
);
|
|
108
116
|
};
|
|
109
117
|
};
|
|
110
118
|
|
|
111
|
-
const
|
|
112
|
-
const request = buf.fromBinary(MessageSchema, await toUint8Array(data));
|
|
119
|
+
const decodePayload = async (request: Message, params: TestEdgeWsServerParams | undefined) => {
|
|
113
120
|
const requestPayload = params?.payloadDecoder
|
|
114
121
|
? params.payloadDecoder(request.payload!.value!)
|
|
115
122
|
: protocol.getPayload(request, TextMessageSchema);
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// packages/core/mesh/edge-client/src/protocol.ts
|
|
2
|
-
import { invariant } from "@dxos/invariant";
|
|
3
|
-
import { buf, bufWkt } from "@dxos/protocols/buf";
|
|
4
|
-
import { MessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
5
|
-
import { bufferToArray } from "@dxos/util";
|
|
6
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/protocol.ts";
|
|
7
|
-
var getTypename = (typeName) => `type.googleapis.com/${typeName}`;
|
|
8
|
-
var Protocol = class {
|
|
9
|
-
constructor(types) {
|
|
10
|
-
this._typeRegistry = buf.createRegistry(...types);
|
|
11
|
-
}
|
|
12
|
-
get typeRegistry() {
|
|
13
|
-
return this._typeRegistry;
|
|
14
|
-
}
|
|
15
|
-
toJson(message) {
|
|
16
|
-
try {
|
|
17
|
-
return buf.toJson(MessageSchema, message, {
|
|
18
|
-
registry: this.typeRegistry
|
|
19
|
-
});
|
|
20
|
-
} catch (err) {
|
|
21
|
-
return {
|
|
22
|
-
type: this.getPayloadType(message)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Return the payload with the given type.
|
|
28
|
-
*/
|
|
29
|
-
getPayload(message, type) {
|
|
30
|
-
invariant(message.payload, void 0, {
|
|
31
|
-
F: __dxlog_file,
|
|
32
|
-
L: 40,
|
|
33
|
-
S: this,
|
|
34
|
-
A: [
|
|
35
|
-
"message.payload",
|
|
36
|
-
""
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
const payloadTypename = this.getPayloadType(message);
|
|
40
|
-
if (type && type.typeName !== payloadTypename) {
|
|
41
|
-
throw new Error(`Unexpected payload type: ${payloadTypename}; expected ${type.typeName}`);
|
|
42
|
-
}
|
|
43
|
-
invariant(bufWkt.anyIs(message.payload, type), `Unexpected payload type: ${payloadTypename}}`, {
|
|
44
|
-
F: __dxlog_file,
|
|
45
|
-
L: 46,
|
|
46
|
-
S: this,
|
|
47
|
-
A: [
|
|
48
|
-
"bufWkt.anyIs(message.payload, type)",
|
|
49
|
-
"`Unexpected payload type: ${payloadTypename}}`"
|
|
50
|
-
]
|
|
51
|
-
});
|
|
52
|
-
const payload = bufWkt.anyUnpack(message.payload, this.typeRegistry);
|
|
53
|
-
invariant(payload, `Empty payload: ${payloadTypename}}`, {
|
|
54
|
-
F: __dxlog_file,
|
|
55
|
-
L: 48,
|
|
56
|
-
S: this,
|
|
57
|
-
A: [
|
|
58
|
-
"payload",
|
|
59
|
-
"`Empty payload: ${payloadTypename}}`"
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
return payload;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get the payload type.
|
|
66
|
-
*/
|
|
67
|
-
getPayloadType(message) {
|
|
68
|
-
if (!message.payload) {
|
|
69
|
-
return void 0;
|
|
70
|
-
}
|
|
71
|
-
const [, type] = message.payload.typeUrl.split("/");
|
|
72
|
-
return type;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Create a packed message.
|
|
76
|
-
*/
|
|
77
|
-
createMessage(type, { source, target, payload, serviceId }) {
|
|
78
|
-
return buf.create(MessageSchema, {
|
|
79
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
80
|
-
source,
|
|
81
|
-
target,
|
|
82
|
-
serviceId,
|
|
83
|
-
payload: payload ? bufWkt.anyPack(type, buf.create(type, payload)) : void 0
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
var toUint8Array = async (data) => {
|
|
88
|
-
if (data instanceof Buffer) {
|
|
89
|
-
return bufferToArray(data);
|
|
90
|
-
}
|
|
91
|
-
if (data instanceof Blob) {
|
|
92
|
-
return new Uint8Array(await data.arrayBuffer());
|
|
93
|
-
}
|
|
94
|
-
throw new Error(`Unexpected datatype: ${data}`);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// packages/core/mesh/edge-client/src/defs.ts
|
|
98
|
-
import { bufWkt as bufWkt2 } from "@dxos/protocols/buf";
|
|
99
|
-
import { SwarmRequestSchema, SwarmResponseSchema, TextMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
100
|
-
var protocol = new Protocol([
|
|
101
|
-
SwarmRequestSchema,
|
|
102
|
-
SwarmResponseSchema,
|
|
103
|
-
TextMessageSchema,
|
|
104
|
-
bufWkt2.AnySchema
|
|
105
|
-
]);
|
|
106
|
-
|
|
107
|
-
export {
|
|
108
|
-
getTypename,
|
|
109
|
-
Protocol,
|
|
110
|
-
toUint8Array,
|
|
111
|
-
protocol
|
|
112
|
-
};
|
|
113
|
-
//# sourceMappingURL=chunk-ZWJXA37R.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/protocol.ts", "../../../src/defs.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport { buf, bufWkt } from '@dxos/protocols/buf';\nimport { type Message, MessageSchema, type PeerSchema } from '@dxos/protocols/buf/dxos/edge/messenger_pb';\nimport { bufferToArray } from '@dxos/util';\n\nexport type PeerData = buf.MessageInitShape<typeof PeerSchema>;\n\nexport const getTypename = (typeName: string) => `type.googleapis.com/${typeName}`;\n\n/**\n * NOTE: The type registry should be extended with all message types.\n */\nexport class Protocol {\n private readonly _typeRegistry: buf.Registry;\n\n constructor(types: buf.DescMessage[]) {\n this._typeRegistry = buf.createRegistry(...types);\n }\n\n get typeRegistry(): buf.Registry {\n return this._typeRegistry;\n }\n\n toJson(message: Message): any {\n try {\n return buf.toJson(MessageSchema, message, { registry: this.typeRegistry });\n } catch (err) {\n return { type: this.getPayloadType(message) };\n }\n }\n\n /**\n * Return the payload with the given type.\n */\n getPayload<Desc extends buf.DescMessage>(message: Message, type: Desc): buf.MessageShape<Desc> {\n invariant(message.payload);\n const payloadTypename = this.getPayloadType(message);\n if (type && type.typeName !== payloadTypename) {\n throw new Error(`Unexpected payload type: ${payloadTypename}; expected ${type.typeName}`);\n }\n\n invariant(bufWkt.anyIs(message.payload, type), `Unexpected payload type: ${payloadTypename}}`);\n const payload = bufWkt.anyUnpack(message.payload, this.typeRegistry) as buf.MessageShape<Desc>;\n invariant(payload, `Empty payload: ${payloadTypename}}`);\n return payload;\n }\n\n /**\n * Get the payload type.\n */\n getPayloadType(message: Message): string | undefined {\n if (!message.payload) {\n return undefined;\n }\n\n const [, type] = message.payload.typeUrl.split('/');\n return type;\n }\n\n /**\n * Create a packed message.\n */\n createMessage<Desc extends buf.DescMessage>(\n type: Desc,\n {\n source,\n target,\n payload,\n serviceId,\n }: {\n source?: PeerData;\n target?: PeerData[];\n payload?: buf.MessageInitShape<Desc>;\n serviceId?: string;\n },\n ) {\n return buf.create(MessageSchema, {\n timestamp: new Date().toISOString(),\n source,\n target,\n serviceId,\n payload: payload ? bufWkt.anyPack(type, buf.create(type, payload)) : undefined,\n });\n }\n}\n\n/**\n * Convert websocket data to Uint8Array.\n */\nexport const toUint8Array = async (data: any): Promise<Uint8Array> => {\n // Node.\n if (data instanceof Buffer) {\n return bufferToArray(data);\n }\n\n // Browser.\n if (data instanceof Blob) {\n return new Uint8Array(await (data as Blob).arrayBuffer());\n }\n\n throw new Error(`Unexpected datatype: ${data}`);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { bufWkt } from '@dxos/protocols/buf';\nimport { SwarmRequestSchema, SwarmResponseSchema, TextMessageSchema } from '@dxos/protocols/buf/dxos/edge/messenger_pb';\n\nimport { Protocol } from './protocol';\n\nexport const protocol = new Protocol([SwarmRequestSchema, SwarmResponseSchema, TextMessageSchema, bufWkt.AnySchema]);\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,iBAAiB;AAC1B,SAASC,KAAKC,cAAc;AAC5B,SAAuBC,qBAAsC;AAC7D,SAASC,qBAAqB;;AAIvB,IAAMC,cAAc,CAACC,aAAqB,uBAAuBA,QAAAA;AAKjE,IAAMC,WAAN,MAAMA;EAGXC,YAAYC,OAA0B;AACpC,SAAKC,gBAAgBT,IAAIU,eAAc,GAAIF,KAAAA;EAC7C;EAEA,IAAIG,eAA6B;AAC/B,WAAO,KAAKF;EACd;EAEAG,OAAOC,SAAuB;AAC5B,QAAI;AACF,aAAOb,IAAIY,OAAOV,eAAeW,SAAS;QAAEC,UAAU,KAAKH;MAAa,CAAA;IAC1E,SAASI,KAAK;AACZ,aAAO;QAAEC,MAAM,KAAKC,eAAeJ,OAAAA;MAAS;IAC9C;EACF;;;;EAKAK,WAAyCL,SAAkBG,MAAoC;AAC7FjB,cAAUc,QAAQM,SAAO,QAAA;;;;;;;;;AACzB,UAAMC,kBAAkB,KAAKH,eAAeJ,OAAAA;AAC5C,QAAIG,QAAQA,KAAKX,aAAae,iBAAiB;AAC7C,YAAM,IAAIC,MAAM,4BAA4BD,eAAAA,cAA6BJ,KAAKX,QAAQ,EAAE;IAC1F;AAEAN,cAAUE,OAAOqB,MAAMT,QAAQM,SAASH,IAAAA,GAAO,4BAA4BI,eAAAA,KAAkB;;;;;;;;;AAC7F,UAAMD,UAAUlB,OAAOsB,UAAUV,QAAQM,SAAS,KAAKR,YAAY;AACnEZ,cAAUoB,SAAS,kBAAkBC,eAAAA,KAAkB;;;;;;;;;AACvD,WAAOD;EACT;;;;EAKAF,eAAeJ,SAAsC;AACnD,QAAI,CAACA,QAAQM,SAAS;AACpB,aAAOK;IACT;AAEA,UAAM,CAAA,EAAGR,IAAAA,IAAQH,QAAQM,QAAQM,QAAQC,MAAM,GAAA;AAC/C,WAAOV;EACT;;;;EAKAW,cACEX,MACA,EACEY,QACAC,QACAV,SACAW,UAAS,GAOX;AACA,WAAO9B,IAAI+B,OAAO7B,eAAe;MAC/B8B,YAAW,oBAAIC,KAAAA,GAAOC,YAAW;MACjCN;MACAC;MACAC;MACAX,SAASA,UAAUlB,OAAOkC,QAAQnB,MAAMhB,IAAI+B,OAAOf,MAAMG,OAAAA,CAAAA,IAAYK;IACvE,CAAA;EACF;AACF;AAKO,IAAMY,eAAe,OAAOC,SAAAA;AAEjC,MAAIA,gBAAgBC,QAAQ;AAC1B,WAAOnC,cAAckC,IAAAA;EACvB;AAGA,MAAIA,gBAAgBE,MAAM;AACxB,WAAO,IAAIC,WAAW,MAAOH,KAAcI,YAAW,CAAA;EACxD;AAEA,QAAM,IAAIpB,MAAM,wBAAwBgB,IAAAA,EAAM;AAChD;;;ACrGA,SAASK,UAAAA,eAAc;AACvB,SAASC,oBAAoBC,qBAAqBC,yBAAyB;AAIpE,IAAMC,WAAW,IAAIC,SAAS;EAACC;EAAoBC;EAAqBC;EAAmBC,QAAOC;CAAU;",
|
|
6
|
-
"names": ["invariant", "buf", "bufWkt", "MessageSchema", "bufferToArray", "getTypename", "typeName", "Protocol", "constructor", "types", "_typeRegistry", "createRegistry", "typeRegistry", "toJson", "message", "registry", "err", "type", "getPayloadType", "getPayload", "payload", "payloadTypename", "Error", "anyIs", "anyUnpack", "undefined", "typeUrl", "split", "createMessage", "source", "target", "serviceId", "create", "timestamp", "Date", "toISOString", "anyPack", "toUint8Array", "data", "Buffer", "Blob", "Uint8Array", "arrayBuffer", "bufWkt", "SwarmRequestSchema", "SwarmResponseSchema", "TextMessageSchema", "protocol", "Protocol", "SwarmRequestSchema", "SwarmResponseSchema", "TextMessageSchema", "bufWkt", "AnySchema"]
|
|
7
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var chunk_ANV2HBEH_exports = {};
|
|
20
|
-
__export(chunk_ANV2HBEH_exports, {
|
|
21
|
-
Protocol: () => Protocol,
|
|
22
|
-
getTypename: () => getTypename,
|
|
23
|
-
protocol: () => protocol,
|
|
24
|
-
toUint8Array: () => toUint8Array
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(chunk_ANV2HBEH_exports);
|
|
27
|
-
var import_invariant = require("@dxos/invariant");
|
|
28
|
-
var import_buf = require("@dxos/protocols/buf");
|
|
29
|
-
var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
|
|
30
|
-
var import_util = require("@dxos/util");
|
|
31
|
-
var import_buf2 = require("@dxos/protocols/buf");
|
|
32
|
-
var import_messenger_pb2 = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
|
|
33
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/edge-client/src/protocol.ts";
|
|
34
|
-
var getTypename = (typeName) => `type.googleapis.com/${typeName}`;
|
|
35
|
-
var Protocol = class {
|
|
36
|
-
constructor(types) {
|
|
37
|
-
this._typeRegistry = import_buf.buf.createRegistry(...types);
|
|
38
|
-
}
|
|
39
|
-
get typeRegistry() {
|
|
40
|
-
return this._typeRegistry;
|
|
41
|
-
}
|
|
42
|
-
toJson(message) {
|
|
43
|
-
try {
|
|
44
|
-
return import_buf.buf.toJson(import_messenger_pb.MessageSchema, message, {
|
|
45
|
-
registry: this.typeRegistry
|
|
46
|
-
});
|
|
47
|
-
} catch (err) {
|
|
48
|
-
return {
|
|
49
|
-
type: this.getPayloadType(message)
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Return the payload with the given type.
|
|
55
|
-
*/
|
|
56
|
-
getPayload(message, type) {
|
|
57
|
-
(0, import_invariant.invariant)(message.payload, void 0, {
|
|
58
|
-
F: __dxlog_file,
|
|
59
|
-
L: 40,
|
|
60
|
-
S: this,
|
|
61
|
-
A: [
|
|
62
|
-
"message.payload",
|
|
63
|
-
""
|
|
64
|
-
]
|
|
65
|
-
});
|
|
66
|
-
const payloadTypename = this.getPayloadType(message);
|
|
67
|
-
if (type && type.typeName !== payloadTypename) {
|
|
68
|
-
throw new Error(`Unexpected payload type: ${payloadTypename}; expected ${type.typeName}`);
|
|
69
|
-
}
|
|
70
|
-
(0, import_invariant.invariant)(import_buf.bufWkt.anyIs(message.payload, type), `Unexpected payload type: ${payloadTypename}}`, {
|
|
71
|
-
F: __dxlog_file,
|
|
72
|
-
L: 46,
|
|
73
|
-
S: this,
|
|
74
|
-
A: [
|
|
75
|
-
"bufWkt.anyIs(message.payload, type)",
|
|
76
|
-
"`Unexpected payload type: ${payloadTypename}}`"
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
|
-
const payload = import_buf.bufWkt.anyUnpack(message.payload, this.typeRegistry);
|
|
80
|
-
(0, import_invariant.invariant)(payload, `Empty payload: ${payloadTypename}}`, {
|
|
81
|
-
F: __dxlog_file,
|
|
82
|
-
L: 48,
|
|
83
|
-
S: this,
|
|
84
|
-
A: [
|
|
85
|
-
"payload",
|
|
86
|
-
"`Empty payload: ${payloadTypename}}`"
|
|
87
|
-
]
|
|
88
|
-
});
|
|
89
|
-
return payload;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Get the payload type.
|
|
93
|
-
*/
|
|
94
|
-
getPayloadType(message) {
|
|
95
|
-
if (!message.payload) {
|
|
96
|
-
return void 0;
|
|
97
|
-
}
|
|
98
|
-
const [, type] = message.payload.typeUrl.split("/");
|
|
99
|
-
return type;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Create a packed message.
|
|
103
|
-
*/
|
|
104
|
-
createMessage(type, { source, target, payload, serviceId }) {
|
|
105
|
-
return import_buf.buf.create(import_messenger_pb.MessageSchema, {
|
|
106
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
107
|
-
source,
|
|
108
|
-
target,
|
|
109
|
-
serviceId,
|
|
110
|
-
payload: payload ? import_buf.bufWkt.anyPack(type, import_buf.buf.create(type, payload)) : void 0
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var toUint8Array = async (data) => {
|
|
115
|
-
if (data instanceof Buffer) {
|
|
116
|
-
return (0, import_util.bufferToArray)(data);
|
|
117
|
-
}
|
|
118
|
-
if (data instanceof Blob) {
|
|
119
|
-
return new Uint8Array(await data.arrayBuffer());
|
|
120
|
-
}
|
|
121
|
-
throw new Error(`Unexpected datatype: ${data}`);
|
|
122
|
-
};
|
|
123
|
-
var protocol = new Protocol([
|
|
124
|
-
import_messenger_pb2.SwarmRequestSchema,
|
|
125
|
-
import_messenger_pb2.SwarmResponseSchema,
|
|
126
|
-
import_messenger_pb2.TextMessageSchema,
|
|
127
|
-
import_buf2.bufWkt.AnySchema
|
|
128
|
-
]);
|
|
129
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
-
0 && (module.exports = {
|
|
131
|
-
Protocol,
|
|
132
|
-
getTypename,
|
|
133
|
-
protocol,
|
|
134
|
-
toUint8Array
|
|
135
|
-
});
|
|
136
|
-
//# sourceMappingURL=chunk-ANV2HBEH.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/protocol.ts", "../../../src/defs.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\nimport { buf, bufWkt } from '@dxos/protocols/buf';\nimport { type Message, MessageSchema, type PeerSchema } from '@dxos/protocols/buf/dxos/edge/messenger_pb';\nimport { bufferToArray } from '@dxos/util';\n\nexport type PeerData = buf.MessageInitShape<typeof PeerSchema>;\n\nexport const getTypename = (typeName: string) => `type.googleapis.com/${typeName}`;\n\n/**\n * NOTE: The type registry should be extended with all message types.\n */\nexport class Protocol {\n private readonly _typeRegistry: buf.Registry;\n\n constructor(types: buf.DescMessage[]) {\n this._typeRegistry = buf.createRegistry(...types);\n }\n\n get typeRegistry(): buf.Registry {\n return this._typeRegistry;\n }\n\n toJson(message: Message): any {\n try {\n return buf.toJson(MessageSchema, message, { registry: this.typeRegistry });\n } catch (err) {\n return { type: this.getPayloadType(message) };\n }\n }\n\n /**\n * Return the payload with the given type.\n */\n getPayload<Desc extends buf.DescMessage>(message: Message, type: Desc): buf.MessageShape<Desc> {\n invariant(message.payload);\n const payloadTypename = this.getPayloadType(message);\n if (type && type.typeName !== payloadTypename) {\n throw new Error(`Unexpected payload type: ${payloadTypename}; expected ${type.typeName}`);\n }\n\n invariant(bufWkt.anyIs(message.payload, type), `Unexpected payload type: ${payloadTypename}}`);\n const payload = bufWkt.anyUnpack(message.payload, this.typeRegistry) as buf.MessageShape<Desc>;\n invariant(payload, `Empty payload: ${payloadTypename}}`);\n return payload;\n }\n\n /**\n * Get the payload type.\n */\n getPayloadType(message: Message): string | undefined {\n if (!message.payload) {\n return undefined;\n }\n\n const [, type] = message.payload.typeUrl.split('/');\n return type;\n }\n\n /**\n * Create a packed message.\n */\n createMessage<Desc extends buf.DescMessage>(\n type: Desc,\n {\n source,\n target,\n payload,\n serviceId,\n }: {\n source?: PeerData;\n target?: PeerData[];\n payload?: buf.MessageInitShape<Desc>;\n serviceId?: string;\n },\n ) {\n return buf.create(MessageSchema, {\n timestamp: new Date().toISOString(),\n source,\n target,\n serviceId,\n payload: payload ? bufWkt.anyPack(type, buf.create(type, payload)) : undefined,\n });\n }\n}\n\n/**\n * Convert websocket data to Uint8Array.\n */\nexport const toUint8Array = async (data: any): Promise<Uint8Array> => {\n // Node.\n if (data instanceof Buffer) {\n return bufferToArray(data);\n }\n\n // Browser.\n if (data instanceof Blob) {\n return new Uint8Array(await (data as Blob).arrayBuffer());\n }\n\n throw new Error(`Unexpected datatype: ${data}`);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { bufWkt } from '@dxos/protocols/buf';\nimport { SwarmRequestSchema, SwarmResponseSchema, TextMessageSchema } from '@dxos/protocols/buf/dxos/edge/messenger_pb';\n\nimport { Protocol } from './protocol';\n\nexport const protocol = new Protocol([SwarmRequestSchema, SwarmResponseSchema, TextMessageSchema, bufWkt.AnySchema]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,uBAA0B;AAC1B,iBAA4B;AAC5B,0BAA6D;AAC7D,kBAA8B;ACH9B,IAAAA,cAAuB;AACvB,IAAAC,uBAA2E;;ADMpE,IAAMC,cAAc,CAACC,aAAqB,uBAAuBA,QAAAA;AAKjE,IAAMC,WAAN,MAAMA;EAGXC,YAAYC,OAA0B;AACpC,SAAKC,gBAAgBC,eAAIC,eAAc,GAAIH,KAAAA;EAC7C;EAEA,IAAII,eAA6B;AAC/B,WAAO,KAAKH;EACd;EAEAI,OAAOC,SAAuB;AAC5B,QAAI;AACF,aAAOJ,eAAIG,OAAOE,mCAAeD,SAAS;QAAEE,UAAU,KAAKJ;MAAa,CAAA;IAC1E,SAASK,KAAK;AACZ,aAAO;QAAEC,MAAM,KAAKC,eAAeL,OAAAA;MAAS;IAC9C;EACF;;;;EAKAM,WAAyCN,SAAkBI,MAAoC;AAC7FG,oCAAUP,QAAQQ,SAAO,QAAA;;;;;;;;;AACzB,UAAMC,kBAAkB,KAAKJ,eAAeL,OAAAA;AAC5C,QAAII,QAAQA,KAAKb,aAAakB,iBAAiB;AAC7C,YAAM,IAAIC,MAAM,4BAA4BD,eAAAA,cAA6BL,KAAKb,QAAQ,EAAE;IAC1F;AAEAgB,oCAAUI,kBAAOC,MAAMZ,QAAQQ,SAASJ,IAAAA,GAAO,4BAA4BK,eAAAA,KAAkB;;;;;;;;;AAC7F,UAAMD,UAAUG,kBAAOE,UAAUb,QAAQQ,SAAS,KAAKV,YAAY;AACnES,oCAAUC,SAAS,kBAAkBC,eAAAA,KAAkB;;;;;;;;;AACvD,WAAOD;EACT;;;;EAKAH,eAAeL,SAAsC;AACnD,QAAI,CAACA,QAAQQ,SAAS;AACpB,aAAOM;IACT;AAEA,UAAM,CAAA,EAAGV,IAAAA,IAAQJ,QAAQQ,QAAQO,QAAQC,MAAM,GAAA;AAC/C,WAAOZ;EACT;;;;EAKAa,cACEb,MACA,EACEc,QACAC,QACAX,SACAY,UAAS,GAOX;AACA,WAAOxB,eAAIyB,OAAOpB,mCAAe;MAC/BqB,YAAW,oBAAIC,KAAAA,GAAOC,YAAW;MACjCN;MACAC;MACAC;MACAZ,SAASA,UAAUG,kBAAOc,QAAQrB,MAAMR,eAAIyB,OAAOjB,MAAMI,OAAAA,CAAAA,IAAYM;IACvE,CAAA;EACF;AACF;AAKO,IAAMY,eAAe,OAAOC,SAAAA;AAEjC,MAAIA,gBAAgBC,QAAQ;AAC1B,eAAOC,2BAAcF,IAAAA;EACvB;AAGA,MAAIA,gBAAgBG,MAAM;AACxB,WAAO,IAAIC,WAAW,MAAOJ,KAAcK,YAAW,CAAA;EACxD;AAEA,QAAM,IAAItB,MAAM,wBAAwBiB,IAAAA,EAAM;AAChD;AChGO,IAAMM,WAAW,IAAIzC,SAAS;EAAC0C;EAAoBC;EAAqBC;EAAmBzB,YAAAA,OAAO0B;CAAU;",
|
|
6
|
-
"names": ["import_buf", "import_messenger_pb", "getTypename", "typeName", "Protocol", "constructor", "types", "_typeRegistry", "buf", "createRegistry", "typeRegistry", "toJson", "message", "MessageSchema", "registry", "err", "type", "getPayloadType", "getPayload", "invariant", "payload", "payloadTypename", "Error", "bufWkt", "anyIs", "anyUnpack", "undefined", "typeUrl", "split", "createMessage", "source", "target", "serviceId", "create", "timestamp", "Date", "toISOString", "anyPack", "toUint8Array", "data", "Buffer", "bufferToArray", "Blob", "Uint8Array", "arrayBuffer", "protocol", "SwarmRequestSchema", "SwarmResponseSchema", "TextMessageSchema", "AnySchema"]
|
|
7
|
-
}
|