@idfkit/core 0.1.0 → 0.2.0-rc.2

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.
Files changed (75) hide show
  1. package/README.md +16 -7
  2. package/dist/collection.d.ts +0 -13
  3. package/dist/collection.d.ts.map +1 -1
  4. package/dist/collection.js +1 -1
  5. package/dist/conformance.d.ts +20 -0
  6. package/dist/conformance.d.ts.map +1 -0
  7. package/dist/conformance.js +20 -0
  8. package/dist/conformance.js.map +1 -0
  9. package/dist/docs-url/index.d.ts +81 -0
  10. package/dist/docs-url/index.d.ts.map +1 -0
  11. package/dist/docs-url/index.js +201 -0
  12. package/dist/docs-url/index.js.map +1 -0
  13. package/dist/docs-url/locations.d.ts +2 -0
  14. package/dist/docs-url/locations.d.ts.map +1 -0
  15. package/dist/docs-url/locations.js +272 -0
  16. package/dist/docs-url/locations.js.map +1 -0
  17. package/dist/document.d.ts +40 -14
  18. package/dist/document.d.ts.map +1 -1
  19. package/dist/document.js +0 -0
  20. package/dist/document.js.map +1 -1
  21. package/dist/index.d.ts +19 -3
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +18 -3
  24. package/dist/index.js.map +1 -1
  25. package/dist/introspect/describe.d.ts +117 -0
  26. package/dist/introspect/describe.d.ts.map +1 -0
  27. package/dist/introspect/describe.js +206 -0
  28. package/dist/introspect/describe.js.map +1 -0
  29. package/dist/node.d.ts +5 -5
  30. package/dist/node.d.ts.map +1 -1
  31. package/dist/node.js +25 -5
  32. package/dist/node.js.map +1 -1
  33. package/dist/object.d.ts +1 -1
  34. package/dist/parse/epjson.d.ts +1 -1
  35. package/dist/parse/epjson.d.ts.map +1 -1
  36. package/dist/parse/epjson.js +3 -3
  37. package/dist/parse/epjson.js.map +1 -1
  38. package/dist/parse/idf.d.ts +24 -6
  39. package/dist/parse/idf.d.ts.map +1 -1
  40. package/dist/parse/idf.js +181 -8
  41. package/dist/parse/idf.js.map +1 -1
  42. package/dist/parse/lexer.d.ts +36 -0
  43. package/dist/parse/lexer.d.ts.map +1 -1
  44. package/dist/parse/lexer.js +49 -2
  45. package/dist/parse/lexer.js.map +1 -1
  46. package/dist/typemap.d.ts +7 -5
  47. package/dist/typemap.d.ts.map +1 -1
  48. package/dist/typemap.js +7 -5
  49. package/dist/typemap.js.map +1 -1
  50. package/dist/validate/index.d.ts +11 -0
  51. package/dist/validate/index.d.ts.map +1 -0
  52. package/dist/validate/index.js +10 -0
  53. package/dist/validate/index.js.map +1 -0
  54. package/dist/validate/types.d.ts +63 -0
  55. package/dist/validate/types.d.ts.map +1 -0
  56. package/dist/validate/types.js +25 -0
  57. package/dist/validate/types.js.map +1 -0
  58. package/dist/validate/validate.d.ts +82 -0
  59. package/dist/validate/validate.d.ts.map +1 -0
  60. package/dist/validate/validate.js +574 -0
  61. package/dist/validate/validate.js.map +1 -0
  62. package/dist/write/epjson.d.ts +3 -3
  63. package/dist/write/idf.d.ts +34 -2
  64. package/dist/write/idf.d.ts.map +1 -1
  65. package/dist/write/idf.js +24 -5
  66. package/dist/write/idf.js.map +1 -1
  67. package/package.json +11 -8
  68. package/dist/types/v26-1.d.ts +0 -65896
  69. package/dist/types/v26-1.d.ts.map +0 -1
  70. package/dist/types/v26-1.js +0 -5
  71. package/dist/types/v26-1.js.map +0 -1
  72. package/dist/types/v9-4.d.ts +0 -61414
  73. package/dist/types/v9-4.d.ts.map +0 -1
  74. package/dist/types/v9-4.js +0 -5
  75. package/dist/types/v9-4.js.map +0 -1
@@ -0,0 +1,117 @@
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
+ /**
106
+ * The schema's explanatory prose, loaded on demand.
107
+ *
108
+ * A plain array of strings, indexed by `SlimType.m` and `SlimField.n`. It is
109
+ * passed in rather than reached for, and that is deliberate: reading it is
110
+ * asynchronous, `describeObjectType` is synchronous, and making the function
111
+ * async to fetch a file most callers do not want would be a breaking change
112
+ * serving the minority. Loading it is the caller's step, and its cost is
113
+ * visible at the call site instead of hidden inside a description.
114
+ */
115
+ export type ProsePool = readonly string[];
116
+ export declare function describeObjectType(schema: Schema, objType: string, prose?: ProsePool): ObjectDescription;
117
+ //# 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;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,MAAM,EAAE,CAAC;AAE1C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,SAAS,GAChB,iBAAiB,CAmCnB"}
@@ -0,0 +1,206 @@
1
+ export function describeObjectType(schema, objType, prose) {
2
+ const type = schema.require(objType);
3
+ // Exact-cased input resolves to itself, so this matches Python's verbatim
4
+ // echo of the argument for every name Python accepts.
5
+ const canonical = schema.resolve(objType) ?? objType;
6
+ const properties = mergedProperties(type);
7
+ const requiredFields = type.r ?? [];
8
+ const required = new Set(requiredFields);
9
+ const extensible = type.x;
10
+ const fieldNames = orderedFieldNames(type);
11
+ const fields = fieldNames.map((name) => describeField(name, properties[name], required.has(name), prose));
12
+ return {
13
+ objType: canonical,
14
+ // Resolved from the pool when one is supplied, and `undefined` otherwise —
15
+ // which is exactly what this returned before the pool existed, so a caller
16
+ // who passes nothing sees no change at all (FR-014). A type with no memo in
17
+ // the source schema also reports `undefined`, in both languages: absence is
18
+ // reported as absence rather than filled with a placeholder.
19
+ memo: lookupProse(type.m, prose),
20
+ fields,
21
+ requiredFields: [...requiredFields],
22
+ hasName: type.anon !== 1,
23
+ isExtensible: extensible !== undefined,
24
+ // Python reads `extensible_size` straight from the schema. The slim bundle
25
+ // drops that key, but it is exactly the repeat-group width, which survives
26
+ // as `x.fields.length`. Verified equal for every extensible type in all 17
27
+ // bundled versions, so this is a derivation, not an approximation.
28
+ extensibleSize: extensible === undefined ? undefined : extensible.fields.length,
29
+ };
30
+ }
31
+ /**
32
+ * Field names in the order Python produces them.
33
+ *
34
+ * @internal
35
+ */
36
+ function orderedFieldNames(type) {
37
+ // Python's `get_field_names` returns `legacy_idd.fields[1:]` — it drops the
38
+ // first entry positionally, on the assumption that it is always the name.
39
+ // That holds for every named type in all 17 bundled versions, but 154 types
40
+ // in 26.1.0 are anonymous, and for those the first entry is a real field
41
+ // (`GlobalGeometryRules.starting_vertex_position`, `Output:Variable.key_value`)
42
+ // which Python silently drops. Dropping positionally rather than filtering on
43
+ // `!== 'name'` is what keeps this port in agreement with the oracle; the
44
+ // divergence to close is in Python, not here.
45
+ const names = type.f.slice(1);
46
+ // No legacy field order (or only the name): Python falls back to the key order
47
+ // of the merged property map. Only the fixed half is taken from `p` here; the
48
+ // extensible half is appended below from `x.fields`, which is an array and so
49
+ // keeps its declaration order. Taking it from `x.p` instead would be wrong:
50
+ // the bundle content-addresses each definition through a canonical serializer
51
+ // that sorts object keys, so every `Record` in it is in alphabetical order,
52
+ // not schema order. `AvailabilityManagerAssignmentList` is the type that shows
53
+ // it — its two extensible fields are declared object-type first and sort
54
+ // name first.
55
+ // `fo` is the declaration order, recorded by the bundle for the three types
56
+ // whose `f` holds only the name. Without it the fallback below returns the
57
+ // key order of `p`, which `canonical()` sorted for content-addressing, and
58
+ // the reader gets alphabetical order where Python gives declaration order.
59
+ const ordered = names.length > 0 ? names : (type.fo ?? Object.keys(type.p)).slice();
60
+ if (type.x !== undefined) {
61
+ for (const name of type.x.fields) {
62
+ if (!ordered.includes(name))
63
+ ordered.push(name);
64
+ }
65
+ }
66
+ return ordered;
67
+ }
68
+ /**
69
+ * Python flattens each extension array's `items.properties` into the top-level
70
+ * property map so extensible fields look up the same way as fixed ones. Spread
71
+ * order reproduces that: existing keys keep their position, new ones append.
72
+ *
73
+ * @internal
74
+ */
75
+ function mergedProperties(type) {
76
+ return type.x === undefined ? type.p : { ...type.p, ...type.x.p };
77
+ }
78
+ /** @internal */
79
+ function describeField(name, field, required, prose) {
80
+ if (field === undefined) {
81
+ // In the positional order but absent from the schema. Python reaches the
82
+ // same state via `properties.get(field_name, {})`.
83
+ return {
84
+ name,
85
+ fieldType: undefined,
86
+ required,
87
+ default: undefined,
88
+ units: undefined,
89
+ enumValues: undefined,
90
+ minimum: undefined,
91
+ maximum: undefined,
92
+ exclusiveMinimum: undefined,
93
+ exclusiveMaximum: undefined,
94
+ note: undefined,
95
+ isReference: false,
96
+ objectList: undefined,
97
+ };
98
+ }
99
+ // `auto` marks a field the bundle collapsed from `anyOf: [number, string]`.
100
+ // Python's `describe_object_type` reads `minimum`/`maximum`/`exclusiveMinimum`/
101
+ // `exclusiveMaximum` from the *top level* of the field schema only, and no
102
+ // `anyOf` field in any of the 17 bundled versions carries those keys at the
103
+ // top level — they live on the numeric branch, which that function never looks
104
+ // at. The bundle hoists them; Python reports null. Suppressing them here is
105
+ // what makes the two sides agree. Validation is a separate question and reads
106
+ // the branch properly on both sides; see `validate/`.
107
+ const collapsedAnyOf = field.auto === 1;
108
+ return {
109
+ name,
110
+ fieldType: fieldTypeOf(field),
111
+ required,
112
+ default: field.d,
113
+ units: field.u,
114
+ enumValues: acceptedValues(field),
115
+ minimum: collapsedAnyOf ? undefined : field.min,
116
+ maximum: collapsedAnyOf ? undefined : field.max,
117
+ exclusiveMinimum: collapsedAnyOf ? undefined : field.xmin,
118
+ exclusiveMaximum: collapsedAnyOf ? undefined : field.xmax,
119
+ note: lookupProse(field.n, prose),
120
+ isReference: field.ol !== undefined,
121
+ objectList: field.ol === undefined ? undefined : [...field.ol],
122
+ };
123
+ }
124
+ /**
125
+ * Resolve a prose index against the pool.
126
+ *
127
+ * Returns `undefined` for a record with no prose, and for every record when no
128
+ * pool was supplied. Out-of-range is `undefined` too rather than a throw: a
129
+ * caller who hands in a pool from a different bundle build gets no prose, which
130
+ * is the same thing they had before, instead of a description that cannot be
131
+ * produced at all.
132
+ *
133
+ * @internal
134
+ */
135
+ function lookupProse(index, prose) {
136
+ if (index === undefined || prose === undefined)
137
+ return undefined;
138
+ return prose[index];
139
+ }
140
+ /**
141
+ * The values a field accepts, as Python reports them.
142
+ *
143
+ * Two sources, and until feature 002 this read neither completely:
144
+ *
145
+ * - `e`, the choice list, with the empty string filtered out by the bundle
146
+ * because `e` is what validation checks against. Python keeps the blank, so
147
+ * `eb` records that it was there and it goes back on the front. It is always
148
+ * the front: measured across all 17 schemas, all 21,962 blank-bearing enums
149
+ * carry it at position 0.
150
+ * - `se`, the collapsed `anyOf` string branch, which holds the sentinels.
151
+ * `Autosize` on 10,565 fields and `Autocalculate` on 1,781. Validation has
152
+ * always read it (`validate/validate.ts:543`); this path never did, so
153
+ * `WindowMaterial:Glazing:EquivalentLayer.diffuse_diffuse_solar_transmittance`
154
+ * reported nothing where Python reported `['', 'Autocalculate']`.
155
+ *
156
+ * A field carries one or the other, never both: `se` exists only when the field
157
+ * was an `anyOf`, and `e` is then hoisted from the numeric branch. The 68
158
+ * fields that carry both are the numeric-enum ones, and Python reports the
159
+ * string branch for those, which is what taking `se` first does.
160
+ *
161
+ * @internal
162
+ */
163
+ function acceptedValues(field) {
164
+ if (field.se !== undefined)
165
+ return [...field.se];
166
+ if (field.e === undefined)
167
+ return undefined;
168
+ return field.eb === 1 ? ['', ...field.e] : [...field.e];
169
+ }
170
+ /**
171
+ * Map the slim storage class back to the epJSON JSON-Schema type string Python
172
+ * reports.
173
+ *
174
+ * The bundle stores four storage classes where Python reports the raw `type`
175
+ * key, so the mapping is not automatically one-to-one. Measured against all 17
176
+ * bundled schemas it is, with one exception:
177
+ *
178
+ * - `'a'` is `"string"`. Every `'a'` field is a raw `"type": "string"`, or an
179
+ * enum-only field, which Python also calls `"string"`.
180
+ * - `'n'` is `"number"`, and `"number|string"` when `auto` is set. `auto` is set
181
+ * exactly when the raw field was `anyOf: [{number}, {string}]` — 13052 such
182
+ * fields across all versions, every one of them in that branch order, so the
183
+ * union string is reconstructed exactly rather than guessed.
184
+ * - `'i'` is `"integer"`, and `"integer|string"` when `auto` is set, the
185
+ * `anyOf: [{integer}, {string}]` shape carried by one field per version from
186
+ * 9.3.0 on, `AirTerminal:SingleDuct:ConstantVolume:CooledBeam.number_of_beams`.
187
+ * The bundle also folds `"type": "number"` carrying `"data_type": "integer"`
188
+ * into `'i'`, which would report `"number"` in Python — but no schema in any
189
+ * bundled version actually uses that form.
190
+ * - `'arr'` is `"array"`.
191
+ *
192
+ * @internal
193
+ */
194
+ function fieldTypeOf(field) {
195
+ switch (field.t) {
196
+ case 'arr':
197
+ return 'array';
198
+ case 'i':
199
+ return field.auto === 1 ? 'integer|string' : 'integer';
200
+ case 'n':
201
+ return field.auto === 1 ? 'number|string' : 'number';
202
+ case 'a':
203
+ return 'string';
204
+ }
205
+ }
206
+ //# sourceMappingURL=describe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/introspect/describe.ts"],"names":[],"mappings":"AAuHA,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,OAAe,EACf,KAAiB;IAEjB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,0EAA0E;IAC1E,sDAAsD;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;IAErD,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;I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AsBG;AACH,SAAS,cAAc,CAAC,KAAgB;IACtC,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;IACjD,IAAI,KAAK,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,WAAW,CAAC,KAAgB;IACnC,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QAChB,KAAK,KAAK;YACR,OAAO,OAAO,CAAC;QACjB,KAAK,GAAG;YACN,OAAO,KAAK,CAAC,IAAI,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 { IDFDocument } from './document.js';
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<IDFDocument<M>>;
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<IDFDocument<M>>;
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: IDFDocument<M>, path: string, options?: WriteIdfOptions): Promise<void>;
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: IDFDocument<M>, path: string, options?: WriteEpJsonOptions): Promise<void>;
39
+ export declare function saveEpJson<M extends AnyTypeMap>(document: IdfDocument<M>, path: string, options?: WriteEpJsonOptions): Promise<void>;
40
40
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAA2B,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,C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gB,GACxB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAuBzB;AAOD,qCAAqC;AACrC,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAChE,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAIzB;AAED,uCAAuC;AACvC,wBAAsB,OAAO,CAAC,CAAC,SAAS,UAAU,EAChD,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,0CAA0C;AAC1C,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EACnD,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAEf"}
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 { detectEpJsonVersion, parseEpJson } from './parse/epjson.js';
12
- import { detectVersion, parseIdf } from './parse/idf.js';
11
+ import { getEpJsonVersion, parseEpJson } from './parse/epjson.js';
12
+ import { getIdfVersion, IdfParseError, 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,33 @@ 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(detectVersion(text), options);
54
- return parseIdf(text, schema, options);
53
+ const schema = await schemaFor(getIdfVersion(text), options);
54
+ // `parseIdf` takes text and cannot know where the text came from, so the path is attached here,
55
+ // at the one place that does. Python's parser opens the file itself and fills `filepath` from
56
+ // its own constructor argument; this is the same field reaching a caller by the only route this
57
+ // library has (FR-033).
58
+ //
59
+ // Stamped on both paths: the findings that stop the parse arrive on the error, and the ones that
60
+ // do not arrive in the result. Neither is useful without saying which file it was.
61
+ try {
62
+ const result = parseIdf(text, schema, options);
63
+ return { ...result, diagnostics: result.diagnostics.map((d) => withPath(d, path)) };
64
+ }
65
+ catch (error) {
66
+ if (error instanceof IdfParseError) {
67
+ throw new IdfParseError(error.diagnostics.map((d) => withPath(d, path)));
68
+ }
69
+ throw error;
70
+ }
71
+ }
72
+ /** Attach the source path to a finding, leaving one that already names a file alone. */
73
+ function withPath(diagnostic, path) {
74
+ return diagnostic.filepath === undefined ? { ...diagnostic, filepath: path } : diagnostic;
55
75
  }
56
76
  /** Read and parse an epJSON file. */
57
77
  export async function loadEpJson(path, options = {}) {
58
78
  const text = await readFile(path, 'utf8');
59
- const schema = await schemaFor(detectEpJsonVersion(text), options);
79
+ const schema = await schemaFor(getEpJsonVersion(text), options);
60
80
  return parseEpJson(text, schema, options).document;
61
81
  }
62
82
  /** 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,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAuC,MAAM,gBAAgB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OA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SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC5F,CAAC;AAED,qCAAqC;AACrC,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAAY,EACZ,UAAuB,EAAE;IAEzB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,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 `IDFDocument`. Declared as an interface so a detached object
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 {
@@ -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 detectEpJsonVersion(source: string | EpJson): string | undefined;
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,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB/E"}
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"}
@@ -1,4 +1,4 @@
1
- import { IDFDocument } from '../document.js';
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 IDFDocument(schema);
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 detectEpJsonVersion(source) {
71
+ export function getEpJsonVersion(source) {
72
72
  let root;
73
73
  try {
74
74
  root = typeof source === 'string' ? JSON.parse(source) : source;
@@ -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,GA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C,MAAuB;IACtD,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAY,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC,oBAAoB,CAAC,CAAC;IAC1C,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;SACtB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC9D,CAAC"}
@@ -1,10 +1,16 @@
1
1
  import type { Schema } from '@idfkit/schemas';
2
- import { IDFDocument } from '../document.js';
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 {
6
- /** Object type the problem occurred in, when known. */
7
- typeName?: string;
6
+ /**
7
+ * Object name the problem occurred in, when known.
8
+ *
9
+ * Python spells this `obj_name`, and `typeName` against its `obj_type` is the same idiomatic
10
+ * casing difference the naming register already records. Not a gap, and not renamed: spending a
11
+ * rename to make the register harder to read is the wrong trade.
12
+ */
13
+ objectName?: string;
8
14
  }
9
15
  export interface ParseOptions {
10
16
  /**
@@ -16,7 +22,7 @@ export interface ParseOptions {
16
22
  onDiagnostic?: (diagnostic: ParseDiagnostic) => void;
17
23
  }
18
24
  export interface ParseResult<M extends AnyTypeMap = UntypedMap> {
19
- document: IDFDocument<M>;
25
+ document: IdfDocument<M>;
20
26
  diagnostics: ParseDiagnostic[];
21
27
  }
22
28
  /**
@@ -31,7 +37,19 @@ export declare function parseIdf<M extends AnyTypeMap = UntypedMap>(text: string
31
37
  export declare class IdfParseError extends Error {
32
38
  readonly line: number;
33
39
  readonly typeName: string | undefined;
34
- constructor(diagnostic: ParseDiagnostic);
40
+ /**
41
+ * Every finding that stopped the parse.
42
+ *
43
+ * This error carried `line` and `typeName` from a single diagnostic, flattened into fields, and
44
+ * a caller who wanted the rest had nowhere to look. Python's `IDFParseError` has always carried
45
+ * the collection; this is the half of the difference that was real.
46
+ *
47
+ * `line` and `typeName` still resolve to the first finding's values, so no existing caller
48
+ * breaks (FR-013, FR-014). They are a convenience over `diagnostics[0]` rather than a second
49
+ * source of truth.
50
+ */
51
+ readonly diagnostics: readonly ParseDiagnostic[];
52
+ constructor(diagnostic: ParseDiagnostic | readonly ParseDiagnostic[]);
35
53
  }
36
54
  /**
37
55
  * Read the version identifier from IDF text without a schema.
@@ -40,5 +58,5 @@ export declare class IdfParseError extends Error {
40
58
  * version lives inside the file. This does the minimum scan needed to break
41
59
  * the cycle, and does not validate anything else.
42
60
  */
43
- export declare function detectVersion(text: string): string | undefined;
61
+ export declare function getIdfVersion(text: string): string | undefined;
44
62
  //# sourceMappingURL=idf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"idf.d.ts","sourceRoot":"","sources":["../../src/parse/idf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAEx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