@shivaedev/contract 0.59.0 → 0.59.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 +6 -0
- package/README.md +2 -2
- package/dist/wire.js +1 -1
- package/dist/wire.js.map +1 -1
- package/package.json +7 -7
- package/src/wire.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -200,7 +200,7 @@ Each operation runs in a span named after the module and the operation, such as
|
|
|
200
200
|
|
|
201
201
|
#### The wire and the browser's contract
|
|
202
202
|
|
|
203
|
-
Types are erased, so the success schema and rejection classes the server encodes with and the browser decodes with must exist as values. [`@shivaedev/build`](https://github.com/ShivaeDev/platform/tree/main/packages/build) writes them from each module's `run` types into one file per module under `src/generated/`, which stays out of Git; an application runs it as `pnpm generate`. The module file passes its wire, as `Notes` does above, and every operation is served with its wire entry's success and rejections, plus `InternalServerError` and `ServiceUnavailable`. A wire entry's success
|
|
203
|
+
Types are erased, so the success schema and rejection classes the server encodes with and the browser decodes with must exist as values. [`@shivaedev/build`](https://github.com/ShivaeDev/platform/tree/main/packages/build) writes them from each module's `run` types into one file per module under `src/generated/`, which stays out of Git; an application runs it as `pnpm generate`. The module file passes its wire, as `Notes` does above, and every operation is served with its wire entry's success and rejections, plus `InternalServerError` and `ServiceUnavailable`. A wire entry's success restates a plain object's fields without annotations and imports an exported Schema class that `run` returns: its RPC carries `GeneratedSuccess` from `@shivaedev/errors/GeneratedSuccess.ts`, so the host collects the names that the class marks sensitive but never treats a restated field as public. Mark a sensitive field on the server's model, or on the exported class a raw read decodes into, as the [errors README](https://github.com/ShivaeDev/platform/tree/main/packages/errors#masking-secrets-in-failures) describes.
|
|
204
204
|
|
|
205
205
|
The file the generator writes exports the wire, the browser's contract built by `clientContract` from the wire, the names of the module's queries and commands, the copied payloads, and the module's name, middleware, subject and key scope, and it ends with a type-level assertion that the browser's contract and the server module have the same RPCs:
|
|
206
206
|
|
|
@@ -625,7 +625,7 @@ The state's `firstSettled` flag is `false` until the stream's `rendered` Effect
|
|
|
625
625
|
|
|
626
626
|
For screen stories, pass `activityScreenSignal(clientActivity(client))` to a test-story screen driver's `activity` option. By default, `settle()` waits for commands until they are reflected and for the first result of each mounted query, then flushes the renderer. Contract identifies commands from its own RPC annotations; kits need no query-name exceptions. The activity state's `commands` count includes commands held for a connection, `unreflectedCommands` counts commands from the moment they are sent until they are reflected or fail, and `initialQueries` counts mounted queries until their first success or failure. Unmounting releases that query's pending activity. `isClientSettled(state)` checks these three counts. An open live query that has delivered its first result, including one awaiting a later refresh, does not keep a screen story pending.
|
|
627
627
|
|
|
628
|
-
`activityScreenSignal(activity)` projects the stream and its `current` Effect into `{ pending, connectionStatus }`. The returned shape is structural and carries no test-story dependency. Stories that wait for a write their client did not make pass `screenSync(client, registry)` from `screenSync.ts` as the driver's `sync` option: it runs the client's `sync` through the view's registry, and the driver's `sync()` settles the screen after it. `isClientIdle(state)` retains the full finite-work check: `rpcCalls` for finite calls, `refreshingAtoms` for mounted query atoms awaiting values must all be zero. Long-lived subscription streams and server reruns themselves do not count as finite calls.
|
|
628
|
+
`activityScreenSignal(activity)` projects the stream and its `current` Effect into `{ pending, connectionStatus }`. The returned shape is structural and carries no test-story dependency. Stories that wait for a write their client did not make pass `screenSync(client, registry)` from `screenSync.ts` as the driver's `sync` option: it runs the client's `sync` through the view's registry, and the driver's `sync()` settles the screen after it. `isClientIdle(state)` retains the full finite-work check: `rpcCalls` for finite calls, `refreshingAtoms` for mounted query atoms awaiting values must all be zero. Long-lived subscription streams and server reruns themselves do not count as finite calls. A screen verb that refreshes or retries a loaded query settles on `activityScreenSignal(activity, isClientIdle)`, because the default check does not wait for that refresh.
|
|
629
629
|
|
|
630
630
|
### Query completion
|
|
631
631
|
|
package/dist/wire.js
CHANGED
|
@@ -3,7 +3,7 @@ import { rejectionSet } from "#rejection.ts";
|
|
|
3
3
|
export function wireRejections(rejections) {
|
|
4
4
|
return { ...rejections, InternalServerError, ServiceUnavailable };
|
|
5
5
|
}
|
|
6
|
-
// A wire's success is generated from run's type and
|
|
6
|
+
// A wire's success is generated from run's type and restates its fields without annotations, so its RPC lets it mark names sensitive but never declare one public.
|
|
7
7
|
export function wired(operation, entry) {
|
|
8
8
|
if (entry === undefined) {
|
|
9
9
|
return operation;
|
package/dist/wire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA+B7C,MAAM,UAAU,cAAc,CAAC,UAA2B;IACzD,OAAO,EAAE,GAAG,UAAU,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AACnE,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA+B7C,MAAM,UAAU,cAAc,CAAC,UAA2B;IACzD,OAAO,EAAE,GAAG,UAAU,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AACnE,CAAC;AAED,mKAAmK;AACnK,MAAM,UAAU,KAAK,CAAC,SAAoC,EAAE,KAA4B;IACvF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,EAAE,GAAG,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;AAClH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/contract",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.1",
|
|
4
4
|
"description": "Typed query and command contracts over native Effect RPC and reactivity",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@shivaedev/changes": "0.14.1",
|
|
47
|
-
"@shivaedev/errors": "0.
|
|
47
|
+
"@shivaedev/errors": "0.15.0",
|
|
48
48
|
"@shivaedev/service": "0.9.2",
|
|
49
49
|
"@shivaedev/types": "0.4.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@effect/platform-node": "4.1.4",
|
|
53
53
|
"@effect/vitest": "4.1.4",
|
|
54
|
-
"@shivaedev/identity": "0.44.
|
|
55
|
-
"@shivaedev/quality": "0.84.
|
|
56
|
-
"@shivaedev/server": "0.46.
|
|
54
|
+
"@shivaedev/identity": "0.44.2",
|
|
55
|
+
"@shivaedev/quality": "0.84.4",
|
|
56
|
+
"@shivaedev/server": "0.46.4",
|
|
57
57
|
"@shivaedev/sql": "0.55.0",
|
|
58
|
-
"@shivaedev/test-kits": "0.16.
|
|
58
|
+
"@shivaedev/test-kits": "0.16.14",
|
|
59
59
|
"@shivaedev/test-sql": "0.26.1",
|
|
60
|
-
"@shivaedev/test-story": "0.52.
|
|
60
|
+
"@shivaedev/test-story": "0.52.7",
|
|
61
61
|
"@types/node": "24.19.2",
|
|
62
62
|
"effect": "4.1.4",
|
|
63
63
|
"fake-indexeddb": "6.2.8",
|
package/src/wire.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function wireRejections(rejections: ClassRejections) {
|
|
|
36
36
|
return { ...rejections, InternalServerError, ServiceUnavailable };
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// A wire's success is generated from run's type and
|
|
39
|
+
// A wire's success is generated from run's type and restates its fields without annotations, so its RPC lets it mark names sensitive but never declare one public.
|
|
40
40
|
export function wired(operation: QueryShape | CommandShape, entry: WireEntry | undefined): QueryShape | CommandShape {
|
|
41
41
|
if (entry === undefined) {
|
|
42
42
|
return operation;
|