@agentshouse/mdruntime 0.1.0-cae97ad2e9142 → 0.1.0-caf080a9a9c60
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/README.md +14 -14
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +318 -0
- package/dist/act-lanes.d.ts +29 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +177 -0
- package/dist/actions.d.ts +25 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +261 -0
- package/dist/adapter.d.ts +126 -107
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +29 -47
- package/dist/bootstrap.d.ts +17 -19
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +266 -135
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +4 -2
- package/dist/chat-types.d.ts +5 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +13 -0
- package/dist/client.d.ts +28 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +84 -20
- package/dist/collection.d.ts +28 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +35 -19
- package/dist/compile.d.ts +8 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +289 -332
- package/dist/connection.d.ts +6 -141
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +111 -5012
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-live.d.ts +138 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +249 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +53 -0
- package/dist/conversation.d.ts +59 -50
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +938 -832
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +153 -0
- package/dist/durability.d.ts +18 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +19 -9
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts +49 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +20 -8
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +70 -40
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +33 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/install.d.ts +54 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +539 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +279 -0
- package/dist/listing.d.ts +48 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +139 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +64 -23
- package/dist/locks.d.ts +7 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +33 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +50 -0
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +15 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +251 -98
- package/dist/messages.d.ts +24 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +92 -32
- package/dist/model.d.ts +8 -11
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +5 -22
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +156 -0
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +15 -15
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +59 -0
- package/dist/outcome.d.ts +20 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +34 -2
- package/dist/overlay.d.ts +6 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +47 -21
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +3 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +10 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +233 -0
- package/dist/presence.d.ts +52 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +220 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +285 -0
- package/dist/query.d.ts +14 -210
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +29 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +115 -0
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +465 -0
- package/dist/reach.d.ts +15 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +228 -145
- package/dist/react.d.ts +15 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +3 -18
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/reads.d.ts +38 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +163 -85
- package/dist/recovery.d.ts +3 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +57 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +35 -7
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +57 -0
- package/dist/replica.d.ts +13 -19
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +66 -35
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +24 -10
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +142 -106
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +217 -0
- package/dist/rows.d.ts +16 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +46 -174
- package/dist/runtime.d.ts +36 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +42 -84
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +349 -170
- package/dist/saves.d.ts +32 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +413 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -1
- package/dist/shared.d.ts +1 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -105
- package/dist/shown.d.ts +32 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +290 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/lanes.d.ts +21 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +80 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket/session.d.ts +38 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +68 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +171 -0
- package/dist/source.d.ts +54 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +82 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/readiness.d.ts +10 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +52 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +430 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +110 -158
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +167 -403
- package/dist/stored.d.ts +65 -59
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +356 -271
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +223 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +540 -0
- package/dist/tables.d.ts +127 -69
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +218 -105
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +63 -11
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +21 -5
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/client.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DocumentQuery, GroupQuery } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { HistoryQuery } from './actions.js';
|
|
3
|
+
import type { AppRoom } from './listing.js';
|
|
4
|
+
import type { ConnectionRefusal } from './socket.js';
|
|
5
|
+
import type { RoomSchemas } from './surface.js';
|
|
6
|
+
import type { SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
2
7
|
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
-
import type {
|
|
8
|
+
import type { UnsentWork } from './durability.js';
|
|
9
|
+
import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView } from './conversation.js';
|
|
4
10
|
import { type Observation } from './observation.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
11
|
+
import type { AttachAnswer, BinaryAnswer, CallResult, DownloadAnswer, HistoryAnswer, QueueEntry, Resolution } from './outcome.js';
|
|
12
|
+
import type { FiguresResult } from './figures.js';
|
|
13
|
+
import type { Holdings } from './holdings.js';
|
|
14
|
+
import type { DocumentResult, GroupResult, PendingResult } from './query.js';
|
|
8
15
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
9
16
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
10
17
|
import type { Readiness } from './readiness.js';
|
|
18
|
+
import type { ObservedRead } from './reads.js';
|
|
11
19
|
import type { SyncStatus } from './status.js';
|
|
12
20
|
import { type RuntimePort } from './wire.js';
|
|
21
|
+
export type BuildFile = (name: string) => Promise<Blob | null>;
|
|
13
22
|
export type MdRuntimeClient = {
|
|
23
|
+
buildFile(name: string): Promise<Blob | null>;
|
|
14
24
|
rooms(): Promise<readonly AppRoom[]>;
|
|
15
25
|
query: {
|
|
16
26
|
(query: DocumentQuery): Promise<DocumentResult | PendingResult>;
|
|
@@ -31,17 +41,8 @@ export type MdRuntimeClient = {
|
|
|
31
41
|
write(value: unknown): Promise<void>;
|
|
32
42
|
edit(members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
33
43
|
};
|
|
34
|
-
conversation: {
|
|
35
|
-
|
|
36
|
-
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
37
|
-
create(input: unknown): Promise<CallResult>;
|
|
38
|
-
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
39
|
-
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
40
|
-
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
41
|
-
interrupt(conversation: string): Promise<CallResult>;
|
|
42
|
-
kill(conversation: string): Promise<CallResult>;
|
|
43
|
-
cancel(conversation: string, turn: string): Promise<CallResult>;
|
|
44
|
-
delete(conversation: string): Promise<CallResult>;
|
|
44
|
+
conversation: ConversationSurface & {
|
|
45
|
+
pageMetadata(app: string, address: string): Promise<string>;
|
|
45
46
|
};
|
|
46
47
|
chatDraft: {
|
|
47
48
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
@@ -52,7 +53,8 @@ export type MdRuntimeClient = {
|
|
|
52
53
|
resolve(room: string, path: string, destination: string): Promise<Resolution>;
|
|
53
54
|
binaryFile: {
|
|
54
55
|
read(room: string, path: string, revision?: string): Promise<BinaryAnswer>;
|
|
55
|
-
|
|
56
|
+
attach(room: string, file: File): Promise<AttachAnswer>;
|
|
57
|
+
download(room: string, path: string, revision?: string): Promise<DownloadAnswer>;
|
|
56
58
|
};
|
|
57
59
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
58
60
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
@@ -60,6 +62,9 @@ export type MdRuntimeClient = {
|
|
|
60
62
|
persistence(): Promise<boolean>;
|
|
61
63
|
retry(): Promise<void>;
|
|
62
64
|
cleanUp(): Promise<number>;
|
|
65
|
+
unsent(): Promise<readonly UnsentWork[]>;
|
|
66
|
+
reset(): Promise<void>;
|
|
67
|
+
readAgain(): Promise<void>;
|
|
63
68
|
observe: {
|
|
64
69
|
(topic: 'deployment-facts'): Promise<Observation<unknown>>;
|
|
65
70
|
(topic: 'rooms'): Promise<Observation<readonly AppRoom[]>>;
|
|
@@ -69,6 +74,7 @@ export type MdRuntimeClient = {
|
|
|
69
74
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
70
75
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
71
76
|
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
77
|
+
(topic: 'authority-changes'): Promise<Observation<number>>;
|
|
72
78
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult | PendingResult>>;
|
|
73
79
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult | PendingResult>>;
|
|
74
80
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
@@ -77,14 +83,18 @@ export type MdRuntimeClient = {
|
|
|
77
83
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
78
84
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
79
85
|
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
86
|
+
(topic: 'figures'): Promise<Observation<FiguresResult>>;
|
|
87
|
+
(topic: 'holdings'): Promise<Observation<Holdings>>;
|
|
88
|
+
(topic: 'read', name: string, input: unknown): Promise<Observation<ObservedRead>>;
|
|
80
89
|
};
|
|
81
90
|
reauthorize(): Promise<void>;
|
|
82
91
|
settled(): Promise<void>;
|
|
83
92
|
};
|
|
84
|
-
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
93
|
+
export declare function connectMdRuntime(port: RuntimePort, buildFile?: BuildFile): MdRuntimeClient;
|
|
85
94
|
export declare function inTurn(client: MdRuntimeClient, work: () => Promise<void>): Promise<void>;
|
|
86
95
|
export { chainedWindows, type WindowAnswer, type WindowChain } from './chain.js';
|
|
87
96
|
export { roomDraftRevision } from './identity.js';
|
|
97
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
88
98
|
export type { Observation } from './observation.js';
|
|
89
99
|
export type { Open } from './open.js';
|
|
90
100
|
export { unanswered, type RuntimePort, type WireMember } from './wire.js';
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EAEjB,iBAAiB,EACjB,mBAAmB,EAEnB,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAY,KAAK,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAE7E,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EAEZ,UAAU,EACV,cAAc,EAGd,aAAa,EAEb,UAAU,EACV,UAAU,EAEX,MAAM,cAA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,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxF;AAED,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
|
+
import { shownBy } from './media.js';
|
|
2
|
+
import { pageMetadataBlock } from './page-metadata.js';
|
|
1
3
|
import { observed } from './observation.js';
|
|
2
4
|
import { runtimeError } from './failure.js';
|
|
3
|
-
import {
|
|
5
|
+
import { AUTHORIZATION_ENDED, PORT_CLOSED, wireAnswer, } from './wire.js';
|
|
4
6
|
// React renders an arrived value in a later task and opens what that render observes as it commits, so this many frames opening nothing mean the page drew what it observes.
|
|
5
7
|
const SETTLED_FRAMES = 2;
|
|
8
|
+
// A browser reads a download's address only after the click that hands it returns, so a copy's address is released a minute later.
|
|
9
|
+
const HANDED_COPY_MS = 60_000;
|
|
10
|
+
const PAGE = /\.html?$/iu;
|
|
11
|
+
const STARTED = { kind: 'started' };
|
|
12
|
+
const BLOCKED = {
|
|
13
|
+
kind: 'blocked',
|
|
14
|
+
code: 'popup-blocked',
|
|
15
|
+
fields: {},
|
|
16
|
+
retryable: true,
|
|
17
|
+
};
|
|
18
|
+
function handed(url, name) {
|
|
19
|
+
const anchor = document.createElement('a');
|
|
20
|
+
anchor.href = url;
|
|
21
|
+
anchor.download = name;
|
|
22
|
+
anchor.click();
|
|
23
|
+
}
|
|
6
24
|
function refused(refusal) {
|
|
7
|
-
return runtimeError(refusal.code
|
|
25
|
+
return runtimeError(refusal.code);
|
|
8
26
|
}
|
|
9
|
-
|
|
27
|
+
const UNBUILT = () => Promise.resolve(null);
|
|
28
|
+
export function connectMdRuntime(port, buildFile = UNBUILT) {
|
|
10
29
|
let sequence = 0;
|
|
11
30
|
let refusal = null;
|
|
12
31
|
let ended = null;
|
|
@@ -18,13 +37,13 @@ export function connectMdRuntime(port) {
|
|
|
18
37
|
const send = (message) => {
|
|
19
38
|
port.postMessage(message);
|
|
20
39
|
};
|
|
21
|
-
function begin(id, topic, first) {
|
|
40
|
+
function begin(id, topic, input, first) {
|
|
22
41
|
const handle = observed(first, () => {
|
|
23
42
|
observations.delete(id);
|
|
24
43
|
if (refusal === null)
|
|
25
44
|
send({ kind: 'stop', id });
|
|
26
45
|
}, topic === 'query');
|
|
27
|
-
observations.set(id, { topic, handle });
|
|
46
|
+
observations.set(id, { topic, input, handle });
|
|
28
47
|
return handle.observation;
|
|
29
48
|
}
|
|
30
49
|
function refuse(reported) {
|
|
@@ -36,7 +55,7 @@ export function connectMdRuntime(port) {
|
|
|
36
55
|
const failure = refused(reported);
|
|
37
56
|
for (const [id, waiting] of opening) {
|
|
38
57
|
if (waiting.topic === 'connection-refusal')
|
|
39
|
-
waiting.settle(begin(id, waiting.topic, reported));
|
|
58
|
+
waiting.settle(begin(id, waiting.topic, waiting.input, reported));
|
|
40
59
|
else
|
|
41
60
|
waiting.fail(failure);
|
|
42
61
|
}
|
|
@@ -62,7 +81,7 @@ export function connectMdRuntime(port) {
|
|
|
62
81
|
drawing?.();
|
|
63
82
|
}
|
|
64
83
|
port.addEventListener('message', (event) => {
|
|
65
|
-
const message =
|
|
84
|
+
const message = wireAnswer(event.data);
|
|
66
85
|
if (message === null)
|
|
67
86
|
return;
|
|
68
87
|
if (message.kind === 'refusal') {
|
|
@@ -88,7 +107,7 @@ export function connectMdRuntime(port) {
|
|
|
88
107
|
waiting.fail(runtimeError(message.code, message.message, message.retryable));
|
|
89
108
|
}
|
|
90
109
|
else
|
|
91
|
-
waiting.settle(begin(message.id, waiting.topic, message.value));
|
|
110
|
+
waiting.settle(begin(message.id, waiting.topic, waiting.input, message.value));
|
|
92
111
|
drawing?.();
|
|
93
112
|
return;
|
|
94
113
|
}
|
|
@@ -124,11 +143,11 @@ export function connectMdRuntime(port) {
|
|
|
124
143
|
const id = (sequence += 1);
|
|
125
144
|
if (refusal !== null) {
|
|
126
145
|
return topic === 'connection-refusal'
|
|
127
|
-
? Promise.resolve(begin(id, topic, refusal))
|
|
146
|
+
? Promise.resolve(begin(id, topic, input, refusal))
|
|
128
147
|
: Promise.reject(refused(refusal));
|
|
129
148
|
}
|
|
130
149
|
return new Promise((settle, fail) => {
|
|
131
|
-
opening.set(id, { topic, settle, fail });
|
|
150
|
+
opening.set(id, { topic, input, settle, fail });
|
|
132
151
|
send({ kind: 'observe', id, topic, input });
|
|
133
152
|
drawing?.();
|
|
134
153
|
});
|
|
@@ -156,6 +175,34 @@ export function connectMdRuntime(port) {
|
|
|
156
175
|
}, { highWaterMark: 0 });
|
|
157
176
|
return { kind: 'binary', stream, byteLength, mediaType };
|
|
158
177
|
}
|
|
178
|
+
async function download(room, path, revision) {
|
|
179
|
+
const tab = PAGE.test(path) ? globalThis.open('', '_blank') : null;
|
|
180
|
+
const linked = await ask('binaryFile.link', [room, path, revision]);
|
|
181
|
+
if (linked.kind === 'link' && PAGE.test(linked.name)) {
|
|
182
|
+
const away = tab ?? globalThis.open('', '_blank');
|
|
183
|
+
if (away === null)
|
|
184
|
+
return BLOCKED;
|
|
185
|
+
away.location.replace(linked.url);
|
|
186
|
+
return STARTED;
|
|
187
|
+
}
|
|
188
|
+
tab?.close();
|
|
189
|
+
if (linked.kind === 'link') {
|
|
190
|
+
handed(linked.url, linked.name);
|
|
191
|
+
return STARTED;
|
|
192
|
+
}
|
|
193
|
+
if (linked.kind !== 'absent')
|
|
194
|
+
return linked;
|
|
195
|
+
const read = streamed(await ask('binaryFile.read', [room, path, revision]));
|
|
196
|
+
if (read.kind !== 'binary')
|
|
197
|
+
return read;
|
|
198
|
+
const copy = await new Response(read.stream, {
|
|
199
|
+
headers: { 'content-type': read.mediaType },
|
|
200
|
+
}).blob();
|
|
201
|
+
const url = URL.createObjectURL(copy);
|
|
202
|
+
handed(url, path.slice(path.lastIndexOf('/') + 1));
|
|
203
|
+
setTimeout(() => URL.revokeObjectURL(url), HANDED_COPY_MS);
|
|
204
|
+
return STARTED;
|
|
205
|
+
}
|
|
159
206
|
function settled() {
|
|
160
207
|
if (settling !== null)
|
|
161
208
|
return settling;
|
|
@@ -185,7 +232,9 @@ export function connectMdRuntime(port) {
|
|
|
185
232
|
});
|
|
186
233
|
return settling;
|
|
187
234
|
}
|
|
188
|
-
|
|
235
|
+
const show = (room, path, revision) => ask('binaryFile.show', [room, path, revision]).then((shown) => streamed(shown));
|
|
236
|
+
return shownBy(show, {
|
|
237
|
+
buildFile,
|
|
189
238
|
rooms: () => ask('rooms', []),
|
|
190
239
|
query: ((query) => ask('query', [query])),
|
|
191
240
|
search: (request) => ask('search', [request]),
|
|
@@ -208,12 +257,22 @@ export function connectMdRuntime(port) {
|
|
|
208
257
|
read: (conversation, options) => ask('conversation.read', [conversation, options]),
|
|
209
258
|
create: (input) => ask('conversation.create', [input]),
|
|
210
259
|
send: (conversation, operation, draft) => ask('conversation.send', [conversation, operation, draft]),
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
260
|
+
answer: (conversation, answer, operation) => ask('conversation.answer', [conversation, answer, operation]),
|
|
261
|
+
interrupt: (conversation, operation) => ask('conversation.interrupt', [conversation, operation]),
|
|
262
|
+
kill: (conversation, operation) => ask('conversation.kill', [conversation, operation]),
|
|
263
|
+
delete: (conversation, operation) => ask('conversation.delete', [conversation, operation]),
|
|
264
|
+
takeOut: (conversation, message, operation) => ask('conversation.takeOut', [conversation, message, operation]),
|
|
265
|
+
decide: (request, decision, operation) => ask('conversation.decide', [request, decision, operation]),
|
|
266
|
+
rename: (conversation, name, operation) => ask('conversation.rename', [conversation, name, operation]),
|
|
267
|
+
option: (conversation, option, value, operation) => ask('conversation.option', [conversation, option, value, operation]),
|
|
268
|
+
retry: (conversation, message, operation) => ask('conversation.retry', [conversation, message, operation]),
|
|
269
|
+
pins: () => ask('conversation.pins', []),
|
|
270
|
+
pin: (figures) => ask('conversation.pin', [figures]),
|
|
271
|
+
openedTurns: () => ask('conversation.openedTurns', []),
|
|
272
|
+
openTurn: (conversation, turn) => ask('conversation.openTurn', [conversation, turn]),
|
|
273
|
+
pageMetadata: async (app, address) => pageMetadataBlock(app, address, [...observations]
|
|
274
|
+
.sort(([left], [right]) => left - right)
|
|
275
|
+
.flatMap(([, { topic, input }]) => (topic === 'query' ? [input[0]] : []))),
|
|
217
276
|
},
|
|
218
277
|
chatDraft: {
|
|
219
278
|
write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
|
|
@@ -223,8 +282,9 @@ export function connectMdRuntime(port) {
|
|
|
223
282
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
224
283
|
resolve: (room, path, destination) => ask('resolve', [room, path, destination]),
|
|
225
284
|
binaryFile: {
|
|
226
|
-
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then(streamed),
|
|
227
|
-
|
|
285
|
+
read: (room, path, revision) => ask('binaryFile.read', [room, path, revision]).then((read) => streamed(read)),
|
|
286
|
+
attach: (room, file) => ask('binaryFile.attach', [room, file]),
|
|
287
|
+
download,
|
|
228
288
|
},
|
|
229
289
|
call: (name, input) => ask('call', [name, input]),
|
|
230
290
|
reached: (locator, roomVersion, path) => ask('reached', [locator, roomVersion, path]),
|
|
@@ -232,10 +292,13 @@ export function connectMdRuntime(port) {
|
|
|
232
292
|
persistence: () => ask('persistence', []),
|
|
233
293
|
retry: () => ask('retry', []),
|
|
234
294
|
cleanUp: () => ask('cleanUp', []),
|
|
295
|
+
unsent: () => ask('unsent', []),
|
|
296
|
+
reset: () => ask('reset', []),
|
|
297
|
+
readAgain: () => ask('readAgain', []),
|
|
235
298
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
236
299
|
reauthorize: () => ask('reauthorize', []),
|
|
237
300
|
settled,
|
|
238
|
-
};
|
|
301
|
+
});
|
|
239
302
|
}
|
|
240
303
|
const turns = new WeakMap();
|
|
241
304
|
export function inTurn(client, work) {
|
|
@@ -245,4 +308,5 @@ export function inTurn(client, work) {
|
|
|
245
308
|
}
|
|
246
309
|
export { chainedWindows } from './chain.js';
|
|
247
310
|
export { roomDraftRevision } from './identity.js';
|
|
311
|
+
export { defineRoomMedia, ROOM_MEDIA } from './media.js';
|
|
248
312
|
export { unanswered } from './wire.js';
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { type Document } from '@agentshouse/mdmodel';
|
|
2
|
-
import type { ModelState } from './model.js';
|
|
1
|
+
import { type DefinitionOf, type Document, type TypedPath } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { ModelState, TypesResult } from './model.js';
|
|
3
|
+
import type { AppTypedSelection } from './listing.js';
|
|
3
4
|
import type { MdModelIdentity } from './adapter.js';
|
|
4
|
-
import { type Paths } from './shared.js';
|
|
5
|
-
import type { Refused } from './transfer.js';
|
|
6
5
|
export declare const MD_MODEL: MdModelIdentity;
|
|
7
6
|
export type Collection = {
|
|
8
7
|
text: Readonly<Record<string, string>>;
|
|
@@ -15,12 +14,34 @@ export type Composition = {
|
|
|
15
14
|
roots: readonly string[];
|
|
16
15
|
model: ModelState;
|
|
17
16
|
} | null;
|
|
17
|
+
typedPaths: readonly TypedPath[];
|
|
18
18
|
};
|
|
19
|
-
export
|
|
20
|
-
|
|
19
|
+
export type Composed = {
|
|
20
|
+
readonly composition: Composition;
|
|
21
|
+
readonly fingerprint: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function composedOf(composition: Composition): Composed;
|
|
24
|
+
type Selecting<M> = {
|
|
25
|
+
readonly model: M;
|
|
26
|
+
readonly selection: {
|
|
27
|
+
readonly roots: readonly string[];
|
|
28
|
+
readonly model: M;
|
|
29
|
+
} | null;
|
|
30
|
+
};
|
|
31
|
+
export declare function selected(composition: {
|
|
32
|
+
readonly selection: {
|
|
33
|
+
readonly roots: readonly string[];
|
|
34
|
+
} | null;
|
|
35
|
+
}, path: string): boolean;
|
|
36
|
+
export declare function governing<M>(composition: Selecting<M>, path: string): M;
|
|
37
|
+
export declare function definitionsAt(composition: Composition, path: string): DefinitionOf;
|
|
38
|
+
export declare function definitionsIn(room: {
|
|
39
|
+
readonly model: TypesResult;
|
|
40
|
+
readonly typedSelection: AppTypedSelection | null;
|
|
41
|
+
}, path: string, typedPaths: readonly TypedPath[]): DefinitionOf;
|
|
21
42
|
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition): Collection;
|
|
22
43
|
export declare function documentsOf(collection: Collection): Generator<number, Iterable<readonly [string, Document]>, void>;
|
|
23
|
-
export declare function unreadable(text: Paths<string>, paths?: Iterable<string> | null): Generator<number, Refused | null, void>;
|
|
24
44
|
export declare function validRoot(root: unknown): root is string;
|
|
25
45
|
export declare function available(composition: Composition): boolean;
|
|
46
|
+
export {};
|
|
26
47
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,eAA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C,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAIvE;AAYD,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAIlF;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,EACxF,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,YAAY,CAQd;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACtC,WAAW,EAAE,WAAW,GACvB,UAAU,CAcZ;AAED,wBAAiB,WAAW,CAC1B,UAAU,EAAE,UAAU,GACrB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAQhE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAEvD;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE3D"}
|
package/dist/collection.js
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
import { parse, VERSION } from '@agentshouse/mdmodel';
|
|
1
|
+
import { definitionAt, parse, VERSION, } from '@agentshouse/mdmodel';
|
|
2
2
|
import { beneath, normalize } from './paths.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { hashed } from './observation.js';
|
|
4
|
+
import { sortedKeys } from './shared.js';
|
|
5
5
|
export const MD_MODEL = { identity: '@agentshouse/mdmodel', version: VERSION };
|
|
6
|
+
const typesPrinted = new WeakMap();
|
|
7
|
+
function typesPrint(model) {
|
|
8
|
+
if (model.status === 'unavailable')
|
|
9
|
+
return '';
|
|
10
|
+
let print = typesPrinted.get(model.types);
|
|
11
|
+
if (print === undefined) {
|
|
12
|
+
print = hashed(JSON.stringify(model.types)).toString(36);
|
|
13
|
+
typesPrinted.set(model.types, print);
|
|
14
|
+
}
|
|
15
|
+
return print;
|
|
16
|
+
}
|
|
17
|
+
export function composedOf(composition) {
|
|
18
|
+
const { model, selection } = composition;
|
|
19
|
+
return {
|
|
20
|
+
composition,
|
|
21
|
+
fingerprint: JSON.stringify([
|
|
22
|
+
typesPrint(model),
|
|
23
|
+
selection === null ? null : [selection.roots, typesPrint(selection.model)],
|
|
24
|
+
]),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
6
27
|
export function selected(composition, path) {
|
|
7
28
|
return (composition.selection !== null &&
|
|
8
29
|
composition.selection.roots.some((root) => beneath(root, path)));
|
|
@@ -12,6 +33,16 @@ export function governing(composition, path) {
|
|
|
12
33
|
? composition.selection.model
|
|
13
34
|
: composition.model;
|
|
14
35
|
}
|
|
36
|
+
function definitionsUnder(composition, path, typedPaths, typesOf) {
|
|
37
|
+
const types = typesOf(governing(composition, path));
|
|
38
|
+
return types === null ? () => undefined : definitionAt({ types }, path, typedPaths);
|
|
39
|
+
}
|
|
40
|
+
export function definitionsAt(composition, path) {
|
|
41
|
+
return definitionsUnder(composition, path, composition.typedPaths, (model) => model.status === 'unavailable' ? null : model.types);
|
|
42
|
+
}
|
|
43
|
+
export function definitionsIn(room, path, typedPaths) {
|
|
44
|
+
return definitionsUnder({ model: room.model, selection: room.typedSelection }, path, typedPaths, ({ types }) => types === null ? null : Object.fromEntries(types.map((type) => [type.name, type])));
|
|
45
|
+
}
|
|
15
46
|
export function collectionOf(text, composition) {
|
|
16
47
|
const parsed = new Map();
|
|
17
48
|
return {
|
|
@@ -23,7 +54,7 @@ export function collectionOf(text, composition) {
|
|
|
23
54
|
const content = text[path];
|
|
24
55
|
if (content === undefined)
|
|
25
56
|
return undefined;
|
|
26
|
-
const read = parse(content, path);
|
|
57
|
+
const read = parse(content, path, definitionsAt(composition, path));
|
|
27
58
|
parsed.set(path, read.ok ? read.document : null);
|
|
28
59
|
return read.ok ? read.document : undefined;
|
|
29
60
|
},
|
|
@@ -39,21 +70,6 @@ export function* documentsOf(collection) {
|
|
|
39
70
|
}
|
|
40
71
|
})();
|
|
41
72
|
}
|
|
42
|
-
export function* unreadable(text, paths = null) {
|
|
43
|
-
const named = paths ?? (yield* keysIn(text));
|
|
44
|
-
let least = null;
|
|
45
|
-
for (const path of named) {
|
|
46
|
-
const content = Object.hasOwn(text, path) ? text[path] : undefined;
|
|
47
|
-
if (content === undefined)
|
|
48
|
-
continue;
|
|
49
|
-
const read = parse(content, path);
|
|
50
|
-
if (!read.ok && (least === null || path < least.path)) {
|
|
51
|
-
least = { path, refused: { kind: 'refused', refusal: read.refusal } };
|
|
52
|
-
}
|
|
53
|
-
yield ROW_WEIGHT + content.length;
|
|
54
|
-
}
|
|
55
|
-
return least?.refused ?? null;
|
|
56
|
-
}
|
|
57
73
|
export function validRoot(root) {
|
|
58
74
|
return typeof root === 'string' && normalize(root) === root;
|
|
59
75
|
}
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { sql } from '@agentshouse/mdmodel';
|
|
2
|
+
import { type Composition } from './collection.js';
|
|
1
3
|
import type { Plan, QueryRows } from './query.js';
|
|
2
|
-
import type { Connection
|
|
4
|
+
import type { Connection } from './tables.js';
|
|
3
5
|
export type QueryRoom = {
|
|
4
6
|
readonly locator: string;
|
|
5
7
|
readonly key: number;
|
|
8
|
+
readonly composition?: Composition;
|
|
6
9
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
10
|
+
type Fragment = sql.Fragment;
|
|
11
|
+
export declare const VISIBLE: (alias: string) => string;
|
|
12
|
+
export declare function within(alias: string, path: string): Fragment;
|
|
11
13
|
export type QueryAnswer = QueryRows & {
|
|
12
14
|
readonly more?: string;
|
|
13
15
|
};
|
|
14
|
-
export declare function selected(connection: Connection, plan: Plan, rooms: readonly QueryRoom[]): Fragment;
|
|
15
16
|
export declare function answerQuery(connection: Connection, plan: Plan, rooms: readonly QueryRoom[], budget?: number | null): QueryAnswer;
|
|
17
|
+
export {};
|
|
16
18
|
//# sourceMappingURL=compile.d.ts.map
|
package/dist/compile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,GAAG,EAQJ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,IAAI,EAAuC,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC,CAAC;AAIF,KAAK,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAI7B,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,MACkC,CAAC;AAa3E,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAM5D;AA2dD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA4ZjE,wBAAgB,WAAW,CACzB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,MAAM,GAAE,MAAM,GAAG,IAAW,GAC3B,WAAW,CAUb"}
|