@procedures/client 0.35.0 → 0.36.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 +67 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/http/server/handler.d.ts.map +1 -1
- package/dist/adapters/http/server/handler.js +17 -3
- package/dist/adapters/http/server/handler.js.map +1 -1
- package/dist/adapters/port/transport.d.ts.map +1 -1
- package/dist/adapters/port/transport.js +2 -0
- package/dist/adapters/port/transport.js.map +1 -1
- package/dist/adapters/websocket/server/transport.d.ts.map +1 -1
- package/dist/adapters/websocket/server/transport.js +2 -0
- package/dist/adapters/websocket/server/transport.js.map +1 -1
- package/dist/adapters/websocket/shared/rpc.d.ts.map +1 -1
- package/dist/adapters/websocket/shared/rpc.js +14 -5
- package/dist/adapters/websocket/shared/rpc.js.map +1 -1
- package/dist/browser.d.ts +6 -4
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +4 -1
- package/dist/browser.js.map +1 -1
- package/dist/client/errors/index.d.ts +1 -1
- package/dist/client/errors/index.d.ts.map +1 -1
- package/dist/client/errors/index.js +1 -1
- package/dist/client/errors/index.js.map +1 -1
- package/dist/client/errors/registry.d.ts +10 -0
- package/dist/client/errors/registry.d.ts.map +1 -1
- package/dist/client/errors/registry.js +12 -0
- package/dist/client/errors/registry.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/events/bus.js +5 -1
- package/dist/events/bus.js.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/publisher.d.ts +18 -2
- package/dist/events/publisher.d.ts.map +1 -1
- package/dist/events/publisher.js +142 -25
- package/dist/events/publisher.js.map +1 -1
- package/dist/events/recheck.d.ts +27 -5
- package/dist/events/recheck.d.ts.map +1 -1
- package/dist/events/recheck.js +11 -10
- package/dist/events/recheck.js.map +1 -1
- package/dist/procedures/collection/admission.d.ts +26 -7
- package/dist/procedures/collection/admission.d.ts.map +1 -1
- package/dist/procedures/collection/admission.js +39 -7
- package/dist/procedures/collection/admission.js.map +1 -1
- package/dist/procedures/collection/changes.d.ts +28 -4
- package/dist/procedures/collection/changes.d.ts.map +1 -1
- package/dist/procedures/collection/changes.js +50 -6
- package/dist/procedures/collection/changes.js.map +1 -1
- package/dist/procedures/collection/hint-filter.d.ts +143 -0
- package/dist/procedures/collection/hint-filter.d.ts.map +1 -0
- package/dist/procedures/collection/hint-filter.js +311 -0
- package/dist/procedures/collection/hint-filter.js.map +1 -0
- package/dist/procedures/collection/index.d.ts +2 -0
- package/dist/procedures/collection/index.d.ts.map +1 -1
- package/dist/procedures/collection/index.js +2 -0
- package/dist/procedures/collection/index.js.map +1 -1
- package/dist/procedures/collection/procedures.d.ts +2 -2
- package/dist/procedures/collection/procedures.d.ts.map +1 -1
- package/dist/procedures/collection/procedures.js +6 -4
- package/dist/procedures/collection/procedures.js.map +1 -1
- package/dist/procedures/index.d.ts +2 -2
- package/dist/procedures/index.d.ts.map +1 -1
- package/dist/procedures/index.js +3 -1
- package/dist/procedures/index.js.map +1 -1
- package/dist/server/error-policy.d.ts +96 -0
- package/dist/server/error-policy.d.ts.map +1 -0
- package/dist/server/error-policy.js +196 -0
- package/dist/server/error-policy.js.map +1 -0
- package/dist/server/error-response.d.ts +30 -0
- package/dist/server/error-response.d.ts.map +1 -0
- package/dist/server/error-response.js +90 -0
- package/dist/server/error-response.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/last-resort.d.ts +17 -0
- package/dist/server/last-resort.d.ts.map +1 -0
- package/dist/server/last-resort.js +19 -0
- package/dist/server/last-resort.js.map +1 -0
- package/dist/server/procedure-server.d.ts +3 -11
- package/dist/server/procedure-server.d.ts.map +1 -1
- package/dist/server/procedure-server.js +7 -42
- package/dist/server/procedure-server.js.map +1 -1
- package/dist/server/server.d.ts +43 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +39 -2
- package/dist/server/server.js.map +1 -1
- package/dist/server/types.d.ts +12 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/http/server/handler.ts +18 -3
- package/src/adapters/port/transport.ts +2 -0
- package/src/adapters/websocket/server/transport.ts +2 -0
- package/src/adapters/websocket/shared/rpc.ts +14 -5
- package/src/browser.ts +11 -0
- package/src/client/errors/index.ts +1 -0
- package/src/client/errors/registry.ts +13 -0
- package/src/client/index.ts +1 -0
- package/src/events/bus.ts +6 -1
- package/src/events/index.ts +1 -1
- package/src/events/publisher.ts +150 -26
- package/src/events/recheck.ts +38 -13
- package/src/procedures/collection/admission.ts +50 -9
- package/src/procedures/collection/changes.ts +68 -7
- package/src/procedures/collection/hint-filter.ts +376 -0
- package/src/procedures/collection/index.ts +3 -0
- package/src/procedures/collection/procedures.ts +8 -6
- package/src/procedures/index.ts +5 -0
- package/src/server/error-policy.ts +263 -0
- package/src/server/error-response.ts +91 -0
- package/src/server/index.ts +2 -0
- package/src/server/last-resort.ts +23 -0
- package/src/server/procedure-server.ts +8 -41
- package/src/server/server.ts +73 -3
- package/src/server/types.ts +13 -0
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* `admission` of `createCollectionProcedures()` gives the rules as data:
|
|
5
5
|
*
|
|
6
6
|
* - `admit` examines each row `{ id, value }` that a read gives. It has the shape of `AdmitItem`,
|
|
7
|
-
* the output filter of a host. The change events
|
|
8
|
-
* subscriber
|
|
7
|
+
* the output filter of a host. The publisher of the change events gives it the rows of each
|
|
8
|
+
* event for each subscriber (roadmap CLI-78). Thus the reads and the events obey one rule.
|
|
9
|
+
* - `admitsAll` tells that `admit` admits each row of a partition for a call. The events of such a
|
|
10
|
+
* subscriber then pass without the filter of each row.
|
|
9
11
|
* - `guard` examines each write `{ op, id, doc, prev }` before the storage changes. A refused write
|
|
10
12
|
* gets `FORBIDDEN` with the reason `write-not-allowed`.
|
|
11
13
|
* - `versionOf` gives the version of a stored item (roadmap CLI-55). With it, a guarded write
|
|
@@ -16,8 +18,11 @@
|
|
|
16
18
|
* (`admittedStorage()`). Each read and each write of each procedure goes through this view.
|
|
17
19
|
*
|
|
18
20
|
* - A refused row is absent: `get` gives undefined, `has` gives false, and the lists, `size`,
|
|
19
|
-
* `find` and `changes` do not have it.
|
|
20
|
-
*
|
|
21
|
+
* `find` and `changes` do not have it.
|
|
22
|
+
* - A delta of `changes` gives only ids that the caller can read (roadmap CLI-78). The view
|
|
23
|
+
* does not know which rows the caller read before the delta. Thus a delta with a refused row or
|
|
24
|
+
* with a deleted row becomes a full answer of the admitted rows. The copy of the caller then
|
|
25
|
+
* drops each other row. When `admitsAll` admits the caller, the delta stays as it is.
|
|
21
26
|
* - An error of `admit` fails the read. It does not hide the rows, so a sync does not delete them.
|
|
22
27
|
* - The guard reads the stored item before the write. With `versionOf`, the write expects the
|
|
23
28
|
* version of that item (roadmap CLI-16). A change of another writer between the read and the
|
|
@@ -66,10 +71,23 @@ export type CollectionWriteGuard = (write: CollectionWrite, invocation: Invocati
|
|
|
66
71
|
export interface CollectionAdmission {
|
|
67
72
|
/**
|
|
68
73
|
* The rule of the rows. It gets each row `{ id, value }` of a read and the invocation of the
|
|
69
|
-
* call, and it gives true to admit the row. The change events
|
|
70
|
-
* subscriber, with the invocation of the subscription
|
|
74
|
+
* call, and it gives true to admit the row. The publisher of the change events applies it to the
|
|
75
|
+
* rows of each event for each subscriber, with the invocation of the subscription (roadmap
|
|
76
|
+
* CLI-78). A subscriber gets only the ids of the rows that it can read.
|
|
71
77
|
*/
|
|
72
78
|
admit?: AdmitItem | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* This function tells that the rule `admit` admits each row of a partition for a call (roadmap
|
|
81
|
+
* CLI-78). It gets the invocation and the partition (undefined for the collection without a
|
|
82
|
+
* partition). True: the change events reach the subscriber without the filter of each row, as
|
|
83
|
+
* before CLI-78. The publisher asks at the start of a subscription and at each re-check.
|
|
84
|
+
*
|
|
85
|
+
* - Give true only when `admit` admits each row of the partition. Else the subscriber gets the
|
|
86
|
+
* ids of rows that it cannot read.
|
|
87
|
+
* - An error gives false.
|
|
88
|
+
* - Without it, the publisher examines each row of each event for each subscriber.
|
|
89
|
+
*/
|
|
90
|
+
admitsAll?: ((invocation: Invocation, partition: string | undefined) => boolean | Promise<boolean>) | undefined;
|
|
73
91
|
/** The guard of each `set`, `patch` and `delete`, also of the batches and of `clear`. */
|
|
74
92
|
guard?: CollectionWriteGuard | undefined;
|
|
75
93
|
/**
|
|
@@ -154,8 +172,9 @@ function withoutValue(conflict: VersionConflict): VersionConflict {
|
|
|
154
172
|
* @param storage - The storage of the call: of the collection, or of its partition
|
|
155
173
|
* @param admission - The rules of the collection
|
|
156
174
|
* @param ctx - The context of the call. The rules get its invocation.
|
|
175
|
+
* @param partition - The partition of the call. `admitsAll` gets it.
|
|
157
176
|
*/
|
|
158
|
-
export function admittedStorage<T>(storage: CollectionStorage<T>, admission: CollectionAdmission | undefined, ctx: ProcedureContext): CollectionStorage<T> {
|
|
177
|
+
export function admittedStorage<T>(storage: CollectionStorage<T>, admission: CollectionAdmission | undefined, ctx: ProcedureContext, partition?: string): CollectionStorage<T> {
|
|
159
178
|
const admit = admission?.admit;
|
|
160
179
|
const guard = admission?.guard;
|
|
161
180
|
if (!admit && !guard) return storage;
|
|
@@ -234,6 +253,23 @@ export function admittedStorage<T>(storage: CollectionStorage<T>, admission: Col
|
|
|
234
253
|
return new VersionConflictError(kept, error instanceof Error ? error.message : undefined);
|
|
235
254
|
};
|
|
236
255
|
|
|
256
|
+
/** This function tells if `admitsAll` admits the caller. An error gives false. */
|
|
257
|
+
const readsAll = async (): Promise<boolean> => {
|
|
258
|
+
if (!admission?.admitsAll || invocation === undefined) return false;
|
|
259
|
+
try {
|
|
260
|
+
return (await admission.admitsAll(invocation, partition)) === true;
|
|
261
|
+
} catch {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
/** The full answer of `changes`: each admitted row, at a version that the rows include. */
|
|
266
|
+
const fullAnswer = async (): Promise<StorageChanges<T>> => {
|
|
267
|
+
const all = await storage.getChangesSince!(undefined);
|
|
268
|
+
if (all.full) return { version: all.version, full: true, changed: await admitted(all.changed), deleted: [] };
|
|
269
|
+
// A log that does not give all rows: the rows, read after the version, include that version
|
|
270
|
+
return { version: all.version, full: true, changed: await entries(), deleted: [] };
|
|
271
|
+
};
|
|
272
|
+
|
|
237
273
|
const view: CollectionStorage<T> = {
|
|
238
274
|
async get(id) {
|
|
239
275
|
const value = await storage.get(id);
|
|
@@ -322,10 +358,15 @@ export function admittedStorage<T>(storage: CollectionStorage<T>, admission: Col
|
|
|
322
358
|
if (!admit) return changes;
|
|
323
359
|
const changed = await admitted(changes.changed);
|
|
324
360
|
if (changes.full) return { ...changes, changed };
|
|
325
|
-
// A delta: the copy of the caller drops each refused row
|
|
326
361
|
const kept = new Set(changed.map(([id]) => id));
|
|
327
362
|
const refused = changes.changed.filter(([id]) => !kept.has(id)).map(([id]) => id);
|
|
328
|
-
|
|
363
|
+
// A delta of admitted rows only gives no id that the caller cannot read
|
|
364
|
+
if (refused.length === 0 && changes.deleted.length === 0) return { ...changes, changed };
|
|
365
|
+
// A caller that reads each row of the partition gets the delta as before (roadmap CLI-78)
|
|
366
|
+
if (await readsAll()) return { ...changes, changed, deleted: [...changes.deleted, ...refused] };
|
|
367
|
+
// The view does not know if the caller read a refused or a deleted row before. A full answer
|
|
368
|
+
// gives no other id, and the copy of the caller drops each row that it cannot read.
|
|
369
|
+
return fullAnswer();
|
|
329
370
|
};
|
|
330
371
|
}
|
|
331
372
|
if (storage.query) {
|
|
@@ -22,12 +22,18 @@
|
|
|
22
22
|
* listens to the topic, the procedures publish nothing, and the chain stops.
|
|
23
23
|
* - The publishes of one storage and one topic run one at a time, in the order of the writes. A
|
|
24
24
|
* write resolves after its event is on the bus. A failed publish never fails the write.
|
|
25
|
+
* - With the rule `admission.admit`, the publisher filters the ids of each event for each
|
|
26
|
+
* subscriber (roadmap CLI-78, `hint-filter.ts`). The event carries the rows after the changes,
|
|
27
|
+
* from the change log. While a subscriber has a filter, each write first reads the rows before
|
|
28
|
+
* it (`getBatch`). Thus a row that leaves the rule reaches that subscriber as a delete.
|
|
25
29
|
*/
|
|
26
30
|
|
|
27
31
|
import type { EventBus } from "../../events/types.js";
|
|
28
32
|
import { withRows } from "../../events/rows.js";
|
|
29
33
|
import type { AdmitItem } from "../invoke.js";
|
|
30
34
|
import type { StorageChanges } from "./storage.js";
|
|
35
|
+
import type { CollectionAdmission } from "./admission.js";
|
|
36
|
+
import { hasFilteredSubscriber, withHintImages, type HintRowState } from "./hint-filter.js";
|
|
31
37
|
import type { RepositoryProvider } from "../types.js";
|
|
32
38
|
import { collectionTopicTarget } from "./topic.js";
|
|
33
39
|
|
|
@@ -52,8 +58,23 @@ export interface CollectionChangeEvent {
|
|
|
52
58
|
* Without the option, the event has no values: read them with `changes`.
|
|
53
59
|
*/
|
|
54
60
|
readonly values?: ReadonlyArray<{ readonly id: string; readonly value: unknown }> | undefined;
|
|
55
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* With the option `values`: the changed ids whose values the output filter of the host refused.
|
|
63
|
+
* Read them with `changes`. A row that the rule of the rows refuses is not in the event (roadmap CLI-78).
|
|
64
|
+
*/
|
|
56
65
|
readonly withheld?: readonly string[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* The version of each changed item, as `versionOf(id)` of the storage gives it (roadmap CLI-77).
|
|
68
|
+
* A publisher that knows the versions sets it, for example `watchStorageChanges()` of
|
|
69
|
+
* `@procedures/mongo`. Without it, read the versions with `changes`. A deleted id has no version.
|
|
70
|
+
*/
|
|
71
|
+
readonly versions?: ReadonlyArray<{ readonly id: string; readonly version: string }> | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* True: read the collection in full, with `changes` and no `since` (roadmap CLI-77). A publisher
|
|
74
|
+
* sets it when it cannot tell what changed, for example `watchStorageChanges()` of
|
|
75
|
+
* `@procedures/mongo` after it lost its resume token. A read since the cursor can miss changes.
|
|
76
|
+
*/
|
|
77
|
+
readonly reset?: boolean | undefined;
|
|
57
78
|
/** The origin of the writes, when one origin made all the changes of the event. */
|
|
58
79
|
readonly origin?: string | undefined;
|
|
59
80
|
}
|
|
@@ -78,6 +99,8 @@ export function collectionTopicReads(topic: string, repository?: RepositoryProvi
|
|
|
78
99
|
/** The part of a storage that the change events read. */
|
|
79
100
|
interface ChangeLog {
|
|
80
101
|
getChangesSince?(since?: string): Promise<StorageChanges<unknown>>;
|
|
102
|
+
/** The stored items of the ids: the rows before a write, for the row filter of the subscribers (roadmap CLI-78). */
|
|
103
|
+
getBatch?(ids: string[]): Promise<Map<string, unknown>>;
|
|
81
104
|
}
|
|
82
105
|
|
|
83
106
|
/** A write that ended, and that no event told yet. */
|
|
@@ -87,6 +110,8 @@ interface EndedWrite {
|
|
|
87
110
|
readonly origin: string | undefined;
|
|
88
111
|
/** True when the chain had a version when the write started. */
|
|
89
112
|
readonly anchored: boolean;
|
|
113
|
+
/** The stored items of the ids before the write, when a subscriber has a row filter (roadmap CLI-78). */
|
|
114
|
+
before?: ReadonlyMap<string, unknown> | undefined;
|
|
90
115
|
}
|
|
91
116
|
|
|
92
117
|
/** The chain of the events of one storage and one topic. */
|
|
@@ -140,7 +165,8 @@ function hint(version: string | undefined, origin: string | undefined): Collecti
|
|
|
140
165
|
/**
|
|
141
166
|
* The event of a delta with the values of the changed items. Each row `{ id, value }` passes the
|
|
142
167
|
* output filter of each subscriber and the rule of the rows of the collection, and a refused row
|
|
143
|
-
* goes from `values` to `withheld`.
|
|
168
|
+
* goes from `values` to `withheld`. The row filter of a subscriber (roadmap CLI-78) first takes the
|
|
169
|
+
* rows that the rule refuses out of the event. Thus only the output filter of the host withholds a row.
|
|
144
170
|
*/
|
|
145
171
|
function withValues(event: CollectionChangeEvent, entries: ReadonlyArray<{ readonly id: string; readonly value: unknown }>, admit: AdmitItem | undefined): CollectionChangeEvent {
|
|
146
172
|
return withRows(
|
|
@@ -162,7 +188,8 @@ function withValues(event: CollectionChangeEvent, entries: ReadonlyArray<{ reado
|
|
|
162
188
|
}
|
|
163
189
|
|
|
164
190
|
/** One publish: the event of the writes that ended since the last publish. */
|
|
165
|
-
async function publish(chain: ChangeChain, storage: ChangeLog, bus: EventBus, topic: string, values: boolean,
|
|
191
|
+
async function publish(chain: ChangeChain, storage: ChangeLog, bus: EventBus, topic: string, values: boolean, admission: CollectionAdmission | undefined): Promise<void> {
|
|
192
|
+
const admit = admission?.admit;
|
|
166
193
|
const writes = chain.ended.splice(0);
|
|
167
194
|
// An earlier publish told these writes
|
|
168
195
|
if (writes.length === 0) return;
|
|
@@ -199,7 +226,33 @@ async function publish(chain: ChangeChain, storage: ChangeLog, bus: EventBus, to
|
|
|
199
226
|
deleted: changes.deleted,
|
|
200
227
|
...(origin !== undefined && { origin }),
|
|
201
228
|
};
|
|
202
|
-
|
|
229
|
+
const out = values ? withValues(event, changes.changed.map(([id, value]) => ({ id, value })), admit) : event;
|
|
230
|
+
// The rows of the event for the row filter of each subscriber (roadmap CLI-78)
|
|
231
|
+
bus.emit(topic, admit ? withHintImages(out, { after: afterOf(changes), before: beforeOf(writes), admission: admission! }) : out);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** The rows after the changes, from the change log: a changed id has its item, a deleted id has none. */
|
|
235
|
+
function afterOf(changes: StorageChanges<unknown>): Map<string, HintRowState> {
|
|
236
|
+
const after = new Map<string, HintRowState>();
|
|
237
|
+
for (const id of changes.deleted) after.set(id, { found: false });
|
|
238
|
+
for (const [id, value] of changes.changed) after.set(id, { found: true, value });
|
|
239
|
+
return after;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* The rows before the changes: for each id, the read of the first write that read it. An id
|
|
244
|
+
* without a read is unknown, so the filter of a subscriber makes a hint without ids for it.
|
|
245
|
+
*/
|
|
246
|
+
function beforeOf(writes: readonly EndedWrite[]): Map<string, HintRowState> {
|
|
247
|
+
const before = new Map<string, HintRowState>();
|
|
248
|
+
for (const write of writes) {
|
|
249
|
+
if (!write.before || write.ids === "*") continue;
|
|
250
|
+
for (const id of write.ids) {
|
|
251
|
+
if (before.has(id)) continue;
|
|
252
|
+
before.set(id, write.before.has(id) ? { found: true, value: write.before.get(id) } : { found: false });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return before;
|
|
203
256
|
}
|
|
204
257
|
|
|
205
258
|
/**
|
|
@@ -215,7 +268,7 @@ async function publish(chain: ChangeChain, storage: ChangeLog, bus: EventBus, to
|
|
|
215
268
|
* @param origin - The origin of the write
|
|
216
269
|
* @param write - The write
|
|
217
270
|
* @param values - True: the events carry the values, for the output filter of each subscriber
|
|
218
|
-
* @param
|
|
271
|
+
* @param admission - The rules of the rows of the collection: each subscriber applies `admit` to the rows of the event (roadmap CLI-41, CLI-78)
|
|
219
272
|
*/
|
|
220
273
|
export async function writeWithChangeEvent<R>(
|
|
221
274
|
bus: EventBus | undefined,
|
|
@@ -225,16 +278,24 @@ export async function writeWithChangeEvent<R>(
|
|
|
225
278
|
origin: string | undefined,
|
|
226
279
|
write: () => Promise<R>,
|
|
227
280
|
values = false,
|
|
228
|
-
|
|
281
|
+
admission?: CollectionAdmission,
|
|
229
282
|
): Promise<R> {
|
|
230
283
|
if (bus === undefined || topic === undefined) return write();
|
|
231
284
|
const chain = chainOf(storage, topic);
|
|
232
285
|
const started: EndedWrite = { ids, origin, anchored: chain.anchor !== undefined };
|
|
286
|
+
// A subscriber with a row filter: the rows before the write tell it which rows left the rule (roadmap CLI-78)
|
|
287
|
+
if (admission?.admit && ids !== "*" && ids.length > 0 && storage.getBatch && hasFilteredSubscriber(bus, topic) && bus.hasSubscribers(topic)) {
|
|
288
|
+
try {
|
|
289
|
+
started.before = await storage.getBatch([...ids]);
|
|
290
|
+
} catch {
|
|
291
|
+
// Without the rows before the write, the filter of a subscriber makes a hint without ids
|
|
292
|
+
}
|
|
293
|
+
}
|
|
233
294
|
try {
|
|
234
295
|
return await write();
|
|
235
296
|
} finally {
|
|
236
297
|
chain.ended.push(started);
|
|
237
|
-
const run = chain.tail.then(() => publish(chain, storage, bus, topic, values,
|
|
298
|
+
const run = chain.tail.then(() => publish(chain, storage, bus, topic, values, admission));
|
|
238
299
|
chain.tail = run.catch(() => undefined);
|
|
239
300
|
await chain.tail;
|
|
240
301
|
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The row filter of the change events of a collection (roadmap CLI-78).
|
|
3
|
+
*
|
|
4
|
+
* A change event names the ids that changed. Before CLI-78, each subscriber of a topic got all the
|
|
5
|
+
* ids, so only a principal that reads the whole partition could subscribe. With CLI-78, the publisher
|
|
6
|
+
* filters each event row by row for each subscriber, with the rule of the rows of the collection
|
|
7
|
+
* (`admission.admit`). The reads apply the same rule (`admittedStorage()`).
|
|
8
|
+
*
|
|
9
|
+
* - The rule comes from the registry of the call: `createCollectionProcedures()` puts its rules on
|
|
10
|
+
* the metadata of its procedures. An event can also carry the rules in its images.
|
|
11
|
+
* - The rule examines the rows of the images of the event (`withHintImages()`): the row after the
|
|
12
|
+
* changes, and the row before them. The publisher does not read a storage.
|
|
13
|
+
* - A changed row that the rule admits stays in `changed`. A changed row that the rule refuses, or
|
|
14
|
+
* a deleted row, goes to `deleted` only when the rule admitted its row before the changes.
|
|
15
|
+
* Otherwise the subscriber does not get its id.
|
|
16
|
+
* - When an image is missing, or the rule fails, the subscriber gets a hint without ids and
|
|
17
|
+
* without `since`. It then reads the changes, through the rule of the reads.
|
|
18
|
+
* - An event without ids, and a `reset` event, pass without ids.
|
|
19
|
+
* - When the subscriber gets no id of an event, it gets no event. The `since` of its next event is
|
|
20
|
+
* then the `version` of the last event that it got. Thus it applies the next delta without a read.
|
|
21
|
+
* - `admission.admitsAll` tells that a subscriber reads each row of its partition. Its events then
|
|
22
|
+
* pass as before CLI-78, with no cost.
|
|
23
|
+
*/
|
|
24
|
+
import type { Invocation } from "../invoke.js";
|
|
25
|
+
import type { AnyProcedure, ProcedureContext } from "../types.js";
|
|
26
|
+
import type { CollectionAdmission } from "./admission.js";
|
|
27
|
+
import { withRows } from "../../events/rows.js";
|
|
28
|
+
import type { EventBus } from "../../events/types.js";
|
|
29
|
+
|
|
30
|
+
/** The state of one row in an image: the stored item, or no item. */
|
|
31
|
+
export type HintRowState = { readonly found: true; readonly value: unknown } | { readonly found: false };
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The rows of a change event, for the row filter of each subscriber (roadmap CLI-78). A missing id
|
|
35
|
+
* in a map is unknown. The images are on a symbol key, so they stay in this process: JSON does
|
|
36
|
+
* not take them.
|
|
37
|
+
*/
|
|
38
|
+
export interface HintImages {
|
|
39
|
+
/** The rows after the changes of the event, by id. */
|
|
40
|
+
readonly after?: ReadonlyMap<string, HintRowState> | undefined;
|
|
41
|
+
/** The rows before the changes of the event (at its `since`), by id. */
|
|
42
|
+
readonly before?: ReadonlyMap<string, HintRowState> | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The rules of the rows of the collection. The publisher uses the rules from its registry
|
|
45
|
+
* first, and these rules only when the registry has none.
|
|
46
|
+
*/
|
|
47
|
+
readonly admission?: CollectionAdmission | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The key of the images of an event. */
|
|
51
|
+
const IMAGES: unique symbol = Symbol.for("procedures.hintImages");
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* This function gives the event with its images, for the row filter of each subscriber (roadmap
|
|
55
|
+
* CLI-78). The images are not enumerable: a copy or a comparison of the event does not see them.
|
|
56
|
+
*/
|
|
57
|
+
export function withHintImages<T extends object>(event: T, images: HintImages): T {
|
|
58
|
+
return Object.defineProperty(event, IMAGES, { value: images, enumerable: false, configurable: true });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The images of an event, or undefined for an event without images. */
|
|
62
|
+
export function hintImagesOf(event: unknown): HintImages | undefined {
|
|
63
|
+
if (typeof event !== "object" || event === null) return undefined;
|
|
64
|
+
const images = (event as { [IMAGES]?: unknown })[IMAGES];
|
|
65
|
+
return typeof images === "object" && images !== null ? (images as HintImages) : undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The key of the rules of a collection on the metadata of its procedures. */
|
|
69
|
+
const RULES: unique symbol = Symbol.for("procedures.collectionRules");
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* This function puts the rules of a collection on the metadata of its procedures, so the publisher
|
|
73
|
+
* of the events finds them in the registry. The key is not enumerable.
|
|
74
|
+
*/
|
|
75
|
+
export function withCollectionRules(procedures: AnyProcedure[], admission: CollectionAdmission | undefined): AnyProcedure[] {
|
|
76
|
+
for (const procedure of procedures) {
|
|
77
|
+
const metadata = procedure.metadata as object | undefined;
|
|
78
|
+
if (metadata) Object.defineProperty(metadata, RULES, { value: { admission }, enumerable: false, configurable: true });
|
|
79
|
+
}
|
|
80
|
+
return procedures;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The rules of a collection in the registry of a call. It gives the rules, or `null` for a
|
|
85
|
+
* collection without rules. It gives undefined when the registry does not know the procedures.
|
|
86
|
+
*/
|
|
87
|
+
export function collectionRulesOf(ctx: ProcedureContext, collection: string): CollectionAdmission | null | undefined {
|
|
88
|
+
const registry = ctx.registry;
|
|
89
|
+
if (!registry) return undefined;
|
|
90
|
+
for (const operation of ["changes", "get"]) {
|
|
91
|
+
const metadata = registry.get(["collections", collection, operation])?.metadata as { [RULES]?: { admission?: CollectionAdmission | undefined } } | undefined;
|
|
92
|
+
const rules = metadata?.[RULES];
|
|
93
|
+
if (rules) return rules.admission ?? null;
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The invocation that the rules of a collection get for the events of one topic (roadmap CLI-78).
|
|
100
|
+
* It has the principal, the capability, the metadata and the signal of the subscription. Its path
|
|
101
|
+
* is the path of `changes` of the collection, and its input has the partition of the topic. Thus
|
|
102
|
+
* a rule that reads `invocation.input.partition` sees the same input as in a read of the topic.
|
|
103
|
+
*
|
|
104
|
+
* @param base - The invocation of the subscription
|
|
105
|
+
* @param ctx - The context of the subscription. Its registry gives the procedure of `changes`.
|
|
106
|
+
* @param collection - The collection of the topic
|
|
107
|
+
* @param partition - The partition that the topic names, before the resolver
|
|
108
|
+
*/
|
|
109
|
+
export function collectionInvocation(base: Invocation | undefined, ctx: ProcedureContext, collection: string, partition: string | undefined): Invocation | undefined {
|
|
110
|
+
if (base === undefined) return undefined;
|
|
111
|
+
const procedure = ctx.registry?.get(["collections", collection, "changes"]);
|
|
112
|
+
return {
|
|
113
|
+
...base,
|
|
114
|
+
...(procedure !== undefined && { procedure, path: procedure.path }),
|
|
115
|
+
input: partition === undefined ? {} : { partition },
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The subscriptions with a row filter, by bus and by topic: the writes read the rows before them only for these. */
|
|
120
|
+
const FILTERED = new WeakMap<object, Map<string, number>>();
|
|
121
|
+
|
|
122
|
+
/** The key of the bus under a view of a bus (`withEventBusSignal()`). */
|
|
123
|
+
const BASE_BUS = Symbol.for("procedures.baseBus");
|
|
124
|
+
|
|
125
|
+
/** The bus under a view of a bus, or the bus itself. */
|
|
126
|
+
function baseOf(bus: EventBus): object {
|
|
127
|
+
return ((bus as { [BASE_BUS]?: EventBus })[BASE_BUS] as object | undefined) ?? bus;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* This function marks a topic of a bus: a subscription of the topic has a row filter. It gives the
|
|
132
|
+
* function that removes the mark. A second call of that function does nothing.
|
|
133
|
+
*/
|
|
134
|
+
export function markFilteredTopic(bus: EventBus, topic: string): () => void {
|
|
135
|
+
const base = baseOf(bus);
|
|
136
|
+
let topics = FILTERED.get(base);
|
|
137
|
+
if (!topics) {
|
|
138
|
+
topics = new Map();
|
|
139
|
+
FILTERED.set(base, topics);
|
|
140
|
+
}
|
|
141
|
+
topics.set(topic, (topics.get(topic) ?? 0) + 1);
|
|
142
|
+
let marked = true;
|
|
143
|
+
return () => {
|
|
144
|
+
if (!marked) return;
|
|
145
|
+
marked = false;
|
|
146
|
+
const count = (topics.get(topic) ?? 1) - 1;
|
|
147
|
+
if (count > 0) topics.set(topic, count);
|
|
148
|
+
else topics.delete(topic);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** True when a subscription of the topic of the bus has a row filter. */
|
|
153
|
+
export function hasFilteredSubscriber(bus: EventBus, topic: string): boolean {
|
|
154
|
+
return (FILTERED.get(baseOf(bus))?.get(topic) ?? 0) > 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The result of the filter for an event that the subscriber does not get. */
|
|
158
|
+
export const DROPPED: unique symbol = Symbol("procedures.droppedHint");
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The mode of a filter. `pass` gives each event as before CLI-78, and `filter` examines each row.
|
|
162
|
+
* `unknown` uses the rules of the images of each event.
|
|
163
|
+
*/
|
|
164
|
+
export type HintFilterMode = "pass" | "filter" | "unknown";
|
|
165
|
+
|
|
166
|
+
/** The fields of a change event that the filter reads. */
|
|
167
|
+
interface ChangeEventShape {
|
|
168
|
+
readonly since?: unknown;
|
|
169
|
+
readonly version?: unknown;
|
|
170
|
+
readonly changed: readonly string[];
|
|
171
|
+
readonly deleted: readonly string[];
|
|
172
|
+
readonly values?: ReadonlyArray<{ readonly id: string; readonly value: unknown }> | undefined;
|
|
173
|
+
readonly versions?: ReadonlyArray<{ readonly id: string; readonly version: string }> | undefined;
|
|
174
|
+
readonly reset?: unknown;
|
|
175
|
+
readonly origin?: unknown;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** True for a value with the shape of a change event: the arrays `changed` and `deleted`. */
|
|
179
|
+
function isChangeEvent(data: unknown): data is ChangeEventShape {
|
|
180
|
+
if (typeof data !== "object" || data === null) return false;
|
|
181
|
+
const event = data as { changed?: unknown; deleted?: unknown };
|
|
182
|
+
return Array.isArray(event.changed) && Array.isArray(event.deleted);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** The fields `version` and `origin` of an event, when they are strings. */
|
|
186
|
+
function headOf(event: ChangeEventShape): { version?: string; origin?: string } {
|
|
187
|
+
return {
|
|
188
|
+
...(typeof event.version === "string" && { version: event.version }),
|
|
189
|
+
...(typeof event.origin === "string" && { origin: event.origin }),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** What the rule tells of one row: admitted, refused, or unknown (no image, or an error). */
|
|
194
|
+
type Verdict = boolean | undefined;
|
|
195
|
+
|
|
196
|
+
/** This function does nothing: the end of a filter that failed. */
|
|
197
|
+
function ignore(): void {}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The row filter of one topic of one subscription (roadmap CLI-78). The publisher gives each event
|
|
201
|
+
* of the topic to `apply()`, one at a time, in the order of the bus.
|
|
202
|
+
*/
|
|
203
|
+
export class RowHintFilter {
|
|
204
|
+
/** The rules from the registry: undefined when the registry does not know the collection. */
|
|
205
|
+
private rules: CollectionAdmission | null | undefined;
|
|
206
|
+
/** The result of `admitsAll` for one set of rules. */
|
|
207
|
+
private all: { readonly admission: CollectionAdmission; readonly value: boolean } | undefined;
|
|
208
|
+
/** The `version` of the last event of the chain, also of an event that the subscriber did not get. */
|
|
209
|
+
private head: string | undefined;
|
|
210
|
+
/** The `since` that the next event of the chain gets: the `version` of the last event that the subscriber got. */
|
|
211
|
+
private base: string | undefined;
|
|
212
|
+
/** The filters, one at a time. */
|
|
213
|
+
private tail: Promise<unknown> = Promise.resolve();
|
|
214
|
+
|
|
215
|
+
constructor(
|
|
216
|
+
/** The rules of the collection from the registry of the call. */
|
|
217
|
+
private readonly lookup: () => CollectionAdmission | null | undefined,
|
|
218
|
+
/** The invocation of the topic (`collectionInvocation()`): the rules get it. */
|
|
219
|
+
readonly invocation: Invocation | undefined,
|
|
220
|
+
/** The partition of the topic: `admitsAll` gets it. */
|
|
221
|
+
private readonly partition: string | undefined,
|
|
222
|
+
) {
|
|
223
|
+
this.rules = lookup();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** The mode of the filter, from the rules and from the last result of `admitsAll`. */
|
|
227
|
+
get mode(): HintFilterMode {
|
|
228
|
+
const rules = this.rules;
|
|
229
|
+
if (rules === undefined) return "unknown";
|
|
230
|
+
if (rules === null || !rules.admit) return "pass";
|
|
231
|
+
return this.all?.admission === rules && this.all.value ? "pass" : "filter";
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* This function reads the rules again and asks `admitsAll` again: at the start of the
|
|
236
|
+
* subscription and at each re-check (roadmap CLI-44). It gives the new mode.
|
|
237
|
+
*/
|
|
238
|
+
async refresh(): Promise<HintFilterMode> {
|
|
239
|
+
this.rules = this.lookup();
|
|
240
|
+
this.all = undefined;
|
|
241
|
+
if (this.rules?.admit) await this.admitsAll(this.rules);
|
|
242
|
+
return this.mode;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** This function forgets the chain: the next event keeps its own `since`. */
|
|
246
|
+
forget(): void {
|
|
247
|
+
this.head = undefined;
|
|
248
|
+
this.base = undefined;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The event for the subscriber. It gives undefined when the event passes as it is (no wait).
|
|
253
|
+
* Otherwise it gives a promise of the event for the subscriber, or of `DROPPED` for no event.
|
|
254
|
+
*/
|
|
255
|
+
apply(data: unknown): Promise<unknown> | undefined {
|
|
256
|
+
if (!isChangeEvent(data)) return undefined;
|
|
257
|
+
const mode = this.mode;
|
|
258
|
+
if (mode === "pass") return undefined;
|
|
259
|
+
const admission = this.rules ?? hintImagesOf(data)?.admission;
|
|
260
|
+
if (!admission?.admit) return undefined;
|
|
261
|
+
const run = this.tail.then(() => this.filter(data, admission));
|
|
262
|
+
this.tail = run.catch(ignore);
|
|
263
|
+
return run;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** The result of `admitsAll` for a set of rules. An error gives false. */
|
|
267
|
+
private async admitsAll(admission: CollectionAdmission): Promise<boolean> {
|
|
268
|
+
if (this.all?.admission === admission) return this.all.value;
|
|
269
|
+
let value = false;
|
|
270
|
+
const invocation = this.invocation;
|
|
271
|
+
if (admission.admitsAll && invocation) {
|
|
272
|
+
try {
|
|
273
|
+
value = (await admission.admitsAll(invocation, this.partition)) === true;
|
|
274
|
+
} catch {
|
|
275
|
+
value = false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
this.all = { admission, value };
|
|
279
|
+
return value;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** The filter of one event with the rule of the rows. */
|
|
283
|
+
private async filter(event: ChangeEventShape, admission: CollectionAdmission): Promise<unknown> {
|
|
284
|
+
// Rules from the images of an event: the subscriber can read each row
|
|
285
|
+
if (await this.admitsAll(admission)) return event;
|
|
286
|
+
if (event.reset === true) {
|
|
287
|
+
this.forget();
|
|
288
|
+
return { ...headOf(event), changed: [], deleted: [], reset: true };
|
|
289
|
+
}
|
|
290
|
+
const since = typeof event.since === "string" ? event.since : undefined;
|
|
291
|
+
if (event.changed.length === 0 && event.deleted.length === 0) {
|
|
292
|
+
if (since === undefined) {
|
|
293
|
+
// A hint: the subscriber reads the changes through the rule of the reads
|
|
294
|
+
this.forget();
|
|
295
|
+
return { ...headOf(event), changed: [], deleted: [] };
|
|
296
|
+
}
|
|
297
|
+
return this.skip(since, event);
|
|
298
|
+
}
|
|
299
|
+
const admit = admission.admit!;
|
|
300
|
+
const invocation = this.invocation;
|
|
301
|
+
const images = hintImagesOf(event);
|
|
302
|
+
const verdict = async (id: string, state: HintRowState | undefined): Promise<Verdict> => {
|
|
303
|
+
if (state === undefined) return undefined;
|
|
304
|
+
if (!state.found || invocation === undefined) return false;
|
|
305
|
+
try {
|
|
306
|
+
return (await admit({ id, value: state.value }, invocation)) === true;
|
|
307
|
+
} catch {
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const before = (id: string): Promise<Verdict> => verdict(id, images?.before?.get(id));
|
|
312
|
+
const changed = await Promise.all(
|
|
313
|
+
event.changed.map(async (id): Promise<"changed" | "deleted" | "none" | undefined> => {
|
|
314
|
+
const now = await verdict(id, images?.after?.get(id));
|
|
315
|
+
if (now === true) return "changed";
|
|
316
|
+
if (now === undefined) return undefined;
|
|
317
|
+
// The row left the rule, or it has no item: a delete for a subscriber that had it
|
|
318
|
+
const was = await before(id);
|
|
319
|
+
return was === undefined ? undefined : was ? "deleted" : "none";
|
|
320
|
+
}),
|
|
321
|
+
);
|
|
322
|
+
const deleted = await Promise.all(event.deleted.map(before));
|
|
323
|
+
if (changed.includes(undefined) || deleted.includes(undefined)) {
|
|
324
|
+
// The filter cannot tell the rows: the subscriber reads the changes through the rule of the reads
|
|
325
|
+
this.forget();
|
|
326
|
+
return { ...headOf(event), changed: [], deleted: [] };
|
|
327
|
+
}
|
|
328
|
+
const visible = event.changed.filter((_, index) => changed[index] === "changed");
|
|
329
|
+
const gone = [...event.changed.filter((_, index) => changed[index] === "deleted"), ...event.deleted.filter((_, index) => deleted[index] === true)];
|
|
330
|
+
if (visible.length === 0 && gone.length === 0) {
|
|
331
|
+
if (since === undefined) return DROPPED;
|
|
332
|
+
return this.skip(since, event);
|
|
333
|
+
}
|
|
334
|
+
const kept = new Set(visible);
|
|
335
|
+
const chained = since === undefined ? undefined : since === this.head ? this.base : since;
|
|
336
|
+
if (since !== undefined && typeof event.version === "string") {
|
|
337
|
+
this.head = event.version;
|
|
338
|
+
this.base = event.version;
|
|
339
|
+
} else {
|
|
340
|
+
this.forget();
|
|
341
|
+
}
|
|
342
|
+
const out = {
|
|
343
|
+
...(chained !== undefined && { since: chained }),
|
|
344
|
+
...(typeof event.version === "string" && { version: event.version }),
|
|
345
|
+
changed: visible,
|
|
346
|
+
deleted: gone,
|
|
347
|
+
...(event.versions && { versions: event.versions.filter(({ id }) => kept.has(id)) }),
|
|
348
|
+
...(typeof event.origin === "string" && { origin: event.origin }),
|
|
349
|
+
};
|
|
350
|
+
if (!event.values) return out;
|
|
351
|
+
const values = event.values.filter(({ id }) => kept.has(id));
|
|
352
|
+
// The rows pass the output filter of the host for the subscriber, as before
|
|
353
|
+
return withRows(
|
|
354
|
+
{ ...out, values },
|
|
355
|
+
{
|
|
356
|
+
rows: values,
|
|
357
|
+
keep: (admitted) => {
|
|
358
|
+
const withheld = values.filter((_, index) => !admitted[index]).map(({ id }) => id);
|
|
359
|
+
return { ...out, values: values.filter((_, index) => admitted[index]), ...(withheld.length > 0 && { withheld }) };
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** An event of the chain that the subscriber does not get: the next event keeps the `since` of the last one. */
|
|
366
|
+
private skip(since: string, event: ChangeEventShape): typeof DROPPED {
|
|
367
|
+
const chained = since === this.head ? this.base : since;
|
|
368
|
+
if (typeof event.version === "string" && chained !== undefined) {
|
|
369
|
+
this.head = event.version;
|
|
370
|
+
this.base = chained;
|
|
371
|
+
} else {
|
|
372
|
+
this.forget();
|
|
373
|
+
}
|
|
374
|
+
return DROPPED;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
@@ -81,6 +81,9 @@ export type { CollectionPartitions, PartitionInput, PartitionResolver } from "./
|
|
|
81
81
|
// The rules of the rows of a collection: a filter of the reads and a guard of the writes (roadmap CLI-41)
|
|
82
82
|
export { admittedStorage, admitsRow } from "./admission.js";
|
|
83
83
|
export type { CollectionAdmission, CollectionRow, CollectionWrite, CollectionWriteGuard } from "./admission.js";
|
|
84
|
+
// The images of the rows of a change event, for the row filter of each subscriber (roadmap CLI-78)
|
|
85
|
+
export { withHintImages, hintImagesOf } from "./hint-filter.js";
|
|
86
|
+
export type { HintImages, HintRowState } from "./hint-filter.js";
|
|
84
87
|
|
|
85
88
|
// The storage interface of the core (the shape of client-collections' CollectionStorage)
|
|
86
89
|
export type {
|