@rivetkit/supabase 2.3.11-rc.5 → 2.3.11-rc.7
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 +1681 -1683
- package/dist/mod.mjs +1681 -1683
- package/package.json +9 -4
package/dist/mod.js
CHANGED
|
@@ -334,183 +334,6 @@ __export(mod_exports, {
|
|
|
334
334
|
module.exports = __toCommonJS(mod_exports);
|
|
335
335
|
var wasmBindings = __toESM(require("@rivetkit/rivetkit-wasm"));
|
|
336
336
|
|
|
337
|
-
// ../rivetkit/dist/tsup/chunk-ZZ3WBRPD.js
|
|
338
|
-
var INTERNAL_ERROR_CODE = "internal_error";
|
|
339
|
-
var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
340
|
-
var USER_ERROR_CODE = "user_error";
|
|
341
|
-
var BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
342
|
-
function looksLikeRivetErrorOptions(value) {
|
|
343
|
-
return typeof value === "object" && value !== null && ("public" in value || "metadata" in value || "statusCode" in value || "actor" in value || "cause" in value);
|
|
344
|
-
}
|
|
345
|
-
function isTypedErrorTag(value) {
|
|
346
|
-
return value === "ActorError" || value === "RivetError";
|
|
347
|
-
}
|
|
348
|
-
function errorMessage(error46, fallback = String(error46)) {
|
|
349
|
-
if (error46 && typeof error46 === "object" && "message" in error46 && typeof error46.message === "string") {
|
|
350
|
-
return error46.message;
|
|
351
|
-
}
|
|
352
|
-
return fallback;
|
|
353
|
-
}
|
|
354
|
-
function isRivetErrorLike(error46) {
|
|
355
|
-
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));
|
|
356
|
-
}
|
|
357
|
-
function isActorAbortedError(error46) {
|
|
358
|
-
return isRivetErrorLike(error46) && error46.group === "actor" && error46.code === "aborted";
|
|
359
|
-
}
|
|
360
|
-
function isActorSpecifier(value) {
|
|
361
|
-
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");
|
|
362
|
-
}
|
|
363
|
-
var RivetError = class extends Error {
|
|
364
|
-
__type = "RivetError";
|
|
365
|
-
public;
|
|
366
|
-
metadata;
|
|
367
|
-
statusCode;
|
|
368
|
-
actor;
|
|
369
|
-
group;
|
|
370
|
-
code;
|
|
371
|
-
static isRivetError(error46) {
|
|
372
|
-
return isRivetErrorLike(error46);
|
|
373
|
-
}
|
|
374
|
-
static isActorError(error46) {
|
|
375
|
-
return isRivetErrorLike(error46);
|
|
376
|
-
}
|
|
377
|
-
constructor(group, code, message, options) {
|
|
378
|
-
const normalized = looksLikeRivetErrorOptions(options) ? options : { metadata: options };
|
|
379
|
-
super(message, { cause: normalized.cause });
|
|
380
|
-
this.name = "RivetError";
|
|
381
|
-
this.group = group;
|
|
382
|
-
this.code = code;
|
|
383
|
-
this.public = normalized.public ?? false;
|
|
384
|
-
this.metadata = normalized.metadata;
|
|
385
|
-
this.statusCode = normalized.statusCode ?? (this.public ? 400 : 500);
|
|
386
|
-
this.actor = normalized.actor;
|
|
387
|
-
}
|
|
388
|
-
toString() {
|
|
389
|
-
return this.message;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
var UserError = class extends RivetError {
|
|
393
|
-
constructor(message, options) {
|
|
394
|
-
super("user", (options == null ? void 0 : options.code) ?? USER_ERROR_CODE, message, {
|
|
395
|
-
public: true,
|
|
396
|
-
metadata: options == null ? void 0 : options.metadata,
|
|
397
|
-
cause: options == null ? void 0 : options.cause
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
function toRivetError(error46, fallback) {
|
|
402
|
-
if (typeof error46 === "string") {
|
|
403
|
-
const bridged = decodeBridgeRivetError(error46);
|
|
404
|
-
if (bridged) {
|
|
405
|
-
return bridged;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
if (error46 instanceof Error) {
|
|
409
|
-
const bridged = decodeBridgeRivetError(error46.message);
|
|
410
|
-
if (bridged) {
|
|
411
|
-
return bridged;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
if (isRivetErrorLike(error46)) {
|
|
415
|
-
return new RivetError(error46.group, error46.code, error46.message, {
|
|
416
|
-
public: error46.public,
|
|
417
|
-
statusCode: error46.statusCode,
|
|
418
|
-
metadata: error46.metadata,
|
|
419
|
-
actor: error46.actor,
|
|
420
|
-
cause: error46 instanceof Error ? error46.cause : void 0
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
return new RivetError(
|
|
424
|
-
(fallback == null ? void 0 : fallback.group) ?? "actor",
|
|
425
|
-
(fallback == null ? void 0 : fallback.code) ?? INTERNAL_ERROR_CODE,
|
|
426
|
-
errorMessage(error46, (fallback == null ? void 0 : fallback.message) ?? "Unknown error"),
|
|
427
|
-
{
|
|
428
|
-
public: fallback == null ? void 0 : fallback.public,
|
|
429
|
-
statusCode: fallback == null ? void 0 : fallback.statusCode,
|
|
430
|
-
metadata: fallback == null ? void 0 : fallback.metadata,
|
|
431
|
-
actor: fallback == null ? void 0 : fallback.actor,
|
|
432
|
-
cause: error46 instanceof Error ? error46 : void 0
|
|
433
|
-
}
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
function encodeBridgeRivetError(error46) {
|
|
437
|
-
return `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
|
|
438
|
-
group: error46.group,
|
|
439
|
-
code: error46.code,
|
|
440
|
-
message: error46.message,
|
|
441
|
-
metadata: error46.metadata,
|
|
442
|
-
public: error46.public,
|
|
443
|
-
statusCode: error46.statusCode,
|
|
444
|
-
actor: error46.actor
|
|
445
|
-
})}`;
|
|
446
|
-
}
|
|
447
|
-
function decodeBridgeRivetErrorPayload(value) {
|
|
448
|
-
if (!value.startsWith(BRIDGE_RIVET_ERROR_PREFIX)) {
|
|
449
|
-
return void 0;
|
|
450
|
-
}
|
|
451
|
-
try {
|
|
452
|
-
const payload = JSON.parse(
|
|
453
|
-
value.slice(BRIDGE_RIVET_ERROR_PREFIX.length)
|
|
454
|
-
);
|
|
455
|
-
if (!isRivetErrorLike(payload)) {
|
|
456
|
-
return void 0;
|
|
457
|
-
}
|
|
458
|
-
if (payload.actor !== void 0 && payload.actor !== null && !isActorSpecifier(payload.actor)) {
|
|
459
|
-
return void 0;
|
|
460
|
-
}
|
|
461
|
-
return payload;
|
|
462
|
-
} catch {
|
|
463
|
-
return void 0;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
function decodeBridgeRivetError(value) {
|
|
467
|
-
const payload = decodeBridgeRivetErrorPayload(value);
|
|
468
|
-
if (!payload) {
|
|
469
|
-
return void 0;
|
|
470
|
-
}
|
|
471
|
-
return new RivetError(payload.group, payload.code, payload.message, {
|
|
472
|
-
metadata: payload.metadata,
|
|
473
|
-
public: payload.public,
|
|
474
|
-
statusCode: payload.statusCode,
|
|
475
|
-
actor: payload.actor ?? void 0
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
function invalidRequest(error46) {
|
|
479
|
-
return new RivetError(
|
|
480
|
-
"request",
|
|
481
|
-
"invalid",
|
|
482
|
-
`Invalid request: ${errorMessage(error46, String(error46))}`,
|
|
483
|
-
{
|
|
484
|
-
public: true,
|
|
485
|
-
cause: error46 instanceof Error ? error46 : void 0
|
|
486
|
-
}
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
function actorNotFound(identifier) {
|
|
490
|
-
return new RivetError(
|
|
491
|
-
"actor",
|
|
492
|
-
"not_found",
|
|
493
|
-
identifier ? `Actor not found: ${identifier} (https://www.rivet.dev/docs/clients/javascript)` : "Actor not found (https://www.rivet.dev/docs/clients/javascript)",
|
|
494
|
-
{ public: true }
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
function forbiddenError() {
|
|
498
|
-
return new RivetError("auth", "forbidden", "Forbidden", {
|
|
499
|
-
public: true,
|
|
500
|
-
statusCode: 403
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
function unsupportedFeature(feature) {
|
|
504
|
-
return new RivetError(
|
|
505
|
-
"feature",
|
|
506
|
-
"unsupported",
|
|
507
|
-
`Unsupported feature: ${feature}`
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// ../rivetkit/dist/tsup/chunk-6QL27Q5R.js
|
|
512
|
-
var import_pino = require("pino");
|
|
513
|
-
|
|
514
337
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/external.js
|
|
515
338
|
var external_exports = {};
|
|
516
339
|
__export(external_exports, {
|
|
@@ -13181,293 +13004,898 @@ var classic_default = external_exports;
|
|
|
13181
13004
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
|
|
13182
13005
|
var v4_default = classic_default;
|
|
13183
13006
|
|
|
13184
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
13190
|
-
var getRivetNamespace = () => getEnvUniversal("RIVET_NAMESPACE");
|
|
13191
|
-
var getRivetPool = () => getEnvUniversal("RIVET_POOL");
|
|
13192
|
-
var getRivetTotalSlots = () => {
|
|
13193
|
-
const value = getEnvUniversal("RIVET_TOTAL_SLOTS");
|
|
13194
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13195
|
-
};
|
|
13196
|
-
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
13197
|
-
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
13198
|
-
var getRivetRunEnginePort = () => {
|
|
13199
|
-
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
13200
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13201
|
-
};
|
|
13202
|
-
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
13203
|
-
var getRivetEnvoyVersion = () => {
|
|
13204
|
-
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
13205
|
-
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13206
|
-
};
|
|
13207
|
-
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
13208
|
-
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
13209
|
-
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
13210
|
-
var getRivetkitRuntimeMode = () => {
|
|
13211
|
-
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
13212
|
-
if (value === void 0) return "envoy";
|
|
13213
|
-
if (value === "envoy" || value === "serverless") return value;
|
|
13214
|
-
throw new Error(
|
|
13215
|
-
`RIVETKIT_RUNTIME_MODE env var must be "envoy" or "serverless"; got "${value}"`
|
|
13216
|
-
);
|
|
13217
|
-
};
|
|
13218
|
-
var getRivetkitPublicDir = () => {
|
|
13219
|
-
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
13220
|
-
return value === void 0 || value === "" ? void 0 : value;
|
|
13221
|
-
};
|
|
13222
|
-
function parsePortEnv(raw) {
|
|
13223
|
-
if (raw === void 0 || raw === "") return void 0;
|
|
13224
|
-
const parsed = Number.parseInt(raw, 10);
|
|
13225
|
-
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
13226
|
-
throw new Error(
|
|
13227
|
-
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
13228
|
-
);
|
|
13007
|
+
// ../rivetkit/dist/tsup/chunk-QWLJCP3X.js
|
|
13008
|
+
function flattenActionHandlers(actions) {
|
|
13009
|
+
const flattened = /* @__PURE__ */ Object.create(null);
|
|
13010
|
+
for (const { name, handler } of collectActionEntries(actions)) {
|
|
13011
|
+
flattened[name] = handler;
|
|
13229
13012
|
}
|
|
13230
|
-
return
|
|
13231
|
-
}
|
|
13232
|
-
var getLogLevel = () => getEnvUniversal("RIVET_LOG_LEVEL") ?? getEnvUniversal("LOG_LEVEL");
|
|
13233
|
-
var getLogTarget = () => getEnvUniversal("RIVET_LOG_TARGET") === "1";
|
|
13234
|
-
var getLogTimestamp = () => getEnvUniversal("RIVET_LOG_TIMESTAMP") === "1";
|
|
13235
|
-
var getLogMessage = () => getEnvUniversal("RIVET_LOG_MESSAGE") === "1";
|
|
13236
|
-
var getLogErrorStack = () => getEnvUniversal("RIVET_LOG_ERROR_STACK") === "1";
|
|
13237
|
-
var getNodeEnv = () => getEnvUniversal("NODE_ENV");
|
|
13238
|
-
var getNextPhase = () => getEnvUniversal("NEXT_PHASE");
|
|
13239
|
-
var isDev = () => getNodeEnv() !== "production";
|
|
13240
|
-
function assertUnreachable(x) {
|
|
13241
|
-
throw new Error(`Unreachable case: ${x}`);
|
|
13242
|
-
}
|
|
13243
|
-
function isCanonicalStructuredRivetError(error46) {
|
|
13244
|
-
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";
|
|
13013
|
+
return flattened;
|
|
13245
13014
|
}
|
|
13246
|
-
function
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
message = error46.message;
|
|
13260
|
-
metadata = error46.metadata;
|
|
13261
|
-
actor2 = error46.actor;
|
|
13262
|
-
} else if (RivetError.isActorError(error46) && error46.public) {
|
|
13263
|
-
statusCode = "statusCode" in error46 && error46.statusCode ? error46.statusCode : 400;
|
|
13264
|
-
public_ = true;
|
|
13265
|
-
group = error46.group;
|
|
13266
|
-
code = error46.code;
|
|
13267
|
-
message = getErrorMessage(error46);
|
|
13268
|
-
metadata = error46.metadata;
|
|
13269
|
-
actor2 = error46.actor;
|
|
13270
|
-
} else if (exposeInternalError) {
|
|
13271
|
-
if (RivetError.isActorError(error46)) {
|
|
13272
|
-
statusCode = 500;
|
|
13273
|
-
public_ = false;
|
|
13274
|
-
group = error46.group;
|
|
13275
|
-
code = error46.code;
|
|
13276
|
-
message = getErrorMessage(error46);
|
|
13277
|
-
metadata = error46.metadata;
|
|
13278
|
-
actor2 = error46.actor;
|
|
13279
|
-
} else {
|
|
13280
|
-
statusCode = 500;
|
|
13281
|
-
public_ = false;
|
|
13282
|
-
group = "rivetkit";
|
|
13283
|
-
code = INTERNAL_ERROR_CODE;
|
|
13284
|
-
message = getErrorMessage(error46);
|
|
13015
|
+
function flattenActionInputSchemas(actions, schemas) {
|
|
13016
|
+
if (schemas === void 0) return void 0;
|
|
13017
|
+
if (!isRecord(schemas)) {
|
|
13018
|
+
throw new TypeError("actionInputSchemas must be an object");
|
|
13019
|
+
}
|
|
13020
|
+
const flattened = /* @__PURE__ */ Object.create(null);
|
|
13021
|
+
for (const { name, path: path2 } of collectActionEntries(actions)) {
|
|
13022
|
+
const nestedSchema = lookupNestedSchema(schemas, path2);
|
|
13023
|
+
const flatSchema = schemas[name];
|
|
13024
|
+
if (nestedSchema !== void 0 && flatSchema !== void 0 && nestedSchema !== flatSchema) {
|
|
13025
|
+
throw new TypeError(
|
|
13026
|
+
`Action input schema \`${name}\` is defined by both a nested path and a dotted key`
|
|
13027
|
+
);
|
|
13285
13028
|
}
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
group = "rivetkit";
|
|
13290
|
-
code = INTERNAL_ERROR_CODE;
|
|
13291
|
-
message = INTERNAL_ERROR_DESCRIPTION;
|
|
13292
|
-
if (RivetError.isActorError(error46)) {
|
|
13293
|
-
actor2 = error46.actor;
|
|
13029
|
+
const schema = nestedSchema ?? flatSchema;
|
|
13030
|
+
if (schema !== void 0) {
|
|
13031
|
+
flattened[name] = schema;
|
|
13294
13032
|
}
|
|
13295
|
-
metadata = {
|
|
13296
|
-
//url: `https://dashboard.rivet.dev/projects/${actorMetadata.project.slug}/environments/${actorMetadata.environment.slug}/actors?actorId=${actorMetadata.actor.id}`,
|
|
13297
|
-
};
|
|
13298
13033
|
}
|
|
13299
|
-
return
|
|
13300
|
-
__type: "ActorError",
|
|
13301
|
-
statusCode,
|
|
13302
|
-
public: public_,
|
|
13303
|
-
group,
|
|
13304
|
-
code,
|
|
13305
|
-
message,
|
|
13306
|
-
metadata,
|
|
13307
|
-
actor: actor2
|
|
13308
|
-
};
|
|
13034
|
+
return flattened;
|
|
13309
13035
|
}
|
|
13310
|
-
function
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13036
|
+
function collectActionEntries(actions) {
|
|
13037
|
+
const entries = [];
|
|
13038
|
+
const names = /* @__PURE__ */ new Set();
|
|
13039
|
+
visitActionGroup(actions ?? {}, [], entries, names);
|
|
13040
|
+
return entries;
|
|
13041
|
+
}
|
|
13042
|
+
function visitActionGroup(value, path2, entries, names) {
|
|
13043
|
+
if (!isRecord(value)) {
|
|
13044
|
+
throw new TypeError(
|
|
13045
|
+
`${formatActionPath(path2)} must be an action handler or group`
|
|
13046
|
+
);
|
|
13047
|
+
}
|
|
13048
|
+
for (const [segment, child] of Object.entries(value)) {
|
|
13049
|
+
const childPath = [...path2, segment];
|
|
13050
|
+
if (typeof child === "function") {
|
|
13051
|
+
const name = childPath.join(".");
|
|
13052
|
+
if (names.has(name)) {
|
|
13053
|
+
throw new TypeError(
|
|
13054
|
+
`Multiple action definitions flatten to \`${name}\``
|
|
13055
|
+
);
|
|
13318
13056
|
}
|
|
13319
|
-
|
|
13320
|
-
|
|
13057
|
+
names.add(name);
|
|
13058
|
+
entries.push({
|
|
13059
|
+
name,
|
|
13060
|
+
path: childPath,
|
|
13061
|
+
handler: child
|
|
13062
|
+
});
|
|
13321
13063
|
} else {
|
|
13322
|
-
|
|
13064
|
+
visitActionGroup(child, childPath, entries, names);
|
|
13323
13065
|
}
|
|
13324
|
-
}
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
return
|
|
13066
|
+
}
|
|
13067
|
+
}
|
|
13068
|
+
function lookupNestedSchema(schemas, path2) {
|
|
13069
|
+
let value = schemas;
|
|
13070
|
+
for (const segment of path2) {
|
|
13071
|
+
if (!isRecord(value) || !Object.hasOwn(value, segment)) {
|
|
13072
|
+
return void 0;
|
|
13331
13073
|
}
|
|
13332
|
-
|
|
13333
|
-
return `Unknown error: ${getErrorMessage(error46)}`;
|
|
13074
|
+
value = value[segment];
|
|
13334
13075
|
}
|
|
13076
|
+
return value;
|
|
13335
13077
|
}
|
|
13336
|
-
function
|
|
13337
|
-
if (
|
|
13338
|
-
return
|
|
13339
|
-
} else {
|
|
13340
|
-
return String(err);
|
|
13078
|
+
function isRecord(value) {
|
|
13079
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13080
|
+
return false;
|
|
13341
13081
|
}
|
|
13082
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13083
|
+
return prototype === Object.prototype || prototype === null;
|
|
13342
13084
|
}
|
|
13343
|
-
function
|
|
13344
|
-
return
|
|
13345
|
-
};
|
|
13085
|
+
function formatActionPath(path2) {
|
|
13086
|
+
return path2.length === 0 ? "actions" : `Action \`${path2.join(".")}\``;
|
|
13346
13087
|
}
|
|
13347
|
-
var
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
}
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13088
|
+
var DEFAULT_SLEEP_GRACE_PERIOD = 15e3;
|
|
13089
|
+
var ACTOR_CONTEXT_INTERNAL_SYMBOL = /* @__PURE__ */ Symbol(
|
|
13090
|
+
"rivetkit.actor_context_internal"
|
|
13091
|
+
);
|
|
13092
|
+
var RAW_STATE_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.raw_state");
|
|
13093
|
+
var CONN_STATE_MANAGER_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.conn_state_manager");
|
|
13094
|
+
var zFunction = () => external_exports.custom((val) => typeof val === "function");
|
|
13095
|
+
var zActionTree = external_exports.custom((value) => {
|
|
13096
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13097
|
+
return false;
|
|
13098
|
+
}
|
|
13099
|
+
const prototype = Object.getPrototypeOf(value);
|
|
13100
|
+
return prototype === Object.prototype || prototype === null;
|
|
13101
|
+
}).superRefine((actions, ctx) => {
|
|
13102
|
+
try {
|
|
13103
|
+
flattenActionHandlers(actions);
|
|
13104
|
+
} catch (error46) {
|
|
13105
|
+
ctx.addIssue({
|
|
13106
|
+
code: "custom",
|
|
13107
|
+
message: error46 instanceof Error ? error46.message : "Invalid action definition"
|
|
13108
|
+
});
|
|
13109
|
+
}
|
|
13110
|
+
});
|
|
13111
|
+
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
13112
|
+
getHistory: zFunction(),
|
|
13113
|
+
onHistoryUpdated: zFunction().optional(),
|
|
13114
|
+
replayFromStep: zFunction().optional()
|
|
13115
|
+
});
|
|
13116
|
+
var RunInspectorConfigSchema = external_exports.object({
|
|
13117
|
+
workflow: WorkflowInspectorConfigSchema.optional()
|
|
13118
|
+
}).optional();
|
|
13119
|
+
var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
13120
|
+
"workflow",
|
|
13121
|
+
"database",
|
|
13122
|
+
"state",
|
|
13123
|
+
"queue",
|
|
13124
|
+
"schedules",
|
|
13125
|
+
"connections",
|
|
13126
|
+
"console"
|
|
13127
|
+
];
|
|
13128
|
+
var BuiltinInspectorTabIdSchema = external_exports.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
13129
|
+
var CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
13130
|
+
var CustomInspectorTabEntrySchema = external_exports.object({
|
|
13131
|
+
id: external_exports.string().regex(
|
|
13132
|
+
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
13133
|
+
"inspector.tabs[].id must contain only letters, digits, underscore, or dash"
|
|
13134
|
+
),
|
|
13135
|
+
label: external_exports.string().min(1),
|
|
13136
|
+
source: external_exports.string().min(1),
|
|
13137
|
+
/**
|
|
13138
|
+
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
13139
|
+
* icon registry); unknown ids fall back to a generic icon.
|
|
13140
|
+
*/
|
|
13141
|
+
icon: external_exports.string().min(1).optional(),
|
|
13142
|
+
hidden: external_exports.literal(false).optional()
|
|
13143
|
+
}).strict();
|
|
13144
|
+
var HideInspectorTabEntrySchema = external_exports.object({
|
|
13145
|
+
id: BuiltinInspectorTabIdSchema,
|
|
13146
|
+
hidden: external_exports.literal(true)
|
|
13147
|
+
}).strict();
|
|
13148
|
+
var InspectorTabEntrySchema = external_exports.union([
|
|
13149
|
+
CustomInspectorTabEntrySchema,
|
|
13150
|
+
HideInspectorTabEntrySchema
|
|
13151
|
+
]);
|
|
13152
|
+
var ActorInspectorConfigSchema = external_exports.object({
|
|
13153
|
+
tabs: external_exports.array(InspectorTabEntrySchema).default(() => [])
|
|
13154
|
+
}).strict().refine(
|
|
13155
|
+
(data) => {
|
|
13156
|
+
const ids = data.tabs.map((t) => t.id);
|
|
13157
|
+
return new Set(ids).size === ids.length;
|
|
13158
|
+
},
|
|
13159
|
+
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] }
|
|
13160
|
+
).refine(
|
|
13161
|
+
(data) => {
|
|
13162
|
+
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
13163
|
+
return data.tabs.every(
|
|
13164
|
+
(t) => t.hidden === true || !builtinSet.has(t.id)
|
|
13165
|
+
);
|
|
13166
|
+
},
|
|
13167
|
+
{
|
|
13168
|
+
message: "Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
13169
|
+
path: ["tabs"]
|
|
13170
|
+
}
|
|
13171
|
+
);
|
|
13172
|
+
var RunConfigSchema = external_exports.object({
|
|
13173
|
+
/** Display name for the actor in the Inspector UI. */
|
|
13174
|
+
name: external_exports.string().optional(),
|
|
13175
|
+
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
13176
|
+
icon: external_exports.string().optional(),
|
|
13177
|
+
/** The run handler function. */
|
|
13178
|
+
run: zFunction(),
|
|
13179
|
+
/** Inspector integration for long-running run handlers. */
|
|
13180
|
+
inspector: RunInspectorConfigSchema.optional()
|
|
13181
|
+
});
|
|
13182
|
+
var RUN_FUNCTION_CONFIG_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
13183
|
+
"rivetkit.run_function_config"
|
|
13184
|
+
);
|
|
13185
|
+
var zRunHandler = external_exports.union([zFunction(), RunConfigSchema]).optional();
|
|
13186
|
+
function getRunFunction(run) {
|
|
13187
|
+
if (!run) return void 0;
|
|
13188
|
+
if (typeof run === "function") return run;
|
|
13189
|
+
return run.run;
|
|
13190
|
+
}
|
|
13191
|
+
function getRunMetadata(run) {
|
|
13192
|
+
if (!run) return {};
|
|
13193
|
+
if (typeof run === "function") {
|
|
13194
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13195
|
+
if (!config3) return {};
|
|
13196
|
+
return { name: config3.name, icon: config3.icon };
|
|
13197
|
+
}
|
|
13198
|
+
return { name: run.name, icon: run.icon };
|
|
13199
|
+
}
|
|
13200
|
+
function getRunInspectorConfig(run, actor2) {
|
|
13201
|
+
if (!run) return void 0;
|
|
13202
|
+
if (typeof run === "function") {
|
|
13203
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13204
|
+
return (config3 == null ? void 0 : config3.inspectorFactory) ? config3.inspectorFactory(actor2) : config3 == null ? void 0 : config3.inspector;
|
|
13205
|
+
}
|
|
13206
|
+
return run.inspector;
|
|
13207
|
+
}
|
|
13208
|
+
function disposeRunInspector(run, actorId) {
|
|
13209
|
+
var _a2;
|
|
13210
|
+
if (!run || typeof run !== "function") {
|
|
13211
|
+
return;
|
|
13212
|
+
}
|
|
13213
|
+
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
13214
|
+
(_a2 = config3 == null ? void 0 : config3.disposeInspector) == null ? void 0 : _a2.call(config3, actorId);
|
|
13215
|
+
}
|
|
13216
|
+
var GlobalActorOptionsBaseSchema = external_exports.object({
|
|
13217
|
+
/** Display name for the actor in the Inspector UI. */
|
|
13218
|
+
name: external_exports.string().optional(),
|
|
13219
|
+
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
13220
|
+
icon: external_exports.string().optional(),
|
|
13221
|
+
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
13222
|
+
enableActorRuntimeSocket: external_exports.boolean().default(false),
|
|
13223
|
+
/**
|
|
13224
|
+
* Can hibernate WebSockets for onWebSocket.
|
|
13225
|
+
*
|
|
13226
|
+
* WebSockets using actions/events are hibernatable by default.
|
|
13227
|
+
*
|
|
13228
|
+
* @experimental
|
|
13229
|
+
**/
|
|
13230
|
+
canHibernateWebSocket: external_exports.union([external_exports.boolean(), zFunction()]).default(false)
|
|
13231
|
+
}).strict();
|
|
13232
|
+
var GlobalActorOptionsSchema = GlobalActorOptionsBaseSchema.prefault(
|
|
13233
|
+
() => ({})
|
|
13234
|
+
);
|
|
13235
|
+
var InstanceActorOptionsBaseSchema = external_exports.object({
|
|
13236
|
+
createVarsTimeout: external_exports.number().positive().default(5e3),
|
|
13237
|
+
createConnStateTimeout: external_exports.number().positive().default(5e3),
|
|
13238
|
+
onBeforeConnectTimeout: external_exports.number().positive().default(5e3),
|
|
13239
|
+
onConnectTimeout: external_exports.number().positive().default(5e3),
|
|
13240
|
+
onMigrateTimeout: external_exports.number().positive().default(3e4),
|
|
13241
|
+
sleepGracePeriod: external_exports.number().positive().default(DEFAULT_SLEEP_GRACE_PERIOD),
|
|
13242
|
+
/** @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. */
|
|
13243
|
+
onDestroyTimeout: external_exports.number().positive().optional(),
|
|
13244
|
+
/** @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. */
|
|
13245
|
+
waitUntilTimeout: external_exports.number().positive().optional(),
|
|
13246
|
+
stateSaveInterval: external_exports.number().positive().default(1e3),
|
|
13247
|
+
actionTimeout: external_exports.number().positive().default(6e4),
|
|
13248
|
+
connectionLivenessTimeout: external_exports.number().positive().default(2500),
|
|
13249
|
+
connectionLivenessInterval: external_exports.number().positive().default(5e3),
|
|
13250
|
+
/** @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. */
|
|
13251
|
+
noSleep: external_exports.boolean().default(false),
|
|
13252
|
+
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
13253
|
+
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
13254
|
+
/** Maximum pending one-shot and recurring schedules. */
|
|
13255
|
+
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
13256
|
+
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
13257
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
13258
|
+
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
13259
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
13260
|
+
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
13261
|
+
}).strict();
|
|
13262
|
+
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
13263
|
+
var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
13264
|
+
InstanceActorOptionsBaseSchema.shape
|
|
13265
|
+
).strict().prefault(() => ({}));
|
|
13266
|
+
var ActorConfigSchema = external_exports.object({
|
|
13267
|
+
onCreate: zFunction().optional(),
|
|
13268
|
+
onDestroy: zFunction().optional(),
|
|
13269
|
+
onMigrate: zFunction().optional(),
|
|
13270
|
+
onWake: zFunction().optional(),
|
|
13271
|
+
onSleep: zFunction().optional(),
|
|
13272
|
+
run: zRunHandler,
|
|
13273
|
+
onStateChange: zFunction().optional(),
|
|
13274
|
+
onBeforeConnect: zFunction().optional(),
|
|
13275
|
+
onConnect: zFunction().optional(),
|
|
13276
|
+
onDisconnect: zFunction().optional(),
|
|
13277
|
+
onBeforeActionResponse: zFunction().optional(),
|
|
13278
|
+
onRequest: zFunction().optional(),
|
|
13279
|
+
onWebSocket: zFunction().optional(),
|
|
13280
|
+
actions: zActionTree.default(() => ({})),
|
|
13281
|
+
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13282
|
+
connParamsSchema: external_exports.any().optional(),
|
|
13283
|
+
events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13284
|
+
queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
13285
|
+
state: external_exports.any().optional(),
|
|
13286
|
+
createState: zFunction().optional(),
|
|
13287
|
+
connState: external_exports.any().optional(),
|
|
13288
|
+
createConnState: zFunction().optional(),
|
|
13289
|
+
vars: external_exports.any().optional(),
|
|
13290
|
+
db: external_exports.any().optional(),
|
|
13291
|
+
createVars: zFunction().optional(),
|
|
13292
|
+
options: ActorOptionsSchema,
|
|
13293
|
+
inspector: ActorInspectorConfigSchema.optional()
|
|
13294
|
+
}).strict().refine(
|
|
13295
|
+
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
13296
|
+
{
|
|
13297
|
+
message: "Cannot define both 'state' and 'createState'",
|
|
13298
|
+
path: ["state"]
|
|
13299
|
+
}
|
|
13300
|
+
).refine(
|
|
13301
|
+
(data) => !(data.connState !== void 0 && data.createConnState !== void 0),
|
|
13302
|
+
{
|
|
13303
|
+
message: "Cannot define both 'connState' and 'createConnState'",
|
|
13304
|
+
path: ["connState"]
|
|
13305
|
+
}
|
|
13306
|
+
).refine(
|
|
13307
|
+
(data) => !(data.vars !== void 0 && data.createVars !== void 0),
|
|
13308
|
+
{
|
|
13309
|
+
message: "Cannot define both 'vars' and 'createVars'",
|
|
13310
|
+
path: ["vars"]
|
|
13311
|
+
}
|
|
13312
|
+
);
|
|
13313
|
+
var DocActorOptionsSchema = external_exports.object({
|
|
13314
|
+
name: external_exports.string().optional().describe("Display name for the actor in the Inspector UI."),
|
|
13315
|
+
icon: external_exports.string().optional().describe(
|
|
13316
|
+
"Icon for the actor in the Inspector UI. Can be an emoji (e.g., '\u{1F680}') or FontAwesome icon name (e.g., 'rocket')."
|
|
13317
|
+
),
|
|
13318
|
+
enableActorRuntimeSocket: external_exports.boolean().optional().describe(
|
|
13319
|
+
"Enables the experimental Actor Runtime Socket for this actor. Default: false"
|
|
13320
|
+
),
|
|
13321
|
+
createVarsTimeout: external_exports.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
13322
|
+
createConnStateTimeout: external_exports.number().optional().describe(
|
|
13323
|
+
"Timeout in ms for createConnState handler. Default: 5000"
|
|
13324
|
+
),
|
|
13325
|
+
onMigrateTimeout: external_exports.number().optional().describe("Timeout in ms for onMigrate handler. Default: 30000"),
|
|
13326
|
+
onBeforeConnectTimeout: external_exports.number().optional().describe(
|
|
13327
|
+
"Timeout in ms for onBeforeConnect handler. Default: 5000"
|
|
13328
|
+
),
|
|
13329
|
+
onConnectTimeout: external_exports.number().optional().describe("Timeout in ms for onConnect handler. Default: 5000"),
|
|
13330
|
+
sleepGracePeriod: external_exports.number().optional().describe(
|
|
13331
|
+
`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}.`
|
|
13332
|
+
),
|
|
13333
|
+
onDestroyTimeout: external_exports.number().optional().describe(
|
|
13334
|
+
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
13335
|
+
),
|
|
13336
|
+
waitUntilTimeout: external_exports.number().optional().describe(
|
|
13337
|
+
"Deprecated. Folded into sleepGracePeriod, which now bounds the entire graceful shutdown window for both sleep and destroy. Will be removed in 2.2.0."
|
|
13338
|
+
),
|
|
13339
|
+
stateSaveInterval: external_exports.number().optional().describe(
|
|
13340
|
+
"Interval in ms between automatic state saves. Default: 1000"
|
|
13341
|
+
),
|
|
13342
|
+
actionTimeout: external_exports.number().optional().describe("Timeout in ms for action handlers. Default: 60000"),
|
|
13343
|
+
connectionLivenessTimeout: external_exports.number().optional().describe(
|
|
13344
|
+
"Timeout in ms for connection liveness checks. Default: 2500"
|
|
13345
|
+
),
|
|
13346
|
+
connectionLivenessInterval: external_exports.number().optional().describe(
|
|
13347
|
+
"Interval in ms between connection liveness checks. Default: 5000"
|
|
13348
|
+
),
|
|
13349
|
+
noSleep: external_exports.boolean().optional().describe(
|
|
13350
|
+
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false"
|
|
13351
|
+
),
|
|
13352
|
+
sleepTimeout: external_exports.number().optional().describe(
|
|
13353
|
+
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
13354
|
+
),
|
|
13355
|
+
maxQueueSize: external_exports.number().optional().describe(
|
|
13356
|
+
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
13357
|
+
),
|
|
13358
|
+
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
13359
|
+
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
13360
|
+
),
|
|
13361
|
+
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
13362
|
+
"Maximum size of each queue message in bytes. Default: 65536"
|
|
13363
|
+
),
|
|
13364
|
+
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
13365
|
+
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
13366
|
+
)
|
|
13367
|
+
}).describe("Actor options for timeouts and behavior configuration.");
|
|
13368
|
+
var DocActorConfigSchema = external_exports.object({
|
|
13369
|
+
state: external_exports.unknown().optional().describe(
|
|
13370
|
+
"Initial state value for the actor. Cannot be used with createState."
|
|
13371
|
+
),
|
|
13372
|
+
createState: external_exports.unknown().optional().describe(
|
|
13373
|
+
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
13374
|
+
),
|
|
13375
|
+
connState: external_exports.unknown().optional().describe(
|
|
13376
|
+
"Initial connection state value. Cannot be used with createConnState."
|
|
13377
|
+
),
|
|
13378
|
+
createConnState: external_exports.unknown().optional().describe(
|
|
13379
|
+
"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."
|
|
13380
|
+
),
|
|
13381
|
+
vars: external_exports.unknown().optional().describe(
|
|
13382
|
+
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
13383
|
+
),
|
|
13384
|
+
createVars: external_exports.unknown().optional().describe(
|
|
13385
|
+
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
13386
|
+
),
|
|
13387
|
+
db: external_exports.unknown().optional().describe("Database provider instance for the actor."),
|
|
13388
|
+
onCreate: external_exports.unknown().optional().describe(
|
|
13389
|
+
"Called when the actor is first initialized. Use to initialize state."
|
|
13390
|
+
),
|
|
13391
|
+
onDestroy: external_exports.unknown().optional().describe("Called when the actor is destroyed."),
|
|
13392
|
+
onMigrate: external_exports.unknown().optional().describe(
|
|
13393
|
+
"Called on every actor start after persisted state loads and before onWake. Use for repeatable schema migrations."
|
|
13394
|
+
),
|
|
13395
|
+
onWake: external_exports.unknown().optional().describe(
|
|
13396
|
+
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
13397
|
+
),
|
|
13398
|
+
onSleep: external_exports.unknown().optional().describe(
|
|
13399
|
+
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
13400
|
+
),
|
|
13401
|
+
run: external_exports.unknown().optional().describe(
|
|
13402
|
+
"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."
|
|
13403
|
+
),
|
|
13404
|
+
onStateChange: external_exports.unknown().optional().describe(
|
|
13405
|
+
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
13406
|
+
),
|
|
13407
|
+
onBeforeConnect: external_exports.unknown().optional().describe(
|
|
13408
|
+
"Called before a client connects. Throw an error to reject the connection. The pending connection is not visible in c.conns while this runs."
|
|
13409
|
+
),
|
|
13410
|
+
onConnect: external_exports.unknown().optional().describe(
|
|
13411
|
+
"Called when a client successfully connects. The connection is visible in c.conns before this runs."
|
|
13412
|
+
),
|
|
13413
|
+
onDisconnect: external_exports.unknown().optional().describe("Called when a client disconnects."),
|
|
13414
|
+
onBeforeActionResponse: external_exports.unknown().optional().describe(
|
|
13415
|
+
"Called before sending an action response. Use to transform output."
|
|
13416
|
+
),
|
|
13417
|
+
onRequest: external_exports.unknown().optional().describe(
|
|
13418
|
+
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
13419
|
+
),
|
|
13420
|
+
onWebSocket: external_exports.unknown().optional().describe(
|
|
13421
|
+
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
13422
|
+
),
|
|
13423
|
+
actions: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
13424
|
+
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object."
|
|
13425
|
+
),
|
|
13426
|
+
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
13427
|
+
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
|
|
13428
|
+
),
|
|
13429
|
+
connParamsSchema: external_exports.unknown().optional().describe(
|
|
13430
|
+
"Optional schema for validating connection params in native runtimes."
|
|
13431
|
+
),
|
|
13432
|
+
events: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of event names to schemas."),
|
|
13433
|
+
queues: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of queue names to schemas."),
|
|
13434
|
+
options: DocActorOptionsSchema.optional()
|
|
13435
|
+
}).describe("Actor configuration passed to the actor() function.");
|
|
13436
|
+
|
|
13437
|
+
// ../rivetkit/dist/tsup/chunk-ZZ3WBRPD.js
|
|
13438
|
+
var INTERNAL_ERROR_CODE = "internal_error";
|
|
13439
|
+
var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
|
|
13440
|
+
var USER_ERROR_CODE = "user_error";
|
|
13441
|
+
var BRIDGE_RIVET_ERROR_PREFIX = "__RIVET_ERROR_JSON__:";
|
|
13442
|
+
function looksLikeRivetErrorOptions(value) {
|
|
13443
|
+
return typeof value === "object" && value !== null && ("public" in value || "metadata" in value || "statusCode" in value || "actor" in value || "cause" in value);
|
|
13444
|
+
}
|
|
13445
|
+
function isTypedErrorTag(value) {
|
|
13446
|
+
return value === "ActorError" || value === "RivetError";
|
|
13447
|
+
}
|
|
13448
|
+
function errorMessage(error46, fallback = String(error46)) {
|
|
13449
|
+
if (error46 && typeof error46 === "object" && "message" in error46 && typeof error46.message === "string") {
|
|
13450
|
+
return error46.message;
|
|
13451
|
+
}
|
|
13452
|
+
return fallback;
|
|
13453
|
+
}
|
|
13454
|
+
function isRivetErrorLike(error46) {
|
|
13455
|
+
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));
|
|
13456
|
+
}
|
|
13457
|
+
function isActorAbortedError(error46) {
|
|
13458
|
+
return isRivetErrorLike(error46) && error46.group === "actor" && error46.code === "aborted";
|
|
13459
|
+
}
|
|
13460
|
+
function isActorSpecifier(value) {
|
|
13461
|
+
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");
|
|
13462
|
+
}
|
|
13463
|
+
var RivetError = class extends Error {
|
|
13464
|
+
__type = "RivetError";
|
|
13465
|
+
public;
|
|
13466
|
+
metadata;
|
|
13467
|
+
statusCode;
|
|
13468
|
+
actor;
|
|
13469
|
+
group;
|
|
13470
|
+
code;
|
|
13471
|
+
static isRivetError(error46) {
|
|
13472
|
+
return isRivetErrorLike(error46);
|
|
13473
|
+
}
|
|
13474
|
+
static isActorError(error46) {
|
|
13475
|
+
return isRivetErrorLike(error46);
|
|
13476
|
+
}
|
|
13477
|
+
constructor(group, code, message, options) {
|
|
13478
|
+
const normalized = looksLikeRivetErrorOptions(options) ? options : { metadata: options };
|
|
13479
|
+
super(message, { cause: normalized.cause });
|
|
13480
|
+
this.name = "RivetError";
|
|
13481
|
+
this.group = group;
|
|
13482
|
+
this.code = code;
|
|
13483
|
+
this.public = normalized.public ?? false;
|
|
13484
|
+
this.metadata = normalized.metadata;
|
|
13485
|
+
this.statusCode = normalized.statusCode ?? (this.public ? 400 : 500);
|
|
13486
|
+
this.actor = normalized.actor;
|
|
13487
|
+
}
|
|
13488
|
+
toString() {
|
|
13489
|
+
return this.message;
|
|
13490
|
+
}
|
|
13491
|
+
};
|
|
13492
|
+
var UserError = class extends RivetError {
|
|
13493
|
+
constructor(message, options) {
|
|
13494
|
+
super("user", (options == null ? void 0 : options.code) ?? USER_ERROR_CODE, message, {
|
|
13495
|
+
public: true,
|
|
13496
|
+
metadata: options == null ? void 0 : options.metadata,
|
|
13497
|
+
cause: options == null ? void 0 : options.cause
|
|
13498
|
+
});
|
|
13499
|
+
}
|
|
13500
|
+
};
|
|
13501
|
+
function toRivetError(error46, fallback) {
|
|
13502
|
+
if (typeof error46 === "string") {
|
|
13503
|
+
const bridged = decodeBridgeRivetError(error46);
|
|
13504
|
+
if (bridged) {
|
|
13505
|
+
return bridged;
|
|
13506
|
+
}
|
|
13507
|
+
}
|
|
13508
|
+
if (error46 instanceof Error) {
|
|
13509
|
+
const bridged = decodeBridgeRivetError(error46.message);
|
|
13510
|
+
if (bridged) {
|
|
13511
|
+
return bridged;
|
|
13512
|
+
}
|
|
13513
|
+
}
|
|
13514
|
+
if (isRivetErrorLike(error46)) {
|
|
13515
|
+
return new RivetError(error46.group, error46.code, error46.message, {
|
|
13516
|
+
public: error46.public,
|
|
13517
|
+
statusCode: error46.statusCode,
|
|
13518
|
+
metadata: error46.metadata,
|
|
13519
|
+
actor: error46.actor,
|
|
13520
|
+
cause: error46 instanceof Error ? error46.cause : void 0
|
|
13521
|
+
});
|
|
13522
|
+
}
|
|
13523
|
+
return new RivetError(
|
|
13524
|
+
(fallback == null ? void 0 : fallback.group) ?? "actor",
|
|
13525
|
+
(fallback == null ? void 0 : fallback.code) ?? INTERNAL_ERROR_CODE,
|
|
13526
|
+
errorMessage(error46, (fallback == null ? void 0 : fallback.message) ?? "Unknown error"),
|
|
13527
|
+
{
|
|
13528
|
+
public: fallback == null ? void 0 : fallback.public,
|
|
13529
|
+
statusCode: fallback == null ? void 0 : fallback.statusCode,
|
|
13530
|
+
metadata: fallback == null ? void 0 : fallback.metadata,
|
|
13531
|
+
actor: fallback == null ? void 0 : fallback.actor,
|
|
13532
|
+
cause: error46 instanceof Error ? error46 : void 0
|
|
13533
|
+
}
|
|
13534
|
+
);
|
|
13535
|
+
}
|
|
13536
|
+
function encodeBridgeRivetError(error46) {
|
|
13537
|
+
return `${BRIDGE_RIVET_ERROR_PREFIX}${JSON.stringify({
|
|
13538
|
+
group: error46.group,
|
|
13539
|
+
code: error46.code,
|
|
13540
|
+
message: error46.message,
|
|
13541
|
+
metadata: error46.metadata,
|
|
13542
|
+
public: error46.public,
|
|
13543
|
+
statusCode: error46.statusCode,
|
|
13544
|
+
actor: error46.actor
|
|
13545
|
+
})}`;
|
|
13546
|
+
}
|
|
13547
|
+
function decodeBridgeRivetErrorPayload(value) {
|
|
13548
|
+
if (!value.startsWith(BRIDGE_RIVET_ERROR_PREFIX)) {
|
|
13549
|
+
return void 0;
|
|
13550
|
+
}
|
|
13551
|
+
try {
|
|
13552
|
+
const payload = JSON.parse(
|
|
13553
|
+
value.slice(BRIDGE_RIVET_ERROR_PREFIX.length)
|
|
13554
|
+
);
|
|
13555
|
+
if (!isRivetErrorLike(payload)) {
|
|
13556
|
+
return void 0;
|
|
13557
|
+
}
|
|
13558
|
+
if (payload.actor !== void 0 && payload.actor !== null && !isActorSpecifier(payload.actor)) {
|
|
13559
|
+
return void 0;
|
|
13560
|
+
}
|
|
13561
|
+
return payload;
|
|
13562
|
+
} catch {
|
|
13563
|
+
return void 0;
|
|
13564
|
+
}
|
|
13565
|
+
}
|
|
13566
|
+
function decodeBridgeRivetError(value) {
|
|
13567
|
+
const payload = decodeBridgeRivetErrorPayload(value);
|
|
13568
|
+
if (!payload) {
|
|
13569
|
+
return void 0;
|
|
13570
|
+
}
|
|
13571
|
+
return new RivetError(payload.group, payload.code, payload.message, {
|
|
13572
|
+
metadata: payload.metadata,
|
|
13573
|
+
public: payload.public,
|
|
13574
|
+
statusCode: payload.statusCode,
|
|
13575
|
+
actor: payload.actor ?? void 0
|
|
13576
|
+
});
|
|
13577
|
+
}
|
|
13578
|
+
function invalidRequest(error46) {
|
|
13579
|
+
return new RivetError(
|
|
13580
|
+
"request",
|
|
13581
|
+
"invalid",
|
|
13582
|
+
`Invalid request: ${errorMessage(error46, String(error46))}`,
|
|
13583
|
+
{
|
|
13584
|
+
public: true,
|
|
13585
|
+
cause: error46 instanceof Error ? error46 : void 0
|
|
13586
|
+
}
|
|
13587
|
+
);
|
|
13588
|
+
}
|
|
13589
|
+
function actorNotFound(identifier) {
|
|
13590
|
+
return new RivetError(
|
|
13591
|
+
"actor",
|
|
13592
|
+
"not_found",
|
|
13593
|
+
identifier ? `Actor not found: ${identifier} (https://www.rivet.dev/docs/clients/javascript)` : "Actor not found (https://www.rivet.dev/docs/clients/javascript)",
|
|
13594
|
+
{ public: true }
|
|
13595
|
+
);
|
|
13596
|
+
}
|
|
13597
|
+
function forbiddenError() {
|
|
13598
|
+
return new RivetError("auth", "forbidden", "Forbidden", {
|
|
13599
|
+
public: true,
|
|
13600
|
+
statusCode: 403
|
|
13601
|
+
});
|
|
13602
|
+
}
|
|
13603
|
+
function unsupportedFeature(feature) {
|
|
13604
|
+
return new RivetError(
|
|
13605
|
+
"feature",
|
|
13606
|
+
"unsupported",
|
|
13607
|
+
`Unsupported feature: ${feature}`
|
|
13608
|
+
);
|
|
13609
|
+
}
|
|
13610
|
+
|
|
13611
|
+
// ../rivetkit/dist/tsup/chunk-XAGDGH4O.js
|
|
13612
|
+
var import_pino = require("pino");
|
|
13613
|
+
var cbor = __toESM(require("cbor-x"), 1);
|
|
13614
|
+
var import_invariant = __toESM(require_invariant(), 1);
|
|
13615
|
+
var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
|
|
13616
|
+
var getRivetEndpoint = () => getEnvUniversal("RIVET_ENDPOINT");
|
|
13617
|
+
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
13618
|
+
var getRivetNamespace = () => getEnvUniversal("RIVET_NAMESPACE");
|
|
13619
|
+
var getRivetPool = () => getEnvUniversal("RIVET_POOL");
|
|
13620
|
+
var getRivetTotalSlots = () => {
|
|
13621
|
+
const value = getEnvUniversal("RIVET_TOTAL_SLOTS");
|
|
13622
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13623
|
+
};
|
|
13624
|
+
var getRivetRunEngine = () => getEnvUniversal("RIVET_RUN_ENGINE") === "1";
|
|
13625
|
+
var getRivetRunEngineHost = () => getEnvUniversal("RIVET_RUN_ENGINE_HOST");
|
|
13626
|
+
var getRivetRunEnginePort = () => {
|
|
13627
|
+
const value = getEnvUniversal("RIVET_RUN_ENGINE_PORT");
|
|
13628
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13629
|
+
};
|
|
13630
|
+
var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
|
|
13631
|
+
var getRivetEnvoyVersion = () => {
|
|
13632
|
+
const value = getEnvUniversal("RIVET_ENVOY_VERSION");
|
|
13633
|
+
return value !== void 0 ? parseInt(value, 10) : void 0;
|
|
13634
|
+
};
|
|
13635
|
+
var getRivetPublicEndpoint = () => getEnvUniversal("RIVET_PUBLIC_ENDPOINT");
|
|
13636
|
+
var getRivetPublicToken = () => getEnvUniversal("RIVET_PUBLIC_TOKEN");
|
|
13637
|
+
var getRivetkitRuntime = () => getEnvUniversal("RIVETKIT_RUNTIME");
|
|
13638
|
+
var getRivetkitRuntimeMode = () => {
|
|
13639
|
+
const value = getEnvUniversal("RIVETKIT_RUNTIME_MODE");
|
|
13640
|
+
if (value === void 0) return "envoy";
|
|
13641
|
+
if (value === "envoy" || value === "serverless") return value;
|
|
13642
|
+
throw new Error(
|
|
13643
|
+
`RIVETKIT_RUNTIME_MODE env var must be "envoy" or "serverless"; got "${value}"`
|
|
13644
|
+
);
|
|
13645
|
+
};
|
|
13646
|
+
var getRivetkitPublicDir = () => {
|
|
13647
|
+
const value = getEnvUniversal("RIVETKIT_PUBLIC_DIR");
|
|
13648
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
13649
|
+
};
|
|
13650
|
+
function parsePortEnv(raw) {
|
|
13651
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
13652
|
+
const parsed = Number.parseInt(raw, 10);
|
|
13653
|
+
if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535 || String(parsed) !== raw.trim()) {
|
|
13654
|
+
throw new Error(
|
|
13655
|
+
`RIVET_PORT env var must be an integer between 1 and 65535; got "${raw}"`
|
|
13656
|
+
);
|
|
13657
|
+
}
|
|
13658
|
+
return parsed;
|
|
13659
|
+
}
|
|
13660
|
+
var getLogLevel = () => getEnvUniversal("RIVET_LOG_LEVEL") ?? getEnvUniversal("LOG_LEVEL");
|
|
13661
|
+
var getLogTarget = () => getEnvUniversal("RIVET_LOG_TARGET") === "1";
|
|
13662
|
+
var getLogTimestamp = () => getEnvUniversal("RIVET_LOG_TIMESTAMP") === "1";
|
|
13663
|
+
var getLogMessage = () => getEnvUniversal("RIVET_LOG_MESSAGE") === "1";
|
|
13664
|
+
var getLogErrorStack = () => getEnvUniversal("RIVET_LOG_ERROR_STACK") === "1";
|
|
13665
|
+
var getNodeEnv = () => getEnvUniversal("NODE_ENV");
|
|
13666
|
+
var getNextPhase = () => getEnvUniversal("NEXT_PHASE");
|
|
13667
|
+
var isDev = () => getNodeEnv() !== "production";
|
|
13668
|
+
function assertUnreachable(x) {
|
|
13669
|
+
throw new Error(`Unreachable case: ${x}`);
|
|
13670
|
+
}
|
|
13671
|
+
function isCanonicalStructuredRivetError(error46) {
|
|
13672
|
+
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";
|
|
13673
|
+
}
|
|
13674
|
+
function deconstructError(error46, exposeInternalError = false) {
|
|
13675
|
+
let statusCode;
|
|
13676
|
+
let public_;
|
|
13677
|
+
let group;
|
|
13678
|
+
let code;
|
|
13679
|
+
let message;
|
|
13680
|
+
let metadata;
|
|
13681
|
+
let actor2;
|
|
13682
|
+
if (isCanonicalStructuredRivetError(error46)) {
|
|
13683
|
+
statusCode = typeof error46.statusCode === "number" ? error46.statusCode : error46.public ? 400 : 500;
|
|
13684
|
+
public_ = error46.public ?? false;
|
|
13685
|
+
group = error46.group;
|
|
13686
|
+
code = error46.code;
|
|
13687
|
+
message = error46.message;
|
|
13688
|
+
metadata = error46.metadata;
|
|
13689
|
+
actor2 = error46.actor;
|
|
13690
|
+
} else if (RivetError.isActorError(error46) && error46.public) {
|
|
13691
|
+
statusCode = "statusCode" in error46 && error46.statusCode ? error46.statusCode : 400;
|
|
13692
|
+
public_ = true;
|
|
13693
|
+
group = error46.group;
|
|
13694
|
+
code = error46.code;
|
|
13695
|
+
message = getErrorMessage(error46);
|
|
13696
|
+
metadata = error46.metadata;
|
|
13697
|
+
actor2 = error46.actor;
|
|
13698
|
+
} else if (exposeInternalError) {
|
|
13699
|
+
if (RivetError.isActorError(error46)) {
|
|
13700
|
+
statusCode = 500;
|
|
13701
|
+
public_ = false;
|
|
13702
|
+
group = error46.group;
|
|
13703
|
+
code = error46.code;
|
|
13704
|
+
message = getErrorMessage(error46);
|
|
13705
|
+
metadata = error46.metadata;
|
|
13706
|
+
actor2 = error46.actor;
|
|
13707
|
+
} else {
|
|
13708
|
+
statusCode = 500;
|
|
13709
|
+
public_ = false;
|
|
13710
|
+
group = "rivetkit";
|
|
13711
|
+
code = INTERNAL_ERROR_CODE;
|
|
13712
|
+
message = getErrorMessage(error46);
|
|
13713
|
+
}
|
|
13714
|
+
} else {
|
|
13715
|
+
statusCode = 500;
|
|
13716
|
+
public_ = false;
|
|
13717
|
+
group = "rivetkit";
|
|
13718
|
+
code = INTERNAL_ERROR_CODE;
|
|
13719
|
+
message = INTERNAL_ERROR_DESCRIPTION;
|
|
13720
|
+
if (RivetError.isActorError(error46)) {
|
|
13721
|
+
actor2 = error46.actor;
|
|
13722
|
+
}
|
|
13723
|
+
metadata = {
|
|
13724
|
+
//url: `https://dashboard.rivet.dev/projects/${actorMetadata.project.slug}/environments/${actorMetadata.environment.slug}/actors?actorId=${actorMetadata.actor.id}`,
|
|
13725
|
+
};
|
|
13726
|
+
}
|
|
13727
|
+
return {
|
|
13728
|
+
__type: "ActorError",
|
|
13729
|
+
statusCode,
|
|
13730
|
+
public: public_,
|
|
13731
|
+
group,
|
|
13732
|
+
code,
|
|
13733
|
+
message,
|
|
13734
|
+
metadata,
|
|
13735
|
+
actor: actor2
|
|
13736
|
+
};
|
|
13737
|
+
}
|
|
13738
|
+
function stringifyError(error46) {
|
|
13739
|
+
if (error46 instanceof Error) {
|
|
13740
|
+
if (typeof process !== "undefined" && getLogErrorStack()) {
|
|
13741
|
+
let stack;
|
|
13742
|
+
try {
|
|
13743
|
+
stack = error46.stack;
|
|
13744
|
+
} catch {
|
|
13745
|
+
stack = void 0;
|
|
13746
|
+
}
|
|
13747
|
+
return `${error46.name}: ${error46.message}${stack ? `
|
|
13748
|
+
${stack}` : ""}`;
|
|
13749
|
+
} else {
|
|
13750
|
+
return `${error46.name}: ${error46.message}`;
|
|
13751
|
+
}
|
|
13752
|
+
} else if (typeof error46 === "string") {
|
|
13753
|
+
return error46;
|
|
13754
|
+
} else if (typeof error46 === "object" && error46 !== null) {
|
|
13755
|
+
try {
|
|
13756
|
+
return `${JSON.stringify(error46)}`;
|
|
13757
|
+
} catch {
|
|
13758
|
+
return "[cannot stringify error]";
|
|
13759
|
+
}
|
|
13760
|
+
} else {
|
|
13761
|
+
return `Unknown error: ${getErrorMessage(error46)}`;
|
|
13762
|
+
}
|
|
13763
|
+
}
|
|
13764
|
+
function getErrorMessage(err) {
|
|
13765
|
+
if (err && typeof err === "object" && "message" in err && typeof err.message === "string") {
|
|
13766
|
+
return err.message;
|
|
13767
|
+
} else {
|
|
13768
|
+
return String(err);
|
|
13769
|
+
}
|
|
13770
|
+
}
|
|
13771
|
+
function noopNext() {
|
|
13772
|
+
return async () => {
|
|
13773
|
+
};
|
|
13774
|
+
}
|
|
13775
|
+
var package_default = {
|
|
13776
|
+
name: "rivetkit",
|
|
13777
|
+
version: "2.3.11-rc.7",
|
|
13778
|
+
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
13779
|
+
license: "Apache-2.0",
|
|
13780
|
+
keywords: [
|
|
13781
|
+
"rivetkit",
|
|
13782
|
+
"stateful",
|
|
13783
|
+
"serverless",
|
|
13784
|
+
"actors",
|
|
13785
|
+
"agents",
|
|
13786
|
+
"realtime",
|
|
13787
|
+
"websocket",
|
|
13788
|
+
"actors",
|
|
13789
|
+
"framework"
|
|
13790
|
+
],
|
|
13791
|
+
files: [
|
|
13792
|
+
"dist",
|
|
13793
|
+
"schemas",
|
|
13794
|
+
"src",
|
|
13795
|
+
"package.json"
|
|
13796
|
+
],
|
|
13797
|
+
type: "module",
|
|
13798
|
+
exports: {
|
|
13799
|
+
".": {
|
|
13800
|
+
import: {
|
|
13801
|
+
types: "./dist/tsup/mod.d.ts",
|
|
13802
|
+
default: "./dist/tsup/mod.js"
|
|
13803
|
+
},
|
|
13804
|
+
require: {
|
|
13805
|
+
types: "./dist/tsup/mod.d.cts",
|
|
13806
|
+
default: "./dist/tsup/mod.cjs"
|
|
13807
|
+
}
|
|
13808
|
+
},
|
|
13809
|
+
"./workflow": {
|
|
13810
|
+
import: {
|
|
13811
|
+
types: "./dist/tsup/workflow/mod.d.ts",
|
|
13812
|
+
default: "./dist/tsup/workflow/mod.js"
|
|
13813
|
+
},
|
|
13814
|
+
require: {
|
|
13815
|
+
types: "./dist/tsup/workflow/mod.d.cts",
|
|
13816
|
+
default: "./dist/tsup/workflow/mod.cjs"
|
|
13817
|
+
}
|
|
13818
|
+
},
|
|
13819
|
+
"./test": {
|
|
13820
|
+
import: {
|
|
13821
|
+
types: "./dist/tsup/test/mod.d.ts",
|
|
13822
|
+
default: "./dist/tsup/test/mod.js"
|
|
13823
|
+
},
|
|
13824
|
+
require: {
|
|
13825
|
+
types: "./dist/tsup/test/mod.d.cts",
|
|
13826
|
+
default: "./dist/tsup/test/mod.cjs"
|
|
13827
|
+
}
|
|
13828
|
+
},
|
|
13829
|
+
"./db": {
|
|
13830
|
+
import: {
|
|
13831
|
+
types: "./dist/tsup/db/mod.d.ts",
|
|
13832
|
+
default: "./dist/tsup/db/mod.js"
|
|
13833
|
+
},
|
|
13834
|
+
require: {
|
|
13835
|
+
types: "./dist/tsup/db/mod.d.cts",
|
|
13836
|
+
default: "./dist/tsup/db/mod.cjs"
|
|
13837
|
+
}
|
|
13838
|
+
},
|
|
13839
|
+
"./db/drizzle": {
|
|
13840
|
+
import: {
|
|
13841
|
+
types: "./dist/tsup/db/drizzle.d.ts",
|
|
13842
|
+
default: "./dist/tsup/db/drizzle.js"
|
|
13843
|
+
},
|
|
13844
|
+
require: {
|
|
13845
|
+
types: "./dist/tsup/db/drizzle.d.cts",
|
|
13846
|
+
default: "./dist/tsup/db/drizzle.cjs"
|
|
13847
|
+
}
|
|
13848
|
+
},
|
|
13849
|
+
"./unstable/migrations": {
|
|
13850
|
+
import: {
|
|
13851
|
+
types: "./dist/tsup/unstable/migrations.d.ts",
|
|
13852
|
+
default: "./dist/tsup/unstable/migrations.js"
|
|
13853
|
+
},
|
|
13854
|
+
require: {
|
|
13855
|
+
types: "./dist/tsup/unstable/migrations.d.cts",
|
|
13856
|
+
default: "./dist/tsup/unstable/migrations.cjs"
|
|
13857
|
+
}
|
|
13858
|
+
},
|
|
13859
|
+
"./dynamic": {
|
|
13860
|
+
import: {
|
|
13861
|
+
types: "./dist/tsup/dynamic/mod.d.ts",
|
|
13862
|
+
default: "./dist/tsup/dynamic/mod.js"
|
|
13863
|
+
},
|
|
13864
|
+
require: {
|
|
13865
|
+
types: "./dist/tsup/dynamic/mod.d.cts",
|
|
13866
|
+
default: "./dist/tsup/dynamic/mod.cjs"
|
|
13867
|
+
}
|
|
13868
|
+
},
|
|
13869
|
+
"./client": {
|
|
13870
|
+
import: {
|
|
13871
|
+
browser: {
|
|
13872
|
+
types: "./dist/browser/client.d.ts",
|
|
13873
|
+
default: "./dist/browser/client.js"
|
|
13874
|
+
},
|
|
13875
|
+
types: "./dist/tsup/client/mod.d.ts",
|
|
13876
|
+
default: "./dist/tsup/client/mod.js"
|
|
13877
|
+
},
|
|
13878
|
+
require: {
|
|
13879
|
+
types: "./dist/tsup/client/mod.d.cts",
|
|
13880
|
+
default: "./dist/tsup/client/mod.cjs"
|
|
13881
|
+
}
|
|
13882
|
+
},
|
|
13883
|
+
"./log": {
|
|
13884
|
+
import: {
|
|
13885
|
+
types: "./dist/tsup/common/log.d.ts",
|
|
13886
|
+
default: "./dist/tsup/common/log.js"
|
|
13887
|
+
},
|
|
13888
|
+
require: {
|
|
13889
|
+
types: "./dist/tsup/common/log.d.cts",
|
|
13890
|
+
default: "./dist/tsup/common/log.cjs"
|
|
13891
|
+
}
|
|
13892
|
+
},
|
|
13893
|
+
"./errors": {
|
|
13894
|
+
import: {
|
|
13895
|
+
types: "./dist/tsup/actor/errors.d.ts",
|
|
13896
|
+
default: "./dist/tsup/actor/errors.js"
|
|
13897
|
+
},
|
|
13898
|
+
require: {
|
|
13471
13899
|
types: "./dist/tsup/actor/errors.d.cts",
|
|
13472
13900
|
default: "./dist/tsup/actor/errors.cjs"
|
|
13473
13901
|
}
|
|
@@ -14057,1315 +14485,885 @@ function reviveJsonCompatValue(input, options = {}) {
|
|
|
14057
14485
|
if (input[0].startsWith("$$")) {
|
|
14058
14486
|
return [
|
|
14059
14487
|
input[0].substring(1),
|
|
14060
|
-
reviveJsonCompatValue(input[1], options)
|
|
14061
|
-
];
|
|
14062
|
-
}
|
|
14063
|
-
throw new Error(
|
|
14064
|
-
`Unknown JSON encoding type: ${input[0]}. This may indicate corrupted data or a version mismatch.`
|
|
14065
|
-
);
|
|
14066
|
-
}
|
|
14067
|
-
return input.map((value) => reviveJsonCompatValue(value, options));
|
|
14068
|
-
}
|
|
14069
|
-
if (isPlainObject2(input)) {
|
|
14070
|
-
const decoded = {};
|
|
14071
|
-
for (const [key, value] of Object.entries(input)) {
|
|
14072
|
-
decoded[key] = reviveJsonCompatValue(value, options);
|
|
14073
|
-
}
|
|
14074
|
-
return decoded;
|
|
14075
|
-
}
|
|
14076
|
-
return input;
|
|
14077
|
-
}
|
|
14078
|
-
function base64DecodeToUint8Array(base643) {
|
|
14079
|
-
if (typeof Buffer !== "undefined") {
|
|
14080
|
-
return new Uint8Array(Buffer.from(base643, "base64"));
|
|
14081
|
-
}
|
|
14082
|
-
const binary = atob(base643);
|
|
14083
|
-
const bytes = new Uint8Array(binary.length);
|
|
14084
|
-
for (let i = 0; i < binary.length; i++) {
|
|
14085
|
-
bytes[i] = binary.charCodeAt(i);
|
|
14086
|
-
}
|
|
14087
|
-
return bytes;
|
|
14088
|
-
}
|
|
14089
|
-
function base64DecodeToArrayBuffer(base643) {
|
|
14090
|
-
return base64DecodeToUint8Array(base643).buffer;
|
|
14091
|
-
}
|
|
14092
|
-
function jsonStringifyCompat(input, space) {
|
|
14093
|
-
return JSON.stringify(
|
|
14094
|
-
input,
|
|
14095
|
-
(_key, value) => {
|
|
14096
|
-
if (typeof value === "bigint") {
|
|
14097
|
-
return [JSON_COMPAT_BIGINT, value.toString()];
|
|
14098
|
-
}
|
|
14099
|
-
if (value instanceof ArrayBuffer) {
|
|
14100
|
-
return [
|
|
14101
|
-
JSON_COMPAT_ARRAY_BUFFER,
|
|
14102
|
-
base64EncodeArrayBuffer(value)
|
|
14103
|
-
];
|
|
14104
|
-
}
|
|
14105
|
-
if (value instanceof Uint8Array) {
|
|
14106
|
-
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(value)];
|
|
14107
|
-
}
|
|
14108
|
-
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && value[0].startsWith("$")) {
|
|
14109
|
-
return [`$${value[0]}`, value[1]];
|
|
14110
|
-
}
|
|
14111
|
-
return value;
|
|
14112
|
-
},
|
|
14113
|
-
space
|
|
14114
|
-
);
|
|
14115
|
-
}
|
|
14116
|
-
function jsonParseCompat(input) {
|
|
14117
|
-
return reviveJsonCompatValue(JSON.parse(input));
|
|
14118
|
-
}
|
|
14119
|
-
var VERSION = package_default.version;
|
|
14120
|
-
var _userAgent;
|
|
14121
|
-
function httpUserAgent() {
|
|
14122
|
-
if (_userAgent !== void 0) {
|
|
14123
|
-
return _userAgent;
|
|
14124
|
-
}
|
|
14125
|
-
let userAgent = `RivetKit/${VERSION}`;
|
|
14126
|
-
const navigatorObj = typeof navigator !== "undefined" ? navigator : void 0;
|
|
14127
|
-
if (navigatorObj == null ? void 0 : navigatorObj.userAgent) userAgent += ` ${navigatorObj.userAgent}`;
|
|
14128
|
-
_userAgent = userAgent;
|
|
14129
|
-
return userAgent;
|
|
14130
|
-
}
|
|
14131
|
-
function getEnvUniversal(key) {
|
|
14132
|
-
if (typeof Deno !== "undefined") {
|
|
14133
|
-
return Deno.env.get(key);
|
|
14134
|
-
} else if (typeof process !== "undefined") {
|
|
14135
|
-
return process.env[key];
|
|
14136
|
-
}
|
|
14137
|
-
}
|
|
14138
|
-
function toUint8Array(data) {
|
|
14139
|
-
if (data instanceof Uint8Array) {
|
|
14140
|
-
return data;
|
|
14141
|
-
} else if (data instanceof ArrayBuffer) {
|
|
14142
|
-
return new Uint8Array(data);
|
|
14143
|
-
} else if (ArrayBuffer.isView(data)) {
|
|
14144
|
-
return new Uint8Array(
|
|
14145
|
-
data.buffer.slice(
|
|
14146
|
-
data.byteOffset,
|
|
14147
|
-
data.byteOffset + data.byteLength
|
|
14148
|
-
)
|
|
14149
|
-
);
|
|
14150
|
-
} else {
|
|
14151
|
-
throw new TypeError("Input must be ArrayBuffer or ArrayBufferView");
|
|
14152
|
-
}
|
|
14153
|
-
}
|
|
14154
|
-
function promiseWithResolvers(onReject) {
|
|
14155
|
-
let resolve;
|
|
14156
|
-
let reject;
|
|
14157
|
-
const promise2 = new Promise((res, rej) => {
|
|
14158
|
-
resolve = res;
|
|
14159
|
-
reject = rej;
|
|
14160
|
-
});
|
|
14161
|
-
promise2.catch(onReject);
|
|
14162
|
-
return { promise: promise2, resolve, reject };
|
|
14163
|
-
}
|
|
14164
|
-
function bufferToArrayBuffer(buf) {
|
|
14165
|
-
return buf.buffer.slice(
|
|
14166
|
-
buf.byteOffset,
|
|
14167
|
-
buf.byteOffset + buf.byteLength
|
|
14168
|
-
);
|
|
14169
|
-
}
|
|
14170
|
-
function combineUrlPath(endpoint, path2, queryParams) {
|
|
14171
|
-
const baseUrl = new URL(endpoint);
|
|
14172
|
-
const pathParts = path2.split("?");
|
|
14173
|
-
const pathOnly = pathParts[0];
|
|
14174
|
-
const existingQuery = pathParts[1] || "";
|
|
14175
|
-
const basePath = baseUrl.pathname.replace(/\/$/, "");
|
|
14176
|
-
const cleanPath = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
14177
|
-
const fullPath = (basePath + cleanPath).replace(/\/\//g, "/");
|
|
14178
|
-
const queryParts = [];
|
|
14179
|
-
if (existingQuery) {
|
|
14180
|
-
queryParts.push(existingQuery);
|
|
14181
|
-
}
|
|
14182
|
-
if (queryParams) {
|
|
14183
|
-
for (const [key, value] of Object.entries(queryParams)) {
|
|
14184
|
-
if (value !== void 0) {
|
|
14185
|
-
queryParts.push(
|
|
14186
|
-
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
14187
|
-
);
|
|
14188
|
-
}
|
|
14189
|
-
}
|
|
14190
|
-
}
|
|
14191
|
-
const fullQuery = queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
14192
|
-
return `${baseUrl.protocol}//${baseUrl.host}${fullPath}${fullQuery}`;
|
|
14193
|
-
}
|
|
14194
|
-
|
|
14195
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/imports/dev.node.js
|
|
14196
|
-
var DEV = process.env.NODE_ENV === "development";
|
|
14197
|
-
|
|
14198
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/assert.js
|
|
14199
|
-
var V8Error = Error;
|
|
14200
|
-
function assert2(test, message = "") {
|
|
14201
|
-
if (!test) {
|
|
14202
|
-
const e = new AssertionError(message);
|
|
14203
|
-
V8Error.captureStackTrace?.(e, assert2);
|
|
14204
|
-
throw e;
|
|
14205
|
-
}
|
|
14206
|
-
}
|
|
14207
|
-
var AssertionError = class extends Error {
|
|
14208
|
-
constructor() {
|
|
14209
|
-
super(...arguments);
|
|
14210
|
-
this.name = "AssertionError";
|
|
14211
|
-
}
|
|
14212
|
-
};
|
|
14213
|
-
|
|
14214
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/validator.js
|
|
14215
|
-
function isU8(val) {
|
|
14216
|
-
return val === (val & 255);
|
|
14217
|
-
}
|
|
14218
|
-
function isU32(val) {
|
|
14219
|
-
return val === val >>> 0;
|
|
14220
|
-
}
|
|
14221
|
-
function isU64(val) {
|
|
14222
|
-
return val === BigInt.asUintN(64, val);
|
|
14223
|
-
}
|
|
14224
|
-
|
|
14225
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/constants.js
|
|
14226
|
-
var TEXT_DECODER_THRESHOLD = 256;
|
|
14227
|
-
var TEXT_ENCODER_THRESHOLD = 256;
|
|
14228
|
-
var INT_SAFE_MAX_BYTE_COUNT = 8;
|
|
14229
|
-
var UINT_MAX_BYTE_COUNT = 10;
|
|
14230
|
-
var UINT_SAFE32_MAX_BYTE_COUNT = 5;
|
|
14231
|
-
var INVALID_UTF8_STRING = "invalid UTF-8 string";
|
|
14232
|
-
var NON_CANONICAL_REPRESENTATION = "must be canonical";
|
|
14233
|
-
var TOO_LARGE_BUFFER = "too large buffer";
|
|
14234
|
-
var TOO_LARGE_NUMBER = "too large number";
|
|
14235
|
-
|
|
14236
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/bare-error.js
|
|
14237
|
-
var BareError = class extends Error {
|
|
14238
|
-
constructor(offset, issue2, opts) {
|
|
14239
|
-
super(`(byte:${offset}) ${issue2}`);
|
|
14240
|
-
this.name = "BareError";
|
|
14241
|
-
this.issue = issue2;
|
|
14242
|
-
this.offset = offset;
|
|
14243
|
-
this.cause = opts?.cause;
|
|
14244
|
-
}
|
|
14245
|
-
};
|
|
14246
|
-
|
|
14247
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/byte-cursor.js
|
|
14248
|
-
var ByteCursor = class {
|
|
14249
|
-
/**
|
|
14250
|
-
* @throws {BareError} Buffer exceeds `config.maxBufferLength`
|
|
14251
|
-
*/
|
|
14252
|
-
constructor(bytes, config3) {
|
|
14253
|
-
this.offset = 0;
|
|
14254
|
-
if (bytes.length > config3.maxBufferLength) {
|
|
14255
|
-
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
14256
|
-
}
|
|
14257
|
-
this.bytes = bytes;
|
|
14258
|
-
this.config = config3;
|
|
14259
|
-
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
14260
|
-
}
|
|
14261
|
-
};
|
|
14262
|
-
function check2(bc, min) {
|
|
14263
|
-
if (DEV) {
|
|
14264
|
-
assert2(isU32(min));
|
|
14265
|
-
}
|
|
14266
|
-
if (bc.offset + min > bc.bytes.length) {
|
|
14267
|
-
throw new BareError(bc.offset, "missing bytes");
|
|
14268
|
-
}
|
|
14269
|
-
}
|
|
14270
|
-
function reserve(bc, min) {
|
|
14271
|
-
if (DEV) {
|
|
14272
|
-
assert2(isU32(min));
|
|
14273
|
-
}
|
|
14274
|
-
const minLen = bc.offset + min | 0;
|
|
14275
|
-
if (minLen > bc.bytes.length) {
|
|
14276
|
-
grow(bc, minLen);
|
|
14277
|
-
}
|
|
14278
|
-
}
|
|
14279
|
-
function grow(bc, minLen) {
|
|
14280
|
-
if (minLen > bc.config.maxBufferLength) {
|
|
14281
|
-
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
14282
|
-
}
|
|
14283
|
-
const buffer = bc.bytes.buffer;
|
|
14284
|
-
let newBytes;
|
|
14285
|
-
if (isEs2024ArrayBufferLike(buffer) && // Make sure that the view covers the end of the buffer.
|
|
14286
|
-
// If it is not the case, this indicates that the user don't want
|
|
14287
|
-
// to override the trailing bytes.
|
|
14288
|
-
bc.bytes.byteOffset + bc.bytes.byteLength === buffer.byteLength && bc.bytes.byteLength + minLen <= buffer.maxByteLength) {
|
|
14289
|
-
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength, buffer.maxByteLength);
|
|
14290
|
-
if (buffer instanceof ArrayBuffer) {
|
|
14291
|
-
buffer.resize(newLen);
|
|
14292
|
-
} else {
|
|
14293
|
-
buffer.grow(newLen);
|
|
14488
|
+
reviveJsonCompatValue(input[1], options)
|
|
14489
|
+
];
|
|
14490
|
+
}
|
|
14491
|
+
throw new Error(
|
|
14492
|
+
`Unknown JSON encoding type: ${input[0]}. This may indicate corrupted data or a version mismatch.`
|
|
14493
|
+
);
|
|
14294
14494
|
}
|
|
14295
|
-
|
|
14296
|
-
} else {
|
|
14297
|
-
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength);
|
|
14298
|
-
newBytes = new Uint8Array(newLen);
|
|
14299
|
-
newBytes.set(bc.bytes);
|
|
14495
|
+
return input.map((value) => reviveJsonCompatValue(value, options));
|
|
14300
14496
|
}
|
|
14301
|
-
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/fixed-primitive.js
|
|
14309
|
-
function readBool(bc) {
|
|
14310
|
-
const val = readU8(bc);
|
|
14311
|
-
if (val > 1) {
|
|
14312
|
-
bc.offset--;
|
|
14313
|
-
throw new BareError(bc.offset, "a bool must be equal to 0 or 1");
|
|
14497
|
+
if (isPlainObject2(input)) {
|
|
14498
|
+
const decoded = {};
|
|
14499
|
+
for (const [key, value] of Object.entries(input)) {
|
|
14500
|
+
decoded[key] = reviveJsonCompatValue(value, options);
|
|
14501
|
+
}
|
|
14502
|
+
return decoded;
|
|
14314
14503
|
}
|
|
14315
|
-
return
|
|
14316
|
-
}
|
|
14317
|
-
function writeBool(bc, x) {
|
|
14318
|
-
writeU8(bc, x ? 1 : 0);
|
|
14319
|
-
}
|
|
14320
|
-
function readU8(bc) {
|
|
14321
|
-
check2(bc, 1);
|
|
14322
|
-
return bc.bytes[bc.offset++];
|
|
14504
|
+
return input;
|
|
14323
14505
|
}
|
|
14324
|
-
function
|
|
14325
|
-
if (
|
|
14326
|
-
|
|
14506
|
+
function base64DecodeToUint8Array(base643) {
|
|
14507
|
+
if (typeof Buffer !== "undefined") {
|
|
14508
|
+
return new Uint8Array(Buffer.from(base643, "base64"));
|
|
14327
14509
|
}
|
|
14328
|
-
|
|
14329
|
-
|
|
14510
|
+
const binary = atob(base643);
|
|
14511
|
+
const bytes = new Uint8Array(binary.length);
|
|
14512
|
+
for (let i = 0; i < binary.length; i++) {
|
|
14513
|
+
bytes[i] = binary.charCodeAt(i);
|
|
14514
|
+
}
|
|
14515
|
+
return bytes;
|
|
14330
14516
|
}
|
|
14331
|
-
function
|
|
14332
|
-
|
|
14333
|
-
const result = bc.view.getUint32(bc.offset, true);
|
|
14334
|
-
bc.offset += 4;
|
|
14335
|
-
return result;
|
|
14517
|
+
function base64DecodeToArrayBuffer(base643) {
|
|
14518
|
+
return base64DecodeToUint8Array(base643).buffer;
|
|
14336
14519
|
}
|
|
14337
|
-
function
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
|
|
14520
|
+
function jsonStringifyCompat(input, space) {
|
|
14521
|
+
return JSON.stringify(
|
|
14522
|
+
input,
|
|
14523
|
+
(_key, value) => {
|
|
14524
|
+
if (typeof value === "bigint") {
|
|
14525
|
+
return [JSON_COMPAT_BIGINT, value.toString()];
|
|
14526
|
+
}
|
|
14527
|
+
if (value instanceof ArrayBuffer) {
|
|
14528
|
+
return [
|
|
14529
|
+
JSON_COMPAT_ARRAY_BUFFER,
|
|
14530
|
+
base64EncodeArrayBuffer(value)
|
|
14531
|
+
];
|
|
14532
|
+
}
|
|
14533
|
+
if (value instanceof Uint8Array) {
|
|
14534
|
+
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(value)];
|
|
14535
|
+
}
|
|
14536
|
+
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && value[0].startsWith("$")) {
|
|
14537
|
+
return [`$${value[0]}`, value[1]];
|
|
14538
|
+
}
|
|
14539
|
+
return value;
|
|
14540
|
+
},
|
|
14541
|
+
space
|
|
14542
|
+
);
|
|
14342
14543
|
}
|
|
14343
|
-
function
|
|
14344
|
-
|
|
14345
|
-
assert2(isU64(x), TOO_LARGE_NUMBER);
|
|
14346
|
-
}
|
|
14347
|
-
reserve(bc, 8);
|
|
14348
|
-
bc.view.setBigUint64(bc.offset, x, true);
|
|
14349
|
-
bc.offset += 8;
|
|
14544
|
+
function jsonParseCompat(input) {
|
|
14545
|
+
return reviveJsonCompatValue(JSON.parse(input));
|
|
14350
14546
|
}
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
function
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
low &= 127;
|
|
14357
|
-
let shiftMul = 128;
|
|
14358
|
-
let byteCount = 1;
|
|
14359
|
-
let byte;
|
|
14360
|
-
do {
|
|
14361
|
-
byte = readU8(bc);
|
|
14362
|
-
low += (byte & 127) * shiftMul;
|
|
14363
|
-
shiftMul *= /* 2**7 */
|
|
14364
|
-
128;
|
|
14365
|
-
byteCount++;
|
|
14366
|
-
} while (byte >= 128 && byteCount < 7);
|
|
14367
|
-
let height = 0;
|
|
14368
|
-
shiftMul = 1;
|
|
14369
|
-
while (byte >= 128 && byteCount < UINT_MAX_BYTE_COUNT) {
|
|
14370
|
-
byte = readU8(bc);
|
|
14371
|
-
height += (byte & 127) * shiftMul;
|
|
14372
|
-
shiftMul *= /* 2**7 */
|
|
14373
|
-
128;
|
|
14374
|
-
byteCount++;
|
|
14375
|
-
}
|
|
14376
|
-
if (byte === 0 || byteCount === UINT_MAX_BYTE_COUNT && byte > 1) {
|
|
14377
|
-
bc.offset -= byteCount;
|
|
14378
|
-
throw new BareError(bc.offset, NON_CANONICAL_REPRESENTATION);
|
|
14379
|
-
}
|
|
14380
|
-
return BigInt(low) + (BigInt(height) << BigInt(7 * 7));
|
|
14547
|
+
var VERSION = package_default.version;
|
|
14548
|
+
var _userAgent;
|
|
14549
|
+
function httpUserAgent() {
|
|
14550
|
+
if (_userAgent !== void 0) {
|
|
14551
|
+
return _userAgent;
|
|
14381
14552
|
}
|
|
14382
|
-
|
|
14553
|
+
let userAgent = `RivetKit/${VERSION}`;
|
|
14554
|
+
const navigatorObj = typeof navigator !== "undefined" ? navigator : void 0;
|
|
14555
|
+
if (navigatorObj == null ? void 0 : navigatorObj.userAgent) userAgent += ` ${navigatorObj.userAgent}`;
|
|
14556
|
+
_userAgent = userAgent;
|
|
14557
|
+
return userAgent;
|
|
14383
14558
|
}
|
|
14384
|
-
function
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14559
|
+
function getEnvUniversal(key) {
|
|
14560
|
+
if (typeof Deno !== "undefined") {
|
|
14561
|
+
return Deno.env.get(key);
|
|
14562
|
+
} else if (typeof process !== "undefined") {
|
|
14563
|
+
return process.env[key];
|
|
14388
14564
|
}
|
|
14389
|
-
writeUintTruncated(bc, truncated);
|
|
14390
14565
|
}
|
|
14391
|
-
function
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14566
|
+
function toUint8Array(data) {
|
|
14567
|
+
if (data instanceof Uint8Array) {
|
|
14568
|
+
return data;
|
|
14569
|
+
} else if (data instanceof ArrayBuffer) {
|
|
14570
|
+
return new Uint8Array(data);
|
|
14571
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
14572
|
+
return new Uint8Array(
|
|
14573
|
+
data.buffer.slice(
|
|
14574
|
+
data.byteOffset,
|
|
14575
|
+
data.byteOffset + data.byteLength
|
|
14576
|
+
)
|
|
14577
|
+
);
|
|
14578
|
+
} else {
|
|
14579
|
+
throw new TypeError("Input must be ArrayBuffer or ArrayBufferView");
|
|
14404
14580
|
}
|
|
14405
|
-
writeU8(bc, tmp);
|
|
14406
14581
|
}
|
|
14407
|
-
function
|
|
14408
|
-
let
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
result += (byte & 127) << shift >>> 0;
|
|
14417
|
-
shift += 7;
|
|
14418
|
-
byteCount++;
|
|
14419
|
-
} while (byte >= 128 && byteCount < UINT_SAFE32_MAX_BYTE_COUNT);
|
|
14420
|
-
if (byte === 0) {
|
|
14421
|
-
bc.offset -= byteCount - 1;
|
|
14422
|
-
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
14423
|
-
}
|
|
14424
|
-
if (byteCount === UINT_SAFE32_MAX_BYTE_COUNT && byte > 15) {
|
|
14425
|
-
bc.offset -= byteCount - 1;
|
|
14426
|
-
throw new BareError(bc.offset, TOO_LARGE_NUMBER);
|
|
14427
|
-
}
|
|
14428
|
-
}
|
|
14429
|
-
return result;
|
|
14582
|
+
function promiseWithResolvers(onReject) {
|
|
14583
|
+
let resolve;
|
|
14584
|
+
let reject;
|
|
14585
|
+
const promise2 = new Promise((res, rej) => {
|
|
14586
|
+
resolve = res;
|
|
14587
|
+
reject = rej;
|
|
14588
|
+
});
|
|
14589
|
+
promise2.catch(onReject);
|
|
14590
|
+
return { promise: promise2, resolve, reject };
|
|
14430
14591
|
}
|
|
14431
|
-
function
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
while (zigZag >= 128) {
|
|
14437
|
-
writeU8(bc, 128 | zigZag & 127);
|
|
14438
|
-
zigZag >>>= 7;
|
|
14439
|
-
}
|
|
14440
|
-
writeU8(bc, zigZag);
|
|
14592
|
+
function bufferToArrayBuffer(buf) {
|
|
14593
|
+
return buf.buffer.slice(
|
|
14594
|
+
buf.byteOffset,
|
|
14595
|
+
buf.byteOffset + buf.byteLength
|
|
14596
|
+
);
|
|
14441
14597
|
}
|
|
14442
|
-
function
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
14462
|
-
}
|
|
14463
|
-
if (byteCount === INT_SAFE_MAX_BYTE_COUNT && byte > 15) {
|
|
14464
|
-
bc.offset -= byteCount - 1;
|
|
14465
|
-
throw new BareError(bc.offset, TOO_LARGE_NUMBER);
|
|
14598
|
+
function combineUrlPath(endpoint, path2, queryParams) {
|
|
14599
|
+
const baseUrl = new URL(endpoint);
|
|
14600
|
+
const pathParts = path2.split("?");
|
|
14601
|
+
const pathOnly = pathParts[0];
|
|
14602
|
+
const existingQuery = pathParts[1] || "";
|
|
14603
|
+
const basePath = baseUrl.pathname.replace(/\/$/, "");
|
|
14604
|
+
const cleanPath = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
14605
|
+
const fullPath = (basePath + cleanPath).replace(/\/\//g, "/");
|
|
14606
|
+
const queryParts = [];
|
|
14607
|
+
if (existingQuery) {
|
|
14608
|
+
queryParts.push(existingQuery);
|
|
14609
|
+
}
|
|
14610
|
+
if (queryParams) {
|
|
14611
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
14612
|
+
if (value !== void 0) {
|
|
14613
|
+
queryParts.push(
|
|
14614
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
14615
|
+
);
|
|
14616
|
+
}
|
|
14466
14617
|
}
|
|
14467
14618
|
}
|
|
14468
|
-
|
|
14619
|
+
const fullQuery = queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
14620
|
+
return `${baseUrl.protocol}//${baseUrl.host}${fullPath}${fullQuery}`;
|
|
14469
14621
|
}
|
|
14470
14622
|
|
|
14471
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
}
|
|
14482
|
-
function writeU8FixedArray(bc, x) {
|
|
14483
|
-
const len = x.length;
|
|
14484
|
-
if (len > 0) {
|
|
14485
|
-
reserve(bc, len);
|
|
14486
|
-
bc.bytes.set(x, bc.offset);
|
|
14487
|
-
bc.offset += len;
|
|
14623
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/imports/dev.node.js
|
|
14624
|
+
var DEV = process.env.NODE_ENV === "development";
|
|
14625
|
+
|
|
14626
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/assert.js
|
|
14627
|
+
var V8Error = Error;
|
|
14628
|
+
function assert2(test, message = "") {
|
|
14629
|
+
if (!test) {
|
|
14630
|
+
const e = new AssertionError(message);
|
|
14631
|
+
V8Error.captureStackTrace?.(e, assert2);
|
|
14632
|
+
throw e;
|
|
14488
14633
|
}
|
|
14489
14634
|
}
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14635
|
+
var AssertionError = class extends Error {
|
|
14636
|
+
constructor() {
|
|
14637
|
+
super(...arguments);
|
|
14638
|
+
this.name = "AssertionError";
|
|
14493
14639
|
}
|
|
14494
|
-
|
|
14495
|
-
const offset = bc.offset;
|
|
14496
|
-
bc.offset += len;
|
|
14497
|
-
return bc.bytes.subarray(offset, offset + len);
|
|
14498
|
-
}
|
|
14640
|
+
};
|
|
14499
14641
|
|
|
14500
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/
|
|
14501
|
-
function
|
|
14502
|
-
return
|
|
14642
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/validator.js
|
|
14643
|
+
function isU8(val) {
|
|
14644
|
+
return val === (val & 255);
|
|
14503
14645
|
}
|
|
14504
|
-
function
|
|
14505
|
-
|
|
14646
|
+
function isU32(val) {
|
|
14647
|
+
return val === val >>> 0;
|
|
14506
14648
|
}
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
function readString(bc) {
|
|
14510
|
-
return readFixedString(bc, readUintSafe32(bc));
|
|
14649
|
+
function isU64(val) {
|
|
14650
|
+
return val === BigInt.asUintN(64, val);
|
|
14511
14651
|
}
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14652
|
+
|
|
14653
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/constants.js
|
|
14654
|
+
var TEXT_DECODER_THRESHOLD = 256;
|
|
14655
|
+
var TEXT_ENCODER_THRESHOLD = 256;
|
|
14656
|
+
var INT_SAFE_MAX_BYTE_COUNT = 8;
|
|
14657
|
+
var UINT_MAX_BYTE_COUNT = 10;
|
|
14658
|
+
var UINT_SAFE32_MAX_BYTE_COUNT = 5;
|
|
14659
|
+
var INVALID_UTF8_STRING = "invalid UTF-8 string";
|
|
14660
|
+
var NON_CANONICAL_REPRESENTATION = "must be canonical";
|
|
14661
|
+
var TOO_LARGE_BUFFER = "too large buffer";
|
|
14662
|
+
var TOO_LARGE_NUMBER = "too large number";
|
|
14663
|
+
|
|
14664
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/bare-error.js
|
|
14665
|
+
var BareError = class extends Error {
|
|
14666
|
+
constructor(offset, issue2, opts) {
|
|
14667
|
+
super(`(byte:${offset}) ${issue2}`);
|
|
14668
|
+
this.name = "BareError";
|
|
14669
|
+
this.issue = issue2;
|
|
14670
|
+
this.offset = offset;
|
|
14671
|
+
this.cause = opts?.cause;
|
|
14522
14672
|
}
|
|
14523
|
-
}
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14673
|
+
};
|
|
14674
|
+
|
|
14675
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/byte-cursor.js
|
|
14676
|
+
var ByteCursor = class {
|
|
14677
|
+
/**
|
|
14678
|
+
* @throws {BareError} Buffer exceeds `config.maxBufferLength`
|
|
14679
|
+
*/
|
|
14680
|
+
constructor(bytes, config3) {
|
|
14681
|
+
this.offset = 0;
|
|
14682
|
+
if (bytes.length > config3.maxBufferLength) {
|
|
14683
|
+
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
14684
|
+
}
|
|
14685
|
+
this.bytes = bytes;
|
|
14686
|
+
this.config = config3;
|
|
14687
|
+
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
14527
14688
|
}
|
|
14528
|
-
|
|
14529
|
-
|
|
14689
|
+
};
|
|
14690
|
+
function check2(bc, min) {
|
|
14691
|
+
if (DEV) {
|
|
14692
|
+
assert2(isU32(min));
|
|
14530
14693
|
}
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
} catch (_cause) {
|
|
14534
|
-
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14694
|
+
if (bc.offset + min > bc.bytes.length) {
|
|
14695
|
+
throw new BareError(bc.offset, "missing bytes");
|
|
14535
14696
|
}
|
|
14536
14697
|
}
|
|
14537
|
-
function
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
let codePoint = bytes[offset++];
|
|
14545
|
-
if (codePoint > 127) {
|
|
14546
|
-
let malformed = true;
|
|
14547
|
-
const byte1 = codePoint;
|
|
14548
|
-
if (offset < upperOffset && codePoint < 224) {
|
|
14549
|
-
const byte2 = bytes[offset++];
|
|
14550
|
-
codePoint = (byte1 & 31) << 6 | byte2 & 63;
|
|
14551
|
-
malformed = codePoint >> 7 === 0 || // non-canonical char
|
|
14552
|
-
byte1 >> 5 !== 6 || // invalid tag
|
|
14553
|
-
byte2 >> 6 !== 2;
|
|
14554
|
-
} else if (offset + 1 < upperOffset && codePoint < 240) {
|
|
14555
|
-
const byte2 = bytes[offset++];
|
|
14556
|
-
const byte3 = bytes[offset++];
|
|
14557
|
-
codePoint = (byte1 & 15) << 12 | (byte2 & 63) << 6 | byte3 & 63;
|
|
14558
|
-
malformed = codePoint >> 11 === 0 || // non-canonical char or missing data
|
|
14559
|
-
codePoint >> 11 === 27 || // surrogate char (0xD800 <= codePoint <= 0xDFFF)
|
|
14560
|
-
byte1 >> 4 !== 14 || // invalid tag
|
|
14561
|
-
byte2 >> 6 !== 2 || // invalid tag
|
|
14562
|
-
byte3 >> 6 !== 2;
|
|
14563
|
-
} else if (offset + 2 < upperOffset) {
|
|
14564
|
-
const byte2 = bytes[offset++];
|
|
14565
|
-
const byte3 = bytes[offset++];
|
|
14566
|
-
const byte4 = bytes[offset++];
|
|
14567
|
-
codePoint = (byte1 & 7) << 18 | (byte2 & 63) << 12 | (byte3 & 63) << 6 | byte4 & 63;
|
|
14568
|
-
malformed = codePoint >> 16 === 0 || // non-canonical char or missing data
|
|
14569
|
-
codePoint > 1114111 || // too large code point
|
|
14570
|
-
byte1 >> 3 !== 30 || // invalid tag
|
|
14571
|
-
byte2 >> 6 !== 2 || // invalid tag
|
|
14572
|
-
byte3 >> 6 !== 2 || // invalid tag
|
|
14573
|
-
byte4 >> 6 !== 2;
|
|
14574
|
-
}
|
|
14575
|
-
if (malformed) {
|
|
14576
|
-
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14577
|
-
}
|
|
14578
|
-
}
|
|
14579
|
-
result += String.fromCodePoint(codePoint);
|
|
14698
|
+
function reserve(bc, min) {
|
|
14699
|
+
if (DEV) {
|
|
14700
|
+
assert2(isU32(min));
|
|
14701
|
+
}
|
|
14702
|
+
const minLen = bc.offset + min | 0;
|
|
14703
|
+
if (minLen > bc.bytes.length) {
|
|
14704
|
+
grow(bc, minLen);
|
|
14580
14705
|
}
|
|
14581
|
-
bc.offset = offset;
|
|
14582
|
-
return result;
|
|
14583
14706
|
}
|
|
14584
|
-
function
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14707
|
+
function grow(bc, minLen) {
|
|
14708
|
+
if (minLen > bc.config.maxBufferLength) {
|
|
14709
|
+
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
14710
|
+
}
|
|
14711
|
+
const buffer = bc.bytes.buffer;
|
|
14712
|
+
let newBytes;
|
|
14713
|
+
if (isEs2024ArrayBufferLike(buffer) && // Make sure that the view covers the end of the buffer.
|
|
14714
|
+
// If it is not the case, this indicates that the user don't want
|
|
14715
|
+
// to override the trailing bytes.
|
|
14716
|
+
bc.bytes.byteOffset + bc.bytes.byteLength === buffer.byteLength && bc.bytes.byteLength + minLen <= buffer.maxByteLength) {
|
|
14717
|
+
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength, buffer.maxByteLength);
|
|
14718
|
+
if (buffer instanceof ArrayBuffer) {
|
|
14719
|
+
buffer.resize(newLen);
|
|
14592
14720
|
} else {
|
|
14593
|
-
|
|
14594
|
-
bytes[offset++] = 192 | codePoint >> 6;
|
|
14595
|
-
} else {
|
|
14596
|
-
if (codePoint < 65536) {
|
|
14597
|
-
bytes[offset++] = 224 | codePoint >> 12;
|
|
14598
|
-
} else {
|
|
14599
|
-
bytes[offset++] = 240 | codePoint >> 18;
|
|
14600
|
-
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
14601
|
-
i++;
|
|
14602
|
-
}
|
|
14603
|
-
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
14604
|
-
}
|
|
14605
|
-
bytes[offset++] = 128 | codePoint & 63;
|
|
14721
|
+
buffer.grow(newLen);
|
|
14606
14722
|
}
|
|
14723
|
+
newBytes = new Uint8Array(buffer, bc.bytes.byteOffset, newLen);
|
|
14724
|
+
} else {
|
|
14725
|
+
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength);
|
|
14726
|
+
newBytes = new Uint8Array(newLen);
|
|
14727
|
+
newBytes.set(bc.bytes);
|
|
14607
14728
|
}
|
|
14608
|
-
bc.
|
|
14729
|
+
bc.bytes = newBytes;
|
|
14730
|
+
bc.view = new DataView(newBytes.buffer);
|
|
14609
14731
|
}
|
|
14610
|
-
function
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
}
|
|
14621
|
-
}
|
|
14622
|
-
}
|
|
14732
|
+
function isEs2024ArrayBufferLike(buffer) {
|
|
14733
|
+
return "maxByteLength" in buffer;
|
|
14734
|
+
}
|
|
14735
|
+
|
|
14736
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/fixed-primitive.js
|
|
14737
|
+
function readBool(bc) {
|
|
14738
|
+
const val = readU8(bc);
|
|
14739
|
+
if (val > 1) {
|
|
14740
|
+
bc.offset--;
|
|
14741
|
+
throw new BareError(bc.offset, "a bool must be equal to 0 or 1");
|
|
14623
14742
|
}
|
|
14624
|
-
return
|
|
14743
|
+
return val > 0;
|
|
14744
|
+
}
|
|
14745
|
+
function writeBool(bc, x) {
|
|
14746
|
+
writeU8(bc, x ? 1 : 0);
|
|
14747
|
+
}
|
|
14748
|
+
function readU8(bc) {
|
|
14749
|
+
check2(bc, 1);
|
|
14750
|
+
return bc.bytes[bc.offset++];
|
|
14625
14751
|
}
|
|
14626
|
-
|
|
14627
|
-
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
14628
|
-
|
|
14629
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
14630
|
-
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
14752
|
+
function writeU8(bc, x) {
|
|
14631
14753
|
if (DEV) {
|
|
14632
|
-
assert2(
|
|
14633
|
-
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
14634
|
-
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
14754
|
+
assert2(isU8(x), TOO_LARGE_NUMBER);
|
|
14635
14755
|
}
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
maxBufferLength
|
|
14639
|
-
};
|
|
14756
|
+
reserve(bc, 1);
|
|
14757
|
+
bc.bytes[bc.offset++] = x;
|
|
14640
14758
|
}
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
return
|
|
14759
|
+
function readU32(bc) {
|
|
14760
|
+
check2(bc, 4);
|
|
14761
|
+
const result = bc.view.getUint32(bc.offset, true);
|
|
14762
|
+
bc.offset += 4;
|
|
14763
|
+
return result;
|
|
14646
14764
|
}
|
|
14647
|
-
function
|
|
14648
|
-
|
|
14765
|
+
function readU64(bc) {
|
|
14766
|
+
check2(bc, 8);
|
|
14767
|
+
const result = bc.view.getBigUint64(bc.offset, true);
|
|
14768
|
+
bc.offset += 8;
|
|
14769
|
+
return result;
|
|
14649
14770
|
}
|
|
14650
|
-
function
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14771
|
+
function writeU64(bc, x) {
|
|
14772
|
+
if (DEV) {
|
|
14773
|
+
assert2(isU64(x), TOO_LARGE_NUMBER);
|
|
14774
|
+
}
|
|
14775
|
+
reserve(bc, 8);
|
|
14776
|
+
bc.view.setBigUint64(bc.offset, x, true);
|
|
14777
|
+
bc.offset += 8;
|
|
14655
14778
|
}
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14779
|
+
|
|
14780
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/uint.js
|
|
14781
|
+
function readUint(bc) {
|
|
14782
|
+
let low = readU8(bc);
|
|
14783
|
+
if (low >= 128) {
|
|
14784
|
+
low &= 127;
|
|
14785
|
+
let shiftMul = 128;
|
|
14786
|
+
let byteCount = 1;
|
|
14787
|
+
let byte;
|
|
14788
|
+
do {
|
|
14789
|
+
byte = readU8(bc);
|
|
14790
|
+
low += (byte & 127) * shiftMul;
|
|
14791
|
+
shiftMul *= /* 2**7 */
|
|
14792
|
+
128;
|
|
14793
|
+
byteCount++;
|
|
14794
|
+
} while (byte >= 128 && byteCount < 7);
|
|
14795
|
+
let height = 0;
|
|
14796
|
+
shiftMul = 1;
|
|
14797
|
+
while (byte >= 128 && byteCount < UINT_MAX_BYTE_COUNT) {
|
|
14798
|
+
byte = readU8(bc);
|
|
14799
|
+
height += (byte & 127) * shiftMul;
|
|
14800
|
+
shiftMul *= /* 2**7 */
|
|
14801
|
+
128;
|
|
14802
|
+
byteCount++;
|
|
14803
|
+
}
|
|
14804
|
+
if (byte === 0 || byteCount === UINT_MAX_BYTE_COUNT && byte > 1) {
|
|
14805
|
+
bc.offset -= byteCount;
|
|
14806
|
+
throw new BareError(bc.offset, NON_CANONICAL_REPRESENTATION);
|
|
14670
14807
|
}
|
|
14808
|
+
return BigInt(low) + (BigInt(height) << BigInt(7 * 7));
|
|
14671
14809
|
}
|
|
14810
|
+
return BigInt(low);
|
|
14672
14811
|
}
|
|
14673
|
-
function
|
|
14674
|
-
const
|
|
14675
|
-
if (
|
|
14676
|
-
|
|
14677
|
-
}
|
|
14678
|
-
const result = [readWorkflowPathSegment(bc)];
|
|
14679
|
-
for (let i = 1; i < len; i++) {
|
|
14680
|
-
result[i] = readWorkflowPathSegment(bc);
|
|
14812
|
+
function writeUint(bc, x) {
|
|
14813
|
+
const truncated = BigInt.asUintN(64, x);
|
|
14814
|
+
if (DEV) {
|
|
14815
|
+
assert2(truncated === x, TOO_LARGE_NUMBER);
|
|
14681
14816
|
}
|
|
14682
|
-
|
|
14817
|
+
writeUintTruncated(bc, truncated);
|
|
14683
14818
|
}
|
|
14684
|
-
function
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
case 4:
|
|
14697
|
-
return "EXHAUSTED";
|
|
14698
|
-
default: {
|
|
14699
|
-
bc.offset = offset;
|
|
14700
|
-
throw new BareError(offset, "invalid tag");
|
|
14819
|
+
function writeUintTruncated(bc, x) {
|
|
14820
|
+
let tmp = Number(BigInt.asUintN(7 * 7, x));
|
|
14821
|
+
let rest = Number(x >> BigInt(7 * 7));
|
|
14822
|
+
let byteCount = 0;
|
|
14823
|
+
while (tmp >= 128 || rest > 0) {
|
|
14824
|
+
writeU8(bc, 128 | tmp & 127);
|
|
14825
|
+
tmp = Math.floor(tmp / /* 2**7 */
|
|
14826
|
+
128);
|
|
14827
|
+
byteCount++;
|
|
14828
|
+
if (byteCount === 7) {
|
|
14829
|
+
tmp = rest;
|
|
14830
|
+
rest = 0;
|
|
14701
14831
|
}
|
|
14702
14832
|
}
|
|
14833
|
+
writeU8(bc, tmp);
|
|
14703
14834
|
}
|
|
14704
|
-
function
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14835
|
+
function readUintSafe32(bc) {
|
|
14836
|
+
let result = readU8(bc);
|
|
14837
|
+
if (result >= 128) {
|
|
14838
|
+
result &= 127;
|
|
14839
|
+
let shift = 7;
|
|
14840
|
+
let byteCount = 1;
|
|
14841
|
+
let byte;
|
|
14842
|
+
do {
|
|
14843
|
+
byte = readU8(bc);
|
|
14844
|
+
result += (byte & 127) << shift >>> 0;
|
|
14845
|
+
shift += 7;
|
|
14846
|
+
byteCount++;
|
|
14847
|
+
} while (byte >= 128 && byteCount < UINT_SAFE32_MAX_BYTE_COUNT);
|
|
14848
|
+
if (byte === 0) {
|
|
14849
|
+
bc.offset -= byteCount - 1;
|
|
14850
|
+
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
14717
14851
|
}
|
|
14718
|
-
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
const offset = bc.offset;
|
|
14722
|
-
const tag = readU8(bc);
|
|
14723
|
-
switch (tag) {
|
|
14724
|
-
case 0:
|
|
14725
|
-
return "PENDING";
|
|
14726
|
-
case 1:
|
|
14727
|
-
return "RUNNING";
|
|
14728
|
-
case 2:
|
|
14729
|
-
return "COMPLETED";
|
|
14730
|
-
case 3:
|
|
14731
|
-
return "FAILED";
|
|
14732
|
-
case 4:
|
|
14733
|
-
return "CANCELLED";
|
|
14734
|
-
default: {
|
|
14735
|
-
bc.offset = offset;
|
|
14736
|
-
throw new BareError(offset, "invalid tag");
|
|
14852
|
+
if (byteCount === UINT_SAFE32_MAX_BYTE_COUNT && byte > 15) {
|
|
14853
|
+
bc.offset -= byteCount - 1;
|
|
14854
|
+
throw new BareError(bc.offset, TOO_LARGE_NUMBER);
|
|
14737
14855
|
}
|
|
14738
14856
|
}
|
|
14857
|
+
return result;
|
|
14739
14858
|
}
|
|
14740
|
-
function
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
};
|
|
14751
|
-
}
|
|
14752
|
-
function readWorkflowLoopEntry(bc) {
|
|
14753
|
-
return {
|
|
14754
|
-
state: readWorkflowCbor(bc),
|
|
14755
|
-
iteration: readU32(bc),
|
|
14756
|
-
output: read0(bc)
|
|
14757
|
-
};
|
|
14758
|
-
}
|
|
14759
|
-
function readWorkflowSleepEntry(bc) {
|
|
14760
|
-
return {
|
|
14761
|
-
deadline: readU64(bc),
|
|
14762
|
-
state: readWorkflowSleepState(bc)
|
|
14763
|
-
};
|
|
14764
|
-
}
|
|
14765
|
-
function readWorkflowMessageEntry(bc) {
|
|
14766
|
-
return {
|
|
14767
|
-
name: readString(bc),
|
|
14768
|
-
messageData: readWorkflowCbor(bc)
|
|
14769
|
-
};
|
|
14770
|
-
}
|
|
14771
|
-
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
14772
|
-
return {
|
|
14773
|
-
name: readString(bc)
|
|
14774
|
-
};
|
|
14775
|
-
}
|
|
14776
|
-
function readWorkflowBranchStatus(bc) {
|
|
14777
|
-
return {
|
|
14778
|
-
status: readWorkflowBranchStatusType(bc),
|
|
14779
|
-
output: read0(bc),
|
|
14780
|
-
error: read1(bc)
|
|
14781
|
-
};
|
|
14859
|
+
function writeUintSafe32(bc, x) {
|
|
14860
|
+
if (DEV) {
|
|
14861
|
+
assert2(isU32(x), TOO_LARGE_NUMBER);
|
|
14862
|
+
}
|
|
14863
|
+
let zigZag = x >>> 0;
|
|
14864
|
+
while (zigZag >= 128) {
|
|
14865
|
+
writeU8(bc, 128 | zigZag & 127);
|
|
14866
|
+
zigZag >>>= 7;
|
|
14867
|
+
}
|
|
14868
|
+
writeU8(bc, zigZag);
|
|
14782
14869
|
}
|
|
14783
|
-
function
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14870
|
+
function readUintSafe(bc) {
|
|
14871
|
+
let result = readU8(bc);
|
|
14872
|
+
if (result >= 128) {
|
|
14873
|
+
result &= 127;
|
|
14874
|
+
let shiftMul = (
|
|
14875
|
+
/* 2**7 */
|
|
14876
|
+
128
|
|
14877
|
+
);
|
|
14878
|
+
let byteCount = 1;
|
|
14879
|
+
let byte;
|
|
14880
|
+
do {
|
|
14881
|
+
byte = readU8(bc);
|
|
14882
|
+
result += (byte & 127) * shiftMul;
|
|
14883
|
+
shiftMul *= /* 2**7 */
|
|
14884
|
+
128;
|
|
14885
|
+
byteCount++;
|
|
14886
|
+
} while (byte >= 128 && byteCount < INT_SAFE_MAX_BYTE_COUNT);
|
|
14887
|
+
if (byte === 0) {
|
|
14888
|
+
bc.offset -= byteCount - 1;
|
|
14889
|
+
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
14890
|
+
}
|
|
14891
|
+
if (byteCount === INT_SAFE_MAX_BYTE_COUNT && byte > 15) {
|
|
14892
|
+
bc.offset -= byteCount - 1;
|
|
14893
|
+
throw new BareError(bc.offset, TOO_LARGE_NUMBER);
|
|
14792
14894
|
}
|
|
14793
|
-
result.set(key, readWorkflowBranchStatus(bc));
|
|
14794
14895
|
}
|
|
14795
14896
|
return result;
|
|
14796
14897
|
}
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14898
|
+
|
|
14899
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/u8-array.js
|
|
14900
|
+
function readU8Array(bc) {
|
|
14901
|
+
return readU8FixedArray(bc, readUintSafe32(bc));
|
|
14801
14902
|
}
|
|
14802
|
-
function
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
branches: read2(bc)
|
|
14806
|
-
};
|
|
14903
|
+
function writeU8Array(bc, x) {
|
|
14904
|
+
writeUintSafe32(bc, x.length);
|
|
14905
|
+
writeU8FixedArray(bc, x);
|
|
14807
14906
|
}
|
|
14808
|
-
function
|
|
14809
|
-
return
|
|
14810
|
-
originalType: readString(bc),
|
|
14811
|
-
originalName: read1(bc)
|
|
14812
|
-
};
|
|
14907
|
+
function readU8FixedArray(bc, len) {
|
|
14908
|
+
return readUnsafeU8FixedArray(bc, len).slice();
|
|
14813
14909
|
}
|
|
14814
|
-
function
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14910
|
+
function writeU8FixedArray(bc, x) {
|
|
14911
|
+
const len = x.length;
|
|
14912
|
+
if (len > 0) {
|
|
14913
|
+
reserve(bc, len);
|
|
14914
|
+
bc.bytes.set(x, bc.offset);
|
|
14915
|
+
bc.offset += len;
|
|
14916
|
+
}
|
|
14819
14917
|
}
|
|
14820
|
-
function
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
switch (tag) {
|
|
14824
|
-
case 0:
|
|
14825
|
-
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
14826
|
-
case 1:
|
|
14827
|
-
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
14828
|
-
case 2:
|
|
14829
|
-
return {
|
|
14830
|
-
tag: "WorkflowSleepEntry",
|
|
14831
|
-
val: readWorkflowSleepEntry(bc)
|
|
14832
|
-
};
|
|
14833
|
-
case 3:
|
|
14834
|
-
return {
|
|
14835
|
-
tag: "WorkflowMessageEntry",
|
|
14836
|
-
val: readWorkflowMessageEntry(bc)
|
|
14837
|
-
};
|
|
14838
|
-
case 4:
|
|
14839
|
-
return {
|
|
14840
|
-
tag: "WorkflowRollbackCheckpointEntry",
|
|
14841
|
-
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
14842
|
-
};
|
|
14843
|
-
case 5:
|
|
14844
|
-
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
14845
|
-
case 6:
|
|
14846
|
-
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
14847
|
-
case 7:
|
|
14848
|
-
return {
|
|
14849
|
-
tag: "WorkflowRemovedEntry",
|
|
14850
|
-
val: readWorkflowRemovedEntry(bc)
|
|
14851
|
-
};
|
|
14852
|
-
case 8:
|
|
14853
|
-
return {
|
|
14854
|
-
tag: "WorkflowVersionCheckEntry",
|
|
14855
|
-
val: readWorkflowVersionCheckEntry(bc)
|
|
14856
|
-
};
|
|
14857
|
-
default: {
|
|
14858
|
-
bc.offset = offset;
|
|
14859
|
-
throw new BareError(offset, "invalid tag");
|
|
14860
|
-
}
|
|
14918
|
+
function readUnsafeU8FixedArray(bc, len) {
|
|
14919
|
+
if (DEV) {
|
|
14920
|
+
assert2(isU32(len));
|
|
14861
14921
|
}
|
|
14922
|
+
check2(bc, len);
|
|
14923
|
+
const offset = bc.offset;
|
|
14924
|
+
bc.offset += len;
|
|
14925
|
+
return bc.bytes.subarray(offset, offset + len);
|
|
14862
14926
|
}
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
kind: readWorkflowEntryKind(bc)
|
|
14868
|
-
};
|
|
14927
|
+
|
|
14928
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/data.js
|
|
14929
|
+
function readData(bc) {
|
|
14930
|
+
return readU8Array(bc).buffer;
|
|
14869
14931
|
}
|
|
14870
|
-
function
|
|
14871
|
-
|
|
14932
|
+
function writeData(bc, x) {
|
|
14933
|
+
writeU8Array(bc, new Uint8Array(x));
|
|
14872
14934
|
}
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
attempts: readU32(bc),
|
|
14878
|
-
lastAttemptAt: readU64(bc),
|
|
14879
|
-
createdAt: readU64(bc),
|
|
14880
|
-
completedAt: read3(bc),
|
|
14881
|
-
rollbackCompletedAt: read3(bc),
|
|
14882
|
-
rollbackError: read1(bc)
|
|
14883
|
-
};
|
|
14935
|
+
|
|
14936
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/string.js
|
|
14937
|
+
function readString(bc) {
|
|
14938
|
+
return readFixedString(bc, readUintSafe32(bc));
|
|
14884
14939
|
}
|
|
14885
|
-
function
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
|
|
14892
|
-
|
|
14940
|
+
function writeString(bc, x) {
|
|
14941
|
+
if (x.length < TEXT_ENCODER_THRESHOLD) {
|
|
14942
|
+
const byteLen = utf8ByteLength(x);
|
|
14943
|
+
writeUintSafe32(bc, byteLen);
|
|
14944
|
+
reserve(bc, byteLen);
|
|
14945
|
+
writeUtf8Js(bc, x);
|
|
14946
|
+
} else {
|
|
14947
|
+
const strBytes = UTF8_ENCODER.encode(x);
|
|
14948
|
+
writeUintSafe32(bc, strBytes.length);
|
|
14949
|
+
writeU8FixedArray(bc, strBytes);
|
|
14893
14950
|
}
|
|
14894
|
-
return result;
|
|
14895
14951
|
}
|
|
14896
|
-
function
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
return [];
|
|
14952
|
+
function readFixedString(bc, byteLen) {
|
|
14953
|
+
if (DEV) {
|
|
14954
|
+
assert2(isU32(byteLen));
|
|
14900
14955
|
}
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14956
|
+
if (byteLen < TEXT_DECODER_THRESHOLD) {
|
|
14957
|
+
return readUtf8Js(bc, byteLen);
|
|
14958
|
+
}
|
|
14959
|
+
try {
|
|
14960
|
+
return UTF8_DECODER.decode(readUnsafeU8FixedArray(bc, byteLen));
|
|
14961
|
+
} catch (_cause) {
|
|
14962
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14963
|
+
}
|
|
14964
|
+
}
|
|
14965
|
+
function readUtf8Js(bc, byteLen) {
|
|
14966
|
+
check2(bc, byteLen);
|
|
14967
|
+
let result = "";
|
|
14968
|
+
const bytes = bc.bytes;
|
|
14969
|
+
let offset = bc.offset;
|
|
14970
|
+
const upperOffset = offset + byteLen;
|
|
14971
|
+
while (offset < upperOffset) {
|
|
14972
|
+
let codePoint = bytes[offset++];
|
|
14973
|
+
if (codePoint > 127) {
|
|
14974
|
+
let malformed = true;
|
|
14975
|
+
const byte1 = codePoint;
|
|
14976
|
+
if (offset < upperOffset && codePoint < 224) {
|
|
14977
|
+
const byte2 = bytes[offset++];
|
|
14978
|
+
codePoint = (byte1 & 31) << 6 | byte2 & 63;
|
|
14979
|
+
malformed = codePoint >> 7 === 0 || // non-canonical char
|
|
14980
|
+
byte1 >> 5 !== 6 || // invalid tag
|
|
14981
|
+
byte2 >> 6 !== 2;
|
|
14982
|
+
} else if (offset + 1 < upperOffset && codePoint < 240) {
|
|
14983
|
+
const byte2 = bytes[offset++];
|
|
14984
|
+
const byte3 = bytes[offset++];
|
|
14985
|
+
codePoint = (byte1 & 15) << 12 | (byte2 & 63) << 6 | byte3 & 63;
|
|
14986
|
+
malformed = codePoint >> 11 === 0 || // non-canonical char or missing data
|
|
14987
|
+
codePoint >> 11 === 27 || // surrogate char (0xD800 <= codePoint <= 0xDFFF)
|
|
14988
|
+
byte1 >> 4 !== 14 || // invalid tag
|
|
14989
|
+
byte2 >> 6 !== 2 || // invalid tag
|
|
14990
|
+
byte3 >> 6 !== 2;
|
|
14991
|
+
} else if (offset + 2 < upperOffset) {
|
|
14992
|
+
const byte2 = bytes[offset++];
|
|
14993
|
+
const byte3 = bytes[offset++];
|
|
14994
|
+
const byte4 = bytes[offset++];
|
|
14995
|
+
codePoint = (byte1 & 7) << 18 | (byte2 & 63) << 12 | (byte3 & 63) << 6 | byte4 & 63;
|
|
14996
|
+
malformed = codePoint >> 16 === 0 || // non-canonical char or missing data
|
|
14997
|
+
codePoint > 1114111 || // too large code point
|
|
14998
|
+
byte1 >> 3 !== 30 || // invalid tag
|
|
14999
|
+
byte2 >> 6 !== 2 || // invalid tag
|
|
15000
|
+
byte3 >> 6 !== 2 || // invalid tag
|
|
15001
|
+
byte4 >> 6 !== 2;
|
|
15002
|
+
}
|
|
15003
|
+
if (malformed) {
|
|
15004
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
15005
|
+
}
|
|
15006
|
+
}
|
|
15007
|
+
result += String.fromCodePoint(codePoint);
|
|
14904
15008
|
}
|
|
15009
|
+
bc.offset = offset;
|
|
14905
15010
|
return result;
|
|
14906
15011
|
}
|
|
14907
|
-
function
|
|
14908
|
-
const
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
const
|
|
14913
|
-
if (
|
|
14914
|
-
|
|
14915
|
-
|
|
15012
|
+
function writeUtf8Js(bc, s) {
|
|
15013
|
+
const bytes = bc.bytes;
|
|
15014
|
+
let offset = bc.offset;
|
|
15015
|
+
let i = 0;
|
|
15016
|
+
while (i < s.length) {
|
|
15017
|
+
const codePoint = s.codePointAt(i++);
|
|
15018
|
+
if (codePoint < 128) {
|
|
15019
|
+
bytes[offset++] = codePoint;
|
|
15020
|
+
} else {
|
|
15021
|
+
if (codePoint < 2048) {
|
|
15022
|
+
bytes[offset++] = 192 | codePoint >> 6;
|
|
15023
|
+
} else {
|
|
15024
|
+
if (codePoint < 65536) {
|
|
15025
|
+
bytes[offset++] = 224 | codePoint >> 12;
|
|
15026
|
+
} else {
|
|
15027
|
+
bytes[offset++] = 240 | codePoint >> 18;
|
|
15028
|
+
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
15029
|
+
i++;
|
|
15030
|
+
}
|
|
15031
|
+
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
15032
|
+
}
|
|
15033
|
+
bytes[offset++] = 128 | codePoint & 63;
|
|
15034
|
+
}
|
|
15035
|
+
}
|
|
15036
|
+
bc.offset = offset;
|
|
15037
|
+
}
|
|
15038
|
+
function utf8ByteLength(s) {
|
|
15039
|
+
let result = s.length;
|
|
15040
|
+
for (let i = 0; i < s.length; i++) {
|
|
15041
|
+
const codePoint = s.codePointAt(i);
|
|
15042
|
+
if (codePoint > 127) {
|
|
15043
|
+
result++;
|
|
15044
|
+
if (codePoint > 2047) {
|
|
15045
|
+
result++;
|
|
15046
|
+
if (codePoint > 65535) {
|
|
15047
|
+
i++;
|
|
15048
|
+
}
|
|
15049
|
+
}
|
|
14916
15050
|
}
|
|
14917
|
-
result.set(key, readWorkflowEntryMetadata(bc));
|
|
14918
15051
|
}
|
|
14919
15052
|
return result;
|
|
14920
15053
|
}
|
|
14921
|
-
|
|
15054
|
+
var UTF8_DECODER = /* @__PURE__ */ new TextDecoder("utf-8", { fatal: true });
|
|
15055
|
+
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
15056
|
+
|
|
15057
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
15058
|
+
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
15059
|
+
if (DEV) {
|
|
15060
|
+
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
15061
|
+
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
15062
|
+
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
15063
|
+
}
|
|
14922
15064
|
return {
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
entryMetadata: read6(bc)
|
|
15065
|
+
initialBufferLength,
|
|
15066
|
+
maxBufferLength
|
|
14926
15067
|
};
|
|
14927
15068
|
}
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
}
|
|
14934
|
-
return result;
|
|
15069
|
+
|
|
15070
|
+
// ../rivetkit/dist/tsup/chunk-RZFEJKIS.js
|
|
15071
|
+
var config2 = /* @__PURE__ */ Config({});
|
|
15072
|
+
function readWorkflowCbor(bc) {
|
|
15073
|
+
return readData(bc);
|
|
14935
15074
|
}
|
|
14936
|
-
function
|
|
14937
|
-
return
|
|
15075
|
+
function readWorkflowNameIndex(bc) {
|
|
15076
|
+
return readU32(bc);
|
|
14938
15077
|
}
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
flattened[name] = handler;
|
|
14945
|
-
}
|
|
14946
|
-
return flattened;
|
|
15078
|
+
function readWorkflowLoopIterationMarker(bc) {
|
|
15079
|
+
return {
|
|
15080
|
+
loop: readWorkflowNameIndex(bc),
|
|
15081
|
+
iteration: readU32(bc)
|
|
15082
|
+
};
|
|
14947
15083
|
}
|
|
14948
|
-
function
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
|
|
14961
|
-
|
|
14962
|
-
const schema = nestedSchema ?? flatSchema;
|
|
14963
|
-
if (schema !== void 0) {
|
|
14964
|
-
flattened[name] = schema;
|
|
15084
|
+
function readWorkflowPathSegment(bc) {
|
|
15085
|
+
const offset = bc.offset;
|
|
15086
|
+
const tag = readU8(bc);
|
|
15087
|
+
switch (tag) {
|
|
15088
|
+
case 0:
|
|
15089
|
+
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
15090
|
+
case 1:
|
|
15091
|
+
return {
|
|
15092
|
+
tag: "WorkflowLoopIterationMarker",
|
|
15093
|
+
val: readWorkflowLoopIterationMarker(bc)
|
|
15094
|
+
};
|
|
15095
|
+
default: {
|
|
15096
|
+
bc.offset = offset;
|
|
15097
|
+
throw new BareError(offset, "invalid tag");
|
|
14965
15098
|
}
|
|
14966
15099
|
}
|
|
14967
|
-
return flattened;
|
|
14968
|
-
}
|
|
14969
|
-
function collectActionEntries(actions) {
|
|
14970
|
-
const entries = [];
|
|
14971
|
-
const names = /* @__PURE__ */ new Set();
|
|
14972
|
-
visitActionGroup(actions ?? {}, [], entries, names);
|
|
14973
|
-
return entries;
|
|
14974
15100
|
}
|
|
14975
|
-
function
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
);
|
|
15101
|
+
function readWorkflowLocation(bc) {
|
|
15102
|
+
const len = readUintSafe(bc);
|
|
15103
|
+
if (len === 0) {
|
|
15104
|
+
return [];
|
|
14980
15105
|
}
|
|
14981
|
-
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
const name = childPath.join(".");
|
|
14985
|
-
if (names.has(name)) {
|
|
14986
|
-
throw new TypeError(
|
|
14987
|
-
`Multiple action definitions flatten to \`${name}\``
|
|
14988
|
-
);
|
|
14989
|
-
}
|
|
14990
|
-
names.add(name);
|
|
14991
|
-
entries.push({
|
|
14992
|
-
name,
|
|
14993
|
-
path: childPath,
|
|
14994
|
-
handler: child
|
|
14995
|
-
});
|
|
14996
|
-
} else {
|
|
14997
|
-
visitActionGroup(child, childPath, entries, names);
|
|
14998
|
-
}
|
|
15106
|
+
const result = [readWorkflowPathSegment(bc)];
|
|
15107
|
+
for (let i = 1; i < len; i++) {
|
|
15108
|
+
result[i] = readWorkflowPathSegment(bc);
|
|
14999
15109
|
}
|
|
15110
|
+
return result;
|
|
15000
15111
|
}
|
|
15001
|
-
function
|
|
15002
|
-
|
|
15003
|
-
|
|
15004
|
-
|
|
15005
|
-
|
|
15112
|
+
function readWorkflowEntryStatus(bc) {
|
|
15113
|
+
const offset = bc.offset;
|
|
15114
|
+
const tag = readU8(bc);
|
|
15115
|
+
switch (tag) {
|
|
15116
|
+
case 0:
|
|
15117
|
+
return "PENDING";
|
|
15118
|
+
case 1:
|
|
15119
|
+
return "RUNNING";
|
|
15120
|
+
case 2:
|
|
15121
|
+
return "COMPLETED";
|
|
15122
|
+
case 3:
|
|
15123
|
+
return "FAILED";
|
|
15124
|
+
case 4:
|
|
15125
|
+
return "EXHAUSTED";
|
|
15126
|
+
default: {
|
|
15127
|
+
bc.offset = offset;
|
|
15128
|
+
throw new BareError(offset, "invalid tag");
|
|
15006
15129
|
}
|
|
15007
|
-
value = value[segment];
|
|
15008
|
-
}
|
|
15009
|
-
return value;
|
|
15010
|
-
}
|
|
15011
|
-
function isRecord(value) {
|
|
15012
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
15013
|
-
return false;
|
|
15014
15130
|
}
|
|
15015
|
-
const prototype = Object.getPrototypeOf(value);
|
|
15016
|
-
return prototype === Object.prototype || prototype === null;
|
|
15017
|
-
}
|
|
15018
|
-
function formatActionPath(path2) {
|
|
15019
|
-
return path2.length === 0 ? "actions" : `Action \`${path2.join(".")}\``;
|
|
15020
15131
|
}
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
)
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
}
|
|
15035
|
-
|
|
15036
|
-
flattenActionHandlers(actions);
|
|
15037
|
-
} catch (error46) {
|
|
15038
|
-
ctx.addIssue({
|
|
15039
|
-
code: "custom",
|
|
15040
|
-
message: error46 instanceof Error ? error46.message : "Invalid action definition"
|
|
15041
|
-
});
|
|
15042
|
-
}
|
|
15043
|
-
});
|
|
15044
|
-
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
15045
|
-
getHistory: zFunction(),
|
|
15046
|
-
onHistoryUpdated: zFunction().optional(),
|
|
15047
|
-
replayFromStep: zFunction().optional()
|
|
15048
|
-
});
|
|
15049
|
-
var RunInspectorConfigSchema = external_exports.object({
|
|
15050
|
-
workflow: WorkflowInspectorConfigSchema.optional()
|
|
15051
|
-
}).optional();
|
|
15052
|
-
var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
15053
|
-
"workflow",
|
|
15054
|
-
"database",
|
|
15055
|
-
"state",
|
|
15056
|
-
"queue",
|
|
15057
|
-
"schedules",
|
|
15058
|
-
"connections",
|
|
15059
|
-
"console"
|
|
15060
|
-
];
|
|
15061
|
-
var BuiltinInspectorTabIdSchema = external_exports.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
15062
|
-
var CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
15063
|
-
var CustomInspectorTabEntrySchema = external_exports.object({
|
|
15064
|
-
id: external_exports.string().regex(
|
|
15065
|
-
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
15066
|
-
"inspector.tabs[].id must contain only letters, digits, underscore, or dash"
|
|
15067
|
-
),
|
|
15068
|
-
label: external_exports.string().min(1),
|
|
15069
|
-
source: external_exports.string().min(1),
|
|
15070
|
-
/**
|
|
15071
|
-
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
15072
|
-
* icon registry); unknown ids fall back to a generic icon.
|
|
15073
|
-
*/
|
|
15074
|
-
icon: external_exports.string().min(1).optional(),
|
|
15075
|
-
hidden: external_exports.literal(false).optional()
|
|
15076
|
-
}).strict();
|
|
15077
|
-
var HideInspectorTabEntrySchema = external_exports.object({
|
|
15078
|
-
id: BuiltinInspectorTabIdSchema,
|
|
15079
|
-
hidden: external_exports.literal(true)
|
|
15080
|
-
}).strict();
|
|
15081
|
-
var InspectorTabEntrySchema = external_exports.union([
|
|
15082
|
-
CustomInspectorTabEntrySchema,
|
|
15083
|
-
HideInspectorTabEntrySchema
|
|
15084
|
-
]);
|
|
15085
|
-
var ActorInspectorConfigSchema = external_exports.object({
|
|
15086
|
-
tabs: external_exports.array(InspectorTabEntrySchema).default(() => [])
|
|
15087
|
-
}).strict().refine(
|
|
15088
|
-
(data) => {
|
|
15089
|
-
const ids = data.tabs.map((t) => t.id);
|
|
15090
|
-
return new Set(ids).size === ids.length;
|
|
15091
|
-
},
|
|
15092
|
-
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] }
|
|
15093
|
-
).refine(
|
|
15094
|
-
(data) => {
|
|
15095
|
-
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
15096
|
-
return data.tabs.every(
|
|
15097
|
-
(t) => t.hidden === true || !builtinSet.has(t.id)
|
|
15098
|
-
);
|
|
15099
|
-
},
|
|
15100
|
-
{
|
|
15101
|
-
message: "Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
15102
|
-
path: ["tabs"]
|
|
15103
|
-
}
|
|
15104
|
-
);
|
|
15105
|
-
var RunConfigSchema = external_exports.object({
|
|
15106
|
-
/** Display name for the actor in the Inspector UI. */
|
|
15107
|
-
name: external_exports.string().optional(),
|
|
15108
|
-
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
15109
|
-
icon: external_exports.string().optional(),
|
|
15110
|
-
/** The run handler function. */
|
|
15111
|
-
run: zFunction(),
|
|
15112
|
-
/** Inspector integration for long-running run handlers. */
|
|
15113
|
-
inspector: RunInspectorConfigSchema.optional()
|
|
15114
|
-
});
|
|
15115
|
-
var RUN_FUNCTION_CONFIG_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
15116
|
-
"rivetkit.run_function_config"
|
|
15117
|
-
);
|
|
15118
|
-
var zRunHandler = external_exports.union([zFunction(), RunConfigSchema]).optional();
|
|
15119
|
-
function getRunFunction(run) {
|
|
15120
|
-
if (!run) return void 0;
|
|
15121
|
-
if (typeof run === "function") return run;
|
|
15122
|
-
return run.run;
|
|
15132
|
+
function readWorkflowSleepState(bc) {
|
|
15133
|
+
const offset = bc.offset;
|
|
15134
|
+
const tag = readU8(bc);
|
|
15135
|
+
switch (tag) {
|
|
15136
|
+
case 0:
|
|
15137
|
+
return "PENDING";
|
|
15138
|
+
case 1:
|
|
15139
|
+
return "COMPLETED";
|
|
15140
|
+
case 2:
|
|
15141
|
+
return "INTERRUPTED";
|
|
15142
|
+
default: {
|
|
15143
|
+
bc.offset = offset;
|
|
15144
|
+
throw new BareError(offset, "invalid tag");
|
|
15145
|
+
}
|
|
15146
|
+
}
|
|
15123
15147
|
}
|
|
15124
|
-
function
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15148
|
+
function readWorkflowBranchStatusType(bc) {
|
|
15149
|
+
const offset = bc.offset;
|
|
15150
|
+
const tag = readU8(bc);
|
|
15151
|
+
switch (tag) {
|
|
15152
|
+
case 0:
|
|
15153
|
+
return "PENDING";
|
|
15154
|
+
case 1:
|
|
15155
|
+
return "RUNNING";
|
|
15156
|
+
case 2:
|
|
15157
|
+
return "COMPLETED";
|
|
15158
|
+
case 3:
|
|
15159
|
+
return "FAILED";
|
|
15160
|
+
case 4:
|
|
15161
|
+
return "CANCELLED";
|
|
15162
|
+
default: {
|
|
15163
|
+
bc.offset = offset;
|
|
15164
|
+
throw new BareError(offset, "invalid tag");
|
|
15165
|
+
}
|
|
15130
15166
|
}
|
|
15131
|
-
return { name: run.name, icon: run.icon };
|
|
15132
15167
|
}
|
|
15133
|
-
function
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15168
|
+
function read0(bc) {
|
|
15169
|
+
return readBool(bc) ? readWorkflowCbor(bc) : null;
|
|
15170
|
+
}
|
|
15171
|
+
function read1(bc) {
|
|
15172
|
+
return readBool(bc) ? readString(bc) : null;
|
|
15173
|
+
}
|
|
15174
|
+
function readWorkflowStepEntry(bc) {
|
|
15175
|
+
return {
|
|
15176
|
+
output: read0(bc),
|
|
15177
|
+
error: read1(bc)
|
|
15178
|
+
};
|
|
15179
|
+
}
|
|
15180
|
+
function readWorkflowLoopEntry(bc) {
|
|
15181
|
+
return {
|
|
15182
|
+
state: readWorkflowCbor(bc),
|
|
15183
|
+
iteration: readU32(bc),
|
|
15184
|
+
output: read0(bc)
|
|
15185
|
+
};
|
|
15186
|
+
}
|
|
15187
|
+
function readWorkflowSleepEntry(bc) {
|
|
15188
|
+
return {
|
|
15189
|
+
deadline: readU64(bc),
|
|
15190
|
+
state: readWorkflowSleepState(bc)
|
|
15191
|
+
};
|
|
15192
|
+
}
|
|
15193
|
+
function readWorkflowMessageEntry(bc) {
|
|
15194
|
+
return {
|
|
15195
|
+
name: readString(bc),
|
|
15196
|
+
messageData: readWorkflowCbor(bc)
|
|
15197
|
+
};
|
|
15198
|
+
}
|
|
15199
|
+
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
15200
|
+
return {
|
|
15201
|
+
name: readString(bc)
|
|
15202
|
+
};
|
|
15203
|
+
}
|
|
15204
|
+
function readWorkflowBranchStatus(bc) {
|
|
15205
|
+
return {
|
|
15206
|
+
status: readWorkflowBranchStatusType(bc),
|
|
15207
|
+
output: read0(bc),
|
|
15208
|
+
error: read1(bc)
|
|
15209
|
+
};
|
|
15210
|
+
}
|
|
15211
|
+
function read2(bc) {
|
|
15212
|
+
const len = readUintSafe(bc);
|
|
15213
|
+
const result = /* @__PURE__ */ new Map();
|
|
15214
|
+
for (let i = 0; i < len; i++) {
|
|
15215
|
+
const offset = bc.offset;
|
|
15216
|
+
const key = readString(bc);
|
|
15217
|
+
if (result.has(key)) {
|
|
15218
|
+
bc.offset = offset;
|
|
15219
|
+
throw new BareError(offset, "duplicated key");
|
|
15220
|
+
}
|
|
15221
|
+
result.set(key, readWorkflowBranchStatus(bc));
|
|
15138
15222
|
}
|
|
15139
|
-
return
|
|
15223
|
+
return result;
|
|
15140
15224
|
}
|
|
15141
|
-
function
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15225
|
+
function readWorkflowJoinEntry(bc) {
|
|
15226
|
+
return {
|
|
15227
|
+
branches: read2(bc)
|
|
15228
|
+
};
|
|
15229
|
+
}
|
|
15230
|
+
function readWorkflowRaceEntry(bc) {
|
|
15231
|
+
return {
|
|
15232
|
+
winner: read1(bc),
|
|
15233
|
+
branches: read2(bc)
|
|
15234
|
+
};
|
|
15235
|
+
}
|
|
15236
|
+
function readWorkflowRemovedEntry(bc) {
|
|
15237
|
+
return {
|
|
15238
|
+
originalType: readString(bc),
|
|
15239
|
+
originalName: read1(bc)
|
|
15240
|
+
};
|
|
15241
|
+
}
|
|
15242
|
+
function readWorkflowVersionCheckEntry(bc) {
|
|
15243
|
+
return {
|
|
15244
|
+
resolved: readU32(bc),
|
|
15245
|
+
latest: readU32(bc)
|
|
15246
|
+
};
|
|
15247
|
+
}
|
|
15248
|
+
function readWorkflowEntryKind(bc) {
|
|
15249
|
+
const offset = bc.offset;
|
|
15250
|
+
const tag = readU8(bc);
|
|
15251
|
+
switch (tag) {
|
|
15252
|
+
case 0:
|
|
15253
|
+
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
15254
|
+
case 1:
|
|
15255
|
+
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
15256
|
+
case 2:
|
|
15257
|
+
return {
|
|
15258
|
+
tag: "WorkflowSleepEntry",
|
|
15259
|
+
val: readWorkflowSleepEntry(bc)
|
|
15260
|
+
};
|
|
15261
|
+
case 3:
|
|
15262
|
+
return {
|
|
15263
|
+
tag: "WorkflowMessageEntry",
|
|
15264
|
+
val: readWorkflowMessageEntry(bc)
|
|
15265
|
+
};
|
|
15266
|
+
case 4:
|
|
15267
|
+
return {
|
|
15268
|
+
tag: "WorkflowRollbackCheckpointEntry",
|
|
15269
|
+
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
15270
|
+
};
|
|
15271
|
+
case 5:
|
|
15272
|
+
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
15273
|
+
case 6:
|
|
15274
|
+
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
15275
|
+
case 7:
|
|
15276
|
+
return {
|
|
15277
|
+
tag: "WorkflowRemovedEntry",
|
|
15278
|
+
val: readWorkflowRemovedEntry(bc)
|
|
15279
|
+
};
|
|
15280
|
+
case 8:
|
|
15281
|
+
return {
|
|
15282
|
+
tag: "WorkflowVersionCheckEntry",
|
|
15283
|
+
val: readWorkflowVersionCheckEntry(bc)
|
|
15284
|
+
};
|
|
15285
|
+
default: {
|
|
15286
|
+
bc.offset = offset;
|
|
15287
|
+
throw new BareError(offset, "invalid tag");
|
|
15288
|
+
}
|
|
15145
15289
|
}
|
|
15146
|
-
const config3 = run[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
15147
|
-
(_a2 = config3 == null ? void 0 : config3.disposeInspector) == null ? void 0 : _a2.call(config3, actorId);
|
|
15148
15290
|
}
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
)
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
/** @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. */
|
|
15176
|
-
onDestroyTimeout: external_exports.number().positive().optional(),
|
|
15177
|
-
/** @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. */
|
|
15178
|
-
waitUntilTimeout: external_exports.number().positive().optional(),
|
|
15179
|
-
stateSaveInterval: external_exports.number().positive().default(1e3),
|
|
15180
|
-
actionTimeout: external_exports.number().positive().default(6e4),
|
|
15181
|
-
connectionLivenessTimeout: external_exports.number().positive().default(2500),
|
|
15182
|
-
connectionLivenessInterval: external_exports.number().positive().default(5e3),
|
|
15183
|
-
/** @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. */
|
|
15184
|
-
noSleep: external_exports.boolean().default(false),
|
|
15185
|
-
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
15186
|
-
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
15187
|
-
/** Maximum pending one-shot and recurring schedules. */
|
|
15188
|
-
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
15189
|
-
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
15190
|
-
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
15191
|
-
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
15192
|
-
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
15193
|
-
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
15194
|
-
}).strict();
|
|
15195
|
-
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
15196
|
-
var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
15197
|
-
InstanceActorOptionsBaseSchema.shape
|
|
15198
|
-
).strict().prefault(() => ({}));
|
|
15199
|
-
var ActorConfigSchema = external_exports.object({
|
|
15200
|
-
onCreate: zFunction().optional(),
|
|
15201
|
-
onDestroy: zFunction().optional(),
|
|
15202
|
-
onMigrate: zFunction().optional(),
|
|
15203
|
-
onWake: zFunction().optional(),
|
|
15204
|
-
onSleep: zFunction().optional(),
|
|
15205
|
-
run: zRunHandler,
|
|
15206
|
-
onStateChange: zFunction().optional(),
|
|
15207
|
-
onBeforeConnect: zFunction().optional(),
|
|
15208
|
-
onConnect: zFunction().optional(),
|
|
15209
|
-
onDisconnect: zFunction().optional(),
|
|
15210
|
-
onBeforeActionResponse: zFunction().optional(),
|
|
15211
|
-
onRequest: zFunction().optional(),
|
|
15212
|
-
onWebSocket: zFunction().optional(),
|
|
15213
|
-
actions: zActionTree.default(() => ({})),
|
|
15214
|
-
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15215
|
-
connParamsSchema: external_exports.any().optional(),
|
|
15216
|
-
events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15217
|
-
queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
|
|
15218
|
-
state: external_exports.any().optional(),
|
|
15219
|
-
createState: zFunction().optional(),
|
|
15220
|
-
connState: external_exports.any().optional(),
|
|
15221
|
-
createConnState: zFunction().optional(),
|
|
15222
|
-
vars: external_exports.any().optional(),
|
|
15223
|
-
db: external_exports.any().optional(),
|
|
15224
|
-
createVars: zFunction().optional(),
|
|
15225
|
-
options: ActorOptionsSchema,
|
|
15226
|
-
inspector: ActorInspectorConfigSchema.optional()
|
|
15227
|
-
}).strict().refine(
|
|
15228
|
-
(data) => !(data.state !== void 0 && data.createState !== void 0),
|
|
15229
|
-
{
|
|
15230
|
-
message: "Cannot define both 'state' and 'createState'",
|
|
15231
|
-
path: ["state"]
|
|
15291
|
+
function readWorkflowEntry(bc) {
|
|
15292
|
+
return {
|
|
15293
|
+
id: readString(bc),
|
|
15294
|
+
location: readWorkflowLocation(bc),
|
|
15295
|
+
kind: readWorkflowEntryKind(bc)
|
|
15296
|
+
};
|
|
15297
|
+
}
|
|
15298
|
+
function read3(bc) {
|
|
15299
|
+
return readBool(bc) ? readU64(bc) : null;
|
|
15300
|
+
}
|
|
15301
|
+
function readWorkflowEntryMetadata(bc) {
|
|
15302
|
+
return {
|
|
15303
|
+
status: readWorkflowEntryStatus(bc),
|
|
15304
|
+
error: read1(bc),
|
|
15305
|
+
attempts: readU32(bc),
|
|
15306
|
+
lastAttemptAt: readU64(bc),
|
|
15307
|
+
createdAt: readU64(bc),
|
|
15308
|
+
completedAt: read3(bc),
|
|
15309
|
+
rollbackCompletedAt: read3(bc),
|
|
15310
|
+
rollbackError: read1(bc)
|
|
15311
|
+
};
|
|
15312
|
+
}
|
|
15313
|
+
function read4(bc) {
|
|
15314
|
+
const len = readUintSafe(bc);
|
|
15315
|
+
if (len === 0) {
|
|
15316
|
+
return [];
|
|
15232
15317
|
}
|
|
15233
|
-
)
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
message: "Cannot define both 'connState' and 'createConnState'",
|
|
15237
|
-
path: ["connState"]
|
|
15318
|
+
const result = [readString(bc)];
|
|
15319
|
+
for (let i = 1; i < len; i++) {
|
|
15320
|
+
result[i] = readString(bc);
|
|
15238
15321
|
}
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15322
|
+
return result;
|
|
15323
|
+
}
|
|
15324
|
+
function read5(bc) {
|
|
15325
|
+
const len = readUintSafe(bc);
|
|
15326
|
+
if (len === 0) {
|
|
15327
|
+
return [];
|
|
15244
15328
|
}
|
|
15245
|
-
);
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
)
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
)
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
)
|
|
15282
|
-
|
|
15283
|
-
"Deprecated. If true, the actor will never sleep. Use c.keepAwake(promise) to scope keep-awake to a specific operation instead. Default: false"
|
|
15284
|
-
),
|
|
15285
|
-
sleepTimeout: external_exports.number().optional().describe(
|
|
15286
|
-
"Time in ms of inactivity before the actor sleeps. Default: 30000"
|
|
15287
|
-
),
|
|
15288
|
-
maxQueueSize: external_exports.number().optional().describe(
|
|
15289
|
-
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
15290
|
-
),
|
|
15291
|
-
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
15292
|
-
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
15293
|
-
),
|
|
15294
|
-
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
15295
|
-
"Maximum size of each queue message in bytes. Default: 65536"
|
|
15296
|
-
),
|
|
15297
|
-
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
15298
|
-
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
15299
|
-
)
|
|
15300
|
-
}).describe("Actor options for timeouts and behavior configuration.");
|
|
15301
|
-
var DocActorConfigSchema = external_exports.object({
|
|
15302
|
-
state: external_exports.unknown().optional().describe(
|
|
15303
|
-
"Initial state value for the actor. Cannot be used with createState."
|
|
15304
|
-
),
|
|
15305
|
-
createState: external_exports.unknown().optional().describe(
|
|
15306
|
-
"Function to create initial state. Receives context and input. Cannot be used with state."
|
|
15307
|
-
),
|
|
15308
|
-
connState: external_exports.unknown().optional().describe(
|
|
15309
|
-
"Initial connection state value. Cannot be used with createConnState."
|
|
15310
|
-
),
|
|
15311
|
-
createConnState: external_exports.unknown().optional().describe(
|
|
15312
|
-
"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."
|
|
15313
|
-
),
|
|
15314
|
-
vars: external_exports.unknown().optional().describe(
|
|
15315
|
-
"Initial ephemeral variables value. Cannot be used with createVars."
|
|
15316
|
-
),
|
|
15317
|
-
createVars: external_exports.unknown().optional().describe(
|
|
15318
|
-
"Function to create ephemeral variables. Receives context and driver context. Cannot be used with vars."
|
|
15319
|
-
),
|
|
15320
|
-
db: external_exports.unknown().optional().describe("Database provider instance for the actor."),
|
|
15321
|
-
onCreate: external_exports.unknown().optional().describe(
|
|
15322
|
-
"Called when the actor is first initialized. Use to initialize state."
|
|
15323
|
-
),
|
|
15324
|
-
onDestroy: external_exports.unknown().optional().describe("Called when the actor is destroyed."),
|
|
15325
|
-
onMigrate: external_exports.unknown().optional().describe(
|
|
15326
|
-
"Called on every actor start after persisted state loads and before onWake. Use for repeatable schema migrations."
|
|
15327
|
-
),
|
|
15328
|
-
onWake: external_exports.unknown().optional().describe(
|
|
15329
|
-
"Called when the actor wakes up and is ready to receive connections and actions."
|
|
15330
|
-
),
|
|
15331
|
-
onSleep: external_exports.unknown().optional().describe(
|
|
15332
|
-
"Called when the actor is stopping or sleeping. Use to clean up resources."
|
|
15333
|
-
),
|
|
15334
|
-
run: external_exports.unknown().optional().describe(
|
|
15335
|
-
"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."
|
|
15336
|
-
),
|
|
15337
|
-
onStateChange: external_exports.unknown().optional().describe(
|
|
15338
|
-
"Called when the actor's state changes. State changes within this hook won't trigger recursion."
|
|
15339
|
-
),
|
|
15340
|
-
onBeforeConnect: external_exports.unknown().optional().describe(
|
|
15341
|
-
"Called before a client connects. Throw an error to reject the connection. The pending connection is not visible in c.conns while this runs."
|
|
15342
|
-
),
|
|
15343
|
-
onConnect: external_exports.unknown().optional().describe(
|
|
15344
|
-
"Called when a client successfully connects. The connection is visible in c.conns before this runs."
|
|
15345
|
-
),
|
|
15346
|
-
onDisconnect: external_exports.unknown().optional().describe("Called when a client disconnects."),
|
|
15347
|
-
onBeforeActionResponse: external_exports.unknown().optional().describe(
|
|
15348
|
-
"Called before sending an action response. Use to transform output."
|
|
15349
|
-
),
|
|
15350
|
-
onRequest: external_exports.unknown().optional().describe(
|
|
15351
|
-
"Called for raw HTTP requests to /actors/{name}/http/* endpoints."
|
|
15352
|
-
),
|
|
15353
|
-
onWebSocket: external_exports.unknown().optional().describe(
|
|
15354
|
-
"Called for raw WebSocket connections to /actors/{name}/websocket/* endpoints."
|
|
15355
|
-
),
|
|
15356
|
-
actions: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
15357
|
-
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object."
|
|
15358
|
-
),
|
|
15359
|
-
actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
15360
|
-
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
|
|
15361
|
-
),
|
|
15362
|
-
connParamsSchema: external_exports.unknown().optional().describe(
|
|
15363
|
-
"Optional schema for validating connection params in native runtimes."
|
|
15364
|
-
),
|
|
15365
|
-
events: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of event names to schemas."),
|
|
15366
|
-
queues: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("Map of queue names to schemas."),
|
|
15367
|
-
options: DocActorOptionsSchema.optional()
|
|
15368
|
-
}).describe("Actor configuration passed to the actor() function.");
|
|
15329
|
+
const result = [readWorkflowEntry(bc)];
|
|
15330
|
+
for (let i = 1; i < len; i++) {
|
|
15331
|
+
result[i] = readWorkflowEntry(bc);
|
|
15332
|
+
}
|
|
15333
|
+
return result;
|
|
15334
|
+
}
|
|
15335
|
+
function read6(bc) {
|
|
15336
|
+
const len = readUintSafe(bc);
|
|
15337
|
+
const result = /* @__PURE__ */ new Map();
|
|
15338
|
+
for (let i = 0; i < len; i++) {
|
|
15339
|
+
const offset = bc.offset;
|
|
15340
|
+
const key = readString(bc);
|
|
15341
|
+
if (result.has(key)) {
|
|
15342
|
+
bc.offset = offset;
|
|
15343
|
+
throw new BareError(offset, "duplicated key");
|
|
15344
|
+
}
|
|
15345
|
+
result.set(key, readWorkflowEntryMetadata(bc));
|
|
15346
|
+
}
|
|
15347
|
+
return result;
|
|
15348
|
+
}
|
|
15349
|
+
function readWorkflowHistory(bc) {
|
|
15350
|
+
return {
|
|
15351
|
+
nameRegistry: read4(bc),
|
|
15352
|
+
entries: read5(bc),
|
|
15353
|
+
entryMetadata: read6(bc)
|
|
15354
|
+
};
|
|
15355
|
+
}
|
|
15356
|
+
function decodeWorkflowHistory(bytes) {
|
|
15357
|
+
const bc = new ByteCursor(bytes, config2);
|
|
15358
|
+
const result = readWorkflowHistory(bc);
|
|
15359
|
+
if (bc.offset < bc.view.byteLength) {
|
|
15360
|
+
throw new BareError(bc.offset, "remaining bytes");
|
|
15361
|
+
}
|
|
15362
|
+
return result;
|
|
15363
|
+
}
|
|
15364
|
+
function decodeWorkflowHistoryTransport(data) {
|
|
15365
|
+
return decodeWorkflowHistory(toUint8Array(data));
|
|
15366
|
+
}
|
|
15369
15367
|
|
|
15370
15368
|
// ../rivetkit/dist/tsup/chunk-JI6GZ2C2.js
|
|
15371
15369
|
var EMPTY_KEY = "/";
|
|
@@ -15484,35 +15482,7 @@ function removePrefixFromKey(prefixedKey) {
|
|
|
15484
15482
|
return prefixedKey.slice(KEYS.KV.length);
|
|
15485
15483
|
}
|
|
15486
15484
|
|
|
15487
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15488
|
-
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
15489
|
-
var AsyncMutex = class {
|
|
15490
|
-
#locked = false;
|
|
15491
|
-
#waiting = [];
|
|
15492
|
-
async acquire() {
|
|
15493
|
-
while (this.#locked) {
|
|
15494
|
-
await new Promise((resolve) => this.#waiting.push(resolve));
|
|
15495
|
-
}
|
|
15496
|
-
this.#locked = true;
|
|
15497
|
-
}
|
|
15498
|
-
release() {
|
|
15499
|
-
this.#locked = false;
|
|
15500
|
-
const next = this.#waiting.shift();
|
|
15501
|
-
if (next) {
|
|
15502
|
-
next();
|
|
15503
|
-
}
|
|
15504
|
-
}
|
|
15505
|
-
async run(fn) {
|
|
15506
|
-
await this.acquire();
|
|
15507
|
-
try {
|
|
15508
|
-
return await fn();
|
|
15509
|
-
} finally {
|
|
15510
|
-
this.release();
|
|
15511
|
-
}
|
|
15512
|
-
}
|
|
15513
|
-
};
|
|
15514
|
-
|
|
15515
|
-
// ../rivetkit/dist/tsup/chunk-7PVR3YAW.js
|
|
15485
|
+
// ../rivetkit/dist/tsup/chunk-B7N2TMLF.js
|
|
15516
15486
|
function logger() {
|
|
15517
15487
|
return getLogger("actor-client");
|
|
15518
15488
|
}
|
|
@@ -15550,7 +15520,35 @@ async function importWebSocket() {
|
|
|
15550
15520
|
return webSocketPromise;
|
|
15551
15521
|
}
|
|
15552
15522
|
|
|
15553
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15523
|
+
// ../rivetkit/dist/tsup/chunk-7AFZMFPQ.js
|
|
15524
|
+
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
15525
|
+
var AsyncMutex = class {
|
|
15526
|
+
#locked = false;
|
|
15527
|
+
#waiting = [];
|
|
15528
|
+
async acquire() {
|
|
15529
|
+
while (this.#locked) {
|
|
15530
|
+
await new Promise((resolve) => this.#waiting.push(resolve));
|
|
15531
|
+
}
|
|
15532
|
+
this.#locked = true;
|
|
15533
|
+
}
|
|
15534
|
+
release() {
|
|
15535
|
+
this.#locked = false;
|
|
15536
|
+
const next = this.#waiting.shift();
|
|
15537
|
+
if (next) {
|
|
15538
|
+
next();
|
|
15539
|
+
}
|
|
15540
|
+
}
|
|
15541
|
+
async run(fn) {
|
|
15542
|
+
await this.acquire();
|
|
15543
|
+
try {
|
|
15544
|
+
return await fn();
|
|
15545
|
+
} finally {
|
|
15546
|
+
this.release();
|
|
15547
|
+
}
|
|
15548
|
+
}
|
|
15549
|
+
};
|
|
15550
|
+
|
|
15551
|
+
// ../rivetkit/dist/tsup/chunk-OISWZDAF.js
|
|
15554
15552
|
var import_invariant2 = __toESM(require_invariant(), 1);
|
|
15555
15553
|
|
|
15556
15554
|
// ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
@@ -15728,7 +15726,7 @@ function createVersionedDataHandler(config3) {
|
|
|
15728
15726
|
return new VersionedDataHandler(config3);
|
|
15729
15727
|
}
|
|
15730
15728
|
|
|
15731
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15729
|
+
// ../rivetkit/dist/tsup/chunk-OISWZDAF.js
|
|
15732
15730
|
var import_invariant3 = __toESM(require_invariant(), 1);
|
|
15733
15731
|
var import_invariant4 = __toESM(require_invariant(), 1);
|
|
15734
15732
|
var PATH_CONNECT = "/connect";
|
|
@@ -28700,7 +28698,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
28700
28698
|
var _a22;
|
|
28701
28699
|
const { ctx } = unwrapTsfnPayload(error46, payload);
|
|
28702
28700
|
const history = (_a22 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a22.getHistory();
|
|
28703
|
-
return history == null ? void 0 :
|
|
28701
|
+
return history == null ? void 0 : toUint8Array(history);
|
|
28704
28702
|
}
|
|
28705
28703
|
) : void 0,
|
|
28706
28704
|
replayWorkflow: getRunInspectorConfig(config3.run) !== void 0 ? wrapNativeCallback(
|
|
@@ -28716,7 +28714,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
28716
28714
|
const history = await workflowInspector.replayFromStep(
|
|
28717
28715
|
entryId
|
|
28718
28716
|
) ?? null;
|
|
28719
|
-
return history == null ? void 0 :
|
|
28717
|
+
return history == null ? void 0 : toUint8Array(history);
|
|
28720
28718
|
}
|
|
28721
28719
|
) : void 0,
|
|
28722
28720
|
actions: Object.fromEntries(
|