@shivaedev/test-story 0.44.2 → 0.45.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/CHANGELOG.md +12 -0
- package/README.md +3 -3
- package/dist/server/browserReadObserver.d.ts +3 -51
- package/dist/server/browserReadObserver.d.ts.map +1 -1
- package/dist/server/browserReadObserver.js +2 -3
- package/dist/server/browserReadObserver.js.map +1 -1
- package/dist/server/browserReads.d.ts +2 -51
- package/dist/server/browserReads.d.ts.map +1 -1
- package/dist/server/observeBrowser.d.ts +2 -51
- package/dist/server/observeBrowser.d.ts.map +1 -1
- package/package.json +16 -15
- package/src/server/browserReadObserver.ts +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.45.1 - 2026-11-07
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Update `@shivaedev/test-sql` from 0.24.3 to 0.24.4.
|
|
8
|
+
|
|
9
|
+
## 0.45.0 - 2026-11-06
|
|
10
|
+
|
|
11
|
+
### Breaking
|
|
12
|
+
|
|
13
|
+
- Browser observers receive pushed query updates. Replace `heardKeys` assertions with delivered values or rendered screens; `hints` and `watchHints` now observe `Result`, `Unchanged` and `QueryReadDenied`.
|
|
14
|
+
|
|
3
15
|
## 0.44.2 - 2026-11-06
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/README.md
CHANGED
|
@@ -1031,7 +1031,7 @@ expect(screen.text("output")).toBe("Saved title");
|
|
|
1031
1031
|
|
|
1032
1032
|
`settle()` waits until every supplied source is settled together, then flushes the renderer before returning. A source that becomes busy while another finishes keeps the wait open. `pending` and `transport` each accept the same sampler, boolean stream or `ScreenSignal` shape; `activity` accepts a `ScreenSignal`; contract owns the projection from native `ClientActivity`. It observes changes from all three without sleeps, quiet windows or polling. With `activityScreenSignal(clientActivity(client))`, the default is commands in flight and each mounted query's first result. A live query that has already delivered, including one awaiting a later refresh, is normal screen state and keeps no wait open. Contract uses its query/command declarations, so kits list no queries as settling exceptions. `find()` waits for settled activity and a matching target, including a target rendered by a later DOM mutation. To wait for a particular changed value, use `findText()` or an explicit live-change wait.
|
|
1033
1033
|
|
|
1034
|
-
|
|
1034
|
+
`nextLiveHint()` waits for the next pushed subscription update received after the verb starts, including first results and server reconciliation results. Start the wait before another viewer writes, then settle the screen after the update arrives. Server coalescing is automatic, and the client makes no follow-up read. A held server rerun leaves the current value visible and does not block a command receipt's settlement. `activityScreenSignal(activity, isClientIdle)` also waits for finite calls and pending query atoms; both functions come from `@shivaedev/contract/clientActivity.ts`. If the client activity stream ends without an update, the wait fails with `SignalNotReceived` from `server/until.ts`. It needs `activity` or a `ScreenSignal` in `pending`; a callback-only driver fails with `MissingClientActivity`. Existing `pending: activityScreenSignal(clientActivity(client))` wiring remains supported.
|
|
1035
1035
|
|
|
1036
1036
|
For screens with runtime timers, acquire `const clock = yield* watchedClock` from `server/watchedClock.ts` during kit creation and pass `clock` to `screenDriver({ act, clock, pending, root, tell })`. Supply that same Clock to the application's atom runtime. While the supplied completion sources are busy, screen waits advance to the next registered sleep inside the supplied renderer `act`, then check completion again. Canceled sleeps are removed. A debounced search can therefore use `enter` followed by `settle` without a real wait or its debounce duration in a kit verb. Clock advancement is opt-in; the driver leaves time alone without `clock`. It advances the shared clock, including other scheduled work, so use explicit `clock.adjust(duration)` inside `act` when a story needs to observe a time boundary, such as holding a diary row for a long press.
|
|
1037
1037
|
|
|
@@ -1078,11 +1078,11 @@ const observed = yield* browserReads({ contracts: [Notes], url });
|
|
|
1078
1078
|
const client = makeClient(Notes, { protocol: observed.protocol, url });
|
|
1079
1079
|
```
|
|
1080
1080
|
|
|
1081
|
-
Expose `observed.readCount`, `observed.reads`, `observed.hints
|
|
1081
|
+
Expose `observed.readCount`, `observed.reads`, `observed.hints` and `observed.watchHints` through the kit's verbs. `readCount()` counts query requests and `$changes` subscription openings; `readCount("notes.list")` selects one tag. `reads()` returns their `tag`, encoded `payload` and `kind` (`"query"` or `"subscription"`), in send order. Commands and protocol acknowledgements do not count. `hints()` returns pushed `Result`, `Unchanged` and `QueryReadDenied` updates. Server reconciliation sends current query values without client read requests. Assert those values or the rendered screen.
|
|
1082
1082
|
|
|
1083
1083
|
`observed.subscriptions()` returns each opening's `tag`, encoded `payload` and `state`: `"open"`, `"answered"` after its first streamed value, `"refused"` with `refusalTag` from a tagged failure Exit, or `"closed"` when the stream completes empty, dies or disconnects before answering. A refusal or closure is not a hint. Expose `observed.waitForSubscriptions` through the kit and `yield* waitForSubscriptions` after the page has opened its subscriptions. It waits on response signals until every opening has answered, been refused or closed. Closing a client also closes its unanswered openings and leaves other clients' openings pending. It has no polling budget and resolves immediately when no opening is pending. It does not wait for future navigation to open subscriptions or for React to render.
|
|
1084
1084
|
|
|
1085
|
-
A story calls `const hints = yield* watchHints()` before the write, then `yield* hints.next` to await its browser delivery. Each watcher buffers its own future deliveries until the calling Scope closes. The wait uses the transport's signal with no polling budget. A hint means the browser received it; wait on the application's query or screen signal separately before asserting its rendered result or
|
|
1085
|
+
A story calls `const hints = yield* watchHints()` before the write, then `yield* hints.next` to await its browser delivery. Each watcher buffers its own future deliveries until the calling Scope closes. The wait uses the transport's signal with no polling budget. A hint means the browser received it; wait on the application's query or screen signal separately before asserting its rendered result or request count. Give another page its own readout to keep its traffic separate.
|
|
1086
1086
|
|
|
1087
1087
|
### API by module
|
|
1088
1088
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as RpcClient from "effect/rpc/RpcClient";
|
|
3
3
|
import type * as RpcMessage from "effect/rpc/RpcMessage";
|
|
4
|
+
import { QueryUpdate } from "@shivaedev/contract/queryUpdate.ts";
|
|
4
5
|
import type { BrowserRead } from "#server/browserReads.ts";
|
|
5
6
|
export declare const browserReadObserver: (contracts: readonly {
|
|
6
7
|
readonly declaration: {
|
|
@@ -10,38 +11,7 @@ export declare const browserReadObserver: (contracts: readonly {
|
|
|
10
11
|
}[];
|
|
11
12
|
};
|
|
12
13
|
}[]) => Effect.Effect<{
|
|
13
|
-
|
|
14
|
-
readonly _tag: "Bucket";
|
|
15
|
-
readonly collection: string;
|
|
16
|
-
readonly field: string;
|
|
17
|
-
readonly value: string | number;
|
|
18
|
-
} | {
|
|
19
|
-
readonly _tag: "List";
|
|
20
|
-
readonly collection: string;
|
|
21
|
-
} | {
|
|
22
|
-
readonly _tag: "Item";
|
|
23
|
-
readonly collection: string;
|
|
24
|
-
readonly id: string | number;
|
|
25
|
-
})[];
|
|
26
|
-
hints: () => ({
|
|
27
|
-
readonly _tag: "Changed";
|
|
28
|
-
readonly keys: readonly ({
|
|
29
|
-
readonly _tag: "Bucket";
|
|
30
|
-
readonly collection: string;
|
|
31
|
-
readonly field: string;
|
|
32
|
-
readonly value: string | number;
|
|
33
|
-
} | {
|
|
34
|
-
readonly _tag: "List";
|
|
35
|
-
readonly collection: string;
|
|
36
|
-
} | {
|
|
37
|
-
readonly _tag: "Item";
|
|
38
|
-
readonly collection: string;
|
|
39
|
-
readonly id: string | number;
|
|
40
|
-
})[];
|
|
41
|
-
readonly queryIndexes?: readonly number[] | undefined;
|
|
42
|
-
} | {
|
|
43
|
-
readonly _tag: "Resync";
|
|
44
|
-
})[];
|
|
14
|
+
hints: () => QueryUpdate[];
|
|
45
15
|
observeProtocol: Effect.Effect<{
|
|
46
16
|
readonly run: (clientId: number, f: (data: RpcMessage.FromServerEncoded) => Effect.Effect<void>) => Effect.Effect<never>;
|
|
47
17
|
readonly send: (clientId: number, request: RpcMessage.FromClientEncoded, transferables?: ReadonlyArray<globalThis.Transferable>) => Effect.Effect<void, import("effect/rpc/RpcClientError").RpcClientError>;
|
|
@@ -63,25 +33,7 @@ export declare const browserReadObserver: (contracts: readonly {
|
|
|
63
33
|
})[];
|
|
64
34
|
waitForSubscriptions: Effect.Effect<void, never, never>;
|
|
65
35
|
watchHints: () => Effect.Effect<{
|
|
66
|
-
next: Effect.Effect<
|
|
67
|
-
readonly _tag: "Changed";
|
|
68
|
-
readonly keys: readonly ({
|
|
69
|
-
readonly _tag: "Bucket";
|
|
70
|
-
readonly collection: string;
|
|
71
|
-
readonly field: string;
|
|
72
|
-
readonly value: string | number;
|
|
73
|
-
} | {
|
|
74
|
-
readonly _tag: "List";
|
|
75
|
-
readonly collection: string;
|
|
76
|
-
} | {
|
|
77
|
-
readonly _tag: "Item";
|
|
78
|
-
readonly collection: string;
|
|
79
|
-
readonly id: string | number;
|
|
80
|
-
})[];
|
|
81
|
-
readonly queryIndexes?: readonly number[] | undefined;
|
|
82
|
-
} | {
|
|
83
|
-
readonly _tag: "Resync";
|
|
84
|
-
}, never, never>;
|
|
36
|
+
next: Effect.Effect<QueryUpdate, never, never>;
|
|
85
37
|
}, never, import("effect/Scope").Scope>;
|
|
86
38
|
}, never, import("effect/Scope").Scope>;
|
|
87
39
|
//# sourceMappingURL=browserReadObserver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserReadObserver.d.ts","sourceRoot":"","sources":["../../src/server/browserReadObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,KAAK,UAAU,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"browserReadObserver.d.ts","sourceRoot":"","sources":["../../src/server/browserReadObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,KAAK,UAAU,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AAGhF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;sBAuEZ,MAAM;;;;;;;;;;;;;;;;uCAMxB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as PubSub from "effect/PubSub";
|
|
3
3
|
import * as RpcClient from "effect/rpc/RpcClient";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
|
-
import {
|
|
5
|
+
import { QueryUpdate } from "@shivaedev/contract/queryUpdate.ts";
|
|
6
6
|
import { browserSubscriptions } from "#server/browserSubscriptions.ts";
|
|
7
7
|
export const browserReadObserver = Effect.fnUntraced(function* (contracts) {
|
|
8
8
|
const queries = new Set(contracts.flatMap(({ declaration }) => declaration.queries.map(({ name }) => `${declaration.name}.${name}`)));
|
|
@@ -21,14 +21,13 @@ export const browserReadObserver = Effect.fnUntraced(function* (contracts) {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
for (const value of message.values) {
|
|
24
|
-
if (Schema.is(
|
|
24
|
+
if (Schema.is(QueryUpdate)(value)) {
|
|
25
25
|
hints.push(value);
|
|
26
26
|
yield* PubSub.publish(deliveries, value);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
return {
|
|
31
|
-
heardKeys: () => hints.flatMap((hint) => (hint._tag === "Changed" ? hint.keys : [])),
|
|
32
31
|
hints: () => [...hints],
|
|
33
32
|
observeProtocol: Effect.gen(function* () {
|
|
34
33
|
const underlying = yield* RpcClient.Protocol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserReadObserver.js","sourceRoot":"","sources":["../../src/server/browserReadObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"browserRead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AO,CAAC,oBAAoB;QAClD,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACrG,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -30,38 +30,7 @@ export interface BrowserReadsOptions {
|
|
|
30
30
|
}
|
|
31
31
|
export declare const browserReads: (options: BrowserReadsOptions) => Effect.Effect<{
|
|
32
32
|
protocol: (arg: string | undefined) => Layer.Layer<import("effect/rpc/RpcClient").Protocol, never, never>;
|
|
33
|
-
|
|
34
|
-
readonly _tag: "Bucket";
|
|
35
|
-
readonly collection: string;
|
|
36
|
-
readonly field: string;
|
|
37
|
-
readonly value: string | number;
|
|
38
|
-
} | {
|
|
39
|
-
readonly _tag: "List";
|
|
40
|
-
readonly collection: string;
|
|
41
|
-
} | {
|
|
42
|
-
readonly _tag: "Item";
|
|
43
|
-
readonly collection: string;
|
|
44
|
-
readonly id: string | number;
|
|
45
|
-
})[];
|
|
46
|
-
hints: () => ({
|
|
47
|
-
readonly _tag: "Changed";
|
|
48
|
-
readonly keys: readonly ({
|
|
49
|
-
readonly _tag: "Bucket";
|
|
50
|
-
readonly collection: string;
|
|
51
|
-
readonly field: string;
|
|
52
|
-
readonly value: string | number;
|
|
53
|
-
} | {
|
|
54
|
-
readonly _tag: "List";
|
|
55
|
-
readonly collection: string;
|
|
56
|
-
} | {
|
|
57
|
-
readonly _tag: "Item";
|
|
58
|
-
readonly collection: string;
|
|
59
|
-
readonly id: string | number;
|
|
60
|
-
})[];
|
|
61
|
-
readonly queryIndexes?: readonly number[] | undefined;
|
|
62
|
-
} | {
|
|
63
|
-
readonly _tag: "Resync";
|
|
64
|
-
})[];
|
|
33
|
+
hints: () => import("@shivaedev/contract/queryUpdate.ts").QueryUpdate[];
|
|
65
34
|
readCount: (tag?: string) => number;
|
|
66
35
|
reads: () => BrowserRead[];
|
|
67
36
|
subscriptions: () => ({
|
|
@@ -76,25 +45,7 @@ export declare const browserReads: (options: BrowserReadsOptions) => Effect.Effe
|
|
|
76
45
|
})[];
|
|
77
46
|
waitForSubscriptions: Effect.Effect<void, never, never>;
|
|
78
47
|
watchHints: () => Effect.Effect<{
|
|
79
|
-
next: Effect.Effect<
|
|
80
|
-
readonly _tag: "Changed";
|
|
81
|
-
readonly keys: readonly ({
|
|
82
|
-
readonly _tag: "Bucket";
|
|
83
|
-
readonly collection: string;
|
|
84
|
-
readonly field: string;
|
|
85
|
-
readonly value: string | number;
|
|
86
|
-
} | {
|
|
87
|
-
readonly _tag: "List";
|
|
88
|
-
readonly collection: string;
|
|
89
|
-
} | {
|
|
90
|
-
readonly _tag: "Item";
|
|
91
|
-
readonly collection: string;
|
|
92
|
-
readonly id: string | number;
|
|
93
|
-
})[];
|
|
94
|
-
readonly queryIndexes?: readonly number[] | undefined;
|
|
95
|
-
} | {
|
|
96
|
-
readonly _tag: "Resync";
|
|
97
|
-
}, never, never>;
|
|
48
|
+
next: Effect.Effect<import("@shivaedev/contract/queryUpdate.ts").QueryUpdate, never, never>;
|
|
98
49
|
}, never, import("effect/Scope").Scope>;
|
|
99
50
|
}, never, import("effect/Scope").Scope>;
|
|
100
51
|
//# sourceMappingURL=browserReads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserReads.d.ts","sourceRoot":"","sources":["../../src/server/browserReads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,M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serReadsOptions) => Effect.Effect<{
|
|
6
6
|
protocol: (arg: string | undefined) => Layer.Layer<RpcClient.Protocol, never, never>;
|
|
7
|
-
|
|
8
|
-
readonly _tag: "Bucket";
|
|
9
|
-
readonly collection: string;
|
|
10
|
-
readonly field: string;
|
|
11
|
-
readonly value: string | number;
|
|
12
|
-
} | {
|
|
13
|
-
readonly _tag: "List";
|
|
14
|
-
readonly collection: string;
|
|
15
|
-
} | {
|
|
16
|
-
readonly _tag: "Item";
|
|
17
|
-
readonly collection: string;
|
|
18
|
-
readonly id: string | number;
|
|
19
|
-
})[];
|
|
20
|
-
hints: () => ({
|
|
21
|
-
readonly _tag: "Changed";
|
|
22
|
-
readonly keys: readonly ({
|
|
23
|
-
readonly _tag: "Bucket";
|
|
24
|
-
readonly collection: string;
|
|
25
|
-
readonly field: string;
|
|
26
|
-
readonly value: string | number;
|
|
27
|
-
} | {
|
|
28
|
-
readonly _tag: "List";
|
|
29
|
-
readonly collection: string;
|
|
30
|
-
} | {
|
|
31
|
-
readonly _tag: "Item";
|
|
32
|
-
readonly collection: string;
|
|
33
|
-
readonly id: string | number;
|
|
34
|
-
})[];
|
|
35
|
-
readonly queryIndexes?: readonly number[] | undefined;
|
|
36
|
-
} | {
|
|
37
|
-
readonly _tag: "Resync";
|
|
38
|
-
})[];
|
|
7
|
+
hints: () => import("@shivaedev/contract/queryUpdate.ts").QueryUpdate[];
|
|
39
8
|
readCount: (tag?: string) => number;
|
|
40
9
|
reads: () => import("#server/browserReads.ts").BrowserRead[];
|
|
41
10
|
subscriptions: () => ({
|
|
@@ -50,25 +19,7 @@ export declare const observeBrowser: (options: BrowserReadsOptions) => Effect.Ef
|
|
|
50
19
|
})[];
|
|
51
20
|
waitForSubscriptions: Effect.Effect<void, never, never>;
|
|
52
21
|
watchHints: () => Effect.Effect<{
|
|
53
|
-
next: Effect.Effect<
|
|
54
|
-
readonly _tag: "Changed";
|
|
55
|
-
readonly keys: readonly ({
|
|
56
|
-
readonly _tag: "Bucket";
|
|
57
|
-
readonly collection: string;
|
|
58
|
-
readonly field: string;
|
|
59
|
-
readonly value: string | number;
|
|
60
|
-
} | {
|
|
61
|
-
readonly _tag: "List";
|
|
62
|
-
readonly collection: string;
|
|
63
|
-
} | {
|
|
64
|
-
readonly _tag: "Item";
|
|
65
|
-
readonly collection: string;
|
|
66
|
-
readonly id: string | number;
|
|
67
|
-
})[];
|
|
68
|
-
readonly queryIndexes?: readonly number[] | undefined;
|
|
69
|
-
} | {
|
|
70
|
-
readonly _tag: "Resync";
|
|
71
|
-
}, never, never>;
|
|
22
|
+
next: Effect.Effect<import("@shivaedev/contract/queryUpdate.ts").QueryUpdate, never, never>;
|
|
72
23
|
}, never, import("effect/Scope").Scope>;
|
|
73
24
|
}, never, import("effect/Scope").Scope>;
|
|
74
25
|
//# sourceMappingURL=observeBrowser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observeBrowser.d.ts","sourceRoot":"","sources":["../../src/server/observeBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"observeBrowser.d.ts","sourceRoot":"","sources":["../../src/server/observeBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;uCAQzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/test-story",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "Tests that read like stories over the real engine: a story kit per engine with its own it, traits per feature, and a failure that prints the story, where it stopped and the engine's state",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/test-story#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -42,22 +42,23 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@shivaedev/contract": "0.
|
|
45
|
+
"@shivaedev/contract": "0.43.0",
|
|
46
46
|
"@shivaedev/test": "0.17.0",
|
|
47
|
-
"@shivaedev/test-sql": "0.24.
|
|
47
|
+
"@shivaedev/test-sql": "0.24.4",
|
|
48
48
|
"dom-accessibility-api": "0.7.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@effect/atom-react": "4.1.
|
|
52
|
-
"@effect/platform-node": "4.1.
|
|
53
|
-
"@effect/sql-pg": "4.1.
|
|
54
|
-
"@effect/vitest": "4.1.
|
|
55
|
-
"@shivaedev/quality": "0.69.
|
|
56
|
-
"@shivaedev/react": "0.
|
|
51
|
+
"@effect/atom-react": "4.1.1",
|
|
52
|
+
"@effect/platform-node": "4.1.1",
|
|
53
|
+
"@effect/sql-pg": "4.1.1",
|
|
54
|
+
"@effect/vitest": "4.1.1",
|
|
55
|
+
"@shivaedev/quality": "0.69.4",
|
|
56
|
+
"@shivaedev/react": "0.46.1",
|
|
57
|
+
"@shivaedev/server": "0.31.1",
|
|
57
58
|
"@types/node": "24.19.2",
|
|
58
59
|
"@types/react": "19.3.0",
|
|
59
60
|
"@types/react-dom": "19.3.0",
|
|
60
|
-
"effect": "4.1.
|
|
61
|
+
"effect": "4.1.1",
|
|
61
62
|
"happy-dom": "21.0.4",
|
|
62
63
|
"react": "19.3.1",
|
|
63
64
|
"react-dom": "19.3.1",
|
|
@@ -65,11 +66,11 @@
|
|
|
65
66
|
"vitest": "5.0.5"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"@effect/atom-react": "4.1.
|
|
69
|
-
"@effect/platform-node": "4.1.
|
|
70
|
-
"@effect/sql-pg": "4.1.
|
|
71
|
-
"@effect/vitest": "4.1.
|
|
72
|
-
"effect": "4.1.
|
|
69
|
+
"@effect/atom-react": "4.1.1",
|
|
70
|
+
"@effect/platform-node": "4.1.1",
|
|
71
|
+
"@effect/sql-pg": "4.1.1",
|
|
72
|
+
"@effect/vitest": "4.1.1",
|
|
73
|
+
"effect": "4.1.1",
|
|
73
74
|
"happy-dom": "21.0.4",
|
|
74
75
|
"react": "19.3.1",
|
|
75
76
|
"react-dom": "19.3.1",
|
|
@@ -3,7 +3,7 @@ import * as PubSub from "effect/PubSub";
|
|
|
3
3
|
import * as RpcClient from "effect/rpc/RpcClient";
|
|
4
4
|
import type * as RpcMessage from "effect/rpc/RpcMessage";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
|
-
import {
|
|
6
|
+
import { QueryUpdate } from "@shivaedev/contract/queryUpdate.ts";
|
|
7
7
|
import type { BrowserRead, BrowserReadsOptions } from "#server/browserReads.ts";
|
|
8
8
|
import { browserSubscriptions } from "#server/browserSubscriptions.ts";
|
|
9
9
|
|
|
@@ -11,8 +11,8 @@ export const browserReadObserver = Effect.fnUntraced(function* (contracts: Brows
|
|
|
11
11
|
const queries = new Set(contracts.flatMap(({ declaration }) => declaration.queries.map(({ name }) => `${declaration.name}.${name}`)));
|
|
12
12
|
const subscriptionTags = new Set(contracts.map(({ declaration }) => `${declaration.name}.$changes`));
|
|
13
13
|
const reads: BrowserRead[] = [];
|
|
14
|
-
const hints:
|
|
15
|
-
const deliveries = yield* PubSub.unbounded<
|
|
14
|
+
const hints: QueryUpdate[] = [];
|
|
15
|
+
const deliveries = yield* PubSub.unbounded<QueryUpdate>();
|
|
16
16
|
yield* Effect.addFinalizer(() => PubSub.shutdown(deliveries));
|
|
17
17
|
const tracked = yield* browserSubscriptions;
|
|
18
18
|
const receive = Effect.fnUntraced(function* (index: number | undefined, message: RpcMessage.FromServerEncoded) {
|
|
@@ -24,14 +24,13 @@ export const browserReadObserver = Effect.fnUntraced(function* (contracts: Brows
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
for (const value of message.values) {
|
|
27
|
-
if (Schema.is(
|
|
27
|
+
if (Schema.is(QueryUpdate)(value)) {
|
|
28
28
|
hints.push(value);
|
|
29
29
|
yield* PubSub.publish(deliveries, value);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
return {
|
|
34
|
-
heardKeys: () => hints.flatMap((hint) => (hint._tag === "Changed" ? hint.keys : [])),
|
|
35
34
|
hints: () => [...hints],
|
|
36
35
|
observeProtocol: Effect.gen(function* () {
|
|
37
36
|
const underlying = yield* RpcClient.Protocol;
|