@agentshouse/mdruntime 0.1.0-cdf82f77fae68 → 0.1.0-ce131cb435f8b
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/AGENTS.md +271 -290
- package/README.md +8 -8
- package/dist/adapter.d.ts +51 -9
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +14 -1
- package/dist/bootstrap.d.ts +3 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +33 -7
- package/dist/change-set.d.ts +2 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +36 -10
- package/dist/chat/acts.d.ts +3 -4
- package/dist/chat/acts.d.ts.map +1 -1
- package/dist/chat/acts.js +10 -10
- package/dist/chat/earlier.d.ts +10 -0
- package/dist/chat/earlier.d.ts.map +1 -0
- package/dist/chat/earlier.js +54 -0
- package/dist/chat/kit.d.ts +2 -1
- package/dist/chat/kit.d.ts.map +1 -1
- package/dist/chat/kit.js +3 -3
- package/dist/chat/list.d.ts +8 -1
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +48 -8
- package/dist/chat/markdown.d.ts +2 -1
- package/dist/chat/markdown.d.ts.map +1 -1
- package/dist/chat/markdown.js +7 -6
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +2 -2
- package/dist/chat/messages.d.ts +1 -0
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +4 -0
- package/dist/chat/provider.d.ts +1 -1
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +62 -79
- package/dist/chat/question.d.ts +1 -1
- package/dist/chat/question.d.ts.map +1 -1
- package/dist/chat/question.js +7 -18
- package/dist/chat/ready.d.ts +1 -0
- package/dist/chat/ready.d.ts.map +1 -1
- package/dist/chat/ready.js +4 -4
- package/dist/chat/style.js +4 -4
- package/dist/client.d.ts +17 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +19 -6
- package/dist/collection.d.ts +20 -5
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +309 -33
- package/dist/connection.d.ts +31 -9
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1573 -372
- package/dist/conversation.d.ts +20 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +474 -163
- package/dist/durability.d.ts +7 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +17 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +157 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/host.d.ts +15 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +94 -12
- package/dist/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +6 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/memory.d.ts +8 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +33 -6
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -1
- package/dist/observation.d.ts +7 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +29 -12
- package/dist/outcome.d.ts +12 -2
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +4 -0
- package/dist/overlay.d.ts +3 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +62 -55
- package/dist/query.d.ts +56 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +36 -7
- package/dist/reach.d.ts +6 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +30 -5
- package/dist/react.d.ts +8 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/read-side.d.ts +16 -7
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +484 -100
- package/dist/readiness.d.ts +53 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +98 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +197 -0
- package/dist/refresh.d.ts +4 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +18 -11
- package/dist/replica.d.ts +10 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +95 -32
- package/dist/room-draft.d.ts +13 -1
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +2 -2
- package/dist/rows.d.ts +6 -13
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +10 -13
- package/dist/save.d.ts +9 -3
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +68 -22
- package/dist/search.d.ts +49 -6
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +192 -47
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +14 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +394 -0
- package/dist/status.d.ts +4 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/store.d.ts +59 -12
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +350 -86
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +64 -0
- package/dist/windows.d.ts +26 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +93 -0
- package/dist/wire.d.ts +152 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +52 -31
- package/package.json +12 -8
package/dist/query.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Definition } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { HeadChange } from './adapter.js';
|
|
3
3
|
import type { BinaryFileRecord } from './binary.js';
|
|
4
|
+
import type { Open } from './open.js';
|
|
4
5
|
export type Value = string | number | boolean | null;
|
|
5
6
|
export type Predicate = Value | {
|
|
6
7
|
$eq: Value;
|
|
@@ -37,6 +38,8 @@ export type Filter = {
|
|
|
37
38
|
types?: readonly string[];
|
|
38
39
|
where?: Where;
|
|
39
40
|
pathPrefix?: string;
|
|
41
|
+
folder?: string;
|
|
42
|
+
paths?: readonly string[];
|
|
40
43
|
hop?: Related & {
|
|
41
44
|
field: string;
|
|
42
45
|
};
|
|
@@ -44,7 +47,7 @@ export type Filter = {
|
|
|
44
47
|
field?: string;
|
|
45
48
|
};
|
|
46
49
|
};
|
|
47
|
-
export type Key = 'room' | 'path' | 'type' | {
|
|
50
|
+
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
48
51
|
field: string;
|
|
49
52
|
};
|
|
50
53
|
export type Select = 'all' | {
|
|
@@ -54,6 +57,7 @@ export type Select = 'all' | {
|
|
|
54
57
|
markdown?: true;
|
|
55
58
|
backlinks?: true;
|
|
56
59
|
change?: true;
|
|
60
|
+
fileId?: true;
|
|
57
61
|
};
|
|
58
62
|
export type OrderOptions = {
|
|
59
63
|
nulls?: 'first' | 'last';
|
|
@@ -69,6 +73,8 @@ export type DocumentQuery = Filter & {
|
|
|
69
73
|
direction?: Direction;
|
|
70
74
|
} & OrderOptions)[];
|
|
71
75
|
limit?: number;
|
|
76
|
+
after?: string;
|
|
77
|
+
total?: true;
|
|
72
78
|
};
|
|
73
79
|
export type GroupQuery = Filter & {
|
|
74
80
|
groupBy: readonly Exclude<Key, 'path'>[];
|
|
@@ -77,6 +83,8 @@ export type GroupQuery = Filter & {
|
|
|
77
83
|
direction?: Direction;
|
|
78
84
|
}[];
|
|
79
85
|
limit?: number;
|
|
86
|
+
after?: string;
|
|
87
|
+
total?: true;
|
|
80
88
|
};
|
|
81
89
|
export type LocalQuery = DocumentQuery | GroupQuery;
|
|
82
90
|
export type Backlink = {
|
|
@@ -94,19 +102,49 @@ export type QueryDocument = {
|
|
|
94
102
|
markdown?: string;
|
|
95
103
|
backlinks?: readonly Backlink[];
|
|
96
104
|
change?: HeadChange | null;
|
|
105
|
+
fileId?: string | null;
|
|
97
106
|
binaryFile?: BinaryFileRecord;
|
|
98
107
|
};
|
|
99
108
|
export type QueryGroup = {
|
|
100
109
|
key: readonly unknown[];
|
|
101
110
|
count: number;
|
|
102
111
|
};
|
|
103
|
-
export type
|
|
112
|
+
export type CoveredRoom = {
|
|
113
|
+
room: string;
|
|
114
|
+
generation: string;
|
|
115
|
+
current: boolean;
|
|
116
|
+
};
|
|
117
|
+
export type QueryCoverage = {
|
|
118
|
+
rooms: readonly CoveredRoom[];
|
|
119
|
+
indexes: readonly string[];
|
|
120
|
+
overlay: readonly string[];
|
|
121
|
+
};
|
|
122
|
+
export type Awaits = Open<'acquisition' | 'preparation' | 'index'>;
|
|
123
|
+
export type PendingRoom = {
|
|
124
|
+
room: string;
|
|
125
|
+
awaits: Awaits;
|
|
126
|
+
};
|
|
127
|
+
export type PendingResult = {
|
|
128
|
+
pending: readonly PendingRoom[];
|
|
129
|
+
};
|
|
130
|
+
export type DocumentRows = {
|
|
104
131
|
documents: readonly QueryDocument[];
|
|
132
|
+
next?: string;
|
|
133
|
+
total?: number;
|
|
105
134
|
};
|
|
106
|
-
export type
|
|
135
|
+
export type GroupRows = {
|
|
107
136
|
groups: readonly QueryGroup[];
|
|
137
|
+
next?: string;
|
|
138
|
+
total?: number;
|
|
139
|
+
};
|
|
140
|
+
export type QueryRows = DocumentRows | GroupRows;
|
|
141
|
+
export type DocumentResult = DocumentRows & {
|
|
142
|
+
coverage: QueryCoverage;
|
|
143
|
+
};
|
|
144
|
+
export type GroupResult = GroupRows & {
|
|
145
|
+
coverage: QueryCoverage;
|
|
108
146
|
};
|
|
109
|
-
export type QueryResult = DocumentResult | GroupResult;
|
|
147
|
+
export type QueryResult = DocumentResult | GroupResult | PendingResult;
|
|
110
148
|
export type QueryErrorCode = 'invalid-query' | 'unknown-type' | 'unknown-field' | 'wrong-kind';
|
|
111
149
|
export type RoomFacts = {
|
|
112
150
|
locator: string;
|
|
@@ -161,6 +199,8 @@ export type KeyPlan = {
|
|
|
161
199
|
of: 'path';
|
|
162
200
|
} | {
|
|
163
201
|
of: 'type';
|
|
202
|
+
} | {
|
|
203
|
+
of: 'folder';
|
|
164
204
|
} | {
|
|
165
205
|
of: 'field';
|
|
166
206
|
field: string;
|
|
@@ -173,6 +213,7 @@ export type DocumentShape = {
|
|
|
173
213
|
markdown: boolean;
|
|
174
214
|
backlinks: boolean;
|
|
175
215
|
change: boolean;
|
|
216
|
+
fileId: boolean;
|
|
176
217
|
orderBy: readonly {
|
|
177
218
|
key: KeyPlan;
|
|
178
219
|
options: OrderOptions & {
|
|
@@ -192,10 +233,17 @@ export type PlanReach = {
|
|
|
192
233
|
rooms: readonly string[];
|
|
193
234
|
documents: readonly string[];
|
|
194
235
|
};
|
|
236
|
+
export type Continuation = {
|
|
237
|
+
text: string;
|
|
238
|
+
values: readonly unknown[] | null;
|
|
239
|
+
};
|
|
195
240
|
export type Plan = {
|
|
241
|
+
key: string;
|
|
196
242
|
rooms: readonly string[] | null;
|
|
197
243
|
reach: PlanReach | null;
|
|
198
244
|
root: Scope;
|
|
245
|
+
folder: string | null;
|
|
246
|
+
paths: readonly string[] | null;
|
|
199
247
|
hop: (Scope & {
|
|
200
248
|
field: string;
|
|
201
249
|
}) | null;
|
|
@@ -204,6 +252,8 @@ export type Plan = {
|
|
|
204
252
|
}) | null;
|
|
205
253
|
shape: DocumentShape | GroupShape;
|
|
206
254
|
limit: number | null;
|
|
255
|
+
after: Continuation | null;
|
|
256
|
+
total: boolean;
|
|
207
257
|
};
|
|
208
258
|
export declare class QueryError extends Error {
|
|
209
259
|
readonly code: QueryErrorCode;
|
|
@@ -214,9 +264,11 @@ type Entries = Readonly<Record<string, unknown>>;
|
|
|
214
264
|
export declare function invalid(at: string, problem: string): never;
|
|
215
265
|
export declare function plain(value: unknown): value is Entries;
|
|
216
266
|
export declare function known(value: Entries, allowed: readonly string[], at: string): void;
|
|
267
|
+
export declare function flag(input: unknown, at: string): boolean;
|
|
217
268
|
export declare function planOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
218
269
|
export declare function limitOf(input: unknown): number | null;
|
|
219
270
|
export declare function filterOf(input: unknown, facts: HeldRooms, reach?: PlanReach | null): Plan;
|
|
271
|
+
export declare function queryKey(query: unknown): string;
|
|
220
272
|
export declare function identityOf(plan: Plan): string;
|
|
221
273
|
export {};
|
|
222
274
|
//# sourceMappingURL=query.d.ts.map
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAErD,MAAM,MAAM,SAAS,GACjB,KAAK,GACL;IAAE,GAAG,EAAE,KAAK,CAAA;CAAE,GACd;IAAE,GAAG,EAAE,KAAK,CAAA;CAAE,GACd;IAAE,GAAG,EAAE,SAAS,KAAK,EAAE,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,SAAS,KAAK,EAAE,CAAA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AE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,QAI3E;AA6VD,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAIxD;AAiED,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,GAAE,SAAS,GAAG,IAAW,GAAG,IAAI,CA4B7F;AAWD,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAMrD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,GAAE,SAAS,GAAG,IAAW,GAAG,IAAI,CAI/F;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAaD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C"}
|
package/dist/query.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pointerFacts, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { referenceField } from './model.js';
|
|
3
3
|
import { normalize } from './paths.js';
|
|
4
|
+
import { decodedCursor } from './windows.js';
|
|
4
5
|
export class QueryError extends Error {
|
|
5
6
|
code;
|
|
6
7
|
retryable = false;
|
|
@@ -11,9 +12,9 @@ export class QueryError extends Error {
|
|
|
11
12
|
}
|
|
12
13
|
const RANGE = ['$gt', '$gte', '$lt', '$lte'];
|
|
13
14
|
const SINGLE = ['$eq', '$ne', '$in', '$nin', '$all', '$size', '$exists'];
|
|
14
|
-
const FILTER = ['rooms', 'types', 'where', 'pathPrefix', 'hop', 'backlinks'];
|
|
15
|
+
const FILTER = ['rooms', 'types', 'where', 'pathPrefix', 'folder', 'paths', 'hop', 'backlinks'];
|
|
15
16
|
const RELATED = ['types', 'where', 'pathPrefix', 'field'];
|
|
16
|
-
const PARTS = ['fields', 'sections', 'preamble', 'markdown', 'backlinks', 'change'];
|
|
17
|
+
const PARTS = ['fields', 'sections', 'preamble', 'markdown', 'backlinks', 'change', 'fileId'];
|
|
17
18
|
const ORDER = ['by', 'direction', 'nulls', 'stringSort', 'locale', 'localeOptions'];
|
|
18
19
|
const CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
19
20
|
const STRAY_ESCAPE = /~(?![01])/u;
|
|
@@ -60,6 +61,13 @@ function names(input, at) {
|
|
|
60
61
|
invalid(at, 'expects a list of names');
|
|
61
62
|
return [...new Set(listed)].sort();
|
|
62
63
|
}
|
|
64
|
+
function pathsOf(input) {
|
|
65
|
+
const listed = list(input, 'paths');
|
|
66
|
+
if (listed.some((item) => typeof item !== 'string' || item === '' || normalize(item) !== item)) {
|
|
67
|
+
invalid('paths', 'expects a list of Paths');
|
|
68
|
+
}
|
|
69
|
+
return [...new Set(listed)].sort();
|
|
70
|
+
}
|
|
63
71
|
function directory(input, at) {
|
|
64
72
|
if (typeof input !== 'string' || normalize(input) !== input) {
|
|
65
73
|
invalid(at, 'expects a normalized directory');
|
|
@@ -279,15 +287,16 @@ function backlinksOf(facts, rooms, input) {
|
|
|
279
287
|
return { types, where, pathPrefix, field };
|
|
280
288
|
}
|
|
281
289
|
function keyPlan(typed, input, at, path) {
|
|
282
|
-
if (input === 'room' || input === 'type' || (path && input === 'path'))
|
|
290
|
+
if (input === 'room' || input === 'type' || input === 'folder' || (path && input === 'path')) {
|
|
283
291
|
return { of: input };
|
|
292
|
+
}
|
|
284
293
|
if (plain(input) && Object.hasOwn(input, 'field') && Object.keys(input).length === 1) {
|
|
285
294
|
if (specs(typed, input.field, place(at, 'field')).some(several)) {
|
|
286
295
|
invalid(place(at, 'field'), 'a path that can hold several values');
|
|
287
296
|
}
|
|
288
297
|
return { of: 'field', field: input.field };
|
|
289
298
|
}
|
|
290
|
-
return invalid(at, path ? 'expects room, path, type or a field' : 'expects room, type or a field');
|
|
299
|
+
return invalid(at, path ? 'expects room, path, type, folder or a field' : 'expects room, type, folder or a field');
|
|
291
300
|
}
|
|
292
301
|
function direction(input, at) {
|
|
293
302
|
if (input === undefined)
|
|
@@ -349,7 +358,7 @@ function parts(typed, input, at, fields) {
|
|
|
349
358
|
});
|
|
350
359
|
return named;
|
|
351
360
|
}
|
|
352
|
-
function flag(input, at) {
|
|
361
|
+
export function flag(input, at) {
|
|
353
362
|
if (input === undefined)
|
|
354
363
|
return false;
|
|
355
364
|
if (input !== true)
|
|
@@ -377,6 +386,7 @@ function documentShape(typed, input) {
|
|
|
377
386
|
markdown: true,
|
|
378
387
|
backlinks: true,
|
|
379
388
|
change: true,
|
|
389
|
+
fileId: true,
|
|
380
390
|
orderBy,
|
|
381
391
|
};
|
|
382
392
|
}
|
|
@@ -391,6 +401,7 @@ function documentShape(typed, input) {
|
|
|
391
401
|
markdown: flag(select.markdown, 'select.markdown'),
|
|
392
402
|
backlinks: flag(select.backlinks, 'select.backlinks'),
|
|
393
403
|
change: flag(select.change, 'select.change'),
|
|
404
|
+
fileId: flag(select.fileId, 'select.fileId'),
|
|
394
405
|
orderBy,
|
|
395
406
|
};
|
|
396
407
|
}
|
|
@@ -421,20 +432,35 @@ export function planOf(input, facts, reach = null) {
|
|
|
421
432
|
invalid('select', 'a grouped query selects nothing');
|
|
422
433
|
if (!grouped && input.select === undefined)
|
|
423
434
|
invalid('select', 'a Document query must select');
|
|
424
|
-
known(input, [...FILTER, 'orderBy', 'limit', grouped ? 'groupBy' : 'select'], '');
|
|
435
|
+
known(input, [...FILTER, 'orderBy', 'limit', 'after', 'total', grouped ? 'groupBy' : 'select'], '');
|
|
425
436
|
const limit = limitOf(input.limit);
|
|
426
437
|
const rooms = input.rooms === undefined ? null : names(input.rooms, 'rooms');
|
|
427
438
|
const { typed, ...root } = scope(facts, rooms, input, '');
|
|
439
|
+
const shape = grouped ? groupShape(typed, input) : documentShape(typed, input);
|
|
428
440
|
return {
|
|
441
|
+
key: queryKey(input),
|
|
429
442
|
rooms,
|
|
430
443
|
reach,
|
|
431
444
|
root,
|
|
445
|
+
folder: input.folder === undefined ? null : directory(input.folder, 'folder'),
|
|
446
|
+
paths: input.paths === undefined ? null : pathsOf(input.paths),
|
|
432
447
|
hop: input.hop === undefined ? null : hopOf(facts, rooms, typed, input.hop),
|
|
433
448
|
backlinks: input.backlinks === undefined ? null : backlinksOf(facts, rooms, input.backlinks),
|
|
434
|
-
shape
|
|
449
|
+
shape,
|
|
435
450
|
limit,
|
|
451
|
+
after: continuationOf(input.after, shape.orderBy.length + 1),
|
|
452
|
+
total: flag(input.total, 'total'),
|
|
436
453
|
};
|
|
437
454
|
}
|
|
455
|
+
function continuationOf(input, arity) {
|
|
456
|
+
if (input === undefined)
|
|
457
|
+
return null;
|
|
458
|
+
const values = typeof input === 'string' ? decodedCursor(input) : null;
|
|
459
|
+
if (values === null || (values.length !== 0 && values.length !== arity)) {
|
|
460
|
+
invalid('after', 'expects the next an earlier result of this query returned');
|
|
461
|
+
}
|
|
462
|
+
return { text: input, values: values.length === 0 ? null : values };
|
|
463
|
+
}
|
|
438
464
|
export function limitOf(input) {
|
|
439
465
|
if (input === undefined)
|
|
440
466
|
return null;
|
|
@@ -449,6 +475,9 @@ export function filterOf(input, facts, reach = null) {
|
|
|
449
475
|
known(input, FILTER, '');
|
|
450
476
|
return planOf({ ...input, select: {} }, facts, reach);
|
|
451
477
|
}
|
|
478
|
+
export function queryKey(query) {
|
|
479
|
+
return canonical(query);
|
|
480
|
+
}
|
|
452
481
|
function canonical(value) {
|
|
453
482
|
if (Array.isArray(value))
|
|
454
483
|
return `[${value.map(canonical).join(',')}]`;
|
package/dist/reach.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReferrerScope } from './adapter.js';
|
|
2
|
-
import type { MdRuntime, RuntimeTopic } from './connection.js';
|
|
2
|
+
import type { MdRuntime, ReadinessPort, RuntimeTopic } from './connection.js';
|
|
3
3
|
import type { Plan, PlanReach, QueryResult } from './query.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Readiness } from './readiness.js';
|
|
5
|
+
import { type SearchResult } from './search.js';
|
|
5
6
|
export type ReachedDocument = {
|
|
6
7
|
readonly room: string;
|
|
7
8
|
readonly path: string;
|
|
@@ -19,12 +20,14 @@ export type RuntimeView = {
|
|
|
19
20
|
};
|
|
20
21
|
export type NarrowedView = RuntimeView & {
|
|
21
22
|
narrow(reach: PortReach | null): void;
|
|
23
|
+
facts(port: ReadinessPort): void;
|
|
22
24
|
};
|
|
23
25
|
export type Reachable = RuntimeView & {
|
|
24
26
|
plan(input: unknown, reach: PortReach | null): Plan;
|
|
25
27
|
query(plan: Plan): Promise<QueryResult>;
|
|
26
28
|
watchPlan(plan: Plan, deliver: (message: unknown) => void): () => void;
|
|
27
29
|
search(input: unknown, reach: PortReach | null): Promise<SearchResult>;
|
|
30
|
+
watchReadiness(port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
28
31
|
referrerScope(referrer: unknown): ReferrerScope | null;
|
|
29
32
|
};
|
|
30
33
|
export declare function holds(reach: PortReach | null, room: string): boolean;
|
|
@@ -38,5 +41,5 @@ export declare function governs(reach: PortReach | null, room: {
|
|
|
38
41
|
readonly selection: boolean;
|
|
39
42
|
};
|
|
40
43
|
export declare function planReach(reach: PortReach | null): PlanReach | null;
|
|
41
|
-
export declare function narrowed(runtime: Reachable, given: PortReach | null): NarrowedView;
|
|
44
|
+
export declare function narrowed(runtime: Reachable, given: PortReach | null, told: ReadinessPort): NarrowedView;
|
|
42
45
|
//# sourceMappingURL=reach.d.ts.map
|
package/dist/reach.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reach.d.ts","sourceRoot":"","sources":["../src/reach.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"reach.d.ts","sourceRoot":"","sources":["../src/reach.ts"],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ist/reach.js
CHANGED
|
@@ -7,6 +7,7 @@ import { beneath } from './paths.js';
|
|
|
7
7
|
import { reconciled } from './read-side.js';
|
|
8
8
|
import { moveTarget, readParts, staleWrite, } from './room-draft.js';
|
|
9
9
|
import { documentKey } from './rows.js';
|
|
10
|
+
import { undeclaredSearch } from './search.js';
|
|
10
11
|
const UNHELD_TYPES = { collection: modelTypes(NO_MODEL), typedSelection: null };
|
|
11
12
|
function unconversed(name) {
|
|
12
13
|
return () => Promise.resolve(undeclared(name));
|
|
@@ -24,6 +25,7 @@ const NO_CONVERSATION = {
|
|
|
24
25
|
};
|
|
25
26
|
const NO_CHAT_DRAFT = {
|
|
26
27
|
write: () => Promise.resolve(),
|
|
28
|
+
prepend: () => Promise.resolve(),
|
|
27
29
|
discard: () => Promise.resolve(),
|
|
28
30
|
};
|
|
29
31
|
export function holds(reach, room) {
|
|
@@ -122,7 +124,7 @@ function savedWithin(reach, room, result) {
|
|
|
122
124
|
function statusWithin(reach, status) {
|
|
123
125
|
return {
|
|
124
126
|
...status,
|
|
125
|
-
attentionRequired: status.attentionRequired.filter((entry) => covers(reach, entry.room, entry.path)),
|
|
127
|
+
attentionRequired: status.attentionRequired.filter((entry) => 'refusal' in entry ? wholly(reach, entry.room) : covers(reach, entry.room, entry.path)),
|
|
126
128
|
};
|
|
127
129
|
}
|
|
128
130
|
function queueWithin(reach, room, entries) {
|
|
@@ -132,9 +134,10 @@ function queueWithin(reach, room, entries) {
|
|
|
132
134
|
function unreached(room) {
|
|
133
135
|
return runtimeError('room-not-held', `No Local Replica for ${room}`);
|
|
134
136
|
}
|
|
135
|
-
export function narrowed(runtime, given) {
|
|
137
|
+
export function narrowed(runtime, given, told) {
|
|
136
138
|
const { md, watch } = runtime;
|
|
137
139
|
let reach = given;
|
|
140
|
+
let port = told;
|
|
138
141
|
const open = new Set();
|
|
139
142
|
function following(begin) {
|
|
140
143
|
let stop = begin();
|
|
@@ -152,6 +155,9 @@ export function narrowed(runtime, given) {
|
|
|
152
155
|
if (topic === 'rooms') {
|
|
153
156
|
return following(() => watch(topic, input, (rooms) => deliver(roomsWithin(reach, rooms))));
|
|
154
157
|
}
|
|
158
|
+
if (topic === 'readiness') {
|
|
159
|
+
return following(() => runtime.watchReadiness(port, reach, deliver));
|
|
160
|
+
}
|
|
155
161
|
if (topic === 'sync-status') {
|
|
156
162
|
return following(() => watch(topic, input, (status) => deliver(statusWithin(reach, status))));
|
|
157
163
|
}
|
|
@@ -189,7 +195,7 @@ export function narrowed(runtime, given) {
|
|
|
189
195
|
if (next === null)
|
|
190
196
|
return;
|
|
191
197
|
held = next.keyed;
|
|
192
|
-
deliver(next.
|
|
198
|
+
deliver(next.message);
|
|
193
199
|
});
|
|
194
200
|
});
|
|
195
201
|
}
|
|
@@ -217,7 +223,9 @@ export function narrowed(runtime, given) {
|
|
|
217
223
|
...md,
|
|
218
224
|
rooms: () => roomsWithin(reach, md.rooms()),
|
|
219
225
|
query: ((input) => runtime.query(runtime.plan(input, reach))),
|
|
220
|
-
search: (input) =>
|
|
226
|
+
search: (input) => port.search === 'required'
|
|
227
|
+
? runtime.search(input, reach)
|
|
228
|
+
: Promise.resolve(undeclaredSearch()),
|
|
221
229
|
types(room) {
|
|
222
230
|
if (wholly(reach, room))
|
|
223
231
|
return md.types(room);
|
|
@@ -236,6 +244,14 @@ export function narrowed(runtime, given) {
|
|
|
236
244
|
}
|
|
237
245
|
return savedWithin(reach, room, await md.save(room, roomDrafts, writtenBy));
|
|
238
246
|
},
|
|
247
|
+
async saveParts(room, parts, writtenBy) {
|
|
248
|
+
if (!holds(reach, room))
|
|
249
|
+
throw unreached(room);
|
|
250
|
+
if (parts.some(({ path, parts: one }) => !covers(reach, room, path) || !moves(reach, room, readParts(one).move))) {
|
|
251
|
+
throw unreached(room);
|
|
252
|
+
}
|
|
253
|
+
return savedWithin(reach, room, await md.saveParts(room, parts, writtenBy));
|
|
254
|
+
},
|
|
239
255
|
history: (room, path, query) => covers(reach, room, path)
|
|
240
256
|
? md.history(room, path, query)
|
|
241
257
|
: Promise.resolve(failure({ kind: 'room-not-readable', locator: room })),
|
|
@@ -243,6 +259,9 @@ export function narrowed(runtime, given) {
|
|
|
243
259
|
read: (room, path, revision) => covers(reach, room, path)
|
|
244
260
|
? md.binaryFile.read(room, path, revision)
|
|
245
261
|
: Promise.resolve(failure({ kind: 'room-not-readable', locator: room })),
|
|
262
|
+
link: (room, path, revision) => covers(reach, room, path)
|
|
263
|
+
? md.binaryFile.link(room, path, revision)
|
|
264
|
+
: Promise.resolve(failure({ kind: 'room-not-readable', locator: room })),
|
|
246
265
|
readReference: (reference) => refers(reach, runtime.referrerScope(reference.referrer))
|
|
247
266
|
? md.binaryFile.readReference(reference)
|
|
248
267
|
: Promise.resolve(unreachedReference(reference.fileRef)),
|
|
@@ -269,7 +288,7 @@ export function narrowed(runtime, given) {
|
|
|
269
288
|
list: () => conversation().list(),
|
|
270
289
|
read: (id, options) => conversation().read(id, options),
|
|
271
290
|
create: (input) => conversation().create(input),
|
|
272
|
-
send: (id) => conversation().send(id),
|
|
291
|
+
send: (id, operation, draft) => conversation().send(id, operation, draft),
|
|
273
292
|
answer: (id, answer) => conversation().answer(id, answer),
|
|
274
293
|
interrupt: (id) => conversation().interrupt(id),
|
|
275
294
|
kill: (id) => conversation().kill(id),
|
|
@@ -278,6 +297,7 @@ export function narrowed(runtime, given) {
|
|
|
278
297
|
},
|
|
279
298
|
chatDraft: {
|
|
280
299
|
write: (id, draft, revision) => chatDraft().write(id, draft, revision),
|
|
300
|
+
prepend: (id, draft) => chatDraft().prepend(id, draft),
|
|
281
301
|
discard: (id) => chatDraft().discard(id),
|
|
282
302
|
},
|
|
283
303
|
observe: observing(within),
|
|
@@ -290,5 +310,10 @@ export function narrowed(runtime, given) {
|
|
|
290
310
|
for (const restart of [...open])
|
|
291
311
|
restart();
|
|
292
312
|
},
|
|
313
|
+
facts(next) {
|
|
314
|
+
port = next;
|
|
315
|
+
for (const restart of [...open])
|
|
316
|
+
restart();
|
|
317
|
+
},
|
|
293
318
|
};
|
|
294
319
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import type { AppRoom, ConnectionRefusal, SaveResult } from './connection.js';
|
|
2
|
+
import type { AppRoom, ConnectionRefusal, SavedRoomDraft, SaveResult } from './connection.js';
|
|
3
3
|
import type { Member, ServiceMode } from './adapter.js';
|
|
4
4
|
import type { ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
5
5
|
import { type RuntimeError } from './failure.js';
|
|
6
6
|
import type { QueueEntry } from './outcome.js';
|
|
7
|
-
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult } from './query.js';
|
|
7
|
+
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult, PendingResult } from './query.js';
|
|
8
|
+
import type { Readiness } from './readiness.js';
|
|
8
9
|
import type { RoomDraft, RoomDraftParts } from './room-draft.js';
|
|
9
10
|
import type { SyncStatus } from './status.js';
|
|
10
11
|
type Client = MdRuntimeClient | null;
|
|
@@ -16,13 +17,14 @@ export type Observed<T> = {
|
|
|
16
17
|
};
|
|
17
18
|
export declare function useObserve(client: Client, topic: 'deployment-facts'): Observed<unknown>;
|
|
18
19
|
export declare function useObserve(client: Client, topic: 'rooms'): Observed<readonly AppRoom[]>;
|
|
20
|
+
export declare function useObserve(client: Client, topic: 'readiness'): Observed<Readiness>;
|
|
19
21
|
export declare function useObserve(client: Client, topic: 'connection-refusal'): Observed<ConnectionRefusal | null>;
|
|
20
22
|
export declare function useObserve(client: Client, topic: 'storage-loss'): Observed<string | null>;
|
|
21
23
|
export declare function useObserve(client: Client, topic: 'sync-status'): Observed<SyncStatus>;
|
|
22
24
|
export declare function useObserve(client: Client, topic: 'service-mode'): Observed<ServiceMode>;
|
|
23
25
|
export declare function useObserve(client: Client, topic: 'member'): Observed<Member | null>;
|
|
24
|
-
export declare function useObserve(client: Client, topic: 'query', query: DocumentQuery): Observed<DocumentResult>;
|
|
25
|
-
export declare function useObserve(client: Client, topic: 'query', query: GroupQuery): Observed<GroupResult>;
|
|
26
|
+
export declare function useObserve(client: Client, topic: 'query', query: DocumentQuery): Observed<DocumentResult | PendingResult>;
|
|
27
|
+
export declare function useObserve(client: Client, topic: 'query', query: GroupQuery): Observed<GroupResult | PendingResult>;
|
|
26
28
|
export declare function useObserve(client: Client, topic: 'queue', locator: string): Observed<readonly QueueEntry[]>;
|
|
27
29
|
export declare function useObserve(client: Client, topic: 'room-drafts'): Observed<readonly RoomDraft[]>;
|
|
28
30
|
export declare function useObserve(client: Client, topic: 'presentation'): Observed<unknown>;
|
|
@@ -33,9 +35,9 @@ export type Saving = {
|
|
|
33
35
|
readonly busy: boolean;
|
|
34
36
|
readonly outcome: SaveResult | null;
|
|
35
37
|
readonly failure: RuntimeError | null;
|
|
36
|
-
save(room: string,
|
|
38
|
+
save(room: string, parts: ReadonlyMap<string, RoomDraftParts>): Promise<SaveResult>;
|
|
39
|
+
saveWritten(room: string, roomDrafts: readonly SavedRoomDraft[]): Promise<SaveResult>;
|
|
37
40
|
};
|
|
38
|
-
export declare function saveRoomDrafts(client: MdRuntimeClient, room: string, roomDrafts: ReadonlyMap<string, RoomDraftParts>): Promise<SaveResult>;
|
|
39
41
|
export declare function useSave(client: MdRuntimeClient): Saving;
|
|
40
42
|
export {};
|
|
41
43
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC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AU,CACxB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,EACrB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,mBAAmB,GAC3B,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAC9B,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,GACrB,QAAQ,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC;AAC1C,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC;AAsCpG,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IACtC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACvF,CAAC;AAMF,wBAAgB,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CA8BvD"}
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
-
import { failed
|
|
2
|
+
import { failed } from './failure.js';
|
|
3
3
|
const LOADING = { state: 'loading' };
|
|
4
4
|
export function useObserve(client, topic, ...input) {
|
|
5
5
|
const key = JSON.stringify([topic, ...input]);
|
|
@@ -33,24 +33,12 @@ export function useObserve(client, topic, ...input) {
|
|
|
33
33
|
return held !== null && held.client === client && held.key === key ? held.observed : LOADING;
|
|
34
34
|
}
|
|
35
35
|
const IDLE = { busy: false, outcome: null, failure: null };
|
|
36
|
-
export async function saveRoomDrafts(client, room, roomDrafts) {
|
|
37
|
-
const kept = [];
|
|
38
|
-
for (const [path, parts] of roomDrafts) {
|
|
39
|
-
const prior = await client.roomDraft.read(room, path);
|
|
40
|
-
const write = await client.roomDraft.write(room, path, prior?.revision ?? null, parts);
|
|
41
|
-
if (write.outcome !== 'written' || write.roomDraft === null) {
|
|
42
|
-
throw runtimeError(write.outcome === 'stale' ? write.code : 'room-draft-unwritten', `the Room Draft at ${path} was not written`);
|
|
43
|
-
}
|
|
44
|
-
kept.push({ path, revision: write.roomDraft.revision });
|
|
45
|
-
}
|
|
46
|
-
return client.save(room, kept);
|
|
47
|
-
}
|
|
48
36
|
export function useSave(client) {
|
|
49
37
|
const [state, setState] = useState(IDLE);
|
|
50
|
-
const
|
|
38
|
+
const settled = useCallback(async (saving) => {
|
|
51
39
|
setState({ busy: true, outcome: null, failure: null });
|
|
52
40
|
try {
|
|
53
|
-
const outcome = await
|
|
41
|
+
const outcome = await saving();
|
|
54
42
|
setState({ busy: false, outcome, failure: null });
|
|
55
43
|
return outcome;
|
|
56
44
|
}
|
|
@@ -59,6 +47,8 @@ export function useSave(client) {
|
|
|
59
47
|
setState({ busy: false, outcome: null, failure });
|
|
60
48
|
throw failure;
|
|
61
49
|
}
|
|
62
|
-
}, [
|
|
63
|
-
|
|
50
|
+
}, []);
|
|
51
|
+
const save = useCallback((room, parts) => settled(() => client.saveParts(room, [...parts].map(([path, one]) => ({ path, parts: one })))), [client, settled]);
|
|
52
|
+
const saveWritten = useCallback((room, roomDrafts) => settled(() => client.save(room, roomDrafts)), [client, settled]);
|
|
53
|
+
return { ...state, save, saveWritten };
|
|
64
54
|
}
|
package/dist/read-side.d.ts
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import type { ChangeSet } from './change-set.js';
|
|
2
|
-
import { type KeyedResult, type
|
|
3
|
-
import type { Plan,
|
|
2
|
+
import { type KeyedResult, type QueryMessage } from './observation.js';
|
|
3
|
+
import type { PendingResult, Plan, QueryCoverage, QueryRows } from './query.js';
|
|
4
|
+
import { type Later } from './turn.js';
|
|
4
5
|
import type { SearchedDocument } from './search.js';
|
|
6
|
+
export type Cover = {
|
|
7
|
+
coverage: QueryCoverage;
|
|
8
|
+
} | PendingResult;
|
|
5
9
|
export type ReadSide = {
|
|
6
|
-
apply(set: ChangeSet): void
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
apply(set: ChangeSet, next?: () => void): Later<void>;
|
|
11
|
+
recover(): void;
|
|
12
|
+
settled(): Promise<void>;
|
|
13
|
+
query<T>(plan: Plan, at: () => T): Promise<{
|
|
14
|
+
rows: QueryRows;
|
|
15
|
+
at: T;
|
|
16
|
+
}>;
|
|
17
|
+
watch(plan: Plan, identity: string, cover: () => Cover, deliver: (message: QueryMessage) => void): () => void;
|
|
18
|
+
room(room: string): readonly string[];
|
|
10
19
|
document(room: string, path: string): SearchedDocument | null;
|
|
11
20
|
close(): void;
|
|
12
21
|
};
|
|
13
22
|
export declare function reconciled(previous: KeyedResult, next: KeyedResult): {
|
|
14
23
|
keyed: KeyedResult;
|
|
15
|
-
|
|
24
|
+
message: QueryMessage;
|
|
16
25
|
} | null;
|
|
17
26
|
export declare function createReadSide(): ReadSide;
|
|
18
27
|
//# sourceMappingURL=read-side.d.ts.map
|
package/dist/read-side.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-side.d.ts","sourceRoot":"","sources":["../src/read-side.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"read-side.d.ts","sourceRoot":"","sources":["../src/read-side.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,KAAK,WAAW,EAEhB,K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