@shivaedev/contract 0.56.0 → 0.57.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +16 -15
  3. package/dist/AutomaticQueryOptions.d.ts +1 -1
  4. package/dist/AutomaticQueryOptions.d.ts.map +1 -1
  5. package/dist/{bind.d.ts → Bound.d.ts} +1 -19
  6. package/dist/Bound.d.ts.map +1 -0
  7. package/dist/Bound.js +2 -0
  8. package/dist/Bound.js.map +1 -0
  9. package/dist/ClientOptions.d.ts +2 -2
  10. package/dist/ClientOptions.d.ts.map +1 -1
  11. package/dist/automaticLive.d.ts +2 -1
  12. package/dist/automaticLive.d.ts.map +1 -1
  13. package/dist/automaticLive.js +4 -9
  14. package/dist/automaticLive.js.map +1 -1
  15. package/dist/automaticQuery.js +2 -2
  16. package/dist/automaticQuery.js.map +1 -1
  17. package/dist/clientActivities.d.ts +1 -15
  18. package/dist/clientActivities.d.ts.map +1 -1
  19. package/dist/clientActivities.js +0 -1
  20. package/dist/clientActivities.js.map +1 -1
  21. package/dist/clientOperations.d.ts +3 -2
  22. package/dist/clientOperations.d.ts.map +1 -1
  23. package/dist/clientOperations.js +3 -4
  24. package/dist/clientOperations.js.map +1 -1
  25. package/dist/makeClient.d.ts +1 -1
  26. package/dist/makeClient.d.ts.map +1 -1
  27. package/dist/makeClient.js +3 -3
  28. package/dist/makeClient.js.map +1 -1
  29. package/dist/queryDelivery.d.ts +1 -1
  30. package/dist/queryDelivery.d.ts.map +1 -1
  31. package/dist/queryDelivery.js.map +1 -1
  32. package/dist/reflectCommand.d.ts.map +1 -1
  33. package/dist/reflectCommand.js +7 -18
  34. package/dist/reflectCommand.js.map +1 -1
  35. package/dist/reflectedStream.d.ts +3 -3
  36. package/dist/reflectedStream.d.ts.map +1 -1
  37. package/dist/reflectedStream.js +4 -5
  38. package/dist/reflectedStream.js.map +1 -1
  39. package/dist/reflection.d.ts +4 -0
  40. package/dist/reflection.d.ts.map +1 -1
  41. package/dist/reflection.js +4 -0
  42. package/dist/reflection.js.map +1 -1
  43. package/dist/rpcClient.d.ts +29 -12
  44. package/dist/rpcClient.d.ts.map +1 -1
  45. package/dist/rpcClient.js +2 -3
  46. package/dist/rpcClient.js.map +1 -1
  47. package/dist/servedHandlers.d.ts.map +1 -1
  48. package/dist/servedHandlers.js +3 -2
  49. package/dist/servedHandlers.js.map +1 -1
  50. package/dist/socketAuthentication.d.ts +1 -11
  51. package/dist/socketAuthentication.d.ts.map +1 -1
  52. package/dist/socketAuthentication.js +15 -7
  53. package/dist/socketAuthentication.js.map +1 -1
  54. package/dist/socketProtocol.js +4 -8
  55. package/dist/socketProtocol.js.map +1 -1
  56. package/package.json +6 -6
  57. package/src/AutomaticQueryOptions.ts +1 -1
  58. package/src/{bind.ts → Bound.ts} +0 -46
  59. package/src/ClientOptions.ts +2 -2
  60. package/src/automaticLive.ts +9 -10
  61. package/src/automaticQuery.ts +2 -2
  62. package/src/clientActivities.ts +1 -2
  63. package/src/clientOperations.ts +5 -4
  64. package/src/makeClient.ts +4 -4
  65. package/src/queryDelivery.ts +2 -2
  66. package/src/reflectCommand.ts +7 -18
  67. package/src/reflectedStream.ts +5 -5
  68. package/src/reflection.ts +5 -0
  69. package/src/rpcClient.ts +2 -3
  70. package/src/servedHandlers.ts +5 -4
  71. package/src/socketAuthentication.ts +22 -7
  72. package/src/socketProtocol.ts +5 -10
  73. package/dist/bind.d.ts.map +0 -1
  74. package/dist/bind.js +0 -11
  75. package/dist/bind.js.map +0 -1
@@ -51,7 +51,7 @@ export function automaticQuery<A, E>({
51
51
  get.set(signals, recordSubscription(get.once(signals), value));
52
52
  dispatcher.scheduleTask(() => {
53
53
  if (active) {
54
- for (const state of clientStatuses === undefined ? [statuses] : [statuses, clientStatuses]) {
54
+ for (const state of [statuses, clientStatuses]) {
55
55
  registry.update(state, (current) => new Map([...current, [token, value]]));
56
56
  }
57
57
  }
@@ -63,7 +63,7 @@ export function automaticQuery<A, E>({
63
63
  }
64
64
  get.addFinalizer(() => {
65
65
  active = false;
66
- for (const state of clientStatuses === undefined ? [statuses] : [statuses, clientStatuses]) {
66
+ for (const state of [statuses, clientStatuses]) {
67
67
  if (registry.getNodes().has(state)) {
68
68
  registry.update(state, (current) => {
69
69
  const next = new Map(current);
@@ -6,8 +6,7 @@ import { clientConnection } from "#adapters/clientConnection.ts";
6
6
  import { querySignals, shareQuerySignals } from "#querySignals.ts";
7
7
  import { wrapAtom } from "#wrapAtom.ts";
8
8
 
9
- type ActivityTracker = ReturnType<typeof makeActivity>;
10
- export const clientActivities = new WeakMap<object, ActivityTracker>();
9
+ export type ActivityTracker = ReturnType<typeof makeActivity>;
11
10
 
12
11
  export function makeActivity(factory: Atom.RuntimeFactory) {
13
12
  const { activity, change, excuse, hold, rendered, setConnection } = activityState();
@@ -7,8 +7,8 @@ import type { Rpc } from "effect/rpc";
7
7
  import type { BindingOwner } from "#adapters/bindingOwner.ts";
8
8
  import { streamingClient, unaryClient } from "#adapters/erasedClient.ts";
9
9
  import type { automaticLive } from "#automaticLive.ts";
10
- import type { QueryOptions, RunOptions } from "#bind.ts";
11
- import { clientActivities } from "#clientActivities.ts";
10
+ import type { QueryOptions, RunOptions } from "#Bound.ts";
11
+ import type { ActivityTracker } from "#clientActivities.ts";
12
12
  import { commandPayload } from "#commandPayload.ts";
13
13
  import { COMMAND_REFLECTED } from "#commandReflected.ts";
14
14
  import { CommandSignal, untilReflected } from "#commandSignal.ts";
@@ -28,6 +28,7 @@ function runSubject(options: unknown): string | undefined {
28
28
 
29
29
  export function clientOperations(
30
30
  service: AtomRpc.AtomRpcClient<unknown, string, Rpc.Any>,
31
+ activity: ActivityTracker,
31
32
  automatic: ReturnType<typeof automaticLive>,
32
33
  owner?: BindingOwner,
33
34
  ) {
@@ -42,7 +43,7 @@ export function clientOperations(
42
43
  const reactivity = yield* Reactivity.Reactivity;
43
44
  return yield* Effect.sync(
44
45
  (): CommandObserver => ({
45
- pending: () => clientActivities.get(ordinaryClient)?.reflecting() ?? (() => undefined),
46
+ pending: activity.reflecting,
46
47
  signal: (state) => {
47
48
  signal(state);
48
49
  if (state === "reflected") {
@@ -79,7 +80,7 @@ export function clientOperations(
79
80
  function warm(get: Atom.AtomContext): boolean {
80
81
  return get.once(warmQueries).has(tracked);
81
82
  }
82
- const watched = clientActivities.get(ordinaryClient)?.watch(result, warm) ?? result;
83
+ const watched = activity.watch(result, warm);
83
84
  const tracked = retainQuery(ordinaryClient.runtime, watched, stored(payload, inputSubject(headers)));
84
85
  cached.set(atom, tracked);
85
86
  return tracked;
package/src/makeClient.ts CHANGED
@@ -6,7 +6,7 @@ import type { Rpc, RpcClient, RpcGroup } from "effect/rpc";
6
6
  import type { RpcClientError } from "effect/rpc/RpcClientError";
7
7
  import { bindingOwner } from "#adapters/bindingOwner.ts";
8
8
  import { automaticLive, type LiveBound } from "#automaticLive.ts";
9
- import type { Bound } from "#bind.ts";
9
+ import type { Bound } from "#Bound.ts";
10
10
  import { bindOperations } from "#bindOperations.ts";
11
11
  import type { ClientOptions } from "#ClientOptions.ts";
12
12
  import type { ActiveClient } from "#clientActivity.ts";
@@ -64,12 +64,12 @@ export function makeClient(contracts: Contracts, options: ClientOptions = {}): L
64
64
  annotations: Context.mergeAll(...list.map((contract) => contract.annotations)),
65
65
  requests: new Map(list.flatMap((contract) => [...contract.requests])),
66
66
  };
67
- const connection = rpcClient("@shivaedev/contract/Contracts", source, options);
67
+ const { activity, connection } = rpcClient("@shivaedev/contract/Contracts", source, options);
68
68
  const { registry, resume, resumeWindow } = options;
69
69
  const bound = Object.entries(contracts).map(([key, { declaration }]) => {
70
70
  const owner = bindingOwner(declaration.keyScope, registry);
71
- const automatic = automaticLive(connection.Client, declaration.name, owner, resume, resumeWindow);
72
- const operations = clientOperations(connection.Client, automatic, owner);
71
+ const automatic = automaticLive(connection.Client, activity, declaration.name, owner, resume, resumeWindow);
72
+ const operations = clientOperations(connection.Client, activity, automatic, owner);
73
73
  return { api: [key, bindOperations(declaration, operations, automatic.subscription)] as const, owner, sync: operations.sync };
74
74
  });
75
75
  // A sync runs through the session's registry when the record holds a session-scoped contract, as that contract's own calls do.
@@ -19,7 +19,7 @@ export function queryDelivery<A, E>(decode: (value: unknown) => A, paused: Atom.
19
19
  const pushed = Atom.make<AsyncResult.AsyncResult<A, E>>(AsyncResult.initial(true));
20
20
  const deliver = Effect.fnUntraced(function* (
21
21
  update: QueryUpdate,
22
- follower: ReflectionFollower | undefined,
22
+ follower: ReflectionFollower,
23
23
  ): Effect.fn.Return<SubscriptionEvent | undefined, never, AtomRegistry.AtomRegistry> {
24
24
  const registry = yield* AtomRegistry.AtomRegistry;
25
25
  const showing = !registry.get(paused);
@@ -47,7 +47,7 @@ export function queryDelivery<A, E>(decode: (value: unknown) => A, paused: Atom.
47
47
  });
48
48
  return {
49
49
  atom: pushed,
50
- stream: <TError, R>(stream: Stream.Stream<QueryUpdate, TError, R>, follower?: ReflectionFollower) =>
50
+ stream: <TError, R>(stream: Stream.Stream<QueryUpdate, TError, R>, follower: ReflectionFollower) =>
51
51
  stream.pipe(
52
52
  Stream.mapEffect((update) => deliver(update, follower)),
53
53
  Stream.filter((event) => event !== undefined),
@@ -1,6 +1,6 @@
1
1
  import { Effect, Exit } from "effect";
2
2
  import type { CommandState } from "#commandSignal.ts";
3
- import { reflections } from "#reflection.ts";
3
+ import { reflectionScope } from "#reflection.ts";
4
4
  import { commandSyncHeaders } from "#syncHeader.ts";
5
5
 
6
6
  export interface CommandObserver {
@@ -14,34 +14,23 @@ export function reflectCommand<A, E, R>(
14
14
  send: (options?: { readonly headers: Record<string, string> }) => Effect.Effect<A, E, R>,
15
15
  standalone = false,
16
16
  ): Effect.Effect<A, E, R> {
17
- return Effect.suspend(() => {
18
- const scope = reflections.get(client);
19
- const reflection = scope?.reflection;
20
- let own: number | undefined;
21
- if (scope !== undefined) {
22
- own = standalone ? scope.reflection.flight() : scope.reflection.send(scope.piggyback);
23
- }
17
+ return Effect.flatMap(reflectionScope(client), ({ piggyback, reflection }) => {
18
+ const own = standalone ? reflection.flight() : reflection.send(piggyback);
24
19
  const finish = observer.pending();
25
20
  observer.signal("sent");
26
- const sent =
27
- reflection === undefined || own === undefined ? send() : send({ headers: commandSyncHeaders({ client: reflection.client, id: own }) });
21
+ const sent = own === undefined ? send() : send({ headers: commandSyncHeaders({ client: reflection.client, id: own }) });
28
22
  return Effect.onExit(sent, (exit) =>
29
23
  Effect.sync(() => {
30
24
  if (Exit.isFailure(exit)) {
31
- reflection?.failed(own);
25
+ reflection.failed(own);
32
26
  finish();
33
27
  return;
34
28
  }
35
29
  observer.signal("accepted");
36
- function reflected() {
30
+ reflection.accepted(own, () => {
37
31
  finish();
38
32
  observer.signal("reflected");
39
- }
40
- if (reflection === undefined) {
41
- reflected();
42
- } else {
43
- reflection.accepted(own, reflected);
44
- }
33
+ });
45
34
  }),
46
35
  );
47
36
  });
@@ -1,7 +1,7 @@
1
1
  import { Effect, Exit, Stream } from "effect";
2
2
  import { Headers } from "effect/http";
3
3
  import { retriesLive } from "#liveRetry.ts";
4
- import { type FollowedStream, type Reflection, reflections } from "#reflection.ts";
4
+ import { type FollowedStream, type Reflection, reflectionScope } from "#reflection.ts";
5
5
  import { streamSyncHeaders } from "#syncHeader.ts";
6
6
 
7
7
  export interface StreamAnchor extends FollowedStream {
@@ -17,10 +17,10 @@ export interface ReflectionFollower {
17
17
 
18
18
  // A mounted query keeps one place in its connection's waits across attempts; it leaves only when it unmounts or stops retrying.
19
19
  export function followReflection(client: object, anchor: StreamAnchor) {
20
- const reflection = reflections.get(client)?.reflection;
21
- if (reflection === undefined) {
22
- return undefined;
23
- }
20
+ return Effect.map(reflectionScope(client), ({ reflection }) => follow(reflection, anchor));
21
+ }
22
+
23
+ function follow(reflection: Reflection, anchor: StreamAnchor) {
24
24
  const follower: ReflectionFollower = {
25
25
  armed: () => reflection.armed(anchor),
26
26
  confirmed: (ids) => reflection.confirmed(anchor, ids),
package/src/reflection.ts CHANGED
@@ -110,3 +110,8 @@ export const makeReflection = Effect.flatMap(Queue.sliding<void>(1), (catchUps)
110
110
  export type Reflection = Effect.Success<typeof makeReflection>;
111
111
 
112
112
  export const reflections = new WeakMap<object, { readonly piggyback: boolean; readonly reflection: Reflection }>();
113
+
114
+ export function reflectionScope(client: object) {
115
+ const scope = reflections.get(client);
116
+ return scope === undefined ? Effect.die(new Error("A client made by makeClient carries its connection's reflection")) : Effect.succeed(scope);
117
+ }
package/src/rpcClient.ts CHANGED
@@ -5,7 +5,7 @@ import { type Rpc, RpcClient, RpcGroup } from "effect/rpc";
5
5
  import type { RpcClientError } from "effect/rpc/RpcClientError";
6
6
  import type { ClientOptions } from "#ClientOptions.ts";
7
7
  import { catchUp } from "#catchUp.ts";
8
- import { clientActivities, makeActivity } from "#clientActivities.ts";
8
+ import { makeActivity } from "#clientActivities.ts";
9
9
  import { Activity } from "#clientActivity.ts";
10
10
  import { ConnectionScope, connectionProtocol } from "#connectionProtocol.ts";
11
11
  import { commandConnections } from "#connectionReadiness.ts";
@@ -86,14 +86,13 @@ export function rpcClient(name: string, source: RpcSource, options: ClientOption
86
86
  protocol: typeof options.protocol === "object" ? protocol : (get) => protocolFor(get(socketIdentity)),
87
87
  runtime: options.runtime,
88
88
  });
89
- clientActivities.set(Client, activity);
90
89
  const directClient = withClientProtocol(protocol, make).pipe(
91
90
  Effect.map((flat) =>
92
91
  Object.fromEntries([...group.requests.keys()].map((tag) => [tag, (payload: never, callOptions: never) => flat(tag, payload, callOptions)])),
93
92
  ),
94
93
  );
95
94
  const layer = Layer.effect(Client, make).pipe(Layer.provide(protocol));
96
- return Object.assign(layer, { [Activity]: activity.activity, Client, client: directClient, runtime: Client.runtime });
95
+ return { activity, connection: Object.assign(layer, { [Activity]: activity.activity, Client, client: directClient, runtime: Client.runtime }) };
97
96
  }
98
97
 
99
98
  function pageRpcUrl() {
@@ -1,11 +1,11 @@
1
- import { Effect, Layer, type Schema } from "effect";
1
+ import { Effect, Layer, type Option, type Schema } from "effect";
2
2
  import { Rpc, RpcGroup, RpcSchema } from "effect/rpc";
3
3
  import { ReadRecorder } from "@shivaedev/changes/readRecorder.ts";
4
4
  import { rpcBoundary } from "@shivaedev/errors/boundary.ts";
5
5
  import { InternalServerError } from "@shivaedev/errors/taxonomy.ts";
6
6
  import type { Declared } from "#contract.ts";
7
7
  import type { CommandShape, QueryShape, StreamShape } from "#operation.ts";
8
- import { CurrentViewer, checkPolicy, type QueryReadPolicy } from "#readPolicy.ts";
8
+ import { CurrentViewer, checkPolicy, type QueryReadPolicy, type Viewer } from "#readPolicy.ts";
9
9
  import { ServedReadPolicy } from "#servedReadPolicy.ts";
10
10
 
11
11
  type Runnable = (payload: unknown) => Effect.Effect<unknown, unknown, unknown>;
@@ -36,10 +36,11 @@ function served(rpc: Rpc.AnyWithProps, operation: QueryShape | CommandShape, run
36
36
  }).pipe(Effect.withSpan(span), boundary);
37
37
  }
38
38
 
39
- // Live subscriptions check the policy outside the handler, so the policy carries the handler's failure mapping.
39
+ // Live subscriptions check the policy outside the handler, so the policy carries the handler's failure mapping. It keeps the
40
+ // policy's own properties, such as the mark of a permission policy that collection reads require.
40
41
  function servedPolicy(rpc: Rpc.AnyWithProps, policy: QueryReadPolicy<unknown, unknown, unknown>): QueryReadPolicy<unknown, unknown, unknown> {
41
42
  const boundary = guarded(rpc);
42
- return (payload, viewer) => boundary(Effect.suspend(() => policy(payload, viewer)));
43
+ return Object.assign((payload: unknown, viewer: Option.Option<Viewer>) => boundary(Effect.suspend(() => policy(payload, viewer))), policy);
43
44
  }
44
45
 
45
46
  type EffectRpc = Rpc.Rpc<string, Schema.Top, Schema.Top, Schema.Top>;
@@ -6,23 +6,38 @@ export const SocketAuthentication = Schema.Struct({
6
6
  token: Schema.String.check(Schema.isPattern(/^[\x21-\x7e]+$/u)),
7
7
  });
8
8
 
9
- export const authenticateSocket = Effect.fnUntraced(function* (token: string) {
10
- const socket = yield* Socket.Socket;
9
+ // Each connection reads the credential once, so a reconnect sends the one stored now and asks for a frame only when one follows.
10
+ export const authenticateSocket = Effect.fnUntraced(function* (
11
+ url: string,
12
+ credential: Effect.Effect<string | null>,
13
+ headers?: Readonly<Record<string, string>>,
14
+ ) {
15
+ const framed = new URL(url);
16
+ framed.searchParams.set("auth", "frame");
17
+ let token: string | null = null;
18
+ const socket = yield* Socket.makeWebSocket(
19
+ Effect.map(credential, (current) => {
20
+ token = current;
21
+ return current === null ? url : framed.toString();
22
+ }),
23
+ { headers },
24
+ );
11
25
  const ready = yield* Latch.make(false);
12
26
  const writer = yield* Effect.map(socket.writer, (nativeWriter) => ({
13
27
  write: (chunk: Parameters<typeof nativeWriter.write>[0]) => ready.await.pipe(Effect.andThen(nativeWriter.write(chunk))),
14
28
  writeAll: (chunks: Parameters<typeof nativeWriter.writeAll>[0]) => ready.await.pipe(Effect.andThen(nativeWriter.writeAll(chunks))),
15
29
  }));
16
- return {
17
- ...socket,
30
+ return Socket.make({
18
31
  reader: Effect.gen(function* () {
19
32
  yield* ready.close;
20
33
  const reader = yield* socket.reader;
21
- const raw = yield* socket.writer;
22
- yield* raw.write(JSON.stringify({ _tag: "Authenticate", token }));
34
+ if (token !== null) {
35
+ const raw = yield* socket.writer;
36
+ yield* raw.write(JSON.stringify({ _tag: "Authenticate", token }));
37
+ }
23
38
  yield* ready.open;
24
39
  return { ...reader, pull: reader.pull.pipe(Effect.onError(() => ready.close)) };
25
40
  }),
26
41
  writer: Effect.succeed(writer),
27
- };
42
+ });
28
43
  });
@@ -35,16 +35,11 @@ export function socketProtocol(options: SocketOptions) {
35
35
 
36
36
  const protocols = Atom.family(
37
37
  (options: Omit<SocketOptions, "resumeWindow"> & { readonly resumeWindow: { readonly target: ResumeWindow } | undefined }) => {
38
- let url = options.url;
39
- if (options.bearerToken !== undefined) {
40
- const address = new URL(url);
41
- address.searchParams.set("auth", "frame");
42
- url = address.toString();
43
- }
44
- const raw = Socket.layerWebSocket(url, { headers: options.headers });
45
- const authenticated = (
46
- options.bearerToken === undefined ? raw : Layer.effect(Socket.Socket, authenticateSocket(options.bearerToken)).pipe(Layer.provide(raw))
47
- ).pipe(Layer.provide(options.webSocketConstructor ?? Socket.layerWebSocketConstructorGlobal));
38
+ const opened =
39
+ options.bearerToken === undefined
40
+ ? Socket.layerWebSocket(options.url, { headers: options.headers })
41
+ : Layer.effect(Socket.Socket, authenticateSocket(options.url, options.bearerToken, options.headers));
42
+ const authenticated = opened.pipe(Layer.provide(options.webSocketConstructor ?? Socket.layerWebSocketConstructorGlobal));
48
43
  const socket = Layer.effect(
49
44
  Socket.Socket,
50
45
  resumeSocket({
@@ -1 +0,0 @@
1
- {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../src/bind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,YAAY,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGlE,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KA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bindingOwner.ts";
2
- import { automaticLive } from "#automaticLive.ts";
3
- import { bindOperations } from "#bindOperations.ts";
4
- import { clientOperations } from "#clientOperations.ts";
5
- export function bind(contract, service, options) {
6
- const { name, keyScope } = contract.declaration;
7
- const owner = bindingOwner(keyScope, options?.registry);
8
- const automatic = automaticLive(service, name, owner, options?.resume, options?.resumeWindow);
9
- return bindOperations(contract.declaration, clientOperations(service, automatic, owner), automatic.subscription);
10
- }
11
- //# sourceMappingURL=bind.js.map
package/dist/bind.js.map DELETED
@@ -1 +0,0 @@
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,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA2FxD,MAAM,UAAU,IAAI,CACnB,QAAmJ,EACnJ,OAAwD,EACxD,OAAqB;IAErB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC;IAChD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9F,OAAO,cAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;AAClH,CAAC"}