@ifc-lite/mcp 0.26.2 → 0.27.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.
Files changed (127) hide show
  1. package/README.md +9 -0
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/context.d.ts +8 -0
  5. package/dist/context.d.ts.map +1 -1
  6. package/dist/context.js.map +1 -1
  7. package/dist/headless-backend-align.d.ts +1 -4
  8. package/dist/headless-backend-align.d.ts.map +1 -1
  9. package/dist/headless-backend-align.js +0 -11
  10. package/dist/headless-backend-align.js.map +1 -1
  11. package/dist/headless-backend.d.ts +4 -72
  12. package/dist/headless-backend.d.ts.map +1 -1
  13. package/dist/headless-backend.js +9 -313
  14. package/dist/headless-backend.js.map +1 -1
  15. package/dist/loader.d.ts.map +1 -1
  16. package/dist/loader.js +14 -21
  17. package/dist/loader.js.map +1 -1
  18. package/dist/resources/providers.js +1 -1
  19. package/dist/resources/providers.js.map +1 -1
  20. package/dist/server.d.ts.map +1 -1
  21. package/dist/server.js +2 -1
  22. package/dist/server.js.map +1 -1
  23. package/dist/tools/diff-authored-keys.d.ts +1 -1
  24. package/dist/tools/diff-authored-keys.d.ts.map +1 -1
  25. package/dist/tools/diff-authored-keys.js +1 -1
  26. package/dist/tools/diff-authored-keys.js.map +1 -1
  27. package/dist/tools/diff-content.d.ts +1 -1
  28. package/dist/tools/diff-content.d.ts.map +1 -1
  29. package/dist/tools/diff-content.js +1 -1
  30. package/dist/tools/diff-content.js.map +1 -1
  31. package/dist/tools/diff-entity-scope.d.ts +1 -1
  32. package/dist/tools/diff-entity-scope.d.ts.map +1 -1
  33. package/dist/tools/diff-fingerprints.d.ts +1 -1
  34. package/dist/tools/diff-fingerprints.d.ts.map +1 -1
  35. package/dist/tools/diff-fingerprints.js +1 -1
  36. package/dist/tools/diff-fingerprints.js.map +1 -1
  37. package/dist/tools/diff.js +1 -1
  38. package/dist/tools/diff.js.map +1 -1
  39. package/dist/tools/discovery.d.ts.map +1 -1
  40. package/dist/tools/discovery.js +10 -3
  41. package/dist/tools/discovery.js.map +1 -1
  42. package/dist/tools/entity-create.js +1 -1
  43. package/dist/tools/entity-create.js.map +1 -1
  44. package/dist/tools/export.d.ts.map +1 -1
  45. package/dist/tools/export.js +36 -46
  46. package/dist/tools/export.js.map +1 -1
  47. package/dist/tools/flow-ai.js +1 -1
  48. package/dist/tools/flow-ai.js.map +1 -1
  49. package/dist/tools/flow-host.d.ts.map +1 -1
  50. package/dist/tools/flow-host.js +7 -2
  51. package/dist/tools/flow-host.js.map +1 -1
  52. package/dist/tools/flow.js +1 -1
  53. package/dist/tools/flow.js.map +1 -1
  54. package/dist/tools/layer-store.d.ts.map +1 -1
  55. package/dist/tools/layer-store.js +8 -7
  56. package/dist/tools/layer-store.js.map +1 -1
  57. package/dist/tools/mutate.d.ts.map +1 -1
  58. package/dist/tools/mutate.js +8 -2
  59. package/dist/tools/mutate.js.map +1 -1
  60. package/dist/tools/query.js +1 -1
  61. package/dist/tools/query.js.map +1 -1
  62. package/dist/tools/review-captures.d.ts.map +1 -1
  63. package/dist/tools/review-captures.js +2 -1
  64. package/dist/tools/review-captures.js.map +1 -1
  65. package/dist/tools/review-findings.d.ts.map +1 -1
  66. package/dist/tools/review-findings.js +13 -5
  67. package/dist/tools/review-findings.js.map +1 -1
  68. package/dist/tools/util.d.ts +11 -0
  69. package/dist/tools/util.d.ts.map +1 -1
  70. package/dist/tools/util.js +24 -1
  71. package/dist/tools/util.js.map +1 -1
  72. package/dist/tools/validation.d.ts.map +1 -1
  73. package/dist/tools/validation.js +1 -3
  74. package/dist/tools/validation.js.map +1 -1
  75. package/package.json +18 -18
  76. package/dist/authored-attribute-value.d.ts +0 -3
  77. package/dist/authored-attribute-value.d.ts.map +0 -1
  78. package/dist/authored-attribute-value.js +0 -34
  79. package/dist/authored-attribute-value.js.map +0 -1
  80. package/dist/backend-query-relationships.d.ts +0 -5
  81. package/dist/backend-query-relationships.d.ts.map +0 -1
  82. package/dist/backend-query-relationships.js +0 -55
  83. package/dist/backend-query-relationships.js.map +0 -1
  84. package/dist/backend-query.d.ts +0 -48
  85. package/dist/backend-query.d.ts.map +0 -1
  86. package/dist/backend-query.js +0 -383
  87. package/dist/backend-query.js.map +0 -1
  88. package/dist/effective-entity-membership.d.ts +0 -8
  89. package/dist/effective-entity-membership.d.ts.map +0 -1
  90. package/dist/effective-entity-membership.js +0 -23
  91. package/dist/effective-entity-membership.js.map +0 -1
  92. package/dist/headless-backend-cost-store.d.ts +0 -14
  93. package/dist/headless-backend-cost-store.d.ts.map +0 -1
  94. package/dist/headless-backend-cost-store.js +0 -20
  95. package/dist/headless-backend-cost-store.js.map +0 -1
  96. package/dist/headless-backend-modelling.d.ts +0 -50
  97. package/dist/headless-backend-modelling.d.ts.map +0 -1
  98. package/dist/headless-backend-modelling.js +0 -128
  99. package/dist/headless-backend-modelling.js.map +0 -1
  100. package/dist/headless-backend-room.d.ts +0 -8
  101. package/dist/headless-backend-room.d.ts.map +0 -1
  102. package/dist/headless-backend-room.js +0 -24
  103. package/dist/headless-backend-room.js.map +0 -1
  104. package/dist/headless-backend-store-stubs.d.ts +0 -13
  105. package/dist/headless-backend-store-stubs.d.ts.map +0 -1
  106. package/dist/headless-backend-store-stubs.js +0 -9
  107. package/dist/headless-backend-store-stubs.js.map +0 -1
  108. package/dist/headless-backend-store.d.ts +0 -8
  109. package/dist/headless-backend-store.d.ts.map +0 -1
  110. package/dist/headless-backend-store.js +0 -38
  111. package/dist/headless-backend-store.js.map +0 -1
  112. package/dist/headless-backend-structural-store.d.ts +0 -21
  113. package/dist/headless-backend-structural-store.d.ts.map +0 -1
  114. package/dist/headless-backend-structural-store.js +0 -20
  115. package/dist/headless-backend-structural-store.js.map +0 -1
  116. package/dist/headless-backend-structural.d.ts +0 -4
  117. package/dist/headless-backend-structural.d.ts.map +0 -1
  118. package/dist/headless-backend-structural.js +0 -24
  119. package/dist/headless-backend-structural.js.map +0 -1
  120. package/dist/overlay.d.ts +0 -166
  121. package/dist/overlay.d.ts.map +0 -1
  122. package/dist/overlay.js +0 -285
  123. package/dist/overlay.js.map +0 -1
  124. package/dist/schema-tables.d.ts +0 -42
  125. package/dist/schema-tables.d.ts.map +0 -1
  126. package/dist/schema-tables.js +0 -77
  127. package/dist/schema-tables.js.map +0 -1
package/dist/overlay.js DELETED
@@ -1,285 +0,0 @@
1
- /* This Source Code Form is subject to the terms of the Mozilla Public
2
- * License, v. 2.0. If a copy of the MPL was not distributed with this
3
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- /**
5
- * The pending-mutation overlay, in the shape the server's read surface needs to
6
- * read it. One reader for every tool: `model_diff` (#2000) and, since #2004, the
7
- * query backend, `model_info` and `count_entities`.
8
- *
9
- * A `model_id` on this server does not name a file — it names a session model,
10
- * and `entity_set_property` / `entity_set_attribute` / `entity_create` /
11
- * `entity_delete` queue their edits in a `MutablePropertyView` overlay that the
12
- * parsed `IfcDataStore` never sees (the store's buffer and index are immutable;
13
- * the overlay materialises at `export_ifc` / `model_save` time).
14
- *
15
- * Read straight from the store, a tool therefore answers about the file as it
16
- * was parsed. That is the wrong answer for the caller most likely to ask: an
17
- * agent edits, reads back to confirm, and is told its edit did not happen — and
18
- * the natural recovery from that is to edit again.
19
- *
20
- * **Reads fold the overlay in silently; the payload then says how many edits are
21
- * queued.** Folding is what makes "what is there now" answerable at all, and
22
- * `query_entities`' filters make it non-negotiable: a query for the value an
23
- * agent just wrote has to find it, and a tool that reported the divergence
24
- * instead of folding would still return the pre-edit row set. Reporting is what
25
- * keeps the answer honest about not being on disk yet — `pendingMutations` is
26
- * absent, not zero, on a session that has never been edited, so nothing changes
27
- * for a read-only caller.
28
- */
29
- import { countEffectiveEntityTypes } from '@ifc-lite/data';
30
- import { storeHasSourceEntity } from '@ifc-lite/mutations';
31
- import { getInheritanceChainAcrossSchemas, effectiveRelationshipEdges, resolveEffectiveEntityRecord, resolveEffectiveRelationshipOverlay, normalizeIfcTypeName, } from '@ifc-lite/parser';
32
- import { effectiveSourceIds, pendingEntityMembership } from './effective-entity-membership.js';
33
- const NO_POSITIONAL_ATTRIBUTES = new Map();
34
- /**
35
- * The model's pending overlay, or `null` when it has none.
36
- *
37
- * Null is the answer for every model that was only ever read: the backend
38
- * creates the view lazily on the first mutation, so an unedited session pays
39
- * nothing and every caller keeps its original store-only path.
40
- */
41
- export function pendingOverlay(model) {
42
- return model.backend.pendingOverlay();
43
- }
44
- /**
45
- * The same reader, built from the view directly.
46
- *
47
- * The backend owns its `MutablePropertyView` and folds the overlay into its own
48
- * query adapter, so it cannot go through `pendingOverlay` — that would need a
49
- * `LoadedModel`, which is the registry entry wrapped *around* the backend.
50
- */
51
- export function overlayFromView(view, store) {
52
- if (!view || !view.hasPendingChanges())
53
- return null;
54
- return new ViewOverlay(view, store);
55
- }
56
- /**
57
- * **Everything derived is lazy, and the point lookup does not derive at all.**
58
- *
59
- * A fresh `ViewOverlay` is built on every overlay read — that is what keeps it
60
- * honest, because there is no revision counter on `MutablePropertyView` to cache
61
- * against and `getMutations().length` is not one (`mutation_undo` splices the
62
- * history, so a later write can land back on the same length). A stale overlay
63
- * after a mutation is a correctness bug; rebuilding is not.
64
- *
65
- * So the rebuild is made cheap instead. The constructor does no work, each
66
- * derived collection is computed once per instance on first use, and
67
- * `createdEntity` — the one called per entity by `entityData` — goes straight to
68
- * the view's own id map rather than materialising the whole created list.
69
- * Measured on a 20k-wall model with 2,000 queued creates, a 1,000-id
70
- * `get_entities_bulk` went from ~1,960ms to ~7ms (median of five), and
71
- * `getMutations()` (which copies the whole history) is no longer touched unless
72
- * a payload reports the count.
73
- */
74
- class ViewOverlay {
75
- view;
76
- store;
77
- tombstones = null;
78
- all = null;
79
- identified = null;
80
- count = null;
81
- effectiveRelations = null;
82
- constructor(view, store) {
83
- this.view = view;
84
- this.store = store;
85
- }
86
- get deleted() {
87
- if (!this.tombstones)
88
- this.tombstones = this.view.getTombstones();
89
- return this.tombstones;
90
- }
91
- /** The created entity as export writes it: effective class, name-relaid attributes, edits applied. */
92
- effectiveCreatedEntity(entity) {
93
- const record = resolveEffectiveEntityRecord(entity, {
94
- retype: this.view.getEntityTypeMutation(entity.expressId)?.newType,
95
- named: this.view.getAttributeMutationsForEntity(entity.expressId).map(({ name, value }) => [name, value]),
96
- positional: this.view.getPositionalMutationsForEntity(entity.expressId) ?? [],
97
- }, this.store.schemaVersion);
98
- return toCreatedEntity({ ...entity, type: record.type, attributes: record.attributes });
99
- }
100
- get createdAll() {
101
- if (!this.all)
102
- this.all = this.view.getNewEntities().map(entity => this.effectiveCreatedEntity(entity));
103
- return this.all;
104
- }
105
- get created() {
106
- if (!this.identified)
107
- this.identified = this.createdAll.filter((entity) => entity.globalId !== '');
108
- return this.identified;
109
- }
110
- get pendingMutations() {
111
- // `getMutations()` copies the whole history, so it is paid once per overlay
112
- // and only when something actually reports the number.
113
- if (this.count === null)
114
- this.count = this.view.getMutations().length;
115
- return this.count;
116
- }
117
- createdEntity(expressId) {
118
- // The view already indexes new entities by id; going through `createdAll`
119
- // here made every `entityData` call O(number of queued creates).
120
- const raw = this.view.getNewEntity(expressId);
121
- return raw ? this.effectiveCreatedEntity(raw) : null;
122
- }
123
- effectiveType(expressId) {
124
- const retype = this.view.getEntityTypeMutation(expressId)?.newType;
125
- return retype ? normalizeIfcTypeName(retype) : null;
126
- }
127
- typeMutations() {
128
- return this.view.getTypeMutations();
129
- }
130
- getTypeMutations() {
131
- return this.view.getTypeMutations();
132
- }
133
- attributes(expressId) {
134
- // Every queued write, not a chosen few. Last write wins, which is what
135
- // `getAttributeMutationsForEntity` already orders for us.
136
- const out = new Map();
137
- for (const { name, value } of this.view.getAttributeMutationsForEntity(expressId)) {
138
- out.set(name, value);
139
- }
140
- return out;
141
- }
142
- positionalAttributes(expressId) {
143
- return this.view.getPositionalMutationsForEntity(expressId) ?? NO_POSITIONAL_ATTRIBUTES;
144
- }
145
- attributesByEntity() {
146
- return this.view.getAttributeMutationsByEntity();
147
- }
148
- get relationshipOverlay() {
149
- if (!this.effectiveRelations)
150
- this.effectiveRelations = resolveEffectiveRelationshipOverlay(this.store, {
151
- createdEntities: () => this.view.getNewEntities(),
152
- mutatedEntityIds: () => this.view.getEffectiveChanges().map(change => change.entityId),
153
- namedAttributes: id => this.view.getAttributeMutationsForEntity(id).map(({ name, value }) => [name, value]),
154
- positionalAttributes: id => this.view.getPositionalMutationsForEntity(id) ?? [],
155
- entityType: id => this.view.getEntityTypeMutation(id)?.newType,
156
- isDeleted: id => this.view.isDeleted(id),
157
- });
158
- return this.effectiveRelations;
159
- }
160
- relationshipEdges(expressId, ifcRelType) {
161
- return effectiveRelationshipEdges(this.relationshipOverlay, id => this.view.isDeleted(id), expressId, ifcRelType);
162
- }
163
- get supersededRelationshipIds() {
164
- return this.relationshipOverlay.supersededSourceIds;
165
- }
166
- propertySets(expressId) {
167
- return this.view.getForEntity(expressId);
168
- }
169
- quantitySets(expressId) {
170
- return this.view.getQuantitiesForEntity(expressId);
171
- }
172
- }
173
- /**
174
- * Entity count per STEP type key, with queued creates, deletes and retypes
175
- * applied by the shared aggregate accessor. A created entity is counted under
176
- * its effective uppercase class, matching the parsed type buckets.
177
- */
178
- export function foldedTypeCounts(store, overlay) {
179
- return countEffectiveEntityTypes(store, pendingEntityMembership(overlay), effectiveSourceIds(store));
180
- }
181
- /**
182
- * The model's entity count with the session's creates and deletes applied.
183
- *
184
- * Adjusts the parser's own total rather than re-summing `byType`, so an unedited
185
- * model's number is byte-for-byte what it always was.
186
- *
187
- * Only tombstones that name a STORE entity are subtracted. A created-then-
188
- * deleted entity is already absent from `createdAll`, so counting its tombstone
189
- * too would subtract it a second time and report one entity fewer than the file
190
- * has (#2012). This also makes a tombstone on an id the store never had — which
191
- * `entity_delete` rejects, but nothing here relies on that — unable to drive the
192
- * count below the truth.
193
- */
194
- export function foldedEntityCount(store, overlay) {
195
- if (!overlay)
196
- return store.entityCount;
197
- let deletedFromStore = 0;
198
- for (const id of overlay.deleted) {
199
- if (storeHasSourceEntity(store, id))
200
- deletedFromStore++;
201
- }
202
- return store.entityCount + overlay.createdAll.length - deletedFromStore;
203
- }
204
- /**
205
- * `{ pendingMutations: n }` when any of the sessions has queued edits, `{}`
206
- * otherwise — spread into a tool payload so an unedited session's shape is
207
- * untouched.
208
- *
209
- * Always a scalar, at every level of every payload. `model_diff` used to publish
210
- * a `{ base, head }` object under the same name inside `contentDiff`, so one
211
- * field name meant two shapes depending on where a caller found it; the split is
212
- * now `pendingMutationsBySide`.
213
- */
214
- export function pendingMutationsField(...overlays) {
215
- if (overlays.every((overlay) => overlay === null))
216
- return {};
217
- return { pendingMutations: overlays.reduce((total, overlay) => total + (overlay?.pendingMutations ?? 0), 0) };
218
- }
219
- /**
220
- * Read the IfcRoot header of an overlay-created entity.
221
- *
222
- * `NewEntity.attributes` is the positional STEP list the caller authored, so
223
- * slots 0/2/3 are `GlobalId`/`Name`/`Description` **for an `IfcRoot` subtype**
224
- * in every schema version — that part of the layout is fixed. Nothing further
225
- * along is: slot 4 is `ObjectType` on an `IfcObject` but `ApplicableOccurrence`
226
- * on an `IfcTypeObject`, so `objectType` and `PredefinedType` are read from the
227
- * store for store entities and simply absent for created ones.
228
- *
229
- * **The `IfcRoot` half of that sentence is a precondition, not a description**,
230
- * and `entity_create` accepts any IFC class. Slot 0 of an
231
- * `IfcPropertySingleValue` is its `Name`, so reading it positionally turned
232
- * `entity_create('IfcPropertySingleValue', ["'Width'", …])` into an entity whose
233
- * GlobalId was `Width` — which then joined the cross-model identity list, so
234
- * `get_entity(global_id: 'Width')` resolved to a property value, `model_diff`
235
- * reported `Width` as an added entity, and `get_entities_bulk` could call it an
236
- * ambiguous GlobalId. The columnar parser hits the same hazard when it keys an
237
- * `IfcMaterial` on the Name in slot 0.
238
- *
239
- * So the header is read only when the class actually derives from `IfcRoot`,
240
- * cross-schema (#2003) so an IFC2X3- or IFC4X3-only root is not judged by the
241
- * IFC4 pin. A class no bundled schema declares has no chain to prove it is a
242
- * root, so it keeps an empty header — the same deliberate vendor gap
243
- * `diff-scope.ts` documents, and the safe direction: an unidentified entity is
244
- * merely unreachable by GlobalId, whereas a wrongly identified one corrupts the
245
- * identity space every other tool shares.
246
- *
247
- * `globalId` also comes back empty when slot 0 holds none — a created
248
- * `IfcCartesianPoint` has no cross-model identity, and neither has a created
249
- * root the caller left unidentified. Those are excluded from `created` (nothing
250
- * can compare or look them up by key) but stay reachable by expressId, because
251
- * `get_entity(express_id)` on an id this session just handed out must not answer
252
- * "not found", and they are still counted.
253
- */
254
- function toCreatedEntity(entity) {
255
- const rooted = getInheritanceChainAcrossSchemas(entity.type).includes('IfcRoot');
256
- return {
257
- expressId: entity.expressId,
258
- ifcType: entity.type,
259
- globalId: (rooted ? stepText(entity.attributes[0]) : undefined) ?? '',
260
- name: rooted ? stepText(entity.attributes[2]) : undefined,
261
- description: rooted ? stepText(entity.attributes[3]) : undefined,
262
- attributes: entity.attributes,
263
- };
264
- }
265
- /**
266
- * Unwrap one authored STEP attribute to plain text.
267
- *
268
- * `StoreEditor.addEntity` documents both `"'literal'"` and a bare string as
269
- * ways to write a string attribute, so the quotes have to come off before the
270
- * value is hashed — otherwise a created entity could never content-match the
271
- * same entity read back out of a file. `$` (unset), `*` (derived) and `#42`
272
- * (a reference) are not text.
273
- */
274
- export function stepText(value) {
275
- if (typeof value !== 'string')
276
- return undefined;
277
- const trimmed = value.trim();
278
- if (trimmed === '' || trimmed === '$' || trimmed === '*' || trimmed.startsWith('#'))
279
- return undefined;
280
- if (trimmed.length >= 2 && trimmed.startsWith("'") && trimmed.endsWith("'")) {
281
- return trimmed.slice(1, -1).replace(/''/g, "'") || undefined;
282
- }
283
- return trimmed;
284
- }
285
- //# sourceMappingURL=overlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,E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C;QAC5E,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,SAAS,CAAC;IAC/D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,42 +0,0 @@
1
- /**
2
- * The bundled IFC schema tables, kept per schema rather than merged.
3
- *
4
- * The parser's `getAttributeNamesAcrossSchemas` answers from the IFC4 codegen
5
- * pin whenever the pin knows the class, and from a merged union otherwise —
6
- * which is the right default for a reader that does not know which schema it is
7
- * looking at. Two callers here do know: `schema_describe` is told the class, and
8
- * the query backend is told the model. For them a merged answer can be the wrong
9
- * schema's answer:
10
- *
11
- * - `IfcControl` has five attributes in IFC2X3 and six in IFC4 (which added
12
- * `Identification`), so subtracting the merged count from an IFC2X3 leaf like
13
- * `IfcScheduleTimeControl` ate one of the leaf's own attributes.
14
- * - `IfcRelCoversSpaces` names slot 4 `RelatedSpace` in IFC2X3 and
15
- * `RelatingSpace` in IFC4, so reading a created one back in an IFC2X3 model
16
- * reported an attribute name the file will not serialise.
17
- *
18
- * Later schemas still win when no schema is named, matching the parser's union.
19
- */
20
- import { type IfcEntityInfo } from '@ifc-lite/data';
21
- /** One schema's row for a class, or undefined. `schema` is matched case- and
22
- * punctuation-insensitively, so `Ifc4x3` and `IFC4X3` both resolve. */
23
- export declare function entityInfoInSchema(type: string, schema: string | undefined): IfcEntityInfo | undefined;
24
- /**
25
- * A class's row and the bundled schema that answered for it, later schemas
26
- * winning — the same precedence the parser's union map applies.
27
- */
28
- export declare function entityInfoAcrossSchemas(type: string): {
29
- info: IfcEntityInfo;
30
- schema: string;
31
- } | undefined;
32
- /**
33
- * Attribute names in STEP positional order, preferring the named schema's
34
- * spelling.
35
- *
36
- * Falls back to the parser's cross-schema answer when the model's schema does
37
- * not declare the class — a vendor extension, or a class the file's declared
38
- * schema does not have. That fallback is the pre-existing behaviour and is
39
- * strictly better than nothing.
40
- */
41
- export declare function attributeNamesForSchema(type: string, schema: string | undefined): readonly string[];
42
- //# sourceMappingURL=schema-tables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-tables.d.ts","sourceRoot":"","sources":["../src/schema-tables.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAA2D,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAuB7G;wEACwE;AACxE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAGtG;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAQzG;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAGnG"}
@@ -1,77 +0,0 @@
1
- /* This Source Code Form is subject to the terms of the Mozilla Public
2
- * License, v. 2.0. If a copy of the MPL was not distributed with this
3
- * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- /**
5
- * The bundled IFC schema tables, kept per schema rather than merged.
6
- *
7
- * The parser's `getAttributeNamesAcrossSchemas` answers from the IFC4 codegen
8
- * pin whenever the pin knows the class, and from a merged union otherwise —
9
- * which is the right default for a reader that does not know which schema it is
10
- * looking at. Two callers here do know: `schema_describe` is told the class, and
11
- * the query backend is told the model. For them a merged answer can be the wrong
12
- * schema's answer:
13
- *
14
- * - `IfcControl` has five attributes in IFC2X3 and six in IFC4 (which added
15
- * `Identification`), so subtracting the merged count from an IFC2X3 leaf like
16
- * `IfcScheduleTimeControl` ate one of the leaf's own attributes.
17
- * - `IfcRelCoversSpaces` names slot 4 `RelatedSpace` in IFC2X3 and
18
- * `RelatingSpace` in IFC4, so reading a created one back in an IFC2X3 model
19
- * reported an attribute name the file will not serialise.
20
- *
21
- * Later schemas still win when no schema is named, matching the parser's union.
22
- */
23
- import { ENTITIES_IFC2X3, ENTITIES_IFC4_EXPRESS, ENTITIES_IFC4X3 } from '@ifc-lite/data';
24
- import { getAttributeNamesAcrossSchemas } from '@ifc-lite/parser';
25
- /** Bundled schemas, oldest first. */
26
- const SCHEMA_TABLES = [
27
- ['IFC2X3', ENTITIES_IFC2X3],
28
- // Checked against the IFC4 EXPRESS registry, so an agent asking about IFC4
29
- // is not told about entities or attributes IFC4 lacks (#5204).
30
- ['IFC4', ENTITIES_IFC4_EXPRESS],
31
- ['IFC4X3', ENTITIES_IFC4X3],
32
- ];
33
- let bySchema = null;
34
- function tables() {
35
- if (!bySchema) {
36
- bySchema = new Map(SCHEMA_TABLES.map(([schema, list]) => [
37
- schema,
38
- new Map(list.map((entity) => [entity.name.toUpperCase(), entity])),
39
- ]));
40
- }
41
- return bySchema;
42
- }
43
- /** One schema's row for a class, or undefined. `schema` is matched case- and
44
- * punctuation-insensitively, so `Ifc4x3` and `IFC4X3` both resolve. */
45
- export function entityInfoInSchema(type, schema) {
46
- if (!schema)
47
- return undefined;
48
- return tables().get(schema.toUpperCase().replace(/[^A-Z0-9]/g, ''))?.get(type.toUpperCase());
49
- }
50
- /**
51
- * A class's row and the bundled schema that answered for it, later schemas
52
- * winning — the same precedence the parser's union map applies.
53
- */
54
- export function entityInfoAcrossSchemas(type) {
55
- const upper = type.toUpperCase();
56
- for (let i = SCHEMA_TABLES.length - 1; i >= 0; i--) {
57
- const schema = SCHEMA_TABLES[i][0];
58
- const info = tables().get(schema)?.get(upper);
59
- if (info)
60
- return { info, schema };
61
- }
62
- return undefined;
63
- }
64
- /**
65
- * Attribute names in STEP positional order, preferring the named schema's
66
- * spelling.
67
- *
68
- * Falls back to the parser's cross-schema answer when the model's schema does
69
- * not declare the class — a vendor extension, or a class the file's declared
70
- * schema does not have. That fallback is the pre-existing behaviour and is
71
- * strictly better than nothing.
72
- */
73
- export function attributeNamesForSchema(type, schema) {
74
- const info = entityInfoInSchema(type, schema);
75
- return info ? info.attributes : getAttributeNamesAcrossSchemas(type);
76
- }
77
- //# sourceMappingURL=schema-tables.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-tables.js","sourceRoot":"","sources":["../src/schema-tables.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AAC7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAElE,qCAAqC;AACrC,MAAM,aAAa,GAA+D;IAChF,CAAC,QAAQ,EAAE,eAAe,CAAC;IAC3B,2EAA2E;IAC3E,+DAA+D;IAC/D,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAC/B,CAAC,QAAQ,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,IAAI,QAAQ,GAAmD,IAAI,CAAC;AACpE,SAAS,MAAM;IACb,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM;YACN,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;SACnE,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;wEACwE;AACxE,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,MAA0B;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM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