@shivaedev/test-kits 0.12.0 → 0.13.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 +15 -0
- package/README.md +1 -1
- package/dist/contract/testing.d.ts +4 -1
- package/dist/contract/testing.d.ts.map +1 -1
- package/dist/contract/testing.js +4 -1
- package/dist/contract/testing.js.map +1 -1
- package/package.json +11 -10
- package/src/contract/testing.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- `layerMemoryProtocol(group)` runs the application host's `schemaSensitiveKeys` check over the group before it serves, and dies with the host's `SensitiveFieldConflict` or `InvalidRedactionMask` and its message. A spec can newly fail only for a group the host already refuses to start with: follow the message, which names both schema paths, and rename one field or mark both sensitive. When the host resolves the conflict through `config.sensitiveKeys`, pass the same list as `layerMemoryProtocol(group, { sensitiveKeys })`.
|
|
8
|
+
- `@shivaedev/errors` is a peer dependency. Applications that install `@shivaedev/platform` already have it; a library that installs test-kits directly adds `@shivaedev/errors`.
|
|
9
|
+
|
|
10
|
+
## 0.12.1 - 2026-11-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Update `@shivaedev/identity` from 0.31.2 to 0.32.0.
|
|
15
|
+
- Update `@shivaedev/test-sql` from 0.24.9 to 0.25.0.
|
|
16
|
+
- Update `@shivaedev/test-story` from 0.47.0 to 0.47.1.
|
|
17
|
+
|
|
3
18
|
## 0.12.0 - 2026-11-11
|
|
4
19
|
|
|
5
20
|
### 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`, `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.
|
|
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. Before it serves, it runs the application host's `schemaSensitiveKeys` check from `@shivaedev/errors/schemaSensitiveKeys.ts` over the group, so a spec that serves a group the host would refuse to start fails too, with the host's error and message: `SensitiveFieldConflict` when one RPC uses a field name both as sensitive and as public, and `InvalidRedactionMask` when a failure's mask does not decode through its schema. The Layer dies with that error, because a client factory takes a protocol Layer that cannot fail. When the host lists extra keys in `config.sensitiveKeys`, pass the same list as `layerMemoryProtocol(group, { sensitiveKeys })` so both judge the group alike.
|
|
93
93
|
|
|
94
94
|
### Jobs
|
|
95
95
|
|
|
@@ -9,5 +9,8 @@ export declare const watchHints: <E, R>(stream: Stream.Stream<QueryUpdate, E, R>
|
|
|
9
9
|
finished: Effect.Effect<void, E, never>;
|
|
10
10
|
hints: SubscriptionRef.SubscriptionRef<readonly QueryUpdate[]>;
|
|
11
11
|
}, E, R | import("effect/Scope").Scope>;
|
|
12
|
-
export
|
|
12
|
+
export interface MemoryProtocolOptions {
|
|
13
|
+
readonly sensitiveKeys?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function layerMemoryProtocol<TRpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<TRpcs>, options?: MemoryProtocolOptions): 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>>;
|
|
13
16
|
//# 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,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;
|
|
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;AAGtE,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,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,qBAAqB,4TAuC1H"}
|
package/dist/contract/testing.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Deferred, Effect, Fiber, Layer, Queue, Stream, SubscriptionRef } from "effect";
|
|
2
2
|
import { RpcClient, RpcSerialization, RpcServer } from "effect/rpc";
|
|
3
|
+
import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
|
|
3
4
|
export const watchHints = Effect.fn("Live.watchHints")(function* (stream) {
|
|
4
5
|
const hints = yield* SubscriptionRef.make([]);
|
|
5
6
|
const ready = yield* Deferred.make();
|
|
@@ -8,8 +9,10 @@ export const watchHints = Effect.fn("Live.watchHints")(function* (stream) {
|
|
|
8
9
|
yield* Effect.raceFirst(Deferred.await(ready), finished);
|
|
9
10
|
return { finished, hints };
|
|
10
11
|
});
|
|
11
|
-
export function layerMemoryProtocol(group) {
|
|
12
|
+
export function layerMemoryProtocol(group, options) {
|
|
12
13
|
return Layer.effect(RpcClient.Protocol, Effect.gen(function* () {
|
|
14
|
+
// A client factory takes a protocol Layer that cannot fail, so the refusal the host reports at startup is a defect here.
|
|
15
|
+
yield* Effect.orDie(schemaSensitiveKeys(group, options?.sensitiveKeys));
|
|
13
16
|
const requests = yield* Queue.unbounded();
|
|
14
17
|
const disconnects = yield* Queue.unbounded();
|
|
15
18
|
const { codecFor } = yield* RpcSerialization.RpcSerialization;
|
|
@@ -1 +1 @@
|
|
|
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,KAA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E,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC/G,IAAI;gBACJ,WAAW,EAAE,IAAI;gBACjB,qBAAqB,EAAE,IAAI;gBAC3B,uBAAuB,EAAE,IAAI;gBAC7B,qBAAqB,EAAE,KAAK;aAC5B,CAAC,CAAC;YACH,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YACxG,OAAO;gBACN,QAAQ;gBACR,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC3F,WAAW,EAAE,IAAI;gBACjB,qBAAqB,EAAE,KAAK;aAC5B,CAAC;QACH,CAAC,CAAC,CACF,CAAC;QACF,OAAO;YACN,GAAG,QAAQ;YACX,GAAG,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC7E,CAAC;IAC3C,CAAC,CAAC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/test-kits",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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.
|
|
47
|
-
"@shivaedev/test-story": "0.47.
|
|
46
|
+
"@shivaedev/test-sql": "0.25.1",
|
|
47
|
+
"@shivaedev/test-story": "0.47.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@shivaedev/github": "0.17.3",
|
|
51
|
-
"@shivaedev/quality": "0.
|
|
51
|
+
"@shivaedev/quality": "0.78.1",
|
|
52
52
|
"@types/node": "24.19.2",
|
|
53
53
|
"better-auth": "1.7.16",
|
|
54
54
|
"effect": "4.1.2",
|
|
@@ -57,13 +57,14 @@
|
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@shivaedev/changes": "0.12.0",
|
|
60
|
-
"@shivaedev/contract": "0.
|
|
60
|
+
"@shivaedev/contract": "0.45.0",
|
|
61
61
|
"@shivaedev/discord": "0.4.4",
|
|
62
|
-
"@shivaedev/email": "0.7.
|
|
63
|
-
"@shivaedev/
|
|
64
|
-
"@shivaedev/
|
|
65
|
-
"@shivaedev/
|
|
66
|
-
"@shivaedev/
|
|
62
|
+
"@shivaedev/email": "0.7.10",
|
|
63
|
+
"@shivaedev/errors": "0.12.0",
|
|
64
|
+
"@shivaedev/identity": "0.32.1",
|
|
65
|
+
"@shivaedev/jobs": "0.42.3",
|
|
66
|
+
"@shivaedev/sql": "0.48.0",
|
|
67
|
+
"@shivaedev/webhooks": "0.12.0",
|
|
67
68
|
"better-auth": "1.7.16",
|
|
68
69
|
"effect": "4.1.2",
|
|
69
70
|
"pg-boss": "12.38.0"
|
package/src/contract/testing.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
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
3
|
import type { QueryUpdate } from "@shivaedev/contract/queryUpdate.ts";
|
|
4
|
+
import { schemaSensitiveKeys } from "@shivaedev/errors/schemaSensitiveKeys.ts";
|
|
4
5
|
|
|
5
6
|
export interface HintViewer<E> {
|
|
6
7
|
readonly finished: Effect.Effect<void, E>;
|
|
@@ -21,10 +22,16 @@ export const watchHints = Effect.fn("Live.watchHints")(function* <E, R>(stream:
|
|
|
21
22
|
return { finished, hints } satisfies HintViewer<E>;
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
export
|
|
25
|
+
export interface MemoryProtocolOptions {
|
|
26
|
+
readonly sensitiveKeys?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function layerMemoryProtocol<TRpcs extends Rpc.Any>(group: RpcGroup.RpcGroup<TRpcs>, options?: MemoryProtocolOptions) {
|
|
25
30
|
return Layer.effect(
|
|
26
31
|
RpcClient.Protocol,
|
|
27
32
|
Effect.gen(function* () {
|
|
33
|
+
// A client factory takes a protocol Layer that cannot fail, so the refusal the host reports at startup is a defect here.
|
|
34
|
+
yield* Effect.orDie(schemaSensitiveKeys(group, options?.sensitiveKeys));
|
|
28
35
|
const requests = yield* Queue.unbounded<readonly [number, RpcMessage.FromClientEncoded]>();
|
|
29
36
|
const disconnects = yield* Queue.unbounded<number>();
|
|
30
37
|
const { codecFor } = yield* RpcSerialization.RpcSerialization;
|