rivetkit 2.3.20 → 2.3.22
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 +43 -5
- package/dist/browser/client.js +315 -63
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +2 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/agent-os/index.cjs +2 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +32 -4
- package/dist/tsup/agent-os/index.d.ts +32 -4
- package/dist/tsup/agent-os/index.js +2 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-553CIQJY.js → chunk-47FSGXYN.js} +2 -2
- package/dist/tsup/{chunk-2NXLTFWI.js → chunk-4DTWJFIZ.js} +3 -3
- package/dist/tsup/chunk-4DTWJFIZ.js.map +1 -0
- package/dist/tsup/{chunk-2CE5UNWK.cjs → chunk-BDKVTNJF.cjs} +11 -10
- package/dist/tsup/chunk-BDKVTNJF.cjs.map +1 -0
- package/dist/tsup/{chunk-DHWZTUKA.js → chunk-DE2IFYJK.js} +4 -3
- package/dist/tsup/chunk-DE2IFYJK.js.map +1 -0
- package/dist/tsup/{chunk-DMQUERRN.js → chunk-GINS4O73.js} +2 -2
- package/dist/tsup/{chunk-3WS7Z64U.cjs → chunk-GZZNJGXY.cjs} +3 -3
- package/dist/tsup/chunk-GZZNJGXY.cjs.map +1 -0
- package/dist/tsup/{chunk-A36FMKOV.cjs → chunk-HEY27WZX.cjs} +479 -230
- package/dist/tsup/chunk-HEY27WZX.cjs.map +1 -0
- package/dist/tsup/{chunk-WAISW7KR.cjs → chunk-KEAUN5F5.cjs} +10 -10
- package/dist/tsup/chunk-KEAUN5F5.cjs.map +1 -0
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -1
- package/dist/tsup/{chunk-CVLNRT7O.cjs → chunk-LUMROGNM.cjs} +3 -3
- package/dist/tsup/chunk-LUMROGNM.cjs.map +1 -0
- package/dist/tsup/{chunk-JX2ITWAV.cjs → chunk-MGI2VVF6.cjs} +14 -4
- package/dist/tsup/chunk-MGI2VVF6.cjs.map +1 -0
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -1
- package/dist/tsup/chunk-NWCAIWHL.cjs.map +1 -1
- package/dist/tsup/{chunk-RSIOGT2U.cjs → chunk-QOQA4JPN.cjs} +7 -7
- package/dist/tsup/chunk-QOQA4JPN.cjs.map +1 -0
- package/dist/tsup/{chunk-TZVAVPGJ.js → chunk-QXBNHJH5.js} +4 -4
- package/dist/tsup/{chunk-W2PXGWMR.js → chunk-RIPVNPR6.js} +2 -2
- package/dist/tsup/{chunk-5G2J26VM.js → chunk-VD47X7KQ.js} +318 -69
- package/dist/tsup/chunk-VD47X7KQ.js.map +1 -0
- package/dist/tsup/{chunk-76YTS32R.cjs → chunk-WLRGUAMW.cjs} +4 -4
- package/dist/tsup/chunk-WLRGUAMW.cjs.map +1 -0
- package/dist/tsup/{chunk-IHKDFKM4.cjs → chunk-WMNXGH25.cjs} +3 -3
- package/dist/tsup/chunk-WMNXGH25.cjs.map +1 -0
- package/dist/tsup/{chunk-SNNVRHLX.js → chunk-XZBDVEQN.js} +2 -2
- package/dist/tsup/{chunk-P2OFXH4G.js → chunk-ZOVJDAOW.js} +14 -4
- package/dist/tsup/chunk-ZOVJDAOW.js.map +1 -0
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +15 -6
- package/dist/tsup/client/mod.d.ts +15 -6
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.cjs.map +1 -1
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Be-VOHaX.d.ts → config-Cv6pjCt-.d.ts} +37 -7
- package/dist/tsup/{config-Ct5uXxXk.d.cts → config-osdJqQwX.d.cts} +37 -7
- package/dist/tsup/{context-CXLa0BIM.d.ts → context-CoVbKBuk.d.ts} +1 -1
- package/dist/tsup/{context-Cw-11Q-B.d.cts → context-DpjrM7n7.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.js +2 -2
- package/dist/tsup/db/mod.cjs +4 -4
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.js +3 -3
- package/dist/tsup/dynamic/mod.cjs.map +1 -1
- package/dist/tsup/dynamic/mod.d.cts +4 -3
- package/dist/tsup/dynamic/mod.d.ts +4 -3
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector/workflow.cjs +5 -5
- package/dist/tsup/inspector/workflow.cjs.map +1 -1
- package/dist/tsup/inspector/workflow.js +4 -4
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
- package/dist/tsup/inspector-tab/mod.d.cts +5 -4
- package/dist/tsup/inspector-tab/mod.d.ts +5 -4
- package/dist/tsup/mod.cjs +170 -158
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +6 -5
- package/dist/tsup/mod.d.ts +6 -5
- package/dist/tsup/mod.js +56 -44
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -3
- package/dist/tsup/test/mod.d.ts +4 -3
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/unstable/migrations.cjs.map +1 -1
- package/dist/tsup/{utils-DsoDinPz.d.ts → utils-3rsE0JvI.d.cts} +12 -2
- package/dist/tsup/{utils-DsoDinPz.d.cts → utils-3rsE0JvI.d.ts} +12 -2
- package/dist/tsup/{utils-OQHBjfcM.d.ts → utils-C1O-SklO.d.ts} +1 -1
- package/dist/tsup/{utils-CNFeS-Dk.d.cts → utils-C6b0aYUM.d.cts} +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +2 -2
- package/dist/tsup/utils.d.ts +2 -2
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +11 -11
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +6 -5
- package/dist/tsup/workflow/mod.d.ts +6 -5
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +10 -9
- package/src/actor/errors.ts +27 -4
- package/src/client/actor-conn.ts +34 -1
- package/src/client/actor-handle.ts +29 -1
- package/src/client/auth.ts +37 -0
- package/src/client/client.ts +10 -2
- package/src/client/config.ts +12 -1
- package/src/client/mod.ts +9 -0
- package/src/client/token-provider.test.ts +86 -0
- package/src/client/token-provider.ts +93 -0
- package/src/client/utils.ts +1 -0
- package/src/engine-client/actor-websocket-client.ts +2 -1
- package/src/engine-client/api-endpoints.ts +28 -0
- package/src/engine-client/driver.ts +4 -0
- package/src/engine-client/mod.ts +201 -64
- package/src/registry/config/envoy.ts +1 -17
- package/src/registry/config/index.test.ts +2 -2
- package/src/registry/config/index.ts +7 -2
- package/src/registry/index.ts +28 -0
- package/src/registry/native.ts +31 -3
- package/dist/tsup/chunk-2CE5UNWK.cjs.map +0 -1
- package/dist/tsup/chunk-2NXLTFWI.js.map +0 -1
- package/dist/tsup/chunk-3WS7Z64U.cjs.map +0 -1
- package/dist/tsup/chunk-5G2J26VM.js.map +0 -1
- package/dist/tsup/chunk-76YTS32R.cjs.map +0 -1
- package/dist/tsup/chunk-A36FMKOV.cjs.map +0 -1
- package/dist/tsup/chunk-CVLNRT7O.cjs.map +0 -1
- package/dist/tsup/chunk-DHWZTUKA.js.map +0 -1
- package/dist/tsup/chunk-IHKDFKM4.cjs.map +0 -1
- package/dist/tsup/chunk-JX2ITWAV.cjs.map +0 -1
- package/dist/tsup/chunk-P2OFXH4G.js.map +0 -1
- package/dist/tsup/chunk-RSIOGT2U.cjs.map +0 -1
- package/dist/tsup/chunk-WAISW7KR.cjs.map +0 -1
- package/src/registry/process-metrics.ts +0 -250
- /package/dist/tsup/{chunk-553CIQJY.js.map → chunk-47FSGXYN.js.map} +0 -0
- /package/dist/tsup/{chunk-DMQUERRN.js.map → chunk-GINS4O73.js.map} +0 -0
- /package/dist/tsup/{chunk-TZVAVPGJ.js.map → chunk-QXBNHJH5.js.map} +0 -0
- /package/dist/tsup/{chunk-W2PXGWMR.js.map → chunk-RIPVNPR6.js.map} +0 -0
- /package/dist/tsup/{chunk-SNNVRHLX.js.map → chunk-XZBDVEQN.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
|
|
2
2
|
import { z as z$2 } from 'zod';
|
|
3
3
|
import z$1, { z } from 'zod/v4';
|
|
4
|
+
import { Rivet } from '@rivetkit/engine-api-full';
|
|
4
5
|
import { Context, Handler, Hono } from 'hono';
|
|
5
6
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
6
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -176,6 +177,26 @@ type RawAccess = {
|
|
|
176
177
|
close: () => Promise<void>;
|
|
177
178
|
};
|
|
178
179
|
|
|
180
|
+
/** A namespace-scoped Engine grant. The caller must provide every grant explicitly. */
|
|
181
|
+
type TokenGrant = Rivet.AuthTokenGrant;
|
|
182
|
+
/** Options for `client.auth.issueToken()`. `expiresIn` is in seconds. */
|
|
183
|
+
type IssueTokenOptions = Pick<Rivet.AuthTokenCreateRequest, "subject" | "grants"> & {
|
|
184
|
+
expiresIn?: Rivet.AuthTokenCreateRequest["duration"];
|
|
185
|
+
};
|
|
186
|
+
/** Token timestamps are Unix milliseconds. */
|
|
187
|
+
interface IssuedToken {
|
|
188
|
+
token: Rivet.AuthTokenCreateResponse["token"];
|
|
189
|
+
issuedAt: Rivet.AuthTokenCreateResponse["issuedTs"];
|
|
190
|
+
expiresAt: Rivet.AuthTokenCreateResponse["expiresTs"];
|
|
191
|
+
}
|
|
192
|
+
/** Resources that can be scoped to a single actor ID. */
|
|
193
|
+
type ActorTokenResource = Extract<Rivet.AuthTokenGrant["resource"], "actor_gateway" | "actor" | "actor_kv">;
|
|
194
|
+
type ActorTokenPermissions = Partial<Record<ActorTokenResource, Rivet.AuthTokenGrant["operations"]>>;
|
|
195
|
+
/** Options for `actor.issueToken()`. Omit permissions for gateway read access only. */
|
|
196
|
+
type ActorIssueTokenOptions = Pick<IssueTokenOptions, "subject" | "expiresIn"> & {
|
|
197
|
+
permissions?: ActorTokenPermissions;
|
|
198
|
+
};
|
|
199
|
+
|
|
179
200
|
declare const EncodingSchema: z.ZodEnum<{
|
|
180
201
|
json: "json";
|
|
181
202
|
cbor: "cbor";
|
|
@@ -372,6 +393,7 @@ interface GatewayRequestOptions {
|
|
|
372
393
|
skipReadyWait?: boolean;
|
|
373
394
|
}
|
|
374
395
|
interface EngineControlClient {
|
|
396
|
+
issueToken(options: IssueTokenOptions): Promise<IssuedToken>;
|
|
375
397
|
getForId(input: GetForIdInput): Promise<ActorOutput | undefined>;
|
|
376
398
|
getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
|
|
377
399
|
getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
|
|
@@ -379,6 +401,8 @@ interface EngineControlClient {
|
|
|
379
401
|
listActors(input: ListActorsInput): Promise<ActorOutput[]>;
|
|
380
402
|
sendRequest(target: GatewayTarget, actorRequest: Request, options?: GatewayRequestOptions): Promise<Response>;
|
|
381
403
|
openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown, options?: GatewayRequestOptions): Promise<UniversalWebSocket>;
|
|
404
|
+
/** Refresh a credential rejected during this WebSocket handshake, if supported. */
|
|
405
|
+
refreshAuthToken?(ws: UniversalWebSocket): Promise<boolean>;
|
|
382
406
|
proxyRequest(c: Context, actorRequest: Request, actorId: string): Promise<Response>;
|
|
383
407
|
proxyWebSocket(c: Context, path: string, actorId: string, encoding: Encoding, params: unknown): Promise<Response>;
|
|
384
408
|
buildGatewayUrl(target: GatewayTarget, options?: GatewayRequestOptions): Promise<string>;
|
|
@@ -1256,6 +1280,8 @@ declare class ActorHandleRaw {
|
|
|
1256
1280
|
* Resolves the actor to get its unique actor ID.
|
|
1257
1281
|
*/
|
|
1258
1282
|
resolve(): Promise<string>;
|
|
1283
|
+
/** Issue a token scoped to this actor. Defaults to actor gateway read access. */
|
|
1284
|
+
issueToken(options?: ActorIssueTokenOptions): Promise<IssuedToken>;
|
|
1259
1285
|
/**
|
|
1260
1286
|
* Returns the raw URL for routing traffic to the actor.
|
|
1261
1287
|
*/
|
|
@@ -1281,11 +1307,17 @@ declare class ActorHandleRaw {
|
|
|
1281
1307
|
type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect" | "send"> & {
|
|
1282
1308
|
connect(params?: unknown, options?: ActorConnectOptions): ActorConn<AD>;
|
|
1283
1309
|
resolve(): Promise<string>;
|
|
1284
|
-
} & ActorDefinitionQueueSend<AD> & ActorDefinitionActions<AD>;
|
|
1310
|
+
} & ActorDefinitionQueueSend<AD> & Omit<ActorDefinitionActions<AD>, keyof ActorHandleRaw>;
|
|
1311
|
+
|
|
1312
|
+
/** Called when RivetKit needs a credential. Keep issuer secrets on your backend. */
|
|
1313
|
+
type GetToken = (options: {
|
|
1314
|
+
forceRefresh: boolean;
|
|
1315
|
+
}) => Promise<string>;
|
|
1285
1316
|
|
|
1286
1317
|
declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
1287
1318
|
endpoint: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string, string | undefined>>;
|
|
1288
1319
|
token: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
|
|
1320
|
+
getToken: z$1.ZodOptional<z$1.ZodCustom<GetToken, GetToken>>;
|
|
1289
1321
|
namespace: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodString>, z$1.ZodTransform<string | undefined, string | undefined>>;
|
|
1290
1322
|
poolName: z$1.ZodDefault<z$1.ZodString>;
|
|
1291
1323
|
encoding: z$1.ZodDefault<z$1.ZodEnum<{
|
|
@@ -1314,6 +1346,7 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
1314
1346
|
disableMetadataLookup: boolean;
|
|
1315
1347
|
maxInputSize: number;
|
|
1316
1348
|
devtools: boolean;
|
|
1349
|
+
getToken?: GetToken | undefined;
|
|
1317
1350
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
1318
1351
|
}, {
|
|
1319
1352
|
endpoint: string;
|
|
@@ -1328,6 +1361,7 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
1328
1361
|
disableMetadataLookup: boolean;
|
|
1329
1362
|
maxInputSize: number;
|
|
1330
1363
|
devtools: boolean;
|
|
1364
|
+
getToken?: GetToken | undefined;
|
|
1331
1365
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
1332
1366
|
}>>;
|
|
1333
1367
|
type ClientConfigInput = z$1.input<typeof ClientConfigSchema>;
|
|
@@ -1492,6 +1526,10 @@ interface ActorClientRuntimeOptions {
|
|
|
1492
1526
|
*/
|
|
1493
1527
|
declare class ClientRaw {
|
|
1494
1528
|
#private;
|
|
1529
|
+
/** Issue namespace-scoped tokens with an explicit grant list. */
|
|
1530
|
+
readonly auth: {
|
|
1531
|
+
issueToken(options: IssueTokenOptions): Promise<IssuedToken>;
|
|
1532
|
+
};
|
|
1495
1533
|
[ACTOR_CONNS_SYMBOL]: Set<ActorConnRaw>;
|
|
1496
1534
|
/**
|
|
1497
1535
|
* Creates an instance of Client.
|
|
@@ -1552,9 +1590,9 @@ declare class ClientRaw {
|
|
|
1552
1590
|
*
|
|
1553
1591
|
* @template A The actor registry type.
|
|
1554
1592
|
*/
|
|
1555
|
-
type Client<A extends Registry<any>> = ClientRaw & {
|
|
1593
|
+
type Client<A extends Registry<any>> = ClientRaw & Omit<{
|
|
1556
1594
|
[K in keyof ExtractActorsFromRegistry<A>]: ActorAccessor<ExtractActorsFromRegistry<A>[K]>;
|
|
1557
|
-
}
|
|
1595
|
+
}, keyof ClientRaw>;
|
|
1558
1596
|
|
|
1559
1597
|
/** @experimental State exposed by a durable workflow run handler to the Inspector. */
|
|
1560
1598
|
type WorkflowState = "pending" | "running" | "sleeping" | "failed" | "completed" | "cancelled" | "rolling_back";
|
|
@@ -2284,7 +2322,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
2284
2322
|
endpoint: string | undefined;
|
|
2285
2323
|
startServices: boolean;
|
|
2286
2324
|
namespace: string;
|
|
2287
|
-
token: string;
|
|
2325
|
+
token: string | undefined;
|
|
2288
2326
|
publicEndpoint: string | undefined;
|
|
2289
2327
|
publicNamespace: string | undefined;
|
|
2290
2328
|
publicToken: string | undefined;
|
|
@@ -2541,4 +2579,4 @@ declare class Registry<A extends RegistryActors> {
|
|
|
2541
2579
|
*/
|
|
2542
2580
|
declare function createClient<A extends Registry<any>>(endpointOrConfig?: string | ClientConfigInput): Client<A>;
|
|
2543
2581
|
|
|
2544
|
-
export { type ActorAccessor, type ActorActionFunction, type ActorActionOptions, ActorClientError, type ActorConn, ActorConnDisposed, ActorConnRaw, type ActorConnStatus, type ActorConnectOptions, ActorDefinition, RivetError as ActorError, type ActorGatewayOptions, type ActorHandle, ActorHandleRaw, type AnyActorDefinition, type Client, type ClientConfigInput, ClientRaw, type ConnectionStateCallback, type CreateOptions, type CreateRequest, type Encoding, type EventUnsubscribe, type ExtractActorsFromRegistry, type ExtractRegistryFromClient, type GetOptions, type GetWithIdOptions, MalformedResponseMessage, ManagerError, type QueryOptions, type Region, RivetError, type StatusChangeCallback, UserError, createClient };
|
|
2582
|
+
export { type ActorAccessor, type ActorActionFunction, type ActorActionOptions, ActorClientError, type ActorConn, ActorConnDisposed, ActorConnRaw, type ActorConnStatus, type ActorConnectOptions, ActorDefinition, RivetError as ActorError, type ActorGatewayOptions, type ActorHandle, ActorHandleRaw, type ActorIssueTokenOptions, type ActorTokenPermissions, type ActorTokenResource, type AnyActorDefinition, type Client, type ClientConfigInput, ClientRaw, type ConnectionStateCallback, type CreateOptions, type CreateRequest, type Encoding, type EventUnsubscribe, type ExtractActorsFromRegistry, type ExtractRegistryFromClient, type GetOptions, type GetToken, type GetWithIdOptions, type IssueTokenOptions, type IssuedToken, MalformedResponseMessage, ManagerError, type QueryOptions, type Region, RivetError, type StatusChangeCallback, type TokenGrant, UserError, createClient };
|