@rivetkit/supabase 2.3.11 → 2.3.12-rc.2
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/mod.js +1128 -1088
- package/dist/mod.mjs +1128 -1088
- package/package.json +3 -3
package/dist/mod.mjs
CHANGED
|
@@ -297,186 +297,6 @@ var require_retry2 = __commonJS({
|
|
|
297
297
|
// src/mod.ts
|
|
298
298
|
import * as wasmBindings from "@rivetkit/rivetkit-wasm";
|
|
299
299
|
|
|
300
|
-
// ../rivetkit/dist/tsup/chunk-ZZ3WBRPD.js
|
|
301
|
-
var INTERNAL_ERROR_CODE = "internal_error";
|
|
302
|
-
var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
303
|
-
var USER_ERROR_CODE = "user_error";
|
|
304
|
-
var BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
305
|
-
function looksLikeRivetErrorOptions(value) {
|
|
306
|
-
return typeof value === "object" && value !== null && ("public" in value || "metadata" in value || "statusCode" in value || "actor" in value || "cause" in value);
|
|
307
|
-
}
|
|
308
|
-
function isTypedErrorTag(value) {
|
|
309
|
-
return value === "ActorError" || value === "RivetError";
|
|
310
|
-
}
|
|
311
|
-
function errorMessage(error46, fallback = String(error46)) {
|
|
312
|
-
if (error46 && typeof error46 === "object" && "message" in error46 && typeof error46.message === "string") {
|
|
313
|
-
return error46.message;
|
|
314
|
-
}
|
|
315
|
-
return fallback;
|
|
316
|
-
}
|
|
317
|
-
function isRivetErrorLike(error46) {
|
|
318
|
-
return typeof error46 === "object" && error46 !== null && "group" in error46 && typeof error46.group === "string" && "code" in error46 && typeof error46.code === "string" && "message" in error46 && typeof error46.message === "string" && (!("__type" in error46) || isTypedErrorTag(error46.__type));
|
|
319
|
-
}
|
|
320
|
-
function isActorAbortedError(error46) {
|
|
321
|
-
return isRivetErrorLike(error46) && error46.group === "actor" && error46.code === "aborted";
|
|
322
|
-
}
|
|
323
|
-
function isActorSpecifier(value) {
|
|
324
|
-
return typeof value === "object" && value !== null && "actorId" in value && typeof value.actorId === "string" && "generation" in value && typeof value.generation === "number" && (!("key" in value) || value.key === void 0 || typeof value.key === "string");
|
|
325
|
-
}
|
|
326
|
-
var RivetError = class extends Error {
|
|
327
|
-
__type = "RivetError";
|
|
328
|
-
public;
|
|
329
|
-
metadata;
|
|
330
|
-
statusCode;
|
|
331
|
-
actor;
|
|
332
|
-
group;
|
|
333
|
-
code;
|
|
334
|
-
static isRivetError(error46) {
|
|
335
|
-
return isRivetErrorLike(error46);
|
|
336
|
-
}
|
|
337
|
-
static isActorError(error46) {
|
|
338
|
-
return isRivetErrorLike(error46);
|
|
339
|
-
}
|
|
340
|
-
constructor(group, code, message, options) {
|
|
341
|
-
const normalized = looksLikeRivetErrorOptions(options) ? options : { metadata: options };
|
|
342
|
-
super(message, { cause: normalized.cause });
|
|
343
|
-
this.name = "RivetError";
|
|
344
|
-
this.group = group;
|
|
345
|
-
this.code = code;
|
|
346
|
-
this.public = normalized.public ?? false;
|
|
347
|
-
this.metadata = normalized.metadata;
|
|
348
|
-
this.statusCode = normalized.statusCode ?? (this.public ? 400 : 500);
|
|
349
|
-
this.actor = normalized.actor;
|
|
350
|
-
}
|
|
351
|
-
toString() {
|
|
352
|
-
return this.message;
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
var UserError = class extends RivetError {
|
|
356
|
-
constructor(message, options) {
|
|
357
|
-
super("user", (options == null ? void 0 : options.code) ?? USER_ERROR_CODE, message, {
|
|
358
|
-
public: true,
|
|
359
|
-
metadata: options == null ? void 0 : options.metadata,
|
|
360
|
-
cause: options == null ? void 0 : options.cause
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
function toRivetError(error46, fallback) {
|
|
365
|
-
if (typeof error46 === "string") {
|
|
366
|
-
const bridged = decodeBridgeRivetError(error46);
|
|
367
|
-
if (bridged) {
|
|
368
|
-
return bridged;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (error46 instanceof Error) {
|
|
372
|
-
const bridged = decodeBridgeRivetError(error46.message);
|
|
373
|
-
if (bridged) {
|
|
374
|
-
return bridged;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
if (isRivetErrorLike(error46)) {
|
|
378
|
-
return new RivetError(error46.group, error46.code, error46.message, {
|
|
379
|
-
public: error46.public,
|
|
380
|
-
statusCode: error46.statusCode,
|
|
381
|
-
metadata: error46.metadata,
|
|
382
|
-
actor: error46.actor,
|
|
383
|
-
cause: error46 instanceof Error ? error46.cause : void 0
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
return new RivetError(
|
|
387
|
-
(fallback == null ? void 0 : fallback.group) ?? "actor",
|
|
388
|
-
(fallback == null ? void 0 : fallback.code) ?? INTERNAL_ERROR_CODE,
|
|
389
|
-
errorMessage(error46, (fallback == null ? void 0 : fallback.message) ?? "Unknown error"),
|
|
390
|
-
{
|
|
391
|
-
public: fallback == null ? void 0 : fallback.public,
|
|
392
|
-
statusCode: fallback == null ? void 0 : fallback.statusCode,
|
|
393
|
-
metadata: fallback == null ? void 0 : fallback.metadata,
|
|
394
|
-
actor: fallback == null ? void 0 : fallback.actor,
|
|
395
|
-
cause: error46 instanceof Error ? error46 : void 0
|
|
396
|
-
}
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
function encodeBridgeRivetError(error46) {
|
|
400
|
-
return `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
|
|
401
|
-
group: error46.group,
|
|
402
|
-
code: error46.code,
|
|
403
|
-
message: error46.message,
|
|
404
|
-
metadata: error46.metadata,
|
|
405
|
-
public: error46.public,
|
|
406
|
-
statusCode: error46.statusCode,
|
|
407
|
-
actor: error46.actor
|
|
408
|
-
})}`;
|
|
409
|
-
}
|
|
410
|
-
function decodeBridgeRivetErrorPayload(value) {
|
|
411
|
-
if (!value.startsWith(BRIDGE_RIVET_ERROR_PREFIX)) {
|
|
412
|
-
return void 0;
|
|
413
|
-
}
|
|
414
|
-
try {
|
|
415
|
-
const payload = JSON.parse(
|
|
416
|
-
value.slice(BRIDGE_RIVET_ERROR_PREFIX.length)
|
|
417
|
-
);
|
|
418
|
-
if (!isRivetErrorLike(payload)) {
|
|
419
|
-
return void 0;
|
|
420
|
-
}
|
|
421
|
-
if (payload.actor !== void 0 && payload.actor !== null && !isActorSpecifier(payload.actor)) {
|
|
422
|
-
return void 0;
|
|
423
|
-
}
|
|
424
|
-
return payload;
|
|
425
|
-
} catch {
|
|
426
|
-
return void 0;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
function decodeBridgeRivetError(value) {
|
|
430
|
-
const payload = decodeBridgeRivetErrorPayload(value);
|
|
431
|
-
if (!payload) {
|
|
432
|
-
return void 0;
|
|
433
|
-
}
|
|
434
|
-
return new RivetError(payload.group, payload.code, payload.message, {
|
|
435
|
-
metadata: payload.metadata,
|
|
436
|
-
public: payload.public,
|
|
437
|
-
statusCode: payload.statusCode,
|
|
438
|
-
actor: payload.actor ?? void 0
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
function invalidRequest(error46) {
|
|
442
|
-
return new RivetError(
|
|
443
|
-
"request",
|
|
444
|
-
"invalid",
|
|
445
|
-
`Invalid request: ${errorMessage(error46, String(error46))}`,
|
|
446
|
-
{
|
|
447
|
-
public: true,
|
|
448
|
-
cause: error46 instanceof Error ? error46 : void 0
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
function actorNotFound(identifier) {
|
|
453
|
-
return new RivetError(
|
|
454
|
-
"actor",
|
|
455
|
-
"not_found",
|
|
456
|
-
identifier ? `Actor not found: ${identifier} (https://www.rivet.dev/docs/clients/javascript)` : "Actor not found (https://www.rivet.dev/docs/clients/javascript)",
|
|
457
|
-
{ public: true }
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
function forbiddenError() {
|
|
461
|
-
return new RivetError("auth", "forbidden", "Forbidden", {
|
|
462
|
-
public: true,
|
|
463
|
-
statusCode: 403
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
function unsupportedFeature(feature) {
|
|
467
|
-
return new RivetError(
|
|
468
|
-
"feature",
|
|
469
|
-
"unsupported",
|
|
470
|
-
`Unsupported feature: ${feature}`
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// ../rivetkit/dist/tsup/chunk-OUENKQHB.js
|
|
475
|
-
import {
|
|
476
|
-
pino,
|
|
477
|
-
stdTimeFunctions
|
|
478
|
-
} from "pino";
|
|
479
|
-
|
|
480
300
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/external.js
|
|
481
301
|
var external_exports = {};
|
|
482
302
|
__export(external_exports, {
|
|
@@ -13147,64 +12967,716 @@ var classic_default = external_exports;
|
|
|
13147
12967
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
|
|
13148
12968
|
var v4_default = classic_default;
|
|
13149
12969
|
|
|
13150
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
13156
|
-
var getRivetNamespace = () => getEnvUniversal("RIVET_NAMESPACE");
|
|
13157
|
-
var getRivetPool = () => getEnvUniversal("RIVET_POOL");
|
|
13158
|
-
var getRivetTotalSlots = () => {
|
|
13159
|
-
const value = getEnvUniversal("RIVET_TOTAL_SLOTS");
|
|
13160
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13161
|
-
};
|
|
13162
|
-
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
13163
|
-
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
13164
|
-
var getRivetRunEnginePort = () => {
|
|
13165
|
-
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
13166
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13167
|
-
};
|
|
13168
|
-
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
13169
|
-
var getRivetEnvoyVersion = () => {
|
|
13170
|
-
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
13171
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13172
|
-
};
|
|
13173
|
-
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
13174
|
-
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
13175
|
-
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
13176
|
-
var getRivetkitRuntimeMode = () => {
|
|
13177
|
-
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
13178
|
-
if (value === void 0) return "envoy";
|
|
13179
|
-
if (value === "envoy" || value === "serverless") return value;
|
|
13180
|
-
throw new Error(
|
|
13181
|
-
`RIVETKIT_RUNTIME_MODE env var must be "envoy" or "serverless"; got "${value}"`
|
|
13182
|
-
);
|
|
13183
|
-
};
|
|
13184
|
-
var getRivetkitPublicDir = () => {
|
|
13185
|
-
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
13186
|
-
return value === void 0 || value === "" ? void 0 : value;
|
|
13187
|
-
};
|
|
13188
|
-
function parsePortEnv(raw) {
|
|
13189
|
-
if (raw === void 0 || raw === "") return void 0;
|
|
13190
|
-
const parsed = Number.parseInt(raw, 10);
|
|
13191
|
-
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
13192
|
-
throw new Error(
|
|
13193
|
-
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
13194
|
-
);
|
|
12970
|
+
// ../rivetkit/dist/tsup/chunk-6W5VGLFT.js
|
|
12971
|
+
function flattenActionHandlers(actions) {
|
|
12972
|
+
const flattened = /* @__PURE__ */ Object.create(null);
|
|
12973
|
+
for (const { name, handler } of collectActionEntries(actions)) {
|
|
12974
|
+
flattened[name] = handler;
|
|
13195
12975
|
}
|
|
13196
|
-
return
|
|
12976
|
+
return flattened;
|
|
13197
12977
|
}
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
12978
|
+
function flattenActionInputSchemas(actions, schemas) {
|
|
12979
|
+
if (schemas === void 0) return void 0;
|
|
12980
|
+
if (!isRecord(schemas)) {
|
|
12981
|
+
throw new TypeError("actionInputSchemas must be an object");
|
|
12982
|
+
}
|
|
12983
|
+
const flattened = /* @__PURE__ */ Object.create(null);
|
|
12984
|
+
for (const { name, path: path2 } of collectActionEntries(actions)) {
|
|
12985
|
+
const nestedSchema = lookupNestedSchema(schemas, path2);
|
|
12986
|
+
const flatSchema = schemas[name];
|
|
12987
|
+
if (nestedSchema !== void 0 && flatSchema !== void 0 && nestedSchema !== flatSchema) {
|
|
12988
|
+
throw new TypeError(
|
|
12989
|
+
`Action input schema \`${name}\` is defined by both a nested path and a dotted key`
|
|
12990
|
+
);
|
|
12991
|
+
}
|
|
12992
|
+
const schema = nestedSchema ?? flatSchema;
|
|
12993
|
+
if (schema !== void 0) {
|
|
12994
|
+
flattened[name] = schema;
|
|
12995
|
+
}
|
|
12996
|
+
}
|
|
12997
|
+
return flattened;
|
|
12998
|
+
}
|
|
12999
|
+
function collectActionEntries(actions) {
|
|
13000
|
+
const entries = [];
|
|
13001
|
+
const names = /* @__PURE__ */ new Set();
|
|
13002
|
+
visitActionGroup(actions ?? {}, [], entries, names);
|
|
13003
|
+
return entries;
|
|
13004
|
+
}
|
|
13005
|
+
function visitActionGroup(value, path2, entries, names) {
|
|
13006
|
+
if (!isRecord(value)) {
|
|
13007
|
+
throw new TypeError(
|
|
13008
|
+
`${formatActionPath(path2)} must be an action handler or group`
|
|
13009
|
+
);
|
|
13010
|
+
}
|
|
13011
|
+
for (const [segment, child] of Object.entries(value)) {
|
|
13012
|
+
const childPath = [...path2, segment];
|
|
13013
|
+
if (typeof child === "function") {
|
|
13014
|
+
const name = childPath.join(".");
|
|
13015
|
+
if (names.has(name)) {
|
|
13016
|
+
throw new TypeError(
|
|
13017
|
+
`Multiple action definitions flatten to \`${name}\``
|
|
13018
|
+
);
|
|
13019
|
+
}
|
|
13020
|
+
names.add(name);
|
|
13021
|
+
entries.push({
|
|
13022
|
+
name,
|
|
13023
|
+
path: childPath,
|
|
13024
|
+
handler: child
|
|
13025
|
+
});
|
|
13026
|
+
} else {
|
|
13027
|
+
visitActionGroup(child, childPath, entries, names);
|
|
13028
|
+
}
|
|
13029
|
+
}
|
|
13030
|
+
}
|
|
13031
|
+
function lookupNestedSchema(schemas, path2) {
|
|
13032
|
+
let value = schemas;
|
|
13033
|
+
for (const segment of path2) {
|
|
13034
|
+
if (!isRecord(value) || !Object.hasOwn(value, segment)) {
|
|
13035
|
+
return void 0;
|
|
13036
|
+
}
|
|
13037
|
+
value = value[segment];
|
|
13038
|
+
}
|
|
13039
|
+
return value;
|
|
13040
|
+
}
|
|
13041
|
+
function isRecord(value) {
|
|
13042
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13043
|
+
return false;
|
|
13044
|
+
}
|
|
13045
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13046
|
+
return prototype === Object.prototype || prototype === null;
|
|
13047
|
+
}
|
|
13048
|
+
function formatActionPath(path2) {
|
|
13049
|
+
return path2.length === 0 ? "actions" : `Action \`${path2.join(".")}\``;
|
|
13050
|
+
}
|
|
13051
|
+
var DEFAULT_SLEEP_GRACE_PERIOD = 15e3;
|
|
13052
|
+
var ACTOR_CONTEXT_INTERNAL_SYMBOL = /* @__PURE__ */ Symbol(
|
|
13053
|
+
"rivetkit.actor_context_internal"
|
|
13054
|
+
);
|
|
13055
|
+
var RAW_STATE_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.raw_state");
|
|
13056
|
+
var CONN_STATE_MANAGER_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.conn_state_manager");
|
|
13057
|
+
var zFunction = () => external_exports.custom((val) => typeof val === "function");
|
|
13058
|
+
var zActionTree = external_exports.custom((value) => {
|
|
13059
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13060
|
+
return false;
|
|
13061
|
+
}
|
|
13062
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13063
|
+
return prototype === Object.prototype || prototype === null;
|
|
13064
|
+
}).superRefine((actions, ctx) => {
|
|
13065
|
+
try {
|
|
13066
|
+
flattenActionHandlers(actions);
|
|
13067
|
+
} catch (error46) {
|
|
13068
|
+
ctx.addIssue({
|
|
13069
|
+
code: "custom",
|
|
13070
|
+
message: error46 instanceof Error ? error46.message : "Invalid action definition"
|
|
13071
|
+
});
|
|
13072
|
+
}
|
|
13073
|
+
});
|
|
13074
|
+
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
13075
|
+
getHistory: zFunction(),
|
|
13076
|
+
getState: zFunction().optional(),
|
|
13077
|
+
onHistoryUpdated: zFunction().optional(),
|
|
13078
|
+
replayFromStep: zFunction().optional()
|
|
13079
|
+
});
|
|
13080
|
+
var RunInspectorConfigSchema = external_exports.object({
|
|
13081
|
+
workflow: WorkflowInspectorConfigSchema.optional()
|
|
13082
|
+
}).optional();
|
|
13083
|
+
var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
13084
|
+
"workflow",
|
|
13085
|
+
"database",
|
|
13086
|
+
"state",
|
|
13087
|
+
"queue",
|
|
13088
|
+
"schedules",
|
|
13089
|
+
"connections",
|
|
13090
|
+
"console"
|
|
13091
|
+
];
|
|
13092
|
+
var BuiltinInspectorTabIdSchema = external_exports.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
13093
|
+
var CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
13094
|
+
var CustomInspectorTabEntrySchema = external_exports.object({
|
|
13095
|
+
id: external_exports.string().regex(
|
|
13096
|
+
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
13097
|
+
"inspector.tabs[].id must contain only letters, digits, underscore, or dash"
|
|
13098
|
+
),
|
|
13099
|
+
label: external_exports.string().min(1),
|
|
13100
|
+
source: external_exports.string().min(1),
|
|
13101
|
+
/**
|
|
13102
|
+
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
13103
|
+
* icon registry); unknown ids fall back to a generic icon.
|
|
13104
|
+
*/
|
|
13105
|
+
icon: external_exports.string().min(1).optional(),
|
|
13106
|
+
hidden: external_exports.literal(false).optional()
|
|
13107
|
+
}).strict();
|
|
13108
|
+
var HideInspectorTabEntrySchema = external_exports.object({
|
|
13109
|
+
id: BuiltinInspectorTabIdSchema,
|
|
13110
|
+
hidden: external_exports.literal(true)
|
|
13111
|
+
}).strict();
|
|
13112
|
+
var InspectorTabEntrySchema = external_exports.union([
|
|
13113
|
+
CustomInspectorTabEntrySchema,
|
|
13114
|
+
HideInspectorTabEntrySchema
|
|
13115
|
+
]);
|
|
13116
|
+
var ActorInspectorConfigSchema = external_exports.object({
|
|
13117
|
+
tabs: external_exports.array(InspectorTabEntrySchema).default(() => [])
|
|
13118
|
+
}).strict().refine(
|
|
13119
|
+
(data) => {
|
|
13120
|
+
const ids = data.tabs.map((t) => t.id);
|
|
13121
|
+
return new Set(ids).size === ids.length;
|
|
13122
|
+
},
|
|
13123
|
+
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] }
|
|
13124
|
+
).refine(
|
|
13125
|
+
(data) => {
|
|
13126
|
+
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
13127
|
+
return data.tabs.every(
|
|
13128
|
+
(t) => t.hidden === true || !builtinSet.has(t.id)
|
|
13129
|
+
);
|
|
13130
|
+
},
|
|
13131
|
+
{
|
|
13132
|
+
message: "Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
13133
|
+
path: ["tabs"]
|
|
13134
|
+
}
|
|
13135
|
+
);
|
|
13136
|
+
var RunConfigSchema = external_exports.object({
|
|
13137
|
+
/** Display name for the actor in the Inspector UI. */
|
|
13138
|
+
name: external_exports.string().optional(),
|
|
13139
|
+
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
13140
|
+
icon: external_exports.string().optional(),
|
|
13141
|
+
/** The run handler function. */
|
|
13142
|
+
run: zFunction(),
|
|
13143
|
+
/** Inspector integration for long-running run handlers. */
|
|
13144
|
+
inspector: RunInspectorConfigSchema.optional()
|
|
13145
|
+
});
|
|
13146
|
+
var RUN_FUNCTION_CONFIG_SYMBOL = /* @__PURE__ */ Symbol.for("rivetkit.run_function_config");
|
|
13147
|
+
function defineRunHandler(run, options) {
|
|
13148
|
+
if (options.inspectorKind === void 0 !== (options.createInspector === void 0)) {
|
|
13149
|
+
throw new TypeError(
|
|
13150
|
+
"defineRunHandler requires inspectorKind and createInspector together"
|
|
13151
|
+
);
|
|
13152
|
+
}
|
|
13153
|
+
Object.defineProperty(run, RUN_FUNCTION_CONFIG_SYMBOL, {
|
|
13154
|
+
configurable: false,
|
|
13155
|
+
enumerable: false,
|
|
13156
|
+
writable: false,
|
|
13157
|
+
value: {
|
|
13158
|
+
name: options.name,
|
|
13159
|
+
icon: options.icon,
|
|
13160
|
+
inspectorKind: options.inspectorKind,
|
|
13161
|
+
createInspector: options.createInspector
|
|
13162
|
+
}
|
|
13163
|
+
});
|
|
13164
|
+
return run;
|
|
13165
|
+
}
|
|
13166
|
+
function getRunInspectorKind(run) {
|
|
13167
|
+
var _a2;
|
|
13168
|
+
if (!run || typeof run !== "function") return void 0;
|
|
13169
|
+
return (_a2 = run[RUN_FUNCTION_CONFIG_SYMBOL]) == null ? void 0 : _a2.inspectorKind;
|
|
13170
|
+
}
|
|
13171
|
+
function createRunInspector(run, context) {
|
|
13172
|
+
var _a2, _b;
|
|
13173
|
+
if (!run || typeof run !== "function") return void 0;
|
|
13174
|
+
return (_b = (_a2 = run[RUN_FUNCTION_CONFIG_SYMBOL]) == null ? void 0 : _a2.createInspector) == null ? void 0 : _b.call(_a2, context);
|
|
13175
|
+
}
|
|
13176
|
+
var zRunHandler = external_exports.union([zFunction(), RunConfigSchema]).optional();
|
|
13177
|
+
function getRunFunction(run) {
|
|
13178
|
+
if (!run) return void 0;
|
|
13179
|
+
if (typeof run === "function") return run;
|
|
13180
|
+
return run.run;
|
|
13181
|
+
}
|
|
13182
|
+
function getRunMetadata(run) {
|
|
13183
|
+
if (!run) return {};
|
|
13184
|
+
if (typeof run === "function") {
|
|
13185
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13186
|
+
if (!config3) return {};
|
|
13187
|
+
return { name: config3.name, icon: config3.icon };
|
|
13188
|
+
}
|
|
13189
|
+
return { name: run.name, icon: run.icon };
|
|
13190
|
+
}
|
|
13191
|
+
function getRunInspectorConfig(run, actor2) {
|
|
13192
|
+
if (!run) return void 0;
|
|
13193
|
+
if (typeof run === "function") {
|
|
13194
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13195
|
+
return (config3 == null ? void 0 : config3.inspectorFactory) ? config3.inspectorFactory(actor2) : config3 == null ? void 0 : config3.inspector;
|
|
13196
|
+
}
|
|
13197
|
+
return run.inspector;
|
|
13198
|
+
}
|
|
13199
|
+
function hasRunInspectorConfig(run) {
|
|
13200
|
+
if (!run) return false;
|
|
13201
|
+
if (typeof run !== "function") return run.inspector !== void 0;
|
|
13202
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13203
|
+
return (config3 == null ? void 0 : config3.inspectorKind) !== void 0 || (config3 == null ? void 0 : config3.createInspector) !== void 0 || (config3 == null ? void 0 : config3.inspector) !== void 0 || (config3 == null ? void 0 : config3.inspectorFactory) !== void 0;
|
|
13204
|
+
}
|
|
13205
|
+
function disposeRunInspector(run, actorId) {
|
|
13206
|
+
var _a2;
|
|
13207
|
+
if (!run || typeof run !== "function") {
|
|
13208
|
+
return;
|
|
13209
|
+
}
|
|
13210
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13211
|
+
(_a2 = config3 == null ? void 0 : config3.disposeInspector) == null ? void 0 : _a2.call(config3, actorId);
|
|
13212
|
+
}
|
|
13213
|
+
var GlobalActorOptionsBaseSchema = external_exports.object({
|
|
13214
|
+
/** Display name for the actor in the Inspector UI. */
|
|
13215
|
+
name: external_exports.string().optional(),
|
|
13216
|
+
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
13217
|
+
icon: external_exports.string().optional(),
|
|
13218
|
+
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
13219
|
+
enableActorRuntimeSocket: external_exports.boolean().default(false),
|
|
13220
|
+
/**
|
|
13221
|
+
* Can hibernate WebSockets for onWebSocket.
|
|
13222
|
+
*
|
|
13223
|
+
* WebSockets using actions/events are hibernatable by default.
|
|
13224
|
+
*
|
|
13225
|
+
* @experimental
|
|
13226
|
+
**/
|
|
13227
|
+
canHibernateWebSocket: external_exports.union([external_exports.boolean(), zFunction()]).default(false)
|
|
13228
|
+
}).strict();
|
|
13229
|
+
var GlobalActorOptionsSchema = GlobalActorOptionsBaseSchema.prefault(
|
|
13230
|
+
() => ({})
|
|
13231
|
+
);
|
|
13232
|
+
var InstanceActorOptionsBaseSchema = external_exports.object({
|
|
13233
|
+
createVarsTimeout: external_exports.number().positive().default(5e3),
|
|
13234
|
+
createConnStateTimeout: external_exports.number().positive().default(5e3),
|
|
13235
|
+
onBeforeConnectTimeout: external_exports.number().positive().default(5e3),
|
|
13236
|
+
onConnectTimeout: external_exports.number().positive().default(5e3),
|
|
13237
|
+
onMigrateTimeout: external_exports.number().positive().default(3e4),
|
|
13238
|
+
sleepGracePeriod: external_exports.number().positive().default(DEFAULT_SLEEP_GRACE_PERIOD),
|
|
13239
|
+
/** @deprecated `onDestroyTimeout` is folded into `sleepGracePeriod`, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0. */
|
|
13240
|
+
onDestroyTimeout: external_exports.number().positive().optional(),
|
|
13241
|
+
/** @deprecated `waitUntilTimeout` is folded into `sleepGracePeriod`, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0. */
|
|
13242
|
+
waitUntilTimeout: external_exports.number().positive().optional(),
|
|
13243
|
+
stateSaveInterval: external_exports.number().positive().default(1e3),
|
|
13244
|
+
actionTimeout: external_exports.number().positive().default(6e4),
|
|
13245
|
+
connectionLivenessTimeout: external_exports.number().positive().default(2500),
|
|
13246
|
+
connectionLivenessInterval: external_exports.number().positive().default(5e3),
|
|
13247
|
+
/** @deprecated Use `c.keepAwake(promise)` to scope keep-awake to a specific operation, or keep `noSleep` for actors that must stay awake indefinitely. Will be removed in 2.2.0. */
|
|
13248
|
+
noSleep: external_exports.boolean().default(false),
|
|
13249
|
+
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
13250
|
+
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
13251
|
+
/** Maximum pending one-shot and recurring schedules. */
|
|
13252
|
+
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
13253
|
+
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
13254
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
13255
|
+
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
13256
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
13257
|
+
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
13258
|
+
}).strict();
|
|
13259
|
+
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
13260
|
+
var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
13261
|
+
InstanceActorOptionsBaseSchema.shape
|
|
13262
|
+
).strict().prefault(() => ({}));
|
|
13263
|
+
var ActorConfigSchema = external_exports.object({
|
|
13264
|
+
onCreate: zFunction().optional(),
|
|
13265
|
+
onDestroy: zFunction().optional(),
|
|
13266
|
+
onMigrate: zFunction().optional(),
|
|
13267
|
+
onWake: zFunction().optional(),
|
|
13268
|
+
onSleep: zFunction().optional(),
|
|
13269
|
+
run: zRunHandler,
|
|
13270
|
+
onStateChange: zFunction().optional(),
|
|
13271
|
+
onBeforeConnect: zFunction().optional(),
|
|
13272
|
+
onConnect: zFunction().optional(),
|
|
13273
|
+
onDisconnect: zFunction().optional(),
|
|
13274
|
+
onBeforeActionResponse: zFunction().optional(),
|
|
13275
|
+
onRequest: zFunction().optional(),
|
|
13276
|
+
onWebSocket: zFunction().optional(),
|
|
13277
|
+
actions: zActionTree.default(() => ({})),
|
|
13278
|
+
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13279
|
+
connParamsSchema: external_exports.any().optional(),
|
|
13280
|
+
events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13281
|
+
queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13282
|
+
state: external_exports.any().optional(),
|
|
13283
|
+
createState: zFunction().optional(),
|
|
13284
|
+
connState: external_exports.any().optional(),
|
|
13285
|
+
createConnState: zFunction().optional(),
|
|
13286
|
+
vars: external_exports.any().optional(),
|
|
13287
|
+
db: external_exports.any().optional(),
|
|
13288
|
+
createVars: zFunction().optional(),
|
|
13289
|
+
options: ActorOptionsSchema,
|
|
13290
|
+
inspector: ActorInspectorConfigSchema.optional()
|
|
13291
|
+
}).strict().refine(
|
|
13292
|
+
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
13293
|
+
{
|
|
13294
|
+
message: "Cannot define both 'state' and 'createState'",
|
|
13295
|
+
path: ["state"]
|
|
13296
|
+
}
|
|
13297
|
+
).refine(
|
|
13298
|
+
(data) => !(data.connState !== void 0 && data.createConnState !== void 0),
|
|
13299
|
+
{
|
|
13300
|
+
message: "Cannot define both 'connState' and 'createConnState'",
|
|
13301
|
+
path: ["connState"]
|
|
13302
|
+
}
|
|
13303
|
+
).refine(
|
|
13304
|
+
(data) => !(data.vars !== void 0 && data.createVars !== void 0),
|
|
13305
|
+
{
|
|
13306
|
+
message: "Cannot define both 'vars' and 'createVars'",
|
|
13307
|
+
path: ["vars"]
|
|
13308
|
+
}
|
|
13309
|
+
);
|
|
13310
|
+
var DocActorOptionsSchema = external_exports.object({
|
|
13311
|
+
name: external_exports.string().optional().describe("Display name for the actor in the Inspector UI."),
|
|
13312
|
+
icon: external_exports.string().optional().describe(
|
|
13313
|
+
"Icon for the actor in the Inspector UI. Can be an emoji (e.g., '\u{1F680}') or FontAwesome icon name (e.g., 'rocket')."
|
|
13314
|
+
),
|
|
13315
|
+
enableActorRuntimeSocket: external_exports.boolean().optional().describe(
|
|
13316
|
+
"Enables the experimental Actor Runtime Socket for this actor. Default: false"
|
|
13317
|
+
),
|
|
13318
|
+
createVarsTimeout: external_exports.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
13319
|
+
createConnStateTimeout: external_exports.number().optional().describe(
|
|
13320
|
+
"Timeout in ms for createConnState handler. Default: 5000"
|
|
13321
|
+
),
|
|
13322
|
+
onMigrateTimeout: external_exports.number().optional().describe("Timeout in ms for onMigrate handler. Default: 30000"),
|
|
13323
|
+
onBeforeConnectTimeout: external_exports.number().optional().describe(
|
|
13324
|
+
"Timeout in ms for onBeforeConnect handler. Default: 5000"
|
|
13325
|
+
),
|
|
13326
|
+
onConnectTimeout: external_exports.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
13327
|
+
sleepGracePeriod: external_exports.number().optional().describe(
|
|
13328
|
+
`Max time in ms for the graceful shutdown window. Covers lifecycle hooks (onSleep, onDestroy), the run handler wait, async raw WebSocket handlers, disconnect callbacks, and final state serialization. Default: ${DEFAULT_SLEEP_GRACE_PERIOD}.`
|
|
13329
|
+
),
|
|
13330
|
+
onDestroyTimeout: external_exports.number().optional().describe(
|
|
13331
|
+
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
13332
|
+
),
|
|
13333
|
+
waitUntilTimeout: external_exports.number().optional().describe(
|
|
13334
|
+
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
13335
|
+
),
|
|
13336
|
+
stateSaveInterval: external_exports.number().optional().describe(
|
|
13337
|
+
"Interval in ms between automatic state saves. Default: 1000"
|
|
13338
|
+
),
|
|
13339
|
+
actionTimeout: external_exports.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
13340
|
+
connectionLivenessTimeout: external_exports.number().optional().describe(
|
|
13341
|
+
"Timeout in ms for connection liveness checks. Default: 2500"
|
|
13342
|
+
),
|
|
13343
|
+
connectionLivenessInterval: external_exports.number().optional().describe(
|
|
13344
|
+
"Interval in ms between connection liveness checks. Default: 5000"
|
|
13345
|
+
),
|
|
13346
|
+
noSleep: external_exports.boolean().optional().describe(
|
|
13347
|
+
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false"
|
|
13348
|
+
),
|
|
13349
|
+
sleepTimeout: external_exports.number().optional().describe(
|
|
13350
|
+
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
13351
|
+
),
|
|
13352
|
+
maxQueueSize: external_exports.number().optional().describe(
|
|
13353
|
+
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
13354
|
+
),
|
|
13355
|
+
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
13356
|
+
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
13357
|
+
),
|
|
13358
|
+
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
13359
|
+
"Maximum size of each queue message in bytes. Default: 65536"
|
|
13360
|
+
),
|
|
13361
|
+
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
13362
|
+
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
13363
|
+
)
|
|
13364
|
+
}).describe("Actor options for timeouts and behavior configuration.");
|
|
13365
|
+
var DocActorConfigSchema = external_exports.object({
|
|
13366
|
+
state: external_exports.unknown().optional().describe(
|
|
13367
|
+
"Initial state value for the actor. Cannot be used with createState."
|
|
13368
|
+
),
|
|
13369
|
+
createState: external_exports.unknown().optional().describe(
|
|
13370
|
+
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
13371
|
+
),
|
|
13372
|
+
connState: external_exports.unknown().optional().describe(
|
|
13373
|
+
"Initial connection state value. Cannot be used with createConnState."
|
|
13374
|
+
),
|
|
13375
|
+
createConnState: external_exports.unknown().optional().describe(
|
|
13376
|
+
"Function to create connection state. Receives context and connection params. The pending connection is not visible in c.conns until this succeeds. Cannot be used with connState."
|
|
13377
|
+
),
|
|
13378
|
+
vars: external_exports.unknown().optional().describe(
|
|
13379
|
+
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
13380
|
+
),
|
|
13381
|
+
createVars: external_exports.unknown().optional().describe(
|
|
13382
|
+
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
13383
|
+
),
|
|
13384
|
+
db: external_exports.unknown().optional().describe("Database provider instance for the actor."),
|
|
13385
|
+
onCreate: external_exports.unknown().optional().describe(
|
|
13386
|
+
"Called when the actor is first initialized. Use to initialize state."
|
|
13387
|
+
),
|
|
13388
|
+
onDestroy: external_exports.unknown().optional().describe("Called when the actor is destroyed."),
|
|
13389
|
+
onMigrate: external_exports.unknown().optional().describe(
|
|
13390
|
+
"Called on every actor start after persisted state loads and before onWake. Use for repeatable schema migrations."
|
|
13391
|
+
),
|
|
13392
|
+
onWake: external_exports.unknown().optional().describe(
|
|
13393
|
+
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
13394
|
+
),
|
|
13395
|
+
onSleep: external_exports.unknown().optional().describe(
|
|
13396
|
+
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
13397
|
+
),
|
|
13398
|
+
run: external_exports.unknown().optional().describe(
|
|
13399
|
+
"Called after actor starts. Does not block startup. Use for background tasks like queue processing or tick loops. If it exits, the actor follows the normal idle sleep timeout once idle. If it throws, the actor logs the error and then follows the normal idle sleep timeout once idle."
|
|
13400
|
+
),
|
|
13401
|
+
onStateChange: external_exports.unknown().optional().describe(
|
|
13402
|
+
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
13403
|
+
),
|
|
13404
|
+
onBeforeConnect: external_exports.unknown().optional().describe(
|
|
13405
|
+
"Called before a client connects. Throw an error to reject the connection. The pending connection is not visible in c.conns while this runs."
|
|
13406
|
+
),
|
|
13407
|
+
onConnect: external_exports.unknown().optional().describe(
|
|
13408
|
+
"Called when a client successfully connects. The connection is visible in c.conns before this runs."
|
|
13409
|
+
),
|
|
13410
|
+
onDisconnect: external_exports.unknown().optional().describe("Called when a client disconnects."),
|
|
13411
|
+
onBeforeActionResponse: external_exports.unknown().optional().describe(
|
|
13412
|
+
"Called before sending an action response. Use to transform output."
|
|
13413
|
+
),
|
|
13414
|
+
onRequest: external_exports.unknown().optional().describe(
|
|
13415
|
+
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
13416
|
+
),
|
|
13417
|
+
onWebSocket: external_exports.unknown().optional().describe(
|
|
13418
|
+
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
13419
|
+
),
|
|
13420
|
+
actions: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
13421
|
+
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object."
|
|
13422
|
+
),
|
|
13423
|
+
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
13424
|
+
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
|
|
13425
|
+
),
|
|
13426
|
+
connParamsSchema: external_exports.unknown().optional().describe(
|
|
13427
|
+
"Optional schema for validating connection params in native runtimes."
|
|
13428
|
+
),
|
|
13429
|
+
events: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of event names to schemas."),
|
|
13430
|
+
queues: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of queue names to schemas."),
|
|
13431
|
+
options: DocActorOptionsSchema.optional()
|
|
13432
|
+
}).describe("Actor configuration passed to the actor() function.");
|
|
13433
|
+
|
|
13434
|
+
// ../rivetkit/dist/tsup/chunk-IXBD7BXC.js
|
|
13435
|
+
var INTERNAL_ERROR_CODE = "internal_error";
|
|
13436
|
+
var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
13437
|
+
var USER_ERROR_CODE = "user_error";
|
|
13438
|
+
var BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
13439
|
+
function looksLikeRivetErrorOptions(value) {
|
|
13440
|
+
return typeof value === "object" && value !== null && ("public" in value || "metadata" in value || "rayId" in value || "statusCode" in value || "actor" in value || "cause" in value);
|
|
13441
|
+
}
|
|
13442
|
+
function isTypedErrorTag(value) {
|
|
13443
|
+
return value === "ActorError" || value === "RivetError";
|
|
13444
|
+
}
|
|
13445
|
+
function errorMessage(error46, fallback = String(error46)) {
|
|
13446
|
+
if (error46 && typeof error46 === "object" && "message" in error46 && typeof error46.message === "string") {
|
|
13447
|
+
return error46.message;
|
|
13448
|
+
}
|
|
13449
|
+
return fallback;
|
|
13450
|
+
}
|
|
13451
|
+
function isRivetErrorLike(error46) {
|
|
13452
|
+
return typeof error46 === "object" && error46 !== null && "group" in error46 && typeof error46.group === "string" && "code" in error46 && typeof error46.code === "string" && "message" in error46 && typeof error46.message === "string" && (!("rayId" in error46) || error46.rayId === void 0 || typeof error46.rayId === "string") && (!("__type" in error46) || isTypedErrorTag(error46.__type));
|
|
13453
|
+
}
|
|
13454
|
+
function isActorAbortedError(error46) {
|
|
13455
|
+
return isRivetErrorLike(error46) && error46.group === "actor" && error46.code === "aborted";
|
|
13456
|
+
}
|
|
13457
|
+
function isActorSpecifier(value) {
|
|
13458
|
+
return typeof value === "object" && value !== null && "actorId" in value && typeof value.actorId === "string" && "generation" in value && typeof value.generation === "number" && (!("key" in value) || value.key === void 0 || typeof value.key === "string");
|
|
13459
|
+
}
|
|
13460
|
+
var RivetError = class extends Error {
|
|
13461
|
+
__type = "RivetError";
|
|
13462
|
+
public;
|
|
13463
|
+
metadata;
|
|
13464
|
+
rayId;
|
|
13465
|
+
statusCode;
|
|
13466
|
+
actor;
|
|
13467
|
+
group;
|
|
13468
|
+
code;
|
|
13469
|
+
static isRivetError(error46) {
|
|
13470
|
+
return isRivetErrorLike(error46);
|
|
13471
|
+
}
|
|
13472
|
+
static isActorError(error46) {
|
|
13473
|
+
return isRivetErrorLike(error46);
|
|
13474
|
+
}
|
|
13475
|
+
constructor(group, code, message, options) {
|
|
13476
|
+
const normalized = looksLikeRivetErrorOptions(options) ? options : { metadata: options };
|
|
13477
|
+
super(message, { cause: normalized.cause });
|
|
13478
|
+
this.name = "RivetError";
|
|
13479
|
+
this.group = group;
|
|
13480
|
+
this.code = code;
|
|
13481
|
+
this.public = normalized.public ?? false;
|
|
13482
|
+
this.metadata = normalized.metadata;
|
|
13483
|
+
this.rayId = normalized.rayId ?? void 0;
|
|
13484
|
+
this.statusCode = normalized.statusCode ?? (this.public ? 400 : 500);
|
|
13485
|
+
this.actor = normalized.actor;
|
|
13486
|
+
}
|
|
13487
|
+
toString() {
|
|
13488
|
+
return this.message;
|
|
13489
|
+
}
|
|
13490
|
+
};
|
|
13491
|
+
var UserError = class extends RivetError {
|
|
13492
|
+
constructor(message, options) {
|
|
13493
|
+
super("user", (options == null ? void 0 : options.code) ?? USER_ERROR_CODE, message, {
|
|
13494
|
+
public: true,
|
|
13495
|
+
metadata: options == null ? void 0 : options.metadata,
|
|
13496
|
+
cause: options == null ? void 0 : options.cause
|
|
13497
|
+
});
|
|
13498
|
+
}
|
|
13499
|
+
};
|
|
13500
|
+
function toRivetError(error46, fallback) {
|
|
13501
|
+
if (typeof error46 === "string") {
|
|
13502
|
+
const bridged = decodeBridgeRivetError(error46);
|
|
13503
|
+
if (bridged) {
|
|
13504
|
+
return bridged;
|
|
13505
|
+
}
|
|
13506
|
+
}
|
|
13507
|
+
if (error46 instanceof Error) {
|
|
13508
|
+
const bridged = decodeBridgeRivetError(error46.message);
|
|
13509
|
+
if (bridged) {
|
|
13510
|
+
return bridged;
|
|
13511
|
+
}
|
|
13512
|
+
}
|
|
13513
|
+
if (isRivetErrorLike(error46)) {
|
|
13514
|
+
return new RivetError(error46.group, error46.code, error46.message, {
|
|
13515
|
+
public: error46.public,
|
|
13516
|
+
statusCode: error46.statusCode,
|
|
13517
|
+
metadata: error46.metadata,
|
|
13518
|
+
rayId: error46.rayId,
|
|
13519
|
+
actor: error46.actor,
|
|
13520
|
+
cause: error46 instanceof Error ? error46.cause : void 0
|
|
13521
|
+
});
|
|
13522
|
+
}
|
|
13523
|
+
return new RivetError(
|
|
13524
|
+
(fallback == null ? void 0 : fallback.group) ?? "actor",
|
|
13525
|
+
(fallback == null ? void 0 : fallback.code) ?? INTERNAL_ERROR_CODE,
|
|
13526
|
+
errorMessage(error46, (fallback == null ? void 0 : fallback.message) ?? "Unknown error"),
|
|
13527
|
+
{
|
|
13528
|
+
public: fallback == null ? void 0 : fallback.public,
|
|
13529
|
+
statusCode: fallback == null ? void 0 : fallback.statusCode,
|
|
13530
|
+
metadata: fallback == null ? void 0 : fallback.metadata,
|
|
13531
|
+
rayId: fallback == null ? void 0 : fallback.rayId,
|
|
13532
|
+
actor: fallback == null ? void 0 : fallback.actor,
|
|
13533
|
+
cause: error46 instanceof Error ? error46 : void 0
|
|
13534
|
+
}
|
|
13535
|
+
);
|
|
13536
|
+
}
|
|
13537
|
+
function encodeBridgeRivetError(error46) {
|
|
13538
|
+
return `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
|
|
13539
|
+
group: error46.group,
|
|
13540
|
+
code: error46.code,
|
|
13541
|
+
message: error46.message,
|
|
13542
|
+
metadata: error46.metadata,
|
|
13543
|
+
rayId: error46.rayId,
|
|
13544
|
+
public: error46.public,
|
|
13545
|
+
statusCode: error46.statusCode,
|
|
13546
|
+
actor: error46.actor
|
|
13547
|
+
})}`;
|
|
13548
|
+
}
|
|
13549
|
+
function decodeBridgeRivetErrorPayload(value) {
|
|
13550
|
+
if (!value.startsWith(BRIDGE_RIVET_ERROR_PREFIX)) {
|
|
13551
|
+
return void 0;
|
|
13552
|
+
}
|
|
13553
|
+
try {
|
|
13554
|
+
const raw = JSON.parse(
|
|
13555
|
+
value.slice(BRIDGE_RIVET_ERROR_PREFIX.length)
|
|
13556
|
+
);
|
|
13557
|
+
const payload = {
|
|
13558
|
+
...raw,
|
|
13559
|
+
rayId: raw.rayId ?? void 0
|
|
13560
|
+
};
|
|
13561
|
+
if (!isRivetErrorLike(payload)) {
|
|
13562
|
+
return void 0;
|
|
13563
|
+
}
|
|
13564
|
+
if (payload.actor !== void 0 && payload.actor !== null && !isActorSpecifier(payload.actor)) {
|
|
13565
|
+
return void 0;
|
|
13566
|
+
}
|
|
13567
|
+
return payload;
|
|
13568
|
+
} catch {
|
|
13569
|
+
return void 0;
|
|
13570
|
+
}
|
|
13571
|
+
}
|
|
13572
|
+
function decodeBridgeRivetError(value) {
|
|
13573
|
+
const payload = decodeBridgeRivetErrorPayload(value);
|
|
13574
|
+
if (!payload) {
|
|
13575
|
+
return void 0;
|
|
13576
|
+
}
|
|
13577
|
+
return new RivetError(payload.group, payload.code, payload.message, {
|
|
13578
|
+
metadata: payload.metadata,
|
|
13579
|
+
rayId: payload.rayId,
|
|
13580
|
+
public: payload.public,
|
|
13581
|
+
statusCode: payload.statusCode,
|
|
13582
|
+
actor: payload.actor ?? void 0
|
|
13583
|
+
});
|
|
13584
|
+
}
|
|
13585
|
+
function invalidRequest(error46) {
|
|
13586
|
+
return new RivetError(
|
|
13587
|
+
"request",
|
|
13588
|
+
"invalid",
|
|
13589
|
+
`Invalid request: ${errorMessage(error46, String(error46))}`,
|
|
13590
|
+
{
|
|
13591
|
+
public: true,
|
|
13592
|
+
cause: error46 instanceof Error ? error46 : void 0
|
|
13593
|
+
}
|
|
13594
|
+
);
|
|
13595
|
+
}
|
|
13596
|
+
function actorNotFound(identifier) {
|
|
13597
|
+
return new RivetError(
|
|
13598
|
+
"actor",
|
|
13599
|
+
"not_found",
|
|
13600
|
+
identifier ? `Actor not found: ${identifier} (https://www.rivet.dev/docs/clients/javascript)` : "Actor not found (https://www.rivet.dev/docs/clients/javascript)",
|
|
13601
|
+
{ public: true }
|
|
13602
|
+
);
|
|
13603
|
+
}
|
|
13604
|
+
function forbiddenError() {
|
|
13605
|
+
return new RivetError("auth", "forbidden", "Forbidden", {
|
|
13606
|
+
public: true,
|
|
13607
|
+
statusCode: 403
|
|
13608
|
+
});
|
|
13609
|
+
}
|
|
13610
|
+
function unsupportedFeature(feature) {
|
|
13611
|
+
return new RivetError(
|
|
13612
|
+
"feature",
|
|
13613
|
+
"unsupported",
|
|
13614
|
+
`Unsupported feature: ${feature}`
|
|
13615
|
+
);
|
|
13616
|
+
}
|
|
13617
|
+
|
|
13618
|
+
// ../rivetkit/dist/tsup/chunk-YW75TS76.js
|
|
13619
|
+
import {
|
|
13620
|
+
pino,
|
|
13621
|
+
stdTimeFunctions
|
|
13622
|
+
} from "pino";
|
|
13623
|
+
var import_invariant = __toESM(require_invariant(), 1);
|
|
13624
|
+
import * as cbor from "cbor-x";
|
|
13625
|
+
var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
|
|
13626
|
+
var getRivetEndpoint = () => getEnvUniversal("RIVET_ENDPOINT");
|
|
13627
|
+
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
13628
|
+
var getRivetNamespace = () => getEnvUniversal("RIVET_NAMESPACE");
|
|
13629
|
+
var getRivetPool = () => getEnvUniversal("RIVET_POOL");
|
|
13630
|
+
var getRivetTotalSlots = () => {
|
|
13631
|
+
const value = getEnvUniversal("RIVET_TOTAL_SLOTS");
|
|
13632
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13633
|
+
};
|
|
13634
|
+
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
13635
|
+
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
13636
|
+
var getRivetRunEnginePort = () => {
|
|
13637
|
+
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
13638
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13639
|
+
};
|
|
13640
|
+
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
13641
|
+
var getRivetEnvoyVersion = () => {
|
|
13642
|
+
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
13643
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13644
|
+
};
|
|
13645
|
+
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
13646
|
+
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
13647
|
+
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
13648
|
+
var getRivetkitRuntimeMode = () => {
|
|
13649
|
+
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
13650
|
+
if (value === void 0) return "envoy";
|
|
13651
|
+
if (value === "envoy" || value === "serverless") return value;
|
|
13652
|
+
throw new Error(
|
|
13653
|
+
`RIVETKIT_RUNTIME_MODE env var must be "envoy" or "serverless"; got "${value}"`
|
|
13654
|
+
);
|
|
13655
|
+
};
|
|
13656
|
+
var getRivetkitPublicDir = () => {
|
|
13657
|
+
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
13658
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
13659
|
+
};
|
|
13660
|
+
function parsePortEnv(raw) {
|
|
13661
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
13662
|
+
const parsed = Number.parseInt(raw, 10);
|
|
13663
|
+
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
13664
|
+
throw new Error(
|
|
13665
|
+
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
13666
|
+
);
|
|
13667
|
+
}
|
|
13668
|
+
return parsed;
|
|
13669
|
+
}
|
|
13670
|
+
var getLogLevel = () => getEnvUniversal("RIVET_LOG_LEVEL") ?? getEnvUniversal("LOG_LEVEL");
|
|
13671
|
+
var getLogTarget = () => getEnvUniversal("RIVET_LOG_TARGET") === "1";
|
|
13672
|
+
var getLogTimestamp = () => getEnvUniversal("RIVET_LOG_TIMESTAMP") === "1";
|
|
13673
|
+
var getLogMessage = () => getEnvUniversal("RIVET_LOG_MESSAGE") === "1";
|
|
13674
|
+
var getLogErrorStack = () => getEnvUniversal("RIVET_LOG_ERROR_STACK") === "1";
|
|
13675
|
+
var getNodeEnv = () => getEnvUniversal("NODE_ENV");
|
|
13676
|
+
var getNextPhase = () => getEnvUniversal("NEXT_PHASE");
|
|
13677
|
+
var isDev = () => getNodeEnv() !== "production";
|
|
13678
|
+
function assertUnreachable(x) {
|
|
13679
|
+
throw new Error(`Unreachable case: ${x}`);
|
|
13208
13680
|
}
|
|
13209
13681
|
function isCanonicalStructuredRivetError(error46) {
|
|
13210
13682
|
return error46 instanceof RivetError || typeof error46 === "object" && error46 !== null && "__type" in error46 && error46.__type === "RivetError" && "group" in error46 && typeof error46.group === "string" && "code" in error46 && typeof error46.code === "string" && "message" in error46 && typeof error46.message === "string";
|
|
@@ -13216,6 +13688,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13216
13688
|
let code;
|
|
13217
13689
|
let message;
|
|
13218
13690
|
let metadata;
|
|
13691
|
+
let rayId;
|
|
13219
13692
|
let actor2;
|
|
13220
13693
|
if (isCanonicalStructuredRivetError(error46)) {
|
|
13221
13694
|
statusCode = typeof error46.statusCode === "number" ? error46.statusCode : error46.public ? 400 : 500;
|
|
@@ -13224,6 +13697,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13224
13697
|
code = error46.code;
|
|
13225
13698
|
message = error46.message;
|
|
13226
13699
|
metadata = error46.metadata;
|
|
13700
|
+
rayId = error46.rayId;
|
|
13227
13701
|
actor2 = error46.actor;
|
|
13228
13702
|
} else if (RivetError.isActorError(error46) && error46.public) {
|
|
13229
13703
|
statusCode = "statusCode" in error46 && error46.statusCode ? error46.statusCode : 400;
|
|
@@ -13232,6 +13706,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13232
13706
|
code = error46.code;
|
|
13233
13707
|
message = getErrorMessage(error46);
|
|
13234
13708
|
metadata = error46.metadata;
|
|
13709
|
+
rayId = error46.rayId;
|
|
13235
13710
|
actor2 = error46.actor;
|
|
13236
13711
|
} else if (exposeInternalError) {
|
|
13237
13712
|
if (RivetError.isActorError(error46)) {
|
|
@@ -13241,6 +13716,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13241
13716
|
code = error46.code;
|
|
13242
13717
|
message = getErrorMessage(error46);
|
|
13243
13718
|
metadata = error46.metadata;
|
|
13719
|
+
rayId = error46.rayId;
|
|
13244
13720
|
actor2 = error46.actor;
|
|
13245
13721
|
} else {
|
|
13246
13722
|
statusCode = 500;
|
|
@@ -13270,6 +13746,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13270
13746
|
code,
|
|
13271
13747
|
message,
|
|
13272
13748
|
metadata,
|
|
13749
|
+
rayId,
|
|
13273
13750
|
actor: actor2
|
|
13274
13751
|
};
|
|
13275
13752
|
}
|
|
@@ -13312,7 +13789,7 @@ function noopNext() {
|
|
|
13312
13789
|
}
|
|
13313
13790
|
var package_default = {
|
|
13314
13791
|
name: "rivetkit",
|
|
13315
|
-
version: "2.3.
|
|
13792
|
+
version: "2.3.12-rc.2",
|
|
13316
13793
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
13317
13794
|
license: "Apache-2.0",
|
|
13318
13795
|
keywords: [
|
|
@@ -14542,840 +15019,376 @@ function readUtf8Js(bc, byteLen) {
|
|
|
14542
15019
|
const byte4 = bytes[offset++];
|
|
14543
15020
|
codePoint = (byte1 & 7) << 18 | (byte2 & 63) << 12 | (byte3 & 63) << 6 | byte4 & 63;
|
|
14544
15021
|
malformed = codePoint >> 16 === 0 || // non-canonical char or missing data
|
|
14545
|
-
codePoint > 1114111 || // too large code point
|
|
14546
|
-
byte1 >> 3 !== 30 || // invalid tag
|
|
14547
|
-
byte2 >> 6 !== 2 || // invalid tag
|
|
14548
|
-
byte3 >> 6 !== 2 || // invalid tag
|
|
14549
|
-
byte4 >> 6 !== 2;
|
|
14550
|
-
}
|
|
14551
|
-
if (malformed) {
|
|
14552
|
-
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14553
|
-
}
|
|
14554
|
-
}
|
|
14555
|
-
result += String.fromCodePoint(codePoint);
|
|
14556
|
-
}
|
|
14557
|
-
bc.offset = offset;
|
|
14558
|
-
return result;
|
|
14559
|
-
}
|
|
14560
|
-
function writeUtf8Js(bc, s) {
|
|
14561
|
-
const bytes = bc.bytes;
|
|
14562
|
-
let offset = bc.offset;
|
|
14563
|
-
let i = 0;
|
|
14564
|
-
while (i < s.length) {
|
|
14565
|
-
const codePoint = s.codePointAt(i++);
|
|
14566
|
-
if (codePoint < 128) {
|
|
14567
|
-
bytes[offset++] = codePoint;
|
|
14568
|
-
} else {
|
|
14569
|
-
if (codePoint < 2048) {
|
|
14570
|
-
bytes[offset++] = 192 | codePoint >> 6;
|
|
14571
|
-
} else {
|
|
14572
|
-
if (codePoint < 65536) {
|
|
14573
|
-
bytes[offset++] = 224 | codePoint >> 12;
|
|
14574
|
-
} else {
|
|
14575
|
-
bytes[offset++] = 240 | codePoint >> 18;
|
|
14576
|
-
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
14577
|
-
i++;
|
|
14578
|
-
}
|
|
14579
|
-
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
14580
|
-
}
|
|
14581
|
-
bytes[offset++] = 128 | codePoint & 63;
|
|
14582
|
-
}
|
|
14583
|
-
}
|
|
14584
|
-
bc.offset = offset;
|
|
14585
|
-
}
|
|
14586
|
-
function utf8ByteLength(s) {
|
|
14587
|
-
let result = s.length;
|
|
14588
|
-
for (let i = 0; i < s.length; i++) {
|
|
14589
|
-
const codePoint = s.codePointAt(i);
|
|
14590
|
-
if (codePoint > 127) {
|
|
14591
|
-
result++;
|
|
14592
|
-
if (codePoint > 2047) {
|
|
14593
|
-
result++;
|
|
14594
|
-
if (codePoint > 65535) {
|
|
14595
|
-
i++;
|
|
14596
|
-
}
|
|
14597
|
-
}
|
|
14598
|
-
}
|
|
14599
|
-
}
|
|
14600
|
-
return result;
|
|
14601
|
-
}
|
|
14602
|
-
var UTF8_DECODER = /* @__PURE__ */ new TextDecoder("utf-8", { fatal: true });
|
|
14603
|
-
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
14604
|
-
|
|
14605
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
14606
|
-
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
14607
|
-
if (DEV) {
|
|
14608
|
-
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
14609
|
-
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
14610
|
-
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
14611
|
-
}
|
|
14612
|
-
return {
|
|
14613
|
-
initialBufferLength,
|
|
14614
|
-
maxBufferLength
|
|
14615
|
-
};
|
|
14616
|
-
}
|
|
14617
|
-
|
|
14618
|
-
// ../rivetkit/dist/tsup/chunk-QFJ24MBU.js
|
|
14619
|
-
var config2 = /* @__PURE__ */ Config({});
|
|
14620
|
-
function readWorkflowCbor(bc) {
|
|
14621
|
-
return readData(bc);
|
|
14622
|
-
}
|
|
14623
|
-
function readWorkflowNameIndex(bc) {
|
|
14624
|
-
return readU32(bc);
|
|
14625
|
-
}
|
|
14626
|
-
function readWorkflowLoopIterationMarker(bc) {
|
|
14627
|
-
return {
|
|
14628
|
-
loop: readWorkflowNameIndex(bc),
|
|
14629
|
-
iteration: readU32(bc)
|
|
14630
|
-
};
|
|
14631
|
-
}
|
|
14632
|
-
function readWorkflowPathSegment(bc) {
|
|
14633
|
-
const offset = bc.offset;
|
|
14634
|
-
const tag = readU8(bc);
|
|
14635
|
-
switch (tag) {
|
|
14636
|
-
case 0:
|
|
14637
|
-
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
14638
|
-
case 1:
|
|
14639
|
-
return {
|
|
14640
|
-
tag: "WorkflowLoopIterationMarker",
|
|
14641
|
-
val: readWorkflowLoopIterationMarker(bc)
|
|
14642
|
-
};
|
|
14643
|
-
default: {
|
|
14644
|
-
bc.offset = offset;
|
|
14645
|
-
throw new BareError(offset, "invalid tag");
|
|
14646
|
-
}
|
|
14647
|
-
}
|
|
14648
|
-
}
|
|
14649
|
-
function readWorkflowLocation(bc) {
|
|
14650
|
-
const len = readUintSafe(bc);
|
|
14651
|
-
if (len === 0) {
|
|
14652
|
-
return [];
|
|
14653
|
-
}
|
|
14654
|
-
const result = [readWorkflowPathSegment(bc)];
|
|
14655
|
-
for (let i = 1; i < len; i++) {
|
|
14656
|
-
result[i] = readWorkflowPathSegment(bc);
|
|
14657
|
-
}
|
|
14658
|
-
return result;
|
|
14659
|
-
}
|
|
14660
|
-
function readWorkflowEntryStatus(bc) {
|
|
14661
|
-
const offset = bc.offset;
|
|
14662
|
-
const tag = readU8(bc);
|
|
14663
|
-
switch (tag) {
|
|
14664
|
-
case 0:
|
|
14665
|
-
return "PENDING";
|
|
14666
|
-
case 1:
|
|
14667
|
-
return "RUNNING";
|
|
14668
|
-
case 2:
|
|
14669
|
-
return "COMPLETED";
|
|
14670
|
-
case 3:
|
|
14671
|
-
return "FAILED";
|
|
14672
|
-
case 4:
|
|
14673
|
-
return "EXHAUSTED";
|
|
14674
|
-
default: {
|
|
14675
|
-
bc.offset = offset;
|
|
14676
|
-
throw new BareError(offset, "invalid tag");
|
|
14677
|
-
}
|
|
14678
|
-
}
|
|
14679
|
-
}
|
|
14680
|
-
function readWorkflowSleepState(bc) {
|
|
14681
|
-
const offset = bc.offset;
|
|
14682
|
-
const tag = readU8(bc);
|
|
14683
|
-
switch (tag) {
|
|
14684
|
-
case 0:
|
|
14685
|
-
return "PENDING";
|
|
14686
|
-
case 1:
|
|
14687
|
-
return "COMPLETED";
|
|
14688
|
-
case 2:
|
|
14689
|
-
return "INTERRUPTED";
|
|
14690
|
-
default: {
|
|
14691
|
-
bc.offset = offset;
|
|
14692
|
-
throw new BareError(offset, "invalid tag");
|
|
14693
|
-
}
|
|
14694
|
-
}
|
|
14695
|
-
}
|
|
14696
|
-
function readWorkflowBranchStatusType(bc) {
|
|
14697
|
-
const offset = bc.offset;
|
|
14698
|
-
const tag = readU8(bc);
|
|
14699
|
-
switch (tag) {
|
|
14700
|
-
case 0:
|
|
14701
|
-
return "PENDING";
|
|
14702
|
-
case 1:
|
|
14703
|
-
return "RUNNING";
|
|
14704
|
-
case 2:
|
|
14705
|
-
return "COMPLETED";
|
|
14706
|
-
case 3:
|
|
14707
|
-
return "FAILED";
|
|
14708
|
-
case 4:
|
|
14709
|
-
return "CANCELLED";
|
|
14710
|
-
default: {
|
|
14711
|
-
bc.offset = offset;
|
|
14712
|
-
throw new BareError(offset, "invalid tag");
|
|
15022
|
+
codePoint > 1114111 || // too large code point
|
|
15023
|
+
byte1 >> 3 !== 30 || // invalid tag
|
|
15024
|
+
byte2 >> 6 !== 2 || // invalid tag
|
|
15025
|
+
byte3 >> 6 !== 2 || // invalid tag
|
|
15026
|
+
byte4 >> 6 !== 2;
|
|
15027
|
+
}
|
|
15028
|
+
if (malformed) {
|
|
15029
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
15030
|
+
}
|
|
14713
15031
|
}
|
|
15032
|
+
result += String.fromCodePoint(codePoint);
|
|
14714
15033
|
}
|
|
15034
|
+
bc.offset = offset;
|
|
15035
|
+
return result;
|
|
14715
15036
|
}
|
|
14716
|
-
function
|
|
14717
|
-
|
|
14718
|
-
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
}
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
}
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
}
|
|
14740
|
-
|
|
14741
|
-
function readWorkflowMessageEntry(bc) {
|
|
14742
|
-
return {
|
|
14743
|
-
name: readString(bc),
|
|
14744
|
-
messageData: readWorkflowCbor(bc)
|
|
14745
|
-
};
|
|
14746
|
-
}
|
|
14747
|
-
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
14748
|
-
return {
|
|
14749
|
-
name: readString(bc)
|
|
14750
|
-
};
|
|
14751
|
-
}
|
|
14752
|
-
function readWorkflowBranchStatus(bc) {
|
|
14753
|
-
return {
|
|
14754
|
-
status: readWorkflowBranchStatusType(bc),
|
|
14755
|
-
output: read0(bc),
|
|
14756
|
-
error: read1(bc)
|
|
14757
|
-
};
|
|
15037
|
+
function writeUtf8Js(bc, s) {
|
|
15038
|
+
const bytes = bc.bytes;
|
|
15039
|
+
let offset = bc.offset;
|
|
15040
|
+
let i = 0;
|
|
15041
|
+
while (i < s.length) {
|
|
15042
|
+
const codePoint = s.codePointAt(i++);
|
|
15043
|
+
if (codePoint < 128) {
|
|
15044
|
+
bytes[offset++] = codePoint;
|
|
15045
|
+
} else {
|
|
15046
|
+
if (codePoint < 2048) {
|
|
15047
|
+
bytes[offset++] = 192 | codePoint >> 6;
|
|
15048
|
+
} else {
|
|
15049
|
+
if (codePoint < 65536) {
|
|
15050
|
+
bytes[offset++] = 224 | codePoint >> 12;
|
|
15051
|
+
} else {
|
|
15052
|
+
bytes[offset++] = 240 | codePoint >> 18;
|
|
15053
|
+
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
15054
|
+
i++;
|
|
15055
|
+
}
|
|
15056
|
+
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
15057
|
+
}
|
|
15058
|
+
bytes[offset++] = 128 | codePoint & 63;
|
|
15059
|
+
}
|
|
15060
|
+
}
|
|
15061
|
+
bc.offset = offset;
|
|
14758
15062
|
}
|
|
14759
|
-
function
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
15063
|
+
function utf8ByteLength(s) {
|
|
15064
|
+
let result = s.length;
|
|
15065
|
+
for (let i = 0; i < s.length; i++) {
|
|
15066
|
+
const codePoint = s.codePointAt(i);
|
|
15067
|
+
if (codePoint > 127) {
|
|
15068
|
+
result++;
|
|
15069
|
+
if (codePoint > 2047) {
|
|
15070
|
+
result++;
|
|
15071
|
+
if (codePoint > 65535) {
|
|
15072
|
+
i++;
|
|
15073
|
+
}
|
|
15074
|
+
}
|
|
14768
15075
|
}
|
|
14769
|
-
result.set(key, readWorkflowBranchStatus(bc));
|
|
14770
15076
|
}
|
|
14771
15077
|
return result;
|
|
14772
15078
|
}
|
|
14773
|
-
|
|
15079
|
+
var UTF8_DECODER = /* @__PURE__ */ new TextDecoder("utf-8", { fatal: true });
|
|
15080
|
+
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
15081
|
+
|
|
15082
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
15083
|
+
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
15084
|
+
if (DEV) {
|
|
15085
|
+
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
15086
|
+
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
15087
|
+
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
15088
|
+
}
|
|
14774
15089
|
return {
|
|
14775
|
-
|
|
15090
|
+
initialBufferLength,
|
|
15091
|
+
maxBufferLength
|
|
14776
15092
|
};
|
|
14777
15093
|
}
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
15094
|
+
|
|
15095
|
+
// ../rivetkit/dist/tsup/chunk-KPZQI3TG.js
|
|
15096
|
+
var config2 = /* @__PURE__ */ Config({});
|
|
15097
|
+
function readWorkflowCbor(bc) {
|
|
15098
|
+
return readData(bc);
|
|
14783
15099
|
}
|
|
14784
|
-
function
|
|
14785
|
-
return
|
|
14786
|
-
originalType: readString(bc),
|
|
14787
|
-
originalName: read1(bc)
|
|
14788
|
-
};
|
|
15100
|
+
function readWorkflowNameIndex(bc) {
|
|
15101
|
+
return readU32(bc);
|
|
14789
15102
|
}
|
|
14790
|
-
function
|
|
15103
|
+
function readWorkflowLoopIterationMarker(bc) {
|
|
14791
15104
|
return {
|
|
14792
|
-
|
|
14793
|
-
|
|
15105
|
+
loop: readWorkflowNameIndex(bc),
|
|
15106
|
+
iteration: readU32(bc)
|
|
14794
15107
|
};
|
|
14795
15108
|
}
|
|
14796
|
-
function
|
|
15109
|
+
function readWorkflowPathSegment(bc) {
|
|
14797
15110
|
const offset = bc.offset;
|
|
14798
15111
|
const tag = readU8(bc);
|
|
14799
15112
|
switch (tag) {
|
|
14800
15113
|
case 0:
|
|
14801
|
-
return { tag: "
|
|
15114
|
+
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
14802
15115
|
case 1:
|
|
14803
|
-
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
14804
|
-
case 2:
|
|
14805
|
-
return {
|
|
14806
|
-
tag: "WorkflowSleepEntry",
|
|
14807
|
-
val: readWorkflowSleepEntry(bc)
|
|
14808
|
-
};
|
|
14809
|
-
case 3:
|
|
14810
|
-
return {
|
|
14811
|
-
tag: "WorkflowMessageEntry",
|
|
14812
|
-
val: readWorkflowMessageEntry(bc)
|
|
14813
|
-
};
|
|
14814
|
-
case 4:
|
|
14815
|
-
return {
|
|
14816
|
-
tag: "WorkflowRollbackCheckpointEntry",
|
|
14817
|
-
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
14818
|
-
};
|
|
14819
|
-
case 5:
|
|
14820
|
-
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
14821
|
-
case 6:
|
|
14822
|
-
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
14823
|
-
case 7:
|
|
14824
|
-
return {
|
|
14825
|
-
tag: "WorkflowRemovedEntry",
|
|
14826
|
-
val: readWorkflowRemovedEntry(bc)
|
|
14827
|
-
};
|
|
14828
|
-
case 8:
|
|
14829
15116
|
return {
|
|
14830
|
-
tag: "
|
|
14831
|
-
val:
|
|
15117
|
+
tag: "WorkflowLoopIterationMarker",
|
|
15118
|
+
val: readWorkflowLoopIterationMarker(bc)
|
|
14832
15119
|
};
|
|
14833
15120
|
default: {
|
|
14834
15121
|
bc.offset = offset;
|
|
14835
15122
|
throw new BareError(offset, "invalid tag");
|
|
14836
|
-
}
|
|
14837
|
-
}
|
|
14838
|
-
}
|
|
14839
|
-
function readWorkflowEntry(bc) {
|
|
14840
|
-
return {
|
|
14841
|
-
id: readString(bc),
|
|
14842
|
-
location: readWorkflowLocation(bc),
|
|
14843
|
-
kind: readWorkflowEntryKind(bc)
|
|
14844
|
-
};
|
|
14845
|
-
}
|
|
14846
|
-
function read3(bc) {
|
|
14847
|
-
return readBool(bc) ? readU64(bc) : null;
|
|
14848
|
-
}
|
|
14849
|
-
function readWorkflowEntryMetadata(bc) {
|
|
14850
|
-
return {
|
|
14851
|
-
status: readWorkflowEntryStatus(bc),
|
|
14852
|
-
error: read1(bc),
|
|
14853
|
-
attempts: readU32(bc),
|
|
14854
|
-
lastAttemptAt: readU64(bc),
|
|
14855
|
-
createdAt: readU64(bc),
|
|
14856
|
-
completedAt: read3(bc),
|
|
14857
|
-
rollbackCompletedAt: read3(bc),
|
|
14858
|
-
rollbackError: read1(bc)
|
|
14859
|
-
};
|
|
14860
|
-
}
|
|
14861
|
-
function read4(bc) {
|
|
14862
|
-
const len = readUintSafe(bc);
|
|
14863
|
-
if (len === 0) {
|
|
14864
|
-
return [];
|
|
14865
|
-
}
|
|
14866
|
-
const result = [readString(bc)];
|
|
14867
|
-
for (let i = 1; i < len; i++) {
|
|
14868
|
-
result[i] = readString(bc);
|
|
14869
|
-
}
|
|
14870
|
-
return result;
|
|
14871
|
-
}
|
|
14872
|
-
function read5(bc) {
|
|
14873
|
-
const len = readUintSafe(bc);
|
|
14874
|
-
if (len === 0) {
|
|
14875
|
-
return [];
|
|
14876
|
-
}
|
|
14877
|
-
const result = [readWorkflowEntry(bc)];
|
|
14878
|
-
for (let i = 1; i < len; i++) {
|
|
14879
|
-
result[i] = readWorkflowEntry(bc);
|
|
14880
|
-
}
|
|
14881
|
-
return result;
|
|
14882
|
-
}
|
|
14883
|
-
function read6(bc) {
|
|
14884
|
-
const len = readUintSafe(bc);
|
|
14885
|
-
const result = /* @__PURE__ */ new Map();
|
|
14886
|
-
for (let i = 0; i < len; i++) {
|
|
14887
|
-
const offset = bc.offset;
|
|
14888
|
-
const key = readString(bc);
|
|
14889
|
-
if (result.has(key)) {
|
|
14890
|
-
bc.offset = offset;
|
|
14891
|
-
throw new BareError(offset, "duplicated key");
|
|
14892
|
-
}
|
|
14893
|
-
result.set(key, readWorkflowEntryMetadata(bc));
|
|
14894
|
-
}
|
|
14895
|
-
return result;
|
|
14896
|
-
}
|
|
14897
|
-
function readWorkflowHistory(bc) {
|
|
14898
|
-
return {
|
|
14899
|
-
nameRegistry: read4(bc),
|
|
14900
|
-
entries: read5(bc),
|
|
14901
|
-
entryMetadata: read6(bc)
|
|
14902
|
-
};
|
|
14903
|
-
}
|
|
14904
|
-
function decodeWorkflowHistory(bytes) {
|
|
14905
|
-
const bc = new ByteCursor(bytes, config2);
|
|
14906
|
-
const result = readWorkflowHistory(bc);
|
|
14907
|
-
if (bc.offset < bc.view.byteLength) {
|
|
14908
|
-
throw new BareError(bc.offset, "remaining bytes");
|
|
14909
|
-
}
|
|
14910
|
-
return result;
|
|
14911
|
-
}
|
|
14912
|
-
function decodeWorkflowHistoryTransport(data) {
|
|
14913
|
-
return decodeWorkflowHistory(toUint8Array(data));
|
|
14914
|
-
}
|
|
14915
|
-
|
|
14916
|
-
// ../rivetkit/dist/tsup/chunk-6W5VGLFT.js
|
|
14917
|
-
function flattenActionHandlers(actions) {
|
|
14918
|
-
const flattened = /* @__PURE__ */ Object.create(null);
|
|
14919
|
-
for (const { name, handler } of collectActionEntries(actions)) {
|
|
14920
|
-
flattened[name] = handler;
|
|
15123
|
+
}
|
|
14921
15124
|
}
|
|
14922
|
-
return flattened;
|
|
14923
15125
|
}
|
|
14924
|
-
function
|
|
14925
|
-
|
|
14926
|
-
if (
|
|
14927
|
-
|
|
15126
|
+
function readWorkflowLocation(bc) {
|
|
15127
|
+
const len = readUintSafe(bc);
|
|
15128
|
+
if (len === 0) {
|
|
15129
|
+
return [];
|
|
14928
15130
|
}
|
|
14929
|
-
const
|
|
14930
|
-
for (
|
|
14931
|
-
|
|
14932
|
-
const flatSchema = schemas[name];
|
|
14933
|
-
if (nestedSchema !== void 0 && flatSchema !== void 0 && nestedSchema !== flatSchema) {
|
|
14934
|
-
throw new TypeError(
|
|
14935
|
-
`Action input schema \`${name}\` is defined by both a nested path and a dotted key`
|
|
14936
|
-
);
|
|
14937
|
-
}
|
|
14938
|
-
const schema = nestedSchema ?? flatSchema;
|
|
14939
|
-
if (schema !== void 0) {
|
|
14940
|
-
flattened[name] = schema;
|
|
14941
|
-
}
|
|
15131
|
+
const result = [readWorkflowPathSegment(bc)];
|
|
15132
|
+
for (let i = 1; i < len; i++) {
|
|
15133
|
+
result[i] = readWorkflowPathSegment(bc);
|
|
14942
15134
|
}
|
|
14943
|
-
return
|
|
14944
|
-
}
|
|
14945
|
-
function collectActionEntries(actions) {
|
|
14946
|
-
const entries = [];
|
|
14947
|
-
const names = /* @__PURE__ */ new Set();
|
|
14948
|
-
visitActionGroup(actions ?? {}, [], entries, names);
|
|
14949
|
-
return entries;
|
|
15135
|
+
return result;
|
|
14950
15136
|
}
|
|
14951
|
-
function
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
|
|
14961
|
-
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
name,
|
|
14969
|
-
path: childPath,
|
|
14970
|
-
handler: child
|
|
14971
|
-
});
|
|
14972
|
-
} else {
|
|
14973
|
-
visitActionGroup(child, childPath, entries, names);
|
|
15137
|
+
function readWorkflowEntryStatus(bc) {
|
|
15138
|
+
const offset = bc.offset;
|
|
15139
|
+
const tag = readU8(bc);
|
|
15140
|
+
switch (tag) {
|
|
15141
|
+
case 0:
|
|
15142
|
+
return "PENDING";
|
|
15143
|
+
case 1:
|
|
15144
|
+
return "RUNNING";
|
|
15145
|
+
case 2:
|
|
15146
|
+
return "COMPLETED";
|
|
15147
|
+
case 3:
|
|
15148
|
+
return "FAILED";
|
|
15149
|
+
case 4:
|
|
15150
|
+
return "EXHAUSTED";
|
|
15151
|
+
default: {
|
|
15152
|
+
bc.offset = offset;
|
|
15153
|
+
throw new BareError(offset, "invalid tag");
|
|
14974
15154
|
}
|
|
14975
15155
|
}
|
|
14976
15156
|
}
|
|
14977
|
-
function
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
15157
|
+
function readWorkflowSleepState(bc) {
|
|
15158
|
+
const offset = bc.offset;
|
|
15159
|
+
const tag = readU8(bc);
|
|
15160
|
+
switch (tag) {
|
|
15161
|
+
case 0:
|
|
15162
|
+
return "PENDING";
|
|
15163
|
+
case 1:
|
|
15164
|
+
return "COMPLETED";
|
|
15165
|
+
case 2:
|
|
15166
|
+
return "INTERRUPTED";
|
|
15167
|
+
default: {
|
|
15168
|
+
bc.offset = offset;
|
|
15169
|
+
throw new BareError(offset, "invalid tag");
|
|
14982
15170
|
}
|
|
14983
|
-
value = value[segment];
|
|
14984
15171
|
}
|
|
14985
|
-
return value;
|
|
14986
15172
|
}
|
|
14987
|
-
function
|
|
14988
|
-
|
|
14989
|
-
|
|
15173
|
+
function readWorkflowBranchStatusType(bc) {
|
|
15174
|
+
const offset = bc.offset;
|
|
15175
|
+
const tag = readU8(bc);
|
|
15176
|
+
switch (tag) {
|
|
15177
|
+
case 0:
|
|
15178
|
+
return "PENDING";
|
|
15179
|
+
case 1:
|
|
15180
|
+
return "RUNNING";
|
|
15181
|
+
case 2:
|
|
15182
|
+
return "COMPLETED";
|
|
15183
|
+
case 3:
|
|
15184
|
+
return "FAILED";
|
|
15185
|
+
case 4:
|
|
15186
|
+
return "CANCELLED";
|
|
15187
|
+
default: {
|
|
15188
|
+
bc.offset = offset;
|
|
15189
|
+
throw new BareError(offset, "invalid tag");
|
|
15190
|
+
}
|
|
14990
15191
|
}
|
|
14991
|
-
const prototype = Object.getPrototypeOf(value);
|
|
14992
|
-
return prototype === Object.prototype || prototype === null;
|
|
14993
15192
|
}
|
|
14994
|
-
function
|
|
14995
|
-
return
|
|
15193
|
+
function read0(bc) {
|
|
15194
|
+
return readBool(bc) ? readWorkflowCbor(bc) : null;
|
|
14996
15195
|
}
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
)
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15009
|
-
|
|
15010
|
-
|
|
15011
|
-
|
|
15012
|
-
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
}
|
|
15019
|
-
});
|
|
15020
|
-
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
15021
|
-
getHistory: zFunction(),
|
|
15022
|
-
getState: zFunction().optional(),
|
|
15023
|
-
onHistoryUpdated: zFunction().optional(),
|
|
15024
|
-
replayFromStep: zFunction().optional()
|
|
15025
|
-
});
|
|
15026
|
-
var RunInspectorConfigSchema = external_exports.object({
|
|
15027
|
-
workflow: WorkflowInspectorConfigSchema.optional()
|
|
15028
|
-
}).optional();
|
|
15029
|
-
var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
15030
|
-
"workflow",
|
|
15031
|
-
"database",
|
|
15032
|
-
"state",
|
|
15033
|
-
"queue",
|
|
15034
|
-
"schedules",
|
|
15035
|
-
"connections",
|
|
15036
|
-
"console"
|
|
15037
|
-
];
|
|
15038
|
-
var BuiltinInspectorTabIdSchema = external_exports.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
15039
|
-
var CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
15040
|
-
var CustomInspectorTabEntrySchema = external_exports.object({
|
|
15041
|
-
id: external_exports.string().regex(
|
|
15042
|
-
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
15043
|
-
"inspector.tabs[].id must contain only letters, digits, underscore, or dash"
|
|
15044
|
-
),
|
|
15045
|
-
label: external_exports.string().min(1),
|
|
15046
|
-
source: external_exports.string().min(1),
|
|
15047
|
-
/**
|
|
15048
|
-
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
15049
|
-
* icon registry); unknown ids fall back to a generic icon.
|
|
15050
|
-
*/
|
|
15051
|
-
icon: external_exports.string().min(1).optional(),
|
|
15052
|
-
hidden: external_exports.literal(false).optional()
|
|
15053
|
-
}).strict();
|
|
15054
|
-
var HideInspectorTabEntrySchema = external_exports.object({
|
|
15055
|
-
id: BuiltinInspectorTabIdSchema,
|
|
15056
|
-
hidden: external_exports.literal(true)
|
|
15057
|
-
}).strict();
|
|
15058
|
-
var InspectorTabEntrySchema = external_exports.union([
|
|
15059
|
-
CustomInspectorTabEntrySchema,
|
|
15060
|
-
HideInspectorTabEntrySchema
|
|
15061
|
-
]);
|
|
15062
|
-
var ActorInspectorConfigSchema = external_exports.object({
|
|
15063
|
-
tabs: external_exports.array(InspectorTabEntrySchema).default(() => [])
|
|
15064
|
-
}).strict().refine(
|
|
15065
|
-
(data) => {
|
|
15066
|
-
const ids = data.tabs.map((t) => t.id);
|
|
15067
|
-
return new Set(ids).size === ids.length;
|
|
15068
|
-
},
|
|
15069
|
-
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] }
|
|
15070
|
-
).refine(
|
|
15071
|
-
(data) => {
|
|
15072
|
-
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
15073
|
-
return data.tabs.every(
|
|
15074
|
-
(t) => t.hidden === true || !builtinSet.has(t.id)
|
|
15075
|
-
);
|
|
15076
|
-
},
|
|
15077
|
-
{
|
|
15078
|
-
message: "Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
15079
|
-
path: ["tabs"]
|
|
15080
|
-
}
|
|
15081
|
-
);
|
|
15082
|
-
var RunConfigSchema = external_exports.object({
|
|
15083
|
-
/** Display name for the actor in the Inspector UI. */
|
|
15084
|
-
name: external_exports.string().optional(),
|
|
15085
|
-
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
15086
|
-
icon: external_exports.string().optional(),
|
|
15087
|
-
/** The run handler function. */
|
|
15088
|
-
run: zFunction(),
|
|
15089
|
-
/** Inspector integration for long-running run handlers. */
|
|
15090
|
-
inspector: RunInspectorConfigSchema.optional()
|
|
15091
|
-
});
|
|
15092
|
-
var RUN_FUNCTION_CONFIG_SYMBOL = /* @__PURE__ */ Symbol.for("rivetkit.run_function_config");
|
|
15093
|
-
function defineRunHandler(run, options) {
|
|
15094
|
-
if (options.inspectorKind === void 0 !== (options.createInspector === void 0)) {
|
|
15095
|
-
throw new TypeError(
|
|
15096
|
-
"defineRunHandler requires inspectorKind and createInspector together"
|
|
15097
|
-
);
|
|
15098
|
-
}
|
|
15099
|
-
Object.defineProperty(run, RUN_FUNCTION_CONFIG_SYMBOL, {
|
|
15100
|
-
configurable: false,
|
|
15101
|
-
enumerable: false,
|
|
15102
|
-
writable: false,
|
|
15103
|
-
value: {
|
|
15104
|
-
name: options.name,
|
|
15105
|
-
icon: options.icon,
|
|
15106
|
-
inspectorKind: options.inspectorKind,
|
|
15107
|
-
createInspector: options.createInspector
|
|
15108
|
-
}
|
|
15109
|
-
});
|
|
15110
|
-
return run;
|
|
15196
|
+
function read1(bc) {
|
|
15197
|
+
return readBool(bc) ? readString(bc) : null;
|
|
15198
|
+
}
|
|
15199
|
+
function readWorkflowStepEntry(bc) {
|
|
15200
|
+
return {
|
|
15201
|
+
output: read0(bc),
|
|
15202
|
+
error: read1(bc)
|
|
15203
|
+
};
|
|
15204
|
+
}
|
|
15205
|
+
function readWorkflowLoopEntry(bc) {
|
|
15206
|
+
return {
|
|
15207
|
+
state: readWorkflowCbor(bc),
|
|
15208
|
+
iteration: readU32(bc),
|
|
15209
|
+
output: read0(bc)
|
|
15210
|
+
};
|
|
15211
|
+
}
|
|
15212
|
+
function readWorkflowSleepEntry(bc) {
|
|
15213
|
+
return {
|
|
15214
|
+
deadline: readU64(bc),
|
|
15215
|
+
state: readWorkflowSleepState(bc)
|
|
15216
|
+
};
|
|
15111
15217
|
}
|
|
15112
|
-
function
|
|
15113
|
-
|
|
15114
|
-
|
|
15115
|
-
|
|
15218
|
+
function readWorkflowMessageEntry(bc) {
|
|
15219
|
+
return {
|
|
15220
|
+
name: readString(bc),
|
|
15221
|
+
messageData: readWorkflowCbor(bc)
|
|
15222
|
+
};
|
|
15116
15223
|
}
|
|
15117
|
-
function
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
|
|
15224
|
+
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
15225
|
+
return {
|
|
15226
|
+
name: readString(bc)
|
|
15227
|
+
};
|
|
15121
15228
|
}
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15229
|
+
function readWorkflowBranchStatus(bc) {
|
|
15230
|
+
return {
|
|
15231
|
+
status: readWorkflowBranchStatusType(bc),
|
|
15232
|
+
output: read0(bc),
|
|
15233
|
+
error: read1(bc)
|
|
15234
|
+
};
|
|
15127
15235
|
}
|
|
15128
|
-
function
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15236
|
+
function read2(bc) {
|
|
15237
|
+
const len = readUintSafe(bc);
|
|
15238
|
+
const result = /* @__PURE__ */ new Map();
|
|
15239
|
+
for (let i = 0; i < len; i++) {
|
|
15240
|
+
const offset = bc.offset;
|
|
15241
|
+
const key = readString(bc);
|
|
15242
|
+
if (result.has(key)) {
|
|
15243
|
+
bc.offset = offset;
|
|
15244
|
+
throw new BareError(offset, "duplicated key");
|
|
15245
|
+
}
|
|
15246
|
+
result.set(key, readWorkflowBranchStatus(bc));
|
|
15134
15247
|
}
|
|
15135
|
-
return
|
|
15248
|
+
return result;
|
|
15136
15249
|
}
|
|
15137
|
-
function
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15250
|
+
function readWorkflowJoinEntry(bc) {
|
|
15251
|
+
return {
|
|
15252
|
+
branches: read2(bc)
|
|
15253
|
+
};
|
|
15254
|
+
}
|
|
15255
|
+
function readWorkflowRaceEntry(bc) {
|
|
15256
|
+
return {
|
|
15257
|
+
winner: read1(bc),
|
|
15258
|
+
branches: read2(bc)
|
|
15259
|
+
};
|
|
15260
|
+
}
|
|
15261
|
+
function readWorkflowRemovedEntry(bc) {
|
|
15262
|
+
return {
|
|
15263
|
+
originalType: readString(bc),
|
|
15264
|
+
originalName: read1(bc)
|
|
15265
|
+
};
|
|
15266
|
+
}
|
|
15267
|
+
function readWorkflowVersionCheckEntry(bc) {
|
|
15268
|
+
return {
|
|
15269
|
+
resolved: readU32(bc),
|
|
15270
|
+
latest: readU32(bc)
|
|
15271
|
+
};
|
|
15272
|
+
}
|
|
15273
|
+
function readWorkflowEntryKind(bc) {
|
|
15274
|
+
const offset = bc.offset;
|
|
15275
|
+
const tag = readU8(bc);
|
|
15276
|
+
switch (tag) {
|
|
15277
|
+
case 0:
|
|
15278
|
+
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
15279
|
+
case 1:
|
|
15280
|
+
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
15281
|
+
case 2:
|
|
15282
|
+
return {
|
|
15283
|
+
tag: "WorkflowSleepEntry",
|
|
15284
|
+
val: readWorkflowSleepEntry(bc)
|
|
15285
|
+
};
|
|
15286
|
+
case 3:
|
|
15287
|
+
return {
|
|
15288
|
+
tag: "WorkflowMessageEntry",
|
|
15289
|
+
val: readWorkflowMessageEntry(bc)
|
|
15290
|
+
};
|
|
15291
|
+
case 4:
|
|
15292
|
+
return {
|
|
15293
|
+
tag: "WorkflowRollbackCheckpointEntry",
|
|
15294
|
+
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
15295
|
+
};
|
|
15296
|
+
case 5:
|
|
15297
|
+
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
15298
|
+
case 6:
|
|
15299
|
+
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
15300
|
+
case 7:
|
|
15301
|
+
return {
|
|
15302
|
+
tag: "WorkflowRemovedEntry",
|
|
15303
|
+
val: readWorkflowRemovedEntry(bc)
|
|
15304
|
+
};
|
|
15305
|
+
case 8:
|
|
15306
|
+
return {
|
|
15307
|
+
tag: "WorkflowVersionCheckEntry",
|
|
15308
|
+
val: readWorkflowVersionCheckEntry(bc)
|
|
15309
|
+
};
|
|
15310
|
+
default: {
|
|
15311
|
+
bc.offset = offset;
|
|
15312
|
+
throw new BareError(offset, "invalid tag");
|
|
15313
|
+
}
|
|
15142
15314
|
}
|
|
15143
|
-
return run.inspector;
|
|
15144
15315
|
}
|
|
15145
|
-
function
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15316
|
+
function readWorkflowEntry(bc) {
|
|
15317
|
+
return {
|
|
15318
|
+
id: readString(bc),
|
|
15319
|
+
location: readWorkflowLocation(bc),
|
|
15320
|
+
kind: readWorkflowEntryKind(bc)
|
|
15321
|
+
};
|
|
15150
15322
|
}
|
|
15151
|
-
function
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15323
|
+
function read3(bc) {
|
|
15324
|
+
return readBool(bc) ? readU64(bc) : null;
|
|
15325
|
+
}
|
|
15326
|
+
function readWorkflowEntryMetadata(bc) {
|
|
15327
|
+
return {
|
|
15328
|
+
status: readWorkflowEntryStatus(bc),
|
|
15329
|
+
error: read1(bc),
|
|
15330
|
+
attempts: readU32(bc),
|
|
15331
|
+
lastAttemptAt: readU64(bc),
|
|
15332
|
+
createdAt: readU64(bc),
|
|
15333
|
+
completedAt: read3(bc),
|
|
15334
|
+
rollbackCompletedAt: read3(bc),
|
|
15335
|
+
rollbackError: read1(bc)
|
|
15336
|
+
};
|
|
15337
|
+
}
|
|
15338
|
+
function read4(bc) {
|
|
15339
|
+
const len = readUintSafe(bc);
|
|
15340
|
+
if (len === 0) {
|
|
15341
|
+
return [];
|
|
15155
15342
|
}
|
|
15156
|
-
const
|
|
15157
|
-
(
|
|
15343
|
+
const result = [readString(bc)];
|
|
15344
|
+
for (let i = 1; i < len; i++) {
|
|
15345
|
+
result[i] = readString(bc);
|
|
15346
|
+
}
|
|
15347
|
+
return result;
|
|
15158
15348
|
}
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
icon: external_exports.string().optional(),
|
|
15164
|
-
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
15165
|
-
enableActorRuntimeSocket: external_exports.boolean().default(false),
|
|
15166
|
-
/**
|
|
15167
|
-
* Can hibernate WebSockets for onWebSocket.
|
|
15168
|
-
*
|
|
15169
|
-
* WebSockets using actions/events are hibernatable by default.
|
|
15170
|
-
*
|
|
15171
|
-
* @experimental
|
|
15172
|
-
**/
|
|
15173
|
-
canHibernateWebSocket: external_exports.union([external_exports.boolean(), zFunction()]).default(false)
|
|
15174
|
-
}).strict();
|
|
15175
|
-
var GlobalActorOptionsSchema = GlobalActorOptionsBaseSchema.prefault(
|
|
15176
|
-
() => ({})
|
|
15177
|
-
);
|
|
15178
|
-
var InstanceActorOptionsBaseSchema = external_exports.object({
|
|
15179
|
-
createVarsTimeout: external_exports.number().positive().default(5e3),
|
|
15180
|
-
createConnStateTimeout: external_exports.number().positive().default(5e3),
|
|
15181
|
-
onBeforeConnectTimeout: external_exports.number().positive().default(5e3),
|
|
15182
|
-
onConnectTimeout: external_exports.number().positive().default(5e3),
|
|
15183
|
-
onMigrateTimeout: external_exports.number().positive().default(3e4),
|
|
15184
|
-
sleepGracePeriod: external_exports.number().positive().default(DEFAULT_SLEEP_GRACE_PERIOD),
|
|
15185
|
-
/** @deprecated `onDestroyTimeout` is folded into `sleepGracePeriod`, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0. */
|
|
15186
|
-
onDestroyTimeout: external_exports.number().positive().optional(),
|
|
15187
|
-
/** @deprecated `waitUntilTimeout` is folded into `sleepGracePeriod`, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0. */
|
|
15188
|
-
waitUntilTimeout: external_exports.number().positive().optional(),
|
|
15189
|
-
stateSaveInterval: external_exports.number().positive().default(1e3),
|
|
15190
|
-
actionTimeout: external_exports.number().positive().default(6e4),
|
|
15191
|
-
connectionLivenessTimeout: external_exports.number().positive().default(2500),
|
|
15192
|
-
connectionLivenessInterval: external_exports.number().positive().default(5e3),
|
|
15193
|
-
/** @deprecated Use `c.keepAwake(promise)` to scope keep-awake to a specific operation, or keep `noSleep` for actors that must stay awake indefinitely. Will be removed in 2.2.0. */
|
|
15194
|
-
noSleep: external_exports.boolean().default(false),
|
|
15195
|
-
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
15196
|
-
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
15197
|
-
/** Maximum pending one-shot and recurring schedules. */
|
|
15198
|
-
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
15199
|
-
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
15200
|
-
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
15201
|
-
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
15202
|
-
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
15203
|
-
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
15204
|
-
}).strict();
|
|
15205
|
-
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
15206
|
-
var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
15207
|
-
InstanceActorOptionsBaseSchema.shape
|
|
15208
|
-
).strict().prefault(() => ({}));
|
|
15209
|
-
var ActorConfigSchema = external_exports.object({
|
|
15210
|
-
onCreate: zFunction().optional(),
|
|
15211
|
-
onDestroy: zFunction().optional(),
|
|
15212
|
-
onMigrate: zFunction().optional(),
|
|
15213
|
-
onWake: zFunction().optional(),
|
|
15214
|
-
onSleep: zFunction().optional(),
|
|
15215
|
-
run: zRunHandler,
|
|
15216
|
-
onStateChange: zFunction().optional(),
|
|
15217
|
-
onBeforeConnect: zFunction().optional(),
|
|
15218
|
-
onConnect: zFunction().optional(),
|
|
15219
|
-
onDisconnect: zFunction().optional(),
|
|
15220
|
-
onBeforeActionResponse: zFunction().optional(),
|
|
15221
|
-
onRequest: zFunction().optional(),
|
|
15222
|
-
onWebSocket: zFunction().optional(),
|
|
15223
|
-
actions: zActionTree.default(() => ({})),
|
|
15224
|
-
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15225
|
-
connParamsSchema: external_exports.any().optional(),
|
|
15226
|
-
events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15227
|
-
queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15228
|
-
state: external_exports.any().optional(),
|
|
15229
|
-
createState: zFunction().optional(),
|
|
15230
|
-
connState: external_exports.any().optional(),
|
|
15231
|
-
createConnState: zFunction().optional(),
|
|
15232
|
-
vars: external_exports.any().optional(),
|
|
15233
|
-
db: external_exports.any().optional(),
|
|
15234
|
-
createVars: zFunction().optional(),
|
|
15235
|
-
options: ActorOptionsSchema,
|
|
15236
|
-
inspector: ActorInspectorConfigSchema.optional()
|
|
15237
|
-
}).strict().refine(
|
|
15238
|
-
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
15239
|
-
{
|
|
15240
|
-
message: "Cannot define both 'state' and 'createState'",
|
|
15241
|
-
path: ["state"]
|
|
15349
|
+
function read5(bc) {
|
|
15350
|
+
const len = readUintSafe(bc);
|
|
15351
|
+
if (len === 0) {
|
|
15352
|
+
return [];
|
|
15242
15353
|
}
|
|
15243
|
-
)
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15354
|
+
const result = [readWorkflowEntry(bc)];
|
|
15355
|
+
for (let i = 1; i < len; i++) {
|
|
15356
|
+
result[i] = readWorkflowEntry(bc);
|
|
15357
|
+
}
|
|
15358
|
+
return result;
|
|
15359
|
+
}
|
|
15360
|
+
function read6(bc) {
|
|
15361
|
+
const len = readUintSafe(bc);
|
|
15362
|
+
const result = /* @__PURE__ */ new Map();
|
|
15363
|
+
for (let i = 0; i < len; i++) {
|
|
15364
|
+
const offset = bc.offset;
|
|
15365
|
+
const key = readString(bc);
|
|
15366
|
+
if (result.has(key)) {
|
|
15367
|
+
bc.offset = offset;
|
|
15368
|
+
throw new BareError(offset, "duplicated key");
|
|
15369
|
+
}
|
|
15370
|
+
result.set(key, readWorkflowEntryMetadata(bc));
|
|
15248
15371
|
}
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15372
|
+
return result;
|
|
15373
|
+
}
|
|
15374
|
+
function readWorkflowHistory(bc) {
|
|
15375
|
+
return {
|
|
15376
|
+
nameRegistry: read4(bc),
|
|
15377
|
+
entries: read5(bc),
|
|
15378
|
+
entryMetadata: read6(bc)
|
|
15379
|
+
};
|
|
15380
|
+
}
|
|
15381
|
+
function decodeWorkflowHistory(bytes) {
|
|
15382
|
+
const bc = new ByteCursor(bytes, config2);
|
|
15383
|
+
const result = readWorkflowHistory(bc);
|
|
15384
|
+
if (bc.offset < bc.view.byteLength) {
|
|
15385
|
+
throw new BareError(bc.offset, "remaining bytes");
|
|
15254
15386
|
}
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
),
|
|
15261
|
-
enableActorRuntimeSocket: external_exports.boolean().optional().describe(
|
|
15262
|
-
"Enables the experimental Actor Runtime Socket for this actor. Default: false"
|
|
15263
|
-
),
|
|
15264
|
-
createVarsTimeout: external_exports.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
15265
|
-
createConnStateTimeout: external_exports.number().optional().describe(
|
|
15266
|
-
"Timeout in ms for createConnState handler. Default: 5000"
|
|
15267
|
-
),
|
|
15268
|
-
onMigrateTimeout: external_exports.number().optional().describe("Timeout in ms for onMigrate handler. Default: 30000"),
|
|
15269
|
-
onBeforeConnectTimeout: external_exports.number().optional().describe(
|
|
15270
|
-
"Timeout in ms for onBeforeConnect handler. Default: 5000"
|
|
15271
|
-
),
|
|
15272
|
-
onConnectTimeout: external_exports.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
15273
|
-
sleepGracePeriod: external_exports.number().optional().describe(
|
|
15274
|
-
`Max time in ms for the graceful shutdown window. Covers lifecycle hooks (onSleep, onDestroy), the run handler wait, async raw WebSocket handlers, disconnect callbacks, and final state serialization. Default: ${DEFAULT_SLEEP_GRACE_PERIOD}.`
|
|
15275
|
-
),
|
|
15276
|
-
onDestroyTimeout: external_exports.number().optional().describe(
|
|
15277
|
-
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
15278
|
-
),
|
|
15279
|
-
waitUntilTimeout: external_exports.number().optional().describe(
|
|
15280
|
-
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
15281
|
-
),
|
|
15282
|
-
stateSaveInterval: external_exports.number().optional().describe(
|
|
15283
|
-
"Interval in ms between automatic state saves. Default: 1000"
|
|
15284
|
-
),
|
|
15285
|
-
actionTimeout: external_exports.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
15286
|
-
connectionLivenessTimeout: external_exports.number().optional().describe(
|
|
15287
|
-
"Timeout in ms for connection liveness checks. Default: 2500"
|
|
15288
|
-
),
|
|
15289
|
-
connectionLivenessInterval: external_exports.number().optional().describe(
|
|
15290
|
-
"Interval in ms between connection liveness checks. Default: 5000"
|
|
15291
|
-
),
|
|
15292
|
-
noSleep: external_exports.boolean().optional().describe(
|
|
15293
|
-
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false"
|
|
15294
|
-
),
|
|
15295
|
-
sleepTimeout: external_exports.number().optional().describe(
|
|
15296
|
-
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
15297
|
-
),
|
|
15298
|
-
maxQueueSize: external_exports.number().optional().describe(
|
|
15299
|
-
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
15300
|
-
),
|
|
15301
|
-
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
15302
|
-
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
15303
|
-
),
|
|
15304
|
-
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
15305
|
-
"Maximum size of each queue message in bytes. Default: 65536"
|
|
15306
|
-
),
|
|
15307
|
-
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
15308
|
-
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
15309
|
-
)
|
|
15310
|
-
}).describe("Actor options for timeouts and behavior configuration.");
|
|
15311
|
-
var DocActorConfigSchema = external_exports.object({
|
|
15312
|
-
state: external_exports.unknown().optional().describe(
|
|
15313
|
-
"Initial state value for the actor. Cannot be used with createState."
|
|
15314
|
-
),
|
|
15315
|
-
createState: external_exports.unknown().optional().describe(
|
|
15316
|
-
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
15317
|
-
),
|
|
15318
|
-
connState: external_exports.unknown().optional().describe(
|
|
15319
|
-
"Initial connection state value. Cannot be used with createConnState."
|
|
15320
|
-
),
|
|
15321
|
-
createConnState: external_exports.unknown().optional().describe(
|
|
15322
|
-
"Function to create connection state. Receives context and connection params. The pending connection is not visible in c.conns until this succeeds. Cannot be used with connState."
|
|
15323
|
-
),
|
|
15324
|
-
vars: external_exports.unknown().optional().describe(
|
|
15325
|
-
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
15326
|
-
),
|
|
15327
|
-
createVars: external_exports.unknown().optional().describe(
|
|
15328
|
-
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
15329
|
-
),
|
|
15330
|
-
db: external_exports.unknown().optional().describe("Database provider instance for the actor."),
|
|
15331
|
-
onCreate: external_exports.unknown().optional().describe(
|
|
15332
|
-
"Called when the actor is first initialized. Use to initialize state."
|
|
15333
|
-
),
|
|
15334
|
-
onDestroy: external_exports.unknown().optional().describe("Called when the actor is destroyed."),
|
|
15335
|
-
onMigrate: external_exports.unknown().optional().describe(
|
|
15336
|
-
"Called on every actor start after persisted state loads and before onWake. Use for repeatable schema migrations."
|
|
15337
|
-
),
|
|
15338
|
-
onWake: external_exports.unknown().optional().describe(
|
|
15339
|
-
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
15340
|
-
),
|
|
15341
|
-
onSleep: external_exports.unknown().optional().describe(
|
|
15342
|
-
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
15343
|
-
),
|
|
15344
|
-
run: external_exports.unknown().optional().describe(
|
|
15345
|
-
"Called after actor starts. Does not block startup. Use for background tasks like queue processing or tick loops. If it exits, the actor follows the normal idle sleep timeout once idle. If it throws, the actor logs the error and then follows the normal idle sleep timeout once idle."
|
|
15346
|
-
),
|
|
15347
|
-
onStateChange: external_exports.unknown().optional().describe(
|
|
15348
|
-
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
15349
|
-
),
|
|
15350
|
-
onBeforeConnect: external_exports.unknown().optional().describe(
|
|
15351
|
-
"Called before a client connects. Throw an error to reject the connection. The pending connection is not visible in c.conns while this runs."
|
|
15352
|
-
),
|
|
15353
|
-
onConnect: external_exports.unknown().optional().describe(
|
|
15354
|
-
"Called when a client successfully connects. The connection is visible in c.conns before this runs."
|
|
15355
|
-
),
|
|
15356
|
-
onDisconnect: external_exports.unknown().optional().describe("Called when a client disconnects."),
|
|
15357
|
-
onBeforeActionResponse: external_exports.unknown().optional().describe(
|
|
15358
|
-
"Called before sending an action response. Use to transform output."
|
|
15359
|
-
),
|
|
15360
|
-
onRequest: external_exports.unknown().optional().describe(
|
|
15361
|
-
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
15362
|
-
),
|
|
15363
|
-
onWebSocket: external_exports.unknown().optional().describe(
|
|
15364
|
-
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
15365
|
-
),
|
|
15366
|
-
actions: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
15367
|
-
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object."
|
|
15368
|
-
),
|
|
15369
|
-
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
15370
|
-
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
|
|
15371
|
-
),
|
|
15372
|
-
connParamsSchema: external_exports.unknown().optional().describe(
|
|
15373
|
-
"Optional schema for validating connection params in native runtimes."
|
|
15374
|
-
),
|
|
15375
|
-
events: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of event names to schemas."),
|
|
15376
|
-
queues: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of queue names to schemas."),
|
|
15377
|
-
options: DocActorOptionsSchema.optional()
|
|
15378
|
-
}).describe("Actor configuration passed to the actor() function.");
|
|
15387
|
+
return result;
|
|
15388
|
+
}
|
|
15389
|
+
function decodeWorkflowHistoryTransport(data) {
|
|
15390
|
+
return decodeWorkflowHistory(toUint8Array(data));
|
|
15391
|
+
}
|
|
15379
15392
|
|
|
15380
15393
|
// ../rivetkit/dist/tsup/chunk-JI6GZ2C2.js
|
|
15381
15394
|
var EMPTY_KEY = "/";
|
|
@@ -15494,6 +15507,44 @@ function removePrefixFromKey(prefixedKey) {
|
|
|
15494
15507
|
return prefixedKey.slice(KEYS.KV.length);
|
|
15495
15508
|
}
|
|
15496
15509
|
|
|
15510
|
+
// ../rivetkit/dist/tsup/chunk-ZEIH7S4M.js
|
|
15511
|
+
function logger() {
|
|
15512
|
+
return getLogger("actor-client");
|
|
15513
|
+
}
|
|
15514
|
+
var webSocketPromise = null;
|
|
15515
|
+
async function importWebSocket() {
|
|
15516
|
+
if (webSocketPromise !== null) {
|
|
15517
|
+
return webSocketPromise;
|
|
15518
|
+
}
|
|
15519
|
+
webSocketPromise = (async () => {
|
|
15520
|
+
let _WebSocket;
|
|
15521
|
+
if (typeof WebSocket !== "undefined") {
|
|
15522
|
+
_WebSocket = WebSocket;
|
|
15523
|
+
} else {
|
|
15524
|
+
try {
|
|
15525
|
+
const moduleName = "ws";
|
|
15526
|
+
const ws = await import(
|
|
15527
|
+
/* webpackIgnore: true */
|
|
15528
|
+
moduleName
|
|
15529
|
+
);
|
|
15530
|
+
_WebSocket = ws.default;
|
|
15531
|
+
logger().debug("using websocket from npm");
|
|
15532
|
+
} catch {
|
|
15533
|
+
_WebSocket = class MockWebSocket {
|
|
15534
|
+
constructor() {
|
|
15535
|
+
throw new Error(
|
|
15536
|
+
'WebSocket support requires installing the "ws" peer dependency.'
|
|
15537
|
+
);
|
|
15538
|
+
}
|
|
15539
|
+
};
|
|
15540
|
+
logger().debug("using mock websocket");
|
|
15541
|
+
}
|
|
15542
|
+
}
|
|
15543
|
+
return _WebSocket;
|
|
15544
|
+
})();
|
|
15545
|
+
return webSocketPromise;
|
|
15546
|
+
}
|
|
15547
|
+
|
|
15497
15548
|
// ../rivetkit/dist/tsup/chunk-JTHHCZCZ.js
|
|
15498
15549
|
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
15499
15550
|
function isManualTransactionControl(query) {
|
|
@@ -15577,45 +15628,7 @@ var AsyncMutex = class {
|
|
|
15577
15628
|
}
|
|
15578
15629
|
};
|
|
15579
15630
|
|
|
15580
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15581
|
-
function logger() {
|
|
15582
|
-
return getLogger("actor-client");
|
|
15583
|
-
}
|
|
15584
|
-
var webSocketPromise = null;
|
|
15585
|
-
async function importWebSocket() {
|
|
15586
|
-
if (webSocketPromise !== null) {
|
|
15587
|
-
return webSocketPromise;
|
|
15588
|
-
}
|
|
15589
|
-
webSocketPromise = (async () => {
|
|
15590
|
-
let _WebSocket;
|
|
15591
|
-
if (typeof WebSocket !== "undefined") {
|
|
15592
|
-
_WebSocket = WebSocket;
|
|
15593
|
-
} else {
|
|
15594
|
-
try {
|
|
15595
|
-
const moduleName = "ws";
|
|
15596
|
-
const ws = await import(
|
|
15597
|
-
/* webpackIgnore: true */
|
|
15598
|
-
moduleName
|
|
15599
|
-
);
|
|
15600
|
-
_WebSocket = ws.default;
|
|
15601
|
-
logger().debug("using websocket from npm");
|
|
15602
|
-
} catch {
|
|
15603
|
-
_WebSocket = class MockWebSocket {
|
|
15604
|
-
constructor() {
|
|
15605
|
-
throw new Error(
|
|
15606
|
-
'WebSocket support requires installing the "ws" peer dependency.'
|
|
15607
|
-
);
|
|
15608
|
-
}
|
|
15609
|
-
};
|
|
15610
|
-
logger().debug("using mock websocket");
|
|
15611
|
-
}
|
|
15612
|
-
}
|
|
15613
|
-
return _WebSocket;
|
|
15614
|
-
})();
|
|
15615
|
-
return webSocketPromise;
|
|
15616
|
-
}
|
|
15617
|
-
|
|
15618
|
-
// ../rivetkit/dist/tsup/chunk-3ZR542SK.js
|
|
15631
|
+
// ../rivetkit/dist/tsup/chunk-BK2JOGQQ.js
|
|
15619
15632
|
var import_invariant2 = __toESM(require_invariant(), 1);
|
|
15620
15633
|
|
|
15621
15634
|
// ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
@@ -15793,7 +15806,7 @@ function createVersionedDataHandler(config3) {
|
|
|
15793
15806
|
return new VersionedDataHandler(config3);
|
|
15794
15807
|
}
|
|
15795
15808
|
|
|
15796
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15809
|
+
// ../rivetkit/dist/tsup/chunk-BK2JOGQQ.js
|
|
15797
15810
|
var import_invariant3 = __toESM(require_invariant(), 1);
|
|
15798
15811
|
var import_invariant4 = __toESM(require_invariant(), 1);
|
|
15799
15812
|
var PATH_CONNECT = "/connect";
|
|
@@ -15848,12 +15861,12 @@ var ActorConnDisposed = class extends ActorClientError {
|
|
|
15848
15861
|
function isSchedulingError(group, code) {
|
|
15849
15862
|
return group === "guard" && (code === "actor_ready_timeout" || code === "actor_runner_failed");
|
|
15850
15863
|
}
|
|
15851
|
-
function actorSchedulingError(group, code, actorId, details) {
|
|
15864
|
+
function actorSchedulingError(group, code, actorId, details, rayId) {
|
|
15852
15865
|
return new RivetError(
|
|
15853
15866
|
group,
|
|
15854
15867
|
code,
|
|
15855
15868
|
`Actor failed to start (${actorId}): ${JSON.stringify(details)}`,
|
|
15856
|
-
{ metadata: { actorId, details } }
|
|
15869
|
+
{ metadata: { actorId, details }, rayId }
|
|
15857
15870
|
);
|
|
15858
15871
|
}
|
|
15859
15872
|
function internalClientError(message, opts) {
|
|
@@ -17833,7 +17846,7 @@ function getGatewayTarget(state) {
|
|
|
17833
17846
|
function isStaleResolvedActorError(group, code) {
|
|
17834
17847
|
return group === "actor" && (code === "not_found" || code === "starting" || code === "stopping" || code === "not_configured" || code === "dropped_reply" || code.startsWith("destroyed_"));
|
|
17835
17848
|
}
|
|
17836
|
-
async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
17849
|
+
async function checkForSchedulingError(group, code, actorId, query, driver, rayId) {
|
|
17837
17850
|
const name = getActorNameFromQuery(query);
|
|
17838
17851
|
try {
|
|
17839
17852
|
const actor2 = await driver.getForId({ name, actorId });
|
|
@@ -17843,7 +17856,13 @@ async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
|
17843
17856
|
actorId,
|
|
17844
17857
|
error: actor2.error
|
|
17845
17858
|
});
|
|
17846
|
-
return actorSchedulingError(
|
|
17859
|
+
return actorSchedulingError(
|
|
17860
|
+
group,
|
|
17861
|
+
code,
|
|
17862
|
+
actorId,
|
|
17863
|
+
actor2.error,
|
|
17864
|
+
rayId
|
|
17865
|
+
);
|
|
17847
17866
|
}
|
|
17848
17867
|
} catch (err) {
|
|
17849
17868
|
logger().warn({
|
|
@@ -18160,6 +18179,7 @@ async function sendHttpRequest(opts) {
|
|
|
18160
18179
|
code: responseData.code,
|
|
18161
18180
|
message: responseData.message,
|
|
18162
18181
|
metadata: responseData.metadata,
|
|
18182
|
+
rayId,
|
|
18163
18183
|
actorId: (_a2 = responseData.actor) == null ? void 0 : _a2.actorId,
|
|
18164
18184
|
generation: (_b = responseData.actor) == null ? void 0 : _b.generation,
|
|
18165
18185
|
actorKey: (_c = responseData.actor) == null ? void 0 : _c.key
|
|
@@ -18170,6 +18190,7 @@ async function sendHttpRequest(opts) {
|
|
|
18170
18190
|
responseData.message,
|
|
18171
18191
|
{
|
|
18172
18192
|
metadata: responseData.metadata,
|
|
18193
|
+
rayId: rayId ?? void 0,
|
|
18173
18194
|
actor: responseData.actor
|
|
18174
18195
|
}
|
|
18175
18196
|
);
|
|
@@ -18349,11 +18370,8 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
18349
18370
|
});
|
|
18350
18371
|
return driver.sendRequest(target, proxyRequest, options);
|
|
18351
18372
|
} catch (err) {
|
|
18352
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(
|
|
18353
|
-
|
|
18354
|
-
true
|
|
18355
|
-
);
|
|
18356
|
-
throw new RivetError(group, code, message, { metadata, actor: actor2 });
|
|
18373
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18374
|
+
throw new RivetError(group, code, message, { metadata, rayId, actor: actor2 });
|
|
18357
18375
|
}
|
|
18358
18376
|
}
|
|
18359
18377
|
async function rawWebSocket(driver, target, params, path2, _protocols, options = {}) {
|
|
@@ -18492,7 +18510,7 @@ var ActorHandleRaw = class {
|
|
|
18492
18510
|
}
|
|
18493
18511
|
}).send(name, body, options);
|
|
18494
18512
|
} catch (err) {
|
|
18495
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(err, true);
|
|
18513
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18496
18514
|
if (this.#shouldRetryQueueDispatchOverload(
|
|
18497
18515
|
group,
|
|
18498
18516
|
code,
|
|
@@ -18508,7 +18526,8 @@ var ActorHandleRaw = class {
|
|
|
18508
18526
|
code,
|
|
18509
18527
|
actorId,
|
|
18510
18528
|
attempt,
|
|
18511
|
-
maxAttempts
|
|
18529
|
+
maxAttempts,
|
|
18530
|
+
rayId
|
|
18512
18531
|
)) {
|
|
18513
18532
|
useQueryTarget = true;
|
|
18514
18533
|
await this.#waitForRetryWindow();
|
|
@@ -18538,6 +18557,7 @@ var ActorHandleRaw = class {
|
|
|
18538
18557
|
}
|
|
18539
18558
|
throw new RivetError(group, code, message, {
|
|
18540
18559
|
metadata,
|
|
18560
|
+
rayId,
|
|
18541
18561
|
actor: actor2
|
|
18542
18562
|
});
|
|
18543
18563
|
}
|
|
@@ -18631,13 +18651,14 @@ var ActorHandleRaw = class {
|
|
|
18631
18651
|
}
|
|
18632
18652
|
return output;
|
|
18633
18653
|
} catch (err) {
|
|
18634
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(err, true);
|
|
18654
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18635
18655
|
if (await this.#shouldRetrySchedulingError(
|
|
18636
18656
|
group,
|
|
18637
18657
|
code,
|
|
18638
18658
|
actorId,
|
|
18639
18659
|
attempt,
|
|
18640
|
-
maxAttempts
|
|
18660
|
+
maxAttempts,
|
|
18661
|
+
rayId
|
|
18641
18662
|
)) {
|
|
18642
18663
|
useQueryTarget = true;
|
|
18643
18664
|
await this.#waitForRetryWindow();
|
|
@@ -18659,7 +18680,7 @@ var ActorHandleRaw = class {
|
|
|
18659
18680
|
"actor",
|
|
18660
18681
|
"not_found",
|
|
18661
18682
|
"The actor does not exist or was destroyed.",
|
|
18662
|
-
{ metadata, actor: actor2 }
|
|
18683
|
+
{ metadata, rayId, actor: actor2 }
|
|
18663
18684
|
);
|
|
18664
18685
|
}
|
|
18665
18686
|
const invalidated = this.#invalidateResolvedActorId(
|
|
@@ -18675,7 +18696,11 @@ var ActorHandleRaw = class {
|
|
|
18675
18696
|
}
|
|
18676
18697
|
continue;
|
|
18677
18698
|
}
|
|
18678
|
-
throw new RivetError(group, code, message, {
|
|
18699
|
+
throw new RivetError(group, code, message, {
|
|
18700
|
+
metadata,
|
|
18701
|
+
rayId,
|
|
18702
|
+
actor: actor2
|
|
18703
|
+
});
|
|
18679
18704
|
}
|
|
18680
18705
|
}
|
|
18681
18706
|
throw new Error("unreachable action retry state");
|
|
@@ -18717,7 +18742,7 @@ var ActorHandleRaw = class {
|
|
|
18717
18742
|
this.#resolvedActorId = void 0;
|
|
18718
18743
|
this.#resolvingActorId = void 0;
|
|
18719
18744
|
}
|
|
18720
|
-
async #shouldRetrySchedulingError(group, code, actorId, attempt, maxAttempts) {
|
|
18745
|
+
async #shouldRetrySchedulingError(group, code, actorId, attempt, maxAttempts, rayId) {
|
|
18721
18746
|
if (!isDynamicActorQuery(this.#actorResolutionState) || !isSchedulingError(group, code) || attempt >= maxAttempts - 1) {
|
|
18722
18747
|
return false;
|
|
18723
18748
|
}
|
|
@@ -18727,7 +18752,8 @@ var ActorHandleRaw = class {
|
|
|
18727
18752
|
code,
|
|
18728
18753
|
actorId,
|
|
18729
18754
|
this.#actorResolutionState,
|
|
18730
|
-
this.#driver
|
|
18755
|
+
this.#driver,
|
|
18756
|
+
rayId
|
|
18731
18757
|
);
|
|
18732
18758
|
if (schedulingError) {
|
|
18733
18759
|
throw schedulingError;
|
|
@@ -18848,13 +18874,14 @@ var ActorHandleRaw = class {
|
|
|
18848
18874
|
}
|
|
18849
18875
|
return response;
|
|
18850
18876
|
} catch (err) {
|
|
18851
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(err, true);
|
|
18877
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18852
18878
|
if (await this.#shouldRetrySchedulingError(
|
|
18853
18879
|
group,
|
|
18854
18880
|
code,
|
|
18855
18881
|
actorId,
|
|
18856
18882
|
attempt,
|
|
18857
|
-
maxAttempts
|
|
18883
|
+
maxAttempts,
|
|
18884
|
+
rayId
|
|
18858
18885
|
)) {
|
|
18859
18886
|
useQueryTarget = true;
|
|
18860
18887
|
await this.#waitForRetryWindow();
|
|
@@ -18882,7 +18909,11 @@ var ActorHandleRaw = class {
|
|
|
18882
18909
|
}
|
|
18883
18910
|
continue;
|
|
18884
18911
|
}
|
|
18885
|
-
throw new RivetError(group, code, message, {
|
|
18912
|
+
throw new RivetError(group, code, message, {
|
|
18913
|
+
metadata,
|
|
18914
|
+
rayId,
|
|
18915
|
+
actor: actor2
|
|
18916
|
+
});
|
|
18886
18917
|
}
|
|
18887
18918
|
}
|
|
18888
18919
|
throw new Error("unreachable fetch retry state");
|
|
@@ -18895,13 +18926,14 @@ var ActorHandleRaw = class {
|
|
|
18895
18926
|
if (!error46) {
|
|
18896
18927
|
return null;
|
|
18897
18928
|
}
|
|
18898
|
-
const { group, code } = error46;
|
|
18929
|
+
const { group, code, rayId } = error46;
|
|
18899
18930
|
if (await this.#shouldRetrySchedulingError(
|
|
18900
18931
|
group,
|
|
18901
18932
|
code,
|
|
18902
18933
|
actorId,
|
|
18903
18934
|
attempt,
|
|
18904
|
-
maxAttempts
|
|
18935
|
+
maxAttempts,
|
|
18936
|
+
rayId
|
|
18905
18937
|
)) {
|
|
18906
18938
|
return {
|
|
18907
18939
|
useQueryTarget: true,
|
|
@@ -18937,7 +18969,7 @@ var ActorHandleRaw = class {
|
|
|
18937
18969
|
const contentType = response.headers.get("content-type");
|
|
18938
18970
|
const encoding = (contentType == null ? void 0 : contentType.includes("application/json")) ? "json" : this.#encoding;
|
|
18939
18971
|
try {
|
|
18940
|
-
|
|
18972
|
+
const error46 = deserializeWithEncoding(
|
|
18941
18973
|
encoding,
|
|
18942
18974
|
new Uint8Array(await response.clone().arrayBuffer()),
|
|
18943
18975
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -18961,6 +18993,10 @@ var ActorHandleRaw = class {
|
|
|
18961
18993
|
} : void 0
|
|
18962
18994
|
})
|
|
18963
18995
|
);
|
|
18996
|
+
return {
|
|
18997
|
+
...error46,
|
|
18998
|
+
rayId: response.headers.get("x-rivet-ray-id") ?? void 0
|
|
18999
|
+
};
|
|
18964
19000
|
} catch {
|
|
18965
19001
|
return null;
|
|
18966
19002
|
}
|
|
@@ -19024,7 +19060,9 @@ var ActorHandleRaw = class {
|
|
|
19024
19060
|
"actor",
|
|
19025
19061
|
"reload_failed",
|
|
19026
19062
|
`reload failed with status ${response.status}: ${body}`,
|
|
19027
|
-
{
|
|
19063
|
+
{
|
|
19064
|
+
rayId: response.headers.get("x-rivet-ray-id") ?? void 0
|
|
19065
|
+
}
|
|
19028
19066
|
);
|
|
19029
19067
|
}
|
|
19030
19068
|
}
|
|
@@ -19878,7 +19916,7 @@ var ActorConnRaw = class {
|
|
|
19878
19916
|
const reason = closeEvent.reason || "";
|
|
19879
19917
|
const parsed = parseWebSocketCloseReason(reason);
|
|
19880
19918
|
if (parsed) {
|
|
19881
|
-
const { group, code } = parsed;
|
|
19919
|
+
const { group, code, rayId } = parsed;
|
|
19882
19920
|
if (this.#shouldReconnectForStaleActor(group, code)) {
|
|
19883
19921
|
this.#clearResolvedActorIdentity();
|
|
19884
19922
|
(_a2 = this.#onOpenPromise) == null ? void 0 : _a2.reject(
|
|
@@ -19886,7 +19924,7 @@ var ActorConnRaw = class {
|
|
|
19886
19924
|
group,
|
|
19887
19925
|
code,
|
|
19888
19926
|
`Connection closed: ${reason}`,
|
|
19889
|
-
|
|
19927
|
+
{ rayId }
|
|
19890
19928
|
)
|
|
19891
19929
|
);
|
|
19892
19930
|
return;
|
|
@@ -19897,7 +19935,8 @@ var ActorConnRaw = class {
|
|
|
19897
19935
|
code,
|
|
19898
19936
|
this.#actorId,
|
|
19899
19937
|
this.#actorResolutionState,
|
|
19900
|
-
this.#driver
|
|
19938
|
+
this.#driver,
|
|
19939
|
+
rayId
|
|
19901
19940
|
);
|
|
19902
19941
|
if (schedulingError) {
|
|
19903
19942
|
error46 = schedulingError;
|
|
@@ -19906,7 +19945,7 @@ var ActorConnRaw = class {
|
|
|
19906
19945
|
group,
|
|
19907
19946
|
code,
|
|
19908
19947
|
`Connection closed: ${reason}`,
|
|
19909
|
-
|
|
19948
|
+
{ rayId }
|
|
19910
19949
|
);
|
|
19911
19950
|
}
|
|
19912
19951
|
} else {
|
|
@@ -19914,7 +19953,7 @@ var ActorConnRaw = class {
|
|
|
19914
19953
|
group,
|
|
19915
19954
|
code,
|
|
19916
19955
|
`Connection closed: ${reason}`,
|
|
19917
|
-
|
|
19956
|
+
{ rayId }
|
|
19918
19957
|
);
|
|
19919
19958
|
}
|
|
19920
19959
|
this.#invalidateActorIfStale(group, code);
|
|
@@ -21509,7 +21548,7 @@ function apiActorToOutput(actor2) {
|
|
|
21509
21548
|
};
|
|
21510
21549
|
}
|
|
21511
21550
|
|
|
21512
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
21551
|
+
// ../rivetkit/dist/tsup/chunk-KRQI5GXM.js
|
|
21513
21552
|
var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
|
|
21514
21553
|
var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
|
|
21515
21554
|
function registerNativeStateTransactionOpener(provider, opener) {
|
|
@@ -26406,7 +26445,8 @@ function encodeNativeCallbackError(error46) {
|
|
|
26406
26445
|
return Object.assign(bridgeError, {
|
|
26407
26446
|
group: structuredError.group,
|
|
26408
26447
|
code: structuredError.code,
|
|
26409
|
-
metadata: structuredError.metadata
|
|
26448
|
+
metadata: structuredError.metadata,
|
|
26449
|
+
rayId: structuredError.rayId
|
|
26410
26450
|
});
|
|
26411
26451
|
}
|
|
26412
26452
|
async function callNative(invoke) {
|