@ifc-lite/lists 1.7.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.
package/LICENSE ADDED
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Column discovery - discovers available properties and quantities from model data.
3
+ *
4
+ * PERF: Samples a subset of entities per type to avoid scanning 100K+ entities.
5
+ */
6
+ import type { IfcTypeEnum } from '@ifc-lite/data';
7
+ import type { ListDataProvider, DiscoveredColumns } from './types.js';
8
+ /**
9
+ * Discover available columns for a set of entity types across one or more data providers.
10
+ * Samples entities to find all property sets and quantity sets available.
11
+ */
12
+ export declare function discoverColumns(providers: ListDataProvider | ListDataProvider[], entityTypes: IfcTypeEnum[]): DiscoveredColumns;
13
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAMtE;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,EAChD,WAAW,EAAE,WAAW,EAAE,GACzB,iBAAiB,CA6DnB"}
@@ -0,0 +1,70 @@
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 { ENTITY_ATTRIBUTES } from './types.js';
5
+ /** Max entities to sample per type per provider for column discovery */
6
+ const SAMPLE_SIZE = 50;
7
+ /**
8
+ * Discover available columns for a set of entity types across one or more data providers.
9
+ * Samples entities to find all property sets and quantity sets available.
10
+ */
11
+ export function discoverColumns(providers, entityTypes) {
12
+ const providerList = Array.isArray(providers) ? providers : [providers];
13
+ const properties = new Map();
14
+ const quantities = new Map();
15
+ for (const provider of providerList) {
16
+ for (const type of entityTypes) {
17
+ const ids = provider.getEntitiesByType(type);
18
+ // Sample up to SAMPLE_SIZE entities per type per provider
19
+ const sampleCount = Math.min(ids.length, SAMPLE_SIZE);
20
+ for (let i = 0; i < sampleCount; i++) {
21
+ const entityId = ids[i];
22
+ // Discover properties
23
+ const psets = provider.getPropertySets(entityId);
24
+ for (const pset of psets) {
25
+ if (!pset.name)
26
+ continue;
27
+ let propNames = properties.get(pset.name);
28
+ if (!propNames) {
29
+ propNames = new Set();
30
+ properties.set(pset.name, propNames);
31
+ }
32
+ for (const prop of pset.properties) {
33
+ if (prop.name)
34
+ propNames.add(prop.name);
35
+ }
36
+ }
37
+ // Discover quantities
38
+ const qsets = provider.getQuantitySets(entityId);
39
+ for (const qset of qsets) {
40
+ if (!qset.name)
41
+ continue;
42
+ let quantNames = quantities.get(qset.name);
43
+ if (!quantNames) {
44
+ quantNames = new Set();
45
+ quantities.set(qset.name, quantNames);
46
+ }
47
+ for (const quant of qset.quantities) {
48
+ if (quant.name)
49
+ quantNames.add(quant.name);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ // Convert Sets to sorted arrays for stable UI
56
+ const propertiesResult = new Map();
57
+ for (const [psetName, propSet] of properties) {
58
+ propertiesResult.set(psetName, Array.from(propSet).sort());
59
+ }
60
+ const quantitiesResult = new Map();
61
+ for (const [qsetName, quantSet] of quantities) {
62
+ quantitiesResult.set(qsetName, Array.from(quantSet).sort());
63
+ }
64
+ return {
65
+ attributes: [...ENTITY_ATTRIBUTES],
66
+ properties: propertiesResult,
67
+ quantities: quantitiesResult,
68
+ };
69
+ }
70
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAU/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,wEAAwE;AACxE,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAgD,EAChD,WAA0B;IAE1B,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAuB,CAAC;IAClD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAuB,CAAC;IAElD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;QACpC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC/B,MAAM,GAAG,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC7C,0DAA0D;YAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAEtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;gBAExB,sBAAsB;gBACtB,M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AED,8CAA8C;IAC9C,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAoB,CAAC;IACrD,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,UAAU,EAAE,CAAC;QAC7C,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAoB,CAAC;IACrD,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,UAAU,EAAE,CAAC;QAC9C,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO;QACL,UAAU,EAAE,CAAC,GAAG,iBAAiB,CAAC;QAClC,UAAU,EAAE,gBAAgB;QAC5B,UAAU,EAAE,gBAAgB;KAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ListDataProvider, ListDefinition, ListResult } from './types.js';
2
+ /**
3
+ * Execute a list definition against a data provider.
4
+ * Returns a flat table result with matched entities and column values.
5
+ */
6
+ export declare function executeList(definition: ListDefinition, provider: ListDataProvider, modelId?: string): ListResult;
7
+ export declare function listResultToCSV(result: ListResult, delimiter?: string): string;
8
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EAKX,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,cAAc,EAC1B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,SAAY,GAClB,UAAU,CA8BZ;AAiQD,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,SAAM,GAAG,MAAM,CAkB3E"}
package/dist/engine.js ADDED
@@ -0,0 +1,254 @@
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 { parsePropertyValue } from '@ifc-lite/encoding';
5
+ /**
6
+ * Execute a list definition against a data provider.
7
+ * Returns a flat table result with matched entities and column values.
8
+ */
9
+ export function executeList(definition, provider, modelId = 'default') {
10
+ const startTime = performance.now();
11
+ // Step 1: Resolve source set (which entities match)
12
+ const matchedIds = resolveSourceSet(definition, provider);
13
+ // Step 2: Extract column values for matched entities
14
+ const rows = new Array(matchedIds.length);
15
+ for (let i = 0; i < matchedIds.length; i++) {
16
+ const entityId = matchedIds[i];
17
+ const values = extractColumnValues(definition.columns, entityId, provider);
18
+ rows[i] = { entityId, modelId, values };
19
+ }
20
+ // Step 3: Sort if configured
21
+ if (definition.sortBy) {
22
+ const colIndex = definition.columns.findIndex(c => c.id === definition.sortBy.columnId);
23
+ if (colIndex >= 0) {
24
+ const dir = definition.sortBy.direction === 'asc' ? 1 : -1;
25
+ rows.sort((a, b) => compareCellValues(a.values[colIndex], b.values[colIndex]) * dir);
26
+ }
27
+ }
28
+ return {
29
+ columns: definition.columns,
30
+ rows,
31
+ totalCount: rows.length,
32
+ executionTime: performance.now() - startTime,
33
+ };
34
+ }
35
+ // ============================================================================
36
+ // Source Set Resolution
37
+ // ============================================================================
38
+ function resolveSourceSet(definition, provider) {
39
+ const { entityTypes, conditions } = definition;
40
+ // Collect entity IDs by type - gather arrays first, then flatten once
41
+ const chunks = [];
42
+ for (const type of entityTypes) {
43
+ const ids = provider.getEntitiesByType(type);
44
+ if (ids.length > 0)
45
+ chunks.push(ids);
46
+ }
47
+ const entityIds = chunks.length === 1 ? chunks[0] : chunks.flat();
48
+ // Apply conditions as filters
49
+ if (conditions.length === 0) {
50
+ return entityIds;
51
+ }
52
+ return entityIds.filter(id => matchesAllConditions(id, conditions, provider));
53
+ }
54
+ function matchesAllConditions(entityId, conditions, provider) {
55
+ for (const condition of conditions) {
56
+ if (!matchesCondition(entityId, condition, provider)) {
57
+ return false;
58
+ }
59
+ }
60
+ return true;
61
+ }
62
+ function matchesCondition(entityId, condition, provider) {
63
+ const actualValue = getConditionValue(entityId, condition, provider);
64
+ if (condition.operator === 'exists') {
65
+ return actualValue !== null && actualValue !== undefined && actualValue !== '';
66
+ }
67
+ if (actualValue === null || actualValue === undefined) {
68
+ return false;
69
+ }
70
+ switch (condition.operator) {
71
+ case 'equals':
72
+ return String(actualValue) === String(condition.value);
73
+ case 'notEquals':
74
+ return String(actualValue) !== String(condition.value);
75
+ case 'contains':
76
+ return String(actualValue).toLowerCase().includes(String(condition.value).toLowerCase());
77
+ case 'gt':
78
+ return Number(actualValue) > Number(condition.value);
79
+ case 'lt':
80
+ return Number(actualValue) < Number(condition.value);
81
+ case 'gte':
82
+ return Number(actualValue) >= Number(condition.value);
83
+ case 'lte':
84
+ return Number(actualValue) <= Number(condition.value);
85
+ default:
86
+ return false;
87
+ }
88
+ }
89
+ function getConditionValue(entityId, condition, provider) {
90
+ switch (condition.source) {
91
+ case 'attribute':
92
+ return getAttributeValue(entityId, condition.propertyName, provider);
93
+ case 'property':
94
+ return getPropertyValue(entityId, condition.psetName ?? '', condition.propertyName, provider);
95
+ case 'quantity':
96
+ return getQuantityValue(entityId, condition.psetName ?? '', condition.propertyName, provider);
97
+ default:
98
+ return null;
99
+ }
100
+ }
101
+ // ============================================================================
102
+ // Column Value Extraction
103
+ // ============================================================================
104
+ function extractColumnValues(columns, entityId, provider) {
105
+ // For efficiency, batch extract properties and quantities once per entity
106
+ const needsProperties = columns.some(c => c.source === 'property');
107
+ const needsQuantities = columns.some(c => c.source === 'quantity');
108
+ let psets;
109
+ let qsets;
110
+ if (needsProperties) {
111
+ psets = provider.getPropertySets(entityId);
112
+ }
113
+ if (needsQuantities) {
114
+ qsets = provider.getQuantitySets(entityId);
115
+ }
116
+ const values = new Array(columns.length);
117
+ for (let i = 0; i < columns.length; i++) {
118
+ const col = columns[i];
119
+ switch (col.source) {
120
+ case 'attribute':
121
+ values[i] = getAttributeValue(entityId, col.propertyName, provider);
122
+ break;
123
+ case 'property':
124
+ values[i] = findPropertyInSets(psets ?? [], col.psetName ?? '', col.propertyName);
125
+ break;
126
+ case 'quantity':
127
+ values[i] = findQuantityInSets(qsets ?? [], col.psetName ?? '', col.propertyName);
128
+ break;
129
+ default:
130
+ values[i] = null;
131
+ }
132
+ }
133
+ return values;
134
+ }
135
+ // ============================================================================
136
+ // Value Accessors
137
+ // ============================================================================
138
+ function getAttributeValue(entityId, attrName, provider) {
139
+ switch (attrName) {
140
+ case 'Name':
141
+ return provider.getEntityName(entityId) || null;
142
+ case 'GlobalId':
143
+ return provider.getEntityGlobalId(entityId) || null;
144
+ case 'Type':
145
+ return provider.getEntityTypeName(entityId) || null;
146
+ case 'Description':
147
+ return provider.getEntityDescription(entityId) || null;
148
+ case 'ObjectType':
149
+ return provider.getEntityObjectType(entityId) || null;
150
+ case 'Tag':
151
+ return provider.getEntityTag(entityId) || null;
152
+ default:
153
+ return null;
154
+ }
155
+ }
156
+ function getPropertyValue(entityId, psetName, propName, provider) {
157
+ const psets = provider.getPropertySets(entityId);
158
+ return findPropertyInSets(psets, psetName, propName);
159
+ }
160
+ function getQuantityValue(entityId, qsetName, quantName, provider) {
161
+ const qsets = provider.getQuantitySets(entityId);
162
+ return findQuantityInSets(qsets, qsetName, quantName);
163
+ }
164
+ function findPropertyInSets(psets, psetName, propName) {
165
+ for (const pset of psets) {
166
+ if (pset.name === psetName) {
167
+ for (const prop of pset.properties) {
168
+ if (prop.name === propName) {
169
+ return resolvePropertyValue(prop.value);
170
+ }
171
+ }
172
+ }
173
+ }
174
+ return null;
175
+ }
176
+ /**
177
+ * Resolve a raw IFC property value to a clean display value.
178
+ * Handles typed arrays [IFCTYPE, value], boolean enums (.T./.F./.U.),
179
+ * IFC string encodings, etc.
180
+ */
181
+ function resolvePropertyValue(value) {
182
+ if (value === null || value === undefined)
183
+ return null;
184
+ const parsed = parsePropertyValue(value);
185
+ const display = parsed.displayValue;
186
+ // Return null for em-dash (null indicator)
187
+ if (display === '\u2014')
188
+ return null;
189
+ // Try to preserve numeric values for sorting
190
+ if (typeof value === 'number')
191
+ return value;
192
+ if (typeof value === 'boolean')
193
+ return display; // "True"/"False"
194
+ // For typed values like [IFCREAL, 5.3], check if the resolved value is numeric
195
+ if (Array.isArray(value) && value.length === 2 && typeof value[1] === 'number') {
196
+ return value[1];
197
+ }
198
+ return display;
199
+ }
200
+ /** Unit suffixes indexed by QuantityType enum */
201
+ const QUANTITY_UNITS = ['m', 'm²', 'm³', '', 'kg', 's'];
202
+ function findQuantityInSets(qsets, qsetName, quantName) {
203
+ for (const qset of qsets) {
204
+ if (qset.name === qsetName) {
205
+ for (const quant of qset.quantities) {
206
+ if (quant.name === quantName) {
207
+ return formatQuantityValue(quant.value, quant.type);
208
+ }
209
+ }
210
+ }
211
+ }
212
+ return null;
213
+ }
214
+ function formatQuantityValue(value, _type) {
215
+ // Return raw number to preserve numeric sorting.
216
+ // Display formatting (locale, units) is handled by the UI layer.
217
+ return value;
218
+ }
219
+ // ============================================================================
220
+ // Sorting
221
+ // ============================================================================
222
+ function compareCellValues(a, b) {
223
+ if (a === null && b === null)
224
+ return 0;
225
+ if (a === null)
226
+ return -1;
227
+ if (b === null)
228
+ return 1;
229
+ if (typeof a === 'number' && typeof b === 'number') {
230
+ return a - b;
231
+ }
232
+ return String(a).localeCompare(String(b));
233
+ }
234
+ // ============================================================================
235
+ // CSV Export from List Result
236
+ // ============================================================================
237
+ export function listResultToCSV(result, delimiter = ',') {
238
+ const csvEscape = (val) => {
239
+ if (val === null || val === undefined)
240
+ return '';
241
+ const str = String(val);
242
+ if (str.includes(delimiter) || str.includes('"') || str.includes('\n')) {
243
+ return `"${str.replace(/"/g, '""')}"`;
244
+ }
245
+ return str;
246
+ };
247
+ const headers = result.columns.map(c => csvEscape(c.label ?? `${c.psetName ? c.psetName + '.' : ''}${c.propertyName}`));
248
+ const lines = [headers.join(delimiter)];
249
+ for (const row of result.rows) {
250
+ lines.push(row.values.map(csvEscape).join(delimiter));
251
+ }
252
+ return lines.join('\n');
253
+ }
254
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAU/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAWxD;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,UAA0B,EAC1B,QAA0B,EAC1B,OAAO,GAAG,SAAS;IAEnB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEpC,oDAAoD;IACpD,MAAM,UAAU,GAAG,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAE1D,qDAAqD;IACrD,MAAM,IAAI,GAAc,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAErD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,MAAM,GAAG,mBAAmB,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC3E,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;IAED,6BAA6B;IAC7B,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,MAAO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,SAAS;YAAE,OAAO,EAAE,CAAC;QACjD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACvE,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;QACxC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACxH,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAExC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { ListDataProvider, ListDefinition, ListResult, ListRow, CellValue, ColumnDefinition, PropertyCondition, ConditionOperator, DiscoveredColumns, EntityAttribute, } from './types.js';
2
+ export { ENTITY_ATTRIBUTES } from './types.js';
3
+ export { executeList, listResultToCSV } from './engine.js';
4
+ export { discoverColumns } from './discovery.js';
5
+ export { LIST_PRESETS } from './presets.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
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
+ export { ENTITY_ATTRIBUTES } from './types.js';
5
+ // Engine
6
+ export { executeList, listResultToCSV } from './engine.js';
7
+ // Column discovery
8
+ export { discoverColumns } from './discovery.js';
9
+ // Presets
10
+ export { LIST_PRESETS } from './presets.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAe/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,SAAS;AACT,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE3D,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,UAAU;AACV,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ListDefinition } from './types.js';
2
+ export declare const LIST_PRESETS: ListDefinition[];
3
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA4CjD,eAAO,MAAM,YAAY,EAAE,cAAc,EAyFxC,CAAC"}
@@ -0,0 +1,102 @@
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
+ * Built-in list presets / templates
6
+ */
7
+ import { IfcTypeEnum } from '@ifc-lite/data';
8
+ function makePreset(name, description, entityTypes, columns) {
9
+ return {
10
+ id: `preset-${name.toLowerCase().replace(/\s+/g, '-')}`,
11
+ name,
12
+ description,
13
+ createdAt: 0,
14
+ updatedAt: 0,
15
+ entityTypes,
16
+ conditions: [],
17
+ columns,
18
+ };
19
+ }
20
+ function attr(name) {
21
+ return { id: `attr-${name.toLowerCase()}`, source: 'attribute', propertyName: name };
22
+ }
23
+ function prop(psetName, propName) {
24
+ return {
25
+ id: `prop-${psetName}-${propName}`.toLowerCase().replace(/\s+/g, '-'),
26
+ source: 'property',
27
+ psetName,
28
+ propertyName: propName,
29
+ label: propName,
30
+ };
31
+ }
32
+ function quant(qsetName, quantName) {
33
+ return {
34
+ id: `quant-${qsetName}-${quantName}`.toLowerCase().replace(/\s+/g, '-'),
35
+ source: 'quantity',
36
+ psetName: qsetName,
37
+ propertyName: quantName,
38
+ label: quantName,
39
+ };
40
+ }
41
+ export const LIST_PRESETS = [
42
+ makePreset('Wall Schedule', 'All walls with common properties and base quantities', [IfcTypeEnum.IfcWall, IfcTypeEnum.IfcWallStandardCase], [
43
+ attr('Name'),
44
+ attr('Type'),
45
+ attr('ObjectType'),
46
+ prop('Pset_WallCommon', 'IsExternal'),
47
+ prop('Pset_WallCommon', 'FireRating'),
48
+ prop('Pset_WallCommon', 'LoadBearing'),
49
+ quant('Qto_WallBaseQuantities', 'Length'),
50
+ quant('Qto_WallBaseQuantities', 'Height'),
51
+ quant('Qto_WallBaseQuantities', 'Width'),
52
+ quant('Qto_WallBaseQuantities', 'GrossVolume'),
53
+ quant('Qto_WallBaseQuantities', 'NetArea'),
54
+ ]),
55
+ makePreset('Door Schedule', 'All doors with dimensions', [IfcTypeEnum.IfcDoor], [
56
+ attr('Name'),
57
+ attr('Type'),
58
+ attr('ObjectType'),
59
+ prop('Pset_DoorCommon', 'FireRating'),
60
+ prop('Pset_DoorCommon', 'IsExternal'),
61
+ prop('Pset_DoorCommon', 'AcousticRating'),
62
+ quant('Qto_DoorBaseQuantities', 'Width'),
63
+ quant('Qto_DoorBaseQuantities', 'Height'),
64
+ quant('Qto_DoorBaseQuantities', 'Area'),
65
+ ]),
66
+ makePreset('Window Schedule', 'All windows with dimensions', [IfcTypeEnum.IfcWindow], [
67
+ attr('Name'),
68
+ attr('Type'),
69
+ attr('ObjectType'),
70
+ prop('Pset_WindowCommon', 'IsExternal'),
71
+ prop('Pset_WindowCommon', 'FireRating'),
72
+ prop('Pset_WindowCommon', 'ThermalTransmittance'),
73
+ quant('Qto_WindowBaseQuantities', 'Width'),
74
+ quant('Qto_WindowBaseQuantities', 'Height'),
75
+ quant('Qto_WindowBaseQuantities', 'Area'),
76
+ ]),
77
+ makePreset('Space Areas', 'All spaces with areas and volumes', [IfcTypeEnum.IfcSpace], [
78
+ attr('Name'),
79
+ attr('Description'),
80
+ attr('ObjectType'),
81
+ prop('Pset_SpaceCommon', 'Category'),
82
+ prop('Pset_SpaceCommon', 'IsExternal'),
83
+ quant('Qto_SpaceBaseQuantities', 'GrossFloorArea'),
84
+ quant('Qto_SpaceBaseQuantities', 'NetFloorArea'),
85
+ quant('Qto_SpaceBaseQuantities', 'GrossVolume'),
86
+ quant('Qto_SpaceBaseQuantities', 'FinishCeilingHeight'),
87
+ ]),
88
+ makePreset('All Elements', 'Overview of all building elements', [
89
+ IfcTypeEnum.IfcWall, IfcTypeEnum.IfcWallStandardCase,
90
+ IfcTypeEnum.IfcDoor, IfcTypeEnum.IfcWindow,
91
+ IfcTypeEnum.IfcSlab, IfcTypeEnum.IfcColumn, IfcTypeEnum.IfcBeam,
92
+ IfcTypeEnum.IfcStair, IfcTypeEnum.IfcRoof, IfcTypeEnum.IfcCovering,
93
+ IfcTypeEnum.IfcCurtainWall, IfcTypeEnum.IfcRailing,
94
+ ], [
95
+ attr('Name'),
96
+ attr('Type'),
97
+ attr('GlobalId'),
98
+ attr('Description'),
99
+ attr('ObjectType'),
100
+ ]),
101
+ ];
102
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,SAAS,UAAU,CACjB,IAAY,EACZ,WAAmB,EACnB,WAA0B,EAC1B,OAAkC;IAElC,OAAO;QACL,EAAE,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;QACvD,IAAI;QACJ,WAAW;QACX,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;QACZ,WAAW;QACX,UAAU,EAAE,EAAE;QACd,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,EAAE,EAAE,EAAE,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AACvF,CAAC;AAED,SAAS,IAAI,CAAC,QAAgB,EAAE,QAAgB;IAC9C,OAAO;QACL,EAAE,EAAE,QAAQ,QAAQ,IAAI,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;QACrE,MAAM,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WAAW,CAAC,SAAS;QAC1C,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,OAAO;QAC/D,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,WAAW;QAClE,WAAW,CAAC,cAAc,EAAE,WAAW,CAAC,UAAU;KACnD,EACD;QACE,IAAI,CAAC,MAAM,CAAC;QACZ,IAAI,CAAC,MAAM,CAAC;QACZ,IAAI,CAAC,UAAU,CAAC;QAChB,IAAI,CAAC,aAAa,CAAC;QACnB,IAAI,CAAC,YAAY,CAAC;KACnB,CACF;CACF,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Types for the Lists feature - configurable property tables from IFC data
3
+ */
4
+ import type { IfcTypeEnum, PropertySet, QuantitySet } from '@ifc-lite/data';
5
+ /**
6
+ * Abstract interface for accessing IFC data during list execution.
7
+ *
8
+ * Consumers implement this to bridge their data source (e.g., IfcDataStore,
9
+ * server model, or custom store) to the list engine.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const provider: ListDataProvider = {
14
+ * getEntitiesByType: (type) => myStore.entities.getByType(type),
15
+ * getEntityName: (id) => myStore.entities.getName(id),
16
+ * getEntityGlobalId: (id) => myStore.entities.getGlobalId(id),
17
+ * getEntityDescription: (id) => myStore.entities.getDescription(id),
18
+ * getEntityObjectType: (id) => myStore.entities.getObjectType(id),
19
+ * getEntityTypeName: (id) => myStore.entities.getTypeName(id),
20
+ * getPropertySets: (id) => myStore.properties.getForEntity(id),
21
+ * getQuantitySets: (id) => myStore.quantities.getForEntity(id),
22
+ * };
23
+ * ```
24
+ */
25
+ export interface ListDataProvider {
26
+ /** Get all entity IDs matching the given IFC type */
27
+ getEntitiesByType(type: IfcTypeEnum): number[];
28
+ /** Get entity name (IfcRoot.Name) by express ID */
29
+ getEntityName(expressId: number): string;
30
+ /** Get entity GlobalId by express ID */
31
+ getEntityGlobalId(expressId: number): string;
32
+ /** Get entity description by express ID */
33
+ getEntityDescription(expressId: number): string;
34
+ /** Get entity object type / predefined type by express ID */
35
+ getEntityObjectType(expressId: number): string;
36
+ /** Get entity tag (IfcElement.Tag) by express ID */
37
+ getEntityTag(expressId: number): string;
38
+ /** Get IFC type name (e.g., "IfcWall") by express ID */
39
+ getEntityTypeName(expressId: number): string;
40
+ /** Get all property sets for an entity (handles on-demand extraction) */
41
+ getPropertySets(expressId: number): PropertySet[];
42
+ /** Get all quantity sets for an entity (handles on-demand extraction) */
43
+ getQuantitySets(expressId: number): QuantitySet[];
44
+ }
45
+ export interface ListDefinition {
46
+ id: string;
47
+ name: string;
48
+ description?: string;
49
+ createdAt: number;
50
+ updatedAt: number;
51
+ /** Which entity types to include */
52
+ entityTypes: IfcTypeEnum[];
53
+ /** Optional property-based filter conditions */
54
+ conditions: PropertyCondition[];
55
+ /** Columns to display */
56
+ columns: ColumnDefinition[];
57
+ /** Current sort state */
58
+ sortBy?: {
59
+ columnId: string;
60
+ direction: 'asc' | 'desc';
61
+ };
62
+ }
63
+ export interface PropertyCondition {
64
+ source: 'attribute' | 'property' | 'quantity';
65
+ /** Property set name (for property/quantity sources) */
66
+ psetName?: string;
67
+ /** Property name within the set */
68
+ propertyName: string;
69
+ operator: ConditionOperator;
70
+ value: string | number | boolean;
71
+ }
72
+ export type ConditionOperator = 'equals' | 'notEquals' | 'contains' | 'gt' | 'lt' | 'gte' | 'lte' | 'exists';
73
+ export interface ColumnDefinition {
74
+ id: string;
75
+ source: 'attribute' | 'property' | 'quantity';
76
+ /** For property: pset name. For quantity: qset name. */
77
+ psetName?: string;
78
+ /** Attribute name or property/quantity name */
79
+ propertyName: string;
80
+ /** Display label override */
81
+ label?: string;
82
+ }
83
+ export interface ListResult {
84
+ columns: ColumnDefinition[];
85
+ rows: ListRow[];
86
+ /** Total matched entities before pagination */
87
+ totalCount: number;
88
+ /** Execution time in ms */
89
+ executionTime: number;
90
+ }
91
+ export interface ListRow {
92
+ /** Entity reference for 3D selection */
93
+ entityId: number;
94
+ modelId: string;
95
+ /** Column values in same order as ListResult.columns */
96
+ values: CellValue[];
97
+ }
98
+ export type CellValue = string | number | boolean | null;
99
+ /** Available columns discovered from the model */
100
+ export interface DiscoveredColumns {
101
+ attributes: string[];
102
+ properties: Map<string, string[]>;
103
+ quantities: Map<string, string[]>;
104
+ }
105
+ export declare const ENTITY_ATTRIBUTES: readonly ["Name", "GlobalId", "Type", "Description", "ObjectType", "Tag"];
106
+ export type EntityAttribute = typeof ENTITY_ATTRIBUTES[number];
107
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CAAC;IAE/C,mDAAmD;IACnD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACzC,wCAAwC;IACxC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7C,2CAA2C;IAC3C,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAChD,6DAA6D;IAC7D,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/C,oDAAoD;IACpD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,wDAAwD;IACxD,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAE7C,yEAAyE;IACzE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;IAClD,yEAAyE;IACzE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,EAA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AAO,EAAE,CAAC;IAChB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAMzD,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACnC;AAMD,eAAO,MAAM,iBAAiB,2EAOpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,15 @@
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
+ // Built-in Attributes
6
+ // ============================================================================
7
+ export const ENTITY_ATTRIBUTES = [
8
+ 'Name',
9
+ 'GlobalId',
10
+ 'Type',
11
+ 'Description',
12
+ 'ObjectType',
13
+ 'Tag',
14
+ ];
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAwJ/D,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,UAAU;IACV,MAAM;IACN,aAAa;IACb,YAAY;IACZ,KAAK;CACG,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@ifc-lite/lists",
3
+ "version": "1.7.0",
4
+ "description": "Configurable property tables and schedules from IFC data for IFC-Lite",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@ifc-lite/data": "1.7.0",
16
+ "@ifc-lite/encoding": "1.7.0"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.3.0",
20
+ "vitest": "^1.6.0"
21
+ },
22
+ "license": "MPL-2.0",
23
+ "author": "Louis True",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/louistrue/ifc-lite.git",
27
+ "directory": "packages/lists"
28
+ },
29
+ "homepage": "https://louistrue.github.io/ifc-lite/",
30
+ "bugs": "https://github.com/louistrue/ifc-lite/issues",
31
+ "keywords": [
32
+ "ifc",
33
+ "bim",
34
+ "lists",
35
+ "schedules",
36
+ "property-tables",
37
+ "aec"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "README.md"
45
+ ],
46
+ "scripts": {
47
+ "build": "tsc",
48
+ "dev": "tsc --watch",
49
+ "test": "vitest run"
50
+ }
51
+ }