@shivaedev/contract 0.19.0 → 0.20.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 +19 -0
- package/README.md +149 -180
- package/dist/automaticLive.d.ts +8 -7
- package/dist/automaticLive.d.ts.map +1 -1
- package/dist/automaticLive.js +101 -51
- package/dist/automaticLive.js.map +1 -1
- package/dist/bind.d.ts +1 -0
- package/dist/bind.d.ts.map +1 -1
- package/dist/bind.js +4 -4
- package/dist/bind.js.map +1 -1
- package/dist/clientOptions.d.ts +6 -5
- package/dist/clientOptions.d.ts.map +1 -1
- package/dist/internal/clientOperations.d.ts +2 -2
- package/dist/internal/clientOperations.d.ts.map +1 -1
- package/dist/internal/clientOperations.js +10 -14
- package/dist/internal/clientOperations.js.map +1 -1
- package/dist/internal/queryReactivity.d.ts +1 -1
- package/dist/internal/queryReactivity.d.ts.map +1 -1
- package/dist/internal/queryReactivity.js +1 -2
- package/dist/internal/queryReactivity.js.map +1 -1
- package/dist/internal/queryResult.d.ts +3 -0
- package/dist/internal/queryResult.d.ts.map +1 -0
- package/dist/internal/queryResult.js +19 -0
- package/dist/internal/queryResult.js.map +1 -0
- package/dist/internal/{httpClient.d.ts → rpcClient.d.ts} +6 -4
- package/dist/internal/rpcClient.d.ts.map +1 -0
- package/dist/internal/rpcClient.js +31 -0
- package/dist/internal/rpcClient.js.map +1 -0
- package/dist/live.d.ts +1 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +14 -1
- package/dist/live.js.map +1 -1
- package/dist/makeLiveServer.js +6 -4
- package/dist/makeLiveServer.js.map +1 -1
- package/package.json +3 -3
- package/src/automaticLive.ts +113 -70
- package/src/bind.ts +7 -6
- package/src/clientOptions.ts +6 -5
- package/src/internal/clientOperations.ts +14 -25
- package/src/internal/queryReactivity.ts +1 -7
- package/src/internal/queryResult.ts +19 -0
- package/src/internal/rpcClient.ts +53 -0
- package/src/live.ts +14 -1
- package/src/makeLiveServer.ts +6 -6
- package/dist/internal/httpClient.d.ts.map +0 -1
- package/dist/internal/httpClient.js +0 -13
- package/dist/internal/httpClient.js.map +0 -1
- package/src/internal/httpClient.ts +0 -21
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Effect, Layer } from "effect";
|
|
2
|
-
import { FetchHttpClient } from "effect/http";
|
|
3
|
-
import * as AtomRpc from "effect/reactivity/AtomRpc";
|
|
4
|
-
import { RpcClient, RpcGroup, RpcSerialization } from "effect/rpc";
|
|
5
|
-
export function httpClient(name, source, options) {
|
|
6
|
-
const group = RpcGroup.make(...source.requests.values()).annotateMerge(source.annotations);
|
|
7
|
-
const protocol = RpcClient.layerProtocolHttp(options).pipe(Layer.provide([options.httpClient ?? FetchHttpClient.layer, options.serialization ?? RpcSerialization.layerNdjson]));
|
|
8
|
-
const Client = AtomRpc.Service()(`${name}/Client`, { group, protocol });
|
|
9
|
-
const client = RpcClient.make(group).pipe(Effect.provide(protocol));
|
|
10
|
-
const layer = Layer.effect(Client, RpcClient.make(group, { flatten: true })).pipe(Layer.provide(protocol));
|
|
11
|
-
return Object.assign(layer, { Client, client, runtime: Client.runtime });
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=httpClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"httpClient.js","sourceRoot":"","sources":["../../src/internal/httpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAY,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAQ7E,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAiB,EAAE,OAAsB;IACjF,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3F,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAAI,CACzD,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC,CACnH,CAAC;IACF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,EAAW,CAAC,GAAG,IAAI,SAAS,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjF,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3G,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type Context, Effect, Layer } from "effect";
|
|
2
|
-
import { FetchHttpClient } from "effect/http";
|
|
3
|
-
import * as AtomRpc from "effect/reactivity/AtomRpc";
|
|
4
|
-
import { type Rpc, RpcClient, RpcGroup, RpcSerialization } from "effect/rpc";
|
|
5
|
-
import type { ClientOptions } from "#clientOptions.ts";
|
|
6
|
-
|
|
7
|
-
export interface HttpGroup {
|
|
8
|
-
readonly annotations: Context.Context<never>;
|
|
9
|
-
readonly requests: ReadonlyMap<string, Rpc.Any>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function httpClient(name: string, source: HttpGroup, options: ClientOptions) {
|
|
13
|
-
const group = RpcGroup.make(...source.requests.values()).annotateMerge(source.annotations);
|
|
14
|
-
const protocol = RpcClient.layerProtocolHttp(options).pipe(
|
|
15
|
-
Layer.provide([options.httpClient ?? FetchHttpClient.layer, options.serialization ?? RpcSerialization.layerNdjson]),
|
|
16
|
-
);
|
|
17
|
-
const Client = AtomRpc.Service<unknown>()(`${name}/Client`, { group, protocol });
|
|
18
|
-
const client = RpcClient.make(group).pipe(Effect.provide(protocol));
|
|
19
|
-
const layer = Layer.effect(Client, RpcClient.make(group, { flatten: true })).pipe(Layer.provide(protocol));
|
|
20
|
-
return Object.assign(layer, { Client, client, runtime: Client.runtime });
|
|
21
|
-
}
|