@shivaedev/contract 0.42.0 → 0.43.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.
Files changed (177) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +27 -177
  3. package/dist/AutomaticQueryOptions.d.ts +0 -5
  4. package/dist/AutomaticQueryOptions.d.ts.map +1 -1
  5. package/dist/HostVersion.d.ts +1 -19
  6. package/dist/HostVersion.d.ts.map +1 -1
  7. package/dist/adapters/activityState.d.ts.map +1 -1
  8. package/dist/adapters/activityState.js +0 -1
  9. package/dist/adapters/activityState.js.map +1 -1
  10. package/dist/adapters/bindingOwner.d.ts.map +1 -1
  11. package/dist/adapters/bindingOwner.js +1 -1
  12. package/dist/adapters/bindingOwner.js.map +1 -1
  13. package/dist/adapters/liveHintStream.d.ts +1 -2
  14. package/dist/adapters/liveHintStream.d.ts.map +1 -1
  15. package/dist/adapters/liveHintStream.js +2 -2
  16. package/dist/adapters/liveHintStream.js.map +1 -1
  17. package/dist/adapters/openLiveHints.d.ts +1 -2
  18. package/dist/adapters/openLiveHints.d.ts.map +1 -1
  19. package/dist/adapters/openLiveHints.js +1 -1
  20. package/dist/adapters/openLiveHints.js.map +1 -1
  21. package/dist/adapters/standaloneLiveServer.d.ts +1 -7
  22. package/dist/adapters/standaloneLiveServer.d.ts.map +1 -1
  23. package/dist/adapters/standaloneLiveServer.js.map +1 -1
  24. package/dist/automaticLive.d.ts +2 -4
  25. package/dist/automaticLive.d.ts.map +1 -1
  26. package/dist/automaticLive.js +5 -14
  27. package/dist/automaticLive.js.map +1 -1
  28. package/dist/automaticQuery.d.ts +1 -1
  29. package/dist/automaticQuery.d.ts.map +1 -1
  30. package/dist/automaticQuery.js +20 -26
  31. package/dist/automaticQuery.js.map +1 -1
  32. package/dist/changesSuccess.d.ts +2 -3
  33. package/dist/changesSuccess.d.ts.map +1 -1
  34. package/dist/changesSuccess.js +1 -3
  35. package/dist/changesSuccess.js.map +1 -1
  36. package/dist/clientActivities.d.ts +0 -2
  37. package/dist/clientActivities.d.ts.map +1 -1
  38. package/dist/clientActivities.js +1 -5
  39. package/dist/clientActivities.js.map +1 -1
  40. package/dist/clientActivity.d.ts +0 -1
  41. package/dist/clientActivity.d.ts.map +1 -1
  42. package/dist/clientActivity.js +1 -1
  43. package/dist/clientActivity.js.map +1 -1
  44. package/dist/clientOperations.d.ts.map +1 -1
  45. package/dist/clientOperations.js +1 -3
  46. package/dist/clientOperations.js.map +1 -1
  47. package/dist/compareQueries.d.ts +2 -19
  48. package/dist/compareQueries.d.ts.map +1 -1
  49. package/dist/compareQueries.js +6 -33
  50. package/dist/compareQueries.js.map +1 -1
  51. package/dist/connectionProtocol.d.ts +1 -1
  52. package/dist/connectionProtocol.d.ts.map +1 -1
  53. package/dist/connectionProtocol.js +1 -1
  54. package/dist/connectionProtocol.js.map +1 -1
  55. package/dist/live-server/layer.js +1 -1
  56. package/dist/live-server/layer.js.map +1 -1
  57. package/dist/live-server/register.d.ts +1 -2
  58. package/dist/live-server/register.d.ts.map +1 -1
  59. package/dist/live-server/resync.d.ts +1 -1
  60. package/dist/live-server/resync.d.ts.map +1 -1
  61. package/dist/live-server/service.d.ts +0 -2
  62. package/dist/live-server/service.d.ts.map +1 -1
  63. package/dist/live-server/service.js +4 -4
  64. package/dist/live-server/service.js.map +1 -1
  65. package/dist/live-server/stream.d.ts +1 -2
  66. package/dist/live-server/stream.d.ts.map +1 -1
  67. package/dist/live-server/subscribe.d.ts +2 -2
  68. package/dist/live-server/subscribe.d.ts.map +1 -1
  69. package/dist/live-server/subscribe.js +1 -1
  70. package/dist/live-server/subscribe.js.map +1 -1
  71. package/dist/live.d.ts +5 -12
  72. package/dist/live.d.ts.map +1 -1
  73. package/dist/live.js +15 -85
  74. package/dist/live.js.map +1 -1
  75. package/dist/liveAttempt.d.ts +3 -6
  76. package/dist/liveAttempt.d.ts.map +1 -1
  77. package/dist/liveAttempt.js +11 -30
  78. package/dist/liveAttempt.js.map +1 -1
  79. package/dist/liveHintQueue.d.ts +0 -1
  80. package/dist/liveHintQueue.d.ts.map +1 -1
  81. package/dist/liveHintQueue.js +9 -12
  82. package/dist/liveHintQueue.js.map +1 -1
  83. package/dist/makeLiveServer.d.ts +1 -5
  84. package/dist/makeLiveServer.d.ts.map +1 -1
  85. package/dist/operation.d.ts +2 -4
  86. package/dist/operation.d.ts.map +1 -1
  87. package/dist/operation.js +0 -1
  88. package/dist/operation.js.map +1 -1
  89. package/dist/operationDeclaration.d.ts +1 -2
  90. package/dist/operationDeclaration.d.ts.map +1 -1
  91. package/dist/operationDeclaration.js.map +1 -1
  92. package/dist/publicConfig.d.ts +6 -21
  93. package/dist/publicConfig.d.ts.map +1 -1
  94. package/dist/queryDelivery.d.ts +4 -5
  95. package/dist/queryDelivery.d.ts.map +1 -1
  96. package/dist/queryDelivery.js +4 -15
  97. package/dist/queryDelivery.js.map +1 -1
  98. package/dist/queryProgress.d.ts.map +1 -1
  99. package/dist/queryProgress.js +1 -4
  100. package/dist/queryProgress.js.map +1 -1
  101. package/dist/querySubscription.d.ts +1 -1
  102. package/dist/querySubscription.d.ts.map +1 -1
  103. package/dist/queryUpdate.d.ts +15 -4
  104. package/dist/queryUpdate.d.ts.map +1 -1
  105. package/dist/queryUpdate.js +7 -1
  106. package/dist/queryUpdate.js.map +1 -1
  107. package/dist/retainQuery.d.ts.map +1 -1
  108. package/dist/retainQuery.js +0 -3
  109. package/dist/retainQuery.js.map +1 -1
  110. package/dist/rpcClient.d.ts.map +1 -1
  111. package/dist/rpcClient.js +4 -4
  112. package/dist/rpcClient.js.map +1 -1
  113. package/dist/socketProtocol.js +1 -1
  114. package/dist/socketProtocol.js.map +1 -1
  115. package/package.json +15 -15
  116. package/src/AutomaticQueryOptions.ts +0 -5
  117. package/src/adapters/activityState.ts +0 -1
  118. package/src/adapters/bindingOwner.ts +1 -1
  119. package/src/adapters/liveHintStream.ts +2 -2
  120. package/src/adapters/openLiveHints.ts +1 -1
  121. package/src/adapters/standaloneLiveServer.ts +1 -5
  122. package/src/automaticLive.ts +4 -16
  123. package/src/automaticQuery.ts +28 -42
  124. package/src/changesSuccess.ts +3 -5
  125. package/src/clientActivities.ts +2 -6
  126. package/src/clientActivity.ts +1 -2
  127. package/src/clientOperations.ts +1 -4
  128. package/src/compareQueries.ts +12 -38
  129. package/src/connectionProtocol.ts +1 -1
  130. package/src/live-server/layer.ts +1 -1
  131. package/src/live-server/register.ts +1 -1
  132. package/src/live-server/resync.ts +1 -1
  133. package/src/live-server/service.ts +4 -4
  134. package/src/live-server/stream.ts +1 -1
  135. package/src/live-server/subscribe.ts +6 -10
  136. package/src/live.ts +19 -97
  137. package/src/liveAttempt.ts +17 -41
  138. package/src/liveHintQueue.ts +9 -12
  139. package/src/operation.ts +3 -17
  140. package/src/operationDeclaration.ts +0 -2
  141. package/src/queryDelivery.ts +6 -26
  142. package/src/queryProgress.ts +1 -4
  143. package/src/querySubscription.ts +1 -1
  144. package/src/queryUpdate.ts +10 -4
  145. package/src/retainQuery.ts +0 -3
  146. package/src/rpcClient.ts +4 -4
  147. package/src/socketProtocol.ts +1 -1
  148. package/dist/liveInvalidation.d.ts +0 -12
  149. package/dist/liveInvalidation.d.ts.map +0 -1
  150. package/dist/liveInvalidation.js +0 -14
  151. package/dist/liveInvalidation.js.map +0 -1
  152. package/dist/livePending.d.ts +0 -7
  153. package/dist/livePending.d.ts.map +0 -1
  154. package/dist/livePending.js +0 -27
  155. package/dist/livePending.js.map +0 -1
  156. package/dist/queryCoalesceWindow.d.ts +0 -4
  157. package/dist/queryCoalesceWindow.d.ts.map +0 -1
  158. package/dist/queryCoalesceWindow.js +0 -11
  159. package/dist/queryCoalesceWindow.js.map +0 -1
  160. package/dist/queryFailure.d.ts +0 -4
  161. package/dist/queryFailure.d.ts.map +0 -1
  162. package/dist/queryFailure.js +0 -12
  163. package/dist/queryFailure.js.map +0 -1
  164. package/dist/queryHints.d.ts +0 -9
  165. package/dist/queryHints.d.ts.map +0 -1
  166. package/dist/queryHints.js +0 -34
  167. package/dist/queryHints.js.map +0 -1
  168. package/dist/queryReactivity.d.ts +0 -5
  169. package/dist/queryReactivity.d.ts.map +0 -1
  170. package/dist/queryReactivity.js +0 -109
  171. package/dist/queryReactivity.js.map +0 -1
  172. package/src/liveInvalidation.ts +0 -21
  173. package/src/livePending.ts +0 -28
  174. package/src/queryCoalesceWindow.ts +0 -13
  175. package/src/queryFailure.ts +0 -13
  176. package/src/queryHints.ts +0 -39
  177. package/src/queryReactivity.ts +0 -127
package/src/live.ts CHANGED
@@ -1,19 +1,15 @@
1
- import { Cause, Duration, Effect, Option, Queue, Schema, type Stream } from "effect";
1
+ import { Cause, Effect, Option, Queue, Schema, type Stream } from "effect";
2
2
  import * as Atom from "effect/reactivity/Atom";
3
- import type * as AtomRegistry from "effect/reactivity/AtomRegistry";
4
- import * as Reactivity from "effect/reactivity/Reactivity";
5
3
  import { Key } from "@shivaedev/changes/keys.ts";
6
- import { clientInvalidationKeys, clientReadKeys, type KeyContext } from "#clientKeys.ts";
4
+ import { clientReadKeys, type KeyContext } from "#clientKeys.ts";
7
5
  import { liveAttempt } from "#liveAttempt.ts";
8
- import { invalidateLive } from "#liveInvalidation.ts";
9
- import { livePending } from "#livePending.ts";
10
6
  import { liveRetry } from "#liveRetry.ts";
11
- import type { SubscriptionHint } from "#queryUpdate.ts";
7
+ import type { SubscriptionEvent } from "#queryUpdate.ts";
12
8
  import type { QueryReadDenied } from "#readPolicyErrors.ts";
13
9
  import { retryOnChange } from "#retryOnChange.ts";
14
10
 
15
11
  export const LiveHint = Schema.Union([
16
- Schema.Struct({ _tag: Schema.Literal("Changed"), keys: Schema.Array(Key), queryIndexes: Schema.optional(Schema.Array(Schema.Number)) }),
12
+ Schema.Struct({ _tag: Schema.Literal("Changed"), keys: Schema.Array(Key) }),
17
13
  Schema.Struct({ _tag: Schema.Literal("Resync") }),
18
14
  ]);
19
15
  export type LiveHint = typeof LiveHint.Type;
@@ -24,127 +20,53 @@ export interface LiveStatus<E> {
24
20
  readonly pending: number;
25
21
  }
26
22
  export interface LiveOptions<E, R> {
27
- readonly coalesceWindow?: Duration.Input;
28
- readonly initialResync?: boolean;
29
23
  readonly keyContext?: KeyContext | undefined;
30
- readonly reopenOnResume?: boolean;
31
24
  readonly resume?: Atom.Atom<unknown>;
32
- readonly resyncKeys: readonly Key[] | ((registry: AtomRegistry.AtomRegistry) => readonly Key[]);
33
- readonly retryDelay?: Duration.Input;
34
- readonly retryKeys?: readonly Key[];
35
- readonly stream: Stream.Stream<SubscriptionHint, E, R>;
25
+ readonly retryDelay?: import("effect").Duration.Input;
26
+ readonly retryKeys?: readonly (typeof Key.Type)[];
27
+ readonly stream: Stream.Stream<SubscriptionEvent, E, R>;
36
28
  }
37
29
 
38
- const MAX_PENDING = 256;
39
-
40
30
  export function live<R, E, TRuntimeError>(runtime: Atom.AtomRuntime<R, TRuntimeError>, options: LiveOptions<E, R>) {
41
- const coalesceWindow = Atom.keepAlive(Atom.make<Duration.Input>(options.coalesceWindow ?? "20 millis"));
42
31
  const paused = Atom.make(false);
43
32
  const status = Atom.make<LiveStatus<E>>({ connection: "connecting", failure: Option.none(), needsResync: true, pending: 0 });
44
33
  const connection = runtime
45
34
  .atom((get) =>
46
35
  Effect.gen(function* () {
47
36
  get.mount(status);
37
+ get.mount(paused);
48
38
  const resumed = yield* Queue.unbounded<void>();
49
- const reactivity = yield* Reactivity.Reactivity;
50
- const retryKeys = options.retryKeys ?? (typeof options.resyncKeys === "function" ? options.resyncKeys(get.registry) : options.resyncKeys);
51
- yield* retryOnChange(status, clientReadKeys(retryKeys, options.keyContext), () => get.refreshSelf());
39
+ yield* retryOnChange(status, clientReadKeys(options.retryKeys ?? [], options.keyContext), () => get.refreshSelf());
52
40
  function update(value: Partial<LiveStatus<E>>) {
53
41
  get.set(status, { ...get.once(status), ...value });
54
42
  }
55
- function flush() {
56
- const queued = pending.take();
57
- if (!get.once(paused)) {
58
- invalidateLive(reactivity, queued, () => active && !get.once(paused));
59
- }
60
- }
61
- const timer = runtime.fn((delay: Duration.Input) => Effect.andThen(Effect.sleep(delay), Effect.sync(flush)));
62
- get.mount(timer);
63
- const pending = livePending(
64
- (window) => get.set(timer, window),
65
- () => get.set(timer, Atom.Interrupt),
66
- );
67
- let active = true;
68
43
  get.addFinalizer(() => {
69
- active = false;
70
- pending.clear();
71
44
  if (get.registry.getNodes().has(status)) {
72
45
  update({ connection: "connecting", failure: Option.none(), needsResync: true, pending: 0 });
73
46
  }
74
47
  });
75
- function changed(changedKeys: readonly Key[]) {
76
- const window = get.once(coalesceWindow);
77
- const keys = clientInvalidationKeys(changedKeys, options.keyContext);
78
- invalidateLive(reactivity, keys, () => active && !get.once(paused), window);
79
- const delay = Duration.toMillis(Duration.fromInputUnsafe(window));
80
- if (delay === 0) {
81
- invalidateLive(reactivity, keys, () => active && !get.once(paused));
82
- return;
83
- }
84
- pending.add(keys, window);
85
- }
86
- function resync() {
87
- if (get.once(status).connection === "failed") {
88
- return;
89
- }
90
- pending.clear();
91
- if (get.once(paused)) {
92
- update({ needsResync: true });
93
- return;
94
- }
95
- const keys = typeof options.resyncKeys === "function" ? options.resyncKeys(get.registry) : options.resyncKeys;
96
- reactivity.invalidateUnsafe(keys.map((key) => clientReadKeys([key], options.keyContext)[0] ?? ""));
97
- update({ needsResync: false, pending: 0 });
98
- }
99
- // A subscription alone does not build the flag, so its first read would otherwise announce a change.
100
- get.once(paused);
101
- get.subscribe(paused, (value) => {
102
- if (!value) {
103
- resync();
104
- }
105
- });
106
- function resume() {
107
- const current = get.once(status).connection;
108
- if (current === "failed") {
109
- return;
110
- }
111
- resync();
112
- if (options.reopenOnResume === true || current === "reconnecting") {
113
- Queue.offerUnsafe(resumed, undefined);
114
- }
115
- }
116
48
  if (options.resume !== undefined) {
117
- // A subscription alone does not initialize a derived signal's dependencies.
118
49
  get.once(options.resume);
119
- get.subscribe(options.resume, resume);
50
+ get.subscribe(options.resume, () => {
51
+ if (!get.once(paused) && get.once(status).connection !== "failed") {
52
+ Queue.offerUnsafe(resumed, undefined);
53
+ }
54
+ });
120
55
  }
121
56
  const attempt = liveAttempt(options.stream, {
122
- changed,
123
- denied: (denial) => {
124
- pending.clear();
125
- update({ connection: "failed", failure: Option.some(Cause.fail(denial)), needsResync: true, pending: 0 });
126
- },
127
- live: () => update({ connection: "live", failure: Option.none() }),
57
+ delivered: () => update({ connection: "live", failure: Option.none(), needsResync: false, pending: 0 }),
58
+ denied: (denial) => update({ connection: "failed", failure: Option.some(Cause.fail(denial)), needsResync: true, pending: 0 }),
128
59
  paused: () => get.once(paused),
129
- queued: () => update({ needsResync: true, pending: Math.min(MAX_PENDING, get.once(status).pending + 1) }),
130
- reconcile: (connected) => {
131
- if (connected || options.initialResync !== false) {
132
- resync();
133
- } else {
134
- update({ needsResync: false });
135
- }
136
- },
60
+ queued: () => update({ connection: "live", needsResync: true, pending: Math.min(256, get.once(status).pending + 1) }),
137
61
  });
138
62
  yield* liveRetry(
139
63
  attempt,
140
- (failure, retry) => {
141
- update({ connection: retry ? "reconnecting" : "failed", failure, needsResync: true });
142
- },
64
+ (failure, retry) => update({ connection: retry ? "reconnecting" : "failed", failure, needsResync: true }),
143
65
  options.retryDelay,
144
66
  resumed,
145
67
  );
146
68
  }),
147
69
  )
148
70
  .pipe(Atom.setIdleTTL(0));
149
- return { coalesceWindow, connection, paused, status };
71
+ return { connection, paused, status };
150
72
  }
@@ -1,52 +1,28 @@
1
1
  import { Effect, Stream } from "effect";
2
- import type { Key } from "@shivaedev/changes/keys.ts";
3
- import type { SubscriptionHint } from "#queryUpdate.ts";
2
+ import type { SubscriptionEvent } from "#queryUpdate.ts";
4
3
  import type { QueryReadDenied } from "#readPolicyErrors.ts";
5
4
 
6
- function deliveredResult(hint: SubscriptionHint): boolean {
7
- return hint._tag === "Changed" && hint.keys.length === 0 && hint.queryIndexes?.length === 0;
8
- }
9
-
10
- function needsRead(hint: SubscriptionHint, connected: boolean): boolean {
11
- return connected && !deliveredResult(hint);
12
- }
13
-
14
5
  export function liveAttempt<E, R>(
15
- stream: Stream.Stream<SubscriptionHint, E, R>,
6
+ stream: Stream.Stream<SubscriptionEvent, E, R>,
16
7
  observe: {
17
- readonly changed: (keys: readonly Key[]) => void;
18
8
  readonly denied: (denial: QueryReadDenied) => void;
19
- readonly live: () => void;
9
+ readonly delivered: () => void;
20
10
  readonly paused: () => boolean;
21
11
  readonly queued: () => void;
22
- readonly reconcile: (connected: boolean) => void;
23
12
  },
24
13
  ) {
25
- let connected = false;
26
- return Effect.suspend(() => {
27
- let first = true;
28
- return stream.pipe(
29
- Stream.runForEach((hint) =>
30
- Effect.sync(() => {
31
- if (hint._tag === "QueryReadDenied") {
32
- observe.denied(hint);
33
- connected = true;
34
- first = true;
35
- return;
36
- }
37
- observe.live();
38
- if (observe.paused()) {
39
- observe.queued();
40
- } else if (first || hint._tag === "Resync" || deliveredResult(hint)) {
41
- observe.reconcile(needsRead(hint, connected));
42
- } else {
43
- observe.changed(hint.keys);
44
- }
45
- connected = true;
46
- first = false;
47
- }),
48
- ),
49
- Effect.scoped,
50
- );
51
- });
14
+ return stream.pipe(
15
+ Stream.runForEach((event) =>
16
+ Effect.sync(() => {
17
+ if (event._tag === "QueryReadDenied") {
18
+ observe.denied(event);
19
+ } else if (observe.paused()) {
20
+ observe.queued();
21
+ } else {
22
+ observe.delivered();
23
+ }
24
+ }),
25
+ ),
26
+ Effect.scoped,
27
+ );
52
28
  }
@@ -2,21 +2,18 @@ import { Effect, Queue } from "effect";
2
2
  import type { LiveHint } from "#live.ts";
3
3
 
4
4
  export const liveHintQueue = Effect.gen(function* () {
5
- const queue = yield* Queue.bounded<LiveHint>(256);
6
- let overflowed = false;
5
+ const queue = yield* Queue.bounded<LiveHint>(1);
6
+ let count = 0;
7
7
  function offer(hint: LiveHint) {
8
- if (overflowed && Queue.sizeUnsafe(queue) > 0) {
8
+ const queued = Queue.takeUnsafe(queue);
9
+ const pending = queued?._tag === "Success" ? queued.value : undefined;
10
+ count = pending === undefined ? 1 : count + 1;
11
+ if (pending?._tag === "Resync" || hint._tag === "Resync" || count > 256) {
12
+ Queue.offerUnsafe(queue, { _tag: "Resync" });
9
13
  return;
10
14
  }
11
- overflowed = false;
12
- if (Queue.offerUnsafe(queue, hint)) {
13
- return;
14
- }
15
- while (Queue.takeUnsafe(queue) !== undefined) {
16
- // Overflow discards targeted hints because the resync covers every subscribed read.
17
- }
18
- overflowed = true;
19
- Queue.offerUnsafe(queue, { _tag: "Resync" });
15
+ const keys = new Map([...(pending?.keys ?? []), ...hint.keys].map((key) => [JSON.stringify(key), key]));
16
+ Queue.offerUnsafe(queue, { _tag: "Changed", keys: [...keys.values()] });
20
17
  }
21
18
  return { offer, queue };
22
19
  });
package/src/operation.ts CHANGED
@@ -25,7 +25,6 @@ export interface OperationShape {
25
25
 
26
26
  export interface QueryShape<E = unknown, R = unknown> extends OperationShape {
27
27
  readonly kind: "query";
28
- readonly live?: "rerun-and-compare" | undefined;
29
28
  readonly readPolicy: Bivariant<QueryReadPolicy<unknown, E, R>>;
30
29
  reads: Bivariant<(payload: unknown, viewer: Option.Option<Viewer>) => readonly Key[]>;
31
30
  readonly readsCollections?: readonly { readonly name: string }[] | undefined;
@@ -53,16 +52,9 @@ interface Operation<TName extends string, TPayload extends Schema.Top, TSuccess
53
52
  readonly success: TSuccess;
54
53
  }
55
54
 
56
- export interface Query<
57
- TName extends string,
58
- TPayload extends Schema.Top,
59
- TSuccess extends Schema.Top,
60
- TSpecs extends RejectionSpecs,
61
- R = never,
62
- TLive extends "rerun-and-compare" | undefined = undefined,
63
- > extends Operation<TName, TPayload, TSuccess, TSpecs> {
55
+ export interface Query<TName extends string, TPayload extends Schema.Top, TSuccess extends Schema.Top, TSpecs extends RejectionSpecs, R = never>
56
+ extends Operation<TName, TPayload, TSuccess, TSpecs> {
64
57
  readonly kind: "query";
65
- readonly live?: TLive;
66
58
  readonly readPolicy: QueryReadPolicy<TPayload["Type"], RejectedBy<TSpecs>, R>;
67
59
  reads: (payload: TPayload["Type"], viewer: Option.Option<Viewer>) => readonly Key[];
68
60
  readonly readsCollections?: readonly { readonly name: string }[] | undefined;
@@ -87,15 +79,10 @@ export function query<
87
79
  TSuccess extends Schema.Top = Schema.Void,
88
80
  const TSpecs extends RejectionSpecs = NoRejections,
89
81
  R = never,
90
- const TLive extends "rerun-and-compare" | undefined = undefined,
91
- >(
92
- name: TName,
93
- declaration: QueryDeclaration<TPayload, TSuccess, TSpecs, R, TLive>,
94
- ): NoInfer<Query<TName, PayloadSchema<TPayload>, TSuccess, TSpecs, R, TLive>>;
82
+ >(name: TName, declaration: QueryDeclaration<TPayload, TSuccess, TSpecs, R>): NoInfer<Query<TName, PayloadSchema<TPayload>, TSuccess, TSpecs, R>>;
95
83
  export function query(
96
84
  name: string,
97
85
  declaration: Loose & {
98
- readonly live?: "rerun-and-compare" | undefined;
99
86
  readonly reads: (payload: unknown, viewer: Option.Option<Viewer>) => readonly Key[];
100
87
  readonly readPolicy: QueryReadPolicy<unknown, unknown, unknown>;
101
88
  readonly readsCollections?: readonly { readonly name: string }[];
@@ -105,7 +92,6 @@ export function query(
105
92
  const collections: readonly Key[] = declaration.readsCollections?.map((collection) => ({ _tag: "List", collection: collection.name })) ?? [];
106
93
  return {
107
94
  ...operation("query", name, declaration),
108
- live: declaration.live,
109
95
  readPolicy: declaration.readPolicy,
110
96
  reads: (payload, viewer) => [...declaration.reads(payload, viewer), ...collections],
111
97
  readsCollections: declaration.readsCollections,
@@ -17,10 +17,8 @@ export type QueryDeclaration<
17
17
  TSuccess extends Schema.Top,
18
18
  TSpecs extends RejectionSpecs,
19
19
  R,
20
- TLive extends "rerun-and-compare" | undefined,
21
20
  > = Declaration<TPayload, TSuccess, TSpecs> &
22
21
  CollectionReads<PayloadSchema<TPayload>["Type"], NoInfer<RejectedBy<TSpecs>>, R> & {
23
- readonly live?: TLive;
24
22
  readonly reads: (payload: PayloadSchema<TPayload>["Type"], viewer: Option.Option<Viewer>) => readonly Key[];
25
23
  readonly serverReads?: QueryServerReads<PayloadSchema<TPayload>["Type"], NoInfer<RejectedBy<TSpecs>>, R>;
26
24
  };
@@ -3,51 +3,31 @@ import * as AsyncResult from "effect/reactivity/AsyncResult";
3
3
  import * as Atom from "effect/reactivity/Atom";
4
4
  import * as AtomRegistry from "effect/reactivity/AtomRegistry";
5
5
  import type { QuerySignals } from "#querySignals.ts";
6
- import type { QueryUpdate, SubscriptionHint } from "#queryUpdate.ts";
6
+ import type { QueryUpdate, SubscriptionEvent } from "#queryUpdate.ts";
7
7
 
8
- export function queryDelivery<A, E>(
9
- atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>,
10
- decode: (value: unknown) => A,
11
- compared: boolean,
12
- paused: Atom.Atom<boolean>,
13
- signals: Atom.Writable<QuerySignals>,
14
- ) {
15
- const version = Atom.make(0);
8
+ export function queryDelivery<A, E>(decode: (value: unknown) => A, paused: Atom.Atom<boolean>, signals: Atom.Writable<QuerySignals>) {
16
9
  const updates = Atom.make(0);
17
10
  const pushed = Atom.make<AsyncResult.AsyncResult<A, E>>(AsyncResult.initial());
18
- const deliver = Effect.fnUntraced(function* (update: QueryUpdate): Effect.fn.Return<SubscriptionHint, never, AtomRegistry.AtomRegistry> {
11
+ const deliver = Effect.fnUntraced(function* (update: QueryUpdate): Effect.fn.Return<SubscriptionEvent, never, AtomRegistry.AtomRegistry> {
19
12
  const registry = yield* AtomRegistry.AtomRegistry;
20
13
  registry.update(updates, (current) => current + 1);
21
14
  if (update._tag === "Unchanged") {
22
15
  if (!registry.get(paused)) {
23
16
  registry.update(signals, (current) => ({ ...current, completed: current.completed + 1, pending: false }));
24
17
  }
25
- return { _tag: "Changed", keys: [], queryIndexes: [] };
18
+ return { _tag: "Delivered" };
26
19
  }
27
20
  if (update._tag !== "Result") {
28
21
  return update;
29
22
  }
30
23
  if (!registry.get(paused)) {
31
24
  registry.set(pushed, AsyncResult.success(decode(update.value)));
32
- registry.update(version, (current) => current + 1);
33
25
  }
34
- return { _tag: "Changed", keys: [], queryIndexes: [] };
26
+ return { _tag: "Delivered" };
35
27
  });
36
28
  return {
37
- atom: compared
38
- ? pushed
39
- : Atom.readable(
40
- (get) => {
41
- const initial = get(pushed);
42
- return AsyncResult.isInitial(initial) ? get(atom) : initial;
43
- },
44
- (refresh) => {
45
- refresh(atom);
46
- refresh(pushed);
47
- },
48
- ),
29
+ atom: pushed,
49
30
  stream: <TError, R>(stream: Stream.Stream<QueryUpdate, TError, R>) => Stream.mapEffect(stream, deliver),
50
31
  updates,
51
- version,
52
32
  };
53
33
  }
@@ -1,16 +1,13 @@
1
1
  import * as AsyncResult from "effect/reactivity/AsyncResult";
2
2
  import type * as Atom from "effect/reactivity/Atom";
3
3
  import type { LiveStatus } from "#live.ts";
4
- import { queryCoalesceWindow } from "#queryCoalesceWindow.ts";
5
4
  import { type QuerySignals, querySignals, shareQuerySignals } from "#querySignals.ts";
6
- import { wrapAtom } from "./wrapAtom.ts";
5
+ import { wrapAtom } from "#wrapAtom.ts";
7
6
 
8
7
  export function queryProgress<A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>) {
9
8
  const signals = querySignals(atom);
10
9
  const tracked = wrapAtom(atom, (get) => {
11
10
  get.mount(signals);
12
- get.once(queryCoalesceWindow(tracked));
13
- get.subscribe(queryCoalesceWindow(tracked), (duration) => get.set(queryCoalesceWindow(atom), duration), { immediate: true });
14
11
  let published = false;
15
12
  function publish(result: AsyncResult.AsyncResult<A, E>) {
16
13
  published = true;
@@ -12,7 +12,7 @@ export type QueryRerun<E = unknown, R = never> = (request: QueryRequest) => Effe
12
12
  export interface QuerySubscription<E = never, R = never> {
13
13
  readonly authorized: Effect.Effect<boolean, E, R>;
14
14
  readonly keys: readonly Key[];
15
- readonly queries?: readonly QueryRequest[];
15
+ readonly queries: readonly QueryRequest[];
16
16
  readonly readScopes?: Effect.Effect<readonly (readonly Key[])[], E, R>;
17
17
  readonly refresh?: Effect.Effect<Context.Context<never>, E, R>;
18
18
  readonly scopes: readonly (readonly Key[])[];
@@ -1,5 +1,5 @@
1
- import type { LiveHint } from "#live.ts";
2
- import type { QueryReadDenied } from "#readPolicyErrors.ts";
1
+ import { Schema } from "effect";
2
+ import { QueryReadDenied } from "#readPolicyErrors.ts";
3
3
 
4
4
  export interface QueryResult {
5
5
  readonly _tag: "Result";
@@ -11,5 +11,11 @@ export interface QueryUnchanged {
11
11
  readonly _tag: "Unchanged";
12
12
  readonly queryIndex: number;
13
13
  }
14
- export type SubscriptionHint = LiveHint | QueryReadDenied;
15
- export type QueryUpdate = SubscriptionHint | QueryResult | QueryUnchanged;
14
+ export type SubscriptionEvent = { readonly _tag: "Delivered" } | QueryReadDenied;
15
+ export type QueryUpdate = QueryReadDenied | QueryResult | QueryUnchanged;
16
+
17
+ export const QueryUpdate = Schema.Union([
18
+ Schema.Struct({ _tag: Schema.Literal("Result"), query: Schema.String, queryIndex: Schema.Number, value: Schema.Unknown }),
19
+ Schema.Struct({ _tag: Schema.Literal("Unchanged"), queryIndex: Schema.Number }),
20
+ QueryReadDenied,
21
+ ]);
@@ -2,7 +2,6 @@ import { Option } from "effect";
2
2
  import * as AsyncResult from "effect/reactivity/AsyncResult";
3
3
  import * as Atom from "effect/reactivity/Atom";
4
4
  import { retainedQueries } from "#adapters/retainedQueries.ts";
5
- import { queryCoalesceWindow } from "#queryCoalesceWindow.ts";
6
5
  import { querySignals, shareQuerySignals } from "#querySignals.ts";
7
6
  import { wrapAtom } from "#wrapAtom.ts";
8
7
 
@@ -13,8 +12,6 @@ export function retainQuery<A, E>(runtime: Atom.AtomRuntime<unknown, unknown>, a
13
12
  get.mount(snapshot);
14
13
  const owner = get.once(retainedQueries);
15
14
  owner.take(retained);
16
- get.once(queryCoalesceWindow(retained));
17
- get.subscribe(queryCoalesceWindow(retained), (value) => get.set(queryCoalesceWindow(atom), value), { immediate: true });
18
15
  get.addFinalizer(() => {
19
16
  if (get.registry.getNodes().has(snapshot) && Option.isSome(get.registry.get(snapshot))) {
20
17
  owner.keep(retained, snapshot, runtime);
package/src/rpcClient.ts CHANGED
@@ -4,14 +4,14 @@ import * as AtomRpc from "effect/reactivity/AtomRpc";
4
4
  import { type Rpc, RpcClient, RpcGroup } from "effect/rpc";
5
5
  import type { RpcClientError } from "effect/rpc/RpcClientError";
6
6
  import { withClientProtocol } from "#adapters/withClientProtocol.ts";
7
+ import { clientActivities, makeActivity } from "#clientActivities.ts";
7
8
  import { Activity } from "#clientActivity.ts";
8
9
  import type { ClientOptions } from "#clientOptions.ts";
10
+ import { connectionProtocol, protocolConnections } from "#connectionProtocol.ts";
11
+ import { commandConnections } from "#connectionReadiness.ts";
9
12
  import type { ResumeWindow } from "#resume.ts";
10
13
  import { CommandInvalidation } from "#serverMetadata.ts";
11
- import { clientActivities, makeActivity } from "./clientActivities.ts";
12
- import { connectionProtocol, protocolConnections } from "./connectionProtocol.ts";
13
- import { commandConnections } from "./connectionReadiness.ts";
14
- import { socketProtocol } from "./socketProtocol.ts";
14
+ import { socketProtocol } from "#socketProtocol.ts";
15
15
 
16
16
  declare const window: ResumeWindow | undefined;
17
17
 
@@ -4,10 +4,10 @@ import { RpcClient, RpcSerialization } from "effect/rpc";
4
4
  import * as Socket from "effect/socket/Socket";
5
5
  import { resumeSocket } from "#adapters/resumeSocket.ts";
6
6
  import type { ClientOptions } from "#clientOptions.ts";
7
+ import { connectionProtocol } from "#connectionProtocol.ts";
7
8
  import type { ResumeWindow } from "#resume.ts";
8
9
  import { SocketClock } from "#SocketClock.ts";
9
10
  import { authenticateSocket } from "#socketAuthentication.ts";
10
- import { connectionProtocol } from "./connectionProtocol.ts";
11
11
 
12
12
  interface SocketOptions {
13
13
  readonly bearerToken: ClientOptions["bearerToken"];
@@ -1,12 +0,0 @@
1
- import type { Duration } from "effect";
2
- import type * as Reactivity from "effect/reactivity/Reactivity";
3
- interface Batch {
4
- readonly active: () => boolean;
5
- readonly seen: Set<() => void>;
6
- readonly window: Duration.Input | undefined;
7
- }
8
- export declare const liveBatches: WeakMap<Reactivity.Reactivity, Batch>;
9
- export declare function liveKeys(keys: readonly string[]): string[];
10
- export declare function invalidateLive(reactivity: Reactivity.Reactivity, keys: readonly string[], active: () => boolean, window?: Duration.Input): void;
11
- export {};
12
- //# sourceMappingURL=liveInvalidation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"liveInvalidation.d.ts","sourceRoot":"","sources":["../src/liveInvalidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAEhE,UAAU,KAAK;IACd,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;CAC5C;AACD,eAAO,MAAM,WAAW,uCAA8C,CAAC;AACvE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,YAE/C;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,KAAK,QAOxI"}
@@ -1,14 +0,0 @@
1
- export const liveBatches = new WeakMap();
2
- export function liveKeys(keys) {
3
- return keys.map((key) => `@shivaedev/live:${key}`);
4
- }
5
- export function invalidateLive(reactivity, keys, active, window) {
6
- liveBatches.set(reactivity, { active, seen: new Set(), window });
7
- try {
8
- reactivity.invalidateUnsafe(window === undefined ? keys : liveKeys(keys));
9
- }
10
- finally {
11
- liveBatches.delete(reactivity);
12
- }
13
- }
14
- //# sourceMappingURL=liveInvalidation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"liveInvalidation.js","sourceRoot":"","sources":["../src/liveInvalidation.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,EAAgC,CAAC;AACvE,MAAM,UAAU,QAAQ,CAAC,IAAuB;IAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAiC,EAAE,IAAuB,EAAE,MAAqB,EAAE,MAAuB;IACxI,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,IAAI,CAAC;QACJ,UAAU,CAAC,gBAAgB,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;YAAS,CAAC;QACV,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;AACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { Duration } from "effect";
2
- export declare function livePending(start: (window: Duration.Input) => void, stop: () => void): {
3
- add(keys: readonly string[], window: Duration.Input): void;
4
- clear(): void;
5
- take(): string[];
6
- };
7
- //# sourceMappingURL=livePending.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"livePending.d.ts","sourceRoot":"","sources":["../src/livePending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,wBAAgB,WAAW,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI;IAInF,GAAG,OAAO,SAAS,MAAM,EAAE,UAAU,QAAQ,CAAC,KAAK;IASnD,KAAK;IAKL,IAAI;EAOL"}
@@ -1,27 +0,0 @@
1
- export function livePending(start, stop) {
2
- const pending = new Set();
3
- let scheduled = false;
4
- return {
5
- add(keys, window) {
6
- for (const key of keys) {
7
- pending.add(key);
8
- }
9
- if (!scheduled) {
10
- scheduled = true;
11
- start(window);
12
- }
13
- },
14
- clear() {
15
- stop();
16
- scheduled = false;
17
- pending.clear();
18
- },
19
- take() {
20
- const queued = [...pending];
21
- scheduled = false;
22
- pending.clear();
23
- return queued;
24
- },
25
- };
26
- }
27
- //# sourceMappingURL=livePending.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"livePending.js","sourceRoot":"","sources":["../src/livePending.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,KAAuC,EAAE,IAAgB;IACpF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO;QACN,GAAG,CAAC,IAAuB,EAAE,MAAsB;YAClD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC;YACD,IAAI,CAAC,SAAS,EAAE,CAAC;gBAChB,SAAS,GAAG,IAAI,CAAC;gBACjB,KAAK,CAAC,MAAM,CAAC,CAAC;YACf,CAAC;QACF,CAAC;QACD,KAAK;YACJ,IAAI,EAAE,CAAC;YACP,SAAS,GAAG,KAAK,CAAC;YAClB,OAAO,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;QACD,IAAI;YACH,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;YAC5B,SAAS,GAAG,KAAK,CAAC;YAClB,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,MAAM,CAAC;QACf,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Duration } from "effect";
2
- import * as Atom from "effect/reactivity/Atom";
3
- export declare function queryCoalesceWindow<A>(query: Atom.Atom<A>): Atom.Writable<Duration.Input | undefined>;
4
- //# sourceMappingURL=queryCoalesceWindow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryCoalesceWindow.d.ts","sourceRoot":"","sources":["../src/queryCoalesceWindow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAI/C,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,CAOrG"}
@@ -1,11 +0,0 @@
1
- import * as Atom from "effect/reactivity/Atom";
2
- const windows = new WeakMap();
3
- export function queryCoalesceWindow(query) {
4
- let window = windows.get(query);
5
- if (window === undefined) {
6
- window = Atom.keepAlive(Atom.make(undefined));
7
- windows.set(query, window);
8
- }
9
- return window;
10
- }
11
- //# sourceMappingURL=queryCoalesceWindow.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryCoalesceWindow.js","sourceRoot":"","sources":["../src/queryCoalesceWindow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAiE,CAAC;AAE7F,MAAM,UAAU,mBAAmB,CAAI,KAAmB;IACzD,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAA6B,SAAS,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type Cause } from "effect";
2
- import type { LiveStatus } from "#live.ts";
3
- export declare function queryFailure(started: () => boolean, publish: (cause: Cause.Cause<unknown>) => void): ({ connection, failure }: LiveStatus<unknown>) => void;
4
- //# sourceMappingURL=queryFailure.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryFailure.d.ts","sourceRoot":"","sources":["../src/queryFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAU,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,OAAO,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,6BACjE,UAAU,CAAC,OAAO,CAAC,UAQpD"}
@@ -1,12 +0,0 @@
1
- import { Option } from "effect";
2
- export function queryFailure(started, publish) {
3
- return ({ connection, failure }) => {
4
- if (Option.isNone(failure)) {
5
- return;
6
- }
7
- if (!started() || connection === "failed") {
8
- publish(failure.value);
9
- }
10
- };
11
- }
12
- //# sourceMappingURL=queryFailure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryFailure.js","sourceRoot":"","sources":["../src/queryFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG5C,MAAM,UAAU,YAAY,CAAC,OAAsB,EAAE,OAA8C;IAClG,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,EAAuB,EAAE,EAAE;QACvD,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO;QACR,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC3C,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACF,CAAC,CAAC;AACH,CAAC"}
@@ -1,9 +0,0 @@
1
- import { type Key } from "@shivaedev/changes/keys.ts";
2
- import type { LiveHint } from "#live.ts";
3
- import type { SubscriptionHint } from "#queryUpdate.ts";
4
- export declare function localQueryKeys(keys: readonly Key[]): Key[];
5
- export declare function queryHint(hint: SubscriptionHint, tracked: readonly {
6
- readonly keys: readonly Key[];
7
- }[]): SubscriptionHint;
8
- export declare function changedHint(keys: readonly Key[], scopes?: readonly (readonly Key[])[]): LiveHint;
9
- //# sourceMappingURL=queryHints.d.ts.map