@ifc-lite/export 4.13.3 → 5.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.
- package/dist/affected-set.d.ts.map +1 -1
- package/dist/affected-set.js +9 -2
- package/dist/affected-set.js.map +1 -1
- package/dist/anonymize-export.js +2 -2
- package/dist/anonymize-export.js.map +1 -1
- package/dist/anonymize-scrub.js +3 -3
- package/dist/anonymize-scrub.js.map +1 -1
- package/dist/appearance-dependencies.js +1 -1
- package/dist/appearance-dependencies.js.map +1 -1
- package/dist/attribute-real-slots.js +1 -1
- package/dist/attribute-real-slots.js.map +1 -1
- package/dist/attribute-slot-types.d.ts.map +1 -1
- package/dist/attribute-slot-types.js +22 -14
- package/dist/attribute-slot-types.js.map +1 -1
- package/dist/authored-resource-cleanup.js +1 -1
- package/dist/authored-resource-cleanup.js.map +1 -1
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +5 -4
- package/dist/declared-property-type.js.map +1 -1
- package/dist/edit-ownership.d.ts +8 -0
- package/dist/edit-ownership.d.ts.map +1 -1
- package/dist/edit-ownership.js +58 -44
- package/dist/edit-ownership.js.map +1 -1
- package/dist/effective-index-created-rows.d.ts +22 -0
- package/dist/effective-index-created-rows.d.ts.map +1 -0
- package/dist/effective-index-created-rows.js +48 -0
- package/dist/effective-index-created-rows.js.map +1 -0
- package/dist/effective-index.d.ts.map +1 -1
- package/dist/effective-index.js +4 -3
- package/dist/effective-index.js.map +1 -1
- package/dist/effective-source-record.js +1 -1
- package/dist/effective-source-record.js.map +1 -1
- package/dist/entity-subgraph.d.ts +6 -2
- package/dist/entity-subgraph.d.ts.map +1 -1
- package/dist/entity-subgraph.js +70 -5
- package/dist/entity-subgraph.js.map +1 -1
- package/dist/entity-type-sets.d.ts +2 -19
- package/dist/entity-type-sets.d.ts.map +1 -1
- package/dist/entity-type-sets.js +14 -4
- package/dist/entity-type-sets.js.map +1 -1
- package/dist/georef-closure.d.ts +12 -0
- package/dist/georef-closure.d.ts.map +1 -1
- package/dist/georef-closure.js +3 -1
- package/dist/georef-closure.js.map +1 -1
- package/dist/ifc4-registry.d.ts +14 -0
- package/dist/ifc4-registry.d.ts.map +1 -0
- package/dist/ifc4-registry.js +22 -0
- package/dist/ifc4-registry.js.map +1 -0
- package/dist/ifc5-effective-rows.js +1 -1
- package/dist/ifc5-effective-rows.js.map +1 -1
- package/dist/ifc5-exporter.d.ts.map +1 -1
- package/dist/ifc5-exporter.js +3 -10
- package/dist/ifc5-exporter.js.map +1 -1
- package/dist/ifc5-tree-scope.js +2 -2
- package/dist/ifc5-tree-scope.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/lod0-generator.d.ts.map +1 -1
- package/dist/lod0-generator.js +14 -8
- package/dist/lod0-generator.js.map +1 -1
- package/dist/merged-bake.d.ts +32 -0
- package/dist/merged-bake.d.ts.map +1 -0
- package/dist/merged-bake.js +120 -0
- package/dist/merged-bake.js.map +1 -0
- package/dist/merged-context.d.ts +49 -6
- package/dist/merged-context.d.ts.map +1 -1
- package/dist/merged-context.js +165 -53
- package/dist/merged-context.js.map +1 -1
- package/dist/merged-exporter.d.ts +7 -14
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +48 -113
- package/dist/merged-exporter.js.map +1 -1
- package/dist/merged-georef-normalize.d.ts +54 -0
- package/dist/merged-georef-normalize.d.ts.map +1 -0
- package/dist/merged-georef-normalize.js +260 -0
- package/dist/merged-georef-normalize.js.map +1 -0
- package/dist/merged-project-contexts.d.ts +12 -0
- package/dist/merged-project-contexts.d.ts.map +1 -0
- package/dist/merged-project-contexts.js +56 -0
- package/dist/merged-project-contexts.js.map +1 -0
- package/dist/merged-remap.d.ts +2 -0
- package/dist/merged-remap.d.ts.map +1 -1
- package/dist/merged-remap.js +10 -0
- package/dist/merged-remap.js.map +1 -1
- package/dist/merged-subcontext.d.ts +22 -0
- package/dist/merged-subcontext.d.ts.map +1 -1
- package/dist/merged-subcontext.js +14 -18
- package/dist/merged-subcontext.js.map +1 -1
- package/dist/nonrel-positional-ref-narrowing.js +6 -6
- package/dist/nonrel-positional-ref-narrowing.js.map +1 -1
- package/dist/nonrel-ref-list-types.d.ts +4 -4
- package/dist/nonrel-ref-list-types.d.ts.map +1 -1
- package/dist/nonrel-ref-list-types.js +19 -7
- package/dist/nonrel-ref-list-types.js.map +1 -1
- package/dist/parquet-created-entity-rows.js +1 -1
- package/dist/parquet-created-entity-rows.js.map +1 -1
- package/dist/parquet-relationship-rows.js +1 -1
- package/dist/parquet-relationship-rows.js.map +1 -1
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +2 -2
- package/dist/reference-collector.js.map +1 -1
- package/dist/registry-entity-names.d.ts +6 -2
- package/dist/registry-entity-names.d.ts.map +1 -1
- package/dist/registry-entity-names.js +10 -2
- package/dist/registry-entity-names.js.map +1 -1
- package/dist/relationship-slot-bounds.js +4 -4
- package/dist/relationship-slot-bounds.js.map +1 -1
- package/dist/remesh-context-roots.d.ts +13 -6
- package/dist/remesh-context-roots.d.ts.map +1 -1
- package/dist/remesh-context-roots.js +51 -22
- package/dist/remesh-context-roots.js.map +1 -1
- package/dist/renumber-step-ids.d.ts +43 -0
- package/dist/renumber-step-ids.d.ts.map +1 -0
- package/dist/renumber-step-ids.js +237 -0
- package/dist/renumber-step-ids.js.map +1 -0
- package/dist/retype.d.ts.map +1 -1
- package/dist/retype.js +23 -12
- package/dist/retype.js.map +1 -1
- package/dist/schema-conversion-description.d.ts +6 -0
- package/dist/schema-conversion-description.d.ts.map +1 -0
- package/dist/schema-conversion-description.js +25 -0
- package/dist/schema-conversion-description.js.map +1 -0
- package/dist/schema-conversion-loss-report.d.ts +20 -34
- package/dist/schema-conversion-loss-report.d.ts.map +1 -1
- package/dist/schema-conversion-loss-report.js +177 -14
- package/dist/schema-conversion-loss-report.js.map +1 -1
- package/dist/schema-converter-attr-maps.d.ts +51 -0
- package/dist/schema-converter-attr-maps.d.ts.map +1 -0
- package/dist/schema-converter-attr-maps.js +142 -0
- package/dist/schema-converter-attr-maps.js.map +1 -0
- package/dist/schema-converter-attr-remap.d.ts +8 -0
- package/dist/schema-converter-attr-remap.d.ts.map +1 -1
- package/dist/schema-converter-attr-remap.js +15 -1
- package/dist/schema-converter-attr-remap.js.map +1 -1
- package/dist/schema-converter-document-links.d.ts +23 -0
- package/dist/schema-converter-document-links.d.ts.map +1 -0
- package/dist/schema-converter-document-links.js +146 -0
- package/dist/schema-converter-document-links.js.map +1 -0
- package/dist/schema-converter-enums.d.ts +13 -1
- package/dist/schema-converter-enums.d.ts.map +1 -1
- package/dist/schema-converter-enums.js +30 -4
- package/dist/schema-converter-enums.js.map +1 -1
- package/dist/schema-converter-ifc4-slots.d.ts +4 -3
- package/dist/schema-converter-ifc4-slots.d.ts.map +1 -1
- package/dist/schema-converter-ifc4-slots.js +4 -3
- package/dist/schema-converter-ifc4-slots.js.map +1 -1
- package/dist/schema-converter-renames.d.ts +17 -0
- package/dist/schema-converter-renames.d.ts.map +1 -1
- package/dist/schema-converter-renames.js +34 -2
- package/dist/schema-converter-renames.js.map +1 -1
- package/dist/schema-converter-retyped.d.ts +17 -0
- package/dist/schema-converter-retyped.d.ts.map +1 -0
- package/dist/schema-converter-retyped.js +68 -0
- package/dist/schema-converter-retyped.js.map +1 -0
- package/dist/schema-converter-structural-axes.d.ts +55 -0
- package/dist/schema-converter-structural-axes.d.ts.map +1 -0
- package/dist/schema-converter-structural-axes.js +378 -0
- package/dist/schema-converter-structural-axes.js.map +1 -0
- package/dist/schema-converter-structural-carriers.d.ts +76 -0
- package/dist/schema-converter-structural-carriers.d.ts.map +1 -0
- package/dist/schema-converter-structural-carriers.js +330 -0
- package/dist/schema-converter-structural-carriers.js.map +1 -0
- package/dist/schema-converter-structural-diagnostics.d.ts +64 -0
- package/dist/schema-converter-structural-diagnostics.d.ts.map +1 -0
- package/dist/schema-converter-structural-diagnostics.js +219 -0
- package/dist/schema-converter-structural-diagnostics.js.map +1 -0
- package/dist/schema-converter-structural-links.d.ts +21 -0
- package/dist/schema-converter-structural-links.d.ts.map +1 -0
- package/dist/schema-converter-structural-links.js +38 -0
- package/dist/schema-converter-structural-links.js.map +1 -0
- package/dist/schema-converter-structural-source.d.ts +76 -0
- package/dist/schema-converter-structural-source.d.ts.map +1 -0
- package/dist/schema-converter-structural-source.js +197 -0
- package/dist/schema-converter-structural-source.js.map +1 -0
- package/dist/schema-converter-structural-thickness.d.ts +33 -0
- package/dist/schema-converter-structural-thickness.d.ts.map +1 -0
- package/dist/schema-converter-structural-thickness.js +155 -0
- package/dist/schema-converter-structural-thickness.js.map +1 -0
- package/dist/schema-converter-structural-varying.d.ts +50 -0
- package/dist/schema-converter-structural-varying.d.ts.map +1 -0
- package/dist/schema-converter-structural-varying.js +170 -0
- package/dist/schema-converter-structural-varying.js.map +1 -0
- package/dist/schema-converter-structural.d.ts +8 -0
- package/dist/schema-converter-structural.d.ts.map +1 -0
- package/dist/schema-converter-structural.js +81 -0
- package/dist/schema-converter-structural.js.map +1 -0
- package/dist/schema-converter-userdefined-label.d.ts +8 -0
- package/dist/schema-converter-userdefined-label.d.ts.map +1 -0
- package/dist/schema-converter-userdefined-label.js +60 -0
- package/dist/schema-converter-userdefined-label.js.map +1 -0
- package/dist/schema-converter-userdefined.d.ts +15 -0
- package/dist/schema-converter-userdefined.d.ts.map +1 -0
- package/dist/schema-converter-userdefined.js +59 -0
- package/dist/schema-converter-userdefined.js.map +1 -0
- package/dist/schema-converter-value-forms.d.ts +12 -0
- package/dist/schema-converter-value-forms.d.ts.map +1 -0
- package/dist/schema-converter-value-forms.js +188 -0
- package/dist/schema-converter-value-forms.js.map +1 -0
- package/dist/schema-converter.d.ts +2 -8
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +57 -68
- package/dist/schema-converter.js.map +1 -1
- package/dist/schema-enum-policy.d.ts +5 -1
- package/dist/schema-enum-policy.d.ts.map +1 -1
- package/dist/schema-enum-policy.js +21 -1
- package/dist/schema-enum-policy.js.map +1 -1
- package/dist/schema-grid-frames.d.ts +19 -0
- package/dist/schema-grid-frames.d.ts.map +1 -0
- package/dist/schema-grid-frames.js +84 -0
- package/dist/schema-grid-frames.js.map +1 -0
- package/dist/schema-ifc2x3-placements.d.ts +12 -0
- package/dist/schema-ifc2x3-placements.d.ts.map +1 -0
- package/dist/schema-ifc2x3-placements.js +297 -0
- package/dist/schema-ifc2x3-placements.js.map +1 -0
- package/dist/schema-ifc2x3-records.d.ts +58 -0
- package/dist/schema-ifc2x3-records.d.ts.map +1 -0
- package/dist/schema-ifc2x3-records.js +179 -0
- package/dist/schema-ifc2x3-records.js.map +1 -0
- package/dist/schema-style-flatten.d.ts +7 -2
- package/dist/schema-style-flatten.d.ts.map +1 -1
- package/dist/schema-style-flatten.js +34 -2
- package/dist/schema-style-flatten.js.map +1 -1
- package/dist/schema-value-form-policy.d.ts +129 -0
- package/dist/schema-value-form-policy.d.ts.map +1 -0
- package/dist/schema-value-form-policy.js +222 -0
- package/dist/schema-value-form-policy.js.map +1 -0
- package/dist/section-export.d.ts.map +1 -1
- package/dist/section-export.js +3 -2
- package/dist/section-export.js.map +1 -1
- package/dist/select-qualification.d.ts.map +1 -1
- package/dist/select-qualification.js +6 -5
- package/dist/select-qualification.js.map +1 -1
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +5 -0
- package/dist/step-collection.js.map +1 -1
- package/dist/step-comment-skip.d.ts +8 -0
- package/dist/step-comment-skip.d.ts.map +1 -1
- package/dist/step-comment-skip.js +28 -0
- package/dist/step-comment-skip.js.map +1 -1
- package/dist/step-coordinate-options.d.ts +15 -0
- package/dist/step-coordinate-options.d.ts.map +1 -1
- package/dist/step-coordinate-options.js +13 -1
- package/dist/step-coordinate-options.js.map +1 -1
- package/dist/step-derived-quantities.d.ts +23 -0
- package/dist/step-derived-quantities.d.ts.map +1 -0
- package/dist/step-derived-quantities.js +50 -0
- package/dist/step-derived-quantities.js.map +1 -0
- package/dist/step-export-types.d.ts +2 -1
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts +0 -6
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +11 -7
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-georeferencing.d.ts +2 -0
- package/dist/step-georeferencing.d.ts.map +1 -1
- package/dist/step-georeferencing.js +122 -46
- package/dist/step-georeferencing.js.map +1 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +4 -1
- package/dist/step-header.js.map +1 -1
- package/dist/step-internal-pset-ids.d.ts +7 -0
- package/dist/step-internal-pset-ids.d.ts.map +1 -0
- package/dist/step-internal-pset-ids.js +25 -0
- package/dist/step-internal-pset-ids.js.map +1 -0
- package/dist/step-map-unit-normalization.d.ts.map +1 -1
- package/dist/step-map-unit-normalization.js +10 -3
- package/dist/step-map-unit-normalization.js.map +1 -1
- package/dist/step-map-unit.d.ts +8 -1
- package/dist/step-map-unit.d.ts.map +1 -1
- package/dist/step-map-unit.js +13 -5
- package/dist/step-map-unit.js.map +1 -1
- package/dist/step-native-set-record.d.ts +2 -0
- package/dist/step-native-set-record.d.ts.map +1 -1
- package/dist/step-native-set-record.js +10 -0
- package/dist/step-native-set-record.js.map +1 -1
- package/dist/step-omission-predicates.d.ts.map +1 -1
- package/dist/step-omission-predicates.js +1 -0
- package/dist/step-omission-predicates.js.map +1 -1
- package/dist/step-overlay-entities.d.ts +0 -35
- package/dist/step-overlay-entities.d.ts.map +1 -1
- package/dist/step-overlay-entities.js +40 -4
- package/dist/step-overlay-entities.js.map +1 -1
- package/dist/step-overlay-property-base.d.ts +13 -0
- package/dist/step-overlay-property-base.d.ts.map +1 -0
- package/dist/step-overlay-property-base.js +30 -0
- package/dist/step-overlay-property-base.js.map +1 -0
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js +13 -0
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-property-set-collection.d.ts.map +1 -1
- package/dist/step-property-set-collection.js +7 -2
- package/dist/step-property-set-collection.js.map +1 -1
- package/dist/step-property-set-generators.d.ts.map +1 -1
- package/dist/step-property-set-generators.js +8 -4
- package/dist/step-property-set-generators.js.map +1 -1
- package/dist/step-property-set-index.js +1 -1
- package/dist/step-property-set-index.js.map +1 -1
- package/dist/step-property-set-readers.d.ts.map +1 -1
- package/dist/step-property-set-readers.js +6 -5
- package/dist/step-property-set-readers.js.map +1 -1
- package/dist/step-pset-copy-on-write.d.ts.map +1 -1
- package/dist/step-pset-copy-on-write.js +9 -7
- package/dist/step-pset-copy-on-write.js.map +1 -1
- package/dist/step-record-frame.d.ts +5 -3
- package/dist/step-record-frame.d.ts.map +1 -1
- package/dist/step-record-frame.js +12 -8
- package/dist/step-record-frame.js.map +1 -1
- package/dist/step-ref-scan.d.ts +7 -0
- package/dist/step-ref-scan.d.ts.map +1 -1
- package/dist/step-ref-scan.js +24 -3
- package/dist/step-ref-scan.js.map +1 -1
- package/dist/step-serialization.d.ts +13 -1
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +29 -2
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-shared-atom-retention.js +1 -1
- package/dist/step-shared-atom-retention.js.map +1 -1
- package/dist/step-slot-grammar.d.ts +2 -0
- package/dist/step-slot-grammar.d.ts.map +1 -1
- package/dist/step-slot-grammar.js +5 -0
- package/dist/step-slot-grammar.js.map +1 -1
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +7 -2
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/subset-entity-reader.d.ts.map +1 -1
- package/dist/subset-entity-reader.js +15 -8
- package/dist/subset-entity-reader.js.map +1 -1
- package/dist/subset-roots.d.ts +4 -14
- package/dist/subset-roots.d.ts.map +1 -1
- package/dist/subset-roots.js +14 -4
- package/dist/subset-roots.js.map +1 -1
- package/dist/unit-normalize.d.ts.map +1 -1
- package/dist/unit-normalize.js +4 -3
- package/dist/unit-normalize.js.map +1 -1
- package/dist/viewer-georef-scale.d.ts +14 -0
- package/dist/viewer-georef-scale.d.ts.map +1 -0
- package/dist/viewer-georef-scale.js +20 -0
- package/dist/viewer-georef-scale.js.map +1 -0
- package/package.json +43 -10
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MPL-2.0 */
|
|
2
|
+
/**
|
|
3
|
+
* IfcDocumentInformation <-> IfcDocumentReference: the link IFC4 moved to the
|
|
4
|
+
* other record (#10846). IFC2X3 lists a document's references in
|
|
5
|
+
* `IfcDocumentInformation.DocumentReferences`; IFC4 made that an inverse and
|
|
6
|
+
* points each reference at its document with
|
|
7
|
+
* `IfcDocumentReference.ReferencedDocument`. A line converter can only write
|
|
8
|
+
* `$` for the slot on the other record, so this prepass reads the links from
|
|
9
|
+
* the source and `apply` writes them: on an upgrade, ReferencedDocument on
|
|
10
|
+
* each listed reference; on a downgrade, DocumentReferences on each document
|
|
11
|
+
* a reference names.
|
|
12
|
+
*
|
|
13
|
+
* IFC2X3 lets one document list a reference (`ReferenceToDocument : SET
|
|
14
|
+
* [0:1]`), so a reference listed again keeps its first document and the
|
|
15
|
+
* extra listing is reported. WR1 (`EXISTS(Name) XOR EXISTS(the document)`,
|
|
16
|
+
* in both schemas) leaves the name to the document, so a listed reference with
|
|
17
|
+
* a Name already breaks IFC2X3 WR1; the upgrade drops that Name, reported. One
|
|
18
|
+
* whose Name is all that identifies it (IfcExternalReference.WR1 needs
|
|
19
|
+
* Location, Identification or Name) keeps the Name and is not linked,
|
|
20
|
+
* reported. Types come from the source, so only an unedited full export arms
|
|
21
|
+
* it. Twin of Rust `schema_document_links.rs`.
|
|
22
|
+
*/
|
|
23
|
+
import { attrNameTable } from './schema-converter.js';
|
|
24
|
+
import { listItems } from './schema-converter-structural-axes.js';
|
|
25
|
+
import { slotRef, slotUnset } from './schema-converter-structural-source.js';
|
|
26
|
+
import { readStepSlots } from './step-argument-parser.js';
|
|
27
|
+
const DOC = 'IFCDOCUMENTINFORMATION';
|
|
28
|
+
const REF = 'IFCDOCUMENTREFERENCE';
|
|
29
|
+
const ifc4Like = (s) => s === 'IFC4' || s === 'IFC4X3';
|
|
30
|
+
/** Whether a conversion between the schemas can move the link. */
|
|
31
|
+
export const documentLinksApply = (from, to) => (from === 'IFC2X3' && ifc4Like(to)) || (to === 'IFC2X3' && ifc4Like(from));
|
|
32
|
+
export class DocumentLinks {
|
|
33
|
+
/** The index of the link slot in the converted record; -1 until armed. */
|
|
34
|
+
at = -1;
|
|
35
|
+
/** The converted reference's Name slot on an upgrade; -1 otherwise. */
|
|
36
|
+
nameAt = -1;
|
|
37
|
+
/** Source references whose Name an upgrade drops for WR1 (the loss report). */
|
|
38
|
+
unnamed = new Set();
|
|
39
|
+
/** Listed source references an upgrade leaves unlinked: a Name is all that identifies them. */
|
|
40
|
+
nameOnly = new Set();
|
|
41
|
+
/** Converted record id -> the value its link slot takes. */
|
|
42
|
+
fill = new Map();
|
|
43
|
+
/** Source records whose link attribute this writes on the other side, by that attribute (the loss report). */
|
|
44
|
+
restored = new Map();
|
|
45
|
+
listedAgain = 0;
|
|
46
|
+
fromSource(source, from, to) {
|
|
47
|
+
if (!documentLinksApply(from, to))
|
|
48
|
+
return;
|
|
49
|
+
const names = (schema, type) => attrNameTable(schema)?.get(type);
|
|
50
|
+
const up = from === 'IFC2X3';
|
|
51
|
+
// The side that holds the link in the source, its slot, and the slot it moves to.
|
|
52
|
+
const [holder, target] = up ? [DOC, REF] : [REF, DOC];
|
|
53
|
+
const readAt = names(from, holder)?.indexOf(up ? 'DocumentReferences' : 'ReferencedDocument') ?? -1;
|
|
54
|
+
const at = names(to, target)?.indexOf(up ? 'ReferencedDocument' : 'DocumentReferences') ?? -1;
|
|
55
|
+
if (readAt < 0 || at < 0)
|
|
56
|
+
return;
|
|
57
|
+
const targets = new Set(source.ids(target));
|
|
58
|
+
// A holder whose slot count is not the source schema's is not read.
|
|
59
|
+
const holders = source.ids(holder).flatMap((id) => {
|
|
60
|
+
const slots = source.slots(id);
|
|
61
|
+
return slots && slots.length === names(from, holder).length ? [{ id, link: slots[readAt] }] : [];
|
|
62
|
+
});
|
|
63
|
+
const link = new Set([up ? 'DocumentReferences' : 'ReferencedDocument']);
|
|
64
|
+
if (up) {
|
|
65
|
+
// IFC2X3 IfcDocumentReference: Location, ItemReference, Name.
|
|
66
|
+
const set = (ref, i) => { const slot = source.slots(ref)?.[i]; return slot !== undefined && !slotUnset(slot); };
|
|
67
|
+
const named = new Set([...targets].filter((ref) => set(ref, 2)));
|
|
68
|
+
for (const ref of named)
|
|
69
|
+
if (!set(ref, 0) && !set(ref, 1))
|
|
70
|
+
targets.delete(ref);
|
|
71
|
+
for (const { id: doc, link: listed } of holders) {
|
|
72
|
+
const members = listItems(listed) ?? [];
|
|
73
|
+
const tag = `#${doc}`;
|
|
74
|
+
let whole = members.length > 0;
|
|
75
|
+
for (const member of members) {
|
|
76
|
+
const ref = slotRef(member);
|
|
77
|
+
const first = ref === null ? undefined : this.fill.get(ref);
|
|
78
|
+
if (ref !== null && named.has(ref) && !targets.has(ref))
|
|
79
|
+
this.nameOnly.add(ref);
|
|
80
|
+
if (ref === null || !targets.has(ref))
|
|
81
|
+
whole = false;
|
|
82
|
+
else if (first === undefined)
|
|
83
|
+
this.fill.set(ref, tag);
|
|
84
|
+
// A repeat inside one list is not a second document.
|
|
85
|
+
else if (first !== tag) {
|
|
86
|
+
this.listedAgain++;
|
|
87
|
+
whole = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (whole)
|
|
91
|
+
this.restored.set(doc, link);
|
|
92
|
+
}
|
|
93
|
+
for (const ref of this.fill.keys())
|
|
94
|
+
if (named.has(ref))
|
|
95
|
+
this.unnamed.add(ref);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const lists = new Map();
|
|
99
|
+
for (const { id: ref, link: named } of holders) {
|
|
100
|
+
const doc = slotRef(named);
|
|
101
|
+
if (doc === null || !targets.has(doc))
|
|
102
|
+
continue;
|
|
103
|
+
this.restored.set(ref, link);
|
|
104
|
+
const list = lists.get(doc) ?? [];
|
|
105
|
+
list.push(`#${ref}`);
|
|
106
|
+
lists.set(doc, list);
|
|
107
|
+
}
|
|
108
|
+
for (const [doc, members] of lists)
|
|
109
|
+
this.fill.set(doc, `(${members.join(',')})`);
|
|
110
|
+
}
|
|
111
|
+
if (this.fill.size === 0)
|
|
112
|
+
return;
|
|
113
|
+
this.at = at;
|
|
114
|
+
if (up)
|
|
115
|
+
this.nameAt = names(to, REF)?.indexOf('Name') ?? -1;
|
|
116
|
+
}
|
|
117
|
+
/** `line`, already converted, with its link slot written. */
|
|
118
|
+
apply(line) {
|
|
119
|
+
if (this.at < 0)
|
|
120
|
+
return line;
|
|
121
|
+
const id = Number(/^\s*#(\d+)/.exec(line)?.[1]);
|
|
122
|
+
const value = this.fill.get(id);
|
|
123
|
+
const record = value ? readStepSlots(line) : null;
|
|
124
|
+
if (!record || !slotUnset(record.slots[this.at]))
|
|
125
|
+
return line;
|
|
126
|
+
const slots = [...record.slots];
|
|
127
|
+
slots[this.at] = value;
|
|
128
|
+
if (this.nameAt >= 0 && this.nameAt < slots.length && this.unnamed.has(id))
|
|
129
|
+
slots[this.nameAt] = '$';
|
|
130
|
+
return `${record.prefix}${slots.join(',')}${record.suffix}`;
|
|
131
|
+
}
|
|
132
|
+
warnings() {
|
|
133
|
+
return [
|
|
134
|
+
...(this.listedAgain > 0
|
|
135
|
+
? [`${this.listedAgain} IfcDocumentReference listing(s) past a reference's first IfcDocumentInformation were dropped: IFC4 ReferencedDocument names one document (#10846).`]
|
|
136
|
+
: []),
|
|
137
|
+
...(this.unnamed.size > 0
|
|
138
|
+
? [`${this.unnamed.size} IfcDocumentReference Name(s) were dropped (the source breaks IFC2X3 WR1 too): IFC4 WR1 gives a reference a Name only when it has no ReferencedDocument, whose Name stands (#10846).`]
|
|
139
|
+
: []),
|
|
140
|
+
...(this.nameOnly.size > 0
|
|
141
|
+
? [`${this.nameOnly.size} IfcDocumentReference(s) identified only by Name keep it and lose their IfcDocumentInformation link (the source breaks IFC2X3 WR1): IFC4 WR1 forbids Name beside ReferencedDocument, and IfcExternalReference.WR1 needs Location, Identification or Name (#10846).`]
|
|
142
|
+
: []),
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=schema-converter-document-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-converter-document-links.js","sourceRoot":"","sources":["../src/schema-converter-document-links.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,aAAa,EAAyB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAsB,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,GAAG,GAAG,wBAAwB,CAAC;AACrC,MAAM,GAAG,GAAG,sBAAsB,CAAC;AACnC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,QAAQ,CAAC;AAE/D,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAU,EAAW,EAAE,CACtE,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAE7E,MAAM,OAAO,aAAa;IACxB,0EAA0E;IAClE,EAAE,GAAG,CAAC,CAAC,CAAC;IAChB,uEAAuE;IAC/D,MAAM,GAAG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AAC;YACP,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC;gBACxB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,oQAAoQ,CAAC;gBAC7R,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -14,12 +14,24 @@
|
|
|
14
14
|
* record whose arity is not the target's is left alone, the same guard the
|
|
15
15
|
* required-slot passes use (position `i` need not be attribute `i`).
|
|
16
16
|
*/
|
|
17
|
+
import { StructuralDiagnostics } from './schema-converter-structural-diagnostics.js';
|
|
18
|
+
import { DocumentLinks } from './schema-converter-document-links.js';
|
|
19
|
+
import { ValueForms } from './schema-converter-value-forms.js';
|
|
17
20
|
import { type SchemaVersionWithRegistry } from '@ifc-lite/parser';
|
|
18
21
|
/** Enum reconciliation for one export: rewrites, and counts what it lost. */
|
|
19
22
|
export declare class EnumReconciliation {
|
|
23
|
+
/** Reuses this per-export collector so both STEP writers forward structural losses. */
|
|
24
|
+
readonly structural: StructuralDiagnostics;
|
|
25
|
+
/** The IfcDocumentInformation <-> IfcDocumentReference link (#10846). */
|
|
26
|
+
readonly documents: DocumentLinks;
|
|
27
|
+
/** Values a target slot's type cannot hold (#10847). */
|
|
28
|
+
readonly forms: ValueForms;
|
|
20
29
|
private readonly losses;
|
|
21
|
-
/**
|
|
30
|
+
/** Records written `.USERDEFINED.` with the label their rule needs unset, per type (#10780). */
|
|
31
|
+
private readonly unlabelled;
|
|
32
|
+
/** Reconcile `line`, already converted to `toSchema`, then report a broken USERDEFINED rule (#10780). */
|
|
22
33
|
apply(line: string, toSchema: SchemaVersionWithRegistry): string;
|
|
34
|
+
private reconcile;
|
|
23
35
|
/** One warning per loss kind, naming what it happened to (#5365). */
|
|
24
36
|
warnings(): string[];
|
|
25
37
|
private record;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-enums.d.ts","sourceRoot":"","sources":["../src/schema-converter-enums.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA+B,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-converter-enums.d.ts","sourceRoot":"","sources":["../src/schema-converter-enums.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAA+B,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AA6C/F,6EAA6E;AAC7E,qBAAa,kBAAkB;IAC7B,uFAAuF;IACvF,QAAQ,CAAC,UAAU,wBAA+B;IAClD,yEAAyE;IACzE,QAAQ,CAAC,SAAS,gBAAuB;IACzC,wDAAwD;IACxD,QAAQ,CAAC,KAAK,aAAoB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,gGAAgG;IAChG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IAExD,yGAAyG;IACzG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,yBAAyB,GAAG,MAAM;IAShE,OAAO,CAAC,SAAS;IAyCjB,qEAAqE;IACrE,QAAQ,IAAI,MAAM,EAAE;IAcpB,OAAO,CAAC,MAAM;CAKf"}
|
|
@@ -17,9 +17,14 @@
|
|
|
17
17
|
* record whose arity is not the target's is left alone, the same guard the
|
|
18
18
|
* required-slot passes use (position `i` need not be attribute `i`).
|
|
19
19
|
*/
|
|
20
|
+
import { StructuralDiagnostics } from './schema-converter-structural-diagnostics.js';
|
|
21
|
+
import { DocumentLinks } from './schema-converter-document-links.js';
|
|
22
|
+
import { ValueForms } from './schema-converter-value-forms.js';
|
|
20
23
|
import { getSchemaRegistryForVersion } from '@ifc-lite/parser';
|
|
21
24
|
import { escapeStepString } from './step-serialization.js';
|
|
22
|
-
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
25
|
+
import { readStepSlots, splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
26
|
+
import { breaksUserDefinedRule, userDefinedRule } from './schema-converter-userdefined.js';
|
|
27
|
+
import { isUnset } from './schema-converter-userdefined-label.js';
|
|
23
28
|
import { resolveMissingEnumMember } from './schema-enum-policy.js';
|
|
24
29
|
const TARGETS = new Map();
|
|
25
30
|
function targetEntities(schema) {
|
|
@@ -50,9 +55,26 @@ const LOSS_TEXT = {
|
|
|
50
55
|
};
|
|
51
56
|
/** Enum reconciliation for one export: rewrites, and counts what it lost. */
|
|
52
57
|
export class EnumReconciliation {
|
|
58
|
+
/** Reuses this per-export collector so both STEP writers forward structural losses. */
|
|
59
|
+
structural = new StructuralDiagnostics();
|
|
60
|
+
/** The IfcDocumentInformation <-> IfcDocumentReference link (#10846). */
|
|
61
|
+
documents = new DocumentLinks();
|
|
62
|
+
/** Values a target slot's type cannot hold (#10847). */
|
|
63
|
+
forms = new ValueForms();
|
|
53
64
|
losses = new Map();
|
|
54
|
-
/**
|
|
65
|
+
/** Records written `.USERDEFINED.` with the label their rule needs unset, per type (#10780). */
|
|
66
|
+
unlabelled = new Map();
|
|
67
|
+
/** Reconcile `line`, already converted to `toSchema`, then report a broken USERDEFINED rule (#10780). */
|
|
55
68
|
apply(line, toSchema) {
|
|
69
|
+
const out = this.reconcile(line, toSchema);
|
|
70
|
+
// Only a record that says USERDEFINED can break the rule; the rest stop here.
|
|
71
|
+
const record = /\.USERDEFINED\./i.test(out) ? readStepSlots(out) : null;
|
|
72
|
+
const rule = record ? userDefinedRule(toSchema, record.type) : undefined;
|
|
73
|
+
if (record && rule && breaksUserDefinedRule(record.slots, rule))
|
|
74
|
+
this.unlabelled.set(record.type, (this.unlabelled.get(record.type) ?? 0) + 1);
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
reconcile(line, toSchema) {
|
|
56
78
|
const open = line.indexOf('(');
|
|
57
79
|
const close = line.lastIndexOf(')');
|
|
58
80
|
const eq = line.indexOf('=');
|
|
@@ -75,7 +97,7 @@ export class EnumReconciliation {
|
|
|
75
97
|
switch (resolution.kind) {
|
|
76
98
|
case 'userdefined':
|
|
77
99
|
values[index] = '.USERDEFINED.';
|
|
78
|
-
if (values[resolution.labelIndex]
|
|
100
|
+
if (isUnset(values[resolution.labelIndex]))
|
|
79
101
|
values[resolution.labelIndex] = `'${escapeStepString(member)}'`;
|
|
80
102
|
else
|
|
81
103
|
this.record('userdefined-label-occupied', where);
|
|
@@ -106,7 +128,11 @@ export class EnumReconciliation {
|
|
|
106
128
|
const total = [...where.values()].reduce((a, b) => a + b, 0);
|
|
107
129
|
out.push(`${total} enum value(s) the target schema does not define were ${LOSS_TEXT[loss]}: ${[...where.keys()].join(', ')} (#5365).`);
|
|
108
130
|
}
|
|
109
|
-
|
|
131
|
+
if (this.unlabelled.size > 0) {
|
|
132
|
+
const total = [...this.unlabelled.values()].reduce((a, b) => a + b, 0);
|
|
133
|
+
out.push(`${total} record(s) say .USERDEFINED. without the label their rule needs; none is invented: ${[...this.unlabelled.keys()].join(', ')} (#10780).`);
|
|
134
|
+
}
|
|
135
|
+
return [...out, ...this.documents.warnings(), ...this.forms.warnings(), ...this.structural.warnings()];
|
|
110
136
|
}
|
|
111
137
|
record(loss, where) {
|
|
112
138
|
const bucket = this.losses.get(loss) ?? new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-enums.js","sourceRoot":"","sources":["../src/schema-converter-enums.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,2BAA2B,EAAkC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC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AAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACvE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,sFAAsF,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7J,CAAC;QACD,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzG,CAAC;IAEO,MAAM,CAAC,IAAU,EAAE,KAAa;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAkB,CAAC;QAClE,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
* problem (#5202 finding 1). The count surfaces as one warning, so the caller
|
|
16
16
|
* learns the file is not valid IFC4 instead of receiving an invented value.
|
|
17
17
|
*
|
|
18
|
-
* `convertStepLine`
|
|
19
|
-
* IFC2X3 → IFC4
|
|
20
|
-
* `
|
|
18
|
+
* `convertStepLine` consults this for `fromSchema` `'IFC4X3'`/`'IFC5'`, and for
|
|
19
|
+
* the IFC2X3 → IFC4 records a structural rewrite or an attribute map wrote
|
|
20
|
+
* (`upgradeCountsIfc4Slots`, #10763). The rest of IFC2X3 → IFC4 is a separately
|
|
21
|
+
* audited upgrade path, pinned byte-for-byte by `schema-converter-door-window-type.test.ts`.
|
|
21
22
|
*/
|
|
22
23
|
export declare class Ifc4SlotCheck {
|
|
23
24
|
/** Required slots left `$`. Counted per SLOT: one record can leave several. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-ifc4-slots.d.ts","sourceRoot":"","sources":["../src/schema-converter-ifc4-slots.ts"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"schema-converter-ifc4-slots.d.ts","sourceRoot":"","sources":["../src/schema-converter-ifc4-slots.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IACxB,+EAA+E;IAC/E,OAAO,CAAC,gBAAgB,CAAK;IAE7B,iFAAiF;IACjF,QAAQ,IAAI,MAAM,EAAE;IASpB;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAc5B"}
|
|
@@ -24,9 +24,10 @@ const NULL_TOKEN = /^(?:\s|\/\*[\s\S]*?\*\/)*\$(?:\s|\/\*[\s\S]*?\*\/)*$/;
|
|
|
24
24
|
* problem (#5202 finding 1). The count surfaces as one warning, so the caller
|
|
25
25
|
* learns the file is not valid IFC4 instead of receiving an invented value.
|
|
26
26
|
*
|
|
27
|
-
* `convertStepLine`
|
|
28
|
-
* IFC2X3 → IFC4
|
|
29
|
-
* `
|
|
27
|
+
* `convertStepLine` consults this for `fromSchema` `'IFC4X3'`/`'IFC5'`, and for
|
|
28
|
+
* the IFC2X3 → IFC4 records a structural rewrite or an attribute map wrote
|
|
29
|
+
* (`upgradeCountsIfc4Slots`, #10763). The rest of IFC2X3 → IFC4 is a separately
|
|
30
|
+
* audited upgrade path, pinned byte-for-byte by `schema-converter-door-window-type.test.ts`.
|
|
30
31
|
*/
|
|
31
32
|
export class Ifc4SlotCheck {
|
|
32
33
|
/** Required slots left `$`. Counted per SLOT: one record can leave several. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-ifc4-slots.js","sourceRoot":"","sources":["../src/schema-converter-ifc4-slots.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAyB,MAAM,oCAAoC,CAAC;AAEhG,qEAAqE;AACrE,MAAM,OAAO,GACX,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvF,mEAAmE;AACnE,MAAM,UAAU,GAAG,sDAAsD,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"schema-converter-ifc4-slots.js","sourceRoot":"","sources":["../src/schema-converter-ifc4-slots.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAyB,MAAM,oCAAoC,CAAC;AAEhG,qEAAqE;AACrE,MAAM,OAAO,GACX,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvF,mEAAmE;AACnE,MAAM,UAAU,GAAG,sDAAsD,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,aAAa;IACxB,+EAA+E;IACvE,gBAAgB,GAAG,CAAC,CAAC;IAE7B,iFAAiF;IACjF,QAAQ;QACN,IAAI,IAAI,CAAC,gBAAgB,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAC3C,OAAO;YACL,GAAG,IAAI,CAAC,gBAAgB,yEAAyE;gBACjG,6FAA6F;gBAC7F,qCAAqC;SACtC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAY;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,KAAK,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QACvD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACvE,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACvE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAChE,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -17,6 +17,23 @@
|
|
|
17
17
|
*/
|
|
18
18
|
/** Entity type -> `[older name, newer name]` pairs. */
|
|
19
19
|
export declare const POSITIONAL_RENAMES: Readonly<Record<string, ReadonlyArray<readonly [string, string]>>>;
|
|
20
|
+
/**
|
|
21
|
+
* Attributes a schema REPLACED IN PLACE (#10758): same index, different
|
|
22
|
+
* concept. Entity type -> `[older name, newer name]`.
|
|
23
|
+
*
|
|
24
|
+
* IfcAsymmetricIShapeProfileDef's slot 11 went from `CentreOfGravityInY` to
|
|
25
|
+
* `BottomFlangeEdgeRadius` (IFC4 ADD2 TC1: "Name changed"). The pair is read as
|
|
26
|
+
* one name for the prefix test, so the record still reaches the target's arity,
|
|
27
|
+
* but {@link replacedSlot} has the converter write `$` there and the loss report
|
|
28
|
+
* name the source attribute. Twin of Rust `POSITIONAL_REPLACEMENTS`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const POSITIONAL_REPLACEMENTS: Readonly<Record<string, readonly [string, string]>>;
|
|
31
|
+
/**
|
|
32
|
+
* The index at which `src` and `tgt` hold the two sides of `entityType`'s
|
|
33
|
+
* {@link POSITIONAL_REPLACEMENTS} pair, in either order. Twin of Rust
|
|
34
|
+
* `replaced_slot`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function replacedSlot(entityType: string, src: readonly string[], tgt: readonly string[]): number | undefined;
|
|
20
37
|
/**
|
|
21
38
|
* True when `shorter` is a STRICT prefix of `longer` by attribute name, with
|
|
22
39
|
* the in-place renames of `entityType` read as one name: the longer form only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-renames.d.ts","sourceRoot":"","sources":["../src/schema-converter-renames.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,uDAAuD;AACvD,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"schema-converter-renames.d.ts","sourceRoot":"","sources":["../src/schema-converter-renames.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,uDAAuD;AACvD,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAiBjG,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAEvF,CAAC;AASF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAKnH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAMT"}
|
|
@@ -32,10 +32,42 @@ export const POSITIONAL_RENAMES = {
|
|
|
32
32
|
IFCWORKSCHEDULE: [['Identifier', 'Identification'], ['WorkControlType', 'PredefinedType']],
|
|
33
33
|
IFCPROPERTYBOUNDEDVALUE: [['Description', 'Specification']],
|
|
34
34
|
IFCPROPERTYTABLEVALUE: [['Description', 'Specification']],
|
|
35
|
+
IFCASYMMETRICISHAPEPROFILEDEF: [
|
|
36
|
+
['OverallWidth', 'BottomFlangeWidth'], ['FlangeThickness', 'BottomFlangeThickness'], ['FilletRadius', 'BottomFlangeFilletRadius'],
|
|
37
|
+
],
|
|
38
|
+
IFCTRANSPORTELEMENT: [['OperationType', 'PredefinedType']],
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Attributes a schema REPLACED IN PLACE (#10758): same index, different
|
|
42
|
+
* concept. Entity type -> `[older name, newer name]`.
|
|
43
|
+
*
|
|
44
|
+
* IfcAsymmetricIShapeProfileDef's slot 11 went from `CentreOfGravityInY` to
|
|
45
|
+
* `BottomFlangeEdgeRadius` (IFC4 ADD2 TC1: "Name changed"). The pair is read as
|
|
46
|
+
* one name for the prefix test, so the record still reaches the target's arity,
|
|
47
|
+
* but {@link replacedSlot} has the converter write `$` there and the loss report
|
|
48
|
+
* name the source attribute. Twin of Rust `POSITIONAL_REPLACEMENTS`.
|
|
49
|
+
*/
|
|
50
|
+
export const POSITIONAL_REPLACEMENTS = {
|
|
51
|
+
IFCASYMMETRICISHAPEPROFILEDEF: ['CentreOfGravityInY', 'BottomFlangeEdgeRadius'],
|
|
35
52
|
};
|
|
36
53
|
function newerName(entityType, name) {
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
if (entityType === undefined)
|
|
55
|
+
return name;
|
|
56
|
+
const renamed = POSITIONAL_RENAMES[entityType]?.find(([older]) => older === name)?.[1];
|
|
57
|
+
const replaced = POSITIONAL_REPLACEMENTS[entityType];
|
|
58
|
+
return renamed ?? (replaced?.[0] === name ? replaced[1] : name);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The index at which `src` and `tgt` hold the two sides of `entityType`'s
|
|
62
|
+
* {@link POSITIONAL_REPLACEMENTS} pair, in either order. Twin of Rust
|
|
63
|
+
* `replaced_slot`.
|
|
64
|
+
*/
|
|
65
|
+
export function replacedSlot(entityType, src, tgt) {
|
|
66
|
+
const pair = POSITIONAL_REPLACEMENTS[entityType];
|
|
67
|
+
if (!pair)
|
|
68
|
+
return undefined;
|
|
69
|
+
const slot = src.findIndex((name, i) => (name === pair[0] && tgt[i] === pair[1]) || (name === pair[1] && tgt[i] === pair[0]));
|
|
70
|
+
return slot < 0 ? undefined : slot;
|
|
39
71
|
}
|
|
40
72
|
/**
|
|
41
73
|
* True when `shorter` is a STRICT prefix of `longer` by attribute name, with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-converter-renames.js","sourceRoot":"","sources":["../src/schema-converter-renames.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;GAgBG;AAEH,uDAAuD;A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AAC,KAAK,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same-named attributes IFC4 RETYPED IN PLACE between a STEP enumeration and
|
|
3
|
+
* a string (#10778). An upgraded IFC2X3 `IFCMONETARYUNIT(.EUR.)` put an enum
|
|
4
|
+
* into IFC4's `IfcLabel` slot, and a downgraded `IFCMONETARYUNIT('EUR')` a
|
|
5
|
+
* string into IFC2X3's enum slot. An upgrade writes the member as a label; a
|
|
6
|
+
* downgrade writes a label that names a member as that member and anything
|
|
7
|
+
* else as `$` (the IFC2X3 slot fill then reports the required slot).
|
|
8
|
+
*
|
|
9
|
+
* Twin of Rust `schema_retyped.rs`. Rust compares its table with
|
|
10
|
+
* `rust/export/tests/fixtures/schema_retyped_slots.json`; the TypeScript test
|
|
11
|
+
* holds this one to it by behaviour, code by code.
|
|
12
|
+
*/
|
|
13
|
+
import type { IfcSchemaVersion } from './schema-converter.js';
|
|
14
|
+
/** `line`, already converted from `fromSchema` to `toSchema`, with every
|
|
15
|
+
* retyped slot in the target's type. `null` passes through. */
|
|
16
|
+
export declare function retypeInPlace(line: string | null, fromSchema: IfcSchemaVersion, toSchema: IfcSchemaVersion): string | null;
|
|
17
|
+
//# sourceMappingURL=schema-converter-retyped.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-converter-retyped.d.ts","sourceRoot":"","sources":["../src/schema-converter-retyped.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAmC9D;gEACgE;AAChE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAwB1H"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { stepRecordHead } from './step-record-frame.js';
|
|
5
|
+
import { readStepSlots } from './step-argument-parser.js';
|
|
6
|
+
import { decodeStepStringLiteral, stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
7
|
+
import { skipStepTrivia } from './step-slot-grammar.js';
|
|
8
|
+
/** IFC2X3 `IfcCurrencyEnum`. */
|
|
9
|
+
const CURRENCY = [
|
|
10
|
+
'AED', 'AES', 'ATS', 'AUD', 'BBD', 'BEG', 'BGL', 'BHD', 'BMD', 'BND', 'BRL', 'BSD',
|
|
11
|
+
'BWP', 'BZD', 'CAD', 'CBD', 'CHF', 'CLP', 'CNY', 'CYS', 'CZK', 'DDP', 'DEM', 'DKK',
|
|
12
|
+
'EGL', 'EST', 'EUR', 'FAK', 'FIM', 'FJD', 'FKP', 'FRF', 'GBP', 'GIP', 'GMD', 'GRX',
|
|
13
|
+
'HKD', 'HUF', 'ICK', 'IDR', 'ILS', 'INR', 'IRP', 'ITL', 'JMD', 'JOD', 'JPY', 'KES',
|
|
14
|
+
'KRW', 'KWD', 'KYD', 'LKR', 'LUF', 'MTL', 'MUR', 'MXN', 'MYR', 'NLG', 'NZD', 'OMR',
|
|
15
|
+
'PGK', 'PHP', 'PKR', 'PLN', 'PTN', 'QAR', 'RUR', 'SAR', 'SCR', 'SEK', 'SGD', 'SKP',
|
|
16
|
+
'THB', 'TRL', 'TTD', 'TWD', 'USD', 'VEB', 'VND', 'XEU', 'ZAR', 'ZWD', 'NOK',
|
|
17
|
+
];
|
|
18
|
+
/** One retyped slot: `[type, index, IFC2X3 enumeration members]`. */
|
|
19
|
+
const RETYPED_SLOTS = [['IFCMONETARYUNIT', 0, CURRENCY]];
|
|
20
|
+
// IFC5 holds Currency as IFC4X3 does; the retype reads values, not attribute lists.
|
|
21
|
+
/** The one enum or string token in `slot`, past the whitespace and comments
|
|
22
|
+
* around it; null for anything else. Twin of Rust `sole_value`. */
|
|
23
|
+
function soleValue(slot) {
|
|
24
|
+
const start = skipStepTrivia(slot, 0);
|
|
25
|
+
let end = -1;
|
|
26
|
+
if (slot[start] === "'")
|
|
27
|
+
end = stepStringLiteralEnd(slot, start);
|
|
28
|
+
else if (slot[start] === '.')
|
|
29
|
+
end = slot.indexOf('.', start + 1) + 1 || -1;
|
|
30
|
+
return start !== -1 && end !== -1 && skipStepTrivia(slot, end) === slot.length ? slot.slice(start, end) : null;
|
|
31
|
+
}
|
|
32
|
+
const ifc4Like = (s) => s === 'IFC4' || s === 'IFC4X3' || s === 'IFC5';
|
|
33
|
+
/** `s` with only a-z upper-cased (members are ASCII upper-case). */
|
|
34
|
+
const asciiUpper = (s) => s.replace(/[a-z]+/g, (run) => run.toUpperCase());
|
|
35
|
+
/** `line`, already converted from `fromSchema` to `toSchema`, with every
|
|
36
|
+
* retyped slot in the target's type. `null` passes through. */
|
|
37
|
+
export function retypeInPlace(line, fromSchema, toSchema) {
|
|
38
|
+
const up = fromSchema === 'IFC2X3' && ifc4Like(toSchema);
|
|
39
|
+
if (line === null || (!up && !(toSchema === 'IFC2X3' && ifc4Like(fromSchema))))
|
|
40
|
+
return line;
|
|
41
|
+
// The head alone names the type; most records stop here.
|
|
42
|
+
const head = stepRecordHead(line);
|
|
43
|
+
const slot = head && RETYPED_SLOTS.find(([t]) => t === line.slice(head.typeStart, head.typeEnd).toUpperCase());
|
|
44
|
+
const record = slot ? readStepSlots(line) : null;
|
|
45
|
+
if (!slot || !record || slot[1] >= record.slots.length)
|
|
46
|
+
return line;
|
|
47
|
+
const slots = [...record.slots];
|
|
48
|
+
const value = soleValue(slots[slot[1]]);
|
|
49
|
+
if (value === null)
|
|
50
|
+
return line;
|
|
51
|
+
const inner = value.slice(1, -1); // untrimmed, as Rust: only the decoded label trims, ASCII-only
|
|
52
|
+
if (up) {
|
|
53
|
+
if (!value.startsWith('.') || !value.endsWith('.'))
|
|
54
|
+
return line;
|
|
55
|
+
slots[slot[1]] = `'${inner}'`;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (!value.startsWith("'") || !value.endsWith("'"))
|
|
59
|
+
return line;
|
|
60
|
+
// A label may spell the code in a STEP encoding (`\X2\0045...\X0\`). Case and
|
|
61
|
+
// whitespace fold ASCII only, as in Rust: `ıNR` is no `INR` (#10806 review).
|
|
62
|
+
const label = asciiUpper(decodeStepStringLiteral(inner).replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, ''));
|
|
63
|
+
const member = slot[2].find((m) => m === label);
|
|
64
|
+
slots[slot[1]] = member ? `.${member}.` : '$';
|
|
65
|
+
}
|
|
66
|
+
return `${record.prefix}${slots.join(',')}${record.suffix}`;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=schema-converter-retyped.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-converter-retyped.js","sourceRoot":"","sources":["../src/schema-converter-retyped.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAgB/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,gCAAgC;AAChC,MAAM,QAAQ,GAAsB;IAClC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IAClF,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,E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AK,KAAK,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAChD,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type SourceRecords, type StructuralRewrite } from './schema-converter-structural-source.js';
|
|
2
|
+
export declare function listItems(token: string | undefined): readonly string[] | null;
|
|
3
|
+
export declare class StructuralAxes {
|
|
4
|
+
/** The exporter's express-id allocator, shared with every other record it appends. */
|
|
5
|
+
ids: (() => number) | null;
|
|
6
|
+
private readonly pending;
|
|
7
|
+
/** Upgrade: member id -> its one ProfileOrientation, or null when its associations disagree. */
|
|
8
|
+
private readonly axes;
|
|
9
|
+
/** Direction id -> its ratios, for the directions a member or an association names. */
|
|
10
|
+
private readonly directions;
|
|
11
|
+
/** Upgrade: member id -> its placement's rotation, for members with an orientation. */
|
|
12
|
+
private readonly memberFrames;
|
|
13
|
+
/** Upgrade: direction value key -> the first source direction with it; built only when a member is turned. */
|
|
14
|
+
private readonly byValue;
|
|
15
|
+
/** Upgrade: member id -> the Axis written for it (`axis` is asked twice per member). */
|
|
16
|
+
private readonly filled;
|
|
17
|
+
/** Upgrade: carrier records left out. */
|
|
18
|
+
private readonly consumed;
|
|
19
|
+
/** Downgrade: association id -> the Axis that fills its unset orientation. */
|
|
20
|
+
private readonly fills;
|
|
21
|
+
private source;
|
|
22
|
+
/** Downgrade: member id -> its Axis and where it travels: an association it has (with its slots), or a new one (null). */
|
|
23
|
+
private readonly carried;
|
|
24
|
+
/** Reads one IFC2X3 record; `fromStore` reads them all. */
|
|
25
|
+
note(line: string): void;
|
|
26
|
+
private readRelation;
|
|
27
|
+
fromStore(source: SourceRecords, from: string, to: string): void;
|
|
28
|
+
/** The ratios of direction `id`, read once. */
|
|
29
|
+
private direction;
|
|
30
|
+
/** IFC2X3 -> IFC4: the carrier associations to leave out, each only an Axis the upgrade then fills. */
|
|
31
|
+
private findCarriers;
|
|
32
|
+
/** IFC4 -> IFC2X3: how each member's Axis travels, or nothing for one that cannot. */
|
|
33
|
+
private planCarriers;
|
|
34
|
+
/** The direction id naming `world`: the member's own Axis when its frame is unturned, else a new record. */
|
|
35
|
+
private worldDirection;
|
|
36
|
+
/**
|
|
37
|
+
* IFC2X3 -> IFC4: the Axis of a curve member, from its one ProfileOrientation
|
|
38
|
+
* turned into its placement frame, or undefined. Angles and conflicting
|
|
39
|
+
* orientations stay unknown; a tangent does not give a section axis.
|
|
40
|
+
*/
|
|
41
|
+
axis(line: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the target holds this member's Axis as planned: `hold` writes a new
|
|
44
|
+
* association, the member's one already holds it, or the writer converts the
|
|
45
|
+
* one `rewrite` fills.
|
|
46
|
+
*/
|
|
47
|
+
fillWritten(id: number): boolean;
|
|
48
|
+
/** IFC4 -> IFC2X3: the message when this member's Axis travels in an association, writing a new one when it needs it; else null. */
|
|
49
|
+
hold(id: number, args: readonly string[], withheld: ReadonlySet<number> | undefined): string | null;
|
|
50
|
+
/** The target body of a carrier record: left out on the upgrade, an association given the orientation on the downgrade. */
|
|
51
|
+
rewrite(id: number, args: readonly string[], withheld: ReadonlySet<number> | undefined): StructuralRewrite | undefined;
|
|
52
|
+
/** Records written so far, to append after the source records. */
|
|
53
|
+
added(): string[];
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=schema-converter-structural-axes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-converter-structural-axes.d.ts","sourceRoot":"","sources":["../src/schema-converter-structural-axes.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAiE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MA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