@rivetkit/supabase 2.3.3 → 2.3.5-rc.1
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 +1609 -1186
- package/dist/mod.mjs +1609 -1186
- package/package.json +3 -3
package/dist/mod.mjs
CHANGED
|
@@ -471,7 +471,7 @@ function unsupportedFeature(feature) {
|
|
|
471
471
|
);
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
474
|
+
// ../rivetkit/dist/tsup/chunk-B4IZU537.js
|
|
475
475
|
import {
|
|
476
476
|
pino,
|
|
477
477
|
stdTimeFunctions
|
|
@@ -13147,7 +13147,9 @@ var classic_default = external_exports;
|
|
|
13147
13147
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
|
|
13148
13148
|
var v4_default = classic_default;
|
|
13149
13149
|
|
|
13150
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
13150
|
+
// ../rivetkit/dist/tsup/chunk-B4IZU537.js
|
|
13151
|
+
var import_invariant = __toESM(require_invariant(), 1);
|
|
13152
|
+
import * as cbor from "cbor-x";
|
|
13151
13153
|
var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
|
|
13152
13154
|
var getRivetEndpoint = () => getEnvUniversal("RIVET_ENDPOINT");
|
|
13153
13155
|
var getRivetToken = () => getEnvUniversal("RIVET_TOKEN");
|
|
@@ -13310,7 +13312,7 @@ function noopNext() {
|
|
|
13310
13312
|
}
|
|
13311
13313
|
var package_default = {
|
|
13312
13314
|
name: "rivetkit",
|
|
13313
|
-
version: "2.3.
|
|
13315
|
+
version: "2.3.5-rc.1",
|
|
13314
13316
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
13315
13317
|
license: "Apache-2.0",
|
|
13316
13318
|
keywords: [
|
|
@@ -13707,834 +13709,1194 @@ function quoteLogfmtString(value) {
|
|
|
13707
13709
|
}
|
|
13708
13710
|
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n")}"`;
|
|
13709
13711
|
}
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
if (_userAgent !== void 0) {
|
|
13714
|
-
return _userAgent;
|
|
13712
|
+
function uint8ArrayToBase642(uint8Array) {
|
|
13713
|
+
if (typeof Buffer !== "undefined") {
|
|
13714
|
+
return Buffer.from(uint8Array).toString("base64");
|
|
13715
13715
|
}
|
|
13716
|
-
let
|
|
13717
|
-
const
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
return userAgent;
|
|
13721
|
-
}
|
|
13722
|
-
function getEnvUniversal(key) {
|
|
13723
|
-
if (typeof Deno !== "undefined") {
|
|
13724
|
-
return Deno.env.get(key);
|
|
13725
|
-
} else if (typeof process !== "undefined") {
|
|
13726
|
-
return process.env[key];
|
|
13716
|
+
let binary = "";
|
|
13717
|
+
const len = uint8Array.byteLength;
|
|
13718
|
+
for (let i = 0; i < len; i++) {
|
|
13719
|
+
binary += String.fromCharCode(uint8Array[i]);
|
|
13727
13720
|
}
|
|
13721
|
+
return btoa(binary);
|
|
13728
13722
|
}
|
|
13729
|
-
function
|
|
13730
|
-
if (
|
|
13731
|
-
return
|
|
13732
|
-
} else if (
|
|
13733
|
-
return
|
|
13734
|
-
} else if (ArrayBuffer.isView(data)) {
|
|
13735
|
-
return new Uint8Array(
|
|
13736
|
-
data.buffer.slice(
|
|
13737
|
-
data.byteOffset,
|
|
13738
|
-
data.byteOffset + data.byteLength
|
|
13739
|
-
)
|
|
13740
|
-
);
|
|
13723
|
+
function contentTypeForEncoding(encoding) {
|
|
13724
|
+
if (encoding === "json") {
|
|
13725
|
+
return "application/json";
|
|
13726
|
+
} else if (encoding === "cbor" || encoding === "bare") {
|
|
13727
|
+
return "application/octet-stream";
|
|
13741
13728
|
} else {
|
|
13742
|
-
|
|
13729
|
+
assertUnreachable(encoding);
|
|
13743
13730
|
}
|
|
13744
13731
|
}
|
|
13745
|
-
function
|
|
13746
|
-
|
|
13747
|
-
let reject;
|
|
13748
|
-
const promise2 = new Promise((res, rej) => {
|
|
13749
|
-
resolve = res;
|
|
13750
|
-
reject = rej;
|
|
13751
|
-
});
|
|
13752
|
-
promise2.catch(onReject);
|
|
13753
|
-
return { promise: promise2, resolve, reject };
|
|
13732
|
+
function encodeCborCompat(value) {
|
|
13733
|
+
return cbor.encode(encodeJsonCompatValue(value));
|
|
13754
13734
|
}
|
|
13755
|
-
function
|
|
13756
|
-
return
|
|
13757
|
-
buf.byteOffset,
|
|
13758
|
-
buf.byteOffset + buf.byteLength
|
|
13759
|
-
);
|
|
13735
|
+
function decodeCborCompat(buffer) {
|
|
13736
|
+
return reviveJsonCompatValue(cbor.decode(buffer));
|
|
13760
13737
|
}
|
|
13761
|
-
function
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
if (
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
if (value !== void 0) {
|
|
13776
|
-
queryParts.push(
|
|
13777
|
-
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
13778
|
-
);
|
|
13779
|
-
}
|
|
13738
|
+
function serializeWithEncoding(encoding, value, versionedDataHandler, version2, zodSchema, toJson, toBare) {
|
|
13739
|
+
if (encoding === "json") {
|
|
13740
|
+
const jsonValue = toJson(value);
|
|
13741
|
+
const validated = zodSchema.parse(jsonValue);
|
|
13742
|
+
return jsonStringifyCompat(validated);
|
|
13743
|
+
} else if (encoding === "cbor") {
|
|
13744
|
+
const jsonValue = toJson(value);
|
|
13745
|
+
const validated = zodSchema.parse(jsonValue);
|
|
13746
|
+
return cbor.encode(validated);
|
|
13747
|
+
} else if (encoding === "bare") {
|
|
13748
|
+
if (!versionedDataHandler) {
|
|
13749
|
+
throw new Error(
|
|
13750
|
+
"VersionedDataHandler is required for 'bare' encoding"
|
|
13751
|
+
);
|
|
13780
13752
|
}
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
function assert2(test, message = "") {
|
|
13792
|
-
if (!test) {
|
|
13793
|
-
const e = new AssertionError(message);
|
|
13794
|
-
V8Error.captureStackTrace?.(e, assert2);
|
|
13795
|
-
throw e;
|
|
13753
|
+
if (version2 === void 0) {
|
|
13754
|
+
throw new Error("version is required for 'bare' encoding");
|
|
13755
|
+
}
|
|
13756
|
+
const bareValue = toBare(value);
|
|
13757
|
+
return versionedDataHandler.serializeWithEmbeddedVersion(
|
|
13758
|
+
bareValue,
|
|
13759
|
+
version2
|
|
13760
|
+
);
|
|
13761
|
+
} else {
|
|
13762
|
+
assertUnreachable(encoding);
|
|
13796
13763
|
}
|
|
13797
13764
|
}
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13765
|
+
function deserializeWithEncoding(encoding, buffer, versionedDataHandler, zodSchema, fromJson, fromBare) {
|
|
13766
|
+
if (encoding === "json") {
|
|
13767
|
+
let parsed;
|
|
13768
|
+
if (typeof buffer === "string") {
|
|
13769
|
+
parsed = jsonParseCompat(buffer);
|
|
13770
|
+
} else {
|
|
13771
|
+
const decoder = new TextDecoder("utf-8");
|
|
13772
|
+
const jsonString = decoder.decode(buffer);
|
|
13773
|
+
parsed = jsonParseCompat(jsonString);
|
|
13774
|
+
}
|
|
13775
|
+
const validated = zodSchema.parse(parsed);
|
|
13776
|
+
return fromJson(validated);
|
|
13777
|
+
} else if (encoding === "cbor") {
|
|
13778
|
+
(0, import_invariant.default)(
|
|
13779
|
+
typeof buffer !== "string",
|
|
13780
|
+
"buffer cannot be string for cbor encoding"
|
|
13781
|
+
);
|
|
13782
|
+
const decoded = decodeCborCompat(buffer);
|
|
13783
|
+
const validated = zodSchema.parse(decoded);
|
|
13784
|
+
return fromJson(validated);
|
|
13785
|
+
} else if (encoding === "bare") {
|
|
13786
|
+
(0, import_invariant.default)(
|
|
13787
|
+
typeof buffer !== "string",
|
|
13788
|
+
"buffer cannot be string for bare encoding"
|
|
13789
|
+
);
|
|
13790
|
+
if (!versionedDataHandler) {
|
|
13791
|
+
throw new Error(
|
|
13792
|
+
"VersionedDataHandler is required for 'bare' encoding"
|
|
13793
|
+
);
|
|
13794
|
+
}
|
|
13795
|
+
const bareValue = versionedDataHandler.deserializeWithEmbeddedVersion(buffer);
|
|
13796
|
+
return fromBare(bareValue);
|
|
13797
|
+
} else {
|
|
13798
|
+
assertUnreachable(encoding);
|
|
13802
13799
|
}
|
|
13803
|
-
};
|
|
13804
|
-
|
|
13805
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/validator.js
|
|
13806
|
-
function isU8(val) {
|
|
13807
|
-
return val === (val & 255);
|
|
13808
13800
|
}
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13801
|
+
var JSON_COMPAT_BIGINT = "$BigInt";
|
|
13802
|
+
var JSON_COMPAT_ARRAY_BUFFER = "$ArrayBuffer";
|
|
13803
|
+
var JSON_COMPAT_UINT8_ARRAY = "$Uint8Array";
|
|
13804
|
+
var JSON_COMPAT_UNDEFINED = "$Undefined";
|
|
13805
|
+
var JSON_COMPAT_SET = "$Set";
|
|
13806
|
+
function isTypedArray(value) {
|
|
13807
|
+
return value instanceof Uint8ClampedArray || value instanceof Uint16Array || value instanceof Uint32Array || value instanceof BigUint64Array || value instanceof Int8Array || value instanceof Int16Array || value instanceof Int32Array || value instanceof BigInt64Array || value instanceof Float32Array || value instanceof Float64Array;
|
|
13814
13808
|
}
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
var INT_SAFE_MAX_BYTE_COUNT = 8;
|
|
13820
|
-
var UINT_MAX_BYTE_COUNT = 10;
|
|
13821
|
-
var UINT_SAFE32_MAX_BYTE_COUNT = 5;
|
|
13822
|
-
var INVALID_UTF8_STRING = "invalid UTF-8 string";
|
|
13823
|
-
var NON_CANONICAL_REPRESENTATION = "must be canonical";
|
|
13824
|
-
var TOO_LARGE_BUFFER = "too large buffer";
|
|
13825
|
-
var TOO_LARGE_NUMBER = "too large number";
|
|
13826
|
-
|
|
13827
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/bare-error.js
|
|
13828
|
-
var BareError = class extends Error {
|
|
13829
|
-
constructor(offset, issue2, opts) {
|
|
13830
|
-
super(`(byte:${offset}) ${issue2}`);
|
|
13831
|
-
this.name = "BareError";
|
|
13832
|
-
this.issue = issue2;
|
|
13833
|
-
this.offset = offset;
|
|
13834
|
-
this.cause = opts?.cause;
|
|
13809
|
+
function assertJsonCompatValue(value, path2 = "") {
|
|
13810
|
+
var _a2;
|
|
13811
|
+
if (value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
13812
|
+
return;
|
|
13835
13813
|
}
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
/**
|
|
13841
|
-
* @throws {BareError} Buffer exceeds `config.maxBufferLength`
|
|
13842
|
-
*/
|
|
13843
|
-
constructor(bytes, config3) {
|
|
13844
|
-
this.offset = 0;
|
|
13845
|
-
if (bytes.length > config3.maxBufferLength) {
|
|
13846
|
-
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
13847
|
-
}
|
|
13848
|
-
this.bytes = bytes;
|
|
13849
|
-
this.config = config3;
|
|
13850
|
-
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
13814
|
+
if (typeof value === "function") {
|
|
13815
|
+
throw new TypeError(
|
|
13816
|
+
`Value at ${path2 || "root"} is a function and is not CBOR serializable`
|
|
13817
|
+
);
|
|
13851
13818
|
}
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13819
|
+
if (typeof value === "symbol") {
|
|
13820
|
+
throw new TypeError(
|
|
13821
|
+
`Value at ${path2 || "root"} is a symbol and is not CBOR serializable`
|
|
13822
|
+
);
|
|
13856
13823
|
}
|
|
13857
|
-
if (
|
|
13858
|
-
|
|
13824
|
+
if (value instanceof Date || value instanceof RegExp || value instanceof Error || value instanceof ArrayBuffer || value instanceof Uint8Array || isTypedArray(value)) {
|
|
13825
|
+
return;
|
|
13859
13826
|
}
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13827
|
+
if (value instanceof WeakMap) {
|
|
13828
|
+
throw new TypeError(
|
|
13829
|
+
`Value at ${path2 || "root"} is a WeakMap and is not CBOR serializable`
|
|
13830
|
+
);
|
|
13864
13831
|
}
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13832
|
+
if (value instanceof WeakSet) {
|
|
13833
|
+
throw new TypeError(
|
|
13834
|
+
`Value at ${path2 || "root"} is a WeakSet and is not CBOR serializable`
|
|
13835
|
+
);
|
|
13868
13836
|
}
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13837
|
+
if (value instanceof WeakRef) {
|
|
13838
|
+
throw new TypeError(
|
|
13839
|
+
`Value at ${path2 || "root"} is a WeakRef and is not CBOR serializable`
|
|
13840
|
+
);
|
|
13873
13841
|
}
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
} else {
|
|
13884
|
-
buffer.grow(newLen);
|
|
13842
|
+
if (value instanceof Promise) {
|
|
13843
|
+
throw new TypeError(
|
|
13844
|
+
`Value at ${path2 || "root"} is a Promise and is not CBOR serializable`
|
|
13845
|
+
);
|
|
13846
|
+
}
|
|
13847
|
+
if (value instanceof Map) {
|
|
13848
|
+
for (const [k, v] of value.entries()) {
|
|
13849
|
+
assertJsonCompatValue(k, `${path2 || "root"}.key(${String(k)})`);
|
|
13850
|
+
assertJsonCompatValue(v, `${path2 || "root"}.value(${String(k)})`);
|
|
13885
13851
|
}
|
|
13886
|
-
|
|
13887
|
-
} else {
|
|
13888
|
-
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength);
|
|
13889
|
-
newBytes = new Uint8Array(newLen);
|
|
13890
|
-
newBytes.set(bc.bytes);
|
|
13852
|
+
return;
|
|
13891
13853
|
}
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
}
|
|
13898
|
-
|
|
13899
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/fixed-primitive.js
|
|
13900
|
-
function readBool(bc) {
|
|
13901
|
-
const val = readU8(bc);
|
|
13902
|
-
if (val > 1) {
|
|
13903
|
-
bc.offset--;
|
|
13904
|
-
throw new BareError(bc.offset, "a bool must be equal to 0 or 1");
|
|
13854
|
+
if (value instanceof Set) {
|
|
13855
|
+
let index = 0;
|
|
13856
|
+
for (const item of value.values()) {
|
|
13857
|
+
assertJsonCompatValue(item, `${path2 || "root"}.set[${index}]`);
|
|
13858
|
+
index++;
|
|
13859
|
+
}
|
|
13860
|
+
return;
|
|
13905
13861
|
}
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13862
|
+
if (Array.isArray(value)) {
|
|
13863
|
+
for (let i = 0; i < value.length; i++) {
|
|
13864
|
+
assertJsonCompatValue(value[i], `${path2 || "root"}[${i}]`);
|
|
13865
|
+
}
|
|
13866
|
+
return;
|
|
13867
|
+
}
|
|
13868
|
+
if (isPlainObject2(value)) {
|
|
13869
|
+
for (const key in value) {
|
|
13870
|
+
assertJsonCompatValue(
|
|
13871
|
+
value[key],
|
|
13872
|
+
path2 ? `${path2}.${key}` : key
|
|
13873
|
+
);
|
|
13874
|
+
}
|
|
13875
|
+
return;
|
|
13876
|
+
}
|
|
13877
|
+
const typeName = typeof value === "object" && value !== null ? ((_a2 = value.constructor) == null ? void 0 : _a2.name) ?? typeof value : typeof value;
|
|
13878
|
+
throw new TypeError(
|
|
13879
|
+
`Value at ${path2 || "root"} of type "${typeName}" is not CBOR serializable`
|
|
13880
|
+
);
|
|
13914
13881
|
}
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13882
|
+
var EncodingSchema = external_exports.enum(["json", "cbor", "bare"]);
|
|
13883
|
+
async function inputDataToBuffer(data) {
|
|
13884
|
+
if (typeof data === "string") {
|
|
13885
|
+
return data;
|
|
13918
13886
|
}
|
|
13919
|
-
|
|
13920
|
-
|
|
13887
|
+
if (data instanceof Blob) {
|
|
13888
|
+
return new Uint8Array(await data.arrayBuffer());
|
|
13889
|
+
}
|
|
13890
|
+
if (data instanceof Uint8Array) {
|
|
13891
|
+
return data;
|
|
13892
|
+
}
|
|
13893
|
+
if (data instanceof ArrayBuffer || data instanceof SharedArrayBuffer) {
|
|
13894
|
+
return new Uint8Array(data);
|
|
13895
|
+
}
|
|
13896
|
+
throw new Error("Malformed message");
|
|
13921
13897
|
}
|
|
13922
|
-
function
|
|
13923
|
-
|
|
13924
|
-
const
|
|
13925
|
-
|
|
13926
|
-
|
|
13898
|
+
function base64EncodeUint8Array(uint8Array) {
|
|
13899
|
+
let binary = "";
|
|
13900
|
+
for (const value of uint8Array) {
|
|
13901
|
+
binary += String.fromCharCode(value);
|
|
13902
|
+
}
|
|
13903
|
+
return btoa(binary);
|
|
13927
13904
|
}
|
|
13928
|
-
function
|
|
13929
|
-
|
|
13930
|
-
const result = bc.view.getBigUint64(bc.offset, true);
|
|
13931
|
-
bc.offset += 8;
|
|
13932
|
-
return result;
|
|
13905
|
+
function base64EncodeArrayBuffer(arrayBuffer) {
|
|
13906
|
+
return base64EncodeUint8Array(new Uint8Array(arrayBuffer));
|
|
13933
13907
|
}
|
|
13934
|
-
function
|
|
13935
|
-
if (
|
|
13936
|
-
|
|
13908
|
+
function isPlainObject2(value) {
|
|
13909
|
+
if (value === null || typeof value !== "object") {
|
|
13910
|
+
return false;
|
|
13937
13911
|
}
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
bc.offset += 8;
|
|
13912
|
+
const proto = Object.getPrototypeOf(value);
|
|
13913
|
+
return proto === Object.prototype || proto === null;
|
|
13941
13914
|
}
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
if (low >= 128) {
|
|
13947
|
-
low &= 127;
|
|
13948
|
-
let shiftMul = 128;
|
|
13949
|
-
let byteCount = 1;
|
|
13950
|
-
let byte;
|
|
13951
|
-
do {
|
|
13952
|
-
byte = readU8(bc);
|
|
13953
|
-
low += (byte & 127) * shiftMul;
|
|
13954
|
-
shiftMul *= /* 2**7 */
|
|
13955
|
-
128;
|
|
13956
|
-
byteCount++;
|
|
13957
|
-
} while (byte >= 128 && byteCount < 7);
|
|
13958
|
-
let height = 0;
|
|
13959
|
-
shiftMul = 1;
|
|
13960
|
-
while (byte >= 128 && byteCount < UINT_MAX_BYTE_COUNT) {
|
|
13961
|
-
byte = readU8(bc);
|
|
13962
|
-
height += (byte & 127) * shiftMul;
|
|
13963
|
-
shiftMul *= /* 2**7 */
|
|
13964
|
-
128;
|
|
13965
|
-
byteCount++;
|
|
13966
|
-
}
|
|
13967
|
-
if (byte === 0 || byteCount === UINT_MAX_BYTE_COUNT && byte > 1) {
|
|
13968
|
-
bc.offset -= byteCount;
|
|
13969
|
-
throw new BareError(bc.offset, NON_CANONICAL_REPRESENTATION);
|
|
13970
|
-
}
|
|
13971
|
-
return BigInt(low) + (BigInt(height) << BigInt(7 * 7));
|
|
13915
|
+
function encodeJsonCompatValue(input) {
|
|
13916
|
+
var _a2;
|
|
13917
|
+
if (input === null) {
|
|
13918
|
+
return input;
|
|
13972
13919
|
}
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
function writeUint(bc, x) {
|
|
13976
|
-
const truncated = BigInt.asUintN(64, x);
|
|
13977
|
-
if (DEV) {
|
|
13978
|
-
assert2(truncated === x, TOO_LARGE_NUMBER);
|
|
13920
|
+
if (input === void 0) {
|
|
13921
|
+
return [JSON_COMPAT_UNDEFINED, 0];
|
|
13979
13922
|
}
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13923
|
+
if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
|
|
13924
|
+
return input;
|
|
13925
|
+
}
|
|
13926
|
+
if (typeof input === "bigint") {
|
|
13927
|
+
return [JSON_COMPAT_BIGINT, input.toString()];
|
|
13928
|
+
}
|
|
13929
|
+
if (input instanceof ArrayBuffer) {
|
|
13930
|
+
return [JSON_COMPAT_ARRAY_BUFFER, base64EncodeArrayBuffer(input)];
|
|
13931
|
+
}
|
|
13932
|
+
if (input instanceof Uint8Array) {
|
|
13933
|
+
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(input)];
|
|
13934
|
+
}
|
|
13935
|
+
if (isTypedArray(input)) {
|
|
13936
|
+
return input;
|
|
13937
|
+
}
|
|
13938
|
+
if (input instanceof Date || input instanceof RegExp || input instanceof Error) {
|
|
13939
|
+
return input;
|
|
13940
|
+
}
|
|
13941
|
+
if (input instanceof Set) {
|
|
13942
|
+
const encoded = [...input.values()].map(
|
|
13943
|
+
(v) => encodeJsonCompatValue(v)
|
|
13944
|
+
);
|
|
13945
|
+
return [JSON_COMPAT_SET, encoded];
|
|
13946
|
+
}
|
|
13947
|
+
if (input instanceof Map) {
|
|
13948
|
+
const encoded = /* @__PURE__ */ new Map();
|
|
13949
|
+
for (const [k, v] of input.entries()) {
|
|
13950
|
+
encoded.set(
|
|
13951
|
+
encodeJsonCompatValue(k),
|
|
13952
|
+
encodeJsonCompatValue(v)
|
|
13953
|
+
);
|
|
13994
13954
|
}
|
|
13955
|
+
return encoded;
|
|
13995
13956
|
}
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
let shift = 7;
|
|
14003
|
-
let byteCount = 1;
|
|
14004
|
-
let byte;
|
|
14005
|
-
do {
|
|
14006
|
-
byte = readU8(bc);
|
|
14007
|
-
result += (byte & 127) << shift >>> 0;
|
|
14008
|
-
shift += 7;
|
|
14009
|
-
byteCount++;
|
|
14010
|
-
} while (byte >= 128 && byteCount < UINT_SAFE32_MAX_BYTE_COUNT);
|
|
14011
|
-
if (byte === 0) {
|
|
14012
|
-
bc.offset -= byteCount - 1;
|
|
14013
|
-
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
13957
|
+
if (Array.isArray(input)) {
|
|
13958
|
+
const encoded = input.map(
|
|
13959
|
+
(value) => encodeJsonCompatValue(value)
|
|
13960
|
+
);
|
|
13961
|
+
if (encoded.length === 2 && typeof encoded[0] === "string" && encoded[0].startsWith("$")) {
|
|
13962
|
+
return [`$${encoded[0]}`, encoded[1]];
|
|
14014
13963
|
}
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
13964
|
+
return encoded;
|
|
13965
|
+
}
|
|
13966
|
+
if (isPlainObject2(input)) {
|
|
13967
|
+
const encoded = {};
|
|
13968
|
+
for (const [key, value] of Object.entries(input)) {
|
|
13969
|
+
encoded[key] = encodeJsonCompatValue(value);
|
|
14018
13970
|
}
|
|
13971
|
+
return encoded;
|
|
14019
13972
|
}
|
|
14020
|
-
|
|
13973
|
+
const typeName = typeof input === "object" && input !== null ? ((_a2 = input.constructor) == null ? void 0 : _a2.name) ?? typeof input : typeof input;
|
|
13974
|
+
throw new TypeError(`Value of type "${typeName}" is not CBOR serializable`);
|
|
14021
13975
|
}
|
|
14022
|
-
function
|
|
14023
|
-
if (
|
|
14024
|
-
|
|
13976
|
+
function reviveJsonCompatValue(input, options = {}) {
|
|
13977
|
+
if (typeof input === "bigint") {
|
|
13978
|
+
if (options.coerceSafeIntegerBigInts && input >= BigInt(Number.MIN_SAFE_INTEGER) && input <= BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
13979
|
+
return Number(input);
|
|
13980
|
+
}
|
|
13981
|
+
return input;
|
|
14025
13982
|
}
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
13983
|
+
if (input instanceof Map) {
|
|
13984
|
+
const revived = /* @__PURE__ */ new Map();
|
|
13985
|
+
for (const [k, v] of input.entries()) {
|
|
13986
|
+
revived.set(
|
|
13987
|
+
reviveJsonCompatValue(k, options),
|
|
13988
|
+
reviveJsonCompatValue(v, options)
|
|
13989
|
+
);
|
|
13990
|
+
}
|
|
13991
|
+
return revived;
|
|
14030
13992
|
}
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
13993
|
+
if (Array.isArray(input)) {
|
|
13994
|
+
if (input.length === 2 && typeof input[0] === "string" && input[0].startsWith("$")) {
|
|
13995
|
+
if (input[0] === JSON_COMPAT_BIGINT) {
|
|
13996
|
+
return BigInt(input[1]);
|
|
13997
|
+
}
|
|
13998
|
+
if (input[0] === JSON_COMPAT_ARRAY_BUFFER) {
|
|
13999
|
+
return base64DecodeToArrayBuffer(input[1]);
|
|
14000
|
+
}
|
|
14001
|
+
if (input[0] === JSON_COMPAT_UINT8_ARRAY) {
|
|
14002
|
+
return base64DecodeToUint8Array(input[1]);
|
|
14003
|
+
}
|
|
14004
|
+
if (input[0] === JSON_COMPAT_UNDEFINED) {
|
|
14005
|
+
return void 0;
|
|
14006
|
+
}
|
|
14007
|
+
if (input[0] === JSON_COMPAT_SET) {
|
|
14008
|
+
const items = input[1].map(
|
|
14009
|
+
(v) => reviveJsonCompatValue(v, options)
|
|
14010
|
+
);
|
|
14011
|
+
return new Set(items);
|
|
14012
|
+
}
|
|
14013
|
+
if (input[0].startsWith("$$")) {
|
|
14014
|
+
return [
|
|
14015
|
+
input[0].substring(1),
|
|
14016
|
+
reviveJsonCompatValue(input[1], options)
|
|
14017
|
+
];
|
|
14018
|
+
}
|
|
14019
|
+
throw new Error(
|
|
14020
|
+
`Unknown JSON encoding type: ${input[0]}. This may indicate corrupted data or a version mismatch.`
|
|
14021
|
+
);
|
|
14053
14022
|
}
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14023
|
+
return input.map((value) => reviveJsonCompatValue(value, options));
|
|
14024
|
+
}
|
|
14025
|
+
if (isPlainObject2(input)) {
|
|
14026
|
+
const decoded = {};
|
|
14027
|
+
for (const [key, value] of Object.entries(input)) {
|
|
14028
|
+
decoded[key] = reviveJsonCompatValue(value, options);
|
|
14057
14029
|
}
|
|
14030
|
+
return decoded;
|
|
14058
14031
|
}
|
|
14059
|
-
return
|
|
14032
|
+
return input;
|
|
14060
14033
|
}
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14034
|
+
function base64DecodeToUint8Array(base643) {
|
|
14035
|
+
if (typeof Buffer !== "undefined") {
|
|
14036
|
+
return new Uint8Array(Buffer.from(base643, "base64"));
|
|
14037
|
+
}
|
|
14038
|
+
const binary = atob(base643);
|
|
14039
|
+
const bytes = new Uint8Array(binary.length);
|
|
14040
|
+
for (let i = 0; i < binary.length; i++) {
|
|
14041
|
+
bytes[i] = binary.charCodeAt(i);
|
|
14042
|
+
}
|
|
14043
|
+
return bytes;
|
|
14065
14044
|
}
|
|
14066
|
-
function
|
|
14067
|
-
|
|
14068
|
-
writeU8FixedArray(bc, x);
|
|
14045
|
+
function base64DecodeToArrayBuffer(base643) {
|
|
14046
|
+
return base64DecodeToUint8Array(base643).buffer;
|
|
14069
14047
|
}
|
|
14070
|
-
function
|
|
14071
|
-
return
|
|
14048
|
+
function jsonStringifyCompat(input, space) {
|
|
14049
|
+
return JSON.stringify(
|
|
14050
|
+
input,
|
|
14051
|
+
(_key, value) => {
|
|
14052
|
+
if (typeof value === "bigint") {
|
|
14053
|
+
return [JSON_COMPAT_BIGINT, value.toString()];
|
|
14054
|
+
}
|
|
14055
|
+
if (value instanceof ArrayBuffer) {
|
|
14056
|
+
return [JSON_COMPAT_ARRAY_BUFFER, base64EncodeArrayBuffer(value)];
|
|
14057
|
+
}
|
|
14058
|
+
if (value instanceof Uint8Array) {
|
|
14059
|
+
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(value)];
|
|
14060
|
+
}
|
|
14061
|
+
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && value[0].startsWith("$")) {
|
|
14062
|
+
return [`$${value[0]}`, value[1]];
|
|
14063
|
+
}
|
|
14064
|
+
return value;
|
|
14065
|
+
},
|
|
14066
|
+
space
|
|
14067
|
+
);
|
|
14072
14068
|
}
|
|
14073
|
-
function
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14069
|
+
function jsonParseCompat(input) {
|
|
14070
|
+
return reviveJsonCompatValue(JSON.parse(input));
|
|
14071
|
+
}
|
|
14072
|
+
var VERSION = package_default.version;
|
|
14073
|
+
var _userAgent;
|
|
14074
|
+
function httpUserAgent() {
|
|
14075
|
+
if (_userAgent !== void 0) {
|
|
14076
|
+
return _userAgent;
|
|
14079
14077
|
}
|
|
14078
|
+
let userAgent = `RivetKit/${VERSION}`;
|
|
14079
|
+
const navigatorObj = typeof navigator !== "undefined" ? navigator : void 0;
|
|
14080
|
+
if (navigatorObj == null ? void 0 : navigatorObj.userAgent) userAgent += ` ${navigatorObj.userAgent}`;
|
|
14081
|
+
_userAgent = userAgent;
|
|
14082
|
+
return userAgent;
|
|
14080
14083
|
}
|
|
14081
|
-
function
|
|
14082
|
-
if (
|
|
14083
|
-
|
|
14084
|
+
function getEnvUniversal(key) {
|
|
14085
|
+
if (typeof Deno !== "undefined") {
|
|
14086
|
+
return Deno.env.get(key);
|
|
14087
|
+
} else if (typeof process !== "undefined") {
|
|
14088
|
+
return process.env[key];
|
|
14084
14089
|
}
|
|
14085
|
-
check2(bc, len);
|
|
14086
|
-
const offset = bc.offset;
|
|
14087
|
-
bc.offset += len;
|
|
14088
|
-
return bc.bytes.subarray(offset, offset + len);
|
|
14089
14090
|
}
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14091
|
+
function toUint8Array(data) {
|
|
14092
|
+
if (data instanceof Uint8Array) {
|
|
14093
|
+
return data;
|
|
14094
|
+
} else if (data instanceof ArrayBuffer) {
|
|
14095
|
+
return new Uint8Array(data);
|
|
14096
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
14097
|
+
return new Uint8Array(
|
|
14098
|
+
data.buffer.slice(
|
|
14099
|
+
data.byteOffset,
|
|
14100
|
+
data.byteOffset + data.byteLength
|
|
14101
|
+
)
|
|
14102
|
+
);
|
|
14103
|
+
} else {
|
|
14104
|
+
throw new TypeError("Input must be ArrayBuffer or ArrayBufferView");
|
|
14105
|
+
}
|
|
14094
14106
|
}
|
|
14095
|
-
function
|
|
14096
|
-
|
|
14107
|
+
function promiseWithResolvers(onReject) {
|
|
14108
|
+
let resolve;
|
|
14109
|
+
let reject;
|
|
14110
|
+
const promise2 = new Promise((res, rej) => {
|
|
14111
|
+
resolve = res;
|
|
14112
|
+
reject = rej;
|
|
14113
|
+
});
|
|
14114
|
+
promise2.catch(onReject);
|
|
14115
|
+
return { promise: promise2, resolve, reject };
|
|
14097
14116
|
}
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14117
|
+
function bufferToArrayBuffer(buf) {
|
|
14118
|
+
return buf.buffer.slice(
|
|
14119
|
+
buf.byteOffset,
|
|
14120
|
+
buf.byteOffset + buf.byteLength
|
|
14121
|
+
);
|
|
14102
14122
|
}
|
|
14103
|
-
function
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14123
|
+
function combineUrlPath(endpoint, path2, queryParams) {
|
|
14124
|
+
const baseUrl = new URL(endpoint);
|
|
14125
|
+
const pathParts = path2.split("?");
|
|
14126
|
+
const pathOnly = pathParts[0];
|
|
14127
|
+
const existingQuery = pathParts[1] || "";
|
|
14128
|
+
const basePath = baseUrl.pathname.replace(/\/$/, "");
|
|
14129
|
+
const cleanPath = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
14130
|
+
const fullPath = (basePath + cleanPath).replace(/\/\//g, "/");
|
|
14131
|
+
const queryParts = [];
|
|
14132
|
+
if (existingQuery) {
|
|
14133
|
+
queryParts.push(existingQuery);
|
|
14113
14134
|
}
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14135
|
+
if (queryParams) {
|
|
14136
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
14137
|
+
if (value !== void 0) {
|
|
14138
|
+
queryParts.push(
|
|
14139
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
14140
|
+
);
|
|
14141
|
+
}
|
|
14142
|
+
}
|
|
14118
14143
|
}
|
|
14119
|
-
|
|
14120
|
-
|
|
14144
|
+
const fullQuery = queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
14145
|
+
return `${baseUrl.protocol}//${baseUrl.host}${fullPath}${fullQuery}`;
|
|
14146
|
+
}
|
|
14147
|
+
|
|
14148
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/imports/dev.node.js
|
|
14149
|
+
var DEV = process.env.NODE_ENV === "development";
|
|
14150
|
+
|
|
14151
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/assert.js
|
|
14152
|
+
var V8Error = Error;
|
|
14153
|
+
function assert2(test, message = "") {
|
|
14154
|
+
if (!test) {
|
|
14155
|
+
const e = new AssertionError(message);
|
|
14156
|
+
V8Error.captureStackTrace?.(e, assert2);
|
|
14157
|
+
throw e;
|
|
14121
14158
|
}
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14159
|
+
}
|
|
14160
|
+
var AssertionError = class extends Error {
|
|
14161
|
+
constructor() {
|
|
14162
|
+
super(...arguments);
|
|
14163
|
+
this.name = "AssertionError";
|
|
14126
14164
|
}
|
|
14165
|
+
};
|
|
14166
|
+
|
|
14167
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/validator.js
|
|
14168
|
+
function isU8(val) {
|
|
14169
|
+
return val === (val & 255);
|
|
14127
14170
|
}
|
|
14128
|
-
function
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
if (malformed) {
|
|
14167
|
-
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14168
|
-
}
|
|
14171
|
+
function isU32(val) {
|
|
14172
|
+
return val === val >>> 0;
|
|
14173
|
+
}
|
|
14174
|
+
function isU64(val) {
|
|
14175
|
+
return val === BigInt.asUintN(64, val);
|
|
14176
|
+
}
|
|
14177
|
+
|
|
14178
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/util/constants.js
|
|
14179
|
+
var TEXT_DECODER_THRESHOLD = 256;
|
|
14180
|
+
var TEXT_ENCODER_THRESHOLD = 256;
|
|
14181
|
+
var INT_SAFE_MAX_BYTE_COUNT = 8;
|
|
14182
|
+
var UINT_MAX_BYTE_COUNT = 10;
|
|
14183
|
+
var UINT_SAFE32_MAX_BYTE_COUNT = 5;
|
|
14184
|
+
var INVALID_UTF8_STRING = "invalid UTF-8 string";
|
|
14185
|
+
var NON_CANONICAL_REPRESENTATION = "must be canonical";
|
|
14186
|
+
var TOO_LARGE_BUFFER = "too large buffer";
|
|
14187
|
+
var TOO_LARGE_NUMBER = "too large number";
|
|
14188
|
+
|
|
14189
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/bare-error.js
|
|
14190
|
+
var BareError = class extends Error {
|
|
14191
|
+
constructor(offset, issue2, opts) {
|
|
14192
|
+
super(`(byte:${offset}) ${issue2}`);
|
|
14193
|
+
this.name = "BareError";
|
|
14194
|
+
this.issue = issue2;
|
|
14195
|
+
this.offset = offset;
|
|
14196
|
+
this.cause = opts?.cause;
|
|
14197
|
+
}
|
|
14198
|
+
};
|
|
14199
|
+
|
|
14200
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/byte-cursor.js
|
|
14201
|
+
var ByteCursor = class {
|
|
14202
|
+
/**
|
|
14203
|
+
* @throws {BareError} Buffer exceeds `config.maxBufferLength`
|
|
14204
|
+
*/
|
|
14205
|
+
constructor(bytes, config3) {
|
|
14206
|
+
this.offset = 0;
|
|
14207
|
+
if (bytes.length > config3.maxBufferLength) {
|
|
14208
|
+
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
14169
14209
|
}
|
|
14170
|
-
|
|
14210
|
+
this.bytes = bytes;
|
|
14211
|
+
this.config = config3;
|
|
14212
|
+
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
14213
|
+
}
|
|
14214
|
+
};
|
|
14215
|
+
function check2(bc, min) {
|
|
14216
|
+
if (DEV) {
|
|
14217
|
+
assert2(isU32(min));
|
|
14218
|
+
}
|
|
14219
|
+
if (bc.offset + min > bc.bytes.length) {
|
|
14220
|
+
throw new BareError(bc.offset, "missing bytes");
|
|
14171
14221
|
}
|
|
14172
|
-
bc.offset = offset;
|
|
14173
|
-
return result;
|
|
14174
14222
|
}
|
|
14175
|
-
function
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
bytes[offset++] = codePoint;
|
|
14183
|
-
} else {
|
|
14184
|
-
if (codePoint < 2048) {
|
|
14185
|
-
bytes[offset++] = 192 | codePoint >> 6;
|
|
14186
|
-
} else {
|
|
14187
|
-
if (codePoint < 65536) {
|
|
14188
|
-
bytes[offset++] = 224 | codePoint >> 12;
|
|
14189
|
-
} else {
|
|
14190
|
-
bytes[offset++] = 240 | codePoint >> 18;
|
|
14191
|
-
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
14192
|
-
i++;
|
|
14193
|
-
}
|
|
14194
|
-
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
14195
|
-
}
|
|
14196
|
-
bytes[offset++] = 128 | codePoint & 63;
|
|
14197
|
-
}
|
|
14223
|
+
function reserve(bc, min) {
|
|
14224
|
+
if (DEV) {
|
|
14225
|
+
assert2(isU32(min));
|
|
14226
|
+
}
|
|
14227
|
+
const minLen = bc.offset + min | 0;
|
|
14228
|
+
if (minLen > bc.bytes.length) {
|
|
14229
|
+
grow(bc, minLen);
|
|
14198
14230
|
}
|
|
14199
|
-
bc.offset = offset;
|
|
14200
14231
|
}
|
|
14201
|
-
function
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14232
|
+
function grow(bc, minLen) {
|
|
14233
|
+
if (minLen > bc.config.maxBufferLength) {
|
|
14234
|
+
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
14235
|
+
}
|
|
14236
|
+
const buffer = bc.bytes.buffer;
|
|
14237
|
+
let newBytes;
|
|
14238
|
+
if (isEs2024ArrayBufferLike(buffer) && // Make sure that the view covers the end of the buffer.
|
|
14239
|
+
// If it is not the case, this indicates that the user don't want
|
|
14240
|
+
// to override the trailing bytes.
|
|
14241
|
+
bc.bytes.byteOffset + bc.bytes.byteLength === buffer.byteLength && bc.bytes.byteLength + minLen <= buffer.maxByteLength) {
|
|
14242
|
+
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength, buffer.maxByteLength);
|
|
14243
|
+
if (buffer instanceof ArrayBuffer) {
|
|
14244
|
+
buffer.resize(newLen);
|
|
14245
|
+
} else {
|
|
14246
|
+
buffer.grow(newLen);
|
|
14213
14247
|
}
|
|
14248
|
+
newBytes = new Uint8Array(buffer, bc.bytes.byteOffset, newLen);
|
|
14249
|
+
} else {
|
|
14250
|
+
const newLen = Math.min(minLen << 1, bc.config.maxBufferLength);
|
|
14251
|
+
newBytes = new Uint8Array(newLen);
|
|
14252
|
+
newBytes.set(bc.bytes);
|
|
14214
14253
|
}
|
|
14215
|
-
|
|
14254
|
+
bc.bytes = newBytes;
|
|
14255
|
+
bc.view = new DataView(newBytes.buffer);
|
|
14216
14256
|
}
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
14221
|
-
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
14222
|
-
if (DEV) {
|
|
14223
|
-
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
14224
|
-
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
14225
|
-
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
14226
|
-
}
|
|
14227
|
-
return {
|
|
14228
|
-
initialBufferLength,
|
|
14229
|
-
maxBufferLength
|
|
14230
|
-
};
|
|
14257
|
+
function isEs2024ArrayBufferLike(buffer) {
|
|
14258
|
+
return "maxByteLength" in buffer;
|
|
14231
14259
|
}
|
|
14232
14260
|
|
|
14233
|
-
//
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14261
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/fixed-primitive.js
|
|
14262
|
+
function readBool(bc) {
|
|
14263
|
+
const val = readU8(bc);
|
|
14264
|
+
if (val > 1) {
|
|
14265
|
+
bc.offset--;
|
|
14266
|
+
throw new BareError(bc.offset, "a bool must be equal to 0 or 1");
|
|
14267
|
+
}
|
|
14268
|
+
return val > 0;
|
|
14237
14269
|
}
|
|
14238
|
-
function
|
|
14239
|
-
|
|
14270
|
+
function writeBool(bc, x) {
|
|
14271
|
+
writeU8(bc, x ? 1 : 0);
|
|
14240
14272
|
}
|
|
14241
|
-
function
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
iteration: readU32(bc)
|
|
14245
|
-
};
|
|
14273
|
+
function readU8(bc) {
|
|
14274
|
+
check2(bc, 1);
|
|
14275
|
+
return bc.bytes[bc.offset++];
|
|
14246
14276
|
}
|
|
14247
|
-
function
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
switch (tag) {
|
|
14251
|
-
case 0:
|
|
14252
|
-
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
14253
|
-
case 1:
|
|
14254
|
-
return {
|
|
14255
|
-
tag: "WorkflowLoopIterationMarker",
|
|
14256
|
-
val: readWorkflowLoopIterationMarker(bc)
|
|
14257
|
-
};
|
|
14258
|
-
default: {
|
|
14259
|
-
bc.offset = offset;
|
|
14260
|
-
throw new BareError(offset, "invalid tag");
|
|
14261
|
-
}
|
|
14277
|
+
function writeU8(bc, x) {
|
|
14278
|
+
if (DEV) {
|
|
14279
|
+
assert2(isU8(x), TOO_LARGE_NUMBER);
|
|
14262
14280
|
}
|
|
14281
|
+
reserve(bc, 1);
|
|
14282
|
+
bc.bytes[bc.offset++] = x;
|
|
14263
14283
|
}
|
|
14264
|
-
function
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
}
|
|
14269
|
-
const result = [readWorkflowPathSegment(bc)];
|
|
14270
|
-
for (let i = 1; i < len; i++) {
|
|
14271
|
-
result[i] = readWorkflowPathSegment(bc);
|
|
14272
|
-
}
|
|
14284
|
+
function readU32(bc) {
|
|
14285
|
+
check2(bc, 4);
|
|
14286
|
+
const result = bc.view.getUint32(bc.offset, true);
|
|
14287
|
+
bc.offset += 4;
|
|
14273
14288
|
return result;
|
|
14274
14289
|
}
|
|
14275
|
-
function
|
|
14276
|
-
|
|
14277
|
-
const
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
return "PENDING";
|
|
14281
|
-
case 1:
|
|
14282
|
-
return "RUNNING";
|
|
14283
|
-
case 2:
|
|
14284
|
-
return "COMPLETED";
|
|
14285
|
-
case 3:
|
|
14286
|
-
return "FAILED";
|
|
14287
|
-
case 4:
|
|
14288
|
-
return "EXHAUSTED";
|
|
14289
|
-
default: {
|
|
14290
|
-
bc.offset = offset;
|
|
14291
|
-
throw new BareError(offset, "invalid tag");
|
|
14292
|
-
}
|
|
14293
|
-
}
|
|
14290
|
+
function readU64(bc) {
|
|
14291
|
+
check2(bc, 8);
|
|
14292
|
+
const result = bc.view.getBigUint64(bc.offset, true);
|
|
14293
|
+
bc.offset += 8;
|
|
14294
|
+
return result;
|
|
14294
14295
|
}
|
|
14295
|
-
function
|
|
14296
|
-
|
|
14297
|
-
|
|
14298
|
-
switch (tag) {
|
|
14299
|
-
case 0:
|
|
14300
|
-
return "PENDING";
|
|
14301
|
-
case 1:
|
|
14302
|
-
return "COMPLETED";
|
|
14303
|
-
case 2:
|
|
14304
|
-
return "INTERRUPTED";
|
|
14305
|
-
default: {
|
|
14306
|
-
bc.offset = offset;
|
|
14307
|
-
throw new BareError(offset, "invalid tag");
|
|
14308
|
-
}
|
|
14296
|
+
function writeU64(bc, x) {
|
|
14297
|
+
if (DEV) {
|
|
14298
|
+
assert2(isU64(x), TOO_LARGE_NUMBER);
|
|
14309
14299
|
}
|
|
14300
|
+
reserve(bc, 8);
|
|
14301
|
+
bc.view.setBigUint64(bc.offset, x, true);
|
|
14302
|
+
bc.offset += 8;
|
|
14310
14303
|
}
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14304
|
+
|
|
14305
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/uint.js
|
|
14306
|
+
function readUint(bc) {
|
|
14307
|
+
let low = readU8(bc);
|
|
14308
|
+
if (low >= 128) {
|
|
14309
|
+
low &= 127;
|
|
14310
|
+
let shiftMul = 128;
|
|
14311
|
+
let byteCount = 1;
|
|
14312
|
+
let byte;
|
|
14313
|
+
do {
|
|
14314
|
+
byte = readU8(bc);
|
|
14315
|
+
low += (byte & 127) * shiftMul;
|
|
14316
|
+
shiftMul *= /* 2**7 */
|
|
14317
|
+
128;
|
|
14318
|
+
byteCount++;
|
|
14319
|
+
} while (byte >= 128 && byteCount < 7);
|
|
14320
|
+
let height = 0;
|
|
14321
|
+
shiftMul = 1;
|
|
14322
|
+
while (byte >= 128 && byteCount < UINT_MAX_BYTE_COUNT) {
|
|
14323
|
+
byte = readU8(bc);
|
|
14324
|
+
height += (byte & 127) * shiftMul;
|
|
14325
|
+
shiftMul *= /* 2**7 */
|
|
14326
|
+
128;
|
|
14327
|
+
byteCount++;
|
|
14328
|
+
}
|
|
14329
|
+
if (byte === 0 || byteCount === UINT_MAX_BYTE_COUNT && byte > 1) {
|
|
14330
|
+
bc.offset -= byteCount;
|
|
14331
|
+
throw new BareError(bc.offset, NON_CANONICAL_REPRESENTATION);
|
|
14328
14332
|
}
|
|
14333
|
+
return BigInt(low) + (BigInt(height) << BigInt(7 * 7));
|
|
14329
14334
|
}
|
|
14335
|
+
return BigInt(low);
|
|
14330
14336
|
}
|
|
14331
|
-
function
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
function readWorkflowStepEntry(bc) {
|
|
14338
|
-
return {
|
|
14339
|
-
output: read0(bc),
|
|
14340
|
-
error: read1(bc)
|
|
14341
|
-
};
|
|
14342
|
-
}
|
|
14343
|
-
function readWorkflowLoopEntry(bc) {
|
|
14344
|
-
return {
|
|
14345
|
-
state: readWorkflowCbor(bc),
|
|
14346
|
-
iteration: readU32(bc),
|
|
14347
|
-
output: read0(bc)
|
|
14348
|
-
};
|
|
14349
|
-
}
|
|
14350
|
-
function readWorkflowSleepEntry(bc) {
|
|
14351
|
-
return {
|
|
14352
|
-
deadline: readU64(bc),
|
|
14353
|
-
state: readWorkflowSleepState(bc)
|
|
14354
|
-
};
|
|
14337
|
+
function writeUint(bc, x) {
|
|
14338
|
+
const truncated = BigInt.asUintN(64, x);
|
|
14339
|
+
if (DEV) {
|
|
14340
|
+
assert2(truncated === x, TOO_LARGE_NUMBER);
|
|
14341
|
+
}
|
|
14342
|
+
writeUintTruncated(bc, truncated);
|
|
14355
14343
|
}
|
|
14356
|
-
function
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14344
|
+
function writeUintTruncated(bc, x) {
|
|
14345
|
+
let tmp = Number(BigInt.asUintN(7 * 7, x));
|
|
14346
|
+
let rest = Number(x >> BigInt(7 * 7));
|
|
14347
|
+
let byteCount = 0;
|
|
14348
|
+
while (tmp >= 128 || rest > 0) {
|
|
14349
|
+
writeU8(bc, 128 | tmp & 127);
|
|
14350
|
+
tmp = Math.floor(tmp / /* 2**7 */
|
|
14351
|
+
128);
|
|
14352
|
+
byteCount++;
|
|
14353
|
+
if (byteCount === 7) {
|
|
14354
|
+
tmp = rest;
|
|
14355
|
+
rest = 0;
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
writeU8(bc, tmp);
|
|
14361
14359
|
}
|
|
14362
|
-
function
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14360
|
+
function readUintSafe32(bc) {
|
|
14361
|
+
let result = readU8(bc);
|
|
14362
|
+
if (result >= 128) {
|
|
14363
|
+
result &= 127;
|
|
14364
|
+
let shift = 7;
|
|
14365
|
+
let byteCount = 1;
|
|
14366
|
+
let byte;
|
|
14367
|
+
do {
|
|
14368
|
+
byte = readU8(bc);
|
|
14369
|
+
result += (byte & 127) << shift >>> 0;
|
|
14370
|
+
shift += 7;
|
|
14371
|
+
byteCount++;
|
|
14372
|
+
} while (byte >= 128 && byteCount < UINT_SAFE32_MAX_BYTE_COUNT);
|
|
14373
|
+
if (byte === 0) {
|
|
14374
|
+
bc.offset -= byteCount - 1;
|
|
14375
|
+
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
14376
|
+
}
|
|
14377
|
+
if (byteCount === UINT_SAFE32_MAX_BYTE_COUNT && byte > 15) {
|
|
14378
|
+
bc.offset -= byteCount - 1;
|
|
14379
|
+
throw new BareError(bc.offset, TOO_LARGE_NUMBER);
|
|
14380
|
+
}
|
|
14381
|
+
}
|
|
14382
|
+
return result;
|
|
14366
14383
|
}
|
|
14367
|
-
function
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14384
|
+
function writeUintSafe32(bc, x) {
|
|
14385
|
+
if (DEV) {
|
|
14386
|
+
assert2(isU32(x), TOO_LARGE_NUMBER);
|
|
14387
|
+
}
|
|
14388
|
+
let zigZag = x >>> 0;
|
|
14389
|
+
while (zigZag >= 128) {
|
|
14390
|
+
writeU8(bc, 128 | zigZag & 127);
|
|
14391
|
+
zigZag >>>= 7;
|
|
14392
|
+
}
|
|
14393
|
+
writeU8(bc, zigZag);
|
|
14373
14394
|
}
|
|
14374
|
-
function
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14395
|
+
function readUintSafe(bc) {
|
|
14396
|
+
let result = readU8(bc);
|
|
14397
|
+
if (result >= 128) {
|
|
14398
|
+
result &= 127;
|
|
14399
|
+
let shiftMul = (
|
|
14400
|
+
/* 2**7 */
|
|
14401
|
+
128
|
|
14402
|
+
);
|
|
14403
|
+
let byteCount = 1;
|
|
14404
|
+
let byte;
|
|
14405
|
+
do {
|
|
14406
|
+
byte = readU8(bc);
|
|
14407
|
+
result += (byte & 127) * shiftMul;
|
|
14408
|
+
shiftMul *= /* 2**7 */
|
|
14409
|
+
128;
|
|
14410
|
+
byteCount++;
|
|
14411
|
+
} while (byte >= 128 && byteCount < INT_SAFE_MAX_BYTE_COUNT);
|
|
14412
|
+
if (byte === 0) {
|
|
14413
|
+
bc.offset -= byteCount - 1;
|
|
14414
|
+
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
14415
|
+
}
|
|
14416
|
+
if (byteCount === INT_SAFE_MAX_BYTE_COUNT && byte > 15) {
|
|
14417
|
+
bc.offset -= byteCount - 1;
|
|
14418
|
+
throw new BareError(bc.offset, TOO_LARGE_NUMBER);
|
|
14383
14419
|
}
|
|
14384
|
-
result.set(key, readWorkflowBranchStatus(bc));
|
|
14385
14420
|
}
|
|
14386
14421
|
return result;
|
|
14387
14422
|
}
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14423
|
+
|
|
14424
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/u8-array.js
|
|
14425
|
+
function readU8Array(bc) {
|
|
14426
|
+
return readU8FixedArray(bc, readUintSafe32(bc));
|
|
14392
14427
|
}
|
|
14393
|
-
function
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
branches: read2(bc)
|
|
14397
|
-
};
|
|
14428
|
+
function writeU8Array(bc, x) {
|
|
14429
|
+
writeUintSafe32(bc, x.length);
|
|
14430
|
+
writeU8FixedArray(bc, x);
|
|
14398
14431
|
}
|
|
14399
|
-
function
|
|
14400
|
-
return
|
|
14401
|
-
originalType: readString(bc),
|
|
14402
|
-
originalName: read1(bc)
|
|
14403
|
-
};
|
|
14432
|
+
function readU8FixedArray(bc, len) {
|
|
14433
|
+
return readUnsafeU8FixedArray(bc, len).slice();
|
|
14404
14434
|
}
|
|
14405
|
-
function
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14435
|
+
function writeU8FixedArray(bc, x) {
|
|
14436
|
+
const len = x.length;
|
|
14437
|
+
if (len > 0) {
|
|
14438
|
+
reserve(bc, len);
|
|
14439
|
+
bc.bytes.set(x, bc.offset);
|
|
14440
|
+
bc.offset += len;
|
|
14441
|
+
}
|
|
14410
14442
|
}
|
|
14411
|
-
function
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
switch (tag) {
|
|
14415
|
-
case 0:
|
|
14416
|
-
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
14417
|
-
case 1:
|
|
14418
|
-
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
14419
|
-
case 2:
|
|
14420
|
-
return {
|
|
14421
|
-
tag: "WorkflowSleepEntry",
|
|
14422
|
-
val: readWorkflowSleepEntry(bc)
|
|
14423
|
-
};
|
|
14424
|
-
case 3:
|
|
14425
|
-
return {
|
|
14426
|
-
tag: "WorkflowMessageEntry",
|
|
14427
|
-
val: readWorkflowMessageEntry(bc)
|
|
14428
|
-
};
|
|
14429
|
-
case 4:
|
|
14430
|
-
return {
|
|
14431
|
-
tag: "WorkflowRollbackCheckpointEntry",
|
|
14432
|
-
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
14433
|
-
};
|
|
14434
|
-
case 5:
|
|
14435
|
-
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
14436
|
-
case 6:
|
|
14437
|
-
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
14438
|
-
case 7:
|
|
14439
|
-
return {
|
|
14440
|
-
tag: "WorkflowRemovedEntry",
|
|
14441
|
-
val: readWorkflowRemovedEntry(bc)
|
|
14442
|
-
};
|
|
14443
|
-
case 8:
|
|
14444
|
-
return {
|
|
14445
|
-
tag: "WorkflowVersionCheckEntry",
|
|
14446
|
-
val: readWorkflowVersionCheckEntry(bc)
|
|
14447
|
-
};
|
|
14448
|
-
default: {
|
|
14449
|
-
bc.offset = offset;
|
|
14450
|
-
throw new BareError(offset, "invalid tag");
|
|
14451
|
-
}
|
|
14443
|
+
function readUnsafeU8FixedArray(bc, len) {
|
|
14444
|
+
if (DEV) {
|
|
14445
|
+
assert2(isU32(len));
|
|
14452
14446
|
}
|
|
14447
|
+
check2(bc, len);
|
|
14448
|
+
const offset = bc.offset;
|
|
14449
|
+
bc.offset += len;
|
|
14450
|
+
return bc.bytes.subarray(offset, offset + len);
|
|
14453
14451
|
}
|
|
14454
|
-
|
|
14452
|
+
|
|
14453
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/data.js
|
|
14454
|
+
function readData(bc) {
|
|
14455
|
+
return readU8Array(bc).buffer;
|
|
14456
|
+
}
|
|
14457
|
+
function writeData(bc, x) {
|
|
14458
|
+
writeU8Array(bc, new Uint8Array(x));
|
|
14459
|
+
}
|
|
14460
|
+
|
|
14461
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/codec/string.js
|
|
14462
|
+
function readString(bc) {
|
|
14463
|
+
return readFixedString(bc, readUintSafe32(bc));
|
|
14464
|
+
}
|
|
14465
|
+
function writeString(bc, x) {
|
|
14466
|
+
if (x.length < TEXT_ENCODER_THRESHOLD) {
|
|
14467
|
+
const byteLen = utf8ByteLength(x);
|
|
14468
|
+
writeUintSafe32(bc, byteLen);
|
|
14469
|
+
reserve(bc, byteLen);
|
|
14470
|
+
writeUtf8Js(bc, x);
|
|
14471
|
+
} else {
|
|
14472
|
+
const strBytes = UTF8_ENCODER.encode(x);
|
|
14473
|
+
writeUintSafe32(bc, strBytes.length);
|
|
14474
|
+
writeU8FixedArray(bc, strBytes);
|
|
14475
|
+
}
|
|
14476
|
+
}
|
|
14477
|
+
function readFixedString(bc, byteLen) {
|
|
14478
|
+
if (DEV) {
|
|
14479
|
+
assert2(isU32(byteLen));
|
|
14480
|
+
}
|
|
14481
|
+
if (byteLen < TEXT_DECODER_THRESHOLD) {
|
|
14482
|
+
return readUtf8Js(bc, byteLen);
|
|
14483
|
+
}
|
|
14484
|
+
try {
|
|
14485
|
+
return UTF8_DECODER.decode(readUnsafeU8FixedArray(bc, byteLen));
|
|
14486
|
+
} catch (_cause) {
|
|
14487
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14488
|
+
}
|
|
14489
|
+
}
|
|
14490
|
+
function readUtf8Js(bc, byteLen) {
|
|
14491
|
+
check2(bc, byteLen);
|
|
14492
|
+
let result = "";
|
|
14493
|
+
const bytes = bc.bytes;
|
|
14494
|
+
let offset = bc.offset;
|
|
14495
|
+
const upperOffset = offset + byteLen;
|
|
14496
|
+
while (offset < upperOffset) {
|
|
14497
|
+
let codePoint = bytes[offset++];
|
|
14498
|
+
if (codePoint > 127) {
|
|
14499
|
+
let malformed = true;
|
|
14500
|
+
const byte1 = codePoint;
|
|
14501
|
+
if (offset < upperOffset && codePoint < 224) {
|
|
14502
|
+
const byte2 = bytes[offset++];
|
|
14503
|
+
codePoint = (byte1 & 31) << 6 | byte2 & 63;
|
|
14504
|
+
malformed = codePoint >> 7 === 0 || // non-canonical char
|
|
14505
|
+
byte1 >> 5 !== 6 || // invalid tag
|
|
14506
|
+
byte2 >> 6 !== 2;
|
|
14507
|
+
} else if (offset + 1 < upperOffset && codePoint < 240) {
|
|
14508
|
+
const byte2 = bytes[offset++];
|
|
14509
|
+
const byte3 = bytes[offset++];
|
|
14510
|
+
codePoint = (byte1 & 15) << 12 | (byte2 & 63) << 6 | byte3 & 63;
|
|
14511
|
+
malformed = codePoint >> 11 === 0 || // non-canonical char or missing data
|
|
14512
|
+
codePoint >> 11 === 27 || // surrogate char (0xD800 <= codePoint <= 0xDFFF)
|
|
14513
|
+
byte1 >> 4 !== 14 || // invalid tag
|
|
14514
|
+
byte2 >> 6 !== 2 || // invalid tag
|
|
14515
|
+
byte3 >> 6 !== 2;
|
|
14516
|
+
} else if (offset + 2 < upperOffset) {
|
|
14517
|
+
const byte2 = bytes[offset++];
|
|
14518
|
+
const byte3 = bytes[offset++];
|
|
14519
|
+
const byte4 = bytes[offset++];
|
|
14520
|
+
codePoint = (byte1 & 7) << 18 | (byte2 & 63) << 12 | (byte3 & 63) << 6 | byte4 & 63;
|
|
14521
|
+
malformed = codePoint >> 16 === 0 || // non-canonical char or missing data
|
|
14522
|
+
codePoint > 1114111 || // too large code point
|
|
14523
|
+
byte1 >> 3 !== 30 || // invalid tag
|
|
14524
|
+
byte2 >> 6 !== 2 || // invalid tag
|
|
14525
|
+
byte3 >> 6 !== 2 || // invalid tag
|
|
14526
|
+
byte4 >> 6 !== 2;
|
|
14527
|
+
}
|
|
14528
|
+
if (malformed) {
|
|
14529
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
14530
|
+
}
|
|
14531
|
+
}
|
|
14532
|
+
result += String.fromCodePoint(codePoint);
|
|
14533
|
+
}
|
|
14534
|
+
bc.offset = offset;
|
|
14535
|
+
return result;
|
|
14536
|
+
}
|
|
14537
|
+
function writeUtf8Js(bc, s) {
|
|
14538
|
+
const bytes = bc.bytes;
|
|
14539
|
+
let offset = bc.offset;
|
|
14540
|
+
let i = 0;
|
|
14541
|
+
while (i < s.length) {
|
|
14542
|
+
const codePoint = s.codePointAt(i++);
|
|
14543
|
+
if (codePoint < 128) {
|
|
14544
|
+
bytes[offset++] = codePoint;
|
|
14545
|
+
} else {
|
|
14546
|
+
if (codePoint < 2048) {
|
|
14547
|
+
bytes[offset++] = 192 | codePoint >> 6;
|
|
14548
|
+
} else {
|
|
14549
|
+
if (codePoint < 65536) {
|
|
14550
|
+
bytes[offset++] = 224 | codePoint >> 12;
|
|
14551
|
+
} else {
|
|
14552
|
+
bytes[offset++] = 240 | codePoint >> 18;
|
|
14553
|
+
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
14554
|
+
i++;
|
|
14555
|
+
}
|
|
14556
|
+
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
14557
|
+
}
|
|
14558
|
+
bytes[offset++] = 128 | codePoint & 63;
|
|
14559
|
+
}
|
|
14560
|
+
}
|
|
14561
|
+
bc.offset = offset;
|
|
14562
|
+
}
|
|
14563
|
+
function utf8ByteLength(s) {
|
|
14564
|
+
let result = s.length;
|
|
14565
|
+
for (let i = 0; i < s.length; i++) {
|
|
14566
|
+
const codePoint = s.codePointAt(i);
|
|
14567
|
+
if (codePoint > 127) {
|
|
14568
|
+
result++;
|
|
14569
|
+
if (codePoint > 2047) {
|
|
14570
|
+
result++;
|
|
14571
|
+
if (codePoint > 65535) {
|
|
14572
|
+
i++;
|
|
14573
|
+
}
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14576
|
+
}
|
|
14577
|
+
return result;
|
|
14578
|
+
}
|
|
14579
|
+
var UTF8_DECODER = /* @__PURE__ */ new TextDecoder("utf-8", { fatal: true });
|
|
14580
|
+
var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
|
|
14581
|
+
|
|
14582
|
+
// ../../../node_modules/.pnpm/@rivetkit+bare-ts@0.6.2/node_modules/@rivetkit/bare-ts/dist/core/config.js
|
|
14583
|
+
function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32 }) {
|
|
14584
|
+
if (DEV) {
|
|
14585
|
+
assert2(isU32(initialBufferLength), TOO_LARGE_NUMBER);
|
|
14586
|
+
assert2(isU32(maxBufferLength), TOO_LARGE_NUMBER);
|
|
14587
|
+
assert2(initialBufferLength <= maxBufferLength, "initialBufferLength must be lower than or equal to maxBufferLength");
|
|
14588
|
+
}
|
|
14455
14589
|
return {
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
kind: readWorkflowEntryKind(bc)
|
|
14590
|
+
initialBufferLength,
|
|
14591
|
+
maxBufferLength
|
|
14459
14592
|
};
|
|
14460
14593
|
}
|
|
14461
|
-
|
|
14462
|
-
|
|
14594
|
+
|
|
14595
|
+
// ../rivetkit/dist/tsup/chunk-MGTSVSUC.js
|
|
14596
|
+
var config2 = /* @__PURE__ */ Config({});
|
|
14597
|
+
function readWorkflowCbor(bc) {
|
|
14598
|
+
return readData(bc);
|
|
14463
14599
|
}
|
|
14464
|
-
function
|
|
14600
|
+
function readWorkflowNameIndex(bc) {
|
|
14601
|
+
return readU32(bc);
|
|
14602
|
+
}
|
|
14603
|
+
function readWorkflowLoopIterationMarker(bc) {
|
|
14465
14604
|
return {
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
attempts: readU32(bc),
|
|
14469
|
-
lastAttemptAt: readU64(bc),
|
|
14470
|
-
createdAt: readU64(bc),
|
|
14471
|
-
completedAt: read3(bc),
|
|
14472
|
-
rollbackCompletedAt: read3(bc),
|
|
14473
|
-
rollbackError: read1(bc)
|
|
14605
|
+
loop: readWorkflowNameIndex(bc),
|
|
14606
|
+
iteration: readU32(bc)
|
|
14474
14607
|
};
|
|
14475
14608
|
}
|
|
14476
|
-
function
|
|
14477
|
-
const
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14609
|
+
function readWorkflowPathSegment(bc) {
|
|
14610
|
+
const offset = bc.offset;
|
|
14611
|
+
const tag = readU8(bc);
|
|
14612
|
+
switch (tag) {
|
|
14613
|
+
case 0:
|
|
14614
|
+
return { tag: "WorkflowNameIndex", val: readWorkflowNameIndex(bc) };
|
|
14615
|
+
case 1:
|
|
14616
|
+
return {
|
|
14617
|
+
tag: "WorkflowLoopIterationMarker",
|
|
14618
|
+
val: readWorkflowLoopIterationMarker(bc)
|
|
14619
|
+
};
|
|
14620
|
+
default: {
|
|
14621
|
+
bc.offset = offset;
|
|
14622
|
+
throw new BareError(offset, "invalid tag");
|
|
14623
|
+
}
|
|
14484
14624
|
}
|
|
14485
|
-
return result;
|
|
14486
14625
|
}
|
|
14487
|
-
function
|
|
14626
|
+
function readWorkflowLocation(bc) {
|
|
14488
14627
|
const len = readUintSafe(bc);
|
|
14489
14628
|
if (len === 0) {
|
|
14490
14629
|
return [];
|
|
14491
14630
|
}
|
|
14492
|
-
const result = [
|
|
14631
|
+
const result = [readWorkflowPathSegment(bc)];
|
|
14493
14632
|
for (let i = 1; i < len; i++) {
|
|
14494
|
-
result[i] =
|
|
14633
|
+
result[i] = readWorkflowPathSegment(bc);
|
|
14495
14634
|
}
|
|
14496
14635
|
return result;
|
|
14497
14636
|
}
|
|
14498
|
-
function
|
|
14499
|
-
const
|
|
14500
|
-
const
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14637
|
+
function readWorkflowEntryStatus(bc) {
|
|
14638
|
+
const offset = bc.offset;
|
|
14639
|
+
const tag = readU8(bc);
|
|
14640
|
+
switch (tag) {
|
|
14641
|
+
case 0:
|
|
14642
|
+
return "PENDING";
|
|
14643
|
+
case 1:
|
|
14644
|
+
return "RUNNING";
|
|
14645
|
+
case 2:
|
|
14646
|
+
return "COMPLETED";
|
|
14647
|
+
case 3:
|
|
14648
|
+
return "FAILED";
|
|
14649
|
+
case 4:
|
|
14650
|
+
return "EXHAUSTED";
|
|
14651
|
+
default: {
|
|
14505
14652
|
bc.offset = offset;
|
|
14506
|
-
throw new BareError(offset, "
|
|
14653
|
+
throw new BareError(offset, "invalid tag");
|
|
14507
14654
|
}
|
|
14508
|
-
result.set(key, readWorkflowEntryMetadata(bc));
|
|
14509
14655
|
}
|
|
14510
|
-
return result;
|
|
14511
|
-
}
|
|
14512
|
-
function readWorkflowHistory(bc) {
|
|
14513
|
-
return {
|
|
14514
|
-
nameRegistry: read4(bc),
|
|
14515
|
-
entries: read5(bc),
|
|
14516
|
-
entryMetadata: read6(bc)
|
|
14517
|
-
};
|
|
14518
14656
|
}
|
|
14519
|
-
function
|
|
14520
|
-
const
|
|
14521
|
-
const
|
|
14522
|
-
|
|
14523
|
-
|
|
14657
|
+
function readWorkflowSleepState(bc) {
|
|
14658
|
+
const offset = bc.offset;
|
|
14659
|
+
const tag = readU8(bc);
|
|
14660
|
+
switch (tag) {
|
|
14661
|
+
case 0:
|
|
14662
|
+
return "PENDING";
|
|
14663
|
+
case 1:
|
|
14664
|
+
return "COMPLETED";
|
|
14665
|
+
case 2:
|
|
14666
|
+
return "INTERRUPTED";
|
|
14667
|
+
default: {
|
|
14668
|
+
bc.offset = offset;
|
|
14669
|
+
throw new BareError(offset, "invalid tag");
|
|
14670
|
+
}
|
|
14524
14671
|
}
|
|
14525
|
-
return result;
|
|
14526
|
-
}
|
|
14527
|
-
function decodeWorkflowHistoryTransport(data) {
|
|
14528
|
-
return decodeWorkflowHistory(toUint8Array(data));
|
|
14529
14672
|
}
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14673
|
+
function readWorkflowBranchStatusType(bc) {
|
|
14674
|
+
const offset = bc.offset;
|
|
14675
|
+
const tag = readU8(bc);
|
|
14676
|
+
switch (tag) {
|
|
14677
|
+
case 0:
|
|
14678
|
+
return "PENDING";
|
|
14679
|
+
case 1:
|
|
14680
|
+
return "RUNNING";
|
|
14681
|
+
case 2:
|
|
14682
|
+
return "COMPLETED";
|
|
14683
|
+
case 3:
|
|
14684
|
+
return "FAILED";
|
|
14685
|
+
case 4:
|
|
14686
|
+
return "CANCELLED";
|
|
14687
|
+
default: {
|
|
14688
|
+
bc.offset = offset;
|
|
14689
|
+
throw new BareError(offset, "invalid tag");
|
|
14690
|
+
}
|
|
14691
|
+
}
|
|
14692
|
+
}
|
|
14693
|
+
function read0(bc) {
|
|
14694
|
+
return readBool(bc) ? readWorkflowCbor(bc) : null;
|
|
14695
|
+
}
|
|
14696
|
+
function read1(bc) {
|
|
14697
|
+
return readBool(bc) ? readString(bc) : null;
|
|
14698
|
+
}
|
|
14699
|
+
function readWorkflowStepEntry(bc) {
|
|
14700
|
+
return {
|
|
14701
|
+
output: read0(bc),
|
|
14702
|
+
error: read1(bc)
|
|
14703
|
+
};
|
|
14704
|
+
}
|
|
14705
|
+
function readWorkflowLoopEntry(bc) {
|
|
14706
|
+
return {
|
|
14707
|
+
state: readWorkflowCbor(bc),
|
|
14708
|
+
iteration: readU32(bc),
|
|
14709
|
+
output: read0(bc)
|
|
14710
|
+
};
|
|
14711
|
+
}
|
|
14712
|
+
function readWorkflowSleepEntry(bc) {
|
|
14713
|
+
return {
|
|
14714
|
+
deadline: readU64(bc),
|
|
14715
|
+
state: readWorkflowSleepState(bc)
|
|
14716
|
+
};
|
|
14717
|
+
}
|
|
14718
|
+
function readWorkflowMessageEntry(bc) {
|
|
14719
|
+
return {
|
|
14720
|
+
name: readString(bc),
|
|
14721
|
+
messageData: readWorkflowCbor(bc)
|
|
14722
|
+
};
|
|
14723
|
+
}
|
|
14724
|
+
function readWorkflowRollbackCheckpointEntry(bc) {
|
|
14725
|
+
return {
|
|
14726
|
+
name: readString(bc)
|
|
14727
|
+
};
|
|
14728
|
+
}
|
|
14729
|
+
function readWorkflowBranchStatus(bc) {
|
|
14730
|
+
return {
|
|
14731
|
+
status: readWorkflowBranchStatusType(bc),
|
|
14732
|
+
output: read0(bc),
|
|
14733
|
+
error: read1(bc)
|
|
14734
|
+
};
|
|
14735
|
+
}
|
|
14736
|
+
function read2(bc) {
|
|
14737
|
+
const len = readUintSafe(bc);
|
|
14738
|
+
const result = /* @__PURE__ */ new Map();
|
|
14739
|
+
for (let i = 0; i < len; i++) {
|
|
14740
|
+
const offset = bc.offset;
|
|
14741
|
+
const key = readString(bc);
|
|
14742
|
+
if (result.has(key)) {
|
|
14743
|
+
bc.offset = offset;
|
|
14744
|
+
throw new BareError(offset, "duplicated key");
|
|
14745
|
+
}
|
|
14746
|
+
result.set(key, readWorkflowBranchStatus(bc));
|
|
14747
|
+
}
|
|
14748
|
+
return result;
|
|
14749
|
+
}
|
|
14750
|
+
function readWorkflowJoinEntry(bc) {
|
|
14751
|
+
return {
|
|
14752
|
+
branches: read2(bc)
|
|
14753
|
+
};
|
|
14754
|
+
}
|
|
14755
|
+
function readWorkflowRaceEntry(bc) {
|
|
14756
|
+
return {
|
|
14757
|
+
winner: read1(bc),
|
|
14758
|
+
branches: read2(bc)
|
|
14759
|
+
};
|
|
14760
|
+
}
|
|
14761
|
+
function readWorkflowRemovedEntry(bc) {
|
|
14762
|
+
return {
|
|
14763
|
+
originalType: readString(bc),
|
|
14764
|
+
originalName: read1(bc)
|
|
14765
|
+
};
|
|
14766
|
+
}
|
|
14767
|
+
function readWorkflowVersionCheckEntry(bc) {
|
|
14768
|
+
return {
|
|
14769
|
+
resolved: readU32(bc),
|
|
14770
|
+
latest: readU32(bc)
|
|
14771
|
+
};
|
|
14772
|
+
}
|
|
14773
|
+
function readWorkflowEntryKind(bc) {
|
|
14774
|
+
const offset = bc.offset;
|
|
14775
|
+
const tag = readU8(bc);
|
|
14776
|
+
switch (tag) {
|
|
14777
|
+
case 0:
|
|
14778
|
+
return { tag: "WorkflowStepEntry", val: readWorkflowStepEntry(bc) };
|
|
14779
|
+
case 1:
|
|
14780
|
+
return { tag: "WorkflowLoopEntry", val: readWorkflowLoopEntry(bc) };
|
|
14781
|
+
case 2:
|
|
14782
|
+
return {
|
|
14783
|
+
tag: "WorkflowSleepEntry",
|
|
14784
|
+
val: readWorkflowSleepEntry(bc)
|
|
14785
|
+
};
|
|
14786
|
+
case 3:
|
|
14787
|
+
return {
|
|
14788
|
+
tag: "WorkflowMessageEntry",
|
|
14789
|
+
val: readWorkflowMessageEntry(bc)
|
|
14790
|
+
};
|
|
14791
|
+
case 4:
|
|
14792
|
+
return {
|
|
14793
|
+
tag: "WorkflowRollbackCheckpointEntry",
|
|
14794
|
+
val: readWorkflowRollbackCheckpointEntry(bc)
|
|
14795
|
+
};
|
|
14796
|
+
case 5:
|
|
14797
|
+
return { tag: "WorkflowJoinEntry", val: readWorkflowJoinEntry(bc) };
|
|
14798
|
+
case 6:
|
|
14799
|
+
return { tag: "WorkflowRaceEntry", val: readWorkflowRaceEntry(bc) };
|
|
14800
|
+
case 7:
|
|
14801
|
+
return {
|
|
14802
|
+
tag: "WorkflowRemovedEntry",
|
|
14803
|
+
val: readWorkflowRemovedEntry(bc)
|
|
14804
|
+
};
|
|
14805
|
+
case 8:
|
|
14806
|
+
return {
|
|
14807
|
+
tag: "WorkflowVersionCheckEntry",
|
|
14808
|
+
val: readWorkflowVersionCheckEntry(bc)
|
|
14809
|
+
};
|
|
14810
|
+
default: {
|
|
14811
|
+
bc.offset = offset;
|
|
14812
|
+
throw new BareError(offset, "invalid tag");
|
|
14813
|
+
}
|
|
14814
|
+
}
|
|
14815
|
+
}
|
|
14816
|
+
function readWorkflowEntry(bc) {
|
|
14817
|
+
return {
|
|
14818
|
+
id: readString(bc),
|
|
14819
|
+
location: readWorkflowLocation(bc),
|
|
14820
|
+
kind: readWorkflowEntryKind(bc)
|
|
14821
|
+
};
|
|
14822
|
+
}
|
|
14823
|
+
function read3(bc) {
|
|
14824
|
+
return readBool(bc) ? readU64(bc) : null;
|
|
14825
|
+
}
|
|
14826
|
+
function readWorkflowEntryMetadata(bc) {
|
|
14827
|
+
return {
|
|
14828
|
+
status: readWorkflowEntryStatus(bc),
|
|
14829
|
+
error: read1(bc),
|
|
14830
|
+
attempts: readU32(bc),
|
|
14831
|
+
lastAttemptAt: readU64(bc),
|
|
14832
|
+
createdAt: readU64(bc),
|
|
14833
|
+
completedAt: read3(bc),
|
|
14834
|
+
rollbackCompletedAt: read3(bc),
|
|
14835
|
+
rollbackError: read1(bc)
|
|
14836
|
+
};
|
|
14837
|
+
}
|
|
14838
|
+
function read4(bc) {
|
|
14839
|
+
const len = readUintSafe(bc);
|
|
14840
|
+
if (len === 0) {
|
|
14841
|
+
return [];
|
|
14842
|
+
}
|
|
14843
|
+
const result = [readString(bc)];
|
|
14844
|
+
for (let i = 1; i < len; i++) {
|
|
14845
|
+
result[i] = readString(bc);
|
|
14846
|
+
}
|
|
14847
|
+
return result;
|
|
14848
|
+
}
|
|
14849
|
+
function read5(bc) {
|
|
14850
|
+
const len = readUintSafe(bc);
|
|
14851
|
+
if (len === 0) {
|
|
14852
|
+
return [];
|
|
14853
|
+
}
|
|
14854
|
+
const result = [readWorkflowEntry(bc)];
|
|
14855
|
+
for (let i = 1; i < len; i++) {
|
|
14856
|
+
result[i] = readWorkflowEntry(bc);
|
|
14857
|
+
}
|
|
14858
|
+
return result;
|
|
14859
|
+
}
|
|
14860
|
+
function read6(bc) {
|
|
14861
|
+
const len = readUintSafe(bc);
|
|
14862
|
+
const result = /* @__PURE__ */ new Map();
|
|
14863
|
+
for (let i = 0; i < len; i++) {
|
|
14864
|
+
const offset = bc.offset;
|
|
14865
|
+
const key = readString(bc);
|
|
14866
|
+
if (result.has(key)) {
|
|
14867
|
+
bc.offset = offset;
|
|
14868
|
+
throw new BareError(offset, "duplicated key");
|
|
14869
|
+
}
|
|
14870
|
+
result.set(key, readWorkflowEntryMetadata(bc));
|
|
14871
|
+
}
|
|
14872
|
+
return result;
|
|
14873
|
+
}
|
|
14874
|
+
function readWorkflowHistory(bc) {
|
|
14875
|
+
return {
|
|
14876
|
+
nameRegistry: read4(bc),
|
|
14877
|
+
entries: read5(bc),
|
|
14878
|
+
entryMetadata: read6(bc)
|
|
14879
|
+
};
|
|
14880
|
+
}
|
|
14881
|
+
function decodeWorkflowHistory(bytes) {
|
|
14882
|
+
const bc = new ByteCursor(bytes, config2);
|
|
14883
|
+
const result = readWorkflowHistory(bc);
|
|
14884
|
+
if (bc.offset < bc.view.byteLength) {
|
|
14885
|
+
throw new BareError(bc.offset, "remaining bytes");
|
|
14886
|
+
}
|
|
14887
|
+
return result;
|
|
14888
|
+
}
|
|
14889
|
+
function decodeWorkflowHistoryTransport(data) {
|
|
14890
|
+
return decodeWorkflowHistory(toUint8Array(data));
|
|
14891
|
+
}
|
|
14892
|
+
|
|
14893
|
+
// ../rivetkit/dist/tsup/chunk-SHBE77IT.js
|
|
14894
|
+
var DEFAULT_SLEEP_GRACE_PERIOD = 15e3;
|
|
14895
|
+
var ACTOR_CONTEXT_INTERNAL_SYMBOL = /* @__PURE__ */ Symbol(
|
|
14896
|
+
"rivetkit.actor_context_internal"
|
|
14897
|
+
);
|
|
14898
|
+
var RAW_STATE_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.raw_state");
|
|
14899
|
+
var CONN_STATE_MANAGER_SYMBOL = /* @__PURE__ */ Symbol("rivetkit.conn_state_manager");
|
|
14538
14900
|
var zFunction = () => external_exports.custom((val) => typeof val === "function");
|
|
14539
14901
|
var WorkflowInspectorConfigSchema = external_exports.object({
|
|
14540
14902
|
getHistory: zFunction(),
|
|
@@ -14549,6 +14911,7 @@ var BUILTIN_INSPECTOR_TAB_IDS = [
|
|
|
14549
14911
|
"database",
|
|
14550
14912
|
"state",
|
|
14551
14913
|
"queue",
|
|
14914
|
+
"schedules",
|
|
14552
14915
|
"connections",
|
|
14553
14916
|
"console"
|
|
14554
14917
|
];
|
|
@@ -14645,6 +15008,8 @@ var GlobalActorOptionsBaseSchema = external_exports.object({
|
|
|
14645
15008
|
name: external_exports.string().optional(),
|
|
14646
15009
|
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
14647
15010
|
icon: external_exports.string().optional(),
|
|
15011
|
+
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
15012
|
+
enableActorRuntimeSocket: external_exports.boolean().default(false),
|
|
14648
15013
|
/**
|
|
14649
15014
|
* Can hibernate WebSockets for onWebSocket.
|
|
14650
15015
|
*
|
|
@@ -14676,10 +15041,12 @@ var InstanceActorOptionsBaseSchema = external_exports.object({
|
|
|
14676
15041
|
noSleep: external_exports.boolean().default(false),
|
|
14677
15042
|
sleepTimeout: external_exports.number().positive().default(3e4),
|
|
14678
15043
|
maxQueueSize: external_exports.number().positive().default(1e3),
|
|
15044
|
+
/** Maximum pending one-shot and recurring schedules. */
|
|
15045
|
+
maxSchedules: external_exports.number().int().nonnegative().default(1e3),
|
|
14679
15046
|
maxQueueMessageSize: external_exports.number().positive().default(64 * 1024),
|
|
14680
|
-
/**
|
|
15047
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
14681
15048
|
preloadMaxWorkflowBytes: external_exports.number().nonnegative().optional(),
|
|
14682
|
-
/**
|
|
15049
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
14683
15050
|
preloadMaxConnectionsBytes: external_exports.number().nonnegative().optional()
|
|
14684
15051
|
}).strict();
|
|
14685
15052
|
var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => ({}));
|
|
@@ -14738,6 +15105,9 @@ var DocActorOptionsSchema = external_exports.object({
|
|
|
14738
15105
|
icon: external_exports.string().optional().describe(
|
|
14739
15106
|
"Icon for the actor in the Inspector UI. Can be an emoji (e.g., '\u{1F680}') or FontAwesome icon name (e.g., 'rocket')."
|
|
14740
15107
|
),
|
|
15108
|
+
enableActorRuntimeSocket: external_exports.boolean().optional().describe(
|
|
15109
|
+
"Enables the experimental Actor Runtime Socket for this actor. Default: false"
|
|
15110
|
+
),
|
|
14741
15111
|
createVarsTimeout: external_exports.number().optional().describe("Timeout in ms for createVars handler. Default: 5000"),
|
|
14742
15112
|
createConnStateTimeout: external_exports.number().optional().describe(
|
|
14743
15113
|
"Timeout in ms for createConnState handler. Default: 5000"
|
|
@@ -14775,17 +15145,14 @@ var DocActorOptionsSchema = external_exports.object({
|
|
|
14775
15145
|
maxQueueSize: external_exports.number().optional().describe(
|
|
14776
15146
|
"Maximum number of queue messages before rejecting new messages. Default: 1000"
|
|
14777
15147
|
),
|
|
15148
|
+
maxSchedules: external_exports.number().int().nonnegative().optional().describe(
|
|
15149
|
+
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000"
|
|
15150
|
+
),
|
|
14778
15151
|
maxQueueMessageSize: external_exports.number().optional().describe(
|
|
14779
15152
|
"Maximum size of each queue message in bytes. Default: 65536"
|
|
14780
15153
|
),
|
|
14781
15154
|
canHibernateWebSocket: external_exports.boolean().optional().describe(
|
|
14782
15155
|
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false"
|
|
14783
|
-
),
|
|
14784
|
-
preloadMaxWorkflowBytes: external_exports.number().optional().describe(
|
|
14785
|
-
"Override RivetKit's workflow preload budget for this actor. Set to 0 to disable workflow preloading."
|
|
14786
|
-
),
|
|
14787
|
-
preloadMaxConnectionsBytes: external_exports.number().optional().describe(
|
|
14788
|
-
"Override RivetKit's connections preload budget for this actor. Set to 0 to disable connections preloading."
|
|
14789
15156
|
)
|
|
14790
15157
|
}).describe("Actor options for timeouts and behavior configuration.");
|
|
14791
15158
|
var DocActorConfigSchema = external_exports.object({
|
|
@@ -14857,7 +15224,7 @@ var DocActorConfigSchema = external_exports.object({
|
|
|
14857
15224
|
options: DocActorOptionsSchema.optional()
|
|
14858
15225
|
}).describe("Actor configuration passed to the actor() function.");
|
|
14859
15226
|
|
|
14860
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15227
|
+
// ../rivetkit/dist/tsup/chunk-JI6GZ2C2.js
|
|
14861
15228
|
var EMPTY_KEY = "/";
|
|
14862
15229
|
var KEY_SEPARATOR = "/";
|
|
14863
15230
|
var KEYS = {
|
|
@@ -14973,377 +15340,9 @@ function makePrefixedKey(key) {
|
|
|
14973
15340
|
function removePrefixFromKey(prefixedKey) {
|
|
14974
15341
|
return prefixedKey.slice(KEYS.KV.length);
|
|
14975
15342
|
}
|
|
14976
|
-
function workflowStoragePrefix() {
|
|
14977
|
-
return Uint8Array.from(WORKFLOW_STORAGE_PREFIX);
|
|
14978
|
-
}
|
|
14979
|
-
function queueMetadataKey() {
|
|
14980
|
-
return Uint8Array.from(QUEUE_METADATA_KEY);
|
|
14981
|
-
}
|
|
14982
|
-
function queueMessagesPrefix() {
|
|
14983
|
-
return Uint8Array.from(QUEUE_MESSAGES_PREFIX);
|
|
14984
|
-
}
|
|
14985
|
-
|
|
14986
|
-
// ../rivetkit/dist/tsup/chunk-DHXWD4DF.js
|
|
14987
|
-
var import_invariant = __toESM(require_invariant(), 1);
|
|
14988
|
-
import * as cbor from "cbor-x";
|
|
14989
|
-
var JSON_COMPAT_BIGINT = "$BigInt";
|
|
14990
|
-
var JSON_COMPAT_ARRAY_BUFFER = "$ArrayBuffer";
|
|
14991
|
-
var JSON_COMPAT_UINT8_ARRAY = "$Uint8Array";
|
|
14992
|
-
var JSON_COMPAT_UNDEFINED = "$Undefined";
|
|
14993
|
-
var JSON_COMPAT_SET = "$Set";
|
|
14994
|
-
function isTypedArray(value) {
|
|
14995
|
-
return value instanceof Uint8ClampedArray || value instanceof Uint16Array || value instanceof Uint32Array || value instanceof BigUint64Array || value instanceof Int8Array || value instanceof Int16Array || value instanceof Int32Array || value instanceof BigInt64Array || value instanceof Float32Array || value instanceof Float64Array;
|
|
14996
|
-
}
|
|
14997
|
-
function assertJsonCompatValue(value, path2 = "") {
|
|
14998
|
-
var _a2;
|
|
14999
|
-
if (value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
15000
|
-
return;
|
|
15001
|
-
}
|
|
15002
|
-
if (typeof value === "function") {
|
|
15003
|
-
throw new TypeError(
|
|
15004
|
-
`Value at ${path2 || "root"} is a function and is not CBOR serializable`
|
|
15005
|
-
);
|
|
15006
|
-
}
|
|
15007
|
-
if (typeof value === "symbol") {
|
|
15008
|
-
throw new TypeError(
|
|
15009
|
-
`Value at ${path2 || "root"} is a symbol and is not CBOR serializable`
|
|
15010
|
-
);
|
|
15011
|
-
}
|
|
15012
|
-
if (value instanceof Date || value instanceof RegExp || value instanceof Error || value instanceof ArrayBuffer || value instanceof Uint8Array || isTypedArray(value)) {
|
|
15013
|
-
return;
|
|
15014
|
-
}
|
|
15015
|
-
if (value instanceof WeakMap) {
|
|
15016
|
-
throw new TypeError(
|
|
15017
|
-
`Value at ${path2 || "root"} is a WeakMap and is not CBOR serializable`
|
|
15018
|
-
);
|
|
15019
|
-
}
|
|
15020
|
-
if (value instanceof WeakSet) {
|
|
15021
|
-
throw new TypeError(
|
|
15022
|
-
`Value at ${path2 || "root"} is a WeakSet and is not CBOR serializable`
|
|
15023
|
-
);
|
|
15024
|
-
}
|
|
15025
|
-
if (value instanceof WeakRef) {
|
|
15026
|
-
throw new TypeError(
|
|
15027
|
-
`Value at ${path2 || "root"} is a WeakRef and is not CBOR serializable`
|
|
15028
|
-
);
|
|
15029
|
-
}
|
|
15030
|
-
if (value instanceof Promise) {
|
|
15031
|
-
throw new TypeError(
|
|
15032
|
-
`Value at ${path2 || "root"} is a Promise and is not CBOR serializable`
|
|
15033
|
-
);
|
|
15034
|
-
}
|
|
15035
|
-
if (value instanceof Map) {
|
|
15036
|
-
for (const [k, v] of value.entries()) {
|
|
15037
|
-
assertJsonCompatValue(k, `${path2 || "root"}.key(${String(k)})`);
|
|
15038
|
-
assertJsonCompatValue(v, `${path2 || "root"}.value(${String(k)})`);
|
|
15039
|
-
}
|
|
15040
|
-
return;
|
|
15041
|
-
}
|
|
15042
|
-
if (value instanceof Set) {
|
|
15043
|
-
let index = 0;
|
|
15044
|
-
for (const item of value.values()) {
|
|
15045
|
-
assertJsonCompatValue(item, `${path2 || "root"}.set[${index}]`);
|
|
15046
|
-
index++;
|
|
15047
|
-
}
|
|
15048
|
-
return;
|
|
15049
|
-
}
|
|
15050
|
-
if (Array.isArray(value)) {
|
|
15051
|
-
for (let i = 0; i < value.length; i++) {
|
|
15052
|
-
assertJsonCompatValue(value[i], `${path2 || "root"}[${i}]`);
|
|
15053
|
-
}
|
|
15054
|
-
return;
|
|
15055
|
-
}
|
|
15056
|
-
if (isPlainObject2(value)) {
|
|
15057
|
-
for (const key in value) {
|
|
15058
|
-
assertJsonCompatValue(
|
|
15059
|
-
value[key],
|
|
15060
|
-
path2 ? `${path2}.${key}` : key
|
|
15061
|
-
);
|
|
15062
|
-
}
|
|
15063
|
-
return;
|
|
15064
|
-
}
|
|
15065
|
-
const typeName = typeof value === "object" && value !== null ? ((_a2 = value.constructor) == null ? void 0 : _a2.name) ?? typeof value : typeof value;
|
|
15066
|
-
throw new TypeError(
|
|
15067
|
-
`Value at ${path2 || "root"} of type "${typeName}" is not CBOR serializable`
|
|
15068
|
-
);
|
|
15069
|
-
}
|
|
15070
|
-
var EncodingSchema = external_exports.enum(["json", "cbor", "bare"]);
|
|
15071
|
-
async function inputDataToBuffer(data) {
|
|
15072
|
-
if (typeof data === "string") {
|
|
15073
|
-
return data;
|
|
15074
|
-
}
|
|
15075
|
-
if (data instanceof Blob) {
|
|
15076
|
-
return new Uint8Array(await data.arrayBuffer());
|
|
15077
|
-
}
|
|
15078
|
-
if (data instanceof Uint8Array) {
|
|
15079
|
-
return data;
|
|
15080
|
-
}
|
|
15081
|
-
if (data instanceof ArrayBuffer || data instanceof SharedArrayBuffer) {
|
|
15082
|
-
return new Uint8Array(data);
|
|
15083
|
-
}
|
|
15084
|
-
throw new Error("Malformed message");
|
|
15085
|
-
}
|
|
15086
|
-
function base64EncodeUint8Array(uint8Array) {
|
|
15087
|
-
let binary = "";
|
|
15088
|
-
for (const value of uint8Array) {
|
|
15089
|
-
binary += String.fromCharCode(value);
|
|
15090
|
-
}
|
|
15091
|
-
return btoa(binary);
|
|
15092
|
-
}
|
|
15093
|
-
function base64EncodeArrayBuffer(arrayBuffer) {
|
|
15094
|
-
return base64EncodeUint8Array(new Uint8Array(arrayBuffer));
|
|
15095
|
-
}
|
|
15096
|
-
function isPlainObject2(value) {
|
|
15097
|
-
if (value === null || typeof value !== "object") {
|
|
15098
|
-
return false;
|
|
15099
|
-
}
|
|
15100
|
-
const proto = Object.getPrototypeOf(value);
|
|
15101
|
-
return proto === Object.prototype || proto === null;
|
|
15102
|
-
}
|
|
15103
|
-
function encodeJsonCompatValue(input) {
|
|
15104
|
-
var _a2;
|
|
15105
|
-
if (input === null) {
|
|
15106
|
-
return input;
|
|
15107
|
-
}
|
|
15108
|
-
if (input === void 0) {
|
|
15109
|
-
return [JSON_COMPAT_UNDEFINED, 0];
|
|
15110
|
-
}
|
|
15111
|
-
if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
|
|
15112
|
-
return input;
|
|
15113
|
-
}
|
|
15114
|
-
if (typeof input === "bigint") {
|
|
15115
|
-
return [JSON_COMPAT_BIGINT, input.toString()];
|
|
15116
|
-
}
|
|
15117
|
-
if (input instanceof ArrayBuffer) {
|
|
15118
|
-
return [JSON_COMPAT_ARRAY_BUFFER, base64EncodeArrayBuffer(input)];
|
|
15119
|
-
}
|
|
15120
|
-
if (input instanceof Uint8Array) {
|
|
15121
|
-
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(input)];
|
|
15122
|
-
}
|
|
15123
|
-
if (isTypedArray(input)) {
|
|
15124
|
-
return input;
|
|
15125
|
-
}
|
|
15126
|
-
if (input instanceof Date || input instanceof RegExp || input instanceof Error) {
|
|
15127
|
-
return input;
|
|
15128
|
-
}
|
|
15129
|
-
if (input instanceof Set) {
|
|
15130
|
-
const encoded = [...input.values()].map(
|
|
15131
|
-
(v) => encodeJsonCompatValue(v)
|
|
15132
|
-
);
|
|
15133
|
-
return [JSON_COMPAT_SET, encoded];
|
|
15134
|
-
}
|
|
15135
|
-
if (input instanceof Map) {
|
|
15136
|
-
const encoded = /* @__PURE__ */ new Map();
|
|
15137
|
-
for (const [k, v] of input.entries()) {
|
|
15138
|
-
encoded.set(
|
|
15139
|
-
encodeJsonCompatValue(k),
|
|
15140
|
-
encodeJsonCompatValue(v)
|
|
15141
|
-
);
|
|
15142
|
-
}
|
|
15143
|
-
return encoded;
|
|
15144
|
-
}
|
|
15145
|
-
if (Array.isArray(input)) {
|
|
15146
|
-
const encoded = input.map(
|
|
15147
|
-
(value) => encodeJsonCompatValue(value)
|
|
15148
|
-
);
|
|
15149
|
-
if (encoded.length === 2 && typeof encoded[0] === "string" && encoded[0].startsWith("$")) {
|
|
15150
|
-
return [`$${encoded[0]}`, encoded[1]];
|
|
15151
|
-
}
|
|
15152
|
-
return encoded;
|
|
15153
|
-
}
|
|
15154
|
-
if (isPlainObject2(input)) {
|
|
15155
|
-
const encoded = {};
|
|
15156
|
-
for (const [key, value] of Object.entries(input)) {
|
|
15157
|
-
encoded[key] = encodeJsonCompatValue(value);
|
|
15158
|
-
}
|
|
15159
|
-
return encoded;
|
|
15160
|
-
}
|
|
15161
|
-
const typeName = typeof input === "object" && input !== null ? ((_a2 = input.constructor) == null ? void 0 : _a2.name) ?? typeof input : typeof input;
|
|
15162
|
-
throw new TypeError(`Value of type "${typeName}" is not CBOR serializable`);
|
|
15163
|
-
}
|
|
15164
|
-
function reviveJsonCompatValue(input, options = {}) {
|
|
15165
|
-
if (typeof input === "bigint") {
|
|
15166
|
-
if (options.coerceSafeIntegerBigInts && input >= BigInt(Number.MIN_SAFE_INTEGER) && input <= BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
15167
|
-
return Number(input);
|
|
15168
|
-
}
|
|
15169
|
-
return input;
|
|
15170
|
-
}
|
|
15171
|
-
if (input instanceof Map) {
|
|
15172
|
-
const revived = /* @__PURE__ */ new Map();
|
|
15173
|
-
for (const [k, v] of input.entries()) {
|
|
15174
|
-
revived.set(
|
|
15175
|
-
reviveJsonCompatValue(k, options),
|
|
15176
|
-
reviveJsonCompatValue(v, options)
|
|
15177
|
-
);
|
|
15178
|
-
}
|
|
15179
|
-
return revived;
|
|
15180
|
-
}
|
|
15181
|
-
if (Array.isArray(input)) {
|
|
15182
|
-
if (input.length === 2 && typeof input[0] === "string" && input[0].startsWith("$")) {
|
|
15183
|
-
if (input[0] === JSON_COMPAT_BIGINT) {
|
|
15184
|
-
return BigInt(input[1]);
|
|
15185
|
-
}
|
|
15186
|
-
if (input[0] === JSON_COMPAT_ARRAY_BUFFER) {
|
|
15187
|
-
return base64DecodeToArrayBuffer(input[1]);
|
|
15188
|
-
}
|
|
15189
|
-
if (input[0] === JSON_COMPAT_UINT8_ARRAY) {
|
|
15190
|
-
return base64DecodeToUint8Array(input[1]);
|
|
15191
|
-
}
|
|
15192
|
-
if (input[0] === JSON_COMPAT_UNDEFINED) {
|
|
15193
|
-
return void 0;
|
|
15194
|
-
}
|
|
15195
|
-
if (input[0] === JSON_COMPAT_SET) {
|
|
15196
|
-
const items = input[1].map(
|
|
15197
|
-
(v) => reviveJsonCompatValue(v, options)
|
|
15198
|
-
);
|
|
15199
|
-
return new Set(items);
|
|
15200
|
-
}
|
|
15201
|
-
if (input[0].startsWith("$$")) {
|
|
15202
|
-
return [
|
|
15203
|
-
input[0].substring(1),
|
|
15204
|
-
reviveJsonCompatValue(input[1], options)
|
|
15205
|
-
];
|
|
15206
|
-
}
|
|
15207
|
-
throw new Error(
|
|
15208
|
-
`Unknown JSON encoding type: ${input[0]}. This may indicate corrupted data or a version mismatch.`
|
|
15209
|
-
);
|
|
15210
|
-
}
|
|
15211
|
-
return input.map((value) => reviveJsonCompatValue(value, options));
|
|
15212
|
-
}
|
|
15213
|
-
if (isPlainObject2(input)) {
|
|
15214
|
-
const decoded = {};
|
|
15215
|
-
for (const [key, value] of Object.entries(input)) {
|
|
15216
|
-
decoded[key] = reviveJsonCompatValue(value, options);
|
|
15217
|
-
}
|
|
15218
|
-
return decoded;
|
|
15219
|
-
}
|
|
15220
|
-
return input;
|
|
15221
|
-
}
|
|
15222
|
-
function base64DecodeToUint8Array(base643) {
|
|
15223
|
-
if (typeof Buffer !== "undefined") {
|
|
15224
|
-
return new Uint8Array(Buffer.from(base643, "base64"));
|
|
15225
|
-
}
|
|
15226
|
-
const binary = atob(base643);
|
|
15227
|
-
const bytes = new Uint8Array(binary.length);
|
|
15228
|
-
for (let i = 0; i < binary.length; i++) {
|
|
15229
|
-
bytes[i] = binary.charCodeAt(i);
|
|
15230
|
-
}
|
|
15231
|
-
return bytes;
|
|
15232
|
-
}
|
|
15233
|
-
function base64DecodeToArrayBuffer(base643) {
|
|
15234
|
-
return base64DecodeToUint8Array(base643).buffer;
|
|
15235
|
-
}
|
|
15236
|
-
function jsonStringifyCompat(input) {
|
|
15237
|
-
return JSON.stringify(input, (_key, value) => {
|
|
15238
|
-
if (typeof value === "bigint") {
|
|
15239
|
-
return [JSON_COMPAT_BIGINT, value.toString()];
|
|
15240
|
-
}
|
|
15241
|
-
if (value instanceof ArrayBuffer) {
|
|
15242
|
-
return [JSON_COMPAT_ARRAY_BUFFER, base64EncodeArrayBuffer(value)];
|
|
15243
|
-
}
|
|
15244
|
-
if (value instanceof Uint8Array) {
|
|
15245
|
-
return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(value)];
|
|
15246
|
-
}
|
|
15247
|
-
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && value[0].startsWith("$")) {
|
|
15248
|
-
return [`$${value[0]}`, value[1]];
|
|
15249
|
-
}
|
|
15250
|
-
return value;
|
|
15251
|
-
});
|
|
15252
|
-
}
|
|
15253
|
-
function jsonParseCompat(input) {
|
|
15254
|
-
return reviveJsonCompatValue(JSON.parse(input));
|
|
15255
|
-
}
|
|
15256
|
-
function uint8ArrayToBase642(uint8Array) {
|
|
15257
|
-
if (typeof Buffer !== "undefined") {
|
|
15258
|
-
return Buffer.from(uint8Array).toString("base64");
|
|
15259
|
-
}
|
|
15260
|
-
let binary = "";
|
|
15261
|
-
const len = uint8Array.byteLength;
|
|
15262
|
-
for (let i = 0; i < len; i++) {
|
|
15263
|
-
binary += String.fromCharCode(uint8Array[i]);
|
|
15264
|
-
}
|
|
15265
|
-
return btoa(binary);
|
|
15266
|
-
}
|
|
15267
|
-
function contentTypeForEncoding(encoding) {
|
|
15268
|
-
if (encoding === "json") {
|
|
15269
|
-
return "application/json";
|
|
15270
|
-
} else if (encoding === "cbor" || encoding === "bare") {
|
|
15271
|
-
return "application/octet-stream";
|
|
15272
|
-
} else {
|
|
15273
|
-
assertUnreachable(encoding);
|
|
15274
|
-
}
|
|
15275
|
-
}
|
|
15276
|
-
function encodeCborCompat(value) {
|
|
15277
|
-
return cbor.encode(encodeJsonCompatValue(value));
|
|
15278
|
-
}
|
|
15279
|
-
function decodeCborCompat(buffer) {
|
|
15280
|
-
return reviveJsonCompatValue(cbor.decode(buffer));
|
|
15281
|
-
}
|
|
15282
|
-
function serializeWithEncoding(encoding, value, versionedDataHandler, version2, zodSchema, toJson, toBare) {
|
|
15283
|
-
if (encoding === "json") {
|
|
15284
|
-
const jsonValue = toJson(value);
|
|
15285
|
-
const validated = zodSchema.parse(jsonValue);
|
|
15286
|
-
return jsonStringifyCompat(validated);
|
|
15287
|
-
} else if (encoding === "cbor") {
|
|
15288
|
-
const jsonValue = toJson(value);
|
|
15289
|
-
const validated = zodSchema.parse(jsonValue);
|
|
15290
|
-
return cbor.encode(validated);
|
|
15291
|
-
} else if (encoding === "bare") {
|
|
15292
|
-
if (!versionedDataHandler) {
|
|
15293
|
-
throw new Error(
|
|
15294
|
-
"VersionedDataHandler is required for 'bare' encoding"
|
|
15295
|
-
);
|
|
15296
|
-
}
|
|
15297
|
-
if (version2 === void 0) {
|
|
15298
|
-
throw new Error("version is required for 'bare' encoding");
|
|
15299
|
-
}
|
|
15300
|
-
const bareValue = toBare(value);
|
|
15301
|
-
return versionedDataHandler.serializeWithEmbeddedVersion(
|
|
15302
|
-
bareValue,
|
|
15303
|
-
version2
|
|
15304
|
-
);
|
|
15305
|
-
} else {
|
|
15306
|
-
assertUnreachable(encoding);
|
|
15307
|
-
}
|
|
15308
|
-
}
|
|
15309
|
-
function deserializeWithEncoding(encoding, buffer, versionedDataHandler, zodSchema, fromJson, fromBare) {
|
|
15310
|
-
if (encoding === "json") {
|
|
15311
|
-
let parsed;
|
|
15312
|
-
if (typeof buffer === "string") {
|
|
15313
|
-
parsed = jsonParseCompat(buffer);
|
|
15314
|
-
} else {
|
|
15315
|
-
const decoder = new TextDecoder("utf-8");
|
|
15316
|
-
const jsonString = decoder.decode(buffer);
|
|
15317
|
-
parsed = jsonParseCompat(jsonString);
|
|
15318
|
-
}
|
|
15319
|
-
const validated = zodSchema.parse(parsed);
|
|
15320
|
-
return fromJson(validated);
|
|
15321
|
-
} else if (encoding === "cbor") {
|
|
15322
|
-
(0, import_invariant.default)(
|
|
15323
|
-
typeof buffer !== "string",
|
|
15324
|
-
"buffer cannot be string for cbor encoding"
|
|
15325
|
-
);
|
|
15326
|
-
const decoded = decodeCborCompat(buffer);
|
|
15327
|
-
const validated = zodSchema.parse(decoded);
|
|
15328
|
-
return fromJson(validated);
|
|
15329
|
-
} else if (encoding === "bare") {
|
|
15330
|
-
(0, import_invariant.default)(
|
|
15331
|
-
typeof buffer !== "string",
|
|
15332
|
-
"buffer cannot be string for bare encoding"
|
|
15333
|
-
);
|
|
15334
|
-
if (!versionedDataHandler) {
|
|
15335
|
-
throw new Error(
|
|
15336
|
-
"VersionedDataHandler is required for 'bare' encoding"
|
|
15337
|
-
);
|
|
15338
|
-
}
|
|
15339
|
-
const bareValue = versionedDataHandler.deserializeWithEmbeddedVersion(buffer);
|
|
15340
|
-
return fromBare(bareValue);
|
|
15341
|
-
} else {
|
|
15342
|
-
assertUnreachable(encoding);
|
|
15343
|
-
}
|
|
15344
|
-
}
|
|
15345
15343
|
|
|
15346
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15344
|
+
// ../rivetkit/dist/tsup/chunk-7AFZMFPQ.js
|
|
15345
|
+
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
15347
15346
|
var AsyncMutex = class {
|
|
15348
15347
|
#locked = false;
|
|
15349
15348
|
#waiting = [];
|
|
@@ -15370,7 +15369,7 @@ var AsyncMutex = class {
|
|
|
15370
15369
|
}
|
|
15371
15370
|
};
|
|
15372
15371
|
|
|
15373
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15372
|
+
// ../rivetkit/dist/tsup/chunk-PAG6G46L.js
|
|
15374
15373
|
function logger() {
|
|
15375
15374
|
return getLogger("actor-client");
|
|
15376
15375
|
}
|
|
@@ -15408,7 +15407,7 @@ async function importWebSocket() {
|
|
|
15408
15407
|
return webSocketPromise;
|
|
15409
15408
|
}
|
|
15410
15409
|
|
|
15411
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15410
|
+
// ../rivetkit/dist/tsup/chunk-GAV4PKFT.js
|
|
15412
15411
|
var import_invariant2 = __toESM(require_invariant(), 1);
|
|
15413
15412
|
|
|
15414
15413
|
// ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
@@ -15586,7 +15585,7 @@ function createVersionedDataHandler(config3) {
|
|
|
15586
15585
|
return new VersionedDataHandler(config3);
|
|
15587
15586
|
}
|
|
15588
15587
|
|
|
15589
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15588
|
+
// ../rivetkit/dist/tsup/chunk-GAV4PKFT.js
|
|
15590
15589
|
var import_invariant3 = __toESM(require_invariant(), 1);
|
|
15591
15590
|
var import_invariant4 = __toESM(require_invariant(), 1);
|
|
15592
15591
|
var PATH_CONNECT = "/connect";
|
|
@@ -20415,13 +20414,6 @@ async function updateRunnerConfig(config3, runnerName, request) {
|
|
|
20415
20414
|
request
|
|
20416
20415
|
);
|
|
20417
20416
|
}
|
|
20418
|
-
async function kvGet(config3, actorId, key) {
|
|
20419
|
-
return apiCall(
|
|
20420
|
-
config3,
|
|
20421
|
-
"GET",
|
|
20422
|
-
`/actors/${encodeURIComponent(actorId)}/kv/keys/${encodeURIComponent(key)}`
|
|
20423
|
-
);
|
|
20424
|
-
}
|
|
20425
20417
|
function shouldSkipReadyWait(options = {}) {
|
|
20426
20418
|
return options.skipReadyWait === true;
|
|
20427
20419
|
}
|
|
@@ -21187,28 +21179,6 @@ var RemoteEngineControlClient = class {
|
|
|
21187
21179
|
const args = await createWebSocketProxy(c, wsGuardUrl, protocols);
|
|
21188
21180
|
return await upgradeWebSocket(() => args)(c, noopNext());
|
|
21189
21181
|
}
|
|
21190
|
-
async kvGet(actorId, key) {
|
|
21191
|
-
await this.#metadataPromise;
|
|
21192
|
-
logger2().debug({ msg: "getting kv value via engine api", key });
|
|
21193
|
-
const response = await kvGet(
|
|
21194
|
-
this.#config,
|
|
21195
|
-
actorId,
|
|
21196
|
-
new TextDecoder("utf8").decode(key)
|
|
21197
|
-
);
|
|
21198
|
-
return response.value;
|
|
21199
|
-
}
|
|
21200
|
-
async kvBatchGet(_actorId, _keys) {
|
|
21201
|
-
throw new Error("kvBatchGet not supported on remote engine client");
|
|
21202
|
-
}
|
|
21203
|
-
async kvBatchPut(_actorId, _entries) {
|
|
21204
|
-
throw new Error("kvBatchPut not supported on remote engine client");
|
|
21205
|
-
}
|
|
21206
|
-
async kvBatchDelete(_actorId, _keys) {
|
|
21207
|
-
throw new Error("kvBatchDelete not supported on remote engine client");
|
|
21208
|
-
}
|
|
21209
|
-
async kvDeleteRange(_actorId, _start, _end) {
|
|
21210
|
-
throw new Error("kvDeleteRange not supported on remote engine client");
|
|
21211
|
-
}
|
|
21212
21182
|
displayInformation() {
|
|
21213
21183
|
return { properties: {} };
|
|
21214
21184
|
}
|
|
@@ -22530,15 +22500,21 @@ var source_default = onChange;
|
|
|
22530
22500
|
function loggerWithoutContext() {
|
|
22531
22501
|
return getLogger("actor-runtime");
|
|
22532
22502
|
}
|
|
22533
|
-
var
|
|
22534
|
-
|
|
22503
|
+
var warnedDeprecatedOptionKeys = /* @__PURE__ */ new Set();
|
|
22504
|
+
var DEPRECATED_OPTION_MESSAGES = {
|
|
22505
|
+
onDestroyTimeout: "Configure `sleepGracePeriod` instead, which bounds the entire graceful shutdown window for both sleep and destroy.",
|
|
22506
|
+
waitUntilTimeout: "Configure `sleepGracePeriod` instead, which bounds the entire graceful shutdown window for both sleep and destroy.",
|
|
22507
|
+
preloadMaxWorkflowBytes: "Internal storage moved to SQLite and no longer uses KV preloading.",
|
|
22508
|
+
preloadMaxConnectionsBytes: "Internal storage moved to SQLite and no longer uses KV preloading."
|
|
22509
|
+
};
|
|
22510
|
+
function warnDeprecatedOptionKeys(options) {
|
|
22535
22511
|
if (!options || typeof options !== "object") return;
|
|
22536
22512
|
const opts = options;
|
|
22537
|
-
for (const key of
|
|
22538
|
-
if (opts[key] !== void 0 && !
|
|
22539
|
-
|
|
22513
|
+
for (const [key, detail] of Object.entries(DEPRECATED_OPTION_MESSAGES)) {
|
|
22514
|
+
if (opts[key] !== void 0 && !warnedDeprecatedOptionKeys.has(key)) {
|
|
22515
|
+
warnedDeprecatedOptionKeys.add(key);
|
|
22540
22516
|
loggerWithoutContext().warn({
|
|
22541
|
-
msg: `actor option \`${key}\` is deprecated and is now ignored.
|
|
22517
|
+
msg: `actor option \`${key}\` is deprecated and is now ignored. ${detail} Will be removed in 2.2.0.`
|
|
22542
22518
|
});
|
|
22543
22519
|
}
|
|
22544
22520
|
}
|
|
@@ -22556,7 +22532,7 @@ function isStaticActorInstance(_actor) {
|
|
|
22556
22532
|
return true;
|
|
22557
22533
|
}
|
|
22558
22534
|
function actor(input) {
|
|
22559
|
-
|
|
22535
|
+
warnDeprecatedOptionKeys(
|
|
22560
22536
|
input == null ? void 0 : input.options
|
|
22561
22537
|
);
|
|
22562
22538
|
const config3 = ActorConfigSchema.parse(input);
|
|
@@ -23261,31 +23237,6 @@ function buildActorNames(config3) {
|
|
|
23261
23237
|
const metadata = {};
|
|
23262
23238
|
metadata.icon = options.icon ?? runMeta.icon;
|
|
23263
23239
|
metadata.name = options.name ?? runMeta.name;
|
|
23264
|
-
metadata.preload = {
|
|
23265
|
-
keys: [
|
|
23266
|
-
Array.from(KEYS.PERSIST_DATA),
|
|
23267
|
-
Array.from(KEYS.INSPECTOR_TOKEN),
|
|
23268
|
-
Array.from(queueMetadataKey()),
|
|
23269
|
-
Array.from(KEYS.LAST_PUSHED_ALARM)
|
|
23270
|
-
],
|
|
23271
|
-
prefixes: [
|
|
23272
|
-
{
|
|
23273
|
-
prefix: Array.from(workflowStoragePrefix()),
|
|
23274
|
-
maxBytes: options.preloadMaxWorkflowBytes ?? 131072,
|
|
23275
|
-
partial: false
|
|
23276
|
-
},
|
|
23277
|
-
{
|
|
23278
|
-
prefix: Array.from(KEYS.CONN_PREFIX),
|
|
23279
|
-
maxBytes: options.preloadMaxConnectionsBytes ?? 65536,
|
|
23280
|
-
partial: false
|
|
23281
|
-
},
|
|
23282
|
-
{
|
|
23283
|
-
prefix: Array.from(queueMessagesPrefix()),
|
|
23284
|
-
maxBytes: 65536,
|
|
23285
|
-
partial: false
|
|
23286
|
-
}
|
|
23287
|
-
]
|
|
23288
|
-
};
|
|
23289
23240
|
if (!metadata.icon) delete metadata.icon;
|
|
23290
23241
|
if (!metadata.name) delete metadata.name;
|
|
23291
23242
|
return [actorName, { metadata }];
|
|
@@ -23473,6 +23424,12 @@ function toNativeBindings(sql, params) {
|
|
|
23473
23424
|
return toNativeBinding(value);
|
|
23474
23425
|
});
|
|
23475
23426
|
}
|
|
23427
|
+
function toNativeBatchStatement(statement) {
|
|
23428
|
+
return {
|
|
23429
|
+
sql: statement.sql,
|
|
23430
|
+
params: toNativeBindings(statement.sql, statement.params)
|
|
23431
|
+
};
|
|
23432
|
+
}
|
|
23476
23433
|
function normalizeNativeMetrics(metrics) {
|
|
23477
23434
|
if (!metrics) return null;
|
|
23478
23435
|
const raw = metrics;
|
|
@@ -23586,6 +23543,60 @@ function wrapJsNativeDatabase(database) {
|
|
|
23586
23543
|
async execute(sql, params) {
|
|
23587
23544
|
return await executeNative(sql, params);
|
|
23588
23545
|
},
|
|
23546
|
+
async executeBatch(statements) {
|
|
23547
|
+
const nativeStatements = statements.map(toNativeBatchStatement);
|
|
23548
|
+
const release = gate.enter();
|
|
23549
|
+
let transaction;
|
|
23550
|
+
try {
|
|
23551
|
+
const results = database.executeBatch ? await database.executeBatch(nativeStatements) : await (async () => {
|
|
23552
|
+
transaction = await database.beginTransaction();
|
|
23553
|
+
const transactionResults = [];
|
|
23554
|
+
for (const statement of nativeStatements) {
|
|
23555
|
+
transactionResults.push(
|
|
23556
|
+
await transaction.execute(
|
|
23557
|
+
statement.sql,
|
|
23558
|
+
statement.params
|
|
23559
|
+
)
|
|
23560
|
+
);
|
|
23561
|
+
}
|
|
23562
|
+
await transaction.commit();
|
|
23563
|
+
transaction = void 0;
|
|
23564
|
+
return transactionResults;
|
|
23565
|
+
})();
|
|
23566
|
+
for (const result of results) {
|
|
23567
|
+
if (result.lastInsertRowId !== void 0) {
|
|
23568
|
+
lastInsertRowId = result.lastInsertRowId;
|
|
23569
|
+
}
|
|
23570
|
+
}
|
|
23571
|
+
return results;
|
|
23572
|
+
} catch (error46) {
|
|
23573
|
+
if (transaction) {
|
|
23574
|
+
try {
|
|
23575
|
+
await transaction.rollback();
|
|
23576
|
+
} catch {
|
|
23577
|
+
}
|
|
23578
|
+
}
|
|
23579
|
+
enrichNativeDatabaseError(database, error46);
|
|
23580
|
+
} finally {
|
|
23581
|
+
release();
|
|
23582
|
+
}
|
|
23583
|
+
},
|
|
23584
|
+
async beginTransaction(timeoutMs) {
|
|
23585
|
+
const release = gate.enter();
|
|
23586
|
+
let transaction;
|
|
23587
|
+
try {
|
|
23588
|
+
transaction = await database.beginTransaction(timeoutMs);
|
|
23589
|
+
} catch (error46) {
|
|
23590
|
+
enrichNativeDatabaseError(database, error46);
|
|
23591
|
+
} finally {
|
|
23592
|
+
release();
|
|
23593
|
+
}
|
|
23594
|
+
return wrapTransaction(database, transaction, gate, (result) => {
|
|
23595
|
+
if (result.lastInsertRowId !== void 0) {
|
|
23596
|
+
lastInsertRowId = result.lastInsertRowId;
|
|
23597
|
+
}
|
|
23598
|
+
});
|
|
23599
|
+
},
|
|
23589
23600
|
async run(sql, params) {
|
|
23590
23601
|
await executeNative(sql, params);
|
|
23591
23602
|
},
|
|
@@ -23603,6 +23614,59 @@ function wrapJsNativeDatabase(database) {
|
|
|
23603
23614
|
}
|
|
23604
23615
|
};
|
|
23605
23616
|
}
|
|
23617
|
+
function wrapTransaction(database, transaction, gate, onExecute) {
|
|
23618
|
+
return {
|
|
23619
|
+
async exec(sql, callback) {
|
|
23620
|
+
const release = gate.enter();
|
|
23621
|
+
let result;
|
|
23622
|
+
try {
|
|
23623
|
+
result = await transaction.exec(sql);
|
|
23624
|
+
} catch (error46) {
|
|
23625
|
+
enrichNativeDatabaseError(database, error46);
|
|
23626
|
+
} finally {
|
|
23627
|
+
release();
|
|
23628
|
+
}
|
|
23629
|
+
if (callback) {
|
|
23630
|
+
for (const row of result.rows) callback(row, result.columns);
|
|
23631
|
+
}
|
|
23632
|
+
},
|
|
23633
|
+
async execute(sql, params) {
|
|
23634
|
+
const release = gate.enter();
|
|
23635
|
+
try {
|
|
23636
|
+
const result = await transaction.execute(
|
|
23637
|
+
sql,
|
|
23638
|
+
toNativeBindings(sql, params)
|
|
23639
|
+
);
|
|
23640
|
+
onExecute(result);
|
|
23641
|
+
return result;
|
|
23642
|
+
} catch (error46) {
|
|
23643
|
+
enrichNativeDatabaseError(database, error46);
|
|
23644
|
+
} finally {
|
|
23645
|
+
release();
|
|
23646
|
+
}
|
|
23647
|
+
},
|
|
23648
|
+
async commit() {
|
|
23649
|
+
const release = gate.enter();
|
|
23650
|
+
try {
|
|
23651
|
+
await transaction.commit();
|
|
23652
|
+
} catch (error46) {
|
|
23653
|
+
enrichNativeDatabaseError(database, error46);
|
|
23654
|
+
} finally {
|
|
23655
|
+
release();
|
|
23656
|
+
}
|
|
23657
|
+
},
|
|
23658
|
+
async rollback() {
|
|
23659
|
+
const release = gate.enter();
|
|
23660
|
+
try {
|
|
23661
|
+
await transaction.rollback();
|
|
23662
|
+
} catch (error46) {
|
|
23663
|
+
enrichNativeDatabaseError(database, error46);
|
|
23664
|
+
} finally {
|
|
23665
|
+
release();
|
|
23666
|
+
}
|
|
23667
|
+
}
|
|
23668
|
+
};
|
|
23669
|
+
}
|
|
23606
23670
|
function lastInsertRowIdColumnName(sql) {
|
|
23607
23671
|
const match = sql.match(
|
|
23608
23672
|
/^\s*SELECT\s+last_insert_rowid\s*\(\s*\)\s*(?:AS\s+("[^"]+"|`[^`]+`|\[[^\]]+\]|\w+))?\s*;?\s*$/i
|
|
@@ -23710,6 +23774,9 @@ function asNativeConn(handle) {
|
|
|
23710
23774
|
function asNativeWebSocket(handle) {
|
|
23711
23775
|
return handle;
|
|
23712
23776
|
}
|
|
23777
|
+
function asNativeSqlTransaction(handle) {
|
|
23778
|
+
return handle;
|
|
23779
|
+
}
|
|
23713
23780
|
function asNativeCancellationToken(handle) {
|
|
23714
23781
|
return handle;
|
|
23715
23782
|
}
|
|
@@ -23739,6 +23806,12 @@ function toNapiSqlBindParams(params) {
|
|
|
23739
23806
|
}
|
|
23740
23807
|
return params.map((param) => toNapiSqlBindParam(param));
|
|
23741
23808
|
}
|
|
23809
|
+
function toNapiSqlBatchStatement(statement) {
|
|
23810
|
+
return {
|
|
23811
|
+
sql: statement.sql,
|
|
23812
|
+
params: toNapiSqlBindParams(statement.params) ?? void 0
|
|
23813
|
+
};
|
|
23814
|
+
}
|
|
23742
23815
|
function toNapiBuffer(value) {
|
|
23743
23816
|
return Buffer.from(value);
|
|
23744
23817
|
}
|
|
@@ -23862,11 +23935,16 @@ var NapiCoreRuntime = class {
|
|
|
23862
23935
|
createCancellationToken() {
|
|
23863
23936
|
return new this.#bindings.CancellationToken();
|
|
23864
23937
|
}
|
|
23865
|
-
|
|
23866
|
-
return
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23938
|
+
decodeInspectorRequest(bytes, advertisedVersion) {
|
|
23939
|
+
return this.#bindings.decodeInspectorRequest(
|
|
23940
|
+
toNapiBuffer(bytes),
|
|
23941
|
+
advertisedVersion
|
|
23942
|
+
);
|
|
23943
|
+
}
|
|
23944
|
+
encodeInspectorResponse(bytes, targetVersion) {
|
|
23945
|
+
return this.#bindings.encodeInspectorResponse(
|
|
23946
|
+
toNapiBuffer(bytes),
|
|
23947
|
+
targetVersion
|
|
23870
23948
|
);
|
|
23871
23949
|
}
|
|
23872
23950
|
cancellationTokenAborted(token) {
|
|
@@ -23930,6 +24008,14 @@ var NapiCoreRuntime = class {
|
|
|
23930
24008
|
toNapiStateDeltaPayload(payload)
|
|
23931
24009
|
);
|
|
23932
24010
|
}
|
|
24011
|
+
async actorSaveStateAndWorkflowBatch(ctx, writes) {
|
|
24012
|
+
await asNativeActorContext(ctx).saveStateAndWorkflowBatch(
|
|
24013
|
+
writes.map((write) => ({
|
|
24014
|
+
key: toNapiBuffer(write.key),
|
|
24015
|
+
value: toNapiBuffer(write.value)
|
|
24016
|
+
}))
|
|
24017
|
+
);
|
|
24018
|
+
}
|
|
23933
24019
|
actorId(ctx) {
|
|
23934
24020
|
return asNativeActorContext(ctx).actorId();
|
|
23935
24021
|
}
|
|
@@ -24036,6 +24122,33 @@ var NapiCoreRuntime = class {
|
|
|
24036
24122
|
);
|
|
24037
24123
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
24038
24124
|
}
|
|
24125
|
+
async actorSqlExecuteBatch(ctx, statements) {
|
|
24126
|
+
const results = await this.#actorSql(ctx).executeBatch(
|
|
24127
|
+
statements.map(toNapiSqlBatchStatement)
|
|
24128
|
+
);
|
|
24129
|
+
return results.map(normalizeRuntimeSqlExecuteResult);
|
|
24130
|
+
}
|
|
24131
|
+
async actorSqlBeginTransaction(ctx, timeoutMs) {
|
|
24132
|
+
return await this.#actorSql(ctx).beginTransaction(
|
|
24133
|
+
timeoutMs
|
|
24134
|
+
);
|
|
24135
|
+
}
|
|
24136
|
+
async actorSqlTransactionExec(transaction, sql) {
|
|
24137
|
+
return await asNativeSqlTransaction(transaction).exec(sql);
|
|
24138
|
+
}
|
|
24139
|
+
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
24140
|
+
const result = await asNativeSqlTransaction(transaction).execute(
|
|
24141
|
+
sql,
|
|
24142
|
+
toNapiSqlBindParams(params)
|
|
24143
|
+
);
|
|
24144
|
+
return normalizeRuntimeSqlExecuteResult(result);
|
|
24145
|
+
}
|
|
24146
|
+
async actorSqlTransactionCommit(transaction) {
|
|
24147
|
+
await asNativeSqlTransaction(transaction).commit();
|
|
24148
|
+
}
|
|
24149
|
+
async actorSqlTransactionRollback(transaction) {
|
|
24150
|
+
await asNativeSqlTransaction(transaction).rollback();
|
|
24151
|
+
}
|
|
24039
24152
|
async actorSqlQuery(ctx, sql, params) {
|
|
24040
24153
|
return await this.#actorSql(ctx).query(
|
|
24041
24154
|
sql,
|
|
@@ -24062,6 +24175,9 @@ var NapiCoreRuntime = class {
|
|
|
24062
24175
|
this.#sql.delete(nativeCtx);
|
|
24063
24176
|
await database.close();
|
|
24064
24177
|
}
|
|
24178
|
+
async actorRuntimeSocketProvision(ctx) {
|
|
24179
|
+
return await asNativeActorContext(ctx).provisionActorRuntimeSocket();
|
|
24180
|
+
}
|
|
24065
24181
|
async actorQueueSend(ctx, name, body) {
|
|
24066
24182
|
return toNapiQueueMessage(
|
|
24067
24183
|
await asNativeActorContext(ctx).queue().send(name, toNapiBuffer(body))
|
|
@@ -24110,11 +24226,51 @@ var NapiCoreRuntime = class {
|
|
|
24110
24226
|
async actorQueueReset(ctx) {
|
|
24111
24227
|
await asNativeActorContext(ctx).queue().reset();
|
|
24112
24228
|
}
|
|
24113
|
-
actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
24114
|
-
asNativeActorContext(ctx).schedule().after(durationMs, actionName, toNapiBuffer(args));
|
|
24229
|
+
async actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
24230
|
+
return await asNativeActorContext(ctx).schedule().after(durationMs, actionName, toNapiBuffer(args));
|
|
24231
|
+
}
|
|
24232
|
+
async actorScheduleAt(ctx, timestampMs, actionName, args) {
|
|
24233
|
+
return await asNativeActorContext(ctx).schedule().at(timestampMs, actionName, toNapiBuffer(args));
|
|
24234
|
+
}
|
|
24235
|
+
async actorScheduleCancel(ctx, id) {
|
|
24236
|
+
return await asNativeActorContext(ctx).schedule().cancel(id);
|
|
24237
|
+
}
|
|
24238
|
+
async actorScheduleGet(ctx, id) {
|
|
24239
|
+
return await asNativeActorContext(ctx).schedule().get(id) ?? void 0;
|
|
24240
|
+
}
|
|
24241
|
+
async actorScheduleList(ctx) {
|
|
24242
|
+
return await asNativeActorContext(ctx).schedule().list();
|
|
24243
|
+
}
|
|
24244
|
+
async actorCronSet(ctx, name, expression, timezone, actionName, args, maxHistory) {
|
|
24245
|
+
await asNativeActorContext(ctx).schedule().cronSet(
|
|
24246
|
+
name,
|
|
24247
|
+
expression,
|
|
24248
|
+
timezone,
|
|
24249
|
+
actionName,
|
|
24250
|
+
toNapiBuffer(args),
|
|
24251
|
+
maxHistory
|
|
24252
|
+
);
|
|
24253
|
+
}
|
|
24254
|
+
async actorCronEvery(ctx, name, intervalMs, actionName, args, maxHistory) {
|
|
24255
|
+
await asNativeActorContext(ctx).schedule().cronEvery(
|
|
24256
|
+
name,
|
|
24257
|
+
intervalMs,
|
|
24258
|
+
actionName,
|
|
24259
|
+
toNapiBuffer(args),
|
|
24260
|
+
maxHistory
|
|
24261
|
+
);
|
|
24262
|
+
}
|
|
24263
|
+
async actorCronGet(ctx, name) {
|
|
24264
|
+
return await asNativeActorContext(ctx).schedule().cronGet(name) ?? void 0;
|
|
24115
24265
|
}
|
|
24116
|
-
|
|
24117
|
-
asNativeActorContext(ctx).schedule().
|
|
24266
|
+
async actorCronList(ctx) {
|
|
24267
|
+
return await asNativeActorContext(ctx).schedule().cronList();
|
|
24268
|
+
}
|
|
24269
|
+
async actorCronDelete(ctx, name) {
|
|
24270
|
+
return await asNativeActorContext(ctx).schedule().cronDelete(name);
|
|
24271
|
+
}
|
|
24272
|
+
async actorCronHistory(ctx, name, limit) {
|
|
24273
|
+
return await asNativeActorContext(ctx).schedule().cronHistory(name, limit);
|
|
24118
24274
|
}
|
|
24119
24275
|
connId(conn) {
|
|
24120
24276
|
return asNativeConn(conn).id();
|
|
@@ -24517,6 +24673,13 @@ var WasmCoreRuntime = class {
|
|
|
24517
24673
|
async actorSaveState(ctx, payload) {
|
|
24518
24674
|
await callHandleAsync(asWasmActorContext(ctx), "saveState", payload);
|
|
24519
24675
|
}
|
|
24676
|
+
async actorSaveStateAndWorkflowBatch(ctx, writes) {
|
|
24677
|
+
await callHandleAsync(
|
|
24678
|
+
asWasmActorContext(ctx),
|
|
24679
|
+
"saveStateAndWorkflowBatch",
|
|
24680
|
+
writes
|
|
24681
|
+
);
|
|
24682
|
+
}
|
|
24520
24683
|
actorId(ctx) {
|
|
24521
24684
|
return callHandle(asWasmActorContext(ctx), "actorId");
|
|
24522
24685
|
}
|
|
@@ -24663,6 +24826,38 @@ var WasmCoreRuntime = class {
|
|
|
24663
24826
|
);
|
|
24664
24827
|
return normalizeRuntimeSqlExecuteResult(result);
|
|
24665
24828
|
}
|
|
24829
|
+
async actorSqlExecuteBatch(ctx, statements) {
|
|
24830
|
+
const results = await callWasm(
|
|
24831
|
+
() => this.#actorSql(ctx).executeBatch(statements)
|
|
24832
|
+
);
|
|
24833
|
+
return results.map(normalizeRuntimeSqlExecuteResult);
|
|
24834
|
+
}
|
|
24835
|
+
async actorSqlBeginTransaction(ctx, timeoutMs) {
|
|
24836
|
+
return await callWasm(
|
|
24837
|
+
() => this.#actorSql(ctx).beginTransaction(timeoutMs)
|
|
24838
|
+
);
|
|
24839
|
+
}
|
|
24840
|
+
async actorSqlTransactionExec(transaction, sql) {
|
|
24841
|
+
return await callWasm(
|
|
24842
|
+
() => transaction.exec(sql)
|
|
24843
|
+
);
|
|
24844
|
+
}
|
|
24845
|
+
async actorSqlTransactionExecute(transaction, sql, params) {
|
|
24846
|
+
const result = await callWasm(
|
|
24847
|
+
() => transaction.execute(sql, params)
|
|
24848
|
+
);
|
|
24849
|
+
return normalizeRuntimeSqlExecuteResult(result);
|
|
24850
|
+
}
|
|
24851
|
+
async actorSqlTransactionCommit(transaction) {
|
|
24852
|
+
await callWasm(
|
|
24853
|
+
() => transaction.commit()
|
|
24854
|
+
);
|
|
24855
|
+
}
|
|
24856
|
+
async actorSqlTransactionRollback(transaction) {
|
|
24857
|
+
await callWasm(
|
|
24858
|
+
() => transaction.rollback()
|
|
24859
|
+
);
|
|
24860
|
+
}
|
|
24666
24861
|
async actorSqlQuery(ctx, sql, params) {
|
|
24667
24862
|
return await callWasm(() => this.#actorSql(ctx).query(sql, params));
|
|
24668
24863
|
}
|
|
@@ -24686,6 +24881,17 @@ var WasmCoreRuntime = class {
|
|
|
24686
24881
|
this.#sql.delete(wasmCtx);
|
|
24687
24882
|
await callWasm(() => database.close());
|
|
24688
24883
|
}
|
|
24884
|
+
async actorRuntimeSocketProvision(_ctx) {
|
|
24885
|
+
throw new RivetError(
|
|
24886
|
+
"actor_runtime_socket",
|
|
24887
|
+
"unsupported",
|
|
24888
|
+
"Actor Runtime Socket is only available on Unix native runtimes.",
|
|
24889
|
+
{
|
|
24890
|
+
public: true,
|
|
24891
|
+
metadata: { runtime: "wasm" }
|
|
24892
|
+
}
|
|
24893
|
+
);
|
|
24894
|
+
}
|
|
24689
24895
|
async actorQueueSend(ctx, name, body) {
|
|
24690
24896
|
const queue2 = childHandle(asWasmActorContext(ctx), "queue");
|
|
24691
24897
|
return normalizeQueueMessage(
|
|
@@ -24757,13 +24963,97 @@ var WasmCoreRuntime = class {
|
|
|
24757
24963
|
const queue2 = childHandle(asWasmActorContext(ctx), "queue");
|
|
24758
24964
|
await callHandleAsync(queue2, "reset");
|
|
24759
24965
|
}
|
|
24760
|
-
actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
24966
|
+
async actorScheduleAfter(ctx, durationMs, actionName, args) {
|
|
24967
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
24968
|
+
return await callHandleAsync(
|
|
24969
|
+
schedule,
|
|
24970
|
+
"after",
|
|
24971
|
+
wasmNumber(durationMs),
|
|
24972
|
+
actionName,
|
|
24973
|
+
args
|
|
24974
|
+
);
|
|
24975
|
+
}
|
|
24976
|
+
async actorScheduleAt(ctx, timestampMs, actionName, args) {
|
|
24977
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
24978
|
+
return await callHandleAsync(
|
|
24979
|
+
schedule,
|
|
24980
|
+
"at",
|
|
24981
|
+
wasmNumber(timestampMs),
|
|
24982
|
+
actionName,
|
|
24983
|
+
args
|
|
24984
|
+
);
|
|
24985
|
+
}
|
|
24986
|
+
async actorScheduleCancel(ctx, id) {
|
|
24987
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
24988
|
+
return await callHandleAsync(schedule, "cancel", id);
|
|
24989
|
+
}
|
|
24990
|
+
async actorScheduleGet(ctx, id) {
|
|
24991
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
24992
|
+
return await callHandleAsync(
|
|
24993
|
+
schedule,
|
|
24994
|
+
"get",
|
|
24995
|
+
id
|
|
24996
|
+
);
|
|
24997
|
+
}
|
|
24998
|
+
async actorScheduleList(ctx) {
|
|
24999
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
25000
|
+
return await callHandleAsync(
|
|
25001
|
+
schedule,
|
|
25002
|
+
"list"
|
|
25003
|
+
);
|
|
25004
|
+
}
|
|
25005
|
+
async actorCronSet(ctx, name, expression, timezone, actionName, args, maxHistory) {
|
|
25006
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
25007
|
+
await callHandleAsync(
|
|
25008
|
+
schedule,
|
|
25009
|
+
"cronSet",
|
|
25010
|
+
name,
|
|
25011
|
+
expression,
|
|
25012
|
+
timezone,
|
|
25013
|
+
actionName,
|
|
25014
|
+
args,
|
|
25015
|
+
maxHistory
|
|
25016
|
+
);
|
|
25017
|
+
}
|
|
25018
|
+
async actorCronEvery(ctx, name, intervalMs, actionName, args, maxHistory) {
|
|
25019
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
25020
|
+
await callHandleAsync(
|
|
25021
|
+
schedule,
|
|
25022
|
+
"cronEvery",
|
|
25023
|
+
name,
|
|
25024
|
+
intervalMs,
|
|
25025
|
+
actionName,
|
|
25026
|
+
args,
|
|
25027
|
+
maxHistory
|
|
25028
|
+
);
|
|
25029
|
+
}
|
|
25030
|
+
async actorCronGet(ctx, name) {
|
|
25031
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
25032
|
+
return await callHandleAsync(
|
|
25033
|
+
schedule,
|
|
25034
|
+
"cronGet",
|
|
25035
|
+
name
|
|
25036
|
+
);
|
|
25037
|
+
}
|
|
25038
|
+
async actorCronList(ctx) {
|
|
24761
25039
|
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
24762
|
-
|
|
25040
|
+
return await callHandleAsync(
|
|
25041
|
+
schedule,
|
|
25042
|
+
"cronList"
|
|
25043
|
+
);
|
|
25044
|
+
}
|
|
25045
|
+
async actorCronDelete(ctx, name) {
|
|
25046
|
+
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
25047
|
+
return await callHandleAsync(schedule, "cronDelete", name);
|
|
24763
25048
|
}
|
|
24764
|
-
|
|
25049
|
+
async actorCronHistory(ctx, name, limit) {
|
|
24765
25050
|
const schedule = childHandle(asWasmActorContext(ctx), "schedule");
|
|
24766
|
-
|
|
25051
|
+
return await callHandleAsync(
|
|
25052
|
+
schedule,
|
|
25053
|
+
"cronHistory",
|
|
25054
|
+
name,
|
|
25055
|
+
limit
|
|
25056
|
+
);
|
|
24767
25057
|
}
|
|
24768
25058
|
connId(conn) {
|
|
24769
25059
|
return callHandle(asWasmConn(conn), "id");
|
|
@@ -25098,6 +25388,23 @@ function getOrCreateNativeSqlDatabase(runtime, ctx) {
|
|
|
25098
25388
|
const database = wrapJsNativeDatabase({
|
|
25099
25389
|
exec: (sql) => runtime.actorSqlExec(ctx, sql),
|
|
25100
25390
|
execute: (sql, params) => runtime.actorSqlExecute(ctx, sql, params),
|
|
25391
|
+
executeBatch: (statements) => runtime.actorSqlExecuteBatch(ctx, statements),
|
|
25392
|
+
beginTransaction: async (timeoutMs) => {
|
|
25393
|
+
const transaction = await runtime.actorSqlBeginTransaction(
|
|
25394
|
+
ctx,
|
|
25395
|
+
timeoutMs
|
|
25396
|
+
);
|
|
25397
|
+
return {
|
|
25398
|
+
exec: (sql) => runtime.actorSqlTransactionExec(transaction, sql),
|
|
25399
|
+
execute: (sql, params) => runtime.actorSqlTransactionExecute(
|
|
25400
|
+
transaction,
|
|
25401
|
+
sql,
|
|
25402
|
+
params
|
|
25403
|
+
),
|
|
25404
|
+
commit: () => runtime.actorSqlTransactionCommit(transaction),
|
|
25405
|
+
rollback: () => runtime.actorSqlTransactionRollback(transaction)
|
|
25406
|
+
};
|
|
25407
|
+
},
|
|
25101
25408
|
query: (sql, params) => runtime.actorSqlQuery(ctx, sql, params),
|
|
25102
25409
|
run: (sql, params) => runtime.actorSqlRun(ctx, sql, params),
|
|
25103
25410
|
metrics: () => runtime.actorSqlMetrics(ctx),
|
|
@@ -25591,26 +25898,116 @@ var NativeScheduleAdapter = class {
|
|
|
25591
25898
|
this.#ctx = ctx;
|
|
25592
25899
|
}
|
|
25593
25900
|
async after(duration3, action, ...args) {
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
-
encodeValue(args)
|
|
25600
|
-
)
|
|
25901
|
+
return await this.#runtime.actorScheduleAfter(
|
|
25902
|
+
this.#ctx,
|
|
25903
|
+
duration3,
|
|
25904
|
+
action,
|
|
25905
|
+
encodeValue(args)
|
|
25601
25906
|
);
|
|
25602
25907
|
}
|
|
25603
25908
|
async at(timestamp, action, ...args) {
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25909
|
+
return await this.#runtime.actorScheduleAt(
|
|
25910
|
+
this.#ctx,
|
|
25911
|
+
timestamp,
|
|
25912
|
+
action,
|
|
25913
|
+
encodeValue(args)
|
|
25914
|
+
);
|
|
25915
|
+
}
|
|
25916
|
+
async cancel(id) {
|
|
25917
|
+
return await this.#runtime.actorScheduleCancel(this.#ctx, id);
|
|
25918
|
+
}
|
|
25919
|
+
async get(id) {
|
|
25920
|
+
const event2 = await this.#runtime.actorScheduleGet(this.#ctx, id);
|
|
25921
|
+
return event2 ? decodeScheduledEventInfo(event2) : void 0;
|
|
25922
|
+
}
|
|
25923
|
+
async list() {
|
|
25924
|
+
return (await this.#runtime.actorScheduleList(this.#ctx)).map(
|
|
25925
|
+
decodeScheduledEventInfo
|
|
25926
|
+
);
|
|
25927
|
+
}
|
|
25928
|
+
};
|
|
25929
|
+
var NativeCronAdapter = class {
|
|
25930
|
+
#runtime;
|
|
25931
|
+
#ctx;
|
|
25932
|
+
constructor(runtime, ctx) {
|
|
25933
|
+
this.#runtime = runtime;
|
|
25934
|
+
this.#ctx = ctx;
|
|
25935
|
+
}
|
|
25936
|
+
async set(options) {
|
|
25937
|
+
await this.#runtime.actorCronSet(
|
|
25938
|
+
this.#ctx,
|
|
25939
|
+
options.name,
|
|
25940
|
+
options.expression,
|
|
25941
|
+
options.timezone,
|
|
25942
|
+
options.action,
|
|
25943
|
+
encodeValue(options.args ?? []),
|
|
25944
|
+
options.maxHistory
|
|
25945
|
+
);
|
|
25946
|
+
}
|
|
25947
|
+
async every(options) {
|
|
25948
|
+
await this.#runtime.actorCronEvery(
|
|
25949
|
+
this.#ctx,
|
|
25950
|
+
options.name,
|
|
25951
|
+
options.interval,
|
|
25952
|
+
options.action,
|
|
25953
|
+
encodeValue(options.args ?? []),
|
|
25954
|
+
options.maxHistory
|
|
25955
|
+
);
|
|
25956
|
+
}
|
|
25957
|
+
async get(name) {
|
|
25958
|
+
const job = await this.#runtime.actorCronGet(this.#ctx, name);
|
|
25959
|
+
return job ? decodeCronJobInfo(job) : void 0;
|
|
25960
|
+
}
|
|
25961
|
+
async list() {
|
|
25962
|
+
return (await this.#runtime.actorCronList(this.#ctx)).map(
|
|
25963
|
+
decodeCronJobInfo
|
|
25611
25964
|
);
|
|
25612
25965
|
}
|
|
25966
|
+
async delete(name) {
|
|
25967
|
+
return await this.#runtime.actorCronDelete(this.#ctx, name);
|
|
25968
|
+
}
|
|
25969
|
+
async history(name, options) {
|
|
25970
|
+
return (await this.#runtime.actorCronHistory(
|
|
25971
|
+
this.#ctx,
|
|
25972
|
+
name,
|
|
25973
|
+
options == null ? void 0 : options.limit
|
|
25974
|
+
)).map(decodeCronFire);
|
|
25975
|
+
}
|
|
25613
25976
|
};
|
|
25977
|
+
function decodeScheduledEventInfo(event2) {
|
|
25978
|
+
return {
|
|
25979
|
+
id: event2.id,
|
|
25980
|
+
action: event2.action,
|
|
25981
|
+
args: decodeArgs(event2.args),
|
|
25982
|
+
runAt: event2.runAt
|
|
25983
|
+
};
|
|
25984
|
+
}
|
|
25985
|
+
function decodeCronJobInfo(job) {
|
|
25986
|
+
const base = {
|
|
25987
|
+
name: job.name,
|
|
25988
|
+
action: job.action,
|
|
25989
|
+
args: decodeArgs(job.args),
|
|
25990
|
+
nextRunAt: job.nextRunAt,
|
|
25991
|
+
lastRunAt: job.lastRunAt,
|
|
25992
|
+
maxHistory: job.maxHistory
|
|
25993
|
+
};
|
|
25994
|
+
if (job.kind === "cron") {
|
|
25995
|
+
return {
|
|
25996
|
+
...base,
|
|
25997
|
+
kind: "cron",
|
|
25998
|
+
expression: job.expression,
|
|
25999
|
+
timezone: job.timezone
|
|
26000
|
+
};
|
|
26001
|
+
}
|
|
26002
|
+
return {
|
|
26003
|
+
...base,
|
|
26004
|
+
kind: "every",
|
|
26005
|
+
interval: job.intervalMs
|
|
26006
|
+
};
|
|
26007
|
+
}
|
|
26008
|
+
function decodeCronFire(fire) {
|
|
26009
|
+
return { ...fire };
|
|
26010
|
+
}
|
|
25614
26011
|
var NativeKvAdapter = class {
|
|
25615
26012
|
#runtime;
|
|
25616
26013
|
#ctx;
|
|
@@ -26391,6 +26788,7 @@ var ActorContextHandleAdapter = class {
|
|
|
26391
26788
|
#client;
|
|
26392
26789
|
#clientFactory;
|
|
26393
26790
|
#connMap;
|
|
26791
|
+
#cron;
|
|
26394
26792
|
#databaseProvider;
|
|
26395
26793
|
#db;
|
|
26396
26794
|
#dispatchCancelToken;
|
|
@@ -26431,6 +26829,11 @@ var ActorContextHandleAdapter = class {
|
|
|
26431
26829
|
}
|
|
26432
26830
|
return this.#sql;
|
|
26433
26831
|
}
|
|
26832
|
+
async actorRuntimeSocket() {
|
|
26833
|
+
return await callNative(
|
|
26834
|
+
() => this.#runtime.actorRuntimeSocketProvision(this.#ctx)
|
|
26835
|
+
);
|
|
26836
|
+
}
|
|
26434
26837
|
get db() {
|
|
26435
26838
|
if (!this.#databaseProvider) {
|
|
26436
26839
|
throw databaseNotConfiguredError();
|
|
@@ -26520,6 +26923,12 @@ var ActorContextHandleAdapter = class {
|
|
|
26520
26923
|
}
|
|
26521
26924
|
return this.#schedule;
|
|
26522
26925
|
}
|
|
26926
|
+
get cron() {
|
|
26927
|
+
if (!this.#cron) {
|
|
26928
|
+
this.#cron = new NativeCronAdapter(this.#runtime, this.#ctx);
|
|
26929
|
+
}
|
|
26930
|
+
return this.#cron;
|
|
26931
|
+
}
|
|
26523
26932
|
get actorId() {
|
|
26524
26933
|
return callNativeSync(() => this.#runtime.actorId(this.#ctx));
|
|
26525
26934
|
}
|
|
@@ -26704,6 +27113,11 @@ var ActorContextHandleAdapter = class {
|
|
|
26704
27113
|
() => this.#runtime.actorRequestSave(this.#ctx, { immediate: false })
|
|
26705
27114
|
);
|
|
26706
27115
|
}
|
|
27116
|
+
async saveStateAndWorkflowBatch(writes) {
|
|
27117
|
+
await callNative(
|
|
27118
|
+
() => this.#runtime.actorSaveStateAndWorkflowBatch(this.#ctx, writes)
|
|
27119
|
+
);
|
|
27120
|
+
}
|
|
26707
27121
|
serializeForTick(reason) {
|
|
26708
27122
|
void reason;
|
|
26709
27123
|
const actorState = getNativePersistState(this.#runtime, this.#ctx);
|
|
@@ -27018,6 +27432,9 @@ var NativeWorkflowRuntimeAdapter = class {
|
|
|
27018
27432
|
this.stateManager = {
|
|
27019
27433
|
saveState: async (opts) => {
|
|
27020
27434
|
await this.#ctx.saveState(opts);
|
|
27435
|
+
},
|
|
27436
|
+
saveStateAndWorkflowBatch: async (writes) => {
|
|
27437
|
+
await this.#ctx.saveStateAndWorkflowBatch(writes);
|
|
27021
27438
|
}
|
|
27022
27439
|
};
|
|
27023
27440
|
}
|
|
@@ -27087,11 +27504,13 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
|
27087
27504
|
const config3 = definition.config;
|
|
27088
27505
|
const options = config3.options ?? {};
|
|
27089
27506
|
const canHibernate = options.canHibernateWebSocket;
|
|
27507
|
+
const usesRemoteSqlite = sqliteBackendForConfig(registryConfig) === "remote";
|
|
27090
27508
|
return {
|
|
27091
27509
|
name: options.name,
|
|
27092
27510
|
icon: options.icon,
|
|
27093
|
-
hasDatabase: config3.db !== void 0,
|
|
27094
|
-
remoteSqlite:
|
|
27511
|
+
hasDatabase: config3.db !== void 0 || usesRemoteSqlite,
|
|
27512
|
+
remoteSqlite: usesRemoteSqlite,
|
|
27513
|
+
enableActorRuntimeSocket: options.enableActorRuntimeSocket === true,
|
|
27095
27514
|
hasState: config3.state !== void 0 || typeof config3.createState === "function",
|
|
27096
27515
|
canHibernateWebsocket: typeof canHibernate === "boolean" ? canHibernate : void 0,
|
|
27097
27516
|
stateSaveIntervalMs: options.stateSaveInterval,
|
|
@@ -27107,6 +27526,7 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
|
|
|
27107
27526
|
connectionLivenessTimeoutMs: options.connectionLivenessTimeout,
|
|
27108
27527
|
connectionLivenessIntervalMs: options.connectionLivenessInterval,
|
|
27109
27528
|
maxQueueSize: options.maxQueueSize,
|
|
27529
|
+
maxSchedules: options.maxSchedules,
|
|
27110
27530
|
maxQueueMessageSize: options.maxQueueMessageSize,
|
|
27111
27531
|
maxIncomingMessageSize: registryConfig.maxIncomingMessageSize,
|
|
27112
27532
|
maxOutgoingMessageSize: registryConfig.maxOutgoingMessageSize,
|
|
@@ -27383,7 +27803,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
27383
27803
|
400
|
|
27384
27804
|
);
|
|
27385
27805
|
}
|
|
27386
|
-
const cbor2 = encodeCborCompat(
|
|
27806
|
+
const cbor2 = encodeCborCompat(
|
|
27807
|
+
body.body ?? null
|
|
27808
|
+
);
|
|
27387
27809
|
const message = await runtime.actorQueueSend(ctx, name, cbor2);
|
|
27388
27810
|
return jsonResponse({
|
|
27389
27811
|
id: message.id().toString(),
|
|
@@ -28076,7 +28498,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
28076
28498
|
name,
|
|
28077
28499
|
wrapNativeCallback(
|
|
28078
28500
|
async (error46, payload) => {
|
|
28079
|
-
const { ctx, conn, args, cancelToken } = unwrapTsfnPayload(error46, payload);
|
|
28501
|
+
const { ctx, conn, args, scheduledFire, cancelToken } = unwrapTsfnPayload(error46, payload);
|
|
28080
28502
|
const actorCtx = conn != null ? makeConnCtx(ctx, conn, void 0, cancelToken) : makeActorCtx(ctx, void 0, cancelToken);
|
|
28081
28503
|
try {
|
|
28082
28504
|
return encodeValue(
|
|
@@ -28086,7 +28508,8 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
28086
28508
|
schemaConfig.actionInputSchemas,
|
|
28087
28509
|
name,
|
|
28088
28510
|
decodeArgs(args)
|
|
28089
|
-
)
|
|
28511
|
+
),
|
|
28512
|
+
...scheduledFire ? [scheduledFire] : []
|
|
28090
28513
|
)
|
|
28091
28514
|
);
|
|
28092
28515
|
} finally {
|