@shivaedev/contract 0.33.0 → 0.35.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 +29 -0
- package/README.md +27 -4
- package/dist/HostVersion.d.ts +31 -0
- package/dist/HostVersion.d.ts.map +1 -0
- package/dist/HostVersion.js +7 -0
- package/dist/HostVersion.js.map +1 -0
- package/dist/adapters/activityState.d.ts +3 -2
- package/dist/adapters/activityState.d.ts.map +1 -1
- package/dist/adapters/activityState.js +4 -1
- package/dist/adapters/activityState.js.map +1 -1
- package/dist/adapters/clientConnection.d.ts +8 -0
- package/dist/adapters/clientConnection.d.ts.map +1 -0
- package/dist/adapters/clientConnection.js +22 -0
- package/dist/adapters/clientConnection.js.map +1 -0
- package/dist/automaticLive.d.ts.map +1 -1
- package/dist/automaticLive.js +3 -1
- package/dist/automaticLive.js.map +1 -1
- package/dist/bind.d.ts +2 -1
- package/dist/bind.d.ts.map +1 -1
- package/dist/bind.js.map +1 -1
- package/dist/clientActivity.d.ts +6 -0
- package/dist/clientActivity.d.ts.map +1 -1
- package/dist/clientActivity.js +1 -1
- package/dist/clientActivity.js.map +1 -1
- package/dist/clientOptions.d.ts +1 -0
- package/dist/clientOptions.d.ts.map +1 -1
- package/dist/composeBindings.d.ts.map +1 -1
- package/dist/composeBindings.js +21 -6
- package/dist/composeBindings.js.map +1 -1
- package/dist/contract.d.ts +7 -10
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +6 -2
- package/dist/contract.js.map +1 -1
- package/dist/internal/automaticQuery.d.ts +2 -2
- package/dist/internal/automaticQuery.d.ts.map +1 -1
- package/dist/internal/automaticQuery.js +12 -10
- package/dist/internal/automaticQuery.js.map +1 -1
- package/dist/internal/clientActivity.d.ts +7 -1
- package/dist/internal/clientActivity.d.ts.map +1 -1
- package/dist/internal/clientActivity.js +13 -3
- package/dist/internal/clientActivity.js.map +1 -1
- package/dist/internal/clientOperations.d.ts.map +1 -1
- package/dist/internal/clientOperations.js +4 -3
- package/dist/internal/clientOperations.js.map +1 -1
- package/dist/internal/commandPayload.d.ts +4 -0
- package/dist/internal/commandPayload.d.ts.map +1 -0
- package/dist/internal/commandPayload.js +9 -0
- package/dist/internal/commandPayload.js.map +1 -0
- package/dist/internal/liveRetry.d.ts +2 -2
- package/dist/internal/liveRetry.d.ts.map +1 -1
- package/dist/internal/liveRetry.js +6 -3
- package/dist/internal/liveRetry.js.map +1 -1
- package/dist/internal/queryReactivity.d.ts.map +1 -1
- package/dist/internal/queryReactivity.js +2 -0
- package/dist/internal/queryReactivity.js.map +1 -1
- package/dist/internal/rpcClient.d.ts +2 -0
- package/dist/internal/rpcClient.d.ts.map +1 -1
- package/dist/internal/rpcClient.js +2 -1
- package/dist/internal/rpcClient.js.map +1 -1
- package/dist/internal/subjectMiddleware.d.ts +16 -0
- package/dist/internal/subjectMiddleware.d.ts.map +1 -0
- package/dist/internal/subjectMiddleware.js +8 -0
- package/dist/internal/subjectMiddleware.js.map +1 -0
- package/dist/live.d.ts +1 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +14 -3
- package/dist/live.js.map +1 -1
- package/dist/operationRpc.d.ts +11 -0
- package/dist/operationRpc.d.ts.map +1 -0
- package/dist/operationRpc.js +2 -0
- package/dist/operationRpc.js.map +1 -0
- package/dist/subject.d.ts +10 -0
- package/dist/subject.d.ts.map +1 -0
- package/dist/subject.js +2 -0
- package/dist/subject.js.map +1 -0
- package/dist/subjectLayers.d.ts +12 -0
- package/dist/subjectLayers.d.ts.map +1 -0
- package/dist/subjectLayers.js +22 -0
- package/dist/subjectLayers.js.map +1 -0
- package/package.json +10 -10
- package/src/HostVersion.ts +7 -0
- package/src/adapters/activityState.ts +10 -3
- package/src/adapters/clientConnection.ts +37 -0
- package/src/automaticLive.ts +3 -1
- package/src/bind.ts +2 -1
- package/src/clientActivity.ts +9 -2
- package/src/clientOptions.ts +1 -0
- package/src/composeBindings.ts +21 -8
- package/src/contract.ts +18 -25
- package/src/internal/automaticQuery.ts +13 -11
- package/src/internal/clientActivity.ts +13 -3
- package/src/internal/clientOperations.ts +13 -3
- package/src/internal/commandPayload.ts +16 -0
- package/src/internal/liveRetry.ts +9 -2
- package/src/internal/queryReactivity.ts +2 -0
- package/src/internal/rpcClient.ts +2 -1
- package/src/internal/subjectMiddleware.ts +22 -0
- package/src/live.ts +15 -2
- package/src/operationRpc.ts +25 -0
- package/src/subject.ts +15 -0
- package/src/subjectLayers.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.35.0 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Client activity and its screen signal carry the same shared connection status.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Resume signals interrupt live retry backoff and reconnect immediately, resetting the next retry delay.
|
|
12
|
+
- Bound commands with a declared `BadRequest` return payload construction and encoding failures as that typed rejection, including struct-level validation details.
|
|
13
|
+
- Live binding discovery traverses nested object and array properties, preserves explicit binding lists, and visits shared objects and cycles once.
|
|
14
|
+
|
|
15
|
+
## 0.34.0 - 2026-11-04
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `makeClient` accepts a native Atom runtime factory so application and test clocks can govern live query coalescing and reconnection.
|
|
20
|
+
- Contracts accept a subject declaration that supplies request context through native RPC middleware and includes its typed refusals in the client's error channel.
|
|
21
|
+
|
|
22
|
+
### Breaking
|
|
23
|
+
|
|
24
|
+
- Import the `OperationRpc` and `Tag` helper types from `@shivaedev/contract/operationRpc.ts` instead of `@shivaedev/contract/contract.ts`.
|
|
25
|
+
|
|
26
|
+
## 0.33.1 - 2026-11-03
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Consume queued live hints when a held query finishes and starts its pending refresh, preventing a later coalescing timer from issuing a duplicate read.
|
|
31
|
+
|
|
3
32
|
## 0.33.0 - 2026-11-03
|
|
4
33
|
|
|
5
34
|
### Breaking
|
package/README.md
CHANGED
|
@@ -88,6 +88,23 @@ The collection's ID schema gives `item` its ID type. Here, `notes.item` takes a
|
|
|
88
88
|
|
|
89
89
|
Operation names must differ within a contract, including across queries, commands and streams. Literal duplicate declarations fail compilation. If the compiler cannot see the names in an array, contract construction checks them and throws with the duplicated names.
|
|
90
90
|
|
|
91
|
+
The native RPC mapping types `OperationRpc` and `Tag` are exported from `@shivaedev/contract/operationRpc.ts`.
|
|
92
|
+
|
|
93
|
+
### Whose account a request acts on
|
|
94
|
+
|
|
95
|
+
Set `subject` on a contract to a browser-safe declaration from `@shivaedev/identity/subject.ts`: `selfSubject` selects the session account; `accountSubject({ permission, refusal, deny })` permits another account only with the permission's `any` grant. The declaration applies to the application RPCs and their changes stream. Native middleware carries its typed failures and supplies the branded `Subject` service to handlers and the application services they call. Business payloads need no owner id.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { contract } from "@shivaedev/contract/contract.ts";
|
|
99
|
+
import { command } from "@shivaedev/contract/operation.ts";
|
|
100
|
+
import { selfSubject } from "@shivaedev/identity/subject.ts";
|
|
101
|
+
|
|
102
|
+
const Save = command("save", { invalidates: () => [] });
|
|
103
|
+
const Account = contract("account", { commands: [Save], subject: selfSubject });
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The client calls `account.save` without an account id. The session host installs the resolver; handlers read `Subject` from the request environment. See [identity's subject guide](https://github.com/ShivaeDev/platform/tree/main/packages/identity#declared-request-subjects) for delegated selection and refusal declarations.
|
|
107
|
+
|
|
91
108
|
### Expected failures
|
|
92
109
|
|
|
93
110
|
Import the shared expected failures from `@shivaedev/errors/taxonomy.ts`: `NotFound`, `Unauthorized`, `Forbidden`, `BadRequest`, `Conflict`, `PreconditionFailed`, `TooManyRequests`, `AuthUnavailable`, `InternalServerError` and `ServiceUnavailable`. Each class is a tagged error schema with a string `message`; `BadRequest` and `Conflict` also accept an optional string `field`. Declare only the failures an operation can return:
|
|
@@ -106,6 +123,8 @@ export const Rename = Rpc.make("Rename", {
|
|
|
106
123
|
|
|
107
124
|
A handler fails with `new Conflict({ field: "name", message: "Name is taken" })`. Native RPC JSON decodes the rejection back to the error instance with its field. Taxonomy errors can be declared on an RPC with no authentication middleware. [`@shivaedev/errors`](https://github.com/ShivaeDev/platform/tree/main/packages/errors#readme) also exports `rejectedField`, which reads the field and message of a rejection on the client.
|
|
108
125
|
|
|
126
|
+
For a bound command declaring `BadRequest`, payload construction or encoding failures become that declared rejection in the Effect error channel. Its `message` contains the schema's validation details, including struct-level checks. The invalid payload does not reach the handler. Commands without a declared `BadRequest` keep native RPC's failure behavior.
|
|
127
|
+
|
|
109
128
|
`rejections: { NoteMissing }` reuses the class. The object's key must equal the class's `_tag`. Sharing a class lets a service and several operations use the same expected failure.
|
|
110
129
|
|
|
111
130
|
`rejections: { Invalid: fieldRejection(Draft) }` generates a tagged error class for that operation. `fieldRejection` derives the allowed field names from the struct; an explicit field list narrows them. `Rename` permits only `"title"`, while `Create` permits `"body"` or `"title"`. Their generated `Invalid` classes are distinct.
|
|
@@ -275,9 +294,13 @@ The dependency rule is deliberately asymmetric:
|
|
|
275
294
|
|
|
276
295
|
Client invalidation follows RPC success. Database hosts from `@shivaedev/server` also publish declared command invalidations automatically after the handler succeeds, excluding keys already announced by repository commits, using `transact` from [`sql`](https://github.com/ShivaeDev/platform/tree/main/packages/sql); commit-bound changes belong to [`changes`](https://github.com/ShivaeDev/platform/tree/main/packages/changes).
|
|
277
296
|
|
|
297
|
+
### Host build announcements
|
|
298
|
+
|
|
299
|
+
`HostVersion` from `@shivaedev/contract/HostVersion.ts` declares the native `platform.hostVersion.watch` string stream shared by the application host and React's deploy controller. The host announces its configured build ID on subscription, including after a host replacement reconnects. It uses the same shared WebSocket connection as other `makeClient` bindings with matching transport options. Applications normally use the controller from `@shivaedev/react/client/deployUpdate.ts` rather than consuming this stream directly.
|
|
300
|
+
|
|
278
301
|
### Client activity
|
|
279
302
|
|
|
280
|
-
`clientActivity(client)` from `@shivaedev/contract/clientActivity.ts` returns a native Effect `Stream` with a `current` Effect for a client made by `makeClient`. Its state reports `rpcCalls` for finite calls, `liveInvalidations` for queued live refreshes, `refreshingAtoms` for mounted query atoms awaiting values, and a `liveHints` sequence for received subscription updates. Long-lived streams do not count as finite calls. `isClientIdle(state)` is true when all three work counts are zero. Observe its stream or pass `activityScreenSignal(clientActivity(client))` to a test-story screen driver's `pending` option and call `settle()` before screen assertions. `activityScreenSignal(activity)` projects the stream and its `current` Effect into `{ pending, hints }`, with `pending` true while finite work remains and `hints` carrying the received live-hint count. The returned shape is structural and carries no test-story dependency. Coalesced work stays pending until its refresh completes.
|
|
303
|
+
`clientActivity(client)` from `@shivaedev/contract/clientActivity.ts` returns a native Effect `Stream` with a `current` Effect for a client made by `makeClient`. Its state includes `connectionStatus`, a `"live" | "reconnecting"` value aggregated across mounted queries from all bindings of the same client service, with changes debounced for 300 ms on the client runtime’s Clock. Refused subscriptions do not count as reconnecting. The stream also exposes its native `connectionStatus` atom for React readers. Its state reports `rpcCalls` for finite calls, `liveInvalidations` for queued live refreshes, `refreshingAtoms` for mounted query atoms awaiting values, and a `liveHints` sequence for received subscription updates. Long-lived streams do not count as finite calls. `isClientIdle(state)` is true when all three work counts are zero. Observe its stream or pass `activityScreenSignal(clientActivity(client))` to a test-story screen driver's `pending` option and call `settle()` before screen assertions. `activityScreenSignal(activity)` projects the stream and its `current` Effect into `{ pending, hints, connectionStatus }`, with `pending` true while finite work remains and `hints` carrying the received live-hint count. The returned shape is structural and carries no test-story dependency. Coalesced work stays pending until its refresh completes.
|
|
281
304
|
|
|
282
305
|
### Query completion
|
|
283
306
|
|
|
@@ -349,7 +372,7 @@ import { clientInvalidationKeys, clientReadKeys, type KeyContext } from "@shivae
|
|
|
349
372
|
|
|
350
373
|
### Compose feature bindings
|
|
351
374
|
|
|
352
|
-
Use `composeBindings(client, bindings)` when a connection contains several feature modules. The returned object keeps the client's fields and types and carries an explicit list of bound APIs. `liveBindings(connection)` reads this list;
|
|
375
|
+
Use `composeBindings(client, bindings)` when a connection contains several feature modules. The returned object keeps the client's fields and types and carries an explicit list of bound APIs. `liveBindings(connection)` reads this list; without an explicit list it finds bindings through nested object properties and arrays at any depth. It visits shared objects once and handles cycles. Explicit lists remain authoritative at each composition.
|
|
353
376
|
|
|
354
377
|
```ts
|
|
355
378
|
import { composeBindings } from "@shivaedev/contract/composeBindings.ts";
|
|
@@ -367,7 +390,7 @@ const connection = composeBindings(
|
|
|
367
390
|
|
|
368
391
|
The automatic live connection exposed at `api[LiveConnection]` includes a writable `paused` atom. Set it in the binding’s registry to pause refreshes; clearing it reconciles the mounted queries. Bindings on the same client runtime share this pause state.
|
|
369
392
|
|
|
370
|
-
Database hosts from `@shivaedev/server` serve the contract's reserved `<contract>.$changes` stream automatically. With the native WebSocket protocol, `bind` and a React `SessionBoundary` connect query atoms without an application subscribe operation or `live()` call. The boundary mounts the bindings declared with `composeBindings`, or finds bound APIs returned directly by `connect` or
|
|
393
|
+
Database hosts from `@shivaedev/server` serve the contract's reserved `<contract>.$changes` stream automatically. With the native WebSocket protocol, `bind` and a React `SessionBoundary` connect query atoms without an application subscribe operation or `live()` call. The boundary mounts the bindings declared with `composeBindings`, or finds bound APIs returned directly by `connect` or nested in properties such as `client.api.notes`. See [automatic changes](https://github.com/ShivaeDev/platform/blob/main/docs/framework/changes.md) for defaults.
|
|
371
394
|
|
|
372
395
|
Subscribing to the hosted `$changes` stream over HTTP fails with `WebSocketRequired` from `@shivaedev/contract/WebSocketRequired.ts`; its message names the stream and says it needs the WebSocket protocol.
|
|
373
396
|
|
|
@@ -503,7 +526,7 @@ const status = registry.get(updates.status);
|
|
|
503
526
|
|
|
504
527
|
While paused, live coordination keeps observing hints and suppresses automatic refresh. `status.pending` saturates at 256 observations. Unpausing reconciles the explicit scope and resets the count. A resume signal also requests reconciliation: an injected native source and visible browser `online` and `visibilitychange` events request it, while hidden events do not.
|
|
505
528
|
|
|
506
|
-
`status` exposes `connection`, `failure`, `needsResync` and `pending`. Expected stream rejections settle with `connection: "failed"` and their typed cause in `failure`. Typed rejections do not retry on a timer. An initial `QueryReadDenied` refusal stays settled through matching change invalidations and resume events; changing the query input or viewer identity starts a new subscription. A denial delivered on an established subscription also sets `connection: "failed"`, but the stream remains open and a later authorized hint restores the query and live status. Other expected rejections can reopen on matching invalidations. Low-level `live()` listens to `retryKeys`, defaulting to its `resyncKeys`, for matching invalidations. Transport errors and server defects reconnect with jittered exponential backoff, starting at `retryDelay` (one second by default) and capped at a nominal 30 seconds. A reconnection reconciles changes missed while disconnected, and successful delivery clears the stream failure. Native query atoms keep previous successful data during a read failure and reject stale responses after invalidation. Query failures remain in their own `AsyncResult`; stream failures appear in `status.failure`.
|
|
529
|
+
`status` exposes `connection`, `failure`, `needsResync` and `pending`. Expected stream rejections settle with `connection: "failed"` and their typed cause in `failure`. Typed rejections do not retry on a timer. An initial `QueryReadDenied` refusal stays settled through matching change invalidations and resume events; changing the query input or viewer identity starts a new subscription. A denial delivered on an established subscription also sets `connection: "failed"`, but the stream remains open and a later authorized hint restores the query and live status. Other expected rejections can reopen on matching invalidations. Low-level `live()` listens to `retryKeys`, defaulting to its `resyncKeys`, for matching invalidations. Transport errors and server defects reconnect with jittered exponential backoff, starting at `retryDelay` (one second by default) and capped at a nominal 30 seconds. A resume signal interrupts that delay, retries immediately and resets the backoff schedule. Healthy hint subscriptions reconcile without reopening; pushed subscriptions reopen to obtain their current value. A reconnection reconciles changes missed while disconnected, and successful delivery clears the stream failure. Native query atoms keep previous successful data during a read failure and reject stale responses after invalidation. Query failures remain in their own `AsyncResult`; stream failures appear in `status.failure`.
|
|
507
530
|
|
|
508
531
|
A `$changes` request is authorized as a whole: one denied member rejects or ends the entire batch, including its other queries. Split queries with independent permissions into separate `$changes` requests. Automatic bound query atoms already subscribe separately.
|
|
509
532
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const HostVersion: import("#contract.ts").Contract<"platform.hostVersion", readonly [], readonly [], import("effect/rpc/Rpc").Rpc<"platform.hostVersion.$changes", Schema.Struct<{
|
|
3
|
+
queries: Schema.$Array<Schema.Union<readonly never[]>>;
|
|
4
|
+
}>, import("effect/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
5
|
+
readonly _tag: Schema.Literal<"Changed">;
|
|
6
|
+
readonly keys: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
7
|
+
readonly _tag: Schema.Literal<"Bucket">;
|
|
8
|
+
readonly collection: Schema.String;
|
|
9
|
+
readonly field: Schema.String;
|
|
10
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Number]>;
|
|
11
|
+
}>, Schema.Struct<{
|
|
12
|
+
readonly _tag: Schema.Literal<"List">;
|
|
13
|
+
readonly collection: Schema.String;
|
|
14
|
+
}>, Schema.Struct<{
|
|
15
|
+
readonly _tag: Schema.Literal<"Item">;
|
|
16
|
+
readonly collection: Schema.String;
|
|
17
|
+
readonly id: Schema.Union<readonly [Schema.String, Schema.Number]>;
|
|
18
|
+
}>]>>;
|
|
19
|
+
readonly queryIndexes: Schema.optional<Schema.$Array<Schema.Number>>;
|
|
20
|
+
}>, Schema.Struct<{
|
|
21
|
+
readonly _tag: Schema.Literal<"Resync">;
|
|
22
|
+
}>]>, typeof import("./readPolicyErrors.ts").QueryReadDenied, ...never[]]>, Schema.Union<readonly [typeof import("./readPolicyErrors.ts").MissingReadPolicy, typeof import("./readPolicyErrors.ts").QueryReadDenied, typeof import("./WebSocketRequired.ts").WebSocketRequired, ...never[]]>>, Schema.Never, import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
|
|
23
|
+
readonly rpc: import("effect/rpc/Rpc").Any;
|
|
24
|
+
readonly payload: unknown;
|
|
25
|
+
}) => import("effect/Effect").Effect<A, E | import("./readPolicyErrors.ts").MissingReadPolicy | import("./readPolicyErrors.ts").QueryReadDenied | import("./WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
|
|
26
|
+
"~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
|
|
27
|
+
"~ClientError": never;
|
|
28
|
+
error: Schema.Union<readonly [typeof import("./readPolicyErrors.ts").MissingReadPolicy, typeof import("./readPolicyErrors.ts").QueryReadDenied, typeof import("./WebSocketRequired.ts").WebSocketRequired]>;
|
|
29
|
+
requiredForClient: false;
|
|
30
|
+
}, never> | import("effect/rpc/Rpc").Rpc<"platform.hostVersion.watch", Schema.Void, import("effect/rpc/RpcSchema").Stream<Schema.String, Schema.Never>, Schema.Never, never, never>, readonly [NoInfer<import("#operation.ts").Streaming<"watch", Schema.Void, Schema.String, {}>>], undefined>;
|
|
31
|
+
//# sourceMappingURL=HostVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostVersion.d.ts","sourceRoot":"","sources":["../src/HostVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;+RAEtB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { contract } from "#contract.ts";
|
|
3
|
+
import { stream } from "#operation.ts";
|
|
4
|
+
export const HostVersion = contract("platform.hostVersion", {
|
|
5
|
+
streams: [stream("watch", { reads: () => [], success: Schema.String })],
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=HostVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostVersion.js","sourceRoot":"","sources":["../src/HostVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,sBAAsB,EAAE;IAC3D,OAAO,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;CACvE,CAAC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import type { ClientActivityState } from "#clientActivity.ts";
|
|
2
|
+
import type { ClientActivityState, ConnectionStatus } from "#clientActivity.ts";
|
|
3
3
|
export declare function activityState(): {
|
|
4
4
|
activity: import("effect/Stream").Stream<ClientActivityState, never, never> & {
|
|
5
5
|
current: Effect.Effect<ClientActivityState, never, never>;
|
|
6
6
|
};
|
|
7
|
-
change: (key: keyof ClientActivityState, delta: number) => void;
|
|
7
|
+
change: (key: Exclude<keyof ClientActivityState, "connectionStatus">, delta: number) => void;
|
|
8
|
+
setConnection: (connectionStatus: ConnectionStatus) => void;
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=activityState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activityState.d.ts","sourceRoot":"","sources":["../../src/adapters/activityState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"activityState.d.ts","sourceRoot":"","sources":["../../src/adapters/activityState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmB,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,wBAAgB,aAAa;IAK3B,QAAQ;;;IACR,MAAM,QAAQ,OAAO,CAAC,MAAM,mBAAmB,EAAE,kBAAkB,CAAC,SAAS,MAAM;IAGnF,aAAa,qBAAqB,gBAAgB;EAMnD"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Effect, SubscriptionRef } from "effect";
|
|
2
2
|
export function activityState() {
|
|
3
|
-
const state = Effect.runSync(SubscriptionRef.make({ liveHints: 0, liveInvalidations: 0, refreshingAtoms: 0, rpcCalls: 0 }));
|
|
3
|
+
const state = Effect.runSync(SubscriptionRef.make({ connectionStatus: "live", liveHints: 0, liveInvalidations: 0, refreshingAtoms: 0, rpcCalls: 0 }));
|
|
4
4
|
return {
|
|
5
5
|
activity: Object.assign(SubscriptionRef.changes(state), { current: SubscriptionRef.get(state) }),
|
|
6
6
|
change: (key, delta) => {
|
|
7
7
|
Effect.runSync(SubscriptionRef.update(state, (current) => ({ ...current, [key]: current[key] + delta })));
|
|
8
8
|
},
|
|
9
|
+
setConnection: (connectionStatus) => {
|
|
10
|
+
Effect.runSync(SubscriptionRef.update(state, (current) => (current.connectionStatus === connectionStatus ? current : { ...current, connectionStatus })));
|
|
11
|
+
},
|
|
9
12
|
};
|
|
10
13
|
}
|
|
11
14
|
//# sourceMappingURL=activityState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activityState.js","sourceRoot":"","sources":["../../src/adapters/activityState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGjD,MAAM,UAAU,aAAa;IAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"activityState.js","sourceRoot":"","sources":["../../src/adapters/activityState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGjD,MAAM,UAAU,aAAa;IAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAC3B,eAAe,CAAC,IAAI,CAAsB,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAC5I,CAAC;IACF,OAAO;QACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAChG,MAAM,EAAE,CAAC,GAA2D,EAAE,KAAa,EAAE,EAAE;YACtF,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3G,CAAC;QACD,aAAa,EAAE,CAAC,gBAAkC,EAAE,EAAE;YACrD,MAAM,CAAC,OAAO,CACb,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,KAAK,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC,CACxI,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
2
|
+
import type { ConnectionStatus } from "#clientActivity.ts";
|
|
3
|
+
import type { LiveStatus } from "#live.ts";
|
|
4
|
+
export declare function clientConnection(factory: Atom.RuntimeFactory, publish: (status: ConnectionStatus) => void): {
|
|
5
|
+
status: Atom.Atom<ConnectionStatus>;
|
|
6
|
+
statuses: Atom.Writable<ReadonlyMap<object, LiveStatus<unknown>>, ReadonlyMap<object, LiveStatus<unknown>>>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=clientConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientConnection.d.ts","sourceRoot":"","sources":["../../src/adapters/clientConnection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI;;;EA8BzG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Effect, Layer, Option, Stream } from "effect";
|
|
2
|
+
import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
3
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
4
|
+
export function clientConnection(factory, publish) {
|
|
5
|
+
const statuses = Atom.make(new Map());
|
|
6
|
+
const current = Atom.map(statuses, (values) => [...values.values()].some(({ connection }) => connection === "connecting" || connection === "reconnecting") ? "reconnecting" : "live");
|
|
7
|
+
const runtime = factory(Layer.empty);
|
|
8
|
+
const status = Atom.make((get) => {
|
|
9
|
+
const context = AsyncResult.value(get(runtime));
|
|
10
|
+
if (Option.isNone(context)) {
|
|
11
|
+
return "live";
|
|
12
|
+
}
|
|
13
|
+
const cancel = Effect.runCallbackWith(context.value)(get.stream(current).pipe(Stream.changes, Stream.debounce("300 millis"), Stream.runForEach((value) => Effect.sync(() => {
|
|
14
|
+
publish(value);
|
|
15
|
+
get.setSelf(value);
|
|
16
|
+
})), Effect.ensuring(Effect.sync(() => publish("live")))));
|
|
17
|
+
get.addFinalizer(cancel);
|
|
18
|
+
return "live";
|
|
19
|
+
});
|
|
20
|
+
return { status, statuses };
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=clientConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientConnection.js","sourceRoot":"","sources":["../../src/adapters/clientConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAI/C,MAAM,UAAU,gBAAgB,CAAC,OAA4B,EAAE,OAA2C;IACzG,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAA2C,IAAI,GAAG,EAAE,CAAC,CAAC;IAChF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CACvB,QAAQ,EACR,CAAC,MAAM,EAAoB,EAAE,CAC5B,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,YAAY,IAAI,UAAU,KAAK,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CACtI,CAAC;IACF,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAoB,EAAE;QAClD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,MAAM,CAAC;QACf,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CACnD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAC7B,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,CAAC;YACf,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CACF,EACD,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CACnD,CACD,CAAC;QACF,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automaticLive.d.ts","sourceRoot":"","sources":["../src/automaticLive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAU,KAAK,MAAM,EAAU,MAAM,QAAQ,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"automaticLive.d.ts","sourceRoot":"","sources":["../src/automaticLive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAU,KAAK,MAAM,EAAU,M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,aAAa,CAChD,OAAO,EACP,MAAM,EACN,GAAG,CAAC,GAAG,CACN,GAAG,MAAM,WAAW,EACpB,MAAM,CAAC,MAAM,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAA;KAAE,CAAC,CAAC,CAAA;CAAE,CAAC,EAC3G,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,EAC5D,MAAM,CAAC,KAAK,CACZ,CACD,CAAC;AAEF,wBAAgB,aAAa,CAC5B,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,YAAY,EACrB,OAAO,UAAO,EACd,YAAY,CAAC,EAAE,YAAY;YAkBZ,CAAC,EAAE,CAAC,QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aACnC,cAAc,QACnB,SAAS,GAAG,EAAE,cACR,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,WACjC,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,YACpB,OAAO,CAAC,KAAK;;;;;;;;EA2CxB"}
|
package/dist/automaticLive.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Effect, Stream } from "effect";
|
|
|
2
2
|
import * as Atom from "effect/reactivity/Atom";
|
|
3
3
|
import { aggregateLiveStatus } from "#internal/aggregateLiveStatus.ts";
|
|
4
4
|
import { automaticQuery } from "#internal/automaticQuery.ts";
|
|
5
|
+
import { clientActivities } from "#internal/clientActivity.ts";
|
|
5
6
|
import { queryDelivery } from "#internal/queryDelivery.ts";
|
|
6
7
|
import { localQueryKeys, queryHint } from "#internal/queryHints.ts";
|
|
7
8
|
import { queryProgress } from "#internal/querySignals.ts";
|
|
@@ -39,6 +40,7 @@ export function automaticLive(service, name, owner, resume, enabled = true, resu
|
|
|
39
40
|
const subscription = live(service.runtime, {
|
|
40
41
|
initialResync: false,
|
|
41
42
|
keyContext: owner?.context,
|
|
43
|
+
reopenOnResume: decode !== undefined,
|
|
42
44
|
resume: signal,
|
|
43
45
|
resyncKeys: decode === undefined ? localQueryKeys(keys) : [],
|
|
44
46
|
retryKeys: keys,
|
|
@@ -47,12 +49,12 @@ export function automaticLive(service, name, owner, resume, enabled = true, resu
|
|
|
47
49
|
const gated = automaticQuery({
|
|
48
50
|
assertOwner,
|
|
49
51
|
atom,
|
|
52
|
+
clientStatuses: clientActivities.get(service)?.statuses,
|
|
50
53
|
coalesceWindow,
|
|
51
54
|
equivalent,
|
|
52
55
|
paused,
|
|
53
56
|
pushed: decode !== undefined,
|
|
54
57
|
ready,
|
|
55
|
-
signal,
|
|
56
58
|
signals,
|
|
57
59
|
source,
|
|
58
60
|
statuses,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automaticLive.js","sourceRoot":"","sources":["../src/automaticLive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGpE,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAK/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAmB,IAAI,EAAE,MAAM,UAAU,CAAC;AACjD,O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,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;AAC1G,CAAC"}
|
package/dist/bind.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ import type { Rpc, RpcGroup } from "effect/rpc";
|
|
|
9
9
|
import type { RpcClientError } from "effect/rpc/RpcClientError";
|
|
10
10
|
import { type LiveBound } from "#automaticLive.ts";
|
|
11
11
|
import type { ClientOptions, MadeClient } from "#clientOptions.ts";
|
|
12
|
-
import type { Contract
|
|
12
|
+
import type { Contract } from "#contract.ts";
|
|
13
13
|
import type { CommandShape, QueryShape, StreamShape } from "#operation.ts";
|
|
14
|
+
import type { Tag } from "#operationRpc.ts";
|
|
14
15
|
import type { ResumeSource, ResumeWindow } from "#resume.ts";
|
|
15
16
|
export type Failure<R extends Rpc.Any> = R extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer TMiddleware, infer _Requires> ? Rpc.ErrorExit<R> | TMiddleware["error"]["Type"] | TMiddleware["~ClientError"] | RpcClientError : never;
|
|
16
17
|
export type RunFailure<R extends Rpc.Any> = Failure<R>;
|
package/dist/bind.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../src/bind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CA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SAAS,EACpC,MAAM,SAAS,GAAG,CAAC,GAAG,GAAG,KAAK,EAE9B,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EACvE,OAAO,EAAE,aAAa,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,SAAS,SAAS,MAAM,GACvG;IAAE,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,YAAY,CAAA;CAAE,CAAC,GACpD,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC"}
|
package/dist/bind.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind.js","sourceRoot":"","sources":["../src/bind.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAkB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAkB,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"bind.js","sourceRoot":"","sources":["../src/bind.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAkB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAkB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA8EnE,MAAM,UAAU,IAAI,CACnB,QA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F,CAAC,EACF,EAAE,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,YAAY,EAAE,CAC5C,CAAC;AACH,CAAC;AAgBD,MAAM,UAAU,UAAU,CACzB,QAEC,EACD,OAGC;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5F,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/clientActivity.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Effect, Stream } from "effect";
|
|
2
|
+
import type * as Atom from "effect/reactivity/Atom";
|
|
3
|
+
export type ConnectionStatus = "live" | "reconnecting";
|
|
2
4
|
export interface ClientActivityState {
|
|
5
|
+
readonly connectionStatus: ConnectionStatus;
|
|
3
6
|
readonly liveHints: number;
|
|
4
7
|
readonly liveInvalidations: number;
|
|
5
8
|
readonly refreshingAtoms: number;
|
|
6
9
|
readonly rpcCalls: number;
|
|
7
10
|
}
|
|
8
11
|
export type ClientActivity = Stream.Stream<ClientActivityState> & {
|
|
12
|
+
readonly connectionStatus: Atom.Atom<ConnectionStatus>;
|
|
9
13
|
readonly current: Effect.Effect<ClientActivityState>;
|
|
10
14
|
};
|
|
11
15
|
export declare const Activity: unique symbol;
|
|
@@ -15,10 +19,12 @@ export interface ActiveClient {
|
|
|
15
19
|
export declare function clientActivity(client: ActiveClient): ClientActivity;
|
|
16
20
|
export declare function isClientIdle(state: ClientActivityState): boolean;
|
|
17
21
|
export declare function activityScreenSignal(activity: ClientActivity): Stream.Stream<{
|
|
22
|
+
connectionStatus: ConnectionStatus;
|
|
18
23
|
hints: number;
|
|
19
24
|
pending: boolean;
|
|
20
25
|
}, never, never> & {
|
|
21
26
|
current: Effect.Effect<{
|
|
27
|
+
connectionStatus: ConnectionStatus;
|
|
22
28
|
hints: number;
|
|
23
29
|
pending: boolean;
|
|
24
30
|
}, never, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientActivity.d.ts","sourceRoot":"","sources":["../src/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"clientActivity.d.ts","sourceRoot":"","sources":["../src/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAEpD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,cAAc,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG;IACjE,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF,eAAO,MAAM,QAAQ,eAAmD,CAAC;AAEzE,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;CACpC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAEnE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAEhE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc;;;;;;;;;;EAK5D"}
|
package/dist/clientActivity.js
CHANGED
|
@@ -8,7 +8,7 @@ export function isClientIdle(state) {
|
|
|
8
8
|
}
|
|
9
9
|
export function activityScreenSignal(activity) {
|
|
10
10
|
function screenState(state) {
|
|
11
|
-
return { hints: state.liveHints, pending: !isClientIdle(state) };
|
|
11
|
+
return { connectionStatus: state.connectionStatus, hints: state.liveHints, pending: !isClientIdle(state) };
|
|
12
12
|
}
|
|
13
13
|
return Object.assign(Stream.map(activity, screenState), { current: Effect.map(activity.current, screenState) });
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientActivity.js","sourceRoot":"","sources":["../src/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"clientActivity.js","sourceRoot":"","sources":["../src/clientActivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAkBxC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAMzE,MAAM,UAAU,cAAc,CAAC,MAAoB;IAClD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAA0B;IACtD,OAAO,KAAK,CAAC,QAAQ,KAAK,CAAC,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,IAAI,KAAK,CAAC,eAAe,KAAK,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAwB;IAC5D,SAAS,WAAW,CAAC,KAA0B;QAC9C,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5G,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;AACjH,CAAC"}
|
package/dist/clientOptions.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface ClientOptions {
|
|
|
16
16
|
readonly protocol?: Layer.Layer<RpcClient.Protocol> | ((identity: string | undefined) => Layer.Layer<RpcClient.Protocol>);
|
|
17
17
|
readonly resume?: ResumeSource;
|
|
18
18
|
readonly resumeWindow?: ResumeWindow;
|
|
19
|
+
readonly runtime?: Atom.RuntimeFactory;
|
|
19
20
|
readonly url: string;
|
|
20
21
|
readonly webSocketConstructor?: Layer.Layer<Socket.WebSocketConstructor>;
|
|
21
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientOptions.d.ts","sourceRoot":"","sources":["../src/clientOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OA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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeBindings.d.ts","sourceRoot":"","sources":["../src/composeBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAEnE,eAAO,MAAM,gBAAgB,eAAqD,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAClD;AAED,wBAAgB,eAAe,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,GAAG,kBAAkB,CAErI;
|
|
1
|
+
{"version":3,"file":"composeBindings.d.ts","sourceRoot":"","sources":["../src/composeBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAEnE,eAAO,MAAM,gBAAgB,eAAqD,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAClD;AAED,wBAAgB,eAAe,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,GAAG,kBAAkB,CAErI;AAUD,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,SAAS,EAAE,CAmBlE"}
|
package/dist/composeBindings.js
CHANGED
|
@@ -3,16 +3,31 @@ export const ComposedBindings = Symbol.for("@shivaedev/contract/ComposedBindings
|
|
|
3
3
|
export function composeBindings(client, bindings) {
|
|
4
4
|
return { ...client, [ComposedBindings]: bindings };
|
|
5
5
|
}
|
|
6
|
+
function isLiveBound(client) {
|
|
7
|
+
return LiveConnection in client;
|
|
8
|
+
}
|
|
6
9
|
function isComposition(client) {
|
|
7
10
|
return ComposedBindings in client;
|
|
8
11
|
}
|
|
9
12
|
export function liveBindings(client) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const pending = [client];
|
|
14
|
+
const visited = new Set();
|
|
15
|
+
const bindings = [];
|
|
16
|
+
for (const value of pending) {
|
|
17
|
+
if (typeof value !== "object" || value === null || visited.has(value)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
visited.add(value);
|
|
21
|
+
if (isComposition(value)) {
|
|
22
|
+
pending.push(...value[ComposedBindings]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
if (isLiveBound(value)) {
|
|
26
|
+
bindings.push(value);
|
|
27
|
+
}
|
|
28
|
+
pending.push(...Object.values(value));
|
|
29
|
+
}
|
|
15
30
|
}
|
|
16
|
-
return
|
|
31
|
+
return bindings;
|
|
17
32
|
}
|
|
18
33
|
//# sourceMappingURL=composeBindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeBindings.js","sourceRoot":"","sources":["../src/composeBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AAMnF,MAAM,UAAU,eAAe,CAAyB,MAAe,EAAE,QAA8B;IACtG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACpC,OAAO,gBAAgB,IAAI,MAAM,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAe;IAC3C,
|
|
1
|
+
{"version":3,"file":"composeBindings.js","sourceRoot":"","sources":["../src/composeBindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,CA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
1
|
-
import {
|
|
2
|
-
import { Rpc, RpcGroup, type RpcMiddleware, type RpcSchema } from "effect/rpc";
|
|
1
|
+
import { Rpc, RpcGroup, type RpcMiddleware } from "effect/rpc";
|
|
3
2
|
import { type Unique } from "#internal/declarationError.ts";
|
|
4
|
-
import type { CommandShape,
|
|
3
|
+
import type { CommandShape, QueryShape, StreamShape } from "#operation.ts";
|
|
4
|
+
import type { OperationRpc } from "#operationRpc.ts";
|
|
5
5
|
import { ReadPolicyGuard } from "#ReadPolicyGuard.ts";
|
|
6
|
-
import { QueryReadDenied } from "#readPolicyErrors.ts";
|
|
7
6
|
import { changesRpc } from "#serverMetadata.ts";
|
|
8
|
-
|
|
7
|
+
import type { SubjectDeclaration, WithSubject } from "#subject.ts";
|
|
9
8
|
export type QueryServices<TQuery> = TQuery extends QueryShape<unknown, infer R> ? R : never;
|
|
10
|
-
type OperationError<TOperation extends OperationShape> = TOperation extends QueryShape ? Schema.Union<readonly [TOperation["error"], typeof QueryReadDenied]> : TOperation["error"];
|
|
11
|
-
export type OperationRpc<TContract extends string, TOperation> = TOperation extends OperationShape ? TOperation extends StreamShape ? Rpc.Rpc<Tag<TContract, TOperation["name"]>, TOperation["payload"], RpcSchema.Stream<TOperation["success"], TOperation["error"]>, Schema.Never> : Rpc.Rpc<Tag<TContract, TOperation["name"]>, TOperation["payload"], TOperation["success"], OperationError<TOperation>, TOperation extends QueryShape ? typeof ReadPolicyGuard : never, QueryServices<TOperation>> : never;
|
|
12
9
|
export interface Declared<TName extends string, TQueries extends readonly QueryShape[], TCommands extends readonly CommandShape[], TStreams extends readonly StreamShape[] = readonly [], TScope extends "session" | undefined = undefined> {
|
|
13
10
|
readonly commands: TCommands;
|
|
14
11
|
readonly keyScope: TScope;
|
|
@@ -23,11 +20,11 @@ export interface Contract<TName extends string, TQueries extends readonly QueryS
|
|
|
23
20
|
readonly declaration: Declared<TName, TQueries, TCommands, TStreams, TScope>;
|
|
24
21
|
middleware: <TM extends RpcMiddleware.AnyService>(middleware: TM) => Contract<TName, TQueries, TCommands, Rpc.AddMiddleware<TRpcs, TM>, TStreams, TScope>;
|
|
25
22
|
}
|
|
26
|
-
export declare function contract<const TName extends string, const TQueries extends readonly QueryShape[] = readonly [], const TCommands extends readonly CommandShape[] = readonly [], const TStreams extends readonly StreamShape[] = readonly [], const TScope extends "session" | undefined = undefined>(name: TName, operations: {
|
|
23
|
+
export declare function contract<const TName extends string, const TQueries extends readonly QueryShape[] = readonly [], const TCommands extends readonly CommandShape[] = readonly [], const TStreams extends readonly StreamShape[] = readonly [], const TScope extends "session" | undefined = undefined, const TSubject extends SubjectDeclaration | undefined = undefined>(name: TName, operations: {
|
|
27
24
|
readonly keyScope?: TScope;
|
|
25
|
+
readonly subject?: TSubject;
|
|
28
26
|
readonly queries?: TQueries & Unique<TQueries>;
|
|
29
27
|
readonly commands?: TCommands & Unique<[...TQueries, ...TCommands]>;
|
|
30
28
|
readonly streams?: TStreams & Unique<[...TQueries, ...TCommands, ...TStreams]>;
|
|
31
|
-
}): Contract<TName, TQueries, TCommands, OperationRpc<TName, TQueries[number] | TCommands[number] | TStreams[number]> | Rpc.AddMiddleware<ReturnType<typeof changesRpc<TName, TQueries>>, typeof ReadPolicyGuard>, TStreams, TScope>;
|
|
32
|
-
export {};
|
|
29
|
+
}): Contract<TName, TQueries, TCommands, WithSubject<OperationRpc<TName, TQueries[number] | TCommands[number] | TStreams[number]> | Rpc.AddMiddleware<ReturnType<typeof changesRpc<TName, TQueries>>, typeof ReadPolicyGuard>, TSubject>, TStreams, TScope>;
|
|
33
30
|
//# sourceMappingURL=contract.d.ts.map
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,QAAQ,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,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;CAC/E,GACC,QAAQ,CACV,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,CACR,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAC5E,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,OAAO,eAAe,CAAC,EAC3F,QAAQ,CACR,EACD,QAAQ,EACR,MAAM,CACN,CAAC"}
|
package/dist/contract.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Rpc, RpcGroup } from "effect/rpc";
|
|
3
3
|
import { declarationError } from "#internal/declarationError.ts";
|
|
4
|
+
import { subjectMiddleware } from "#internal/subjectMiddleware.ts";
|
|
4
5
|
import { ReadPolicyGuard } from "#ReadPolicyGuard.ts";
|
|
5
6
|
import { QueryReadDenied } from "#readPolicyErrors.ts";
|
|
6
7
|
import { changesRpc, KeyScope, operationAnnotations } from "#serverMetadata.ts";
|
|
@@ -28,11 +29,14 @@ export function contract(name, operations) {
|
|
|
28
29
|
stream: operation.kind === "stream",
|
|
29
30
|
success: operation.success,
|
|
30
31
|
}).annotateMerge(operationAnnotations(operation, keyScope));
|
|
31
|
-
|
|
32
|
+
const guarded = operation.kind === "query" ? rpc.middleware(ReadPolicyGuard) : rpc;
|
|
33
|
+
return operations.subject === undefined ? guarded : guarded.middleware(subjectMiddleware(`${name}.${operation.name}`, operations.subject));
|
|
32
34
|
});
|
|
33
35
|
const application = RpcGroup.make(...rpcs);
|
|
34
36
|
const changes = changesRpc(name, queries).middleware(ReadPolicyGuard);
|
|
35
|
-
|
|
37
|
+
const subjectChanges = operations.subject === undefined ? changes : changes.middleware(subjectMiddleware(`${name}.$changes`, operations.subject));
|
|
38
|
+
const group = application.add(keyScope === undefined ? subjectChanges : subjectChanges.annotate(KeyScope, keyScope));
|
|
39
|
+
return withDeclaration(group, application, {
|
|
36
40
|
commands,
|
|
37
41
|
keyScope,
|
|
38
42
|
name,
|