rivetkit 2.0.37 → 2.0.39
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/{chunk-G4N7FZMM.cjs → chunk-7E3RWMR6.cjs} +195 -93
- package/dist/tsup/chunk-7E3RWMR6.cjs.map +1 -0
- package/dist/tsup/{chunk-J6TX5EFW.js → chunk-BQ36VTSB.js} +108 -6
- package/dist/tsup/chunk-BQ36VTSB.js.map +1 -0
- package/dist/tsup/{chunk-4V7MS7SO.cjs → chunk-C64FV764.cjs} +3 -3
- package/dist/tsup/{chunk-4V7MS7SO.cjs.map → chunk-C64FV764.cjs.map} +1 -1
- package/dist/tsup/{chunk-XI335ZED.js → chunk-CDK6DRO2.js} +6 -4
- package/dist/tsup/chunk-CDK6DRO2.js.map +1 -0
- package/dist/tsup/{chunk-LYYTV7DN.cjs → chunk-DY4H3ASE.cjs} +50 -46
- package/dist/tsup/chunk-DY4H3ASE.cjs.map +1 -0
- package/dist/tsup/{chunk-B6BP74X3.cjs → chunk-KMYFL3OL.cjs} +318 -92
- package/dist/tsup/chunk-KMYFL3OL.cjs.map +1 -0
- package/dist/tsup/{chunk-22NKW7F5.cjs → chunk-MZPYVTVG.cjs} +9 -9
- package/dist/tsup/{chunk-22NKW7F5.cjs.map → chunk-MZPYVTVG.cjs.map} +1 -1
- package/dist/tsup/{chunk-RBA5AQTB.js → chunk-OJZRCEIA.js} +5 -5
- package/dist/tsup/{chunk-RXA3ZMCL.js → chunk-PHCD25XO.js} +2 -2
- package/dist/tsup/{chunk-5XGZXH74.js → chunk-PVKUXMOA.js} +264 -38
- package/dist/tsup/chunk-PVKUXMOA.js.map +1 -0
- package/dist/tsup/{chunk-FIUSIG6J.js → chunk-T7IPDBWH.js} +8 -4
- package/dist/tsup/{chunk-FIUSIG6J.js.map → chunk-T7IPDBWH.js.map} +1 -1
- package/dist/tsup/{chunk-5VVIFC6M.cjs → chunk-UAX5E3EU.cjs} +443 -369
- package/dist/tsup/chunk-UAX5E3EU.cjs.map +1 -0
- package/dist/tsup/{chunk-X5IX3YPO.cjs → chunk-X72X7I7T.cjs} +6 -4
- package/dist/tsup/chunk-X72X7I7T.cjs.map +1 -0
- package/dist/tsup/{chunk-ZQBSQ6H3.js → chunk-XU74APB4.js} +208 -134
- package/dist/tsup/chunk-XU74APB4.js.map +1 -0
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +3 -3
- package/dist/tsup/client/mod.d.ts +3 -3
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config--NjwiYlS.d.cts → config-BuBlMs6C.d.cts} +238 -60
- package/dist/tsup/{config-CRuzI6n4.d.ts → config-CBwo4ooA.d.ts} +238 -60
- package/dist/tsup/{driver-yKjYx9Yy.d.cts → driver-CPXmh8f8.d.cts} +1 -1
- package/dist/tsup/{driver-BcmckRaF.d.ts → driver-DxWa6HUO.d.ts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +3 -3
- 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 +2 -2
- package/dist/tsup/driver-test-suite/mod.cjs +81 -35
- 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 +407 -361
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/{kv-CTM8sCvx.d.cts → keys-Chhy4ylv.d.cts} +1 -0
- package/dist/tsup/{kv-CTM8sCvx.d.ts → keys-Chhy4ylv.d.ts} +1 -0
- package/dist/tsup/mod.cjs +19 -7
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +18 -6
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/package.json +6 -4
- package/src/actor/config.ts +198 -2
- package/src/actor/contexts/base/actor.ts +12 -0
- package/src/actor/instance/connection-manager.ts +1 -1
- package/src/actor/instance/keys.ts +29 -0
- package/src/actor/instance/kv.ts +240 -14
- package/src/actor/instance/mod.ts +5 -4
- package/src/actor/instance/state-manager.ts +1 -1
- package/src/actor/mod.ts +2 -1
- package/src/actor/router-websocket-endpoints.ts +2 -1
- package/src/client/actor-conn.ts +70 -81
- package/src/client/actor-handle.ts +35 -15
- package/src/client/actor-query.ts +47 -0
- package/src/client/errors.ts +22 -58
- package/src/client/mod.ts +1 -1
- package/src/client/utils.ts +33 -0
- package/src/driver-helpers/utils.ts +1 -1
- package/src/driver-test-suite/mod.ts +3 -0
- package/src/driver-test-suite/test-inline-client-driver.ts +3 -0
- package/src/driver-test-suite/tests/actor-kv.ts +44 -0
- package/src/driver-test-suite/utils.ts +4 -0
- package/src/drivers/engine/actor-driver.ts +3 -3
- package/src/drivers/file-system/manager.ts +5 -0
- package/src/manager/driver.ts +8 -3
- package/src/manager-api/actors.ts +1 -20
- package/src/registry/config/index.ts +68 -0
- package/src/remote-manager-driver/actor-http-client.ts +5 -3
- package/src/remote-manager-driver/actor-websocket-client.ts +18 -7
- package/src/remote-manager-driver/mod.ts +21 -1
- package/src/serverless/router.test.ts +166 -0
- package/src/serverless/router.ts +58 -5
- package/src/utils/env-vars.ts +4 -1
- package/dist/tsup/chunk-5VVIFC6M.cjs.map +0 -1
- package/dist/tsup/chunk-5XGZXH74.js.map +0 -1
- package/dist/tsup/chunk-B6BP74X3.cjs.map +0 -1
- package/dist/tsup/chunk-G4N7FZMM.cjs.map +0 -1
- package/dist/tsup/chunk-J6TX5EFW.js.map +0 -1
- package/dist/tsup/chunk-LYYTV7DN.cjs.map +0 -1
- package/dist/tsup/chunk-X5IX3YPO.cjs.map +0 -1
- package/dist/tsup/chunk-XI335ZED.js.map +0 -1
- package/dist/tsup/chunk-ZQBSQ6H3.js.map +0 -1
- /package/dist/tsup/{chunk-RBA5AQTB.js.map → chunk-OJZRCEIA.js.map} +0 -0
- /package/dist/tsup/{chunk-RXA3ZMCL.js.map → chunk-PHCD25XO.js.map} +0 -0
|
@@ -31,7 +31,7 @@ var _chunkKDFWJKMJcjs = require('./chunk-KDFWJKMJ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkX72X7I7Tcjs = require('./chunk-X72X7I7T.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -152,12 +152,215 @@ function deserializeActorKey(keyString) {
|
|
|
152
152
|
// src/actor/router-endpoints.ts
|
|
153
153
|
|
|
154
154
|
|
|
155
|
+
// src/actor/instance/keys.ts
|
|
156
|
+
var KEYS = {
|
|
157
|
+
PERSIST_DATA: Uint8Array.from([1]),
|
|
158
|
+
CONN_PREFIX: Uint8Array.from([2]),
|
|
159
|
+
// Prefix for connection keys
|
|
160
|
+
INSPECTOR_TOKEN: Uint8Array.from([3]),
|
|
161
|
+
// Inspector token key
|
|
162
|
+
KV: Uint8Array.from([4])
|
|
163
|
+
// Prefix for user-facing KV storage
|
|
164
|
+
};
|
|
165
|
+
function makePrefixedKey(key) {
|
|
166
|
+
const prefixed = new Uint8Array(KEYS.KV.length + key.length);
|
|
167
|
+
prefixed.set(KEYS.KV, 0);
|
|
168
|
+
prefixed.set(key, KEYS.KV.length);
|
|
169
|
+
return prefixed;
|
|
170
|
+
}
|
|
171
|
+
function removePrefixFromKey(prefixedKey) {
|
|
172
|
+
return prefixedKey.slice(KEYS.KV.length);
|
|
173
|
+
}
|
|
174
|
+
function makeConnKey(connId) {
|
|
175
|
+
const encoder = new TextEncoder();
|
|
176
|
+
const connIdBytes = encoder.encode(connId);
|
|
177
|
+
const key = new Uint8Array(KEYS.CONN_PREFIX.length + connIdBytes.length);
|
|
178
|
+
key.set(KEYS.CONN_PREFIX, 0);
|
|
179
|
+
key.set(connIdBytes, KEYS.CONN_PREFIX.length);
|
|
180
|
+
return key;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/actor/instance/kv.ts
|
|
184
|
+
var textEncoder = new TextEncoder();
|
|
185
|
+
var textDecoder = new TextDecoder();
|
|
186
|
+
function encodeKey(key, keyType) {
|
|
187
|
+
if (key instanceof Uint8Array) {
|
|
188
|
+
return key;
|
|
189
|
+
}
|
|
190
|
+
const resolvedKeyType = _nullishCoalesce(keyType, () => ( "text"));
|
|
191
|
+
if (resolvedKeyType === "binary") {
|
|
192
|
+
throw new TypeError("Expected a Uint8Array when keyType is binary");
|
|
193
|
+
}
|
|
194
|
+
return textEncoder.encode(key);
|
|
195
|
+
}
|
|
196
|
+
function decodeKey(key, keyType) {
|
|
197
|
+
const resolvedKeyType = _nullishCoalesce(keyType, () => ( "text"));
|
|
198
|
+
switch (resolvedKeyType) {
|
|
199
|
+
case "text":
|
|
200
|
+
return textDecoder.decode(key);
|
|
201
|
+
case "binary":
|
|
202
|
+
return key;
|
|
203
|
+
default:
|
|
204
|
+
throw new TypeError("Invalid kv key type");
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function resolveValueType(value) {
|
|
208
|
+
if (typeof value === "string") {
|
|
209
|
+
return "text";
|
|
210
|
+
}
|
|
211
|
+
if (value instanceof Uint8Array) {
|
|
212
|
+
return "binary";
|
|
213
|
+
}
|
|
214
|
+
if (value instanceof ArrayBuffer) {
|
|
215
|
+
return "arrayBuffer";
|
|
216
|
+
}
|
|
217
|
+
throw new TypeError("Invalid kv value");
|
|
218
|
+
}
|
|
219
|
+
function encodeValue(value, options) {
|
|
220
|
+
const type = _nullishCoalesce((options == null ? void 0 : options.type), () => ( resolveValueType(value)));
|
|
221
|
+
switch (type) {
|
|
222
|
+
case "text":
|
|
223
|
+
if (typeof value !== "string") {
|
|
224
|
+
throw new TypeError("Expected a string when type is text");
|
|
225
|
+
}
|
|
226
|
+
return textEncoder.encode(value);
|
|
227
|
+
case "arrayBuffer":
|
|
228
|
+
if (!(value instanceof ArrayBuffer)) {
|
|
229
|
+
throw new TypeError("Expected an ArrayBuffer when type is arrayBuffer");
|
|
230
|
+
}
|
|
231
|
+
return new Uint8Array(value);
|
|
232
|
+
case "binary":
|
|
233
|
+
if (!(value instanceof Uint8Array)) {
|
|
234
|
+
throw new TypeError("Expected a Uint8Array when type is binary");
|
|
235
|
+
}
|
|
236
|
+
return value;
|
|
237
|
+
default:
|
|
238
|
+
throw new TypeError("Invalid kv value type");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function decodeValue(value, options) {
|
|
242
|
+
const type = _nullishCoalesce((options == null ? void 0 : options.type), () => ( "text"));
|
|
243
|
+
switch (type) {
|
|
244
|
+
case "text":
|
|
245
|
+
return textDecoder.decode(value);
|
|
246
|
+
case "arrayBuffer": {
|
|
247
|
+
const copy = new Uint8Array(value.byteLength);
|
|
248
|
+
copy.set(value);
|
|
249
|
+
return copy.buffer;
|
|
250
|
+
}
|
|
251
|
+
case "binary":
|
|
252
|
+
return value;
|
|
253
|
+
default:
|
|
254
|
+
throw new TypeError("Invalid kv value type");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
var ActorKv = class {
|
|
258
|
+
#driver;
|
|
259
|
+
#actorId;
|
|
260
|
+
constructor(driver, actorId) {
|
|
261
|
+
this.#driver = driver;
|
|
262
|
+
this.#actorId = actorId;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get a single value by key.
|
|
266
|
+
*/
|
|
267
|
+
async get(key, options) {
|
|
268
|
+
const results = await this.#driver.kvBatchGet(this.#actorId, [
|
|
269
|
+
makePrefixedKey(encodeKey(key))
|
|
270
|
+
]);
|
|
271
|
+
const result = results[0];
|
|
272
|
+
if (!result) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
return decodeValue(result, options);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get multiple values by keys.
|
|
279
|
+
*/
|
|
280
|
+
async getBatch(keys, options) {
|
|
281
|
+
const prefixedKeys = keys.map(
|
|
282
|
+
(key) => makePrefixedKey(encodeKey(key))
|
|
283
|
+
);
|
|
284
|
+
const results = await this.#driver.kvBatchGet(
|
|
285
|
+
this.#actorId,
|
|
286
|
+
prefixedKeys
|
|
287
|
+
);
|
|
288
|
+
return results.map(
|
|
289
|
+
(result) => result ? decodeValue(result, options) : null
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Put a single key-value pair.
|
|
294
|
+
*/
|
|
295
|
+
async put(key, value, options) {
|
|
296
|
+
await this.#driver.kvBatchPut(this.#actorId, [
|
|
297
|
+
[makePrefixedKey(encodeKey(key)), encodeValue(value, options)]
|
|
298
|
+
]);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Put multiple key-value pairs.
|
|
302
|
+
*/
|
|
303
|
+
async putBatch(entries, options) {
|
|
304
|
+
const prefixedEntries = entries.map(
|
|
305
|
+
([key, value]) => [
|
|
306
|
+
makePrefixedKey(encodeKey(key)),
|
|
307
|
+
encodeValue(value, options)
|
|
308
|
+
]
|
|
309
|
+
);
|
|
310
|
+
await this.#driver.kvBatchPut(this.#actorId, prefixedEntries);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Delete a single key.
|
|
314
|
+
*/
|
|
315
|
+
async delete(key) {
|
|
316
|
+
await this.#driver.kvBatchDelete(this.#actorId, [
|
|
317
|
+
makePrefixedKey(encodeKey(key))
|
|
318
|
+
]);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Delete multiple keys.
|
|
322
|
+
*/
|
|
323
|
+
async deleteBatch(keys) {
|
|
324
|
+
const prefixedKeys = keys.map(
|
|
325
|
+
(key) => makePrefixedKey(encodeKey(key))
|
|
326
|
+
);
|
|
327
|
+
await this.#driver.kvBatchDelete(this.#actorId, prefixedKeys);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* List all keys with a given prefix.
|
|
331
|
+
* Returns key-value pairs where keys have the user prefix removed.
|
|
332
|
+
*/
|
|
333
|
+
async list(prefix, options) {
|
|
334
|
+
const prefixedPrefix = makePrefixedKey(
|
|
335
|
+
encodeKey(prefix, options == null ? void 0 : options.keyType)
|
|
336
|
+
);
|
|
337
|
+
const results = await this.#driver.kvListPrefix(
|
|
338
|
+
this.#actorId,
|
|
339
|
+
prefixedPrefix
|
|
340
|
+
);
|
|
341
|
+
return results.map(([key, value]) => [
|
|
342
|
+
decodeKey(removePrefixFromKey(key), options == null ? void 0 : options.keyType),
|
|
343
|
+
decodeValue(value, options)
|
|
344
|
+
]);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
155
348
|
// src/actor/contexts/base/actor.ts
|
|
156
349
|
var ActorContext = class {
|
|
157
350
|
#actor;
|
|
351
|
+
#kv;
|
|
158
352
|
constructor(actor) {
|
|
159
353
|
this.#actor = actor;
|
|
160
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Gets the KV storage interface.
|
|
357
|
+
*/
|
|
358
|
+
get kv() {
|
|
359
|
+
if (!this.#kv) {
|
|
360
|
+
this.#kv = new ActorKv(this.#actor.driver, this.#actor.id);
|
|
361
|
+
}
|
|
362
|
+
return this.#kv;
|
|
363
|
+
}
|
|
161
364
|
/**
|
|
162
365
|
* Get the actor state
|
|
163
366
|
*
|
|
@@ -385,7 +588,7 @@ function contentTypeForEncoding(encoding) {
|
|
|
385
588
|
} else if (encoding === "cbor" || encoding === "bare") {
|
|
386
589
|
return "application/octet-stream";
|
|
387
590
|
} else {
|
|
388
|
-
|
|
591
|
+
_chunkX72X7I7Tcjs.assertUnreachable.call(void 0, encoding);
|
|
389
592
|
}
|
|
390
593
|
}
|
|
391
594
|
function serializeWithEncoding(encoding, value, versionedDataHandler, version, zodSchema, toJson, toBare) {
|
|
@@ -412,7 +615,7 @@ function serializeWithEncoding(encoding, value, versionedDataHandler, version, z
|
|
|
412
615
|
version
|
|
413
616
|
);
|
|
414
617
|
} else {
|
|
415
|
-
|
|
618
|
+
_chunkX72X7I7Tcjs.assertUnreachable.call(void 0, encoding);
|
|
416
619
|
}
|
|
417
620
|
}
|
|
418
621
|
function deserializeWithEncoding(encoding, buffer, versionedDataHandler, zodSchema, fromJson, fromBare) {
|
|
@@ -448,13 +651,13 @@ function deserializeWithEncoding(encoding, buffer, versionedDataHandler, zodSche
|
|
|
448
651
|
const bareValue = versionedDataHandler.deserializeWithEmbeddedVersion(buffer);
|
|
449
652
|
return fromBare(bareValue);
|
|
450
653
|
} else {
|
|
451
|
-
|
|
654
|
+
_chunkX72X7I7Tcjs.assertUnreachable.call(void 0, encoding);
|
|
452
655
|
}
|
|
453
656
|
}
|
|
454
657
|
|
|
455
658
|
// src/actor/log.ts
|
|
456
659
|
function loggerWithoutContext() {
|
|
457
|
-
return
|
|
660
|
+
return _chunkX72X7I7Tcjs.getLogger.call(void 0, "actor-runtime");
|
|
458
661
|
}
|
|
459
662
|
|
|
460
663
|
// src/actor/utils.ts
|
|
@@ -1568,7 +1771,7 @@ async function handleAction(c, config6, actorDriver, actionName, actorId) {
|
|
|
1568
1771
|
(value) => ({ output: value }),
|
|
1569
1772
|
// BARE/CBOR: output needs to be CBOR-encoded to ArrayBuffer
|
|
1570
1773
|
(value) => ({
|
|
1571
|
-
output:
|
|
1774
|
+
output: _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(value))
|
|
1572
1775
|
})
|
|
1573
1776
|
);
|
|
1574
1777
|
const messageSize = serialized instanceof Uint8Array ? serialized.byteLength : serialized.length;
|
|
@@ -1611,7 +1814,7 @@ function getRequestEncoding(req) {
|
|
|
1611
1814
|
return result.data;
|
|
1612
1815
|
}
|
|
1613
1816
|
function getRequestExposeInternalError(_req) {
|
|
1614
|
-
return
|
|
1817
|
+
return _chunkX72X7I7Tcjs.getEnvUniversal.call(void 0, "RIVET_EXPOSE_ERRORS") === "1" || _chunkX72X7I7Tcjs.getEnvUniversal.call(void 0, "NODE_ENV") === "development";
|
|
1615
1818
|
}
|
|
1616
1819
|
function getRequestConnParams(req) {
|
|
1617
1820
|
const paramsParam = req.header(HEADER_CONN_PARAMS);
|
|
@@ -1622,7 +1825,7 @@ function getRequestConnParams(req) {
|
|
|
1622
1825
|
return JSON.parse(paramsParam);
|
|
1623
1826
|
} catch (err) {
|
|
1624
1827
|
throw new (0, _chunkSNAUKDDKcjs.InvalidParams)(
|
|
1625
|
-
`Invalid params JSON: ${
|
|
1828
|
+
`Invalid params JSON: ${_chunkX72X7I7Tcjs.stringifyError.call(void 0, err)}`
|
|
1626
1829
|
);
|
|
1627
1830
|
}
|
|
1628
1831
|
}
|
|
@@ -1637,14 +1840,14 @@ var ENGINE_ENDPOINT = `http://127.0.0.1:${ENGINE_PORT}`;
|
|
|
1637
1840
|
// src/inspector/config.ts
|
|
1638
1841
|
|
|
1639
1842
|
var defaultTokenFn = () => {
|
|
1640
|
-
const envToken =
|
|
1843
|
+
const envToken = _chunkX72X7I7Tcjs.getRivetkitInspectorToken.call(void 0, );
|
|
1641
1844
|
if (envToken) {
|
|
1642
1845
|
return envToken;
|
|
1643
1846
|
}
|
|
1644
1847
|
return "";
|
|
1645
1848
|
};
|
|
1646
1849
|
var defaultEnabled = () => {
|
|
1647
|
-
return
|
|
1850
|
+
return _chunkX72X7I7Tcjs.isDev.call(void 0, ) || !_chunkX72X7I7Tcjs.getRivetkitInspectorDisable.call(void 0, );
|
|
1648
1851
|
};
|
|
1649
1852
|
var InspectorConfigSchema = _zod.z.object({
|
|
1650
1853
|
enabled: _zod.z.boolean().default(defaultEnabled),
|
|
@@ -1749,10 +1952,10 @@ var DriverConfigSchema = _zod.z.object({
|
|
|
1749
1952
|
|
|
1750
1953
|
var RunnerConfigSchema = _zod.z.object({
|
|
1751
1954
|
// MARK: Runner
|
|
1752
|
-
totalSlots: _zod.z.number().default(() => _nullishCoalesce(
|
|
1753
|
-
runnerName: _zod.z.string().default(() => _nullishCoalesce(
|
|
1754
|
-
runnerKey: _zod.z.string().optional().transform((x) => _nullishCoalesce(x, () => (
|
|
1755
|
-
version: _zod.z.number().default(() => _nullishCoalesce(
|
|
1955
|
+
totalSlots: _zod.z.number().default(() => _nullishCoalesce(_chunkX72X7I7Tcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
|
|
1956
|
+
runnerName: _zod.z.string().default(() => _nullishCoalesce(_chunkX72X7I7Tcjs.getRivetRunner.call(void 0, ), () => ( "default"))),
|
|
1957
|
+
runnerKey: _zod.z.string().optional().transform((x) => _nullishCoalesce(x, () => ( _chunkX72X7I7Tcjs.getRivetRunnerKey.call(void 0, )))),
|
|
1958
|
+
version: _zod.z.number().default(() => _nullishCoalesce(_chunkX72X7I7Tcjs.getRivetRunnerVersion.call(void 0, ), () => ( 1)))
|
|
1756
1959
|
});
|
|
1757
1960
|
|
|
1758
1961
|
// src/registry/config/serverless.ts
|
|
@@ -1776,9 +1979,9 @@ var ServerlessConfigSchema = _zod.z.object({
|
|
|
1776
1979
|
* Downloads and starts the full Rust engine process.
|
|
1777
1980
|
* Auto-enabled in development mode when no endpoint is provided.
|
|
1778
1981
|
*/
|
|
1779
|
-
spawnEngine: _zod.z.boolean().default(() =>
|
|
1982
|
+
spawnEngine: _zod.z.boolean().default(() => _chunkX72X7I7Tcjs.getRivetRunEngine.call(void 0, )),
|
|
1780
1983
|
/** @experimental */
|
|
1781
|
-
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(
|
|
1984
|
+
engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkX72X7I7Tcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkX72X7I7Tcjs.VERSION))),
|
|
1782
1985
|
/**
|
|
1783
1986
|
* @experimental
|
|
1784
1987
|
*
|
|
@@ -1807,7 +2010,7 @@ var ServerlessConfigSchema = _zod.z.object({
|
|
|
1807
2010
|
*
|
|
1808
2011
|
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
1809
2012
|
*/
|
|
1810
|
-
publicEndpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
2013
|
+
publicEndpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkX72X7I7Tcjs.getRivetPublicEndpoint.call(void 0, )))),
|
|
1811
2014
|
/**
|
|
1812
2015
|
* Token that clients should use when connecting via the public endpoint.
|
|
1813
2016
|
*
|
|
@@ -1815,7 +2018,7 @@ var ServerlessConfigSchema = _zod.z.object({
|
|
|
1815
2018
|
*
|
|
1816
2019
|
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
1817
2020
|
*/
|
|
1818
|
-
publicToken: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
2021
|
+
publicToken: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkX72X7I7Tcjs.getRivetPublicToken.call(void 0, ))))
|
|
1819
2022
|
// There is no publicNamespace config option because the frontend and backend
|
|
1820
2023
|
// cannot use different namespaces. The namespace is extracted from the
|
|
1821
2024
|
// publicEndpoint URL auth syntax if provided.
|
|
@@ -1857,7 +2060,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
1857
2060
|
* */
|
|
1858
2061
|
logging: _zod.z.object({
|
|
1859
2062
|
baseLogger: _zod.z.custom().optional(),
|
|
1860
|
-
level:
|
|
2063
|
+
level: _chunkX72X7I7Tcjs.LogLevelSchema.optional()
|
|
1861
2064
|
}).optional().default(() => ({})),
|
|
1862
2065
|
// MARK: Routing
|
|
1863
2066
|
// // This is a function to allow for lazy configuration of upgradeWebSocket on the
|
|
@@ -1875,9 +2078,9 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
1875
2078
|
*
|
|
1876
2079
|
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
1877
2080
|
*/
|
|
1878
|
-
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => (
|
|
1879
|
-
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
1880
|
-
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => (
|
|
2081
|
+
endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkX72X7I7Tcjs.getRivetEngine.call(void 0, ))), () => ( _chunkX72X7I7Tcjs.getRivetEndpoint.call(void 0, )))),
|
|
2082
|
+
token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkX72X7I7Tcjs.getRivetToken.call(void 0, )))),
|
|
2083
|
+
namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkX72X7I7Tcjs.getRivetNamespace.call(void 0, )))),
|
|
1881
2084
|
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
|
|
1882
2085
|
// MARK: Client
|
|
1883
2086
|
// TODO:
|
|
@@ -1912,7 +2115,7 @@ var RegistryConfigSchema = _zod.z.object({
|
|
|
1912
2115
|
() => RunnerConfigSchema.parse({})
|
|
1913
2116
|
)
|
|
1914
2117
|
}).transform((config6, ctx) => {
|
|
1915
|
-
const isDevEnv =
|
|
2118
|
+
const isDevEnv = _chunkX72X7I7Tcjs.isDev.call(void 0, );
|
|
1916
2119
|
const parsedEndpoint = config6.endpoint ? tryParseEndpoint(ctx, {
|
|
1917
2120
|
endpoint: config6.endpoint,
|
|
1918
2121
|
path: ["endpoint"],
|
|
@@ -1981,10 +2184,59 @@ function buildActorNames(config6) {
|
|
|
1981
2184
|
Object.keys(config6.use).map((name) => [name, { metadata: {} }])
|
|
1982
2185
|
);
|
|
1983
2186
|
}
|
|
2187
|
+
var DocInspectorConfigSchema = _zod.z.object({
|
|
2188
|
+
enabled: _zod.z.boolean().optional().describe("Whether to enable the Rivet Inspector. Defaults to true in development mode."),
|
|
2189
|
+
token: _zod.z.string().optional().describe("Token used to access the Inspector."),
|
|
2190
|
+
defaultEndpoint: _zod.z.string().optional().describe("Default RivetKit server endpoint for Rivet Inspector to connect to.")
|
|
2191
|
+
}).optional().describe("Inspector configuration for debugging and development.");
|
|
2192
|
+
var DocConfigureRunnerPoolSchema = _zod.z.object({
|
|
2193
|
+
name: _zod.z.string().optional().describe("Name of the runner pool."),
|
|
2194
|
+
url: _zod.z.string().describe("URL of the serverless platform to configure runners."),
|
|
2195
|
+
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().describe("Headers to include in requests to the serverless platform."),
|
|
2196
|
+
maxRunners: _zod.z.number().optional().describe("Maximum number of runners in the pool."),
|
|
2197
|
+
minRunners: _zod.z.number().optional().describe("Minimum number of runners to keep warm."),
|
|
2198
|
+
requestLifespan: _zod.z.number().optional().describe("Maximum lifespan of a request in milliseconds."),
|
|
2199
|
+
runnersMargin: _zod.z.number().optional().describe("Buffer margin for scaling runners."),
|
|
2200
|
+
slotsPerRunner: _zod.z.number().optional().describe("Number of actor slots per runner."),
|
|
2201
|
+
metadata: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional().describe("Additional metadata to pass to the serverless platform.")
|
|
2202
|
+
}).optional();
|
|
2203
|
+
var DocServerlessConfigSchema = _zod.z.object({
|
|
2204
|
+
spawnEngine: _zod.z.boolean().optional().describe("Downloads and starts the full Rust engine process. Auto-enabled in development mode when no endpoint is provided. Default: false"),
|
|
2205
|
+
engineVersion: _zod.z.string().optional().describe("Version of the engine to download. Defaults to the current RivetKit version."),
|
|
2206
|
+
configureRunnerPool: DocConfigureRunnerPoolSchema.describe("Automatically configure serverless runners in the engine."),
|
|
2207
|
+
basePath: _zod.z.string().optional().describe("Base path for serverless API routes. Default: '/api/rivet'"),
|
|
2208
|
+
publicEndpoint: _zod.z.string().optional().describe("The endpoint that clients should connect to. Supports URL auth syntax: https://namespace:token@api.rivet.dev"),
|
|
2209
|
+
publicToken: _zod.z.string().optional().describe("Token that clients should use when connecting via the public endpoint.")
|
|
2210
|
+
}).describe("Configuration for serverless deployment mode.");
|
|
2211
|
+
var DocRunnerConfigSchema = _zod.z.object({
|
|
2212
|
+
totalSlots: _zod.z.number().optional().describe("Total number of actor slots available. Default: 100000"),
|
|
2213
|
+
runnerName: _zod.z.string().optional().describe("Name of this runner. Default: 'default'"),
|
|
2214
|
+
runnerKey: _zod.z.string().optional().describe("Authentication key for the runner."),
|
|
2215
|
+
version: _zod.z.number().optional().describe("Version number of this runner. Default: 1")
|
|
2216
|
+
}).describe("Configuration for runner mode.");
|
|
2217
|
+
var DocRegistryConfigSchema = _zod.z.object({
|
|
2218
|
+
use: _zod.z.record(_zod.z.string(), _zod.z.unknown()).describe("Actor definitions. Keys are actor names, values are actor definitions."),
|
|
2219
|
+
maxIncomingMessageSize: _zod.z.number().optional().describe("Maximum size of incoming WebSocket messages in bytes. Default: 65536"),
|
|
2220
|
+
maxOutgoingMessageSize: _zod.z.number().optional().describe("Maximum size of outgoing WebSocket messages in bytes. Default: 1048576"),
|
|
2221
|
+
noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
|
|
2222
|
+
logging: _zod.z.object({
|
|
2223
|
+
level: _chunkX72X7I7Tcjs.LogLevelSchema.optional().describe("Log level for RivetKit. Default: 'warn'")
|
|
2224
|
+
}).optional().describe("Logging configuration."),
|
|
2225
|
+
endpoint: _zod.z.string().optional().describe("Endpoint URL to connect to Rivet Engine. Supports URL auth syntax: https://namespace:token@api.rivet.dev. Can also be set via RIVET_ENDPOINT environment variable."),
|
|
2226
|
+
token: _zod.z.string().optional().describe("Authentication token for Rivet Engine. Can also be set via RIVET_TOKEN environment variable."),
|
|
2227
|
+
namespace: _zod.z.string().optional().describe("Namespace to use. Default: 'default'. Can also be set via RIVET_NAMESPACE environment variable."),
|
|
2228
|
+
headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().describe("Additional headers to include in requests to Rivet Engine."),
|
|
2229
|
+
serveManager: _zod.z.boolean().optional().describe("Whether to start the local manager server. Auto-determined based on endpoint and NODE_ENV if not specified."),
|
|
2230
|
+
managerBasePath: _zod.z.string().optional().describe("Base path for the manager API. Default: '/'"),
|
|
2231
|
+
managerPort: _zod.z.number().optional().describe("Port to run the manager on. Default: 6420"),
|
|
2232
|
+
inspector: DocInspectorConfigSchema,
|
|
2233
|
+
serverless: DocServerlessConfigSchema.optional(),
|
|
2234
|
+
runner: DocRunnerConfigSchema.optional()
|
|
2235
|
+
}).describe("RivetKit registry configuration.");
|
|
1984
2236
|
|
|
1985
2237
|
// src/common/router.ts
|
|
1986
2238
|
function logger() {
|
|
1987
|
-
return
|
|
2239
|
+
return _chunkX72X7I7Tcjs.getLogger.call(void 0, "router");
|
|
1988
2240
|
}
|
|
1989
2241
|
function loggerMiddleware(logger4) {
|
|
1990
2242
|
return async (c, next) => {
|
|
@@ -2002,7 +2254,7 @@ function loggerMiddleware(logger4) {
|
|
|
2002
2254
|
reqSize: c.req.header("content-length"),
|
|
2003
2255
|
resSize: c.res.headers.get("content-length"),
|
|
2004
2256
|
userAgent: c.req.header("user-agent"),
|
|
2005
|
-
...
|
|
2257
|
+
..._chunkX72X7I7Tcjs.getLogHeaders.call(void 0, ) ? { allHeaders: JSON.stringify(c.req.header()) } : {}
|
|
2006
2258
|
});
|
|
2007
2259
|
};
|
|
2008
2260
|
}
|
|
@@ -2011,7 +2263,7 @@ function handleRouteNotFound(c) {
|
|
|
2011
2263
|
}
|
|
2012
2264
|
function handleRouteError(error, c) {
|
|
2013
2265
|
const exposeInternalError = getRequestExposeInternalError(c.req.raw);
|
|
2014
|
-
const { statusCode, group, code, message, metadata } =
|
|
2266
|
+
const { statusCode, group, code, message, metadata } = _chunkX72X7I7Tcjs.deconstructError.call(void 0,
|
|
2015
2267
|
error,
|
|
2016
2268
|
logger(),
|
|
2017
2269
|
{
|
|
@@ -2045,7 +2297,7 @@ function handleRouteError(error, c) {
|
|
|
2045
2297
|
group: value.group,
|
|
2046
2298
|
code: value.code,
|
|
2047
2299
|
message: value.message,
|
|
2048
|
-
metadata: value.metadata ?
|
|
2300
|
+
metadata: value.metadata ? _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0, cbor3.encode(value.metadata)) : null
|
|
2049
2301
|
})
|
|
2050
2302
|
);
|
|
2051
2303
|
return c.body(output, { status: statusCode });
|
|
@@ -2053,7 +2305,7 @@ function handleRouteError(error, c) {
|
|
|
2053
2305
|
function handleMetadataRequest(c, config6, runnerKind, clientEndpoint, clientNamespace, clientToken) {
|
|
2054
2306
|
const response = {
|
|
2055
2307
|
runtime: "rivetkit",
|
|
2056
|
-
version:
|
|
2308
|
+
version: _chunkX72X7I7Tcjs.VERSION,
|
|
2057
2309
|
runner: {
|
|
2058
2310
|
kind: runnerKind
|
|
2059
2311
|
},
|
|
@@ -2068,7 +2320,7 @@ function handleHealthRequest(c) {
|
|
|
2068
2320
|
return c.json({
|
|
2069
2321
|
status: "ok",
|
|
2070
2322
|
runtime: "rivetkit",
|
|
2071
|
-
version:
|
|
2323
|
+
version: _chunkX72X7I7Tcjs.VERSION
|
|
2072
2324
|
});
|
|
2073
2325
|
}
|
|
2074
2326
|
|
|
@@ -2080,21 +2332,6 @@ function handleHealthRequest(c) {
|
|
|
2080
2332
|
var RivetIdSchema = _zod.z.string();
|
|
2081
2333
|
|
|
2082
2334
|
// src/manager-api/actors.ts
|
|
2083
|
-
var ServerlessConnectionErrorSchema = _zod.z.union([
|
|
2084
|
-
_zod.z.object({ http_error: _zod.z.object({ status_code: _zod.z.number(), body: _zod.z.string() }) }),
|
|
2085
|
-
_zod.z.literal("stream_ended_early"),
|
|
2086
|
-
_zod.z.object({ connection_error: _zod.z.object({ message: _zod.z.string() }) }),
|
|
2087
|
-
_zod.z.literal("invalid_base64"),
|
|
2088
|
-
_zod.z.object({ invalid_payload: _zod.z.object({ message: _zod.z.string() }) }),
|
|
2089
|
-
_zod.z.literal("runner_config_not_found"),
|
|
2090
|
-
_zod.z.literal("runner_config_not_serverless"),
|
|
2091
|
-
_zod.z.literal("namespace_not_found")
|
|
2092
|
-
]);
|
|
2093
|
-
var ActorErrorDetailsSchema = _zod.z.union([
|
|
2094
|
-
_zod.z.object({ serverless_error: ServerlessConnectionErrorSchema }),
|
|
2095
|
-
_zod.z.object({ no_capacity: _zod.z.object({ runner_name: _zod.z.string() }) }),
|
|
2096
|
-
_zod.z.object({ runner_no_response: _zod.z.object({ runner_id: _zod.z.string() }) })
|
|
2097
|
-
]);
|
|
2098
2335
|
var ActorSchema = _zod.z.object({
|
|
2099
2336
|
actor_id: RivetIdSchema,
|
|
2100
2337
|
name: _zod.z.string(),
|
|
@@ -2106,7 +2343,7 @@ var ActorSchema = _zod.z.object({
|
|
|
2106
2343
|
destroy_ts: _zod.z.number().nullable().optional(),
|
|
2107
2344
|
sleep_ts: _zod.z.number().nullable().optional(),
|
|
2108
2345
|
start_ts: _zod.z.number().nullable().optional(),
|
|
2109
|
-
error:
|
|
2346
|
+
error: _zod.z.unknown().nullable().optional()
|
|
2110
2347
|
});
|
|
2111
2348
|
var ActorNameSchema = _zod.z.object({
|
|
2112
2349
|
metadata: _zod.z.record(_zod.z.string(), _zod.z.unknown())
|
|
@@ -2198,7 +2435,7 @@ var cors = () => {
|
|
|
2198
2435
|
|
|
2199
2436
|
// src/utils/router.ts
|
|
2200
2437
|
function logger2() {
|
|
2201
|
-
return
|
|
2438
|
+
return _chunkX72X7I7Tcjs.getLogger.call(void 0, "router");
|
|
2202
2439
|
}
|
|
2203
2440
|
function createRouter(basePath, builder) {
|
|
2204
2441
|
const router = new (0, _zodopenapi.OpenAPIHono)({ strict: false }).basePath(basePath);
|
|
@@ -2257,7 +2494,7 @@ function buildOpenApiRequestBody(schema) {
|
|
|
2257
2494
|
|
|
2258
2495
|
// src/inspector/log.ts
|
|
2259
2496
|
function inspectorLogger() {
|
|
2260
|
-
return
|
|
2497
|
+
return _chunkX72X7I7Tcjs.getLogger.call(void 0, "inspector");
|
|
2261
2498
|
}
|
|
2262
2499
|
|
|
2263
2500
|
// src/inspector/handler.ts
|
|
@@ -2389,7 +2626,7 @@ async function handleWebSocketInspectorConnect({
|
|
|
2389
2626
|
}
|
|
2390
2627
|
});
|
|
2391
2628
|
} else {
|
|
2392
|
-
|
|
2629
|
+
_chunkX72X7I7Tcjs.assertUnreachable.call(void 0, message.body);
|
|
2393
2630
|
}
|
|
2394
2631
|
} catch (error) {
|
|
2395
2632
|
inspectorLogger().warn(
|
|
@@ -2649,7 +2886,7 @@ var StateManager = class {
|
|
|
2649
2886
|
#handleChange(path, value) {
|
|
2650
2887
|
if (path.startsWith("state")) {
|
|
2651
2888
|
let invalidPath = "";
|
|
2652
|
-
if (!
|
|
2889
|
+
if (!_chunkX72X7I7Tcjs.isCborSerializable.call(void 0,
|
|
2653
2890
|
value,
|
|
2654
2891
|
(invalidPathPart) => {
|
|
2655
2892
|
invalidPath = invalidPathPart;
|
|
@@ -2841,7 +3078,7 @@ var Conn = (_class = class {
|
|
|
2841
3078
|
tag: "Event",
|
|
2842
3079
|
val: {
|
|
2843
3080
|
name: value.name,
|
|
2844
|
-
args:
|
|
3081
|
+
args: _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(value.args))
|
|
2845
3082
|
}
|
|
2846
3083
|
}
|
|
2847
3084
|
})
|
|
@@ -2884,7 +3121,7 @@ function getValueLength(value) {
|
|
|
2884
3121
|
} else if (value instanceof ArrayBuffer || value instanceof SharedArrayBuffer || value instanceof Uint8Array) {
|
|
2885
3122
|
return value.byteLength;
|
|
2886
3123
|
} else {
|
|
2887
|
-
|
|
3124
|
+
_chunkX72X7I7Tcjs.assertUnreachable.call(void 0, value);
|
|
2888
3125
|
}
|
|
2889
3126
|
}
|
|
2890
3127
|
async function inputDataToBuffer(data) {
|
|
@@ -2989,7 +3226,7 @@ async function processMessage(message, actor, conn, handler) {
|
|
|
2989
3226
|
tag: "ActionResponse",
|
|
2990
3227
|
val: {
|
|
2991
3228
|
id,
|
|
2992
|
-
output:
|
|
3229
|
+
output: _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0, cbor5.encode(value))
|
|
2993
3230
|
}
|
|
2994
3231
|
}
|
|
2995
3232
|
})
|
|
@@ -3017,10 +3254,10 @@ async function processMessage(message, actor, conn, handler) {
|
|
|
3017
3254
|
subscribe
|
|
3018
3255
|
});
|
|
3019
3256
|
} else {
|
|
3020
|
-
|
|
3257
|
+
_chunkX72X7I7Tcjs.assertUnreachable.call(void 0, message.body);
|
|
3021
3258
|
}
|
|
3022
3259
|
} catch (error) {
|
|
3023
|
-
const { group, code, message: message2, metadata } =
|
|
3260
|
+
const { group, code, message: message2, metadata } = _chunkX72X7I7Tcjs.deconstructError.call(void 0,
|
|
3024
3261
|
error,
|
|
3025
3262
|
actor.rLog,
|
|
3026
3263
|
{
|
|
@@ -3028,7 +3265,7 @@ async function processMessage(message, actor, conn, handler) {
|
|
|
3028
3265
|
actionId,
|
|
3029
3266
|
actionName
|
|
3030
3267
|
},
|
|
3031
|
-
|
|
3268
|
+
_chunkX72X7I7Tcjs.getEnvUniversal.call(void 0, "RIVET_EXPOSE_ERRORS") === "1" || _chunkX72X7I7Tcjs.getEnvUniversal.call(void 0, "NODE_ENV") === "development"
|
|
3032
3269
|
);
|
|
3033
3270
|
actor.rLog.debug({
|
|
3034
3271
|
msg: "sending error response",
|
|
@@ -3071,7 +3308,7 @@ async function processMessage(message, actor, conn, handler) {
|
|
|
3071
3308
|
group: value.group,
|
|
3072
3309
|
code: value.code,
|
|
3073
3310
|
message: value.message,
|
|
3074
|
-
metadata: value.metadata ?
|
|
3311
|
+
metadata: value.metadata ? _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0,
|
|
3075
3312
|
cbor5.encode(value.metadata)
|
|
3076
3313
|
) : null,
|
|
3077
3314
|
actionId: value.actionId !== void 0 ? value.actionId : null
|
|
@@ -3097,7 +3334,7 @@ async function routeWebSocket(request, requestPath, requestHeaders, config6, act
|
|
|
3097
3334
|
requestPath,
|
|
3098
3335
|
isHibernatable
|
|
3099
3336
|
});
|
|
3100
|
-
const closePromiseResolvers =
|
|
3337
|
+
const closePromiseResolvers = _chunkX72X7I7Tcjs.promiseWithResolvers.call(void 0, );
|
|
3101
3338
|
let handler;
|
|
3102
3339
|
let connDriver;
|
|
3103
3340
|
if (requestPath === PATH_CONNECT) {
|
|
@@ -3150,7 +3387,7 @@ async function routeWebSocket(request, requestPath, requestHeaders, config6, act
|
|
|
3150
3387
|
exposeInternalError
|
|
3151
3388
|
});
|
|
3152
3389
|
} catch (error) {
|
|
3153
|
-
const { group, code } =
|
|
3390
|
+
const { group, code } = _chunkX72X7I7Tcjs.deconstructError.call(void 0,
|
|
3154
3391
|
error,
|
|
3155
3392
|
loggerWithoutContext(),
|
|
3156
3393
|
{},
|
|
@@ -3202,7 +3439,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
3202
3439
|
maxIncomingMessageSize: runConfig.maxIncomingMessageSize
|
|
3203
3440
|
}).then((message) => {
|
|
3204
3441
|
actor.processMessage(message, conn).catch((error) => {
|
|
3205
|
-
const { code } =
|
|
3442
|
+
const { code } = _chunkX72X7I7Tcjs.deconstructError.call(void 0,
|
|
3206
3443
|
error,
|
|
3207
3444
|
actor.rLog,
|
|
3208
3445
|
{
|
|
@@ -3213,7 +3450,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
3213
3450
|
ws.close(1011, code);
|
|
3214
3451
|
});
|
|
3215
3452
|
}).catch((error) => {
|
|
3216
|
-
const { code } =
|
|
3453
|
+
const { code } = _chunkX72X7I7Tcjs.deconstructError.call(void 0,
|
|
3217
3454
|
error,
|
|
3218
3455
|
actor.rLog,
|
|
3219
3456
|
{
|
|
@@ -3248,7 +3485,7 @@ async function handleWebSocketConnect(setWebSocket, {
|
|
|
3248
3485
|
try {
|
|
3249
3486
|
actor.rLog.warn({ msg: "websocket error" });
|
|
3250
3487
|
} catch (error) {
|
|
3251
|
-
|
|
3488
|
+
_chunkX72X7I7Tcjs.deconstructError.call(void 0,
|
|
3252
3489
|
error,
|
|
3253
3490
|
actor.rLog,
|
|
3254
3491
|
{ wsEvent: "error" },
|
|
@@ -3304,7 +3541,7 @@ function parseWebSocketProtocols(protocols) {
|
|
|
3304
3541
|
}
|
|
3305
3542
|
}
|
|
3306
3543
|
}
|
|
3307
|
-
const encoding = EncodingSchema.parse(encodingRaw);
|
|
3544
|
+
const encoding = EncodingSchema.parse(_nullishCoalesce(encodingRaw, () => ( "json")));
|
|
3308
3545
|
const connParams = connParamsRaw ? JSON.parse(connParamsRaw) : void 0;
|
|
3309
3546
|
return { encoding, connParams };
|
|
3310
3547
|
}
|
|
@@ -3317,7 +3554,7 @@ function truncateRawWebSocketPathPrefix(path) {
|
|
|
3317
3554
|
|
|
3318
3555
|
// src/manager/log.ts
|
|
3319
3556
|
function logger3() {
|
|
3320
|
-
return
|
|
3557
|
+
return _chunkX72X7I7Tcjs.getLogger.call(void 0, "actor-manager");
|
|
3321
3558
|
}
|
|
3322
3559
|
|
|
3323
3560
|
// src/manager/gateway.ts
|
|
@@ -3553,7 +3790,7 @@ async function createTestWebSocketProxy(proxyToActorWsPromise) {
|
|
|
3553
3790
|
promise: clientToProxyWsPromise,
|
|
3554
3791
|
resolve: clientToProxyWsResolve,
|
|
3555
3792
|
reject: clientToProxyWsReject
|
|
3556
|
-
} =
|
|
3793
|
+
} = _chunkX72X7I7Tcjs.promiseWithResolvers.call(void 0, );
|
|
3557
3794
|
try {
|
|
3558
3795
|
logger3().debug({ msg: "awaiting client websocket promise" });
|
|
3559
3796
|
proxyToActorWs = await proxyToActorWsPromise;
|
|
@@ -3947,12 +4184,12 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
3947
4184
|
responses: buildOpenApiResponses(ActorsKvGetResponseSchema)
|
|
3948
4185
|
});
|
|
3949
4186
|
router.openapi(route, async (c) => {
|
|
3950
|
-
if (
|
|
4187
|
+
if (_chunkX72X7I7Tcjs.getNodeEnv.call(void 0, ) === "development" && !config6.token) {
|
|
3951
4188
|
logger3().warn({
|
|
3952
4189
|
msg: "RIVET_TOKEN is not set, skipping KV store access checks in development mode. This endpoint will be disabled in production, unless you set the token."
|
|
3953
4190
|
});
|
|
3954
4191
|
}
|
|
3955
|
-
if (
|
|
4192
|
+
if (_chunkX72X7I7Tcjs.getNodeEnv.call(void 0, ) !== "development") {
|
|
3956
4193
|
if (!config6.token) {
|
|
3957
4194
|
throw new (0, _chunkSNAUKDDKcjs.RestrictedFeature)("KV store access");
|
|
3958
4195
|
}
|
|
@@ -3988,7 +4225,7 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
3988
4225
|
const output = await managerDriver[method](...args);
|
|
3989
4226
|
response = { ok: output };
|
|
3990
4227
|
} catch (rawErr) {
|
|
3991
|
-
const err =
|
|
4228
|
+
const err = _chunkX72X7I7Tcjs.deconstructError.call(void 0, rawErr, logger3(), {}, true);
|
|
3992
4229
|
response = { err };
|
|
3993
4230
|
}
|
|
3994
4231
|
return c.body(cbor6.encode(response));
|
|
@@ -4046,7 +4283,7 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
4046
4283
|
return await createTestWebSocketProxy(
|
|
4047
4284
|
clientToProxyWsPromise
|
|
4048
4285
|
);
|
|
4049
|
-
})(c,
|
|
4286
|
+
})(c, _chunkX72X7I7Tcjs.noopNext.call(void 0, ));
|
|
4050
4287
|
});
|
|
4051
4288
|
router.all(".test/inline-driver/send-request/*", async (c) => {
|
|
4052
4289
|
const actorId = c.req.header(HEADER_ACTOR_ID);
|
|
@@ -4076,9 +4313,9 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
4076
4313
|
} catch (error) {
|
|
4077
4314
|
logger3().error({
|
|
4078
4315
|
msg: "error in test inline raw http",
|
|
4079
|
-
error:
|
|
4316
|
+
error: _chunkX72X7I7Tcjs.stringifyError.call(void 0, error)
|
|
4080
4317
|
});
|
|
4081
|
-
const err =
|
|
4318
|
+
const err = _chunkX72X7I7Tcjs.deconstructError.call(void 0, error, logger3(), {}, true);
|
|
4082
4319
|
return c.json(
|
|
4083
4320
|
{
|
|
4084
4321
|
error: {
|
|
@@ -4126,7 +4363,7 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
4126
4363
|
} catch (error) {
|
|
4127
4364
|
logger3().error({
|
|
4128
4365
|
msg: "error forcing disconnect",
|
|
4129
|
-
error:
|
|
4366
|
+
error: _chunkX72X7I7Tcjs.stringifyError.call(void 0, error)
|
|
4130
4367
|
});
|
|
4131
4368
|
return c.text(`Error: ${error}`, 500);
|
|
4132
4369
|
}
|
|
@@ -4166,23 +4403,6 @@ function createApiActor(actor) {
|
|
|
4166
4403
|
// src/driver-helpers/utils.ts
|
|
4167
4404
|
|
|
4168
4405
|
|
|
4169
|
-
// src/actor/instance/kv.ts
|
|
4170
|
-
var KEYS = {
|
|
4171
|
-
PERSIST_DATA: Uint8Array.from([1]),
|
|
4172
|
-
CONN_PREFIX: Uint8Array.from([2]),
|
|
4173
|
-
// Prefix for connection keys
|
|
4174
|
-
INSPECTOR_TOKEN: Uint8Array.from([3])
|
|
4175
|
-
// Inspector token key
|
|
4176
|
-
};
|
|
4177
|
-
function makeConnKey(connId) {
|
|
4178
|
-
const encoder = new TextEncoder();
|
|
4179
|
-
const connIdBytes = encoder.encode(connId);
|
|
4180
|
-
const key = new Uint8Array(KEYS.CONN_PREFIX.length + connIdBytes.length);
|
|
4181
|
-
key.set(KEYS.CONN_PREFIX, 0);
|
|
4182
|
-
key.set(connIdBytes, KEYS.CONN_PREFIX.length);
|
|
4183
|
-
return key;
|
|
4184
|
-
}
|
|
4185
|
-
|
|
4186
4406
|
// src/schemas/actor-persist/versioned.ts
|
|
4187
4407
|
|
|
4188
4408
|
|
|
@@ -4854,9 +5074,9 @@ var CONN_VERSIONED = _vbare.createVersionedDataHandler.call(void 0, {
|
|
|
4854
5074
|
// src/driver-helpers/utils.ts
|
|
4855
5075
|
function serializeEmptyPersistData(input) {
|
|
4856
5076
|
const persistData = {
|
|
4857
|
-
input: input !== void 0 ?
|
|
5077
|
+
input: input !== void 0 ? _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0, cbor7.encode(input)) : null,
|
|
4858
5078
|
hasInitialized: false,
|
|
4859
|
-
state:
|
|
5079
|
+
state: _chunkX72X7I7Tcjs.bufferToArrayBuffer.call(void 0, cbor7.encode(void 0)),
|
|
4860
5080
|
scheduledEvents: []
|
|
4861
5081
|
};
|
|
4862
5082
|
return ACTOR_VERSIONED.serializeWithEmbeddedVersion(
|
|
@@ -4959,5 +5179,11 @@ function getInitialActorKvState(input) {
|
|
|
4959
5179
|
|
|
4960
5180
|
|
|
4961
5181
|
|
|
4962
|
-
|
|
4963
|
-
|
|
5182
|
+
|
|
5183
|
+
|
|
5184
|
+
|
|
5185
|
+
|
|
5186
|
+
|
|
5187
|
+
|
|
5188
|
+
exports.createHttpDriver = createHttpDriver; exports.CURRENT_VERSION = CURRENT_VERSION; exports.TO_SERVER_VERSIONED = TO_SERVER_VERSIONED2; exports.TO_CLIENT_VERSIONED = TO_CLIENT_VERSIONED2; exports.HTTP_ACTION_REQUEST_VERSIONED = HTTP_ACTION_REQUEST_VERSIONED; exports.HTTP_ACTION_RESPONSE_VERSIONED = HTTP_ACTION_RESPONSE_VERSIONED; exports.HTTP_RESPONSE_ERROR_VERSIONED = HTTP_RESPONSE_ERROR_VERSIONED; exports.ToClientSchema = ToClientSchema; exports.ToServerSchema = ToServerSchema; exports.HttpActionRequestSchema = HttpActionRequestSchema; exports.HttpActionResponseSchema = HttpActionResponseSchema; exports.HttpResponseErrorSchema = HttpResponseErrorSchema; exports.uint8ArrayToBase64 = uint8ArrayToBase64; exports.contentTypeForEncoding = contentTypeForEncoding; exports.serializeWithEncoding = serializeWithEncoding; exports.deserializeWithEncoding = deserializeWithEncoding; exports.loggerWithoutContext = loggerWithoutContext; exports.assertUnreachable = assertUnreachable2; exports.DeadlineError = DeadlineError; exports.deadline = deadline; exports.generateSecureToken = generateSecureToken; exports.isStatePath = isStatePath; exports.isConnStatePath = isConnStatePath; exports.EncodingSchema = EncodingSchema; exports.CachedSerializer = CachedSerializer; exports.jsonStringifyCompat = jsonStringifyCompat; exports.CONN_CONNECTED_SYMBOL = CONN_CONNECTED_SYMBOL; exports.CONN_SPEAKS_RIVETKIT_SYMBOL = CONN_SPEAKS_RIVETKIT_SYMBOL; exports.CONN_DRIVER_SYMBOL = CONN_DRIVER_SYMBOL; exports.CONN_STATE_MANAGER_SYMBOL = CONN_STATE_MANAGER_SYMBOL; exports.CONN_SEND_MESSAGE_SYMBOL = CONN_SEND_MESSAGE_SYMBOL; exports.Conn = Conn; exports.KEYS = KEYS; exports.makeConnKey = makeConnKey; exports.ActorKv = ActorKv; exports.ActorContext = ActorContext; exports.ActionContext = ActionContext; exports.CURRENT_VERSION2 = CURRENT_VERSION2; exports.ACTOR_VERSIONED = ACTOR_VERSIONED; exports.CONN_VERSIONED = CONN_VERSIONED; exports.BeforeConnectContext = BeforeConnectContext; exports.ConnectContext = ConnectContext; exports.CreateConnStateContext = CreateConnStateContext; exports.RequestContext = RequestContext; exports.WebSocketContext = WebSocketContext; exports.serializeActorKey = serializeActorKey; exports.deserializeActorKey = deserializeActorKey; exports.getValueLength = getValueLength; exports.inputDataToBuffer = inputDataToBuffer; exports.processMessage = processMessage; exports.PATH_CONNECT = PATH_CONNECT; exports.PATH_WEBSOCKET_BASE = PATH_WEBSOCKET_BASE; exports.PATH_WEBSOCKET_PREFIX = PATH_WEBSOCKET_PREFIX; exports.PATH_INSPECTOR_CONNECT = PATH_INSPECTOR_CONNECT; exports.HEADER_ACTOR_QUERY = HEADER_ACTOR_QUERY; exports.HEADER_ENCODING = HEADER_ENCODING; exports.HEADER_CONN_PARAMS = HEADER_CONN_PARAMS; exports.HEADER_ACTOR_ID = HEADER_ACTOR_ID; exports.HEADER_RIVET_TOKEN = HEADER_RIVET_TOKEN; exports.HEADER_RIVET_TARGET = HEADER_RIVET_TARGET; exports.HEADER_RIVET_ACTOR = HEADER_RIVET_ACTOR; exports.WS_PROTOCOL_STANDARD = WS_PROTOCOL_STANDARD; exports.WS_PROTOCOL_TARGET = WS_PROTOCOL_TARGET; exports.WS_PROTOCOL_ACTOR = WS_PROTOCOL_ACTOR; exports.WS_PROTOCOL_ENCODING = WS_PROTOCOL_ENCODING; exports.WS_PROTOCOL_CONN_PARAMS = WS_PROTOCOL_CONN_PARAMS; exports.WS_TEST_PROTOCOL_PATH = WS_TEST_PROTOCOL_PATH; exports.ALLOWED_PUBLIC_HEADERS = ALLOWED_PUBLIC_HEADERS; exports.handleAction = handleAction; exports.handleRawRequest = handleRawRequest; exports.ENGINE_PORT = ENGINE_PORT; exports.ENGINE_ENDPOINT = ENGINE_ENDPOINT; exports.InspectorConfigSchema = InspectorConfigSchema; exports.tryParseEndpoint = tryParseEndpoint; exports.DriverConfigSchema = DriverConfigSchema; exports.ActorsSchema = ActorsSchema; exports.TestConfigSchema = TestConfigSchema; exports.RegistryConfigSchema = RegistryConfigSchema; exports.buildActorNames = buildActorNames; exports.DocInspectorConfigSchema = DocInspectorConfigSchema; exports.DocConfigureRunnerPoolSchema = DocConfigureRunnerPoolSchema; exports.DocServerlessConfigSchema = DocServerlessConfigSchema; exports.DocRunnerConfigSchema = DocRunnerConfigSchema; exports.DocRegistryConfigSchema = DocRegistryConfigSchema; exports.loggerMiddleware = loggerMiddleware; exports.handleRouteNotFound = handleRouteNotFound; exports.handleRouteError = handleRouteError; exports.handleMetadataRequest = handleMetadataRequest; exports.handleHealthRequest = handleHealthRequest; exports.routeWebSocket = routeWebSocket; exports.parseWebSocketProtocols = parseWebSocketProtocols; exports.truncateRawWebSocketPathPrefix = truncateRawWebSocketPathPrefix; exports.createRouter = createRouter; exports.buildManagerRouter = buildManagerRouter; exports.getInitialActorKvState = getInitialActorKvState;
|
|
5189
|
+
//# sourceMappingURL=chunk-KMYFL3OL.cjs.map
|