@agentshouse/app-bridge 0.1.0-ca559eade7c19 → 0.1.0-ca6bf24eae119
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 +9 -9
- package/dist/calls.d.ts +676 -69
- package/dist/index.d.ts +36 -18
- package/dist/mdmodel/condition.d.ts +23 -10
- package/dist/mdmodel/definition.d.ts +3 -1
- package/dist/mdmodel/document.d.ts +5 -5
- package/dist/mdmodel/index.d.ts +9 -7
- package/dist/mdmodel/links.d.ts +28 -0
- package/dist/mdmodel/paths.d.ts +9 -1
- package/dist/mdmodel/project.d.ts +1 -0
- package/dist/mdmodel/types.d.ts +28 -4
- package/dist/mdmodel/validate.d.ts +27 -3
- package/dist/mdruntime/adapter.d.ts +83 -48
- package/dist/mdruntime/binary.d.ts +0 -5
- package/dist/mdruntime/chain.d.ts +10 -0
- package/dist/mdruntime/change-set.d.ts +9 -16
- package/dist/mdruntime/change.d.ts +31 -1
- package/dist/mdruntime/client.d.ts +13 -5
- package/dist/mdruntime/collection.d.ts +10 -21
- package/dist/mdruntime/compile.d.ts +15 -0
- package/dist/mdruntime/connection.d.ts +25 -13
- package/dist/mdruntime/conversation.d.ts +19 -6
- package/dist/mdruntime/durability.d.ts +2 -5
- package/dist/mdruntime/fulltext.d.ts +26 -0
- package/dist/mdruntime/identity.d.ts +6 -0
- package/dist/mdruntime/media.d.ts +7 -0
- package/dist/mdruntime/messages.d.ts +27 -0
- package/dist/mdruntime/model.d.ts +6 -1
- package/dist/mdruntime/observation.d.ts +15 -0
- package/dist/mdruntime/opened.d.ts +21 -0
- package/dist/mdruntime/outcome.d.ts +45 -7
- package/dist/mdruntime/overlay.d.ts +2 -5
- package/dist/mdruntime/query.d.ts +32 -2
- package/dist/mdruntime/reach.d.ts +13 -4
- package/dist/mdruntime/readiness.d.ts +14 -15
- package/dist/mdruntime/recovery.d.ts +3 -2
- package/dist/mdruntime/replica.d.ts +55 -33
- package/dist/mdruntime/room-draft.d.ts +21 -3
- package/dist/mdruntime/save.d.ts +53 -14
- package/dist/mdruntime/search.d.ts +23 -42
- package/dist/mdruntime/status.d.ts +4 -3
- package/dist/mdruntime/store.d.ts +90 -97
- package/dist/mdruntime/stored.d.ts +129 -0
- package/dist/mdruntime/tables.d.ts +324 -0
- package/dist/mdruntime/wire.d.ts +33 -1
- package/dist/test-host.d.ts +7 -4
- package/dist/test-host.js +18 -28
- package/docs/families.md +50 -49
- package/package.json +8 -3
- package/dist/mdruntime/acquisition.d.ts +0 -13
- package/dist/mdruntime/file.d.ts +0 -19
- package/dist/mdruntime/rows.d.ts +0 -37
- package/dist/mdruntime/shared.d.ts +0 -10
- package/dist/mdruntime/transfer.d.ts +0 -9
- package/dist/mdruntime/turn.d.ts +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { MdRuntimeClient, Open } from './mdruntime/client.js';
|
|
2
|
-
import type {
|
|
3
|
-
export type {
|
|
4
|
-
export type
|
|
2
|
+
import type { HouseMethods } from './calls.js';
|
|
3
|
+
export type { HouseMethods } from './calls.js';
|
|
4
|
+
export type HouseParams<Name extends string> = Name extends keyof HouseMethods ? HouseMethods[Name]['params'] : unknown;
|
|
5
|
+
type CallResult = Awaited<ReturnType<MdRuntimeClient['call']>>;
|
|
6
|
+
export type HouseResult<Name extends string> = Exclude<CallResult, {
|
|
7
|
+
readonly kind: 'action';
|
|
8
|
+
}> | (Extract<CallResult, {
|
|
9
|
+
readonly kind: 'action';
|
|
10
|
+
}> & {
|
|
11
|
+
readonly result: Name extends keyof HouseMethods ? HouseMethods[Name]['result'] : unknown;
|
|
12
|
+
});
|
|
5
13
|
export interface HouseRuntime extends Omit<MdRuntimeClient, 'call'> {
|
|
6
|
-
call<Name extends Open<keyof
|
|
14
|
+
call<Name extends Open<keyof HouseMethods>>(method: Name, params: HouseParams<Name>): Promise<HouseResult<Name>>;
|
|
7
15
|
}
|
|
8
16
|
export interface HouseSyncState {
|
|
9
17
|
readonly state: string;
|
|
@@ -13,6 +21,7 @@ export interface HouseCredentialState {
|
|
|
13
21
|
readonly state: Open<'none' | 'held' | 'rejected'>;
|
|
14
22
|
readonly expiresAt: number | null;
|
|
15
23
|
}
|
|
24
|
+
export type HouseDatabaseFailure = 'unsupported' | 'damaged';
|
|
16
25
|
export type HouseAnalyticsChoice = 'accept' | 'decline';
|
|
17
26
|
export interface HouseAnalytics {
|
|
18
27
|
readonly measures: boolean;
|
|
@@ -32,6 +41,7 @@ export interface HouseStatus {
|
|
|
32
41
|
readonly retryable: boolean;
|
|
33
42
|
} | null;
|
|
34
43
|
readonly loss: string | null;
|
|
44
|
+
readonly database: Open<HouseDatabaseFailure> | null;
|
|
35
45
|
readonly analytics: HouseAnalytics;
|
|
36
46
|
readonly serviceMode: Open<'open' | 'write-halted'> | null;
|
|
37
47
|
readonly offline: boolean;
|
|
@@ -70,8 +80,6 @@ export interface HouseExternalRequest {
|
|
|
70
80
|
readonly headers?: Readonly<Record<string, string>>;
|
|
71
81
|
readonly body?: string;
|
|
72
82
|
readonly body_base64?: string;
|
|
73
|
-
readonly account?: string;
|
|
74
|
-
readonly slot?: string;
|
|
75
83
|
readonly room_ref?: string;
|
|
76
84
|
}
|
|
77
85
|
export type HouseExternalAnswer = {
|
|
@@ -110,22 +118,32 @@ export interface HouseBrowserRefused extends Error {
|
|
|
110
118
|
readonly code: string;
|
|
111
119
|
readonly retryable: boolean;
|
|
112
120
|
}
|
|
113
|
-
export interface HouseTrialWithheld {
|
|
114
|
-
readonly code: Open<'house_trial_withheld'>;
|
|
115
|
-
readonly retryable: true;
|
|
116
|
-
}
|
|
117
|
-
export type HouseTask = unknown;
|
|
118
|
-
export type HouseActivation = Open<'committed' | 'abandoned'>;
|
|
119
121
|
export interface HouseCooperation {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
placed(): Promise<void> | void;
|
|
123
|
+
}
|
|
124
|
+
export type HouseChatWidth = 'full' | '3/4' | '1/2' | '1/3';
|
|
125
|
+
export interface HouseChatOpened {
|
|
126
|
+
readonly conversation: string | null;
|
|
127
|
+
readonly agent: string | null;
|
|
128
|
+
}
|
|
129
|
+
export interface HouseChatOptions {
|
|
130
|
+
readonly conversation?: string | null;
|
|
131
|
+
readonly agent?: string | null;
|
|
132
|
+
readonly showChats?: boolean;
|
|
133
|
+
readonly width?: HouseChatWidth;
|
|
134
|
+
readonly onOpen?: (opened: HouseChatOpened) => void;
|
|
135
|
+
readonly onLink?: (href: string) => void;
|
|
136
|
+
}
|
|
137
|
+
export interface HouseMountedChat {
|
|
138
|
+
update(options: HouseChatOptions): void;
|
|
139
|
+
unmount(): void;
|
|
140
|
+
}
|
|
141
|
+
export interface HouseChat {
|
|
142
|
+
mount(element: object, options?: HouseChatOptions): Promise<HouseMountedChat>;
|
|
126
143
|
}
|
|
127
144
|
export interface HouseBridge {
|
|
128
145
|
readonly runtime: Promise<HouseRuntime>;
|
|
146
|
+
readonly chat: HouseChat;
|
|
129
147
|
address(): string | null;
|
|
130
148
|
onAddress(listener: (address: string) => void): () => void;
|
|
131
149
|
push(address: string): Promise<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ValueFacts } from './definition.js';
|
|
1
|
+
import { type Definition, type ValueFacts } from './definition.js';
|
|
2
2
|
import type { Document, VerifiedModel } from './types.js';
|
|
3
|
-
export type ConditionValue = string | number | boolean
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type ConditionValue = string | number | boolean;
|
|
4
|
+
export declare const CONDITION_OPERATORS: readonly ['eq', 'in', 'exists', 'contains', 'gt', 'gte', 'lt', 'lte', 'prefix'];
|
|
5
|
+
export type ConditionOperator = (typeof CONDITION_OPERATORS)[number];
|
|
6
6
|
export type ConditionTest = {
|
|
7
7
|
readonly all: readonly ConditionTest[];
|
|
8
8
|
} | {
|
|
@@ -41,6 +41,7 @@ type DocumentEventBase = {
|
|
|
41
41
|
readonly on: 'documents';
|
|
42
42
|
readonly scope: ConditionScope;
|
|
43
43
|
readonly by?: ConditionTest;
|
|
44
|
+
readonly moved_between_rooms?: boolean;
|
|
44
45
|
};
|
|
45
46
|
export type DocumentCondition = (DocumentEventBase & {
|
|
46
47
|
readonly mode: 'starts_matching';
|
|
@@ -102,11 +103,13 @@ export type DocumentFacts = {
|
|
|
102
103
|
readonly fields: Readonly<Record<string, Fact>>;
|
|
103
104
|
readonly sections: readonly string[];
|
|
104
105
|
};
|
|
105
|
-
export declare const
|
|
106
|
+
export declare const TEXT_FIELD = "/text";
|
|
107
|
+
export declare const WRITE_DOORS: readonly ['browser', 'agent', 'client', 'function'];
|
|
106
108
|
export type WriteDoor = (typeof WRITE_DOORS)[number];
|
|
107
109
|
export type Actor = {
|
|
108
110
|
readonly user?: string;
|
|
109
111
|
readonly site?: string;
|
|
112
|
+
readonly app?: string;
|
|
110
113
|
readonly door?: WriteDoor;
|
|
111
114
|
};
|
|
112
115
|
export type DocumentEvent = {
|
|
@@ -114,13 +117,12 @@ export type DocumentEvent = {
|
|
|
114
117
|
readonly after: DocumentFacts | null;
|
|
115
118
|
readonly changed: readonly string[];
|
|
116
119
|
readonly by: Actor;
|
|
120
|
+
readonly moved_between_rooms: boolean;
|
|
117
121
|
};
|
|
118
122
|
export type ItemFacts = {
|
|
119
123
|
readonly delivery: string;
|
|
120
124
|
readonly source: string | null;
|
|
121
125
|
readonly address: string | null;
|
|
122
|
-
readonly has_attachment: boolean;
|
|
123
|
-
readonly provider: string | null;
|
|
124
126
|
readonly container: string | null;
|
|
125
127
|
readonly author: string | null;
|
|
126
128
|
readonly headers: Readonly<Record<string, string>>;
|
|
@@ -140,10 +142,21 @@ export declare function facts(document: Document, at: {
|
|
|
140
142
|
}, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
|
|
141
143
|
export declare function prosePaths(facts: DocumentFacts): string[];
|
|
142
144
|
export declare function datePointers(fields: Readonly<Record<string, ValueFacts>>): string[];
|
|
145
|
+
export declare function valuedChange(definition: Definition, field: string): boolean;
|
|
146
|
+
export declare function changeFields(definition: Definition): string[];
|
|
147
|
+
export declare function memberPointers(definition: Definition, memberType: string): string[];
|
|
148
|
+
export declare const DOCUMENT_PATHS: readonly string[];
|
|
149
|
+
export declare const ACTOR_PATHS: readonly string[];
|
|
150
|
+
export declare const ITEM_PATHS: readonly string[];
|
|
151
|
+
export declare function testOperators(definitions: readonly Definition[], path: string, memberType: string | null): readonly ConditionOperator[];
|
|
152
|
+
export declare function actorOperators(path: string): readonly ConditionOperator[];
|
|
153
|
+
export declare function itemOperators(path: string): readonly ConditionOperator[];
|
|
154
|
+
export declare function itemKind(path: string): FactKind | null;
|
|
143
155
|
export declare function dated(value: unknown): value is string;
|
|
144
156
|
export declare function instant(value: unknown): bigint | undefined;
|
|
145
157
|
export declare function pointed(value: unknown, pointer: string): unknown;
|
|
146
|
-
export declare function
|
|
147
|
-
export declare function
|
|
148
|
-
export declare function
|
|
158
|
+
export declare function members(document: DocumentFacts, path: string): readonly string[];
|
|
159
|
+
export declare function holds(test: ConditionTest, document: DocumentFacts): Truth;
|
|
160
|
+
export declare function fires(condition: DocumentCondition, event: DocumentEvent): boolean;
|
|
161
|
+
export declare function itemFires(condition: ItemCondition, item: ItemFacts): boolean;
|
|
149
162
|
export {};
|
|
@@ -5,6 +5,7 @@ export type ValueFacts = {
|
|
|
5
5
|
readonly format?: string;
|
|
6
6
|
readonly values?: readonly unknown[];
|
|
7
7
|
readonly reference?: readonly string[];
|
|
8
|
+
readonly crossRoom?: true;
|
|
8
9
|
readonly prose: boolean;
|
|
9
10
|
readonly conditional?: true;
|
|
10
11
|
readonly prefix?: readonly ValueFacts[];
|
|
@@ -59,6 +60,7 @@ export declare const JSON_TYPES: readonly JsonType[];
|
|
|
59
60
|
export declare const BUILT_IN_TYPE = "any";
|
|
60
61
|
export declare const ATTACHMENT = "attachment";
|
|
61
62
|
export declare const ARRAY_INDEX: RegExp;
|
|
63
|
+
export declare const JSON_POINTER: RegExp;
|
|
62
64
|
export declare function escapePointer(key: string): string;
|
|
63
65
|
export declare function pointerSegments(pointer: string): string[];
|
|
64
66
|
export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
|
|
@@ -76,4 +78,4 @@ export type PointerFacts = {
|
|
|
76
78
|
export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
|
|
77
79
|
export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
|
|
78
80
|
export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
|
|
79
|
-
export declare function readSchema(text: string): VerifiedModel | Failure;
|
|
81
|
+
export declare function readSchema(text: string, provided?: VerifiedModel): VerifiedModel | Failure;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import
|
|
2
|
+
import { type LinkInventory } from './links.js';
|
|
3
|
+
import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult } from './types.js';
|
|
3
4
|
import { type YamlMap } from './yaml.js';
|
|
5
|
+
export declare function inventoryOf(document: Document): LinkInventory;
|
|
4
6
|
export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
|
|
5
7
|
export declare function parse(content: string, file?: string): ParseResult;
|
|
6
|
-
export declare function relativize(document: Document, file: string, handle: string, definition?: Definition): ApplyResult;
|
|
8
|
+
export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
|
|
7
9
|
export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
|
|
8
10
|
export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
|
|
9
11
|
export declare function links(document: Document, file: string): readonly Link[];
|
|
10
|
-
export declare function linkOccurrences(document: Document, file: string): readonly LinkOccurrence[];
|
|
11
12
|
export declare function bodyLinks(body: string, file: string): readonly Link[];
|
|
12
|
-
export declare function apply(document: Document,
|
|
13
|
+
export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
|
|
13
14
|
export declare function serialize(document: Document): string;
|
|
14
|
-
export declare function fieldStart(document: Document, pointer: string): number | undefined;
|
|
15
15
|
export declare function frontmatter(document: Document): YamlMap | null;
|
package/dist/mdmodel/index.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export { dated, datePointers, factKind, facts, fires, holds, instant, itemFires, pointed, prosePaths, WRITE_DOORS, } from './condition.js';
|
|
2
|
-
export type { Actor, Condition, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
|
|
1
|
+
export { ACTOR_PATHS, actorOperators, changeFields, CONDITION_OPERATORS, dated, datePointers, DOCUMENT_PATHS, factKind, facts, fires, holds, instant, ITEM_PATHS, itemFires, itemKind, itemOperators, memberPointers, members, pointed, prosePaths, testOperators, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './condition.js';
|
|
2
|
+
export type { Actor, Condition, ConditionOperator, ConditionScope, ConditionTest, ConditionValue, CronCondition, DateCondition, DocumentCondition, DocumentEvent, DocumentFacts, Fact, FactKind, ItemCondition, ItemFacts, Resolved, WriteDoor, } from './condition.js';
|
|
3
3
|
export { headingLines } from './blocks.js';
|
|
4
4
|
export type { HeadingLine } from './blocks.js';
|
|
5
5
|
export { divide } from './divide.js';
|
|
6
|
-
export { apply, bodyLinks,
|
|
6
|
+
export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, } from './document.js';
|
|
7
7
|
export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
8
|
-
export { relative, retarget, target } from './paths.js';
|
|
8
|
+
export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
|
|
9
|
+
export type { RoomTarget } from './paths.js';
|
|
9
10
|
export { MARKDOWN_SYNTAX_PROFILE } from './profile.js';
|
|
10
11
|
export { project } from './project.js';
|
|
11
12
|
export { references } from './references.js';
|
|
12
|
-
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
13
|
+
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
13
14
|
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
|
|
14
|
-
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link,
|
|
15
|
-
export { checkDocument, resolves, sectionReferences, validate, verify } from './validate.js';
|
|
15
|
+
export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
16
|
+
export { assess, bodyRoomLinks, checkDocument, resolves, roomReferences, sectionReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
17
|
+
export type { Assessment, Verdicts } from './validate.js';
|
|
16
18
|
export { VERSION } from './version.js';
|
|
17
19
|
export { bodyAfterFrontmatter, equalValue, frontmatterValue } from './yaml.js';
|
|
18
20
|
export type { FrontmatterValue } from './yaml.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare function escapes(text: string, index: number): boolean;
|
|
2
|
+
export declare function spanCursor(spans: readonly (readonly [number, number])[]): (index: number) => number | undefined;
|
|
3
|
+
export type HrefOccurrence = {
|
|
4
|
+
readonly href: string;
|
|
5
|
+
readonly start: number;
|
|
6
|
+
readonly end: number;
|
|
7
|
+
readonly bracketed: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type LinkUse = {
|
|
10
|
+
readonly start: number;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
readonly labelStart: number;
|
|
13
|
+
readonly labelEnd: number;
|
|
14
|
+
readonly destination: HrefOccurrence;
|
|
15
|
+
};
|
|
16
|
+
export type DefinitionBlock = {
|
|
17
|
+
readonly start: number;
|
|
18
|
+
readonly end: number;
|
|
19
|
+
readonly destination: HrefOccurrence;
|
|
20
|
+
};
|
|
21
|
+
export type LinkInventory = {
|
|
22
|
+
readonly uses: readonly LinkUse[];
|
|
23
|
+
readonly blocks: readonly DefinitionBlock[];
|
|
24
|
+
};
|
|
25
|
+
export declare function fenceSpans(text: string): readonly (readonly [number, number])[];
|
|
26
|
+
export declare function linkInventory(body: string): LinkInventory;
|
|
27
|
+
export declare function destinations(inventory: LinkInventory): readonly HrefOccurrence[];
|
|
28
|
+
export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
|
package/dist/mdmodel/paths.d.ts
CHANGED
|
@@ -2,14 +2,22 @@ export declare function dirname(path: string): string;
|
|
|
2
2
|
export declare function join(base: string, relative: string): string;
|
|
3
3
|
export declare function normalize(path: string): string | null;
|
|
4
4
|
export declare function destinationPath(href: string): string | null;
|
|
5
|
+
export type RoomTarget = {
|
|
6
|
+
readonly handle: string;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
};
|
|
5
9
|
export declare function classifyHref(from: string, href: string): {
|
|
6
10
|
kind: 'skip';
|
|
7
11
|
} | {
|
|
8
12
|
kind: 'path';
|
|
9
13
|
path: string;
|
|
10
|
-
} | {
|
|
14
|
+
} | ({
|
|
15
|
+
kind: 'room';
|
|
16
|
+
} & RoomTarget) | {
|
|
11
17
|
kind: 'invalid';
|
|
12
18
|
};
|
|
19
|
+
export declare function roomTarget(href: string): RoomTarget | null;
|
|
20
|
+
export declare function roomPath(href: string): string | null;
|
|
13
21
|
export declare function target(from: string, href: string): string | null;
|
|
14
22
|
export declare function retarget(href: string, to: string): string;
|
|
15
23
|
export declare function relative(from: string, target: string): string;
|
|
@@ -15,6 +15,7 @@ export type InputResult = {
|
|
|
15
15
|
readonly ok: false;
|
|
16
16
|
readonly refusal: Refusal;
|
|
17
17
|
};
|
|
18
|
+
export declare function firstEditFrom(edits: readonly Edit[], start: number): number;
|
|
18
19
|
export declare function rangeText(content: string, range: Extent, edits: readonly Edit[]): string;
|
|
19
20
|
export declare function projectionInput(document: Document, file: string, context: ProjectionContext): InputResult;
|
|
20
21
|
export declare function project(document: Document, file: string, context?: ProjectionContext): Projection;
|
package/dist/mdmodel/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
|
|
|
2
2
|
export type Library = Readonly<Record<string, string>>;
|
|
3
3
|
export type VerifiedModel = {
|
|
4
4
|
readonly types: Readonly<Record<string, Definition>>;
|
|
5
|
+
readonly nameable?: readonly string[];
|
|
5
6
|
};
|
|
6
7
|
export type ModelVerification = {
|
|
7
8
|
readonly verdict: 'accept';
|
|
@@ -13,13 +14,14 @@ export type ModelVerification = {
|
|
|
13
14
|
};
|
|
14
15
|
export type ValidationContext = {
|
|
15
16
|
readonly binaryTargets: readonly string[];
|
|
17
|
+
readonly anyRoom?: true;
|
|
16
18
|
};
|
|
17
19
|
export type ProjectionContext = {
|
|
18
20
|
readonly documentTargets: readonly string[];
|
|
19
21
|
readonly definition?: Definition;
|
|
20
22
|
};
|
|
21
23
|
export type DivisionContext = ProjectionContext & {
|
|
22
|
-
readonly
|
|
24
|
+
readonly bound: number;
|
|
23
25
|
};
|
|
24
26
|
export type Extent = {
|
|
25
27
|
readonly start: number;
|
|
@@ -60,6 +62,10 @@ export type Validation = {
|
|
|
60
62
|
} | ({
|
|
61
63
|
readonly verdict: 'refuse';
|
|
62
64
|
} & Refusal);
|
|
65
|
+
export type ValidationStep = {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly resolved: number;
|
|
68
|
+
};
|
|
63
69
|
export type Projection = {
|
|
64
70
|
readonly ok: true;
|
|
65
71
|
readonly text: string;
|
|
@@ -92,14 +98,31 @@ export type Link = {
|
|
|
92
98
|
readonly href: string;
|
|
93
99
|
readonly target: string;
|
|
94
100
|
};
|
|
95
|
-
export type LinkOccurrence = Link & {
|
|
96
|
-
readonly start: number;
|
|
97
|
-
};
|
|
98
101
|
export type Reference = {
|
|
99
102
|
readonly pointer: string;
|
|
100
103
|
readonly value: string;
|
|
101
104
|
readonly to: readonly string[];
|
|
105
|
+
readonly crossRoom?: true;
|
|
102
106
|
};
|
|
107
|
+
export type RoomReference = {
|
|
108
|
+
readonly handle: string;
|
|
109
|
+
readonly path: string;
|
|
110
|
+
} & ({
|
|
111
|
+
readonly kind: 'link';
|
|
112
|
+
readonly href: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: 'field';
|
|
115
|
+
readonly pointer: string;
|
|
116
|
+
readonly value: string;
|
|
117
|
+
readonly to: readonly string[];
|
|
118
|
+
readonly crossRoom?: true;
|
|
119
|
+
} | {
|
|
120
|
+
readonly kind: 'item';
|
|
121
|
+
readonly section: string;
|
|
122
|
+
readonly href: string;
|
|
123
|
+
readonly to: readonly string[];
|
|
124
|
+
readonly crossRoom?: true;
|
|
125
|
+
});
|
|
103
126
|
export type Change = {
|
|
104
127
|
readonly kind: 'field';
|
|
105
128
|
readonly name: string;
|
|
@@ -130,6 +153,7 @@ export type ApplyResult = {
|
|
|
130
153
|
} | {
|
|
131
154
|
readonly outcome: 'stale';
|
|
132
155
|
readonly document: Document;
|
|
156
|
+
readonly stale: readonly number[];
|
|
133
157
|
} | {
|
|
134
158
|
readonly outcome: 'refuse';
|
|
135
159
|
readonly refusal: Refusal;
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { DocumentCheck, Library, ModelVerification, Reached, Validation, ValidationContext, VerifiedModel } from './types.js';
|
|
2
|
+
import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
3
|
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
4
|
-
export declare function verify(schema: string): ModelVerification;
|
|
5
|
-
export declare function checkDocument(file: string, content: string, model: VerifiedModel): DocumentCheck;
|
|
4
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
5
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): DocumentCheck;
|
|
6
6
|
export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
|
|
7
|
+
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
8
|
+
export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
|
|
9
|
+
type Placed = {
|
|
10
|
+
readonly reference: Reached;
|
|
11
|
+
readonly location: string;
|
|
12
|
+
};
|
|
13
|
+
export type Assessment = {
|
|
14
|
+
readonly file: string;
|
|
15
|
+
readonly type: string | undefined;
|
|
16
|
+
readonly targets: readonly string[];
|
|
17
|
+
readonly read: Validation | null;
|
|
18
|
+
readonly structured: Validation | null;
|
|
19
|
+
readonly fields: readonly Placed[];
|
|
20
|
+
readonly linked: boolean;
|
|
21
|
+
readonly sections: readonly Placed[];
|
|
22
|
+
};
|
|
23
|
+
export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Pick<ValidationContext, 'anyRoom'>): Assessment;
|
|
24
|
+
export type Verdicts = {
|
|
25
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
26
|
+
verdict(): Validation;
|
|
27
|
+
};
|
|
28
|
+
export declare function verdicts(): Verdicts;
|
|
29
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
7
30
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
31
|
+
export {};
|