@idfkit/core 0.1.0 → 0.2.0-rc.1
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 +16 -7
- package/dist/collection.d.ts +0 -13
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +1 -1
- package/dist/conformance.d.ts +20 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +20 -0
- package/dist/conformance.js.map +1 -0
- package/dist/docs-url/index.d.ts +81 -0
- package/dist/docs-url/index.d.ts.map +1 -0
- package/dist/docs-url/index.js +201 -0
- package/dist/docs-url/index.js.map +1 -0
- package/dist/docs-url/locations.d.ts +2 -0
- package/dist/docs-url/locations.d.ts.map +1 -0
- package/dist/docs-url/locations.js +272 -0
- package/dist/docs-url/locations.js.map +1 -0
- package/dist/document.d.ts +40 -14
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +0 -0
- package/dist/document.js.map +1 -1
- package/dist/index.d.ts +19 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/introspect/describe.d.ts +106 -0
- package/dist/introspect/describe.d.ts.map +1 -0
- package/dist/introspect/describe.js +168 -0
- package/dist/introspect/describe.js.map +1 -0
- package/dist/node.d.ts +5 -5
- package/dist/node.js +4 -4
- package/dist/node.js.map +1 -1
- package/dist/object.d.ts +1 -1
- package/dist/parse/epjson.d.ts +1 -1
- package/dist/parse/epjson.d.ts.map +1 -1
- package/dist/parse/epjson.js +3 -3
- package/dist/parse/epjson.js.map +1 -1
- package/dist/parse/idf.d.ts +3 -3
- package/dist/parse/idf.js +3 -3
- package/dist/typemap.d.ts +7 -5
- package/dist/typemap.d.ts.map +1 -1
- package/dist/typemap.js +7 -5
- package/dist/typemap.js.map +1 -1
- package/dist/validate/index.d.ts +11 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +10 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/types.d.ts +63 -0
- package/dist/validate/types.d.ts.map +1 -0
- package/dist/validate/types.js +25 -0
- package/dist/validate/types.js.map +1 -0
- package/dist/validate/validate.d.ts +82 -0
- package/dist/validate/validate.d.ts.map +1 -0
- package/dist/validate/validate.js +574 -0
- package/dist/validate/validate.js.map +1 -0
- package/dist/write/epjson.d.ts +3 -3
- package/dist/write/idf.d.ts +2 -2
- package/package.json +11 -8
- package/dist/types/v26-1.d.ts +0 -65896
- package/dist/types/v26-1.d.ts.map +0 -1
- package/dist/types/v26-1.js +0 -5
- package/dist/types/v26-1.js.map +0 -1
- package/dist/types/v9-4.d.ts +0 -61414
- package/dist/types/v9-4.d.ts.map +0 -1
- package/dist/types/v9-4.js +0 -5
- package/dist/types/v9-4.js.map +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Schema } from '@idfkit/schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Description of a single field in an EnergyPlus object type.
|
|
4
|
+
*
|
|
5
|
+
* The field set mirrors Python's `idfkit.introspection.FieldDescription`
|
|
6
|
+
* one-for-one, snake_case renamed to camelCase. Every member is always present,
|
|
7
|
+
* so a description can be diffed against the Python dataclass key by key;
|
|
8
|
+
* Python's `str | None` becomes `string | undefined`.
|
|
9
|
+
*/
|
|
10
|
+
export interface FieldDescription {
|
|
11
|
+
/** Field name in epJSON spelling, e.g. `x_origin`. */
|
|
12
|
+
readonly name: string;
|
|
13
|
+
/**
|
|
14
|
+
* epJSON JSON-Schema type: `"number"`, `"string"`, `"integer"`, `"array"`, or
|
|
15
|
+
* a pipe-delimited union in declaration order for heterogeneous `anyOf`
|
|
16
|
+
* fields, e.g. `"number|string"` for `Schedule:Compact`'s extensible `field`.
|
|
17
|
+
*
|
|
18
|
+
* `undefined` when the field appears in the positional order but carries no
|
|
19
|
+
* schema definition at all.
|
|
20
|
+
*/
|
|
21
|
+
readonly fieldType: string | undefined;
|
|
22
|
+
/** Whether the field is listed in the object's `required` array. */
|
|
23
|
+
readonly required: boolean;
|
|
24
|
+
readonly default: string | number | undefined;
|
|
25
|
+
/** SI units, e.g. `"m"`, `"W/m-K"`. */
|
|
26
|
+
readonly units: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Permitted values for a choice field.
|
|
29
|
+
*
|
|
30
|
+
* Numbers rather than strings for the handful of fields that express a choice
|
|
31
|
+
* numerically, matching Python, which also hands back the raw JSON values.
|
|
32
|
+
*/
|
|
33
|
+
readonly enumValues: readonly (string | number)[] | undefined;
|
|
34
|
+
readonly minimum: number | undefined;
|
|
35
|
+
readonly maximum: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Exclusive minimum, as the schema for this version declares it.
|
|
38
|
+
*
|
|
39
|
+
* `true` rather than a number on 8.9.0 through 9.5.0, whose draft-04 schemas
|
|
40
|
+
* use the keyword as a flag qualifying `minimum` instead of as a bound. Python
|
|
41
|
+
* reports the same raw value, so a caller comparing the two sides sees no
|
|
42
|
+
* difference; a caller comparing a value against it must check the type first.
|
|
43
|
+
*/
|
|
44
|
+
readonly exclusiveMinimum: number | boolean | undefined;
|
|
45
|
+
/** Exclusive maximum. Number or boolean, exactly as `exclusiveMinimum`. */
|
|
46
|
+
readonly exclusiveMaximum: number | boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Field documentation note.
|
|
49
|
+
*
|
|
50
|
+
* Always `undefined` here. The slim schema bundle deliberately drops `note`
|
|
51
|
+
* (see the header of `@idfkit/schemas`'s `types.ts`), and no other faithful
|
|
52
|
+
* source for it exists in this package. It is kept in the type because the
|
|
53
|
+
* naming register requires the same field set on both sides, and because
|
|
54
|
+
* inventing a value from the field name would be worse than admitting the
|
|
55
|
+
* absence.
|
|
56
|
+
*/
|
|
57
|
+
readonly note: string | undefined;
|
|
58
|
+
/** Whether this field points into another object's reference list. */
|
|
59
|
+
readonly isReference: boolean;
|
|
60
|
+
/** Reference list names this field points into. */
|
|
61
|
+
readonly objectList: readonly string[] | undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Description of an EnergyPlus object type.
|
|
65
|
+
*
|
|
66
|
+
* Field set mirrors Python's `idfkit.introspection.ObjectDescription`.
|
|
67
|
+
*/
|
|
68
|
+
export interface ObjectDescription {
|
|
69
|
+
/** Canonical object type name, e.g. `"Zone"`. */
|
|
70
|
+
readonly objType: string;
|
|
71
|
+
/**
|
|
72
|
+
* Object memo from the schema.
|
|
73
|
+
*
|
|
74
|
+
* Always `undefined` here, for the same reason as `FieldDescription.note`:
|
|
75
|
+
* the slim bundle drops `memo`, and this package has no faithful source for
|
|
76
|
+
* it. See that member's note.
|
|
77
|
+
*/
|
|
78
|
+
readonly memo: string | undefined;
|
|
79
|
+
readonly fields: readonly FieldDescription[];
|
|
80
|
+
/** Required field names, in schema order. */
|
|
81
|
+
readonly requiredFields: readonly string[];
|
|
82
|
+
/** Whether the type carries a name field. `Version` and friends do not. */
|
|
83
|
+
readonly hasName: boolean;
|
|
84
|
+
/** Whether the type has a repeating extensible group. */
|
|
85
|
+
readonly isExtensible: boolean;
|
|
86
|
+
/** Number of fields in one extensible repeat group. */
|
|
87
|
+
readonly extensibleSize: number | undefined;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Describe an EnergyPlus object type: its fields, their order, and their
|
|
91
|
+
* constraints.
|
|
92
|
+
*
|
|
93
|
+
* Synchronous and pure, like the rest of `@idfkit/core`'s root entry: the
|
|
94
|
+
* schema is already in memory, and this only reads it.
|
|
95
|
+
*
|
|
96
|
+
* Ports `idfkit.introspection.describe_object_type`. Where the slim schema
|
|
97
|
+
* cannot reproduce Python exactly the loss is recorded in a comment at the
|
|
98
|
+
* point it happens rather than papered over with a plausible substitute.
|
|
99
|
+
*
|
|
100
|
+
* @throws If `objType` is not defined in this schema version. The message is
|
|
101
|
+
* the one `Schema.require` already produces everywhere else in the package;
|
|
102
|
+
* Python raises `UnknownObjectTypeError`, which has no registered TypeScript
|
|
103
|
+
* counterpart and so must not become a new exported class.
|
|
104
|
+
*/
|
|
105
|
+
export declare function describeObjectType(schema: Schema, objType: string): ObjectDescription;
|
|
106
|
+
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/introspect/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACxD,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACxD;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7C,6CAA6C;IAC7C,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CA+BrF"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describe an EnergyPlus object type: its fields, their order, and their
|
|
3
|
+
* constraints.
|
|
4
|
+
*
|
|
5
|
+
* Synchronous and pure, like the rest of `@idfkit/core`'s root entry: the
|
|
6
|
+
* schema is already in memory, and this only reads it.
|
|
7
|
+
*
|
|
8
|
+
* Ports `idfkit.introspection.describe_object_type`. Where the slim schema
|
|
9
|
+
* cannot reproduce Python exactly the loss is recorded in a comment at the
|
|
10
|
+
* point it happens rather than papered over with a plausible substitute.
|
|
11
|
+
*
|
|
12
|
+
* @throws If `objType` is not defined in this schema version. The message is
|
|
13
|
+
* the one `Schema.require` already produces everywhere else in the package;
|
|
14
|
+
* Python raises `UnknownObjectTypeError`, which has no registered TypeScript
|
|
15
|
+
* counterpart and so must not become a new exported class.
|
|
16
|
+
*/
|
|
17
|
+
export function describeObjectType(schema, objType) {
|
|
18
|
+
const type = schema.require(objType);
|
|
19
|
+
// Exact-cased input resolves to itself, so this matches Python's verbatim
|
|
20
|
+
// echo of the argument for every name Python accepts.
|
|
21
|
+
const canonical = schema.resolve(objType) ?? objType;
|
|
22
|
+
const properties = mergedProperties(type);
|
|
23
|
+
const requiredFields = type.r ?? [];
|
|
24
|
+
const required = new Set(requiredFields);
|
|
25
|
+
const extensible = type.x;
|
|
26
|
+
const fieldNames = orderedFieldNames(type);
|
|
27
|
+
const fields = fieldNames.map((name) => describeField(name, properties[name], required.has(name)));
|
|
28
|
+
return {
|
|
29
|
+
objType: canonical,
|
|
30
|
+
// Not carried by the slim bundle. See ObjectDescription.memo.
|
|
31
|
+
memo: undefined,
|
|
32
|
+
fields,
|
|
33
|
+
requiredFields: [...requiredFields],
|
|
34
|
+
hasName: type.anon !== 1,
|
|
35
|
+
isExtensible: extensible !== undefined,
|
|
36
|
+
// Python reads `extensible_size` straight from the schema. The slim bundle
|
|
37
|
+
// drops that key, but it is exactly the repeat-group width, which survives
|
|
38
|
+
// as `x.fields.length`. Verified equal for every extensible type in all 17
|
|
39
|
+
// bundled versions, so this is a derivation, not an approximation.
|
|
40
|
+
extensibleSize: extensible === undefined ? undefined : extensible.fields.length,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Field names in the order Python produces them.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
function orderedFieldNames(type) {
|
|
49
|
+
// Python's `get_field_names` returns `legacy_idd.fields[1:]` — it drops the
|
|
50
|
+
// first entry positionally, on the assumption that it is always the name.
|
|
51
|
+
// That holds for every named type in all 17 bundled versions, but 154 types
|
|
52
|
+
// in 26.1.0 are anonymous, and for those the first entry is a real field
|
|
53
|
+
// (`GlobalGeometryRules.starting_vertex_position`, `Output:Variable.key_value`)
|
|
54
|
+
// which Python silently drops. Dropping positionally rather than filtering on
|
|
55
|
+
// `!== 'name'` is what keeps this port in agreement with the oracle; the
|
|
56
|
+
// divergence to close is in Python, not here.
|
|
57
|
+
const names = type.f.slice(1);
|
|
58
|
+
// No legacy field order (or only the name): Python falls back to the key order
|
|
59
|
+
// of the merged property map. Only the fixed half is taken from `p` here; the
|
|
60
|
+
// extensible half is appended below from `x.fields`, which is an array and so
|
|
61
|
+
// keeps its declaration order. Taking it from `x.p` instead would be wrong:
|
|
62
|
+
// the bundle content-addresses each definition through a canonical serializer
|
|
63
|
+
// that sorts object keys, so every `Record` in it is in alphabetical order,
|
|
64
|
+
// not schema order. `AvailabilityManagerAssignmentList` is the type that shows
|
|
65
|
+
// it — its two extensible fields are declared object-type first and sort
|
|
66
|
+
// name first.
|
|
67
|
+
const ordered = names.length > 0 ? names : Object.keys(type.p);
|
|
68
|
+
if (type.x !== undefined) {
|
|
69
|
+
for (const name of type.x.fields) {
|
|
70
|
+
if (!ordered.includes(name))
|
|
71
|
+
ordered.push(name);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return ordered;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Python flattens each extension array's `items.properties` into the top-level
|
|
78
|
+
* property map so extensible fields look up the same way as fixed ones. Spread
|
|
79
|
+
* order reproduces that: existing keys keep their position, new ones append.
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
function mergedProperties(type) {
|
|
84
|
+
return type.x === undefined ? type.p : { ...type.p, ...type.x.p };
|
|
85
|
+
}
|
|
86
|
+
/** @internal */
|
|
87
|
+
function describeField(name, field, required) {
|
|
88
|
+
if (field === undefined) {
|
|
89
|
+
// In the positional order but absent from the schema. Python reaches the
|
|
90
|
+
// same state via `properties.get(field_name, {})`.
|
|
91
|
+
return {
|
|
92
|
+
name,
|
|
93
|
+
fieldType: undefined,
|
|
94
|
+
required,
|
|
95
|
+
default: undefined,
|
|
96
|
+
units: undefined,
|
|
97
|
+
enumValues: undefined,
|
|
98
|
+
minimum: undefined,
|
|
99
|
+
maximum: undefined,
|
|
100
|
+
exclusiveMinimum: undefined,
|
|
101
|
+
exclusiveMaximum: undefined,
|
|
102
|
+
note: undefined,
|
|
103
|
+
isReference: false,
|
|
104
|
+
objectList: undefined,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// `auto` marks a field the bundle collapsed from `anyOf: [number, string]`.
|
|
108
|
+
// Python's `describe_object_type` reads `minimum`/`maximum`/`exclusiveMinimum`/
|
|
109
|
+
// `exclusiveMaximum` from the *top level* of the field schema only, and no
|
|
110
|
+
// `anyOf` field in any of the 17 bundled versions carries those keys at the
|
|
111
|
+
// top level — they live on the numeric branch, which that function never looks
|
|
112
|
+
// at. The bundle hoists them; Python reports null. Suppressing them here is
|
|
113
|
+
// what makes the two sides agree. Validation is a separate question and reads
|
|
114
|
+
// the branch properly on both sides; see `validate/`.
|
|
115
|
+
const collapsedAnyOf = field.auto === 1;
|
|
116
|
+
return {
|
|
117
|
+
name,
|
|
118
|
+
fieldType: fieldTypeOf(field),
|
|
119
|
+
required,
|
|
120
|
+
default: field.d,
|
|
121
|
+
units: field.u,
|
|
122
|
+
enumValues: field.e === undefined ? undefined : [...field.e],
|
|
123
|
+
minimum: collapsedAnyOf ? undefined : field.min,
|
|
124
|
+
maximum: collapsedAnyOf ? undefined : field.max,
|
|
125
|
+
exclusiveMinimum: collapsedAnyOf ? undefined : field.xmin,
|
|
126
|
+
exclusiveMaximum: collapsedAnyOf ? undefined : field.xmax,
|
|
127
|
+
note: undefined,
|
|
128
|
+
isReference: field.ol !== undefined,
|
|
129
|
+
objectList: field.ol === undefined ? undefined : [...field.ol],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Map the slim storage class back to the epJSON JSON-Schema type string Python
|
|
134
|
+
* reports.
|
|
135
|
+
*
|
|
136
|
+
* The bundle stores four storage classes where Python reports the raw `type`
|
|
137
|
+
* key, so the mapping is not automatically one-to-one. Measured against all 17
|
|
138
|
+
* bundled schemas it is, with one exception:
|
|
139
|
+
*
|
|
140
|
+
* - `'a'` is `"string"`. Every `'a'` field is a raw `"type": "string"`, or an
|
|
141
|
+
* enum-only field, which Python also calls `"string"`.
|
|
142
|
+
* - `'n'` is `"number"`, and `"number|string"` when `auto` is set. `auto` is set
|
|
143
|
+
* exactly when the raw field was `anyOf: [{number}, {string}]` — 13052 such
|
|
144
|
+
* fields across all versions, every one of them in that branch order, so the
|
|
145
|
+
* union string is reconstructed exactly rather than guessed.
|
|
146
|
+
* - `'i'` is `"integer"`, and `"integer|string"` when `auto` is set, the
|
|
147
|
+
* `anyOf: [{integer}, {string}]` shape carried by one field per version from
|
|
148
|
+
* 9.3.0 on, `AirTerminal:SingleDuct:ConstantVolume:CooledBeam.number_of_beams`.
|
|
149
|
+
* The bundle also folds `"type": "number"` carrying `"data_type": "integer"`
|
|
150
|
+
* into `'i'`, which would report `"number"` in Python — but no schema in any
|
|
151
|
+
* bundled version actually uses that form.
|
|
152
|
+
* - `'arr'` is `"array"`.
|
|
153
|
+
*
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
function fieldTypeOf(field) {
|
|
157
|
+
switch (field.t) {
|
|
158
|
+
case 'arr':
|
|
159
|
+
return 'array';
|
|
160
|
+
case 'i':
|
|
161
|
+
return field.auto === 1 ? 'integer|string' : 'integer';
|
|
162
|
+
case 'n':
|
|
163
|
+
return field.auto === 1 ? 'number|string' : 'number';
|
|
164
|
+
case 'a':
|
|
165
|
+
return 'string';
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=describe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/introspect/describe.ts"],"names":[],"mappings":"AA2FA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,OAAe;IAChE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,0EAA0E;IAC1E,sDAAsD;IACtD,MAAM,SAAS,GA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AI,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;QACzD,KAAK,GAAG;YACN,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC;QACvD,KAAK,GAAG;YACN,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
|
package/dist/node.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* to be async "just in case" and browser bundles never pull in `node:fs`.
|
|
7
7
|
*/
|
|
8
8
|
import { SchemaBundle, type Schema } from '@idfkit/schemas';
|
|
9
|
-
import type {
|
|
9
|
+
import type { IdfDocument } from './document.js';
|
|
10
10
|
import { type ParseOptions, type ParseResult } from './parse/idf.js';
|
|
11
11
|
import type { AnyTypeMap, UntypedMap } from './typemap.js';
|
|
12
12
|
import { type WriteEpJsonOptions } from './write/epjson.js';
|
|
@@ -28,13 +28,13 @@ export interface LoadOptions extends ParseOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare function schemaFor(detected: string | undefined, options?: LoadOptions): Promise<Schema>;
|
|
30
30
|
/** Read and parse an IDF file. */
|
|
31
|
-
export declare function loadIdf<M extends AnyTypeMap = UntypedMap>(path: string, options?: LoadOptions): Promise<
|
|
31
|
+
export declare function loadIdf<M extends AnyTypeMap = UntypedMap>(path: string, options?: LoadOptions): Promise<IdfDocument<M>>;
|
|
32
32
|
/** Read and parse an IDF file, keeping non-fatal diagnostics. */
|
|
33
33
|
export declare function loadIdfWithDiagnostics<M extends AnyTypeMap = UntypedMap>(path: string, options?: LoadOptions): Promise<ParseResult<M>>;
|
|
34
34
|
/** Read and parse an epJSON file. */
|
|
35
|
-
export declare function loadEpJson<M extends AnyTypeMap = UntypedMap>(path: string, options?: LoadOptions): Promise<
|
|
35
|
+
export declare function loadEpJson<M extends AnyTypeMap = UntypedMap>(path: string, options?: LoadOptions): Promise<IdfDocument<M>>;
|
|
36
36
|
/** Write a document to an IDF file. */
|
|
37
|
-
export declare function saveIdf<M extends AnyTypeMap>(document:
|
|
37
|
+
export declare function saveIdf<M extends AnyTypeMap>(document: IdfDocument<M>, path: string, options?: WriteIdfOptions): Promise<void>;
|
|
38
38
|
/** Write a document to an epJSON file. */
|
|
39
|
-
export declare function saveEpJson<M extends AnyTypeMap>(document:
|
|
39
|
+
export declare function saveEpJson<M extends AnyTypeMap>(document: IdfDocument<M>, path: string, options?: WriteEpJsonOptions): Promise<void>;
|
|
40
40
|
//# sourceMappingURL=node.d.ts.map
|
package/dist/node.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
9
9
|
import { SchemaBundle } from '@idfkit/schemas';
|
|
10
10
|
import { localBundle } from '@idfkit/schemas/node';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getEpJsonVersion, parseEpJson } from './parse/epjson.js';
|
|
12
|
+
import { getIdfVersion, parseIdf } from './parse/idf.js';
|
|
13
13
|
import { resolveVersion } from './versions.js';
|
|
14
14
|
import { writeEpJson } from './write/epjson.js';
|
|
15
15
|
import { writeIdf } from './write/idf.js';
|
|
@@ -50,13 +50,13 @@ export async function loadIdfWithDiagnostics(path, options = {}) {
|
|
|
50
50
|
// models routinely contain single high bytes (degree signs, accented station
|
|
51
51
|
// names) that are not valid utf-8 and would otherwise decode to U+FFFD.
|
|
52
52
|
const text = await readFile(path, 'latin1');
|
|
53
|
-
const schema = await schemaFor(
|
|
53
|
+
const schema = await schemaFor(getIdfVersion(text), options);
|
|
54
54
|
return parseIdf(text, schema, options);
|
|
55
55
|
}
|
|
56
56
|
/** Read and parse an epJSON file. */
|
|
57
57
|
export async function loadEpJson(path, options = {}) {
|
|
58
58
|
const text = await readFile(path, 'utf8');
|
|
59
|
-
const schema = await schemaFor(
|
|
59
|
+
const schema = await schemaFor(getEpJsonVersion(text), options);
|
|
60
60
|
return parseEpJson(text, schema, options).document;
|
|
61
61
|
}
|
|
62
62
|
/** Write a document to an IDF file. */
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAuC,MAAM,gBAAgB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAwB,MAAM,gBAAgB,CAAC;AAEhE,IAAI,aAAuC,CAAC;AAE5C,kFAAkF;AAClF,MAAM,UAAU,OAAO;IACrB,aAAa,KAAK,WAAW,EAAE,CAAC;IAChC,OAAO,aAAa,CAAC;AACvB,CAAC;AASD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,QAA4B,EAC5B,UAAuB,EAAE;IAEzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;IAC3C,IAAI,OAAO,CAAC,OAAO,KAA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AI,EAAE,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAChE,OAAO,WAAW,CAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC;AACxD,CAAC;AAED,uCAAuC;AACvC,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,QAAwB,EACxB,IAAY,EACZ,UAA2B,EAAE;IAE7B,MAAM,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAwB,EACxB,IAAY,EACZ,UAA8B,EAAE;IAEhC,MAAM,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/object.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type FieldValues = Record<string, StoredValue | null | undefined>;
|
|
|
12
12
|
/**
|
|
13
13
|
* Something that wants to know when an object changes.
|
|
14
14
|
*
|
|
15
|
-
* Implemented by `
|
|
15
|
+
* Implemented by `IdfDocument`. Declared as an interface so a detached object
|
|
16
16
|
* has no dependency on the document at all.
|
|
17
17
|
*/
|
|
18
18
|
export interface ObjectOwner {
|
package/dist/parse/epjson.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export type EpJson = Record<string, Record<string, Record<string, unknown>>>;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function parseEpJson<M extends AnyTypeMap = UntypedMap>(source: string | EpJson, schema: Schema, options?: ParseOptions): ParseResult<M>;
|
|
14
14
|
/** Read the version identifier from epJSON without a schema. */
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function getEpJsonVersion(source: string | EpJson): string | undefined;
|
|
16
16
|
//# sourceMappingURL=epjson.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epjson.d.ts","sourceRoot":"","sources":["../../src/parse/epjson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAmB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG3E,2DAA2D;AAC3D,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7E;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAC3D,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,YAAiB,GACzB,WAAW,CAAC,CAAC,CAAC,CA6DhB;AAED,gEAAgE;AAChE,wBAAgB,
|
|
1
|
+
{"version":3,"file":"epjson.d.ts","sourceRoot":"","sources":["../../src/parse/epjson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAmB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG3E,2DAA2D;AAC3D,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7E;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAC3D,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,YAAiB,GACzB,WAAW,CAAC,CAAC,CAAC,CA6DhB;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB5E"}
|
package/dist/parse/epjson.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IdfDocument } from '../document.js';
|
|
2
2
|
import { IdfParseError } from './idf.js';
|
|
3
3
|
/**
|
|
4
4
|
* Parse epJSON into a document.
|
|
@@ -26,7 +26,7 @@ export function parseEpJson(source, schema, options = {}) {
|
|
|
26
26
|
line: 1,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
const document = new
|
|
29
|
+
const document = new IdfDocument(schema);
|
|
30
30
|
for (const [typeName, body] of Object.entries(root)) {
|
|
31
31
|
const canonical = schema.resolve(typeName);
|
|
32
32
|
if (canonical === undefined) {
|
|
@@ -68,7 +68,7 @@ export function parseEpJson(source, schema, options = {}) {
|
|
|
68
68
|
return { document, diagnostics };
|
|
69
69
|
}
|
|
70
70
|
/** Read the version identifier from epJSON without a schema. */
|
|
71
|
-
export function
|
|
71
|
+
export function getEpJsonVersion(source) {
|
|
72
72
|
let root;
|
|
73
73
|
try {
|
|
74
74
|
root = typeof source === 'string' ? JSON.parse(source) : source;
|
package/dist/parse/epjson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epjson.js","sourceRoot":"","sources":["../../src/parse/epjson.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,MAAuB,EACvB,MAAc,EACd,UAAwB,EAAE;IAE1B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC;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,5 @@
|
|
|
1
1
|
import type { Schema } from '@idfkit/schemas';
|
|
2
|
-
import {
|
|
2
|
+
import { IdfDocument } from '../document.js';
|
|
3
3
|
import type { AnyTypeMap, UntypedMap } from '../typemap.js';
|
|
4
4
|
import { type LexDiagnostic } from './lexer.js';
|
|
5
5
|
export interface ParseDiagnostic extends LexDiagnostic {
|
|
@@ -16,7 +16,7 @@ export interface ParseOptions {
|
|
|
16
16
|
onDiagnostic?: (diagnostic: ParseDiagnostic) => void;
|
|
17
17
|
}
|
|
18
18
|
export interface ParseResult<M extends AnyTypeMap = UntypedMap> {
|
|
19
|
-
document:
|
|
19
|
+
document: IdfDocument<M>;
|
|
20
20
|
diagnostics: ParseDiagnostic[];
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -40,5 +40,5 @@ export declare class IdfParseError extends Error {
|
|
|
40
40
|
* version lives inside the file. This does the minimum scan needed to break
|
|
41
41
|
* the cycle, and does not validate anything else.
|
|
42
42
|
*/
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function getIdfVersion(text: string): string | undefined;
|
|
44
44
|
//# sourceMappingURL=idf.d.ts.map
|
package/dist/parse/idf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IdfDocument } from '../document.js';
|
|
2
2
|
import { lex } from './lexer.js';
|
|
3
3
|
/**
|
|
4
4
|
* Parse IDF text into a document.
|
|
@@ -19,7 +19,7 @@ export function parseIdf(text, schema, options = {}) {
|
|
|
19
19
|
options.onDiagnostic?.(diagnostic);
|
|
20
20
|
};
|
|
21
21
|
const raw = lex(text, { onDiagnostic: report });
|
|
22
|
-
const document = new
|
|
22
|
+
const document = new IdfDocument(schema);
|
|
23
23
|
for (const object of raw) {
|
|
24
24
|
const canonical = schema.resolve(object.typeName);
|
|
25
25
|
if (canonical === undefined) {
|
|
@@ -151,7 +151,7 @@ export class IdfParseError extends Error {
|
|
|
151
151
|
* version lives inside the file. This does the minimum scan needed to break
|
|
152
152
|
* the cycle, and does not validate anything else.
|
|
153
153
|
*/
|
|
154
|
-
export function
|
|
154
|
+
export function getIdfVersion(text) {
|
|
155
155
|
// Strip comments first. Trying to tolerate them inside the pattern means
|
|
156
156
|
// guessing how many comment lines sit between the comma and the value, which
|
|
157
157
|
// is exactly the kind of thing that works on the file you tested and fails on
|
package/dist/typemap.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version-specific static typing, with no runtime cost at all.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* object type plus a `TypeMap` joining type name to
|
|
6
|
-
* parameterized by that map resolves `doc.all('Zone')` to
|
|
7
|
-
* objects with `Zone`'s fields, and the editor completes among
|
|
8
|
-
* names as you type the string.
|
|
4
|
+
* An opt-in package (`@idfkit/types-v26-1`, one per EnergyPlus version) exports
|
|
5
|
+
* one interface per object type plus a `TypeMap` joining type name to
|
|
6
|
+
* interface. A document parameterized by that map resolves `doc.all('Zone')` to
|
|
7
|
+
* a collection of objects with `Zone`'s fields, and the editor completes among
|
|
8
|
+
* all 858 type names as you type the string. Install none of them and every
|
|
9
|
+
* document is an `UntypedMap`: nothing stops working, the field names are
|
|
10
|
+
* simply not checked.
|
|
9
11
|
*
|
|
10
12
|
* This is where JavaScript beats the Python original rather than imitating it.
|
|
11
13
|
* `__getattr__` resolves names at runtime, so an editor cannot see them and a
|
package/dist/typemap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typemap.d.ts","sourceRoot":"","sources":["../src/typemap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"typemap.d.ts","sourceRoot":"","sources":["../src/typemap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD,iDAAiD;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElF,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,GAC5E,CAAC,CAAC,CAAC,CAAC,GACJ,UAAU,CAAC;AAEf;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,GAC5E,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACb,WAAW,CAAC"}
|
package/dist/typemap.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version-specific static typing, with no runtime cost at all.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* object type plus a `TypeMap` joining type name to
|
|
6
|
-
* parameterized by that map resolves `doc.all('Zone')` to
|
|
7
|
-
* objects with `Zone`'s fields, and the editor completes among
|
|
8
|
-
* names as you type the string.
|
|
4
|
+
* An opt-in package (`@idfkit/types-v26-1`, one per EnergyPlus version) exports
|
|
5
|
+
* one interface per object type plus a `TypeMap` joining type name to
|
|
6
|
+
* interface. A document parameterized by that map resolves `doc.all('Zone')` to
|
|
7
|
+
* a collection of objects with `Zone`'s fields, and the editor completes among
|
|
8
|
+
* all 858 type names as you type the string. Install none of them and every
|
|
9
|
+
* document is an `UntypedMap`: nothing stops working, the field names are
|
|
10
|
+
* simply not checked.
|
|
9
11
|
*
|
|
10
12
|
* This is where JavaScript beats the Python original rather than imitating it.
|
|
11
13
|
* `__getattr__` resolves names at runtime, so an editor cannot see them and a
|
package/dist/typemap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typemap.js","sourceRoot":"","sources":["../src/typemap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"typemap.js","sourceRoot":"","sources":["../src/typemap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema validation.
|
|
3
|
+
*
|
|
4
|
+
* Five names, matching the Python library's `idfkit.validation` one for one
|
|
5
|
+
* under the field-casing rule. Everything else in this directory is an
|
|
6
|
+
* implementation detail.
|
|
7
|
+
*/
|
|
8
|
+
export { validateDocument, validateObject } from './validate.js';
|
|
9
|
+
export { Severity } from './types.js';
|
|
10
|
+
export type { ValidationError, ValidationResult } from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema validation.
|
|
3
|
+
*
|
|
4
|
+
* Five names, matching the Python library's `idfkit.validation` one for one
|
|
5
|
+
* under the field-casing rule. Everything else in this directory is an
|
|
6
|
+
* implementation detail.
|
|
7
|
+
*/
|
|
8
|
+
export { validateDocument, validateObject } from './validate.js';
|
|
9
|
+
export { Severity } from './types.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vocabulary validation reports in.
|
|
3
|
+
*
|
|
4
|
+
* A finding is a record, not a throw. The Python original names the type
|
|
5
|
+
* `ValidationError` and this port keeps that spelling, but nothing here is ever
|
|
6
|
+
* raised: a finding carries a severity and a location, and callers collect them
|
|
7
|
+
* into a `ValidationResult` and decide what to do. Naming it after an exception
|
|
8
|
+
* and then returning it is the one thing the naming register asks both
|
|
9
|
+
* libraries to keep in step, so the name stays.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Severity of a validation finding.
|
|
13
|
+
*
|
|
14
|
+
* Both a value and a type. The value gives the Python original's
|
|
15
|
+
* `Severity.ERROR` spelling; the type is the string union that a `'error'`
|
|
16
|
+
* literal satisfies, which is how the same three strings reach the wire in both
|
|
17
|
+
* languages. The strings themselves are load-bearing: the conformance corpus
|
|
18
|
+
* compares them across the two implementations.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Severity: Readonly<{
|
|
21
|
+
readonly ERROR: "error";
|
|
22
|
+
readonly WARNING: "warning";
|
|
23
|
+
readonly INFO: "info";
|
|
24
|
+
}>;
|
|
25
|
+
export type Severity = (typeof Severity)[keyof typeof Severity];
|
|
26
|
+
/**
|
|
27
|
+
* One validation finding.
|
|
28
|
+
*
|
|
29
|
+
* `code` is the machine-readable part and is shared with the Python library
|
|
30
|
+
* verbatim (`E001`…`E010`, `W002`, `W003`). `message` is for a human and is
|
|
31
|
+
* *not* guaranteed identical across the two languages: number formatting and
|
|
32
|
+
* type names differ between the runtimes. Match on `code`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ValidationError {
|
|
35
|
+
/** How serious the finding is. */
|
|
36
|
+
readonly severity: Severity;
|
|
37
|
+
/** Object type the finding was found on. */
|
|
38
|
+
readonly objType: string;
|
|
39
|
+
/** Object name the finding was found on. Empty for anonymous objects. */
|
|
40
|
+
readonly objName: string;
|
|
41
|
+
/** Field the finding concerns, or `undefined` when it concerns the object. */
|
|
42
|
+
readonly field: string | undefined;
|
|
43
|
+
/** Human-readable description. */
|
|
44
|
+
readonly message: string;
|
|
45
|
+
/** Machine-readable code, stable across languages. */
|
|
46
|
+
readonly code: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Everything one validation run found, split by severity.
|
|
50
|
+
*
|
|
51
|
+
* `isValid` and `totalIssues` are computed once when the result is built rather
|
|
52
|
+
* than being live properties, because the arrays are read-only.
|
|
53
|
+
*/
|
|
54
|
+
export interface ValidationResult {
|
|
55
|
+
readonly errors: readonly ValidationError[];
|
|
56
|
+
readonly warnings: readonly ValidationError[];
|
|
57
|
+
readonly info: readonly ValidationError[];
|
|
58
|
+
/** True when `errors` is empty. Warnings and info do not make a model invalid. */
|
|
59
|
+
readonly isValid: boolean;
|
|
60
|
+
/** `errors + warnings + info`. */
|
|
61
|
+
readonly totalIssues: number;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validate/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ;;;;EAIV,CAAC;AAEZ,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,CAAC;IAC1C,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B"}
|