rivetkit 2.3.11-rc.8 → 2.3.11-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.js +1 -1
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +1 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.js +1 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-E6WB2BLO.cjs → chunk-6SBPWTXJ.cjs} +9 -9
- package/dist/tsup/{chunk-E6WB2BLO.cjs.map → chunk-6SBPWTXJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-A55CGZIV.cjs → chunk-BZWKY6WO.cjs} +139 -139
- package/dist/tsup/{chunk-A55CGZIV.cjs.map → chunk-BZWKY6WO.cjs.map} +1 -1
- package/dist/tsup/{chunk-4EDGOGCB.js → chunk-C5TORAVP.js} +2 -2
- package/dist/tsup/{chunk-JBQ63WSM.js → chunk-HOZ3ZLZ2.js} +6 -6
- package/dist/tsup/{chunk-N6MBTYGX.cjs → chunk-IMRDHZM2.cjs} +4 -4
- package/dist/tsup/{chunk-N6MBTYGX.cjs.map → chunk-IMRDHZM2.cjs.map} +1 -1
- package/dist/tsup/{chunk-WRRB24UY.js → chunk-IOLZ3ONU.js} +3 -3
- package/dist/tsup/{chunk-AGNBLCNJ.js → chunk-LZ4TSBIP.js} +2 -2
- package/dist/tsup/{chunk-AGNBLCNJ.js.map → chunk-LZ4TSBIP.js.map} +1 -1
- package/dist/tsup/{chunk-KVD6ZWNM.js → chunk-QVCO6DTZ.js} +3 -3
- package/dist/tsup/{chunk-2ROUKH7W.cjs → chunk-T56IZ42M.cjs} +2 -2
- package/dist/tsup/{chunk-2ROUKH7W.cjs.map → chunk-T56IZ42M.cjs.map} +1 -1
- package/dist/tsup/{chunk-CCUO5OKD.cjs → chunk-T5XVTVQY.cjs} +3 -3
- package/dist/tsup/{chunk-CCUO5OKD.cjs.map → chunk-T5XVTVQY.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZVM35ICH.cjs → chunk-V5CVATRU.cjs} +7 -7
- package/dist/tsup/{chunk-ZVM35ICH.cjs.map → chunk-V5CVATRU.cjs.map} +1 -1
- package/dist/tsup/{chunk-V6ANE6JM.js → chunk-XOOESJY7.js} +2 -2
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -4
- package/dist/tsup/inspector/mod.js +3 -3
- package/dist/tsup/mod.cjs +170 -72
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.js +109 -11
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +6 -6
- package/dist/tsup/workflow/mod.js +3 -3
- package/package.json +8 -8
- package/src/registry/native.ts +45 -8
- package/src/registry/write-through-proxy.ts +101 -0
- /package/dist/tsup/{chunk-4EDGOGCB.js.map → chunk-C5TORAVP.js.map} +0 -0
- /package/dist/tsup/{chunk-JBQ63WSM.js.map → chunk-HOZ3ZLZ2.js.map} +0 -0
- /package/dist/tsup/{chunk-WRRB24UY.js.map → chunk-IOLZ3ONU.js.map} +0 -0
- /package/dist/tsup/{chunk-KVD6ZWNM.js.map → chunk-QVCO6DTZ.js.map} +0 -0
- /package/dist/tsup/{chunk-V6ANE6JM.js.map → chunk-XOOESJY7.js.map} +0 -0
package/dist/tsup/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeWorkflowHistoryTransport
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-C5TORAVP.js";
|
|
4
4
|
import {
|
|
5
5
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
6
6
|
ActorConfigSchema,
|
|
@@ -23,13 +23,13 @@ import {
|
|
|
23
23
|
isResponseLike,
|
|
24
24
|
tryParseEndpoint,
|
|
25
25
|
updateRunnerConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-HOZ3ZLZ2.js";
|
|
27
27
|
import {
|
|
28
28
|
makePrefixedKey,
|
|
29
29
|
removePrefixFromKey
|
|
30
30
|
} from "./chunk-JI6GZ2C2.js";
|
|
31
|
+
import "./chunk-XOOESJY7.js";
|
|
31
32
|
import "./chunk-7AFZMFPQ.js";
|
|
32
|
-
import "./chunk-V6ANE6JM.js";
|
|
33
33
|
import {
|
|
34
34
|
LogLevelSchema,
|
|
35
35
|
VERSION,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
parsePortEnv,
|
|
63
63
|
stringifyError,
|
|
64
64
|
toUint8Array
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-LZ4TSBIP.js";
|
|
66
66
|
import {
|
|
67
67
|
INTERNAL_ERROR_CODE,
|
|
68
68
|
RivetError,
|
|
@@ -2795,6 +2795,83 @@ function createWriteThroughProxy(value, commit, beforeChange) {
|
|
|
2795
2795
|
}
|
|
2796
2796
|
);
|
|
2797
2797
|
}
|
|
2798
|
+
function unwrapProxy(value) {
|
|
2799
|
+
let current = value;
|
|
2800
|
+
while (current !== null && typeof current === "object") {
|
|
2801
|
+
const target = onChange.target(current);
|
|
2802
|
+
if (target === current) {
|
|
2803
|
+
break;
|
|
2804
|
+
}
|
|
2805
|
+
current = target;
|
|
2806
|
+
}
|
|
2807
|
+
return current;
|
|
2808
|
+
}
|
|
2809
|
+
function isPlainObject(value) {
|
|
2810
|
+
const proto = Object.getPrototypeOf(value);
|
|
2811
|
+
return proto === Object.prototype || proto === null;
|
|
2812
|
+
}
|
|
2813
|
+
function unwrapDeep(value, seen) {
|
|
2814
|
+
const unwrapped = unwrapProxy(value);
|
|
2815
|
+
if (!unwrapped || typeof unwrapped !== "object") {
|
|
2816
|
+
return unwrapped;
|
|
2817
|
+
}
|
|
2818
|
+
if (seen.has(unwrapped)) {
|
|
2819
|
+
return unwrapped;
|
|
2820
|
+
}
|
|
2821
|
+
seen.add(unwrapped);
|
|
2822
|
+
if (Array.isArray(unwrapped)) {
|
|
2823
|
+
for (let i = 0; i < unwrapped.length; i++) {
|
|
2824
|
+
const child = unwrapDeep(unwrapped[i], seen);
|
|
2825
|
+
if (child !== unwrapped[i]) {
|
|
2826
|
+
unwrapped[i] = child;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
return unwrapped;
|
|
2830
|
+
}
|
|
2831
|
+
if (unwrapped instanceof Map) {
|
|
2832
|
+
const replacements = [];
|
|
2833
|
+
for (const [key, child] of unwrapped.entries()) {
|
|
2834
|
+
const nextKey = unwrapDeep(key, seen);
|
|
2835
|
+
const nextChild = unwrapDeep(child, seen);
|
|
2836
|
+
if (nextKey !== key || nextChild !== child) {
|
|
2837
|
+
replacements.push([key, nextKey, nextChild]);
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
for (const [key, nextKey, nextChild] of replacements) {
|
|
2841
|
+
if (nextKey !== key) {
|
|
2842
|
+
unwrapped.delete(key);
|
|
2843
|
+
}
|
|
2844
|
+
unwrapped.set(nextKey, nextChild);
|
|
2845
|
+
}
|
|
2846
|
+
return unwrapped;
|
|
2847
|
+
}
|
|
2848
|
+
if (unwrapped instanceof Set) {
|
|
2849
|
+
const replacements = [];
|
|
2850
|
+
for (const child of unwrapped.values()) {
|
|
2851
|
+
const next = unwrapDeep(child, seen);
|
|
2852
|
+
if (next !== child) {
|
|
2853
|
+
replacements.push([child, next]);
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
for (const [child, next] of replacements) {
|
|
2857
|
+
unwrapped.delete(child);
|
|
2858
|
+
unwrapped.add(next);
|
|
2859
|
+
}
|
|
2860
|
+
return unwrapped;
|
|
2861
|
+
}
|
|
2862
|
+
if (isPlainObject(unwrapped)) {
|
|
2863
|
+
for (const key of Object.keys(unwrapped)) {
|
|
2864
|
+
const child = unwrapDeep(unwrapped[key], seen);
|
|
2865
|
+
if (child !== unwrapped[key]) {
|
|
2866
|
+
unwrapped[key] = child;
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
return unwrapped;
|
|
2871
|
+
}
|
|
2872
|
+
function unwrapWriteThroughProxy(value) {
|
|
2873
|
+
return unwrapDeep(value, /* @__PURE__ */ new Set());
|
|
2874
|
+
}
|
|
2798
2875
|
|
|
2799
2876
|
// src/registry/native.ts
|
|
2800
2877
|
var textEncoder = new TextEncoder();
|
|
@@ -3483,8 +3560,23 @@ var NativeConnAdapter = class {
|
|
|
3483
3560
|
}
|
|
3484
3561
|
get state() {
|
|
3485
3562
|
const nextState = this.#readState();
|
|
3563
|
+
if (!this.#ctx) {
|
|
3564
|
+
return this.#createStateProxy(nextState);
|
|
3565
|
+
}
|
|
3566
|
+
const connState = getNativeConnPersistState(
|
|
3567
|
+
this.#runtime,
|
|
3568
|
+
this.#ctx,
|
|
3569
|
+
this.#conn
|
|
3570
|
+
);
|
|
3571
|
+
if (connState.stateProxy === void 0 || connState.stateProxyTarget !== nextState) {
|
|
3572
|
+
connState.stateProxyTarget = nextState;
|
|
3573
|
+
connState.stateProxy = this.#createStateProxy(nextState);
|
|
3574
|
+
}
|
|
3575
|
+
return connState.stateProxy;
|
|
3576
|
+
}
|
|
3577
|
+
#createStateProxy(state) {
|
|
3486
3578
|
return createWriteThroughProxy(
|
|
3487
|
-
|
|
3579
|
+
state,
|
|
3488
3580
|
(nextValue) => {
|
|
3489
3581
|
this.#writeState(nextValue, { writeNative: true });
|
|
3490
3582
|
},
|
|
@@ -3494,11 +3586,14 @@ var NativeConnAdapter = class {
|
|
|
3494
3586
|
);
|
|
3495
3587
|
}
|
|
3496
3588
|
set state(value) {
|
|
3497
|
-
|
|
3498
|
-
|
|
3589
|
+
const nextValue = unwrapWriteThroughProxy(value);
|
|
3590
|
+
assertJsonCompatValue(nextValue);
|
|
3591
|
+
this.#writeState(nextValue, { writeNative: true });
|
|
3499
3592
|
}
|
|
3500
3593
|
initializeState(value) {
|
|
3501
|
-
this.#writeState(value, {
|
|
3594
|
+
this.#writeState(unwrapWriteThroughProxy(value), {
|
|
3595
|
+
writeNative: false
|
|
3596
|
+
});
|
|
3502
3597
|
}
|
|
3503
3598
|
get isHibernatable() {
|
|
3504
3599
|
return callNativeSync(
|
|
@@ -4551,14 +4646,17 @@ var ActorContextHandleAdapter = class {
|
|
|
4551
4646
|
throw stateNotEnabledError();
|
|
4552
4647
|
}
|
|
4553
4648
|
this.#assertCanMutateState();
|
|
4554
|
-
|
|
4555
|
-
|
|
4649
|
+
const nextValue = unwrapWriteThroughProxy(value);
|
|
4650
|
+
assertJsonCompatValue(nextValue);
|
|
4651
|
+
this.#writeState(nextValue, { scheduleSave: true });
|
|
4556
4652
|
}
|
|
4557
4653
|
initializeState(value) {
|
|
4558
4654
|
if (!this.#stateEnabled) {
|
|
4559
4655
|
return;
|
|
4560
4656
|
}
|
|
4561
|
-
this.#writeState(value, {
|
|
4657
|
+
this.#writeState(unwrapWriteThroughProxy(value), {
|
|
4658
|
+
scheduleSave: false
|
|
4659
|
+
});
|
|
4562
4660
|
}
|
|
4563
4661
|
get vars() {
|
|
4564
4662
|
const runtimeState = getNativeRuntimeState(this.#runtime, this.#ctx);
|