rivetkit 0.0.0-main.41efcce → 0.0.0-main.49693dc
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/browser/client.d.ts +939 -104
- package/dist/browser/client.js +1867 -900
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2079 -233
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2408 -2029
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +932 -114
- package/dist/tsup/agent-os/index.d.ts +932 -114
- package/dist/tsup/agent-os/index.js +2412 -2033
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-J27CEW6F.js → chunk-2OBVQZX6.js} +6 -6
- package/dist/tsup/chunk-2OBVQZX6.js.map +1 -0
- package/dist/tsup/chunk-3ZWHWMFJ.js +14 -0
- package/dist/tsup/chunk-3ZWHWMFJ.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-4KGXFC6M.cjs} +238 -22
- package/dist/tsup/chunk-4KGXFC6M.cjs.map +1 -0
- package/dist/tsup/{chunk-CVHUXINE.js → chunk-5IU3MI7X.js} +594 -72
- package/dist/tsup/chunk-5IU3MI7X.js.map +1 -0
- package/dist/tsup/{chunk-VD7AZIBR.js → chunk-6CXQMHZR.js} +1161 -361
- package/dist/tsup/chunk-6CXQMHZR.js.map +1 -0
- package/dist/tsup/{chunk-SBEFJ4IQ.js → chunk-6W2UIH3X.js} +70 -8
- package/dist/tsup/chunk-6W2UIH3X.js.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-6W5VGLFT.js} +237 -21
- package/dist/tsup/chunk-6W5VGLFT.js.map +1 -0
- package/dist/tsup/{chunk-RF3MEJV6.cjs → chunk-B73TBMMG.cjs} +18 -11
- package/dist/tsup/chunk-B73TBMMG.cjs.map +1 -0
- package/dist/tsup/chunk-D6TORRA4.js +243 -0
- package/dist/tsup/chunk-D6TORRA4.js.map +1 -0
- package/dist/tsup/{chunk-PXLJOMJD.js → chunk-FXT3HN32.js} +2 -2
- package/dist/tsup/{chunk-ZGWSH7YV.js → chunk-IXBD7BXC.js} +48 -72
- package/dist/tsup/chunk-IXBD7BXC.js.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-JI6GZ2C2.js} +4 -12
- package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-SPMMF6TR.cjs → chunk-LGOWPZJ5.cjs} +3 -3
- package/dist/tsup/chunk-LGOWPZJ5.cjs.map +1 -0
- package/dist/tsup/chunk-LYNWTX6R.cjs +14 -0
- package/dist/tsup/chunk-LYNWTX6R.cjs.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-MYWZCDML.cjs} +4 -12
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
- package/dist/tsup/{chunk-XSC2WWXD.js → chunk-NYDZLWHZ.js} +16 -9
- package/dist/tsup/chunk-NYDZLWHZ.js.map +1 -0
- package/dist/tsup/{chunk-AV54CVAG.cjs → chunk-RB7WUDX6.cjs} +1290 -490
- package/dist/tsup/chunk-RB7WUDX6.cjs.map +1 -0
- package/dist/tsup/{chunk-JTL6Y2UN.cjs → chunk-SPJORZMM.cjs} +49 -73
- package/dist/tsup/chunk-SPJORZMM.cjs.map +1 -0
- package/dist/tsup/chunk-SSMKIYEX.cjs +243 -0
- package/dist/tsup/chunk-SSMKIYEX.cjs.map +1 -0
- package/dist/tsup/{chunk-TQSL4NJ3.cjs → chunk-TQ4HSX2U.cjs} +72 -10
- package/dist/tsup/chunk-TQ4HSX2U.cjs.map +1 -0
- package/dist/tsup/{chunk-EVADNK6Z.cjs → chunk-U6ZQELGJ.cjs} +10 -10
- package/dist/tsup/chunk-U6ZQELGJ.cjs.map +1 -0
- package/dist/tsup/chunk-XLBMKZD3.cjs +1257 -0
- package/dist/tsup/chunk-XLBMKZD3.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +8 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +18 -7
- package/dist/tsup/client/mod.d.ts +18 -7
- package/dist/tsup/client/mod.js +7 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- 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-B3RIidaJ.d.ts → config-BXSV17G7.d.cts} +987 -72
- package/dist/tsup/{config-D6WxBYjV.d.cts → config-Bi1r6gI7.d.ts} +987 -72
- package/dist/tsup/{config-B9qUIHX4.d.ts → config-ey2I2zz5.d.cts} +82 -15
- package/dist/tsup/{config-B9qUIHX4.d.cts → config-ey2I2zz5.d.ts} +82 -15
- package/dist/tsup/context-4fJemY0D.d.cts +129 -0
- package/dist/tsup/context-D4sNYboo.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +168 -103
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -4
- package/dist/tsup/db/drizzle.d.ts +8 -4
- package/dist/tsup/db/drizzle.js +170 -105
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +6 -163
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +12 -4
- package/dist/tsup/db/mod.d.ts +12 -4
- package/dist/tsup/db/mod.js +5 -162
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +38 -0
- package/dist/tsup/dynamic/mod.d.ts +38 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +26 -136
- package/dist/tsup/inspector/mod.d.ts +26 -136
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +241 -0
- package/dist/tsup/inspector-tab/mod.d.ts +241 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +4268 -944
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -8
- package/dist/tsup/mod.d.ts +9 -8
- package/dist/tsup/mod.js +4229 -905
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +26 -21
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +7 -6
- package/dist/tsup/test/mod.d.ts +7 -6
- package/dist/tsup/test/mod.js +25 -20
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/unstable/migrations.cjs +101 -0
- package/dist/tsup/unstable/migrations.cjs.map +1 -0
- package/dist/tsup/unstable/migrations.d.cts +29 -0
- package/dist/tsup/unstable/migrations.d.ts +29 -0
- package/dist/tsup/unstable/migrations.js +101 -0
- package/dist/tsup/unstable/migrations.js.map +1 -0
- package/dist/tsup/utils-Bbz-3411.d.cts +162 -0
- package/dist/tsup/utils-BqdWVlzm.d.ts +162 -0
- package/dist/tsup/utils-vvJQyygr.d.cts +109 -0
- package/dist/tsup/utils-vvJQyygr.d.ts +109 -0
- package/dist/tsup/utils.cjs +7 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +4 -147
- package/dist/tsup/utils.d.ts +4 -147
- package/dist/tsup/utils.js +6 -2
- package/dist/tsup/workflow/mod.cjs +517 -412
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +11 -10
- package/dist/tsup/workflow/mod.d.ts +11 -10
- package/dist/tsup/workflow/mod.js +511 -406
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +62 -14
- package/src/actor/actions.ts +119 -0
- package/src/actor/config.test.ts +78 -0
- package/src/actor/config.ts +518 -96
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +38 -26
- package/src/actor/errors.ts +101 -89
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +32 -21
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/cron.ts +37 -2
- package/src/agent-os/actor/index.ts +39 -19
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/agent-os/types.ts +11 -0
- package/src/client/actor-common.ts +106 -53
- package/src/client/actor-conn.ts +94 -45
- package/src/client/actor-handle.ts +198 -79
- package/src/client/actor-query.ts +13 -6
- package/src/client/client.ts +43 -15
- package/src/client/config.ts +8 -0
- package/src/client/errors.ts +4 -2
- package/src/client/lifecycle-errors.ts +28 -4
- package/src/client/mod.ts +9 -4
- package/src/client/query.ts +3 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +24 -16
- package/src/client/resolve-gateway-target.ts +3 -1
- package/src/client/utils.ts +36 -10
- package/src/common/actor-router-consts.ts +7 -0
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +103 -10
- package/src/common/database/mod.test.ts +364 -0
- package/src/common/database/mod.ts +278 -149
- package/src/common/database/native-database.test.ts +220 -0
- package/src/common/database/native-database.ts +394 -58
- package/src/common/database/shared.ts +25 -0
- package/src/common/encoding.ts +302 -38
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/inspector-transport.ts +12 -2
- package/src/common/log.ts +117 -14
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +23 -203
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.test.ts +164 -0
- package/src/db/drizzle.ts +207 -121
- package/src/db/mod.ts +6 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +64 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +23 -4
- package/src/engine-client/actor-websocket-client.ts +32 -5
- package/src/engine-client/api-endpoints.ts +52 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +21 -17
- package/src/engine-client/mod.ts +116 -64
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/globals.d.ts +4 -0
- package/src/inspector/client.browser.ts +127 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector/workflow.ts +61 -0
- package/src/inspector-tab/mod.ts +301 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +160 -53
- package/src/registry/config/serverless.ts +7 -1
- package/src/registry/index.ts +659 -96
- package/src/registry/napi-runtime.ts +1154 -0
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +2005 -955
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/run-handler-coordinator.test.ts +252 -0
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.test.ts +50 -0
- package/src/registry/runtime.ts +839 -0
- package/src/registry/wasm-runtime.ts +1283 -0
- package/src/registry/write-through-proxy.ts +141 -0
- package/src/serde.ts +8 -2
- package/src/serverless/configure.ts +102 -49
- package/src/test/mod.ts +2 -17
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.test.ts +170 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +39 -0
- package/src/utils/node.ts +44 -28
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +4 -2
- package/src/workflow/context.ts +683 -242
- package/src/workflow/driver.test.ts +62 -0
- package/src/workflow/driver.ts +246 -119
- package/src/workflow/inspector.ts +24 -24
- package/src/workflow/mod.ts +76 -84
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-6AVUJ52Q.cjs +0 -253
- package/dist/tsup/chunk-6AVUJ52Q.cjs.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-7X7RVTFF.cjs +0 -735
- package/dist/tsup/chunk-7X7RVTFF.cjs.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-AV54CVAG.cjs.map +0 -1
- package/dist/tsup/chunk-CVHUXINE.js.map +0 -1
- package/dist/tsup/chunk-EVADNK6Z.cjs.map +0 -1
- package/dist/tsup/chunk-J27CEW6F.js.map +0 -1
- package/dist/tsup/chunk-JTL6Y2UN.cjs.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RF3MEJV6.cjs.map +0 -1
- package/dist/tsup/chunk-SB4MXRN2.js +0 -253
- package/dist/tsup/chunk-SB4MXRN2.js.map +0 -1
- package/dist/tsup/chunk-SBEFJ4IQ.js.map +0 -1
- package/dist/tsup/chunk-SPMMF6TR.cjs.map +0 -1
- package/dist/tsup/chunk-TQSL4NJ3.cjs.map +0 -1
- package/dist/tsup/chunk-VD7AZIBR.js.map +0 -1
- package/dist/tsup/chunk-XSC2WWXD.js.map +0 -1
- package/dist/tsup/chunk-ZGWSH7YV.js.map +0 -1
- package/dist/tsup/context-BxvHh9wi.d.cts +0 -92
- package/dist/tsup/context-CNIZBIKl.d.ts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2501
- package/src/drivers/engine/actor-driver.ts +0 -2470
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-PXLJOMJD.js.map → chunk-FXT3HN32.js.map} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Context, Handler } from 'hono';
|
|
2
|
+
import './utils-vvJQyygr.js';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
|
|
5
|
+
declare const EncodingSchema: z.ZodEnum<{
|
|
6
|
+
json: "json";
|
|
7
|
+
cbor: "cbor";
|
|
8
|
+
bare: "bare";
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Encoding used to communicate between the client & actor.
|
|
12
|
+
*/
|
|
13
|
+
type Encoding = z.infer<typeof EncodingSchema>;
|
|
14
|
+
/** Stringifies with compat for values that BARE & CBOR supports. */
|
|
15
|
+
declare function jsonStringifyCompat(input: any, space?: string | number): string;
|
|
16
|
+
/** Parses JSON with compat for values that BARE & CBOR supports. */
|
|
17
|
+
declare function jsonParseCompat(input: string): any;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Joins multiple abort signals into one.
|
|
21
|
+
*
|
|
22
|
+
* The returned signal aborts when the first input signal aborts.
|
|
23
|
+
* Uses `AbortSignal.any(...)` when available, with a runtime fallback.
|
|
24
|
+
*
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
|
+
declare function joinSignals(...signals: Array<AbortSignal | undefined | null>): AbortSignal;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a promise that resolves after the given number of milliseconds.
|
|
30
|
+
*
|
|
31
|
+
* @experimental
|
|
32
|
+
*/
|
|
33
|
+
declare function sleep(ms: number): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a fixed-rate interval tick function that can be awaited in a loop.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* const tick = interval(100);
|
|
39
|
+
* while (!c.aborted) {
|
|
40
|
+
* await tick();
|
|
41
|
+
* if (c.aborted) break;
|
|
42
|
+
* // ... game logic
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* @experimental
|
|
46
|
+
*/
|
|
47
|
+
declare function interval(ms: number): () => Promise<void>;
|
|
48
|
+
declare const VERSION: string;
|
|
49
|
+
/**
|
|
50
|
+
* Builds the HTTP user agent used by this library.
|
|
51
|
+
*
|
|
52
|
+
* @experimental
|
|
53
|
+
*/
|
|
54
|
+
declare function httpUserAgent(): string;
|
|
55
|
+
type UpgradeWebSocket = (createEvents: (c: Context) => any) => Handler;
|
|
56
|
+
type GetUpgradeWebSocket = () => UpgradeWebSocket;
|
|
57
|
+
/**
|
|
58
|
+
* Reads an environment variable from Deno or Node runtimes.
|
|
59
|
+
*
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
62
|
+
declare function getEnvUniversal(key: string): string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Traces a debug value and returns it.
|
|
65
|
+
*
|
|
66
|
+
* @experimental
|
|
67
|
+
*/
|
|
68
|
+
declare function dbg<T>(x: T): T;
|
|
69
|
+
/**
|
|
70
|
+
* Converts various ArrayBuffer-like types to Uint8Array.
|
|
71
|
+
* Handles ArrayBuffer, ArrayBufferView (including typed arrays), and passes through existing Uint8Array.
|
|
72
|
+
*
|
|
73
|
+
* @param data - The ArrayBuffer or ArrayBufferView to convert
|
|
74
|
+
* @returns A Uint8Array view of the data
|
|
75
|
+
*
|
|
76
|
+
* @experimental
|
|
77
|
+
*/
|
|
78
|
+
declare function toUint8Array(data: ArrayBuffer | ArrayBufferView): Uint8Array;
|
|
79
|
+
type LongTimeoutHandle = {
|
|
80
|
+
abort: () => void;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Polyfill for Promise.withResolvers().
|
|
84
|
+
*
|
|
85
|
+
* This is specifically for Cloudflare Workers. Their implementation of Promise.withResolvers does not work correctly.
|
|
86
|
+
*
|
|
87
|
+
* @experimental
|
|
88
|
+
*/
|
|
89
|
+
declare function promiseWithResolvers<T>(onReject: (reason?: any) => void): {
|
|
90
|
+
promise: Promise<T>;
|
|
91
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
92
|
+
reject: (reason?: any) => void;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Sets a timeout that supports delays larger than the JavaScript timer limit.
|
|
96
|
+
*
|
|
97
|
+
* @experimental
|
|
98
|
+
*/
|
|
99
|
+
declare function setLongTimeout(listener: () => void, after: number): LongTimeoutHandle;
|
|
100
|
+
/**
|
|
101
|
+
* A tiny utility that coalesces/enqueues async operations so only the latest
|
|
102
|
+
* queued task runs per cycle, while callers receive a promise that resolves
|
|
103
|
+
* when the task for the cycle they joined has completed.
|
|
104
|
+
*/
|
|
105
|
+
declare class SinglePromiseQueue {
|
|
106
|
+
#private;
|
|
107
|
+
/** The currently running promise of #drainLoop. Do not await this, instead await `pending` to await the current cycle. */
|
|
108
|
+
runningDrainLoop?: Promise<void>;
|
|
109
|
+
/** Queue the next operation and return a promise that resolves when it flushes. */
|
|
110
|
+
enqueue(op: () => Promise<void>): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Converts a Buffer or Uint8Array into an ArrayBuffer view.
|
|
114
|
+
*
|
|
115
|
+
* @experimental
|
|
116
|
+
*/
|
|
117
|
+
declare function bufferToArrayBuffer(buf: Buffer | Uint8Array): ArrayBuffer;
|
|
118
|
+
/**
|
|
119
|
+
* Properly combines a base URL endpoint with a path, preserving any base path in the endpoint.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* combineUrlPath("http://localhost:8787/rivet", "/actors/action")
|
|
123
|
+
* // Returns: "http://localhost:8787/rivet/actors/action"
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* combineUrlPath("http://localhost:8787/rivet", "/actors?type=foo", { namespace: "test" })
|
|
127
|
+
* // Returns: "http://localhost:8787/rivet/actors?type=foo&namespace=test"
|
|
128
|
+
*
|
|
129
|
+
* @param endpoint The base URL endpoint that may contain a path component
|
|
130
|
+
* @param path The path to append to the endpoint (may include query parameters)
|
|
131
|
+
* @param queryParams Optional additional query parameters to append
|
|
132
|
+
* @returns The properly combined URL string
|
|
133
|
+
*
|
|
134
|
+
* @experimental
|
|
135
|
+
*/
|
|
136
|
+
declare function combineUrlPath(endpoint: string, path: string, queryParams?: Record<string, string | undefined>): string;
|
|
137
|
+
/**
|
|
138
|
+
* Compares two ArrayBuffer values by byte content.
|
|
139
|
+
*
|
|
140
|
+
* @experimental
|
|
141
|
+
*/
|
|
142
|
+
declare function arrayBuffersEqual(buf1: ArrayBuffer, buf2: ArrayBuffer): boolean;
|
|
143
|
+
declare const EXTRA_ERROR_LOG: {
|
|
144
|
+
issues: string;
|
|
145
|
+
support: string;
|
|
146
|
+
version: string;
|
|
147
|
+
};
|
|
148
|
+
type Runtime = "deno" | "bun" | "node";
|
|
149
|
+
/**
|
|
150
|
+
* Detects the current JavaScript runtime from the user agent.
|
|
151
|
+
*
|
|
152
|
+
* @experimental
|
|
153
|
+
*/
|
|
154
|
+
declare function detectRuntime(): Runtime;
|
|
155
|
+
type DeepReadonly<T> = {
|
|
156
|
+
readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
|
|
157
|
+
};
|
|
158
|
+
type DeepMutable<T> = {
|
|
159
|
+
-readonly [K in keyof T]: T[K] extends object ? DeepMutable<T[K]> : T[K];
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export { type DeepMutable as D, type Encoding as E, type GetUpgradeWebSocket as G, type LongTimeoutHandle as L, type Runtime as R, SinglePromiseQueue as S, type UpgradeWebSocket as U, VERSION as V, type DeepReadonly as a, EXTRA_ERROR_LOG as b, arrayBuffersEqual as c, bufferToArrayBuffer as d, combineUrlPath as e, dbg as f, detectRuntime as g, getEnvUniversal as h, httpUserAgent as i, interval as j, joinSignals as k, jsonParseCompat as l, jsonStringifyCompat as m, sleep as n, promiseWithResolvers as p, setLongTimeout as s, toUint8Array as t };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Next } from 'hono';
|
|
2
|
+
import { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
3
|
+
|
|
4
|
+
declare const INTERNAL_ERROR_CODE = "internal_error";
|
|
5
|
+
declare const INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
6
|
+
type InternalErrorMetadata = Record<string, never>;
|
|
7
|
+
declare const USER_ERROR_CODE = "user_error";
|
|
8
|
+
declare const BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
9
|
+
interface RivetErrorOptions extends ErrorOptions {
|
|
10
|
+
/** Error data can safely be serialized in a response to the client. */
|
|
11
|
+
public?: boolean;
|
|
12
|
+
/** Metadata associated with this error. */
|
|
13
|
+
metadata?: unknown;
|
|
14
|
+
/** Request identifier used to correlate this error with engine logs. */
|
|
15
|
+
rayId?: string;
|
|
16
|
+
/** Explicit HTTP status override for router responses. */
|
|
17
|
+
statusCode?: number;
|
|
18
|
+
/** Actor context associated with this error. */
|
|
19
|
+
actor?: ActorSpecifier;
|
|
20
|
+
}
|
|
21
|
+
/** Identifies the actor that was handling work when an error was produced. */
|
|
22
|
+
interface ActorSpecifier {
|
|
23
|
+
actorId: string;
|
|
24
|
+
generation: number;
|
|
25
|
+
key?: string;
|
|
26
|
+
}
|
|
27
|
+
interface RivetErrorLike {
|
|
28
|
+
__type?: "ActorError" | "RivetError";
|
|
29
|
+
group: string;
|
|
30
|
+
code: string;
|
|
31
|
+
message: string;
|
|
32
|
+
metadata?: unknown;
|
|
33
|
+
rayId?: string;
|
|
34
|
+
public?: boolean;
|
|
35
|
+
statusCode?: number;
|
|
36
|
+
actor?: ActorSpecifier;
|
|
37
|
+
}
|
|
38
|
+
interface BridgeRivetErrorPayload extends RivetErrorLike {
|
|
39
|
+
}
|
|
40
|
+
interface UserErrorOptions extends ErrorOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Machine readable code for this error. Useful for catching different types of
|
|
43
|
+
* errors in try-catch.
|
|
44
|
+
*/
|
|
45
|
+
code?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Additional metadata related to the error. Useful for understanding context
|
|
48
|
+
* about the error.
|
|
49
|
+
*/
|
|
50
|
+
metadata?: unknown;
|
|
51
|
+
}
|
|
52
|
+
declare function isRivetErrorLike(error: unknown): error is RivetError | DeconstructedError | RivetErrorLike;
|
|
53
|
+
declare function isActorAbortedError(error: unknown): boolean;
|
|
54
|
+
declare class RivetError extends Error {
|
|
55
|
+
__type: "RivetError";
|
|
56
|
+
public: boolean;
|
|
57
|
+
metadata?: unknown;
|
|
58
|
+
readonly rayId?: string;
|
|
59
|
+
statusCode: number;
|
|
60
|
+
actor?: ActorSpecifier;
|
|
61
|
+
readonly group: string;
|
|
62
|
+
readonly code: string;
|
|
63
|
+
static isRivetError(error: unknown): error is RivetError | DeconstructedError;
|
|
64
|
+
static isActorError(error: unknown): error is RivetError | DeconstructedError;
|
|
65
|
+
constructor(group: string, code: string, message: string, options?: RivetErrorOptions | unknown);
|
|
66
|
+
toString(): string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare class UserError extends RivetError {
|
|
70
|
+
constructor(message: string, options?: UserErrorOptions);
|
|
71
|
+
}
|
|
72
|
+
declare function toRivetError(error: unknown, fallback?: Partial<RivetErrorLike>): RivetError;
|
|
73
|
+
declare function encodeBridgeRivetError(error: RivetErrorLike): string;
|
|
74
|
+
declare function decodeBridgeRivetErrorPayload(value: string): BridgeRivetErrorPayload | undefined;
|
|
75
|
+
declare function decodeBridgeRivetError(value: string): RivetError | undefined;
|
|
76
|
+
declare function isRivetErrorCode(error: unknown, group: string, code: string): error is RivetError;
|
|
77
|
+
declare function internalError(message: string, options?: Partial<RivetErrorOptions> & {
|
|
78
|
+
group?: string;
|
|
79
|
+
code?: string;
|
|
80
|
+
}): RivetError;
|
|
81
|
+
declare function invalidEncoding(format?: string): RivetError;
|
|
82
|
+
declare function invalidRequest(error?: unknown): RivetError;
|
|
83
|
+
declare function actorNotFound(identifier?: string): RivetError;
|
|
84
|
+
declare function actorStopping(identifier?: string): RivetError;
|
|
85
|
+
interface ActorRestartingOptions {
|
|
86
|
+
phase?: "stopping" | "sleeping" | "waking" | "runner_shutdown";
|
|
87
|
+
retryAfterMs?: number;
|
|
88
|
+
}
|
|
89
|
+
declare function actorRestarting(opts?: ActorRestartingOptions): RivetError;
|
|
90
|
+
declare function forbiddenError(): RivetError;
|
|
91
|
+
declare function unsupportedFeature(feature: string): RivetError;
|
|
92
|
+
|
|
93
|
+
declare function assertUnreachable(x: never): never;
|
|
94
|
+
interface DeconstructedError {
|
|
95
|
+
__type: "ActorError";
|
|
96
|
+
statusCode: ContentfulStatusCode;
|
|
97
|
+
public: boolean;
|
|
98
|
+
group: string;
|
|
99
|
+
code: string;
|
|
100
|
+
message: string;
|
|
101
|
+
metadata?: unknown;
|
|
102
|
+
rayId?: string;
|
|
103
|
+
actor?: ActorSpecifier;
|
|
104
|
+
}
|
|
105
|
+
declare function stringifyError(error: unknown): string;
|
|
106
|
+
/** Generates a `Next` handler to pass to middleware in order to be able to call arbitrary middleware. */
|
|
107
|
+
declare function noopNext(): Next;
|
|
108
|
+
|
|
109
|
+
export { type ActorRestartingOptions as A, BRIDGE_RIVET_ERROR_PREFIX as B, INTERNAL_ERROR_CODE as I, RivetError as R, UserError as U, type RivetErrorLike as a, type RivetErrorOptions as b, type UserErrorOptions as c, assertUnreachable as d, type ActorSpecifier as e, type BridgeRivetErrorPayload as f, INTERNAL_ERROR_DESCRIPTION as g, type InternalErrorMetadata as h, USER_ERROR_CODE as i, actorNotFound as j, actorRestarting as k, actorStopping as l, decodeBridgeRivetError as m, noopNext as n, decodeBridgeRivetErrorPayload as o, encodeBridgeRivetError as p, forbiddenError as q, internalError as r, stringifyError as s, invalidEncoding as t, invalidRequest as u, isActorAbortedError as v, isRivetErrorCode as w, isRivetErrorLike as x, toRivetError as y, unsupportedFeature as z };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Next } from 'hono';
|
|
2
|
+
import { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
3
|
+
|
|
4
|
+
declare const INTERNAL_ERROR_CODE = "internal_error";
|
|
5
|
+
declare const INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
6
|
+
type InternalErrorMetadata = Record<string, never>;
|
|
7
|
+
declare const USER_ERROR_CODE = "user_error";
|
|
8
|
+
declare const BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
9
|
+
interface RivetErrorOptions extends ErrorOptions {
|
|
10
|
+
/** Error data can safely be serialized in a response to the client. */
|
|
11
|
+
public?: boolean;
|
|
12
|
+
/** Metadata associated with this error. */
|
|
13
|
+
metadata?: unknown;
|
|
14
|
+
/** Request identifier used to correlate this error with engine logs. */
|
|
15
|
+
rayId?: string;
|
|
16
|
+
/** Explicit HTTP status override for router responses. */
|
|
17
|
+
statusCode?: number;
|
|
18
|
+
/** Actor context associated with this error. */
|
|
19
|
+
actor?: ActorSpecifier;
|
|
20
|
+
}
|
|
21
|
+
/** Identifies the actor that was handling work when an error was produced. */
|
|
22
|
+
interface ActorSpecifier {
|
|
23
|
+
actorId: string;
|
|
24
|
+
generation: number;
|
|
25
|
+
key?: string;
|
|
26
|
+
}
|
|
27
|
+
interface RivetErrorLike {
|
|
28
|
+
__type?: "ActorError" | "RivetError";
|
|
29
|
+
group: string;
|
|
30
|
+
code: string;
|
|
31
|
+
message: string;
|
|
32
|
+
metadata?: unknown;
|
|
33
|
+
rayId?: string;
|
|
34
|
+
public?: boolean;
|
|
35
|
+
statusCode?: number;
|
|
36
|
+
actor?: ActorSpecifier;
|
|
37
|
+
}
|
|
38
|
+
interface BridgeRivetErrorPayload extends RivetErrorLike {
|
|
39
|
+
}
|
|
40
|
+
interface UserErrorOptions extends ErrorOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Machine readable code for this error. Useful for catching different types of
|
|
43
|
+
* errors in try-catch.
|
|
44
|
+
*/
|
|
45
|
+
code?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Additional metadata related to the error. Useful for understanding context
|
|
48
|
+
* about the error.
|
|
49
|
+
*/
|
|
50
|
+
metadata?: unknown;
|
|
51
|
+
}
|
|
52
|
+
declare function isRivetErrorLike(error: unknown): error is RivetError | DeconstructedError | RivetErrorLike;
|
|
53
|
+
declare function isActorAbortedError(error: unknown): boolean;
|
|
54
|
+
declare class RivetError extends Error {
|
|
55
|
+
__type: "RivetError";
|
|
56
|
+
public: boolean;
|
|
57
|
+
metadata?: unknown;
|
|
58
|
+
readonly rayId?: string;
|
|
59
|
+
statusCode: number;
|
|
60
|
+
actor?: ActorSpecifier;
|
|
61
|
+
readonly group: string;
|
|
62
|
+
readonly code: string;
|
|
63
|
+
static isRivetError(error: unknown): error is RivetError | DeconstructedError;
|
|
64
|
+
static isActorError(error: unknown): error is RivetError | DeconstructedError;
|
|
65
|
+
constructor(group: string, code: string, message: string, options?: RivetErrorOptions | unknown);
|
|
66
|
+
toString(): string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare class UserError extends RivetError {
|
|
70
|
+
constructor(message: string, options?: UserErrorOptions);
|
|
71
|
+
}
|
|
72
|
+
declare function toRivetError(error: unknown, fallback?: Partial<RivetErrorLike>): RivetError;
|
|
73
|
+
declare function encodeBridgeRivetError(error: RivetErrorLike): string;
|
|
74
|
+
declare function decodeBridgeRivetErrorPayload(value: string): BridgeRivetErrorPayload | undefined;
|
|
75
|
+
declare function decodeBridgeRivetError(value: string): RivetError | undefined;
|
|
76
|
+
declare function isRivetErrorCode(error: unknown, group: string, code: string): error is RivetError;
|
|
77
|
+
declare function internalError(message: string, options?: Partial<RivetErrorOptions> & {
|
|
78
|
+
group?: string;
|
|
79
|
+
code?: string;
|
|
80
|
+
}): RivetError;
|
|
81
|
+
declare function invalidEncoding(format?: string): RivetError;
|
|
82
|
+
declare function invalidRequest(error?: unknown): RivetError;
|
|
83
|
+
declare function actorNotFound(identifier?: string): RivetError;
|
|
84
|
+
declare function actorStopping(identifier?: string): RivetError;
|
|
85
|
+
interface ActorRestartingOptions {
|
|
86
|
+
phase?: "stopping" | "sleeping" | "waking" | "runner_shutdown";
|
|
87
|
+
retryAfterMs?: number;
|
|
88
|
+
}
|
|
89
|
+
declare function actorRestarting(opts?: ActorRestartingOptions): RivetError;
|
|
90
|
+
declare function forbiddenError(): RivetError;
|
|
91
|
+
declare function unsupportedFeature(feature: string): RivetError;
|
|
92
|
+
|
|
93
|
+
declare function assertUnreachable(x: never): never;
|
|
94
|
+
interface DeconstructedError {
|
|
95
|
+
__type: "ActorError";
|
|
96
|
+
statusCode: ContentfulStatusCode;
|
|
97
|
+
public: boolean;
|
|
98
|
+
group: string;
|
|
99
|
+
code: string;
|
|
100
|
+
message: string;
|
|
101
|
+
metadata?: unknown;
|
|
102
|
+
rayId?: string;
|
|
103
|
+
actor?: ActorSpecifier;
|
|
104
|
+
}
|
|
105
|
+
declare function stringifyError(error: unknown): string;
|
|
106
|
+
/** Generates a `Next` handler to pass to middleware in order to be able to call arbitrary middleware. */
|
|
107
|
+
declare function noopNext(): Next;
|
|
108
|
+
|
|
109
|
+
export { type ActorRestartingOptions as A, BRIDGE_RIVET_ERROR_PREFIX as B, INTERNAL_ERROR_CODE as I, RivetError as R, UserError as U, type RivetErrorLike as a, type RivetErrorOptions as b, type UserErrorOptions as c, assertUnreachable as d, type ActorSpecifier as e, type BridgeRivetErrorPayload as f, INTERNAL_ERROR_DESCRIPTION as g, type InternalErrorMetadata as h, USER_ERROR_CODE as i, actorNotFound as j, actorRestarting as k, actorStopping as l, decodeBridgeRivetError as m, noopNext as n, decodeBridgeRivetErrorPayload as o, encodeBridgeRivetError as p, forbiddenError as q, internalError as r, stringifyError as s, invalidEncoding as t, invalidRequest as u, isActorAbortedError as v, isRivetErrorCode as w, isRivetErrorLike as x, toRivetError as y, unsupportedFeature as z };
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var _chunk7X7RVTFFcjs = require('./chunk-7X7RVTFF.cjs');
|
|
21
|
-
require('./chunk-JTL6Y2UN.cjs');
|
|
22
20
|
|
|
23
21
|
|
|
22
|
+
var _chunkXLBMKZD3cjs = require('./chunk-XLBMKZD3.cjs');
|
|
23
|
+
require('./chunk-SPJORZMM.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -38,5 +38,9 @@ require('./chunk-JTL6Y2UN.cjs');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.EXTRA_ERROR_LOG = _chunkXLBMKZD3cjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkXLBMKZD3cjs.SinglePromiseQueue; exports.VERSION = _chunkXLBMKZD3cjs.VERSION; exports.arrayBuffersEqual = _chunkXLBMKZD3cjs.arrayBuffersEqual; exports.assertUnreachable = _chunkXLBMKZD3cjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkXLBMKZD3cjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkXLBMKZD3cjs.combineUrlPath; exports.dbg = _chunkXLBMKZD3cjs.dbg; exports.detectRuntime = _chunkXLBMKZD3cjs.detectRuntime; exports.getEnvUniversal = _chunkXLBMKZD3cjs.getEnvUniversal; exports.httpUserAgent = _chunkXLBMKZD3cjs.httpUserAgent; exports.interval = _chunkXLBMKZD3cjs.interval; exports.joinSignals = _chunkXLBMKZD3cjs.joinSignals; exports.jsonParseCompat = _chunkXLBMKZD3cjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkXLBMKZD3cjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkXLBMKZD3cjs.promiseWithResolvers; exports.setLongTimeout = _chunkXLBMKZD3cjs.setLongTimeout; exports.sleep = _chunkXLBMKZD3cjs.sleep; exports.stringifyError = _chunkXLBMKZD3cjs.stringifyError; exports.toUint8Array = _chunkXLBMKZD3cjs.toUint8Array;
|
|
42
46
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/actors/actors/rivetkit-typescript/packages/rivetkit/dist/tsup/utils.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,qoCAAC","file":"/home/runner/work/actors/actors/rivetkit-typescript/packages/rivetkit/dist/tsup/utils.cjs"}
|
package/dist/tsup/utils.d.cts
CHANGED
|
@@ -1,148 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import 'hono';
|
|
2
|
+
export { d as assertUnreachable, s as stringifyError } from './utils-vvJQyygr.cjs';
|
|
3
|
+
export { D as DeepMutable, a as DeepReadonly, b as EXTRA_ERROR_LOG, G as GetUpgradeWebSocket, L as LongTimeoutHandle, R as Runtime, S as SinglePromiseQueue, U as UpgradeWebSocket, V as VERSION, c as arrayBuffersEqual, d as bufferToArrayBuffer, e as combineUrlPath, f as dbg, g as detectRuntime, h as getEnvUniversal, i as httpUserAgent, j as interval, k as joinSignals, l as jsonParseCompat, m as jsonStringifyCompat, p as promiseWithResolvers, s as setLongTimeout, n as sleep, t as toUint8Array } from './utils-Bbz-3411.cjs';
|
|
3
4
|
import 'hono/utils/http-status';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Joins multiple abort signals into one.
|
|
7
|
-
*
|
|
8
|
-
* The returned signal aborts when the first input signal aborts.
|
|
9
|
-
* Uses `AbortSignal.any(...)` when available, with a runtime fallback.
|
|
10
|
-
*
|
|
11
|
-
* @experimental
|
|
12
|
-
*/
|
|
13
|
-
declare function joinSignals(...signals: Array<AbortSignal | undefined | null>): AbortSignal;
|
|
14
|
-
/**
|
|
15
|
-
* Returns a promise that resolves after the given number of milliseconds.
|
|
16
|
-
*
|
|
17
|
-
* @experimental
|
|
18
|
-
*/
|
|
19
|
-
declare function sleep(ms: number): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Creates a fixed-rate interval tick function that can be awaited in a loop.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const tick = interval(100);
|
|
25
|
-
* while (!c.aborted) {
|
|
26
|
-
* await tick();
|
|
27
|
-
* if (c.aborted) break;
|
|
28
|
-
* // ... game logic
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* @experimental
|
|
32
|
-
*/
|
|
33
|
-
declare function interval(ms: number): () => Promise<void>;
|
|
34
|
-
declare const VERSION: string;
|
|
35
|
-
/**
|
|
36
|
-
* Builds the HTTP user agent used by this library.
|
|
37
|
-
*
|
|
38
|
-
* @experimental
|
|
39
|
-
*/
|
|
40
|
-
declare function httpUserAgent(): string;
|
|
41
|
-
type UpgradeWebSocket = (createEvents: (c: Context) => any) => Handler;
|
|
42
|
-
type GetUpgradeWebSocket = () => UpgradeWebSocket;
|
|
43
|
-
/**
|
|
44
|
-
* Reads an environment variable from Deno or Node runtimes.
|
|
45
|
-
*
|
|
46
|
-
* @experimental
|
|
47
|
-
*/
|
|
48
|
-
declare function getEnvUniversal(key: string): string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Traces a debug value and returns it.
|
|
51
|
-
*
|
|
52
|
-
* @experimental
|
|
53
|
-
*/
|
|
54
|
-
declare function dbg<T>(x: T): T;
|
|
55
|
-
/**
|
|
56
|
-
* Converts various ArrayBuffer-like types to Uint8Array.
|
|
57
|
-
* Handles ArrayBuffer, ArrayBufferView (including typed arrays), and passes through existing Uint8Array.
|
|
58
|
-
*
|
|
59
|
-
* @param data - The ArrayBuffer or ArrayBufferView to convert
|
|
60
|
-
* @returns A Uint8Array view of the data
|
|
61
|
-
*
|
|
62
|
-
* @experimental
|
|
63
|
-
*/
|
|
64
|
-
declare function toUint8Array(data: ArrayBuffer | ArrayBufferView): Uint8Array;
|
|
65
|
-
type LongTimeoutHandle = {
|
|
66
|
-
abort: () => void;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Polyfill for Promise.withResolvers().
|
|
70
|
-
*
|
|
71
|
-
* This is specifically for Cloudflare Workers. Their implementation of Promise.withResolvers does not work correctly.
|
|
72
|
-
*
|
|
73
|
-
* @experimental
|
|
74
|
-
*/
|
|
75
|
-
declare function promiseWithResolvers<T>(onReject: (reason?: any) => void): {
|
|
76
|
-
promise: Promise<T>;
|
|
77
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
78
|
-
reject: (reason?: any) => void;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Sets a timeout that supports delays larger than the JavaScript timer limit.
|
|
82
|
-
*
|
|
83
|
-
* @experimental
|
|
84
|
-
*/
|
|
85
|
-
declare function setLongTimeout(listener: () => void, after: number): LongTimeoutHandle;
|
|
86
|
-
/**
|
|
87
|
-
* A tiny utility that coalesces/enqueues async operations so only the latest
|
|
88
|
-
* queued task runs per cycle, while callers receive a promise that resolves
|
|
89
|
-
* when the task for the cycle they joined has completed.
|
|
90
|
-
*/
|
|
91
|
-
declare class SinglePromiseQueue {
|
|
92
|
-
#private;
|
|
93
|
-
/** The currently running promise of #drainLoop. Do not await this, instead await `pending` to await the current cycle. */
|
|
94
|
-
runningDrainLoop?: Promise<void>;
|
|
95
|
-
/** Queue the next operation and return a promise that resolves when it flushes. */
|
|
96
|
-
enqueue(op: () => Promise<void>): Promise<void>;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Converts a Buffer or Uint8Array into an ArrayBuffer view.
|
|
100
|
-
*
|
|
101
|
-
* @experimental
|
|
102
|
-
*/
|
|
103
|
-
declare function bufferToArrayBuffer(buf: Buffer | Uint8Array): ArrayBuffer;
|
|
104
|
-
/**
|
|
105
|
-
* Properly combines a base URL endpoint with a path, preserving any base path in the endpoint.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* combineUrlPath("http://localhost:8787/rivet", "/actors/action")
|
|
109
|
-
* // Returns: "http://localhost:8787/rivet/actors/action"
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* combineUrlPath("http://localhost:8787/rivet", "/actors?type=foo", { namespace: "test" })
|
|
113
|
-
* // Returns: "http://localhost:8787/rivet/actors?type=foo&namespace=test"
|
|
114
|
-
*
|
|
115
|
-
* @param endpoint The base URL endpoint that may contain a path component
|
|
116
|
-
* @param path The path to append to the endpoint (may include query parameters)
|
|
117
|
-
* @param queryParams Optional additional query parameters to append
|
|
118
|
-
* @returns The properly combined URL string
|
|
119
|
-
*
|
|
120
|
-
* @experimental
|
|
121
|
-
*/
|
|
122
|
-
declare function combineUrlPath(endpoint: string, path: string, queryParams?: Record<string, string | undefined>): string;
|
|
123
|
-
/**
|
|
124
|
-
* Compares two ArrayBuffer values by byte content.
|
|
125
|
-
*
|
|
126
|
-
* @experimental
|
|
127
|
-
*/
|
|
128
|
-
declare function arrayBuffersEqual(buf1: ArrayBuffer, buf2: ArrayBuffer): boolean;
|
|
129
|
-
declare const EXTRA_ERROR_LOG: {
|
|
130
|
-
issues: string;
|
|
131
|
-
support: string;
|
|
132
|
-
version: string;
|
|
133
|
-
};
|
|
134
|
-
type Runtime = "deno" | "bun" | "node";
|
|
135
|
-
/**
|
|
136
|
-
* Detects the current JavaScript runtime from the user agent.
|
|
137
|
-
*
|
|
138
|
-
* @experimental
|
|
139
|
-
*/
|
|
140
|
-
declare function detectRuntime(): Runtime;
|
|
141
|
-
type DeepReadonly<T> = {
|
|
142
|
-
readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
|
|
143
|
-
};
|
|
144
|
-
type DeepMutable<T> = {
|
|
145
|
-
-readonly [K in keyof T]: T[K] extends object ? DeepMutable<T[K]> : T[K];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export { type DeepMutable, type DeepReadonly, EXTRA_ERROR_LOG, type GetUpgradeWebSocket, type LongTimeoutHandle, type Runtime, SinglePromiseQueue, type UpgradeWebSocket, VERSION, arrayBuffersEqual, bufferToArrayBuffer, combineUrlPath, dbg, detectRuntime, getEnvUniversal, httpUserAgent, interval, joinSignals, promiseWithResolvers, setLongTimeout, sleep, toUint8Array };
|
|
5
|
+
import 'zod/v4';
|