@rivetkit/engine-runner-protocol 2.0.27 → 2.0.28
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.d.ts +49 -53
- package/dist/index.js +155 -122
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,10 +30,7 @@ declare function readKvValue(bc: bare.ByteCursor): KvValue;
|
|
|
30
30
|
declare function writeKvValue(bc: bare.ByteCursor, x: KvValue): void;
|
|
31
31
|
type KvMetadata = {
|
|
32
32
|
readonly version: ArrayBuffer;
|
|
33
|
-
|
|
34
|
-
* TODO: Rename to update_ts
|
|
35
|
-
*/
|
|
36
|
-
readonly createTs: i64;
|
|
33
|
+
readonly updateTs: i64;
|
|
37
34
|
};
|
|
38
35
|
declare function readKvMetadata(bc: bare.ByteCursor): KvMetadata;
|
|
39
36
|
declare function writeKvMetadata(bc: bare.ByteCursor, x: KvMetadata): void;
|
|
@@ -181,6 +178,13 @@ type ActorConfig = {
|
|
|
181
178
|
};
|
|
182
179
|
declare function readActorConfig(bc: bare.ByteCursor): ActorConfig;
|
|
183
180
|
declare function writeActorConfig(bc: bare.ByteCursor, x: ActorConfig): void;
|
|
181
|
+
type ActorCheckpoint = {
|
|
182
|
+
readonly actorId: Id;
|
|
183
|
+
readonly generation: u32;
|
|
184
|
+
readonly index: i64;
|
|
185
|
+
};
|
|
186
|
+
declare function readActorCheckpoint(bc: bare.ByteCursor): ActorCheckpoint;
|
|
187
|
+
declare function writeActorCheckpoint(bc: bare.ByteCursor, x: ActorCheckpoint): void;
|
|
184
188
|
/**
|
|
185
189
|
* Intent
|
|
186
190
|
*/
|
|
@@ -218,22 +222,16 @@ declare function writeActorState(bc: bare.ByteCursor, x: ActorState): void;
|
|
|
218
222
|
* MARK: Events
|
|
219
223
|
*/
|
|
220
224
|
type EventActorIntent = {
|
|
221
|
-
readonly actorId: Id;
|
|
222
|
-
readonly generation: u32;
|
|
223
225
|
readonly intent: ActorIntent;
|
|
224
226
|
};
|
|
225
227
|
declare function readEventActorIntent(bc: bare.ByteCursor): EventActorIntent;
|
|
226
228
|
declare function writeEventActorIntent(bc: bare.ByteCursor, x: EventActorIntent): void;
|
|
227
229
|
type EventActorStateUpdate = {
|
|
228
|
-
readonly actorId: Id;
|
|
229
|
-
readonly generation: u32;
|
|
230
230
|
readonly state: ActorState;
|
|
231
231
|
};
|
|
232
232
|
declare function readEventActorStateUpdate(bc: bare.ByteCursor): EventActorStateUpdate;
|
|
233
233
|
declare function writeEventActorStateUpdate(bc: bare.ByteCursor, x: EventActorStateUpdate): void;
|
|
234
234
|
type EventActorSetAlarm = {
|
|
235
|
-
readonly actorId: Id;
|
|
236
|
-
readonly generation: u32;
|
|
237
235
|
readonly alarmTs: i64 | null;
|
|
238
236
|
};
|
|
239
237
|
declare function readEventActorSetAlarm(bc: bare.ByteCursor): EventActorSetAlarm;
|
|
@@ -251,7 +249,7 @@ type Event = {
|
|
|
251
249
|
declare function readEvent(bc: bare.ByteCursor): Event;
|
|
252
250
|
declare function writeEvent(bc: bare.ByteCursor, x: Event): void;
|
|
253
251
|
type EventWrapper = {
|
|
254
|
-
readonly
|
|
252
|
+
readonly checkpoint: ActorCheckpoint;
|
|
255
253
|
readonly inner: Event;
|
|
256
254
|
};
|
|
257
255
|
declare function readEventWrapper(bc: bare.ByteCursor): EventWrapper;
|
|
@@ -263,19 +261,12 @@ type HibernatingRequest = {
|
|
|
263
261
|
declare function readHibernatingRequest(bc: bare.ByteCursor): HibernatingRequest;
|
|
264
262
|
declare function writeHibernatingRequest(bc: bare.ByteCursor, x: HibernatingRequest): void;
|
|
265
263
|
type CommandStartActor = {
|
|
266
|
-
readonly actorId: Id;
|
|
267
|
-
readonly generation: u32;
|
|
268
264
|
readonly config: ActorConfig;
|
|
269
265
|
readonly hibernatingRequests: readonly HibernatingRequest[];
|
|
270
266
|
};
|
|
271
267
|
declare function readCommandStartActor(bc: bare.ByteCursor): CommandStartActor;
|
|
272
268
|
declare function writeCommandStartActor(bc: bare.ByteCursor, x: CommandStartActor): void;
|
|
273
|
-
type CommandStopActor =
|
|
274
|
-
readonly actorId: Id;
|
|
275
|
-
readonly generation: u32;
|
|
276
|
-
};
|
|
277
|
-
declare function readCommandStopActor(bc: bare.ByteCursor): CommandStopActor;
|
|
278
|
-
declare function writeCommandStopActor(bc: bare.ByteCursor, x: CommandStopActor): void;
|
|
269
|
+
type CommandStopActor = null;
|
|
279
270
|
type Command = {
|
|
280
271
|
readonly tag: "CommandStartActor";
|
|
281
272
|
readonly val: CommandStartActor;
|
|
@@ -286,11 +277,25 @@ type Command = {
|
|
|
286
277
|
declare function readCommand(bc: bare.ByteCursor): Command;
|
|
287
278
|
declare function writeCommand(bc: bare.ByteCursor, x: Command): void;
|
|
288
279
|
type CommandWrapper = {
|
|
289
|
-
readonly
|
|
280
|
+
readonly checkpoint: ActorCheckpoint;
|
|
290
281
|
readonly inner: Command;
|
|
291
282
|
};
|
|
292
283
|
declare function readCommandWrapper(bc: bare.ByteCursor): CommandWrapper;
|
|
293
284
|
declare function writeCommandWrapper(bc: bare.ByteCursor, x: CommandWrapper): void;
|
|
285
|
+
/**
|
|
286
|
+
* We redeclare this so its top level
|
|
287
|
+
*/
|
|
288
|
+
type ActorCommandKeyData = {
|
|
289
|
+
readonly tag: "CommandStartActor";
|
|
290
|
+
readonly val: CommandStartActor;
|
|
291
|
+
} | {
|
|
292
|
+
readonly tag: "CommandStopActor";
|
|
293
|
+
readonly val: CommandStopActor;
|
|
294
|
+
};
|
|
295
|
+
declare function readActorCommandKeyData(bc: bare.ByteCursor): ActorCommandKeyData;
|
|
296
|
+
declare function writeActorCommandKeyData(bc: bare.ByteCursor, x: ActorCommandKeyData): void;
|
|
297
|
+
declare function encodeActorCommandKeyData(x: ActorCommandKeyData, config?: Partial<bare.Config>): Uint8Array;
|
|
298
|
+
declare function decodeActorCommandKeyData(bytes: Uint8Array): ActorCommandKeyData;
|
|
294
299
|
type MessageId = {
|
|
295
300
|
/**
|
|
296
301
|
* Globally unique ID
|
|
@@ -307,7 +312,6 @@ type MessageId = {
|
|
|
307
312
|
};
|
|
308
313
|
declare function readMessageId(bc: bare.ByteCursor): MessageId;
|
|
309
314
|
declare function writeMessageId(bc: bare.ByteCursor, x: MessageId): void;
|
|
310
|
-
type DeprecatedTunnelAck = null;
|
|
311
315
|
/**
|
|
312
316
|
* HTTP
|
|
313
317
|
*/
|
|
@@ -391,14 +395,11 @@ declare function writeToServerWebSocketClose(bc: bare.ByteCursor, x: ToServerWeb
|
|
|
391
395
|
/**
|
|
392
396
|
* To Server
|
|
393
397
|
*/
|
|
394
|
-
type ToServerTunnelMessageKind =
|
|
395
|
-
readonly tag: "DeprecatedTunnelAck";
|
|
396
|
-
readonly val: DeprecatedTunnelAck;
|
|
397
|
-
}
|
|
398
|
+
type ToServerTunnelMessageKind =
|
|
398
399
|
/**
|
|
399
400
|
* HTTP
|
|
400
401
|
*/
|
|
401
|
-
|
|
402
|
+
{
|
|
402
403
|
readonly tag: "ToServerResponseStart";
|
|
403
404
|
readonly val: ToServerResponseStart;
|
|
404
405
|
} | {
|
|
@@ -435,14 +436,11 @@ declare function writeToServerTunnelMessage(bc: bare.ByteCursor, x: ToServerTunn
|
|
|
435
436
|
/**
|
|
436
437
|
* To Client
|
|
437
438
|
*/
|
|
438
|
-
type ToClientTunnelMessageKind =
|
|
439
|
-
readonly tag: "DeprecatedTunnelAck";
|
|
440
|
-
readonly val: DeprecatedTunnelAck;
|
|
441
|
-
}
|
|
439
|
+
type ToClientTunnelMessageKind =
|
|
442
440
|
/**
|
|
443
441
|
* HTTP
|
|
444
442
|
*/
|
|
445
|
-
|
|
443
|
+
{
|
|
446
444
|
readonly tag: "ToClientRequestStart";
|
|
447
445
|
readonly val: ToClientRequestStart;
|
|
448
446
|
} | {
|
|
@@ -473,6 +471,11 @@ type ToClientTunnelMessage = {
|
|
|
473
471
|
};
|
|
474
472
|
declare function readToClientTunnelMessage(bc: bare.ByteCursor): ToClientTunnelMessage;
|
|
475
473
|
declare function writeToClientTunnelMessage(bc: bare.ByteCursor, x: ToClientTunnelMessage): void;
|
|
474
|
+
type ToClientPing = {
|
|
475
|
+
readonly ts: i64;
|
|
476
|
+
};
|
|
477
|
+
declare function readToClientPing(bc: bare.ByteCursor): ToClientPing;
|
|
478
|
+
declare function writeToClientPing(bc: bare.ByteCursor, x: ToClientPing): void;
|
|
476
479
|
/**
|
|
477
480
|
* MARK: To Server
|
|
478
481
|
*/
|
|
@@ -480,7 +483,6 @@ type ToServerInit = {
|
|
|
480
483
|
readonly name: string;
|
|
481
484
|
readonly version: u32;
|
|
482
485
|
readonly totalSlots: u32;
|
|
483
|
-
readonly lastCommandIdx: i64 | null;
|
|
484
486
|
readonly prepopulateActorNames: ReadonlyMap<string, ActorName> | null;
|
|
485
487
|
readonly metadata: Json | null;
|
|
486
488
|
};
|
|
@@ -490,16 +492,16 @@ type ToServerEvents = readonly EventWrapper[];
|
|
|
490
492
|
declare function readToServerEvents(bc: bare.ByteCursor): ToServerEvents;
|
|
491
493
|
declare function writeToServerEvents(bc: bare.ByteCursor, x: ToServerEvents): void;
|
|
492
494
|
type ToServerAckCommands = {
|
|
493
|
-
readonly
|
|
495
|
+
readonly lastCommandCheckpoints: readonly ActorCheckpoint[];
|
|
494
496
|
};
|
|
495
497
|
declare function readToServerAckCommands(bc: bare.ByteCursor): ToServerAckCommands;
|
|
496
498
|
declare function writeToServerAckCommands(bc: bare.ByteCursor, x: ToServerAckCommands): void;
|
|
497
499
|
type ToServerStopping = null;
|
|
498
|
-
type
|
|
500
|
+
type ToServerPong = {
|
|
499
501
|
readonly ts: i64;
|
|
500
502
|
};
|
|
501
|
-
declare function
|
|
502
|
-
declare function
|
|
503
|
+
declare function readToServerPong(bc: bare.ByteCursor): ToServerPong;
|
|
504
|
+
declare function writeToServerPong(bc: bare.ByteCursor, x: ToServerPong): void;
|
|
503
505
|
type ToServerKvRequest = {
|
|
504
506
|
readonly actorId: Id;
|
|
505
507
|
readonly requestId: u32;
|
|
@@ -520,8 +522,8 @@ type ToServer = {
|
|
|
520
522
|
readonly tag: "ToServerStopping";
|
|
521
523
|
readonly val: ToServerStopping;
|
|
522
524
|
} | {
|
|
523
|
-
readonly tag: "
|
|
524
|
-
readonly val:
|
|
525
|
+
readonly tag: "ToServerPong";
|
|
526
|
+
readonly val: ToServerPong;
|
|
525
527
|
} | {
|
|
526
528
|
readonly tag: "ToServerKvRequest";
|
|
527
529
|
readonly val: ToServerKvRequest;
|
|
@@ -543,7 +545,6 @@ declare function readProtocolMetadata(bc: bare.ByteCursor): ProtocolMetadata;
|
|
|
543
545
|
declare function writeProtocolMetadata(bc: bare.ByteCursor, x: ProtocolMetadata): void;
|
|
544
546
|
type ToClientInit = {
|
|
545
547
|
readonly runnerId: Id;
|
|
546
|
-
readonly lastEventIdx: i64;
|
|
547
548
|
readonly metadata: ProtocolMetadata;
|
|
548
549
|
};
|
|
549
550
|
declare function readToClientInit(bc: bare.ByteCursor): ToClientInit;
|
|
@@ -552,7 +553,7 @@ type ToClientCommands = readonly CommandWrapper[];
|
|
|
552
553
|
declare function readToClientCommands(bc: bare.ByteCursor): ToClientCommands;
|
|
553
554
|
declare function writeToClientCommands(bc: bare.ByteCursor, x: ToClientCommands): void;
|
|
554
555
|
type ToClientAckEvents = {
|
|
555
|
-
readonly
|
|
556
|
+
readonly lastEventCheckpoints: readonly ActorCheckpoint[];
|
|
556
557
|
};
|
|
557
558
|
declare function readToClientAckEvents(bc: bare.ByteCursor): ToClientAckEvents;
|
|
558
559
|
declare function writeToClientAckEvents(bc: bare.ByteCursor, x: ToClientAckEvents): void;
|
|
@@ -562,13 +563,9 @@ type ToClientKvResponse = {
|
|
|
562
563
|
};
|
|
563
564
|
declare function readToClientKvResponse(bc: bare.ByteCursor): ToClientKvResponse;
|
|
564
565
|
declare function writeToClientKvResponse(bc: bare.ByteCursor, x: ToClientKvResponse): void;
|
|
565
|
-
type ToClientClose = null;
|
|
566
566
|
type ToClient = {
|
|
567
567
|
readonly tag: "ToClientInit";
|
|
568
568
|
readonly val: ToClientInit;
|
|
569
|
-
} | {
|
|
570
|
-
readonly tag: "ToClientClose";
|
|
571
|
-
readonly val: ToClientClose;
|
|
572
569
|
} | {
|
|
573
570
|
readonly tag: "ToClientCommands";
|
|
574
571
|
readonly val: ToClientCommands;
|
|
@@ -581,6 +578,9 @@ type ToClient = {
|
|
|
581
578
|
} | {
|
|
582
579
|
readonly tag: "ToClientTunnelMessage";
|
|
583
580
|
readonly val: ToClientTunnelMessage;
|
|
581
|
+
} | {
|
|
582
|
+
readonly tag: "ToClientPing";
|
|
583
|
+
readonly val: ToClientPing;
|
|
584
584
|
};
|
|
585
585
|
declare function readToClient(bc: bare.ByteCursor): ToClient;
|
|
586
586
|
declare function writeToClient(bc: bare.ByteCursor, x: ToClient): void;
|
|
@@ -596,6 +596,7 @@ type ToRunnerPing = {
|
|
|
596
596
|
};
|
|
597
597
|
declare function readToRunnerPing(bc: bare.ByteCursor): ToRunnerPing;
|
|
598
598
|
declare function writeToRunnerPing(bc: bare.ByteCursor, x: ToRunnerPing): void;
|
|
599
|
+
type ToRunnerClose = null;
|
|
599
600
|
/**
|
|
600
601
|
* We have to re-declare the entire union since BARE will not generate the
|
|
601
602
|
* ser/de for ToClient if it's not a top-level type
|
|
@@ -604,20 +605,14 @@ type ToRunner = {
|
|
|
604
605
|
readonly tag: "ToRunnerPing";
|
|
605
606
|
readonly val: ToRunnerPing;
|
|
606
607
|
} | {
|
|
607
|
-
readonly tag: "
|
|
608
|
-
readonly val:
|
|
609
|
-
} | {
|
|
610
|
-
readonly tag: "ToClientClose";
|
|
611
|
-
readonly val: ToClientClose;
|
|
608
|
+
readonly tag: "ToRunnerClose";
|
|
609
|
+
readonly val: ToRunnerClose;
|
|
612
610
|
} | {
|
|
613
611
|
readonly tag: "ToClientCommands";
|
|
614
612
|
readonly val: ToClientCommands;
|
|
615
613
|
} | {
|
|
616
614
|
readonly tag: "ToClientAckEvents";
|
|
617
615
|
readonly val: ToClientAckEvents;
|
|
618
|
-
} | {
|
|
619
|
-
readonly tag: "ToClientKvResponse";
|
|
620
|
-
readonly val: ToClientKvResponse;
|
|
621
616
|
} | {
|
|
622
617
|
readonly tag: "ToClientTunnelMessage";
|
|
623
618
|
readonly val: ToClientTunnelMessage;
|
|
@@ -651,6 +646,7 @@ declare function decodeToGateway(bytes: Uint8Array): ToGateway;
|
|
|
651
646
|
*/
|
|
652
647
|
type ToServerlessServerInit = {
|
|
653
648
|
readonly runnerId: Id;
|
|
649
|
+
readonly runnerProtocolVersion: u16;
|
|
654
650
|
};
|
|
655
651
|
declare function readToServerlessServerInit(bc: bare.ByteCursor): ToServerlessServerInit;
|
|
656
652
|
declare function writeToServerlessServerInit(bc: bare.ByteCursor, x: ToServerlessServerInit): void;
|
|
@@ -663,4 +659,4 @@ declare function writeToServerlessServer(bc: bare.ByteCursor, x: ToServerlessSer
|
|
|
663
659
|
declare function encodeToServerlessServer(x: ToServerlessServer, config?: Partial<bare.Config>): Uint8Array;
|
|
664
660
|
declare function decodeToServerlessServer(bytes: Uint8Array): ToServerlessServer;
|
|
665
661
|
|
|
666
|
-
export { type ActorConfig, type ActorIntent, type ActorIntentSleep, type ActorIntentStop, type ActorName, type ActorState, type ActorStateRunning, type ActorStateStopped, type Command, type CommandStartActor, type CommandStopActor, type CommandWrapper, type
|
|
662
|
+
export { type ActorCheckpoint, type ActorCommandKeyData, type ActorConfig, type ActorIntent, type ActorIntentSleep, type ActorIntentStop, type ActorName, type ActorState, type ActorStateRunning, type ActorStateStopped, type Command, type CommandStartActor, type CommandStopActor, type CommandWrapper, type Event, type EventActorIntent, type EventActorSetAlarm, type EventActorStateUpdate, type EventWrapper, type GatewayId, type HibernatingRequest, type Id, type Json, type KvDeleteRequest, type KvDeleteResponse, type KvDropRequest, type KvDropResponse, type KvErrorResponse, type KvGetRequest, type KvGetResponse, type KvKey, type KvListAllQuery, type KvListPrefixQuery, type KvListQuery, type KvListRangeQuery, type KvListRequest, type KvListResponse, type KvMetadata, type KvPutRequest, type KvPutResponse, type KvRequestData, type KvResponseData, type KvValue, type MessageId, type MessageIndex, type ProtocolMetadata, type RequestId, StopCode, type ToClient, type ToClientAckEvents, type ToClientCommands, type ToClientInit, type ToClientKvResponse, type ToClientPing, type ToClientRequestAbort, type ToClientRequestChunk, type ToClientRequestStart, type ToClientTunnelMessage, type ToClientTunnelMessageKind, type ToClientWebSocketClose, type ToClientWebSocketMessage, type ToClientWebSocketOpen, type ToGateway, type ToGatewayPong, type ToRunner, type ToRunnerClose, type ToRunnerPing, type ToServer, type ToServerAckCommands, type ToServerEvents, type ToServerInit, type ToServerKvRequest, type ToServerPong, type ToServerResponseAbort, type ToServerResponseChunk, type ToServerResponseStart, type ToServerStopping, type ToServerTunnelMessage, type ToServerTunnelMessageKind, type ToServerWebSocketClose, type ToServerWebSocketMessage, type ToServerWebSocketMessageAck, type ToServerWebSocketOpen, type ToServerlessServer, type ToServerlessServerInit, decodeActorCommandKeyData, decodeToClient, decodeToGateway, decodeToRunner, decodeToServer, decodeToServerlessServer, encodeActorCommandKeyData, encodeToClient, encodeToGateway, encodeToRunner, encodeToServer, encodeToServerlessServer, type i64, readActorCheckpoint, readActorCommandKeyData, readActorConfig, readActorIntent, readActorName, readActorState, readActorStateStopped, readCommand, readCommandStartActor, readCommandWrapper, readEvent, readEventActorIntent, readEventActorSetAlarm, readEventActorStateUpdate, readEventWrapper, readGatewayId, readHibernatingRequest, readId, readJson, readKvDeleteRequest, readKvErrorResponse, readKvGetRequest, readKvGetResponse, readKvKey, readKvListPrefixQuery, readKvListQuery, readKvListRangeQuery, readKvListRequest, readKvListResponse, readKvMetadata, readKvPutRequest, readKvRequestData, readKvResponseData, readKvValue, readMessageId, readMessageIndex, readProtocolMetadata, readRequestId, readStopCode, readToClient, readToClientAckEvents, readToClientCommands, readToClientInit, readToClientKvResponse, readToClientPing, readToClientRequestChunk, readToClientRequestStart, readToClientTunnelMessage, readToClientTunnelMessageKind, readToClientWebSocketClose, readToClientWebSocketMessage, readToClientWebSocketOpen, readToGateway, readToGatewayPong, readToRunner, readToRunnerPing, readToServer, readToServerAckCommands, readToServerEvents, readToServerInit, readToServerKvRequest, readToServerPong, readToServerResponseChunk, readToServerResponseStart, readToServerTunnelMessage, readToServerTunnelMessageKind, readToServerWebSocketClose, readToServerWebSocketMessage, readToServerWebSocketMessageAck, readToServerWebSocketOpen, readToServerlessServer, readToServerlessServerInit, type u16, type u32, type u64, writeActorCheckpoint, writeActorCommandKeyData, writeActorConfig, writeActorIntent, writeActorName, writeActorState, writeActorStateStopped, writeCommand, writeCommandStartActor, writeCommandWrapper, writeEvent, writeEventActorIntent, writeEventActorSetAlarm, writeEventActorStateUpdate, writeEventWrapper, writeGatewayId, writeHibernatingRequest, writeId, writeJson, writeKvDeleteRequest, writeKvErrorResponse, writeKvGetRequest, writeKvGetResponse, writeKvKey, writeKvListPrefixQuery, writeKvListQuery, writeKvListRangeQuery, writeKvListRequest, writeKvListResponse, writeKvMetadata, writeKvPutRequest, writeKvRequestData, writeKvResponseData, writeKvValue, writeMessageId, writeMessageIndex, writeProtocolMetadata, writeRequestId, writeStopCode, writeToClient, writeToClientAckEvents, writeToClientCommands, writeToClientInit, writeToClientKvResponse, writeToClientPing, writeToClientRequestChunk, writeToClientRequestStart, writeToClientTunnelMessage, writeToClientTunnelMessageKind, writeToClientWebSocketClose, writeToClientWebSocketMessage, writeToClientWebSocketOpen, writeToGateway, writeToGatewayPong, writeToRunner, writeToRunnerPing, writeToServer, writeToServerAckCommands, writeToServerEvents, writeToServerInit, writeToServerKvRequest, writeToServerPong, writeToServerResponseChunk, writeToServerResponseStart, writeToServerTunnelMessage, writeToServerTunnelMessageKind, writeToServerWebSocketClose, writeToServerWebSocketMessage, writeToServerWebSocketMessageAck, writeToServerWebSocketOpen, writeToServerlessServer, writeToServerlessServerInit };
|
package/dist/index.js
CHANGED
|
@@ -49,12 +49,12 @@ function writeKvValue(bc, x) {
|
|
|
49
49
|
function readKvMetadata(bc) {
|
|
50
50
|
return {
|
|
51
51
|
version: bare.readData(bc),
|
|
52
|
-
|
|
52
|
+
updateTs: bare.readI64(bc)
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
function writeKvMetadata(bc, x) {
|
|
56
56
|
bare.writeData(bc, x.version);
|
|
57
|
-
bare.writeI64(bc, x.
|
|
57
|
+
bare.writeI64(bc, x.updateTs);
|
|
58
58
|
}
|
|
59
59
|
function readKvListRangeQuery(bc) {
|
|
60
60
|
return {
|
|
@@ -421,6 +421,18 @@ function writeActorConfig(bc, x) {
|
|
|
421
421
|
bare.writeI64(bc, x.createTs);
|
|
422
422
|
write6(bc, x.input);
|
|
423
423
|
}
|
|
424
|
+
function readActorCheckpoint(bc) {
|
|
425
|
+
return {
|
|
426
|
+
actorId: readId(bc),
|
|
427
|
+
generation: bare.readU32(bc),
|
|
428
|
+
index: bare.readI64(bc)
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function writeActorCheckpoint(bc, x) {
|
|
432
|
+
writeId(bc, x.actorId);
|
|
433
|
+
bare.writeU32(bc, x.generation);
|
|
434
|
+
bare.writeI64(bc, x.index);
|
|
435
|
+
}
|
|
424
436
|
function readActorIntent(bc) {
|
|
425
437
|
const offset = bc.offset;
|
|
426
438
|
const tag = bare.readU8(bc);
|
|
@@ -486,26 +498,18 @@ function writeActorState(bc, x) {
|
|
|
486
498
|
}
|
|
487
499
|
function readEventActorIntent(bc) {
|
|
488
500
|
return {
|
|
489
|
-
actorId: readId(bc),
|
|
490
|
-
generation: bare.readU32(bc),
|
|
491
501
|
intent: readActorIntent(bc)
|
|
492
502
|
};
|
|
493
503
|
}
|
|
494
504
|
function writeEventActorIntent(bc, x) {
|
|
495
|
-
writeId(bc, x.actorId);
|
|
496
|
-
bare.writeU32(bc, x.generation);
|
|
497
505
|
writeActorIntent(bc, x.intent);
|
|
498
506
|
}
|
|
499
507
|
function readEventActorStateUpdate(bc) {
|
|
500
508
|
return {
|
|
501
|
-
actorId: readId(bc),
|
|
502
|
-
generation: bare.readU32(bc),
|
|
503
509
|
state: readActorState(bc)
|
|
504
510
|
};
|
|
505
511
|
}
|
|
506
512
|
function writeEventActorStateUpdate(bc, x) {
|
|
507
|
-
writeId(bc, x.actorId);
|
|
508
|
-
bare.writeU32(bc, x.generation);
|
|
509
513
|
writeActorState(bc, x.state);
|
|
510
514
|
}
|
|
511
515
|
function read7(bc) {
|
|
@@ -519,14 +523,10 @@ function write7(bc, x) {
|
|
|
519
523
|
}
|
|
520
524
|
function readEventActorSetAlarm(bc) {
|
|
521
525
|
return {
|
|
522
|
-
actorId: readId(bc),
|
|
523
|
-
generation: bare.readU32(bc),
|
|
524
526
|
alarmTs: read7(bc)
|
|
525
527
|
};
|
|
526
528
|
}
|
|
527
529
|
function writeEventActorSetAlarm(bc, x) {
|
|
528
|
-
writeId(bc, x.actorId);
|
|
529
|
-
bare.writeU32(bc, x.generation);
|
|
530
530
|
write7(bc, x.alarmTs);
|
|
531
531
|
}
|
|
532
532
|
function readEvent(bc) {
|
|
@@ -566,12 +566,12 @@ function writeEvent(bc, x) {
|
|
|
566
566
|
}
|
|
567
567
|
function readEventWrapper(bc) {
|
|
568
568
|
return {
|
|
569
|
-
|
|
569
|
+
checkpoint: readActorCheckpoint(bc),
|
|
570
570
|
inner: readEvent(bc)
|
|
571
571
|
};
|
|
572
572
|
}
|
|
573
573
|
function writeEventWrapper(bc, x) {
|
|
574
|
-
|
|
574
|
+
writeActorCheckpoint(bc, x.checkpoint);
|
|
575
575
|
writeEvent(bc, x.inner);
|
|
576
576
|
}
|
|
577
577
|
function readHibernatingRequest(bc) {
|
|
@@ -603,28 +603,14 @@ function write8(bc, x) {
|
|
|
603
603
|
}
|
|
604
604
|
function readCommandStartActor(bc) {
|
|
605
605
|
return {
|
|
606
|
-
actorId: readId(bc),
|
|
607
|
-
generation: bare.readU32(bc),
|
|
608
606
|
config: readActorConfig(bc),
|
|
609
607
|
hibernatingRequests: read8(bc)
|
|
610
608
|
};
|
|
611
609
|
}
|
|
612
610
|
function writeCommandStartActor(bc, x) {
|
|
613
|
-
writeId(bc, x.actorId);
|
|
614
|
-
bare.writeU32(bc, x.generation);
|
|
615
611
|
writeActorConfig(bc, x.config);
|
|
616
612
|
write8(bc, x.hibernatingRequests);
|
|
617
613
|
}
|
|
618
|
-
function readCommandStopActor(bc) {
|
|
619
|
-
return {
|
|
620
|
-
actorId: readId(bc),
|
|
621
|
-
generation: bare.readU32(bc)
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
function writeCommandStopActor(bc, x) {
|
|
625
|
-
writeId(bc, x.actorId);
|
|
626
|
-
bare.writeU32(bc, x.generation);
|
|
627
|
-
}
|
|
628
614
|
function readCommand(bc) {
|
|
629
615
|
const offset = bc.offset;
|
|
630
616
|
const tag = bare.readU8(bc);
|
|
@@ -632,7 +618,7 @@ function readCommand(bc) {
|
|
|
632
618
|
case 0:
|
|
633
619
|
return { tag: "CommandStartActor", val: readCommandStartActor(bc) };
|
|
634
620
|
case 1:
|
|
635
|
-
return { tag: "CommandStopActor", val:
|
|
621
|
+
return { tag: "CommandStopActor", val: null };
|
|
636
622
|
default: {
|
|
637
623
|
bc.offset = offset;
|
|
638
624
|
throw new bare.BareError(offset, "invalid tag");
|
|
@@ -648,21 +634,64 @@ function writeCommand(bc, x) {
|
|
|
648
634
|
}
|
|
649
635
|
case "CommandStopActor": {
|
|
650
636
|
bare.writeU8(bc, 1);
|
|
651
|
-
writeCommandStopActor(bc, x.val);
|
|
652
637
|
break;
|
|
653
638
|
}
|
|
654
639
|
}
|
|
655
640
|
}
|
|
656
641
|
function readCommandWrapper(bc) {
|
|
657
642
|
return {
|
|
658
|
-
|
|
643
|
+
checkpoint: readActorCheckpoint(bc),
|
|
659
644
|
inner: readCommand(bc)
|
|
660
645
|
};
|
|
661
646
|
}
|
|
662
647
|
function writeCommandWrapper(bc, x) {
|
|
663
|
-
|
|
648
|
+
writeActorCheckpoint(bc, x.checkpoint);
|
|
664
649
|
writeCommand(bc, x.inner);
|
|
665
650
|
}
|
|
651
|
+
function readActorCommandKeyData(bc) {
|
|
652
|
+
const offset = bc.offset;
|
|
653
|
+
const tag = bare.readU8(bc);
|
|
654
|
+
switch (tag) {
|
|
655
|
+
case 0:
|
|
656
|
+
return { tag: "CommandStartActor", val: readCommandStartActor(bc) };
|
|
657
|
+
case 1:
|
|
658
|
+
return { tag: "CommandStopActor", val: null };
|
|
659
|
+
default: {
|
|
660
|
+
bc.offset = offset;
|
|
661
|
+
throw new bare.BareError(offset, "invalid tag");
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function writeActorCommandKeyData(bc, x) {
|
|
666
|
+
switch (x.tag) {
|
|
667
|
+
case "CommandStartActor": {
|
|
668
|
+
bare.writeU8(bc, 0);
|
|
669
|
+
writeCommandStartActor(bc, x.val);
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
case "CommandStopActor": {
|
|
673
|
+
bare.writeU8(bc, 1);
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
function encodeActorCommandKeyData(x, config) {
|
|
679
|
+
const fullConfig = config != null ? bare.Config(config) : DEFAULT_CONFIG;
|
|
680
|
+
const bc = new bare.ByteCursor(
|
|
681
|
+
new Uint8Array(fullConfig.initialBufferLength),
|
|
682
|
+
fullConfig
|
|
683
|
+
);
|
|
684
|
+
writeActorCommandKeyData(bc, x);
|
|
685
|
+
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
686
|
+
}
|
|
687
|
+
function decodeActorCommandKeyData(bytes) {
|
|
688
|
+
const bc = new bare.ByteCursor(bytes, DEFAULT_CONFIG);
|
|
689
|
+
const result = readActorCommandKeyData(bc);
|
|
690
|
+
if (bc.offset < bc.view.byteLength) {
|
|
691
|
+
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
692
|
+
}
|
|
693
|
+
return result;
|
|
694
|
+
}
|
|
666
695
|
function readMessageId(bc) {
|
|
667
696
|
return {
|
|
668
697
|
gatewayId: readGatewayId(bc),
|
|
@@ -832,20 +861,18 @@ function readToServerTunnelMessageKind(bc) {
|
|
|
832
861
|
const tag = bare.readU8(bc);
|
|
833
862
|
switch (tag) {
|
|
834
863
|
case 0:
|
|
835
|
-
return { tag: "DeprecatedTunnelAck", val: null };
|
|
836
|
-
case 1:
|
|
837
864
|
return { tag: "ToServerResponseStart", val: readToServerResponseStart(bc) };
|
|
838
|
-
case
|
|
865
|
+
case 1:
|
|
839
866
|
return { tag: "ToServerResponseChunk", val: readToServerResponseChunk(bc) };
|
|
840
|
-
case
|
|
867
|
+
case 2:
|
|
841
868
|
return { tag: "ToServerResponseAbort", val: null };
|
|
842
|
-
case
|
|
869
|
+
case 3:
|
|
843
870
|
return { tag: "ToServerWebSocketOpen", val: readToServerWebSocketOpen(bc) };
|
|
844
|
-
case
|
|
871
|
+
case 4:
|
|
845
872
|
return { tag: "ToServerWebSocketMessage", val: readToServerWebSocketMessage(bc) };
|
|
846
|
-
case
|
|
873
|
+
case 5:
|
|
847
874
|
return { tag: "ToServerWebSocketMessageAck", val: readToServerWebSocketMessageAck(bc) };
|
|
848
|
-
case
|
|
875
|
+
case 6:
|
|
849
876
|
return { tag: "ToServerWebSocketClose", val: readToServerWebSocketClose(bc) };
|
|
850
877
|
default: {
|
|
851
878
|
bc.offset = offset;
|
|
@@ -855,41 +882,37 @@ function readToServerTunnelMessageKind(bc) {
|
|
|
855
882
|
}
|
|
856
883
|
function writeToServerTunnelMessageKind(bc, x) {
|
|
857
884
|
switch (x.tag) {
|
|
858
|
-
case "DeprecatedTunnelAck": {
|
|
859
|
-
bare.writeU8(bc, 0);
|
|
860
|
-
break;
|
|
861
|
-
}
|
|
862
885
|
case "ToServerResponseStart": {
|
|
863
|
-
bare.writeU8(bc,
|
|
886
|
+
bare.writeU8(bc, 0);
|
|
864
887
|
writeToServerResponseStart(bc, x.val);
|
|
865
888
|
break;
|
|
866
889
|
}
|
|
867
890
|
case "ToServerResponseChunk": {
|
|
868
|
-
bare.writeU8(bc,
|
|
891
|
+
bare.writeU8(bc, 1);
|
|
869
892
|
writeToServerResponseChunk(bc, x.val);
|
|
870
893
|
break;
|
|
871
894
|
}
|
|
872
895
|
case "ToServerResponseAbort": {
|
|
873
|
-
bare.writeU8(bc,
|
|
896
|
+
bare.writeU8(bc, 2);
|
|
874
897
|
break;
|
|
875
898
|
}
|
|
876
899
|
case "ToServerWebSocketOpen": {
|
|
877
|
-
bare.writeU8(bc,
|
|
900
|
+
bare.writeU8(bc, 3);
|
|
878
901
|
writeToServerWebSocketOpen(bc, x.val);
|
|
879
902
|
break;
|
|
880
903
|
}
|
|
881
904
|
case "ToServerWebSocketMessage": {
|
|
882
|
-
bare.writeU8(bc,
|
|
905
|
+
bare.writeU8(bc, 4);
|
|
883
906
|
writeToServerWebSocketMessage(bc, x.val);
|
|
884
907
|
break;
|
|
885
908
|
}
|
|
886
909
|
case "ToServerWebSocketMessageAck": {
|
|
887
|
-
bare.writeU8(bc,
|
|
910
|
+
bare.writeU8(bc, 5);
|
|
888
911
|
writeToServerWebSocketMessageAck(bc, x.val);
|
|
889
912
|
break;
|
|
890
913
|
}
|
|
891
914
|
case "ToServerWebSocketClose": {
|
|
892
|
-
bare.writeU8(bc,
|
|
915
|
+
bare.writeU8(bc, 6);
|
|
893
916
|
writeToServerWebSocketClose(bc, x.val);
|
|
894
917
|
break;
|
|
895
918
|
}
|
|
@@ -910,18 +933,16 @@ function readToClientTunnelMessageKind(bc) {
|
|
|
910
933
|
const tag = bare.readU8(bc);
|
|
911
934
|
switch (tag) {
|
|
912
935
|
case 0:
|
|
913
|
-
return { tag: "DeprecatedTunnelAck", val: null };
|
|
914
|
-
case 1:
|
|
915
936
|
return { tag: "ToClientRequestStart", val: readToClientRequestStart(bc) };
|
|
916
|
-
case
|
|
937
|
+
case 1:
|
|
917
938
|
return { tag: "ToClientRequestChunk", val: readToClientRequestChunk(bc) };
|
|
918
|
-
case
|
|
939
|
+
case 2:
|
|
919
940
|
return { tag: "ToClientRequestAbort", val: null };
|
|
920
|
-
case
|
|
941
|
+
case 3:
|
|
921
942
|
return { tag: "ToClientWebSocketOpen", val: readToClientWebSocketOpen(bc) };
|
|
922
|
-
case
|
|
943
|
+
case 4:
|
|
923
944
|
return { tag: "ToClientWebSocketMessage", val: readToClientWebSocketMessage(bc) };
|
|
924
|
-
case
|
|
945
|
+
case 5:
|
|
925
946
|
return { tag: "ToClientWebSocketClose", val: readToClientWebSocketClose(bc) };
|
|
926
947
|
default: {
|
|
927
948
|
bc.offset = offset;
|
|
@@ -931,36 +952,32 @@ function readToClientTunnelMessageKind(bc) {
|
|
|
931
952
|
}
|
|
932
953
|
function writeToClientTunnelMessageKind(bc, x) {
|
|
933
954
|
switch (x.tag) {
|
|
934
|
-
case "DeprecatedTunnelAck": {
|
|
935
|
-
bare.writeU8(bc, 0);
|
|
936
|
-
break;
|
|
937
|
-
}
|
|
938
955
|
case "ToClientRequestStart": {
|
|
939
|
-
bare.writeU8(bc,
|
|
956
|
+
bare.writeU8(bc, 0);
|
|
940
957
|
writeToClientRequestStart(bc, x.val);
|
|
941
958
|
break;
|
|
942
959
|
}
|
|
943
960
|
case "ToClientRequestChunk": {
|
|
944
|
-
bare.writeU8(bc,
|
|
961
|
+
bare.writeU8(bc, 1);
|
|
945
962
|
writeToClientRequestChunk(bc, x.val);
|
|
946
963
|
break;
|
|
947
964
|
}
|
|
948
965
|
case "ToClientRequestAbort": {
|
|
949
|
-
bare.writeU8(bc,
|
|
966
|
+
bare.writeU8(bc, 2);
|
|
950
967
|
break;
|
|
951
968
|
}
|
|
952
969
|
case "ToClientWebSocketOpen": {
|
|
953
|
-
bare.writeU8(bc,
|
|
970
|
+
bare.writeU8(bc, 3);
|
|
954
971
|
writeToClientWebSocketOpen(bc, x.val);
|
|
955
972
|
break;
|
|
956
973
|
}
|
|
957
974
|
case "ToClientWebSocketMessage": {
|
|
958
|
-
bare.writeU8(bc,
|
|
975
|
+
bare.writeU8(bc, 4);
|
|
959
976
|
writeToClientWebSocketMessage(bc, x.val);
|
|
960
977
|
break;
|
|
961
978
|
}
|
|
962
979
|
case "ToClientWebSocketClose": {
|
|
963
|
-
bare.writeU8(bc,
|
|
980
|
+
bare.writeU8(bc, 5);
|
|
964
981
|
writeToClientWebSocketClose(bc, x.val);
|
|
965
982
|
break;
|
|
966
983
|
}
|
|
@@ -976,6 +993,14 @@ function writeToClientTunnelMessage(bc, x) {
|
|
|
976
993
|
writeMessageId(bc, x.messageId);
|
|
977
994
|
writeToClientTunnelMessageKind(bc, x.messageKind);
|
|
978
995
|
}
|
|
996
|
+
function readToClientPing(bc) {
|
|
997
|
+
return {
|
|
998
|
+
ts: bare.readI64(bc)
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function writeToClientPing(bc, x) {
|
|
1002
|
+
bare.writeI64(bc, x.ts);
|
|
1003
|
+
}
|
|
979
1004
|
function read11(bc) {
|
|
980
1005
|
const len = bare.readUintSafe(bc);
|
|
981
1006
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -1020,7 +1045,6 @@ function readToServerInit(bc) {
|
|
|
1020
1045
|
name: bare.readString(bc),
|
|
1021
1046
|
version: bare.readU32(bc),
|
|
1022
1047
|
totalSlots: bare.readU32(bc),
|
|
1023
|
-
lastCommandIdx: read7(bc),
|
|
1024
1048
|
prepopulateActorNames: read12(bc),
|
|
1025
1049
|
metadata: read13(bc)
|
|
1026
1050
|
};
|
|
@@ -1029,7 +1053,6 @@ function writeToServerInit(bc, x) {
|
|
|
1029
1053
|
bare.writeString(bc, x.name);
|
|
1030
1054
|
bare.writeU32(bc, x.version);
|
|
1031
1055
|
bare.writeU32(bc, x.totalSlots);
|
|
1032
|
-
write7(bc, x.lastCommandIdx);
|
|
1033
1056
|
write12(bc, x.prepopulateActorNames);
|
|
1034
1057
|
write13(bc, x.metadata);
|
|
1035
1058
|
}
|
|
@@ -1050,20 +1073,37 @@ function writeToServerEvents(bc, x) {
|
|
|
1050
1073
|
writeEventWrapper(bc, x[i]);
|
|
1051
1074
|
}
|
|
1052
1075
|
}
|
|
1076
|
+
function read14(bc) {
|
|
1077
|
+
const len = bare.readUintSafe(bc);
|
|
1078
|
+
if (len === 0) {
|
|
1079
|
+
return [];
|
|
1080
|
+
}
|
|
1081
|
+
const result = [readActorCheckpoint(bc)];
|
|
1082
|
+
for (let i = 1; i < len; i++) {
|
|
1083
|
+
result[i] = readActorCheckpoint(bc);
|
|
1084
|
+
}
|
|
1085
|
+
return result;
|
|
1086
|
+
}
|
|
1087
|
+
function write14(bc, x) {
|
|
1088
|
+
bare.writeUintSafe(bc, x.length);
|
|
1089
|
+
for (let i = 0; i < x.length; i++) {
|
|
1090
|
+
writeActorCheckpoint(bc, x[i]);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1053
1093
|
function readToServerAckCommands(bc) {
|
|
1054
1094
|
return {
|
|
1055
|
-
|
|
1095
|
+
lastCommandCheckpoints: read14(bc)
|
|
1056
1096
|
};
|
|
1057
1097
|
}
|
|
1058
1098
|
function writeToServerAckCommands(bc, x) {
|
|
1059
|
-
|
|
1099
|
+
write14(bc, x.lastCommandCheckpoints);
|
|
1060
1100
|
}
|
|
1061
|
-
function
|
|
1101
|
+
function readToServerPong(bc) {
|
|
1062
1102
|
return {
|
|
1063
1103
|
ts: bare.readI64(bc)
|
|
1064
1104
|
};
|
|
1065
1105
|
}
|
|
1066
|
-
function
|
|
1106
|
+
function writeToServerPong(bc, x) {
|
|
1067
1107
|
bare.writeI64(bc, x.ts);
|
|
1068
1108
|
}
|
|
1069
1109
|
function readToServerKvRequest(bc) {
|
|
@@ -1091,7 +1131,7 @@ function readToServer(bc) {
|
|
|
1091
1131
|
case 3:
|
|
1092
1132
|
return { tag: "ToServerStopping", val: null };
|
|
1093
1133
|
case 4:
|
|
1094
|
-
return { tag: "
|
|
1134
|
+
return { tag: "ToServerPong", val: readToServerPong(bc) };
|
|
1095
1135
|
case 5:
|
|
1096
1136
|
return { tag: "ToServerKvRequest", val: readToServerKvRequest(bc) };
|
|
1097
1137
|
case 6:
|
|
@@ -1123,9 +1163,9 @@ function writeToServer(bc, x) {
|
|
|
1123
1163
|
bare.writeU8(bc, 3);
|
|
1124
1164
|
break;
|
|
1125
1165
|
}
|
|
1126
|
-
case "
|
|
1166
|
+
case "ToServerPong": {
|
|
1127
1167
|
bare.writeU8(bc, 4);
|
|
1128
|
-
|
|
1168
|
+
writeToServerPong(bc, x.val);
|
|
1129
1169
|
break;
|
|
1130
1170
|
}
|
|
1131
1171
|
case "ToServerKvRequest": {
|
|
@@ -1168,13 +1208,11 @@ function writeProtocolMetadata(bc, x) {
|
|
|
1168
1208
|
function readToClientInit(bc) {
|
|
1169
1209
|
return {
|
|
1170
1210
|
runnerId: readId(bc),
|
|
1171
|
-
lastEventIdx: bare.readI64(bc),
|
|
1172
1211
|
metadata: readProtocolMetadata(bc)
|
|
1173
1212
|
};
|
|
1174
1213
|
}
|
|
1175
1214
|
function writeToClientInit(bc, x) {
|
|
1176
1215
|
writeId(bc, x.runnerId);
|
|
1177
|
-
bare.writeI64(bc, x.lastEventIdx);
|
|
1178
1216
|
writeProtocolMetadata(bc, x.metadata);
|
|
1179
1217
|
}
|
|
1180
1218
|
function readToClientCommands(bc) {
|
|
@@ -1196,11 +1234,11 @@ function writeToClientCommands(bc, x) {
|
|
|
1196
1234
|
}
|
|
1197
1235
|
function readToClientAckEvents(bc) {
|
|
1198
1236
|
return {
|
|
1199
|
-
|
|
1237
|
+
lastEventCheckpoints: read14(bc)
|
|
1200
1238
|
};
|
|
1201
1239
|
}
|
|
1202
1240
|
function writeToClientAckEvents(bc, x) {
|
|
1203
|
-
|
|
1241
|
+
write14(bc, x.lastEventCheckpoints);
|
|
1204
1242
|
}
|
|
1205
1243
|
function readToClientKvResponse(bc) {
|
|
1206
1244
|
return {
|
|
@@ -1219,15 +1257,15 @@ function readToClient(bc) {
|
|
|
1219
1257
|
case 0:
|
|
1220
1258
|
return { tag: "ToClientInit", val: readToClientInit(bc) };
|
|
1221
1259
|
case 1:
|
|
1222
|
-
return { tag: "ToClientClose", val: null };
|
|
1223
|
-
case 2:
|
|
1224
1260
|
return { tag: "ToClientCommands", val: readToClientCommands(bc) };
|
|
1225
|
-
case
|
|
1261
|
+
case 2:
|
|
1226
1262
|
return { tag: "ToClientAckEvents", val: readToClientAckEvents(bc) };
|
|
1227
|
-
case
|
|
1263
|
+
case 3:
|
|
1228
1264
|
return { tag: "ToClientKvResponse", val: readToClientKvResponse(bc) };
|
|
1229
|
-
case
|
|
1265
|
+
case 4:
|
|
1230
1266
|
return { tag: "ToClientTunnelMessage", val: readToClientTunnelMessage(bc) };
|
|
1267
|
+
case 5:
|
|
1268
|
+
return { tag: "ToClientPing", val: readToClientPing(bc) };
|
|
1231
1269
|
default: {
|
|
1232
1270
|
bc.offset = offset;
|
|
1233
1271
|
throw new bare.BareError(offset, "invalid tag");
|
|
@@ -1241,30 +1279,31 @@ function writeToClient(bc, x) {
|
|
|
1241
1279
|
writeToClientInit(bc, x.val);
|
|
1242
1280
|
break;
|
|
1243
1281
|
}
|
|
1244
|
-
case "ToClientClose": {
|
|
1245
|
-
bare.writeU8(bc, 1);
|
|
1246
|
-
break;
|
|
1247
|
-
}
|
|
1248
1282
|
case "ToClientCommands": {
|
|
1249
|
-
bare.writeU8(bc,
|
|
1283
|
+
bare.writeU8(bc, 1);
|
|
1250
1284
|
writeToClientCommands(bc, x.val);
|
|
1251
1285
|
break;
|
|
1252
1286
|
}
|
|
1253
1287
|
case "ToClientAckEvents": {
|
|
1254
|
-
bare.writeU8(bc,
|
|
1288
|
+
bare.writeU8(bc, 2);
|
|
1255
1289
|
writeToClientAckEvents(bc, x.val);
|
|
1256
1290
|
break;
|
|
1257
1291
|
}
|
|
1258
1292
|
case "ToClientKvResponse": {
|
|
1259
|
-
bare.writeU8(bc,
|
|
1293
|
+
bare.writeU8(bc, 3);
|
|
1260
1294
|
writeToClientKvResponse(bc, x.val);
|
|
1261
1295
|
break;
|
|
1262
1296
|
}
|
|
1263
1297
|
case "ToClientTunnelMessage": {
|
|
1264
|
-
bare.writeU8(bc,
|
|
1298
|
+
bare.writeU8(bc, 4);
|
|
1265
1299
|
writeToClientTunnelMessage(bc, x.val);
|
|
1266
1300
|
break;
|
|
1267
1301
|
}
|
|
1302
|
+
case "ToClientPing": {
|
|
1303
|
+
bare.writeU8(bc, 5);
|
|
1304
|
+
writeToClientPing(bc, x.val);
|
|
1305
|
+
break;
|
|
1306
|
+
}
|
|
1268
1307
|
}
|
|
1269
1308
|
}
|
|
1270
1309
|
function encodeToClient(x, config) {
|
|
@@ -1303,16 +1342,12 @@ function readToRunner(bc) {
|
|
|
1303
1342
|
case 0:
|
|
1304
1343
|
return { tag: "ToRunnerPing", val: readToRunnerPing(bc) };
|
|
1305
1344
|
case 1:
|
|
1306
|
-
return { tag: "
|
|
1345
|
+
return { tag: "ToRunnerClose", val: null };
|
|
1307
1346
|
case 2:
|
|
1308
|
-
return { tag: "ToClientClose", val: null };
|
|
1309
|
-
case 3:
|
|
1310
1347
|
return { tag: "ToClientCommands", val: readToClientCommands(bc) };
|
|
1311
|
-
case
|
|
1348
|
+
case 3:
|
|
1312
1349
|
return { tag: "ToClientAckEvents", val: readToClientAckEvents(bc) };
|
|
1313
|
-
case
|
|
1314
|
-
return { tag: "ToClientKvResponse", val: readToClientKvResponse(bc) };
|
|
1315
|
-
case 6:
|
|
1350
|
+
case 4:
|
|
1316
1351
|
return { tag: "ToClientTunnelMessage", val: readToClientTunnelMessage(bc) };
|
|
1317
1352
|
default: {
|
|
1318
1353
|
bc.offset = offset;
|
|
@@ -1327,32 +1362,22 @@ function writeToRunner(bc, x) {
|
|
|
1327
1362
|
writeToRunnerPing(bc, x.val);
|
|
1328
1363
|
break;
|
|
1329
1364
|
}
|
|
1330
|
-
case "
|
|
1365
|
+
case "ToRunnerClose": {
|
|
1331
1366
|
bare.writeU8(bc, 1);
|
|
1332
|
-
writeToClientInit(bc, x.val);
|
|
1333
|
-
break;
|
|
1334
|
-
}
|
|
1335
|
-
case "ToClientClose": {
|
|
1336
|
-
bare.writeU8(bc, 2);
|
|
1337
1367
|
break;
|
|
1338
1368
|
}
|
|
1339
1369
|
case "ToClientCommands": {
|
|
1340
|
-
bare.writeU8(bc,
|
|
1370
|
+
bare.writeU8(bc, 2);
|
|
1341
1371
|
writeToClientCommands(bc, x.val);
|
|
1342
1372
|
break;
|
|
1343
1373
|
}
|
|
1344
1374
|
case "ToClientAckEvents": {
|
|
1345
|
-
bare.writeU8(bc,
|
|
1375
|
+
bare.writeU8(bc, 3);
|
|
1346
1376
|
writeToClientAckEvents(bc, x.val);
|
|
1347
1377
|
break;
|
|
1348
1378
|
}
|
|
1349
|
-
case "ToClientKvResponse": {
|
|
1350
|
-
bare.writeU8(bc, 5);
|
|
1351
|
-
writeToClientKvResponse(bc, x.val);
|
|
1352
|
-
break;
|
|
1353
|
-
}
|
|
1354
1379
|
case "ToClientTunnelMessage": {
|
|
1355
|
-
bare.writeU8(bc,
|
|
1380
|
+
bare.writeU8(bc, 4);
|
|
1356
1381
|
writeToClientTunnelMessage(bc, x.val);
|
|
1357
1382
|
break;
|
|
1358
1383
|
}
|
|
@@ -1432,11 +1457,13 @@ function decodeToGateway(bytes) {
|
|
|
1432
1457
|
}
|
|
1433
1458
|
function readToServerlessServerInit(bc) {
|
|
1434
1459
|
return {
|
|
1435
|
-
runnerId: readId(bc)
|
|
1460
|
+
runnerId: readId(bc),
|
|
1461
|
+
runnerProtocolVersion: bare.readU16(bc)
|
|
1436
1462
|
};
|
|
1437
1463
|
}
|
|
1438
1464
|
function writeToServerlessServerInit(bc, x) {
|
|
1439
1465
|
writeId(bc, x.runnerId);
|
|
1466
|
+
bare.writeU16(bc, x.runnerProtocolVersion);
|
|
1440
1467
|
}
|
|
1441
1468
|
function readToServerlessServer(bc) {
|
|
1442
1469
|
const offset = bc.offset;
|
|
@@ -1478,16 +1505,20 @@ function decodeToServerlessServer(bytes) {
|
|
|
1478
1505
|
}
|
|
1479
1506
|
export {
|
|
1480
1507
|
StopCode,
|
|
1508
|
+
decodeActorCommandKeyData,
|
|
1481
1509
|
decodeToClient,
|
|
1482
1510
|
decodeToGateway,
|
|
1483
1511
|
decodeToRunner,
|
|
1484
1512
|
decodeToServer,
|
|
1485
1513
|
decodeToServerlessServer,
|
|
1514
|
+
encodeActorCommandKeyData,
|
|
1486
1515
|
encodeToClient,
|
|
1487
1516
|
encodeToGateway,
|
|
1488
1517
|
encodeToRunner,
|
|
1489
1518
|
encodeToServer,
|
|
1490
1519
|
encodeToServerlessServer,
|
|
1520
|
+
readActorCheckpoint,
|
|
1521
|
+
readActorCommandKeyData,
|
|
1491
1522
|
readActorConfig,
|
|
1492
1523
|
readActorIntent,
|
|
1493
1524
|
readActorName,
|
|
@@ -1495,7 +1526,6 @@ export {
|
|
|
1495
1526
|
readActorStateStopped,
|
|
1496
1527
|
readCommand,
|
|
1497
1528
|
readCommandStartActor,
|
|
1498
|
-
readCommandStopActor,
|
|
1499
1529
|
readCommandWrapper,
|
|
1500
1530
|
readEvent,
|
|
1501
1531
|
readEventActorIntent,
|
|
@@ -1531,6 +1561,7 @@ export {
|
|
|
1531
1561
|
readToClientCommands,
|
|
1532
1562
|
readToClientInit,
|
|
1533
1563
|
readToClientKvResponse,
|
|
1564
|
+
readToClientPing,
|
|
1534
1565
|
readToClientRequestChunk,
|
|
1535
1566
|
readToClientRequestStart,
|
|
1536
1567
|
readToClientTunnelMessage,
|
|
@@ -1547,7 +1578,7 @@ export {
|
|
|
1547
1578
|
readToServerEvents,
|
|
1548
1579
|
readToServerInit,
|
|
1549
1580
|
readToServerKvRequest,
|
|
1550
|
-
|
|
1581
|
+
readToServerPong,
|
|
1551
1582
|
readToServerResponseChunk,
|
|
1552
1583
|
readToServerResponseStart,
|
|
1553
1584
|
readToServerTunnelMessage,
|
|
@@ -1558,6 +1589,8 @@ export {
|
|
|
1558
1589
|
readToServerWebSocketOpen,
|
|
1559
1590
|
readToServerlessServer,
|
|
1560
1591
|
readToServerlessServerInit,
|
|
1592
|
+
writeActorCheckpoint,
|
|
1593
|
+
writeActorCommandKeyData,
|
|
1561
1594
|
writeActorConfig,
|
|
1562
1595
|
writeActorIntent,
|
|
1563
1596
|
writeActorName,
|
|
@@ -1565,7 +1598,6 @@ export {
|
|
|
1565
1598
|
writeActorStateStopped,
|
|
1566
1599
|
writeCommand,
|
|
1567
1600
|
writeCommandStartActor,
|
|
1568
|
-
writeCommandStopActor,
|
|
1569
1601
|
writeCommandWrapper,
|
|
1570
1602
|
writeEvent,
|
|
1571
1603
|
writeEventActorIntent,
|
|
@@ -1601,6 +1633,7 @@ export {
|
|
|
1601
1633
|
writeToClientCommands,
|
|
1602
1634
|
writeToClientInit,
|
|
1603
1635
|
writeToClientKvResponse,
|
|
1636
|
+
writeToClientPing,
|
|
1604
1637
|
writeToClientRequestChunk,
|
|
1605
1638
|
writeToClientRequestStart,
|
|
1606
1639
|
writeToClientTunnelMessage,
|
|
@@ -1617,7 +1650,7 @@ export {
|
|
|
1617
1650
|
writeToServerEvents,
|
|
1618
1651
|
writeToServerInit,
|
|
1619
1652
|
writeToServerKvRequest,
|
|
1620
|
-
|
|
1653
|
+
writeToServerPong,
|
|
1621
1654
|
writeToServerResponseChunk,
|
|
1622
1655
|
writeToServerResponseStart,
|
|
1623
1656
|
writeToServerTunnelMessage,
|