@ifc-lite/export 4.2.0 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/anonymize-export.d.ts.map +1 -1
  2. package/dist/anonymize-export.js +10 -4
  3. package/dist/anonymize-export.js.map +1 -1
  4. package/dist/anonymize-placement.js +2 -2
  5. package/dist/anonymize-placement.js.map +1 -1
  6. package/dist/appearance-dependencies.d.ts.map +1 -1
  7. package/dist/appearance-dependencies.js +9 -5
  8. package/dist/appearance-dependencies.js.map +1 -1
  9. package/dist/csv-table.d.ts +10 -0
  10. package/dist/csv-table.d.ts.map +1 -0
  11. package/dist/csv-table.js +39 -0
  12. package/dist/csv-table.js.map +1 -0
  13. package/dist/effective-appearance-record.d.ts.map +1 -1
  14. package/dist/effective-appearance-record.js +11 -7
  15. package/dist/effective-appearance-record.js.map +1 -1
  16. package/dist/ifc5-export-helpers.d.ts +19 -0
  17. package/dist/ifc5-export-helpers.d.ts.map +1 -1
  18. package/dist/ifc5-export-helpers.js +41 -0
  19. package/dist/ifc5-export-helpers.js.map +1 -1
  20. package/dist/ifc5-exporter.d.ts +9 -10
  21. package/dist/ifc5-exporter.d.ts.map +1 -1
  22. package/dist/ifc5-exporter.js +5 -32
  23. package/dist/ifc5-exporter.js.map +1 -1
  24. package/dist/index.d.ts +4 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +8 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/merged-empty-containers.d.ts.map +1 -1
  29. package/dist/merged-empty-containers.js +6 -9
  30. package/dist/merged-empty-containers.js.map +1 -1
  31. package/dist/merged-exporter.d.ts +3 -3
  32. package/dist/merged-exporter.d.ts.map +1 -1
  33. package/dist/merged-exporter.js +23 -18
  34. package/dist/merged-exporter.js.map +1 -1
  35. package/dist/parquet-exporter.js +2 -26
  36. package/dist/parquet-exporter.js.map +1 -1
  37. package/dist/reference-collector.d.ts +20 -8
  38. package/dist/reference-collector.d.ts.map +1 -1
  39. package/dist/reference-collector.js +33 -41
  40. package/dist/reference-collector.js.map +1 -1
  41. package/dist/schema-converter-attr-remap.d.ts +11 -22
  42. package/dist/schema-converter-attr-remap.d.ts.map +1 -1
  43. package/dist/schema-converter-attr-remap.js +35 -23
  44. package/dist/schema-converter-attr-remap.js.map +1 -1
  45. package/dist/schema-converter-owner-history.d.ts +44 -0
  46. package/dist/schema-converter-owner-history.d.ts.map +1 -0
  47. package/dist/schema-converter-owner-history.js +90 -0
  48. package/dist/schema-converter-owner-history.js.map +1 -0
  49. package/dist/schema-converter.d.ts +6 -1
  50. package/dist/schema-converter.d.ts.map +1 -1
  51. package/dist/schema-converter.js +27 -79
  52. package/dist/schema-converter.js.map +1 -1
  53. package/dist/step-argument-parser.d.ts +13 -3
  54. package/dist/step-argument-parser.d.ts.map +1 -1
  55. package/dist/step-argument-parser.js +21 -11
  56. package/dist/step-argument-parser.js.map +1 -1
  57. package/dist/step-comment-skip.d.ts +1 -1
  58. package/dist/step-comment-skip.js +1 -1
  59. package/dist/step-export-types.d.ts +5 -0
  60. package/dist/step-export-types.d.ts.map +1 -1
  61. package/dist/step-export-types.js.map +1 -1
  62. package/dist/step-exporter.d.ts.map +1 -1
  63. package/dist/step-exporter.js +6 -0
  64. package/dist/step-exporter.js.map +1 -1
  65. package/dist/step-header.d.ts.map +1 -1
  66. package/dist/step-header.js +1 -0
  67. package/dist/step-header.js.map +1 -1
  68. package/dist/step-overlay-attribute-overrides.d.ts.map +1 -1
  69. package/dist/step-overlay-attribute-overrides.js +6 -2
  70. package/dist/step-overlay-attribute-overrides.js.map +1 -1
  71. package/dist/step-overlay-entities.d.ts.map +1 -1
  72. package/dist/step-overlay-entities.js +2 -5
  73. package/dist/step-overlay-entities.js.map +1 -1
  74. package/dist/step-pass-builder.d.ts.map +1 -1
  75. package/dist/step-pass-builder.js +2 -0
  76. package/dist/step-pass-builder.js.map +1 -1
  77. package/dist/step-property-set-generators.d.ts +1 -1
  78. package/dist/step-property-set-generators.d.ts.map +1 -1
  79. package/dist/step-property-set-generators.js +7 -5
  80. package/dist/step-property-set-generators.js.map +1 -1
  81. package/dist/step-property-set-readers.d.ts +14 -3
  82. package/dist/step-property-set-readers.d.ts.map +1 -1
  83. package/dist/step-property-set-readers.js +23 -9
  84. package/dist/step-property-set-readers.js.map +1 -1
  85. package/dist/step-property-sets.js +1 -1
  86. package/dist/step-property-sets.js.map +1 -1
  87. package/dist/step-serialization.d.ts +1 -1
  88. package/dist/step-serialization.js +1 -1
  89. package/dist/step-source-iteration.d.ts.map +1 -1
  90. package/dist/step-source-iteration.js +1 -5
  91. package/dist/step-source-iteration.js.map +1 -1
  92. package/dist/subset-entity-reader.d.ts +12 -4
  93. package/dist/subset-entity-reader.d.ts.map +1 -1
  94. package/dist/subset-entity-reader.js +4 -16
  95. package/dist/subset-entity-reader.js.map +1 -1
  96. package/dist/zero-content.d.ts +32 -0
  97. package/dist/zero-content.d.ts.map +1 -0
  98. package/dist/zero-content.js +64 -0
  99. package/dist/zero-content.js.map +1 -0
  100. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"subset-entity-reader.d.ts","sourceRoot":"","sources":["../src/subset-entity-reader.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBvD;;mDAEmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED;kFACkF;AAClF,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACxF;A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CAAE,EAC1C,KAAK,EAAE,oBAAoB,EAC3B,EAAE,EAAE,MAAM,GACT,gBAAgB,GAAG,IAAI,CASzB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAc5D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAIhG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAMvF"}
@@ -1,19 +1,10 @@
1
1
  /* This Source Code Form is subject to the terms of the Mozilla Public
2
2
  * License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
- import { STEP_TRIVIA, getAttributeNamesAcrossSchemas, resolveEntityNameAlias } from '@ifc-lite/parser';
4
+ import { getAttributeNamesAcrossSchemas, resolveEntityNameAlias } from '@ifc-lite/parser';
5
5
  import { ENTITIES_IFC2X3, ENTITIES_IFC4, ENTITIES_IFC4X3 } from '@ifc-lite/data';
6
6
  import { createSourceRefReader, decodeRange } from './source-ref-bounds.js';
7
- import { splitTopLevelArgs } from './step-argument-parser.js';
8
- /**
9
- * `#N=TYPE(...);` record, with STEP trivia (whitespace and/or a
10
- * `/* ... *​/` comment, #3789) tolerated between the type name and `(` —
11
- * the same adjacency fix the rest of this package's record readers carry.
12
- * Without it a wrapped record reads as unparseable, `readEntityArgs` returns
13
- * `null`, and `anonymize-placement.ts` / `anonymize-scrub.ts` silently skip
14
- * that entity instead of scrubbing it.
15
- */
16
- const RECORD_RE = new RegExp(`^#\\d+\\s*=\\s*(\\w+)${STEP_TRIVIA}\\(([\\s\\S]*)\\)\\s*;\\s*$`);
7
+ import { readStepSlots } from './step-argument-parser.js';
17
8
  /**
18
9
  * Read entity `id`'s STEP record out of `store`'s source and split it into
19
10
  * its type token and top-level argument list. Returns `null` when the id has
@@ -36,11 +27,8 @@ export function readEntityArgs(store, index, id) {
36
27
  if (!isReadable(ref))
37
28
  return null;
38
29
  const line = decodeRange(store.source, ref.byteOffset, ref.byteOffset + ref.byteLength);
39
- const match = line.match(RECORD_RE);
40
- if (!match)
41
- return null;
42
- const [, type, argsText] = match;
43
- return { type: type.toUpperCase(), args: splitTopLevelArgs(argsText) };
30
+ const record = readStepSlots(line);
31
+ return record === null ? null : { type: record.type, args: record.slots.map((arg) => arg.trim()) };
44
32
  }
45
33
  const ATTRIBUTE_NAMES_BY_SCHEMA = {
46
34
  IFC2X3: attributeTableByUpperName(ENTITIES_IFC2X3),
@@ -1 +1 @@
1
- {"version":3,"file":"subset-entity-reader.js","sourceRoot":"","sources":["../src/subset-entity-reader.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmB/D,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,wBAAwB,WAAW,6BAA6B,CAAC,CAAC;AAiB/F;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA0C,EAC1C,KAA2B,EAC3B,EAAU;IAEV,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,M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,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,8BAA8B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * "Did this export actually carry any content?" for the two Rust-backed
3
+ * non-mesh formats — the JSON-LD and STEP twins of `countObjVertices` (OBJ)
4
+ * and `countGlbMeshes` (GLB).
5
+ *
6
+ * Both writers always return a syntactically valid, non-zero-byte document
7
+ * even when every entity is filtered out: JSON-LD still carries its
8
+ * `@context` around an empty `@graph`, and the STEP writer still regenerates
9
+ * the ISO-10303-21 header around an empty `DATA;` section. So a byte-length
10
+ * check cannot tell an empty export from a real one, exactly as it cannot for
11
+ * a header-only OBJ. Node count and entity count are the content signals.
12
+ */
13
+ /**
14
+ * Count the `@graph` nodes in an IFC-Lite-generated JSON-LD export. Zero means
15
+ * the document describes no entities.
16
+ *
17
+ * The graph is parsed rather than pattern-matched: `"@id"` also appears on
18
+ * nested property-set and quantity-set objects, so counting occurrences would
19
+ * over-report and let an entity-free document look populated.
20
+ */
21
+ export declare function countJsonldNodes(jsonld: Uint8Array): number;
22
+ /**
23
+ * Count the entity instances (`#123=...`) in a STEP/IFC export. Zero means the
24
+ * `DATA;` section is empty — a header-only file that round-trips to nothing.
25
+ *
26
+ * The Rust STEP writer emits one instance per line, so an anchored per-line
27
+ * match counts instances without a full STEP parse. A `#123` appearing as a
28
+ * reference inside another instance's attribute list is never at the start of
29
+ * a line, so it cannot inflate the count.
30
+ */
31
+ export declare function countStepEntities(step: Uint8Array): number;
32
+ //# sourceMappingURL=zero-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero-content.d.ts","sourceRoot":"","sources":["../src/zero-content.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAa3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAY1D"}
@@ -0,0 +1,64 @@
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
+ * "Did this export actually carry any content?" for the two Rust-backed
6
+ * non-mesh formats — the JSON-LD and STEP twins of `countObjVertices` (OBJ)
7
+ * and `countGlbMeshes` (GLB).
8
+ *
9
+ * Both writers always return a syntactically valid, non-zero-byte document
10
+ * even when every entity is filtered out: JSON-LD still carries its
11
+ * `@context` around an empty `@graph`, and the STEP writer still regenerates
12
+ * the ISO-10303-21 header around an empty `DATA;` section. So a byte-length
13
+ * check cannot tell an empty export from a real one, exactly as it cannot for
14
+ * a header-only OBJ. Node count and entity count are the content signals.
15
+ */
16
+ /**
17
+ * Count the `@graph` nodes in an IFC-Lite-generated JSON-LD export. Zero means
18
+ * the document describes no entities.
19
+ *
20
+ * The graph is parsed rather than pattern-matched: `"@id"` also appears on
21
+ * nested property-set and quantity-set objects, so counting occurrences would
22
+ * over-report and let an entity-free document look populated.
23
+ */
24
+ export function countJsonldNodes(jsonld) {
25
+ let parsed;
26
+ try {
27
+ parsed = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(jsonld));
28
+ }
29
+ catch {
30
+ // A malformed / non-UTF-8 / non-JSON buffer describes no entities. Return
31
+ // 0 so callers treat it as an empty export (and fail loud) rather than
32
+ // crashing on the decode with an opaque stack trace.
33
+ return 0;
34
+ }
35
+ if (typeof parsed !== 'object' || parsed === null)
36
+ return 0;
37
+ const graph = parsed['@graph'];
38
+ return Array.isArray(graph) ? graph.length : 0;
39
+ }
40
+ /**
41
+ * Count the entity instances (`#123=...`) in a STEP/IFC export. Zero means the
42
+ * `DATA;` section is empty — a header-only file that round-trips to nothing.
43
+ *
44
+ * The Rust STEP writer emits one instance per line, so an anchored per-line
45
+ * match counts instances without a full STEP parse. A `#123` appearing as a
46
+ * reference inside another instance's attribute list is never at the start of
47
+ * a line, so it cannot inflate the count.
48
+ */
49
+ export function countStepEntities(step) {
50
+ let text;
51
+ try {
52
+ text = new TextDecoder('utf-8', { fatal: true }).decode(step);
53
+ }
54
+ catch {
55
+ return 0;
56
+ }
57
+ let count = 0;
58
+ for (const line of text.split('\n')) {
59
+ if (/^#\d+\s*=/.test(line))
60
+ count++;
61
+ }
62
+ return count;
63
+ }
64
+ //# sourceMappingURL=zero-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero-content.js","sourceRoot":"","sources":["../src/zero-content.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAChF,CAAC;IAAC,MAAM,CAAC;QACP,0EAA0E;QAC1E,uEAAuE;QACvE,qDAAqD;QACrD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAI,MAAiC,CAAC,QAAQ,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/export",
3
- "version": "4.2.0",
3
+ "version": "4.3.2",
4
4
  "description": "Export formats for IFC-Lite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,13 +16,13 @@
16
16
  "parquet-wasm": "^0.7.2",
17
17
  "apache-arrow": "^21.2.0",
18
18
  "jszip": "^3.10.0",
19
- "@ifc-lite/geometry": "^5.0.0",
19
+ "@ifc-lite/geometry": "^7.0.0",
20
20
  "@ifc-lite/codegen": "^1.17.0",
21
- "@ifc-lite/data": "^4.2.0",
21
+ "@ifc-lite/data": "^4.4.0",
22
22
  "@ifc-lite/encoding": "^2.2.0",
23
- "@ifc-lite/parser": "^6.1.0",
24
- "@ifc-lite/mutations": "^2.2.0",
25
- "@ifc-lite/ifcx": "^4.1.0"
23
+ "@ifc-lite/parser": "^6.4.0",
24
+ "@ifc-lite/mutations": "^2.3.0",
25
+ "@ifc-lite/ifcx": "^4.1.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^6.0.3",