@shivaedev/contract 0.40.0 → 0.42.0
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/CHANGELOG.md +26 -0
- package/README.md +12 -6
- package/dist/AutomaticQueryOptions.d.ts +22 -0
- package/dist/AutomaticQueryOptions.d.ts.map +1 -0
- package/dist/AutomaticQueryOptions.js +2 -0
- package/dist/AutomaticQueryOptions.js.map +1 -0
- package/dist/adapters/activityState.d.ts.map +1 -1
- package/dist/adapters/activityState.js +9 -1
- package/dist/adapters/activityState.js.map +1 -1
- package/dist/adapters/retainedQueries.d.ts +7 -0
- package/dist/adapters/retainedQueries.d.ts.map +1 -0
- package/dist/adapters/retainedQueries.js +45 -0
- package/dist/adapters/retainedQueries.js.map +1 -0
- package/dist/automaticLive.d.ts +1 -1
- package/dist/automaticLive.d.ts.map +1 -1
- package/dist/automaticLive.js +9 -7
- package/dist/automaticLive.js.map +1 -1
- package/dist/automaticQuery.d.ts +3 -17
- package/dist/automaticQuery.d.ts.map +1 -1
- package/dist/automaticQuery.js +12 -7
- package/dist/automaticQuery.js.map +1 -1
- package/dist/bind.d.ts +1 -2
- package/dist/bind.d.ts.map +1 -1
- package/dist/bind.js +8 -12
- package/dist/bind.js.map +1 -1
- package/dist/bindOperations.d.ts +6 -0
- package/dist/bindOperations.d.ts.map +1 -0
- package/dist/bindOperations.js +10 -0
- package/dist/bindOperations.js.map +1 -0
- package/dist/changesSuccess.d.ts +2 -3
- package/dist/changesSuccess.d.ts.map +1 -1
- package/dist/changesSuccess.js +2 -4
- package/dist/changesSuccess.js.map +1 -1
- package/dist/clientActivities.d.ts +2 -2
- package/dist/clientActivities.d.ts.map +1 -1
- package/dist/clientActivities.js +28 -12
- package/dist/clientActivities.js.map +1 -1
- package/dist/clientActivity.d.ts +4 -1
- package/dist/clientActivity.d.ts.map +1 -1
- package/dist/clientActivity.js +5 -2
- package/dist/clientActivity.js.map +1 -1
- package/dist/clientOperations.d.ts +1 -1
- package/dist/clientOperations.d.ts.map +1 -1
- package/dist/clientOperations.js +54 -51
- package/dist/clientOperations.js.map +1 -1
- package/dist/compareQueries.d.ts +1 -1
- package/dist/compareQueries.d.ts.map +1 -1
- package/dist/compareQueries.js +10 -4
- package/dist/compareQueries.js.map +1 -1
- package/dist/live-server/subscribe.js +1 -1
- package/dist/live-server/subscribe.js.map +1 -1
- package/dist/liveAttempt.d.ts.map +1 -1
- package/dist/liveAttempt.js +8 -2
- package/dist/liveAttempt.js.map +1 -1
- package/dist/publicConfig.d.ts +6 -1
- package/dist/publicConfig.d.ts.map +1 -1
- package/dist/queryDelivery.d.ts +3 -1
- package/dist/queryDelivery.d.ts.map +1 -1
- package/dist/queryDelivery.js +18 -5
- package/dist/queryDelivery.js.map +1 -1
- package/dist/queryHints.js +1 -1
- package/dist/queryHints.js.map +1 -1
- package/dist/queryRetention.d.ts +8 -0
- package/dist/queryRetention.d.ts.map +1 -0
- package/dist/queryRetention.js +3 -0
- package/dist/queryRetention.js.map +1 -0
- package/dist/querySignals.d.ts +1 -0
- package/dist/querySignals.d.ts.map +1 -1
- package/dist/querySignals.js.map +1 -1
- package/dist/retainQuery.d.ts +4 -0
- package/dist/retainQuery.d.ts.map +1 -0
- package/dist/retainQuery.js +38 -0
- package/dist/retainQuery.js.map +1 -0
- package/dist/rpcClient.d.ts +1 -1
- package/dist/rpcClient.d.ts.map +1 -1
- package/dist/rpcClient.js +4 -2
- package/dist/rpcClient.js.map +1 -1
- package/package.json +8 -8
- package/src/AutomaticQueryOptions.ts +22 -0
- package/src/adapters/activityState.ts +9 -1
- package/src/adapters/retainedQueries.ts +47 -0
- package/src/automaticLive.ts +11 -7
- package/src/automaticQuery.ts +16 -21
- package/src/bind.ts +16 -22
- package/src/bindOperations.ts +20 -0
- package/src/changesSuccess.ts +11 -14
- package/src/clientActivities.ts +29 -12
- package/src/clientActivity.ts +8 -2
- package/src/clientOperations.ts +79 -82
- package/src/compareQueries.ts +10 -4
- package/src/live-server/subscribe.ts +1 -1
- package/src/liveAttempt.ts +10 -2
- package/src/queryDelivery.ts +22 -5
- package/src/queryHints.ts +1 -1
- package/src/queryRetention.ts +9 -0
- package/src/querySignals.ts +1 -0
- package/src/retainQuery.ts +39 -0
- package/src/rpcClient.ts +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryDelivery.js","sourceRoot":"","sources":["../src/queryDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAI/D,MAAM,UAAU,aAAa,CAC5B,IAA8C,EAC9C,
|
|
1
|
+
{"version":3,"file":"queryDelivery.js","sourceRoot":"","sources":["../src/queryDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAI/D,MAAM,UAAU,aAAa,CAC5B,IAA8C,EAC9C,MAA6B,EAC7B,QAAiB,EACjB,MAA0B,EAC1B,OAAoC;IAEpC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAgC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/E,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAmB;QAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,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GAAG,CAAC,MAAM,CAAC,CAAC;gBAC5B,OAAO,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7D,CAAC,EACD,CAAC,OAAO,EAAE,EAAE;gBACX,OAAO,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC,CACD;QACH,MAAM,EAAE,CAAY,MAA6C,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;QACvG,OAAO;QACP,OAAO;KACP,CAAC;AACH,CAAC"}
|
package/dist/queryHints.js
CHANGED
package/dist/queryHints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryHints.js","sourceRoot":"","sources":["../src/queryHints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAY,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAIlF,MAAM,UAAU,cAAc,CAAC,IAAoB;IAClD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAsB,EAAE,OAAqD;IACtG,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO;QACN,IAAI
|
|
1
|
+
{"version":3,"file":"queryHints.js","sourceRoot":"","sources":["../src/queryHints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAY,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAIlF,MAAM,UAAU,cAAc,CAAC,IAAoB;IAClD,OA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AE,MAAoC;IACrF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO;QACN,IAAI,EAAE,SAAS;QACf,IAAI;QACJ,GAAG,CAAC,MAAM,KAAK,SAAS;YACvB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;KAC9H,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Duration } from "effect";
|
|
2
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
3
|
+
export interface QueryRetentionOptions {
|
|
4
|
+
readonly capacity?: number;
|
|
5
|
+
readonly timeToLive?: Duration.Input;
|
|
6
|
+
}
|
|
7
|
+
export declare const queryRetention: Atom.Writable<QueryRetentionOptions, QueryRetentionOptions>;
|
|
8
|
+
//# sourceMappingURL=queryRetention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryRetention.d.ts","sourceRoot":"","sources":["../src/queryRetention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,6DAAuD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryRetention.js","sourceRoot":"","sources":["../src/queryRetention.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAO/C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAwB,EAAE,CAAC,CAAC,CAAC"}
|
package/dist/querySignals.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as Atom from "effect/reactivity/Atom";
|
|
|
2
2
|
export interface QuerySignals {
|
|
3
3
|
readonly completed: number;
|
|
4
4
|
readonly pending: boolean;
|
|
5
|
+
readonly retained?: boolean;
|
|
5
6
|
readonly subscription: "disabled" | "opening" | "open" | "refused";
|
|
6
7
|
}
|
|
7
8
|
export declare function querySignals(query: Atom.Atom<unknown>): Atom.Writable<QuerySignals>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"querySignals.d.ts","sourceRoot":"","sources":["../src/querySignals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;CACnE;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAOnF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAEtF"}
|
|
1
|
+
{"version":3,"file":"querySignals.d.ts","sourceRoot":"","sources":["../src/querySignals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;CACnE;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAOnF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAEtF"}
|
package/dist/querySignals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"querySignals.js","sourceRoot":"","sources":["../src/querySignals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"querySignals.js","sourceRoot":"","sources":["../src/querySignals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAS/C,MAAM,MAAM,GAAG,IAAI,OAAO,EAAmD,CAAC;AAE9E,MAAM,UAAU,YAAY,CAAC,KAAyB;IACrD,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,KAAK,GAAG,IAAI,CAAC,IAAI,CAAe,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;QAC3F,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAyB,EAAE,MAA0B;IACtF,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
2
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
3
|
+
export declare function retainQuery<A, E>(runtime: Atom.AtomRuntime<unknown, unknown>, atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>): Atom.Atom<AsyncResult.AsyncResult<any, any> | AsyncResult.AsyncResult<A, E>>;
|
|
4
|
+
//# sourceMappingURL=retainQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retainQuery.d.ts","sourceRoot":"","sources":["../src/retainQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAM/C,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gFA8B5H"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Option } from "effect";
|
|
2
|
+
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
3
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
4
|
+
import { retainedQueries } from "#adapters/retainedQueries.ts";
|
|
5
|
+
import { queryCoalesceWindow } from "#queryCoalesceWindow.ts";
|
|
6
|
+
import { querySignals, shareQuerySignals } from "#querySignals.ts";
|
|
7
|
+
import { wrapAtom } from "#wrapAtom.ts";
|
|
8
|
+
export function retainQuery(runtime, atom) {
|
|
9
|
+
const snapshot = Atom.make(Option.none()).pipe(Atom.setIdleTTL(0));
|
|
10
|
+
const signals = querySignals(atom);
|
|
11
|
+
const retained = wrapAtom(atom, (get) => {
|
|
12
|
+
get.mount(snapshot);
|
|
13
|
+
const owner = get.once(retainedQueries);
|
|
14
|
+
owner.take(retained);
|
|
15
|
+
get.once(queryCoalesceWindow(retained));
|
|
16
|
+
get.subscribe(queryCoalesceWindow(retained), (value) => get.set(queryCoalesceWindow(atom), value), { immediate: true });
|
|
17
|
+
get.addFinalizer(() => {
|
|
18
|
+
if (get.registry.getNodes().has(snapshot) && Option.isSome(get.registry.get(snapshot))) {
|
|
19
|
+
owner.keep(retained, snapshot, runtime);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
function display(result) {
|
|
23
|
+
if (AsyncResult.isSuccess(result) && !result.waiting) {
|
|
24
|
+
get.set(snapshot, Option.some(result));
|
|
25
|
+
}
|
|
26
|
+
const kept = AsyncResult.isInitial(result) ? get.once(snapshot) : Option.none();
|
|
27
|
+
get.set(signals, { ...get.once(signals), retained: Option.isSome(kept) });
|
|
28
|
+
return Option.match(kept, { onNone: () => result, onSome: AsyncResult.waiting });
|
|
29
|
+
}
|
|
30
|
+
const context = new Proxy(get, {
|
|
31
|
+
get: (target, key, receiver) => key === "setSelf" ? (value) => get.setSelf(display(value)) : Reflect.get(target, key, receiver),
|
|
32
|
+
});
|
|
33
|
+
return display(atom.read(context));
|
|
34
|
+
}).pipe(Atom.setIdleTTL(0));
|
|
35
|
+
shareQuerySignals(retained, atom);
|
|
36
|
+
return retained;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=retainQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retainQuery.js","sourceRoot":"","sources":["../src/retain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CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;SAC/H,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClC,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
package/dist/rpcClient.d.ts
CHANGED
package/dist/rpcClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpcClient.d.ts","sourceRoot":"","sources":["../src/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"rpcClient.d.ts","sourceRoot":"","sources":["../src/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,KAAK,GAAG,EAAuB,MAAM,YAAY,CAAC;AAG3D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAUvD,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;CAChD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa;;;;;;;;+BA8DH,KAAK,eAAe,KAAK;;;EAKtG;AAED,eAAO,MAAM,cAAc,uDAA2C,CAAC"}
|
package/dist/rpcClient.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Effect, Layer, Stream } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, Option, Stream } from "effect";
|
|
2
2
|
import * as Atom from "effect/reactivity/Atom";
|
|
3
3
|
import * as AtomRpc from "effect/reactivity/AtomRpc";
|
|
4
4
|
import { RpcClient, RpcGroup } from "effect/rpc";
|
|
5
5
|
import { withClientProtocol } from "#adapters/withClientProtocol.ts";
|
|
6
6
|
import { Activity } from "#clientActivity.ts";
|
|
7
|
+
import { CommandInvalidation } from "#serverMetadata.ts";
|
|
7
8
|
import { clientActivities, makeActivity } from "./clientActivities.js";
|
|
8
9
|
import { connectionProtocol, protocolConnections } from "./connectionProtocol.js";
|
|
9
10
|
import { commandConnections } from "./connectionReadiness.js";
|
|
@@ -11,6 +12,7 @@ import { socketProtocol } from "./socketProtocol.js";
|
|
|
11
12
|
export function rpcClient(name, source, options) {
|
|
12
13
|
const activity = makeActivity(options.runtime ?? Atom.runtime);
|
|
13
14
|
const group = RpcGroup.make(...source.requests.values()).annotateMerge(source.annotations);
|
|
15
|
+
const commands = new Set([...group.requests].filter(([, rpc]) => Option.isSome(Context.getOption(rpc.annotations, CommandInvalidation))).map(([tag]) => tag));
|
|
14
16
|
function sharedProtocol(identity) {
|
|
15
17
|
return socketProtocol({
|
|
16
18
|
bearerToken: options.bearerToken,
|
|
@@ -43,7 +45,7 @@ export function rpcClient(name, source, options) {
|
|
|
43
45
|
// Publish after the consumer handles the hint so idle cannot race its invalidation.
|
|
44
46
|
return result.pipe(Stream.flatMap((hint) => Stream.concat(Stream.succeed(hint), Stream.fromEffect(Effect.sync(activity.hint)).pipe(Stream.drain))));
|
|
45
47
|
}
|
|
46
|
-
return Effect.isEffect(result) && !args[2]?.asQueue ? activity.track(result) : result;
|
|
48
|
+
return Effect.isEffect(result) && !args[2]?.asQueue ? activity.track(result, commands.has(args[0])) : result;
|
|
47
49
|
},
|
|
48
50
|
});
|
|
49
51
|
commandConnections.set(observed, wait);
|
package/dist/rpcClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../src/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"rpcClient.js","sourceRoot":"","sources":["../src/rpcClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAY,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AASrD,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,MAAiB,EAAE,OAAsB;IAChF,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,aAAa,CAA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W,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAc,EAAE,WAAkB,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAC3I,CACD,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;AACvH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAqB,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Typed query and command contracts over native Effect RPC and reactivity",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"@effect/platform-node": "4.1.0",
|
|
52
52
|
"@effect/vitest": "4.1.0",
|
|
53
53
|
"@shivaedev/errors": "0.10.0",
|
|
54
|
-
"@shivaedev/identity": "0.
|
|
55
|
-
"@shivaedev/quality": "0.
|
|
56
|
-
"@shivaedev/server": "0.
|
|
57
|
-
"@shivaedev/sql": "0.
|
|
58
|
-
"@shivaedev/test-kits": "0.
|
|
59
|
-
"@shivaedev/test-sql": "0.24.
|
|
60
|
-
"@shivaedev/test-story": "0.
|
|
54
|
+
"@shivaedev/identity": "0.29.1",
|
|
55
|
+
"@shivaedev/quality": "0.67.3",
|
|
56
|
+
"@shivaedev/server": "0.29.1",
|
|
57
|
+
"@shivaedev/sql": "0.44.0",
|
|
58
|
+
"@shivaedev/test-kits": "0.9.2",
|
|
59
|
+
"@shivaedev/test-sql": "0.24.2",
|
|
60
|
+
"@shivaedev/test-story": "0.44.1",
|
|
61
61
|
"@types/node": "24.19.2",
|
|
62
62
|
"effect": "4.1.0",
|
|
63
63
|
"esbuild": "0.28.2",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Duration } from "effect";
|
|
2
|
+
import type * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
3
|
+
import type * as Atom from "effect/reactivity/Atom";
|
|
4
|
+
import type { LiveBound, LiveConnection } from "#automaticLive.ts";
|
|
5
|
+
import type { LiveStatus } from "#live.ts";
|
|
6
|
+
import type { QuerySignals } from "#querySignals.ts";
|
|
7
|
+
|
|
8
|
+
export interface AutomaticQueryOptions<A, E> {
|
|
9
|
+
readonly atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>;
|
|
10
|
+
readonly clientStatuses: Atom.Writable<ReadonlyMap<object, LiveStatus<unknown>>> | undefined;
|
|
11
|
+
readonly coalesceWindow: Atom.Writable<Duration.Input>;
|
|
12
|
+
readonly equivalent: (left: A, right: A) => boolean;
|
|
13
|
+
readonly paused: Atom.Writable<boolean>;
|
|
14
|
+
readonly pushed: boolean;
|
|
15
|
+
readonly ready: Atom.Writable<boolean>;
|
|
16
|
+
readonly resultVersion: Atom.Atom<number>;
|
|
17
|
+
readonly signals: Atom.Writable<QuerySignals>;
|
|
18
|
+
readonly source: Atom.Atom<AsyncResult.AsyncResult<A, E>>;
|
|
19
|
+
readonly statuses: Atom.Writable<ReadonlyMap<object, LiveStatus<unknown>>>;
|
|
20
|
+
readonly subscription: LiveBound[typeof LiveConnection];
|
|
21
|
+
readonly subscriptionVersion: Atom.Atom<number>;
|
|
22
|
+
}
|
|
@@ -5,7 +5,15 @@ export function activityState() {
|
|
|
5
5
|
let held = 0;
|
|
6
6
|
let connection: ConnectionStatus = "live";
|
|
7
7
|
const state = Effect.runSync(
|
|
8
|
-
SubscriptionRef.make<ClientActivityState>({
|
|
8
|
+
SubscriptionRef.make<ClientActivityState>({
|
|
9
|
+
commands: 0,
|
|
10
|
+
connectionStatus: "live",
|
|
11
|
+
initialQueries: 0,
|
|
12
|
+
liveHints: 0,
|
|
13
|
+
liveInvalidations: 0,
|
|
14
|
+
refreshingAtoms: 0,
|
|
15
|
+
rpcCalls: 0,
|
|
16
|
+
}),
|
|
9
17
|
);
|
|
10
18
|
function publish() {
|
|
11
19
|
const connectionStatus = held > 0 ? "waiting-for-connection" : connection;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Duration, Effect, Option } from "effect";
|
|
2
|
+
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
3
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
4
|
+
import { queryRetention } from "#queryRetention.ts";
|
|
5
|
+
|
|
6
|
+
export const retainedQueries = Atom.keepAlive(
|
|
7
|
+
Atom.make((get) => {
|
|
8
|
+
const idle = new Map<Atom.Atom<unknown>, { readonly release: () => void; readonly expire: () => void }>();
|
|
9
|
+
get.addFinalizer(() => idle.clear());
|
|
10
|
+
return {
|
|
11
|
+
keep: <A>(query: Atom.Atom<unknown>, snapshot: Atom.Writable<Option.Option<A>>, runtime: Atom.AtomRuntime<unknown, unknown>) => {
|
|
12
|
+
const { capacity = 100, timeToLive = "5 minutes" } = get.registry.get(queryRetention);
|
|
13
|
+
const duration = Duration.fromInputUnsafe(timeToLive);
|
|
14
|
+
if (capacity <= 0 || Duration.toMillis(duration) <= 0) {
|
|
15
|
+
get.registry.set(snapshot, Option.none());
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const registry = get.registry;
|
|
19
|
+
const unmount = registry.mount(snapshot);
|
|
20
|
+
function release() {
|
|
21
|
+
idle.delete(query);
|
|
22
|
+
stop();
|
|
23
|
+
unmount();
|
|
24
|
+
}
|
|
25
|
+
function expire() {
|
|
26
|
+
registry.set(snapshot, Option.none());
|
|
27
|
+
release();
|
|
28
|
+
}
|
|
29
|
+
idle.set(query, { expire, release });
|
|
30
|
+
const timer = Atom.make((context) => {
|
|
31
|
+
const services = context(runtime);
|
|
32
|
+
if (AsyncResult.isSuccess(services)) {
|
|
33
|
+
context.addFinalizer(Effect.runCallbackWith(services.value)(Effect.sleep(duration).pipe(Effect.andThen(Effect.sync(expire)))));
|
|
34
|
+
}
|
|
35
|
+
}).pipe(Atom.setIdleTTL(0));
|
|
36
|
+
const stop = registry.mount(timer);
|
|
37
|
+
while (idle.size > capacity) {
|
|
38
|
+
const oldest = idle.keys().next().value;
|
|
39
|
+
if (oldest !== undefined) {
|
|
40
|
+
idle.get(oldest)?.expire();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
take: (atom: Atom.Atom<unknown>) => idle.get(atom)?.release(),
|
|
45
|
+
};
|
|
46
|
+
}),
|
|
47
|
+
);
|
package/src/automaticLive.ts
CHANGED
|
@@ -74,22 +74,24 @@ export function automaticLive(
|
|
|
74
74
|
reference: QueryReference,
|
|
75
75
|
keys: readonly Key[],
|
|
76
76
|
equivalent: (left: A, right: A) => boolean,
|
|
77
|
-
decode
|
|
77
|
+
decode: (value: unknown) => A,
|
|
78
|
+
compared: boolean,
|
|
79
|
+
reactive: (source: Atom.Atom<AsyncResult.AsyncResult<A, E>>) => Atom.Atom<AsyncResult.AsyncResult<A, E>>,
|
|
78
80
|
headers?: Headers.Input,
|
|
79
81
|
) {
|
|
80
82
|
if (!enabled) {
|
|
81
|
-
return queryProgress(atom);
|
|
83
|
+
return queryProgress(reactive(atom));
|
|
82
84
|
}
|
|
83
85
|
const ready = Atom.make(false);
|
|
84
86
|
const signals = querySignals(atom);
|
|
85
|
-
const delivery = queryDelivery(atom, decode, paused, signals);
|
|
86
|
-
const source =
|
|
87
|
+
const delivery = queryDelivery(atom, decode, compared, paused, signals);
|
|
88
|
+
const source = compared ? delivery.atom : reactive(delivery.atom.pipe(Atom.setIdleTTL(0)));
|
|
87
89
|
const subscription = live(service.runtime, {
|
|
88
90
|
initialResync: false,
|
|
89
91
|
keyContext: owner?.context,
|
|
90
|
-
reopenOnResume:
|
|
92
|
+
reopenOnResume: compared,
|
|
91
93
|
resume: signal,
|
|
92
|
-
resyncKeys:
|
|
94
|
+
resyncKeys: compared ? [] : localQueryKeys(keys),
|
|
93
95
|
retryKeys: keys,
|
|
94
96
|
stream: Stream.unwrap(service.use((client) => Effect.succeed(client(`${name}.$changes`, { queries: [reference] }, { headers })))).pipe(
|
|
95
97
|
delivery.stream,
|
|
@@ -103,12 +105,14 @@ export function automaticLive(
|
|
|
103
105
|
coalesceWindow,
|
|
104
106
|
equivalent,
|
|
105
107
|
paused,
|
|
106
|
-
pushed:
|
|
108
|
+
pushed: compared,
|
|
107
109
|
ready,
|
|
110
|
+
resultVersion: delivery.version,
|
|
108
111
|
signals,
|
|
109
112
|
source,
|
|
110
113
|
statuses,
|
|
111
114
|
subscription,
|
|
115
|
+
subscriptionVersion: delivery.updates,
|
|
112
116
|
});
|
|
113
117
|
shareQuerySignals(gated, atom);
|
|
114
118
|
Object.assign(gated, { initialValueTarget: atom });
|
package/src/automaticQuery.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import { Cause,
|
|
1
|
+
import { Cause, Option, Predicate } from "effect";
|
|
2
2
|
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
3
3
|
import * as Atom from "effect/reactivity/Atom";
|
|
4
|
-
import type {
|
|
4
|
+
import type { AutomaticQueryOptions } from "#AutomaticQueryOptions.ts";
|
|
5
5
|
import type { LiveStatus } from "#live.ts";
|
|
6
6
|
import { queryCoalesceWindow } from "#queryCoalesceWindow.ts";
|
|
7
7
|
import { queryFailure } from "#queryFailure.ts";
|
|
8
8
|
import { recordCompletion, recordSubscription } from "#queryProgress.ts";
|
|
9
9
|
import { queryResult } from "#queryResult.ts";
|
|
10
|
-
import type { QuerySignals } from "#querySignals.ts";
|
|
11
10
|
|
|
12
|
-
interface GateOptions<A, E> {
|
|
11
|
+
interface GateOptions<A, E> extends AutomaticQueryOptions<A, E> {
|
|
13
12
|
readonly assertOwner: (get: Atom.AtomContext) => void;
|
|
14
|
-
readonly atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>;
|
|
15
|
-
readonly clientStatuses: Atom.Writable<ReadonlyMap<object, LiveStatus<unknown>>> | undefined;
|
|
16
|
-
readonly coalesceWindow: Atom.Writable<Duration.Input>;
|
|
17
|
-
readonly equivalent: (left: A, right: A) => boolean;
|
|
18
|
-
readonly paused: Atom.Writable<boolean>;
|
|
19
|
-
readonly pushed: boolean;
|
|
20
|
-
readonly ready: Atom.Writable<boolean>;
|
|
21
|
-
readonly signals: Atom.Writable<QuerySignals>;
|
|
22
|
-
readonly source: Atom.Atom<AsyncResult.AsyncResult<A, E>>;
|
|
23
|
-
readonly statuses: Atom.Writable<ReadonlyMap<object, LiveStatus<unknown>>>;
|
|
24
|
-
readonly subscription: LiveBound[typeof LiveConnection];
|
|
25
13
|
}
|
|
26
14
|
export function automaticQuery<A, E>({
|
|
27
15
|
atom,
|
|
@@ -32,15 +20,21 @@ export function automaticQuery<A, E>({
|
|
|
32
20
|
paused,
|
|
33
21
|
pushed,
|
|
34
22
|
ready,
|
|
23
|
+
resultVersion,
|
|
35
24
|
signals,
|
|
36
25
|
source,
|
|
37
26
|
statuses,
|
|
38
27
|
subscription,
|
|
28
|
+
subscriptionVersion,
|
|
39
29
|
}: GateOptions<A, E>) {
|
|
40
30
|
const gated = Atom.readable(
|
|
41
31
|
(get) => {
|
|
42
32
|
assertOwner(get);
|
|
43
33
|
get.mount(signals);
|
|
34
|
+
get.mount(resultVersion);
|
|
35
|
+
get.mount(subscriptionVersion);
|
|
36
|
+
const openingVersion = get.once(subscriptionVersion);
|
|
37
|
+
get.refresh(subscription.connection);
|
|
44
38
|
const registry = get.registry;
|
|
45
39
|
const dispatcher = registry.schedulerAsync.makeDispatcher();
|
|
46
40
|
let denied = false;
|
|
@@ -49,7 +43,7 @@ export function automaticQuery<A, E>({
|
|
|
49
43
|
get.set(ready, false);
|
|
50
44
|
get.set(signals, { ...get.once(signals), pending: true, subscription: "opening" });
|
|
51
45
|
get.once(queryCoalesceWindow(gated));
|
|
52
|
-
get.subscribe(queryCoalesceWindow(gated), (value) => get.set(queryCoalesceWindow(
|
|
46
|
+
get.subscribe(queryCoalesceWindow(gated), (value) => get.set(queryCoalesceWindow(source), value), { immediate: true });
|
|
53
47
|
const token = {};
|
|
54
48
|
let active = true;
|
|
55
49
|
function observe(value: LiveStatus<unknown>) {
|
|
@@ -61,7 +55,7 @@ export function automaticQuery<A, E>({
|
|
|
61
55
|
}
|
|
62
56
|
}
|
|
63
57
|
}, 0);
|
|
64
|
-
if (value.connection === "live") {
|
|
58
|
+
if (value.connection === "live" && get.once(subscriptionVersion) > openingVersion) {
|
|
65
59
|
denied = false;
|
|
66
60
|
registry.set(ready, true);
|
|
67
61
|
}
|
|
@@ -81,22 +75,22 @@ export function automaticQuery<A, E>({
|
|
|
81
75
|
get.addFinalizer(registry.subscribe(subscription.status, observe, { immediate: true }));
|
|
82
76
|
get.addFinalizer(registry.subscribe(coalesceWindow, (value) => registry.set(subscription.coalesceWindow, value), { immediate: true }));
|
|
83
77
|
let started = false;
|
|
78
|
+
let deniedVersion = 0;
|
|
84
79
|
function start() {
|
|
85
80
|
if (stopSource !== undefined) {
|
|
86
81
|
return;
|
|
87
82
|
}
|
|
88
|
-
|
|
89
|
-
if (!pushed) {
|
|
83
|
+
if (!pushed && get.once(resultVersion) === deniedVersion) {
|
|
90
84
|
get.refresh(source);
|
|
91
85
|
}
|
|
86
|
+
started = true;
|
|
92
87
|
const publish = queryResult<A, E>(equivalent, (value) => {
|
|
93
88
|
if (!denied) {
|
|
94
89
|
get.setSelf(value);
|
|
95
90
|
get.set(signals, recordCompletion(get.once(signals), value));
|
|
96
91
|
}
|
|
97
92
|
});
|
|
98
|
-
stopSource = registry.subscribe(source, publish);
|
|
99
|
-
publish(get.once(source));
|
|
93
|
+
stopSource = registry.subscribe(source, publish, { immediate: true });
|
|
100
94
|
}
|
|
101
95
|
get.once(ready);
|
|
102
96
|
get.subscribe(ready, (value) => {
|
|
@@ -109,6 +103,7 @@ export function automaticQuery<A, E>({
|
|
|
109
103
|
(cause) => {
|
|
110
104
|
if (Option.exists(Cause.findErrorOption(cause), Predicate.isTagged("QueryReadDenied"))) {
|
|
111
105
|
denied = true;
|
|
106
|
+
deniedVersion = get.once(resultVersion);
|
|
112
107
|
registry.set(ready, false);
|
|
113
108
|
stopSource?.();
|
|
114
109
|
stopSource = undefined;
|
package/src/bind.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Effect, Layer, Stream } from "effect";
|
|
2
2
|
import type { Headers } from "effect/http";
|
|
3
3
|
import type * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
4
4
|
import type * as Atom from "effect/reactivity/Atom";
|
|
@@ -8,7 +8,8 @@ import type * as Reactivity from "effect/reactivity/Reactivity";
|
|
|
8
8
|
import type { Rpc, RpcGroup } from "effect/rpc";
|
|
9
9
|
import type { RpcClientError } from "effect/rpc/RpcClientError";
|
|
10
10
|
import { bindingOwner } from "#adapters/bindingOwner.ts";
|
|
11
|
-
import { automaticLive, type LiveBound
|
|
11
|
+
import { automaticLive, type LiveBound } from "#automaticLive.ts";
|
|
12
|
+
import { bindOperations } from "#bindOperations.ts";
|
|
12
13
|
import { clientOperations } from "#clientOperations.ts";
|
|
13
14
|
import type { ClientOptions, MadeClient } from "#clientOptions.ts";
|
|
14
15
|
import type { Contract, Declared } from "#contract.ts";
|
|
@@ -27,7 +28,6 @@ export type RunFailure<R extends Rpc.Any> = Failure<R>;
|
|
|
27
28
|
export interface QueryOptions {
|
|
28
29
|
readonly headers?: Headers.Input;
|
|
29
30
|
readonly serializationKey?: string;
|
|
30
|
-
readonly timeToLive?: Duration.Input;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface BoundQuery<R extends Rpc.Any, TSelf, TSubscription extends Rpc.Any = never> {
|
|
@@ -95,26 +95,10 @@ export function bind(
|
|
|
95
95
|
service: AtomRpc.AtomRpcClient<unknown, string, Rpc.Any>,
|
|
96
96
|
options?: BindOptions,
|
|
97
97
|
): unknown {
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function bindApi(
|
|
102
|
-
contract: { readonly declaration: Declared<string, readonly QueryShape[], readonly CommandShape[], readonly StreamShape[], "session" | undefined> },
|
|
103
|
-
service: AtomRpc.AtomRpcClient<unknown, string, Rpc.Any>,
|
|
104
|
-
options?: BindOptions,
|
|
105
|
-
) {
|
|
106
|
-
const { name, queries, commands, streams, keyScope } = contract.declaration;
|
|
98
|
+
const { name, keyScope } = contract.declaration;
|
|
107
99
|
const owner = bindingOwner(keyScope, options?.registry);
|
|
108
100
|
const automatic = automaticLive(service, name, owner, options?.resume, options?.live, options?.resumeWindow);
|
|
109
|
-
|
|
110
|
-
return Object.assign(
|
|
111
|
-
Object.fromEntries([
|
|
112
|
-
...queries.map((query) => [query.name, operations.query(`${name}.${query.name}`, query)] as const),
|
|
113
|
-
...commands.map((command) => [command.name, operations.command(`${name}.${command.name}`, command)] as const),
|
|
114
|
-
...streams.map((stream) => [stream.name, operations.stream(`${name}.${stream.name}`)] as const),
|
|
115
|
-
]),
|
|
116
|
-
{ [LiveConnection]: automatic.subscription },
|
|
117
|
-
);
|
|
101
|
+
return bindOperations(contract.declaration, clientOperations(service, automatic, owner), automatic.subscription);
|
|
118
102
|
}
|
|
119
103
|
|
|
120
104
|
export function makeClient<
|
|
@@ -141,6 +125,16 @@ export function makeClient(
|
|
|
141
125
|
},
|
|
142
126
|
): Layer.Layer<never> {
|
|
143
127
|
const connection = rpcClient(contract.declaration.name, options.group ?? contract, options);
|
|
144
|
-
const
|
|
128
|
+
const bindingOptions: BindOptions = options;
|
|
129
|
+
const owner = bindingOwner(contract.declaration.keyScope, bindingOptions.registry);
|
|
130
|
+
const automatic = automaticLive(
|
|
131
|
+
connection.Client,
|
|
132
|
+
contract.declaration.name,
|
|
133
|
+
owner,
|
|
134
|
+
bindingOptions.resume,
|
|
135
|
+
bindingOptions.live,
|
|
136
|
+
bindingOptions.resumeWindow,
|
|
137
|
+
);
|
|
138
|
+
const api = bindOperations(contract.declaration, clientOperations(connection.Client, automatic, owner), automatic.subscription);
|
|
145
139
|
return Object.assign(connection, { api });
|
|
146
140
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type LiveBound, LiveConnection } from "#automaticLive.ts";
|
|
2
|
+
import type { clientOperations } from "#clientOperations.ts";
|
|
3
|
+
import type { Declared } from "#contract.ts";
|
|
4
|
+
import type { CommandShape, QueryShape, StreamShape } from "#operation.ts";
|
|
5
|
+
|
|
6
|
+
export function bindOperations(
|
|
7
|
+
declaration: Declared<string, readonly QueryShape[], readonly CommandShape[], readonly StreamShape[], "session" | undefined>,
|
|
8
|
+
operations: ReturnType<typeof clientOperations>,
|
|
9
|
+
subscription: LiveBound[typeof LiveConnection],
|
|
10
|
+
) {
|
|
11
|
+
const { name, queries, commands, streams } = declaration;
|
|
12
|
+
return Object.assign(
|
|
13
|
+
Object.fromEntries([
|
|
14
|
+
...queries.map((query) => [query.name, operations.query(`${name}.${query.name}`, query)] as const),
|
|
15
|
+
...commands.map((command) => [command.name, operations.command(`${name}.${command.name}`, command)] as const),
|
|
16
|
+
...streams.map((stream) => [stream.name, operations.stream(`${name}.${stream.name}`)] as const),
|
|
17
|
+
]),
|
|
18
|
+
{ [LiveConnection]: subscription },
|
|
19
|
+
);
|
|
20
|
+
}
|
package/src/changesSuccess.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { QueryReadDenied } from "#readPolicyErrors.ts";
|
|
|
5
5
|
|
|
6
6
|
export const QueryUnchanged = Schema.Struct({ _tag: Schema.Literal("Unchanged"), queryIndex: Schema.Number });
|
|
7
7
|
|
|
8
|
-
type Rerun<TQuery extends QueryShape> = TQuery extends QueryShape ? ("rerun-and-compare" extends TQuery["live"] ? TQuery : never) : never;
|
|
9
8
|
type ResultSchema<TQuery extends QueryShape> = TQuery extends QueryShape
|
|
10
9
|
?
|
|
11
10
|
| Schema.Struct<{
|
|
@@ -14,26 +13,24 @@ type ResultSchema<TQuery extends QueryShape> = TQuery extends QueryShape
|
|
|
14
13
|
queryIndex: Schema.Number;
|
|
15
14
|
value: TQuery["success"];
|
|
16
15
|
}>
|
|
17
|
-
| typeof QueryUnchanged
|
|
16
|
+
| ("rerun-and-compare" extends TQuery["live"] ? typeof QueryUnchanged : never)
|
|
18
17
|
: never;
|
|
19
18
|
|
|
20
19
|
export function changesSuccess<const TQueries extends readonly QueryShape[]>(
|
|
21
20
|
queries: TQueries,
|
|
22
|
-
): Schema.Union<readonly [typeof LiveHint, typeof QueryReadDenied, ...ResultSchema<
|
|
21
|
+
): Schema.Union<readonly [typeof LiveHint, typeof QueryReadDenied, ...ResultSchema<TQueries[number]>[]]>;
|
|
23
22
|
export function changesSuccess(queries: readonly QueryShape[]) {
|
|
24
23
|
return Schema.Union([
|
|
25
24
|
LiveHint,
|
|
26
25
|
QueryReadDenied,
|
|
27
|
-
...queries
|
|
28
|
-
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
Schema.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}),
|
|
37
|
-
]),
|
|
26
|
+
...queries.flatMap((query) => [
|
|
27
|
+
...(query.live === "rerun-and-compare" ? [QueryUnchanged] : []),
|
|
28
|
+
Schema.Struct({
|
|
29
|
+
_tag: Schema.Literal("Result"),
|
|
30
|
+
query: Schema.Literal(query.name),
|
|
31
|
+
queryIndex: Schema.Number,
|
|
32
|
+
value: query.success,
|
|
33
|
+
}),
|
|
34
|
+
]),
|
|
38
35
|
]);
|
|
39
36
|
}
|