@agentshouse/mdmodel 0.1.0-ccf1367190878 → 0.1.0-cdbd463e01dc2
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/API.md +197 -178
- package/README.md +21 -22
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +35 -20
- package/dist/definition.d.ts +3 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +112 -24
- package/dist/divide.d.ts.map +1 -1
- package/dist/divide.js +27 -17
- package/dist/document.d.ts +5 -5
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +304 -187
- package/dist/event.d.ts +78 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +230 -0
- package/dist/facts.d.ts +15 -0
- package/dist/facts.d.ts.map +1 -0
- package/dist/facts.js +39 -0
- package/dist/index.d.ts +22 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/kinds.d.ts +19 -0
- package/dist/kinds.d.ts.map +1 -0
- package/dist/kinds.js +161 -0
- package/dist/links.d.ts +2 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +107 -50
- package/dist/paths.d.ts +9 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +28 -2
- package/dist/pattern.d.ts +10 -0
- package/dist/pattern.d.ts.map +1 -0
- package/dist/pattern.js +355 -0
- package/dist/project.d.ts +1 -0
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +38 -15
- package/dist/query/language.d.ts +223 -0
- package/dist/query/language.d.ts.map +1 -0
- package/dist/query/language.js +565 -0
- package/dist/query/match.d.ts +14 -0
- package/dist/query/match.d.ts.map +1 -0
- package/dist/query/match.js +121 -0
- package/dist/query/rows.d.ts +32 -0
- package/dist/query/rows.d.ts.map +1 -0
- package/dist/query/rows.js +161 -0
- package/dist/query/sql.d.ts +39 -0
- package/dist/query/sql.d.ts.map +1 -0
- package/dist/query/sql.js +279 -0
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +6 -1
- package/dist/reserved.d.ts +5 -0
- package/dist/reserved.d.ts.map +1 -0
- package/dist/reserved.js +20 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +55 -4
- package/dist/types.d.ts +35 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +29 -4
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +301 -85
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +36 -3
- package/fixtures/README.md +26 -6
- package/fixtures/cases/conditional-section/context.json +1 -0
- package/fixtures/cases/conditional-section/expected.json +6 -0
- package/fixtures/cases/conditional-section/library/questions/hosting.md +9 -0
- package/fixtures/cases/conditional-section/library/questions/payments.md +12 -0
- package/fixtures/cases/conditional-section/schema.yaml +14 -0
- package/fixtures/cases/cross-room-link/context.json +1 -0
- package/fixtures/cases/cross-room-link/expected.json +1 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +6 -0
- package/fixtures/cases/cross-room-link/schema.yaml +3 -0
- package/fixtures/cases/cross-room-reference/context.json +1 -0
- package/fixtures/cases/cross-room-reference/expected.json +1 -0
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +9 -0
- package/fixtures/cases/cross-room-reference/schema.yaml +9 -0
- package/fixtures/cases/link-into-a-reserved-name/context.json +1 -0
- package/fixtures/cases/link-into-a-reserved-name/expected.json +5 -0
- package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +6 -0
- package/fixtures/cases/link-into-a-reserved-name/schema.yaml +3 -0
- package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/context.json +1 -0
- package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/expected.json +5 -0
- package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/library/notes/b.md +5 -0
- package/fixtures/cases/member-on-an-untyped-document/context.json +1 -0
- package/fixtures/cases/member-on-an-untyped-document/expected.json +6 -0
- package/fixtures/cases/member-on-an-untyped-document/library/note.md +4 -0
- package/fixtures/cases/member-on-another-type/context.json +1 -0
- package/fixtures/cases/member-on-another-type/expected.json +6 -0
- package/fixtures/cases/member-on-another-type/library/note.md +4 -0
- package/fixtures/cases/member-on-another-type/schema.yaml +7 -0
- package/fixtures/cases/reference-into-a-reserved-name/context.json +1 -0
- package/fixtures/cases/reference-into-a-reserved-name/expected.json +6 -0
- package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +4 -0
- package/fixtures/cases/reference-into-a-reserved-name/library/settings/brief.md +1 -0
- package/fixtures/cases/reference-into-a-reserved-name/schema.yaml +3 -0
- package/fixtures/cases/room-md-declares-a-type/context.json +1 -0
- package/fixtures/cases/room-md-declares-a-type/expected.json +6 -0
- package/fixtures/cases/room-md-declares-a-type/library/ROOM.md +5 -0
- package/fixtures/cases/typed-path-names-another-type/context.json +11 -0
- package/fixtures/cases/typed-path-names-another-type/expected.json +6 -0
- package/fixtures/cases/typed-path-names-another-type/library/settings/prefs/one.md +3 -0
- package/fixtures/cases/typed-path-names-another-type/schema.yaml +6 -0
- package/fixtures/cases/typed-path-names-its-type/context.json +11 -0
- package/fixtures/cases/typed-path-names-its-type/expected.json +3 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/deeper/two.md +1 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +4 -0
- package/fixtures/cases/typed-path-names-its-type/schema.yaml +6 -0
- package/fixtures/cases/typed-path-names-no-type/context.json +11 -0
- package/fixtures/cases/typed-path-names-no-type/expected.json +6 -0
- package/fixtures/cases/typed-path-names-no-type/library/settings/prefs/one.md +1 -0
- package/fixtures/cases/typed-path-names-no-type/schema.yaml +6 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/expected.json +6 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +4 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/schema.yaml +5 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/expected.json +6 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +6 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/schema.yaml +5 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/expected.json +3 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/plan.md +1 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +5 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/schema.yaml +5 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/expected.json +5 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +5 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/schema.yaml +5 -0
- package/fixtures/division.json +26 -26
- package/fixtures/queries.json +913 -0
- package/package.json +7 -2
- package/dist/condition.d.ts +0 -149
- package/dist/condition.d.ts.map +0 -1
- package/dist/condition.js +0 -500
package/dist/reserved.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const ROOM_DESCRIPTION = 'ROOM.md';
|
|
2
|
+
export const RESERVED_NAMES = [
|
|
3
|
+
ROOM_DESCRIPTION,
|
|
4
|
+
'capture',
|
|
5
|
+
'settings',
|
|
6
|
+
'rooms',
|
|
7
|
+
'agents',
|
|
8
|
+
'house',
|
|
9
|
+
];
|
|
10
|
+
function folded(name) {
|
|
11
|
+
return name.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
const FOLDED_RESERVED_NAMES = new Set(RESERVED_NAMES.map(folded));
|
|
14
|
+
export function isReservedName(name) {
|
|
15
|
+
return FOLDED_RESERVED_NAMES.has(folded(name));
|
|
16
|
+
}
|
|
17
|
+
export function isDocumentPath(path) {
|
|
18
|
+
const first = path.split('/', 1)[0];
|
|
19
|
+
return first !== '' && !isReservedName(first);
|
|
20
|
+
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export type SchemaRefusal = {
|
|
|
4
4
|
readonly location: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function frontmatterRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
|
|
7
|
+
export declare function conditionedSections(definition: Definition, fields: Readonly<Record<string, unknown>>): readonly string[];
|
|
7
8
|
export declare function fitsItem(definition: Definition, section: string, text: string): boolean;
|
|
8
9
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0B5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA6NjF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAI3B;AAYD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,SAAS,MAAM,EAAE,CAGnB;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMvF"}
|
package/dist/schema.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Validator } from '@cfworker/json-schema';
|
|
2
2
|
import { escapePointer, refTarget } from './definition.js';
|
|
3
3
|
import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
4
|
+
import { withLinearRegExp } from './pattern.js';
|
|
4
5
|
import { interpretPlain, isRecord } from './yaml.js';
|
|
5
6
|
const STANDING_MAPS = ['properties', 'patternProperties'];
|
|
6
7
|
const STANDING = [
|
|
@@ -95,10 +96,49 @@ function closed(node, inPlace, defs, always = false) {
|
|
|
95
96
|
function copied(value) {
|
|
96
97
|
return JSON.parse(JSON.stringify(value));
|
|
97
98
|
}
|
|
99
|
+
function asks(asked) {
|
|
100
|
+
return asked.sections.length > 0 || asked.conditions.length > 0;
|
|
101
|
+
}
|
|
102
|
+
function branchOf(node, defs, closedDefs) {
|
|
103
|
+
if (!isRecord(node))
|
|
104
|
+
return { schema: node, asked: { sections: [], conditions: [] } };
|
|
105
|
+
const { sections, ...rest } = node;
|
|
106
|
+
const read = unconditioned(rest, defs, closedDefs);
|
|
107
|
+
const required = Object.entries(isRecord(sections) ? sections : {}).flatMap(([name, spec]) => isRecord(spec) && spec.required === true ? [name] : []);
|
|
108
|
+
return { schema: read.schema, asked: { sections: required, conditions: read.conditions } };
|
|
109
|
+
}
|
|
110
|
+
function unconditioned(node, defs, closedDefs) {
|
|
111
|
+
if (!isRecord(node))
|
|
112
|
+
return { schema: node, conditions: [] };
|
|
113
|
+
const schema = { ...node };
|
|
114
|
+
const conditions = [];
|
|
115
|
+
if (Array.isArray(node.allOf))
|
|
116
|
+
schema.allOf = node.allOf.map((entry) => {
|
|
117
|
+
const read = unconditioned(entry, defs, closedDefs);
|
|
118
|
+
conditions.push(...read.conditions);
|
|
119
|
+
return read.schema;
|
|
120
|
+
});
|
|
121
|
+
if (node.if === undefined)
|
|
122
|
+
return { schema, conditions };
|
|
123
|
+
const met = branchOf(node.then, defs, closedDefs);
|
|
124
|
+
const unmet = branchOf(node.else, defs, closedDefs);
|
|
125
|
+
if (node.then !== undefined)
|
|
126
|
+
schema.then = met.schema;
|
|
127
|
+
if (node.else !== undefined)
|
|
128
|
+
schema.else = unmet.schema;
|
|
129
|
+
if (!asks(met.asked) && !asks(unmet.asked))
|
|
130
|
+
return { schema, conditions };
|
|
131
|
+
const test = new Validator(isRecord(node.if)
|
|
132
|
+
? { ...closed(node.if, true, defs), $defs: closedDefs }
|
|
133
|
+
: node.if === true, '2020-12', false);
|
|
134
|
+
return { schema, conditions: [...conditions, { test, met: met.asked, unmet: unmet.asked }] };
|
|
135
|
+
}
|
|
98
136
|
function compile(definition) {
|
|
99
137
|
const defs = copied(definition.shape.defs);
|
|
100
|
-
const { sections, member_document: _mark, ...
|
|
138
|
+
const { sections, member_document: _mark, ...written } = copied(definition.shape.schema);
|
|
101
139
|
const closedDefs = mapped(defs, (held) => closed(held, true, defs));
|
|
140
|
+
const read = unconditioned(written, defs, closedDefs);
|
|
141
|
+
const root = read.schema;
|
|
102
142
|
const declared = isRecord(root.properties) ? root.properties : {};
|
|
103
143
|
const properties = {
|
|
104
144
|
[TYPE_FIELD]: true,
|
|
@@ -114,7 +154,7 @@ function compile(definition) {
|
|
|
114
154
|
continue;
|
|
115
155
|
lists.set(name, new Validator({ ...closed(spec.items, false, defs), $defs: closedDefs }, '2020-12', false));
|
|
116
156
|
}
|
|
117
|
-
return { frontmatter, sections: lists };
|
|
157
|
+
return { frontmatter, sections: lists, conditions: read.conditions };
|
|
118
158
|
}
|
|
119
159
|
function compiledOf(definition) {
|
|
120
160
|
const held = compiled.get(definition);
|
|
@@ -150,14 +190,25 @@ function refusalOf(errors) {
|
|
|
150
190
|
return { rule: 'schema', location: '' };
|
|
151
191
|
}
|
|
152
192
|
export function frontmatterRefusal(definition, fields) {
|
|
153
|
-
const
|
|
193
|
+
const { frontmatter } = compiledOf(definition);
|
|
194
|
+
const result = withLinearRegExp(() => frontmatter.validate(fields));
|
|
154
195
|
return result.valid ? undefined : refusalOf(result.errors);
|
|
155
196
|
}
|
|
197
|
+
function askedOf(conditions, fields) {
|
|
198
|
+
return conditions.flatMap((condition) => {
|
|
199
|
+
const asked = condition.test.validate(fields).valid ? condition.met : condition.unmet;
|
|
200
|
+
return [...asked.sections, ...askedOf(asked.conditions, fields)];
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
export function conditionedSections(definition, fields) {
|
|
204
|
+
const { conditions } = compiledOf(definition);
|
|
205
|
+
return withLinearRegExp(() => askedOf(conditions, fields));
|
|
206
|
+
}
|
|
156
207
|
export function fitsItem(definition, section, text) {
|
|
157
208
|
const spec = definition.sections[section];
|
|
158
209
|
const validator = compiledOf(definition).sections.get(section);
|
|
159
210
|
if (spec?.kind !== 'list' || validator === undefined)
|
|
160
211
|
return false;
|
|
161
212
|
const typed = spec.items.type === 'string' ? text : interpretPlain(text);
|
|
162
|
-
return validator.validate(typed).valid;
|
|
213
|
+
return withLinearRegExp(() => validator.validate(typed).valid);
|
|
163
214
|
}
|
package/dist/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';
|
|
@@ -11,15 +12,23 @@ export type ModelVerification = {
|
|
|
11
12
|
readonly rule: string;
|
|
12
13
|
readonly location?: string;
|
|
13
14
|
};
|
|
15
|
+
export type TypedPath = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly named: boolean;
|
|
19
|
+
readonly body: boolean;
|
|
20
|
+
};
|
|
14
21
|
export type ValidationContext = {
|
|
15
22
|
readonly binaryTargets: readonly string[];
|
|
23
|
+
readonly anyRoom?: true;
|
|
24
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
16
25
|
};
|
|
17
26
|
export type ProjectionContext = {
|
|
18
27
|
readonly documentTargets: readonly string[];
|
|
19
28
|
readonly definition?: Definition;
|
|
20
29
|
};
|
|
21
30
|
export type DivisionContext = ProjectionContext & {
|
|
22
|
-
readonly
|
|
31
|
+
readonly bound: number;
|
|
23
32
|
};
|
|
24
33
|
export type Extent = {
|
|
25
34
|
readonly start: number;
|
|
@@ -60,6 +69,10 @@ export type Validation = {
|
|
|
60
69
|
} | ({
|
|
61
70
|
readonly verdict: 'refuse';
|
|
62
71
|
} & Refusal);
|
|
72
|
+
export type ValidationStep = {
|
|
73
|
+
readonly path: string;
|
|
74
|
+
readonly resolved: number;
|
|
75
|
+
};
|
|
63
76
|
export type Projection = {
|
|
64
77
|
readonly ok: true;
|
|
65
78
|
readonly text: string;
|
|
@@ -92,14 +105,31 @@ export type Link = {
|
|
|
92
105
|
readonly href: string;
|
|
93
106
|
readonly target: string;
|
|
94
107
|
};
|
|
95
|
-
export type LinkOccurrence = Link & {
|
|
96
|
-
readonly start: number;
|
|
97
|
-
};
|
|
98
108
|
export type Reference = {
|
|
99
109
|
readonly pointer: string;
|
|
100
110
|
readonly value: string;
|
|
101
111
|
readonly to: readonly string[];
|
|
112
|
+
readonly crossRoom?: true;
|
|
102
113
|
};
|
|
114
|
+
export type RoomReference = {
|
|
115
|
+
readonly handle: string;
|
|
116
|
+
readonly path: string;
|
|
117
|
+
} & ({
|
|
118
|
+
readonly kind: 'link';
|
|
119
|
+
readonly href: string;
|
|
120
|
+
} | {
|
|
121
|
+
readonly kind: 'field';
|
|
122
|
+
readonly pointer: string;
|
|
123
|
+
readonly value: string;
|
|
124
|
+
readonly to: readonly string[];
|
|
125
|
+
readonly crossRoom?: true;
|
|
126
|
+
} | {
|
|
127
|
+
readonly kind: 'item';
|
|
128
|
+
readonly section: string;
|
|
129
|
+
readonly href: string;
|
|
130
|
+
readonly to: readonly string[];
|
|
131
|
+
readonly crossRoom?: true;
|
|
132
|
+
});
|
|
103
133
|
export type Change = {
|
|
104
134
|
readonly kind: 'field';
|
|
105
135
|
readonly name: string;
|
|
@@ -130,6 +160,7 @@ export type ApplyResult = {
|
|
|
130
160
|
} | {
|
|
131
161
|
readonly outcome: 'stale';
|
|
132
162
|
readonly document: Document;
|
|
163
|
+
readonly stale: readonly number[];
|
|
133
164
|
} | {
|
|
134
165
|
readonly outcome: 'refuse';
|
|
135
166
|
readonly refusal: Refusal;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF,MA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
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
|
|
6
|
-
|
|
4
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
5
|
+
export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
|
|
6
|
+
type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
|
|
7
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
|
|
8
|
+
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
9
|
+
export declare function roomReferences(file: string, content: string, definition?: Definition): readonly RoomReference[];
|
|
10
|
+
type Placed = {
|
|
11
|
+
readonly reference: Reached;
|
|
12
|
+
readonly location: string;
|
|
13
|
+
};
|
|
14
|
+
export type Assessment = {
|
|
15
|
+
readonly file: string;
|
|
16
|
+
readonly type: string | undefined;
|
|
17
|
+
readonly targets: readonly string[];
|
|
18
|
+
readonly read: Validation | null;
|
|
19
|
+
readonly structured: Validation | null;
|
|
20
|
+
readonly fields: readonly Placed[];
|
|
21
|
+
readonly linked: boolean;
|
|
22
|
+
readonly sections: readonly Placed[];
|
|
23
|
+
};
|
|
24
|
+
export declare function assess(file: string, content: string, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
|
|
25
|
+
export type Verdicts = {
|
|
26
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
27
|
+
verdict(): Validation;
|
|
28
|
+
};
|
|
29
|
+
export declare function verdicts(): Verdicts;
|
|
30
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
7
31
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
32
|
+
export {};
|
|
8
33
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWzF,OAAO,KAAK,EAEV,aAAa,EAEb,OAAO,EACP,iBAAiB,EACjB,OAAO,EACP,aAAa,EAEb,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AA6GpB,wBAAgB,QAAQ,CACtB,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,OAAO,CAET;AA8BD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAQlF;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,aAAa,CAIjF;AAoFD,KAAK,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;AAEjE,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE,OAAY,GACpB,aAAa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