@ifc-lite/export 4.14.0 → 6.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 (304) hide show
  1. package/dist/anonymize-placement.d.ts.map +1 -1
  2. package/dist/anonymize-placement.js +2 -2
  3. package/dist/anonymize-placement.js.map +1 -1
  4. package/dist/attribute-slot-types.d.ts.map +1 -1
  5. package/dist/attribute-slot-types.js +3 -1
  6. package/dist/attribute-slot-types.js.map +1 -1
  7. package/dist/effective-index-created-rows.d.ts +3 -0
  8. package/dist/effective-index-created-rows.d.ts.map +1 -1
  9. package/dist/effective-index-created-rows.js +16 -5
  10. package/dist/effective-index-created-rows.js.map +1 -1
  11. package/dist/effective-index.d.ts.map +1 -1
  12. package/dist/effective-index.js +2 -1
  13. package/dist/effective-index.js.map +1 -1
  14. package/dist/entity-iteration.d.ts +1 -1
  15. package/dist/entity-iteration.d.ts.map +1 -1
  16. package/dist/entity-iteration.js.map +1 -1
  17. package/dist/generated/ifc2x3-typed-properties.d.ts +11 -0
  18. package/dist/generated/ifc2x3-typed-properties.d.ts.map +1 -0
  19. package/dist/generated/ifc2x3-typed-properties.js +49 -0
  20. package/dist/generated/ifc2x3-typed-properties.js.map +1 -0
  21. package/dist/georef-closure.d.ts +12 -0
  22. package/dist/georef-closure.d.ts.map +1 -1
  23. package/dist/georef-closure.js +3 -1
  24. package/dist/georef-closure.js.map +1 -1
  25. package/dist/ifc5-exporter.d.ts.map +1 -1
  26. package/dist/ifc5-exporter.js +3 -10
  27. package/dist/ifc5-exporter.js.map +1 -1
  28. package/dist/index.d.ts +4 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +4 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/merged-bake.d.ts +32 -0
  33. package/dist/merged-bake.d.ts.map +1 -0
  34. package/dist/merged-bake.js +120 -0
  35. package/dist/merged-bake.js.map +1 -0
  36. package/dist/merged-context.d.ts +49 -6
  37. package/dist/merged-context.d.ts.map +1 -1
  38. package/dist/merged-context.js +165 -53
  39. package/dist/merged-context.js.map +1 -1
  40. package/dist/merged-exporter.d.ts +7 -14
  41. package/dist/merged-exporter.d.ts.map +1 -1
  42. package/dist/merged-exporter.js +112 -178
  43. package/dist/merged-exporter.js.map +1 -1
  44. package/dist/merged-georef-normalize.d.ts +54 -0
  45. package/dist/merged-georef-normalize.d.ts.map +1 -0
  46. package/dist/merged-georef-normalize.js +260 -0
  47. package/dist/merged-georef-normalize.js.map +1 -0
  48. package/dist/merged-guid.d.ts +5 -7
  49. package/dist/merged-guid.d.ts.map +1 -1
  50. package/dist/merged-guid.js +37 -42
  51. package/dist/merged-guid.js.map +1 -1
  52. package/dist/merged-header.d.ts +6 -0
  53. package/dist/merged-header.d.ts.map +1 -1
  54. package/dist/merged-header.js +6 -0
  55. package/dist/merged-header.js.map +1 -1
  56. package/dist/merged-inverse-claims.d.ts.map +1 -1
  57. package/dist/merged-inverse-claims.js +3 -2
  58. package/dist/merged-inverse-claims.js.map +1 -1
  59. package/dist/merged-planner-guids.d.ts +1 -0
  60. package/dist/merged-planner-guids.d.ts.map +1 -1
  61. package/dist/merged-planner-guids.js +5 -6
  62. package/dist/merged-planner-guids.js.map +1 -1
  63. package/dist/merged-project-contexts.d.ts +12 -0
  64. package/dist/merged-project-contexts.d.ts.map +1 -0
  65. package/dist/merged-project-contexts.js +56 -0
  66. package/dist/merged-project-contexts.js.map +1 -0
  67. package/dist/merged-remap.d.ts +3 -1
  68. package/dist/merged-remap.d.ts.map +1 -1
  69. package/dist/merged-remap.js +15 -1
  70. package/dist/merged-remap.js.map +1 -1
  71. package/dist/merged-subcontext.d.ts +22 -0
  72. package/dist/merged-subcontext.d.ts.map +1 -1
  73. package/dist/merged-subcontext.js +14 -18
  74. package/dist/merged-subcontext.js.map +1 -1
  75. package/dist/schema-calendar-date-values.d.ts +15 -0
  76. package/dist/schema-calendar-date-values.d.ts.map +1 -0
  77. package/dist/schema-calendar-date-values.js +107 -0
  78. package/dist/schema-calendar-date-values.js.map +1 -0
  79. package/dist/schema-calendar-dates.d.ts +11 -0
  80. package/dist/schema-calendar-dates.d.ts.map +1 -0
  81. package/dist/schema-calendar-dates.js +127 -0
  82. package/dist/schema-calendar-dates.js.map +1 -0
  83. package/dist/schema-conversion-loss-description.d.ts +3 -0
  84. package/dist/schema-conversion-loss-description.d.ts.map +1 -0
  85. package/dist/schema-conversion-loss-description.js +23 -0
  86. package/dist/schema-conversion-loss-description.js.map +1 -0
  87. package/dist/schema-conversion-loss-report.d.ts +22 -19
  88. package/dist/schema-conversion-loss-report.d.ts.map +1 -1
  89. package/dist/schema-conversion-loss-report.js +223 -61
  90. package/dist/schema-conversion-loss-report.js.map +1 -1
  91. package/dist/schema-converter-attr-maps.d.ts +63 -0
  92. package/dist/schema-converter-attr-maps.d.ts.map +1 -0
  93. package/dist/schema-converter-attr-maps.js +186 -0
  94. package/dist/schema-converter-attr-maps.js.map +1 -0
  95. package/dist/schema-converter-attr-remap.d.ts +2 -2
  96. package/dist/schema-converter-attr-remap.d.ts.map +1 -1
  97. package/dist/schema-converter-attr-remap.js +9 -5
  98. package/dist/schema-converter-attr-remap.js.map +1 -1
  99. package/dist/schema-converter-document-links.d.ts +23 -0
  100. package/dist/schema-converter-document-links.d.ts.map +1 -0
  101. package/dist/schema-converter-document-links.js +146 -0
  102. package/dist/schema-converter-document-links.js.map +1 -0
  103. package/dist/schema-converter-durations.d.ts +9 -0
  104. package/dist/schema-converter-durations.d.ts.map +1 -0
  105. package/dist/schema-converter-durations.js +60 -0
  106. package/dist/schema-converter-durations.js.map +1 -0
  107. package/dist/schema-converter-enums.d.ts +18 -2
  108. package/dist/schema-converter-enums.d.ts.map +1 -1
  109. package/dist/schema-converter-enums.js +39 -6
  110. package/dist/schema-converter-enums.js.map +1 -1
  111. package/dist/schema-converter-ifc2x3-slots.d.ts +1 -1
  112. package/dist/schema-converter-ifc2x3-slots.d.ts.map +1 -1
  113. package/dist/schema-converter-ifc2x3-slots.js +6 -5
  114. package/dist/schema-converter-ifc2x3-slots.js.map +1 -1
  115. package/dist/schema-converter-ifc4-slots.d.ts +4 -3
  116. package/dist/schema-converter-ifc4-slots.d.ts.map +1 -1
  117. package/dist/schema-converter-ifc4-slots.js +4 -3
  118. package/dist/schema-converter-ifc4-slots.js.map +1 -1
  119. package/dist/schema-converter-ifc4x3-upgrade.d.ts +5 -0
  120. package/dist/schema-converter-ifc4x3-upgrade.d.ts.map +1 -0
  121. package/dist/schema-converter-ifc4x3-upgrade.js +41 -0
  122. package/dist/schema-converter-ifc4x3-upgrade.js.map +1 -0
  123. package/dist/schema-converter-material-referent.d.ts +55 -0
  124. package/dist/schema-converter-material-referent.d.ts.map +1 -0
  125. package/dist/schema-converter-material-referent.js +184 -0
  126. package/dist/schema-converter-material-referent.js.map +1 -0
  127. package/dist/schema-converter-owner-history.d.ts +1 -1
  128. package/dist/schema-converter-owner-history.d.ts.map +1 -1
  129. package/dist/schema-converter-owner-history.js +4 -3
  130. package/dist/schema-converter-owner-history.js.map +1 -1
  131. package/dist/schema-converter-product-proxy.d.ts +0 -23
  132. package/dist/schema-converter-product-proxy.d.ts.map +1 -1
  133. package/dist/schema-converter-product-proxy.js +2 -1
  134. package/dist/schema-converter-product-proxy.js.map +1 -1
  135. package/dist/schema-converter-renames.d.ts +17 -0
  136. package/dist/schema-converter-renames.d.ts.map +1 -1
  137. package/dist/schema-converter-renames.js +34 -2
  138. package/dist/schema-converter-renames.js.map +1 -1
  139. package/dist/schema-converter-retyped.d.ts +17 -0
  140. package/dist/schema-converter-retyped.d.ts.map +1 -0
  141. package/dist/schema-converter-retyped.js +68 -0
  142. package/dist/schema-converter-retyped.js.map +1 -0
  143. package/dist/schema-converter-step-finish.d.ts +4 -0
  144. package/dist/schema-converter-step-finish.d.ts.map +1 -0
  145. package/dist/schema-converter-step-finish.js +27 -0
  146. package/dist/schema-converter-step-finish.js.map +1 -0
  147. package/dist/schema-converter-structural-axes.d.ts +48 -4
  148. package/dist/schema-converter-structural-axes.d.ts.map +1 -1
  149. package/dist/schema-converter-structural-axes.js +350 -31
  150. package/dist/schema-converter-structural-axes.js.map +1 -1
  151. package/dist/schema-converter-structural-carriers.d.ts +78 -0
  152. package/dist/schema-converter-structural-carriers.d.ts.map +1 -0
  153. package/dist/schema-converter-structural-carriers.js +336 -0
  154. package/dist/schema-converter-structural-carriers.js.map +1 -0
  155. package/dist/schema-converter-structural-diagnostics.d.ts +56 -9
  156. package/dist/schema-converter-structural-diagnostics.d.ts.map +1 -1
  157. package/dist/schema-converter-structural-diagnostics.js +170 -17
  158. package/dist/schema-converter-structural-diagnostics.js.map +1 -1
  159. package/dist/schema-converter-structural-links.d.ts +2 -2
  160. package/dist/schema-converter-structural-links.d.ts.map +1 -1
  161. package/dist/schema-converter-structural-links.js +3 -28
  162. package/dist/schema-converter-structural-links.js.map +1 -1
  163. package/dist/schema-converter-structural-source.d.ts +83 -0
  164. package/dist/schema-converter-structural-source.d.ts.map +1 -0
  165. package/dist/schema-converter-structural-source.js +207 -0
  166. package/dist/schema-converter-structural-source.js.map +1 -0
  167. package/dist/schema-converter-structural-thickness.d.ts +33 -0
  168. package/dist/schema-converter-structural-thickness.d.ts.map +1 -0
  169. package/dist/schema-converter-structural-thickness.js +155 -0
  170. package/dist/schema-converter-structural-thickness.js.map +1 -0
  171. package/dist/schema-converter-structural-varying.d.ts +21 -9
  172. package/dist/schema-converter-structural-varying.d.ts.map +1 -1
  173. package/dist/schema-converter-structural-varying.js +83 -54
  174. package/dist/schema-converter-structural-varying.js.map +1 -1
  175. package/dist/schema-converter-structural.d.ts +2 -2
  176. package/dist/schema-converter-structural.d.ts.map +1 -1
  177. package/dist/schema-converter-structural.js +9 -6
  178. package/dist/schema-converter-structural.js.map +1 -1
  179. package/dist/schema-converter-typed-properties.d.ts +30 -0
  180. package/dist/schema-converter-typed-properties.d.ts.map +1 -0
  181. package/dist/schema-converter-typed-properties.js +173 -0
  182. package/dist/schema-converter-typed-properties.js.map +1 -0
  183. package/dist/schema-converter-unrooted-upgrade.d.ts +14 -0
  184. package/dist/schema-converter-unrooted-upgrade.d.ts.map +1 -0
  185. package/dist/schema-converter-unrooted-upgrade.js +228 -0
  186. package/dist/schema-converter-unrooted-upgrade.js.map +1 -0
  187. package/dist/schema-converter-userdefined-label.d.ts +8 -0
  188. package/dist/schema-converter-userdefined-label.d.ts.map +1 -0
  189. package/dist/schema-converter-userdefined-label.js +61 -0
  190. package/dist/schema-converter-userdefined-label.js.map +1 -0
  191. package/dist/schema-converter-userdefined.d.ts +15 -0
  192. package/dist/schema-converter-userdefined.d.ts.map +1 -0
  193. package/dist/schema-converter-userdefined.js +59 -0
  194. package/dist/schema-converter-userdefined.js.map +1 -0
  195. package/dist/schema-converter-value-forms.d.ts +20 -0
  196. package/dist/schema-converter-value-forms.d.ts.map +1 -0
  197. package/dist/schema-converter-value-forms.js +225 -0
  198. package/dist/schema-converter-value-forms.js.map +1 -0
  199. package/dist/schema-converter.d.ts +10 -15
  200. package/dist/schema-converter.d.ts.map +1 -1
  201. package/dist/schema-converter.js +87 -83
  202. package/dist/schema-converter.js.map +1 -1
  203. package/dist/schema-enum-policy.d.ts +5 -1
  204. package/dist/schema-enum-policy.d.ts.map +1 -1
  205. package/dist/schema-enum-policy.js +21 -1
  206. package/dist/schema-enum-policy.js.map +1 -1
  207. package/dist/schema-ifc2x3-placements.d.ts.map +1 -1
  208. package/dist/schema-ifc2x3-placements.js +20 -31
  209. package/dist/schema-ifc2x3-placements.js.map +1 -1
  210. package/dist/schema-ifc2x3-records.d.ts.map +1 -1
  211. package/dist/schema-ifc2x3-records.js +3 -2
  212. package/dist/schema-ifc2x3-records.js.map +1 -1
  213. package/dist/schema-ifc2x3-style-assignments.d.ts +4 -0
  214. package/dist/schema-ifc2x3-style-assignments.d.ts.map +1 -0
  215. package/dist/schema-ifc2x3-style-assignments.js +33 -0
  216. package/dist/schema-ifc2x3-style-assignments.js.map +1 -0
  217. package/dist/schema-structural-varying-effective.d.ts +2 -0
  218. package/dist/schema-structural-varying-effective.d.ts.map +1 -0
  219. package/dist/schema-structural-varying-effective.js +95 -0
  220. package/dist/schema-structural-varying-effective.js.map +1 -0
  221. package/dist/schema-untranslatable.d.ts +22 -13
  222. package/dist/schema-untranslatable.d.ts.map +1 -1
  223. package/dist/schema-untranslatable.js +84 -6
  224. package/dist/schema-untranslatable.js.map +1 -1
  225. package/dist/schema-value-form-policy.d.ts +129 -0
  226. package/dist/schema-value-form-policy.d.ts.map +1 -0
  227. package/dist/schema-value-form-policy.js +255 -0
  228. package/dist/schema-value-form-policy.js.map +1 -0
  229. package/dist/step-argument-parser.d.ts +3 -3
  230. package/dist/step-argument-parser.d.ts.map +1 -1
  231. package/dist/step-argument-parser.js +6 -6
  232. package/dist/step-argument-parser.js.map +1 -1
  233. package/dist/step-collection.d.ts.map +1 -1
  234. package/dist/step-collection.js +2 -0
  235. package/dist/step-collection.js.map +1 -1
  236. package/dist/step-comment-skip.d.ts +8 -0
  237. package/dist/step-comment-skip.d.ts.map +1 -1
  238. package/dist/step-comment-skip.js +30 -0
  239. package/dist/step-comment-skip.js.map +1 -1
  240. package/dist/step-coordinate-options.d.ts +15 -0
  241. package/dist/step-coordinate-options.d.ts.map +1 -1
  242. package/dist/step-coordinate-options.js +13 -1
  243. package/dist/step-coordinate-options.js.map +1 -1
  244. package/dist/step-export-types.d.ts +5 -7
  245. package/dist/step-export-types.d.ts.map +1 -1
  246. package/dist/step-export-types.js.map +1 -1
  247. package/dist/step-exporter.d.ts +0 -6
  248. package/dist/step-exporter.d.ts.map +1 -1
  249. package/dist/step-exporter.js +19 -12
  250. package/dist/step-exporter.js.map +1 -1
  251. package/dist/step-georeferencing.d.ts +2 -0
  252. package/dist/step-georeferencing.d.ts.map +1 -1
  253. package/dist/step-georeferencing.js +126 -63
  254. package/dist/step-georeferencing.js.map +1 -1
  255. package/dist/step-header.d.ts.map +1 -1
  256. package/dist/step-header.js +1 -0
  257. package/dist/step-header.js.map +1 -1
  258. package/dist/step-internal-pset-ids.js +1 -1
  259. package/dist/step-internal-pset-ids.js.map +1 -1
  260. package/dist/step-map-unit-normalization.d.ts.map +1 -1
  261. package/dist/step-map-unit-normalization.js +5 -4
  262. package/dist/step-map-unit-normalization.js.map +1 -1
  263. package/dist/step-map-unit.d.ts +8 -1
  264. package/dist/step-map-unit.d.ts.map +1 -1
  265. package/dist/step-map-unit.js +13 -5
  266. package/dist/step-map-unit.js.map +1 -1
  267. package/dist/step-omission-predicates.d.ts.map +1 -1
  268. package/dist/step-omission-predicates.js +1 -0
  269. package/dist/step-omission-predicates.js.map +1 -1
  270. package/dist/step-overlay-entities.d.ts +0 -35
  271. package/dist/step-overlay-entities.d.ts.map +1 -1
  272. package/dist/step-overlay-entities.js +38 -2
  273. package/dist/step-overlay-entities.js.map +1 -1
  274. package/dist/step-pass-builder.d.ts.map +1 -1
  275. package/dist/step-pass-builder.js +59 -7
  276. package/dist/step-pass-builder.js.map +1 -1
  277. package/dist/step-record-frame.d.ts +5 -3
  278. package/dist/step-record-frame.d.ts.map +1 -1
  279. package/dist/step-record-frame.js +12 -8
  280. package/dist/step-record-frame.js.map +1 -1
  281. package/dist/step-ref-scan.d.ts +12 -0
  282. package/dist/step-ref-scan.d.ts.map +1 -1
  283. package/dist/step-ref-scan.js +24 -3
  284. package/dist/step-ref-scan.js.map +1 -1
  285. package/dist/step-serialization.d.ts +12 -0
  286. package/dist/step-serialization.d.ts.map +1 -1
  287. package/dist/step-serialization.js +15 -0
  288. package/dist/step-serialization.js.map +1 -1
  289. package/dist/step-slot-grammar.d.ts +3 -2
  290. package/dist/step-slot-grammar.d.ts.map +1 -1
  291. package/dist/step-slot-grammar.js +5 -5
  292. package/dist/step-slot-grammar.js.map +1 -1
  293. package/dist/step-source-iteration.d.ts.map +1 -1
  294. package/dist/step-source-iteration.js +6 -9
  295. package/dist/step-source-iteration.js.map +1 -1
  296. package/dist/unit-normalize.d.ts +2 -2
  297. package/dist/unit-normalize.d.ts.map +1 -1
  298. package/dist/unit-normalize.js +23 -13
  299. package/dist/unit-normalize.js.map +1 -1
  300. package/dist/viewer-georef-scale.d.ts +14 -0
  301. package/dist/viewer-georef-scale.d.ts.map +1 -0
  302. package/dist/viewer-georef-scale.js +20 -0
  303. package/dist/viewer-georef-scale.js.map +1 -0
  304. package/package.json +41 -8
@@ -0,0 +1,207 @@
1
+ /* SPDX-License-Identifier: MPL-2.0 */
2
+ /**
3
+ * What the structural conversion prepasses (#9668) share: the schema pair they
4
+ * run for, memoized reads of source records, subtype tests, and the property-set
5
+ * carrier some of them write into the target file and read back from the source.
6
+ */
7
+ import { stepStringLiteralEnd } from '@ifc-lite/encoding';
8
+ import { deterministicGlobalId, getCanonicalEntityName, getSchemaRegistryForVersion } from '@ifc-lite/parser';
9
+ import { listItems } from './schema-converter-structural-axes.js';
10
+ import { decodeRange } from './source-ref-bounds.js';
11
+ import { readStepSlots } from './step-argument-parser.js';
12
+ import { stepRecordHead } from './step-record-frame.js';
13
+ import { parseStepNumber, skipStepTrivia } from './step-slot-grammar.js';
14
+ import { namedExpressIds, referencesAnyExpressId } from './step-ref-scan.js';
15
+ /** IFC2X3 -> IFC4 is an upgrade, IFC4 -> IFC2X3 a downgrade; the prepasses run for nothing else. */
16
+ export const conversionMode = (from, to) => from === 'IFC2X3' && to === 'IFC4' ? 'upgrade' : from === 'IFC4' && to === 'IFC2X3' ? 'downgrade' : null;
17
+ /** Whether any of `args` names an id this export withholds. */
18
+ export const namesWithheld = (args, withheld) => !!withheld?.size && !!args?.some((a) => referencesAnyExpressId(a, withheld));
19
+ const SUBTYPES = new Map();
20
+ /** Whether `keyword` names a subtype of `parent` in `schema`, memoized per triple. */
21
+ export function isSubtype(schema, keyword, parent) {
22
+ if (!keyword)
23
+ return false;
24
+ const key = `${schema} ${keyword} ${parent}`;
25
+ let known = SUBTYPES.get(key);
26
+ if (known === undefined) {
27
+ const registry = getSchemaRegistryForVersion(schema);
28
+ const name = getCanonicalEntityName(registry, keyword);
29
+ known = !!name && registry.entities[name]?.inheritanceChain?.includes(parent) === true;
30
+ SUBTYPES.set(key, known);
31
+ }
32
+ return known;
33
+ }
34
+ /** Source records read by id, each decoded once. Lives only for one prepass. */
35
+ export class SourceRecords {
36
+ store;
37
+ keptIdsByType = new Map();
38
+ cache = new Map();
39
+ constructor(store) {
40
+ this.store = store;
41
+ }
42
+ hasIndexedRecords() {
43
+ // @raw-entity-enumeration-ok distinguish a parsed source index from type-only preview input
44
+ return this.store.entityIndex.byId.size > 0 || (this.store.deferredEntityIndex?.size ?? 0) > 0;
45
+ }
46
+ decode(entry) {
47
+ return decodeRange(this.store.source, entry.byteOffset, entry.byteOffset + entry.byteLength);
48
+ }
49
+ /**
50
+ * How many source records name each of `targets`, outside strings and
51
+ * comments. Reads every record, so callers ask only when they have targets.
52
+ */
53
+ referrers(targets) {
54
+ const uses = new Map();
55
+ for (const { named } of this.naming(targets))
56
+ for (const t of named)
57
+ uses.set(t, (uses.get(t) ?? 0) + 1);
58
+ return uses;
59
+ }
60
+ /**
61
+ * Each source record naming any of `targets` outside strings and comments,
62
+ * and which ones. Reads every record and caches nothing, so callers ask only
63
+ * when they have targets.
64
+ */
65
+ *naming(targets) {
66
+ if (targets.size === 0)
67
+ return;
68
+ for (const { id, text } of this.texts()) {
69
+ const head = stepRecordHead(text);
70
+ const named = namedExpressIds(text.slice(head?.open ?? skipStepTrivia(text, 0) + 1), targets);
71
+ if (named.size)
72
+ yield { id, named };
73
+ }
74
+ }
75
+ /** The kept source records, including deferred atoms, without caching their text. */
76
+ *texts() {
77
+ const deferred = this.store.deferredEntityIndex;
78
+ // @raw-entity-enumeration-ok same unedited source-only prepass
79
+ const primary = this.store.entityIndex.byId;
80
+ for (const index of deferred ? [primary, deferred] : [primary]) {
81
+ for (const [id, entry] of index) {
82
+ if (deferred && this.entry(id) !== entry)
83
+ continue;
84
+ yield { id, text: this.decode(entry) };
85
+ }
86
+ }
87
+ }
88
+ /** A repeated id belongs to its last record, at that record's position. */
89
+ ids(type) {
90
+ const cached = this.keptIdsByType.get(type);
91
+ if (cached)
92
+ return cached;
93
+ // @raw-entity-enumeration-ok conversion prepass is enabled only for an unedited full-source export (step-pass-builder.ts)
94
+ const ids = this.store.entityIndex.byType.get(type) ?? [];
95
+ const last = new Map();
96
+ ids.forEach((id, i) => last.set(id, i));
97
+ const kept = ids.filter((id, i) => last.get(id) === i && this.type(id) === type);
98
+ this.keptIdsByType.set(type, kept);
99
+ return kept;
100
+ }
101
+ entry(id) {
102
+ // @raw-entity-enumeration-ok same unedited source-only prepass
103
+ const primary = this.store.entityIndex.byId.get(id);
104
+ const deferred = this.store.deferredEntityIndex?.get(id);
105
+ return deferred && (!primary || deferred.byteOffset > primary.byteOffset) ? deferred : primary;
106
+ }
107
+ type(id) {
108
+ return id === null ? undefined : this.entry(id)?.type.toUpperCase();
109
+ }
110
+ /** The record's source text, as written. */
111
+ text(id) {
112
+ const entry = this.entry(id);
113
+ return entry ? this.decode(entry) : undefined;
114
+ }
115
+ slots(id) {
116
+ if (id === null)
117
+ return undefined;
118
+ if (!this.cache.has(id)) {
119
+ const entry = this.entry(id);
120
+ this.cache.set(id, entry ? readStepSlots(this.decode(entry))?.slots : undefined);
121
+ }
122
+ return this.cache.get(id);
123
+ }
124
+ }
125
+ /** An entity reference slot, with STEP whitespace and comments around it allowed (#10248). */
126
+ export function slotRef(token) {
127
+ const text = token ?? '';
128
+ const start = skipStepTrivia(text, 0);
129
+ const m = start < 0 ? null : /^#\s*(\d+)/.exec(text.slice(start));
130
+ return m && skipStepTrivia(text, start + m[0].length) === text.length ? Number(m[1]) : null;
131
+ }
132
+ /** Whether the slot is the unset marker `$`, with STEP whitespace and comments around it allowed (#10248). */
133
+ export function slotUnset(token) {
134
+ const text = token ?? '';
135
+ const start = skipStepTrivia(text, 0);
136
+ return start >= 0 && text[start] === '$' && skipStepTrivia(text, start + 1) === text.length;
137
+ }
138
+ /** The bare number of `token`, given as such or wrapped as `TYPE(n)`, or null when it is not a finite number. */
139
+ export function bareMeasure(token, type) {
140
+ const wrapped = new RegExp(`^\\s*${type}\\s*\\((.*)\\)\\s*$`, 'i').exec(token ?? '')?.[1];
141
+ const bare = (wrapped ?? token ?? '').trim();
142
+ return Number.isFinite(parseStepNumber(bare)) ? bare : null;
143
+ }
144
+ /** The text of a STEP string token, or null. Only compared with fixed names here, so escapes need no decoding. */
145
+ export function stepString(token) {
146
+ // STEP whitespace and comments may sit around the string (#10248), never inside the quotes.
147
+ const text = token ?? '';
148
+ const start = skipStepTrivia(text, 0);
149
+ if (start < 0 || text[start] !== "'")
150
+ return null;
151
+ const end = stepStringLiteralEnd(text, start);
152
+ return end > start && skipStepTrivia(text, end) === text.length ? text.slice(start + 1, end - 1) : null;
153
+ }
154
+ /** Every property set named `name` in the source, with what it relates to; `exclusive`, which reads every record, only with `checkExclusive`. */
155
+ export function readCarrierSets(source, name, checkExclusive = true) {
156
+ const rels = source.ids('IFCRELDEFINESBYPROPERTIES');
157
+ const candidates = rels.filter((rel) => {
158
+ const pset = slotRef(source.slots(rel)?.[5]);
159
+ return source.type(pset) === 'IFCPROPERTYSET' && stepString(source.slots(pset)?.[2]) === name;
160
+ });
161
+ if (!candidates.length)
162
+ return [];
163
+ const members = candidates.map((rel) => {
164
+ const pset = slotRef(source.slots(rel)[5]);
165
+ return { rel, pset, propIds: (listItems(source.slots(pset)?.[4] ?? '') ?? []).map(slotRef) };
166
+ });
167
+ // A carrier is exclusive when its relationship is the only record naming its set, and its set the only one naming each property.
168
+ const uses = checkExclusive ? source.referrers(new Set(members.flatMap(({ pset, propIds }) => [pset, ...propIds.filter((p) => p !== null)]))) : undefined;
169
+ return members.map(({ rel, pset, propIds }) => {
170
+ // IfcPropertySet names its properties uniquely (IFC4 UniquePropertyNames, IFC2X3 WR32). A set that does
171
+ // not, that lists a property it cannot read, or whose relationship lists a non-reference, still counts as
172
+ // present for the objects it does name (for ambiguity checks) but gives no property and is never consumed.
173
+ const listed = listItems(source.slots(rel)?.[4] ?? '')?.map(slotRef) ?? [];
174
+ const related = listed.filter((r) => r !== null);
175
+ const props = new Map();
176
+ if (related.length === listed.length) {
177
+ for (const p of propIds) {
178
+ const propName = stepString(source.slots(p)?.[0]);
179
+ if (p === null || propName === null || props.has(propName)) {
180
+ props.clear();
181
+ break;
182
+ }
183
+ props.set(propName, p);
184
+ }
185
+ }
186
+ const exclusive = uses ? uses.get(pset) === 1 && propIds.every((p) => p !== null && uses.get(p) === 1) : undefined;
187
+ return { rel, pset, related, props, exclusive };
188
+ });
189
+ }
190
+ /**
191
+ * The records of a property set named `name` holding `properties` (STEP bodies
192
+ * such as `IFCPROPERTYSINGLEVALUE(...)`) and relating it to `object`, with
193
+ * GlobalIds derived from `seed`. `ids` numbers them in the target file.
194
+ */
195
+ export function writeCarrierSet(ids, seed, ownerHistory, name, object, properties) {
196
+ const lines = [];
197
+ const propIds = properties.map((body) => {
198
+ const id = ids();
199
+ lines.push(`#${id}=${body};`);
200
+ return `#${id}`;
201
+ });
202
+ const pset = ids();
203
+ lines.push(`#${pset}=IFCPROPERTYSET('${deterministicGlobalId(`${seed}:pset`)}',${ownerHistory},'${name}',$,(${propIds.join(',')}));`);
204
+ lines.push(`#${ids()}=IFCRELDEFINESBYPROPERTIES('${deterministicGlobalId(`${seed}:rel`)}',${ownerHistory},$,$,(#${object}),#${pset});`);
205
+ return lines;
206
+ }
207
+ //# sourceMappingURL=schema-converter-structural-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-converter-structural-source.js","sourceRoot":"","sources":["../src/schema-converter-structural-source.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,EAAqB,MAAM,kBAAkB,CAAC;AACjI,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,C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ite } from './schema-converter-structural-source.js';
2
+ export declare const THICKNESS_WRITTEN = "IFC2X3 SubsequentThickness is held in IFC4 as Pset_StructuralSurfaceMemberVaryingThickness Thickness1 to Thickness3";
3
+ export declare class StructuralThickness {
4
+ /** The exporter's express-id allocator, shared with every other record it appends. */
5
+ ids: (() => number) | null;
6
+ private readonly pending;
7
+ private mode;
8
+ /** IfcProductDefinitionShape id -> the IfcShapeAspects naming it. */
9
+ private readonly aspects;
10
+ /** Aspects IFC2X3 admits as VaryingThicknessLocation: each representation one point (WR62, WR63); both directions require it. */
11
+ private readonly pointAspects;
12
+ /** Member id -> its three thicknesses from a source property set, or [] when it has more than one set. */
13
+ private readonly psets;
14
+ /** Members whose property set gives LocationNLocal/LocationNGlobal, which the aspect order cannot be checked against. */
15
+ private readonly located;
16
+ fromStore(source: SourceRecords, from: string, to: string): void;
17
+ /** The one aspect of a representation slot, or null. */
18
+ private aspectOf;
19
+ /**
20
+ * IFC2X3 -> IFC4: the attributes of a varying member IFC4 holds elsewhere:
21
+ * SubsequentThickness and VaryingThicknessLocation, in a matching property
22
+ * set the member has or one this adds, when the location is the
23
+ * representation's one point aspect (WR62, WR63). None otherwise.
24
+ */
25
+ note(id: number, entity: string, args: readonly string[], withheld: ReadonlySet<number> | undefined): readonly string[];
26
+ /** IFC4 -> IFC2X3: why a member the generic path writes has no IFC2X3 thicknesses (`rewrite` leaves located members to it), or undefined. */
27
+ notice(id: number, entity: string, args: readonly string[]): string | undefined;
28
+ /** IFC4 -> IFC2X3: the IFC2X3 member body from its property set and its one aspect, or undefined. */
29
+ rewrite(id: number, entity: string, args: readonly string[]): StructuralRewrite | undefined;
30
+ /** Records written so far, to append after the source records. */
31
+ added(): string[];
32
+ }
33
+ //# sourceMappingURL=schema-converter-structural-thickness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-converter-structural-thickness.d.ts","sourceRoot":"","sources":["../src/schema-converter-structural-thickness.ts"],"names":[],"mappings":"AAqBA,OAAO,EA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+ /**
3
+ * Varying surface member thickness IFC2X3 <-> IFC4 (#9668). IFC4 deleted
4
+ * IfcStructuralSurfaceMemberVarying.SubsequentThickness and
5
+ * VaryingThicknessLocation and gives the thicknesses by
6
+ * Pset_StructuralSurfaceMemberVaryingThickness (IFC4 IfcStructuralSurfaceMemberVarying:
7
+ * "properties are provided by means of Pset_StructuralSurfaceMemberVaryingThickness"),
8
+ * which holds three: Thickness1 to Thickness3.
9
+ *
10
+ * The upgrade writes an IFC2X3 member with three thicknesses (Thickness and two
11
+ * subsequent ones) as that property set when its location aspect is the one
12
+ * point aspect of the member's representation (WR62, WR63), which is where the
13
+ * downgrade takes it back; otherwise both are reported lost. A matching
14
+ * property set the member already has counts the same way. The property set is
15
+ * valid IFC2X3 too and is kept; a member that has one is not given a second.
16
+ * The downgrade reads a native IFC4 member the same way: its property set and
17
+ * the one point aspect of its representation, the only candidate location.
18
+ *
19
+ * Reads the source store, so only an unedited full export arms it.
20
+ */
21
+ import { listItems } from './schema-converter-structural-axes.js';
22
+ import { bareMeasure, conversionMode, readCarrierSets, slotRef, slotUnset, writeCarrierSet } from './schema-converter-structural-source.js';
23
+ import { parseStepNumber } from './step-slot-grammar.js';
24
+ const THICKNESS_PSET = 'Pset_StructuralSurfaceMemberVaryingThickness';
25
+ const ENTITY = 'IFCSTRUCTURALSURFACEMEMBERVARYING';
26
+ const NAMES = ['Thickness1', 'Thickness2', 'Thickness3'];
27
+ const THICKNESS_LOCATED = `${THICKNESS_PSET} gives Location properties, which cannot be checked against the IfcShapeAspect order; IFC2X3 SubsequentThickness and VaryingThicknessLocation are not written`;
28
+ export const THICKNESS_WRITTEN = `IFC2X3 SubsequentThickness is held in IFC4 as ${THICKNESS_PSET} Thickness1 to Thickness3`;
29
+ const THICKNESS_READ = `${THICKNESS_PSET} Thickness1 to Thickness3 are written as the IFC2X3 Thickness and SubsequentThickness, located by the one IfcShapeAspect of the member's representation`;
30
+ /** Whether a property record is a single or list value with no value: `$` or `()`. Anything else, or unreadable, counts as a value. */
31
+ function emptyValue(type, args) {
32
+ if (!args || (type !== 'IFCPROPERTYSINGLEVALUE' && type !== 'IFCPROPERTYLISTVALUE'))
33
+ return false;
34
+ const value = args[2] ?? '';
35
+ // listItems skips STEP trivia and returns null for anything that is not a readable list.
36
+ return slotUnset(value) || listItems(value)?.length === 0;
37
+ }
38
+ /** The bare number of a thickness token, `0.2` or `IFCPOSITIVELENGTHMEASURE(0.2)`, or null unless positive. */
39
+ function thickness(token) {
40
+ const bare = bareMeasure(token, 'IFCPOSITIVELENGTHMEASURE');
41
+ return bare !== null && parseStepNumber(bare) > 0 ? bare : null;
42
+ }
43
+ export class StructuralThickness {
44
+ /** The exporter's express-id allocator, shared with every other record it appends. */
45
+ ids = null;
46
+ pending = [];
47
+ mode = null;
48
+ /** IfcProductDefinitionShape id -> the IfcShapeAspects naming it. */
49
+ aspects = new Map();
50
+ /** Aspects IFC2X3 admits as VaryingThicknessLocation: each representation one point (WR62, WR63); both directions require it. */
51
+ pointAspects = new Set();
52
+ /** Member id -> its three thicknesses from a source property set, or [] when it has more than one set. */
53
+ psets = new Map();
54
+ /** Members whose property set gives LocationNLocal/LocationNGlobal, which the aspect order cannot be checked against. */
55
+ located = new Set();
56
+ fromStore(source, from, to) {
57
+ const mode = conversionMode(from, to);
58
+ if (!mode || !source.ids(ENTITY).length)
59
+ return;
60
+ this.mode = mode;
61
+ // Only the aspects of a varying member's representation are ever asked for.
62
+ const shapes = new Set(source.ids(ENTITY).map((m) => slotRef(source.slots(m)?.[6])));
63
+ for (const id of source.ids('IFCSHAPEASPECT')) {
64
+ const shape = slotRef(source.slots(id)?.[4]);
65
+ if (shape === null || !shapes.has(shape))
66
+ continue;
67
+ const list = this.aspects.get(shape) ?? [];
68
+ list.push(id);
69
+ this.aspects.set(shape, list);
70
+ const representations = (listItems(source.slots(id)?.[0] ?? '') ?? []).map(slotRef);
71
+ if (representations.length && representations.every((r) => {
72
+ const items = (listItems(source.slots(r)?.[3] ?? '') ?? []).map(slotRef);
73
+ return items.length === 1 && ['IFCCARTESIANPOINT', 'IFCPOINTONSURFACE'].includes(source.type(items[0]) ?? '');
74
+ }))
75
+ this.pointAspects.add(id);
76
+ }
77
+ for (const set of readCarrierSets(source, THICKNESS_PSET, false)) {
78
+ const values = NAMES.map((name) => {
79
+ const prop = set.props.get(name);
80
+ const args = source.type(prop ?? null) === 'IFCPROPERTYSINGLEVALUE' ? source.slots(prop) : undefined;
81
+ // A value in its own unit would need converting; only one in the project's length unit is read.
82
+ return args && slotUnset(args[3] ?? '$') ? thickness(args[2]) : null;
83
+ });
84
+ // A location property counts unless it is a single or list value that is plainly empty.
85
+ const givesLocations = [...set.props].some(([name, prop]) => /^Location[123](?:Local|Global)$/.test(name) && !emptyValue(source.type(prop), source.slots(prop)));
86
+ for (const member of set.related) {
87
+ if (source.type(member) !== ENTITY)
88
+ continue;
89
+ if (givesLocations)
90
+ this.located.add(member);
91
+ // A member with two such property sets keeps neither reading.
92
+ this.psets.set(member, this.psets.has(member) || values.includes(null) ? [] : values);
93
+ }
94
+ }
95
+ }
96
+ /** The one aspect of a representation slot, or null. */
97
+ aspectOf(representation) {
98
+ const found = this.aspects.get(slotRef(representation) ?? -1);
99
+ return found?.length === 1 ? found[0] : null;
100
+ }
101
+ /**
102
+ * IFC2X3 -> IFC4: the attributes of a varying member IFC4 holds elsewhere:
103
+ * SubsequentThickness and VaryingThicknessLocation, in a matching property
104
+ * set the member has or one this adds, when the location is the
105
+ * representation's one point aspect (WR62, WR63). None otherwise.
106
+ */
107
+ note(id, entity, args, withheld) {
108
+ // The added property set names only the member; an IFC4 target withholds none, so none is checked.
109
+ if (this.mode !== 'upgrade' || entity !== ENTITY || !this.ids || withheld?.size || args.length !== 11)
110
+ return [];
111
+ const values = [args[8], ...listItems(args[9]) ?? []].map(thickness);
112
+ if (values.length !== 3 || values.includes(null))
113
+ return [];
114
+ // Held only where the location comes back too, so the round trip is exact.
115
+ const location = slotRef(args[10]);
116
+ if (location === null || this.aspectOf(args[6]) !== location || !this.pointAspects.has(location))
117
+ return [];
118
+ // A set giving locations is not read back by the downgrade, so it does not hold them.
119
+ if (this.located.has(id))
120
+ return [];
121
+ const existing = this.psets.get(id);
122
+ if (existing) {
123
+ // A property set the member already has holds the thicknesses only when its values are these.
124
+ if (existing.length !== 3 || existing.some((v, i) => parseStepNumber(v) !== parseStepNumber(values[i])))
125
+ return [];
126
+ }
127
+ else {
128
+ const properties = values.map((v, i) => `IFCPROPERTYSINGLEVALUE('${NAMES[i]}',$,IFCPOSITIVELENGTHMEASURE(${v}),$)`);
129
+ this.pending.push(...writeCarrierSet(this.ids, `ifc2x3-thickness:${args[0].trim()}`, args[1], THICKNESS_PSET, id, properties));
130
+ }
131
+ return ['SubsequentThickness', 'VaryingThicknessLocation'];
132
+ }
133
+ /** IFC4 -> IFC2X3: why a member the generic path writes has no IFC2X3 thicknesses (`rewrite` leaves located members to it), or undefined. */
134
+ notice(id, entity, args) {
135
+ return this.mode === 'downgrade' && entity === ENTITY && args.length === 9 && this.located.has(id) ? THICKNESS_LOCATED : undefined;
136
+ }
137
+ /** IFC4 -> IFC2X3: the IFC2X3 member body from its property set and its one aspect, or undefined. */
138
+ rewrite(id, entity, args) {
139
+ if (this.mode !== 'downgrade' || entity !== ENTITY || args.length !== 9 || this.located.has(id))
140
+ return undefined;
141
+ const [first, ...rest] = this.psets.get(id) ?? [];
142
+ const aspect = this.aspectOf(args[6]);
143
+ if (first === undefined || aspect === null || !this.pointAspects.has(aspect))
144
+ return undefined;
145
+ // IFC2X3's VaryingThickness starts with Thickness (WR61 requires it).
146
+ const own = thickness(args[8]);
147
+ if (own !== null && parseStepNumber(own) !== parseStepNumber(first))
148
+ return undefined;
149
+ const values = [...args.slice(0, 8), own === null ? first : args[8], `(${rest.join(',')})`, `#${aspect}`];
150
+ return { body: `${ENTITY}(${values.join(',')})`, losses: [THICKNESS_READ] };
151
+ }
152
+ /** Records written so far, to append after the source records. */
153
+ added() { return this.pending.splice(0); }
154
+ }
155
+ //# sourceMappingURL=schema-converter-structural-thickness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-converter-structural-thickness.js","sourceRoot":"","sources":["../src/schema-converter-structural-thickness.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAiB,eAAe,EAA+C,MAAM,yCAAyC,CAAC;AACxM,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,cAAc,GAAG,8CAA8C,CAAC;AACtE,MAAM,MAAM,GAAG,mCAAmC,CAAC;AACnD,MAAM,KAAK,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AACzD,MAAM,iBAAiB,GAAG,GAAG,cAAc,+JAA+J,CAAC;AAC3M,MAAM,CAAC,MAAM,iBAAiB,GAAG,iDAAiD,cAAc,2BAA2B,CAAC;AAC5H,MAAM,cAAc,GAAG,GAAG,cAAc,yJAAyJ,CAAC;AAElM,uIAAuI;AACvI,SAAS,UAAU,CAAC,IAAwB,EAAE,IAAmC;IAC/E,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,wBAAwB,IAAI,IAAI,KAAK,sBAAsB,CAAC;QAAE,OAAO,KAAK,CAAC;IAClG,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5B,yFAAyF;IACzF,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,+GAA+G;AAC/G,SAAS,SAAS,CAAC,KAAyB;IAC1C,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC;IAC5D,OAAO,IAAI,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AAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,SAAS,CAAC;QAC/F,sEAAsE;QACtE,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,GAAG,KAAK,IAAI,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACtF,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;QAC1G,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC;IAC9E,CAAC;IAED,kEAAkE;IAClE,KAAK,KAAe,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrD"}
@@ -1,9 +1,8 @@
1
- /** Matches rust/export/src/schema_structural_varying.rs (#9668). */
2
- import type { IfcDataStore } from '@ifc-lite/parser';
3
- export interface Rewrite {
4
- readonly body: string;
5
- readonly losses: readonly string[];
6
- }
1
+ import type { SourceRecords, StructuralRewrite } from './schema-converter-structural-source.js';
2
+ /** Why the downgrade refuses a file: a record it does not convert names a configuration it converts, or a record it passes through as it is names any configuration. */
3
+ export declare const SHARED_CONFIGURATION = "IFCSTRUCTURALLOADCONFIGURATION shared with a non-converted referrer has no representation in IFC2X3";
4
+ /** The IFC4 action an IFC2X3 varying action converts to. */
5
+ export declare const varyingTarget: (ifc2x3: string) => string | undefined;
7
6
  /**
8
7
  * Converts varying actions in both directions, and only those that convert
9
8
  * back: one test (`convertible`) decides both, so a configuration this writes
@@ -16,19 +15,23 @@ export declare class StructuralVarying {
16
15
  ids: (() => number) | null;
17
16
  private readonly pending;
18
17
  private mode;
19
- private byId;
18
+ private effectiveTypes;
19
+ private source?;
20
20
  /** IFC4 IfcStructuralLoadConfiguration id -> its values. */
21
21
  private readonly configs;
22
22
  /** IfcProductDefinitionShape id -> the IfcShapeAspects naming it as PartOfProductDefinitionShape. */
23
23
  private readonly aspects;
24
- fromStore(store: IfcDataStore, from: string, to: string): void;
24
+ fromSource(source: SourceRecords, from: string, to: string): void;
25
+ /** Prepare the same upgrade using the records a filtered or edited export actually writes. */
26
+ fromEffective(types: ReadonlyMap<number, string>, aspects: readonly number[], slots: (id: number) => readonly string[] | undefined): void;
27
+ private readAspects;
25
28
  /** Rust scan_ifc4 keeps configurations referenced by any record that is not converted.
26
29
  * They have no IFC2X3 form, so refuse the export instead of silently proxying a referrer.
27
30
  */
28
31
  private checkSharedConfigurations;
29
32
  private typeOf;
30
33
  /** The target record body for a varying action of either schema, or undefined. */
31
- rewrite(entity: string, args: readonly string[]): Rewrite | undefined;
34
+ rewrite(id: number, entity: string, args: readonly string[], carried: ReadonlySet<string>): StructuralRewrite | undefined;
32
35
  /** IfcStructuralLoadConfiguration records written so far, to append after the source records. */
33
36
  added(): string[];
34
37
  /**
@@ -37,6 +40,15 @@ export declare class StructuralVarying {
37
40
  * enough loads, all of one type that the IFC2X3 WR61 admits.
38
41
  */
39
42
  private convertible;
43
+ /**
44
+ * IFC2X3 -> IFC4, when this prepass is armed: whether this IFC2X3 varying
45
+ * action stays unconverted (no IFC4 entity holds it then). False when unarmed.
46
+ */
47
+ staysUnconverted(entity: string, args: readonly string[]): boolean;
48
+ /** Armed for IFC2X3 -> IFC4, with the exporter's id allocator. */
49
+ private get upgrading();
50
+ /** The kind and loads of an IFC2X3 varying action `toIfc4` converts, or undefined. */
51
+ private upgradeLoads;
40
52
  private toIfc4;
41
53
  private toIfc2x3;
42
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schema-converter-structural-varying.d.ts","sourceRoot":"","sources":["../src/schema-converter-structural-varying.ts"],"names":[],"mappings":"AACA,oEAAoE;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA8BrD,MAAM,WAAW,OAAO;IAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE;AAGtF;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAC5B,sFAAsF;IACtF,GAAG,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,IAAI,CAAwC;IACpD,OAAO,CAAC,IAAI,CAAkD;IAC9D,4DAA4D;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,qGAAqG;IACrG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgE;IAExF,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IA6B9D;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAsBjC,OAAO,CAAC,MAAM;IAEd,kFAAkF;IAClF,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS;IAIrE,iGAAiG;IACjG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