@ifc-lite/codegen 1.15.12 → 1.16.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 (80) hide show
  1. package/dist/generated/ifc4/entities.d.ts +6221 -0
  2. package/dist/generated/ifc4/entities.d.ts.map +1 -0
  3. package/dist/generated/ifc4/entities.js +8 -0
  4. package/dist/generated/ifc4/entities.js.map +1 -0
  5. package/dist/generated/ifc4/enums.d.ts +2260 -0
  6. package/dist/generated/ifc4/enums.d.ts.map +1 -0
  7. package/dist/generated/ifc4/enums.js +2467 -0
  8. package/dist/generated/ifc4/enums.js.map +1 -0
  9. package/dist/generated/ifc4/index.d.ts +13 -0
  10. package/dist/generated/ifc4/index.d.ts.map +1 -0
  11. package/dist/generated/ifc4/index.js +16 -0
  12. package/dist/generated/ifc4/index.js.map +1 -0
  13. package/dist/generated/ifc4/schema-registry.d.ts +50 -0
  14. package/dist/generated/ifc4/schema-registry.d.ts.map +1 -0
  15. package/dist/generated/ifc4/schema-registry.js +62999 -0
  16. package/dist/generated/ifc4/schema-registry.js.map +1 -0
  17. package/dist/generated/ifc4/selects.d.ts +130 -0
  18. package/dist/generated/ifc4/selects.d.ts.map +1 -0
  19. package/dist/generated/ifc4/selects.js +8 -0
  20. package/dist/generated/ifc4/selects.js.map +1 -0
  21. package/dist/generated/ifc4/serializers.d.ts +12 -0
  22. package/dist/generated/ifc4/serializers.d.ts.map +1 -0
  23. package/dist/generated/ifc4/serializers.js +30 -0
  24. package/dist/generated/ifc4/serializers.js.map +1 -0
  25. package/dist/generated/ifc4/type-ids.d.ts +815 -0
  26. package/dist/generated/ifc4/type-ids.d.ts.map +1 -0
  27. package/dist/generated/ifc4/type-ids.js +1671 -0
  28. package/dist/generated/ifc4/type-ids.js.map +1 -0
  29. package/dist/generated/ifc4/types.d.ts +268 -0
  30. package/dist/generated/ifc4/types.d.ts.map +1 -0
  31. package/dist/generated/ifc4/types.js +8 -0
  32. package/dist/generated/ifc4/types.js.map +1 -0
  33. package/dist/generated/ifc4x3/entities.d.ts +6982 -0
  34. package/dist/generated/ifc4x3/entities.d.ts.map +1 -0
  35. package/dist/generated/ifc4x3/entities.js +8 -0
  36. package/dist/generated/ifc4x3/entities.js.map +1 -0
  37. package/dist/generated/ifc4x3/enums.d.ts +2853 -0
  38. package/dist/generated/ifc4x3/enums.d.ts.map +1 -0
  39. package/dist/generated/ifc4x3/enums.js +3096 -0
  40. package/dist/generated/ifc4x3/enums.js.map +1 -0
  41. package/dist/generated/ifc4x3/index.d.ts +13 -0
  42. package/dist/generated/ifc4x3/index.d.ts.map +1 -0
  43. package/dist/generated/ifc4x3/index.js +16 -0
  44. package/dist/generated/ifc4x3/index.js.map +1 -0
  45. package/dist/generated/ifc4x3/schema-registry.d.ts +50 -0
  46. package/dist/generated/ifc4x3/schema-registry.d.ts.map +1 -0
  47. package/dist/generated/ifc4x3/schema-registry.js +71299 -0
  48. package/dist/generated/ifc4x3/schema-registry.js.map +1 -0
  49. package/dist/generated/ifc4x3/selects.d.ts +131 -0
  50. package/dist/generated/ifc4x3/selects.d.ts.map +1 -0
  51. package/dist/generated/ifc4x3/selects.js +8 -0
  52. package/dist/generated/ifc4x3/selects.js.map +1 -0
  53. package/dist/generated/ifc4x3/serializers.d.ts +12 -0
  54. package/dist/generated/ifc4x3/serializers.d.ts.map +1 -0
  55. package/dist/generated/ifc4x3/serializers.js +30 -0
  56. package/dist/generated/ifc4x3/serializers.js.map +1 -0
  57. package/dist/generated/ifc4x3/type-ids.d.ts +915 -0
  58. package/dist/generated/ifc4x3/type-ids.d.ts.map +1 -0
  59. package/dist/generated/ifc4x3/type-ids.js +1871 -0
  60. package/dist/generated/ifc4x3/type-ids.js.map +1 -0
  61. package/dist/generated/ifc4x3/types.d.ts +272 -0
  62. package/dist/generated/ifc4x3/types.d.ts.map +1 -0
  63. package/dist/generated/ifc4x3/types.js +8 -0
  64. package/dist/generated/ifc4x3/types.js.map +1 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +3 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/rust-generator.d.ts.map +1 -1
  70. package/dist/rust-generator.js +2 -14
  71. package/dist/rust-generator.js.map +1 -1
  72. package/dist/rust-type-name-parser.d.ts +4 -0
  73. package/dist/rust-type-name-parser.d.ts.map +1 -0
  74. package/dist/rust-type-name-parser.js +27 -0
  75. package/dist/rust-type-name-parser.js.map +1 -0
  76. package/dist/schema-hierarchy.d.ts +57 -0
  77. package/dist/schema-hierarchy.d.ts.map +1 -0
  78. package/dist/schema-hierarchy.js +69 -0
  79. package/dist/schema-hierarchy.js.map +1 -0
  80. package/package.json +20 -3
@@ -0,0 +1,69 @@
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
+ * Per-registry index from upper-cased entity name to its upper-cased
6
+ * inheritance chain, built once per registry object and cached by identity
7
+ * (a generated bundle's `SCHEMA_REGISTRY` is a module-level singleton, so
8
+ * identity is stable for the process lifetime). IFC EXPRESS entity names are
9
+ * unique under case-folding, so upper-casing both the key and the chain
10
+ * entries is lossless and lets callers pass either the raw STEP/type-table
11
+ * spelling (already upper-case, e.g. `'IFCWALL'`) or the schema's own
12
+ * PascalCase spelling (`'IfcWall'`) without needing to know which.
13
+ */
14
+ const chainIndexCache = new WeakMap();
15
+ function chainIndexFor(registry) {
16
+ let index = chainIndexCache.get(registry);
17
+ if (!index) {
18
+ index = new Map();
19
+ for (const [name, meta] of Object.entries(registry.entities)) {
20
+ if (meta.inheritanceChain && meta.inheritanceChain.length > 0) {
21
+ index.set(name.toUpperCase(), meta.inheritanceChain.map((n) => n.toUpperCase()));
22
+ }
23
+ }
24
+ chainIndexCache.set(registry, index);
25
+ }
26
+ return index;
27
+ }
28
+ /**
29
+ * Is `type` the same entity as `ancestor`, or a (possibly transitive) subtype
30
+ * of it, according to `registry`? Reflexive: `isSubtypeOf(r, 'IfcWall',
31
+ * 'IfcWall')` is `true`, matching the chain's own inclusion of the entity
32
+ * itself. Case-insensitive on both arguments. Returns `false` for a `type`
33
+ * the registry does not know (including an abstract supertype with no
34
+ * `inheritanceChain` of its own, and any name from a *different* schema
35
+ * version's vocabulary) — never throws.
36
+ */
37
+ export function isSubtypeOf(registry, type, ancestor) {
38
+ const chain = chainIndexFor(registry).get(type.toUpperCase());
39
+ if (!chain)
40
+ return false;
41
+ return chain.includes(ancestor.toUpperCase());
42
+ }
43
+ /**
44
+ * Is `type` a subtype of (or the same entity as) `ancestor` in ANY of the
45
+ * given registries? Use this to test membership against a schema-version
46
+ * union — e.g. a set of entity types that must be recognised whether the
47
+ * store was parsed against IFC4 or IFC4X3, mirroring how a hand-maintained
48
+ * "recognise it in either schema" allowlist used to be built by hand.
49
+ */
50
+ export function isSubtypeOfAny(registries, type, ancestor) {
51
+ return registries.some((registry) => isSubtypeOf(registry, type, ancestor));
52
+ }
53
+ /**
54
+ * Is `type` a PROPER (strict) subtype of `ancestor` — i.e. `isSubtypeOf` is
55
+ * true AND `type` is not `ancestor` itself? Use this for an abstract
56
+ * supertype with no concrete instances (`IfcMaterialDefinition`,
57
+ * `IfcProfileDef`, …): no real IFC entity's `EntityRef.type` is ever the
58
+ * literal abstract-type name, so a caller asking "is this entity one of
59
+ * that abstract type's concrete members" wants the self-match excluded,
60
+ * not `isSubtypeOf`'s reflexive answer.
61
+ */
62
+ export function isProperSubtypeOf(registry, type, ancestor) {
63
+ return type.toUpperCase() !== ancestor.toUpperCase() && isSubtypeOf(registry, type, ancestor);
64
+ }
65
+ /** `isProperSubtypeOf`, checked against ANY of the given registries. */
66
+ export function isProperSubtypeOfAny(registries, type, ancestor) {
67
+ return registries.some((registry) => isProperSubtypeOf(registry, type, ancestor));
68
+ }
69
+ //# sourceMappingURL=schema-hierarchy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-hierarch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AEhB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAA2B,EAAE,IAAY,EAAE,QAAgB;IAC3F,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChG,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,oBAAoB,CAClC,UAAwC,EACxC,IAAY,EACZ,QAAgB;IAEhB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/codegen",
3
- "version": "1.15.12",
3
+ "version": "1.16.0",
4
4
  "description": "TypeScript code generator from IFC EXPRESS schemas",
5
5
  "type": "module",
6
6
  "repository": {
@@ -10,6 +10,23 @@
10
10
  },
11
11
  "main": "dist/index.js",
12
12
  "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./ifc4": {
20
+ "types": "./dist/generated/ifc4/index.d.ts",
21
+ "import": "./dist/generated/ifc4/index.js",
22
+ "default": "./dist/generated/ifc4/index.js"
23
+ },
24
+ "./ifc4x3": {
25
+ "types": "./dist/generated/ifc4x3/index.d.ts",
26
+ "import": "./dist/generated/ifc4x3/index.js",
27
+ "default": "./dist/generated/ifc4x3/index.js"
28
+ }
29
+ },
13
30
  "keywords": [
14
31
  "ifc",
15
32
  "express",
@@ -23,7 +40,7 @@
23
40
  "@ifc-lite/data": "^4.0.0"
24
41
  },
25
42
  "devDependencies": {
26
- "@types/node": "^26.4.0",
43
+ "@types/node": "^26.4.1",
27
44
  "typescript": "^6.0.3",
28
45
  "vitest": "^4.1.11"
29
46
  },
@@ -38,7 +55,7 @@
38
55
  "README.md"
39
56
  ],
40
57
  "scripts": {
41
- "build": "pnpm exec tsc",
58
+ "build": "pnpm exec tsc && pnpm exec tsc -p tsconfig.generated.json",
42
59
  "typecheck": "node ../../scripts/typecheck-tests.mjs",
43
60
  "dev": "pnpm exec tsc --watch",
44
61
  "test": "vitest run",