rivetkit 2.0.41 → 2.0.43-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/{chunk-LMG4QMDO.js → chunk-2NJQ3DJ5.js} +15 -5
- package/dist/tsup/{chunk-LMG4QMDO.js.map → chunk-2NJQ3DJ5.js.map} +1 -1
- package/dist/tsup/{chunk-SNAUKDDK.cjs → chunk-2XQS746M.cjs} +4 -4
- package/dist/tsup/chunk-2XQS746M.cjs.map +1 -0
- package/dist/tsup/{chunk-DSNSFYDL.cjs → chunk-3HKN5HQ7.cjs} +3 -3
- package/dist/tsup/chunk-3HKN5HQ7.cjs.map +1 -0
- package/dist/tsup/{chunk-B5UXC4QV.cjs → chunk-BEMEUFS2.cjs} +78 -78
- package/dist/tsup/chunk-BEMEUFS2.cjs.map +1 -0
- package/dist/tsup/chunk-CKBPIXRM.js +278 -0
- package/dist/tsup/chunk-CKBPIXRM.js.map +1 -0
- package/dist/tsup/{chunk-GTQKDCM4.cjs → chunk-ETNL2HZL.cjs} +49 -49
- package/dist/tsup/chunk-ETNL2HZL.cjs.map +1 -0
- package/dist/tsup/{chunk-OXN6EZUB.js → chunk-F7ZL4T63.js} +3 -3
- package/dist/tsup/chunk-GBENOENJ.cjs.map +1 -1
- package/dist/tsup/chunk-KDFWJKMJ.cjs.map +1 -1
- package/dist/tsup/{chunk-2YHR67M4.js → chunk-LFVF5SCU.js} +4 -4
- package/dist/tsup/chunk-LFVF5SCU.js.map +1 -0
- package/dist/tsup/{chunk-4UHJ3ADW.cjs → chunk-MQ3PTGWH.cjs} +115 -99
- package/dist/tsup/chunk-MQ3PTGWH.cjs.map +1 -0
- package/dist/tsup/{chunk-Y7ZDTLD2.js → chunk-NENM5PQN.js} +2 -2
- package/dist/tsup/chunk-R33VIC3W.cjs +278 -0
- package/dist/tsup/chunk-R33VIC3W.cjs.map +1 -0
- package/dist/tsup/{chunk-QDVKDX7G.cjs → chunk-ROVVTBUE.cjs} +9 -9
- package/dist/tsup/chunk-ROVVTBUE.cjs.map +1 -0
- package/dist/tsup/{chunk-7KIR3QLO.js → chunk-S22E2HUH.js} +24 -8
- package/dist/tsup/chunk-S22E2HUH.js.map +1 -0
- package/dist/tsup/{chunk-UGOCTUBG.js → chunk-TFMRMA5S.js} +5 -5
- package/dist/tsup/{chunk-WYZLRPQM.cjs → chunk-YR6H6STI.cjs} +269 -269
- package/dist/tsup/chunk-YR6H6STI.cjs.map +1 -0
- package/dist/tsup/{chunk-S6F7EKC7.cjs → chunk-YZZF7DES.cjs} +20 -10
- package/dist/tsup/chunk-YZZF7DES.cjs.map +1 -0
- package/dist/tsup/{chunk-4J5EFV3E.js → chunk-Z3BORZE2.js} +5 -5
- package/dist/tsup/{chunk-NRP2OHSW.js → chunk-ZKCVZA7Z.js} +5 -5
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +2 -2
- package/dist/tsup/common/log.d.ts +2 -2
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.cjs.map +1 -1
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-D43N-CFi.d.ts → config-CLnylLYY.d.ts} +10 -10
- package/dist/tsup/{config-COyis_uH.d.cts → config-CZB2-W8x.d.cts} +10 -10
- package/dist/tsup/{driver-KyM2v645.d.ts → driver-D0QX9M11.d.ts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +4 -4
- package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
- package/dist/tsup/driver-helpers/mod.d.cts +2 -2
- package/dist/tsup/driver-helpers/mod.d.ts +2 -2
- package/dist/tsup/driver-helpers/mod.js +3 -3
- package/dist/tsup/{driver-Bt7B-qMd.d.cts → driver-q-zqG7fc.d.cts} +1 -1
- package/dist/tsup/driver-test-suite/mod.cjs +323 -448
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
- package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
- package/dist/tsup/driver-test-suite/mod.js +916 -1041
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/mod.cjs +8 -8
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +4 -4
- package/dist/tsup/mod.d.ts +4 -4
- package/dist/tsup/mod.js +7 -7
- package/dist/tsup/serve-test-suite/mod.cjs +1581 -0
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -0
- package/dist/tsup/serve-test-suite/mod.d.cts +9 -0
- package/dist/tsup/serve-test-suite/mod.d.ts +9 -0
- package/dist/tsup/serve-test-suite/mod.js +1578 -0
- package/dist/tsup/serve-test-suite/mod.js.map +1 -0
- package/dist/tsup/test/mod.cjs +8 -8
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +7 -7
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.js +2 -2
- package/package.json +14 -4
- package/src/actor/errors.ts +4 -4
- package/src/driver-test-suite/mod.ts +3 -0
- package/src/driver-test-suite/tests/actor-driver.ts +4 -0
- package/src/driver-test-suite/tests/actor-lifecycle.ts +157 -0
- package/src/driver-test-suite/tests/conn-error-serialization.ts +64 -0
- package/src/drivers/engine/actor-driver.ts +24 -4
- package/src/serve-test-suite/mod.ts +147 -0
- package/dist/schemas/actor-persist/v1.js +0 -167
- package/dist/schemas/actor-persist/v2.js +0 -200
- package/dist/schemas/actor-persist/v3.js +0 -200
- package/dist/schemas/client-protocol/v1.js +0 -301
- package/dist/schemas/client-protocol/v2.js +0 -299
- package/dist/schemas/file-system-driver/v1.js +0 -76
- package/dist/schemas/file-system-driver/v2.js +0 -103
- package/dist/schemas/file-system-driver/v3.js +0 -122
- package/dist/tsup/chunk-2YHR67M4.js.map +0 -1
- package/dist/tsup/chunk-4UHJ3ADW.cjs.map +0 -1
- package/dist/tsup/chunk-7KIR3QLO.js.map +0 -1
- package/dist/tsup/chunk-B5UXC4QV.cjs.map +0 -1
- package/dist/tsup/chunk-DSNSFYDL.cjs.map +0 -1
- package/dist/tsup/chunk-GTQKDCM4.cjs.map +0 -1
- package/dist/tsup/chunk-QDVKDX7G.cjs.map +0 -1
- package/dist/tsup/chunk-S6F7EKC7.cjs.map +0 -1
- package/dist/tsup/chunk-SNAUKDDK.cjs.map +0 -1
- package/dist/tsup/chunk-WYZLRPQM.cjs.map +0 -1
- /package/dist/tsup/{chunk-OXN6EZUB.js.map → chunk-F7ZL4T63.js.map} +0 -0
- /package/dist/tsup/{chunk-Y7ZDTLD2.js.map → chunk-NENM5PQN.js.map} +0 -0
- /package/dist/tsup/{chunk-UGOCTUBG.js.map → chunk-TFMRMA5S.js.map} +0 -0
- /package/dist/tsup/{chunk-4J5EFV3E.js.map → chunk-Z3BORZE2.js.map} +0 -0
- /package/dist/tsup/{chunk-NRP2OHSW.js.map → chunk-ZKCVZA7Z.js.map} +0 -0
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
// @generated - post-processed by compile-bare.ts
|
|
2
|
-
import * as bare from "@rivetkit/bare-ts";
|
|
3
|
-
const config = /* @__PURE__ */ bare.Config({});
|
|
4
|
-
export function readGatewayId(bc) {
|
|
5
|
-
return bare.readFixedData(bc, 4);
|
|
6
|
-
}
|
|
7
|
-
export function writeGatewayId(bc, x) {
|
|
8
|
-
assert(x.byteLength === 4);
|
|
9
|
-
bare.writeFixedData(bc, x);
|
|
10
|
-
}
|
|
11
|
-
export function readRequestId(bc) {
|
|
12
|
-
return bare.readFixedData(bc, 4);
|
|
13
|
-
}
|
|
14
|
-
export function writeRequestId(bc, x) {
|
|
15
|
-
assert(x.byteLength === 4);
|
|
16
|
-
bare.writeFixedData(bc, x);
|
|
17
|
-
}
|
|
18
|
-
export function readMessageIndex(bc) {
|
|
19
|
-
return bare.readU16(bc);
|
|
20
|
-
}
|
|
21
|
-
export function writeMessageIndex(bc, x) {
|
|
22
|
-
bare.writeU16(bc, x);
|
|
23
|
-
}
|
|
24
|
-
export function encodeMessageIndex(x) {
|
|
25
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
26
|
-
writeMessageIndex(bc, x);
|
|
27
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
28
|
-
}
|
|
29
|
-
export function decodeMessageIndex(bytes) {
|
|
30
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
31
|
-
const result = readMessageIndex(bc);
|
|
32
|
-
if (bc.offset < bc.view.byteLength) {
|
|
33
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
export function readCbor(bc) {
|
|
38
|
-
return bare.readData(bc);
|
|
39
|
-
}
|
|
40
|
-
export function writeCbor(bc, x) {
|
|
41
|
-
bare.writeData(bc, x);
|
|
42
|
-
}
|
|
43
|
-
export function readSubscription(bc) {
|
|
44
|
-
return {
|
|
45
|
-
eventName: bare.readString(bc),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export function writeSubscription(bc, x) {
|
|
49
|
-
bare.writeString(bc, x.eventName);
|
|
50
|
-
}
|
|
51
|
-
function read0(bc) {
|
|
52
|
-
const len = bare.readUintSafe(bc);
|
|
53
|
-
if (len === 0) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
const result = [readSubscription(bc)];
|
|
57
|
-
for (let i = 1; i < len; i++) {
|
|
58
|
-
result[i] = readSubscription(bc);
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
function write0(bc, x) {
|
|
63
|
-
bare.writeUintSafe(bc, x.length);
|
|
64
|
-
for (let i = 0; i < x.length; i++) {
|
|
65
|
-
writeSubscription(bc, x[i]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function read1(bc) {
|
|
69
|
-
const len = bare.readUintSafe(bc);
|
|
70
|
-
const result = new Map();
|
|
71
|
-
for (let i = 0; i < len; i++) {
|
|
72
|
-
const offset = bc.offset;
|
|
73
|
-
const key = bare.readString(bc);
|
|
74
|
-
if (result.has(key)) {
|
|
75
|
-
bc.offset = offset;
|
|
76
|
-
throw new bare.BareError(offset, "duplicated key");
|
|
77
|
-
}
|
|
78
|
-
result.set(key, bare.readString(bc));
|
|
79
|
-
}
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
function write1(bc, x) {
|
|
83
|
-
bare.writeUintSafe(bc, x.size);
|
|
84
|
-
for (const kv of x) {
|
|
85
|
-
bare.writeString(bc, kv[0]);
|
|
86
|
-
bare.writeString(bc, kv[1]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
export function readConn(bc) {
|
|
90
|
-
return {
|
|
91
|
-
id: bare.readString(bc),
|
|
92
|
-
parameters: readCbor(bc),
|
|
93
|
-
state: readCbor(bc),
|
|
94
|
-
subscriptions: read0(bc),
|
|
95
|
-
gatewayId: readGatewayId(bc),
|
|
96
|
-
requestId: readRequestId(bc),
|
|
97
|
-
serverMessageIndex: bare.readU16(bc),
|
|
98
|
-
clientMessageIndex: bare.readU16(bc),
|
|
99
|
-
requestPath: bare.readString(bc),
|
|
100
|
-
requestHeaders: read1(bc),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
export function writeConn(bc, x) {
|
|
104
|
-
bare.writeString(bc, x.id);
|
|
105
|
-
writeCbor(bc, x.parameters);
|
|
106
|
-
writeCbor(bc, x.state);
|
|
107
|
-
write0(bc, x.subscriptions);
|
|
108
|
-
writeGatewayId(bc, x.gatewayId);
|
|
109
|
-
writeRequestId(bc, x.requestId);
|
|
110
|
-
bare.writeU16(bc, x.serverMessageIndex);
|
|
111
|
-
bare.writeU16(bc, x.clientMessageIndex);
|
|
112
|
-
bare.writeString(bc, x.requestPath);
|
|
113
|
-
write1(bc, x.requestHeaders);
|
|
114
|
-
}
|
|
115
|
-
export function encodeConn(x) {
|
|
116
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
117
|
-
writeConn(bc, x);
|
|
118
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
119
|
-
}
|
|
120
|
-
export function decodeConn(bytes) {
|
|
121
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
122
|
-
const result = readConn(bc);
|
|
123
|
-
if (bc.offset < bc.view.byteLength) {
|
|
124
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
125
|
-
}
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
function read2(bc) {
|
|
129
|
-
return bare.readBool(bc)
|
|
130
|
-
? readCbor(bc)
|
|
131
|
-
: null;
|
|
132
|
-
}
|
|
133
|
-
function write2(bc, x) {
|
|
134
|
-
bare.writeBool(bc, x !== null);
|
|
135
|
-
if (x !== null) {
|
|
136
|
-
writeCbor(bc, x);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export function readScheduleEvent(bc) {
|
|
140
|
-
return {
|
|
141
|
-
eventId: bare.readString(bc),
|
|
142
|
-
timestamp: bare.readI64(bc),
|
|
143
|
-
action: bare.readString(bc),
|
|
144
|
-
args: read2(bc),
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
export function writeScheduleEvent(bc, x) {
|
|
148
|
-
bare.writeString(bc, x.eventId);
|
|
149
|
-
bare.writeI64(bc, x.timestamp);
|
|
150
|
-
bare.writeString(bc, x.action);
|
|
151
|
-
write2(bc, x.args);
|
|
152
|
-
}
|
|
153
|
-
function read3(bc) {
|
|
154
|
-
const len = bare.readUintSafe(bc);
|
|
155
|
-
if (len === 0) {
|
|
156
|
-
return [];
|
|
157
|
-
}
|
|
158
|
-
const result = [readScheduleEvent(bc)];
|
|
159
|
-
for (let i = 1; i < len; i++) {
|
|
160
|
-
result[i] = readScheduleEvent(bc);
|
|
161
|
-
}
|
|
162
|
-
return result;
|
|
163
|
-
}
|
|
164
|
-
function write3(bc, x) {
|
|
165
|
-
bare.writeUintSafe(bc, x.length);
|
|
166
|
-
for (let i = 0; i < x.length; i++) {
|
|
167
|
-
writeScheduleEvent(bc, x[i]);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
export function readActor(bc) {
|
|
171
|
-
return {
|
|
172
|
-
input: read2(bc),
|
|
173
|
-
hasInitialized: bare.readBool(bc),
|
|
174
|
-
state: readCbor(bc),
|
|
175
|
-
scheduledEvents: read3(bc),
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
export function writeActor(bc, x) {
|
|
179
|
-
write2(bc, x.input);
|
|
180
|
-
bare.writeBool(bc, x.hasInitialized);
|
|
181
|
-
writeCbor(bc, x.state);
|
|
182
|
-
write3(bc, x.scheduledEvents);
|
|
183
|
-
}
|
|
184
|
-
export function encodeActor(x) {
|
|
185
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
186
|
-
writeActor(bc, x);
|
|
187
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
188
|
-
}
|
|
189
|
-
export function decodeActor(bytes) {
|
|
190
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
191
|
-
const result = readActor(bc);
|
|
192
|
-
if (bc.offset < bc.view.byteLength) {
|
|
193
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
194
|
-
}
|
|
195
|
-
return result;
|
|
196
|
-
}
|
|
197
|
-
function assert(condition, message) {
|
|
198
|
-
if (!condition)
|
|
199
|
-
throw new Error(message ?? "Assertion failed");
|
|
200
|
-
}
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
// @generated - post-processed by compile-bare.ts
|
|
2
|
-
import * as bare from "@rivetkit/bare-ts";
|
|
3
|
-
const config = /* @__PURE__ */ bare.Config({});
|
|
4
|
-
export function readInit(bc) {
|
|
5
|
-
return {
|
|
6
|
-
actorId: bare.readString(bc),
|
|
7
|
-
connectionId: bare.readString(bc),
|
|
8
|
-
connectionToken: bare.readString(bc),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export function writeInit(bc, x) {
|
|
12
|
-
bare.writeString(bc, x.actorId);
|
|
13
|
-
bare.writeString(bc, x.connectionId);
|
|
14
|
-
bare.writeString(bc, x.connectionToken);
|
|
15
|
-
}
|
|
16
|
-
function read0(bc) {
|
|
17
|
-
return bare.readBool(bc)
|
|
18
|
-
? bare.readData(bc)
|
|
19
|
-
: null;
|
|
20
|
-
}
|
|
21
|
-
function write0(bc, x) {
|
|
22
|
-
bare.writeBool(bc, x !== null);
|
|
23
|
-
if (x !== null) {
|
|
24
|
-
bare.writeData(bc, x);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function read1(bc) {
|
|
28
|
-
return bare.readBool(bc)
|
|
29
|
-
? bare.readUint(bc)
|
|
30
|
-
: null;
|
|
31
|
-
}
|
|
32
|
-
function write1(bc, x) {
|
|
33
|
-
bare.writeBool(bc, x !== null);
|
|
34
|
-
if (x !== null) {
|
|
35
|
-
bare.writeUint(bc, x);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export function readError(bc) {
|
|
39
|
-
return {
|
|
40
|
-
group: bare.readString(bc),
|
|
41
|
-
code: bare.readString(bc),
|
|
42
|
-
message: bare.readString(bc),
|
|
43
|
-
metadata: read0(bc),
|
|
44
|
-
actionId: read1(bc),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export function writeError(bc, x) {
|
|
48
|
-
bare.writeString(bc, x.group);
|
|
49
|
-
bare.writeString(bc, x.code);
|
|
50
|
-
bare.writeString(bc, x.message);
|
|
51
|
-
write0(bc, x.metadata);
|
|
52
|
-
write1(bc, x.actionId);
|
|
53
|
-
}
|
|
54
|
-
export function readActionResponse(bc) {
|
|
55
|
-
return {
|
|
56
|
-
id: bare.readUint(bc),
|
|
57
|
-
output: bare.readData(bc),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export function writeActionResponse(bc, x) {
|
|
61
|
-
bare.writeUint(bc, x.id);
|
|
62
|
-
bare.writeData(bc, x.output);
|
|
63
|
-
}
|
|
64
|
-
export function readEvent(bc) {
|
|
65
|
-
return {
|
|
66
|
-
name: bare.readString(bc),
|
|
67
|
-
args: bare.readData(bc),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export function writeEvent(bc, x) {
|
|
71
|
-
bare.writeString(bc, x.name);
|
|
72
|
-
bare.writeData(bc, x.args);
|
|
73
|
-
}
|
|
74
|
-
export function readToClientBody(bc) {
|
|
75
|
-
const offset = bc.offset;
|
|
76
|
-
const tag = bare.readU8(bc);
|
|
77
|
-
switch (tag) {
|
|
78
|
-
case 0:
|
|
79
|
-
return { tag: "Init", val: readInit(bc) };
|
|
80
|
-
case 1:
|
|
81
|
-
return { tag: "Error", val: readError(bc) };
|
|
82
|
-
case 2:
|
|
83
|
-
return { tag: "ActionResponse", val: readActionResponse(bc) };
|
|
84
|
-
case 3:
|
|
85
|
-
return { tag: "Event", val: readEvent(bc) };
|
|
86
|
-
default: {
|
|
87
|
-
bc.offset = offset;
|
|
88
|
-
throw new bare.BareError(offset, "invalid tag");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
export function writeToClientBody(bc, x) {
|
|
93
|
-
switch (x.tag) {
|
|
94
|
-
case "Init": {
|
|
95
|
-
bare.writeU8(bc, 0);
|
|
96
|
-
writeInit(bc, x.val);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case "Error": {
|
|
100
|
-
bare.writeU8(bc, 1);
|
|
101
|
-
writeError(bc, x.val);
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
case "ActionResponse": {
|
|
105
|
-
bare.writeU8(bc, 2);
|
|
106
|
-
writeActionResponse(bc, x.val);
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
case "Event": {
|
|
110
|
-
bare.writeU8(bc, 3);
|
|
111
|
-
writeEvent(bc, x.val);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
export function readToClient(bc) {
|
|
117
|
-
return {
|
|
118
|
-
body: readToClientBody(bc),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
export function writeToClient(bc, x) {
|
|
122
|
-
writeToClientBody(bc, x.body);
|
|
123
|
-
}
|
|
124
|
-
export function encodeToClient(x) {
|
|
125
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
126
|
-
writeToClient(bc, x);
|
|
127
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
128
|
-
}
|
|
129
|
-
export function decodeToClient(bytes) {
|
|
130
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
131
|
-
const result = readToClient(bc);
|
|
132
|
-
if (bc.offset < bc.view.byteLength) {
|
|
133
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
134
|
-
}
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
export function readActionRequest(bc) {
|
|
138
|
-
return {
|
|
139
|
-
id: bare.readUint(bc),
|
|
140
|
-
name: bare.readString(bc),
|
|
141
|
-
args: bare.readData(bc),
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
export function writeActionRequest(bc, x) {
|
|
145
|
-
bare.writeUint(bc, x.id);
|
|
146
|
-
bare.writeString(bc, x.name);
|
|
147
|
-
bare.writeData(bc, x.args);
|
|
148
|
-
}
|
|
149
|
-
export function readSubscriptionRequest(bc) {
|
|
150
|
-
return {
|
|
151
|
-
eventName: bare.readString(bc),
|
|
152
|
-
subscribe: bare.readBool(bc),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
export function writeSubscriptionRequest(bc, x) {
|
|
156
|
-
bare.writeString(bc, x.eventName);
|
|
157
|
-
bare.writeBool(bc, x.subscribe);
|
|
158
|
-
}
|
|
159
|
-
export function readToServerBody(bc) {
|
|
160
|
-
const offset = bc.offset;
|
|
161
|
-
const tag = bare.readU8(bc);
|
|
162
|
-
switch (tag) {
|
|
163
|
-
case 0:
|
|
164
|
-
return { tag: "ActionRequest", val: readActionRequest(bc) };
|
|
165
|
-
case 1:
|
|
166
|
-
return { tag: "SubscriptionRequest", val: readSubscriptionRequest(bc) };
|
|
167
|
-
default: {
|
|
168
|
-
bc.offset = offset;
|
|
169
|
-
throw new bare.BareError(offset, "invalid tag");
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
export function writeToServerBody(bc, x) {
|
|
174
|
-
switch (x.tag) {
|
|
175
|
-
case "ActionRequest": {
|
|
176
|
-
bare.writeU8(bc, 0);
|
|
177
|
-
writeActionRequest(bc, x.val);
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
case "SubscriptionRequest": {
|
|
181
|
-
bare.writeU8(bc, 1);
|
|
182
|
-
writeSubscriptionRequest(bc, x.val);
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
export function readToServer(bc) {
|
|
188
|
-
return {
|
|
189
|
-
body: readToServerBody(bc),
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
export function writeToServer(bc, x) {
|
|
193
|
-
writeToServerBody(bc, x.body);
|
|
194
|
-
}
|
|
195
|
-
export function encodeToServer(x) {
|
|
196
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
197
|
-
writeToServer(bc, x);
|
|
198
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
199
|
-
}
|
|
200
|
-
export function decodeToServer(bytes) {
|
|
201
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
202
|
-
const result = readToServer(bc);
|
|
203
|
-
if (bc.offset < bc.view.byteLength) {
|
|
204
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
205
|
-
}
|
|
206
|
-
return result;
|
|
207
|
-
}
|
|
208
|
-
export function readHttpActionRequest(bc) {
|
|
209
|
-
return {
|
|
210
|
-
args: bare.readData(bc),
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
export function writeHttpActionRequest(bc, x) {
|
|
214
|
-
bare.writeData(bc, x.args);
|
|
215
|
-
}
|
|
216
|
-
export function encodeHttpActionRequest(x) {
|
|
217
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
218
|
-
writeHttpActionRequest(bc, x);
|
|
219
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
220
|
-
}
|
|
221
|
-
export function decodeHttpActionRequest(bytes) {
|
|
222
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
223
|
-
const result = readHttpActionRequest(bc);
|
|
224
|
-
if (bc.offset < bc.view.byteLength) {
|
|
225
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
226
|
-
}
|
|
227
|
-
return result;
|
|
228
|
-
}
|
|
229
|
-
export function readHttpActionResponse(bc) {
|
|
230
|
-
return {
|
|
231
|
-
output: bare.readData(bc),
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
export function writeHttpActionResponse(bc, x) {
|
|
235
|
-
bare.writeData(bc, x.output);
|
|
236
|
-
}
|
|
237
|
-
export function encodeHttpActionResponse(x) {
|
|
238
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
239
|
-
writeHttpActionResponse(bc, x);
|
|
240
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
241
|
-
}
|
|
242
|
-
export function decodeHttpActionResponse(bytes) {
|
|
243
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
244
|
-
const result = readHttpActionResponse(bc);
|
|
245
|
-
if (bc.offset < bc.view.byteLength) {
|
|
246
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
247
|
-
}
|
|
248
|
-
return result;
|
|
249
|
-
}
|
|
250
|
-
export function readHttpResponseError(bc) {
|
|
251
|
-
return {
|
|
252
|
-
group: bare.readString(bc),
|
|
253
|
-
code: bare.readString(bc),
|
|
254
|
-
message: bare.readString(bc),
|
|
255
|
-
metadata: read0(bc),
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
export function writeHttpResponseError(bc, x) {
|
|
259
|
-
bare.writeString(bc, x.group);
|
|
260
|
-
bare.writeString(bc, x.code);
|
|
261
|
-
bare.writeString(bc, x.message);
|
|
262
|
-
write0(bc, x.metadata);
|
|
263
|
-
}
|
|
264
|
-
export function encodeHttpResponseError(x) {
|
|
265
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
266
|
-
writeHttpResponseError(bc, x);
|
|
267
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
268
|
-
}
|
|
269
|
-
export function decodeHttpResponseError(bytes) {
|
|
270
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
271
|
-
const result = readHttpResponseError(bc);
|
|
272
|
-
if (bc.offset < bc.view.byteLength) {
|
|
273
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
274
|
-
}
|
|
275
|
-
return result;
|
|
276
|
-
}
|
|
277
|
-
export function readHttpResolveResponse(bc) {
|
|
278
|
-
return {
|
|
279
|
-
actorId: bare.readString(bc),
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
export function writeHttpResolveResponse(bc, x) {
|
|
283
|
-
bare.writeString(bc, x.actorId);
|
|
284
|
-
}
|
|
285
|
-
export function encodeHttpResolveResponse(x) {
|
|
286
|
-
const bc = new bare.ByteCursor(new Uint8Array(config.initialBufferLength), config);
|
|
287
|
-
writeHttpResolveResponse(bc, x);
|
|
288
|
-
return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset);
|
|
289
|
-
}
|
|
290
|
-
export function decodeHttpResolveResponse(bytes) {
|
|
291
|
-
const bc = new bare.ByteCursor(bytes, config);
|
|
292
|
-
const result = readHttpResolveResponse(bc);
|
|
293
|
-
if (bc.offset < bc.view.byteLength) {
|
|
294
|
-
throw new bare.BareError(bc.offset, "remaining bytes");
|
|
295
|
-
}
|
|
296
|
-
return result;
|
|
297
|
-
}
|
|
298
|
-
function assert(condition, message) {
|
|
299
|
-
if (!condition)
|
|
300
|
-
throw new Error(message ?? "Assertion failed");
|
|
301
|
-
}
|