@ifc-lite/sdk 9.5.0 → 9.6.0

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 (103) hide show
  1. package/README.md +28 -16
  2. package/dist/cost-reference-scan.d.ts.map +1 -1
  3. package/dist/cost-reference-scan.js +10 -9
  4. package/dist/cost-reference-scan.js.map +1 -1
  5. package/dist/headless/align-backend.d.ts +5 -0
  6. package/dist/headless/align-backend.d.ts.map +1 -0
  7. package/dist/headless/align-backend.js +15 -0
  8. package/dist/headless/align-backend.js.map +1 -0
  9. package/dist/headless/authored-attribute-value.d.ts +3 -0
  10. package/dist/headless/authored-attribute-value.d.ts.map +1 -0
  11. package/dist/headless/authored-attribute-value.js +34 -0
  12. package/dist/headless/authored-attribute-value.js.map +1 -0
  13. package/dist/headless/backend-query-relationships.d.ts +5 -0
  14. package/dist/headless/backend-query-relationships.d.ts.map +1 -0
  15. package/dist/headless/backend-query-relationships.js +55 -0
  16. package/dist/headless/backend-query-relationships.js.map +1 -0
  17. package/dist/headless/backend-query.d.ts +20 -0
  18. package/dist/headless/backend-query.d.ts.map +1 -0
  19. package/dist/headless/backend-query.js +359 -0
  20. package/dist/headless/backend-query.js.map +1 -0
  21. package/dist/headless/backend.d.ts +80 -0
  22. package/dist/headless/backend.d.ts.map +1 -0
  23. package/dist/headless/backend.js +317 -0
  24. package/dist/headless/backend.js.map +1 -0
  25. package/dist/headless/capabilities.d.ts +22 -0
  26. package/dist/headless/capabilities.d.ts.map +1 -0
  27. package/dist/headless/capabilities.js +52 -0
  28. package/dist/headless/capabilities.js.map +1 -0
  29. package/dist/headless/effective-entity-membership.d.ts +8 -0
  30. package/dist/headless/effective-entity-membership.d.ts.map +1 -0
  31. package/dist/headless/effective-entity-membership.js +23 -0
  32. package/dist/headless/effective-entity-membership.js.map +1 -0
  33. package/dist/headless/headless-backend-cost-store.d.ts +14 -0
  34. package/dist/headless/headless-backend-cost-store.d.ts.map +1 -0
  35. package/dist/headless/headless-backend-cost-store.js +18 -0
  36. package/dist/headless/headless-backend-cost-store.js.map +1 -0
  37. package/dist/headless/headless-backend-modelling.d.ts +50 -0
  38. package/dist/headless/headless-backend-modelling.d.ts.map +1 -0
  39. package/dist/headless/headless-backend-modelling.js +128 -0
  40. package/dist/headless/headless-backend-modelling.js.map +1 -0
  41. package/dist/headless/headless-backend-room.d.ts +9 -0
  42. package/dist/headless/headless-backend-room.d.ts.map +1 -0
  43. package/dist/headless/headless-backend-room.js +22 -0
  44. package/dist/headless/headless-backend-room.js.map +1 -0
  45. package/dist/headless/headless-backend-store-stubs.d.ts +13 -0
  46. package/dist/headless/headless-backend-store-stubs.d.ts.map +1 -0
  47. package/dist/headless/headless-backend-store-stubs.js +9 -0
  48. package/dist/headless/headless-backend-store-stubs.js.map +1 -0
  49. package/dist/headless/headless-backend-store.d.ts +8 -0
  50. package/dist/headless/headless-backend-store.d.ts.map +1 -0
  51. package/dist/headless/headless-backend-store.js +42 -0
  52. package/dist/headless/headless-backend-store.js.map +1 -0
  53. package/dist/headless/headless-backend-structural-store.d.ts +21 -0
  54. package/dist/headless/headless-backend-structural-store.d.ts.map +1 -0
  55. package/dist/headless/headless-backend-structural-store.js +18 -0
  56. package/dist/headless/headless-backend-structural-store.js.map +1 -0
  57. package/dist/headless/headless-backend-structural.d.ts +4 -0
  58. package/dist/headless/headless-backend-structural.d.ts.map +1 -0
  59. package/dist/headless/headless-backend-structural.js +24 -0
  60. package/dist/headless/headless-backend-structural.js.map +1 -0
  61. package/dist/headless/mutation-base.d.ts +5 -0
  62. package/dist/headless/mutation-base.d.ts.map +1 -0
  63. package/dist/headless/mutation-base.js +31 -0
  64. package/dist/headless/mutation-base.js.map +1 -0
  65. package/dist/headless/options.d.ts +11 -0
  66. package/dist/headless/options.d.ts.map +1 -0
  67. package/dist/headless/options.js +13 -0
  68. package/dist/headless/options.js.map +1 -0
  69. package/dist/headless/overlay.d.ts +170 -0
  70. package/dist/headless/overlay.d.ts.map +1 -0
  71. package/dist/headless/overlay.js +285 -0
  72. package/dist/headless/overlay.js.map +1 -0
  73. package/dist/headless/schema-tables.d.ts +42 -0
  74. package/dist/headless/schema-tables.d.ts.map +1 -0
  75. package/dist/headless/schema-tables.js +77 -0
  76. package/dist/headless/schema-tables.js.map +1 -0
  77. package/dist/headless/session.d.ts +23 -0
  78. package/dist/headless/session.d.ts.map +1 -0
  79. package/dist/headless/session.js +125 -0
  80. package/dist/headless/session.js.map +1 -0
  81. package/dist/headless.d.ts +13 -0
  82. package/dist/headless.d.ts.map +1 -0
  83. package/dist/headless.js +13 -0
  84. package/dist/headless.js.map +1 -0
  85. package/dist/index.d.ts +2 -1
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/namespaces/bcf-viewpoint.d.ts +19 -0
  88. package/dist/namespaces/bcf-viewpoint.d.ts.map +1 -1
  89. package/dist/namespaces/bcf-viewpoint.js.map +1 -1
  90. package/dist/namespaces/bcf.d.ts.map +1 -1
  91. package/dist/namespaces/bcf.js +17 -0
  92. package/dist/namespaces/bcf.js.map +1 -1
  93. package/dist/namespaces/viewer.d.ts +20 -1
  94. package/dist/namespaces/viewer.d.ts.map +1 -1
  95. package/dist/namespaces/viewer.js +40 -0
  96. package/dist/namespaces/viewer.js.map +1 -1
  97. package/dist/section-plane.d.ts +12 -0
  98. package/dist/section-plane.d.ts.map +1 -0
  99. package/dist/section-plane.js +5 -0
  100. package/dist/section-plane.js.map +1 -0
  101. package/dist/types.d.ts +6 -6
  102. package/dist/types.d.ts.map +1 -1
  103. package/package.json +20 -15
@@ -0,0 +1,359 @@
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
+ import { extractAllEntityAttributes, extractClassificationsOnDemand, extractDocumentsOnDemand, extractMaterialsOnDemand, extractRelationshipsOnDemand, extractExactRelatedIds, expandTypes, QUERY_REL_TYPE_MAP, extractTypePropertiesOnDemand, isQueryableObjectType, } from '@ifc-lite/parser';
5
+ import { attributeNamesForSchema } from './schema-tables.js';
6
+ import { EntityNode, matchesPropertyFilter } from '@ifc-lite/query';
7
+ import { iterateEffectiveEntityIds } from '@ifc-lite/mutations';
8
+ import { authoredValue } from './authored-attribute-value.js';
9
+ import { foldRelationshipRows } from './backend-query-relationships.js';
10
+ // `expandTypes` used to be defined here; it now comes from `@ifc-lite/parser`,
11
+ // shared with the other query backends (see `query-backend-maps.ts`). Re-exported
12
+ // so this module's consumers are unaffected by where it lives.
13
+ export { expandTypes };
14
+ /** Shared predicate for unfiltered headless object queries. */
15
+ export const isProductType = isQueryableObjectType;
16
+ function createdEntityData(created, ref, store) {
17
+ const names = attributeNamesForSchema(created.ifcType, store.schemaVersion);
18
+ const objectType = authoredValue(created.attributes[names.indexOf('ObjectType')]);
19
+ return {
20
+ ref,
21
+ globalId: created.globalId,
22
+ name: created.name ?? '',
23
+ type: created.ifcType,
24
+ description: created.description ?? '',
25
+ objectType: typeof objectType === 'string' ? objectType : '',
26
+ };
27
+ }
28
+ /**
29
+ * Build the query adapter over a store, folding whatever `overlay()` returns at
30
+ * call time. `overlay` is a getter, not a value: the backend creates its
31
+ * `MutablePropertyView` lazily on the first mutation, so a session that is only
32
+ * ever read gets `null` on every call and keeps the original store-only path.
33
+ */
34
+ export function createQueryAdapter(store, modelId, overlay, mutationView, options = {}) {
35
+ const PaginationError = options.paginationError ?? Error;
36
+ const normalizeTypePropertyValue = options.normalizeTypePropertyValue ??
37
+ ((value) => value);
38
+ function entityData(ref) {
39
+ const pending = overlay();
40
+ if (pending?.deleted.has(ref.expressId))
41
+ return null;
42
+ const created = pending?.createdEntity(ref.expressId);
43
+ if (created) {
44
+ const data = createdEntityData(created, ref, store);
45
+ return { ...data, type: pending?.effectiveType(ref.expressId) ?? data.type };
46
+ }
47
+ // @raw-entity-enumeration-ok tombstones and overlay-created ids returned above; this point probe only checks the remaining parsed source
48
+ if (!store.entityIndex.byId.has(ref.expressId))
49
+ return null;
50
+ const node = new EntityNode(store, ref.expressId);
51
+ const type = node.type;
52
+ if (!type || type === 'Unknown')
53
+ return null;
54
+ return withOverrides({
55
+ ref,
56
+ globalId: node.globalId,
57
+ name: node.name,
58
+ type: pending?.effectiveType(ref.expressId) ?? type,
59
+ description: node.description,
60
+ objectType: node.objectType,
61
+ }, pending, ref.expressId);
62
+ }
63
+ function withOverrides(data, pending, expressId) {
64
+ if (!pending)
65
+ return data;
66
+ const overrides = pending.attributes(expressId);
67
+ const positional = pending.positionalAttributes(expressId);
68
+ if (overrides.size === 0 && positional.size === 0 && !pending.effectiveType(expressId))
69
+ return data;
70
+ const next = {
71
+ ...data,
72
+ type: pending.effectiveType(expressId) ?? data.type,
73
+ name: overrides.get('Name') ?? data.name,
74
+ description: overrides.get('Description') ?? data.description,
75
+ objectType: overrides.get('ObjectType') ?? data.objectType,
76
+ };
77
+ // Positional slots are named by the effective class (a queued retype wins).
78
+ const effectiveType = pending.effectiveType(expressId);
79
+ const exactType = effectiveType ?? (store.entities.getTypeName(expressId) || data.type);
80
+ const names = attributeNamesForSchema(exactType, store.schemaVersion);
81
+ if (effectiveType && names.length > 0 && !names.includes('ObjectType'))
82
+ next.objectType = '';
83
+ for (const [index, value] of positional) {
84
+ const authored = authoredValue(value);
85
+ const isUnset = value == null || (typeof value === 'string' && ['', '$', '*'].includes(value.trim()));
86
+ const text = typeof authored === 'string' ? authored : isUnset ? '' : null;
87
+ if (text === null)
88
+ continue;
89
+ if (names[index] === 'Name')
90
+ next.name = text;
91
+ else if (names[index] === 'Description')
92
+ next.description = text;
93
+ else if (names[index] === 'ObjectType')
94
+ next.objectType = text;
95
+ }
96
+ return next;
97
+ }
98
+ function properties(ref, captured) {
99
+ // `captured` lets a caller that already has the overlay pass it in rather
100
+ // than have it rebuilt per entity — the filter loop in `entities()` runs
101
+ // this once per candidate row.
102
+ const pending = captured !== undefined ? captured : overlay();
103
+ // An entity this session deleted answers nothing, as `entityData` and
104
+ // `entities` already have it answer nothing (#2014 review).
105
+ if (pending?.deleted.has(ref.expressId))
106
+ return [];
107
+ // `getForEntity` reads the same on-demand extraction the store would, then
108
+ // applies the overlay on top — so it is the whole answer, not the delta.
109
+ const psets = pending
110
+ ? pending.propertySets(ref.expressId)
111
+ : new EntityNode(store, ref.expressId).properties();
112
+ return psets.map((pset) => ({
113
+ name: pset.name,
114
+ globalId: pset.globalId,
115
+ properties: pset.properties.map((p) => ({ name: p.name, type: p.type, value: p.value })),
116
+ }));
117
+ }
118
+ function quantities(ref) {
119
+ const pending = overlay();
120
+ if (pending?.deleted.has(ref.expressId))
121
+ return [];
122
+ const qsets = pending
123
+ ? pending.quantitySets(ref.expressId)
124
+ : new EntityNode(store, ref.expressId).quantities();
125
+ return qsets.map((qset) => ({
126
+ name: qset.name,
127
+ quantities: qset.quantities.map((q) => ({ name: q.name, type: q.type, value: q.value })),
128
+ }));
129
+ }
130
+ function attributes(ref) {
131
+ const pending = overlay();
132
+ if (pending?.deleted.has(ref.expressId))
133
+ return [];
134
+ const created = pending?.createdEntity(ref.expressId);
135
+ const base = created
136
+ // Not in the store, so there is nothing to extract: name the authored
137
+ // positional list from the schema instead. Cross-schema, because a created
138
+ // IFC2X3 or IFC4X3 class is not in the IFC4 codegen pin (#2003).
139
+ ? namedAuthoredAttributes(created)
140
+ : extractAllEntityAttributes(store, ref.expressId);
141
+ if (!pending)
142
+ return base;
143
+ const overrides = pending.attributes(ref.expressId);
144
+ const positional = pending.positionalAttributes(ref.expressId);
145
+ if (overrides.size === 0 && positional.size === 0)
146
+ return base;
147
+ // Overwrite what the base carries, then append what it does not. The append
148
+ // is the half that was missing (#2014): `extractAllEntityAttributes` omits
149
+ // an attribute whose stored value is `$`, so setting a previously-unset
150
+ // `Description` changed the top-level field while this list still denied it
151
+ // — one payload contradicting itself. Appended names go last; the list is
152
+ // name-keyed and its order is not positional (the base already drops nulls).
153
+ const merged = new Map(base.map((attribute) => [attribute.name, attribute.value]));
154
+ const writes = new Map(overrides);
155
+ const exactType = created?.ifcType ?? store.entities.getTypeName(ref.expressId);
156
+ const names = attributeNamesForSchema(exactType, store.schemaVersion);
157
+ for (const [index, value] of positional) {
158
+ const name = names[index];
159
+ if (name)
160
+ writes.set(name, value);
161
+ }
162
+ for (const [name, value] of writes) {
163
+ const authored = authoredValue(value);
164
+ if (authored === undefined)
165
+ merged.delete(name);
166
+ else
167
+ merged.set(name, authored);
168
+ }
169
+ return [...merged].map(([name, value]) => ({ name, value }));
170
+ }
171
+ function namedAuthoredAttributes(created) {
172
+ // The *model's* schema, not the IFC4 pin. `IfcRelCoversSpaces` names slot 4
173
+ // `RelatedSpace` in IFC2X3 and `RelatingSpace` in IFC4, so the pinned answer
174
+ // reported a name the file would not serialise. Falls back to the parser's
175
+ // cross-schema list when the declared schema does not carry the class.
176
+ const names = attributeNamesForSchema(created.ifcType, store.schemaVersion);
177
+ const out = [];
178
+ for (let i = 0; i < created.attributes.length; i++) {
179
+ const value = authoredValue(created.attributes[i]);
180
+ if (value === undefined)
181
+ continue;
182
+ // No synthetic `Attribute7` names: `bim.attributes` is a list of IFC
183
+ // EXPRESS attribute names, and an invented one is not one. A payload
184
+ // longer than the schema knows about is the caller's to explain.
185
+ const name = names[i];
186
+ if (name === undefined)
187
+ continue;
188
+ out.push({ name, value });
189
+ }
190
+ return out;
191
+ }
192
+ return {
193
+ entities(descriptor) {
194
+ const pending = overlay();
195
+ const requested = descriptor.types && descriptor.types.length > 0
196
+ ? expandTypes(descriptor.types, store.schemaVersion)
197
+ : null;
198
+ const results = [];
199
+ for (const { expressId, type, overlayCreated } of iterateEffectiveEntityIds(store, mutationView(), requested ?? undefined)) {
200
+ if (!requested && !isProductType(type))
201
+ continue;
202
+ const ref = { modelId, expressId };
203
+ if (overlayCreated) {
204
+ const created = pending?.createdEntity(expressId);
205
+ if (!created)
206
+ throw new Error(`Missing pending entity #${expressId} during enumeration`);
207
+ results.push(withOverrides(createdEntityData(created, ref, store), pending, expressId));
208
+ continue;
209
+ }
210
+ const node = new EntityNode(store, expressId);
211
+ results.push(withOverrides({
212
+ ref,
213
+ globalId: node.globalId,
214
+ name: node.name,
215
+ type: node.type,
216
+ description: node.description,
217
+ objectType: node.objectType,
218
+ }, pending, expressId));
219
+ }
220
+ let filtered = results;
221
+ if (descriptor.filters && descriptor.filters.length > 0) {
222
+ const propsCache = new Map();
223
+ const cachedProps = (ref) => {
224
+ let cached = propsCache.get(ref.expressId);
225
+ if (!cached) {
226
+ cached = properties(ref, pending);
227
+ propsCache.set(ref.expressId, cached);
228
+ }
229
+ return cached;
230
+ };
231
+ // A `Qto_` filter (or any psetName with no matching property set)
232
+ // falls back to quantity sets — see `matchesPropertyFilter` in
233
+ // `@ifc-lite/query`'s `property-filter-match.ts`. Without this, a
234
+ // `Qto_WallBaseQuantities.NetVolume>1` filter (e.g. from the `#4094`
235
+ // selector adapter's `.select()`/`selector` param) silently matched
236
+ // zero entities even when the quantity was present.
237
+ const qsetsCache = new Map();
238
+ const cachedQuantities = (ref) => {
239
+ let cached = qsetsCache.get(ref.expressId);
240
+ if (!cached) {
241
+ cached = quantities(ref);
242
+ qsetsCache.set(ref.expressId, cached);
243
+ }
244
+ return cached;
245
+ };
246
+ for (const filter of descriptor.filters) {
247
+ filtered = filtered.filter((entity) => matchesPropertyFilter(cachedProps(entity.ref), filter, cachedQuantities(entity.ref)));
248
+ }
249
+ }
250
+ // An explicit zero limit is empty. Reject invalid bounds rather than
251
+ // quietly serving more rows than the caller requested (#2298).
252
+ if (descriptor.offset != null) {
253
+ if (!Number.isFinite(descriptor.offset) || descriptor.offset < 0) {
254
+ throw new PaginationError(`Invalid offset: ${descriptor.offset} (must be a non-negative finite number)`);
255
+ }
256
+ if (descriptor.offset > 0)
257
+ filtered = filtered.slice(descriptor.offset);
258
+ }
259
+ if (descriptor.limit != null) {
260
+ if (!Number.isFinite(descriptor.limit) || descriptor.limit < 0) {
261
+ throw new PaginationError(`Invalid limit: ${descriptor.limit} (must be a non-negative finite number)`);
262
+ }
263
+ filtered = filtered.slice(0, descriptor.limit);
264
+ }
265
+ return filtered;
266
+ },
267
+ // Headless contexts have no interactive viewer filter, so there is never an
268
+ // "active filter" to report (issue #1107).
269
+ entitiesMatchingActiveFilter: () => null,
270
+ entityData,
271
+ attributes,
272
+ properties: (ref) => properties(ref),
273
+ quantities,
274
+ classifications(ref) {
275
+ return extractClassificationsOnDemand(store, ref.expressId);
276
+ },
277
+ materials(ref) {
278
+ return extractMaterialsOnDemand(store, ref.expressId);
279
+ },
280
+ typeProperties(ref) {
281
+ const info = extractTypePropertiesOnDemand(store, ref.expressId);
282
+ if (!info)
283
+ return null;
284
+ return {
285
+ typeName: info.typeName,
286
+ typeId: info.typeId,
287
+ properties: info.properties.map((pset) => ({
288
+ name: pset.name,
289
+ globalId: pset.globalId,
290
+ properties: pset.properties.map((p) => ({ name: p.name, type: p.type, value: normalizeTypePropertyValue(p.value) })),
291
+ })),
292
+ };
293
+ },
294
+ documents(ref) {
295
+ return extractDocumentsOnDemand(store, ref.expressId);
296
+ },
297
+ relationships(ref) {
298
+ const result = extractRelationshipsOnDemand(store, ref.expressId);
299
+ const pending = overlay();
300
+ if (!pending)
301
+ return result;
302
+ return foldRelationshipRows(result, pending, ref, entityData);
303
+ },
304
+ /**
305
+ * Containment, aggregation and typing, with the session's queued edits
306
+ * applied (#2014).
307
+ *
308
+ * This is the seam every containment answer already passes through:
309
+ * `bim.storey`, `bim.path`, `bim.contains`, `bim.decomposes` and
310
+ * `bim.containedIn` are all thin wrappers over it. Folding here is what
311
+ * stopped `query_entities(in_storey)` from dropping an entity that the same
312
+ * session had just created *and* placed with a queued
313
+ * `IfcRelContainedInSpatialStructure` — a query that returns an entity
314
+ * without the filter and drops it with one reads as a wrong storey rather
315
+ * than a missing fold.
316
+ *
317
+ * Three rules, in order:
318
+ *
319
+ * 1. A parsed edge is dropped when the session deleted the `IfcRel…` record
320
+ * that produced it. The graph carries `relationshipId` per edge, so this
321
+ * is exact rather than inferred.
322
+ * 2. An edge to or from a tombstoned entity is dropped. Deleting a storey
323
+ * has to stop answering "this wall is in that storey".
324
+ * 3. Queued relationships are added. Deleting a queued relationship forgets
325
+ * it outright, so there is no tombstone case to handle on this side.
326
+ *
327
+ * `forward` walks Relating → Related (a storey to its elements, a whole to
328
+ * its parts); `inverse` walks back.
329
+ */
330
+ related(ref, relType, direction) {
331
+ const relEnum = QUERY_REL_TYPE_MAP[relType];
332
+ if (relEnum === undefined)
333
+ return [];
334
+ const pending = overlay();
335
+ // A deleted entity relates to nothing (#2014 review).
336
+ if (pending?.deleted.has(ref.expressId))
337
+ return [];
338
+ const out = [];
339
+ const seen = new Set();
340
+ const take = (expressId) => {
341
+ if (pending?.deleted.has(expressId) || seen.has(expressId))
342
+ return;
343
+ seen.add(expressId);
344
+ out.push(expressId);
345
+ };
346
+ const isDeleted = pending
347
+ ? (id) => pending.deleted.has(id) || pending.supersededRelationshipIds.has(id)
348
+ : () => false;
349
+ for (const id of extractExactRelatedIds(store, ref.expressId, relType, direction, isDeleted))
350
+ take(id);
351
+ for (const edge of pending?.relationshipEdges(ref.expressId, relType) ?? []) {
352
+ if (edge.direction === direction)
353
+ take(edge.targetId);
354
+ }
355
+ return out.map((expressId) => ({ modelId: ref.modelId, expressId }));
356
+ },
357
+ };
358
+ }
359
+ //# sourceMappingURL=backend-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-query.js","sourceRoot":"","sources":["../../src/headless/backend-query.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmB/D,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,C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AK,MAAM,IAAI,IAAI,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC5E,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;oBAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxD,CAAC;YACD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC/E,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,80 @@
1
+ /** Shared headless `BimBackend` over an already-loaded store. */
2
+ import type { BimBackend, BimEventType, ModelBackendMethods, QueryBackendMethods, SelectionBackendMethods, VisibilityBackendMethods, ViewerBackendMethods, MutateBackendMethods, StoreBackendMethods, SpatialBackendMethods, ExportBackendMethods, LensBackendMethods, FilesBackendMethods, ScheduleBackendMethods, StructuralBackendMethods, CostBackendMethods } from '../index.js';
3
+ import { type EntityRefCheck, type StyleBackendMethods } from '../index.js';
4
+ import { type HeadlessOperation } from './capabilities.js';
5
+ import type { HeadlessBackendOptions } from './options.js';
6
+ import type { IfcDataStore } from '@ifc-lite/parser';
7
+ import { MutablePropertyView, StoreEditor } from '@ifc-lite/mutations';
8
+ import { type PendingOverlay } from './overlay.js';
9
+ export declare class HeadlessBackend implements BimBackend {
10
+ readonly model: ModelBackendMethods;
11
+ readonly query: QueryBackendMethods;
12
+ readonly selection: SelectionBackendMethods;
13
+ /**
14
+ * Mutable so the MCP server can swap in streaming adapters when the
15
+ * viewer subprocess starts, then revert when it closes. Marked
16
+ * `readonly` on the BimBackend interface but the underlying instance
17
+ * is ours to manage.
18
+ */
19
+ visibility: VisibilityBackendMethods;
20
+ viewer: ViewerBackendMethods;
21
+ readonly mutate: MutateBackendMethods;
22
+ readonly style: StyleBackendMethods;
23
+ readonly store: StoreBackendMethods;
24
+ readonly spatial: SpatialBackendMethods;
25
+ readonly export: ExportBackendMethods;
26
+ readonly lens: LensBackendMethods;
27
+ readonly files: FilesBackendMethods;
28
+ readonly schedule: ScheduleBackendMethods;
29
+ readonly structural: StructuralBackendMethods;
30
+ readonly cost: CostBackendMethods;
31
+ private dataStore;
32
+ private modelName;
33
+ private modelId;
34
+ /** Every model id this backend answers for, so the schedule assert, the
35
+ * `bim.mutate.*` guard and `bim.store.addEntity` cannot differ (#3764). The
36
+ * legacy-host aliases are accepted only when explicitly supplied. */
37
+ private readonly acceptedModelIds;
38
+ /** The reference check `bim.mutate.*` is gated on (`null` when writable,
39
+ * else the reason), exposed because the mutation TOOLS write into
40
+ * `getMutationView()` directly and need the same gate (#3764). */
41
+ readonly checkEntityRef: EntityRefCheck;
42
+ private mutationView;
43
+ private storeEditor;
44
+ private readonly disposeRoomCommands;
45
+ private viewerAttached;
46
+ private readonly options;
47
+ private peerScopes;
48
+ capability(operation: HeadlessOperation): import("./capabilities.js").HeadlessCapability;
49
+ setPeerScopes(provider: typeof this.peerScopes): void;
50
+ dispose(): void;
51
+ constructor(store: IfcDataStore, modelName: string, modelId: string, options?: HeadlessBackendOptions, modelAliases?: readonly string[]);
52
+ subscribe(_event: BimEventType, _handler: (data: unknown) => void): () => void;
53
+ private createModelAdapter;
54
+ /** This session's queued edits, or null when it has none. */
55
+ pendingOverlay(): PendingOverlay | null;
56
+ private createSelectionAdapter;
57
+ private getOrCreateStoreEditor;
58
+ /** Expose the mutation view so tools can inspect pending mutations. */
59
+ getMutationView(): MutablePropertyView | null;
60
+ /**
61
+ * The overlay every `bim.mutate.*` write goes through, created on first use
62
+ * so a read-only session still pays nothing. Built by `getOrCreateStoreEditor`
63
+ * to keep the extractor wiring in one place.
64
+ */
65
+ /** The view `bim.mutate` writes through — public so `run_flow`'s `tables()` reads the same overlay. */
66
+ getOrCreateMutationView(): MutablePropertyView;
67
+ /** Force creation of the editor (used by mutation tools that always need it). */
68
+ ensureEditor(): StoreEditor;
69
+ /** Replace the viewer/visibility adapters at runtime (for ViewerManager). */
70
+ attachStreamingAdapters(viewer: ViewerBackendMethods, visibility: VisibilityBackendMethods): void;
71
+ /** Restore no-op viewer/visibility adapters (for ViewerManager close). */
72
+ detachStreamingAdapters(): void;
73
+ /** Whether `modelId` names the one model this backend holds. */
74
+ acceptsModelId(modelId: string): boolean;
75
+ /** Refuse an unknown model id loudly, at whichever surface was handed it. */
76
+ assertKnownModelId(modelId: string): void;
77
+ private createExportAdapter;
78
+ private createScheduleAdapter;
79
+ }
80
+ //# sourceMappingURL=backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/headless/backend.ts"],"names":[],"mappings":"AAIA,iEAAiE;AAEjE,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAMnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAA8E,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAExJ,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAwB,MAAM,qBAAqB,CAAC;AAQ7F,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAGpE,qBAAa,eAAgB,YAAW,UAAU;IAChD,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,mBAA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