@ifc-lite/parser 6.5.0 → 7.0.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 (79) hide show
  1. package/README.md +21 -0
  2. package/dist/cost-category-buckets.d.ts +5 -0
  3. package/dist/cost-category-buckets.d.ts.map +1 -0
  4. package/dist/cost-category-buckets.js +37 -0
  5. package/dist/cost-category-buckets.js.map +1 -0
  6. package/dist/cost-compatibility-tree.d.ts +4 -0
  7. package/dist/cost-compatibility-tree.d.ts.map +1 -0
  8. package/dist/cost-compatibility-tree.js +46 -0
  9. package/dist/cost-compatibility-tree.js.map +1 -0
  10. package/dist/cost-evaluation-arithmetic.d.ts +16 -0
  11. package/dist/cost-evaluation-arithmetic.d.ts.map +1 -0
  12. package/dist/cost-evaluation-arithmetic.js +181 -0
  13. package/dist/cost-evaluation-arithmetic.js.map +1 -0
  14. package/dist/cost-evaluation-context.d.ts +20 -0
  15. package/dist/cost-evaluation-context.d.ts.map +1 -0
  16. package/dist/cost-evaluation-context.js +54 -0
  17. package/dist/cost-evaluation-context.js.map +1 -0
  18. package/dist/cost-evaluation-result.d.ts +5 -0
  19. package/dist/cost-evaluation-result.d.ts.map +1 -0
  20. package/dist/cost-evaluation-result.js +20 -0
  21. package/dist/cost-evaluation-result.js.map +1 -0
  22. package/dist/cost-evaluator.d.ts +6 -0
  23. package/dist/cost-evaluator.d.ts.map +1 -0
  24. package/dist/cost-evaluator.js +396 -0
  25. package/dist/cost-evaluator.js.map +1 -0
  26. package/dist/cost-extractor.d.ts +3 -8
  27. package/dist/cost-extractor.d.ts.map +1 -1
  28. package/dist/cost-extractor.js +330 -335
  29. package/dist/cost-extractor.js.map +1 -1
  30. package/dist/cost-quantities.d.ts +5 -0
  31. package/dist/cost-quantities.d.ts.map +1 -0
  32. package/dist/cost-quantities.js +116 -0
  33. package/dist/cost-quantities.js.map +1 -0
  34. package/dist/cost-quantity-evaluator.d.ts +23 -0
  35. package/dist/cost-quantity-evaluator.d.ts.map +1 -0
  36. package/dist/cost-quantity-evaluator.js +153 -0
  37. package/dist/cost-quantity-evaluator.js.map +1 -0
  38. package/dist/cost-reader.d.ts +26 -0
  39. package/dist/cost-reader.d.ts.map +1 -0
  40. package/dist/cost-reader.js +117 -0
  41. package/dist/cost-reader.js.map +1 -0
  42. package/dist/cost-relationships.d.ts +7 -0
  43. package/dist/cost-relationships.d.ts.map +1 -0
  44. package/dist/cost-relationships.js +237 -0
  45. package/dist/cost-relationships.js.map +1 -0
  46. package/dist/cost-step-lexemes.d.ts +16 -0
  47. package/dist/cost-step-lexemes.d.ts.map +1 -0
  48. package/dist/cost-step-lexemes.js +131 -0
  49. package/dist/cost-step-lexemes.js.map +1 -0
  50. package/dist/cost-types.d.ts +210 -76
  51. package/dist/cost-types.d.ts.map +1 -1
  52. package/dist/cost-units.d.ts +38 -0
  53. package/dist/cost-units.d.ts.map +1 -0
  54. package/dist/cost-units.js +348 -0
  55. package/dist/cost-units.js.map +1 -0
  56. package/dist/cost-value-evaluation-session.d.ts +19 -0
  57. package/dist/cost-value-evaluation-session.d.ts.map +1 -0
  58. package/dist/cost-value-evaluation-session.js +25 -0
  59. package/dist/cost-value-evaluation-session.js.map +1 -0
  60. package/dist/cost.d.ts +4 -0
  61. package/dist/cost.d.ts.map +1 -0
  62. package/dist/cost.js +6 -0
  63. package/dist/cost.js.map +1 -0
  64. package/dist/entity-extractor.d.ts.map +1 -1
  65. package/dist/entity-extractor.js +5 -2
  66. package/dist/entity-extractor.js.map +1 -1
  67. package/dist/index.d.ts +1 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +1 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/step-entity-parameters.d.ts +9 -0
  72. package/dist/step-entity-parameters.d.ts.map +1 -0
  73. package/dist/step-entity-parameters.js +30 -0
  74. package/dist/step-entity-parameters.js.map +1 -0
  75. package/package.json +4 -3
  76. package/dist/cost-schedule-2x3.d.ts +0 -31
  77. package/dist/cost-schedule-2x3.d.ts.map +0 -1
  78. package/dist/cost-schedule-2x3.js +0 -75
  79. package/dist/cost-schedule-2x3.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Return the source between a record's opening parenthesis and its matching
3
+ * close. The entity reference handed to the extractor can include trailing
4
+ * STEP trivia before `;`; a greedy regex therefore mistakes a `)` inside that
5
+ * trivia for the record close. Strings and comments carry no structure, just
6
+ * as they do in the tokenizer's byte-level record-boundary scanner.
7
+ */
8
+ export declare function entityParameters(record: string, openEnd: number): string | undefined;
9
+ //# sourceMappingURL=step-entity-parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-entity-parameters.d.ts","sourceRoot":"","sources":["../src/step-entity-parameters.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAepF"}
@@ -0,0 +1,30 @@
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 { StepTextScan } from './step-lexing.js';
5
+ /**
6
+ * Return the source between a record's opening parenthesis and its matching
7
+ * close. The entity reference handed to the extractor can include trailing
8
+ * STEP trivia before `;`; a greedy regex therefore mistakes a `)` inside that
9
+ * trivia for the record close. Strings and comments carry no structure, just
10
+ * as they do in the tokenizer's byte-level record-boundary scanner.
11
+ */
12
+ export function entityParameters(record, openEnd) {
13
+ let depth = 1;
14
+ const lexical = new StepTextScan(record);
15
+ for (let index = openEnd; index < record.length;) {
16
+ const skipped = lexical.skipLexicalAt(index);
17
+ if (skipped > index) {
18
+ index = skipped;
19
+ continue;
20
+ }
21
+ const char = record[index];
22
+ if (char === '(')
23
+ depth++;
24
+ else if (char === ')' && --depth === 0)
25
+ return record.slice(openEnd, index);
26
+ index++;
27
+ }
28
+ return undefined;
29
+ }
30
+ //# sourceMappingURL=step-entity-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-entity-parameters.js","sourceRoot":"","sources":["../src/step-entity-parameters.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAe;IAC9D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,IAAI,KAAK,GAAG,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC;QACjD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,OAAO,GAAG,KAAK,EAAE,CAAC;YACpB,KAAK,GAAG,OAAO,CAAC;YAChB,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,IAAI,KAAK,GAAG;YAAE,KAAK,EAAE,CAAC;aACrB,IAAI,IAAI,KAAK,GAAG,IAAI,EAAE,KAAK,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5E,KAAK,EAAE,CAAC;IACV,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/parser",
3
- "version": "6.5.0",
3
+ "version": "7.0.0",
4
4
  "description": "IFC/STEP parser for IFC-Lite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,13 +17,14 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
+ "decimal.js": "^10.6.0",
20
21
  "fflate": "^0.8.3",
21
22
  "jszip": "^3.10.0",
22
23
  "@ifc-lite/data": "^4.4.0",
23
24
  "@ifc-lite/encoding": "^2.2.0",
24
25
  "@ifc-lite/ifcx": "^4.1.1",
25
- "@ifc-lite/wasm-lifecycle": "^0.2.0",
26
- "@ifc-lite/wasm": "^9.0.1"
26
+ "@ifc-lite/wasm": "^9.1.0",
27
+ "@ifc-lite/wasm-lifecycle": "^0.2.0"
27
28
  },
28
29
  "devDependencies": {
29
30
  "typescript": "^6.0.3",
@@ -1,31 +0,0 @@
1
- /**
2
- * IFC2X3 `IfcCostSchedule` attribute layout, used by `cost-extractor.ts`.
3
- *
4
- * In IFC2X3 `IfcControl` adds no attributes to `IfcObject`, so the schedule's
5
- * own attributes start at slot 5 (IFC4 inserts `Identification` there and
6
- * reorders the rest):
7
- *
8
- * 5 SubmittedBy, 6 PreparedBy, 7 SubmittedOn, 8 Status, 9 TargetUsers,
9
- * 10 UpdateDate, 11 ID, 12 PredefinedType
10
- *
11
- * `SubmittedOn`/`UpdateDate` are `IfcDateTimeSelect` — a reference to an
12
- * `IfcCalendarDate` or `IfcDateAndTime` entity, not the IFC4 ISO string — so
13
- * they are resolved here into the same `YYYY-MM-DD[THH:MM:SS]` shape the IFC4
14
- * path returns.
15
- */
16
- import type { EntityExtractor } from './entity-extractor.js';
17
- import type { IfcDataStore } from './columnar-parser.js';
18
- export declare const COST_SCHEDULE_ATTR_2X3: {
19
- readonly SubmittedOn: 7;
20
- readonly Status: 8;
21
- readonly UpdateDate: 10;
22
- readonly ID: 11;
23
- readonly PredefinedType: 12;
24
- };
25
- /**
26
- * Resolve an IFC2X3 `IfcDateTimeSelect` attribute (an entity reference) to an
27
- * ISO-like string; `undefined` for `$`, a non-reference, or an unresolvable
28
- * / unexpected target type.
29
- */
30
- export declare function resolveDateTimeSelect2x3(extractor: EntityExtractor, store: IfcDataStore, value: unknown): string | undefined;
31
- //# sourceMappingURL=cost-schedule-2x3.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cost-schedule-2x3.d.ts","sourceRoot":"","sources":["../src/cost-schedule-2x3.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,sBAAsB;;;;;;CAMzB,CAAC;AAsBX;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,SAAS,CAmBpB"}
@@ -1,75 +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
- * IFC2X3 `IfcCostSchedule` attribute layout, used by `cost-extractor.ts`.
6
- *
7
- * In IFC2X3 `IfcControl` adds no attributes to `IfcObject`, so the schedule's
8
- * own attributes start at slot 5 (IFC4 inserts `Identification` there and
9
- * reorders the rest):
10
- *
11
- * 5 SubmittedBy, 6 PreparedBy, 7 SubmittedOn, 8 Status, 9 TargetUsers,
12
- * 10 UpdateDate, 11 ID, 12 PredefinedType
13
- *
14
- * `SubmittedOn`/`UpdateDate` are `IfcDateTimeSelect` — a reference to an
15
- * `IfcCalendarDate` or `IfcDateAndTime` entity, not the IFC4 ISO string — so
16
- * they are resolved here into the same `YYYY-MM-DD[THH:MM:SS]` shape the IFC4
17
- * path returns.
18
- */
19
- export const COST_SCHEDULE_ATTR_2X3 = {
20
- SubmittedOn: 7,
21
- Status: 8,
22
- UpdateDate: 10,
23
- ID: 11,
24
- PredefinedType: 12,
25
- };
26
- function pad2(n) {
27
- return n < 10 ? `0${n}` : String(n);
28
- }
29
- function calendarDate(a) {
30
- // IfcCalendarDate(DayComponent, MonthComponent, YearComponent)
31
- const [day, month, year] = a;
32
- if (typeof day !== 'number' || typeof month !== 'number' || typeof year !== 'number')
33
- return undefined;
34
- return `${year}-${pad2(month)}-${pad2(day)}`;
35
- }
36
- function localTime(a) {
37
- // IfcLocalTime(HourComponent, MinuteComponent?, SecondComponent?, Zone?, DaylightSavingOffset?)
38
- const [hour, minute, second] = a;
39
- if (typeof hour !== 'number')
40
- return undefined;
41
- const m = typeof minute === 'number' ? minute : 0;
42
- const s = typeof second === 'number' ? Math.floor(second) : 0;
43
- return `${pad2(hour)}:${pad2(m)}:${pad2(s)}`;
44
- }
45
- /**
46
- * Resolve an IFC2X3 `IfcDateTimeSelect` attribute (an entity reference) to an
47
- * ISO-like string; `undefined` for `$`, a non-reference, or an unresolvable
48
- * / unexpected target type.
49
- */
50
- export function resolveDateTimeSelect2x3(extractor, store, value) {
51
- if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0)
52
- return undefined;
53
- const ref = store.entityIndex.byId.get(value);
54
- if (!ref)
55
- return undefined;
56
- const entity = extractor.extractEntity(ref);
57
- if (!entity)
58
- return undefined;
59
- const a = entity.attributes || [];
60
- const type = ref.type.toUpperCase();
61
- if (type === 'IFCCALENDARDATE')
62
- return calendarDate(a);
63
- if (type === 'IFCDATEANDTIME') {
64
- // IfcDateAndTime(DateComponent : IfcCalendarDate, TimeComponent : IfcLocalTime)
65
- const date = resolveDateTimeSelect2x3(extractor, store, a[0]);
66
- if (date === undefined)
67
- return undefined;
68
- const timeRef = typeof a[1] === 'number' ? store.entityIndex.byId.get(a[1]) : undefined;
69
- const time = timeRef ? extractor.extractEntity(timeRef) : null;
70
- const clock = time ? localTime(time.attributes || []) : undefined;
71
- return clock === undefined ? date : `${date}T${clock}`;
72
- }
73
- return undefined;
74
- }
75
- //# sourceMappingURL=cost-schedule-2x3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cost-schedule-2x3.js","sourceRoot":"","sources":["../src/cost-schedule-2x3.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAC/D;;;;;;;;;;;;;;GAcG;AAKH,MAAM,CAAC,MAAM,sBAAs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