apps 0.0.1-beta.34 → 0.0.1-beta.35
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/framework-reference.json +1 -1
- package/js/{chunk-PUBNIORL.js → chunk-5CQMUXW7.js} +2 -2
- package/js/{chunk-DSUKW6KJ.js → chunk-5KNA2Z5I.js} +13 -11
- package/js/{chunk-UMCMZFXW.js → chunk-73AV3JVU.js} +1 -1
- package/js/{chunk-6ZJ2H6P4.js → chunk-A4O72Z3A.js} +298 -190
- package/js/{chunk-FBBXFFFJ.js → chunk-BI45HZWM.js} +2 -2
- package/js/{chunk-DXGWKNTQ.js → chunk-BI6R577B.js} +2 -2
- package/js/{chunk-IU6OK5G2.js → chunk-ENJCQWVF.js} +3 -3
- package/js/{chunk-OX233L7N.js → chunk-FFTALB6S.js} +2 -2
- package/js/{chunk-DASNNAP4.js → chunk-HDAQBRT5.js} +391 -14
- package/js/{chunk-HW3DPBZR.js → chunk-I7CNZ4CM.js} +1 -1
- package/js/{chunk-QKVZGWGZ.js → chunk-IA3VSGR4.js} +7 -7
- package/js/{chunk-EXGKN554.js → chunk-IJQ5LE74.js} +9805 -9254
- package/js/{chunk-5JVNM3CQ.js → chunk-IU7CCCUC.js} +12 -12
- package/js/{chunk-Q7Q5JTRW.js → chunk-JU7F4PRK.js} +2 -2
- package/js/{chunk-QZD2RZ4S.js → chunk-KBXQOJYW.js} +8 -8
- package/js/{chunk-CJY5X26R.js → chunk-KOOJUMLR.js} +86 -50
- package/js/{chunk-ETLILMHY.js → chunk-KZFV3WCJ.js} +21 -19
- package/js/{chunk-MYH3QZ4L.js → chunk-LUROQKFP.js} +9 -9
- package/js/{chunk-ZOY7PDMI.js → chunk-NHCFIWN5.js} +1 -1
- package/js/chunk-NHUHTWAF.js +0 -0
- package/js/{chunk-QYM4STZW.js → chunk-PHO7HXTC.js} +149 -353
- package/js/{chunk-O3OAFU7Q.js → chunk-POOIHRPF.js} +2 -2
- package/js/{chunk-AUFVX4KM.js → chunk-RSNZDT4L.js} +2 -2
- package/js/{chunk-EPUWF4ZG.js → chunk-SRB2WDU7.js} +3 -3
- package/js/{chunk-MFHUR5SB.js → chunk-TADLIUEU.js} +4 -4
- package/js/{chunk-5OM6HBNU.js → chunk-UWOIEJ56.js} +18 -18
- package/js/chunk-V5DWGYRK.js +268 -0
- package/js/{chunk-QUEPZ67T.js → chunk-VBVOPW4U.js} +3 -3
- package/js/{chunk-GZ4UHXRT.js → chunk-WDBUOIWV.js} +3 -3
- package/js/{chunk-6KG4DZD7.js → chunk-Y3XN4X4Q.js} +1 -1
- package/js/{chunk-UKMIHP2G.js → chunk-YW333DH3.js} +4 -4
- package/js/{chunk-O4QOPXQT.js → chunk-YYK6GEMC.js} +11 -11
- package/js/client.js +12 -11
- package/js/contracts.js +10 -9
- package/js/effect.js +23 -21
- package/js/graphql.js +25 -23
- package/js/host.js +23 -21
- package/js/index.js +16 -14
- package/js/mcp/effect.js +25 -23
- package/js/mcp/stdio.js +25 -23
- package/js/mcp.js +27 -25
- package/js/openapi.js +22 -21
- package/js/react.js +3 -3
- package/js/skills/effect.js +6 -5
- package/js/skills.js +18 -16
- package/js/storage/facet.js +19 -345
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +6 -5
- package/js/ui/serving.js +10 -9
- package/package.json +3 -3
- package/runtime.json +1 -1
- package/types/app-data/src/implementation/sqlite.d.ts +1 -1
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/protocols/1.d.ts +4 -4
- package/types/apps/src/contracts/protocols/2.d.ts +4 -4
- package/types/apps/src/contracts/protocols/3.d.ts +4 -4
- package/types/apps/src/contracts/protocols/4.d.ts +4 -4
- package/types/apps/src/contracts/protocols/5.d.ts +4 -4
- package/types/apps/src/contracts/protocols/6.d.ts +4 -4
- package/types/apps/src/contracts/protocols/7.d.ts +4 -4
- package/types/apps/src/contracts/protocols/8.d.ts +4 -4
- package/types/apps/src/contracts/ui.d.ts +1 -1
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/network.d.ts +1 -1
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/telemetry/src/browser-operations.d.ts +1 -1
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +1 -1
- package/types/utils/src/api-error.d.ts +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
invalidate,
|
|
4
4
|
layer,
|
|
5
5
|
mutation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HDAQBRT5.js";
|
|
7
7
|
import {
|
|
8
8
|
Boolean,
|
|
9
9
|
Cause,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
effect,
|
|
54
54
|
empty,
|
|
55
55
|
empty2,
|
|
56
|
-
empty3,
|
|
56
|
+
empty6 as empty3,
|
|
57
57
|
empty7 as empty4,
|
|
58
58
|
encodeEffect,
|
|
59
59
|
encodeExit,
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
fromJsonString,
|
|
81
81
|
gen,
|
|
82
82
|
get,
|
|
83
|
-
get2,
|
|
83
|
+
get3 as get2,
|
|
84
84
|
get5 as get3,
|
|
85
85
|
getCurrent,
|
|
86
86
|
getOrElse,
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
pipeArguments,
|
|
129
129
|
provide2 as provide,
|
|
130
130
|
provideMerge,
|
|
131
|
-
remove,
|
|
131
|
+
remove3 as remove,
|
|
132
132
|
runCallbackWith,
|
|
133
133
|
runForEachArray,
|
|
134
134
|
runForkWith,
|
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
runSyncWith,
|
|
137
137
|
scope,
|
|
138
138
|
scopedWith,
|
|
139
|
-
set,
|
|
139
|
+
set4 as set,
|
|
140
140
|
set5 as set2,
|
|
141
141
|
some,
|
|
142
142
|
squash,
|
|
@@ -158,12 +158,12 @@ import {
|
|
|
158
158
|
void_2,
|
|
159
159
|
whileLoop,
|
|
160
160
|
zipRight
|
|
161
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-IJQ5LE74.js";
|
|
162
162
|
import {
|
|
163
163
|
__export
|
|
164
164
|
} from "./chunk-CZ7CSFO4.js";
|
|
165
165
|
|
|
166
|
-
// ../../node_modules/.bun/effect@
|
|
166
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/AsyncResult.js
|
|
167
167
|
var AsyncResult_exports = {};
|
|
168
168
|
__export(AsyncResult_exports, {
|
|
169
169
|
Schema: () => Schema,
|
|
@@ -276,7 +276,7 @@ var failureWithPrevious = (cause2, options) => failure(cause2, {
|
|
|
276
276
|
});
|
|
277
277
|
var fail4 = (error2, options) => failure(fail(error2), options);
|
|
278
278
|
var failWithPrevious = (error2, options) => failureWithPrevious(fail(error2), options);
|
|
279
|
-
var waiting = (self, options) => {
|
|
279
|
+
var waiting = /* @__PURE__ */ dual((args) => isAsyncResult(args[0]), (self, options) => {
|
|
280
280
|
if (self.waiting) {
|
|
281
281
|
return options?.touch ? touch(self) : self;
|
|
282
282
|
}
|
|
@@ -287,7 +287,7 @@ var waiting = (self, options) => {
|
|
|
287
287
|
result.timestamp = Date.now();
|
|
288
288
|
}
|
|
289
289
|
return result;
|
|
290
|
-
};
|
|
290
|
+
});
|
|
291
291
|
var touch = (result) => {
|
|
292
292
|
if (isSuccess(result)) {
|
|
293
293
|
return success(result.value, {
|
|
@@ -296,7 +296,7 @@ var touch = (result) => {
|
|
|
296
296
|
}
|
|
297
297
|
return result;
|
|
298
298
|
};
|
|
299
|
-
var replacePrevious = (self, previous) => {
|
|
299
|
+
var replacePrevious = /* @__PURE__ */ dual(2, (self, previous) => {
|
|
300
300
|
if (self._tag === "Failure") {
|
|
301
301
|
return failureWithPrevious(self.cause, {
|
|
302
302
|
previous,
|
|
@@ -304,7 +304,7 @@ var replacePrevious = (self, previous) => {
|
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
return self;
|
|
307
|
-
};
|
|
307
|
+
});
|
|
308
308
|
var value = (self) => {
|
|
309
309
|
if (self._tag === "Success") {
|
|
310
310
|
return some(self.value);
|
|
@@ -600,7 +600,7 @@ var Schema = (options) => {
|
|
|
600
600
|
});
|
|
601
601
|
};
|
|
602
602
|
|
|
603
|
-
// ../../node_modules/.bun/effect@
|
|
603
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/AtomRegistry.js
|
|
604
604
|
var AtomRegistry_exports = {};
|
|
605
605
|
__export(AtomRegistry_exports, {
|
|
606
606
|
AtomRegistry: () => AtomRegistry,
|
|
@@ -660,9 +660,21 @@ var mount = /* @__PURE__ */ dual(2, (self, atom) => acquireRelease(sync(() => se
|
|
|
660
660
|
var constImmediate = {
|
|
661
661
|
immediate: true
|
|
662
662
|
};
|
|
663
|
-
var
|
|
664
|
-
|
|
663
|
+
var invoke = (f) => {
|
|
664
|
+
f();
|
|
665
665
|
};
|
|
666
|
+
var noFailure = {};
|
|
667
|
+
function runAll(items, f) {
|
|
668
|
+
let failure2 = noFailure;
|
|
669
|
+
for (const item of items) {
|
|
670
|
+
try {
|
|
671
|
+
f(item);
|
|
672
|
+
} catch (error2) {
|
|
673
|
+
if (failure2 === noFailure) failure2 = error2;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (failure2 !== noFailure) throw failure2;
|
|
677
|
+
}
|
|
666
678
|
var SerializableTypeId = "~effect-atom/atom/Atom/Serializable";
|
|
667
679
|
var atomKey = (atom) => SerializableTypeId in atom ? atom[SerializableTypeId].key : atom;
|
|
668
680
|
var RegistryImpl = class {
|
|
@@ -733,6 +745,8 @@ var RegistryImpl = class {
|
|
|
733
745
|
const node = this.ensureNode(atom);
|
|
734
746
|
if (options?.immediate) {
|
|
735
747
|
f(node.value());
|
|
748
|
+
} else if (node.state === NodeState.stale) {
|
|
749
|
+
node.value();
|
|
736
750
|
}
|
|
737
751
|
const remove2 = node.subscribe(function() {
|
|
738
752
|
f(node._value);
|
|
@@ -853,26 +867,35 @@ var RegistryImpl = class {
|
|
|
853
867
|
sweepBucket(bucket) {
|
|
854
868
|
const nodes = this.timeoutBuckets.get(bucket)[0];
|
|
855
869
|
this.timeoutBuckets.delete(bucket);
|
|
856
|
-
nodes.
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
870
|
+
runAll(nodes, this.removeIdleNode);
|
|
871
|
+
}
|
|
872
|
+
removeIdleNode = (node) => {
|
|
873
|
+
this.nodeTimeoutBucket.delete(node);
|
|
874
|
+
if (!node.canBeRemoved) return;
|
|
875
|
+
this.nodes.delete(atomKey(node.atom));
|
|
876
|
+
this.onNodeRemoved?.(node);
|
|
877
|
+
this.#currentSweepTTL = node.atom.idleTTL ?? this.defaultIdleTTL;
|
|
878
|
+
try {
|
|
862
879
|
node.remove();
|
|
880
|
+
} finally {
|
|
863
881
|
this.#currentSweepTTL = null;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
882
|
+
}
|
|
883
|
+
};
|
|
866
884
|
reset() {
|
|
867
885
|
this.timeoutBuckets.forEach(([, handle]) => clearTimeout(handle));
|
|
868
886
|
this.timeoutBuckets.clear();
|
|
869
887
|
this.nodeTimeoutBucket.clear();
|
|
870
|
-
this.nodes.
|
|
871
|
-
node.remove();
|
|
872
|
-
this.onNodeRemoved?.(node);
|
|
873
|
-
});
|
|
888
|
+
const nodes = Array.from(this.nodes.values());
|
|
874
889
|
this.nodes.clear();
|
|
890
|
+
for (const node of nodes) {
|
|
891
|
+
node.state = NodeState.removed;
|
|
892
|
+
}
|
|
893
|
+
runAll(nodes, this.destroyNode);
|
|
875
894
|
}
|
|
895
|
+
destroyNode = (node) => {
|
|
896
|
+
node.remove();
|
|
897
|
+
this.onNodeRemoved?.(node);
|
|
898
|
+
};
|
|
876
899
|
dispose() {
|
|
877
900
|
this.disposed = true;
|
|
878
901
|
this.reset();
|
|
@@ -904,13 +927,15 @@ var NodeImpl = class {
|
|
|
904
927
|
lifetime;
|
|
905
928
|
writeContext;
|
|
906
929
|
preserveInitialValueOnBuild = false;
|
|
930
|
+
invalidatedDuringBuild = false;
|
|
931
|
+
failed = false;
|
|
932
|
+
// Every parent that holds this node as a child. A stale node keeps the
|
|
933
|
+
// parents of its last build, so they are not released and their next change
|
|
934
|
+
// still reaches it. A build drops the parents it did not read.
|
|
907
935
|
parents = /* @__PURE__ */ new Set();
|
|
908
|
-
previousParents;
|
|
909
936
|
children = /* @__PURE__ */ new Set();
|
|
910
937
|
listeners = /* @__PURE__ */ new Set();
|
|
911
|
-
|
|
912
|
-
building = false;
|
|
913
|
-
invalidatedDuringBuild = false;
|
|
938
|
+
observedChildren = 0;
|
|
914
939
|
currentState() {
|
|
915
940
|
switch (this.state) {
|
|
916
941
|
case NodeState.uninitialized:
|
|
@@ -926,33 +951,108 @@ var NodeImpl = class {
|
|
|
926
951
|
get canBeRemoved() {
|
|
927
952
|
return !this.atom.keepAlive && this.listeners.size === 0 && this.children.size === 0 && this.state !== 0;
|
|
928
953
|
}
|
|
954
|
+
get building() {
|
|
955
|
+
return this.lifetime !== void 0 && this.lifetime.reads !== void 0;
|
|
956
|
+
}
|
|
957
|
+
// An observed node is rebuilt as soon as it goes stale, because something
|
|
958
|
+
// waits for its value without reading it. The count spares walking the
|
|
959
|
+
// children on every invalidation.
|
|
960
|
+
get isObserved() {
|
|
961
|
+
return !this.atom.lazy || this.listeners.size > 0 || this.observedChildren > 0;
|
|
962
|
+
}
|
|
963
|
+
childObserved(delta) {
|
|
964
|
+
const observed = this.isObserved;
|
|
965
|
+
this.observedChildren += delta;
|
|
966
|
+
if (observed !== this.isObserved) {
|
|
967
|
+
this.observedChanged(delta);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
observedChanged(delta) {
|
|
971
|
+
for (const parent of this.parents) {
|
|
972
|
+
parent.childObserved(delta);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
929
975
|
_value = void 0;
|
|
930
976
|
value() {
|
|
931
|
-
|
|
932
|
-
this.
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
977
|
+
while ((this.state & NodeFlags.waitingForValue) !== 0) {
|
|
978
|
+
this.build();
|
|
979
|
+
}
|
|
980
|
+
return this._value;
|
|
981
|
+
}
|
|
982
|
+
build() {
|
|
983
|
+
this.disposeLifetime();
|
|
984
|
+
this.invalidatedDuringBuild = false;
|
|
985
|
+
const lifetime = makeLifetime(this);
|
|
986
|
+
this.lifetime = lifetime;
|
|
987
|
+
let value2;
|
|
988
|
+
let read = false;
|
|
989
|
+
try {
|
|
990
|
+
value2 = this.atom.read(lifetime);
|
|
991
|
+
read = true;
|
|
992
|
+
} finally {
|
|
993
|
+
const reads = lifetime.reads;
|
|
994
|
+
lifetime.reads = void 0;
|
|
995
|
+
if (this.lifetime === lifetime) {
|
|
996
|
+
this.dropUnread(reads);
|
|
997
|
+
if (!read) this.fail();
|
|
943
998
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
999
|
+
}
|
|
1000
|
+
if (this.lifetime === lifetime && (this.state & NodeFlags.waitingForValue) !== 0) {
|
|
1001
|
+
if (this.preserveInitialValueOnBuild) {
|
|
1002
|
+
this.preserveInitialValueOnBuild = false;
|
|
1003
|
+
this.failed = false;
|
|
1004
|
+
this.state = NodeState.valid;
|
|
1005
|
+
} else {
|
|
1006
|
+
this.setValue(value2);
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
if (lifetime.failure !== noFailure) throw lifetime.failure;
|
|
1010
|
+
}
|
|
1011
|
+
// A build that threw leaves its dependents holding, or reading, a value
|
|
1012
|
+
// this node no longer stands behind, so they go stale and rebuild when
|
|
1013
|
+
// pulled or observed. The read's error is the one reported.
|
|
1014
|
+
fail() {
|
|
1015
|
+
this.failed = true;
|
|
1016
|
+
try {
|
|
1017
|
+
this.invalidateChildren();
|
|
1018
|
+
} catch {
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
readTracked(atom, lifetime) {
|
|
1022
|
+
const parent = this.registry.ensureNode(atom);
|
|
1023
|
+
if (!this.parents.has(parent)) {
|
|
1024
|
+
this.parents.add(parent);
|
|
1025
|
+
parent.children.add(this);
|
|
1026
|
+
if (this.isObserved) {
|
|
1027
|
+
parent.childObserved(1);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
try {
|
|
1031
|
+
return parent.value();
|
|
1032
|
+
} catch (error2) {
|
|
1033
|
+
if (lifetime.reads === void 0 || parent.state !== NodeState.valid) throw error2;
|
|
1034
|
+
if (lifetime.failure === noFailure) lifetime.failure = error2;
|
|
1035
|
+
return parent._value;
|
|
1036
|
+
} finally {
|
|
1037
|
+
if (lifetime.reads !== void 0 && !lifetime.disposed) {
|
|
1038
|
+
lifetime.reads.add(parent);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
dropUnread(reads) {
|
|
1043
|
+
if (reads.size === this.parents.size) return;
|
|
1044
|
+
const observed = this.isObserved;
|
|
1045
|
+
for (const parent of this.parents) {
|
|
1046
|
+
if (reads.has(parent)) continue;
|
|
1047
|
+
this.parents.delete(parent);
|
|
1048
|
+
parent.children.delete(this);
|
|
1049
|
+
if (observed) {
|
|
1050
|
+
parent.childObserved(-1);
|
|
1051
|
+
}
|
|
1052
|
+
if (parent.canBeRemoved) {
|
|
1053
|
+
this.registry.scheduleNodeRemoval(parent);
|
|
953
1054
|
}
|
|
954
1055
|
}
|
|
955
|
-
return this._value;
|
|
956
1056
|
}
|
|
957
1057
|
valueOption() {
|
|
958
1058
|
if ((this.state & NodeFlags.initialized) === 0) {
|
|
@@ -965,151 +1065,143 @@ var NodeImpl = class {
|
|
|
965
1065
|
this.preserveInitialValueOnBuild = true;
|
|
966
1066
|
this.state = NodeState.stale;
|
|
967
1067
|
this._value = value2;
|
|
968
|
-
if (
|
|
969
|
-
|
|
970
|
-
} else {
|
|
971
|
-
this.notify();
|
|
1068
|
+
if (this.listeners.size > 0) {
|
|
1069
|
+
this.announce();
|
|
972
1070
|
}
|
|
973
1071
|
return;
|
|
974
1072
|
}
|
|
975
1073
|
this.setValue(value2);
|
|
976
1074
|
}
|
|
977
1075
|
setValue(value2) {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
if (batchState.phase === BatchPhase.collect) {
|
|
982
|
-
batchState.notify.add(this);
|
|
983
|
-
} else {
|
|
984
|
-
this.notify();
|
|
985
|
-
}
|
|
986
|
-
return;
|
|
987
|
-
}
|
|
1076
|
+
const recovered = this.failed;
|
|
1077
|
+
this.failed = false;
|
|
1078
|
+
const initialized = (this.state & NodeFlags.initialized) !== 0;
|
|
988
1079
|
this.state = NodeState.valid;
|
|
989
|
-
if (this.atom.equals(this._value, value2)) {
|
|
1080
|
+
if (initialized && this.atom.equals(this._value, value2)) {
|
|
1081
|
+
if (recovered) this.invalidateChildren();
|
|
990
1082
|
return;
|
|
991
1083
|
}
|
|
992
1084
|
this._value = value2;
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
} else {
|
|
1085
|
+
let failure2 = noFailure;
|
|
1086
|
+
try {
|
|
996
1087
|
this.invalidateChildren();
|
|
1088
|
+
} catch (error2) {
|
|
1089
|
+
failure2 = error2;
|
|
997
1090
|
}
|
|
998
1091
|
if (this.listeners.size > 0) {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1092
|
+
try {
|
|
1093
|
+
this.announce();
|
|
1094
|
+
} catch (error2) {
|
|
1095
|
+
if (failure2 === noFailure) failure2 = error2;
|
|
1003
1096
|
}
|
|
1004
1097
|
}
|
|
1098
|
+
if (failure2 !== noFailure) throw failure2;
|
|
1005
1099
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
this.previousParents = void 0;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
if (!parent.children.has(this)) {
|
|
1015
|
-
parent.children.add(this);
|
|
1016
|
-
if (parent.skipInvalidation) {
|
|
1017
|
-
parent.skipInvalidation = false;
|
|
1018
|
-
}
|
|
1100
|
+
announce() {
|
|
1101
|
+
if (batchState.phase === BatchPhase.collect) {
|
|
1102
|
+
batchState.notify.add(this);
|
|
1103
|
+
} else {
|
|
1104
|
+
this.notify();
|
|
1019
1105
|
}
|
|
1020
1106
|
}
|
|
1021
|
-
removeChild(child) {
|
|
1022
|
-
this.children.delete(child);
|
|
1023
|
-
}
|
|
1024
1107
|
invalidate() {
|
|
1025
|
-
if (this.building && batchState.phase === BatchPhase.collect) {
|
|
1026
|
-
this.invalidatedDuringBuild = true;
|
|
1027
|
-
}
|
|
1028
1108
|
if (this.state === NodeState.valid) {
|
|
1029
1109
|
this.state = NodeState.stale;
|
|
1030
|
-
|
|
1110
|
+
try {
|
|
1111
|
+
this.disposeLifetime();
|
|
1112
|
+
} finally {
|
|
1113
|
+
this.propagate();
|
|
1114
|
+
}
|
|
1115
|
+
} else if (this.building && batchState.phase !== BatchPhase.collect) {
|
|
1116
|
+
this.build();
|
|
1117
|
+
} else {
|
|
1118
|
+
this.propagate();
|
|
1031
1119
|
}
|
|
1120
|
+
}
|
|
1121
|
+
propagate() {
|
|
1032
1122
|
if (batchState.phase === BatchPhase.collect) {
|
|
1123
|
+
if (this.building) {
|
|
1124
|
+
this.invalidatedDuringBuild = true;
|
|
1125
|
+
}
|
|
1033
1126
|
batchState.stale.push(this);
|
|
1034
|
-
} else if (this.
|
|
1035
|
-
this.invalidateChildren();
|
|
1036
|
-
this.skipInvalidation = true;
|
|
1037
|
-
} else {
|
|
1127
|
+
} else if (this.isObserved) {
|
|
1038
1128
|
this.value();
|
|
1129
|
+
} else {
|
|
1130
|
+
this.invalidateChildren();
|
|
1039
1131
|
}
|
|
1040
1132
|
}
|
|
1041
1133
|
invalidateChildren() {
|
|
1042
1134
|
if (this.children.size === 0) {
|
|
1043
1135
|
return;
|
|
1044
1136
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1137
|
+
let failure2 = noFailure;
|
|
1138
|
+
for (const child of Array.from(this.children)) {
|
|
1139
|
+
if (!child.affectedBy(this)) continue;
|
|
1140
|
+
try {
|
|
1141
|
+
child.invalidate();
|
|
1142
|
+
} catch (error2) {
|
|
1143
|
+
if (failure2 === noFailure) failure2 = error2;
|
|
1144
|
+
}
|
|
1049
1145
|
}
|
|
1146
|
+
if (failure2 !== noFailure) throw failure2;
|
|
1147
|
+
}
|
|
1148
|
+
// Whether a change of the parent reaches this node: it holds the parent's
|
|
1149
|
+
// value, or a running build has already read it. A stale node is stale
|
|
1150
|
+
// already, and a build that has not read the parent yet will read the new
|
|
1151
|
+
// value. The exception is an observed node that is still stale: its rebuild
|
|
1152
|
+
// failed, and a parent that has a value again is its chance to recover.
|
|
1153
|
+
affectedBy(parent) {
|
|
1154
|
+
if (this.state === NodeState.valid) return true;
|
|
1155
|
+
const reads = this.lifetime?.reads;
|
|
1156
|
+
if (reads !== void 0) return reads.has(parent);
|
|
1157
|
+
return this.isObserved && parent.state === NodeState.valid;
|
|
1050
1158
|
}
|
|
1051
1159
|
notify() {
|
|
1052
|
-
this.listeners.forEach(notifyListener);
|
|
1053
1160
|
if (batchState.phase === BatchPhase.commit) {
|
|
1054
1161
|
batchState.notify.delete(this);
|
|
1055
1162
|
}
|
|
1163
|
+
runAll(this.listeners, invoke);
|
|
1056
1164
|
}
|
|
1057
1165
|
disposeLifetime() {
|
|
1058
|
-
|
|
1059
|
-
|
|
1166
|
+
const lifetime = this.lifetime;
|
|
1167
|
+
if (lifetime !== void 0) {
|
|
1060
1168
|
this.lifetime = void 0;
|
|
1061
|
-
|
|
1062
|
-
if (this.parents.size !== 0) {
|
|
1063
|
-
this.previousParents = this.parents;
|
|
1064
|
-
this.parents = /* @__PURE__ */ new Set();
|
|
1169
|
+
lifetime.dispose();
|
|
1065
1170
|
}
|
|
1066
1171
|
}
|
|
1067
1172
|
remove() {
|
|
1173
|
+
const observed = this.isObserved;
|
|
1068
1174
|
this.state = NodeState.removed;
|
|
1069
1175
|
this.listeners.clear();
|
|
1070
|
-
|
|
1176
|
+
try {
|
|
1071
1177
|
this.disposeLifetime();
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1178
|
+
} finally {
|
|
1179
|
+
const parents = Array.from(this.parents);
|
|
1180
|
+
this.parents.clear();
|
|
1181
|
+
runAll(parents, (parent) => {
|
|
1182
|
+
parent.children.delete(this);
|
|
1183
|
+
if (observed) {
|
|
1184
|
+
parent.childObserved(-1);
|
|
1185
|
+
}
|
|
1186
|
+
if (parent.canBeRemoved) {
|
|
1187
|
+
this.registry.removeNode(parent);
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1083
1190
|
}
|
|
1084
1191
|
}
|
|
1085
1192
|
subscribe(listener) {
|
|
1193
|
+
const observed = this.isObserved;
|
|
1086
1194
|
this.listeners.add(listener);
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
};
|
|
1090
|
-
function childrenAreActive(children) {
|
|
1091
|
-
if (children.size === 0) {
|
|
1092
|
-
return false;
|
|
1093
|
-
}
|
|
1094
|
-
let current = children;
|
|
1095
|
-
let stack;
|
|
1096
|
-
let stackIndex = 0;
|
|
1097
|
-
while (current !== void 0) {
|
|
1098
|
-
for (const child of current) {
|
|
1099
|
-
if (!child.atom.lazy || child.listeners.size > 0) {
|
|
1100
|
-
return true;
|
|
1101
|
-
} else if (child.children.size > 0) {
|
|
1102
|
-
if (stack === void 0) {
|
|
1103
|
-
stack = [child.children];
|
|
1104
|
-
} else {
|
|
1105
|
-
stack.push(child.children);
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1195
|
+
if (!observed) {
|
|
1196
|
+
this.observedChanged(1);
|
|
1108
1197
|
}
|
|
1109
|
-
|
|
1198
|
+
return () => {
|
|
1199
|
+
if (this.listeners.delete(listener) && !this.isObserved) {
|
|
1200
|
+
this.observedChanged(-1);
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1110
1203
|
}
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1204
|
+
};
|
|
1113
1205
|
var LifetimeProto = {
|
|
1114
1206
|
get registry() {
|
|
1115
1207
|
return this.node.registry;
|
|
@@ -1123,10 +1215,7 @@ var LifetimeProto = {
|
|
|
1123
1215
|
if (this.disposed) {
|
|
1124
1216
|
return this.node.registry.get(atom);
|
|
1125
1217
|
}
|
|
1126
|
-
|
|
1127
|
-
const value2 = parent.value();
|
|
1128
|
-
this.node.addParent(parent);
|
|
1129
|
-
return value2;
|
|
1218
|
+
return this.node.readTracked(atom, this);
|
|
1130
1219
|
},
|
|
1131
1220
|
result(atom, options) {
|
|
1132
1221
|
if (this.disposed || this.isFn) {
|
|
@@ -1243,28 +1332,23 @@ var LifetimeProto = {
|
|
|
1243
1332
|
}
|
|
1244
1333
|
const finalizers = this.finalizers;
|
|
1245
1334
|
this.finalizers = void 0;
|
|
1246
|
-
|
|
1247
|
-
finalizers[i]();
|
|
1248
|
-
}
|
|
1335
|
+
runAll(finalizers.reverse(), invoke);
|
|
1249
1336
|
}
|
|
1250
1337
|
};
|
|
1251
1338
|
var makeLifetime = (node) => {
|
|
1252
1339
|
function get5(atom) {
|
|
1253
|
-
if (get5.disposed) {
|
|
1254
|
-
return node.registry.get(atom);
|
|
1255
|
-
} else if (get5.isFn) {
|
|
1340
|
+
if (get5.disposed || get5.isFn) {
|
|
1256
1341
|
return node.registry.get(atom);
|
|
1257
1342
|
}
|
|
1258
|
-
|
|
1259
|
-
const value2 = parent.value();
|
|
1260
|
-
node.addParent(parent);
|
|
1261
|
-
return value2;
|
|
1343
|
+
return node.readTracked(atom, get5);
|
|
1262
1344
|
}
|
|
1263
1345
|
Object.setPrototypeOf(get5, LifetimeProto);
|
|
1264
1346
|
get5.isFn = false;
|
|
1265
1347
|
get5.disposed = false;
|
|
1266
1348
|
get5.finalizers = void 0;
|
|
1267
1349
|
get5.node = node;
|
|
1350
|
+
get5.reads = /* @__PURE__ */ new Set();
|
|
1351
|
+
get5.failure = noFailure;
|
|
1268
1352
|
return get5;
|
|
1269
1353
|
};
|
|
1270
1354
|
var WriteContextImpl = class {
|
|
@@ -1299,27 +1383,45 @@ var batchState = {
|
|
|
1299
1383
|
notify: /* @__PURE__ */ new Set()
|
|
1300
1384
|
};
|
|
1301
1385
|
function batch(f) {
|
|
1386
|
+
const previousPhase = batchState.phase;
|
|
1302
1387
|
batchState.phase = BatchPhase.collect;
|
|
1303
1388
|
batchState.depth++;
|
|
1389
|
+
let failure2 = noFailure;
|
|
1304
1390
|
try {
|
|
1305
1391
|
f();
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1392
|
+
} catch (error2) {
|
|
1393
|
+
failure2 = error2;
|
|
1394
|
+
}
|
|
1395
|
+
if (batchState.depth === 1) {
|
|
1396
|
+
const {
|
|
1397
|
+
notify,
|
|
1398
|
+
stale
|
|
1399
|
+
} = batchState;
|
|
1400
|
+
let i = 0;
|
|
1401
|
+
do {
|
|
1402
|
+
batchState.phase = BatchPhase.collect;
|
|
1403
|
+
for (; i < stale.length; i++) {
|
|
1404
|
+
try {
|
|
1405
|
+
batchRebuildNode(stale[i]);
|
|
1406
|
+
} catch (error2) {
|
|
1407
|
+
if (failure2 === noFailure) failure2 = error2;
|
|
1408
|
+
}
|
|
1309
1409
|
}
|
|
1310
1410
|
batchState.phase = BatchPhase.commit;
|
|
1311
|
-
for (const node of
|
|
1312
|
-
|
|
1411
|
+
for (const node of notify) {
|
|
1412
|
+
try {
|
|
1413
|
+
node.notify();
|
|
1414
|
+
} catch (error2) {
|
|
1415
|
+
if (failure2 === noFailure) failure2 = error2;
|
|
1416
|
+
}
|
|
1313
1417
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
batchState.depth--;
|
|
1318
|
-
if (batchState.depth === 0) {
|
|
1319
|
-
batchState.phase = BatchPhase.disabled;
|
|
1320
|
-
batchState.stale = [];
|
|
1321
|
-
}
|
|
1418
|
+
} while (i < stale.length);
|
|
1419
|
+
batchState.stale = [];
|
|
1420
|
+
notify.clear();
|
|
1322
1421
|
}
|
|
1422
|
+
batchState.depth--;
|
|
1423
|
+
batchState.phase = previousPhase;
|
|
1424
|
+
if (failure2 !== noFailure) throw failure2;
|
|
1323
1425
|
}
|
|
1324
1426
|
function batchRebuildNode(node) {
|
|
1325
1427
|
if (node.state === NodeState.valid) {
|
|
@@ -1330,17 +1432,10 @@ function batchRebuildNode(node) {
|
|
|
1330
1432
|
node.state = NodeState.stale;
|
|
1331
1433
|
node.disposeLifetime();
|
|
1332
1434
|
}
|
|
1333
|
-
|
|
1334
|
-
if (parent.state !== NodeState.valid) {
|
|
1335
|
-
batchRebuildNode(parent);
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
if (node.state !== NodeState.valid) {
|
|
1339
|
-
node.value();
|
|
1340
|
-
}
|
|
1435
|
+
node.value();
|
|
1341
1436
|
}
|
|
1342
1437
|
|
|
1343
|
-
// ../../node_modules/.bun/effect@
|
|
1438
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Atom.js
|
|
1344
1439
|
var Atom_exports = {};
|
|
1345
1440
|
__export(Atom_exports, {
|
|
1346
1441
|
Interrupt: () => Interrupt,
|
|
@@ -1400,12 +1495,13 @@ __export(Atom_exports, {
|
|
|
1400
1495
|
writable: () => writable
|
|
1401
1496
|
});
|
|
1402
1497
|
|
|
1403
|
-
// ../../node_modules/.bun/effect@
|
|
1498
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/persistence/KeyValueStore.js
|
|
1404
1499
|
var ErrorTypeId = "~effect/persistence/KeyValueStore/KeyValueStoreError";
|
|
1405
1500
|
var KeyValueStoreError = class extends (/* @__PURE__ */ TaggedError("KeyValueStoreError")) {
|
|
1406
1501
|
/**
|
|
1407
1502
|
* Marks this value as a key-value store error for runtime guards.
|
|
1408
1503
|
*
|
|
1504
|
+
* @stability unstable
|
|
1409
1505
|
* @since 4.0.0
|
|
1410
1506
|
*/
|
|
1411
1507
|
[ErrorTypeId] = ErrorTypeId;
|
|
@@ -1442,7 +1538,7 @@ var toSchemaStore = (self, schema) => {
|
|
|
1442
1538
|
};
|
|
1443
1539
|
};
|
|
1444
1540
|
|
|
1445
|
-
// ../../node_modules/.bun/effect@
|
|
1541
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Atom.js
|
|
1446
1542
|
var TypeId3 = "~effect/reactivity/Atom";
|
|
1447
1543
|
var isAtom = (u) => hasProperty(u, TypeId3);
|
|
1448
1544
|
var WritableTypeId = "~effect/reactivity/Atom/Writable";
|
|
@@ -1602,7 +1698,7 @@ var effect2 = (get5, effect3, options, services) => {
|
|
|
1602
1698
|
const initialValue2 = options?.initialValue !== void 0 ? success(options.initialValue) : initial();
|
|
1603
1699
|
return makeEffect(get5, effect3, initialValue2, services, options?.uninterruptible);
|
|
1604
1700
|
};
|
|
1605
|
-
function makeEffect(ctx, effect3, initialValue2, services =
|
|
1701
|
+
function makeEffect(ctx, effect3, initialValue2, services = empty(), uninterruptible = false) {
|
|
1606
1702
|
const previous = ctx.self();
|
|
1607
1703
|
const scope2 = makeUnsafe();
|
|
1608
1704
|
ctx.addFinalizer(() => {
|
|
@@ -1693,7 +1789,7 @@ var stream = (get5, stream2, options, services) => {
|
|
|
1693
1789
|
const initialValue2 = options?.initialValue !== void 0 ? success(options.initialValue) : initial();
|
|
1694
1790
|
return makeStream(get5, stream2, initialValue2, services);
|
|
1695
1791
|
};
|
|
1696
|
-
function makeStream(ctx, stream2, initialValue2, services =
|
|
1792
|
+
function makeStream(ctx, stream2, initialValue2, services = empty()) {
|
|
1697
1793
|
const previous = ctx.self();
|
|
1698
1794
|
services = add(services, AtomRegistry, ctx.registry);
|
|
1699
1795
|
const run = scopedWith((scope2) => flatMap2(toPullScoped(stream2.channel, scope2), (pull2) => whileLoop({
|
|
@@ -1732,7 +1828,7 @@ var subscriptionRef = (ref) => makeSubRef(readable((get5) => {
|
|
|
1732
1828
|
const value2 = typeof ref === "function" ? ref(get5) : ref;
|
|
1733
1829
|
return isSubscriptionRef(value2) ? value2 : makeEffect(get5, value2, initial(true));
|
|
1734
1830
|
}), readSubscriptionRef);
|
|
1735
|
-
var readSubscriptionRef = (get5, sub, services =
|
|
1831
|
+
var readSubscriptionRef = (get5, sub, services = empty()) => {
|
|
1736
1832
|
if (isSubscriptionRef(sub)) {
|
|
1737
1833
|
get5.addFinalizer(changes2(sub).pipe(runForEachArray((arr) => {
|
|
1738
1834
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -1828,8 +1924,9 @@ function makeResultFn(f, options) {
|
|
|
1828
1924
|
startImmediately: true
|
|
1829
1925
|
}), (fiber) => {
|
|
1830
1926
|
fibers.add(fiber);
|
|
1927
|
+
const runningFibers = Array.from(fibers);
|
|
1831
1928
|
fiber.addObserver(() => fibers.delete(fiber));
|
|
1832
|
-
return map2(joinAll(
|
|
1929
|
+
return map2(joinAll(runningFibers), (arr) => arr[0]);
|
|
1833
1930
|
});
|
|
1834
1931
|
}
|
|
1835
1932
|
return makeEffect(get5, value2, initialValue2, services, false);
|
|
@@ -1860,7 +1957,7 @@ var pull = (create, options) => {
|
|
|
1860
1957
|
var makeStreamPullEffect = (get5, pullSignal, create, options) => flatMap2(toPull(typeof create === "function" ? create(get5) : create), (pullChunk) => {
|
|
1861
1958
|
const fiber = getCurrent();
|
|
1862
1959
|
const services = fiber.context;
|
|
1863
|
-
let acc =
|
|
1960
|
+
let acc = empty2();
|
|
1864
1961
|
const pull2 = matchCauseEffect(pullChunk, {
|
|
1865
1962
|
onFailure(cause2) {
|
|
1866
1963
|
if (isDoneCause(cause2)) {
|
|
@@ -1923,7 +2020,10 @@ var family = typeof WeakRef === "undefined" || typeof FinalizationRegistry === "
|
|
|
1923
2020
|
} : (f) => {
|
|
1924
2021
|
const atoms = empty3();
|
|
1925
2022
|
const registry = new FinalizationRegistry((arg) => {
|
|
1926
|
-
|
|
2023
|
+
const entry = get2(atoms, arg);
|
|
2024
|
+
if (entry._tag === "Some" && entry.value.deref() === void 0) {
|
|
2025
|
+
remove(atoms, arg);
|
|
2026
|
+
}
|
|
1927
2027
|
});
|
|
1928
2028
|
return function(arg) {
|
|
1929
2029
|
const atomEntry = get2(atoms, arg).pipe(flatMapNullishOr((ref) => ref.deref()));
|
|
@@ -2049,7 +2149,15 @@ var swr = /* @__PURE__ */ dual(2, (self, options) => {
|
|
|
2049
2149
|
return current;
|
|
2050
2150
|
}
|
|
2051
2151
|
if (shouldRevalidateSWR(current, staleTime)) {
|
|
2052
|
-
|
|
2152
|
+
let active = true;
|
|
2153
|
+
get5.addFinalizer(() => {
|
|
2154
|
+
active = false;
|
|
2155
|
+
});
|
|
2156
|
+
get5.registry.schedulerAsync.makeDispatcher().scheduleTask(() => {
|
|
2157
|
+
if (active && shouldRevalidateSWR(get5.once(self), staleTime)) {
|
|
2158
|
+
get5.refresh(self);
|
|
2159
|
+
}
|
|
2160
|
+
}, 0);
|
|
2053
2161
|
}
|
|
2054
2162
|
return current;
|
|
2055
2163
|
}, {
|