@shivaedev/test-kits 0.9.2 → 0.10.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 +18 -0
- package/README.md +1 -1
- package/dist/contract/testing.d.ts +1 -5
- package/dist/contract/testing.d.ts.map +1 -1
- package/dist/contract/testing.js +0 -7
- package/dist/contract/testing.js.map +1 -1
- package/package.json +10 -10
- package/src/contract/testing.ts +1 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 - 2026-11-06
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- Replace key-based `heard` assertions with delivered query values or mounted query completion signals. `watchHints` observes pushed query updates.
|
|
8
|
+
|
|
9
|
+
## 0.9.3 - 2026-11-06
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Update `@shivaedev/email` from 0.7.1 to 0.7.2.
|
|
14
|
+
- Update `@shivaedev/identity` from 0.29.1 to 0.29.2.
|
|
15
|
+
- Update `@shivaedev/jobs` from 0.40.1 to 0.41.0.
|
|
16
|
+
- Update `@shivaedev/sql` from 0.44.0 to 0.45.0.
|
|
17
|
+
- Update `@shivaedev/test-sql` from 0.24.2 to 0.24.3.
|
|
18
|
+
- Update `@shivaedev/test-story` from 0.44.1 to 0.44.2.
|
|
19
|
+
- Update `@shivaedev/webhooks` from 0.11.2 to 0.11.3.
|
|
20
|
+
|
|
3
21
|
## 0.9.2 - 2026-11-06
|
|
4
22
|
|
|
5
23
|
### Changed
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ Import `withChangeCoverage`, `expectPublished`, `UnannouncedWrites`, `PublishedK
|
|
|
89
89
|
|
|
90
90
|
### Contract subscriptions
|
|
91
91
|
|
|
92
|
-
Import `watchHints`, `
|
|
92
|
+
Import `watchHints`, `layerMemoryProtocol` and the `HintViewer` type from `@shivaedev/test-kits/contract/testing.ts`. `watchHints(stream)` starts a scoped listener and waits for its first update, including a live query’s initial `Result`. Its readout retains `Result`, `Unchanged` and `QueryReadDenied` deliveries. Assert delivered values, or wait on a mounted query's completion signal. `layerMemoryProtocol(group)` connects the native RPC client and server in-process; provide the real group's handlers and middleware.
|
|
93
93
|
|
|
94
94
|
### Jobs
|
|
95
95
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Effect, Layer, Stream, SubscriptionRef } from "effect";
|
|
2
2
|
import { type Rpc, RpcClient, type RpcGroup, RpcSerialization, RpcServer } from "effect/rpc";
|
|
3
|
-
import type { Key } from "@shivaedev/changes/keys.ts";
|
|
4
3
|
import type { QueryUpdate } from "@shivaedev/contract/queryUpdate.ts";
|
|
5
4
|
export interface HintViewer<E> {
|
|
6
5
|
readonly finished: Effect.Effect<void, E>;
|
|
@@ -10,8 +9,5 @@ export declare const watchHints: <E, R>(stream: Stream.Stream<QueryUpdate, E, R>
|
|
|
10
9
|
finished: Effect.Effect<void, E, never>;
|
|
11
10
|
hints: SubscriptionRef.SubscriptionRef<readonly QueryUpdate[]>;
|
|
12
11
|
}, E, R | import("effect/Scope").Scope>;
|
|
13
|
-
export declare const heard: <E>(viewer: HintViewer<E>, keys: readonly Key[], options?: {
|
|
14
|
-
readonly within?: Duration.Input;
|
|
15
|
-
} | undefined) => Effect.Effect<boolean, E, never>;
|
|
16
12
|
export declare function layerMemoryProtocol<TRpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<TRpcs>): Layer.Layer<RpcClient.Protocol, never, Exclude<Exclude<Exclude<Rpc.ServicesServer<TRpcs>, RpcServer.Protocol>, import("effect/Scope").Scope>, RpcSerialization.RpcSerialization> | Exclude<Exclude<Exclude<Rpc.ToHandler<TRpcs>, RpcServer.Protocol>, import("effect/Scope").Scope>, RpcSerialization.RpcSerialization>>;
|
|
17
13
|
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/contract/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/contract/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAS,KAAK,EAAS,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACxF,OAAO,EAAE,KAAK,GAAG,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAmB,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE,MAAM,WAAW,UAAU,CAAC,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,eAAe,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,UAAU,GAA2C,CAAC,EAAE,CAAC;;;uCAYpE,CAAC;AAEH,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,4TAqCzF"}
|
package/dist/contract/testing.js
CHANGED
|
@@ -8,13 +8,6 @@ export const watchHints = Effect.fn("Live.watchHints")(function* (stream) {
|
|
|
8
8
|
yield* Effect.raceFirst(Deferred.await(ready), finished);
|
|
9
9
|
return { finished, hints };
|
|
10
10
|
});
|
|
11
|
-
export const heard = Effect.fn("Live.heard")(function* (viewer, keys, options = {}) {
|
|
12
|
-
const matching = SubscriptionRef.changes(viewer.hints).pipe(Stream.filter((hints) => hints.some((hint) => namesKeys(hint, keys))), Stream.runHead, Effect.as(true));
|
|
13
|
-
return yield* Effect.raceFirst(matching, Effect.as(viewer.finished, false)).pipe(Effect.timeoutOrElse({ duration: options.within ?? "1 second", orElse: () => Effect.succeed(false) }));
|
|
14
|
-
});
|
|
15
|
-
function namesKeys(hint, keys) {
|
|
16
|
-
return hint._tag === "Changed" && keys.every((key) => hint.keys.some((actual) => JSON.stringify(actual) === JSON.stringify(key)));
|
|
17
|
-
}
|
|
18
11
|
export function layerMemoryProtocol(group) {
|
|
19
12
|
return Layer.effect(RpcClient.Protocol, Effect.gen(function* () {
|
|
20
13
|
const requests = yield* Queue.unbounded();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../src/contract/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../src/contract/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACxF,OAAO,EAAY,SAAS,EAAkC,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAQ9G,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,EAAQ,MAAwC;IAC/G,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC,IAAI,CAAyB,EAAE,CAAC,CAAC;IACtE,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAQ,CAAC;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAC/B,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1B,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,C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
2
2
|
"name": "@shivaedev/test-kits",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Reusable story building blocks for Platform applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shivaedev/test-sql": "0.24.
|
|
47
|
-
"@shivaedev/test-story": "0.
|
|
46
|
+
"@shivaedev/test-sql": "0.24.3",
|
|
47
|
+
"@shivaedev/test-story": "0.45.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@shivaedev/github": "0.15.0",
|
|
51
|
-
"@shivaedev/quality": "0.
|
|
51
|
+
"@shivaedev/quality": "0.69.3",
|
|
52
52
|
"@types/node": "24.19.2",
|
|
53
53
|
"better-auth": "1.7.14",
|
|
54
54
|
"effect": "4.1.0",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@shivaedev/changes": "0.11.0",
|
|
60
|
-
"@shivaedev/contract": "0.
|
|
60
|
+
"@shivaedev/contract": "0.43.0",
|
|
61
61
|
"@shivaedev/discord": "0.4.0",
|
|
62
|
-
"@shivaedev/email": "0.7.
|
|
63
|
-
"@shivaedev/identity": "0.
|
|
64
|
-
"@shivaedev/jobs": "0.
|
|
65
|
-
"@shivaedev/sql": "0.
|
|
66
|
-
"@shivaedev/webhooks": "0.11.
|
|
62
|
+
"@shivaedev/email": "0.7.2",
|
|
63
|
+
"@shivaedev/identity": "0.30.0",
|
|
64
|
+
"@shivaedev/jobs": "0.41.0",
|
|
65
|
+
"@shivaedev/sql": "0.45.0",
|
|
66
|
+
"@shivaedev/webhooks": "0.11.3",
|
|
67
67
|
"better-auth": "1.7.14",
|
|
68
68
|
"effect": "4.1.0",
|
|
69
69
|
"pg-boss": "12.38.0"
|
package/src/contract/testing.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Deferred,
|
|
1
|
+
import { Deferred, Effect, Fiber, Layer, Queue, Stream, SubscriptionRef } from "effect";
|
|
2
2
|
import { type Rpc, RpcClient, type RpcGroup, type RpcMessage, RpcSerialization, RpcServer } from "effect/rpc";
|
|
3
|
-
import type { Key } from "@shivaedev/changes/keys.ts";
|
|
4
3
|
import type { QueryUpdate } from "@shivaedev/contract/queryUpdate.ts";
|
|
5
4
|
|
|
6
5
|
export interface HintViewer<E> {
|
|
@@ -22,25 +21,6 @@ export const watchHints = Effect.fn("Live.watchHints")(function* <E, R>(stream:
|
|
|
22
21
|
return { finished, hints } satisfies HintViewer<E>;
|
|
23
22
|
});
|
|
24
23
|
|
|
25
|
-
export const heard = Effect.fn("Live.heard")(function* <E>(
|
|
26
|
-
viewer: HintViewer<E>,
|
|
27
|
-
keys: readonly Key[],
|
|
28
|
-
options: { readonly within?: Duration.Input } = {},
|
|
29
|
-
) {
|
|
30
|
-
const matching = SubscriptionRef.changes(viewer.hints).pipe(
|
|
31
|
-
Stream.filter((hints) => hints.some((hint) => namesKeys(hint, keys))),
|
|
32
|
-
Stream.runHead,
|
|
33
|
-
Effect.as(true),
|
|
34
|
-
);
|
|
35
|
-
return yield* Effect.raceFirst(matching, Effect.as(viewer.finished, false)).pipe(
|
|
36
|
-
Effect.timeoutOrElse({ duration: options.within ?? "1 second", orElse: () => Effect.succeed(false) }),
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
function namesKeys(hint: QueryUpdate, keys: readonly Key[]): boolean {
|
|
41
|
-
return hint._tag === "Changed" && keys.every((key) => hint.keys.some((actual) => JSON.stringify(actual) === JSON.stringify(key)));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
24
|
export function layerMemoryProtocol<TRpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<TRpcs>) {
|
|
45
25
|
return Layer.effect(
|
|
46
26
|
RpcClient.Protocol,
|