@rivetkit/supabase 2.3.12-rc.1 → 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.js
CHANGED
|
@@ -335,183 +335,6 @@ __export(mod_exports, {
|
|
|
335
335
|
module.exports = __toCommonJS(mod_exports);
|
|
336
336
|
var wasmBindings = __toESM(require("@rivetkit/rivetkit-wasm"));
|
|
337
337
|
|
|
338
|
-
// ../rivetkit/dist/tsup/chunk-ZZ3WBRPD.js
|
|
339
|
-
var INTERNAL_ERROR_CODE = "internal_error";
|
|
340
|
-
var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
341
|
-
var USER_ERROR_CODE = "user_error";
|
|
342
|
-
var BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
343
|
-
function looksLikeRivetErrorOptions(value) {
|
|
344
|
-
return typeof value === "object" && value !== null && ("public" in value || "metadata" in value || "statusCode" in value || "actor" in value || "cause" in value);
|
|
345
|
-
}
|
|
346
|
-
function isTypedErrorTag(value) {
|
|
347
|
-
return value === "ActorError" || value === "RivetError";
|
|
348
|
-
}
|
|
349
|
-
function errorMessage(error46, fallback = String(error46)) {
|
|
350
|
-
if (error46 && typeof error46 === "object" && "message" in error46 && typeof error46.message === "string") {
|
|
351
|
-
return error46.message;
|
|
352
|
-
}
|
|
353
|
-
return fallback;
|
|
354
|
-
}
|
|
355
|
-
function isRivetErrorLike(error46) {
|
|
356
|
-
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));
|
|
357
|
-
}
|
|
358
|
-
function isActorAbortedError(error46) {
|
|
359
|
-
return isRivetErrorLike(error46) && error46.group === "actor" && error46.code === "aborted";
|
|
360
|
-
}
|
|
361
|
-
function isActorSpecifier(value) {
|
|
362
|
-
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");
|
|
363
|
-
}
|
|
364
|
-
var RivetError = class extends Error {
|
|
365
|
-
__type = "RivetError";
|
|
366
|
-
public;
|
|
367
|
-
metadata;
|
|
368
|
-
statusCode;
|
|
369
|
-
actor;
|
|
370
|
-
group;
|
|
371
|
-
code;
|
|
372
|
-
static isRivetError(error46) {
|
|
373
|
-
return isRivetErrorLike(error46);
|
|
374
|
-
}
|
|
375
|
-
static isActorError(error46) {
|
|
376
|
-
return isRivetErrorLike(error46);
|
|
377
|
-
}
|
|
378
|
-
constructor(group, code, message, options) {
|
|
379
|
-
const normalized = looksLikeRivetErrorOptions(options) ? options : { metadata: options };
|
|
380
|
-
super(message, { cause: normalized.cause });
|
|
381
|
-
this.name = "RivetError";
|
|
382
|
-
this.group = group;
|
|
383
|
-
this.code = code;
|
|
384
|
-
this.public = normalized.public ?? false;
|
|
385
|
-
this.metadata = normalized.metadata;
|
|
386
|
-
this.statusCode = normalized.statusCode ?? (this.public ? 400 : 500);
|
|
387
|
-
this.actor = normalized.actor;
|
|
388
|
-
}
|
|
389
|
-
toString() {
|
|
390
|
-
return this.message;
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
var UserError = class extends RivetError {
|
|
394
|
-
constructor(message, options) {
|
|
395
|
-
super("user", (options == null ? void 0 : options.code) ?? USER_ERROR_CODE, message, {
|
|
396
|
-
public: true,
|
|
397
|
-
metadata: options == null ? void 0 : options.metadata,
|
|
398
|
-
cause: options == null ? void 0 : options.cause
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
function toRivetError(error46, fallback) {
|
|
403
|
-
if (typeof error46 === "string") {
|
|
404
|
-
const bridged = decodeBridgeRivetError(error46);
|
|
405
|
-
if (bridged) {
|
|
406
|
-
return bridged;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
if (error46 instanceof Error) {
|
|
410
|
-
const bridged = decodeBridgeRivetError(error46.message);
|
|
411
|
-
if (bridged) {
|
|
412
|
-
return bridged;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (isRivetErrorLike(error46)) {
|
|
416
|
-
return new RivetError(error46.group, error46.code, error46.message, {
|
|
417
|
-
public: error46.public,
|
|
418
|
-
statusCode: error46.statusCode,
|
|
419
|
-
metadata: error46.metadata,
|
|
420
|
-
actor: error46.actor,
|
|
421
|
-
cause: error46 instanceof Error ? error46.cause : void 0
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
return new RivetError(
|
|
425
|
-
(fallback == null ? void 0 : fallback.group) ?? "actor",
|
|
426
|
-
(fallback == null ? void 0 : fallback.code) ?? INTERNAL_ERROR_CODE,
|
|
427
|
-
errorMessage(error46, (fallback == null ? void 0 : fallback.message) ?? "Unknown error"),
|
|
428
|
-
{
|
|
429
|
-
public: fallback == null ? void 0 : fallback.public,
|
|
430
|
-
statusCode: fallback == null ? void 0 : fallback.statusCode,
|
|
431
|
-
metadata: fallback == null ? void 0 : fallback.metadata,
|
|
432
|
-
actor: fallback == null ? void 0 : fallback.actor,
|
|
433
|
-
cause: error46 instanceof Error ? error46 : void 0
|
|
434
|
-
}
|
|
435
|
-
);
|
|
436
|
-
}
|
|
437
|
-
function encodeBridgeRivetError(error46) {
|
|
438
|
-
return `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
|
|
439
|
-
group: error46.group,
|
|
440
|
-
code: error46.code,
|
|
441
|
-
message: error46.message,
|
|
442
|
-
metadata: error46.metadata,
|
|
443
|
-
public: error46.public,
|
|
444
|
-
statusCode: error46.statusCode,
|
|
445
|
-
actor: error46.actor
|
|
446
|
-
})}`;
|
|
447
|
-
}
|
|
448
|
-
function decodeBridgeRivetErrorPayload(value) {
|
|
449
|
-
if (!value.startsWith(BRIDGE_RIVET_ERROR_PREFIX)) {
|
|
450
|
-
return void 0;
|
|
451
|
-
}
|
|
452
|
-
try {
|
|
453
|
-
const payload = JSON.parse(
|
|
454
|
-
value.slice(BRIDGE_RIVET_ERROR_PREFIX.length)
|
|
455
|
-
);
|
|
456
|
-
if (!isRivetErrorLike(payload)) {
|
|
457
|
-
return void 0;
|
|
458
|
-
}
|
|
459
|
-
if (payload.actor !== void 0 && payload.actor !== null && !isActorSpecifier(payload.actor)) {
|
|
460
|
-
return void 0;
|
|
461
|
-
}
|
|
462
|
-
return payload;
|
|
463
|
-
} catch {
|
|
464
|
-
return void 0;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
function decodeBridgeRivetError(value) {
|
|
468
|
-
const payload = decodeBridgeRivetErrorPayload(value);
|
|
469
|
-
if (!payload) {
|
|
470
|
-
return void 0;
|
|
471
|
-
}
|
|
472
|
-
return new RivetError(payload.group, payload.code, payload.message, {
|
|
473
|
-
metadata: payload.metadata,
|
|
474
|
-
public: payload.public,
|
|
475
|
-
statusCode: payload.statusCode,
|
|
476
|
-
actor: payload.actor ?? void 0
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
function invalidRequest(error46) {
|
|
480
|
-
return new RivetError(
|
|
481
|
-
"request",
|
|
482
|
-
"invalid",
|
|
483
|
-
`Invalid request: ${errorMessage(error46, String(error46))}`,
|
|
484
|
-
{
|
|
485
|
-
public: true,
|
|
486
|
-
cause: error46 instanceof Error ? error46 : void 0
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
function actorNotFound(identifier) {
|
|
491
|
-
return new RivetError(
|
|
492
|
-
"actor",
|
|
493
|
-
"not_found",
|
|
494
|
-
identifier ? `Actor not found: ${identifier} (https://www.rivet.dev/docs/clients/javascript)` : "Actor not found (https://www.rivet.dev/docs/clients/javascript)",
|
|
495
|
-
{ public: true }
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
function forbiddenError() {
|
|
499
|
-
return new RivetError("auth", "forbidden", "Forbidden", {
|
|
500
|
-
public: true,
|
|
501
|
-
statusCode: 403
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
function unsupportedFeature(feature) {
|
|
505
|
-
return new RivetError(
|
|
506
|
-
"feature",
|
|
507
|
-
"unsupported",
|
|
508
|
-
`Unsupported feature: ${feature}`
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// ../rivetkit/dist/tsup/chunk-HVHDZDM2.js
|
|
513
|
-
var import_pino = require("pino");
|
|
514
|
-
|
|
515
338
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/external.js
|
|
516
339
|
var external_exports = {};
|
|
517
340
|
__export(external_exports, {
|
|
@@ -13182,67 +13005,716 @@ var classic_default = external_exports;
|
|
|
13182
13005
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
|
|
13183
13006
|
var v4_default = classic_default;
|
|
13184
13007
|
|
|
13185
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
13191
|
-
var getRivetNamespace = () => getEnvUniversal("RIVET_NAMESPACE");
|
|
13192
|
-
var getRivetPool = () => getEnvUniversal("RIVET_POOL");
|
|
13193
|
-
var getRivetTotalSlots = () => {
|
|
13194
|
-
const value = getEnvUniversal("RIVET_TOTAL_SLOTS");
|
|
13195
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13196
|
-
};
|
|
13197
|
-
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
13198
|
-
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
13199
|
-
var getRivetRunEnginePort = () => {
|
|
13200
|
-
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
13201
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13202
|
-
};
|
|
13203
|
-
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
13204
|
-
var getRivetEnvoyVersion = () => {
|
|
13205
|
-
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
13206
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13207
|
-
};
|
|
13208
|
-
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
13209
|
-
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
13210
|
-
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
13211
|
-
var getRivetkitRuntimeMode = () => {
|
|
13212
|
-
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
13213
|
-
if (value === void 0) return "envoy";
|
|
13214
|
-
if (value === "envoy" || value === "serverless") return value;
|
|
13215
|
-
throw new Error(
|
|
13216
|
-
`RIVETKIT_RUNTIME_MODE env var must be "envoy" or "serverless"; got "${value}"`
|
|
13217
|
-
);
|
|
13218
|
-
};
|
|
13219
|
-
var getRivetkitPublicDir = () => {
|
|
13220
|
-
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
13221
|
-
return value === void 0 || value === "" ? void 0 : value;
|
|
13222
|
-
};
|
|
13223
|
-
function parsePortEnv(raw) {
|
|
13224
|
-
if (raw === void 0 || raw === "") return void 0;
|
|
13225
|
-
const parsed = Number.parseInt(raw, 10);
|
|
13226
|
-
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
13227
|
-
throw new Error(
|
|
13228
|
-
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
13229
|
-
);
|
|
13008
|
+
// ../rivetkit/dist/tsup/chunk-6W5VGLFT.js
|
|
13009
|
+
function flattenActionHandlers(actions) {
|
|
13010
|
+
const flattened = /* @__PURE__ */ Object.create(null);
|
|
13011
|
+
for (const { name, handler } of collectActionEntries(actions)) {
|
|
13012
|
+
flattened[name] = handler;
|
|
13230
13013
|
}
|
|
13231
|
-
return
|
|
13232
|
-
}
|
|
13233
|
-
var getLogLevel = () => getEnvUniversal("RIVET_LOG_LEVEL") ?? getEnvUniversal("LOG_LEVEL");
|
|
13234
|
-
var getLogTarget = () => getEnvUniversal("RIVET_LOG_TARGET") === "1";
|
|
13235
|
-
var getLogTimestamp = () => getEnvUniversal("RIVET_LOG_TIMESTAMP") === "1";
|
|
13236
|
-
var getLogMessage = () => getEnvUniversal("RIVET_LOG_MESSAGE") === "1";
|
|
13237
|
-
var getLogErrorStack = () => getEnvUniversal("RIVET_LOG_ERROR_STACK") === "1";
|
|
13238
|
-
var getNodeEnv = () => getEnvUniversal("NODE_ENV");
|
|
13239
|
-
var getNextPhase = () => getEnvUniversal("NEXT_PHASE");
|
|
13240
|
-
var isDev = () => getNodeEnv() !== "production";
|
|
13241
|
-
function assertUnreachable(x) {
|
|
13242
|
-
throw new Error(`Unreachable case: ${x}`);
|
|
13014
|
+
return flattened;
|
|
13243
13015
|
}
|
|
13244
|
-
function
|
|
13245
|
-
|
|
13016
|
+
function flattenActionInputSchemas(actions, schemas) {
|
|
13017
|
+
if (schemas === void 0) return void 0;
|
|
13018
|
+
if (!isRecord(schemas)) {
|
|
13019
|
+
throw new TypeError("actionInputSchemas must be an object");
|
|
13020
|
+
}
|
|
13021
|
+
const flattened = /* @__PURE__ */ Object.create(null);
|
|
13022
|
+
for (const { name, path: path2 } of collectActionEntries(actions)) {
|
|
13023
|
+
const nestedSchema = lookupNestedSchema(schemas, path2);
|
|
13024
|
+
const flatSchema = schemas[name];
|
|
13025
|
+
if (nestedSchema !== void 0 && flatSchema !== void 0 && nestedSchema !== flatSchema) {
|
|
13026
|
+
throw new TypeError(
|
|
13027
|
+
`Action input schema \`${name}\` is defined by both a nested path and a dotted key`
|
|
13028
|
+
);
|
|
13029
|
+
}
|
|
13030
|
+
const schema = nestedSchema ?? flatSchema;
|
|
13031
|
+
if (schema !== void 0) {
|
|
13032
|
+
flattened[name] = schema;
|
|
13033
|
+
}
|
|
13034
|
+
}
|
|
13035
|
+
return flattened;
|
|
13036
|
+
}
|
|
13037
|
+
function collectActionEntries(actions) {
|
|
13038
|
+
const entries = [];
|
|
13039
|
+
const names = /* @__PURE__ */ new Set();
|
|
13040
|
+
visitActionGroup(actions ?? {}, [], entries, names);
|
|
13041
|
+
return entries;
|
|
13042
|
+
}
|
|
13043
|
+
function visitActionGroup(value, path2, entries, names) {
|
|
13044
|
+
if (!isRecord(value)) {
|
|
13045
|
+
throw new TypeError(
|
|
13046
|
+
`${formatActionPath(path2)} must be an action handler or group`
|
|
13047
|
+
);
|
|
13048
|
+
}
|
|
13049
|
+
for (const [segment, child] of Object.entries(value)) {
|
|
13050
|
+
const childPath = [...path2, segment];
|
|
13051
|
+
if (typeof child === "function") {
|
|
13052
|
+
const name = childPath.join(".");
|
|
13053
|
+
if (names.has(name)) {
|
|
13054
|
+
throw new TypeError(
|
|
13055
|
+
`Multiple action definitions flatten to \`${name}\``
|
|
13056
|
+
);
|
|
13057
|
+
}
|
|
13058
|
+
names.add(name);
|
|
13059
|
+
entries.push({
|
|
13060
|
+
name,
|
|
13061
|
+
path: childPath,
|
|
13062
|
+
handler: child
|
|
13063
|
+
});
|
|
13064
|
+
} else {
|
|
13065
|
+
visitActionGroup(child, childPath, entries, names);
|
|
13066
|
+
}
|
|
13067
|
+
}
|
|
13068
|
+
}
|
|
13069
|
+
function lookupNestedSchema(schemas, path2) {
|
|
13070
|
+
let value = schemas;
|
|
13071
|
+
for (const segment of path2) {
|
|
13072
|
+
if (!isRecord(value) || !Object.hasOwn(value, segment)) {
|
|
13073
|
+
return void 0;
|
|
13074
|
+
}
|
|
13075
|
+
value = value[segment];
|
|
13076
|
+
}
|
|
13077
|
+
return value;
|
|
13078
|
+
}
|
|
13079
|
+
function isRecord(value) {
|
|
13080
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13081
|
+
return false;
|
|
13082
|
+
}
|
|
13083
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13084
|
+
return prototype === Object.prototype || prototype === null;
|
|
13085
|
+
}
|
|
13086
|
+
function formatActionPath(path2) {
|
|
13087
|
+
return path2.length === 0 ? "actions" : `Action \`${path2.join(".")}\``;
|
|
13088
|
+
}
|
|
13089
|
+
var DEFAULT_SLEEP_GRACE_PERIOD = 15e3;
|
|
13090
|
+
var ACTOR_CONTEXT_INTERNAL_SYMBOL = /* @__PURE__ */ Symbol(
|
|
13091
|
+
"rivetkit.actor_context_internal"
|
|
13092
|
+
);
|
|
13093
|
+
var RAW_STATE_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.raw_state");
|
|
13094
|
+
var CONN_STATE_MANAGER_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.conn_state_manager");
|
|
13095
|
+
var zFunction = () => external_exports.custom((val) => typeof val === "function");
|
|
13096
|
+
var zActionTree = external_exports.custom((value) => {
|
|
13097
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13098
|
+
return false;
|
|
13099
|
+
}
|
|
13100
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13101
|
+
return prototype === Object.prototype || prototype === null;
|
|
13102
|
+
}).superRefine((actions, ctx) => {
|
|
13103
|
+
try {
|
|
13104
|
+
flattenActionHandlers(actions);
|
|
13105
|
+
} catch (error46) {
|
|
13106
|
+
ctx.addIssue({
|
|
13107
|
+
code: "custom",
|
|
13108
|
+
message: error46 instanceof Error ? error46.message : "Invalid action definition"
|
|
13109
|
+
});
|
|
13110
|
+
}
|
|
13111
|
+
});
|
|
13112
|
+
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
13113
|
+
getHistory: zFunction(),
|
|
13114
|
+
getState: zFunction().optional(),
|
|
13115
|
+
onHistoryUpdated: zFunction().optional(),
|
|
13116
|
+
replayFromStep: zFunction().optional()
|
|
13117
|
+
});
|
|
13118
|
+
var RunInspectorConfigSchema = external_exports.object({
|
|
13119
|
+
workflow: WorkflowInspectorConfigSchema.optional()
|
|
13120
|
+
}).optional();
|
|
13121
|
+
var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
13122
|
+
"workflow",
|
|
13123
|
+
"database",
|
|
13124
|
+
"state",
|
|
13125
|
+
"queue",
|
|
13126
|
+
"schedules",
|
|
13127
|
+
"connections",
|
|
13128
|
+
"console"
|
|
13129
|
+
];
|
|
13130
|
+
var BuiltinInspectorTabIdSchema = external_exports.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
13131
|
+
var CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
13132
|
+
var CustomInspectorTabEntrySchema = external_exports.object({
|
|
13133
|
+
id: external_exports.string().regex(
|
|
13134
|
+
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
13135
|
+
"inspector.tabs[].id must contain only letters, digits, underscore, or dash"
|
|
13136
|
+
),
|
|
13137
|
+
label: external_exports.string().min(1),
|
|
13138
|
+
source: external_exports.string().min(1),
|
|
13139
|
+
/**
|
|
13140
|
+
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
13141
|
+
* icon registry); unknown ids fall back to a generic icon.
|
|
13142
|
+
*/
|
|
13143
|
+
icon: external_exports.string().min(1).optional(),
|
|
13144
|
+
hidden: external_exports.literal(false).optional()
|
|
13145
|
+
}).strict();
|
|
13146
|
+
var HideInspectorTabEntrySchema = external_exports.object({
|
|
13147
|
+
id: BuiltinInspectorTabIdSchema,
|
|
13148
|
+
hidden: external_exports.literal(true)
|
|
13149
|
+
}).strict();
|
|
13150
|
+
var InspectorTabEntrySchema = external_exports.union([
|
|
13151
|
+
CustomInspectorTabEntrySchema,
|
|
13152
|
+
HideInspectorTabEntrySchema
|
|
13153
|
+
]);
|
|
13154
|
+
var ActorInspectorConfigSchema = external_exports.object({
|
|
13155
|
+
tabs: external_exports.array(InspectorTabEntrySchema).default(() => [])
|
|
13156
|
+
}).strict().refine(
|
|
13157
|
+
(data) => {
|
|
13158
|
+
const ids = data.tabs.map((t) => t.id);
|
|
13159
|
+
return new Set(ids).size === ids.length;
|
|
13160
|
+
},
|
|
13161
|
+
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] }
|
|
13162
|
+
).refine(
|
|
13163
|
+
(data) => {
|
|
13164
|
+
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
13165
|
+
return data.tabs.every(
|
|
13166
|
+
(t) => t.hidden === true || !builtinSet.has(t.id)
|
|
13167
|
+
);
|
|
13168
|
+
},
|
|
13169
|
+
{
|
|
13170
|
+
message: "Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
13171
|
+
path: ["tabs"]
|
|
13172
|
+
}
|
|
13173
|
+
);
|
|
13174
|
+
var RunConfigSchema = external_exports.object({
|
|
13175
|
+
/** Display name for the actor in the Inspector UI. */
|
|
13176
|
+
name: external_exports.string().optional(),
|
|
13177
|
+
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
13178
|
+
icon: external_exports.string().optional(),
|
|
13179
|
+
/** The run handler function. */
|
|
13180
|
+
run: zFunction(),
|
|
13181
|
+
/** Inspector integration for long-running run handlers. */
|
|
13182
|
+
inspector: RunInspectorConfigSchema.optional()
|
|
13183
|
+
});
|
|
13184
|
+
var RUN_FUNCTION_CONFIG_SYMBOL = /* @__PURE__ */ Symbol.for("rivetkit.run_function_config");
|
|
13185
|
+
function defineRunHandler(run, options) {
|
|
13186
|
+
if (options.inspectorKind === void 0 !== (options.createInspector === void 0)) {
|
|
13187
|
+
throw new TypeError(
|
|
13188
|
+
"defineRunHandler requires inspectorKind and createInspector together"
|
|
13189
|
+
);
|
|
13190
|
+
}
|
|
13191
|
+
Object.defineProperty(run, RUN_FUNCTION_CONFIG_SYMBOL, {
|
|
13192
|
+
configurable: false,
|
|
13193
|
+
enumerable: false,
|
|
13194
|
+
writable: false,
|
|
13195
|
+
value: {
|
|
13196
|
+
name: options.name,
|
|
13197
|
+
icon: options.icon,
|
|
13198
|
+
inspectorKind: options.inspectorKind,
|
|
13199
|
+
createInspector: options.createInspector
|
|
13200
|
+
}
|
|
13201
|
+
});
|
|
13202
|
+
return run;
|
|
13203
|
+
}
|
|
13204
|
+
function getRunInspectorKind(run) {
|
|
13205
|
+
var _a2;
|
|
13206
|
+
if (!run || typeof run !== "function") return void 0;
|
|
13207
|
+
return (_a2 = run[RUN_FUNCTION_CONFIG_SYMBOL]) == null ? void 0 : _a2.inspectorKind;
|
|
13208
|
+
}
|
|
13209
|
+
function createRunInspector(run, context) {
|
|
13210
|
+
var _a2, _b;
|
|
13211
|
+
if (!run || typeof run !== "function") return void 0;
|
|
13212
|
+
return (_b = (_a2 = run[RUN_FUNCTION_CONFIG_SYMBOL]) == null ? void 0 : _a2.createInspector) == null ? void 0 : _b.call(_a2, context);
|
|
13213
|
+
}
|
|
13214
|
+
var zRunHandler = external_exports.union([zFunction(), RunConfigSchema]).optional();
|
|
13215
|
+
function getRunFunction(run) {
|
|
13216
|
+
if (!run) return void 0;
|
|
13217
|
+
if (typeof run === "function") return run;
|
|
13218
|
+
return run.run;
|
|
13219
|
+
}
|
|
13220
|
+
function getRunMetadata(run) {
|
|
13221
|
+
if (!run) return {};
|
|
13222
|
+
if (typeof run === "function") {
|
|
13223
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13224
|
+
if (!config3) return {};
|
|
13225
|
+
return { name: config3.name, icon: config3.icon };
|
|
13226
|
+
}
|
|
13227
|
+
return { name: run.name, icon: run.icon };
|
|
13228
|
+
}
|
|
13229
|
+
function getRunInspectorConfig(run, actor2) {
|
|
13230
|
+
if (!run) return void 0;
|
|
13231
|
+
if (typeof run === "function") {
|
|
13232
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13233
|
+
return (config3 == null ? void 0 : config3.inspectorFactory) ? config3.inspectorFactory(actor2) : config3 == null ? void 0 : config3.inspector;
|
|
13234
|
+
}
|
|
13235
|
+
return run.inspector;
|
|
13236
|
+
}
|
|
13237
|
+
function hasRunInspectorConfig(run) {
|
|
13238
|
+
if (!run) return false;
|
|
13239
|
+
if (typeof run !== "function") return run.inspector !== void 0;
|
|
13240
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13241
|
+
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;
|
|
13242
|
+
}
|
|
13243
|
+
function disposeRunInspector(run, actorId) {
|
|
13244
|
+
var _a2;
|
|
13245
|
+
if (!run || typeof run !== "function") {
|
|
13246
|
+
return;
|
|
13247
|
+
}
|
|
13248
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13249
|
+
(_a2 = config3 == null ? void 0 : config3.disposeInspector) == null ? void 0 : _a2.call(config3, actorId);
|
|
13250
|
+
}
|
|
13251
|
+
var GlobalActorOptionsBaseSchema = external_exports.object({
|
|
13252
|
+
/** Display name for the actor in the Inspector UI. */
|
|
13253
|
+
name: external_exports.string().optional(),
|
|
13254
|
+
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
13255
|
+
icon: external_exports.string().optional(),
|
|
13256
|
+
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
13257
|
+
enableActorRuntimeSocket: external_exports.boolean().default(false),
|
|
13258
|
+
/**
|
|
13259
|
+
* Can hibernate WebSockets for onWebSocket.
|
|
13260
|
+
*
|
|
13261
|
+
* WebSockets using actions/events are hibernatable by default.
|
|
13262
|
+
*
|
|
13263
|
+
* @experimental
|
|
13264
|
+
**/
|
|
13265
|
+
canHibernateWebSocket: external_exports.union([external_exports.boolean(), zFunction()]).default(false)
|
|
13266
|
+
}).strict();
|
|
13267
|
+
var GlobalActorOptionsSchema = GlobalActorOptionsBaseSchema.prefault(
|
|
13268
|
+
() => ({})
|
|
13269
|
+
);
|
|
13270
|
+
var InstanceActorOptionsBaseSchema = external_exports.object({
|
|
13271
|
+
createVarsTimeout: external_exports.number().positive().default(5e3),
|
|
13272
|
+
createConnStateTimeout: external_exports.number().positive().default(5e3),
|
|
13273
|
+
onBeforeConnectTimeout: external_exports.number().positive().default(5e3),
|
|
13274
|
+
onConnectTimeout: external_exports.number().positive().default(5e3),
|
|
13275
|
+
onMigrateTimeout: external_exports.number().positive().default(3e4),
|
|
13276
|
+
sleepGracePeriod: external_exports.number().positive().default(DEFAULT_SLEEP_GRACE_PERIOD),
|
|
13277
|
+
/** @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. */
|
|
13278
|
+
onDestroyTimeout: external_exports.number().positive().optional(),
|
|
13279
|
+
/** @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. */
|
|
13280
|
+
waitUntilTimeout: external_exports.number().positive().optional(),
|
|
13281
|
+
stateSaveInterval: external_exports.number().positive().default(1e3),
|
|
13282
|
+
actionTimeout: external_exports.number().positive().default(6e4),
|
|
13283
|
+
connectionLivenessTimeout: external_exports.number().positive().default(2500),
|
|
13284
|
+
connectionLivenessInterval: external_exports.number().positive().default(5e3),
|
|
13285
|
+
/** @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. */
|
|
13286
|
+
noSleep: external_exports.boolean().default(false),
|
|
13287
|
+
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
13288
|
+
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
13289
|
+
/** Maximum pending one-shot and recurring schedules. */
|
|
13290
|
+
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
13291
|
+
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
13292
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
13293
|
+
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
13294
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
13295
|
+
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
13296
|
+
}).strict();
|
|
13297
|
+
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
13298
|
+
var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
13299
|
+
InstanceActorOptionsBaseSchema.shape
|
|
13300
|
+
).strict().prefault(() => ({}));
|
|
13301
|
+
var ActorConfigSchema = external_exports.object({
|
|
13302
|
+
onCreate: zFunction().optional(),
|
|
13303
|
+
onDestroy: zFunction().optional(),
|
|
13304
|
+
onMigrate: zFunction().optional(),
|
|
13305
|
+
onWake: zFunction().optional(),
|
|
13306
|
+
onSleep: zFunction().optional(),
|
|
13307
|
+
run: zRunHandler,
|
|
13308
|
+
onStateChange: zFunction().optional(),
|
|
13309
|
+
onBeforeConnect: zFunction().optional(),
|
|
13310
|
+
onConnect: zFunction().optional(),
|
|
13311
|
+
onDisconnect: zFunction().optional(),
|
|
13312
|
+
onBeforeActionResponse: zFunction().optional(),
|
|
13313
|
+
onRequest: zFunction().optional(),
|
|
13314
|
+
onWebSocket: zFunction().optional(),
|
|
13315
|
+
actions: zActionTree.default(() => ({})),
|
|
13316
|
+
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13317
|
+
connParamsSchema: external_exports.any().optional(),
|
|
13318
|
+
events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13319
|
+
queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13320
|
+
state: external_exports.any().optional(),
|
|
13321
|
+
createState: zFunction().optional(),
|
|
13322
|
+
connState: external_exports.any().optional(),
|
|
13323
|
+
createConnState: zFunction().optional(),
|
|
13324
|
+
vars: external_exports.any().optional(),
|
|
13325
|
+
db: external_exports.any().optional(),
|
|
13326
|
+
createVars: zFunction().optional(),
|
|
13327
|
+
options: ActorOptionsSchema,
|
|
13328
|
+
inspector: ActorInspectorConfigSchema.optional()
|
|
13329
|
+
}).strict().refine(
|
|
13330
|
+
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
13331
|
+
{
|
|
13332
|
+
message: "Cannot define both 'state' and 'createState'",
|
|
13333
|
+
path: ["state"]
|
|
13334
|
+
}
|
|
13335
|
+
).refine(
|
|
13336
|
+
(data) => !(data.connState !== void 0 && data.createConnState !== void 0),
|
|
13337
|
+
{
|
|
13338
|
+
message: "Cannot define both 'connState' and 'createConnState'",
|
|
13339
|
+
path: ["connState"]
|
|
13340
|
+
}
|
|
13341
|
+
).refine(
|
|
13342
|
+
(data) => !(data.vars !== void 0 && data.createVars !== void 0),
|
|
13343
|
+
{
|
|
13344
|
+
message: "Cannot define both 'vars' and 'createVars'",
|
|
13345
|
+
path: ["vars"]
|
|
13346
|
+
}
|
|
13347
|
+
);
|
|
13348
|
+
var DocActorOptionsSchema = external_exports.object({
|
|
13349
|
+
name: external_exports.string().optional().describe("Display name for the actor in the Inspector UI."),
|
|
13350
|
+
icon: external_exports.string().optional().describe(
|
|
13351
|
+
"Icon for the actor in the Inspector UI. Can be an emoji (e.g., '\u{1F680}') or FontAwesome icon name (e.g., 'rocket')."
|
|
13352
|
+
),
|
|
13353
|
+
enableActorRuntimeSocket: external_exports.boolean().optional().describe(
|
|
13354
|
+
"Enables the experimental Actor Runtime Socket for this actor. Default: false"
|
|
13355
|
+
),
|
|
13356
|
+
createVarsTimeout: external_exports.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
13357
|
+
createConnStateTimeout: external_exports.number().optional().describe(
|
|
13358
|
+
"Timeout in ms for createConnState handler. Default: 5000"
|
|
13359
|
+
),
|
|
13360
|
+
onMigrateTimeout: external_exports.number().optional().describe("Timeout in ms for onMigrate handler. Default: 30000"),
|
|
13361
|
+
onBeforeConnectTimeout: external_exports.number().optional().describe(
|
|
13362
|
+
"Timeout in ms for onBeforeConnect handler. Default: 5000"
|
|
13363
|
+
),
|
|
13364
|
+
onConnectTimeout: external_exports.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
13365
|
+
sleepGracePeriod: external_exports.number().optional().describe(
|
|
13366
|
+
`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}.`
|
|
13367
|
+
),
|
|
13368
|
+
onDestroyTimeout: external_exports.number().optional().describe(
|
|
13369
|
+
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
13370
|
+
),
|
|
13371
|
+
waitUntilTimeout: external_exports.number().optional().describe(
|
|
13372
|
+
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
13373
|
+
),
|
|
13374
|
+
stateSaveInterval: external_exports.number().optional().describe(
|
|
13375
|
+
"Interval in ms between automatic state saves. Default: 1000"
|
|
13376
|
+
),
|
|
13377
|
+
actionTimeout: external_exports.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
13378
|
+
connectionLivenessTimeout: external_exports.number().optional().describe(
|
|
13379
|
+
"Timeout in ms for connection liveness checks. Default: 2500"
|
|
13380
|
+
),
|
|
13381
|
+
connectionLivenessInterval: external_exports.number().optional().describe(
|
|
13382
|
+
"Interval in ms between connection liveness checks. Default: 5000"
|
|
13383
|
+
),
|
|
13384
|
+
noSleep: external_exports.boolean().optional().describe(
|
|
13385
|
+
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false"
|
|
13386
|
+
),
|
|
13387
|
+
sleepTimeout: external_exports.number().optional().describe(
|
|
13388
|
+
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
13389
|
+
),
|
|
13390
|
+
maxQueueSize: external_exports.number().optional().describe(
|
|
13391
|
+
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
13392
|
+
),
|
|
13393
|
+
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
13394
|
+
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
13395
|
+
),
|
|
13396
|
+
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
13397
|
+
"Maximum size of each queue message in bytes. Default: 65536"
|
|
13398
|
+
),
|
|
13399
|
+
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
13400
|
+
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
13401
|
+
)
|
|
13402
|
+
}).describe("Actor options for timeouts and behavior configuration.");
|
|
13403
|
+
var DocActorConfigSchema = external_exports.object({
|
|
13404
|
+
state: external_exports.unknown().optional().describe(
|
|
13405
|
+
"Initial state value for the actor. Cannot be used with createState."
|
|
13406
|
+
),
|
|
13407
|
+
createState: external_exports.unknown().optional().describe(
|
|
13408
|
+
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
13409
|
+
),
|
|
13410
|
+
connState: external_exports.unknown().optional().describe(
|
|
13411
|
+
"Initial connection state value. Cannot be used with createConnState."
|
|
13412
|
+
),
|
|
13413
|
+
createConnState: external_exports.unknown().optional().describe(
|
|
13414
|
+
"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."
|
|
13415
|
+
),
|
|
13416
|
+
vars: external_exports.unknown().optional().describe(
|
|
13417
|
+
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
13418
|
+
),
|
|
13419
|
+
createVars: external_exports.unknown().optional().describe(
|
|
13420
|
+
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
13421
|
+
),
|
|
13422
|
+
db: external_exports.unknown().optional().describe("Database provider instance for the actor."),
|
|
13423
|
+
onCreate: external_exports.unknown().optional().describe(
|
|
13424
|
+
"Called when the actor is first initialized. Use to initialize state."
|
|
13425
|
+
),
|
|
13426
|
+
onDestroy: external_exports.unknown().optional().describe("Called when the actor is destroyed."),
|
|
13427
|
+
onMigrate: external_exports.unknown().optional().describe(
|
|
13428
|
+
"Called on every actor start after persisted state loads and before onWake. Use for repeatable schema migrations."
|
|
13429
|
+
),
|
|
13430
|
+
onWake: external_exports.unknown().optional().describe(
|
|
13431
|
+
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
13432
|
+
),
|
|
13433
|
+
onSleep: external_exports.unknown().optional().describe(
|
|
13434
|
+
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
13435
|
+
),
|
|
13436
|
+
run: external_exports.unknown().optional().describe(
|
|
13437
|
+
"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."
|
|
13438
|
+
),
|
|
13439
|
+
onStateChange: external_exports.unknown().optional().describe(
|
|
13440
|
+
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
13441
|
+
),
|
|
13442
|
+
onBeforeConnect: external_exports.unknown().optional().describe(
|
|
13443
|
+
"Called before a client connects. Throw an error to reject the connection. The pending connection is not visible in c.conns while this runs."
|
|
13444
|
+
),
|
|
13445
|
+
onConnect: external_exports.unknown().optional().describe(
|
|
13446
|
+
"Called when a client successfully connects. The connection is visible in c.conns before this runs."
|
|
13447
|
+
),
|
|
13448
|
+
onDisconnect: external_exports.unknown().optional().describe("Called when a client disconnects."),
|
|
13449
|
+
onBeforeActionResponse: external_exports.unknown().optional().describe(
|
|
13450
|
+
"Called before sending an action response. Use to transform output."
|
|
13451
|
+
),
|
|
13452
|
+
onRequest: external_exports.unknown().optional().describe(
|
|
13453
|
+
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
13454
|
+
),
|
|
13455
|
+
onWebSocket: external_exports.unknown().optional().describe(
|
|
13456
|
+
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
13457
|
+
),
|
|
13458
|
+
actions: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
13459
|
+
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object."
|
|
13460
|
+
),
|
|
13461
|
+
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
13462
|
+
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
|
|
13463
|
+
),
|
|
13464
|
+
connParamsSchema: external_exports.unknown().optional().describe(
|
|
13465
|
+
"Optional schema for validating connection params in native runtimes."
|
|
13466
|
+
),
|
|
13467
|
+
events: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of event names to schemas."),
|
|
13468
|
+
queues: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of queue names to schemas."),
|
|
13469
|
+
options: DocActorOptionsSchema.optional()
|
|
13470
|
+
}).describe("Actor configuration passed to the actor() function.");
|
|
13471
|
+
|
|
13472
|
+
// ../rivetkit/dist/tsup/chunk-IXBD7BXC.js
|
|
13473
|
+
var INTERNAL_ERROR_CODE = "internal_error";
|
|
13474
|
+
var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
13475
|
+
var USER_ERROR_CODE = "user_error";
|
|
13476
|
+
var BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
13477
|
+
function looksLikeRivetErrorOptions(value) {
|
|
13478
|
+
return typeof value === "object" && value !== null && ("public" in value || "metadata" in value || "rayId" in value || "statusCode" in value || "actor" in value || "cause" in value);
|
|
13479
|
+
}
|
|
13480
|
+
function isTypedErrorTag(value) {
|
|
13481
|
+
return value === "ActorError" || value === "RivetError";
|
|
13482
|
+
}
|
|
13483
|
+
function errorMessage(error46, fallback = String(error46)) {
|
|
13484
|
+
if (error46 && typeof error46 === "object" && "message" in error46 && typeof error46.message === "string") {
|
|
13485
|
+
return error46.message;
|
|
13486
|
+
}
|
|
13487
|
+
return fallback;
|
|
13488
|
+
}
|
|
13489
|
+
function isRivetErrorLike(error46) {
|
|
13490
|
+
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));
|
|
13491
|
+
}
|
|
13492
|
+
function isActorAbortedError(error46) {
|
|
13493
|
+
return isRivetErrorLike(error46) && error46.group === "actor" && error46.code === "aborted";
|
|
13494
|
+
}
|
|
13495
|
+
function isActorSpecifier(value) {
|
|
13496
|
+
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");
|
|
13497
|
+
}
|
|
13498
|
+
var RivetError = class extends Error {
|
|
13499
|
+
__type = "RivetError";
|
|
13500
|
+
public;
|
|
13501
|
+
metadata;
|
|
13502
|
+
rayId;
|
|
13503
|
+
statusCode;
|
|
13504
|
+
actor;
|
|
13505
|
+
group;
|
|
13506
|
+
code;
|
|
13507
|
+
static isRivetError(error46) {
|
|
13508
|
+
return isRivetErrorLike(error46);
|
|
13509
|
+
}
|
|
13510
|
+
static isActorError(error46) {
|
|
13511
|
+
return isRivetErrorLike(error46);
|
|
13512
|
+
}
|
|
13513
|
+
constructor(group, code, message, options) {
|
|
13514
|
+
const normalized = looksLikeRivetErrorOptions(options) ? options : { metadata: options };
|
|
13515
|
+
super(message, { cause: normalized.cause });
|
|
13516
|
+
this.name = "RivetError";
|
|
13517
|
+
this.group = group;
|
|
13518
|
+
this.code = code;
|
|
13519
|
+
this.public = normalized.public ?? false;
|
|
13520
|
+
this.metadata = normalized.metadata;
|
|
13521
|
+
this.rayId = normalized.rayId ?? void 0;
|
|
13522
|
+
this.statusCode = normalized.statusCode ?? (this.public ? 400 : 500);
|
|
13523
|
+
this.actor = normalized.actor;
|
|
13524
|
+
}
|
|
13525
|
+
toString() {
|
|
13526
|
+
return this.message;
|
|
13527
|
+
}
|
|
13528
|
+
};
|
|
13529
|
+
var UserError = class extends RivetError {
|
|
13530
|
+
constructor(message, options) {
|
|
13531
|
+
super("user", (options == null ? void 0 : options.code) ?? USER_ERROR_CODE, message, {
|
|
13532
|
+
public: true,
|
|
13533
|
+
metadata: options == null ? void 0 : options.metadata,
|
|
13534
|
+
cause: options == null ? void 0 : options.cause
|
|
13535
|
+
});
|
|
13536
|
+
}
|
|
13537
|
+
};
|
|
13538
|
+
function toRivetError(error46, fallback) {
|
|
13539
|
+
if (typeof error46 === "string") {
|
|
13540
|
+
const bridged = decodeBridgeRivetError(error46);
|
|
13541
|
+
if (bridged) {
|
|
13542
|
+
return bridged;
|
|
13543
|
+
}
|
|
13544
|
+
}
|
|
13545
|
+
if (error46 instanceof Error) {
|
|
13546
|
+
const bridged = decodeBridgeRivetError(error46.message);
|
|
13547
|
+
if (bridged) {
|
|
13548
|
+
return bridged;
|
|
13549
|
+
}
|
|
13550
|
+
}
|
|
13551
|
+
if (isRivetErrorLike(error46)) {
|
|
13552
|
+
return new RivetError(error46.group, error46.code, error46.message, {
|
|
13553
|
+
public: error46.public,
|
|
13554
|
+
statusCode: error46.statusCode,
|
|
13555
|
+
metadata: error46.metadata,
|
|
13556
|
+
rayId: error46.rayId,
|
|
13557
|
+
actor: error46.actor,
|
|
13558
|
+
cause: error46 instanceof Error ? error46.cause : void 0
|
|
13559
|
+
});
|
|
13560
|
+
}
|
|
13561
|
+
return new RivetError(
|
|
13562
|
+
(fallback == null ? void 0 : fallback.group) ?? "actor",
|
|
13563
|
+
(fallback == null ? void 0 : fallback.code) ?? INTERNAL_ERROR_CODE,
|
|
13564
|
+
errorMessage(error46, (fallback == null ? void 0 : fallback.message) ?? "Unknown error"),
|
|
13565
|
+
{
|
|
13566
|
+
public: fallback == null ? void 0 : fallback.public,
|
|
13567
|
+
statusCode: fallback == null ? void 0 : fallback.statusCode,
|
|
13568
|
+
metadata: fallback == null ? void 0 : fallback.metadata,
|
|
13569
|
+
rayId: fallback == null ? void 0 : fallback.rayId,
|
|
13570
|
+
actor: fallback == null ? void 0 : fallback.actor,
|
|
13571
|
+
cause: error46 instanceof Error ? error46 : void 0
|
|
13572
|
+
}
|
|
13573
|
+
);
|
|
13574
|
+
}
|
|
13575
|
+
function encodeBridgeRivetError(error46) {
|
|
13576
|
+
return `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
|
|
13577
|
+
group: error46.group,
|
|
13578
|
+
code: error46.code,
|
|
13579
|
+
message: error46.message,
|
|
13580
|
+
metadata: error46.metadata,
|
|
13581
|
+
rayId: error46.rayId,
|
|
13582
|
+
public: error46.public,
|
|
13583
|
+
statusCode: error46.statusCode,
|
|
13584
|
+
actor: error46.actor
|
|
13585
|
+
})}`;
|
|
13586
|
+
}
|
|
13587
|
+
function decodeBridgeRivetErrorPayload(value) {
|
|
13588
|
+
if (!value.startsWith(BRIDGE_RIVET_ERROR_PREFIX)) {
|
|
13589
|
+
return void 0;
|
|
13590
|
+
}
|
|
13591
|
+
try {
|
|
13592
|
+
const raw = JSON.parse(
|
|
13593
|
+
value.slice(BRIDGE_RIVET_ERROR_PREFIX.length)
|
|
13594
|
+
);
|
|
13595
|
+
const payload = {
|
|
13596
|
+
...raw,
|
|
13597
|
+
rayId: raw.rayId ?? void 0
|
|
13598
|
+
};
|
|
13599
|
+
if (!isRivetErrorLike(payload)) {
|
|
13600
|
+
return void 0;
|
|
13601
|
+
}
|
|
13602
|
+
if (payload.actor !== void 0 && payload.actor !== null && !isActorSpecifier(payload.actor)) {
|
|
13603
|
+
return void 0;
|
|
13604
|
+
}
|
|
13605
|
+
return payload;
|
|
13606
|
+
} catch {
|
|
13607
|
+
return void 0;
|
|
13608
|
+
}
|
|
13609
|
+
}
|
|
13610
|
+
function decodeBridgeRivetError(value) {
|
|
13611
|
+
const payload = decodeBridgeRivetErrorPayload(value);
|
|
13612
|
+
if (!payload) {
|
|
13613
|
+
return void 0;
|
|
13614
|
+
}
|
|
13615
|
+
return new RivetError(payload.group, payload.code, payload.message, {
|
|
13616
|
+
metadata: payload.metadata,
|
|
13617
|
+
rayId: payload.rayId,
|
|
13618
|
+
public: payload.public,
|
|
13619
|
+
statusCode: payload.statusCode,
|
|
13620
|
+
actor: payload.actor ?? void 0
|
|
13621
|
+
});
|
|
13622
|
+
}
|
|
13623
|
+
function invalidRequest(error46) {
|
|
13624
|
+
return new RivetError(
|
|
13625
|
+
"request",
|
|
13626
|
+
"invalid",
|
|
13627
|
+
`Invalid request: ${errorMessage(error46, String(error46))}`,
|
|
13628
|
+
{
|
|
13629
|
+
public: true,
|
|
13630
|
+
cause: error46 instanceof Error ? error46 : void 0
|
|
13631
|
+
}
|
|
13632
|
+
);
|
|
13633
|
+
}
|
|
13634
|
+
function actorNotFound(identifier) {
|
|
13635
|
+
return new RivetError(
|
|
13636
|
+
"actor",
|
|
13637
|
+
"not_found",
|
|
13638
|
+
identifier ? `Actor not found: ${identifier} (https://www.rivet.dev/docs/clients/javascript)` : "Actor not found (https://www.rivet.dev/docs/clients/javascript)",
|
|
13639
|
+
{ public: true }
|
|
13640
|
+
);
|
|
13641
|
+
}
|
|
13642
|
+
function forbiddenError() {
|
|
13643
|
+
return new RivetError("auth", "forbidden", "Forbidden", {
|
|
13644
|
+
public: true,
|
|
13645
|
+
statusCode: 403
|
|
13646
|
+
});
|
|
13647
|
+
}
|
|
13648
|
+
function unsupportedFeature(feature) {
|
|
13649
|
+
return new RivetError(
|
|
13650
|
+
"feature",
|
|
13651
|
+
"unsupported",
|
|
13652
|
+
`Unsupported feature: ${feature}`
|
|
13653
|
+
);
|
|
13654
|
+
}
|
|
13655
|
+
|
|
13656
|
+
// ../rivetkit/dist/tsup/chunk-YW75TS76.js
|
|
13657
|
+
var import_pino = require("pino");
|
|
13658
|
+
var cbor = __toESM(require("cbor-x"), 1);
|
|
13659
|
+
var import_invariant = __toESM(require_invariant(), 1);
|
|
13660
|
+
var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
|
|
13661
|
+
var getRivetEndpoint = () => getEnvUniversal("RIVET_ENDPOINT");
|
|
13662
|
+
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
13663
|
+
var getRivetNamespace = () => getEnvUniversal("RIVET_NAMESPACE");
|
|
13664
|
+
var getRivetPool = () => getEnvUniversal("RIVET_POOL");
|
|
13665
|
+
var getRivetTotalSlots = () => {
|
|
13666
|
+
const value = getEnvUniversal("RIVET_TOTAL_SLOTS");
|
|
13667
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13668
|
+
};
|
|
13669
|
+
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
13670
|
+
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
13671
|
+
var getRivetRunEnginePort = () => {
|
|
13672
|
+
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
13673
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13674
|
+
};
|
|
13675
|
+
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
13676
|
+
var getRivetEnvoyVersion = () => {
|
|
13677
|
+
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
13678
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13679
|
+
};
|
|
13680
|
+
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
13681
|
+
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
13682
|
+
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
13683
|
+
var getRivetkitRuntimeMode = () => {
|
|
13684
|
+
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
13685
|
+
if (value === void 0) return "envoy";
|
|
13686
|
+
if (value === "envoy" || value === "serverless") return value;
|
|
13687
|
+
throw new Error(
|
|
13688
|
+
`RIVETKIT_RUNTIME_MODE env var must be "envoy" or "serverless"; got "${value}"`
|
|
13689
|
+
);
|
|
13690
|
+
};
|
|
13691
|
+
var getRivetkitPublicDir = () => {
|
|
13692
|
+
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
13693
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
13694
|
+
};
|
|
13695
|
+
function parsePortEnv(raw) {
|
|
13696
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
13697
|
+
const parsed = Number.parseInt(raw, 10);
|
|
13698
|
+
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
13699
|
+
throw new Error(
|
|
13700
|
+
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
13701
|
+
);
|
|
13702
|
+
}
|
|
13703
|
+
return parsed;
|
|
13704
|
+
}
|
|
13705
|
+
var getLogLevel = () => getEnvUniversal("RIVET_LOG_LEVEL") ?? getEnvUniversal("LOG_LEVEL");
|
|
13706
|
+
var getLogTarget = () => getEnvUniversal("RIVET_LOG_TARGET") === "1";
|
|
13707
|
+
var getLogTimestamp = () => getEnvUniversal("RIVET_LOG_TIMESTAMP") === "1";
|
|
13708
|
+
var getLogMessage = () => getEnvUniversal("RIVET_LOG_MESSAGE") === "1";
|
|
13709
|
+
var getLogErrorStack = () => getEnvUniversal("RIVET_LOG_ERROR_STACK") === "1";
|
|
13710
|
+
var getNodeEnv = () => getEnvUniversal("NODE_ENV");
|
|
13711
|
+
var getNextPhase = () => getEnvUniversal("NEXT_PHASE");
|
|
13712
|
+
var isDev = () => getNodeEnv() !== "production";
|
|
13713
|
+
function assertUnreachable(x) {
|
|
13714
|
+
throw new Error(`Unreachable case: ${x}`);
|
|
13715
|
+
}
|
|
13716
|
+
function isCanonicalStructuredRivetError(error46) {
|
|
13717
|
+
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";
|
|
13246
13718
|
}
|
|
13247
13719
|
function deconstructError(error46, exposeInternalError = false) {
|
|
13248
13720
|
let statusCode;
|
|
@@ -13251,6 +13723,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13251
13723
|
let code;
|
|
13252
13724
|
let message;
|
|
13253
13725
|
let metadata;
|
|
13726
|
+
let rayId;
|
|
13254
13727
|
let actor2;
|
|
13255
13728
|
if (isCanonicalStructuredRivetError(error46)) {
|
|
13256
13729
|
statusCode = typeof error46.statusCode === "number" ? error46.statusCode : error46.public ? 400 : 500;
|
|
@@ -13259,6 +13732,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13259
13732
|
code = error46.code;
|
|
13260
13733
|
message = error46.message;
|
|
13261
13734
|
metadata = error46.metadata;
|
|
13735
|
+
rayId = error46.rayId;
|
|
13262
13736
|
actor2 = error46.actor;
|
|
13263
13737
|
} else if (RivetError.isActorError(error46) && error46.public) {
|
|
13264
13738
|
statusCode = "statusCode" in error46 && error46.statusCode ? error46.statusCode : 400;
|
|
@@ -13267,6 +13741,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13267
13741
|
code = error46.code;
|
|
13268
13742
|
message = getErrorMessage(error46);
|
|
13269
13743
|
metadata = error46.metadata;
|
|
13744
|
+
rayId = error46.rayId;
|
|
13270
13745
|
actor2 = error46.actor;
|
|
13271
13746
|
} else if (exposeInternalError) {
|
|
13272
13747
|
if (RivetError.isActorError(error46)) {
|
|
@@ -13276,6 +13751,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13276
13751
|
code = error46.code;
|
|
13277
13752
|
message = getErrorMessage(error46);
|
|
13278
13753
|
metadata = error46.metadata;
|
|
13754
|
+
rayId = error46.rayId;
|
|
13279
13755
|
actor2 = error46.actor;
|
|
13280
13756
|
} else {
|
|
13281
13757
|
statusCode = 500;
|
|
@@ -13305,6 +13781,7 @@ function deconstructError(error46, exposeInternalError = false) {
|
|
|
13305
13781
|
code,
|
|
13306
13782
|
message,
|
|
13307
13783
|
metadata,
|
|
13784
|
+
rayId,
|
|
13308
13785
|
actor: actor2
|
|
13309
13786
|
};
|
|
13310
13787
|
}
|
|
@@ -13347,7 +13824,7 @@ function noopNext() {
|
|
|
13347
13824
|
}
|
|
13348
13825
|
var package_default = {
|
|
13349
13826
|
name: "rivetkit",
|
|
13350
|
-
version: "2.3.12-rc.
|
|
13827
|
+
version: "2.3.12-rc.2",
|
|
13351
13828
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
13352
13829
|
license: "Apache-2.0",
|
|
13353
13830
|
keywords: [
|
|
@@ -14577,840 +15054,376 @@ function readUtf8Js(bc, byteLen) {
|
|
|
14577
15054
|
const byte4 = bytes[offset++];
|
|
14578
15055
|
codePoint = (byte1 & 7) << 18 | (byte2 & 63) << 12 | (byte3 & 63) << 6 | byte4 & 63;
|
|
14579
15056
|
malformed = codePoint >> 16 === 0 || // non-canonical char or missing data
|
|
14580
|
-
codePoint > 1114111 || // too large code point
|
|
14581
|
-
byte1 >> 3 !== 30 || // invalid tag
|
|
14582
|
-
byte2 >> 6 !== 2 || // invalid tag
|
|
14583
|
-
byte3 >> 6 !== 2 || // invalid tag
|
|
14584
|
-
byte4 >> 6 !== 2;
|
|
14585
|
-
}
|
|
14586
|
-
if (malformed) {
|
|
14587
|
-
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14588
|
-
}
|
|
14589
|
-
}
|
|
14590
|
-
result += String.fromCodePoint(codePoint);
|
|
14591
|
-
}
|
|
14592
|
-
bc.offset = offset;
|
|
14593
|
-
return result;
|
|
14594
|
-
}
|
|
14595
|
-
function writeUtf8Js(bc, s) {
|
|
14596
|
-
const bytes = bc.bytes;
|
|
14597
|
-
let offset = bc.offset;
|
|
14598
|
-
let i = 0;
|
|
14599
|
-
while (i < s.length) {
|
|
14600
|
-
const codePoint = s.codePointAt(i++);
|
|
14601
|
-
if (codePoint < 128) {
|
|
14602
|
-
bytes[offset++] = codePoint;
|
|
14603
|
-
} else {
|
|
14604
|
-
if (codePoint < 2048) {
|
|
14605
|
-
bytes[offset++] = 192 | codePoint >> 6;
|
|
14606
|
-
} else {
|
|
14607
|
-
if (codePoint < 65536) {
|
|
14608
|
-
bytes[offset++] = 224 | codePoint >> 12;
|
|
14609
|
-
} else {
|
|
14610
|
-
bytes[offset++] = 240 | codePoint >> 18;
|
|
14611
|
-
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
14612
|
-
i++;
|
|
14613
|
-
}
|
|
14614
|
-
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
14615
|
-
}
|
|
14616
|
-
bytes[offset++] = 128 | codePoint & 63;
|
|
14617
|
-
}
|
|
14618
|
-
}
|
|
14619
|
-
bc.offset = offset;
|
|
14620
|
-
}
|
|
14621
|
-
function utf8ByteLength(s) {
|
|
14622
|
-
let result = s.length;
|
|
14623
|
-
for (let i = 0; i < s.length; i++) {
|
|
14624
|
-
const codePoint = s.codePointAt(i);
|
|
14625
|
-
if (codePoint > 127) {
|
|
14626
|
-
result++;
|
|
14627
|
-
if (codePoint > 2047) {
|
|
14628
|
-
result++;
|
|
14629
|
-
if (codePoint > 65535) {
|
|
14630
|
-
i++;
|
|
14631
|
-
}
|
|
14632
|
-
}
|
|
14633
|
-
}
|
|
14634
|
-
}
|
|
14635
|
-
return result;
|
|
14636
|
-
}
|
|
14637
|
-
var UTF8_DECODER = /* @__PURE__ */ new TextDecoder("utf-8", { fatal: true });
|
|
14638
|
-
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
14639
|
-
|
|
14640
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
14641
|
-
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
14642
|
-
if (DEV) {
|
|
14643
|
-
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
14644
|
-
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
14645
|
-
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
14646
|
-
}
|
|
14647
|
-
return {
|
|
14648
|
-
initialBufferLength,
|
|
14649
|
-
maxBufferLength
|
|
14650
|
-
};
|
|
14651
|
-
}
|
|
14652
|
-
|
|
14653
|
-
// ../rivetkit/dist/tsup/chunk-5UYNV4W6.js
|
|
14654
|
-
var config2 = /* @__PURE__ */ Config({});
|
|
14655
|
-
function readWorkflowCbor(bc) {
|
|
14656
|
-
return readData(bc);
|
|
14657
|
-
}
|
|
14658
|
-
function readWorkflowNameIndex(bc) {
|
|
14659
|
-
return readU32(bc);
|
|
14660
|
-
}
|
|
14661
|
-
function readWorkflowLoopIterationMarker(bc) {
|
|
14662
|
-
return {
|
|
14663
|
-
loop: readWorkflowNameIndex(bc),
|
|
14664
|
-
iteration: readU32(bc)
|
|
14665
|
-
};
|
|
14666
|
-
}
|
|
14667
|
-
function readWorkflowPathSegment(bc) {
|
|
14668
|
-
const offset = bc.offset;
|
|
14669
|
-
const tag = readU8(bc);
|
|
14670
|
-
switch (tag) {
|
|
14671
|
-
case 0:
|
|
14672
|
-
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
14673
|
-
case 1:
|
|
14674
|
-
return {
|
|
14675
|
-
tag: "WorkflowLoopIterationMarker",
|
|
14676
|
-
val: readWorkflowLoopIterationMarker(bc)
|
|
14677
|
-
};
|
|
14678
|
-
default: {
|
|
14679
|
-
bc.offset = offset;
|
|
14680
|
-
throw new BareError(offset, "invalid tag");
|
|
14681
|
-
}
|
|
14682
|
-
}
|
|
14683
|
-
}
|
|
14684
|
-
function readWorkflowLocation(bc) {
|
|
14685
|
-
const len = readUintSafe(bc);
|
|
14686
|
-
if (len === 0) {
|
|
14687
|
-
return [];
|
|
14688
|
-
}
|
|
14689
|
-
const result = [readWorkflowPathSegment(bc)];
|
|
14690
|
-
for (let i = 1; i < len; i++) {
|
|
14691
|
-
result[i] = readWorkflowPathSegment(bc);
|
|
14692
|
-
}
|
|
14693
|
-
return result;
|
|
14694
|
-
}
|
|
14695
|
-
function readWorkflowEntryStatus(bc) {
|
|
14696
|
-
const offset = bc.offset;
|
|
14697
|
-
const tag = readU8(bc);
|
|
14698
|
-
switch (tag) {
|
|
14699
|
-
case 0:
|
|
14700
|
-
return "PENDING";
|
|
14701
|
-
case 1:
|
|
14702
|
-
return "RUNNING";
|
|
14703
|
-
case 2:
|
|
14704
|
-
return "COMPLETED";
|
|
14705
|
-
case 3:
|
|
14706
|
-
return "FAILED";
|
|
14707
|
-
case 4:
|
|
14708
|
-
return "EXHAUSTED";
|
|
14709
|
-
default: {
|
|
14710
|
-
bc.offset = offset;
|
|
14711
|
-
throw new BareError(offset, "invalid tag");
|
|
14712
|
-
}
|
|
14713
|
-
}
|
|
14714
|
-
}
|
|
14715
|
-
function readWorkflowSleepState(bc) {
|
|
14716
|
-
const offset = bc.offset;
|
|
14717
|
-
const tag = readU8(bc);
|
|
14718
|
-
switch (tag) {
|
|
14719
|
-
case 0:
|
|
14720
|
-
return "PENDING";
|
|
14721
|
-
case 1:
|
|
14722
|
-
return "COMPLETED";
|
|
14723
|
-
case 2:
|
|
14724
|
-
return "INTERRUPTED";
|
|
14725
|
-
default: {
|
|
14726
|
-
bc.offset = offset;
|
|
14727
|
-
throw new BareError(offset, "invalid tag");
|
|
14728
|
-
}
|
|
14729
|
-
}
|
|
14730
|
-
}
|
|
14731
|
-
function readWorkflowBranchStatusType(bc) {
|
|
14732
|
-
const offset = bc.offset;
|
|
14733
|
-
const tag = readU8(bc);
|
|
14734
|
-
switch (tag) {
|
|
14735
|
-
case 0:
|
|
14736
|
-
return "PENDING";
|
|
14737
|
-
case 1:
|
|
14738
|
-
return "RUNNING";
|
|
14739
|
-
case 2:
|
|
14740
|
-
return "COMPLETED";
|
|
14741
|
-
case 3:
|
|
14742
|
-
return "FAILED";
|
|
14743
|
-
case 4:
|
|
14744
|
-
return "CANCELLED";
|
|
14745
|
-
default: {
|
|
14746
|
-
bc.offset = offset;
|
|
14747
|
-
throw new BareError(offset, "invalid tag");
|
|
15057
|
+
codePoint > 1114111 || // too large code point
|
|
15058
|
+
byte1 >> 3 !== 30 || // invalid tag
|
|
15059
|
+
byte2 >> 6 !== 2 || // invalid tag
|
|
15060
|
+
byte3 >> 6 !== 2 || // invalid tag
|
|
15061
|
+
byte4 >> 6 !== 2;
|
|
15062
|
+
}
|
|
15063
|
+
if (malformed) {
|
|
15064
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
15065
|
+
}
|
|
14748
15066
|
}
|
|
15067
|
+
result += String.fromCodePoint(codePoint);
|
|
14749
15068
|
}
|
|
15069
|
+
bc.offset = offset;
|
|
15070
|
+
return result;
|
|
14750
15071
|
}
|
|
14751
|
-
function
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
}
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
}
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
}
|
|
14775
|
-
|
|
14776
|
-
function readWorkflowMessageEntry(bc) {
|
|
14777
|
-
return {
|
|
14778
|
-
name: readString(bc),
|
|
14779
|
-
messageData: readWorkflowCbor(bc)
|
|
14780
|
-
};
|
|
14781
|
-
}
|
|
14782
|
-
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
14783
|
-
return {
|
|
14784
|
-
name: readString(bc)
|
|
14785
|
-
};
|
|
14786
|
-
}
|
|
14787
|
-
function readWorkflowBranchStatus(bc) {
|
|
14788
|
-
return {
|
|
14789
|
-
status: readWorkflowBranchStatusType(bc),
|
|
14790
|
-
output: read0(bc),
|
|
14791
|
-
error: read1(bc)
|
|
14792
|
-
};
|
|
15072
|
+
function writeUtf8Js(bc, s) {
|
|
15073
|
+
const bytes = bc.bytes;
|
|
15074
|
+
let offset = bc.offset;
|
|
15075
|
+
let i = 0;
|
|
15076
|
+
while (i < s.length) {
|
|
15077
|
+
const codePoint = s.codePointAt(i++);
|
|
15078
|
+
if (codePoint < 128) {
|
|
15079
|
+
bytes[offset++] = codePoint;
|
|
15080
|
+
} else {
|
|
15081
|
+
if (codePoint < 2048) {
|
|
15082
|
+
bytes[offset++] = 192 | codePoint >> 6;
|
|
15083
|
+
} else {
|
|
15084
|
+
if (codePoint < 65536) {
|
|
15085
|
+
bytes[offset++] = 224 | codePoint >> 12;
|
|
15086
|
+
} else {
|
|
15087
|
+
bytes[offset++] = 240 | codePoint >> 18;
|
|
15088
|
+
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
15089
|
+
i++;
|
|
15090
|
+
}
|
|
15091
|
+
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
15092
|
+
}
|
|
15093
|
+
bytes[offset++] = 128 | codePoint & 63;
|
|
15094
|
+
}
|
|
15095
|
+
}
|
|
15096
|
+
bc.offset = offset;
|
|
14793
15097
|
}
|
|
14794
|
-
function
|
|
14795
|
-
|
|
14796
|
-
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
|
|
15098
|
+
function utf8ByteLength(s) {
|
|
15099
|
+
let result = s.length;
|
|
15100
|
+
for (let i = 0; i < s.length; i++) {
|
|
15101
|
+
const codePoint = s.codePointAt(i);
|
|
15102
|
+
if (codePoint > 127) {
|
|
15103
|
+
result++;
|
|
15104
|
+
if (codePoint > 2047) {
|
|
15105
|
+
result++;
|
|
15106
|
+
if (codePoint > 65535) {
|
|
15107
|
+
i++;
|
|
15108
|
+
}
|
|
15109
|
+
}
|
|
14803
15110
|
}
|
|
14804
|
-
result.set(key, readWorkflowBranchStatus(bc));
|
|
14805
15111
|
}
|
|
14806
15112
|
return result;
|
|
14807
15113
|
}
|
|
14808
|
-
|
|
15114
|
+
var UTF8_DECODER = /* @__PURE__ */ new TextDecoder("utf-8", { fatal: true });
|
|
15115
|
+
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
15116
|
+
|
|
15117
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
15118
|
+
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
15119
|
+
if (DEV) {
|
|
15120
|
+
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
15121
|
+
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
15122
|
+
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
15123
|
+
}
|
|
14809
15124
|
return {
|
|
14810
|
-
|
|
15125
|
+
initialBufferLength,
|
|
15126
|
+
maxBufferLength
|
|
14811
15127
|
};
|
|
14812
15128
|
}
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
15129
|
+
|
|
15130
|
+
// ../rivetkit/dist/tsup/chunk-KPZQI3TG.js
|
|
15131
|
+
var config2 = /* @__PURE__ */ Config({});
|
|
15132
|
+
function readWorkflowCbor(bc) {
|
|
15133
|
+
return readData(bc);
|
|
14818
15134
|
}
|
|
14819
|
-
function
|
|
14820
|
-
return
|
|
14821
|
-
originalType: readString(bc),
|
|
14822
|
-
originalName: read1(bc)
|
|
14823
|
-
};
|
|
15135
|
+
function readWorkflowNameIndex(bc) {
|
|
15136
|
+
return readU32(bc);
|
|
14824
15137
|
}
|
|
14825
|
-
function
|
|
15138
|
+
function readWorkflowLoopIterationMarker(bc) {
|
|
14826
15139
|
return {
|
|
14827
|
-
|
|
14828
|
-
|
|
15140
|
+
loop: readWorkflowNameIndex(bc),
|
|
15141
|
+
iteration: readU32(bc)
|
|
14829
15142
|
};
|
|
14830
15143
|
}
|
|
14831
|
-
function
|
|
15144
|
+
function readWorkflowPathSegment(bc) {
|
|
14832
15145
|
const offset = bc.offset;
|
|
14833
15146
|
const tag = readU8(bc);
|
|
14834
15147
|
switch (tag) {
|
|
14835
15148
|
case 0:
|
|
14836
|
-
return { tag: "
|
|
15149
|
+
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
14837
15150
|
case 1:
|
|
14838
|
-
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
14839
|
-
case 2:
|
|
14840
|
-
return {
|
|
14841
|
-
tag: "WorkflowSleepEntry",
|
|
14842
|
-
val: readWorkflowSleepEntry(bc)
|
|
14843
|
-
};
|
|
14844
|
-
case 3:
|
|
14845
|
-
return {
|
|
14846
|
-
tag: "WorkflowMessageEntry",
|
|
14847
|
-
val: readWorkflowMessageEntry(bc)
|
|
14848
|
-
};
|
|
14849
|
-
case 4:
|
|
14850
|
-
return {
|
|
14851
|
-
tag: "WorkflowRollbackCheckpointEntry",
|
|
14852
|
-
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
14853
|
-
};
|
|
14854
|
-
case 5:
|
|
14855
|
-
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
14856
|
-
case 6:
|
|
14857
|
-
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
14858
|
-
case 7:
|
|
14859
|
-
return {
|
|
14860
|
-
tag: "WorkflowRemovedEntry",
|
|
14861
|
-
val: readWorkflowRemovedEntry(bc)
|
|
14862
|
-
};
|
|
14863
|
-
case 8:
|
|
14864
15151
|
return {
|
|
14865
|
-
tag: "
|
|
14866
|
-
val:
|
|
15152
|
+
tag: "WorkflowLoopIterationMarker",
|
|
15153
|
+
val: readWorkflowLoopIterationMarker(bc)
|
|
14867
15154
|
};
|
|
14868
15155
|
default: {
|
|
14869
15156
|
bc.offset = offset;
|
|
14870
15157
|
throw new BareError(offset, "invalid tag");
|
|
14871
|
-
}
|
|
14872
|
-
}
|
|
14873
|
-
}
|
|
14874
|
-
function readWorkflowEntry(bc) {
|
|
14875
|
-
return {
|
|
14876
|
-
id: readString(bc),
|
|
14877
|
-
location: readWorkflowLocation(bc),
|
|
14878
|
-
kind: readWorkflowEntryKind(bc)
|
|
14879
|
-
};
|
|
14880
|
-
}
|
|
14881
|
-
function read3(bc) {
|
|
14882
|
-
return readBool(bc) ? readU64(bc) : null;
|
|
14883
|
-
}
|
|
14884
|
-
function readWorkflowEntryMetadata(bc) {
|
|
14885
|
-
return {
|
|
14886
|
-
status: readWorkflowEntryStatus(bc),
|
|
14887
|
-
error: read1(bc),
|
|
14888
|
-
attempts: readU32(bc),
|
|
14889
|
-
lastAttemptAt: readU64(bc),
|
|
14890
|
-
createdAt: readU64(bc),
|
|
14891
|
-
completedAt: read3(bc),
|
|
14892
|
-
rollbackCompletedAt: read3(bc),
|
|
14893
|
-
rollbackError: read1(bc)
|
|
14894
|
-
};
|
|
14895
|
-
}
|
|
14896
|
-
function read4(bc) {
|
|
14897
|
-
const len = readUintSafe(bc);
|
|
14898
|
-
if (len === 0) {
|
|
14899
|
-
return [];
|
|
14900
|
-
}
|
|
14901
|
-
const result = [readString(bc)];
|
|
14902
|
-
for (let i = 1; i < len; i++) {
|
|
14903
|
-
result[i] = readString(bc);
|
|
14904
|
-
}
|
|
14905
|
-
return result;
|
|
14906
|
-
}
|
|
14907
|
-
function read5(bc) {
|
|
14908
|
-
const len = readUintSafe(bc);
|
|
14909
|
-
if (len === 0) {
|
|
14910
|
-
return [];
|
|
14911
|
-
}
|
|
14912
|
-
const result = [readWorkflowEntry(bc)];
|
|
14913
|
-
for (let i = 1; i < len; i++) {
|
|
14914
|
-
result[i] = readWorkflowEntry(bc);
|
|
14915
|
-
}
|
|
14916
|
-
return result;
|
|
14917
|
-
}
|
|
14918
|
-
function read6(bc) {
|
|
14919
|
-
const len = readUintSafe(bc);
|
|
14920
|
-
const result = /* @__PURE__ */ new Map();
|
|
14921
|
-
for (let i = 0; i < len; i++) {
|
|
14922
|
-
const offset = bc.offset;
|
|
14923
|
-
const key = readString(bc);
|
|
14924
|
-
if (result.has(key)) {
|
|
14925
|
-
bc.offset = offset;
|
|
14926
|
-
throw new BareError(offset, "duplicated key");
|
|
14927
|
-
}
|
|
14928
|
-
result.set(key, readWorkflowEntryMetadata(bc));
|
|
14929
|
-
}
|
|
14930
|
-
return result;
|
|
14931
|
-
}
|
|
14932
|
-
function readWorkflowHistory(bc) {
|
|
14933
|
-
return {
|
|
14934
|
-
nameRegistry: read4(bc),
|
|
14935
|
-
entries: read5(bc),
|
|
14936
|
-
entryMetadata: read6(bc)
|
|
14937
|
-
};
|
|
14938
|
-
}
|
|
14939
|
-
function decodeWorkflowHistory(bytes) {
|
|
14940
|
-
const bc = new ByteCursor(bytes, config2);
|
|
14941
|
-
const result = readWorkflowHistory(bc);
|
|
14942
|
-
if (bc.offset < bc.view.byteLength) {
|
|
14943
|
-
throw new BareError(bc.offset, "remaining bytes");
|
|
14944
|
-
}
|
|
14945
|
-
return result;
|
|
14946
|
-
}
|
|
14947
|
-
function decodeWorkflowHistoryTransport(data) {
|
|
14948
|
-
return decodeWorkflowHistory(toUint8Array(data));
|
|
14949
|
-
}
|
|
14950
|
-
|
|
14951
|
-
// ../rivetkit/dist/tsup/chunk-6W5VGLFT.js
|
|
14952
|
-
function flattenActionHandlers(actions) {
|
|
14953
|
-
const flattened = /* @__PURE__ */ Object.create(null);
|
|
14954
|
-
for (const { name, handler } of collectActionEntries(actions)) {
|
|
14955
|
-
flattened[name] = handler;
|
|
15158
|
+
}
|
|
14956
15159
|
}
|
|
14957
|
-
return flattened;
|
|
14958
15160
|
}
|
|
14959
|
-
function
|
|
14960
|
-
|
|
14961
|
-
if (
|
|
14962
|
-
|
|
15161
|
+
function readWorkflowLocation(bc) {
|
|
15162
|
+
const len = readUintSafe(bc);
|
|
15163
|
+
if (len === 0) {
|
|
15164
|
+
return [];
|
|
14963
15165
|
}
|
|
14964
|
-
const
|
|
14965
|
-
for (
|
|
14966
|
-
|
|
14967
|
-
const flatSchema = schemas[name];
|
|
14968
|
-
if (nestedSchema !== void 0 && flatSchema !== void 0 && nestedSchema !== flatSchema) {
|
|
14969
|
-
throw new TypeError(
|
|
14970
|
-
`Action input schema \`${name}\` is defined by both a nested path and a dotted key`
|
|
14971
|
-
);
|
|
14972
|
-
}
|
|
14973
|
-
const schema = nestedSchema ?? flatSchema;
|
|
14974
|
-
if (schema !== void 0) {
|
|
14975
|
-
flattened[name] = schema;
|
|
14976
|
-
}
|
|
15166
|
+
const result = [readWorkflowPathSegment(bc)];
|
|
15167
|
+
for (let i = 1; i < len; i++) {
|
|
15168
|
+
result[i] = readWorkflowPathSegment(bc);
|
|
14977
15169
|
}
|
|
14978
|
-
return
|
|
14979
|
-
}
|
|
14980
|
-
function collectActionEntries(actions) {
|
|
14981
|
-
const entries = [];
|
|
14982
|
-
const names = /* @__PURE__ */ new Set();
|
|
14983
|
-
visitActionGroup(actions ?? {}, [], entries, names);
|
|
14984
|
-
return entries;
|
|
15170
|
+
return result;
|
|
14985
15171
|
}
|
|
14986
|
-
function
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
name,
|
|
15004
|
-
path: childPath,
|
|
15005
|
-
handler: child
|
|
15006
|
-
});
|
|
15007
|
-
} else {
|
|
15008
|
-
visitActionGroup(child, childPath, entries, names);
|
|
15172
|
+
function readWorkflowEntryStatus(bc) {
|
|
15173
|
+
const offset = bc.offset;
|
|
15174
|
+
const tag = readU8(bc);
|
|
15175
|
+
switch (tag) {
|
|
15176
|
+
case 0:
|
|
15177
|
+
return "PENDING";
|
|
15178
|
+
case 1:
|
|
15179
|
+
return "RUNNING";
|
|
15180
|
+
case 2:
|
|
15181
|
+
return "COMPLETED";
|
|
15182
|
+
case 3:
|
|
15183
|
+
return "FAILED";
|
|
15184
|
+
case 4:
|
|
15185
|
+
return "EXHAUSTED";
|
|
15186
|
+
default: {
|
|
15187
|
+
bc.offset = offset;
|
|
15188
|
+
throw new BareError(offset, "invalid tag");
|
|
15009
15189
|
}
|
|
15010
15190
|
}
|
|
15011
15191
|
}
|
|
15012
|
-
function
|
|
15013
|
-
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15192
|
+
function readWorkflowSleepState(bc) {
|
|
15193
|
+
const offset = bc.offset;
|
|
15194
|
+
const tag = readU8(bc);
|
|
15195
|
+
switch (tag) {
|
|
15196
|
+
case 0:
|
|
15197
|
+
return "PENDING";
|
|
15198
|
+
case 1:
|
|
15199
|
+
return "COMPLETED";
|
|
15200
|
+
case 2:
|
|
15201
|
+
return "INTERRUPTED";
|
|
15202
|
+
default: {
|
|
15203
|
+
bc.offset = offset;
|
|
15204
|
+
throw new BareError(offset, "invalid tag");
|
|
15017
15205
|
}
|
|
15018
|
-
value = value[segment];
|
|
15019
15206
|
}
|
|
15020
|
-
return value;
|
|
15021
15207
|
}
|
|
15022
|
-
function
|
|
15023
|
-
|
|
15024
|
-
|
|
15208
|
+
function readWorkflowBranchStatusType(bc) {
|
|
15209
|
+
const offset = bc.offset;
|
|
15210
|
+
const tag = readU8(bc);
|
|
15211
|
+
switch (tag) {
|
|
15212
|
+
case 0:
|
|
15213
|
+
return "PENDING";
|
|
15214
|
+
case 1:
|
|
15215
|
+
return "RUNNING";
|
|
15216
|
+
case 2:
|
|
15217
|
+
return "COMPLETED";
|
|
15218
|
+
case 3:
|
|
15219
|
+
return "FAILED";
|
|
15220
|
+
case 4:
|
|
15221
|
+
return "CANCELLED";
|
|
15222
|
+
default: {
|
|
15223
|
+
bc.offset = offset;
|
|
15224
|
+
throw new BareError(offset, "invalid tag");
|
|
15225
|
+
}
|
|
15025
15226
|
}
|
|
15026
|
-
const prototype = Object.getPrototypeOf(value);
|
|
15027
|
-
return prototype === Object.prototype || prototype === null;
|
|
15028
15227
|
}
|
|
15029
|
-
function
|
|
15030
|
-
return
|
|
15228
|
+
function read0(bc) {
|
|
15229
|
+
return readBool(bc) ? readWorkflowCbor(bc) : null;
|
|
15031
15230
|
}
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
)
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
}
|
|
15054
|
-
});
|
|
15055
|
-
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
15056
|
-
getHistory: zFunction(),
|
|
15057
|
-
getState: zFunction().optional(),
|
|
15058
|
-
onHistoryUpdated: zFunction().optional(),
|
|
15059
|
-
replayFromStep: zFunction().optional()
|
|
15060
|
-
});
|
|
15061
|
-
var RunInspectorConfigSchema = external_exports.object({
|
|
15062
|
-
workflow: WorkflowInspectorConfigSchema.optional()
|
|
15063
|
-
}).optional();
|
|
15064
|
-
var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
15065
|
-
"workflow",
|
|
15066
|
-
"database",
|
|
15067
|
-
"state",
|
|
15068
|
-
"queue",
|
|
15069
|
-
"schedules",
|
|
15070
|
-
"connections",
|
|
15071
|
-
"console"
|
|
15072
|
-
];
|
|
15073
|
-
var BuiltinInspectorTabIdSchema = external_exports.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
15074
|
-
var CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
15075
|
-
var CustomInspectorTabEntrySchema = external_exports.object({
|
|
15076
|
-
id: external_exports.string().regex(
|
|
15077
|
-
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
15078
|
-
"inspector.tabs[].id must contain only letters, digits, underscore, or dash"
|
|
15079
|
-
),
|
|
15080
|
-
label: external_exports.string().min(1),
|
|
15081
|
-
source: external_exports.string().min(1),
|
|
15082
|
-
/**
|
|
15083
|
-
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
15084
|
-
* icon registry); unknown ids fall back to a generic icon.
|
|
15085
|
-
*/
|
|
15086
|
-
icon: external_exports.string().min(1).optional(),
|
|
15087
|
-
hidden: external_exports.literal(false).optional()
|
|
15088
|
-
}).strict();
|
|
15089
|
-
var HideInspectorTabEntrySchema = external_exports.object({
|
|
15090
|
-
id: BuiltinInspectorTabIdSchema,
|
|
15091
|
-
hidden: external_exports.literal(true)
|
|
15092
|
-
}).strict();
|
|
15093
|
-
var InspectorTabEntrySchema = external_exports.union([
|
|
15094
|
-
CustomInspectorTabEntrySchema,
|
|
15095
|
-
HideInspectorTabEntrySchema
|
|
15096
|
-
]);
|
|
15097
|
-
var ActorInspectorConfigSchema = external_exports.object({
|
|
15098
|
-
tabs: external_exports.array(InspectorTabEntrySchema).default(() => [])
|
|
15099
|
-
}).strict().refine(
|
|
15100
|
-
(data) => {
|
|
15101
|
-
const ids = data.tabs.map((t) => t.id);
|
|
15102
|
-
return new Set(ids).size === ids.length;
|
|
15103
|
-
},
|
|
15104
|
-
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] }
|
|
15105
|
-
).refine(
|
|
15106
|
-
(data) => {
|
|
15107
|
-
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
15108
|
-
return data.tabs.every(
|
|
15109
|
-
(t) => t.hidden === true || !builtinSet.has(t.id)
|
|
15110
|
-
);
|
|
15111
|
-
},
|
|
15112
|
-
{
|
|
15113
|
-
message: "Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
15114
|
-
path: ["tabs"]
|
|
15115
|
-
}
|
|
15116
|
-
);
|
|
15117
|
-
var RunConfigSchema = external_exports.object({
|
|
15118
|
-
/** Display name for the actor in the Inspector UI. */
|
|
15119
|
-
name: external_exports.string().optional(),
|
|
15120
|
-
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
15121
|
-
icon: external_exports.string().optional(),
|
|
15122
|
-
/** The run handler function. */
|
|
15123
|
-
run: zFunction(),
|
|
15124
|
-
/** Inspector integration for long-running run handlers. */
|
|
15125
|
-
inspector: RunInspectorConfigSchema.optional()
|
|
15126
|
-
});
|
|
15127
|
-
var RUN_FUNCTION_CONFIG_SYMBOL = /* @__PURE__ */ Symbol.for("rivetkit.run_function_config");
|
|
15128
|
-
function defineRunHandler(run, options) {
|
|
15129
|
-
if (options.inspectorKind === void 0 !== (options.createInspector === void 0)) {
|
|
15130
|
-
throw new TypeError(
|
|
15131
|
-
"defineRunHandler requires inspectorKind and createInspector together"
|
|
15132
|
-
);
|
|
15133
|
-
}
|
|
15134
|
-
Object.defineProperty(run, RUN_FUNCTION_CONFIG_SYMBOL, {
|
|
15135
|
-
configurable: false,
|
|
15136
|
-
enumerable: false,
|
|
15137
|
-
writable: false,
|
|
15138
|
-
value: {
|
|
15139
|
-
name: options.name,
|
|
15140
|
-
icon: options.icon,
|
|
15141
|
-
inspectorKind: options.inspectorKind,
|
|
15142
|
-
createInspector: options.createInspector
|
|
15143
|
-
}
|
|
15144
|
-
});
|
|
15145
|
-
return run;
|
|
15231
|
+
function read1(bc) {
|
|
15232
|
+
return readBool(bc) ? readString(bc) : null;
|
|
15233
|
+
}
|
|
15234
|
+
function readWorkflowStepEntry(bc) {
|
|
15235
|
+
return {
|
|
15236
|
+
output: read0(bc),
|
|
15237
|
+
error: read1(bc)
|
|
15238
|
+
};
|
|
15239
|
+
}
|
|
15240
|
+
function readWorkflowLoopEntry(bc) {
|
|
15241
|
+
return {
|
|
15242
|
+
state: readWorkflowCbor(bc),
|
|
15243
|
+
iteration: readU32(bc),
|
|
15244
|
+
output: read0(bc)
|
|
15245
|
+
};
|
|
15246
|
+
}
|
|
15247
|
+
function readWorkflowSleepEntry(bc) {
|
|
15248
|
+
return {
|
|
15249
|
+
deadline: readU64(bc),
|
|
15250
|
+
state: readWorkflowSleepState(bc)
|
|
15251
|
+
};
|
|
15146
15252
|
}
|
|
15147
|
-
function
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15253
|
+
function readWorkflowMessageEntry(bc) {
|
|
15254
|
+
return {
|
|
15255
|
+
name: readString(bc),
|
|
15256
|
+
messageData: readWorkflowCbor(bc)
|
|
15257
|
+
};
|
|
15151
15258
|
}
|
|
15152
|
-
function
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15259
|
+
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
15260
|
+
return {
|
|
15261
|
+
name: readString(bc)
|
|
15262
|
+
};
|
|
15156
15263
|
}
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15264
|
+
function readWorkflowBranchStatus(bc) {
|
|
15265
|
+
return {
|
|
15266
|
+
status: readWorkflowBranchStatusType(bc),
|
|
15267
|
+
output: read0(bc),
|
|
15268
|
+
error: read1(bc)
|
|
15269
|
+
};
|
|
15162
15270
|
}
|
|
15163
|
-
function
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15271
|
+
function read2(bc) {
|
|
15272
|
+
const len = readUintSafe(bc);
|
|
15273
|
+
const result = /* @__PURE__ */ new Map();
|
|
15274
|
+
for (let i = 0; i < len; i++) {
|
|
15275
|
+
const offset = bc.offset;
|
|
15276
|
+
const key = readString(bc);
|
|
15277
|
+
if (result.has(key)) {
|
|
15278
|
+
bc.offset = offset;
|
|
15279
|
+
throw new BareError(offset, "duplicated key");
|
|
15280
|
+
}
|
|
15281
|
+
result.set(key, readWorkflowBranchStatus(bc));
|
|
15169
15282
|
}
|
|
15170
|
-
return
|
|
15283
|
+
return result;
|
|
15171
15284
|
}
|
|
15172
|
-
function
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15285
|
+
function readWorkflowJoinEntry(bc) {
|
|
15286
|
+
return {
|
|
15287
|
+
branches: read2(bc)
|
|
15288
|
+
};
|
|
15289
|
+
}
|
|
15290
|
+
function readWorkflowRaceEntry(bc) {
|
|
15291
|
+
return {
|
|
15292
|
+
winner: read1(bc),
|
|
15293
|
+
branches: read2(bc)
|
|
15294
|
+
};
|
|
15295
|
+
}
|
|
15296
|
+
function readWorkflowRemovedEntry(bc) {
|
|
15297
|
+
return {
|
|
15298
|
+
originalType: readString(bc),
|
|
15299
|
+
originalName: read1(bc)
|
|
15300
|
+
};
|
|
15301
|
+
}
|
|
15302
|
+
function readWorkflowVersionCheckEntry(bc) {
|
|
15303
|
+
return {
|
|
15304
|
+
resolved: readU32(bc),
|
|
15305
|
+
latest: readU32(bc)
|
|
15306
|
+
};
|
|
15307
|
+
}
|
|
15308
|
+
function readWorkflowEntryKind(bc) {
|
|
15309
|
+
const offset = bc.offset;
|
|
15310
|
+
const tag = readU8(bc);
|
|
15311
|
+
switch (tag) {
|
|
15312
|
+
case 0:
|
|
15313
|
+
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
15314
|
+
case 1:
|
|
15315
|
+
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
15316
|
+
case 2:
|
|
15317
|
+
return {
|
|
15318
|
+
tag: "WorkflowSleepEntry",
|
|
15319
|
+
val: readWorkflowSleepEntry(bc)
|
|
15320
|
+
};
|
|
15321
|
+
case 3:
|
|
15322
|
+
return {
|
|
15323
|
+
tag: "WorkflowMessageEntry",
|
|
15324
|
+
val: readWorkflowMessageEntry(bc)
|
|
15325
|
+
};
|
|
15326
|
+
case 4:
|
|
15327
|
+
return {
|
|
15328
|
+
tag: "WorkflowRollbackCheckpointEntry",
|
|
15329
|
+
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
15330
|
+
};
|
|
15331
|
+
case 5:
|
|
15332
|
+
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
15333
|
+
case 6:
|
|
15334
|
+
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
15335
|
+
case 7:
|
|
15336
|
+
return {
|
|
15337
|
+
tag: "WorkflowRemovedEntry",
|
|
15338
|
+
val: readWorkflowRemovedEntry(bc)
|
|
15339
|
+
};
|
|
15340
|
+
case 8:
|
|
15341
|
+
return {
|
|
15342
|
+
tag: "WorkflowVersionCheckEntry",
|
|
15343
|
+
val: readWorkflowVersionCheckEntry(bc)
|
|
15344
|
+
};
|
|
15345
|
+
default: {
|
|
15346
|
+
bc.offset = offset;
|
|
15347
|
+
throw new BareError(offset, "invalid tag");
|
|
15348
|
+
}
|
|
15177
15349
|
}
|
|
15178
|
-
return run.inspector;
|
|
15179
15350
|
}
|
|
15180
|
-
function
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15351
|
+
function readWorkflowEntry(bc) {
|
|
15352
|
+
return {
|
|
15353
|
+
id: readString(bc),
|
|
15354
|
+
location: readWorkflowLocation(bc),
|
|
15355
|
+
kind: readWorkflowEntryKind(bc)
|
|
15356
|
+
};
|
|
15185
15357
|
}
|
|
15186
|
-
function
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15358
|
+
function read3(bc) {
|
|
15359
|
+
return readBool(bc) ? readU64(bc) : null;
|
|
15360
|
+
}
|
|
15361
|
+
function readWorkflowEntryMetadata(bc) {
|
|
15362
|
+
return {
|
|
15363
|
+
status: readWorkflowEntryStatus(bc),
|
|
15364
|
+
error: read1(bc),
|
|
15365
|
+
attempts: readU32(bc),
|
|
15366
|
+
lastAttemptAt: readU64(bc),
|
|
15367
|
+
createdAt: readU64(bc),
|
|
15368
|
+
completedAt: read3(bc),
|
|
15369
|
+
rollbackCompletedAt: read3(bc),
|
|
15370
|
+
rollbackError: read1(bc)
|
|
15371
|
+
};
|
|
15372
|
+
}
|
|
15373
|
+
function read4(bc) {
|
|
15374
|
+
const len = readUintSafe(bc);
|
|
15375
|
+
if (len === 0) {
|
|
15376
|
+
return [];
|
|
15190
15377
|
}
|
|
15191
|
-
const
|
|
15192
|
-
(
|
|
15378
|
+
const result = [readString(bc)];
|
|
15379
|
+
for (let i = 1; i < len; i++) {
|
|
15380
|
+
result[i] = readString(bc);
|
|
15381
|
+
}
|
|
15382
|
+
return result;
|
|
15193
15383
|
}
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
icon: external_exports.string().optional(),
|
|
15199
|
-
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
15200
|
-
enableActorRuntimeSocket: external_exports.boolean().default(false),
|
|
15201
|
-
/**
|
|
15202
|
-
* Can hibernate WebSockets for onWebSocket.
|
|
15203
|
-
*
|
|
15204
|
-
* WebSockets using actions/events are hibernatable by default.
|
|
15205
|
-
*
|
|
15206
|
-
* @experimental
|
|
15207
|
-
**/
|
|
15208
|
-
canHibernateWebSocket: external_exports.union([external_exports.boolean(), zFunction()]).default(false)
|
|
15209
|
-
}).strict();
|
|
15210
|
-
var GlobalActorOptionsSchema = GlobalActorOptionsBaseSchema.prefault(
|
|
15211
|
-
() => ({})
|
|
15212
|
-
);
|
|
15213
|
-
var InstanceActorOptionsBaseSchema = external_exports.object({
|
|
15214
|
-
createVarsTimeout: external_exports.number().positive().default(5e3),
|
|
15215
|
-
createConnStateTimeout: external_exports.number().positive().default(5e3),
|
|
15216
|
-
onBeforeConnectTimeout: external_exports.number().positive().default(5e3),
|
|
15217
|
-
onConnectTimeout: external_exports.number().positive().default(5e3),
|
|
15218
|
-
onMigrateTimeout: external_exports.number().positive().default(3e4),
|
|
15219
|
-
sleepGracePeriod: external_exports.number().positive().default(DEFAULT_SLEEP_GRACE_PERIOD),
|
|
15220
|
-
/** @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. */
|
|
15221
|
-
onDestroyTimeout: external_exports.number().positive().optional(),
|
|
15222
|
-
/** @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. */
|
|
15223
|
-
waitUntilTimeout: external_exports.number().positive().optional(),
|
|
15224
|
-
stateSaveInterval: external_exports.number().positive().default(1e3),
|
|
15225
|
-
actionTimeout: external_exports.number().positive().default(6e4),
|
|
15226
|
-
connectionLivenessTimeout: external_exports.number().positive().default(2500),
|
|
15227
|
-
connectionLivenessInterval: external_exports.number().positive().default(5e3),
|
|
15228
|
-
/** @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. */
|
|
15229
|
-
noSleep: external_exports.boolean().default(false),
|
|
15230
|
-
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
15231
|
-
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
15232
|
-
/** Maximum pending one-shot and recurring schedules. */
|
|
15233
|
-
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
15234
|
-
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
15235
|
-
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
15236
|
-
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
15237
|
-
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
15238
|
-
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
15239
|
-
}).strict();
|
|
15240
|
-
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
15241
|
-
var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
15242
|
-
InstanceActorOptionsBaseSchema.shape
|
|
15243
|
-
).strict().prefault(() => ({}));
|
|
15244
|
-
var ActorConfigSchema = external_exports.object({
|
|
15245
|
-
onCreate: zFunction().optional(),
|
|
15246
|
-
onDestroy: zFunction().optional(),
|
|
15247
|
-
onMigrate: zFunction().optional(),
|
|
15248
|
-
onWake: zFunction().optional(),
|
|
15249
|
-
onSleep: zFunction().optional(),
|
|
15250
|
-
run: zRunHandler,
|
|
15251
|
-
onStateChange: zFunction().optional(),
|
|
15252
|
-
onBeforeConnect: zFunction().optional(),
|
|
15253
|
-
onConnect: zFunction().optional(),
|
|
15254
|
-
onDisconnect: zFunction().optional(),
|
|
15255
|
-
onBeforeActionResponse: zFunction().optional(),
|
|
15256
|
-
onRequest: zFunction().optional(),
|
|
15257
|
-
onWebSocket: zFunction().optional(),
|
|
15258
|
-
actions: zActionTree.default(() => ({})),
|
|
15259
|
-
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15260
|
-
connParamsSchema: external_exports.any().optional(),
|
|
15261
|
-
events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15262
|
-
queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15263
|
-
state: external_exports.any().optional(),
|
|
15264
|
-
createState: zFunction().optional(),
|
|
15265
|
-
connState: external_exports.any().optional(),
|
|
15266
|
-
createConnState: zFunction().optional(),
|
|
15267
|
-
vars: external_exports.any().optional(),
|
|
15268
|
-
db: external_exports.any().optional(),
|
|
15269
|
-
createVars: zFunction().optional(),
|
|
15270
|
-
options: ActorOptionsSchema,
|
|
15271
|
-
inspector: ActorInspectorConfigSchema.optional()
|
|
15272
|
-
}).strict().refine(
|
|
15273
|
-
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
15274
|
-
{
|
|
15275
|
-
message: "Cannot define both 'state' and 'createState'",
|
|
15276
|
-
path: ["state"]
|
|
15384
|
+
function read5(bc) {
|
|
15385
|
+
const len = readUintSafe(bc);
|
|
15386
|
+
if (len === 0) {
|
|
15387
|
+
return [];
|
|
15277
15388
|
}
|
|
15278
|
-
)
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15389
|
+
const result = [readWorkflowEntry(bc)];
|
|
15390
|
+
for (let i = 1; i < len; i++) {
|
|
15391
|
+
result[i] = readWorkflowEntry(bc);
|
|
15392
|
+
}
|
|
15393
|
+
return result;
|
|
15394
|
+
}
|
|
15395
|
+
function read6(bc) {
|
|
15396
|
+
const len = readUintSafe(bc);
|
|
15397
|
+
const result = /* @__PURE__ */ new Map();
|
|
15398
|
+
for (let i = 0; i < len; i++) {
|
|
15399
|
+
const offset = bc.offset;
|
|
15400
|
+
const key = readString(bc);
|
|
15401
|
+
if (result.has(key)) {
|
|
15402
|
+
bc.offset = offset;
|
|
15403
|
+
throw new BareError(offset, "duplicated key");
|
|
15404
|
+
}
|
|
15405
|
+
result.set(key, readWorkflowEntryMetadata(bc));
|
|
15283
15406
|
}
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15407
|
+
return result;
|
|
15408
|
+
}
|
|
15409
|
+
function readWorkflowHistory(bc) {
|
|
15410
|
+
return {
|
|
15411
|
+
nameRegistry: read4(bc),
|
|
15412
|
+
entries: read5(bc),
|
|
15413
|
+
entryMetadata: read6(bc)
|
|
15414
|
+
};
|
|
15415
|
+
}
|
|
15416
|
+
function decodeWorkflowHistory(bytes) {
|
|
15417
|
+
const bc = new ByteCursor(bytes, config2);
|
|
15418
|
+
const result = readWorkflowHistory(bc);
|
|
15419
|
+
if (bc.offset < bc.view.byteLength) {
|
|
15420
|
+
throw new BareError(bc.offset, "remaining bytes");
|
|
15289
15421
|
}
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
),
|
|
15296
|
-
enableActorRuntimeSocket: external_exports.boolean().optional().describe(
|
|
15297
|
-
"Enables the experimental Actor Runtime Socket for this actor. Default: false"
|
|
15298
|
-
),
|
|
15299
|
-
createVarsTimeout: external_exports.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
15300
|
-
createConnStateTimeout: external_exports.number().optional().describe(
|
|
15301
|
-
"Timeout in ms for createConnState handler. Default: 5000"
|
|
15302
|
-
),
|
|
15303
|
-
onMigrateTimeout: external_exports.number().optional().describe("Timeout in ms for onMigrate handler. Default: 30000"),
|
|
15304
|
-
onBeforeConnectTimeout: external_exports.number().optional().describe(
|
|
15305
|
-
"Timeout in ms for onBeforeConnect handler. Default: 5000"
|
|
15306
|
-
),
|
|
15307
|
-
onConnectTimeout: external_exports.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
15308
|
-
sleepGracePeriod: external_exports.number().optional().describe(
|
|
15309
|
-
`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}.`
|
|
15310
|
-
),
|
|
15311
|
-
onDestroyTimeout: external_exports.number().optional().describe(
|
|
15312
|
-
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
15313
|
-
),
|
|
15314
|
-
waitUntilTimeout: external_exports.number().optional().describe(
|
|
15315
|
-
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
15316
|
-
),
|
|
15317
|
-
stateSaveInterval: external_exports.number().optional().describe(
|
|
15318
|
-
"Interval in ms between automatic state saves. Default: 1000"
|
|
15319
|
-
),
|
|
15320
|
-
actionTimeout: external_exports.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
15321
|
-
connectionLivenessTimeout: external_exports.number().optional().describe(
|
|
15322
|
-
"Timeout in ms for connection liveness checks. Default: 2500"
|
|
15323
|
-
),
|
|
15324
|
-
connectionLivenessInterval: external_exports.number().optional().describe(
|
|
15325
|
-
"Interval in ms between connection liveness checks. Default: 5000"
|
|
15326
|
-
),
|
|
15327
|
-
noSleep: external_exports.boolean().optional().describe(
|
|
15328
|
-
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false"
|
|
15329
|
-
),
|
|
15330
|
-
sleepTimeout: external_exports.number().optional().describe(
|
|
15331
|
-
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
15332
|
-
),
|
|
15333
|
-
maxQueueSize: external_exports.number().optional().describe(
|
|
15334
|
-
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
15335
|
-
),
|
|
15336
|
-
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
15337
|
-
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
15338
|
-
),
|
|
15339
|
-
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
15340
|
-
"Maximum size of each queue message in bytes. Default: 65536"
|
|
15341
|
-
),
|
|
15342
|
-
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
15343
|
-
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
15344
|
-
)
|
|
15345
|
-
}).describe("Actor options for timeouts and behavior configuration.");
|
|
15346
|
-
var DocActorConfigSchema = external_exports.object({
|
|
15347
|
-
state: external_exports.unknown().optional().describe(
|
|
15348
|
-
"Initial state value for the actor. Cannot be used with createState."
|
|
15349
|
-
),
|
|
15350
|
-
createState: external_exports.unknown().optional().describe(
|
|
15351
|
-
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
15352
|
-
),
|
|
15353
|
-
connState: external_exports.unknown().optional().describe(
|
|
15354
|
-
"Initial connection state value. Cannot be used with createConnState."
|
|
15355
|
-
),
|
|
15356
|
-
createConnState: external_exports.unknown().optional().describe(
|
|
15357
|
-
"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."
|
|
15358
|
-
),
|
|
15359
|
-
vars: external_exports.unknown().optional().describe(
|
|
15360
|
-
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
15361
|
-
),
|
|
15362
|
-
createVars: external_exports.unknown().optional().describe(
|
|
15363
|
-
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
15364
|
-
),
|
|
15365
|
-
db: external_exports.unknown().optional().describe("Database provider instance for the actor."),
|
|
15366
|
-
onCreate: external_exports.unknown().optional().describe(
|
|
15367
|
-
"Called when the actor is first initialized. Use to initialize state."
|
|
15368
|
-
),
|
|
15369
|
-
onDestroy: external_exports.unknown().optional().describe("Called when the actor is destroyed."),
|
|
15370
|
-
onMigrate: external_exports.unknown().optional().describe(
|
|
15371
|
-
"Called on every actor start after persisted state loads and before onWake. Use for repeatable schema migrations."
|
|
15372
|
-
),
|
|
15373
|
-
onWake: external_exports.unknown().optional().describe(
|
|
15374
|
-
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
15375
|
-
),
|
|
15376
|
-
onSleep: external_exports.unknown().optional().describe(
|
|
15377
|
-
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
15378
|
-
),
|
|
15379
|
-
run: external_exports.unknown().optional().describe(
|
|
15380
|
-
"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."
|
|
15381
|
-
),
|
|
15382
|
-
onStateChange: external_exports.unknown().optional().describe(
|
|
15383
|
-
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
15384
|
-
),
|
|
15385
|
-
onBeforeConnect: external_exports.unknown().optional().describe(
|
|
15386
|
-
"Called before a client connects. Throw an error to reject the connection. The pending connection is not visible in c.conns while this runs."
|
|
15387
|
-
),
|
|
15388
|
-
onConnect: external_exports.unknown().optional().describe(
|
|
15389
|
-
"Called when a client successfully connects. The connection is visible in c.conns before this runs."
|
|
15390
|
-
),
|
|
15391
|
-
onDisconnect: external_exports.unknown().optional().describe("Called when a client disconnects."),
|
|
15392
|
-
onBeforeActionResponse: external_exports.unknown().optional().describe(
|
|
15393
|
-
"Called before sending an action response. Use to transform output."
|
|
15394
|
-
),
|
|
15395
|
-
onRequest: external_exports.unknown().optional().describe(
|
|
15396
|
-
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
15397
|
-
),
|
|
15398
|
-
onWebSocket: external_exports.unknown().optional().describe(
|
|
15399
|
-
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
15400
|
-
),
|
|
15401
|
-
actions: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
15402
|
-
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object."
|
|
15403
|
-
),
|
|
15404
|
-
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
15405
|
-
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
|
|
15406
|
-
),
|
|
15407
|
-
connParamsSchema: external_exports.unknown().optional().describe(
|
|
15408
|
-
"Optional schema for validating connection params in native runtimes."
|
|
15409
|
-
),
|
|
15410
|
-
events: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of event names to schemas."),
|
|
15411
|
-
queues: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of queue names to schemas."),
|
|
15412
|
-
options: DocActorOptionsSchema.optional()
|
|
15413
|
-
}).describe("Actor configuration passed to the actor() function.");
|
|
15422
|
+
return result;
|
|
15423
|
+
}
|
|
15424
|
+
function decodeWorkflowHistoryTransport(data) {
|
|
15425
|
+
return decodeWorkflowHistory(toUint8Array(data));
|
|
15426
|
+
}
|
|
15414
15427
|
|
|
15415
15428
|
// ../rivetkit/dist/tsup/chunk-JI6GZ2C2.js
|
|
15416
15429
|
var EMPTY_KEY = "/";
|
|
@@ -15529,6 +15542,44 @@ function removePrefixFromKey(prefixedKey) {
|
|
|
15529
15542
|
return prefixedKey.slice(KEYS.KV.length);
|
|
15530
15543
|
}
|
|
15531
15544
|
|
|
15545
|
+
// ../rivetkit/dist/tsup/chunk-ZEIH7S4M.js
|
|
15546
|
+
function logger() {
|
|
15547
|
+
return getLogger("actor-client");
|
|
15548
|
+
}
|
|
15549
|
+
var webSocketPromise = null;
|
|
15550
|
+
async function importWebSocket() {
|
|
15551
|
+
if (webSocketPromise !== null) {
|
|
15552
|
+
return webSocketPromise;
|
|
15553
|
+
}
|
|
15554
|
+
webSocketPromise = (async () => {
|
|
15555
|
+
let _WebSocket;
|
|
15556
|
+
if (typeof WebSocket !== "undefined") {
|
|
15557
|
+
_WebSocket = WebSocket;
|
|
15558
|
+
} else {
|
|
15559
|
+
try {
|
|
15560
|
+
const moduleName = "ws";
|
|
15561
|
+
const ws = await import(
|
|
15562
|
+
/* webpackIgnore: true */
|
|
15563
|
+
moduleName
|
|
15564
|
+
);
|
|
15565
|
+
_WebSocket = ws.default;
|
|
15566
|
+
logger().debug("using websocket from npm");
|
|
15567
|
+
} catch {
|
|
15568
|
+
_WebSocket = class MockWebSocket {
|
|
15569
|
+
constructor() {
|
|
15570
|
+
throw new Error(
|
|
15571
|
+
'WebSocket support requires installing the "ws" peer dependency.'
|
|
15572
|
+
);
|
|
15573
|
+
}
|
|
15574
|
+
};
|
|
15575
|
+
logger().debug("using mock websocket");
|
|
15576
|
+
}
|
|
15577
|
+
}
|
|
15578
|
+
return _WebSocket;
|
|
15579
|
+
})();
|
|
15580
|
+
return webSocketPromise;
|
|
15581
|
+
}
|
|
15582
|
+
|
|
15532
15583
|
// ../rivetkit/dist/tsup/chunk-JTHHCZCZ.js
|
|
15533
15584
|
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
15534
15585
|
function isManualTransactionControl(query) {
|
|
@@ -15612,45 +15663,7 @@ var AsyncMutex = class {
|
|
|
15612
15663
|
}
|
|
15613
15664
|
};
|
|
15614
15665
|
|
|
15615
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15616
|
-
function logger() {
|
|
15617
|
-
return getLogger("actor-client");
|
|
15618
|
-
}
|
|
15619
|
-
var webSocketPromise = null;
|
|
15620
|
-
async function importWebSocket() {
|
|
15621
|
-
if (webSocketPromise !== null) {
|
|
15622
|
-
return webSocketPromise;
|
|
15623
|
-
}
|
|
15624
|
-
webSocketPromise = (async () => {
|
|
15625
|
-
let _WebSocket;
|
|
15626
|
-
if (typeof WebSocket !== "undefined") {
|
|
15627
|
-
_WebSocket = WebSocket;
|
|
15628
|
-
} else {
|
|
15629
|
-
try {
|
|
15630
|
-
const moduleName = "ws";
|
|
15631
|
-
const ws = await import(
|
|
15632
|
-
/* webpackIgnore: true */
|
|
15633
|
-
moduleName
|
|
15634
|
-
);
|
|
15635
|
-
_WebSocket = ws.default;
|
|
15636
|
-
logger().debug("using websocket from npm");
|
|
15637
|
-
} catch {
|
|
15638
|
-
_WebSocket = class MockWebSocket {
|
|
15639
|
-
constructor() {
|
|
15640
|
-
throw new Error(
|
|
15641
|
-
'WebSocket support requires installing the "ws" peer dependency.'
|
|
15642
|
-
);
|
|
15643
|
-
}
|
|
15644
|
-
};
|
|
15645
|
-
logger().debug("using mock websocket");
|
|
15646
|
-
}
|
|
15647
|
-
}
|
|
15648
|
-
return _WebSocket;
|
|
15649
|
-
})();
|
|
15650
|
-
return webSocketPromise;
|
|
15651
|
-
}
|
|
15652
|
-
|
|
15653
|
-
// ../rivetkit/dist/tsup/chunk-A5BZEQOG.js
|
|
15666
|
+
// ../rivetkit/dist/tsup/chunk-BK2JOGQQ.js
|
|
15654
15667
|
var import_invariant2 = __toESM(require_invariant(), 1);
|
|
15655
15668
|
|
|
15656
15669
|
// ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
@@ -15828,7 +15841,7 @@ function createVersionedDataHandler(config3) {
|
|
|
15828
15841
|
return new VersionedDataHandler(config3);
|
|
15829
15842
|
}
|
|
15830
15843
|
|
|
15831
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15844
|
+
// ../rivetkit/dist/tsup/chunk-BK2JOGQQ.js
|
|
15832
15845
|
var import_invariant3 = __toESM(require_invariant(), 1);
|
|
15833
15846
|
var import_invariant4 = __toESM(require_invariant(), 1);
|
|
15834
15847
|
var PATH_CONNECT = "/connect";
|
|
@@ -15883,12 +15896,12 @@ var ActorConnDisposed = class extends ActorClientError {
|
|
|
15883
15896
|
function isSchedulingError(group, code) {
|
|
15884
15897
|
return group === "guard" && (code === "actor_ready_timeout" || code === "actor_runner_failed");
|
|
15885
15898
|
}
|
|
15886
|
-
function actorSchedulingError(group, code, actorId, details) {
|
|
15899
|
+
function actorSchedulingError(group, code, actorId, details, rayId) {
|
|
15887
15900
|
return new RivetError(
|
|
15888
15901
|
group,
|
|
15889
15902
|
code,
|
|
15890
15903
|
`Actor failed to start (${actorId}): ${JSON.stringify(details)}`,
|
|
15891
|
-
{ metadata: { actorId, details } }
|
|
15904
|
+
{ metadata: { actorId, details }, rayId }
|
|
15892
15905
|
);
|
|
15893
15906
|
}
|
|
15894
15907
|
function internalClientError(message, opts) {
|
|
@@ -17868,7 +17881,7 @@ function getGatewayTarget(state) {
|
|
|
17868
17881
|
function isStaleResolvedActorError(group, code) {
|
|
17869
17882
|
return group === "actor" && (code === "not_found" || code === "starting" || code === "stopping" || code === "not_configured" || code === "dropped_reply" || code.startsWith("destroyed_"));
|
|
17870
17883
|
}
|
|
17871
|
-
async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
17884
|
+
async function checkForSchedulingError(group, code, actorId, query, driver, rayId) {
|
|
17872
17885
|
const name = getActorNameFromQuery(query);
|
|
17873
17886
|
try {
|
|
17874
17887
|
const actor2 = await driver.getForId({ name, actorId });
|
|
@@ -17878,7 +17891,13 @@ async function checkForSchedulingError(group, code, actorId, query, driver) {
|
|
|
17878
17891
|
actorId,
|
|
17879
17892
|
error: actor2.error
|
|
17880
17893
|
});
|
|
17881
|
-
return actorSchedulingError(
|
|
17894
|
+
return actorSchedulingError(
|
|
17895
|
+
group,
|
|
17896
|
+
code,
|
|
17897
|
+
actorId,
|
|
17898
|
+
actor2.error,
|
|
17899
|
+
rayId
|
|
17900
|
+
);
|
|
17882
17901
|
}
|
|
17883
17902
|
} catch (err) {
|
|
17884
17903
|
logger().warn({
|
|
@@ -18195,6 +18214,7 @@ async function sendHttpRequest(opts) {
|
|
|
18195
18214
|
code: responseData.code,
|
|
18196
18215
|
message: responseData.message,
|
|
18197
18216
|
metadata: responseData.metadata,
|
|
18217
|
+
rayId,
|
|
18198
18218
|
actorId: (_a2 = responseData.actor) == null ? void 0 : _a2.actorId,
|
|
18199
18219
|
generation: (_b = responseData.actor) == null ? void 0 : _b.generation,
|
|
18200
18220
|
actorKey: (_c = responseData.actor) == null ? void 0 : _c.key
|
|
@@ -18205,6 +18225,7 @@ async function sendHttpRequest(opts) {
|
|
|
18205
18225
|
responseData.message,
|
|
18206
18226
|
{
|
|
18207
18227
|
metadata: responseData.metadata,
|
|
18228
|
+
rayId: rayId ?? void 0,
|
|
18208
18229
|
actor: responseData.actor
|
|
18209
18230
|
}
|
|
18210
18231
|
);
|
|
@@ -18384,11 +18405,8 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
18384
18405
|
});
|
|
18385
18406
|
return driver.sendRequest(target, proxyRequest, options);
|
|
18386
18407
|
} catch (err) {
|
|
18387
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(
|
|
18388
|
-
|
|
18389
|
-
true
|
|
18390
|
-
);
|
|
18391
|
-
throw new RivetError(group, code, message, { metadata, actor: actor2 });
|
|
18408
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18409
|
+
throw new RivetError(group, code, message, { metadata, rayId, actor: actor2 });
|
|
18392
18410
|
}
|
|
18393
18411
|
}
|
|
18394
18412
|
async function rawWebSocket(driver, target, params, path2, _protocols, options = {}) {
|
|
@@ -18527,7 +18545,7 @@ var ActorHandleRaw = class {
|
|
|
18527
18545
|
}
|
|
18528
18546
|
}).send(name, body, options);
|
|
18529
18547
|
} catch (err) {
|
|
18530
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(err, true);
|
|
18548
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18531
18549
|
if (this.#shouldRetryQueueDispatchOverload(
|
|
18532
18550
|
group,
|
|
18533
18551
|
code,
|
|
@@ -18543,7 +18561,8 @@ var ActorHandleRaw = class {
|
|
|
18543
18561
|
code,
|
|
18544
18562
|
actorId,
|
|
18545
18563
|
attempt,
|
|
18546
|
-
maxAttempts
|
|
18564
|
+
maxAttempts,
|
|
18565
|
+
rayId
|
|
18547
18566
|
)) {
|
|
18548
18567
|
useQueryTarget = true;
|
|
18549
18568
|
await this.#waitForRetryWindow();
|
|
@@ -18573,6 +18592,7 @@ var ActorHandleRaw = class {
|
|
|
18573
18592
|
}
|
|
18574
18593
|
throw new RivetError(group, code, message, {
|
|
18575
18594
|
metadata,
|
|
18595
|
+
rayId,
|
|
18576
18596
|
actor: actor2
|
|
18577
18597
|
});
|
|
18578
18598
|
}
|
|
@@ -18666,13 +18686,14 @@ var ActorHandleRaw = class {
|
|
|
18666
18686
|
}
|
|
18667
18687
|
return output;
|
|
18668
18688
|
} catch (err) {
|
|
18669
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(err, true);
|
|
18689
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18670
18690
|
if (await this.#shouldRetrySchedulingError(
|
|
18671
18691
|
group,
|
|
18672
18692
|
code,
|
|
18673
18693
|
actorId,
|
|
18674
18694
|
attempt,
|
|
18675
|
-
maxAttempts
|
|
18695
|
+
maxAttempts,
|
|
18696
|
+
rayId
|
|
18676
18697
|
)) {
|
|
18677
18698
|
useQueryTarget = true;
|
|
18678
18699
|
await this.#waitForRetryWindow();
|
|
@@ -18694,7 +18715,7 @@ var ActorHandleRaw = class {
|
|
|
18694
18715
|
"actor",
|
|
18695
18716
|
"not_found",
|
|
18696
18717
|
"The actor does not exist or was destroyed.",
|
|
18697
|
-
{ metadata, actor: actor2 }
|
|
18718
|
+
{ metadata, rayId, actor: actor2 }
|
|
18698
18719
|
);
|
|
18699
18720
|
}
|
|
18700
18721
|
const invalidated = this.#invalidateResolvedActorId(
|
|
@@ -18710,7 +18731,11 @@ var ActorHandleRaw = class {
|
|
|
18710
18731
|
}
|
|
18711
18732
|
continue;
|
|
18712
18733
|
}
|
|
18713
|
-
throw new RivetError(group, code, message, {
|
|
18734
|
+
throw new RivetError(group, code, message, {
|
|
18735
|
+
metadata,
|
|
18736
|
+
rayId,
|
|
18737
|
+
actor: actor2
|
|
18738
|
+
});
|
|
18714
18739
|
}
|
|
18715
18740
|
}
|
|
18716
18741
|
throw new Error("unreachable action retry state");
|
|
@@ -18752,7 +18777,7 @@ var ActorHandleRaw = class {
|
|
|
18752
18777
|
this.#resolvedActorId = void 0;
|
|
18753
18778
|
this.#resolvingActorId = void 0;
|
|
18754
18779
|
}
|
|
18755
|
-
async #shouldRetrySchedulingError(group, code, actorId, attempt, maxAttempts) {
|
|
18780
|
+
async #shouldRetrySchedulingError(group, code, actorId, attempt, maxAttempts, rayId) {
|
|
18756
18781
|
if (!isDynamicActorQuery(this.#actorResolutionState) || !isSchedulingError(group, code) || attempt >= maxAttempts - 1) {
|
|
18757
18782
|
return false;
|
|
18758
18783
|
}
|
|
@@ -18762,7 +18787,8 @@ var ActorHandleRaw = class {
|
|
|
18762
18787
|
code,
|
|
18763
18788
|
actorId,
|
|
18764
18789
|
this.#actorResolutionState,
|
|
18765
|
-
this.#driver
|
|
18790
|
+
this.#driver,
|
|
18791
|
+
rayId
|
|
18766
18792
|
);
|
|
18767
18793
|
if (schedulingError) {
|
|
18768
18794
|
throw schedulingError;
|
|
@@ -18883,13 +18909,14 @@ var ActorHandleRaw = class {
|
|
|
18883
18909
|
}
|
|
18884
18910
|
return response;
|
|
18885
18911
|
} catch (err) {
|
|
18886
|
-
const { group, code, message, metadata, actor: actor2 } = deconstructError(err, true);
|
|
18912
|
+
const { group, code, message, metadata, rayId, actor: actor2 } = deconstructError(err, true);
|
|
18887
18913
|
if (await this.#shouldRetrySchedulingError(
|
|
18888
18914
|
group,
|
|
18889
18915
|
code,
|
|
18890
18916
|
actorId,
|
|
18891
18917
|
attempt,
|
|
18892
|
-
maxAttempts
|
|
18918
|
+
maxAttempts,
|
|
18919
|
+
rayId
|
|
18893
18920
|
)) {
|
|
18894
18921
|
useQueryTarget = true;
|
|
18895
18922
|
await this.#waitForRetryWindow();
|
|
@@ -18917,7 +18944,11 @@ var ActorHandleRaw = class {
|
|
|
18917
18944
|
}
|
|
18918
18945
|
continue;
|
|
18919
18946
|
}
|
|
18920
|
-
throw new RivetError(group, code, message, {
|
|
18947
|
+
throw new RivetError(group, code, message, {
|
|
18948
|
+
metadata,
|
|
18949
|
+
rayId,
|
|
18950
|
+
actor: actor2
|
|
18951
|
+
});
|
|
18921
18952
|
}
|
|
18922
18953
|
}
|
|
18923
18954
|
throw new Error("unreachable fetch retry state");
|
|
@@ -18930,13 +18961,14 @@ var ActorHandleRaw = class {
|
|
|
18930
18961
|
if (!error46) {
|
|
18931
18962
|
return null;
|
|
18932
18963
|
}
|
|
18933
|
-
const { group, code } = error46;
|
|
18964
|
+
const { group, code, rayId } = error46;
|
|
18934
18965
|
if (await this.#shouldRetrySchedulingError(
|
|
18935
18966
|
group,
|
|
18936
18967
|
code,
|
|
18937
18968
|
actorId,
|
|
18938
18969
|
attempt,
|
|
18939
|
-
maxAttempts
|
|
18970
|
+
maxAttempts,
|
|
18971
|
+
rayId
|
|
18940
18972
|
)) {
|
|
18941
18973
|
return {
|
|
18942
18974
|
useQueryTarget: true,
|
|
@@ -18972,7 +19004,7 @@ var ActorHandleRaw = class {
|
|
|
18972
19004
|
const contentType = response.headers.get("content-type");
|
|
18973
19005
|
const encoding = (contentType == null ? void 0 : contentType.includes("application/json")) ? "json" : this.#encoding;
|
|
18974
19006
|
try {
|
|
18975
|
-
|
|
19007
|
+
const error46 = deserializeWithEncoding(
|
|
18976
19008
|
encoding,
|
|
18977
19009
|
new Uint8Array(await response.clone().arrayBuffer()),
|
|
18978
19010
|
HTTP_RESPONSE_ERROR_VERSIONED,
|
|
@@ -18996,6 +19028,10 @@ var ActorHandleRaw = class {
|
|
|
18996
19028
|
} : void 0
|
|
18997
19029
|
})
|
|
18998
19030
|
);
|
|
19031
|
+
return {
|
|
19032
|
+
...error46,
|
|
19033
|
+
rayId: response.headers.get("x-rivet-ray-id") ?? void 0
|
|
19034
|
+
};
|
|
18999
19035
|
} catch {
|
|
19000
19036
|
return null;
|
|
19001
19037
|
}
|
|
@@ -19059,7 +19095,9 @@ var ActorHandleRaw = class {
|
|
|
19059
19095
|
"actor",
|
|
19060
19096
|
"reload_failed",
|
|
19061
19097
|
`reload failed with status ${response.status}: ${body}`,
|
|
19062
|
-
{
|
|
19098
|
+
{
|
|
19099
|
+
rayId: response.headers.get("x-rivet-ray-id") ?? void 0
|
|
19100
|
+
}
|
|
19063
19101
|
);
|
|
19064
19102
|
}
|
|
19065
19103
|
}
|
|
@@ -19913,7 +19951,7 @@ var ActorConnRaw = class {
|
|
|
19913
19951
|
const reason = closeEvent.reason || "";
|
|
19914
19952
|
const parsed = parseWebSocketCloseReason(reason);
|
|
19915
19953
|
if (parsed) {
|
|
19916
|
-
const { group, code } = parsed;
|
|
19954
|
+
const { group, code, rayId } = parsed;
|
|
19917
19955
|
if (this.#shouldReconnectForStaleActor(group, code)) {
|
|
19918
19956
|
this.#clearResolvedActorIdentity();
|
|
19919
19957
|
(_a2 = this.#onOpenPromise) == null ? void 0 : _a2.reject(
|
|
@@ -19921,7 +19959,7 @@ var ActorConnRaw = class {
|
|
|
19921
19959
|
group,
|
|
19922
19960
|
code,
|
|
19923
19961
|
`Connection closed: ${reason}`,
|
|
19924
|
-
|
|
19962
|
+
{ rayId }
|
|
19925
19963
|
)
|
|
19926
19964
|
);
|
|
19927
19965
|
return;
|
|
@@ -19932,7 +19970,8 @@ var ActorConnRaw = class {
|
|
|
19932
19970
|
code,
|
|
19933
19971
|
this.#actorId,
|
|
19934
19972
|
this.#actorResolutionState,
|
|
19935
|
-
this.#driver
|
|
19973
|
+
this.#driver,
|
|
19974
|
+
rayId
|
|
19936
19975
|
);
|
|
19937
19976
|
if (schedulingError) {
|
|
19938
19977
|
error46 = schedulingError;
|
|
@@ -19941,7 +19980,7 @@ var ActorConnRaw = class {
|
|
|
19941
19980
|
group,
|
|
19942
19981
|
code,
|
|
19943
19982
|
`Connection closed: ${reason}`,
|
|
19944
|
-
|
|
19983
|
+
{ rayId }
|
|
19945
19984
|
);
|
|
19946
19985
|
}
|
|
19947
19986
|
} else {
|
|
@@ -19949,7 +19988,7 @@ var ActorConnRaw = class {
|
|
|
19949
19988
|
group,
|
|
19950
19989
|
code,
|
|
19951
19990
|
`Connection closed: ${reason}`,
|
|
19952
|
-
|
|
19991
|
+
{ rayId }
|
|
19953
19992
|
);
|
|
19954
19993
|
}
|
|
19955
19994
|
this.#invalidateActorIfStale(group, code);
|
|
@@ -21544,7 +21583,7 @@ function apiActorToOutput(actor2) {
|
|
|
21544
21583
|
};
|
|
21545
21584
|
}
|
|
21546
21585
|
|
|
21547
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
21586
|
+
// ../rivetkit/dist/tsup/chunk-KRQI5GXM.js
|
|
21548
21587
|
var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
|
|
21549
21588
|
var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
|
|
21550
21589
|
function registerNativeStateTransactionOpener(provider, opener) {
|
|
@@ -26441,7 +26480,8 @@ function encodeNativeCallbackError(error46) {
|
|
|
26441
26480
|
return Object.assign(bridgeError, {
|
|
26442
26481
|
group: structuredError.group,
|
|
26443
26482
|
code: structuredError.code,
|
|
26444
|
-
metadata: structuredError.metadata
|
|
26483
|
+
metadata: structuredError.metadata,
|
|
26484
|
+
rayId: structuredError.rayId
|
|
26445
26485
|
});
|
|
26446
26486
|
}
|
|
26447
26487
|
async function callNative(invoke) {
|